diff --git a/EMBOS/.cproject b/EMBOS/.cproject new file mode 100644 index 0000000..cd7cf5f --- /dev/null +++ b/EMBOS/.cproject @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/EMBOS/.gitignore b/EMBOS/.gitignore new file mode 100644 index 0000000..0478634 --- /dev/null +++ b/EMBOS/.gitignore @@ -0,0 +1,3 @@ +# 忽略文件 + +/Debug \ No newline at end of file diff --git a/EMBOS/.mxproject b/EMBOS/.mxproject new file mode 100644 index 0000000..89bdaaf --- /dev/null +++ b/EMBOS/.mxproject @@ -0,0 +1,38 @@ +[PreviousLibFiles] +LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sdram.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sdram.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h; + +[PreviousUsedCubeIDEFiles] +SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\can.c;Core\Src\fmc.c;Core\Src\spi.c;Core\Src\tim.c;Core\Src\usart.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c;Core\Src/system_stm32f4xx.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c;Core\Src/system_stm32f4xx.c;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;; +HeaderPath=Drivers\STM32F4xx_HAL_Driver\Inc;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F4xx\Include;Drivers\CMSIS\Include;Core\Inc; +CDefines=USE_FULL_LL_DRIVER;USE_HAL_DRIVER;STM32F446xx;USE_FULL_LL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER; + +[PreviousGenFiles] +AdvancedFolderStructure=true +HeaderFileListSize=10 +HeaderFiles#0=D:/GAOS/EMBOS/Core/Inc/gpio.h +HeaderFiles#1=D:/GAOS/EMBOS/Core/Inc/can.h +HeaderFiles#2=D:/GAOS/EMBOS/Core/Inc/fmc.h +HeaderFiles#3=D:/GAOS/EMBOS/Core/Inc/spi.h +HeaderFiles#4=D:/GAOS/EMBOS/Core/Inc/tim.h +HeaderFiles#5=D:/GAOS/EMBOS/Core/Inc/usart.h +HeaderFiles#6=D:/GAOS/EMBOS/Core/Inc/stm32f4xx_it.h +HeaderFiles#7=D:/GAOS/EMBOS/Core/Inc/stm32_assert.h +HeaderFiles#8=D:/GAOS/EMBOS/Core/Inc/stm32f4xx_hal_conf.h +HeaderFiles#9=D:/GAOS/EMBOS/Core/Inc/main.h +HeaderFolderListSize=1 +HeaderPath#0=D:/GAOS/EMBOS/Core/Inc +HeaderFiles=; +SourceFileListSize=9 +SourceFiles#0=D:/GAOS/EMBOS/Core/Src/gpio.c +SourceFiles#1=D:/GAOS/EMBOS/Core/Src/can.c +SourceFiles#2=D:/GAOS/EMBOS/Core/Src/fmc.c +SourceFiles#3=D:/GAOS/EMBOS/Core/Src/spi.c +SourceFiles#4=D:/GAOS/EMBOS/Core/Src/tim.c +SourceFiles#5=D:/GAOS/EMBOS/Core/Src/usart.c +SourceFiles#6=D:/GAOS/EMBOS/Core/Src/stm32f4xx_it.c +SourceFiles#7=D:/GAOS/EMBOS/Core/Src/stm32f4xx_hal_msp.c +SourceFiles#8=D:/GAOS/EMBOS/Core/Src/main.c +SourceFolderListSize=1 +SourcePath#0=D:/GAOS/EMBOS/Core/Src +SourceFiles=; + diff --git a/EMBOS/.project b/EMBOS/.project new file mode 100644 index 0000000..cb1ce9c --- /dev/null +++ b/EMBOS/.project @@ -0,0 +1,45 @@ + + + EMBOS + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.st.stm32cube.ide.mcu.MCUProjectNature + com.st.stm32cube.ide.mcu.MCUCubeProjectNature + org.eclipse.cdt.core.cnature + com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature + com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature + com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature + com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature + com.st.stm32cube.ide.mcu.MCURootProjectNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + NxBase + 2 + WORKSPACE_LOC/NxBase + + + NxFuncs + 2 + WORKSPACE_LOC/NxFuncs + + + diff --git a/EMBOS/.settings/language.settings.xml b/EMBOS/.settings/language.settings.xml new file mode 100644 index 0000000..b6fe201 --- /dev/null +++ b/EMBOS/.settings/language.settings.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/EMBOS/.settings/org.eclipse.cdt.core.prefs b/EMBOS/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000..c8ec5df --- /dev/null +++ b/EMBOS/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,6 @@ +doxygen/doxygen_new_line_after_brief=true +doxygen/doxygen_use_brief_tag=false +doxygen/doxygen_use_javadoc_tags=true +doxygen/doxygen_use_pre_tag=false +doxygen/doxygen_use_structural_commands=false +eclipse.preferences.version=1 diff --git a/EMBOS/.settings/org.eclipse.core.resources.prefs b/EMBOS/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..bb29a1d --- /dev/null +++ b/EMBOS/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=GBK diff --git a/EMBOS/.settings/stm32cubeide.project.prefs b/EMBOS/.settings/stm32cubeide.project.prefs new file mode 100644 index 0000000..3f9da6a --- /dev/null +++ b/EMBOS/.settings/stm32cubeide.project.prefs @@ -0,0 +1,5 @@ +2F62501ED4689FB349E356AB974DBE57=446C1940AE0DC624DF9E59F46D5411EC +635E684B79701B039C64EA45C3F84D30=4BA934B5501A5478417C4EB18A4C5819 +8DF89ED150041C4CBC7CB9A9CAA90856=446C1940AE0DC624DF9E59F46D5411EC +DC22A860405A8BF2F2C095E5B6529F12=AF3508E355F7C558D6934CB5DEED1D7F +eclipse.preferences.version=1 diff --git a/EMBOS/.vscode/settings.json b/EMBOS/.vscode/settings.json new file mode 100644 index 0000000..4044c5f --- /dev/null +++ b/EMBOS/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "datafile.h": "c" + } +} \ No newline at end of file diff --git a/EMBOS/Core/Inc/can.h b/EMBOS/Core/Inc/can.h new file mode 100644 index 0000000..ed4ff9b --- /dev/null +++ b/EMBOS/Core/Inc/can.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * @file can.h + * @brief This file contains all the function prototypes for + * the can.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __CAN_H__ +#define __CAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +extern CAN_HandleTypeDef hcan1; + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_CAN1_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CAN_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/fmc.h b/EMBOS/Core/Inc/fmc.h new file mode 100644 index 0000000..8d39349 --- /dev/null +++ b/EMBOS/Core/Inc/fmc.h @@ -0,0 +1,64 @@ +/** + ****************************************************************************** + * File Name : FMC.h + * Description : This file provides code for the configuration + * of the FMC peripheral. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __FMC_H +#define __FMC_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +extern SRAM_HandleTypeDef hsram1; +extern SDRAM_HandleTypeDef hsdram1; +extern SDRAM_HandleTypeDef hsdram2; + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_FMC_Init(void); +void HAL_SRAM_MspInit(SRAM_HandleTypeDef* hsram); +void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram); +void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef* hsdram); +void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef* hsdram); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif +#endif /*__FMC_H */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/gpio.h b/EMBOS/Core/Inc/gpio.h new file mode 100644 index 0000000..3149c8f --- /dev/null +++ b/EMBOS/Core/Inc/gpio.h @@ -0,0 +1,49 @@ +/** + ****************************************************************************** + * @file gpio.h + * @brief This file contains all the function prototypes for + * the gpio.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __GPIO_H__ +#define __GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_GPIO_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif +#endif /*__ GPIO_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/main.h b/EMBOS/Core/Inc/main.h new file mode 100644 index 0000000..e9e15e3 --- /dev/null +++ b/EMBOS/Core/Inc/main.h @@ -0,0 +1,102 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.h + * @brief : Header for main.c file. + * This file contains the common defines of the application. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAIN_H +#define __MAIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" +#include "stm32f4xx_hal.h" +#include "stm32f4xx_ll_rcc.h" +#include "stm32f4xx_ll_bus.h" +#include "stm32f4xx_ll_system.h" +#include "stm32f4xx_ll_exti.h" +#include "stm32f4xx_ll_cortex.h" +#include "stm32f4xx_ll_utils.h" +#include "stm32f4xx_ll_pwr.h" +#include "stm32f4xx_ll_dma.h" +#include "stm32f4xx_ll_spi.h" +#include "stm32f4xx_ll_tim.h" +#include "stm32f4xx_ll_usart.h" +#include "stm32f4xx_ll_gpio.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void Error_Handler(void); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +/* Private defines -----------------------------------------------------------*/ +#define LED_Pin LL_GPIO_PIN_13 +#define LED_GPIO_Port GPIOC +#define W5500_RST_Pin LL_GPIO_PIN_14 +#define W5500_RST_GPIO_Port GPIOC +#define W5500_INT_Pin LL_GPIO_PIN_15 +#define W5500_INT_GPIO_Port GPIOC +#define W5500_INT_EXTI_IRQn EXTI15_10_IRQn +#define SPI1_NSS_Pin LL_GPIO_PIN_4 +#define SPI1_NSS_GPIO_Port GPIOA +#define SPI2_NSS_Pin LL_GPIO_PIN_12 +#define SPI2_NSS_GPIO_Port GPIOB +#define USART6_EN_Pin LL_GPIO_PIN_8 +#define USART6_EN_GPIO_Port GPIOC +#define SPI3_NSS_Pin LL_GPIO_PIN_15 +#define SPI3_NSS_GPIO_Port GPIOA +#define FPGA_12K_INT_Pin LL_GPIO_PIN_6 +#define FPGA_12K_INT_GPIO_Port GPIOD +#define FPGA_12K_INT_EXTI_IRQn EXTI9_5_IRQn +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIN_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/spi.h b/EMBOS/Core/Inc/spi.h new file mode 100644 index 0000000..a2d5fbd --- /dev/null +++ b/EMBOS/Core/Inc/spi.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * @file spi.h + * @brief This file contains all the function prototypes for + * the spi.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __SPI_H__ +#define __SPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_SPI1_Init(void); +void MX_SPI2_Init(void); +void MX_SPI3_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __SPI_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/stm32_assert.h b/EMBOS/Core/Inc/stm32_assert.h new file mode 100644 index 0000000..03511c4 --- /dev/null +++ b/EMBOS/Core/Inc/stm32_assert.h @@ -0,0 +1,53 @@ +/** + ****************************************************************************** + * @file stm32_assert.h + * @brief STM32 assert file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2018 STMicroelectronics. + * All rights reserved.

+ * + * 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****/ diff --git a/EMBOS/Core/Inc/stm32f4xx_hal_conf.h b/EMBOS/Core/Inc/stm32f4xx_hal_conf.h new file mode 100644 index 0000000..0a9fef8 --- /dev/null +++ b/EMBOS/Core/Inc/stm32f4xx_hal_conf.h @@ -0,0 +1,486 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf_template.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32f4xx_hal_conf.h. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_CONF_H +#define __STM32F4xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED + + /* #define HAL_ADC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +#define HAL_CAN_MODULE_ENABLED +/* #define HAL_CRC_MODULE_ENABLED */ +/* #define HAL_CAN_LEGACY_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +/* #define HAL_DAC_MODULE_ENABLED */ +/* #define HAL_DCMI_MODULE_ENABLED */ +/* #define HAL_DMA2D_MODULE_ENABLED */ +/* #define HAL_ETH_MODULE_ENABLED */ +/* #define HAL_NAND_MODULE_ENABLED */ +/* #define HAL_NOR_MODULE_ENABLED */ +/* #define HAL_PCCARD_MODULE_ENABLED */ +#define HAL_SRAM_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +/* #define HAL_HASH_MODULE_ENABLED */ +/* #define HAL_I2C_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_LTDC_MODULE_ENABLED */ +/* #define HAL_RNG_MODULE_ENABLED */ +/* #define HAL_RTC_MODULE_ENABLED */ +/* #define HAL_SAI_MODULE_ENABLED */ +/* #define HAL_SD_MODULE_ENABLED */ +/* #define HAL_MMC_MODULE_ENABLED */ +/* #define HAL_SPI_MODULE_ENABLED */ +/* #define HAL_TIM_MODULE_ENABLED */ +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +/* #define HAL_PCD_MODULE_ENABLED */ +/* #define HAL_HCD_MODULE_ENABLED */ +/* #define HAL_DSI_MODULE_ENABLED */ +/* #define HAL_QSPI_MODULE_ENABLED */ +/* #define HAL_QSPI_MODULE_ENABLED */ +/* #define HAL_CEC_MODULE_ENABLED */ +/* #define HAL_FMPI2C_MODULE_ENABLED */ +/* #define HAL_SPDIFRX_MODULE_ENABLED */ +/* #define HAL_DFSDM_MODULE_ENABLED */ +/* #define HAL_LPTIM_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) + #define HSE_VALUE ((uint32_t)12000000U) /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) + #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz + The real value may vary depending on the variations + in voltage and temperature.*/ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#if !defined (LSE_VALUE) + #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#if !defined (EXTERNAL_CLOCK_VALUE) + #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 1U +#define INSTRUCTION_CACHE_ENABLE 1U +#define DATA_CACHE_ENABLE 1U + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC 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_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA 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_MMC_REGISTER_CALLBACKS 0U /* MMC 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_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD 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_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_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_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY ((uint32_t)0x000000FFU) +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU) + +#define PHY_READ_TO ((uint32_t)0x0000FFFFU) +#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU) + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver +* Activated: CRC code is present inside driver +* Deactivated: CRC code cleaned from driver +*/ + +#define USE_SPI_CRC 0U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED + #include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED + #include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED + #include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED + #include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED + #include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED + #include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED + #include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED + #include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED + #include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED + #include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED + #include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED + #include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED + #include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED + #include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED + #include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED + #include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED + #include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED + #include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED + #include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED + #include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED + #include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED + #include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED + #include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED + #include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ + #define assert_param(expr) ((expr) ? (void)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 /* __STM32F4xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/stm32f4xx_it.h b/EMBOS/Core/Inc/stm32f4xx_it.h new file mode 100644 index 0000000..842cdda --- /dev/null +++ b/EMBOS/Core/Inc/stm32f4xx_it.h @@ -0,0 +1,81 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f4xx_it.h + * @brief This file contains the headers of the interrupt handlers. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_IT_H +#define __STM32F4xx_IT_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void NMI_Handler(void); +void HardFault_Handler(void); +void MemManage_Handler(void); +void BusFault_Handler(void); +void UsageFault_Handler(void); +void SVC_Handler(void); +void DebugMon_Handler(void); +void PendSV_Handler(void); +void SysTick_Handler(void); +void CAN1_TX_IRQHandler(void); +void CAN1_RX0_IRQHandler(void); +void EXTI9_5_IRQHandler(void); +void TIM1_BRK_TIM9_IRQHandler(void); +void TIM1_UP_TIM10_IRQHandler(void); +void TIM1_TRG_COM_TIM11_IRQHandler(void); +void USART1_IRQHandler(void); +void EXTI15_10_IRQHandler(void); +void TIM8_BRK_TIM12_IRQHandler(void); +void TIM8_UP_TIM13_IRQHandler(void); +void TIM8_TRG_COM_TIM14_IRQHandler(void); +void USART6_IRQHandler(void); +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_IT_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/tim.h b/EMBOS/Core/Inc/tim.h new file mode 100644 index 0000000..e0e48ac --- /dev/null +++ b/EMBOS/Core/Inc/tim.h @@ -0,0 +1,56 @@ +/** + ****************************************************************************** + * @file tim.h + * @brief This file contains all the function prototypes for + * the tim.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __TIM_H__ +#define __TIM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_TIM8_Init(void); +void MX_TIM9_Init(void); +void MX_TIM10_Init(void); +void MX_TIM11_Init(void); +void MX_TIM12_Init(void); +void MX_TIM13_Init(void); +void MX_TIM14_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIM_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Inc/usart.h b/EMBOS/Core/Inc/usart.h new file mode 100644 index 0000000..24463f5 --- /dev/null +++ b/EMBOS/Core/Inc/usart.h @@ -0,0 +1,51 @@ +/** + ****************************************************************************** + * @file usart.h + * @brief This file contains all the function prototypes for + * the usart.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __USART_H__ +#define __USART_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_USART1_UART_Init(void); +void MX_USART6_UART_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USART_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/can.c b/EMBOS/Core/Src/can.c new file mode 100644 index 0000000..209293c --- /dev/null +++ b/EMBOS/Core/Src/can.c @@ -0,0 +1,117 @@ +/** + ****************************************************************************** + * @file can.c + * @brief This file provides code for the configuration + * of the CAN instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "can.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +CAN_HandleTypeDef hcan1; + +/* CAN1 init function */ +void MX_CAN1_Init(void) +{ + + hcan1.Instance = CAN1; + hcan1.Init.Prescaler = 5; + hcan1.Init.Mode = CAN_MODE_NORMAL; + hcan1.Init.SyncJumpWidth = CAN_SJW_2TQ; + hcan1.Init.TimeSeg1 = CAN_BS1_14TQ; + hcan1.Init.TimeSeg2 = CAN_BS2_3TQ; + hcan1.Init.TimeTriggeredMode = DISABLE; + hcan1.Init.AutoBusOff = ENABLE; + hcan1.Init.AutoWakeUp = DISABLE; + hcan1.Init.AutoRetransmission = ENABLE; + hcan1.Init.ReceiveFifoLocked = DISABLE; + hcan1.Init.TransmitFifoPriority = DISABLE; + if (HAL_CAN_Init(&hcan1) != HAL_OK) + { + Error_Handler(); + } + +} + +void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle) +{ + + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(canHandle->Instance==CAN1) + { + /* USER CODE BEGIN CAN1_MspInit 0 */ + + /* USER CODE END CAN1_MspInit 0 */ + /* CAN1 clock enable */ + __HAL_RCC_CAN1_CLK_ENABLE(); + + __HAL_RCC_GPIOB_CLK_ENABLE(); + /**CAN1 GPIO Configuration + PB8 ------> CAN1_RX + PB9 ------> CAN1_TX + */ + GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF9_CAN1; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /* CAN1 interrupt Init */ + HAL_NVIC_SetPriority(CAN1_TX_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(CAN1_TX_IRQn); + HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn); + /* USER CODE BEGIN CAN1_MspInit 1 */ + + /* USER CODE END CAN1_MspInit 1 */ + } +} + +void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle) +{ + + if(canHandle->Instance==CAN1) + { + /* USER CODE BEGIN CAN1_MspDeInit 0 */ + + /* USER CODE END CAN1_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_CAN1_CLK_DISABLE(); + + /**CAN1 GPIO Configuration + PB8 ------> CAN1_RX + PB9 ------> CAN1_TX + */ + HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9); + + /* CAN1 interrupt Deinit */ + HAL_NVIC_DisableIRQ(CAN1_TX_IRQn); + HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn); + /* USER CODE BEGIN CAN1_MspDeInit 1 */ + + /* USER CODE END CAN1_MspDeInit 1 */ + } +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/fmc.c b/EMBOS/Core/Src/fmc.c new file mode 100644 index 0000000..914c27c --- /dev/null +++ b/EMBOS/Core/Src/fmc.c @@ -0,0 +1,399 @@ +/** + ****************************************************************************** + * File Name : FMC.c + * Description : This file provides code for the configuration + * of the FMC peripheral. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "fmc.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +SRAM_HandleTypeDef hsram1; +SDRAM_HandleTypeDef hsdram1; +SDRAM_HandleTypeDef hsdram2; + +/* FMC initialization function */ +void MX_FMC_Init(void) +{ + /* USER CODE BEGIN FMC_Init 0 */ + + /* USER CODE END FMC_Init 0 */ + + FMC_NORSRAM_TimingTypeDef Timing = {0}; + FMC_SDRAM_TimingTypeDef SdramTiming = {0}; + + /* USER CODE BEGIN FMC_Init 1 */ + + /* USER CODE END FMC_Init 1 */ + + /** Perform the SRAM1 memory initialization sequence + */ + hsram1.Instance = FMC_NORSRAM_DEVICE; + hsram1.Extended = FMC_NORSRAM_EXTENDED_DEVICE; + /* hsram1.Init */ + hsram1.Init.NSBank = FMC_NORSRAM_BANK1; + hsram1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE; + hsram1.Init.MemoryType = FMC_MEMORY_TYPE_SRAM; + hsram1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16; + hsram1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE; + hsram1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW; + hsram1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS; + hsram1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE; + hsram1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE; + hsram1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE; + hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE; + hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE; + hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY; + hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE; + hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE; + /* Timing */ + Timing.AddressSetupTime = 3; + Timing.AddressHoldTime = 15; + Timing.DataSetupTime = 3; + Timing.BusTurnAroundDuration = 1; + Timing.CLKDivision = 16; + Timing.DataLatency = 17; + Timing.AccessMode = FMC_ACCESS_MODE_A; + /* ExtTiming */ + + if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK) + { + Error_Handler( ); + } + + /** Perform the SDRAM1 memory initialization sequence + */ + hsdram1.Instance = FMC_SDRAM_DEVICE; + /* hsdram1.Init */ + hsdram1.Init.SDBank = FMC_SDRAM_BANK1; + hsdram1.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9; + hsdram1.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13; + hsdram1.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16; + hsdram1.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; + hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3; + hsdram1.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; + hsdram1.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2; + hsdram1.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE; + hsdram1.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1; + /* SdramTiming */ + SdramTiming.LoadToActiveDelay = 2; + SdramTiming.ExitSelfRefreshDelay = 8; + SdramTiming.SelfRefreshTime = 6; + SdramTiming.RowCycleDelay = 6; + SdramTiming.WriteRecoveryTime = 4; + SdramTiming.RPDelay = 2; + SdramTiming.RCDDelay = 2; + + if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK) + { + Error_Handler( ); + } + + /** Perform the SDRAM2 memory initialization sequence + */ + hsdram2.Instance = FMC_SDRAM_DEVICE; + /* hsdram2.Init */ + hsdram2.Init.SDBank = FMC_SDRAM_BANK2; + hsdram2.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9; + hsdram2.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13; + hsdram2.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16; + hsdram2.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; + hsdram2.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3; + hsdram2.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; + hsdram2.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2; + hsdram2.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE; + hsdram2.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1; + /* SdramTiming */ + SdramTiming.LoadToActiveDelay = 2; + SdramTiming.ExitSelfRefreshDelay = 8; + SdramTiming.SelfRefreshTime = 6; + SdramTiming.RowCycleDelay = 6; + SdramTiming.WriteRecoveryTime = 4; + SdramTiming.RPDelay = 2; + SdramTiming.RCDDelay = 2; + + if (HAL_SDRAM_Init(&hsdram2, &SdramTiming) != HAL_OK) + { + Error_Handler( ); + } + + /* USER CODE BEGIN FMC_Init 2 */ + + /* USER CODE END FMC_Init 2 */ +} + +static uint32_t FMC_Initialized = 0; + +static void HAL_FMC_MspInit(void){ + /* USER CODE BEGIN FMC_MspInit 0 */ + + /* USER CODE END FMC_MspInit 0 */ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if (FMC_Initialized) { + return; + } + FMC_Initialized = 1; + + /* Peripheral clock enable */ + __HAL_RCC_FMC_CLK_ENABLE(); + + /** FMC GPIO Configuration + PF0 ------> FMC_A0 + PF1 ------> FMC_A1 + PF2 ------> FMC_A2 + PF3 ------> FMC_A3 + PF4 ------> FMC_A4 + PF5 ------> FMC_A5 + PC0 ------> FMC_SDNWE + PC3 ------> FMC_SDCKE0 + PC4 ------> FMC_SDNE0 + PF11 ------> FMC_SDNRAS + PF12 ------> FMC_A6 + PF13 ------> FMC_A7 + PF14 ------> FMC_A8 + PF15 ------> FMC_A9 + PG0 ------> FMC_A10 + PG1 ------> FMC_A11 + PE7 ------> FMC_D4 + PE8 ------> FMC_D5 + PE9 ------> FMC_D6 + PE10 ------> FMC_D7 + PE11 ------> FMC_D8 + PE12 ------> FMC_D9 + PE13 ------> FMC_D10 + PE14 ------> FMC_D11 + PE15 ------> FMC_D12 + PD8 ------> FMC_D13 + PD9 ------> FMC_D14 + PD10 ------> FMC_D15 + PD14 ------> FMC_D0 + PD15 ------> FMC_D1 + PG2 ------> FMC_A12 + PG4 ------> FMC_BA0 + PG5 ------> FMC_BA1 + PG8 ------> FMC_SDCLK + PD0 ------> FMC_D2 + PD1 ------> FMC_D3 + PD4 ------> FMC_NOE + PD5 ------> FMC_NWE + PD7 ------> FMC_NE1 + PG15 ------> FMC_SDNCAS + PB5 ------> FMC_SDCKE1 + PB6 ------> FMC_SDNE1 + PE0 ------> FMC_NBL0 + PE1 ------> FMC_NBL1 + */ + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 + |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_11|GPIO_PIN_12 + |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); + + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_3|GPIO_PIN_4; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4 + |GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_15; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); + + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 + |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 + |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); + + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_14 + |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4 + |GPIO_PIN_5|GPIO_PIN_7; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); + + /* GPIO_InitStruct */ + GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF12_FMC; + + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /* USER CODE BEGIN FMC_MspInit 1 */ + + /* USER CODE END FMC_MspInit 1 */ +} + +void HAL_SRAM_MspInit(SRAM_HandleTypeDef* sramHandle){ + /* USER CODE BEGIN SRAM_MspInit 0 */ + + /* USER CODE END SRAM_MspInit 0 */ + HAL_FMC_MspInit(); + /* USER CODE BEGIN SRAM_MspInit 1 */ + + /* USER CODE END SRAM_MspInit 1 */ +} + +void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef* sdramHandle){ + /* USER CODE BEGIN SDRAM_MspInit 0 */ + + /* USER CODE END SDRAM_MspInit 0 */ + HAL_FMC_MspInit(); + /* USER CODE BEGIN SDRAM_MspInit 1 */ + + /* USER CODE END SDRAM_MspInit 1 */ +} + +static uint32_t FMC_DeInitialized = 0; + +static void HAL_FMC_MspDeInit(void){ + /* USER CODE BEGIN FMC_MspDeInit 0 */ + + /* USER CODE END FMC_MspDeInit 0 */ + if (FMC_DeInitialized) { + return; + } + FMC_DeInitialized = 1; + /* Peripheral clock enable */ + __HAL_RCC_FMC_CLK_DISABLE(); + + /** FMC GPIO Configuration + PF0 ------> FMC_A0 + PF1 ------> FMC_A1 + PF2 ------> FMC_A2 + PF3 ------> FMC_A3 + PF4 ------> FMC_A4 + PF5 ------> FMC_A5 + PC0 ------> FMC_SDNWE + PC3 ------> FMC_SDCKE0 + PC4 ------> FMC_SDNE0 + PF11 ------> FMC_SDNRAS + PF12 ------> FMC_A6 + PF13 ------> FMC_A7 + PF14 ------> FMC_A8 + PF15 ------> FMC_A9 + PG0 ------> FMC_A10 + PG1 ------> FMC_A11 + PE7 ------> FMC_D4 + PE8 ------> FMC_D5 + PE9 ------> FMC_D6 + PE10 ------> FMC_D7 + PE11 ------> FMC_D8 + PE12 ------> FMC_D9 + PE13 ------> FMC_D10 + PE14 ------> FMC_D11 + PE15 ------> FMC_D12 + PD8 ------> FMC_D13 + PD9 ------> FMC_D14 + PD10 ------> FMC_D15 + PD14 ------> FMC_D0 + PD15 ------> FMC_D1 + PG2 ------> FMC_A12 + PG4 ------> FMC_BA0 + PG5 ------> FMC_BA1 + PG8 ------> FMC_SDCLK + PD0 ------> FMC_D2 + PD1 ------> FMC_D3 + PD4 ------> FMC_NOE + PD5 ------> FMC_NWE + PD7 ------> FMC_NE1 + PG15 ------> FMC_SDNCAS + PB5 ------> FMC_SDCKE1 + PB6 ------> FMC_SDNE1 + PE0 ------> FMC_NBL0 + PE1 ------> FMC_NBL1 + */ + + HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 + |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_11|GPIO_PIN_12 + |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15); + + HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_3|GPIO_PIN_4); + + HAL_GPIO_DeInit(GPIOG, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4 + |GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_15); + + HAL_GPIO_DeInit(GPIOE, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 + |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 + |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1); + + HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_14 + |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4 + |GPIO_PIN_5|GPIO_PIN_7); + + HAL_GPIO_DeInit(GPIOB, GPIO_PIN_5|GPIO_PIN_6); + + /* USER CODE BEGIN FMC_MspDeInit 1 */ + + /* USER CODE END FMC_MspDeInit 1 */ +} + +void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* sramHandle){ + /* USER CODE BEGIN SRAM_MspDeInit 0 */ + + /* USER CODE END SRAM_MspDeInit 0 */ + HAL_FMC_MspDeInit(); + /* USER CODE BEGIN SRAM_MspDeInit 1 */ + + /* USER CODE END SRAM_MspDeInit 1 */ +} + +void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef* sdramHandle){ + /* USER CODE BEGIN SDRAM_MspDeInit 0 */ + + /* USER CODE END SDRAM_MspDeInit 0 */ + HAL_FMC_MspDeInit(); + /* USER CODE BEGIN SDRAM_MspDeInit 1 */ + + /* USER CODE END SDRAM_MspDeInit 1 */ +} +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/gpio.c b/EMBOS/Core/Src/gpio.c new file mode 100644 index 0000000..d712b4a --- /dev/null +++ b/EMBOS/Core/Src/gpio.c @@ -0,0 +1,153 @@ +/** + ****************************************************************************** + * @file gpio.c + * @brief This file provides code for the configuration + * of all used GPIO pins. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "gpio.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/*----------------------------------------------------------------------------*/ +/* Configure GPIO */ +/*----------------------------------------------------------------------------*/ +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/** Configure pins as + * Analog + * Input + * Output + * EVENT_OUT + * EXTI +*/ +void MX_GPIO_Init(void) +{ + + LL_EXTI_InitTypeDef EXTI_InitStruct = {0}; + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* GPIO Ports Clock Enable */ + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOF); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOH); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOG); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOE); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOD); + + /**/ + LL_GPIO_SetOutputPin(GPIOC, LED_Pin|W5500_RST_Pin); + + /**/ + LL_GPIO_SetOutputPin(GPIOA, SPI1_NSS_Pin|SPI3_NSS_Pin); + + /**/ + LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin); + + /**/ + LL_GPIO_ResetOutputPin(USART6_EN_GPIO_Port, USART6_EN_Pin); + + /**/ + GPIO_InitStruct.Pin = LED_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = W5500_RST_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(W5500_RST_GPIO_Port, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = SPI1_NSS_Pin|SPI3_NSS_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = SPI2_NSS_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(SPI2_NSS_GPIO_Port, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = USART6_EN_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_DOWN; + LL_GPIO_Init(USART6_EN_GPIO_Port, &GPIO_InitStruct); + + /**/ + LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTC, LL_SYSCFG_EXTI_LINE15); + + /**/ + LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTD, LL_SYSCFG_EXTI_LINE6); + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_15; + EXTI_InitStruct.LineCommand = ENABLE; + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING; + LL_EXTI_Init(&EXTI_InitStruct); + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_6; + EXTI_InitStruct.LineCommand = ENABLE; + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING; + LL_EXTI_Init(&EXTI_InitStruct); + + /**/ + LL_GPIO_SetPinPull(W5500_INT_GPIO_Port, W5500_INT_Pin, LL_GPIO_PULL_UP); + + /**/ + LL_GPIO_SetPinPull(FPGA_12K_INT_GPIO_Port, FPGA_12K_INT_Pin, LL_GPIO_PULL_UP); + + /**/ + LL_GPIO_SetPinMode(W5500_INT_GPIO_Port, W5500_INT_Pin, LL_GPIO_MODE_INPUT); + + /**/ + LL_GPIO_SetPinMode(FPGA_12K_INT_GPIO_Port, FPGA_12K_INT_Pin, LL_GPIO_MODE_INPUT); + + /* EXTI interrupt init*/ + NVIC_SetPriority(EXTI9_5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(EXTI9_5_IRQn); + NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(EXTI15_10_IRQn); + +} + +/* USER CODE BEGIN 2 */ + +/* USER CODE END 2 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/main.c b/EMBOS/Core/Src/main.c new file mode 100644 index 0000000..7088cab --- /dev/null +++ b/EMBOS/Core/Src/main.c @@ -0,0 +1,206 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.c + * @brief : Main program body + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "can.h" +#include "spi.h" +#include "tim.h" +#include "usart.h" +#include "gpio.h" +#include "fmc.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +#include "tasks.h" +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN PTD */ + +/* USER CODE END PTD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ + +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +void SystemClock_Config(void); +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/** + * @brief The application entry point. + * @retval int + */ +int main(void) +{ + /* USER CODE BEGIN 1 */ + SetVectorTable(); + /* USER CODE END 1 */ + + /* MCU Configuration--------------------------------------------------------*/ + + /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + HAL_Init(); + + /* USER CODE BEGIN Init */ + + /* USER CODE END Init */ + + /* Configure the system clock */ + SystemClock_Config(); + + /* USER CODE BEGIN SysInit */ + + /* USER CODE END SysInit */ + + /* Initialize all configured peripherals */ + MX_GPIO_Init(); + MX_USART1_UART_Init(); + MX_USART6_UART_Init(); + MX_FMC_Init(); + MX_SPI1_Init(); + MX_CAN1_Init(); + MX_SPI2_Init(); + MX_SPI3_Init(); + MX_TIM8_Init(); + MX_TIM9_Init(); + MX_TIM10_Init(); + MX_TIM11_Init(); + MX_TIM12_Init(); + MX_TIM13_Init(); + MX_TIM14_Init(); + /* USER CODE BEGIN 2 */ + MainTasks(); + /* USER CODE END 2 */ + + /* Infinite loop */ + /* USER CODE BEGIN WHILE */ + while (1) + { + /* USER CODE END WHILE */ + + /* USER CODE BEGIN 3 */ + } + /* USER CODE END 3 */ +} + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + LL_FLASH_SetLatency(LL_FLASH_LATENCY_5); + while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_5) + { + } + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + LL_PWR_EnableOverDriveMode(); + LL_RCC_HSE_EnableBypass(); + LL_RCC_HSE_Enable(); + + /* Wait till HSE is ready */ + while(LL_RCC_HSE_IsReady() != 1) + { + + } + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_12, 360, LL_RCC_PLLR_DIV_2); + LL_RCC_PLL_Enable(); + + /* Wait till PLL is ready */ + while(LL_RCC_PLL_IsReady() != 1) + { + + } + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_4); + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_2); + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLLR); + + /* Wait till System clock is ready */ + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLLR) + { + + } + LL_SetSystemCoreClock(180000000); + + /* Update the time base */ + if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK) + { + Error_Handler(); + } + LL_RCC_SetTIMPrescaler(LL_RCC_TIM_PRESCALER_TWICE); +} + +/* USER CODE BEGIN 4 */ + +/* USER CODE END 4 */ + +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + __disable_irq(); + while (1) + { + } + /* USER CODE END Error_Handler_Debug */ +} + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) +{ + /* USER CODE BEGIN 6 */ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* USER CODE END 6 */ +} +#endif /* USE_FULL_ASSERT */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/spi.c b/EMBOS/Core/Src/spi.c new file mode 100644 index 0000000..d301444 --- /dev/null +++ b/EMBOS/Core/Src/spi.c @@ -0,0 +1,164 @@ +/** + ****************************************************************************** + * @file spi.c + * @brief This file provides code for the configuration + * of the SPI instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "spi.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* SPI1 init function */ +void MX_SPI1_Init(void) +{ + LL_SPI_InitTypeDef SPI_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI1); + + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); + /**SPI1 GPIO Configuration + PA6 ------> SPI1_MISO + PA7 ------> SPI1_MOSI + PB3 ------> SPI1_SCK + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_5; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = LL_GPIO_PIN_3; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_5; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; + SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; + SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; + SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; + SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; + SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; + SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; + SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; + SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; + SPI_InitStruct.CRCPoly = 10; + LL_SPI_Init(SPI1, &SPI_InitStruct); + LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA); + +} +/* SPI2 init function */ +void MX_SPI2_Init(void) +{ + LL_SPI_InitTypeDef SPI_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2); + + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); + /**SPI2 GPIO Configuration + PB13 ------> SPI2_SCK + PB14 ------> SPI2_MISO + PB15 ------> SPI2_MOSI + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_5; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; + SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; + SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; + SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; + SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; + SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; + SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; + SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; + SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; + SPI_InitStruct.CRCPoly = 10; + LL_SPI_Init(SPI2, &SPI_InitStruct); + LL_SPI_SetStandard(SPI2, LL_SPI_PROTOCOL_MOTOROLA); + +} +/* SPI3 init function */ +void MX_SPI3_Init(void) +{ + LL_SPI_InitTypeDef SPI_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI3); + + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC); + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); + /**SPI3 GPIO Configuration + PC10 ------> SPI3_SCK + PC12 ------> SPI3_MOSI + PB4 ------> SPI3_MISO + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_10|LL_GPIO_PIN_12; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_6; + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = LL_GPIO_PIN_4; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_6; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; + SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; + SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; + SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; + SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; + SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; + SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; + SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; + SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; + SPI_InitStruct.CRCPoly = 10; + LL_SPI_Init(SPI3, &SPI_InitStruct); + LL_SPI_SetStandard(SPI3, LL_SPI_PROTOCOL_MOTOROLA); + +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/stm32f4xx_hal_msp.c b/EMBOS/Core/Src/stm32f4xx_hal_msp.c new file mode 100644 index 0000000..7f5715d --- /dev/null +++ b/EMBOS/Core/Src/stm32f4xx_hal_msp.c @@ -0,0 +1,84 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f4xx_hal_msp.c + * @brief This file provides code for the MSP Initialization + * and de-Initialization codes. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN Define */ + +/* USER CODE END Define */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN Macro */ + +/* USER CODE END Macro */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* External functions --------------------------------------------------------*/ +/* USER CODE BEGIN ExternalFunctions */ + +/* USER CODE END ExternalFunctions */ + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ +/** + * Initializes the Global MSP. + */ +void HAL_MspInit(void) +{ + /* USER CODE BEGIN MspInit 0 */ + + /* USER CODE END MspInit 0 */ + + __HAL_RCC_SYSCFG_CLK_ENABLE(); + __HAL_RCC_PWR_CLK_ENABLE(); + + /* System interrupt init*/ + + /* USER CODE BEGIN MspInit 1 */ + + /* USER CODE END MspInit 1 */ +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/stm32f4xx_it.c b/EMBOS/Core/Src/stm32f4xx_it.c new file mode 100644 index 0000000..03bc542 --- /dev/null +++ b/EMBOS/Core/Src/stm32f4xx_it.c @@ -0,0 +1,441 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f4xx_it.c + * @brief Interrupt Service Routines. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "stm32f4xx_it.h" +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +#include "trigger.h" +#include "serial.h" +#include "stdebug.h" +#include "ethernet.h" +#include "stm32motos.h" +#include "embfpga.h" +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* External variables --------------------------------------------------------*/ +extern CAN_HandleTypeDef hcan1; +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/******************************************************************************/ +/* Cortex-M4 Processor Interruption and Exception Handlers */ +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + u32 stackaddr = (__get_MSP()+0x10); + OutStackInfo(4, stackaddr); + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + while (1) + { + } + /* USER CODE END NonMaskableInt_IRQn 1 */ +} + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + /* USER CODE BEGIN HardFault_IRQn 0 */ + u32 stackaddr = (__get_MSP()+0x10); + OutStackInfo(0, stackaddr); + /* USER CODE END HardFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_HardFault_IRQn 0 */ + /* USER CODE END W1_HardFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + u32 stackaddr = (__get_MSP()+0x10); + OutStackInfo(1, stackaddr); + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ + /* USER CODE END W1_MemoryManagement_IRQn 0 */ + } +} + +/** + * @brief This function handles Pre-fetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + /* USER CODE BEGIN BusFault_IRQn 0 */ + u32 stackaddr = (__get_MSP()+0x10); + OutStackInfo(2, stackaddr); + /* USER CODE END BusFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_BusFault_IRQn 0 */ + /* USER CODE END W1_BusFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + /* USER CODE BEGIN UsageFault_IRQn 0 */ + u32 stackaddr = (__get_MSP()+0x10); + OutStackInfo(3, stackaddr); + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ + /* USER CODE END W1_UsageFault_IRQn 0 */ + } +} + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + /* USER CODE BEGIN SVCall_IRQn 0 */ + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + /* USER CODE BEGIN DebugMonitor_IRQn 0 */ + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + +/** + * @brief This function handles Pendable request for system service. + */ +void PendSV_Handler(void) +{ + /* USER CODE BEGIN PendSV_IRQn 0 */ + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ + TriggerIntProc(); + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + +/******************************************************************************/ +/* STM32F4xx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32f4xx.s). */ +/******************************************************************************/ + +/** + * @brief This function handles CAN1 TX interrupt. + */ +void CAN1_TX_IRQHandler(void) +{ + /* USER CODE BEGIN CAN1_TX_IRQn 0 */ + + /* USER CODE END CAN1_TX_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan1); + /* USER CODE BEGIN CAN1_TX_IRQn 1 */ + + /* USER CODE END CAN1_TX_IRQn 1 */ +} + +/** + * @brief This function handles CAN1 RX0 interrupt. + */ +void CAN1_RX0_IRQHandler(void) +{ + /* USER CODE BEGIN CAN1_RX0_IRQn 0 */ + + /* USER CODE END CAN1_RX0_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan1); + /* USER CODE BEGIN CAN1_RX0_IRQn 1 */ + + /* USER CODE END CAN1_RX0_IRQn 1 */ +} + +/** + * @brief This function handles EXTI line[9:5] interrupts. + */ +void EXTI9_5_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI9_5_IRQn 0 */ + + /* USER CODE END EXTI9_5_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_6) != RESET) + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_6); + /* USER CODE BEGIN LL_EXTI_LINE_6 */ + FpgaIntProc(); // fpgaж + /* USER CODE END LL_EXTI_LINE_6 */ + } + /* USER CODE BEGIN EXTI9_5_IRQn 1 */ + + /* USER CODE END EXTI9_5_IRQn 1 */ +} + +/** + * @brief This function handles TIM1 break interrupt and TIM9 global interrupt. + */ +void TIM1_BRK_TIM9_IRQHandler(void) +{ + /* USER CODE BEGIN TIM1_BRK_TIM9_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM9) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM9); +#if (STM32_MOTOS_NUM >= 1) + STM32Moto1IntProc(); +#endif + } + /* USER CODE END TIM1_BRK_TIM9_IRQn 0 */ + + /* USER CODE BEGIN TIM1_BRK_TIM9_IRQn 1 */ + + /* USER CODE END TIM1_BRK_TIM9_IRQn 1 */ +} + +/** + * @brief This function handles TIM1 update interrupt and TIM10 global interrupt. + */ +void TIM1_UP_TIM10_IRQHandler(void) +{ + /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM10) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM10); +#if (STM32_MOTOS_NUM >= 2) + STM32Moto2IntProc(); +#endif + } + /* USER CODE END TIM1_UP_TIM10_IRQn 0 */ + + /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 1 */ + + /* USER CODE END TIM1_UP_TIM10_IRQn 1 */ +} + +/** + * @brief This function handles TIM1 trigger and commutation interrupts and TIM11 global interrupt. + */ +void TIM1_TRG_COM_TIM11_IRQHandler(void) +{ + /* USER CODE BEGIN TIM1_TRG_COM_TIM11_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM11) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM11); +#if (STM32_MOTOS_NUM >= 3) + STM32Moto3IntProc(); +#endif + } + /* USER CODE END TIM1_TRG_COM_TIM11_IRQn 0 */ + + /* USER CODE BEGIN TIM1_TRG_COM_TIM11_IRQn 1 */ + + /* USER CODE END TIM1_TRG_COM_TIM11_IRQn 1 */ +} + +/** + * @brief This function handles USART1 global interrupt. + */ +void USART1_IRQHandler(void) +{ + /* USER CODE BEGIN USART1_IRQn 0 */ +#ifdef COMM_USART1 + USART1IntProc(); +#endif + /* USER CODE END USART1_IRQn 0 */ + /* USER CODE BEGIN USART1_IRQn 1 */ + + /* USER CODE END USART1_IRQn 1 */ +} + +/** + * @brief This function handles EXTI line[15:10] interrupts. + */ +void EXTI15_10_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI15_10_IRQn 0 */ + + /* USER CODE END EXTI15_10_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_15) != RESET) + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_15); + /* USER CODE BEGIN LL_EXTI_LINE_15 */ + //EthernetIntProc(); // 5500ж + /* USER CODE END LL_EXTI_LINE_15 */ + } + /* USER CODE BEGIN EXTI15_10_IRQn 1 */ + + /* USER CODE END EXTI15_10_IRQn 1 */ +} + +/** + * @brief This function handles TIM8 break interrupt and TIM12 global interrupt. + */ +void TIM8_BRK_TIM12_IRQHandler(void) +{ + /* USER CODE BEGIN TIM8_BRK_TIM12_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM12) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM12); +#if (STM32_MOTOS_NUM >= 4) + STM32Moto4IntProc(); +#endif + } + /* USER CODE END TIM8_BRK_TIM12_IRQn 0 */ + + /* USER CODE BEGIN TIM8_BRK_TIM12_IRQn 1 */ + + /* USER CODE END TIM8_BRK_TIM12_IRQn 1 */ +} + +/** + * @brief This function handles TIM8 update interrupt and TIM13 global interrupt. + */ +void TIM8_UP_TIM13_IRQHandler(void) +{ + /* USER CODE BEGIN TIM8_UP_TIM13_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM8) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM8); +#if (STM32_MOTOS_NUM > 0 || STM32_SOFT_PWM > 0) + STM32MotoSpeedIntProc(); +#endif + } + if (LL_TIM_IsActiveFlag_UPDATE(TIM13) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM13); +#if (STM32_MOTOS_NUM >= 5) + STM32Moto5IntProc(); +#endif + } + /* USER CODE END TIM8_UP_TIM13_IRQn 0 */ + + /* USER CODE BEGIN TIM8_UP_TIM13_IRQn 1 */ + + /* USER CODE END TIM8_UP_TIM13_IRQn 1 */ +} + +/** + * @brief This function handles TIM8 trigger and commutation interrupts and TIM14 global interrupt. + */ +void TIM8_TRG_COM_TIM14_IRQHandler(void) +{ + /* USER CODE BEGIN TIM8_TRG_COM_TIM14_IRQn 0 */ + if (LL_TIM_IsActiveFlag_UPDATE(TIM14) == 1) + { + LL_TIM_ClearFlag_UPDATE(TIM14); +#if (STM32_MOTOS_NUM >= 6) + STM32Moto6IntProc(); +#endif + } + /* USER CODE END TIM8_TRG_COM_TIM14_IRQn 0 */ + + /* USER CODE BEGIN TIM8_TRG_COM_TIM14_IRQn 1 */ + + /* USER CODE END TIM8_TRG_COM_TIM14_IRQn 1 */ +} + +/** + * @brief This function handles USART6 global interrupt. + */ +void USART6_IRQHandler(void) +{ + /* USER CODE BEGIN USART6_IRQn 0 */ +#ifdef COMM_USART6 + USART6IntProc(); +#endif + /* USER CODE END USART6_IRQn 0 */ + /* USER CODE BEGIN USART6_IRQn 1 */ + + /* USER CODE END USART6_IRQn 1 */ +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/syscalls.c b/EMBOS/Core/Src/syscalls.c new file mode 100644 index 0000000..4ec9584 --- /dev/null +++ b/EMBOS/Core/Src/syscalls.c @@ -0,0 +1,159 @@ +/** + ****************************************************************************** + * @file syscalls.c + * @author Auto-generated by STM32CubeIDE + * @brief STM32CubeIDE Minimal System calls file + * + * For more information about which c-functions + * need which of these lowlevel functions + * please consult the Newlib libc-manual + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes */ +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Variables */ +//#undef errno +extern int errno; +extern int __io_putchar(int ch) __attribute__((weak)); +extern int __io_getchar(void) __attribute__((weak)); + +register char * stack_ptr asm("sp"); + +char *__env[1] = { 0 }; +char **environ = __env; + + +/* Functions */ +void initialise_monitor_handles() +{ +} + +int _getpid(void) +{ + return 1; +} + +int _kill(int pid, int sig) +{ + errno = EINVAL; + return -1; +} + +void _exit (int status) +{ + _kill(status, -1); + while (1) {} /* Make sure we hang here */ +} + +__attribute__((weak)) int _read(int file, char *ptr, int len) +{ + int DataIdx; + + for (DataIdx = 0; DataIdx < len; DataIdx++) + { + *ptr++ = __io_getchar(); + } + +return len; +} + +__attribute__((weak)) int _write(int file, char *ptr, int len) +{ + int DataIdx; + + for (DataIdx = 0; DataIdx < len; DataIdx++) + { + __io_putchar(*ptr++); + } + return len; +} + +int _close(int file) +{ + return -1; +} + + +int _fstat(int file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int _isatty(int file) +{ + return 1; +} + +int _lseek(int file, int ptr, int dir) +{ + return 0; +} + +int _open(char *path, int flags, ...) +{ + /* Pretend like we always fail */ + return -1; +} + +int _wait(int *status) +{ + errno = ECHILD; + return -1; +} + +int _unlink(char *name) +{ + errno = ENOENT; + return -1; +} + +int _times(struct tms *buf) +{ + return -1; +} + +int _stat(char *file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int _link(char *old, char *new) +{ + errno = EMLINK; + return -1; +} + +int _fork(void) +{ + errno = EAGAIN; + return -1; +} + +int _execve(char *name, char **argv, char **env) +{ + errno = ENOMEM; + return -1; +} diff --git a/EMBOS/Core/Src/sysmem.c b/EMBOS/Core/Src/sysmem.c new file mode 100644 index 0000000..d7cc52c --- /dev/null +++ b/EMBOS/Core/Src/sysmem.c @@ -0,0 +1,80 @@ +/** + ****************************************************************************** + * @file sysmem.c + * @author Generated by STM32CubeIDE + * @brief STM32CubeIDE System Memory calls file + * + * For more information about which C functions + * need which of these lowlevel functions + * please consult the newlib libc manual + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes */ +#include +#include + +/** + * Pointer to the current high watermark of the heap usage + */ +static uint8_t *__sbrk_heap_end = NULL; + +/** + * @brief _sbrk() allocates memory to the newlib heap and is used by malloc + * and others from the C library + * + * @verbatim + * ############################################################################ + * # .data # .bss # newlib heap # MSP stack # + * # # # # Reserved by _Min_Stack_Size # + * ############################################################################ + * ^-- RAM start ^-- _end _estack, RAM end --^ + * @endverbatim + * + * This implementation starts allocating at the '_end' linker symbol + * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack + * The implementation considers '_estack' linker symbol to be RAM end + * NOTE: If the MSP stack, at any point during execution, grows larger than the + * reserved size, please increase the '_Min_Stack_Size'. + * + * @param incr Memory size + * @return Pointer to allocated memory + */ +void *_sbrk(ptrdiff_t incr) +{ + extern uint8_t _end; /* Symbol defined in the linker script */ + extern uint8_t _estack; /* Symbol defined in the linker script */ + extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */ + const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size; + const uint8_t *max_heap = (uint8_t *)stack_limit; + uint8_t *prev_heap_end; + + /* Initialize heap end at first call */ + if (NULL == __sbrk_heap_end) + { + __sbrk_heap_end = &_end; + } + + /* Protect heap from growing into the reserved MSP stack */ + if (__sbrk_heap_end + incr > max_heap) + { + errno = ENOMEM; + return (void *)-1; + } + + prev_heap_end = __sbrk_heap_end; + __sbrk_heap_end += incr; + + return (void *)prev_heap_end; +} diff --git a/EMBOS/Core/Src/system_stm32f4xx.c b/EMBOS/Core/Src/system_stm32f4xx.c new file mode 100644 index 0000000..bcb2b9f --- /dev/null +++ b/EMBOS/Core/Src/system_stm32f4xx.c @@ -0,0 +1,727 @@ +/** + ****************************************************************************** + * @file system_stm32f4xx.c + * @author MCD Application Team + * @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File. + * + * This file provides two functions and one global variable to be called from + * user application: + * - SystemInit(): This function is called at startup just after reset and + * before branch to main program. This call is made inside + * the "startup_stm32f4xx.s" file. + * + * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used + * by the user application to setup the SysTick + * timer or configure other parameters. + * + * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must + * be called whenever the core clock is changed + * during program execution. + * + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f4xx_system + * @{ + */ + +/** @addtogroup STM32F4xx_System_Private_Includes + * @{ + */ + + +#include "stm32f4xx.h" + +#if !defined (HSE_VALUE) + #define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSI_VALUE) + #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_TypesDefinitions + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Defines + * @{ + */ + +/************************* Miscellaneous Configuration ************************/ +/*!< Uncomment the following line if you need to use external SRAM or SDRAM as data memory */ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\ + || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) +/* #define DATA_IN_ExtSRAM */ +#endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F469xx || STM32F479xx ||\ + STM32F412Zx || STM32F412Vx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/* #define DATA_IN_ExtSDRAM */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\ + STM32F479xx */ + +/*!< Uncomment the following line if you need to relocate your vector Table in + Internal SRAM. */ +/* #define VECT_TAB_SRAM */ +#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. + This value must be a multiple of 0x200. */ +/******************************************************************************/ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Variables + * @{ + */ + /* This variable is updated in three ways: + 1) by calling CMSIS function SystemCoreClockUpdate() + 2) by calling HAL API function HAL_RCC_GetHCLKFreq() + 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency + Note: If you use this function to configure the system clock; then there + is no need to call the 2 first functions listed above, since SystemCoreClock + variable is updated automatically. + */ +uint32_t SystemCoreClock = 16000000; +const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; +const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4}; +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes + * @{ + */ + +#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM) + static void SystemInit_ExtMemCtl(void); +#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Private_Functions + * @{ + */ + +/** + * @brief Setup the microcontroller system + * Initialize the FPU setting, vector table location and External memory + * configuration. + * @param None + * @retval None + */ +void SystemInit(void) +{ + /* FPU settings ------------------------------------------------------------*/ + #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */ + #endif + +#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM) + SystemInit_ExtMemCtl(); +#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */ + + /* Configure the Vector Table location add offset address ------------------*/ +#ifdef VECT_TAB_SRAM + SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ +#else + SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ +#endif +} + +/** + * @brief Update SystemCoreClock variable according to Clock Register Values. + * The SystemCoreClock variable contains the core clock (HCLK), it can + * be used by the user application to setup the SysTick timer or configure + * other parameters. + * + * @note Each time the core clock (HCLK) changes, this function must be called + * to update SystemCoreClock variable value. Otherwise, any configuration + * based on this variable will be incorrect. + * + * @note - The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * + * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) + * + * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) + * + * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) + * or HSI_VALUE(*) multiplied/divided by the PLL factors. + * + * (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * + * (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (its value + * depends on the application requirements), user has to ensure that HSE_VALUE + * is same as the real frequency of the crystal used. Otherwise, this function + * may have wrong result. + * + * - The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @param None + * @retval None + */ +void SystemCoreClockUpdate(void) +{ + uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; + + /* Get SYSCLK source -------------------------------------------------------*/ + tmp = RCC->CFGR & RCC_CFGR_SWS; + + switch (tmp) + { + case 0x00: /* HSI used as system clock source */ + SystemCoreClock = HSI_VALUE; + break; + case 0x04: /* HSE used as system clock source */ + SystemCoreClock = HSE_VALUE; + break; + case 0x08: /* PLL used as system clock source */ + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N + SYSCLK = PLL_VCO / PLL_P + */ + pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + + if (pllsource != 0) + { + /* HSE used as PLL clock source */ + pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + + pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; + SystemCoreClock = pllvco/pllp; + break; + default: + SystemCoreClock = HSI_VALUE; + break; + } + /* Compute HCLK frequency --------------------------------------------------*/ + /* Get HCLK prescaler */ + tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; + /* HCLK frequency */ + SystemCoreClock >>= tmp; +} + +#if defined (DATA_IN_ExtSRAM) && defined (DATA_IN_ExtSDRAM) +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Setup the external memory controller. + * Called in startup_stm32f4xx.s before jump to main. + * This function configures the external memories (SRAM/SDRAM) + * This SRAM/SDRAM will be used as program data memory (including heap and stack). + * @param None + * @retval None + */ +void SystemInit_ExtMemCtl(void) +{ + __IO uint32_t tmp = 0x00; + + register uint32_t tmpreg = 0, timeout = 0xFFFF; + register __IO uint32_t index; + + /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface clock */ + RCC->AHB1ENR |= 0x000001F8; + + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN); + + /* Connect PDx pins to FMC Alternate function */ + GPIOD->AFR[0] = 0x00CCC0CC; + GPIOD->AFR[1] = 0xCCCCCCCC; + /* Configure PDx pins in Alternate function mode */ + GPIOD->MODER = 0xAAAA0A8A; + /* Configure PDx pins speed to 100 MHz */ + GPIOD->OSPEEDR = 0xFFFF0FCF; + /* Configure PDx pins Output type to push-pull */ + GPIOD->OTYPER = 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOD->PUPDR = 0x00000000; + + /* Connect PEx pins to FMC Alternate function */ + GPIOE->AFR[0] = 0xC00CC0CC; + GPIOE->AFR[1] = 0xCCCCCCCC; + /* Configure PEx pins in Alternate function mode */ + GPIOE->MODER = 0xAAAA828A; + /* Configure PEx pins speed to 100 MHz */ + GPIOE->OSPEEDR = 0xFFFFC3CF; + /* Configure PEx pins Output type to push-pull */ + GPIOE->OTYPER = 0x00000000; + /* No pull-up, pull-down for PEx pins */ + GPIOE->PUPDR = 0x00000000; + + /* Connect PFx pins to FMC Alternate function */ + GPIOF->AFR[0] = 0xCCCCCCCC; + GPIOF->AFR[1] = 0xCCCCCCCC; + /* Configure PFx pins in Alternate function mode */ + GPIOF->MODER = 0xAA800AAA; + /* Configure PFx pins speed to 50 MHz */ + GPIOF->OSPEEDR = 0xAA800AAA; + /* Configure PFx pins Output type to push-pull */ + GPIOF->OTYPER = 0x00000000; + /* No pull-up, pull-down for PFx pins */ + GPIOF->PUPDR = 0x00000000; + + /* Connect PGx pins to FMC Alternate function */ + GPIOG->AFR[0] = 0xCCCCCCCC; + GPIOG->AFR[1] = 0xCCCCCCCC; + /* Configure PGx pins in Alternate function mode */ + GPIOG->MODER = 0xAAAAAAAA; + /* Configure PGx pins speed to 50 MHz */ + GPIOG->OSPEEDR = 0xAAAAAAAA; + /* Configure PGx pins Output type to push-pull */ + GPIOG->OTYPER = 0x00000000; + /* No pull-up, pull-down for PGx pins */ + GPIOG->PUPDR = 0x00000000; + + /* Connect PHx pins to FMC Alternate function */ + GPIOH->AFR[0] = 0x00C0CC00; + GPIOH->AFR[1] = 0xCCCCCCCC; + /* Configure PHx pins in Alternate function mode */ + GPIOH->MODER = 0xAAAA08A0; + /* Configure PHx pins speed to 50 MHz */ + GPIOH->OSPEEDR = 0xAAAA08A0; + /* Configure PHx pins Output type to push-pull */ + GPIOH->OTYPER = 0x00000000; + /* No pull-up, pull-down for PHx pins */ + GPIOH->PUPDR = 0x00000000; + + /* Connect PIx pins to FMC Alternate function */ + GPIOI->AFR[0] = 0xCCCCCCCC; + GPIOI->AFR[1] = 0x00000CC0; + /* Configure PIx pins in Alternate function mode */ + GPIOI->MODER = 0x0028AAAA; + /* Configure PIx pins speed to 50 MHz */ + GPIOI->OSPEEDR = 0x0028AAAA; + /* Configure PIx pins Output type to push-pull */ + GPIOI->OTYPER = 0x00000000; + /* No pull-up, pull-down for PIx pins */ + GPIOI->PUPDR = 0x00000000; + +/*-- FMC Configuration -------------------------------------------------------*/ + /* Enable the FMC interface clock */ + RCC->AHB3ENR |= 0x00000001; + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); + + FMC_Bank5_6->SDCR[0] = 0x000019E4; + FMC_Bank5_6->SDTR[0] = 0x01115351; + + /* SDRAM initialization sequence */ + /* Clock enable command */ + FMC_Bank5_6->SDCMR = 0x00000011; + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Delay */ + for (index = 0; index<1000; index++); + + /* PALL command */ + FMC_Bank5_6->SDCMR = 0x00000012; + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Auto refresh command */ + FMC_Bank5_6->SDCMR = 0x00000073; + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* MRD register program */ + FMC_Bank5_6->SDCMR = 0x00046014; + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Set refresh count */ + tmpreg = FMC_Bank5_6->SDRTR; + FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1)); + + /* Disable write protection */ + tmpreg = FMC_Bank5_6->SDCR[0]; + FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF); + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) + /* Configure and enable Bank1_SRAM2 */ + FMC_Bank1->BTCR[2] = 0x00001011; + FMC_Bank1->BTCR[3] = 0x00000201; + FMC_Bank1E->BWTR[2] = 0x0fffffff; +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ +#if defined(STM32F469xx) || defined(STM32F479xx) + /* Configure and enable Bank1_SRAM2 */ + FMC_Bank1->BTCR[2] = 0x00001091; + FMC_Bank1->BTCR[3] = 0x00110212; + FMC_Bank1E->BWTR[2] = 0x0fffffff; +#endif /* STM32F469xx || STM32F479xx */ + + (void)(tmp); +} +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +#elif defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM) +/** + * @brief Setup the external memory controller. + * Called in startup_stm32f4xx.s before jump to main. + * This function configures the external memories (SRAM/SDRAM) + * This SRAM/SDRAM will be used as program data memory (including heap and stack). + * @param None + * @retval None + */ +void SystemInit_ExtMemCtl(void) +{ + __IO uint32_t tmp = 0x00; +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +#if defined (DATA_IN_ExtSDRAM) + register uint32_t tmpreg = 0, timeout = 0xFFFF; + register __IO uint32_t index; + +#if defined(STM32F446xx) + /* Enable GPIOA, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG interface + clock */ + RCC->AHB1ENR |= 0x0000007D; +#else + /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface + clock */ + RCC->AHB1ENR |= 0x000001F8; +#endif /* STM32F446xx */ + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN); + +#if defined(STM32F446xx) + /* Connect PAx pins to FMC Alternate function */ + GPIOA->AFR[0] |= 0xC0000000; + GPIOA->AFR[1] |= 0x00000000; + /* Configure PDx pins in Alternate function mode */ + GPIOA->MODER |= 0x00008000; + /* Configure PDx pins speed to 50 MHz */ + GPIOA->OSPEEDR |= 0x00008000; + /* Configure PDx pins Output type to push-pull */ + GPIOA->OTYPER |= 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOA->PUPDR |= 0x00000000; + + /* Connect PCx pins to FMC Alternate function */ + GPIOC->AFR[0] |= 0x00CC0000; + GPIOC->AFR[1] |= 0x00000000; + /* Configure PDx pins in Alternate function mode */ + GPIOC->MODER |= 0x00000A00; + /* Configure PDx pins speed to 50 MHz */ + GPIOC->OSPEEDR |= 0x00000A00; + /* Configure PDx pins Output type to push-pull */ + GPIOC->OTYPER |= 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOC->PUPDR |= 0x00000000; +#endif /* STM32F446xx */ + + /* Connect PDx pins to FMC Alternate function */ + GPIOD->AFR[0] = 0x000000CC; + GPIOD->AFR[1] = 0xCC000CCC; + /* Configure PDx pins in Alternate function mode */ + GPIOD->MODER = 0xA02A000A; + /* Configure PDx pins speed to 50 MHz */ + GPIOD->OSPEEDR = 0xA02A000A; + /* Configure PDx pins Output type to push-pull */ + GPIOD->OTYPER = 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOD->PUPDR = 0x00000000; + + /* Connect PEx pins to FMC Alternate function */ + GPIOE->AFR[0] = 0xC00000CC; + GPIOE->AFR[1] = 0xCCCCCCCC; + /* Configure PEx pins in Alternate function mode */ + GPIOE->MODER = 0xAAAA800A; + /* Configure PEx pins speed to 50 MHz */ + GPIOE->OSPEEDR = 0xAAAA800A; + /* Configure PEx pins Output type to push-pull */ + GPIOE->OTYPER = 0x00000000; + /* No pull-up, pull-down for PEx pins */ + GPIOE->PUPDR = 0x00000000; + + /* Connect PFx pins to FMC Alternate function */ + GPIOF->AFR[0] = 0xCCCCCCCC; + GPIOF->AFR[1] = 0xCCCCCCCC; + /* Configure PFx pins in Alternate function mode */ + GPIOF->MODER = 0xAA800AAA; + /* Configure PFx pins speed to 50 MHz */ + GPIOF->OSPEEDR = 0xAA800AAA; + /* Configure PFx pins Output type to push-pull */ + GPIOF->OTYPER = 0x00000000; + /* No pull-up, pull-down for PFx pins */ + GPIOF->PUPDR = 0x00000000; + + /* Connect PGx pins to FMC Alternate function */ + GPIOG->AFR[0] = 0xCCCCCCCC; + GPIOG->AFR[1] = 0xCCCCCCCC; + /* Configure PGx pins in Alternate function mode */ + GPIOG->MODER = 0xAAAAAAAA; + /* Configure PGx pins speed to 50 MHz */ + GPIOG->OSPEEDR = 0xAAAAAAAA; + /* Configure PGx pins Output type to push-pull */ + GPIOG->OTYPER = 0x00000000; + /* No pull-up, pull-down for PGx pins */ + GPIOG->PUPDR = 0x00000000; + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F469xx) || defined(STM32F479xx) + /* Connect PHx pins to FMC Alternate function */ + GPIOH->AFR[0] = 0x00C0CC00; + GPIOH->AFR[1] = 0xCCCCCCCC; + /* Configure PHx pins in Alternate function mode */ + GPIOH->MODER = 0xAAAA08A0; + /* Configure PHx pins speed to 50 MHz */ + GPIOH->OSPEEDR = 0xAAAA08A0; + /* Configure PHx pins Output type to push-pull */ + GPIOH->OTYPER = 0x00000000; + /* No pull-up, pull-down for PHx pins */ + GPIOH->PUPDR = 0x00000000; + + /* Connect PIx pins to FMC Alternate function */ + GPIOI->AFR[0] = 0xCCCCCCCC; + GPIOI->AFR[1] = 0x00000CC0; + /* Configure PIx pins in Alternate function mode */ + GPIOI->MODER = 0x0028AAAA; + /* Configure PIx pins speed to 50 MHz */ + GPIOI->OSPEEDR = 0x0028AAAA; + /* Configure PIx pins Output type to push-pull */ + GPIOI->OTYPER = 0x00000000; + /* No pull-up, pull-down for PIx pins */ + GPIOI->PUPDR = 0x00000000; +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +/*-- FMC Configuration -------------------------------------------------------*/ + /* Enable the FMC interface clock */ + RCC->AHB3ENR |= 0x00000001; + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); + + /* Configure and enable SDRAM bank1 */ +#if defined(STM32F446xx) + FMC_Bank5_6->SDCR[0] = 0x00001954; +#else + FMC_Bank5_6->SDCR[0] = 0x000019E4; +#endif /* STM32F446xx */ + FMC_Bank5_6->SDTR[0] = 0x01115351; + + /* SDRAM initialization sequence */ + /* Clock enable command */ + FMC_Bank5_6->SDCMR = 0x00000011; + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Delay */ + for (index = 0; index<1000; index++); + + /* PALL command */ + FMC_Bank5_6->SDCMR = 0x00000012; + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Auto refresh command */ +#if defined(STM32F446xx) + FMC_Bank5_6->SDCMR = 0x000000F3; +#else + FMC_Bank5_6->SDCMR = 0x00000073; +#endif /* STM32F446xx */ + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* MRD register program */ +#if defined(STM32F446xx) + FMC_Bank5_6->SDCMR = 0x00044014; +#else + FMC_Bank5_6->SDCMR = 0x00046014; +#endif /* STM32F446xx */ + timeout = 0xFFFF; + while((tmpreg != 0) && (timeout-- > 0)) + { + tmpreg = FMC_Bank5_6->SDSR & 0x00000020; + } + + /* Set refresh count */ + tmpreg = FMC_Bank5_6->SDRTR; +#if defined(STM32F446xx) + FMC_Bank5_6->SDRTR = (tmpreg | (0x0000050C<<1)); +#else + FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1)); +#endif /* STM32F446xx */ + + /* Disable write protection */ + tmpreg = FMC_Bank5_6->SDCR[0]; + FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF); +#endif /* DATA_IN_ExtSDRAM */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\ + || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\ + || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) + +#if defined(DATA_IN_ExtSRAM) +/*-- GPIOs Configuration -----------------------------------------------------*/ + /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */ + RCC->AHB1ENR |= 0x00000078; + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN); + + /* Connect PDx pins to FMC Alternate function */ + GPIOD->AFR[0] = 0x00CCC0CC; + GPIOD->AFR[1] = 0xCCCCCCCC; + /* Configure PDx pins in Alternate function mode */ + GPIOD->MODER = 0xAAAA0A8A; + /* Configure PDx pins speed to 100 MHz */ + GPIOD->OSPEEDR = 0xFFFF0FCF; + /* Configure PDx pins Output type to push-pull */ + GPIOD->OTYPER = 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOD->PUPDR = 0x00000000; + + /* Connect PEx pins to FMC Alternate function */ + GPIOE->AFR[0] = 0xC00CC0CC; + GPIOE->AFR[1] = 0xCCCCCCCC; + /* Configure PEx pins in Alternate function mode */ + GPIOE->MODER = 0xAAAA828A; + /* Configure PEx pins speed to 100 MHz */ + GPIOE->OSPEEDR = 0xFFFFC3CF; + /* Configure PEx pins Output type to push-pull */ + GPIOE->OTYPER = 0x00000000; + /* No pull-up, pull-down for PEx pins */ + GPIOE->PUPDR = 0x00000000; + + /* Connect PFx pins to FMC Alternate function */ + GPIOF->AFR[0] = 0x00CCCCCC; + GPIOF->AFR[1] = 0xCCCC0000; + /* Configure PFx pins in Alternate function mode */ + GPIOF->MODER = 0xAA000AAA; + /* Configure PFx pins speed to 100 MHz */ + GPIOF->OSPEEDR = 0xFF000FFF; + /* Configure PFx pins Output type to push-pull */ + GPIOF->OTYPER = 0x00000000; + /* No pull-up, pull-down for PFx pins */ + GPIOF->PUPDR = 0x00000000; + + /* Connect PGx pins to FMC Alternate function */ + GPIOG->AFR[0] = 0x00CCCCCC; + GPIOG->AFR[1] = 0x000000C0; + /* Configure PGx pins in Alternate function mode */ + GPIOG->MODER = 0x00085AAA; + /* Configure PGx pins speed to 100 MHz */ + GPIOG->OSPEEDR = 0x000CAFFF; + /* Configure PGx pins Output type to push-pull */ + GPIOG->OTYPER = 0x00000000; + /* No pull-up, pull-down for PGx pins */ + GPIOG->PUPDR = 0x00000000; + +/*-- FMC/FSMC Configuration --------------------------------------------------*/ + /* Enable the FMC/FSMC interface clock */ + RCC->AHB3ENR |= 0x00000001; + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); + /* Configure and enable Bank1_SRAM2 */ + FMC_Bank1->BTCR[2] = 0x00001011; + FMC_Bank1->BTCR[3] = 0x00000201; + FMC_Bank1E->BWTR[2] = 0x0fffffff; +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ +#if defined(STM32F469xx) || defined(STM32F479xx) + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); + /* Configure and enable Bank1_SRAM2 */ + FMC_Bank1->BTCR[2] = 0x00001091; + FMC_Bank1->BTCR[3] = 0x00110212; + FMC_Bank1E->BWTR[2] = 0x0fffffff; +#endif /* STM32F469xx || STM32F479xx */ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)\ + || defined(STM32F412Zx) || defined(STM32F412Vx) + /* Delay after an RCC peripheral clock enabling */ + tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN); + /* Configure and enable Bank1_SRAM2 */ + FSMC_Bank1->BTCR[2] = 0x00001011; + FSMC_Bank1->BTCR[3] = 0x00000201; + FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF; +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx */ + +#endif /* DATA_IN_ExtSRAM */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ + STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx */ + (void)(tmp); +} +#endif /* DATA_IN_ExtSRAM && DATA_IN_ExtSDRAM */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/tim.c b/EMBOS/Core/Src/tim.c new file mode 100644 index 0000000..c9c1750 --- /dev/null +++ b/EMBOS/Core/Src/tim.c @@ -0,0 +1,182 @@ +/** + ****************************************************************************** + * @file tim.c + * @brief This file provides code for the configuration + * of the TIM instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "tim.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* TIM8 init function */ +void MX_TIM8_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM8); + + /* TIM8 interrupt Init */ + NVIC_SetPriority(TIM8_BRK_TIM12_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_BRK_TIM12_IRQn); + NVIC_SetPriority(TIM8_UP_TIM13_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn); + NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn); + + TIM_InitStruct.Prescaler = 179; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 99; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + TIM_InitStruct.RepetitionCounter = 0; + LL_TIM_Init(TIM8, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM8); + LL_TIM_SetClockSource(TIM8, LL_TIM_CLOCKSOURCE_INTERNAL); + LL_TIM_SetTriggerOutput(TIM8, LL_TIM_TRGO_RESET); + LL_TIM_DisableMasterSlaveMode(TIM8); + +} +/* TIM9 init function */ +void MX_TIM9_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM9); + + /* TIM9 interrupt Init */ + NVIC_SetPriority(TIM1_BRK_TIM9_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM1_BRK_TIM9_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM9, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM9); + LL_TIM_SetClockSource(TIM9, LL_TIM_CLOCKSOURCE_INTERNAL); + +} +/* TIM10 init function */ +void MX_TIM10_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM10); + + /* TIM10 interrupt Init */ + NVIC_SetPriority(TIM1_UP_TIM10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM1_UP_TIM10_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM10, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM10); + +} +/* TIM11 init function */ +void MX_TIM11_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM11); + + /* TIM11 interrupt Init */ + NVIC_SetPriority(TIM1_TRG_COM_TIM11_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM1_TRG_COM_TIM11_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM11, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM11); + +} +/* TIM12 init function */ +void MX_TIM12_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM12); + + /* TIM12 interrupt Init */ + NVIC_SetPriority(TIM8_BRK_TIM12_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_BRK_TIM12_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM12, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM12); + LL_TIM_SetClockSource(TIM12, LL_TIM_CLOCKSOURCE_INTERNAL); + +} +/* TIM13 init function */ +void MX_TIM13_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM13); + + /* TIM13 interrupt Init */ + NVIC_SetPriority(TIM8_UP_TIM13_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM13, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM13); + +} +/* TIM14 init function */ +void MX_TIM14_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM14); + + /* TIM14 interrupt Init */ + NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn); + + TIM_InitStruct.Prescaler = 299; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 65535; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + LL_TIM_Init(TIM14, &TIM_InitStruct); + LL_TIM_DisableARRPreload(TIM14); + +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Src/usart.c b/EMBOS/Core/Src/usart.c new file mode 100644 index 0000000..cbcd963 --- /dev/null +++ b/EMBOS/Core/Src/usart.c @@ -0,0 +1,112 @@ +/** + ****************************************************************************** + * @file usart.c + * @brief This file provides code for the configuration + * of the USART instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usart.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* USART1 init function */ + +void MX_USART1_UART_Init(void) +{ + LL_USART_InitTypeDef USART_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); + + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); + /**USART1 GPIO Configuration + PA9 ------> USART1_TX + PA10 ------> USART1_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_7; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USART1 interrupt Init */ + NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(USART1_IRQn); + + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART1, &USART_InitStruct); + LL_USART_ConfigAsyncMode(USART1); + LL_USART_Enable(USART1); + +} +/* USART6 init function */ + +void MX_USART6_UART_Init(void) +{ + LL_USART_InitTypeDef USART_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART6); + + LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC); + /**USART6 GPIO Configuration + PC6 ------> USART6_TX + PC7 ------> USART6_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_8; + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /* USART6 interrupt Init */ + NVIC_SetPriority(USART6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(USART6_IRQn); + + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART6, &USART_InitStruct); + LL_USART_ConfigAsyncMode(USART6); + LL_USART_Enable(USART6); + +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Core/Startup/startup_stm32f446zetx.s b/EMBOS/Core/Startup/startup_stm32f446zetx.s new file mode 100644 index 0000000..e023d00 --- /dev/null +++ b/EMBOS/Core/Startup/startup_stm32f446zetx.s @@ -0,0 +1,536 @@ +/** + ****************************************************************************** + * @file startup_stm32f446xx.s + * @author MCD Application Team + * @brief STM32F446xx Devices vector table for GCC based toolchains. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M4 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss +/* stack used for SystemInit_ExtMemCtl; always internal RAM used */ + +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr sp, =_estack /* set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + bx lr +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * @param None + * @retval None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex M3. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +*******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + + /* External Interrupts */ + .word WWDG_IRQHandler /* Window WatchDog */ + .word PVD_IRQHandler /* PVD through EXTI Line detection */ + .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ + .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ + .word FLASH_IRQHandler /* FLASH */ + .word RCC_IRQHandler /* RCC */ + .word EXTI0_IRQHandler /* EXTI Line0 */ + .word EXTI1_IRQHandler /* EXTI Line1 */ + .word EXTI2_IRQHandler /* EXTI Line2 */ + .word EXTI3_IRQHandler /* EXTI Line3 */ + .word EXTI4_IRQHandler /* EXTI Line4 */ + .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ + .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ + .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ + .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ + .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ + .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ + .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ + .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ + .word CAN1_TX_IRQHandler /* CAN1 TX */ + .word CAN1_RX0_IRQHandler /* CAN1 RX0 */ + .word CAN1_RX1_IRQHandler /* CAN1 RX1 */ + .word CAN1_SCE_IRQHandler /* CAN1 SCE */ + .word EXTI9_5_IRQHandler /* External Line[9:5]s */ + .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */ + .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */ + .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */ + .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ + .word TIM2_IRQHandler /* TIM2 */ + .word TIM3_IRQHandler /* TIM3 */ + .word TIM4_IRQHandler /* TIM4 */ + .word I2C1_EV_IRQHandler /* I2C1 Event */ + .word I2C1_ER_IRQHandler /* I2C1 Error */ + .word I2C2_EV_IRQHandler /* I2C2 Event */ + .word I2C2_ER_IRQHandler /* I2C2 Error */ + .word SPI1_IRQHandler /* SPI1 */ + .word SPI2_IRQHandler /* SPI2 */ + .word USART1_IRQHandler /* USART1 */ + .word USART2_IRQHandler /* USART2 */ + .word USART3_IRQHandler /* USART3 */ + .word EXTI15_10_IRQHandler /* External Line[15:10]s */ + .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ + .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */ + .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ + .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ + .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ + .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ + .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ + .word FMC_IRQHandler /* FMC */ + .word SDIO_IRQHandler /* SDIO */ + .word TIM5_IRQHandler /* TIM5 */ + .word SPI3_IRQHandler /* SPI3 */ + .word UART4_IRQHandler /* UART4 */ + .word UART5_IRQHandler /* UART5 */ + .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */ + .word TIM7_IRQHandler /* TIM7 */ + .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ + .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ + .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ + .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ + .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word CAN2_TX_IRQHandler /* CAN2 TX */ + .word CAN2_RX0_IRQHandler /* CAN2 RX0 */ + .word CAN2_RX1_IRQHandler /* CAN2 RX1 */ + .word CAN2_SCE_IRQHandler /* CAN2 SCE */ + .word OTG_FS_IRQHandler /* USB OTG FS */ + .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ + .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ + .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ + .word USART6_IRQHandler /* USART6 */ + .word I2C3_EV_IRQHandler /* I2C3 event */ + .word I2C3_ER_IRQHandler /* I2C3 error */ + .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */ + .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */ + .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */ + .word OTG_HS_IRQHandler /* USB OTG HS */ + .word DCMI_IRQHandler /* DCMI */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word FPU_IRQHandler /* FPU */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word SPI4_IRQHandler /* SPI4 */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word SAI1_IRQHandler /* SAI1 */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word 0 /* Reserved */ + .word SAI2_IRQHandler /* SAI2 */ + .word QUADSPI_IRQHandler /* QuadSPI */ + .word CEC_IRQHandler /* CEC */ + .word SPDIF_RX_IRQHandler /* SPDIF RX */ + .word FMPI2C1_EV_IRQHandler /* FMPI2C 1 Event */ + .word FMPI2C1_ER_IRQHandler /* FMPI2C 1 Error */ + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_IRQHandler + .thumb_set PVD_IRQHandler,Default_Handler + + .weak TAMP_STAMP_IRQHandler + .thumb_set TAMP_STAMP_IRQHandler,Default_Handler + + .weak RTC_WKUP_IRQHandler + .thumb_set RTC_WKUP_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Stream0_IRQHandler + .thumb_set DMA1_Stream0_IRQHandler,Default_Handler + + .weak DMA1_Stream1_IRQHandler + .thumb_set DMA1_Stream1_IRQHandler,Default_Handler + + .weak DMA1_Stream2_IRQHandler + .thumb_set DMA1_Stream2_IRQHandler,Default_Handler + + .weak DMA1_Stream3_IRQHandler + .thumb_set DMA1_Stream3_IRQHandler,Default_Handler + + .weak DMA1_Stream4_IRQHandler + .thumb_set DMA1_Stream4_IRQHandler,Default_Handler + + .weak DMA1_Stream5_IRQHandler + .thumb_set DMA1_Stream5_IRQHandler,Default_Handler + + .weak DMA1_Stream6_IRQHandler + .thumb_set DMA1_Stream6_IRQHandler,Default_Handler + + .weak ADC_IRQHandler + .thumb_set ADC_IRQHandler,Default_Handler + + .weak CAN1_TX_IRQHandler + .thumb_set CAN1_TX_IRQHandler,Default_Handler + + .weak CAN1_RX0_IRQHandler + .thumb_set CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_TIM9_IRQHandler + .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler + + .weak TIM1_UP_TIM10_IRQHandler + .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_TIM11_IRQHandler + .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak TIM3_IRQHandler + .thumb_set TIM3_IRQHandler,Default_Handler + + .weak TIM4_IRQHandler + .thumb_set TIM4_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak OTG_FS_WKUP_IRQHandler + .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler + + .weak TIM8_BRK_TIM12_IRQHandler + .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler + + .weak TIM8_UP_TIM13_IRQHandler + .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler + + .weak TIM8_TRG_COM_TIM14_IRQHandler + .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler + + .weak TIM8_CC_IRQHandler + .thumb_set TIM8_CC_IRQHandler,Default_Handler + + .weak DMA1_Stream7_IRQHandler + .thumb_set DMA1_Stream7_IRQHandler,Default_Handler + + .weak FMC_IRQHandler + .thumb_set FMC_IRQHandler,Default_Handler + + .weak SDIO_IRQHandler + .thumb_set SDIO_IRQHandler,Default_Handler + + .weak TIM5_IRQHandler + .thumb_set TIM5_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak UART4_IRQHandler + .thumb_set UART4_IRQHandler,Default_Handler + + .weak UART5_IRQHandler + .thumb_set UART5_IRQHandler,Default_Handler + + .weak TIM6_DAC_IRQHandler + .thumb_set TIM6_DAC_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Stream0_IRQHandler + .thumb_set DMA2_Stream0_IRQHandler,Default_Handler + + .weak DMA2_Stream1_IRQHandler + .thumb_set DMA2_Stream1_IRQHandler,Default_Handler + + .weak DMA2_Stream2_IRQHandler + .thumb_set DMA2_Stream2_IRQHandler,Default_Handler + + .weak DMA2_Stream3_IRQHandler + .thumb_set DMA2_Stream3_IRQHandler,Default_Handler + + .weak DMA2_Stream4_IRQHandler + .thumb_set DMA2_Stream4_IRQHandler,Default_Handler + + .weak CAN2_TX_IRQHandler + .thumb_set CAN2_TX_IRQHandler,Default_Handler + + .weak CAN2_RX0_IRQHandler + .thumb_set CAN2_RX0_IRQHandler,Default_Handler + + .weak CAN2_RX1_IRQHandler + .thumb_set CAN2_RX1_IRQHandler,Default_Handler + + .weak CAN2_SCE_IRQHandler + .thumb_set CAN2_SCE_IRQHandler,Default_Handler + + .weak OTG_FS_IRQHandler + .thumb_set OTG_FS_IRQHandler,Default_Handler + + .weak DMA2_Stream5_IRQHandler + .thumb_set DMA2_Stream5_IRQHandler,Default_Handler + + .weak DMA2_Stream6_IRQHandler + .thumb_set DMA2_Stream6_IRQHandler,Default_Handler + + .weak DMA2_Stream7_IRQHandler + .thumb_set DMA2_Stream7_IRQHandler,Default_Handler + + .weak USART6_IRQHandler + .thumb_set USART6_IRQHandler,Default_Handler + + .weak I2C3_EV_IRQHandler + .thumb_set I2C3_EV_IRQHandler,Default_Handler + + .weak I2C3_ER_IRQHandler + .thumb_set I2C3_ER_IRQHandler,Default_Handler + + .weak OTG_HS_EP1_OUT_IRQHandler + .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler + + .weak OTG_HS_EP1_IN_IRQHandler + .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler + + .weak OTG_HS_WKUP_IRQHandler + .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler + + .weak OTG_HS_IRQHandler + .thumb_set OTG_HS_IRQHandler,Default_Handler + + .weak DCMI_IRQHandler + .thumb_set DCMI_IRQHandler,Default_Handler + + .weak FPU_IRQHandler + .thumb_set FPU_IRQHandler,Default_Handler + + .weak SPI4_IRQHandler + .thumb_set SPI4_IRQHandler,Default_Handler + + .weak SAI1_IRQHandler + .thumb_set SAI1_IRQHandler,Default_Handler + + .weak SAI2_IRQHandler + .thumb_set SAI2_IRQHandler,Default_Handler + + .weak QUADSPI_IRQHandler + .thumb_set QUADSPI_IRQHandler,Default_Handler + + .weak CEC_IRQHandler + .thumb_set CEC_IRQHandler,Default_Handler + + .weak SPDIF_RX_IRQHandler + .thumb_set SPDIF_RX_IRQHandler,Default_Handler + + .weak FMPI2C1_EV_IRQHandler + .thumb_set FMPI2C1_EV_IRQHandler,Default_Handler + + .weak FMPI2C1_ER_IRQHandler + .thumb_set FMPI2C1_ER_IRQHandler,Default_Handler + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h b/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h new file mode 100644 index 0000000..3e08c45 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h @@ -0,0 +1,15974 @@ +/** + ****************************************************************************** + * @file stm32f446xx.h + * @author MCD Application Team + * @brief CMSIS STM32F446xx Device Peripheral Access Layer Header File. + * + * This file contains: + * - Data structures and the address mapping for all peripherals + * - peripherals registers declarations and bits definition + * - Macros to access peripheral’s registers hardware + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS_Device + * @{ + */ + +/** @addtogroup stm32f446xx + * @{ + */ + +#ifndef __STM32F446xx_H +#define __STM32F446xx_H + +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +/** @addtogroup Configuration_section_for_CMSIS + * @{ + */ + +/** + * @brief Configuration of the Cortex-M4 Processor and Core Peripherals + */ +#define __CM4_REV 0x0001U /*!< Core revision r0p1 */ +#define __MPU_PRESENT 1U /*!< STM32F4XX provides an MPU */ +#define __NVIC_PRIO_BITS 4U /*!< STM32F4XX uses 4 Bits for the Priority Levels */ +#define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ +#define __FPU_PRESENT 1U /*!< FPU present */ + +/** + * @} + */ + +/** @addtogroup Peripheral_interrupt_number_definition + * @{ + */ + +/** + * @brief STM32F4XX Interrupt Number Definition, according to the selected device + * in @ref Library_configuration_section + */ +typedef enum +{ +/****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/ + NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ + MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */ + BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */ + UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */ + SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */ + DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */ + PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */ + SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */ +/****** STM32 specific Interrupt Numbers **********************************************************************/ + WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ + PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ + TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */ + RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line */ + FLASH_IRQn = 4, /*!< FLASH global Interrupt */ + RCC_IRQn = 5, /*!< RCC global Interrupt */ + EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */ + EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */ + EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */ + EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */ + EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */ + DMA1_Stream0_IRQn = 11, /*!< DMA1 Stream 0 global Interrupt */ + DMA1_Stream1_IRQn = 12, /*!< DMA1 Stream 1 global Interrupt */ + DMA1_Stream2_IRQn = 13, /*!< DMA1 Stream 2 global Interrupt */ + DMA1_Stream3_IRQn = 14, /*!< DMA1 Stream 3 global Interrupt */ + DMA1_Stream4_IRQn = 15, /*!< DMA1 Stream 4 global Interrupt */ + DMA1_Stream5_IRQn = 16, /*!< DMA1 Stream 5 global Interrupt */ + DMA1_Stream6_IRQn = 17, /*!< DMA1 Stream 6 global Interrupt */ + ADC_IRQn = 18, /*!< ADC1, ADC2 and ADC3 global Interrupts */ + CAN1_TX_IRQn = 19, /*!< CAN1 TX Interrupt */ + CAN1_RX0_IRQn = 20, /*!< CAN1 RX0 Interrupt */ + CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ + CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ + EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ + TIM1_BRK_TIM9_IRQn = 24, /*!< TIM1 Break interrupt and TIM9 global interrupt */ + TIM1_UP_TIM10_IRQn = 25, /*!< TIM1 Update Interrupt and TIM10 global interrupt */ + TIM1_TRG_COM_TIM11_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */ + TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */ + TIM2_IRQn = 28, /*!< TIM2 global Interrupt */ + TIM3_IRQn = 29, /*!< TIM3 global Interrupt */ + TIM4_IRQn = 30, /*!< TIM4 global Interrupt */ + I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ + I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ + I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ + I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ + SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ + SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ + USART1_IRQn = 37, /*!< USART1 global Interrupt */ + USART2_IRQn = 38, /*!< USART2 global Interrupt */ + USART3_IRQn = 39, /*!< USART3 global Interrupt */ + EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ + RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line Interrupt */ + OTG_FS_WKUP_IRQn = 42, /*!< USB OTG FS Wakeup through EXTI line interrupt */ + TIM8_BRK_TIM12_IRQn = 43, /*!< TIM8 Break Interrupt and TIM12 global interrupt */ + TIM8_UP_TIM13_IRQn = 44, /*!< TIM8 Update Interrupt and TIM13 global interrupt */ + TIM8_TRG_COM_TIM14_IRQn = 45, /*!< TIM8 Trigger and Commutation Interrupt and TIM14 global interrupt */ + TIM8_CC_IRQn = 46, /*!< TIM8 Capture Compare global interrupt */ + DMA1_Stream7_IRQn = 47, /*!< DMA1 Stream7 Interrupt */ + FMC_IRQn = 48, /*!< FMC global Interrupt */ + SDIO_IRQn = 49, /*!< SDIO global Interrupt */ + TIM5_IRQn = 50, /*!< TIM5 global Interrupt */ + SPI3_IRQn = 51, /*!< SPI3 global Interrupt */ + UART4_IRQn = 52, /*!< UART4 global Interrupt */ + UART5_IRQn = 53, /*!< UART5 global Interrupt */ + TIM6_DAC_IRQn = 54, /*!< TIM6 global and DAC1&2 underrun error interrupts */ + TIM7_IRQn = 55, /*!< TIM7 global interrupt */ + DMA2_Stream0_IRQn = 56, /*!< DMA2 Stream 0 global Interrupt */ + DMA2_Stream1_IRQn = 57, /*!< DMA2 Stream 1 global Interrupt */ + DMA2_Stream2_IRQn = 58, /*!< DMA2 Stream 2 global Interrupt */ + DMA2_Stream3_IRQn = 59, /*!< DMA2 Stream 3 global Interrupt */ + DMA2_Stream4_IRQn = 60, /*!< DMA2 Stream 4 global Interrupt */ + CAN2_TX_IRQn = 63, /*!< CAN2 TX Interrupt */ + CAN2_RX0_IRQn = 64, /*!< CAN2 RX0 Interrupt */ + CAN2_RX1_IRQn = 65, /*!< CAN2 RX1 Interrupt */ + CAN2_SCE_IRQn = 66, /*!< CAN2 SCE Interrupt */ + OTG_FS_IRQn = 67, /*!< USB OTG FS global Interrupt */ + DMA2_Stream5_IRQn = 68, /*!< DMA2 Stream 5 global interrupt */ + DMA2_Stream6_IRQn = 69, /*!< DMA2 Stream 6 global interrupt */ + DMA2_Stream7_IRQn = 70, /*!< DMA2 Stream 7 global interrupt */ + USART6_IRQn = 71, /*!< USART6 global interrupt */ + I2C3_EV_IRQn = 72, /*!< I2C3 event interrupt */ + I2C3_ER_IRQn = 73, /*!< I2C3 error interrupt */ + OTG_HS_EP1_OUT_IRQn = 74, /*!< USB OTG HS End Point 1 Out global interrupt */ + OTG_HS_EP1_IN_IRQn = 75, /*!< USB OTG HS End Point 1 In global interrupt */ + OTG_HS_WKUP_IRQn = 76, /*!< USB OTG HS Wakeup through EXTI interrupt */ + OTG_HS_IRQn = 77, /*!< USB OTG HS global interrupt */ + DCMI_IRQn = 78, /*!< DCMI global interrupt */ + FPU_IRQn = 81, /*!< FPU global interrupt */ + SPI4_IRQn = 84, /*!< SPI4 global Interrupt */ + SAI1_IRQn = 87, /*!< SAI1 global Interrupt */ + SAI2_IRQn = 91, /*!< SAI2 global Interrupt */ + QUADSPI_IRQn = 92, /*!< QuadSPI global Interrupt */ + CEC_IRQn = 93, /*!< CEC global Interrupt */ + SPDIF_RX_IRQn = 94, /*!< SPDIF-RX global Interrupt */ + FMPI2C1_EV_IRQn = 95, /*!< FMPI2C1 Event Interrupt */ + FMPI2C1_ER_IRQn = 96 /*!< FMPI2C1 Error Interrupt */ +} IRQn_Type; + +/** + * @} + */ + +#include "core_cm4.h" /* Cortex-M4 processor and core peripherals */ +#include "system_stm32f4xx.h" +#include + +/** @addtogroup Peripheral_registers_structures + * @{ + */ + +/** + * @brief Analog to Digital Converter + */ + +typedef struct +{ + __IO uint32_t SR; /*!< ADC status register, Address offset: 0x00 */ + __IO uint32_t CR1; /*!< ADC control register 1, Address offset: 0x04 */ + __IO uint32_t CR2; /*!< ADC control register 2, Address offset: 0x08 */ + __IO uint32_t SMPR1; /*!< ADC sample time register 1, Address offset: 0x0C */ + __IO uint32_t SMPR2; /*!< ADC sample time register 2, Address offset: 0x10 */ + __IO uint32_t JOFR1; /*!< ADC injected channel data offset register 1, Address offset: 0x14 */ + __IO uint32_t JOFR2; /*!< ADC injected channel data offset register 2, Address offset: 0x18 */ + __IO uint32_t JOFR3; /*!< ADC injected channel data offset register 3, Address offset: 0x1C */ + __IO uint32_t JOFR4; /*!< ADC injected channel data offset register 4, Address offset: 0x20 */ + __IO uint32_t HTR; /*!< ADC watchdog higher threshold register, Address offset: 0x24 */ + __IO uint32_t LTR; /*!< ADC watchdog lower threshold register, Address offset: 0x28 */ + __IO uint32_t SQR1; /*!< ADC regular sequence register 1, Address offset: 0x2C */ + __IO uint32_t SQR2; /*!< ADC regular sequence register 2, Address offset: 0x30 */ + __IO uint32_t SQR3; /*!< ADC regular sequence register 3, Address offset: 0x34 */ + __IO uint32_t JSQR; /*!< ADC injected sequence register, Address offset: 0x38*/ + __IO uint32_t JDR1; /*!< ADC injected data register 1, Address offset: 0x3C */ + __IO uint32_t JDR2; /*!< ADC injected data register 2, Address offset: 0x40 */ + __IO uint32_t JDR3; /*!< ADC injected data register 3, Address offset: 0x44 */ + __IO uint32_t JDR4; /*!< ADC injected data register 4, Address offset: 0x48 */ + __IO uint32_t DR; /*!< ADC regular data register, Address offset: 0x4C */ +} ADC_TypeDef; + +typedef struct +{ + __IO uint32_t CSR; /*!< ADC Common status register, Address offset: ADC1 base address + 0x300 */ + __IO uint32_t CCR; /*!< ADC common control register, Address offset: ADC1 base address + 0x304 */ + __IO uint32_t CDR; /*!< ADC common regular data register for dual + AND triple modes, Address offset: ADC1 base address + 0x308 */ +} ADC_Common_TypeDef; + + +/** + * @brief Controller Area Network TxMailBox + */ + +typedef struct +{ + __IO uint32_t TIR; /*!< CAN TX mailbox identifier register */ + __IO uint32_t TDTR; /*!< CAN mailbox data length control and time stamp register */ + __IO uint32_t TDLR; /*!< CAN mailbox data low register */ + __IO uint32_t TDHR; /*!< CAN mailbox data high register */ +} CAN_TxMailBox_TypeDef; + +/** + * @brief Controller Area Network FIFOMailBox + */ + +typedef struct +{ + __IO uint32_t RIR; /*!< CAN receive FIFO mailbox identifier register */ + __IO uint32_t RDTR; /*!< CAN receive FIFO mailbox data length control and time stamp register */ + __IO uint32_t RDLR; /*!< CAN receive FIFO mailbox data low register */ + __IO uint32_t RDHR; /*!< CAN receive FIFO mailbox data high register */ +} CAN_FIFOMailBox_TypeDef; + +/** + * @brief Controller Area Network FilterRegister + */ + +typedef struct +{ + __IO uint32_t FR1; /*!< CAN Filter bank register 1 */ + __IO uint32_t FR2; /*!< CAN Filter bank register 1 */ +} CAN_FilterRegister_TypeDef; + +/** + * @brief Controller Area Network + */ + +typedef struct +{ + __IO uint32_t MCR; /*!< CAN master control register, Address offset: 0x00 */ + __IO uint32_t MSR; /*!< CAN master status register, Address offset: 0x04 */ + __IO uint32_t TSR; /*!< CAN transmit status register, Address offset: 0x08 */ + __IO uint32_t RF0R; /*!< CAN receive FIFO 0 register, Address offset: 0x0C */ + __IO uint32_t RF1R; /*!< CAN receive FIFO 1 register, Address offset: 0x10 */ + __IO uint32_t IER; /*!< CAN interrupt enable register, Address offset: 0x14 */ + __IO uint32_t ESR; /*!< CAN error status register, Address offset: 0x18 */ + __IO uint32_t BTR; /*!< CAN bit timing register, Address offset: 0x1C */ + uint32_t RESERVED0[88]; /*!< Reserved, 0x020 - 0x17F */ + CAN_TxMailBox_TypeDef sTxMailBox[3]; /*!< CAN Tx MailBox, Address offset: 0x180 - 0x1AC */ + CAN_FIFOMailBox_TypeDef sFIFOMailBox[2]; /*!< CAN FIFO MailBox, Address offset: 0x1B0 - 0x1CC */ + uint32_t RESERVED1[12]; /*!< Reserved, 0x1D0 - 0x1FF */ + __IO uint32_t FMR; /*!< CAN filter master register, Address offset: 0x200 */ + __IO uint32_t FM1R; /*!< CAN filter mode register, Address offset: 0x204 */ + uint32_t RESERVED2; /*!< Reserved, 0x208 */ + __IO uint32_t FS1R; /*!< CAN filter scale register, Address offset: 0x20C */ + uint32_t RESERVED3; /*!< Reserved, 0x210 */ + __IO uint32_t FFA1R; /*!< CAN filter FIFO assignment register, Address offset: 0x214 */ + uint32_t RESERVED4; /*!< Reserved, 0x218 */ + __IO uint32_t FA1R; /*!< CAN filter activation register, Address offset: 0x21C */ + uint32_t RESERVED5[8]; /*!< Reserved, 0x220-0x23F */ + CAN_FilterRegister_TypeDef sFilterRegister[28]; /*!< CAN Filter Register, Address offset: 0x240-0x31C */ +} CAN_TypeDef; + + +/** + * @brief Consumer Electronics Control + */ + +typedef struct +{ + __IO uint32_t CR; /*!< CEC control register, Address offset:0x00 */ + __IO uint32_t CFGR; /*!< CEC configuration register, Address offset:0x04 */ + __IO uint32_t TXDR; /*!< CEC Tx data register , Address offset:0x08 */ + __IO uint32_t RXDR; /*!< CEC Rx Data Register, Address offset:0x0C */ + __IO uint32_t ISR; /*!< CEC Interrupt and Status Register, Address offset:0x10 */ + __IO uint32_t IER; /*!< CEC interrupt enable register, Address offset:0x14 */ +}CEC_TypeDef; +/** + * @brief CRC calculation unit + */ + +typedef struct +{ + __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */ + __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */ + uint8_t RESERVED0; /*!< Reserved, 0x05 */ + uint16_t RESERVED1; /*!< Reserved, 0x06 */ + __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */ +} CRC_TypeDef; + +/** + * @brief Digital to Analog Converter + */ + +typedef struct +{ + __IO uint32_t CR; /*!< DAC control register, Address offset: 0x00 */ + __IO uint32_t SWTRIGR; /*!< DAC software trigger register, Address offset: 0x04 */ + __IO uint32_t DHR12R1; /*!< DAC channel1 12-bit right-aligned data holding register, Address offset: 0x08 */ + __IO uint32_t DHR12L1; /*!< DAC channel1 12-bit left aligned data holding register, Address offset: 0x0C */ + __IO uint32_t DHR8R1; /*!< DAC channel1 8-bit right aligned data holding register, Address offset: 0x10 */ + __IO uint32_t DHR12R2; /*!< DAC channel2 12-bit right aligned data holding register, Address offset: 0x14 */ + __IO uint32_t DHR12L2; /*!< DAC channel2 12-bit left aligned data holding register, Address offset: 0x18 */ + __IO uint32_t DHR8R2; /*!< DAC channel2 8-bit right-aligned data holding register, Address offset: 0x1C */ + __IO uint32_t DHR12RD; /*!< Dual DAC 12-bit right-aligned data holding register, Address offset: 0x20 */ + __IO uint32_t DHR12LD; /*!< DUAL DAC 12-bit left aligned data holding register, Address offset: 0x24 */ + __IO uint32_t DHR8RD; /*!< DUAL DAC 8-bit right aligned data holding register, Address offset: 0x28 */ + __IO uint32_t DOR1; /*!< DAC channel1 data output register, Address offset: 0x2C */ + __IO uint32_t DOR2; /*!< DAC channel2 data output register, Address offset: 0x30 */ + __IO uint32_t SR; /*!< DAC status register, Address offset: 0x34 */ +} DAC_TypeDef; + +/** + * @brief Debug MCU + */ + +typedef struct +{ + __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */ + __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */ + __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */ + __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */ +}DBGMCU_TypeDef; + +/** + * @brief DCMI + */ + +typedef struct +{ + __IO uint32_t CR; /*!< DCMI control register 1, Address offset: 0x00 */ + __IO uint32_t SR; /*!< DCMI status register, Address offset: 0x04 */ + __IO uint32_t RISR; /*!< DCMI raw interrupt status register, Address offset: 0x08 */ + __IO uint32_t IER; /*!< DCMI interrupt enable register, Address offset: 0x0C */ + __IO uint32_t MISR; /*!< DCMI masked interrupt status register, Address offset: 0x10 */ + __IO uint32_t ICR; /*!< DCMI interrupt clear register, Address offset: 0x14 */ + __IO uint32_t ESCR; /*!< DCMI embedded synchronization code register, Address offset: 0x18 */ + __IO uint32_t ESUR; /*!< DCMI embedded synchronization unmask register, Address offset: 0x1C */ + __IO uint32_t CWSTRTR; /*!< DCMI crop window start, Address offset: 0x20 */ + __IO uint32_t CWSIZER; /*!< DCMI crop window size, Address offset: 0x24 */ + __IO uint32_t DR; /*!< DCMI data register, Address offset: 0x28 */ +} DCMI_TypeDef; + +/** + * @brief DMA Controller + */ + +typedef struct +{ + __IO uint32_t CR; /*!< DMA stream x configuration register */ + __IO uint32_t NDTR; /*!< DMA stream x number of data register */ + __IO uint32_t PAR; /*!< DMA stream x peripheral address register */ + __IO uint32_t M0AR; /*!< DMA stream x memory 0 address register */ + __IO uint32_t M1AR; /*!< DMA stream x memory 1 address register */ + __IO uint32_t FCR; /*!< DMA stream x FIFO control register */ +} DMA_Stream_TypeDef; + +typedef struct +{ + __IO uint32_t LISR; /*!< DMA low interrupt status register, Address offset: 0x00 */ + __IO uint32_t HISR; /*!< DMA high interrupt status register, Address offset: 0x04 */ + __IO uint32_t LIFCR; /*!< DMA low interrupt flag clear register, Address offset: 0x08 */ + __IO uint32_t HIFCR; /*!< DMA high interrupt flag clear register, Address offset: 0x0C */ +} DMA_TypeDef; + +/** + * @brief External Interrupt/Event Controller + */ + +typedef struct +{ + __IO uint32_t IMR; /*!< EXTI Interrupt mask register, Address offset: 0x00 */ + __IO uint32_t EMR; /*!< EXTI Event mask register, Address offset: 0x04 */ + __IO uint32_t RTSR; /*!< EXTI Rising trigger selection register, Address offset: 0x08 */ + __IO uint32_t FTSR; /*!< EXTI Falling trigger selection register, Address offset: 0x0C */ + __IO uint32_t SWIER; /*!< EXTI Software interrupt event register, Address offset: 0x10 */ + __IO uint32_t PR; /*!< EXTI Pending register, Address offset: 0x14 */ +} EXTI_TypeDef; + +/** + * @brief FLASH Registers + */ + +typedef struct +{ + __IO uint32_t ACR; /*!< FLASH access control register, Address offset: 0x00 */ + __IO uint32_t KEYR; /*!< FLASH key register, Address offset: 0x04 */ + __IO uint32_t OPTKEYR; /*!< FLASH option key register, Address offset: 0x08 */ + __IO uint32_t SR; /*!< FLASH status register, Address offset: 0x0C */ + __IO uint32_t CR; /*!< FLASH control register, Address offset: 0x10 */ + __IO uint32_t OPTCR; /*!< FLASH option control register , Address offset: 0x14 */ + __IO uint32_t OPTCR1; /*!< FLASH option control register 1, Address offset: 0x18 */ +} FLASH_TypeDef; + +/** + * @brief Flexible Memory Controller + */ + +typedef struct +{ + __IO uint32_t BTCR[8]; /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */ +} FMC_Bank1_TypeDef; + +/** + * @brief Flexible Memory Controller Bank1E + */ + +typedef struct +{ + __IO uint32_t BWTR[7]; /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */ +} FMC_Bank1E_TypeDef; + +/** + * @brief Flexible Memory Controller Bank3 + */ + +typedef struct +{ + __IO uint32_t PCR; /*!< NAND Flash control register, Address offset: 0x80 */ + __IO uint32_t SR; /*!< NAND Flash FIFO status and interrupt register, Address offset: 0x84 */ + __IO uint32_t PMEM; /*!< NAND Flash Common memory space timing register, Address offset: 0x88 */ + __IO uint32_t PATT; /*!< NAND Flash Attribute memory space timing register, Address offset: 0x8C */ + uint32_t RESERVED; /*!< Reserved, 0x90 */ + __IO uint32_t ECCR; /*!< NAND Flash ECC result registers, Address offset: 0x94 */ +} FMC_Bank3_TypeDef; + +/** + * @brief Flexible Memory Controller Bank5_6 + */ + +typedef struct +{ + __IO uint32_t SDCR[2]; /*!< SDRAM Control registers , Address offset: 0x140-0x144 */ + __IO uint32_t SDTR[2]; /*!< SDRAM Timing registers , Address offset: 0x148-0x14C */ + __IO uint32_t SDCMR; /*!< SDRAM Command Mode register, Address offset: 0x150 */ + __IO uint32_t SDRTR; /*!< SDRAM Refresh Timer register, Address offset: 0x154 */ + __IO uint32_t SDSR; /*!< SDRAM Status register, Address offset: 0x158 */ +} FMC_Bank5_6_TypeDef; + +/** + * @brief General Purpose I/O + */ + +typedef struct +{ + __IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */ + __IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */ + __IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */ + __IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */ + __IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */ + __IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */ + __IO uint32_t BSRR; /*!< GPIO port bit set/reset register, Address offset: 0x18 */ + __IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */ + __IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */ +} GPIO_TypeDef; + +/** + * @brief System configuration controller + */ + +typedef struct +{ + __IO uint32_t MEMRMP; /*!< SYSCFG memory remap register, Address offset: 0x00 */ + __IO uint32_t PMC; /*!< SYSCFG peripheral mode configuration register, Address offset: 0x04 */ + __IO uint32_t EXTICR[4]; /*!< SYSCFG external interrupt configuration registers, Address offset: 0x08-0x14 */ + uint32_t RESERVED[2]; /*!< Reserved, 0x18-0x1C */ + __IO uint32_t CMPCR; /*!< SYSCFG Compensation cell control register, Address offset: 0x20 */ + uint32_t RESERVED1[2]; /*!< Reserved, 0x24-0x28 */ + __IO uint32_t CFGR; /*!< SYSCFG Configuration register, Address offset: 0x2C */ +} SYSCFG_TypeDef; + +/** + * @brief Inter-integrated Circuit Interface + */ + +typedef struct +{ + __IO uint32_t CR1; /*!< I2C Control register 1, Address offset: 0x00 */ + __IO uint32_t CR2; /*!< I2C Control register 2, Address offset: 0x04 */ + __IO uint32_t OAR1; /*!< I2C Own address register 1, Address offset: 0x08 */ + __IO uint32_t OAR2; /*!< I2C Own address register 2, Address offset: 0x0C */ + __IO uint32_t DR; /*!< I2C Data register, Address offset: 0x10 */ + __IO uint32_t SR1; /*!< I2C Status register 1, Address offset: 0x14 */ + __IO uint32_t SR2; /*!< I2C Status register 2, Address offset: 0x18 */ + __IO uint32_t CCR; /*!< I2C Clock control register, Address offset: 0x1C */ + __IO uint32_t TRISE; /*!< I2C TRISE register, Address offset: 0x20 */ + __IO uint32_t FLTR; /*!< I2C FLTR register, Address offset: 0x24 */ +} I2C_TypeDef; + +/** + * @brief Inter-integrated Circuit Interface + */ + +typedef struct +{ + __IO uint32_t CR1; /*!< FMPI2C Control register 1, Address offset: 0x00 */ + __IO uint32_t CR2; /*!< FMPI2C Control register 2, Address offset: 0x04 */ + __IO uint32_t OAR1; /*!< FMPI2C Own address 1 register, Address offset: 0x08 */ + __IO uint32_t OAR2; /*!< FMPI2C Own address 2 register, Address offset: 0x0C */ + __IO uint32_t TIMINGR; /*!< FMPI2C Timing register, Address offset: 0x10 */ + __IO uint32_t TIMEOUTR; /*!< FMPI2C Timeout register, Address offset: 0x14 */ + __IO uint32_t ISR; /*!< FMPI2C Interrupt and status register, Address offset: 0x18 */ + __IO uint32_t ICR; /*!< FMPI2C Interrupt clear register, Address offset: 0x1C */ + __IO uint32_t PECR; /*!< FMPI2C PEC register, Address offset: 0x20 */ + __IO uint32_t RXDR; /*!< FMPI2C Receive data register, Address offset: 0x24 */ + __IO uint32_t TXDR; /*!< FMPI2C Transmit data register, Address offset: 0x28 */ +} FMPI2C_TypeDef; + +/** + * @brief Independent WATCHDOG + */ + +typedef struct +{ + __IO uint32_t KR; /*!< IWDG Key register, Address offset: 0x00 */ + __IO uint32_t PR; /*!< IWDG Prescaler register, Address offset: 0x04 */ + __IO uint32_t RLR; /*!< IWDG Reload register, Address offset: 0x08 */ + __IO uint32_t SR; /*!< IWDG Status register, Address offset: 0x0C */ +} IWDG_TypeDef; + + +/** + * @brief Power Control + */ + +typedef struct +{ + __IO uint32_t CR; /*!< PWR power control register, Address offset: 0x00 */ + __IO uint32_t CSR; /*!< PWR power control/status register, Address offset: 0x04 */ +} PWR_TypeDef; + +/** + * @brief Reset and Clock Control + */ + +typedef struct +{ + __IO uint32_t CR; /*!< RCC clock control register, Address offset: 0x00 */ + __IO uint32_t PLLCFGR; /*!< RCC PLL configuration register, Address offset: 0x04 */ + __IO uint32_t CFGR; /*!< RCC clock configuration register, Address offset: 0x08 */ + __IO uint32_t CIR; /*!< RCC clock interrupt register, Address offset: 0x0C */ + __IO uint32_t AHB1RSTR; /*!< RCC AHB1 peripheral reset register, Address offset: 0x10 */ + __IO uint32_t AHB2RSTR; /*!< RCC AHB2 peripheral reset register, Address offset: 0x14 */ + __IO uint32_t AHB3RSTR; /*!< RCC AHB3 peripheral reset register, Address offset: 0x18 */ + uint32_t RESERVED0; /*!< Reserved, 0x1C */ + __IO uint32_t APB1RSTR; /*!< RCC APB1 peripheral reset register, Address offset: 0x20 */ + __IO uint32_t APB2RSTR; /*!< RCC APB2 peripheral reset register, Address offset: 0x24 */ + uint32_t RESERVED1[2]; /*!< Reserved, 0x28-0x2C */ + __IO uint32_t AHB1ENR; /*!< RCC AHB1 peripheral clock register, Address offset: 0x30 */ + __IO uint32_t AHB2ENR; /*!< RCC AHB2 peripheral clock register, Address offset: 0x34 */ + __IO uint32_t AHB3ENR; /*!< RCC AHB3 peripheral clock register, Address offset: 0x38 */ + uint32_t RESERVED2; /*!< Reserved, 0x3C */ + __IO uint32_t APB1ENR; /*!< RCC APB1 peripheral clock enable register, Address offset: 0x40 */ + __IO uint32_t APB2ENR; /*!< RCC APB2 peripheral clock enable register, Address offset: 0x44 */ + uint32_t RESERVED3[2]; /*!< Reserved, 0x48-0x4C */ + __IO uint32_t AHB1LPENR; /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */ + __IO uint32_t AHB2LPENR; /*!< RCC AHB2 peripheral clock enable in low power mode register, Address offset: 0x54 */ + __IO uint32_t AHB3LPENR; /*!< RCC AHB3 peripheral clock enable in low power mode register, Address offset: 0x58 */ + uint32_t RESERVED4; /*!< Reserved, 0x5C */ + __IO uint32_t APB1LPENR; /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */ + __IO uint32_t APB2LPENR; /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */ + uint32_t RESERVED5[2]; /*!< Reserved, 0x68-0x6C */ + __IO uint32_t BDCR; /*!< RCC Backup domain control register, Address offset: 0x70 */ + __IO uint32_t CSR; /*!< RCC clock control & status register, Address offset: 0x74 */ + uint32_t RESERVED6[2]; /*!< Reserved, 0x78-0x7C */ + __IO uint32_t SSCGR; /*!< RCC spread spectrum clock generation register, Address offset: 0x80 */ + __IO uint32_t PLLI2SCFGR; /*!< RCC PLLI2S configuration register, Address offset: 0x84 */ + __IO uint32_t PLLSAICFGR; /*!< RCC PLLSAI configuration register, Address offset: 0x88 */ + __IO uint32_t DCKCFGR; /*!< RCC Dedicated Clocks configuration register, Address offset: 0x8C */ + __IO uint32_t CKGATENR; /*!< RCC Clocks Gated ENable Register, Address offset: 0x90 */ + __IO uint32_t DCKCFGR2; /*!< RCC Dedicated Clocks configuration register 2, Address offset: 0x94 */ +} RCC_TypeDef; + +/** + * @brief Real-Time Clock + */ + +typedef struct +{ + __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */ + __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */ + __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */ + __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */ + __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */ + __IO uint32_t WUTR; /*!< RTC wakeup timer register, Address offset: 0x14 */ + __IO uint32_t CALIBR; /*!< RTC calibration register, Address offset: 0x18 */ + __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */ + __IO uint32_t ALRMBR; /*!< RTC alarm B register, Address offset: 0x20 */ + __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */ + __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */ + __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */ + __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */ + __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */ + __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */ + __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */ + __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */ + __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */ + __IO uint32_t ALRMBSSR;/*!< RTC alarm B sub second register, Address offset: 0x48 */ + uint32_t RESERVED7; /*!< Reserved, 0x4C */ + __IO uint32_t BKP0R; /*!< RTC backup register 1, Address offset: 0x50 */ + __IO uint32_t BKP1R; /*!< RTC backup register 1, Address offset: 0x54 */ + __IO uint32_t BKP2R; /*!< RTC backup register 2, Address offset: 0x58 */ + __IO uint32_t BKP3R; /*!< RTC backup register 3, Address offset: 0x5C */ + __IO uint32_t BKP4R; /*!< RTC backup register 4, Address offset: 0x60 */ + __IO uint32_t BKP5R; /*!< RTC backup register 5, Address offset: 0x64 */ + __IO uint32_t BKP6R; /*!< RTC backup register 6, Address offset: 0x68 */ + __IO uint32_t BKP7R; /*!< RTC backup register 7, Address offset: 0x6C */ + __IO uint32_t BKP8R; /*!< RTC backup register 8, Address offset: 0x70 */ + __IO uint32_t BKP9R; /*!< RTC backup register 9, Address offset: 0x74 */ + __IO uint32_t BKP10R; /*!< RTC backup register 10, Address offset: 0x78 */ + __IO uint32_t BKP11R; /*!< RTC backup register 11, Address offset: 0x7C */ + __IO uint32_t BKP12R; /*!< RTC backup register 12, Address offset: 0x80 */ + __IO uint32_t BKP13R; /*!< RTC backup register 13, Address offset: 0x84 */ + __IO uint32_t BKP14R; /*!< RTC backup register 14, Address offset: 0x88 */ + __IO uint32_t BKP15R; /*!< RTC backup register 15, Address offset: 0x8C */ + __IO uint32_t BKP16R; /*!< RTC backup register 16, Address offset: 0x90 */ + __IO uint32_t BKP17R; /*!< RTC backup register 17, Address offset: 0x94 */ + __IO uint32_t BKP18R; /*!< RTC backup register 18, Address offset: 0x98 */ + __IO uint32_t BKP19R; /*!< RTC backup register 19, Address offset: 0x9C */ +} RTC_TypeDef; + +/** + * @brief Serial Audio Interface + */ + +typedef struct +{ + __IO uint32_t GCR; /*!< SAI global configuration register, Address offset: 0x00 */ +} SAI_TypeDef; + +typedef struct +{ + __IO uint32_t CR1; /*!< SAI block x configuration register 1, Address offset: 0x04 */ + __IO uint32_t CR2; /*!< SAI block x configuration register 2, Address offset: 0x08 */ + __IO uint32_t FRCR; /*!< SAI block x frame configuration register, Address offset: 0x0C */ + __IO uint32_t SLOTR; /*!< SAI block x slot register, Address offset: 0x10 */ + __IO uint32_t IMR; /*!< SAI block x interrupt mask register, Address offset: 0x14 */ + __IO uint32_t SR; /*!< SAI block x status register, Address offset: 0x18 */ + __IO uint32_t CLRFR; /*!< SAI block x clear flag register, Address offset: 0x1C */ + __IO uint32_t DR; /*!< SAI block x data register, Address offset: 0x20 */ +} SAI_Block_TypeDef; + +/** + * @brief SD host Interface + */ + +typedef struct +{ + __IO uint32_t POWER; /*!< SDIO power control register, Address offset: 0x00 */ + __IO uint32_t CLKCR; /*!< SDI clock control register, Address offset: 0x04 */ + __IO uint32_t ARG; /*!< SDIO argument register, Address offset: 0x08 */ + __IO uint32_t CMD; /*!< SDIO command register, Address offset: 0x0C */ + __IO const uint32_t RESPCMD; /*!< SDIO command response register, Address offset: 0x10 */ + __IO const uint32_t RESP1; /*!< SDIO response 1 register, Address offset: 0x14 */ + __IO const uint32_t RESP2; /*!< SDIO response 2 register, Address offset: 0x18 */ + __IO const uint32_t RESP3; /*!< SDIO response 3 register, Address offset: 0x1C */ + __IO const uint32_t RESP4; /*!< SDIO response 4 register, Address offset: 0x20 */ + __IO uint32_t DTIMER; /*!< SDIO data timer register, Address offset: 0x24 */ + __IO uint32_t DLEN; /*!< SDIO data length register, Address offset: 0x28 */ + __IO uint32_t DCTRL; /*!< SDIO data control register, Address offset: 0x2C */ + __IO const uint32_t DCOUNT; /*!< SDIO data counter register, Address offset: 0x30 */ + __IO const uint32_t STA; /*!< SDIO status register, Address offset: 0x34 */ + __IO uint32_t ICR; /*!< SDIO interrupt clear register, Address offset: 0x38 */ + __IO uint32_t MASK; /*!< SDIO mask register, Address offset: 0x3C */ + uint32_t RESERVED0[2]; /*!< Reserved, 0x40-0x44 */ + __IO const uint32_t FIFOCNT; /*!< SDIO FIFO counter register, Address offset: 0x48 */ + uint32_t RESERVED1[13]; /*!< Reserved, 0x4C-0x7C */ + __IO uint32_t FIFO; /*!< SDIO data FIFO register, Address offset: 0x80 */ +} SDIO_TypeDef; + +/** + * @brief Serial Peripheral Interface + */ + +typedef struct +{ + __IO uint32_t CR1; /*!< SPI control register 1 (not used in I2S mode), Address offset: 0x00 */ + __IO uint32_t CR2; /*!< SPI control register 2, Address offset: 0x04 */ + __IO uint32_t SR; /*!< SPI status register, Address offset: 0x08 */ + __IO uint32_t DR; /*!< SPI data register, Address offset: 0x0C */ + __IO uint32_t CRCPR; /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */ + __IO uint32_t RXCRCR; /*!< SPI RX CRC register (not used in I2S mode), Address offset: 0x14 */ + __IO uint32_t TXCRCR; /*!< SPI TX CRC register (not used in I2S mode), Address offset: 0x18 */ + __IO uint32_t I2SCFGR; /*!< SPI_I2S configuration register, Address offset: 0x1C */ + __IO uint32_t I2SPR; /*!< SPI_I2S prescaler register, Address offset: 0x20 */ +} SPI_TypeDef; + +/** + * @brief QUAD Serial Peripheral Interface + */ + +typedef struct +{ + __IO uint32_t CR; /*!< QUADSPI Control register, Address offset: 0x00 */ + __IO uint32_t DCR; /*!< QUADSPI Device Configuration register, Address offset: 0x04 */ + __IO uint32_t SR; /*!< QUADSPI Status register, Address offset: 0x08 */ + __IO uint32_t FCR; /*!< QUADSPI Flag Clear register, Address offset: 0x0C */ + __IO uint32_t DLR; /*!< QUADSPI Data Length register, Address offset: 0x10 */ + __IO uint32_t CCR; /*!< QUADSPI Communication Configuration register, Address offset: 0x14 */ + __IO uint32_t AR; /*!< QUADSPI Address register, Address offset: 0x18 */ + __IO uint32_t ABR; /*!< QUADSPI Alternate Bytes register, Address offset: 0x1C */ + __IO uint32_t DR; /*!< QUADSPI Data register, Address offset: 0x20 */ + __IO uint32_t PSMKR; /*!< QUADSPI Polling Status Mask register, Address offset: 0x24 */ + __IO uint32_t PSMAR; /*!< QUADSPI Polling Status Match register, Address offset: 0x28 */ + __IO uint32_t PIR; /*!< QUADSPI Polling Interval register, Address offset: 0x2C */ + __IO uint32_t LPTR; /*!< QUADSPI Low Power Timeout register, Address offset: 0x30 */ +} QUADSPI_TypeDef; + +/** + * @brief SPDIFRX Interface + */ + +typedef struct +{ + __IO uint32_t CR; /*!< Control register, Address offset: 0x00 */ + __IO uint16_t IMR; /*!< Interrupt mask register, Address offset: 0x04 */ + uint16_t RESERVED0; /*!< Reserved, 0x06 */ + __IO uint32_t SR; /*!< Status register, Address offset: 0x08 */ + __IO uint16_t IFCR; /*!< Interrupt Flag Clear register, Address offset: 0x0C */ + uint16_t RESERVED1; /*!< Reserved, 0x0E */ + __IO uint32_t DR; /*!< Data input register, Address offset: 0x10 */ + __IO uint32_t CSR; /*!< Channel Status register, Address offset: 0x14 */ + __IO uint32_t DIR; /*!< Debug Information register, Address offset: 0x18 */ + uint16_t RESERVED2; /*!< Reserved, 0x1A */ +} SPDIFRX_TypeDef; + +/** + * @brief TIM + */ + +typedef struct +{ + __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */ + __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */ + __IO uint32_t SMCR; /*!< TIM slave mode control register, Address offset: 0x08 */ + __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */ + __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */ + __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */ + __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */ + __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */ + __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */ + __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */ + __IO uint32_t PSC; /*!< TIM prescaler, Address offset: 0x28 */ + __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */ + __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */ + __IO uint32_t CCR1; /*!< TIM capture/compare register 1, Address offset: 0x34 */ + __IO uint32_t CCR2; /*!< TIM capture/compare register 2, Address offset: 0x38 */ + __IO uint32_t CCR3; /*!< TIM capture/compare register 3, Address offset: 0x3C */ + __IO uint32_t CCR4; /*!< TIM capture/compare register 4, Address offset: 0x40 */ + __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */ + __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */ + __IO uint32_t DMAR; /*!< TIM DMA address for full transfer, Address offset: 0x4C */ + __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */ +} TIM_TypeDef; + +/** + * @brief Universal Synchronous Asynchronous Receiver Transmitter + */ + +typedef struct +{ + __IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */ + __IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */ + __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */ + __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x0C */ + __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x10 */ + __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x14 */ + __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x18 */ +} USART_TypeDef; + +/** + * @brief Window WATCHDOG + */ + +typedef struct +{ + __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */ + __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */ + __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */ +} WWDG_TypeDef; +/** + * @brief USB_OTG_Core_Registers + */ +typedef struct +{ + __IO uint32_t GOTGCTL; /*!< USB_OTG Control and Status Register 000h */ + __IO uint32_t GOTGINT; /*!< USB_OTG Interrupt Register 004h */ + __IO uint32_t GAHBCFG; /*!< Core AHB Configuration Register 008h */ + __IO uint32_t GUSBCFG; /*!< Core USB Configuration Register 00Ch */ + __IO uint32_t GRSTCTL; /*!< Core Reset Register 010h */ + __IO uint32_t GINTSTS; /*!< Core Interrupt Register 014h */ + __IO uint32_t GINTMSK; /*!< Core Interrupt Mask Register 018h */ + __IO uint32_t GRXSTSR; /*!< Receive Sts Q Read Register 01Ch */ + __IO uint32_t GRXSTSP; /*!< Receive Sts Q Read & POP Register 020h */ + __IO uint32_t GRXFSIZ; /*!< Receive FIFO Size Register 024h */ + __IO uint32_t DIEPTXF0_HNPTXFSIZ; /*!< EP0 / Non Periodic Tx FIFO Size Register 028h */ + __IO uint32_t HNPTXSTS; /*!< Non Periodic Tx FIFO/Queue Sts reg 02Ch */ + uint32_t Reserved30[2]; /*!< Reserved 030h */ + __IO uint32_t GCCFG; /*!< General Purpose IO Register 038h */ + __IO uint32_t CID; /*!< User ID Register 03Ch */ + uint32_t Reserved5[3]; /*!< Reserved 040h-048h */ + __IO uint32_t GHWCFG3; /*!< User HW config3 04Ch */ + uint32_t Reserved6; /*!< Reserved 050h */ + __IO uint32_t GLPMCFG; /*!< LPM Register 054h */ + uint32_t Reserved; /*!< Reserved 058h */ + __IO uint32_t GDFIFOCFG; /*!< DFIFO Software Config Register 05Ch */ + uint32_t Reserved43[40]; /*!< Reserved 058h-0FFh */ + __IO uint32_t HPTXFSIZ; /*!< Host Periodic Tx FIFO Size Reg 100h */ + __IO uint32_t DIEPTXF[0x0F]; /*!< dev Periodic Transmit FIFO */ +} USB_OTG_GlobalTypeDef; + +/** + * @brief USB_OTG_device_Registers + */ +typedef struct +{ + __IO uint32_t DCFG; /*!< dev Configuration Register 800h */ + __IO uint32_t DCTL; /*!< dev Control Register 804h */ + __IO uint32_t DSTS; /*!< dev Status Register (RO) 808h */ + uint32_t Reserved0C; /*!< Reserved 80Ch */ + __IO uint32_t DIEPMSK; /*!< dev IN Endpoint Mask 810h */ + __IO uint32_t DOEPMSK; /*!< dev OUT Endpoint Mask 814h */ + __IO uint32_t DAINT; /*!< dev All Endpoints Itr Reg 818h */ + __IO uint32_t DAINTMSK; /*!< dev All Endpoints Itr Mask 81Ch */ + uint32_t Reserved20; /*!< Reserved 820h */ + uint32_t Reserved9; /*!< Reserved 824h */ + __IO uint32_t DVBUSDIS; /*!< dev VBUS discharge Register 828h */ + __IO uint32_t DVBUSPULSE; /*!< dev VBUS Pulse Register 82Ch */ + __IO uint32_t DTHRCTL; /*!< dev threshold 830h */ + __IO uint32_t DIEPEMPMSK; /*!< dev empty msk 834h */ + __IO uint32_t DEACHINT; /*!< dedicated EP interrupt 838h */ + __IO uint32_t DEACHMSK; /*!< dedicated EP msk 83Ch */ + uint32_t Reserved40; /*!< dedicated EP mask 840h */ + __IO uint32_t DINEP1MSK; /*!< dedicated EP mask 844h */ + uint32_t Reserved44[15]; /*!< Reserved 844-87Ch */ + __IO uint32_t DOUTEP1MSK; /*!< dedicated EP msk 884h */ +} USB_OTG_DeviceTypeDef; + +/** + * @brief USB_OTG_IN_Endpoint-Specific_Register + */ +typedef struct +{ + __IO uint32_t DIEPCTL; /*!< dev IN Endpoint Control Reg 900h + (ep_num * 20h) + 00h */ + uint32_t Reserved04; /*!< Reserved 900h + (ep_num * 20h) + 04h */ + __IO uint32_t DIEPINT; /*!< dev IN Endpoint Itr Reg 900h + (ep_num * 20h) + 08h */ + uint32_t Reserved0C; /*!< Reserved 900h + (ep_num * 20h) + 0Ch */ + __IO uint32_t DIEPTSIZ; /*!< IN Endpoint Txfer Size 900h + (ep_num * 20h) + 10h */ + __IO uint32_t DIEPDMA; /*!< IN Endpoint DMA Address Reg 900h + (ep_num * 20h) + 14h */ + __IO uint32_t DTXFSTS; /*!< IN Endpoint Tx FIFO Status Reg 900h + (ep_num * 20h) + 18h */ + uint32_t Reserved18; /*!< Reserved 900h+(ep_num*20h)+1Ch-900h+ (ep_num * 20h) + 1Ch */ +} USB_OTG_INEndpointTypeDef; + +/** + * @brief USB_OTG_OUT_Endpoint-Specific_Registers + */ +typedef struct +{ + __IO uint32_t DOEPCTL; /*!< dev OUT Endpoint Control Reg B00h + (ep_num * 20h) + 00h */ + uint32_t Reserved04; /*!< Reserved B00h + (ep_num * 20h) + 04h */ + __IO uint32_t DOEPINT; /*!< dev OUT Endpoint Itr Reg B00h + (ep_num * 20h) + 08h */ + uint32_t Reserved0C; /*!< Reserved B00h + (ep_num * 20h) + 0Ch */ + __IO uint32_t DOEPTSIZ; /*!< dev OUT Endpoint Txfer Size B00h + (ep_num * 20h) + 10h */ + __IO uint32_t DOEPDMA; /*!< dev OUT Endpoint DMA Address B00h + (ep_num * 20h) + 14h */ + uint32_t Reserved18[2]; /*!< Reserved B00h + (ep_num * 20h) + 18h - B00h + (ep_num * 20h) + 1Ch */ +} USB_OTG_OUTEndpointTypeDef; + +/** + * @brief USB_OTG_Host_Mode_Register_Structures + */ +typedef struct +{ + __IO uint32_t HCFG; /*!< Host Configuration Register 400h */ + __IO uint32_t HFIR; /*!< Host Frame Interval Register 404h */ + __IO uint32_t HFNUM; /*!< Host Frame Nbr/Frame Remaining 408h */ + uint32_t Reserved40C; /*!< Reserved 40Ch */ + __IO uint32_t HPTXSTS; /*!< Host Periodic Tx FIFO/ Queue Status 410h */ + __IO uint32_t HAINT; /*!< Host All Channels Interrupt Register 414h */ + __IO uint32_t HAINTMSK; /*!< Host All Channels Interrupt Mask 418h */ +} USB_OTG_HostTypeDef; + +/** + * @brief USB_OTG_Host_Channel_Specific_Registers + */ +typedef struct +{ + __IO uint32_t HCCHAR; /*!< Host Channel Characteristics Register 500h */ + __IO uint32_t HCSPLT; /*!< Host Channel Split Control Register 504h */ + __IO uint32_t HCINT; /*!< Host Channel Interrupt Register 508h */ + __IO uint32_t HCINTMSK; /*!< Host Channel Interrupt Mask Register 50Ch */ + __IO uint32_t HCTSIZ; /*!< Host Channel Transfer Size Register 510h */ + __IO uint32_t HCDMA; /*!< Host Channel DMA Address Register 514h */ + uint32_t Reserved[2]; /*!< Reserved */ +} USB_OTG_HostChannelTypeDef; + +/** + * @} + */ + +/** @addtogroup Peripheral_memory_map + * @{ + */ +#define FLASH_BASE 0x08000000UL /*!< FLASH(up to 1 MB) base address in the alias region */ +#define SRAM1_BASE 0x20000000UL /*!< SRAM1(112 KB) base address in the alias region */ +#define SRAM2_BASE 0x2001C000UL /*!< SRAM2(16 KB) base address in the alias region */ +#define PERIPH_BASE 0x40000000UL /*!< Peripheral base address in the alias region */ +#define BKPSRAM_BASE 0x40024000UL /*!< Backup SRAM(4 KB) base address in the alias region */ +#define FMC_R_BASE 0xA0000000UL /*!< FMC registers base address */ +#define QSPI_R_BASE 0xA0001000UL /*!< QuadSPI registers base address */ +#define SRAM1_BB_BASE 0x22000000UL /*!< SRAM1(112 KB) base address in the bit-band region */ +#define SRAM2_BB_BASE 0x22380000UL /*!< SRAM2(16 KB) base address in the bit-band region */ +#define PERIPH_BB_BASE 0x42000000UL /*!< Peripheral base address in the bit-band region */ +#define BKPSRAM_BB_BASE 0x42480000UL /*!< Backup SRAM(4 KB) base address in the bit-band region */ +#define FLASH_END 0x0807FFFFUL /*!< FLASH end address */ +#define FLASH_OTP_BASE 0x1FFF7800UL /*!< Base address of : (up to 528 Bytes) embedded FLASH OTP Area */ +#define FLASH_OTP_END 0x1FFF7A0FUL /*!< End address of : (up to 528 Bytes) embedded FLASH OTP Area */ + +/* Legacy defines */ +#define SRAM_BASE SRAM1_BASE +#define SRAM_BB_BASE SRAM1_BB_BASE + +/*!< Peripheral memory map */ +#define APB1PERIPH_BASE PERIPH_BASE +#define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000UL) +#define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000UL) +#define AHB2PERIPH_BASE (PERIPH_BASE + 0x10000000UL) + +/*!< APB1 peripherals */ +#define TIM2_BASE (APB1PERIPH_BASE + 0x0000UL) +#define TIM3_BASE (APB1PERIPH_BASE + 0x0400UL) +#define TIM4_BASE (APB1PERIPH_BASE + 0x0800UL) +#define TIM5_BASE (APB1PERIPH_BASE + 0x0C00UL) +#define TIM6_BASE (APB1PERIPH_BASE + 0x1000UL) +#define TIM7_BASE (APB1PERIPH_BASE + 0x1400UL) +#define TIM12_BASE (APB1PERIPH_BASE + 0x1800UL) +#define TIM13_BASE (APB1PERIPH_BASE + 0x1C00UL) +#define TIM14_BASE (APB1PERIPH_BASE + 0x2000UL) +#define RTC_BASE (APB1PERIPH_BASE + 0x2800UL) +#define WWDG_BASE (APB1PERIPH_BASE + 0x2C00UL) +#define IWDG_BASE (APB1PERIPH_BASE + 0x3000UL) +#define SPI2_BASE (APB1PERIPH_BASE + 0x3800UL) +#define SPI3_BASE (APB1PERIPH_BASE + 0x3C00UL) +#define SPDIFRX_BASE (APB1PERIPH_BASE + 0x4000UL) +#define USART2_BASE (APB1PERIPH_BASE + 0x4400UL) +#define USART3_BASE (APB1PERIPH_BASE + 0x4800UL) +#define UART4_BASE (APB1PERIPH_BASE + 0x4C00UL) +#define UART5_BASE (APB1PERIPH_BASE + 0x5000UL) +#define I2C1_BASE (APB1PERIPH_BASE + 0x5400UL) +#define I2C2_BASE (APB1PERIPH_BASE + 0x5800UL) +#define I2C3_BASE (APB1PERIPH_BASE + 0x5C00UL) +#define FMPI2C1_BASE (APB1PERIPH_BASE + 0x6000UL) +#define CAN1_BASE (APB1PERIPH_BASE + 0x6400UL) +#define CAN2_BASE (APB1PERIPH_BASE + 0x6800UL) +#define CEC_BASE (APB1PERIPH_BASE + 0x6C00UL) +#define PWR_BASE (APB1PERIPH_BASE + 0x7000UL) +#define DAC_BASE (APB1PERIPH_BASE + 0x7400UL) + +/*!< APB2 peripherals */ +#define TIM1_BASE (APB2PERIPH_BASE + 0x0000UL) +#define TIM8_BASE (APB2PERIPH_BASE + 0x0400UL) +#define USART1_BASE (APB2PERIPH_BASE + 0x1000UL) +#define USART6_BASE (APB2PERIPH_BASE + 0x1400UL) +#define ADC1_BASE (APB2PERIPH_BASE + 0x2000UL) +#define ADC2_BASE (APB2PERIPH_BASE + 0x2100UL) +#define ADC3_BASE (APB2PERIPH_BASE + 0x2200UL) +#define ADC123_COMMON_BASE (APB2PERIPH_BASE + 0x2300UL) +/* Legacy define */ +#define ADC_BASE ADC123_COMMON_BASE +#define SDIO_BASE (APB2PERIPH_BASE + 0x2C00UL) +#define SPI1_BASE (APB2PERIPH_BASE + 0x3000UL) +#define SPI4_BASE (APB2PERIPH_BASE + 0x3400UL) +#define SYSCFG_BASE (APB2PERIPH_BASE + 0x3800UL) +#define EXTI_BASE (APB2PERIPH_BASE + 0x3C00UL) +#define TIM9_BASE (APB2PERIPH_BASE + 0x4000UL) +#define TIM10_BASE (APB2PERIPH_BASE + 0x4400UL) +#define TIM11_BASE (APB2PERIPH_BASE + 0x4800UL) +#define SAI1_BASE (APB2PERIPH_BASE + 0x5800UL) +#define SAI1_Block_A_BASE (SAI1_BASE + 0x004UL) +#define SAI1_Block_B_BASE (SAI1_BASE + 0x024UL) +#define SAI2_BASE (APB2PERIPH_BASE + 0x5C00UL) +#define SAI2_Block_A_BASE (SAI2_BASE + 0x004UL) +#define SAI2_Block_B_BASE (SAI2_BASE + 0x024UL) + +/*!< AHB1 peripherals */ +#define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000UL) +#define GPIOB_BASE (AHB1PERIPH_BASE + 0x0400UL) +#define GPIOC_BASE (AHB1PERIPH_BASE + 0x0800UL) +#define GPIOD_BASE (AHB1PERIPH_BASE + 0x0C00UL) +#define GPIOE_BASE (AHB1PERIPH_BASE + 0x1000UL) +#define GPIOF_BASE (AHB1PERIPH_BASE + 0x1400UL) +#define GPIOG_BASE (AHB1PERIPH_BASE + 0x1800UL) +#define GPIOH_BASE (AHB1PERIPH_BASE + 0x1C00UL) +#define CRC_BASE (AHB1PERIPH_BASE + 0x3000UL) +#define RCC_BASE (AHB1PERIPH_BASE + 0x3800UL) +#define FLASH_R_BASE (AHB1PERIPH_BASE + 0x3C00UL) +#define DMA1_BASE (AHB1PERIPH_BASE + 0x6000UL) +#define DMA1_Stream0_BASE (DMA1_BASE + 0x010UL) +#define DMA1_Stream1_BASE (DMA1_BASE + 0x028UL) +#define DMA1_Stream2_BASE (DMA1_BASE + 0x040UL) +#define DMA1_Stream3_BASE (DMA1_BASE + 0x058UL) +#define DMA1_Stream4_BASE (DMA1_BASE + 0x070UL) +#define DMA1_Stream5_BASE (DMA1_BASE + 0x088UL) +#define DMA1_Stream6_BASE (DMA1_BASE + 0x0A0UL) +#define DMA1_Stream7_BASE (DMA1_BASE + 0x0B8UL) +#define DMA2_BASE (AHB1PERIPH_BASE + 0x6400UL) +#define DMA2_Stream0_BASE (DMA2_BASE + 0x010UL) +#define DMA2_Stream1_BASE (DMA2_BASE + 0x028UL) +#define DMA2_Stream2_BASE (DMA2_BASE + 0x040UL) +#define DMA2_Stream3_BASE (DMA2_BASE + 0x058UL) +#define DMA2_Stream4_BASE (DMA2_BASE + 0x070UL) +#define DMA2_Stream5_BASE (DMA2_BASE + 0x088UL) +#define DMA2_Stream6_BASE (DMA2_BASE + 0x0A0UL) +#define DMA2_Stream7_BASE (DMA2_BASE + 0x0B8UL) + +/*!< AHB2 peripherals */ +#define DCMI_BASE (AHB2PERIPH_BASE + 0x50000UL) + +/*!< FMC Bankx registers base address */ +#define FMC_Bank1_R_BASE (FMC_R_BASE + 0x0000UL) +#define FMC_Bank1E_R_BASE (FMC_R_BASE + 0x0104UL) +#define FMC_Bank3_R_BASE (FMC_R_BASE + 0x0080UL) +#define FMC_Bank5_6_R_BASE (FMC_R_BASE + 0x0140UL) + + +/*!< Debug MCU registers base address */ +#define DBGMCU_BASE 0xE0042000UL +/*!< USB registers base address */ +#define USB_OTG_HS_PERIPH_BASE 0x40040000UL +#define USB_OTG_FS_PERIPH_BASE 0x50000000UL + +#define USB_OTG_GLOBAL_BASE 0x000UL +#define USB_OTG_DEVICE_BASE 0x800UL +#define USB_OTG_IN_ENDPOINT_BASE 0x900UL +#define USB_OTG_OUT_ENDPOINT_BASE 0xB00UL +#define USB_OTG_EP_REG_SIZE 0x20UL +#define USB_OTG_HOST_BASE 0x400UL +#define USB_OTG_HOST_PORT_BASE 0x440UL +#define USB_OTG_HOST_CHANNEL_BASE 0x500UL +#define USB_OTG_HOST_CHANNEL_SIZE 0x20UL +#define USB_OTG_PCGCCTL_BASE 0xE00UL +#define USB_OTG_FIFO_BASE 0x1000UL +#define USB_OTG_FIFO_SIZE 0x1000UL + +#define UID_BASE 0x1FFF7A10UL /*!< Unique device ID register base address */ +#define FLASHSIZE_BASE 0x1FFF7A22UL /*!< FLASH Size register base address */ +#define PACKAGE_BASE 0x1FFF7BF0UL /*!< Package size register base address */ +/** + * @} + */ + +/** @addtogroup Peripheral_declaration + * @{ + */ +#define TIM2 ((TIM_TypeDef *) TIM2_BASE) +#define TIM3 ((TIM_TypeDef *) TIM3_BASE) +#define TIM4 ((TIM_TypeDef *) TIM4_BASE) +#define TIM5 ((TIM_TypeDef *) TIM5_BASE) +#define TIM6 ((TIM_TypeDef *) TIM6_BASE) +#define TIM7 ((TIM_TypeDef *) TIM7_BASE) +#define TIM12 ((TIM_TypeDef *) TIM12_BASE) +#define TIM13 ((TIM_TypeDef *) TIM13_BASE) +#define TIM14 ((TIM_TypeDef *) TIM14_BASE) +#define RTC ((RTC_TypeDef *) RTC_BASE) +#define WWDG ((WWDG_TypeDef *) WWDG_BASE) +#define IWDG ((IWDG_TypeDef *) IWDG_BASE) +#define SPI2 ((SPI_TypeDef *) SPI2_BASE) +#define SPI3 ((SPI_TypeDef *) SPI3_BASE) +#define SPDIFRX ((SPDIFRX_TypeDef *) SPDIFRX_BASE) +#define USART2 ((USART_TypeDef *) USART2_BASE) +#define USART3 ((USART_TypeDef *) USART3_BASE) +#define UART4 ((USART_TypeDef *) UART4_BASE) +#define UART5 ((USART_TypeDef *) UART5_BASE) +#define I2C1 ((I2C_TypeDef *) I2C1_BASE) +#define I2C2 ((I2C_TypeDef *) I2C2_BASE) +#define I2C3 ((I2C_TypeDef *) I2C3_BASE) +#define FMPI2C1 ((FMPI2C_TypeDef *) FMPI2C1_BASE) +#define CAN1 ((CAN_TypeDef *) CAN1_BASE) +#define CAN2 ((CAN_TypeDef *) CAN2_BASE) +#define CEC ((CEC_TypeDef *) CEC_BASE) +#define PWR ((PWR_TypeDef *) PWR_BASE) +#define DAC1 ((DAC_TypeDef *) DAC_BASE) +#define DAC ((DAC_TypeDef *) DAC_BASE) /* Kept for legacy purpose */ +#define TIM1 ((TIM_TypeDef *) TIM1_BASE) +#define TIM8 ((TIM_TypeDef *) TIM8_BASE) +#define USART1 ((USART_TypeDef *) USART1_BASE) +#define USART6 ((USART_TypeDef *) USART6_BASE) +#define ADC1 ((ADC_TypeDef *) ADC1_BASE) +#define ADC2 ((ADC_TypeDef *) ADC2_BASE) +#define ADC3 ((ADC_TypeDef *) ADC3_BASE) +#define ADC123_COMMON ((ADC_Common_TypeDef *) ADC123_COMMON_BASE) +/* Legacy define */ +#define ADC ADC123_COMMON +#define SDIO ((SDIO_TypeDef *) SDIO_BASE) +#define SPI1 ((SPI_TypeDef *) SPI1_BASE) +#define SPI4 ((SPI_TypeDef *) SPI4_BASE) +#define SYSCFG ((SYSCFG_TypeDef *) SYSCFG_BASE) +#define EXTI ((EXTI_TypeDef *) EXTI_BASE) +#define TIM9 ((TIM_TypeDef *) TIM9_BASE) +#define TIM10 ((TIM_TypeDef *) TIM10_BASE) +#define TIM11 ((TIM_TypeDef *) TIM11_BASE) +#define SAI1 ((SAI_TypeDef *) SAI1_BASE) +#define SAI1_Block_A ((SAI_Block_TypeDef *)SAI1_Block_A_BASE) +#define SAI1_Block_B ((SAI_Block_TypeDef *)SAI1_Block_B_BASE) +#define SAI2 ((SAI_TypeDef *) SAI2_BASE) +#define SAI2_Block_A ((SAI_Block_TypeDef *)SAI2_Block_A_BASE) +#define SAI2_Block_B ((SAI_Block_TypeDef *)SAI2_Block_B_BASE) +#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE) +#define GPIOB ((GPIO_TypeDef *) GPIOB_BASE) +#define GPIOC ((GPIO_TypeDef *) GPIOC_BASE) +#define GPIOD ((GPIO_TypeDef *) GPIOD_BASE) +#define GPIOE ((GPIO_TypeDef *) GPIOE_BASE) +#define GPIOF ((GPIO_TypeDef *) GPIOF_BASE) +#define GPIOG ((GPIO_TypeDef *) GPIOG_BASE) +#define GPIOH ((GPIO_TypeDef *) GPIOH_BASE) +#define CRC ((CRC_TypeDef *) CRC_BASE) +#define RCC ((RCC_TypeDef *) RCC_BASE) +#define FLASH ((FLASH_TypeDef *) FLASH_R_BASE) +#define DMA1 ((DMA_TypeDef *) DMA1_BASE) +#define DMA1_Stream0 ((DMA_Stream_TypeDef *) DMA1_Stream0_BASE) +#define DMA1_Stream1 ((DMA_Stream_TypeDef *) DMA1_Stream1_BASE) +#define DMA1_Stream2 ((DMA_Stream_TypeDef *) DMA1_Stream2_BASE) +#define DMA1_Stream3 ((DMA_Stream_TypeDef *) DMA1_Stream3_BASE) +#define DMA1_Stream4 ((DMA_Stream_TypeDef *) DMA1_Stream4_BASE) +#define DMA1_Stream5 ((DMA_Stream_TypeDef *) DMA1_Stream5_BASE) +#define DMA1_Stream6 ((DMA_Stream_TypeDef *) DMA1_Stream6_BASE) +#define DMA1_Stream7 ((DMA_Stream_TypeDef *) DMA1_Stream7_BASE) +#define DMA2 ((DMA_TypeDef *) DMA2_BASE) +#define DMA2_Stream0 ((DMA_Stream_TypeDef *) DMA2_Stream0_BASE) +#define DMA2_Stream1 ((DMA_Stream_TypeDef *) DMA2_Stream1_BASE) +#define DMA2_Stream2 ((DMA_Stream_TypeDef *) DMA2_Stream2_BASE) +#define DMA2_Stream3 ((DMA_Stream_TypeDef *) DMA2_Stream3_BASE) +#define DMA2_Stream4 ((DMA_Stream_TypeDef *) DMA2_Stream4_BASE) +#define DMA2_Stream5 ((DMA_Stream_TypeDef *) DMA2_Stream5_BASE) +#define DMA2_Stream6 ((DMA_Stream_TypeDef *) DMA2_Stream6_BASE) +#define DMA2_Stream7 ((DMA_Stream_TypeDef *) DMA2_Stream7_BASE) +#define DCMI ((DCMI_TypeDef *) DCMI_BASE) +#define FMC_Bank1 ((FMC_Bank1_TypeDef *) FMC_Bank1_R_BASE) +#define FMC_Bank1E ((FMC_Bank1E_TypeDef *) FMC_Bank1E_R_BASE) +#define FMC_Bank3 ((FMC_Bank3_TypeDef *) FMC_Bank3_R_BASE) +#define FMC_Bank5_6 ((FMC_Bank5_6_TypeDef *) FMC_Bank5_6_R_BASE) +#define QUADSPI ((QUADSPI_TypeDef *) QSPI_R_BASE) +#define DBGMCU ((DBGMCU_TypeDef *) DBGMCU_BASE) +#define USB_OTG_FS ((USB_OTG_GlobalTypeDef *) USB_OTG_FS_PERIPH_BASE) +#define USB_OTG_HS ((USB_OTG_GlobalTypeDef *) USB_OTG_HS_PERIPH_BASE) + +/** + * @} + */ + +/** @addtogroup Exported_constants + * @{ + */ + + /** @addtogroup Peripheral_Registers_Bits_Definition + * @{ + */ + +/******************************************************************************/ +/* Peripheral Registers_Bits_Definition */ +/******************************************************************************/ + +/******************************************************************************/ +/* */ +/* Analog to Digital Converter */ +/* */ +/******************************************************************************/ +/* + * @brief Specific device feature definitions (not present on all devices in the STM32F4 serie) + */ +#define ADC_MULTIMODE_SUPPORT /*!
© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.
+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f4xx + * @{ + */ + +#ifndef __STM32F4xx_H +#define __STM32F4xx_H + +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +/** @addtogroup Library_configuration_section + * @{ + */ + +/** + * @brief STM32 Family + */ +#if !defined (STM32F4) +#define STM32F4 +#endif /* STM32F4 */ + +/* Uncomment the line below according to the target STM32 device used in your + application + */ +#if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \ + !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \ + !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F410Tx) && !defined (STM32F410Cx) && \ + !defined (STM32F410Rx) && !defined (STM32F411xE) && !defined (STM32F446xx) && !defined (STM32F469xx) && \ + !defined (STM32F479xx) && !defined (STM32F412Cx) && !defined (STM32F412Rx) && !defined (STM32F412Vx) && \ + !defined (STM32F412Zx) && !defined (STM32F413xx) && !defined (STM32F423xx) + /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */ + /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */ + /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */ + /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */ + /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */ + /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */ + /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG, + STM32F439NI, STM32F429IG and STM32F429II Devices */ + /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG, + STM32F439NI, STM32F439IG and STM32F439II Devices */ + /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */ + /* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */ + /* #define STM32F410Tx */ /*!< STM32F410T8 and STM32F410TB Devices */ + /* #define STM32F410Cx */ /*!< STM32F410C8 and STM32F410CB Devices */ + /* #define STM32F410Rx */ /*!< STM32F410R8 and STM32F410RB Devices */ + /* #define STM32F411xE */ /*!< STM32F411CC, STM32F411RC, STM32F411VC, STM32F411CE, STM32F411RE and STM32F411VE Devices */ + /* #define STM32F446xx */ /*!< STM32F446MC, STM32F446ME, STM32F446RC, STM32F446RE, STM32F446VC, STM32F446VE, STM32F446ZC, + and STM32F446ZE Devices */ + /* #define STM32F469xx */ /*!< STM32F469AI, STM32F469II, STM32F469BI, STM32F469NI, STM32F469AG, STM32F469IG, STM32F469BG, + STM32F469NG, STM32F469AE, STM32F469IE, STM32F469BE and STM32F469NE Devices */ + /* #define STM32F479xx */ /*!< STM32F479AI, STM32F479II, STM32F479BI, STM32F479NI, STM32F479AG, STM32F479IG, STM32F479BG + and STM32F479NG Devices */ + /* #define STM32F412Cx */ /*!< STM32F412CEU and STM32F412CGU Devices */ + /* #define STM32F412Zx */ /*!< STM32F412ZET, STM32F412ZGT, STM32F412ZEJ and STM32F412ZGJ Devices */ + /* #define STM32F412Vx */ /*!< STM32F412VET, STM32F412VGT, STM32F412VEH and STM32F412VGH Devices */ + /* #define STM32F412Rx */ /*!< STM32F412RET, STM32F412RGT, STM32F412REY and STM32F412RGY Devices */ + /* #define STM32F413xx */ /*!< STM32F413CH, STM32F413MH, STM32F413RH, STM32F413VH, STM32F413ZH, STM32F413CG, STM32F413MG, + STM32F413RG, STM32F413VG and STM32F413ZG Devices */ + /* #define STM32F423xx */ /*!< STM32F423CH, STM32F423RH, STM32F423VH and STM32F423ZH Devices */ +#endif + +/* Tip: To avoid modifying this file each time you need to switch between these + devices, you can define the device in your toolchain compiler preprocessor. + */ +#if !defined (USE_HAL_DRIVER) +/** + * @brief Comment the line below if you will not use the peripherals drivers. + In this case, these drivers will not be included and the application code will + be based on direct access to peripherals registers + */ + /*#define USE_HAL_DRIVER */ +#endif /* USE_HAL_DRIVER */ + +/** + * @brief CMSIS version number V2.6.5 + */ +#define __STM32F4xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */ +#define __STM32F4xx_CMSIS_VERSION_SUB1 (0x06U) /*!< [23:16] sub1 version */ +#define __STM32F4xx_CMSIS_VERSION_SUB2 (0x05U) /*!< [15:8] sub2 version */ +#define __STM32F4xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ +#define __STM32F4xx_CMSIS_VERSION ((__STM32F4xx_CMSIS_VERSION_MAIN << 24)\ + |(__STM32F4xx_CMSIS_VERSION_SUB1 << 16)\ + |(__STM32F4xx_CMSIS_VERSION_SUB2 << 8 )\ + |(__STM32F4xx_CMSIS_VERSION)) + +/** + * @} + */ + +/** @addtogroup Device_Included + * @{ + */ + +#if defined(STM32F405xx) + #include "stm32f405xx.h" +#elif defined(STM32F415xx) + #include "stm32f415xx.h" +#elif defined(STM32F407xx) + #include "stm32f407xx.h" +#elif defined(STM32F417xx) + #include "stm32f417xx.h" +#elif defined(STM32F427xx) + #include "stm32f427xx.h" +#elif defined(STM32F437xx) + #include "stm32f437xx.h" +#elif defined(STM32F429xx) + #include "stm32f429xx.h" +#elif defined(STM32F439xx) + #include "stm32f439xx.h" +#elif defined(STM32F401xC) + #include "stm32f401xc.h" +#elif defined(STM32F401xE) + #include "stm32f401xe.h" +#elif defined(STM32F410Tx) + #include "stm32f410tx.h" +#elif defined(STM32F410Cx) + #include "stm32f410cx.h" +#elif defined(STM32F410Rx) + #include "stm32f410rx.h" +#elif defined(STM32F411xE) + #include "stm32f411xe.h" +#elif defined(STM32F446xx) + #include "stm32f446xx.h" +#elif defined(STM32F469xx) + #include "stm32f469xx.h" +#elif defined(STM32F479xx) + #include "stm32f479xx.h" +#elif defined(STM32F412Cx) + #include "stm32f412cx.h" +#elif defined(STM32F412Zx) + #include "stm32f412zx.h" +#elif defined(STM32F412Rx) + #include "stm32f412rx.h" +#elif defined(STM32F412Vx) + #include "stm32f412vx.h" +#elif defined(STM32F413xx) + #include "stm32f413xx.h" +#elif defined(STM32F423xx) + #include "stm32f423xx.h" +#else + #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)" +#endif + +/** + * @} + */ + +/** @addtogroup Exported_types + * @{ + */ +typedef enum +{ + RESET = 0U, + SET = !RESET +} FlagStatus, ITStatus; + +typedef enum +{ + DISABLE = 0U, + ENABLE = !DISABLE +} FunctionalState; +#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) + +typedef enum +{ + SUCCESS = 0U, + ERROR = !SUCCESS +} ErrorStatus; + +/** + * @} + */ + + +/** @addtogroup Exported_macro + * @{ + */ +#define SET_BIT(REG, BIT) ((REG) |= (BIT)) + +#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) + +#define READ_BIT(REG, BIT) ((REG) & (BIT)) + +#define CLEAR_REG(REG) ((REG) = (0x0)) + +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) + +#define READ_REG(REG) ((REG)) + +#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) + +#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) + + +/** + * @} + */ + +#if defined (USE_HAL_DRIVER) + #include "stm32f4xx_hal.h" +#endif /* USE_HAL_DRIVER */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __STM32F4xx_H */ +/** + * @} + */ + +/** + * @} + */ + + + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h b/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h new file mode 100644 index 0000000..99cb936 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h @@ -0,0 +1,122 @@ +/** + ****************************************************************************** + * @file system_stm32f4xx.h + * @author MCD Application Team + * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * 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. + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f4xx_system + * @{ + */ + +/** + * @brief Define to prevent recursive inclusion + */ +#ifndef __SYSTEM_STM32F4XX_H +#define __SYSTEM_STM32F4XX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/** @addtogroup STM32F4xx_System_Includes + * @{ + */ + +/** + * @} + */ + + +/** @addtogroup STM32F4xx_System_Exported_types + * @{ + */ + /* This variable is updated in three ways: + 1) by calling CMSIS function SystemCoreClockUpdate() + 2) by calling HAL API function HAL_RCC_GetSysClockFreq() + 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency + Note: If you use this function to configure the system clock; then there + is no need to call the 2 first functions listed above, since SystemCoreClock + variable is updated automatically. + */ +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ + +extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ +extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Exported_Constants + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Exported_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F4xx_System_Exported_Functions + * @{ + */ + +extern void SystemInit(void); +extern void SystemCoreClockUpdate(void); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSTEM_STM32F4XX_H */ + +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_armcc.h b/EMBOS/Drivers/CMSIS/Include/cmsis_armcc.h new file mode 100644 index 0000000..4d9d064 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_armcc.h @@ -0,0 +1,865 @@ +/**************************************************************************//** + * @file cmsis_armcc.h + * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_ARMCC_H +#define __CMSIS_ARMCC_H + + +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677) + #error "Please use Arm Compiler Toolchain V4.0.677 or later!" +#endif + +/* CMSIS compiler control architecture macros */ +#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \ + (defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) ) + #define __ARM_ARCH_6M__ 1 +#endif + +#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1)) + #define __ARM_ARCH_7M__ 1 +#endif + +#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1)) + #define __ARM_ARCH_7EM__ 1 +#endif + + /* __ARM_ARCH_8M_BASE__ not applicable */ + /* __ARM_ARCH_8M_MAIN__ not applicable */ + + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE __inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static __inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE static __forceinline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __declspec(noreturn) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed)) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION __packed union +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x))) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr))) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr))) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __enable_irq(); */ + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __disable_irq(); */ + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_INLINE uint32_t __get_CONTROL(void) +{ + register uint32_t __regControl __ASM("control"); + return(__regControl); +} + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + register uint32_t __regControl __ASM("control"); + __regControl = control; +} + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_INLINE uint32_t __get_IPSR(void) +{ + register uint32_t __regIPSR __ASM("ipsr"); + return(__regIPSR); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_INLINE uint32_t __get_APSR(void) +{ + register uint32_t __regAPSR __ASM("apsr"); + return(__regAPSR); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_INLINE uint32_t __get_xPSR(void) +{ + register uint32_t __regXPSR __ASM("xpsr"); + return(__regXPSR); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + return(__regProcessStackPointer); +} + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + __regProcessStackPointer = topOfProcStack; +} + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + return(__regMainStackPointer); +} + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + __regMainStackPointer = topOfMainStack; +} + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + register uint32_t __regPriMask __ASM("primask"); + return(__regPriMask); +} + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (priMask); +} + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + register uint32_t __regBasePri __ASM("basepri"); + return(__regBasePri); +} + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + register uint32_t __regBasePri __ASM("basepri"); + __regBasePri = (basePri & 0xFFU); +} + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + register uint32_t __regBasePriMax __ASM("basepri_max"); + __regBasePriMax = (basePri & 0xFFU); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + return(__regFaultMask); +} + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + __regFaultMask = (faultMask & (uint32_t)1U); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + register uint32_t __regfpscr __ASM("fpscr"); + return(__regfpscr); +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + register uint32_t __regfpscr __ASM("fpscr"); + __regfpscr = (fpscr); +#else + (void)fpscr; +#endif +} + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __nop + + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI __wfi + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __wfe + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __sev + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +#define __ISB() do {\ + __schedule_barrier();\ + __isb(0xF);\ + __schedule_barrier();\ + } while (0U) + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() do {\ + __schedule_barrier();\ + __dsb(0xF);\ + __schedule_barrier();\ + } while (0U) + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() do {\ + __schedule_barrier();\ + __dmb(0xF);\ + __schedule_barrier();\ + } while (0U) + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV __rev + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) +{ + rev16 r0, r0 + bx lr +} +#endif + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value) +{ + revsh r0, r0 + bx lr +} +#endif + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +#define __ROR __ror + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __breakpoint(value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + #define __RBIT __rbit +#else +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value != 0U; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ + return result; +} +#endif + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) +#else + #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) +#else + #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) +#else + #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXB(value, ptr) __strex(value, ptr) +#else + #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXH(value, ptr) __strex(value, ptr) +#else + #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXW(value, ptr) __strex(value, ptr) +#else + #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +#define __CLREX __clrex + + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __ssat + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __usat + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) +{ + rrx r0, r0 + bx lr +} +#endif + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr)) + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr)) + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr)) + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRBT(value, ptr) __strt(value, ptr) + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRHT(value, ptr) __strt(value, ptr) + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRT(value, ptr) __strt(value, ptr) + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +#define __SADD8 __sadd8 +#define __QADD8 __qadd8 +#define __SHADD8 __shadd8 +#define __UADD8 __uadd8 +#define __UQADD8 __uqadd8 +#define __UHADD8 __uhadd8 +#define __SSUB8 __ssub8 +#define __QSUB8 __qsub8 +#define __SHSUB8 __shsub8 +#define __USUB8 __usub8 +#define __UQSUB8 __uqsub8 +#define __UHSUB8 __uhsub8 +#define __SADD16 __sadd16 +#define __QADD16 __qadd16 +#define __SHADD16 __shadd16 +#define __UADD16 __uadd16 +#define __UQADD16 __uqadd16 +#define __UHADD16 __uhadd16 +#define __SSUB16 __ssub16 +#define __QSUB16 __qsub16 +#define __SHSUB16 __shsub16 +#define __USUB16 __usub16 +#define __UQSUB16 __uqsub16 +#define __UHSUB16 __uhsub16 +#define __SASX __sasx +#define __QASX __qasx +#define __SHASX __shasx +#define __UASX __uasx +#define __UQASX __uqasx +#define __UHASX __uhasx +#define __SSAX __ssax +#define __QSAX __qsax +#define __SHSAX __shsax +#define __USAX __usax +#define __UQSAX __uqsax +#define __UHSAX __uhsax +#define __USAD8 __usad8 +#define __USADA8 __usada8 +#define __SSAT16 __ssat16 +#define __USAT16 __usat16 +#define __UXTB16 __uxtb16 +#define __UXTAB16 __uxtab16 +#define __SXTB16 __sxtb16 +#define __SXTAB16 __sxtab16 +#define __SMUAD __smuad +#define __SMUADX __smuadx +#define __SMLAD __smlad +#define __SMLADX __smladx +#define __SMLALD __smlald +#define __SMLALDX __smlaldx +#define __SMUSD __smusd +#define __SMUSDX __smusdx +#define __SMLSD __smlsd +#define __SMLSDX __smlsdx +#define __SMLSLD __smlsld +#define __SMLSLDX __smlsldx +#define __SEL __sel +#define __QADD __qadd +#define __QSUB __qsub + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ + ((int64_t)(ARG3) << 32U) ) >> 32U)) + +#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#endif /* __CMSIS_ARMCC_H */ diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_armclang.h b/EMBOS/Drivers/CMSIS/Include/cmsis_armclang.h new file mode 100644 index 0000000..162a400 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_armclang.h @@ -0,0 +1,1869 @@ +/**************************************************************************//** + * @file cmsis_armclang.h + * @brief CMSIS compiler armclang (Arm Compiler 6) header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */ + +#ifndef __CMSIS_ARMCLANG_H +#define __CMSIS_ARMCLANG_H + +#pragma clang system_header /* treat file as system include file */ + +#ifndef __ARM_COMPAT_H +#include /* Compatibility header for Arm Compiler 5 intrinsics */ +#endif + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE __inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static __inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((__noreturn__)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */ + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */ + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */ + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __enable_irq(); see arm_compat.h */ + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __disable_irq(); see arm_compat.h */ + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_FORCEINLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Stack Pointer (non-secure) + \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state. + \return SP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, sp_ns" : "=r" (result) ); + return(result); +} + + +/** + \brief Set Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state. + \param [in] topOfStack Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack) +{ + __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq /* see arm_compat.h */ + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq /* see arm_compat.h */ + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return result; +#endif +} + +#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +#endif +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + return result; +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +#endif +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr +#else +#define __get_FPSCR() ((uint32_t)0U) +#endif + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#define __set_FPSCR __builtin_arm_set_fpscr +#else +#define __set_FPSCR(x) ((void)(x)) +#endif + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __builtin_arm_nop + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI __builtin_arm_wfi + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __builtin_arm_wfe + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __builtin_arm_sev + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +#define __ISB() __builtin_arm_isb(0xF); + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() __builtin_arm_dsb(0xF); + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() __builtin_arm_dmb(0xF); + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV(value) __builtin_bswap32(value) + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV16(value) __ROR(__REV(value), 16) + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REVSH(value) (int16_t)__builtin_bswap16(value) + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + op2 %= 32U; + if (op2 == 0U) + { + return op1; + } + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +#define __RBIT __builtin_arm_rbit + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ (uint8_t)__builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDREXB (uint8_t)__builtin_arm_ldrex + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDREXH (uint16_t)__builtin_arm_ldrex + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDREXW (uint32_t)__builtin_arm_ldrex + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXB (uint32_t)__builtin_arm_strex + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXH (uint32_t)__builtin_arm_strex + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXW (uint32_t)__builtin_arm_strex + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +#define __CLREX __builtin_arm_clrex + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __builtin_arm_ssat + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __builtin_arm_usat + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDAEXB (uint8_t)__builtin_arm_ldaex + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDAEXH (uint16_t)__builtin_arm_ldaex + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDAEX (uint32_t)__builtin_arm_ldaex + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEXB (uint32_t)__builtin_arm_stlex + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEXH (uint32_t)__builtin_arm_stlex + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEX (uint32_t)__builtin_arm_stlex + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + +__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#endif /* __CMSIS_ARMCLANG_H */ diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_compiler.h b/EMBOS/Drivers/CMSIS/Include/cmsis_compiler.h new file mode 100644 index 0000000..94212eb --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_compiler.h @@ -0,0 +1,266 @@ +/**************************************************************************//** + * @file cmsis_compiler.h + * @brief CMSIS compiler generic header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_COMPILER_H +#define __CMSIS_COMPILER_H + +#include + +/* + * Arm Compiler 4/5 + */ +#if defined ( __CC_ARM ) + #include "cmsis_armcc.h" + + +/* + * Arm Compiler 6 (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #include "cmsis_armclang.h" + + +/* + * GNU Compiler + */ +#elif defined ( __GNUC__ ) + #include "cmsis_gcc.h" + + +/* + * IAR Compiler + */ +#elif defined ( __ICCARM__ ) + #include + + +/* + * TI Arm Compiler + */ +#elif defined ( __TI_ARM__ ) + #include + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed)) + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed)) + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +/* + * TASKING Compiler + */ +#elif defined ( __TASKING__ ) + /* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __packed__ + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __packed__ + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __packed__ + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __packed__ T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __align(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +/* + * COSMIC Compiler + */ +#elif defined ( __CSMC__ ) + #include + + #ifndef __ASM + #define __ASM _asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + // NO RETURN is automatically detected hence no warning here + #define __NO_RETURN + #endif + #ifndef __USED + #warning No compiler specific solution for __USED. __USED is ignored. + #define __USED + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __PACKED + #define __PACKED @packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT @packed struct + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION @packed union + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + @packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +#else + #error Unknown compiler. +#endif + + +#endif /* __CMSIS_COMPILER_H */ + diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_gcc.h b/EMBOS/Drivers/CMSIS/Include/cmsis_gcc.h new file mode 100644 index 0000000..2d9db15 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_gcc.h @@ -0,0 +1,2085 @@ +/**************************************************************************//** + * @file cmsis_gcc.h + * @brief CMSIS compiler GCC header file + * @version V5.0.4 + * @date 09. April 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_GCC_H +#define __CMSIS_GCC_H + +/* ignore some GCC warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +/* Fallback for __has_builtin */ +#ifndef __has_builtin + #define __has_builtin(x) (0) +#endif + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((__noreturn__)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_FORCEINLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Stack Pointer (non-secure) + \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state. + \return SP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, sp_ns" : "=r" (result) ); + return(result); +} + + +/** + \brief Set Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state. + \param [in] topOfStack Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack) +{ + __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) :: "memory"); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) :: "memory"); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return result; +#endif +} + +#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +#endif +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + return result; +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +#endif +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__STATIC_FORCEINLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_get_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + return __builtin_arm_get_fpscr(); +#else + uint32_t result; + + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + return(result); +#endif +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_set_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + __builtin_arm_set_fpscr(fpscr); +#else + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory"); +#endif +#else + (void)fpscr; +#endif +} + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_RW_REG(r) "+l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_RW_REG(r) "+r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP() __ASM volatile ("nop") + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI() __ASM volatile ("wfi") + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE() __ASM volatile ("wfe") + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV() __ASM volatile ("sev") + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +__STATIC_FORCEINLINE void __ISB(void) +{ + __ASM volatile ("isb 0xF":::"memory"); +} + + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__STATIC_FORCEINLINE void __DSB(void) +{ + __ASM volatile ("dsb 0xF":::"memory"); +} + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__STATIC_FORCEINLINE void __DMB(void) +{ + __ASM volatile ("dmb 0xF":::"memory"); +} + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE int16_t __REVSH(int16_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (int16_t)__builtin_bswap16(value); +#else + int16_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + op2 %= 32U; + if (op2 == 0U) + { + return op1; + } + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); +#else + uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value != 0U; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return result; +} + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ (uint8_t)__builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +__STATIC_FORCEINLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +__extension__ \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ + __extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + +__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#pragma GCC diagnostic pop + +#endif /* __CMSIS_GCC_H */ diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_iccarm.h b/EMBOS/Drivers/CMSIS/Include/cmsis_iccarm.h new file mode 100644 index 0000000..11c4af0 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_iccarm.h @@ -0,0 +1,935 @@ +/**************************************************************************//** + * @file cmsis_iccarm.h + * @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file + * @version V5.0.7 + * @date 19. June 2018 + ******************************************************************************/ + +//------------------------------------------------------------------------------ +// +// Copyright (c) 2017-2018 IAR Systems +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//------------------------------------------------------------------------------ + + +#ifndef __CMSIS_ICCARM_H__ +#define __CMSIS_ICCARM_H__ + +#ifndef __ICCARM__ + #error This file should only be compiled by ICCARM +#endif + +#pragma system_include + +#define __IAR_FT _Pragma("inline=forced") __intrinsic + +#if (__VER__ >= 8000000) + #define __ICCARM_V8 1 +#else + #define __ICCARM_V8 0 +#endif + +#ifndef __ALIGNED + #if __ICCARM_V8 + #define __ALIGNED(x) __attribute__((aligned(x))) + #elif (__VER__ >= 7080000) + /* Needs IAR language extensions */ + #define __ALIGNED(x) __attribute__((aligned(x))) + #else + #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored. + #define __ALIGNED(x) + #endif +#endif + + +/* Define compiler macros for CPU architecture, used in CMSIS 5. + */ +#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__ +/* Macros already defined */ +#else + #if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #elif defined(__ARM8M_BASELINE__) + #define __ARM_ARCH_8M_BASE__ 1 + #elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M' + #if __ARM_ARCH == 6 + #define __ARM_ARCH_6M__ 1 + #elif __ARM_ARCH == 7 + #if __ARM_FEATURE_DSP + #define __ARM_ARCH_7EM__ 1 + #else + #define __ARM_ARCH_7M__ 1 + #endif + #endif /* __ARM_ARCH */ + #endif /* __ARM_ARCH_PROFILE == 'M' */ +#endif + +/* Alternativ core deduction for older ICCARM's */ +#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \ + !defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__) + #if defined(__ARM6M__) && (__CORE__ == __ARM6M__) + #define __ARM_ARCH_6M__ 1 + #elif defined(__ARM7M__) && (__CORE__ == __ARM7M__) + #define __ARM_ARCH_7M__ 1 + #elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__) + #define __ARM_ARCH_7EM__ 1 + #elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__) + #define __ARM_ARCH_8M_BASE__ 1 + #elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #else + #error "Unknown target." + #endif +#endif + + + +#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1 + #define __IAR_M0_FAMILY 1 +#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1 + #define __IAR_M0_FAMILY 1 +#else + #define __IAR_M0_FAMILY 0 +#endif + + +#ifndef __ASM + #define __ASM __asm +#endif + +#ifndef __INLINE + #define __INLINE inline +#endif + +#ifndef __NO_RETURN + #if __ICCARM_V8 + #define __NO_RETURN __attribute__((__noreturn__)) + #else + #define __NO_RETURN _Pragma("object_attribute=__noreturn") + #endif +#endif + +#ifndef __PACKED + #if __ICCARM_V8 + #define __PACKED __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED __packed + #endif +#endif + +#ifndef __PACKED_STRUCT + #if __ICCARM_V8 + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED_STRUCT __packed struct + #endif +#endif + +#ifndef __PACKED_UNION + #if __ICCARM_V8 + #define __PACKED_UNION union __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED_UNION __packed union + #endif +#endif + +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif + +#ifndef __FORCEINLINE + #define __FORCEINLINE _Pragma("inline=forced") +#endif + +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE +#endif + +#ifndef __UNALIGNED_UINT16_READ +#pragma language=save +#pragma language=extended +__IAR_FT uint16_t __iar_uint16_read(void const *ptr) +{ + return *(__packed uint16_t*)(ptr); +} +#pragma language=restore +#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR) +#endif + + +#ifndef __UNALIGNED_UINT16_WRITE +#pragma language=save +#pragma language=extended +__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val) +{ + *(__packed uint16_t*)(ptr) = val;; +} +#pragma language=restore +#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL) +#endif + +#ifndef __UNALIGNED_UINT32_READ +#pragma language=save +#pragma language=extended +__IAR_FT uint32_t __iar_uint32_read(void const *ptr) +{ + return *(__packed uint32_t*)(ptr); +} +#pragma language=restore +#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR) +#endif + +#ifndef __UNALIGNED_UINT32_WRITE +#pragma language=save +#pragma language=extended +__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val) +{ + *(__packed uint32_t*)(ptr) = val;; +} +#pragma language=restore +#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL) +#endif + +#ifndef __UNALIGNED_UINT32 /* deprecated */ +#pragma language=save +#pragma language=extended +__packed struct __iar_u32 { uint32_t v; }; +#pragma language=restore +#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v) +#endif + +#ifndef __USED + #if __ICCARM_V8 + #define __USED __attribute__((used)) + #else + #define __USED _Pragma("__root") + #endif +#endif + +#ifndef __WEAK + #if __ICCARM_V8 + #define __WEAK __attribute__((weak)) + #else + #define __WEAK _Pragma("__weak") + #endif +#endif + + +#ifndef __ICCARM_INTRINSICS_VERSION__ + #define __ICCARM_INTRINSICS_VERSION__ 0 +#endif + +#if __ICCARM_INTRINSICS_VERSION__ == 2 + + #if defined(__CLZ) + #undef __CLZ + #endif + #if defined(__REVSH) + #undef __REVSH + #endif + #if defined(__RBIT) + #undef __RBIT + #endif + #if defined(__SSAT) + #undef __SSAT + #endif + #if defined(__USAT) + #undef __USAT + #endif + + #include "iccarm_builtin.h" + + #define __disable_fault_irq __iar_builtin_disable_fiq + #define __disable_irq __iar_builtin_disable_interrupt + #define __enable_fault_irq __iar_builtin_enable_fiq + #define __enable_irq __iar_builtin_enable_interrupt + #define __arm_rsr __iar_builtin_rsr + #define __arm_wsr __iar_builtin_wsr + + + #define __get_APSR() (__arm_rsr("APSR")) + #define __get_BASEPRI() (__arm_rsr("BASEPRI")) + #define __get_CONTROL() (__arm_rsr("CONTROL")) + #define __get_FAULTMASK() (__arm_rsr("FAULTMASK")) + + #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + #define __get_FPSCR() (__arm_rsr("FPSCR")) + #define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE))) + #else + #define __get_FPSCR() ( 0 ) + #define __set_FPSCR(VALUE) ((void)VALUE) + #endif + + #define __get_IPSR() (__arm_rsr("IPSR")) + #define __get_MSP() (__arm_rsr("MSP")) + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + #define __get_MSPLIM() (0U) + #else + #define __get_MSPLIM() (__arm_rsr("MSPLIM")) + #endif + #define __get_PRIMASK() (__arm_rsr("PRIMASK")) + #define __get_PSP() (__arm_rsr("PSP")) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __get_PSPLIM() (0U) + #else + #define __get_PSPLIM() (__arm_rsr("PSPLIM")) + #endif + + #define __get_xPSR() (__arm_rsr("xPSR")) + + #define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE))) + #define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE))) + #define __set_CONTROL(VALUE) (__arm_wsr("CONTROL", (VALUE))) + #define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE))) + #define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE))) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + #define __set_MSPLIM(VALUE) ((void)(VALUE)) + #else + #define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE))) + #endif + #define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE))) + #define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE))) + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __set_PSPLIM(VALUE) ((void)(VALUE)) + #else + #define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE))) + #endif + + #define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS")) + #define __TZ_set_CONTROL_NS(VALUE) (__arm_wsr("CONTROL_NS", (VALUE))) + #define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS")) + #define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE))) + #define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS")) + #define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE))) + #define __TZ_get_SP_NS() (__arm_rsr("SP_NS")) + #define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE))) + #define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS")) + #define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE))) + #define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS")) + #define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE))) + #define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS")) + #define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE))) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __TZ_get_PSPLIM_NS() (0U) + #define __TZ_set_PSPLIM_NS(VALUE) ((void)(VALUE)) + #else + #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS")) + #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE))) + #endif + + #define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS")) + #define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE))) + + #define __NOP __iar_builtin_no_operation + + #define __CLZ __iar_builtin_CLZ + #define __CLREX __iar_builtin_CLREX + + #define __DMB __iar_builtin_DMB + #define __DSB __iar_builtin_DSB + #define __ISB __iar_builtin_ISB + + #define __LDREXB __iar_builtin_LDREXB + #define __LDREXH __iar_builtin_LDREXH + #define __LDREXW __iar_builtin_LDREX + + #define __RBIT __iar_builtin_RBIT + #define __REV __iar_builtin_REV + #define __REV16 __iar_builtin_REV16 + + __IAR_FT int16_t __REVSH(int16_t val) + { + return (int16_t) __iar_builtin_REVSH(val); + } + + #define __ROR __iar_builtin_ROR + #define __RRX __iar_builtin_RRX + + #define __SEV __iar_builtin_SEV + + #if !__IAR_M0_FAMILY + #define __SSAT __iar_builtin_SSAT + #endif + + #define __STREXB __iar_builtin_STREXB + #define __STREXH __iar_builtin_STREXH + #define __STREXW __iar_builtin_STREX + + #if !__IAR_M0_FAMILY + #define __USAT __iar_builtin_USAT + #endif + + #define __WFE __iar_builtin_WFE + #define __WFI __iar_builtin_WFI + + #if __ARM_MEDIA__ + #define __SADD8 __iar_builtin_SADD8 + #define __QADD8 __iar_builtin_QADD8 + #define __SHADD8 __iar_builtin_SHADD8 + #define __UADD8 __iar_builtin_UADD8 + #define __UQADD8 __iar_builtin_UQADD8 + #define __UHADD8 __iar_builtin_UHADD8 + #define __SSUB8 __iar_builtin_SSUB8 + #define __QSUB8 __iar_builtin_QSUB8 + #define __SHSUB8 __iar_builtin_SHSUB8 + #define __USUB8 __iar_builtin_USUB8 + #define __UQSUB8 __iar_builtin_UQSUB8 + #define __UHSUB8 __iar_builtin_UHSUB8 + #define __SADD16 __iar_builtin_SADD16 + #define __QADD16 __iar_builtin_QADD16 + #define __SHADD16 __iar_builtin_SHADD16 + #define __UADD16 __iar_builtin_UADD16 + #define __UQADD16 __iar_builtin_UQADD16 + #define __UHADD16 __iar_builtin_UHADD16 + #define __SSUB16 __iar_builtin_SSUB16 + #define __QSUB16 __iar_builtin_QSUB16 + #define __SHSUB16 __iar_builtin_SHSUB16 + #define __USUB16 __iar_builtin_USUB16 + #define __UQSUB16 __iar_builtin_UQSUB16 + #define __UHSUB16 __iar_builtin_UHSUB16 + #define __SASX __iar_builtin_SASX + #define __QASX __iar_builtin_QASX + #define __SHASX __iar_builtin_SHASX + #define __UASX __iar_builtin_UASX + #define __UQASX __iar_builtin_UQASX + #define __UHASX __iar_builtin_UHASX + #define __SSAX __iar_builtin_SSAX + #define __QSAX __iar_builtin_QSAX + #define __SHSAX __iar_builtin_SHSAX + #define __USAX __iar_builtin_USAX + #define __UQSAX __iar_builtin_UQSAX + #define __UHSAX __iar_builtin_UHSAX + #define __USAD8 __iar_builtin_USAD8 + #define __USADA8 __iar_builtin_USADA8 + #define __SSAT16 __iar_builtin_SSAT16 + #define __USAT16 __iar_builtin_USAT16 + #define __UXTB16 __iar_builtin_UXTB16 + #define __UXTAB16 __iar_builtin_UXTAB16 + #define __SXTB16 __iar_builtin_SXTB16 + #define __SXTAB16 __iar_builtin_SXTAB16 + #define __SMUAD __iar_builtin_SMUAD + #define __SMUADX __iar_builtin_SMUADX + #define __SMMLA __iar_builtin_SMMLA + #define __SMLAD __iar_builtin_SMLAD + #define __SMLADX __iar_builtin_SMLADX + #define __SMLALD __iar_builtin_SMLALD + #define __SMLALDX __iar_builtin_SMLALDX + #define __SMUSD __iar_builtin_SMUSD + #define __SMUSDX __iar_builtin_SMUSDX + #define __SMLSD __iar_builtin_SMLSD + #define __SMLSDX __iar_builtin_SMLSDX + #define __SMLSLD __iar_builtin_SMLSLD + #define __SMLSLDX __iar_builtin_SMLSLDX + #define __SEL __iar_builtin_SEL + #define __QADD __iar_builtin_QADD + #define __QSUB __iar_builtin_QSUB + #define __PKHBT __iar_builtin_PKHBT + #define __PKHTB __iar_builtin_PKHTB + #endif + +#else /* __ICCARM_INTRINSICS_VERSION__ == 2 */ + + #if __IAR_M0_FAMILY + /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */ + #define __CLZ __cmsis_iar_clz_not_active + #define __SSAT __cmsis_iar_ssat_not_active + #define __USAT __cmsis_iar_usat_not_active + #define __RBIT __cmsis_iar_rbit_not_active + #define __get_APSR __cmsis_iar_get_APSR_not_active + #endif + + + #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) )) + #define __get_FPSCR __cmsis_iar_get_FPSR_not_active + #define __set_FPSCR __cmsis_iar_set_FPSR_not_active + #endif + + #ifdef __INTRINSICS_INCLUDED + #error intrinsics.h is already included previously! + #endif + + #include + + #if __IAR_M0_FAMILY + /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */ + #undef __CLZ + #undef __SSAT + #undef __USAT + #undef __RBIT + #undef __get_APSR + + __STATIC_INLINE uint8_t __CLZ(uint32_t data) + { + if (data == 0U) { return 32U; } + + uint32_t count = 0U; + uint32_t mask = 0x80000000U; + + while ((data & mask) == 0U) + { + count += 1U; + mask = mask >> 1U; + } + return count; + } + + __STATIC_INLINE uint32_t __RBIT(uint32_t v) + { + uint8_t sc = 31U; + uint32_t r = v; + for (v >>= 1U; v; v >>= 1U) + { + r <<= 1U; + r |= v & 1U; + sc--; + } + return (r << sc); + } + + __STATIC_INLINE uint32_t __get_APSR(void) + { + uint32_t res; + __asm("MRS %0,APSR" : "=r" (res)); + return res; + } + + #endif + + #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) )) + #undef __get_FPSCR + #undef __set_FPSCR + #define __get_FPSCR() (0) + #define __set_FPSCR(VALUE) ((void)VALUE) + #endif + + #pragma diag_suppress=Pe940 + #pragma diag_suppress=Pe177 + + #define __enable_irq __enable_interrupt + #define __disable_irq __disable_interrupt + #define __NOP __no_operation + + #define __get_xPSR __get_PSR + + #if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0) + + __IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr) + { + return __LDREX((unsigned long *)ptr); + } + + __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr) + { + return __STREX(value, (unsigned long *)ptr); + } + #endif + + + /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */ + #if (__CORTEX_M >= 0x03) + + __IAR_FT uint32_t __RRX(uint32_t value) + { + uint32_t result; + __ASM("RRX %0, %1" : "=r"(result) : "r" (value) : "cc"); + return(result); + } + + __IAR_FT void __set_BASEPRI_MAX(uint32_t value) + { + __asm volatile("MSR BASEPRI_MAX,%0"::"r" (value)); + } + + + #define __enable_fault_irq __enable_fiq + #define __disable_fault_irq __disable_fiq + + + #endif /* (__CORTEX_M >= 0x03) */ + + __IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2) + { + return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2)); + } + + #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + + __IAR_FT uint32_t __get_MSPLIM(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,MSPLIM" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __set_MSPLIM(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR MSPLIM,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __get_PSPLIM(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,PSPLIM" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __set_PSPLIM(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR PSPLIM,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __TZ_get_CONTROL_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,CONTROL_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_CONTROL_NS(uint32_t value) + { + __asm volatile("MSR CONTROL_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PSP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,PSP_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_PSP_NS(uint32_t value) + { + __asm volatile("MSR PSP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_MSP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,MSP_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_MSP_NS(uint32_t value) + { + __asm volatile("MSR MSP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_SP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,SP_NS" : "=r" (res)); + return res; + } + __IAR_FT void __TZ_set_SP_NS(uint32_t value) + { + __asm volatile("MSR SP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PRIMASK_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,PRIMASK_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_PRIMASK_NS(uint32_t value) + { + __asm volatile("MSR PRIMASK_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_BASEPRI_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,BASEPRI_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_BASEPRI_NS(uint32_t value) + { + __asm volatile("MSR BASEPRI_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_FAULTMASK_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,FAULTMASK_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_FAULTMASK_NS(uint32_t value) + { + __asm volatile("MSR FAULTMASK_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PSPLIM_NS(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,PSPLIM_NS" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR PSPLIM_NS,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __TZ_get_MSPLIM_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,MSPLIM_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_MSPLIM_NS(uint32_t value) + { + __asm volatile("MSR MSPLIM_NS,%0" :: "r" (value)); + } + + #endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */ + +#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */ + +#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value)) + +#if __IAR_M0_FAMILY + __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) + { + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; + } + + __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) + { + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; + } +#endif + +#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */ + + __IAR_FT uint8_t __LDRBT(volatile uint8_t *addr) + { + uint32_t res; + __ASM("LDRBT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDRHT(volatile uint16_t *addr) + { + uint32_t res; + __ASM("LDRHT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDRT(volatile uint32_t *addr) + { + uint32_t res; + __ASM("LDRT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return res; + } + + __IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr) + { + __ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory"); + } + + __IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr) + { + __ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory"); + } + + __IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr) + { + __ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory"); + } + +#endif /* (__CORTEX_M >= 0x03) */ + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + + + __IAR_FT uint8_t __LDAB(volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDAH(volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDA(volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("LDA %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return res; + } + + __IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr) + { + __ASM volatile ("STLB %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr) + { + __ASM volatile ("STLH %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr) + { + __ASM volatile ("STL %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEXB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEXH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEX %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEXB %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEXH %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEX %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + +#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */ + +#undef __IAR_FT +#undef __IAR_M0_FAMILY +#undef __ICCARM_V8 + +#pragma diag_default=Pe940 +#pragma diag_default=Pe177 + +#endif /* __CMSIS_ICCARM_H__ */ diff --git a/EMBOS/Drivers/CMSIS/Include/cmsis_version.h b/EMBOS/Drivers/CMSIS/Include/cmsis_version.h new file mode 100644 index 0000000..660f612 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/cmsis_version.h @@ -0,0 +1,39 @@ +/**************************************************************************//** + * @file cmsis_version.h + * @brief CMSIS Core(M) Version definitions + * @version V5.0.2 + * @date 19. April 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CMSIS_VERSION_H +#define __CMSIS_VERSION_H + +/* CMSIS Version definitions */ +#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ +#define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ +#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ + __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ +#endif diff --git a/EMBOS/Drivers/CMSIS/Include/core_armv8mbl.h b/EMBOS/Drivers/CMSIS/Include/core_armv8mbl.h new file mode 100644 index 0000000..251e4ed --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_armv8mbl.h @@ -0,0 +1,1918 @@ +/**************************************************************************//** + * @file core_armv8mbl.h + * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 22. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_ARMV8MBL_H_GENERIC +#define __CORE_ARMV8MBL_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_ARMv8MBL + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS definitions */ +#define __ARMv8MBL_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __ARMv8MBL_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \ + __ARMv8MBL_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M ( 2U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MBL_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_ARMV8MBL_H_DEPENDANT +#define __CORE_ARMV8MBL_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __ARMv8MBL_REV + #define __ARMv8MBL_REV 0x0000U + #warning "__ARMv8MBL_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif + + #ifndef __ETM_PRESENT + #define __ETM_PRESENT 0U + #warning "__ETM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MTB_PRESENT + #define __MTB_PRESENT 0U + #warning "__MTB_PRESENT not defined in device header file; using default!" + #endif + +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group ARMv8MBL */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t RESERVED0[6U]; + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[809U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */ + uint32_t RESERVED4[4U]; + __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */ +#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI Periodic Synchronization Control Register Definitions */ +#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */ +#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */ + +/* TPI Software Lock Status Register Definitions */ +#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */ +#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */ + +#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */ +#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */ + +#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */ +#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + uint32_t RESERVED0[7U]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#endif +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register */ +#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */ +#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MBL_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_armv8mml.h b/EMBOS/Drivers/CMSIS/Include/core_armv8mml.h new file mode 100644 index 0000000..3a3148e --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_armv8mml.h @@ -0,0 +1,2927 @@ +/**************************************************************************//** + * @file core_armv8mml.h + * @brief CMSIS Armv8-M Mainline Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 06. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_ARMV8MML_H_GENERIC +#define __CORE_ARMV8MML_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_ARMv8MML + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS Armv8MML definitions */ +#define __ARMv8MML_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __ARMv8MML_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \ + __ARMv8MML_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (81U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MML_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_ARMV8MML_H_DEPENDANT +#define __CORE_ARMV8MML_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __ARMv8MML_REV + #define __ARMv8MML_REV 0x0000U + #warning "__ARMv8MML_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DSP_PRESENT + #define __DSP_PRESENT 0U + #warning "__DSP_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group ARMv8MML */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ +#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */ + uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */ + uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */ +#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */ + +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED6[580U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */ + uint32_t RESERVED3[92U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */ +#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */ +#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */ + +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */ +#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */ +#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Non-Secure Access Control Register Definitions */ +#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */ +#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */ + +#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */ +#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */ + +#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */ +#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ + __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */ + uint32_t RESERVED6[4U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Stimulus Port Register Definitions */ +#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */ +#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */ + +#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */ +#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */ + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */ +#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */ + +#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */ +#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ + uint32_t RESERVED32[934U]; + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ + uint32_t RESERVED33[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */ +#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[809U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */ + uint32_t RESERVED4[4U]; + __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */ +#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI Periodic Synchronization Control Register Definitions */ +#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */ +#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */ + +/* TPI Software Lock Status Register Definitions */ +#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */ +#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */ + +#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */ +#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */ + +#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */ +#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */ + __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */ + __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */ + __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */ + uint32_t RESERVED0[1]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#else + uint32_t RESERVED0[3]; +#endif + __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */ + __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */ +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/* Secure Fault Status Register Definitions */ +#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */ +#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */ + +#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */ +#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */ + +#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */ +#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */ + +#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */ +#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */ + +#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */ +#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */ + +#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */ +#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */ + +#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */ +#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */ + +#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */ +#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */ +#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */ + +#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */ +#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */ + +#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */ +#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */ + +#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */ +#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */ + +#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */ +#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */ + +#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */ +#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */ +#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */ +#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + + #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ + #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */ + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + + #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */ + #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */ + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Set Priority Grouping (non-secure) + \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB_NS->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB_NS->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping (non-secure) + \details Reads the priority grouping field from the non-secure NVIC when in secure state. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void) +{ + return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MML_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm0.h b/EMBOS/Drivers/CMSIS/Include/core_cm0.h new file mode 100644 index 0000000..f929bba --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm0.h @@ -0,0 +1,949 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V5.0.5 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M0 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000U + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm0plus.h b/EMBOS/Drivers/CMSIS/Include/core_cm0plus.h new file mode 100644 index 0000000..424011a --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm0plus.h @@ -0,0 +1,1083 @@ +/**************************************************************************//** + * @file core_cm0plus.h + * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File + * @version V5.0.6 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0PLUS_H_GENERIC +#define __CORE_CM0PLUS_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex-M0+ + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM0+ definitions */ +#define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ + __CM0PLUS_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0PLUS_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0PLUS_H_DEPENDANT +#define __CORE_CM0PLUS_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0PLUS_REV + #define __CM0PLUS_REV 0x0000U + #warning "__CM0PLUS_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex-M0+ */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Interrupt Control State Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0+ header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; + +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0PLUS_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm1.h b/EMBOS/Drivers/CMSIS/Include/core_cm1.h new file mode 100644 index 0000000..0ed678e --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm1.h @@ -0,0 +1,976 @@ +/**************************************************************************//** + * @file core_cm1.h + * @brief CMSIS Cortex-M1 Core Peripheral Access Layer Header File + * @version V1.0.0 + * @date 23. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM1_H_GENERIC +#define __CORE_CM1_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M1 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM1 definitions */ +#define __CM1_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM1_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM1_CMSIS_VERSION ((__CM1_CMSIS_VERSION_MAIN << 16U) | \ + __CM1_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (1U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM1_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM1_H_DEPENDANT +#define __CORE_CM1_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM1_REV + #define __CM1_REV 0x0100U + #warning "__CM1_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M1 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_ITCMUAEN_Pos 4U /*!< ACTLR: Instruction TCM Upper Alias Enable Position */ +#define SCnSCB_ACTLR_ITCMUAEN_Msk (1UL << SCnSCB_ACTLR_ITCMUAEN_Pos) /*!< ACTLR: Instruction TCM Upper Alias Enable Mask */ + +#define SCnSCB_ACTLR_ITCMLAEN_Pos 3U /*!< ACTLR: Instruction TCM Lower Alias Enable Position */ +#define SCnSCB_ACTLR_ITCMLAEN_Msk (1UL << SCnSCB_ACTLR_ITCMLAEN_Pos) /*!< ACTLR: Instruction TCM Lower Alias Enable Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M1 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M1 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M1 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM1_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm23.h b/EMBOS/Drivers/CMSIS/Include/core_cm23.h new file mode 100644 index 0000000..acbc5df --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm23.h @@ -0,0 +1,1993 @@ +/**************************************************************************//** + * @file core_cm23.h + * @brief CMSIS Cortex-M23 Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 22. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM23_H_GENERIC +#define __CORE_CM23_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M23 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS definitions */ +#define __CM23_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM23_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM23_CMSIS_VERSION ((__CM23_CMSIS_VERSION_MAIN << 16U) | \ + __CM23_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (23U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM23_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM23_H_DEPENDANT +#define __CORE_CM23_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM23_REV + #define __CM23_REV 0x0000U + #warning "__CM23_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif + + #ifndef __ETM_PRESENT + #define __ETM_PRESENT 0U + #warning "__ETM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MTB_PRESENT + #define __MTB_PRESENT 0U + #warning "__MTB_PRESENT not defined in device header file; using default!" + #endif + +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M23 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t RESERVED0[6U]; + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */ + __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */ + __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration Test FIFO Test Data 0 Register Definitions */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */ +#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */ +#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */ +#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */ + +/* TPI Integration Test ATB Control Register 2 Register Definitions */ +#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */ +#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */ + +#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */ +#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */ + +#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */ +#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */ + +#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */ +#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */ + +/* TPI Integration Test FIFO Test Data 1 Register Definitions */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */ +#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */ +#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */ +#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */ + +/* TPI Integration Test ATB Control Register 0 Definitions */ +#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */ +#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */ + +#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */ +#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */ + +#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */ +#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */ + +#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */ +#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + uint32_t RESERVED0[7U]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#endif +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register */ +#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */ +#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M23 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M23 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM23_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm3.h b/EMBOS/Drivers/CMSIS/Include/core_cm3.h new file mode 100644 index 0000000..74bff64 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm3.h @@ -0,0 +1,1941 @@ +/**************************************************************************//** + * @file core_cm3.h + * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM3_H_GENERIC +#define __CORE_CM3_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M3 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM3 definitions */ +#define __CM3_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM3_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \ + __CM3_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (3U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM3_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM3_H_DEPENDANT +#define __CORE_CM3_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM3_REV + #define __CM3_REV 0x0200U + #warning "__CM3_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M3 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#if defined (__CM3_REV) && (__CM3_REV < 0x0201U) /* core r2p1 */ +#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ +#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ + +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#else +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ +#if defined (__CM3_REV) && (__CM3_REV >= 0x200U) + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +#else + uint32_t RESERVED1[1U]; +#endif +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM3_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm33.h b/EMBOS/Drivers/CMSIS/Include/core_cm33.h new file mode 100644 index 0000000..6cd2db7 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm33.h @@ -0,0 +1,3002 @@ +/**************************************************************************//** + * @file core_cm33.h + * @brief CMSIS Cortex-M33 Core Peripheral Access Layer Header File + * @version V5.0.9 + * @date 06. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM33_H_GENERIC +#define __CORE_CM33_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M33 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM33 definitions */ +#define __CM33_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM33_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM33_CMSIS_VERSION ((__CM33_CMSIS_VERSION_MAIN << 16U) | \ + __CM33_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (33U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined (__TARGET_FPU_VFP) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined (__ARM_PCS_VFP) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined (__ARMVFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined (__TI_VFP_SUPPORT__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined (__FPU_VFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM33_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM33_H_DEPENDANT +#define __CORE_CM33_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM33_REV + #define __CM33_REV 0x0000U + #warning "__CM33_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DSP_PRESENT + #define __DSP_PRESENT 0U + #warning "__DSP_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M33 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ +#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */ + uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */ + uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */ +#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */ + +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED6[580U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */ + uint32_t RESERVED3[92U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */ +#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */ +#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */ + +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */ +#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */ +#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Non-Secure Access Control Register Definitions */ +#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */ +#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */ + +#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */ +#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */ + +#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */ +#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ + __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */ + uint32_t RESERVED6[4U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Stimulus Port Register Definitions */ +#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */ +#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */ + +#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */ +#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */ + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */ +#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */ + +#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */ +#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ + uint32_t RESERVED32[934U]; + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ + uint32_t RESERVED33[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */ +#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */ + __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */ + __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration Test FIFO Test Data 0 Register Definitions */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */ +#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */ +#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */ +#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */ + +/* TPI Integration Test ATB Control Register 2 Register Definitions */ +#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */ +#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */ + +#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */ +#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */ + +#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */ +#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */ + +#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */ +#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */ + +/* TPI Integration Test FIFO Test Data 1 Register Definitions */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */ +#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */ +#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */ +#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */ + +/* TPI Integration Test ATB Control Register 0 Definitions */ +#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */ +#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */ + +#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */ +#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */ + +#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */ +#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */ + +#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */ +#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */ + __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */ + __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */ + __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */ + uint32_t RESERVED0[1]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#else + uint32_t RESERVED0[3]; +#endif + __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */ + __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */ +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/* Secure Fault Status Register Definitions */ +#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */ +#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */ + +#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */ +#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */ + +#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */ +#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */ + +#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */ +#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */ + +#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */ +#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */ + +#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */ +#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */ + +#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */ +#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */ + +#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */ +#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */ +#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */ + +#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */ +#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */ + +#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */ +#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */ + +#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */ +#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */ + +#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */ +#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */ + +#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */ +#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */ +#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */ +#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + + #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ + #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */ + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + + #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */ + #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */ + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Set Priority Grouping (non-secure) + \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB_NS->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB_NS->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping (non-secure) + \details Reads the priority grouping field from the non-secure NVIC when in secure state. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void) +{ + return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM33_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm4.h b/EMBOS/Drivers/CMSIS/Include/core_cm4.h new file mode 100644 index 0000000..7d56873 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm4.h @@ -0,0 +1,2129 @@ +/**************************************************************************//** + * @file core_cm4.h + * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM4_H_GENERIC +#define __CORE_CM4_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M4 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM4 definitions */ +#define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \ + __CM4_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (4U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM4_H_DEPENDANT +#define __CORE_CM4_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM4_REV + #define __CM4_REV 0x0000U + #warning "__CM4_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M4 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */ +#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */ + +#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */ +#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ +#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ +#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_cm7.h b/EMBOS/Drivers/CMSIS/Include/core_cm7.h new file mode 100644 index 0000000..a14dc62 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_cm7.h @@ -0,0 +1,2671 @@ +/**************************************************************************//** + * @file core_cm7.h + * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM7_H_GENERIC +#define __CORE_CM7_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M7 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM7 definitions */ +#define __CM7_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM7_CMSIS_VERSION_SUB ( __CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \ + __CM7_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (7U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM7_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM7_H_DEPENDANT +#define __CORE_CM7_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM7_REV + #define __CM7_REV 0x0000U + #warning "__CM7_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __ICACHE_PRESENT + #define __ICACHE_PRESENT 0U + #warning "__ICACHE_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DCACHE_PRESENT + #define __DCACHE_PRESENT 0U + #warning "__DCACHE_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DTCM_PRESENT + #define __DTCM_PRESENT 0U + #warning "__DTCM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M7 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_AFR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[1U]; + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + uint32_t RESERVED3[93U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: Branch prediction enable bit Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: Branch prediction enable bit Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: Instruction cache enable bit Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: Instruction cache enable bit Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: Cache enable bit Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: Cache enable bit Mask */ + +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISITMATBFLUSH_Pos 12U /*!< ACTLR: DISITMATBFLUSH Position */ +#define SCnSCB_ACTLR_DISITMATBFLUSH_Msk (1UL << SCnSCB_ACTLR_DISITMATBFLUSH_Pos) /*!< ACTLR: DISITMATBFLUSH Mask */ + +#define SCnSCB_ACTLR_DISRAMODE_Pos 11U /*!< ACTLR: DISRAMODE Position */ +#define SCnSCB_ACTLR_DISRAMODE_Msk (1UL << SCnSCB_ACTLR_DISRAMODE_Pos) /*!< ACTLR: DISRAMODE Mask */ + +#define SCnSCB_ACTLR_FPEXCODIS_Pos 10U /*!< ACTLR: FPEXCODIS Position */ +#define SCnSCB_ACTLR_FPEXCODIS_Msk (1UL << SCnSCB_ACTLR_FPEXCODIS_Pos) /*!< ACTLR: FPEXCODIS Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED3[981U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( W) Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/* Media and FP Feature Register 2 Definitions */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ +#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ +#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = SCB->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## Cache functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_CacheFunctions Cache Functions + \brief Functions that configure Instruction and Data cache. + @{ + */ + +/* Cache Size ID Register Macros */ +#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos) +#define CCSIDR_SETS(x) (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos ) + + +/** + \brief Enable I-Cache + \details Turns on I-Cache + */ +__STATIC_INLINE void SCB_EnableICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->ICIALLU = 0UL; /* invalidate I-Cache */ + __DSB(); + __ISB(); + SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */ + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Disable I-Cache + \details Turns off I-Cache + */ +__STATIC_INLINE void SCB_DisableICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */ + SCB->ICIALLU = 0UL; /* invalidate I-Cache */ + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Invalidate I-Cache + \details Invalidates I-Cache + */ +__STATIC_INLINE void SCB_InvalidateICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->ICIALLU = 0UL; + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Enable D-Cache + \details Turns on D-Cache + */ +__STATIC_INLINE void SCB_EnableDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | + ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + __DSB(); + + SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */ + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Disable D-Cache + \details Turns off D-Cache + */ +__STATIC_INLINE void SCB_DisableDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean & invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | + ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Invalidate D-Cache + \details Invalidates D-Cache + */ +__STATIC_INLINE void SCB_InvalidateDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | + ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Clean D-Cache + \details Cleans D-Cache + */ +__STATIC_INLINE void SCB_CleanDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) | + ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Clean & Invalidate D-Cache + \details Cleans and Invalidates D-Cache + */ +__STATIC_INLINE void SCB_CleanInvalidateDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean & invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | + ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Invalidate by address + \details Invalidates D-Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t)addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCIMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Clean by address + \details Cleans D-Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t) addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCCMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Clean and Invalidate by address + \details Cleans and invalidates D_Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t) addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCCIMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/*@} end of CMSIS_Core_CacheFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM7_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_sc000.h b/EMBOS/Drivers/CMSIS/Include/core_sc000.h new file mode 100644 index 0000000..9b67c92 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_sc000.h @@ -0,0 +1,1022 @@ +/**************************************************************************//** + * @file core_sc000.h + * @brief CMSIS SC000 Core Peripheral Access Layer Header File + * @version V5.0.5 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_SC000_H_GENERIC +#define __CORE_SC000_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup SC000 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS SC000 definitions */ +#define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \ + __SC000_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_SC (000U) /*!< Cortex secure core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC000_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_SC000_H_DEPENDANT +#define __CORE_SC000_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __SC000_REV + #define __SC000_REV 0x0000U + #warning "__SC000_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group SC000 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED0[1U]; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + uint32_t RESERVED1[154U]; + __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the SC000 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC000_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/core_sc300.h b/EMBOS/Drivers/CMSIS/Include/core_sc300.h new file mode 100644 index 0000000..3e8a471 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/core_sc300.h @@ -0,0 +1,1915 @@ +/**************************************************************************//** + * @file core_sc300.h + * @brief CMSIS SC300 Core Peripheral Access Layer Header File + * @version V5.0.6 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_SC300_H_GENERIC +#define __CORE_SC300_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup SC3000 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS SC300 definitions */ +#define __SC300_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __SC300_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \ + __SC300_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_SC (300U) /*!< Cortex secure core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC300_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_SC300_H_DEPENDANT +#define __CORE_SC300_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __SC300_REV + #define __SC300_REV 0x0000U + #warning "__SC300_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group SC300 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + uint32_t RESERVED1[129U]; + __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ +#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ + +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + uint32_t RESERVED1[1U]; +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC300_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/EMBOS/Drivers/CMSIS/Include/mpu_armv7.h b/EMBOS/Drivers/CMSIS/Include/mpu_armv7.h new file mode 100644 index 0000000..0142203 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/mpu_armv7.h @@ -0,0 +1,270 @@ +/****************************************************************************** + * @file mpu_armv7.h + * @brief CMSIS MPU API for Armv7-M MPU + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef ARM_MPU_ARMV7_H +#define ARM_MPU_ARMV7_H + +#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes +#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes +#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes +#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes +#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes +#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte +#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes +#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes +#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes +#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes +#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes +#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes +#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes +#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes +#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes +#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte +#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes +#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes +#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes +#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes +#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes +#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes +#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes +#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes +#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes +#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte +#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes +#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes + +#define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access +#define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only +#define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only +#define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access +#define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only +#define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access + +/** MPU Region Base Address Register Value +* +* \param Region The region to be configured, number 0 to 15. +* \param BaseAddress The base address for the region. +*/ +#define ARM_MPU_RBAR(Region, BaseAddress) \ + (((BaseAddress) & MPU_RBAR_ADDR_Msk) | \ + ((Region) & MPU_RBAR_REGION_Msk) | \ + (MPU_RBAR_VALID_Msk)) + +/** +* MPU Memory Access Attributes +* +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +*/ +#define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \ + ((((TypeExtField ) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \ + (((IsShareable ) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \ + (((IsCacheable ) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \ + (((IsBufferable ) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk)) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \ + ((((DisableExec ) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \ + (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \ + (((AccessAttributes) ) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk))) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \ + ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size) + +/** +* MPU Memory Access Attribute for strongly ordered memory. +* - TEX: 000b +* - Shareable +* - Non-cacheable +* - Non-bufferable +*/ +#define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U) + +/** +* MPU Memory Access Attribute for device memory. +* - TEX: 000b (if non-shareable) or 010b (if shareable) +* - Shareable or non-shareable +* - Non-cacheable +* - Bufferable (if shareable) or non-bufferable (if non-shareable) +* +* \param IsShareable Configures the device memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U)) + +/** +* MPU Memory Access Attribute for normal memory. +* - TEX: 1BBb (reflecting outer cacheability rules) +* - Shareable or non-shareable +* - Cacheable or non-cacheable (reflecting inner cacheability rules) +* - Bufferable or non-bufferable (reflecting inner cacheability rules) +* +* \param OuterCp Configures the outer cache policy. +* \param InnerCp Configures the inner cache policy. +* \param IsShareable Configures the memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) & 2U), ((InnerCp) & 1U)) + +/** +* MPU Memory Access Attribute non-cacheable policy. +*/ +#define ARM_MPU_CACHEP_NOCACHE 0U + +/** +* MPU Memory Access Attribute write-back, write and read allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_WRA 1U + +/** +* MPU Memory Access Attribute write-through, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WT_NWA 2U + +/** +* MPU Memory Access Attribute write-back, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_NWA 3U + + +/** +* Struct for a single MPU Region +*/ +typedef struct { + uint32_t RBAR; //!< The region base address register value (RBAR) + uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR +} ARM_MPU_Region_t; + +/** Enable the MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} + +/** Clear and disable the given MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr) +{ + MPU->RNR = rnr; + MPU->RASR = 0U; +} + +/** Configure an MPU region. +* \param rbar Value for RBAR register. +* \param rsar Value for RSAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr) +{ + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Configure the given MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rsar Value for RSAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr) +{ + MPU->RNR = rnr; + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Memcopy with strictly ordered memory access, e.g. for register targets. +* \param dst Destination data is copied to. +* \param src Source data is copied from. +* \param len Amount of data words to be copied. +*/ +__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len) +{ + uint32_t i; + for (i = 0U; i < len; ++i) + { + dst[i] = src[i]; + } +} + +/** Load the given number of MPU regions from a table. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt) +{ + const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U; + while (cnt > MPU_TYPE_RALIASES) { + orderedCpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize); + table += MPU_TYPE_RALIASES; + cnt -= MPU_TYPE_RALIASES; + } + orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize); +} + +#endif diff --git a/EMBOS/Drivers/CMSIS/Include/mpu_armv8.h b/EMBOS/Drivers/CMSIS/Include/mpu_armv8.h new file mode 100644 index 0000000..62571da --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/mpu_armv8.h @@ -0,0 +1,333 @@ +/****************************************************************************** + * @file mpu_armv8.h + * @brief CMSIS MPU API for Armv8-M MPU + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef ARM_MPU_ARMV8_H +#define ARM_MPU_ARMV8_H + +/** \brief Attribute for device memory (outer only) */ +#define ARM_MPU_ATTR_DEVICE ( 0U ) + +/** \brief Attribute for non-cacheable, normal memory */ +#define ARM_MPU_ATTR_NON_CACHEABLE ( 4U ) + +/** \brief Attribute for normal memory (outer and inner) +* \param NT Non-Transient: Set to 1 for non-transient data. +* \param WB Write-Back: Set to 1 to use write-back update policy. +* \param RA Read Allocation: Set to 1 to use cache allocation on read miss. +* \param WA Write Allocation: Set to 1 to use cache allocation on write miss. +*/ +#define ARM_MPU_ATTR_MEMORY_(NT, WB, RA, WA) \ + (((NT & 1U) << 3U) | ((WB & 1U) << 2U) | ((RA & 1U) << 1U) | (WA & 1U)) + +/** \brief Device memory type non Gathering, non Re-ordering, non Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGnRnE (0U) + +/** \brief Device memory type non Gathering, non Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGnRE (1U) + +/** \brief Device memory type non Gathering, Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGRE (2U) + +/** \brief Device memory type Gathering, Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_GRE (3U) + +/** \brief Memory Attribute +* \param O Outer memory attributes +* \param I O == ARM_MPU_ATTR_DEVICE: Device memory attributes, else: Inner memory attributes +*/ +#define ARM_MPU_ATTR(O, I) (((O & 0xFU) << 4U) | (((O & 0xFU) != 0U) ? (I & 0xFU) : ((I & 0x3U) << 2U))) + +/** \brief Normal memory non-shareable */ +#define ARM_MPU_SH_NON (0U) + +/** \brief Normal memory outer shareable */ +#define ARM_MPU_SH_OUTER (2U) + +/** \brief Normal memory inner shareable */ +#define ARM_MPU_SH_INNER (3U) + +/** \brief Memory access permissions +* \param RO Read-Only: Set to 1 for read-only memory. +* \param NP Non-Privileged: Set to 1 for non-privileged memory. +*/ +#define ARM_MPU_AP_(RO, NP) (((RO & 1U) << 1U) | (NP & 1U)) + +/** \brief Region Base Address Register value +* \param BASE The base address bits [31:5] of a memory region. The value is zero extended. Effective address gets 32 byte aligned. +* \param SH Defines the Shareability domain for this memory region. +* \param RO Read-Only: Set to 1 for a read-only memory region. +* \param NP Non-Privileged: Set to 1 for a non-privileged memory region. +* \oaram XN eXecute Never: Set to 1 for a non-executable memory region. +*/ +#define ARM_MPU_RBAR(BASE, SH, RO, NP, XN) \ + ((BASE & MPU_RBAR_BASE_Msk) | \ + ((SH << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk) | \ + ((ARM_MPU_AP_(RO, NP) << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk) | \ + ((XN << MPU_RBAR_XN_Pos) & MPU_RBAR_XN_Msk)) + +/** \brief Region Limit Address Register value +* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended. +* \param IDX The attribute index to be associated with this memory region. +*/ +#define ARM_MPU_RLAR(LIMIT, IDX) \ + ((LIMIT & MPU_RLAR_LIMIT_Msk) | \ + ((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \ + (MPU_RLAR_EN_Msk)) + +/** +* Struct for a single MPU Region +*/ +typedef struct { + uint32_t RBAR; /*!< Region Base Address Register value */ + uint32_t RLAR; /*!< Region Limit Address Register value */ +} ARM_MPU_Region_t; + +/** Enable the MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} + +#ifdef MPU_NS +/** Enable the Non-secure MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable_NS(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the Non-secure MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable_NS(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU_NS->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} +#endif + +/** Set the memory attribute encoding to the given MPU. +* \param mpu Pointer to the MPU to be configured. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr) +{ + const uint8_t reg = idx / 4U; + const uint32_t pos = ((idx % 4U) * 8U); + const uint32_t mask = 0xFFU << pos; + + if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) { + return; // invalid index + } + + mpu->MAIR[reg] = ((mpu->MAIR[reg] & ~mask) | ((attr << pos) & mask)); +} + +/** Set the memory attribute encoding. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttr(uint8_t idx, uint8_t attr) +{ + ARM_MPU_SetMemAttrEx(MPU, idx, attr); +} + +#ifdef MPU_NS +/** Set the memory attribute encoding to the Non-secure MPU. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttr_NS(uint8_t idx, uint8_t attr) +{ + ARM_MPU_SetMemAttrEx(MPU_NS, idx, attr); +} +#endif + +/** Clear and disable the given MPU region of the given MPU. +* \param mpu Pointer to MPU to be used. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegionEx(MPU_Type* mpu, uint32_t rnr) +{ + mpu->RNR = rnr; + mpu->RLAR = 0U; +} + +/** Clear and disable the given MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr) +{ + ARM_MPU_ClrRegionEx(MPU, rnr); +} + +#ifdef MPU_NS +/** Clear and disable the given Non-secure MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion_NS(uint32_t rnr) +{ + ARM_MPU_ClrRegionEx(MPU_NS, rnr); +} +#endif + +/** Configure the given MPU region of the given MPU. +* \param mpu Pointer to MPU to be used. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegionEx(MPU_Type* mpu, uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + mpu->RNR = rnr; + mpu->RBAR = rbar; + mpu->RLAR = rlar; +} + +/** Configure the given MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + ARM_MPU_SetRegionEx(MPU, rnr, rbar, rlar); +} + +#ifdef MPU_NS +/** Configure the given Non-secure MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion_NS(uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + ARM_MPU_SetRegionEx(MPU_NS, rnr, rbar, rlar); +} +#endif + +/** Memcopy with strictly ordered memory access, e.g. for register targets. +* \param dst Destination data is copied to. +* \param src Source data is copied from. +* \param len Amount of data words to be copied. +*/ +__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len) +{ + uint32_t i; + for (i = 0U; i < len; ++i) + { + dst[i] = src[i]; + } +} + +/** Load the given number of MPU regions from a table to the given MPU. +* \param mpu Pointer to the MPU registers to be used. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_LoadEx(MPU_Type* mpu, uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U; + if (cnt == 1U) { + mpu->RNR = rnr; + orderedCpy(&(mpu->RBAR), &(table->RBAR), rowWordSize); + } else { + uint32_t rnrBase = rnr & ~(MPU_TYPE_RALIASES-1U); + uint32_t rnrOffset = rnr % MPU_TYPE_RALIASES; + + mpu->RNR = rnrBase; + while ((rnrOffset + cnt) > MPU_TYPE_RALIASES) { + uint32_t c = MPU_TYPE_RALIASES - rnrOffset; + orderedCpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize); + table += c; + cnt -= c; + rnrOffset = 0U; + rnrBase += MPU_TYPE_RALIASES; + mpu->RNR = rnrBase; + } + + orderedCpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), cnt*rowWordSize); + } +} + +/** Load the given number of MPU regions from a table. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + ARM_MPU_LoadEx(MPU, rnr, table, cnt); +} + +#ifdef MPU_NS +/** Load the given number of MPU regions from a table to the Non-secure MPU. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load_NS(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + ARM_MPU_LoadEx(MPU_NS, rnr, table, cnt); +} +#endif + +#endif + diff --git a/EMBOS/Drivers/CMSIS/Include/tz_context.h b/EMBOS/Drivers/CMSIS/Include/tz_context.h new file mode 100644 index 0000000..0d09749 --- /dev/null +++ b/EMBOS/Drivers/CMSIS/Include/tz_context.h @@ -0,0 +1,70 @@ +/****************************************************************************** + * @file tz_context.h + * @brief Context Management for Armv8-M TrustZone + * @version V1.0.1 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef TZ_CONTEXT_H +#define TZ_CONTEXT_H + +#include + +#ifndef TZ_MODULEID_T +#define TZ_MODULEID_T +/// \details Data type that identifies secure software modules called by a process. +typedef uint32_t TZ_ModuleId_t; +#endif + +/// \details TZ Memory ID identifies an allocated memory slot. +typedef uint32_t TZ_MemoryId_t; + +/// Initialize secure context memory system +/// \return execution status (1: success, 0: error) +uint32_t TZ_InitContextSystem_S (void); + +/// Allocate context memory for calling secure software modules in TrustZone +/// \param[in] module identifies software modules called from non-secure mode +/// \return value != 0 id TrustZone memory slot identifier +/// \return value 0 no memory available or internal error +TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); + +/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); + +/// Load secure context (called on RTOS thread context switch) +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); + +/// Store secure context (called on RTOS thread context switch) +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); + +#endif // TZ_CONTEXT_H diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h new file mode 100644 index 0000000..90767ed --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h @@ -0,0 +1,3776 @@ +/** + ****************************************************************************** + * @file stm32_hal_legacy.h + * @author MCD Application Team + * @brief This file contains aliases definition for the STM32Cube HAL constants + * macros and functions maintained for legacy purpose. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * 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 + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup HAL_AES_Aliased_Defines HAL CRYP Aliased Defines maintained for legacy purpose + * @{ + */ +#define AES_FLAG_RDERR CRYP_FLAG_RDERR +#define AES_FLAG_WRERR CRYP_FLAG_WRERR +#define AES_CLEARFLAG_CCF CRYP_CLEARFLAG_CCF +#define AES_CLEARFLAG_RDERR CRYP_CLEARFLAG_RDERR +#define AES_CLEARFLAG_WRERR CRYP_CLEARFLAG_WRERR + +/** + * @} + */ + +/** @defgroup HAL_ADC_Aliased_Defines HAL ADC Aliased Defines maintained for legacy purpose + * @{ + */ +#define ADC_RESOLUTION12b ADC_RESOLUTION_12B +#define ADC_RESOLUTION10b ADC_RESOLUTION_10B +#define ADC_RESOLUTION8b ADC_RESOLUTION_8B +#define ADC_RESOLUTION6b ADC_RESOLUTION_6B +#define OVR_DATA_OVERWRITTEN ADC_OVR_DATA_OVERWRITTEN +#define OVR_DATA_PRESERVED ADC_OVR_DATA_PRESERVED +#define EOC_SINGLE_CONV ADC_EOC_SINGLE_CONV +#define EOC_SEQ_CONV ADC_EOC_SEQ_CONV +#define EOC_SINGLE_SEQ_CONV ADC_EOC_SINGLE_SEQ_CONV +#define REGULAR_GROUP ADC_REGULAR_GROUP +#define INJECTED_GROUP ADC_INJECTED_GROUP +#define REGULAR_INJECTED_GROUP ADC_REGULAR_INJECTED_GROUP +#define AWD_EVENT ADC_AWD_EVENT +#define AWD1_EVENT ADC_AWD1_EVENT +#define AWD2_EVENT ADC_AWD2_EVENT +#define AWD3_EVENT ADC_AWD3_EVENT +#define OVR_EVENT ADC_OVR_EVENT +#define JQOVF_EVENT ADC_JQOVF_EVENT +#define ALL_CHANNELS ADC_ALL_CHANNELS +#define REGULAR_CHANNELS ADC_REGULAR_CHANNELS +#define INJECTED_CHANNELS ADC_INJECTED_CHANNELS +#define SYSCFG_FLAG_SENSOR_ADC ADC_FLAG_SENSOR +#define SYSCFG_FLAG_VREF_ADC ADC_FLAG_VREFINT +#define ADC_CLOCKPRESCALER_PCLK_DIV1 ADC_CLOCK_SYNC_PCLK_DIV1 +#define ADC_CLOCKPRESCALER_PCLK_DIV2 ADC_CLOCK_SYNC_PCLK_DIV2 +#define ADC_CLOCKPRESCALER_PCLK_DIV4 ADC_CLOCK_SYNC_PCLK_DIV4 +#define ADC_CLOCKPRESCALER_PCLK_DIV6 ADC_CLOCK_SYNC_PCLK_DIV6 +#define ADC_CLOCKPRESCALER_PCLK_DIV8 ADC_CLOCK_SYNC_PCLK_DIV8 +#define ADC_EXTERNALTRIG0_T6_TRGO ADC_EXTERNALTRIGCONV_T6_TRGO +#define ADC_EXTERNALTRIG1_T21_CC2 ADC_EXTERNALTRIGCONV_T21_CC2 +#define ADC_EXTERNALTRIG2_T2_TRGO ADC_EXTERNALTRIGCONV_T2_TRGO +#define ADC_EXTERNALTRIG3_T2_CC4 ADC_EXTERNALTRIGCONV_T2_CC4 +#define ADC_EXTERNALTRIG4_T22_TRGO ADC_EXTERNALTRIGCONV_T22_TRGO +#define ADC_EXTERNALTRIG7_EXT_IT11 ADC_EXTERNALTRIGCONV_EXT_IT11 +#define ADC_CLOCK_ASYNC ADC_CLOCK_ASYNC_DIV1 +#define ADC_EXTERNALTRIG_EDGE_NONE ADC_EXTERNALTRIGCONVEDGE_NONE +#define ADC_EXTERNALTRIG_EDGE_RISING ADC_EXTERNALTRIGCONVEDGE_RISING +#define ADC_EXTERNALTRIG_EDGE_FALLING ADC_EXTERNALTRIGCONVEDGE_FALLING +#define ADC_EXTERNALTRIG_EDGE_RISINGFALLING ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING +#define ADC_SAMPLETIME_2CYCLE_5 ADC_SAMPLETIME_2CYCLES_5 + +#define HAL_ADC_STATE_BUSY_REG HAL_ADC_STATE_REG_BUSY +#define HAL_ADC_STATE_BUSY_INJ HAL_ADC_STATE_INJ_BUSY +#define HAL_ADC_STATE_EOC_REG HAL_ADC_STATE_REG_EOC +#define HAL_ADC_STATE_EOC_INJ HAL_ADC_STATE_INJ_EOC +#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 */ +/** + * @} + */ + +/** @defgroup HAL_CEC_Aliased_Defines HAL CEC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define __HAL_CEC_GET_IT __HAL_CEC_GET_FLAG + +/** + * @} + */ + +/** @defgroup HAL_COMP_Aliased_Defines HAL COMP Aliased Defines maintained for legacy purpose + * @{ + */ +#define COMP_WINDOWMODE_DISABLED COMP_WINDOWMODE_DISABLE +#define COMP_WINDOWMODE_ENABLED COMP_WINDOWMODE_ENABLE +#define COMP_EXTI_LINE_COMP1_EVENT COMP_EXTI_LINE_COMP1 +#define COMP_EXTI_LINE_COMP2_EVENT COMP_EXTI_LINE_COMP2 +#define COMP_EXTI_LINE_COMP3_EVENT COMP_EXTI_LINE_COMP3 +#define COMP_EXTI_LINE_COMP4_EVENT COMP_EXTI_LINE_COMP4 +#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 +#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 +#define COMP_OUTPUT_TIM3OCREFCLR COMP_OUTPUT_COMP1_TIM3OCREFCLR +#endif /* STM32F373xC || STM32F378xx */ + +#if defined(STM32L0) || defined(STM32L4) +#define COMP_WINDOWMODE_ENABLE COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON + +#define COMP_NONINVERTINGINPUT_IO1 COMP_INPUT_PLUS_IO1 +#define COMP_NONINVERTINGINPUT_IO2 COMP_INPUT_PLUS_IO2 +#define COMP_NONINVERTINGINPUT_IO3 COMP_INPUT_PLUS_IO3 +#define COMP_NONINVERTINGINPUT_IO4 COMP_INPUT_PLUS_IO4 +#define COMP_NONINVERTINGINPUT_IO5 COMP_INPUT_PLUS_IO5 +#define COMP_NONINVERTINGINPUT_IO6 COMP_INPUT_PLUS_IO6 + +#define COMP_INVERTINGINPUT_1_4VREFINT COMP_INPUT_MINUS_1_4VREFINT +#define COMP_INVERTINGINPUT_1_2VREFINT COMP_INPUT_MINUS_1_2VREFINT +#define COMP_INVERTINGINPUT_3_4VREFINT COMP_INPUT_MINUS_3_4VREFINT +#define COMP_INVERTINGINPUT_VREFINT COMP_INPUT_MINUS_VREFINT +#define COMP_INVERTINGINPUT_DAC1_CH1 COMP_INPUT_MINUS_DAC1_CH1 +#define COMP_INVERTINGINPUT_DAC1_CH2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_DAC1 COMP_INPUT_MINUS_DAC1_CH1 +#define COMP_INVERTINGINPUT_DAC2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_IO1 COMP_INPUT_MINUS_IO1 +#if defined(STM32L0) +/* Issue fixed on STM32L0 COMP driver: only 2 dedicated IO (IO1 and IO2), */ +/* IO2 was wrongly assigned to IO shared with DAC and IO3 was corresponding */ +/* to the second dedicated IO (only for COMP2). */ +#define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO2 +#else +#define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_IO2 +#define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO3 +#endif +#define COMP_INVERTINGINPUT_IO4 COMP_INPUT_MINUS_IO4 +#define COMP_INVERTINGINPUT_IO5 COMP_INPUT_MINUS_IO5 + +#define COMP_OUTPUTLEVEL_LOW COMP_OUTPUT_LEVEL_LOW +#define COMP_OUTPUTLEVEL_HIGH COMP_OUTPUT_LEVEL_HIGH + +/* Note: Literal "COMP_FLAG_LOCK" kept for legacy purpose. */ +/* To check COMP lock state, use macro "__HAL_COMP_IS_LOCKED()". */ +#if defined(COMP_CSR_LOCK) +#define COMP_FLAG_LOCK COMP_CSR_LOCK +#elif defined(COMP_CSR_COMP1LOCK) +#define COMP_FLAG_LOCK COMP_CSR_COMP1LOCK +#elif defined(COMP_CSR_COMPxLOCK) +#define COMP_FLAG_LOCK COMP_CSR_COMPxLOCK +#endif + +#if defined(STM32L4) +#define COMP_BLANKINGSRCE_TIM1OC5 COMP_BLANKINGSRC_TIM1_OC5_COMP1 +#define COMP_BLANKINGSRCE_TIM2OC3 COMP_BLANKINGSRC_TIM2_OC3_COMP1 +#define COMP_BLANKINGSRCE_TIM3OC3 COMP_BLANKINGSRC_TIM3_OC3_COMP1 +#define COMP_BLANKINGSRCE_TIM3OC4 COMP_BLANKINGSRC_TIM3_OC4_COMP2 +#define COMP_BLANKINGSRCE_TIM8OC5 COMP_BLANKINGSRC_TIM8_OC5_COMP2 +#define COMP_BLANKINGSRCE_TIM15OC1 COMP_BLANKINGSRC_TIM15_OC1_COMP2 +#define COMP_BLANKINGSRCE_NONE COMP_BLANKINGSRC_NONE +#endif + +#if defined(STM32L0) +#define COMP_MODE_HIGHSPEED COMP_POWERMODE_MEDIUMSPEED +#define COMP_MODE_LOWSPEED COMP_POWERMODE_ULTRALOWPOWER +#else +#define COMP_MODE_HIGHSPEED COMP_POWERMODE_HIGHSPEED +#define COMP_MODE_MEDIUMSPEED COMP_POWERMODE_MEDIUMSPEED +#define COMP_MODE_LOWPOWER COMP_POWERMODE_LOWPOWER +#define COMP_MODE_ULTRALOWPOWER COMP_POWERMODE_ULTRALOWPOWER +#endif + +#endif +/** + * @} + */ + +/** @defgroup HAL_CORTEX_Aliased_Defines HAL CORTEX Aliased Defines maintained for legacy purpose + * @{ + */ +#define __HAL_CORTEX_SYSTICKCLK_CONFIG HAL_SYSTICK_CLKSourceConfig +/** + * @} + */ + +/** @defgroup HAL_CRC_Aliased_Defines HAL CRC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define CRC_OUTPUTDATA_INVERSION_DISABLED CRC_OUTPUTDATA_INVERSION_DISABLE +#define CRC_OUTPUTDATA_INVERSION_ENABLED CRC_OUTPUTDATA_INVERSION_ENABLE + +/** + * @} + */ + +/** @defgroup HAL_DAC_Aliased_Defines HAL DAC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define DAC1_CHANNEL_1 DAC_CHANNEL_1 +#define DAC1_CHANNEL_2 DAC_CHANNEL_2 +#define DAC2_CHANNEL_1 DAC_CHANNEL_1 +#define DAC_WAVE_NONE 0x00000000U +#define DAC_WAVE_NOISE DAC_CR_WAVE1_0 +#define DAC_WAVE_TRIANGLE DAC_CR_WAVE1_1 +#define DAC_WAVEGENERATION_NONE DAC_WAVE_NONE +#define DAC_WAVEGENERATION_NOISE DAC_WAVE_NOISE +#define DAC_WAVEGENERATION_TRIANGLE DAC_WAVE_TRIANGLE + +#if defined(STM32G4) || defined(STM32H7) +#define DAC_CHIPCONNECT_DISABLE DAC_CHIPCONNECT_EXTERNAL +#define DAC_CHIPCONNECT_ENABLE DAC_CHIPCONNECT_INTERNAL +#endif + +#if defined(STM32L1) || defined(STM32L4) || defined(STM32G0) || defined(STM32L5) || defined(STM32H7) || defined(STM32F4) +#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 + +/** + * @} + */ + +/** @defgroup HAL_DMA_Aliased_Defines HAL DMA Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_REMAPDMA_ADC_DMA_CH2 DMA_REMAP_ADC_DMA_CH2 +#define HAL_REMAPDMA_USART1_TX_DMA_CH4 DMA_REMAP_USART1_TX_DMA_CH4 +#define HAL_REMAPDMA_USART1_RX_DMA_CH5 DMA_REMAP_USART1_RX_DMA_CH5 +#define HAL_REMAPDMA_TIM16_DMA_CH4 DMA_REMAP_TIM16_DMA_CH4 +#define HAL_REMAPDMA_TIM17_DMA_CH2 DMA_REMAP_TIM17_DMA_CH2 +#define HAL_REMAPDMA_USART3_DMA_CH32 DMA_REMAP_USART3_DMA_CH32 +#define HAL_REMAPDMA_TIM16_DMA_CH6 DMA_REMAP_TIM16_DMA_CH6 +#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_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 +#define HAL_REMAPDMA_TIM3_DMA_CH6 DMA_REMAP_TIM3_DMA_CH6 + +#define IS_HAL_REMAPDMA IS_DMA_REMAP +#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 + +#if defined(STM32L4R5xx) || defined(STM32L4R9xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) +#define DMA_REQUEST_DCMI_PSSI DMA_REQUEST_DCMI +#endif + +#endif /* STM32L4 */ + +#if defined(STM32G0) +#define DMA_REQUEST_DAC1_CHANNEL1 DMA_REQUEST_DAC1_CH1 +#define DMA_REQUEST_DAC1_CHANNEL2 DMA_REQUEST_DAC1_CH2 +#endif + +#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 + +#define DAC_TRIGGER_LP1_OUT DAC_TRIGGER_LPTIM1_OUT +#define DAC_TRIGGER_LP2_OUT DAC_TRIGGER_LPTIM2_OUT + +#endif /* STM32H7 */ + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Defines HAL FLASH Aliased Defines maintained for legacy purpose + * @{ + */ + +#define TYPEPROGRAM_BYTE FLASH_TYPEPROGRAM_BYTE +#define TYPEPROGRAM_HALFWORD FLASH_TYPEPROGRAM_HALFWORD +#define TYPEPROGRAM_WORD FLASH_TYPEPROGRAM_WORD +#define TYPEPROGRAM_DOUBLEWORD FLASH_TYPEPROGRAM_DOUBLEWORD +#define TYPEERASE_SECTORS FLASH_TYPEERASE_SECTORS +#define TYPEERASE_PAGES FLASH_TYPEERASE_PAGES +#define TYPEERASE_PAGEERASE FLASH_TYPEERASE_PAGES +#define TYPEERASE_MASSERASE FLASH_TYPEERASE_MASSERASE +#define WRPSTATE_DISABLE OB_WRPSTATE_DISABLE +#define WRPSTATE_ENABLE OB_WRPSTATE_ENABLE +#define HAL_FLASH_TIMEOUT_VALUE FLASH_TIMEOUT_VALUE +#define OBEX_PCROP OPTIONBYTE_PCROP +#define OBEX_BOOTCONFIG OPTIONBYTE_BOOTCONFIG +#define PCROPSTATE_DISABLE OB_PCROP_STATE_DISABLE +#define PCROPSTATE_ENABLE OB_PCROP_STATE_ENABLE +#define TYPEERASEDATA_BYTE FLASH_TYPEERASEDATA_BYTE +#define TYPEERASEDATA_HALFWORD FLASH_TYPEERASEDATA_HALFWORD +#define TYPEERASEDATA_WORD FLASH_TYPEERASEDATA_WORD +#define TYPEPROGRAMDATA_BYTE FLASH_TYPEPROGRAMDATA_BYTE +#define TYPEPROGRAMDATA_HALFWORD FLASH_TYPEPROGRAMDATA_HALFWORD +#define TYPEPROGRAMDATA_WORD FLASH_TYPEPROGRAMDATA_WORD +#define TYPEPROGRAMDATA_FASTBYTE FLASH_TYPEPROGRAMDATA_FASTBYTE +#define TYPEPROGRAMDATA_FASTHALFWORD FLASH_TYPEPROGRAMDATA_FASTHALFWORD +#define TYPEPROGRAMDATA_FASTWORD FLASH_TYPEPROGRAMDATA_FASTWORD +#define PAGESIZE FLASH_PAGE_SIZE +#define TYPEPROGRAM_FASTBYTE FLASH_TYPEPROGRAM_BYTE +#define TYPEPROGRAM_FASTHALFWORD FLASH_TYPEPROGRAM_HALFWORD +#define TYPEPROGRAM_FASTWORD FLASH_TYPEPROGRAM_WORD +#define VOLTAGE_RANGE_1 FLASH_VOLTAGE_RANGE_1 +#define VOLTAGE_RANGE_2 FLASH_VOLTAGE_RANGE_2 +#define VOLTAGE_RANGE_3 FLASH_VOLTAGE_RANGE_3 +#define VOLTAGE_RANGE_4 FLASH_VOLTAGE_RANGE_4 +#define TYPEPROGRAM_FAST FLASH_TYPEPROGRAM_FAST +#define TYPEPROGRAM_FAST_AND_LAST FLASH_TYPEPROGRAM_FAST_AND_LAST +#define WRPAREA_BANK1_AREAA OB_WRPAREA_BANK1_AREAA +#define WRPAREA_BANK1_AREAB OB_WRPAREA_BANK1_AREAB +#define WRPAREA_BANK2_AREAA OB_WRPAREA_BANK2_AREAA +#define WRPAREA_BANK2_AREAB OB_WRPAREA_BANK2_AREAB +#define IWDG_STDBY_FREEZE OB_IWDG_STDBY_FREEZE +#define IWDG_STDBY_ACTIVE OB_IWDG_STDBY_RUN +#define IWDG_STOP_FREEZE OB_IWDG_STOP_FREEZE +#define IWDG_STOP_ACTIVE OB_IWDG_STOP_RUN +#define FLASH_ERROR_NONE HAL_FLASH_ERROR_NONE +#define FLASH_ERROR_RD HAL_FLASH_ERROR_RD +#define FLASH_ERROR_PG HAL_FLASH_ERROR_PROG +#define FLASH_ERROR_PGP HAL_FLASH_ERROR_PGS +#define FLASH_ERROR_WRP HAL_FLASH_ERROR_WRP +#define FLASH_ERROR_OPTV HAL_FLASH_ERROR_OPTV +#define FLASH_ERROR_OPTVUSR HAL_FLASH_ERROR_OPTVUSR +#define FLASH_ERROR_PROG HAL_FLASH_ERROR_PROG +#define FLASH_ERROR_OP HAL_FLASH_ERROR_OPERATION +#define FLASH_ERROR_PGA HAL_FLASH_ERROR_PGA +#define FLASH_ERROR_SIZE HAL_FLASH_ERROR_SIZE +#define FLASH_ERROR_SIZ HAL_FLASH_ERROR_SIZE +#define FLASH_ERROR_PGS HAL_FLASH_ERROR_PGS +#define FLASH_ERROR_MIS HAL_FLASH_ERROR_MIS +#define FLASH_ERROR_FAST HAL_FLASH_ERROR_FAST +#define FLASH_ERROR_FWWERR HAL_FLASH_ERROR_FWWERR +#define FLASH_ERROR_NOTZERO HAL_FLASH_ERROR_NOTZERO +#define FLASH_ERROR_OPERATION HAL_FLASH_ERROR_OPERATION +#define FLASH_ERROR_ERS HAL_FLASH_ERROR_ERS +#define OB_WDG_SW OB_IWDG_SW +#define OB_WDG_HW OB_IWDG_HW +#define OB_SDADC12_VDD_MONITOR_SET OB_SDACD_VDD_MONITOR_SET +#define OB_SDADC12_VDD_MONITOR_RESET OB_SDACD_VDD_MONITOR_RESET +#define OB_RAM_PARITY_CHECK_SET OB_SRAM_PARITY_SET +#define OB_RAM_PARITY_CHECK_RESET OB_SRAM_PARITY_RESET +#define IS_OB_SDADC12_VDD_MONITOR IS_OB_SDACD_VDD_MONITOR +#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 +#define FLASH_FLAG_WDW FLASH_FLAG_WBNE +#define OB_WRP_SECTOR_All OB_WRP_SECTOR_ALL +#endif /* STM32H7 */ + +/** + * @} + */ + +/** @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 */ + +/** + * @} + */ + +/** @defgroup HAL_SYSCFG_Aliased_Defines HAL SYSCFG Aliased Defines maintained for legacy purpose + * @{ + */ + +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA9 I2C_FASTMODEPLUS_PA9 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA10 I2C_FASTMODEPLUS_PA10 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB6 I2C_FASTMODEPLUS_PB6 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB7 I2C_FASTMODEPLUS_PB7 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB8 I2C_FASTMODEPLUS_PB8 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB9 I2C_FASTMODEPLUS_PB9 +#define HAL_SYSCFG_FASTMODEPLUS_I2C1 I2C_FASTMODEPLUS_I2C1 +#define HAL_SYSCFG_FASTMODEPLUS_I2C2 I2C_FASTMODEPLUS_I2C2 +#define HAL_SYSCFG_FASTMODEPLUS_I2C3 I2C_FASTMODEPLUS_I2C3 +#if defined(STM32G4) + +#define HAL_SYSCFG_EnableIOAnalogSwitchBooster HAL_SYSCFG_EnableIOSwitchBooster +#define HAL_SYSCFG_DisableIOAnalogSwitchBooster HAL_SYSCFG_DisableIOSwitchBooster +#define HAL_SYSCFG_EnableIOAnalogSwitchVDD HAL_SYSCFG_EnableIOSwitchVDD +#define HAL_SYSCFG_DisableIOAnalogSwitchVDD HAL_SYSCFG_DisableIOSwitchVDD +#endif /* STM32G4 */ +/** + * @} + */ + + +/** @defgroup LL_FMC_Aliased_Defines LL FMC Aliased Defines maintained for compatibility purpose + * @{ + */ +#if defined(STM32L4) || defined(STM32F7) || defined(STM32H7) || defined(STM32G4) +#define FMC_NAND_PCC_WAIT_FEATURE_DISABLE FMC_NAND_WAIT_FEATURE_DISABLE +#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 +#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 +#define FMC_NAND_MEM_BUS_WIDTH_16 FMC_NAND_PCC_MEM_BUS_WIDTH_16 +#endif +/** + * @} + */ + +/** @defgroup LL_FSMC_Aliased_Defines LL FSMC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define FSMC_NORSRAM_TYPEDEF FSMC_NORSRAM_TypeDef +#define FSMC_NORSRAM_EXTENDED_TYPEDEF FSMC_NORSRAM_EXTENDED_TypeDef +/** + * @} + */ + +/** @defgroup HAL_GPIO_Aliased_Macros HAL GPIO Aliased Macros maintained for legacy purpose + * @{ + */ +#define GET_GPIO_SOURCE GPIO_GET_INDEX +#define GET_GPIO_INDEX GPIO_GET_INDEX + +#if defined(STM32F4) +#define GPIO_AF12_SDMMC GPIO_AF12_SDIO +#define GPIO_AF12_SDMMC1 GPIO_AF12_SDIO +#endif + +#if defined(STM32F7) +#define GPIO_AF12_SDIO GPIO_AF12_SDMMC1 +#define GPIO_AF12_SDMMC GPIO_AF12_SDMMC1 +#endif + +#if defined(STM32L4) +#define GPIO_AF12_SDIO GPIO_AF12_SDMMC1 +#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 + +#if defined (STM32H743xx) || defined (STM32H753xx) || defined (STM32H750xx) || defined (STM32H742xx) || \ + defined (STM32H745xx) || defined (STM32H755xx) || defined (STM32H747xx) || defined (STM32H757xx) +#define GPIO_AF10_OTG2_HS GPIO_AF10_OTG2_FS +#define GPIO_AF10_OTG1_FS GPIO_AF10_OTG1_HS +#define GPIO_AF12_OTG2_FS GPIO_AF12_OTG1_FS +#endif /*STM32H743xx || STM32H753xx || STM32H750xx || STM32H742xx || STM32H745xx || STM32H755xx || STM32H747xx || STM32H757xx */ +#endif /* STM32H7 */ + +#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) || defined(STM32G4) || 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 || STM32G4 || STM32H7*/ + +#if defined(STM32L1) + #define GPIO_SPEED_VERY_LOW GPIO_SPEED_FREQ_LOW + #define GPIO_SPEED_LOW GPIO_SPEED_FREQ_MEDIUM + #define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_HIGH + #define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_VERY_HIGH +#endif /* STM32L1 */ + +#if defined(STM32F0) || defined(STM32F3) || defined(STM32F1) + #define GPIO_SPEED_LOW GPIO_SPEED_FREQ_LOW + #define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_MEDIUM + #define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_HIGH +#endif /* STM32F0 || STM32F3 || STM32F1 */ + +#define GPIO_AF6_DFSDM GPIO_AF6_DFSDM1 +/** + * @} + */ + +/** @defgroup HAL_HRTIM_Aliased_Macros HAL HRTIM Aliased Macros maintained for legacy purpose + * @{ + */ +#define HRTIM_TIMDELAYEDPROTECTION_DISABLED HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DISABLED +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT1_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT1_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT1_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT1_DEEV7 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_DEEV7 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV7 +#define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7 + +#define __HAL_HRTIM_SetCounter __HAL_HRTIM_SETCOUNTER +#define __HAL_HRTIM_GetCounter __HAL_HRTIM_GETCOUNTER +#define __HAL_HRTIM_SetPeriod __HAL_HRTIM_SETPERIOD +#define __HAL_HRTIM_GetPeriod __HAL_HRTIM_GETPERIOD +#define __HAL_HRTIM_SetClockPrescaler __HAL_HRTIM_SETCLOCKPRESCALER +#define __HAL_HRTIM_GetClockPrescaler __HAL_HRTIM_GETCLOCKPRESCALER +#define __HAL_HRTIM_SetCompare __HAL_HRTIM_SETCOMPARE +#define __HAL_HRTIM_GetCompare __HAL_HRTIM_GETCOMPARE + +#if defined(STM32G4) +#define HAL_HRTIM_ExternalEventCounterConfig HAL_HRTIM_ExtEventCounterConfig +#define HAL_HRTIM_ExternalEventCounterEnable HAL_HRTIM_ExtEventCounterEnable +#define HAL_HRTIM_ExternalEventCounterDisable HAL_HRTIM_ExtEventCounterDisable +#define HAL_HRTIM_ExternalEventCounterReset HAL_HRTIM_ExtEventCounterReset +#endif /* STM32G4 */ + +#if defined(STM32H7) +#define HRTIM_OUTPUTSET_TIMAEV1_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMAEV2_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMAEV3_TIMCCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMAEV4_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMAEV5_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMAEV6_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMAEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMAEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMAEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMBEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMBEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMBEV3_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMBEV4_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMBEV5_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMBEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMBEV7_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMBEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMBEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMCEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMCEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMCEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMCEV4_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMCEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMCEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMCEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMCEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMCEV9_TIMFCMP2 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMDEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMDEV2_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMDEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMDEV4_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMDEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMDEV6_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMDEV7_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMDEV8_TIMFCMP1 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMDEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMEEV1_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMEEV2_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMEEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMEEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMEEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMEEV6_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMEEV7_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMEEV8_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMEEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMFEV1_TIMACMP3 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMFEV2_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMFEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMFEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMFEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMFEV6_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMFEV7_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMFEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMFEV9_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_9 + +#define HRTIM_OUTPUTRESET_TIMAEV1_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMAEV2_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMAEV3_TIMCCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMAEV4_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMAEV5_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMAEV6_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMAEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMAEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMAEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMBEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMBEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMBEV3_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMBEV4_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMBEV5_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMBEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMBEV7_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMBEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMBEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMCEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMCEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMCEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMCEV4_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMCEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMCEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMCEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMCEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMCEV9_TIMFCMP2 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMDEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMDEV2_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMDEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMDEV4_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMDEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMDEV6_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMDEV7_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMDEV8_TIMFCMP1 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMDEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMEEV1_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMEEV2_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMEEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMEEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMEEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMEEV6_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMEEV7_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMEEV8_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMEEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMFEV1_TIMACMP3 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMFEV2_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMFEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMFEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMFEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMFEV6_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMFEV7_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMFEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMFEV9_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_9 +#endif /* STM32H7 */ + +#if defined(STM32F3) +/** @brief Constants defining available sources associated to external events. + */ +#define HRTIM_EVENTSRC_1 (0x00000000U) +#define HRTIM_EVENTSRC_2 (HRTIM_EECR1_EE1SRC_0) +#define HRTIM_EVENTSRC_3 (HRTIM_EECR1_EE1SRC_1) +#define HRTIM_EVENTSRC_4 (HRTIM_EECR1_EE1SRC_1 | HRTIM_EECR1_EE1SRC_0) + +/** @brief Constants defining the events that can be selected to configure the + * set/reset crossbar of a timer output + */ +#define HRTIM_OUTPUTSET_TIMEV_1 (HRTIM_SET1R_TIMEVNT1) +#define HRTIM_OUTPUTSET_TIMEV_2 (HRTIM_SET1R_TIMEVNT2) +#define HRTIM_OUTPUTSET_TIMEV_3 (HRTIM_SET1R_TIMEVNT3) +#define HRTIM_OUTPUTSET_TIMEV_4 (HRTIM_SET1R_TIMEVNT4) +#define HRTIM_OUTPUTSET_TIMEV_5 (HRTIM_SET1R_TIMEVNT5) +#define HRTIM_OUTPUTSET_TIMEV_6 (HRTIM_SET1R_TIMEVNT6) +#define HRTIM_OUTPUTSET_TIMEV_7 (HRTIM_SET1R_TIMEVNT7) +#define HRTIM_OUTPUTSET_TIMEV_8 (HRTIM_SET1R_TIMEVNT8) +#define HRTIM_OUTPUTSET_TIMEV_9 (HRTIM_SET1R_TIMEVNT9) + +#define HRTIM_OUTPUTRESET_TIMEV_1 (HRTIM_RST1R_TIMEVNT1) +#define HRTIM_OUTPUTRESET_TIMEV_2 (HRTIM_RST1R_TIMEVNT2) +#define HRTIM_OUTPUTRESET_TIMEV_3 (HRTIM_RST1R_TIMEVNT3) +#define HRTIM_OUTPUTRESET_TIMEV_4 (HRTIM_RST1R_TIMEVNT4) +#define HRTIM_OUTPUTRESET_TIMEV_5 (HRTIM_RST1R_TIMEVNT5) +#define HRTIM_OUTPUTRESET_TIMEV_6 (HRTIM_RST1R_TIMEVNT6) +#define HRTIM_OUTPUTRESET_TIMEV_7 (HRTIM_RST1R_TIMEVNT7) +#define HRTIM_OUTPUTRESET_TIMEV_8 (HRTIM_RST1R_TIMEVNT8) +#define HRTIM_OUTPUTRESET_TIMEV_9 (HRTIM_RST1R_TIMEVNT9) + +/** @brief Constants defining the event filtering applied to external events + * by a timer + */ +#define HRTIM_TIMEVENTFILTER_NONE (0x00000000U) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP1 (HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP2 (HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP3 (HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP4 (HRTIM_EEFR1_EE1FLTR_2) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR1 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR2 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR3 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR4 (HRTIM_EEFR1_EE1FLTR_3) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR5 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR6 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR7 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR8 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2) +#define HRTIM_TIMEVENTFILTER_WINDOWINGCMP2 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_WINDOWINGCMP3 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_WINDOWINGTIM (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) + +/** @brief Constants defining the DLL calibration periods (in micro seconds) + */ +#define HRTIM_CALIBRATIONRATE_7300 0x00000000U +#define HRTIM_CALIBRATIONRATE_910 (HRTIM_DLLCR_CALRTE_0) +#define HRTIM_CALIBRATIONRATE_114 (HRTIM_DLLCR_CALRTE_1) +#define HRTIM_CALIBRATIONRATE_14 (HRTIM_DLLCR_CALRTE_1 | HRTIM_DLLCR_CALRTE_0) + +#endif /* STM32F3 */ +/** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Defines HAL I2C Aliased Defines maintained for legacy purpose + * @{ + */ +#define I2C_DUALADDRESS_DISABLED I2C_DUALADDRESS_DISABLE +#define I2C_DUALADDRESS_ENABLED I2C_DUALADDRESS_ENABLE +#define I2C_GENERALCALL_DISABLED I2C_GENERALCALL_DISABLE +#define I2C_GENERALCALL_ENABLED I2C_GENERALCALL_ENABLE +#define I2C_NOSTRETCH_DISABLED I2C_NOSTRETCH_DISABLE +#define I2C_NOSTRETCH_ENABLED I2C_NOSTRETCH_ENABLE +#define I2C_ANALOGFILTER_ENABLED I2C_ANALOGFILTER_ENABLE +#define I2C_ANALOGFILTER_DISABLED I2C_ANALOGFILTER_DISABLE +#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32G0) || defined(STM32L4) || defined(STM32L1) || defined(STM32F7) +#define HAL_I2C_STATE_MEM_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_MEM_BUSY_RX HAL_I2C_STATE_BUSY_RX +#define HAL_I2C_STATE_MASTER_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_MASTER_BUSY_RX HAL_I2C_STATE_BUSY_RX +#define HAL_I2C_STATE_SLAVE_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_SLAVE_BUSY_RX HAL_I2C_STATE_BUSY_RX +#endif +/** + * @} + */ + +/** @defgroup HAL_IRDA_Aliased_Defines HAL IRDA Aliased Defines maintained for legacy purpose + * @{ + */ +#define IRDA_ONE_BIT_SAMPLE_DISABLED IRDA_ONE_BIT_SAMPLE_DISABLE +#define IRDA_ONE_BIT_SAMPLE_ENABLED IRDA_ONE_BIT_SAMPLE_ENABLE + +/** + * @} + */ + +/** @defgroup HAL_IWDG_Aliased_Defines HAL IWDG Aliased Defines maintained for legacy purpose + * @{ + */ +#define KR_KEY_RELOAD IWDG_KEY_RELOAD +#define KR_KEY_ENABLE IWDG_KEY_ENABLE +#define KR_KEY_EWA IWDG_KEY_WRITE_ACCESS_ENABLE +#define KR_KEY_DWA IWDG_KEY_WRITE_ACCESS_DISABLE +/** + * @} + */ + +/** @defgroup HAL_LPTIM_Aliased_Defines HAL LPTIM Aliased Defines maintained for legacy purpose + * @{ + */ + +#define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSISTION LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION +#define LPTIM_CLOCKSAMPLETIME_2TRANSISTIONS LPTIM_CLOCKSAMPLETIME_2TRANSITIONS +#define LPTIM_CLOCKSAMPLETIME_4TRANSISTIONS LPTIM_CLOCKSAMPLETIME_4TRANSITIONS +#define LPTIM_CLOCKSAMPLETIME_8TRANSISTIONS LPTIM_CLOCKSAMPLETIME_8TRANSITIONS + +#define LPTIM_CLOCKPOLARITY_RISINGEDGE LPTIM_CLOCKPOLARITY_RISING +#define LPTIM_CLOCKPOLARITY_FALLINGEDGE LPTIM_CLOCKPOLARITY_FALLING +#define LPTIM_CLOCKPOLARITY_BOTHEDGES LPTIM_CLOCKPOLARITY_RISING_FALLING + +#define LPTIM_TRIGSAMPLETIME_DIRECTTRANSISTION LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION +#define LPTIM_TRIGSAMPLETIME_2TRANSISTIONS LPTIM_TRIGSAMPLETIME_2TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_4TRANSISTIONS LPTIM_TRIGSAMPLETIME_4TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_8TRANSISTIONS LPTIM_TRIGSAMPLETIME_8TRANSITIONS + +/* The following 3 definition have also been present in a temporary version of lptim.h */ +/* They need to be renamed also to the right name, just in case */ +#define LPTIM_TRIGSAMPLETIME_2TRANSITION LPTIM_TRIGSAMPLETIME_2TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_4TRANSITION LPTIM_TRIGSAMPLETIME_4TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_8TRANSITION LPTIM_TRIGSAMPLETIME_8TRANSITIONS + +/** + * @} + */ + +/** @defgroup HAL_NAND_Aliased_Defines HAL NAND Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_NAND_Read_Page HAL_NAND_Read_Page_8b +#define HAL_NAND_Write_Page HAL_NAND_Write_Page_8b +#define HAL_NAND_Read_SpareArea HAL_NAND_Read_SpareArea_8b +#define HAL_NAND_Write_SpareArea HAL_NAND_Write_SpareArea_8b + +#define NAND_AddressTypedef NAND_AddressTypeDef + +#define __ARRAY_ADDRESS ARRAY_ADDRESS +#define __ADDR_1st_CYCLE ADDR_1ST_CYCLE +#define __ADDR_2nd_CYCLE ADDR_2ND_CYCLE +#define __ADDR_3rd_CYCLE ADDR_3RD_CYCLE +#define __ADDR_4th_CYCLE ADDR_4TH_CYCLE +/** + * @} + */ + +/** @defgroup HAL_NOR_Aliased_Defines HAL NOR Aliased Defines maintained for legacy purpose + * @{ + */ +#define NOR_StatusTypedef HAL_NOR_StatusTypeDef +#define NOR_SUCCESS HAL_NOR_STATUS_SUCCESS +#define NOR_ONGOING HAL_NOR_STATUS_ONGOING +#define NOR_ERROR HAL_NOR_STATUS_ERROR +#define NOR_TIMEOUT HAL_NOR_STATUS_TIMEOUT + +#define __NOR_WRITE NOR_WRITE +#define __NOR_ADDR_SHIFT NOR_ADDR_SHIFT +/** + * @} + */ + +/** @defgroup HAL_OPAMP_Aliased_Defines HAL OPAMP Aliased Defines maintained for legacy purpose + * @{ + */ + +#define OPAMP_NONINVERTINGINPUT_VP0 OPAMP_NONINVERTINGINPUT_IO0 +#define OPAMP_NONINVERTINGINPUT_VP1 OPAMP_NONINVERTINGINPUT_IO1 +#define OPAMP_NONINVERTINGINPUT_VP2 OPAMP_NONINVERTINGINPUT_IO2 +#define OPAMP_NONINVERTINGINPUT_VP3 OPAMP_NONINVERTINGINPUT_IO3 + +#define OPAMP_SEC_NONINVERTINGINPUT_VP0 OPAMP_SEC_NONINVERTINGINPUT_IO0 +#define OPAMP_SEC_NONINVERTINGINPUT_VP1 OPAMP_SEC_NONINVERTINGINPUT_IO1 +#define OPAMP_SEC_NONINVERTINGINPUT_VP2 OPAMP_SEC_NONINVERTINGINPUT_IO2 +#define OPAMP_SEC_NONINVERTINGINPUT_VP3 OPAMP_SEC_NONINVERTINGINPUT_IO3 + +#define OPAMP_INVERTINGINPUT_VM0 OPAMP_INVERTINGINPUT_IO0 +#define OPAMP_INVERTINGINPUT_VM1 OPAMP_INVERTINGINPUT_IO1 + +#define IOPAMP_INVERTINGINPUT_VM0 OPAMP_INVERTINGINPUT_IO0 +#define IOPAMP_INVERTINGINPUT_VM1 OPAMP_INVERTINGINPUT_IO1 + +#define OPAMP_SEC_INVERTINGINPUT_VM0 OPAMP_SEC_INVERTINGINPUT_IO0 +#define OPAMP_SEC_INVERTINGINPUT_VM1 OPAMP_SEC_INVERTINGINPUT_IO1 + +#define OPAMP_INVERTINGINPUT_VINM OPAMP_SEC_INVERTINGINPUT_IO1 + +#define OPAMP_PGACONNECT_NO OPAMP_PGA_CONNECT_INVERTINGINPUT_NO +#define OPAMP_PGACONNECT_VM0 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 +#define OPAMP_PGACONNECT_VM1 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO1 + +#if defined(STM32L1) || defined(STM32L4) || defined(STM32L5) || defined(STM32H7) +#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 + + +/** + * @} + */ + +/** @defgroup HAL_I2S_Aliased_Defines HAL I2S Aliased Defines maintained for legacy purpose + * @{ + */ +#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 +/** + * @} + */ + +/** @defgroup HAL_PCCARD_Aliased_Defines HAL PCCARD Aliased Defines maintained for legacy purpose + * @{ + */ + +/* Compact Flash-ATA registers description */ +#define CF_DATA ATA_DATA +#define CF_SECTOR_COUNT ATA_SECTOR_COUNT +#define CF_SECTOR_NUMBER ATA_SECTOR_NUMBER +#define CF_CYLINDER_LOW ATA_CYLINDER_LOW +#define CF_CYLINDER_HIGH ATA_CYLINDER_HIGH +#define CF_CARD_HEAD ATA_CARD_HEAD +#define CF_STATUS_CMD ATA_STATUS_CMD +#define CF_STATUS_CMD_ALTERNATE ATA_STATUS_CMD_ALTERNATE +#define CF_COMMON_DATA_AREA ATA_COMMON_DATA_AREA + +/* Compact Flash-ATA commands */ +#define CF_READ_SECTOR_CMD ATA_READ_SECTOR_CMD +#define CF_WRITE_SECTOR_CMD ATA_WRITE_SECTOR_CMD +#define CF_ERASE_SECTOR_CMD ATA_ERASE_SECTOR_CMD +#define CF_IDENTIFY_CMD ATA_IDENTIFY_CMD + +#define PCCARD_StatusTypedef HAL_PCCARD_StatusTypeDef +#define PCCARD_SUCCESS HAL_PCCARD_STATUS_SUCCESS +#define PCCARD_ONGOING HAL_PCCARD_STATUS_ONGOING +#define PCCARD_ERROR HAL_PCCARD_STATUS_ERROR +#define PCCARD_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT +/** + * @} + */ + +/** @defgroup HAL_RTC_Aliased_Defines HAL RTC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define FORMAT_BIN RTC_FORMAT_BIN +#define FORMAT_BCD RTC_FORMAT_BCD + +#define RTC_ALARMSUBSECONDMASK_None RTC_ALARMSUBSECONDMASK_NONE +#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 + +#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_TAMPER1_2_INTERRUPT RTC_ALL_TAMPER_INTERRUPT +#define RTC_TAMPER1_2_3_INTERRUPT RTC_ALL_TAMPER_INTERRUPT + +#define RTC_TIMESTAMPPIN_PC13 RTC_TIMESTAMPPIN_DEFAULT +#define RTC_TIMESTAMPPIN_PA0 RTC_TIMESTAMPPIN_POS1 +#define RTC_TIMESTAMPPIN_PI8 RTC_TIMESTAMPPIN_POS1 +#define RTC_TIMESTAMPPIN_PC1 RTC_TIMESTAMPPIN_POS2 + +#define RTC_OUTPUT_REMAP_PC13 RTC_OUTPUT_REMAP_NONE +#define RTC_OUTPUT_REMAP_PB14 RTC_OUTPUT_REMAP_POS1 +#define RTC_OUTPUT_REMAP_PB2 RTC_OUTPUT_REMAP_POS1 + +#define RTC_TAMPERPIN_PC13 RTC_TAMPERPIN_DEFAULT +#define RTC_TAMPERPIN_PA0 RTC_TAMPERPIN_POS1 +#define RTC_TAMPERPIN_PI8 RTC_TAMPERPIN_POS1 + +#if defined(STM32H7) +#define RTC_TAMPCR_TAMPXE RTC_TAMPER_X +#define RTC_TAMPCR_TAMPXIE RTC_TAMPER_X_INTERRUPT + +#define RTC_TAMPER1_INTERRUPT RTC_IT_TAMP1 +#define RTC_TAMPER2_INTERRUPT RTC_IT_TAMP2 +#define RTC_TAMPER3_INTERRUPT RTC_IT_TAMP3 +#define RTC_ALL_TAMPER_INTERRUPT RTC_IT_TAMPALL +#endif /* STM32H7 */ + +/** + * @} + */ + + +/** @defgroup HAL_SMARTCARD_Aliased_Defines HAL SMARTCARD Aliased Defines maintained for legacy purpose + * @{ + */ +#define SMARTCARD_NACK_ENABLED SMARTCARD_NACK_ENABLE +#define SMARTCARD_NACK_DISABLED SMARTCARD_NACK_DISABLE + +#define SMARTCARD_ONEBIT_SAMPLING_DISABLED SMARTCARD_ONE_BIT_SAMPLE_DISABLE +#define SMARTCARD_ONEBIT_SAMPLING_ENABLED SMARTCARD_ONE_BIT_SAMPLE_ENABLE +#define SMARTCARD_ONEBIT_SAMPLING_DISABLE SMARTCARD_ONE_BIT_SAMPLE_DISABLE +#define SMARTCARD_ONEBIT_SAMPLING_ENABLE SMARTCARD_ONE_BIT_SAMPLE_ENABLE + +#define SMARTCARD_TIMEOUT_DISABLED SMARTCARD_TIMEOUT_DISABLE +#define SMARTCARD_TIMEOUT_ENABLED SMARTCARD_TIMEOUT_ENABLE + +#define SMARTCARD_LASTBIT_DISABLED SMARTCARD_LASTBIT_DISABLE +#define SMARTCARD_LASTBIT_ENABLED SMARTCARD_LASTBIT_ENABLE +/** + * @} + */ + + +/** @defgroup HAL_SMBUS_Aliased_Defines HAL SMBUS Aliased Defines maintained for legacy purpose + * @{ + */ +#define SMBUS_DUALADDRESS_DISABLED SMBUS_DUALADDRESS_DISABLE +#define SMBUS_DUALADDRESS_ENABLED SMBUS_DUALADDRESS_ENABLE +#define SMBUS_GENERALCALL_DISABLED SMBUS_GENERALCALL_DISABLE +#define SMBUS_GENERALCALL_ENABLED SMBUS_GENERALCALL_ENABLE +#define SMBUS_NOSTRETCH_DISABLED SMBUS_NOSTRETCH_DISABLE +#define SMBUS_NOSTRETCH_ENABLED SMBUS_NOSTRETCH_ENABLE +#define SMBUS_ANALOGFILTER_ENABLED SMBUS_ANALOGFILTER_ENABLE +#define SMBUS_ANALOGFILTER_DISABLED SMBUS_ANALOGFILTER_DISABLE +#define SMBUS_PEC_DISABLED SMBUS_PEC_DISABLE +#define SMBUS_PEC_ENABLED SMBUS_PEC_ENABLE +#define HAL_SMBUS_STATE_SLAVE_LISTEN HAL_SMBUS_STATE_LISTEN +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Defines HAL SPI Aliased Defines maintained for legacy purpose + * @{ + */ +#define SPI_TIMODE_DISABLED SPI_TIMODE_DISABLE +#define SPI_TIMODE_ENABLED SPI_TIMODE_ENABLE + +#define SPI_CRCCALCULATION_DISABLED SPI_CRCCALCULATION_DISABLE +#define SPI_CRCCALCULATION_ENABLED SPI_CRCCALCULATION_ENABLE + +#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 */ + +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Defines HAL TIM Aliased Defines maintained for legacy purpose + * @{ + */ +#define CCER_CCxE_MASK TIM_CCER_CCxE_MASK +#define CCER_CCxNE_MASK TIM_CCER_CCxNE_MASK + +#define TIM_DMABase_CR1 TIM_DMABASE_CR1 +#define TIM_DMABase_CR2 TIM_DMABASE_CR2 +#define TIM_DMABase_SMCR TIM_DMABASE_SMCR +#define TIM_DMABase_DIER TIM_DMABASE_DIER +#define TIM_DMABase_SR TIM_DMABASE_SR +#define TIM_DMABase_EGR TIM_DMABASE_EGR +#define TIM_DMABase_CCMR1 TIM_DMABASE_CCMR1 +#define TIM_DMABase_CCMR2 TIM_DMABASE_CCMR2 +#define TIM_DMABase_CCER TIM_DMABASE_CCER +#define TIM_DMABase_CNT TIM_DMABASE_CNT +#define TIM_DMABase_PSC TIM_DMABASE_PSC +#define TIM_DMABase_ARR TIM_DMABASE_ARR +#define TIM_DMABase_RCR TIM_DMABASE_RCR +#define TIM_DMABase_CCR1 TIM_DMABASE_CCR1 +#define TIM_DMABase_CCR2 TIM_DMABASE_CCR2 +#define TIM_DMABase_CCR3 TIM_DMABASE_CCR3 +#define TIM_DMABase_CCR4 TIM_DMABASE_CCR4 +#define TIM_DMABase_BDTR TIM_DMABASE_BDTR +#define TIM_DMABase_DCR TIM_DMABASE_DCR +#define TIM_DMABase_DMAR TIM_DMABASE_DMAR +#define TIM_DMABase_OR1 TIM_DMABASE_OR1 +#define TIM_DMABase_CCMR3 TIM_DMABASE_CCMR3 +#define TIM_DMABase_CCR5 TIM_DMABASE_CCR5 +#define TIM_DMABase_CCR6 TIM_DMABASE_CCR6 +#define TIM_DMABase_OR2 TIM_DMABASE_OR2 +#define TIM_DMABase_OR3 TIM_DMABASE_OR3 +#define TIM_DMABase_OR TIM_DMABASE_OR + +#define TIM_EventSource_Update TIM_EVENTSOURCE_UPDATE +#define TIM_EventSource_CC1 TIM_EVENTSOURCE_CC1 +#define TIM_EventSource_CC2 TIM_EVENTSOURCE_CC2 +#define TIM_EventSource_CC3 TIM_EVENTSOURCE_CC3 +#define TIM_EventSource_CC4 TIM_EVENTSOURCE_CC4 +#define TIM_EventSource_COM TIM_EVENTSOURCE_COM +#define TIM_EventSource_Trigger TIM_EVENTSOURCE_TRIGGER +#define TIM_EventSource_Break TIM_EVENTSOURCE_BREAK +#define TIM_EventSource_Break2 TIM_EVENTSOURCE_BREAK2 + +#define TIM_DMABurstLength_1Transfer TIM_DMABURSTLENGTH_1TRANSFER +#define TIM_DMABurstLength_2Transfers TIM_DMABURSTLENGTH_2TRANSFERS +#define TIM_DMABurstLength_3Transfers TIM_DMABURSTLENGTH_3TRANSFERS +#define TIM_DMABurstLength_4Transfers TIM_DMABURSTLENGTH_4TRANSFERS +#define TIM_DMABurstLength_5Transfers TIM_DMABURSTLENGTH_5TRANSFERS +#define TIM_DMABurstLength_6Transfers TIM_DMABURSTLENGTH_6TRANSFERS +#define TIM_DMABurstLength_7Transfers TIM_DMABURSTLENGTH_7TRANSFERS +#define TIM_DMABurstLength_8Transfers TIM_DMABURSTLENGTH_8TRANSFERS +#define TIM_DMABurstLength_9Transfers TIM_DMABURSTLENGTH_9TRANSFERS +#define TIM_DMABurstLength_10Transfers TIM_DMABURSTLENGTH_10TRANSFERS +#define TIM_DMABurstLength_11Transfers TIM_DMABURSTLENGTH_11TRANSFERS +#define TIM_DMABurstLength_12Transfers TIM_DMABURSTLENGTH_12TRANSFERS +#define TIM_DMABurstLength_13Transfers TIM_DMABURSTLENGTH_13TRANSFERS +#define TIM_DMABurstLength_14Transfers TIM_DMABURSTLENGTH_14TRANSFERS +#define TIM_DMABurstLength_15Transfers TIM_DMABURSTLENGTH_15TRANSFERS +#define TIM_DMABurstLength_16Transfers TIM_DMABURSTLENGTH_16TRANSFERS +#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 + +/** + * @} + */ + +/** @defgroup HAL_TSC_Aliased_Defines HAL TSC Aliased Defines maintained for legacy purpose + * @{ + */ +#define TSC_SYNC_POL_FALL TSC_SYNC_POLARITY_FALLING +#define TSC_SYNC_POL_RISE_HIGH TSC_SYNC_POLARITY_RISING +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Defines HAL UART Aliased Defines maintained for legacy purpose + * @{ + */ +#define UART_ONEBIT_SAMPLING_DISABLED UART_ONE_BIT_SAMPLE_DISABLE +#define UART_ONEBIT_SAMPLING_ENABLED UART_ONE_BIT_SAMPLE_ENABLE +#define UART_ONE_BIT_SAMPLE_DISABLED UART_ONE_BIT_SAMPLE_DISABLE +#define UART_ONE_BIT_SAMPLE_ENABLED UART_ONE_BIT_SAMPLE_ENABLE + +#define __HAL_UART_ONEBIT_ENABLE __HAL_UART_ONE_BIT_SAMPLE_ENABLE +#define __HAL_UART_ONEBIT_DISABLE __HAL_UART_ONE_BIT_SAMPLE_DISABLE + +#define __DIV_SAMPLING16 UART_DIV_SAMPLING16 +#define __DIVMANT_SAMPLING16 UART_DIVMANT_SAMPLING16 +#define __DIVFRAQ_SAMPLING16 UART_DIVFRAQ_SAMPLING16 +#define __UART_BRR_SAMPLING16 UART_BRR_SAMPLING16 + +#define __DIV_SAMPLING8 UART_DIV_SAMPLING8 +#define __DIVMANT_SAMPLING8 UART_DIVMANT_SAMPLING8 +#define __DIVFRAQ_SAMPLING8 UART_DIVFRAQ_SAMPLING8 +#define __UART_BRR_SAMPLING8 UART_BRR_SAMPLING8 + +#define __DIV_LPUART UART_DIV_LPUART + +#define UART_WAKEUPMETHODE_IDLELINE UART_WAKEUPMETHOD_IDLELINE +#define UART_WAKEUPMETHODE_ADDRESSMARK UART_WAKEUPMETHOD_ADDRESSMARK + +/** + * @} + */ + + +/** @defgroup HAL_USART_Aliased_Defines HAL USART Aliased Defines maintained for legacy purpose + * @{ + */ + +#define USART_CLOCK_DISABLED USART_CLOCK_DISABLE +#define USART_CLOCK_ENABLED USART_CLOCK_ENABLE + +#define USARTNACK_ENABLED USART_NACK_ENABLE +#define USARTNACK_DISABLED USART_NACK_DISABLE +/** + * @} + */ + +/** @defgroup HAL_WWDG_Aliased_Defines HAL WWDG Aliased Defines maintained for legacy purpose + * @{ + */ +#define CFR_BASE WWDG_CFR_BASE + +/** + * @} + */ + +/** @defgroup HAL_CAN_Aliased_Defines HAL CAN Aliased Defines maintained for legacy purpose + * @{ + */ +#define CAN_FilterFIFO0 CAN_FILTER_FIFO0 +#define CAN_FilterFIFO1 CAN_FILTER_FIFO1 +#define CAN_IT_RQCP0 CAN_IT_TME +#define CAN_IT_RQCP1 CAN_IT_TME +#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)0x00U) +#define CAN_TXSTATUS_OK ((uint8_t)0x01U) +#define CAN_TXSTATUS_PENDING ((uint8_t)0x02U) + +/** + * @} + */ + +/** @defgroup HAL_ETH_Aliased_Defines HAL ETH Aliased Defines maintained for legacy purpose + * @{ + */ + +#define VLAN_TAG ETH_VLAN_TAG +#define MIN_ETH_PAYLOAD ETH_MIN_ETH_PAYLOAD +#define MAX_ETH_PAYLOAD ETH_MAX_ETH_PAYLOAD +#define JUMBO_FRAME_PAYLOAD ETH_JUMBO_FRAME_PAYLOAD +#define MACMIIAR_CR_MASK ETH_MACMIIAR_CR_MASK +#define MACCR_CLEAR_MASK ETH_MACCR_CLEAR_MASK +#define MACFCR_CLEAR_MASK ETH_MACFCR_CLEAR_MASK +#define DMAOMR_CLEAR_MASK ETH_DMAOMR_CLEAR_MASK + +#define ETH_MMCCR 0x00000100U +#define ETH_MMCRIR 0x00000104U +#define ETH_MMCTIR 0x00000108U +#define ETH_MMCRIMR 0x0000010CU +#define ETH_MMCTIMR 0x00000110U +#define ETH_MMCTGFSCCR 0x0000014CU +#define ETH_MMCTGFMSCCR 0x00000150U +#define ETH_MMCTGFCR 0x00000168U +#define ETH_MMCRFCECR 0x00000194U +#define ETH_MMCRFAECR 0x00000198U +#define ETH_MMCRGUFCR 0x000001C4U + +#define ETH_MAC_TXFIFO_FULL 0x02000000U /* Tx FIFO full */ +#define ETH_MAC_TXFIFONOT_EMPTY 0x01000000U /* Tx FIFO not empty */ +#define ETH_MAC_TXFIFO_WRITE_ACTIVE 0x00400000U /* Tx FIFO write active */ +#define ETH_MAC_TXFIFO_IDLE 0x00000000U /* Tx FIFO read status: Idle */ +#define ETH_MAC_TXFIFO_READ 0x00100000U /* Tx FIFO read status: Read (transferring data to the MAC transmitter) */ +#define ETH_MAC_TXFIFO_WAITING 0x00200000U /* Tx FIFO read status: Waiting for TxStatus from MAC transmitter */ +#define ETH_MAC_TXFIFO_WRITING 0x00300000U /* Tx FIFO read status: Writing the received TxStatus or flushing the TxFIFO */ +#define ETH_MAC_TRANSMISSION_PAUSE 0x00080000U /* MAC transmitter in pause */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_IDLE 0x00000000U /* MAC transmit frame controller: Idle */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_WAITING 0x00020000U /* MAC transmit frame controller: Waiting for Status of previous frame or IFG/backoff period to be over */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_GENRATING_PCF 0x00040000U /* MAC transmit frame controller: Generating and transmitting a Pause control frame (in full duplex mode) */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_TRANSFERRING 0x00060000U /* MAC transmit frame controller: Transferring input frame for transmission */ +#define ETH_MAC_MII_TRANSMIT_ACTIVE 0x00010000U /* MAC MII transmit engine active */ +#define ETH_MAC_RXFIFO_EMPTY 0x00000000U /* Rx FIFO fill level: empty */ +#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 */ +#define ETH_MAC_SMALL_FIFO_READ_ACTIVE 0x00000002U /* MAC small FIFO read controller active */ +#define ETH_MAC_SMALL_FIFO_WRITE_ACTIVE 0x00000004U /* MAC small FIFO write controller active */ +#define ETH_MAC_SMALL_FIFO_RW_ACTIVE 0x00000006U /* MAC small FIFO read / write controllers active */ +#define ETH_MAC_MII_RECEIVE_PROTOCOL_ACTIVE 0x00000001U /* MAC MII receive protocol engine active */ + +/** + * @} + */ + +/** @defgroup HAL_DCMI_Aliased_Defines HAL DCMI Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_DCMI_ERROR_OVF HAL_DCMI_ERROR_OVR +#define DCMI_IT_OVF DCMI_IT_OVR +#define DCMI_FLAG_OVFRI DCMI_FLAG_OVRRI +#define DCMI_FLAG_OVFMI DCMI_FLAG_OVRMI + +#define HAL_DCMI_ConfigCROP HAL_DCMI_ConfigCrop +#define HAL_DCMI_EnableCROP HAL_DCMI_EnableCrop +#define HAL_DCMI_DisableCROP HAL_DCMI_DisableCrop + +/** + * @} + */ + +#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 + * @{ + */ +#define DMA2D_ARGB8888 DMA2D_OUTPUT_ARGB8888 +#define DMA2D_RGB888 DMA2D_OUTPUT_RGB888 +#define DMA2D_RGB565 DMA2D_OUTPUT_RGB565 +#define DMA2D_ARGB1555 DMA2D_OUTPUT_ARGB1555 +#define DMA2D_ARGB4444 DMA2D_OUTPUT_ARGB4444 + +#define CM_ARGB8888 DMA2D_INPUT_ARGB8888 +#define CM_RGB888 DMA2D_INPUT_RGB888 +#define CM_RGB565 DMA2D_INPUT_RGB565 +#define CM_ARGB1555 DMA2D_INPUT_ARGB1555 +#define CM_ARGB4444 DMA2D_INPUT_ARGB4444 +#define CM_L8 DMA2D_INPUT_L8 +#define CM_AL44 DMA2D_INPUT_AL44 +#define CM_AL88 DMA2D_INPUT_AL88 +#define CM_L4 DMA2D_INPUT_L4 +#define CM_A8 DMA2D_INPUT_A8 +#define CM_A4 DMA2D_INPUT_A4 +/** + * @} + */ +#endif /* STM32L4 || STM32F7 || STM32F4 || STM32H7 */ + +/** @defgroup HAL_PPP_Aliased_Defines HAL PPP Aliased Defines maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup HAL_CRYP_Aliased_Functions HAL CRYP Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_CRYP_ComputationCpltCallback HAL_CRYPEx_ComputationCpltCallback +/** + * @} + */ + +/** @defgroup HAL_HASH_Aliased_Functions HAL HASH Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_HASH_STATETypeDef HAL_HASH_StateTypeDef +#define HAL_HASHPhaseTypeDef HAL_HASH_PhaseTypeDef +#define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish +#define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish +#define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish +#define HAL_HMAC_SHA256_Finish HAL_HASH_SHA256_Finish + +/*HASH Algorithm Selection*/ + +#define HASH_AlgoSelection_SHA1 HASH_ALGOSELECTION_SHA1 +#define HASH_AlgoSelection_SHA224 HASH_ALGOSELECTION_SHA224 +#define HASH_AlgoSelection_SHA256 HASH_ALGOSELECTION_SHA256 +#define HASH_AlgoSelection_MD5 HASH_ALGOSELECTION_MD5 + +#define HASH_AlgoMode_HASH HASH_ALGOMODE_HASH +#define HASH_AlgoMode_HMAC HASH_ALGOMODE_HMAC + +#define HASH_HMACKeyType_ShortKey HASH_HMAC_KEYTYPE_SHORTKEY +#define HASH_HMACKeyType_LongKey HASH_HMAC_KEYTYPE_LONGKEY + +#if defined(STM32L4) || defined(STM32F4) || defined(STM32F7) || defined(STM32H7) + +#define HAL_HASH_MD5_Accumulate HAL_HASH_MD5_Accmlt +#define HAL_HASH_MD5_Accumulate_End HAL_HASH_MD5_Accmlt_End +#define HAL_HASH_MD5_Accumulate_IT HAL_HASH_MD5_Accmlt_IT +#define HAL_HASH_MD5_Accumulate_End_IT HAL_HASH_MD5_Accmlt_End_IT + +#define HAL_HASH_SHA1_Accumulate HAL_HASH_SHA1_Accmlt +#define HAL_HASH_SHA1_Accumulate_End HAL_HASH_SHA1_Accmlt_End +#define HAL_HASH_SHA1_Accumulate_IT HAL_HASH_SHA1_Accmlt_IT +#define HAL_HASH_SHA1_Accumulate_End_IT HAL_HASH_SHA1_Accmlt_End_IT + +#define HAL_HASHEx_SHA224_Accumulate HAL_HASHEx_SHA224_Accmlt +#define HAL_HASHEx_SHA224_Accumulate_End HAL_HASHEx_SHA224_Accmlt_End +#define HAL_HASHEx_SHA224_Accumulate_IT HAL_HASHEx_SHA224_Accmlt_IT +#define HAL_HASHEx_SHA224_Accumulate_End_IT HAL_HASHEx_SHA224_Accmlt_End_IT + +#define HAL_HASHEx_SHA256_Accumulate HAL_HASHEx_SHA256_Accmlt +#define HAL_HASHEx_SHA256_Accumulate_End HAL_HASHEx_SHA256_Accmlt_End +#define HAL_HASHEx_SHA256_Accumulate_IT HAL_HASHEx_SHA256_Accmlt_IT +#define HAL_HASHEx_SHA256_Accumulate_End_IT HAL_HASHEx_SHA256_Accmlt_End_IT + +#endif /* STM32L4 || STM32F4 || STM32F7 || STM32H7 */ +/** + * @} + */ + +/** @defgroup HAL_Aliased_Functions HAL Generic Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_EnableDBGSleepMode HAL_DBGMCU_EnableDBGSleepMode +#define HAL_DisableDBGSleepMode HAL_DBGMCU_DisableDBGSleepMode +#define HAL_EnableDBGStopMode HAL_DBGMCU_EnableDBGStopMode +#define HAL_DisableDBGStopMode HAL_DBGMCU_DisableDBGStopMode +#define HAL_EnableDBGStandbyMode HAL_DBGMCU_EnableDBGStandbyMode +#define HAL_DisableDBGStandbyMode HAL_DBGMCU_DisableDBGStandbyMode +#define HAL_DBG_LowPowerConfig(Periph, cmd) (((cmd)==ENABLE)? HAL_DBGMCU_DBG_EnableLowPowerConfig(Periph) : HAL_DBGMCU_DBG_DisableLowPowerConfig(Periph)) +#define HAL_VREFINT_OutputSelect HAL_SYSCFG_VREFINT_OutputSelect +#define HAL_Lock_Cmd(cmd) (((cmd)==ENABLE) ? HAL_SYSCFG_Enable_Lock_VREFINT() : HAL_SYSCFG_Disable_Lock_VREFINT()) +#if defined(STM32L0) +#else +#define HAL_VREFINT_Cmd(cmd) (((cmd)==ENABLE)? HAL_SYSCFG_EnableVREFINT() : HAL_SYSCFG_DisableVREFINT()) +#endif +#define HAL_ADC_EnableBuffer_Cmd(cmd) (((cmd)==ENABLE) ? HAL_ADCEx_EnableVREFINT() : HAL_ADCEx_DisableVREFINT()) +#define HAL_ADC_EnableBufferSensor_Cmd(cmd) (((cmd)==ENABLE) ? HAL_ADCEx_EnableVREFINTTempSensor() : HAL_ADCEx_DisableVREFINTTempSensor()) +#if defined(STM32H7A3xx) || defined(STM32H7B3xx) || defined(STM32H7B0xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xxQ) || defined(STM32H7B0xxQ) +#define HAL_EnableSRDomainDBGStopMode HAL_EnableDomain3DBGStopMode +#define HAL_DisableSRDomainDBGStopMode HAL_DisableDomain3DBGStopMode +#define HAL_EnableSRDomainDBGStandbyMode HAL_EnableDomain3DBGStandbyMode +#define HAL_DisableSRDomainDBGStandbyMode HAL_DisableDomain3DBGStandbyMode +#endif /* STM32H7A3xx || STM32H7B3xx || STM32H7B0xx || STM32H7A3xxQ || STM32H7B3xxQ || STM32H7B0xxQ */ + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Functions HAL FLASH Aliased Functions maintained for legacy purpose + * @{ + */ +#define FLASH_HalfPageProgram HAL_FLASHEx_HalfPageProgram +#define FLASH_EnableRunPowerDown HAL_FLASHEx_EnableRunPowerDown +#define FLASH_DisableRunPowerDown HAL_FLASHEx_DisableRunPowerDown +#define HAL_DATA_EEPROMEx_Unlock HAL_FLASHEx_DATAEEPROM_Unlock +#define HAL_DATA_EEPROMEx_Lock HAL_FLASHEx_DATAEEPROM_Lock +#define HAL_DATA_EEPROMEx_Erase HAL_FLASHEx_DATAEEPROM_Erase +#define HAL_DATA_EEPROMEx_Program HAL_FLASHEx_DATAEEPROM_Program + + /** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Functions HAL I2C Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_I2CEx_AnalogFilter_Config HAL_I2CEx_ConfigAnalogFilter +#define HAL_I2CEx_DigitalFilter_Config HAL_I2CEx_ConfigDigitalFilter +#define HAL_FMPI2CEx_AnalogFilter_Config HAL_FMPI2CEx_ConfigAnalogFilter +#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(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32L5) || defined(STM32G4) +#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 +#endif /* STM32H7 || STM32WB || STM32G0 || STM32F0 || STM32F1 || STM32F2 || STM32F3 || STM32F4 || STM32F7 || STM32L0 || STM32L4 || STM32L5 || STM32G4 */ +#if defined(STM32H7) || defined(STM32WB) || defined(STM32G0) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32L5) || defined(STM32G4) +#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 || STM32L5 || STM32G4 */ + +#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 */ + /** + * @} + */ + +/** @defgroup HAL_PWR_Aliased HAL PWR Aliased maintained for legacy purpose + * @{ + */ + +#if defined(STM32G0) +#define HAL_PWR_ConfigPVD HAL_PWREx_ConfigPVD +#define HAL_PWR_EnablePVD HAL_PWREx_EnablePVD +#define HAL_PWR_DisablePVD HAL_PWREx_DisablePVD +#define HAL_PWR_PVD_IRQHandler HAL_PWREx_PVD_IRQHandler +#endif +#define HAL_PWR_PVDConfig HAL_PWR_ConfigPVD +#define HAL_PWR_DisableBkUpReg HAL_PWREx_DisableBkUpReg +#define HAL_PWR_DisableFlashPowerDown HAL_PWREx_DisableFlashPowerDown +#define HAL_PWR_DisableVddio2Monitor HAL_PWREx_DisableVddio2Monitor +#define HAL_PWR_EnableBkUpReg HAL_PWREx_EnableBkUpReg +#define HAL_PWR_EnableFlashPowerDown HAL_PWREx_EnableFlashPowerDown +#define HAL_PWR_EnableVddio2Monitor HAL_PWREx_EnableVddio2Monitor +#define HAL_PWR_PVD_PVM_IRQHandler HAL_PWREx_PVD_PVM_IRQHandler +#define HAL_PWR_PVDLevelConfig HAL_PWR_ConfigPVD +#define HAL_PWR_Vddio2Monitor_IRQHandler HAL_PWREx_Vddio2Monitor_IRQHandler +#define HAL_PWR_Vddio2MonitorCallback HAL_PWREx_Vddio2MonitorCallback +#define HAL_PWREx_ActivateOverDrive HAL_PWREx_EnableOverDrive +#define HAL_PWREx_DeactivateOverDrive HAL_PWREx_DisableOverDrive +#define HAL_PWREx_DisableSDADCAnalog HAL_PWREx_DisableSDADC +#define HAL_PWREx_EnableSDADCAnalog HAL_PWREx_EnableSDADC +#define HAL_PWREx_PVMConfig HAL_PWREx_ConfigPVM + +#define PWR_MODE_NORMAL PWR_PVD_MODE_NORMAL +#define PWR_MODE_IT_RISING PWR_PVD_MODE_IT_RISING +#define PWR_MODE_IT_FALLING PWR_PVD_MODE_IT_FALLING +#define PWR_MODE_IT_RISING_FALLING PWR_PVD_MODE_IT_RISING_FALLING +#define PWR_MODE_EVENT_RISING PWR_PVD_MODE_EVENT_RISING +#define PWR_MODE_EVENT_FALLING PWR_PVD_MODE_EVENT_FALLING +#define PWR_MODE_EVENT_RISING_FALLING PWR_PVD_MODE_EVENT_RISING_FALLING + +#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 +#define PMODE_BitNumber PMODE_BIT_NUMBER +#define EWUP_BitNumber EWUP_BIT_NUMBER +#define FPDS_BitNumber FPDS_BIT_NUMBER +#define ODEN_BitNumber ODEN_BIT_NUMBER +#define ODSWEN_BitNumber ODSWEN_BIT_NUMBER +#define MRLVDS_BitNumber MRLVDS_BIT_NUMBER +#define LPLVDS_BitNumber LPLVDS_BIT_NUMBER +#define BRE_BitNumber BRE_BIT_NUMBER + +#define PWR_MODE_EVT PWR_PVD_MODE_NORMAL + + /** + * @} + */ + +/** @defgroup HAL_SMBUS_Aliased_Functions HAL SMBUS Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_SMBUS_Slave_Listen_IT HAL_SMBUS_EnableListen_IT +#define HAL_SMBUS_SlaveAddrCallback HAL_SMBUS_AddrCallback +#define HAL_SMBUS_SlaveListenCpltCallback HAL_SMBUS_ListenCpltCallback +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Functions HAL SPI Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_SPI_FlushRxFifo HAL_SPIEx_FlushRxFifo +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Functions HAL TIM Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_TIM_DMADelayPulseCplt TIM_DMADelayPulseCplt +#define HAL_TIM_DMAError TIM_DMAError +#define HAL_TIM_DMACaptureCplt TIM_DMACaptureCplt +#define HAL_TIMEx_DMACommutationCplt TIMEx_DMACommutationCplt +#if defined(STM32H7) || defined(STM32G0) || defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) || defined(STM32F4) || defined(STM32F7) || 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 || STM32F0 || STM32F1 || STM32F2 || STM32F3 || STM32F4 || STM32F7 || STM32L0 */ +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Functions HAL UART Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_UART_WakeupCallback HAL_UARTEx_WakeupCallback +/** + * @} + */ + +/** @defgroup HAL_LTDC_Aliased_Functions HAL LTDC Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_LTDC_LineEvenCallback HAL_LTDC_LineEventCallback +#define HAL_LTDC_Relaod HAL_LTDC_Reload +#define HAL_LTDC_StructInitFromVideoConfig HAL_LTDCEx_StructInitFromVideoConfig +#define HAL_LTDC_StructInitFromAdaptedCommandConfig HAL_LTDCEx_StructInitFromAdaptedCommandConfig +/** + * @} + */ + + +/** @defgroup HAL_PPP_Aliased_Functions HAL PPP Aliased Functions maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +/* Exported macros ------------------------------------------------------------*/ + +/** @defgroup HAL_AES_Aliased_Macros HAL CRYP Aliased Macros maintained for legacy purpose + * @{ + */ +#define AES_IT_CC CRYP_IT_CC +#define AES_IT_ERR CRYP_IT_ERR +#define AES_FLAG_CCF CRYP_FLAG_CCF +/** + * @} + */ + +/** @defgroup HAL_Aliased_Macros HAL Generic Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_GET_BOOT_MODE __HAL_SYSCFG_GET_BOOT_MODE +#define __HAL_REMAPMEMORY_FLASH __HAL_SYSCFG_REMAPMEMORY_FLASH +#define __HAL_REMAPMEMORY_SYSTEMFLASH __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH +#define __HAL_REMAPMEMORY_SRAM __HAL_SYSCFG_REMAPMEMORY_SRAM +#define __HAL_REMAPMEMORY_FMC __HAL_SYSCFG_REMAPMEMORY_FMC +#define __HAL_REMAPMEMORY_FMC_SDRAM __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM +#define __HAL_REMAPMEMORY_FSMC __HAL_SYSCFG_REMAPMEMORY_FSMC +#define __HAL_REMAPMEMORY_QUADSPI __HAL_SYSCFG_REMAPMEMORY_QUADSPI +#define __HAL_FMC_BANK __HAL_SYSCFG_FMC_BANK +#define __HAL_GET_FLAG __HAL_SYSCFG_GET_FLAG +#define __HAL_CLEAR_FLAG __HAL_SYSCFG_CLEAR_FLAG +#define __HAL_VREFINT_OUT_ENABLE __HAL_SYSCFG_VREFINT_OUT_ENABLE +#define __HAL_VREFINT_OUT_DISABLE __HAL_SYSCFG_VREFINT_OUT_DISABLE +#define __HAL_SYSCFG_SRAM2_WRP_ENABLE __HAL_SYSCFG_SRAM2_WRP_0_31_ENABLE + +#define SYSCFG_FLAG_VREF_READY SYSCFG_FLAG_VREFINT_READY +#define SYSCFG_FLAG_RC48 RCC_FLAG_HSI48 +#define IS_SYSCFG_FASTMODEPLUS_CONFIG IS_I2C_FASTMODEPLUS +#define UFB_MODE_BitNumber UFB_MODE_BIT_NUMBER +#define CMP_PD_BitNumber CMP_PD_BIT_NUMBER + +/** + * @} + */ + + +/** @defgroup HAL_ADC_Aliased_Macros HAL ADC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __ADC_ENABLE __HAL_ADC_ENABLE +#define __ADC_DISABLE __HAL_ADC_DISABLE +#define __HAL_ADC_ENABLING_CONDITIONS ADC_ENABLING_CONDITIONS +#define __HAL_ADC_DISABLING_CONDITIONS ADC_DISABLING_CONDITIONS +#define __HAL_ADC_IS_ENABLED ADC_IS_ENABLE +#define __ADC_IS_ENABLED ADC_IS_ENABLE +#define __HAL_ADC_IS_SOFTWARE_START_REGULAR ADC_IS_SOFTWARE_START_REGULAR +#define __HAL_ADC_IS_SOFTWARE_START_INJECTED ADC_IS_SOFTWARE_START_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR ADC_IS_CONVERSION_ONGOING_REGULAR +#define __HAL_ADC_IS_CONVERSION_ONGOING_INJECTED ADC_IS_CONVERSION_ONGOING_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING ADC_IS_CONVERSION_ONGOING +#define __HAL_ADC_CLEAR_ERRORCODE ADC_CLEAR_ERRORCODE + +#define __HAL_ADC_GET_RESOLUTION ADC_GET_RESOLUTION +#define __HAL_ADC_JSQR_RK ADC_JSQR_RK +#define __HAL_ADC_CFGR_AWD1CH ADC_CFGR_AWD1CH_SHIFT +#define __HAL_ADC_CFGR_AWD23CR ADC_CFGR_AWD23CR +#define __HAL_ADC_CFGR_INJECT_AUTO_CONVERSION ADC_CFGR_INJECT_AUTO_CONVERSION +#define __HAL_ADC_CFGR_INJECT_CONTEXT_QUEUE ADC_CFGR_INJECT_CONTEXT_QUEUE +#define __HAL_ADC_CFGR_INJECT_DISCCONTINUOUS ADC_CFGR_INJECT_DISCCONTINUOUS +#define __HAL_ADC_CFGR_REG_DISCCONTINUOUS ADC_CFGR_REG_DISCCONTINUOUS +#define __HAL_ADC_CFGR_DISCONTINUOUS_NUM ADC_CFGR_DISCONTINUOUS_NUM +#define __HAL_ADC_CFGR_AUTOWAIT ADC_CFGR_AUTOWAIT +#define __HAL_ADC_CFGR_CONTINUOUS ADC_CFGR_CONTINUOUS +#define __HAL_ADC_CFGR_OVERRUN ADC_CFGR_OVERRUN +#define __HAL_ADC_CFGR_DMACONTREQ ADC_CFGR_DMACONTREQ +#define __HAL_ADC_CFGR_EXTSEL ADC_CFGR_EXTSEL_SET +#define __HAL_ADC_JSQR_JEXTSEL ADC_JSQR_JEXTSEL_SET +#define __HAL_ADC_OFR_CHANNEL ADC_OFR_CHANNEL +#define __HAL_ADC_DIFSEL_CHANNEL ADC_DIFSEL_CHANNEL +#define __HAL_ADC_CALFACT_DIFF_SET ADC_CALFACT_DIFF_SET +#define __HAL_ADC_CALFACT_DIFF_GET ADC_CALFACT_DIFF_GET +#define __HAL_ADC_TRX_HIGHTHRESHOLD ADC_TRX_HIGHTHRESHOLD + +#define __HAL_ADC_OFFSET_SHIFT_RESOLUTION ADC_OFFSET_SHIFT_RESOLUTION +#define __HAL_ADC_AWD1THRESHOLD_SHIFT_RESOLUTION ADC_AWD1THRESHOLD_SHIFT_RESOLUTION +#define __HAL_ADC_AWD23THRESHOLD_SHIFT_RESOLUTION ADC_AWD23THRESHOLD_SHIFT_RESOLUTION +#define __HAL_ADC_COMMON_REGISTER ADC_COMMON_REGISTER +#define __HAL_ADC_COMMON_CCR_MULTI ADC_COMMON_CCR_MULTI +#define __HAL_ADC_MULTIMODE_IS_ENABLED ADC_MULTIMODE_IS_ENABLE +#define __ADC_MULTIMODE_IS_ENABLED ADC_MULTIMODE_IS_ENABLE +#define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER ADC_NONMULTIMODE_OR_MULTIMODEMASTER +#define __HAL_ADC_COMMON_ADC_OTHER ADC_COMMON_ADC_OTHER +#define __HAL_ADC_MULTI_SLAVE ADC_MULTI_SLAVE + +#define __HAL_ADC_SQR1_L ADC_SQR1_L_SHIFT +#define __HAL_ADC_JSQR_JL ADC_JSQR_JL_SHIFT +#define __HAL_ADC_JSQR_RK_JL ADC_JSQR_RK_JL +#define __HAL_ADC_CR1_DISCONTINUOUS_NUM ADC_CR1_DISCONTINUOUS_NUM +#define __HAL_ADC_CR1_SCAN ADC_CR1_SCAN_SET +#define __HAL_ADC_CONVCYCLES_MAX_RANGE ADC_CONVCYCLES_MAX_RANGE +#define __HAL_ADC_CLOCK_PRESCALER_RANGE ADC_CLOCK_PRESCALER_RANGE +#define __HAL_ADC_GET_CLOCK_PRESCALER ADC_GET_CLOCK_PRESCALER + +#define __HAL_ADC_SQR1 ADC_SQR1 +#define __HAL_ADC_SMPR1 ADC_SMPR1 +#define __HAL_ADC_SMPR2 ADC_SMPR2 +#define __HAL_ADC_SQR3_RK ADC_SQR3_RK +#define __HAL_ADC_SQR2_RK ADC_SQR2_RK +#define __HAL_ADC_SQR1_RK ADC_SQR1_RK +#define __HAL_ADC_CR2_CONTINUOUS ADC_CR2_CONTINUOUS +#define __HAL_ADC_CR1_DISCONTINUOUS ADC_CR1_DISCONTINUOUS +#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_JSQR ADC_JSQR + +#define __HAL_ADC_CHSELR_CHANNEL ADC_CHSELR_CHANNEL +#define __HAL_ADC_CFGR1_REG_DISCCONTINUOUS ADC_CFGR1_REG_DISCCONTINUOUS +#define __HAL_ADC_CFGR1_AUTOOFF ADC_CFGR1_AUTOOFF +#define __HAL_ADC_CFGR1_AUTOWAIT ADC_CFGR1_AUTOWAIT +#define __HAL_ADC_CFGR1_CONTINUOUS ADC_CFGR1_CONTINUOUS +#define __HAL_ADC_CFGR1_OVERRUN ADC_CFGR1_OVERRUN +#define __HAL_ADC_CFGR1_SCANDIR ADC_CFGR1_SCANDIR +#define __HAL_ADC_CFGR1_DMACONTREQ ADC_CFGR1_DMACONTREQ + +/** + * @} + */ + +/** @defgroup HAL_DAC_Aliased_Macros HAL DAC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_DHR12R1_ALIGNEMENT DAC_DHR12R1_ALIGNMENT +#define __HAL_DHR12R2_ALIGNEMENT DAC_DHR12R2_ALIGNMENT +#define __HAL_DHR12RD_ALIGNEMENT DAC_DHR12RD_ALIGNMENT +#define IS_DAC_GENERATE_WAVE IS_DAC_WAVE + +/** + * @} + */ + +/** @defgroup HAL_DBGMCU_Aliased_Macros HAL DBGMCU Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_FREEZE_TIM1_DBGMCU __HAL_DBGMCU_FREEZE_TIM1 +#define __HAL_UNFREEZE_TIM1_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM1 +#define __HAL_FREEZE_TIM2_DBGMCU __HAL_DBGMCU_FREEZE_TIM2 +#define __HAL_UNFREEZE_TIM2_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM2 +#define __HAL_FREEZE_TIM3_DBGMCU __HAL_DBGMCU_FREEZE_TIM3 +#define __HAL_UNFREEZE_TIM3_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM3 +#define __HAL_FREEZE_TIM4_DBGMCU __HAL_DBGMCU_FREEZE_TIM4 +#define __HAL_UNFREEZE_TIM4_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM4 +#define __HAL_FREEZE_TIM5_DBGMCU __HAL_DBGMCU_FREEZE_TIM5 +#define __HAL_UNFREEZE_TIM5_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM5 +#define __HAL_FREEZE_TIM6_DBGMCU __HAL_DBGMCU_FREEZE_TIM6 +#define __HAL_UNFREEZE_TIM6_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM6 +#define __HAL_FREEZE_TIM7_DBGMCU __HAL_DBGMCU_FREEZE_TIM7 +#define __HAL_UNFREEZE_TIM7_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM7 +#define __HAL_FREEZE_TIM8_DBGMCU __HAL_DBGMCU_FREEZE_TIM8 +#define __HAL_UNFREEZE_TIM8_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM8 + +#define __HAL_FREEZE_TIM9_DBGMCU __HAL_DBGMCU_FREEZE_TIM9 +#define __HAL_UNFREEZE_TIM9_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM9 +#define __HAL_FREEZE_TIM10_DBGMCU __HAL_DBGMCU_FREEZE_TIM10 +#define __HAL_UNFREEZE_TIM10_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM10 +#define __HAL_FREEZE_TIM11_DBGMCU __HAL_DBGMCU_FREEZE_TIM11 +#define __HAL_UNFREEZE_TIM11_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM11 +#define __HAL_FREEZE_TIM12_DBGMCU __HAL_DBGMCU_FREEZE_TIM12 +#define __HAL_UNFREEZE_TIM12_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM12 +#define __HAL_FREEZE_TIM13_DBGMCU __HAL_DBGMCU_FREEZE_TIM13 +#define __HAL_UNFREEZE_TIM13_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM13 +#define __HAL_FREEZE_TIM14_DBGMCU __HAL_DBGMCU_FREEZE_TIM14 +#define __HAL_UNFREEZE_TIM14_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM14 +#define __HAL_FREEZE_CAN2_DBGMCU __HAL_DBGMCU_FREEZE_CAN2 +#define __HAL_UNFREEZE_CAN2_DBGMCU __HAL_DBGMCU_UNFREEZE_CAN2 + + +#define __HAL_FREEZE_TIM15_DBGMCU __HAL_DBGMCU_FREEZE_TIM15 +#define __HAL_UNFREEZE_TIM15_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM15 +#define __HAL_FREEZE_TIM16_DBGMCU __HAL_DBGMCU_FREEZE_TIM16 +#define __HAL_UNFREEZE_TIM16_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM16 +#define __HAL_FREEZE_TIM17_DBGMCU __HAL_DBGMCU_FREEZE_TIM17 +#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 +#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 +#define __HAL_UNFREEZE_I2C2_TIMEOUT_DBGMCU __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT +#define __HAL_FREEZE_I2C3_TIMEOUT_DBGMCU __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT +#define __HAL_UNFREEZE_I2C3_TIMEOUT_DBGMCU __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT +#define __HAL_FREEZE_CAN1_DBGMCU __HAL_DBGMCU_FREEZE_CAN1 +#define __HAL_UNFREEZE_CAN1_DBGMCU __HAL_DBGMCU_UNFREEZE_CAN1 +#define __HAL_FREEZE_LPTIM1_DBGMCU __HAL_DBGMCU_FREEZE_LPTIM1 +#define __HAL_UNFREEZE_LPTIM1_DBGMCU __HAL_DBGMCU_UNFREEZE_LPTIM1 +#define __HAL_FREEZE_LPTIM2_DBGMCU __HAL_DBGMCU_FREEZE_LPTIM2 +#define __HAL_UNFREEZE_LPTIM2_DBGMCU __HAL_DBGMCU_UNFREEZE_LPTIM2 + +/** + * @} + */ + +/** @defgroup HAL_COMP_Aliased_Macros HAL COMP Aliased Macros maintained for legacy purpose + * @{ + */ +#if defined(STM32F3) +#define COMP_START __HAL_COMP_ENABLE +#define COMP_STOP __HAL_COMP_DISABLE +#define COMP_LOCK __HAL_COMP_LOCK + +#if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP6_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP6_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F302xE) || defined(STM32F302xC) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP6_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP6_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F303xC) || defined(STM32F358xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP7_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP7_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F373xC) ||defined(STM32F378xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP2_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()) +# endif +#else +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP2_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()) +#endif + +#define __HAL_COMP_GET_EXTI_LINE COMP_GET_EXTI_LINE + +#if defined(STM32L0) || defined(STM32L4) +/* Note: On these STM32 families, the only argument of this macro */ +/* is COMP_FLAG_LOCK. */ +/* This macro is replaced by __HAL_COMP_IS_LOCKED with only HAL handle */ +/* argument. */ +#define __HAL_COMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_COMP_IS_LOCKED(__HANDLE__)) +#endif +/** + * @} + */ + +#if defined(STM32L0) || defined(STM32L4) +/** @defgroup HAL_COMP_Aliased_Functions HAL COMP Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_COMP_Start_IT HAL_COMP_Start /* Function considered as legacy as EXTI event or IT configuration is done into HAL_COMP_Init() */ +#define HAL_COMP_Stop_IT HAL_COMP_Stop /* Function considered as legacy as EXTI event or IT configuration is done into HAL_COMP_Init() */ +/** + * @} + */ +#endif + +/** @defgroup HAL_DAC_Aliased_Macros HAL DAC Aliased Macros maintained for legacy purpose + * @{ + */ + +#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_WAVE_NONE) || \ + ((WAVE) == DAC_WAVE_NOISE)|| \ + ((WAVE) == DAC_WAVE_TRIANGLE)) + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Macros HAL FLASH Aliased Macros maintained for legacy purpose + * @{ + */ + +#define IS_WRPAREA IS_OB_WRPAREA +#define IS_TYPEPROGRAM IS_FLASH_TYPEPROGRAM +#define IS_TYPEPROGRAMFLASH IS_FLASH_TYPEPROGRAM +#define IS_TYPEERASE IS_FLASH_TYPEERASE +#define IS_NBSECTORS IS_FLASH_NBSECTORS +#define IS_OB_WDG_SOURCE IS_OB_IWDG_SOURCE + +/** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Macros HAL I2C Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_I2C_RESET_CR2 I2C_RESET_CR2 +#define __HAL_I2C_GENERATE_START I2C_GENERATE_START +#if defined(STM32F1) +#define __HAL_I2C_FREQ_RANGE I2C_FREQRANGE +#else +#define __HAL_I2C_FREQ_RANGE I2C_FREQ_RANGE +#endif /* STM32F1 */ +#define __HAL_I2C_RISE_TIME I2C_RISE_TIME +#define __HAL_I2C_SPEED_STANDARD I2C_SPEED_STANDARD +#define __HAL_I2C_SPEED_FAST I2C_SPEED_FAST +#define __HAL_I2C_SPEED I2C_SPEED +#define __HAL_I2C_7BIT_ADD_WRITE I2C_7BIT_ADD_WRITE +#define __HAL_I2C_7BIT_ADD_READ I2C_7BIT_ADD_READ +#define __HAL_I2C_10BIT_ADDRESS I2C_10BIT_ADDRESS +#define __HAL_I2C_10BIT_HEADER_WRITE I2C_10BIT_HEADER_WRITE +#define __HAL_I2C_10BIT_HEADER_READ I2C_10BIT_HEADER_READ +#define __HAL_I2C_MEM_ADD_MSB I2C_MEM_ADD_MSB +#define __HAL_I2C_MEM_ADD_LSB I2C_MEM_ADD_LSB +#define __HAL_I2C_FREQRANGE I2C_FREQRANGE +/** + * @} + */ + +/** @defgroup HAL_I2S_Aliased_Macros HAL I2S Aliased Macros maintained for legacy purpose + * @{ + */ + +#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 + +/** + * @} + */ + +/** @defgroup HAL_IRDA_Aliased_Macros HAL IRDA Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __IRDA_DISABLE __HAL_IRDA_DISABLE +#define __IRDA_ENABLE __HAL_IRDA_ENABLE + +#define __HAL_IRDA_GETCLOCKSOURCE IRDA_GETCLOCKSOURCE +#define __HAL_IRDA_MASK_COMPUTATION IRDA_MASK_COMPUTATION +#define __IRDA_GETCLOCKSOURCE IRDA_GETCLOCKSOURCE +#define __IRDA_MASK_COMPUTATION IRDA_MASK_COMPUTATION + +#define IS_IRDA_ONEBIT_SAMPLE IS_IRDA_ONE_BIT_SAMPLE + + +/** + * @} + */ + + +/** @defgroup HAL_IWDG_Aliased_Macros HAL IWDG Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_IWDG_ENABLE_WRITE_ACCESS IWDG_ENABLE_WRITE_ACCESS +#define __HAL_IWDG_DISABLE_WRITE_ACCESS IWDG_DISABLE_WRITE_ACCESS +/** + * @} + */ + + +/** @defgroup HAL_LPTIM_Aliased_Macros HAL LPTIM Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_LPTIM_ENABLE_INTERRUPT __HAL_LPTIM_ENABLE_IT +#define __HAL_LPTIM_DISABLE_INTERRUPT __HAL_LPTIM_DISABLE_IT +#define __HAL_LPTIM_GET_ITSTATUS __HAL_LPTIM_GET_IT_SOURCE + +/** + * @} + */ + + +/** @defgroup HAL_OPAMP_Aliased_Macros HAL OPAMP Aliased Macros maintained for legacy purpose + * @{ + */ +#define __OPAMP_CSR_OPAXPD OPAMP_CSR_OPAXPD +#define __OPAMP_CSR_S3SELX OPAMP_CSR_S3SELX +#define __OPAMP_CSR_S4SELX OPAMP_CSR_S4SELX +#define __OPAMP_CSR_S5SELX OPAMP_CSR_S5SELX +#define __OPAMP_CSR_S6SELX OPAMP_CSR_S6SELX +#define __OPAMP_CSR_OPAXCAL_L OPAMP_CSR_OPAXCAL_L +#define __OPAMP_CSR_OPAXCAL_H OPAMP_CSR_OPAXCAL_H +#define __OPAMP_CSR_OPAXLPM OPAMP_CSR_OPAXLPM +#define __OPAMP_CSR_ALL_SWITCHES OPAMP_CSR_ALL_SWITCHES +#define __OPAMP_CSR_ANAWSELX OPAMP_CSR_ANAWSELX +#define __OPAMP_CSR_OPAXCALOUT OPAMP_CSR_OPAXCALOUT +#define __OPAMP_OFFSET_TRIM_BITSPOSITION OPAMP_OFFSET_TRIM_BITSPOSITION +#define __OPAMP_OFFSET_TRIM_SET OPAMP_OFFSET_TRIM_SET + +/** + * @} + */ + + +/** @defgroup HAL_PWR_Aliased_Macros HAL PWR Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_PVD_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT +#define __HAL_PVD_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT +#define __HAL_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PVD_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PVD_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE +#define __HAL_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PVM_EVENT_DISABLE __HAL_PWR_PVM_EVENT_DISABLE +#define __HAL_PVM_EVENT_ENABLE __HAL_PWR_PVM_EVENT_ENABLE +#define __HAL_PVM_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVM_EXTI_FALLINGTRIGGER_DISABLE +#define __HAL_PVM_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVM_EXTI_FALLINGTRIGGER_ENABLE +#define __HAL_PVM_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVM_EXTI_RISINGTRIGGER_DISABLE +#define __HAL_PVM_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVM_EXTI_RISINGTRIGGER_ENABLE +#define __HAL_PWR_INTERNALWAKEUP_DISABLE HAL_PWREx_DisableInternalWakeUpLine +#define __HAL_PWR_INTERNALWAKEUP_ENABLE HAL_PWREx_EnableInternalWakeUpLine +#define __HAL_PWR_PULL_UP_DOWN_CONFIG_DISABLE HAL_PWREx_DisablePullUpPullDownConfig +#define __HAL_PWR_PULL_UP_DOWN_CONFIG_ENABLE HAL_PWREx_EnablePullUpPullDownConfig +#define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() do { __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); } while(0) +#define __HAL_PWR_PVD_EXTI_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT +#define __HAL_PWR_PVD_EXTI_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT +#define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE +#define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PWR_PVM_DISABLE() do { HAL_PWREx_DisablePVM1();HAL_PWREx_DisablePVM2();HAL_PWREx_DisablePVM3();HAL_PWREx_DisablePVM4(); } while(0) +#define __HAL_PWR_PVM_ENABLE() do { HAL_PWREx_EnablePVM1();HAL_PWREx_EnablePVM2();HAL_PWREx_EnablePVM3();HAL_PWREx_EnablePVM4(); } while(0) +#define __HAL_PWR_SRAM2CONTENT_PRESERVE_DISABLE HAL_PWREx_DisableSRAM2ContentRetention +#define __HAL_PWR_SRAM2CONTENT_PRESERVE_ENABLE HAL_PWREx_EnableSRAM2ContentRetention +#define __HAL_PWR_VDDIO2_DISABLE HAL_PWREx_DisableVddIO2 +#define __HAL_PWR_VDDIO2_ENABLE HAL_PWREx_EnableVddIO2 +#define __HAL_PWR_VDDIO2_EXTI_CLEAR_EGDE_TRIGGER __HAL_PWR_VDDIO2_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PWR_VDDIO2_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_VDDIO2_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_VDDUSB_DISABLE HAL_PWREx_DisableVddUSB +#define __HAL_PWR_VDDUSB_ENABLE HAL_PWREx_EnableVddUSB + +#if defined (STM32F4) +#define __HAL_PVD_EXTI_ENABLE_IT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_ENABLE_IT() +#define __HAL_PVD_EXTI_DISABLE_IT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_DISABLE_IT() +#define __HAL_PVD_EXTI_GET_FLAG(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_GET_FLAG() +#define __HAL_PVD_EXTI_CLEAR_FLAG(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_CLEAR_FLAG() +#define __HAL_PVD_EXTI_GENERATE_SWIT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_GENERATE_SWIT() +#else +#define __HAL_PVD_EXTI_CLEAR_FLAG __HAL_PWR_PVD_EXTI_CLEAR_FLAG +#define __HAL_PVD_EXTI_DISABLE_IT __HAL_PWR_PVD_EXTI_DISABLE_IT +#define __HAL_PVD_EXTI_ENABLE_IT __HAL_PWR_PVD_EXTI_ENABLE_IT +#define __HAL_PVD_EXTI_GENERATE_SWIT __HAL_PWR_PVD_EXTI_GENERATE_SWIT +#define __HAL_PVD_EXTI_GET_FLAG __HAL_PWR_PVD_EXTI_GET_FLAG +#endif /* STM32F4 */ +/** + * @} + */ + + +/** @defgroup HAL_RCC_Aliased HAL RCC Aliased maintained for legacy purpose + * @{ + */ + +#define RCC_StopWakeUpClock_MSI RCC_STOP_WAKEUPCLOCK_MSI +#define RCC_StopWakeUpClock_HSI RCC_STOP_WAKEUPCLOCK_HSI + +#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 __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 +#define __ADC3_CLK_ENABLE __HAL_RCC_ADC3_CLK_ENABLE +#define __ADC3_FORCE_RESET __HAL_RCC_ADC3_FORCE_RESET +#define __ADC3_RELEASE_RESET __HAL_RCC_ADC3_RELEASE_RESET +#define __AES_CLK_DISABLE __HAL_RCC_AES_CLK_DISABLE +#define __AES_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE +#define __AES_CLK_SLEEP_DISABLE __HAL_RCC_AES_CLK_SLEEP_DISABLE +#define __AES_CLK_SLEEP_ENABLE __HAL_RCC_AES_CLK_SLEEP_ENABLE +#define __AES_FORCE_RESET __HAL_RCC_AES_FORCE_RESET +#define __AES_RELEASE_RESET __HAL_RCC_AES_RELEASE_RESET +#define __CRYP_CLK_SLEEP_ENABLE __HAL_RCC_CRYP_CLK_SLEEP_ENABLE +#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_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 +#define __AFIO_FORCE_RESET __HAL_RCC_AFIO_FORCE_RESET +#define __AFIO_RELEASE_RESET __HAL_RCC_AFIO_RELEASE_RESET +#define __AHB_FORCE_RESET __HAL_RCC_AHB_FORCE_RESET +#define __AHB_RELEASE_RESET __HAL_RCC_AHB_RELEASE_RESET +#define __AHB1_FORCE_RESET __HAL_RCC_AHB1_FORCE_RESET +#define __AHB1_RELEASE_RESET __HAL_RCC_AHB1_RELEASE_RESET +#define __AHB2_FORCE_RESET __HAL_RCC_AHB2_FORCE_RESET +#define __AHB2_RELEASE_RESET __HAL_RCC_AHB2_RELEASE_RESET +#define __AHB3_FORCE_RESET __HAL_RCC_AHB3_FORCE_RESET +#define __AHB3_RELEASE_RESET __HAL_RCC_AHB3_RELEASE_RESET +#define __APB1_FORCE_RESET __HAL_RCC_APB1_FORCE_RESET +#define __APB1_RELEASE_RESET __HAL_RCC_APB1_RELEASE_RESET +#define __APB2_FORCE_RESET __HAL_RCC_APB2_FORCE_RESET +#define __APB2_RELEASE_RESET __HAL_RCC_APB2_RELEASE_RESET +#define __BKP_CLK_DISABLE __HAL_RCC_BKP_CLK_DISABLE +#define __BKP_CLK_ENABLE __HAL_RCC_BKP_CLK_ENABLE +#define __BKP_FORCE_RESET __HAL_RCC_BKP_FORCE_RESET +#define __BKP_RELEASE_RESET __HAL_RCC_BKP_RELEASE_RESET +#define __CAN1_CLK_DISABLE __HAL_RCC_CAN1_CLK_DISABLE +#define __CAN1_CLK_ENABLE __HAL_RCC_CAN1_CLK_ENABLE +#define __CAN1_CLK_SLEEP_DISABLE __HAL_RCC_CAN1_CLK_SLEEP_DISABLE +#define __CAN1_CLK_SLEEP_ENABLE __HAL_RCC_CAN1_CLK_SLEEP_ENABLE +#define __CAN1_FORCE_RESET __HAL_RCC_CAN1_FORCE_RESET +#define __CAN1_RELEASE_RESET __HAL_RCC_CAN1_RELEASE_RESET +#define __CAN_CLK_DISABLE __HAL_RCC_CAN1_CLK_DISABLE +#define __CAN_CLK_ENABLE __HAL_RCC_CAN1_CLK_ENABLE +#define __CAN_FORCE_RESET __HAL_RCC_CAN1_FORCE_RESET +#define __CAN_RELEASE_RESET __HAL_RCC_CAN1_RELEASE_RESET +#define __CAN2_CLK_DISABLE __HAL_RCC_CAN2_CLK_DISABLE +#define __CAN2_CLK_ENABLE __HAL_RCC_CAN2_CLK_ENABLE +#define __CAN2_FORCE_RESET __HAL_RCC_CAN2_FORCE_RESET +#define __CAN2_RELEASE_RESET __HAL_RCC_CAN2_RELEASE_RESET +#define __CEC_CLK_DISABLE __HAL_RCC_CEC_CLK_DISABLE +#define __CEC_CLK_ENABLE __HAL_RCC_CEC_CLK_ENABLE +#define __COMP_CLK_DISABLE __HAL_RCC_COMP_CLK_DISABLE +#define __COMP_CLK_ENABLE __HAL_RCC_COMP_CLK_ENABLE +#define __COMP_FORCE_RESET __HAL_RCC_COMP_FORCE_RESET +#define __COMP_RELEASE_RESET __HAL_RCC_COMP_RELEASE_RESET +#define __COMP_CLK_SLEEP_ENABLE __HAL_RCC_COMP_CLK_SLEEP_ENABLE +#define __COMP_CLK_SLEEP_DISABLE __HAL_RCC_COMP_CLK_SLEEP_DISABLE +#define __CEC_FORCE_RESET __HAL_RCC_CEC_FORCE_RESET +#define __CEC_RELEASE_RESET __HAL_RCC_CEC_RELEASE_RESET +#define __CRC_CLK_DISABLE __HAL_RCC_CRC_CLK_DISABLE +#define __CRC_CLK_ENABLE __HAL_RCC_CRC_CLK_ENABLE +#define __CRC_CLK_SLEEP_DISABLE __HAL_RCC_CRC_CLK_SLEEP_DISABLE +#define __CRC_CLK_SLEEP_ENABLE __HAL_RCC_CRC_CLK_SLEEP_ENABLE +#define __CRC_FORCE_RESET __HAL_RCC_CRC_FORCE_RESET +#define __CRC_RELEASE_RESET __HAL_RCC_CRC_RELEASE_RESET +#define __DAC_CLK_DISABLE __HAL_RCC_DAC_CLK_DISABLE +#define __DAC_CLK_ENABLE __HAL_RCC_DAC_CLK_ENABLE +#define __DAC_FORCE_RESET __HAL_RCC_DAC_FORCE_RESET +#define __DAC_RELEASE_RESET __HAL_RCC_DAC_RELEASE_RESET +#define __DAC1_CLK_DISABLE __HAL_RCC_DAC1_CLK_DISABLE +#define __DAC1_CLK_ENABLE __HAL_RCC_DAC1_CLK_ENABLE +#define __DAC1_CLK_SLEEP_DISABLE __HAL_RCC_DAC1_CLK_SLEEP_DISABLE +#define __DAC1_CLK_SLEEP_ENABLE __HAL_RCC_DAC1_CLK_SLEEP_ENABLE +#define __DAC1_FORCE_RESET __HAL_RCC_DAC1_FORCE_RESET +#define __DAC1_RELEASE_RESET __HAL_RCC_DAC1_RELEASE_RESET +#define __DBGMCU_CLK_ENABLE __HAL_RCC_DBGMCU_CLK_ENABLE +#define __DBGMCU_CLK_DISABLE __HAL_RCC_DBGMCU_CLK_DISABLE +#define __DBGMCU_FORCE_RESET __HAL_RCC_DBGMCU_FORCE_RESET +#define __DBGMCU_RELEASE_RESET __HAL_RCC_DBGMCU_RELEASE_RESET +#define __DFSDM_CLK_DISABLE __HAL_RCC_DFSDM_CLK_DISABLE +#define __DFSDM_CLK_ENABLE __HAL_RCC_DFSDM_CLK_ENABLE +#define __DFSDM_CLK_SLEEP_DISABLE __HAL_RCC_DFSDM_CLK_SLEEP_DISABLE +#define __DFSDM_CLK_SLEEP_ENABLE __HAL_RCC_DFSDM_CLK_SLEEP_ENABLE +#define __DFSDM_FORCE_RESET __HAL_RCC_DFSDM_FORCE_RESET +#define __DFSDM_RELEASE_RESET __HAL_RCC_DFSDM_RELEASE_RESET +#define __DMA1_CLK_DISABLE __HAL_RCC_DMA1_CLK_DISABLE +#define __DMA1_CLK_ENABLE __HAL_RCC_DMA1_CLK_ENABLE +#define __DMA1_CLK_SLEEP_DISABLE __HAL_RCC_DMA1_CLK_SLEEP_DISABLE +#define __DMA1_CLK_SLEEP_ENABLE __HAL_RCC_DMA1_CLK_SLEEP_ENABLE +#define __DMA1_FORCE_RESET __HAL_RCC_DMA1_FORCE_RESET +#define __DMA1_RELEASE_RESET __HAL_RCC_DMA1_RELEASE_RESET +#define __DMA2_CLK_DISABLE __HAL_RCC_DMA2_CLK_DISABLE +#define __DMA2_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE +#define __DMA2_CLK_SLEEP_DISABLE __HAL_RCC_DMA2_CLK_SLEEP_DISABLE +#define __DMA2_CLK_SLEEP_ENABLE __HAL_RCC_DMA2_CLK_SLEEP_ENABLE +#define __DMA2_FORCE_RESET __HAL_RCC_DMA2_FORCE_RESET +#define __DMA2_RELEASE_RESET __HAL_RCC_DMA2_RELEASE_RESET +#define __ETHMAC_CLK_DISABLE __HAL_RCC_ETHMAC_CLK_DISABLE +#define __ETHMAC_CLK_ENABLE __HAL_RCC_ETHMAC_CLK_ENABLE +#define __ETHMAC_FORCE_RESET __HAL_RCC_ETHMAC_FORCE_RESET +#define __ETHMAC_RELEASE_RESET __HAL_RCC_ETHMAC_RELEASE_RESET +#define __ETHMACRX_CLK_DISABLE __HAL_RCC_ETHMACRX_CLK_DISABLE +#define __ETHMACRX_CLK_ENABLE __HAL_RCC_ETHMACRX_CLK_ENABLE +#define __ETHMACTX_CLK_DISABLE __HAL_RCC_ETHMACTX_CLK_DISABLE +#define __ETHMACTX_CLK_ENABLE __HAL_RCC_ETHMACTX_CLK_ENABLE +#define __FIREWALL_CLK_DISABLE __HAL_RCC_FIREWALL_CLK_DISABLE +#define __FIREWALL_CLK_ENABLE __HAL_RCC_FIREWALL_CLK_ENABLE +#define __FLASH_CLK_DISABLE __HAL_RCC_FLASH_CLK_DISABLE +#define __FLASH_CLK_ENABLE __HAL_RCC_FLASH_CLK_ENABLE +#define __FLASH_CLK_SLEEP_DISABLE __HAL_RCC_FLASH_CLK_SLEEP_DISABLE +#define __FLASH_CLK_SLEEP_ENABLE __HAL_RCC_FLASH_CLK_SLEEP_ENABLE +#define __FLASH_FORCE_RESET __HAL_RCC_FLASH_FORCE_RESET +#define __FLASH_RELEASE_RESET __HAL_RCC_FLASH_RELEASE_RESET +#define __FLITF_CLK_DISABLE __HAL_RCC_FLITF_CLK_DISABLE +#define __FLITF_CLK_ENABLE __HAL_RCC_FLITF_CLK_ENABLE +#define __FLITF_FORCE_RESET __HAL_RCC_FLITF_FORCE_RESET +#define __FLITF_RELEASE_RESET __HAL_RCC_FLITF_RELEASE_RESET +#define __FLITF_CLK_SLEEP_ENABLE __HAL_RCC_FLITF_CLK_SLEEP_ENABLE +#define __FLITF_CLK_SLEEP_DISABLE __HAL_RCC_FLITF_CLK_SLEEP_DISABLE +#define __FMC_CLK_DISABLE __HAL_RCC_FMC_CLK_DISABLE +#define __FMC_CLK_ENABLE __HAL_RCC_FMC_CLK_ENABLE +#define __FMC_CLK_SLEEP_DISABLE __HAL_RCC_FMC_CLK_SLEEP_DISABLE +#define __FMC_CLK_SLEEP_ENABLE __HAL_RCC_FMC_CLK_SLEEP_ENABLE +#define __FMC_FORCE_RESET __HAL_RCC_FMC_FORCE_RESET +#define __FMC_RELEASE_RESET __HAL_RCC_FMC_RELEASE_RESET +#define __FSMC_CLK_DISABLE __HAL_RCC_FSMC_CLK_DISABLE +#define __FSMC_CLK_ENABLE __HAL_RCC_FSMC_CLK_ENABLE +#define __GPIOA_CLK_DISABLE __HAL_RCC_GPIOA_CLK_DISABLE +#define __GPIOA_CLK_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE +#define __GPIOA_CLK_SLEEP_DISABLE __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE +#define __GPIOA_CLK_SLEEP_ENABLE __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE +#define __GPIOA_FORCE_RESET __HAL_RCC_GPIOA_FORCE_RESET +#define __GPIOA_RELEASE_RESET __HAL_RCC_GPIOA_RELEASE_RESET +#define __GPIOB_CLK_DISABLE __HAL_RCC_GPIOB_CLK_DISABLE +#define __GPIOB_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE +#define __GPIOB_CLK_SLEEP_DISABLE __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE +#define __GPIOB_CLK_SLEEP_ENABLE __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE +#define __GPIOB_FORCE_RESET __HAL_RCC_GPIOB_FORCE_RESET +#define __GPIOB_RELEASE_RESET __HAL_RCC_GPIOB_RELEASE_RESET +#define __GPIOC_CLK_DISABLE __HAL_RCC_GPIOC_CLK_DISABLE +#define __GPIOC_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE +#define __GPIOC_CLK_SLEEP_DISABLE __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE +#define __GPIOC_CLK_SLEEP_ENABLE __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE +#define __GPIOC_FORCE_RESET __HAL_RCC_GPIOC_FORCE_RESET +#define __GPIOC_RELEASE_RESET __HAL_RCC_GPIOC_RELEASE_RESET +#define __GPIOD_CLK_DISABLE __HAL_RCC_GPIOD_CLK_DISABLE +#define __GPIOD_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE +#define __GPIOD_CLK_SLEEP_DISABLE __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE +#define __GPIOD_CLK_SLEEP_ENABLE __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE +#define __GPIOD_FORCE_RESET __HAL_RCC_GPIOD_FORCE_RESET +#define __GPIOD_RELEASE_RESET __HAL_RCC_GPIOD_RELEASE_RESET +#define __GPIOE_CLK_DISABLE __HAL_RCC_GPIOE_CLK_DISABLE +#define __GPIOE_CLK_ENABLE __HAL_RCC_GPIOE_CLK_ENABLE +#define __GPIOE_CLK_SLEEP_DISABLE __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE +#define __GPIOE_CLK_SLEEP_ENABLE __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE +#define __GPIOE_FORCE_RESET __HAL_RCC_GPIOE_FORCE_RESET +#define __GPIOE_RELEASE_RESET __HAL_RCC_GPIOE_RELEASE_RESET +#define __GPIOF_CLK_DISABLE __HAL_RCC_GPIOF_CLK_DISABLE +#define __GPIOF_CLK_ENABLE __HAL_RCC_GPIOF_CLK_ENABLE +#define __GPIOF_CLK_SLEEP_DISABLE __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE +#define __GPIOF_CLK_SLEEP_ENABLE __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE +#define __GPIOF_FORCE_RESET __HAL_RCC_GPIOF_FORCE_RESET +#define __GPIOF_RELEASE_RESET __HAL_RCC_GPIOF_RELEASE_RESET +#define __GPIOG_CLK_DISABLE __HAL_RCC_GPIOG_CLK_DISABLE +#define __GPIOG_CLK_ENABLE __HAL_RCC_GPIOG_CLK_ENABLE +#define __GPIOG_CLK_SLEEP_DISABLE __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE +#define __GPIOG_CLK_SLEEP_ENABLE __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE +#define __GPIOG_FORCE_RESET __HAL_RCC_GPIOG_FORCE_RESET +#define __GPIOG_RELEASE_RESET __HAL_RCC_GPIOG_RELEASE_RESET +#define __GPIOH_CLK_DISABLE __HAL_RCC_GPIOH_CLK_DISABLE +#define __GPIOH_CLK_ENABLE __HAL_RCC_GPIOH_CLK_ENABLE +#define __GPIOH_CLK_SLEEP_DISABLE __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE +#define __GPIOH_CLK_SLEEP_ENABLE __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE +#define __GPIOH_FORCE_RESET __HAL_RCC_GPIOH_FORCE_RESET +#define __GPIOH_RELEASE_RESET __HAL_RCC_GPIOH_RELEASE_RESET +#define __I2C1_CLK_DISABLE __HAL_RCC_I2C1_CLK_DISABLE +#define __I2C1_CLK_ENABLE __HAL_RCC_I2C1_CLK_ENABLE +#define __I2C1_CLK_SLEEP_DISABLE __HAL_RCC_I2C1_CLK_SLEEP_DISABLE +#define __I2C1_CLK_SLEEP_ENABLE __HAL_RCC_I2C1_CLK_SLEEP_ENABLE +#define __I2C1_FORCE_RESET __HAL_RCC_I2C1_FORCE_RESET +#define __I2C1_RELEASE_RESET __HAL_RCC_I2C1_RELEASE_RESET +#define __I2C2_CLK_DISABLE __HAL_RCC_I2C2_CLK_DISABLE +#define __I2C2_CLK_ENABLE __HAL_RCC_I2C2_CLK_ENABLE +#define __I2C2_CLK_SLEEP_DISABLE __HAL_RCC_I2C2_CLK_SLEEP_DISABLE +#define __I2C2_CLK_SLEEP_ENABLE __HAL_RCC_I2C2_CLK_SLEEP_ENABLE +#define __I2C2_FORCE_RESET __HAL_RCC_I2C2_FORCE_RESET +#define __I2C2_RELEASE_RESET __HAL_RCC_I2C2_RELEASE_RESET +#define __I2C3_CLK_DISABLE __HAL_RCC_I2C3_CLK_DISABLE +#define __I2C3_CLK_ENABLE __HAL_RCC_I2C3_CLK_ENABLE +#define __I2C3_CLK_SLEEP_DISABLE __HAL_RCC_I2C3_CLK_SLEEP_DISABLE +#define __I2C3_CLK_SLEEP_ENABLE __HAL_RCC_I2C3_CLK_SLEEP_ENABLE +#define __I2C3_FORCE_RESET __HAL_RCC_I2C3_FORCE_RESET +#define __I2C3_RELEASE_RESET __HAL_RCC_I2C3_RELEASE_RESET +#define __LCD_CLK_DISABLE __HAL_RCC_LCD_CLK_DISABLE +#define __LCD_CLK_ENABLE __HAL_RCC_LCD_CLK_ENABLE +#define __LCD_CLK_SLEEP_DISABLE __HAL_RCC_LCD_CLK_SLEEP_DISABLE +#define __LCD_CLK_SLEEP_ENABLE __HAL_RCC_LCD_CLK_SLEEP_ENABLE +#define __LCD_FORCE_RESET __HAL_RCC_LCD_FORCE_RESET +#define __LCD_RELEASE_RESET __HAL_RCC_LCD_RELEASE_RESET +#define __LPTIM1_CLK_DISABLE __HAL_RCC_LPTIM1_CLK_DISABLE +#define __LPTIM1_CLK_ENABLE __HAL_RCC_LPTIM1_CLK_ENABLE +#define __LPTIM1_CLK_SLEEP_DISABLE __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE +#define __LPTIM1_CLK_SLEEP_ENABLE __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE +#define __LPTIM1_FORCE_RESET __HAL_RCC_LPTIM1_FORCE_RESET +#define __LPTIM1_RELEASE_RESET __HAL_RCC_LPTIM1_RELEASE_RESET +#define __LPTIM2_CLK_DISABLE __HAL_RCC_LPTIM2_CLK_DISABLE +#define __LPTIM2_CLK_ENABLE __HAL_RCC_LPTIM2_CLK_ENABLE +#define __LPTIM2_CLK_SLEEP_DISABLE __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE +#define __LPTIM2_CLK_SLEEP_ENABLE __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE +#define __LPTIM2_FORCE_RESET __HAL_RCC_LPTIM2_FORCE_RESET +#define __LPTIM2_RELEASE_RESET __HAL_RCC_LPTIM2_RELEASE_RESET +#define __LPUART1_CLK_DISABLE __HAL_RCC_LPUART1_CLK_DISABLE +#define __LPUART1_CLK_ENABLE __HAL_RCC_LPUART1_CLK_ENABLE +#define __LPUART1_CLK_SLEEP_DISABLE __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE +#define __LPUART1_CLK_SLEEP_ENABLE __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE +#define __LPUART1_FORCE_RESET __HAL_RCC_LPUART1_FORCE_RESET +#define __LPUART1_RELEASE_RESET __HAL_RCC_LPUART1_RELEASE_RESET +#define __OPAMP_CLK_DISABLE __HAL_RCC_OPAMP_CLK_DISABLE +#define __OPAMP_CLK_ENABLE __HAL_RCC_OPAMP_CLK_ENABLE +#define __OPAMP_CLK_SLEEP_DISABLE __HAL_RCC_OPAMP_CLK_SLEEP_DISABLE +#define __OPAMP_CLK_SLEEP_ENABLE __HAL_RCC_OPAMP_CLK_SLEEP_ENABLE +#define __OPAMP_FORCE_RESET __HAL_RCC_OPAMP_FORCE_RESET +#define __OPAMP_RELEASE_RESET __HAL_RCC_OPAMP_RELEASE_RESET +#define __OTGFS_CLK_DISABLE __HAL_RCC_OTGFS_CLK_DISABLE +#define __OTGFS_CLK_ENABLE __HAL_RCC_OTGFS_CLK_ENABLE +#define __OTGFS_CLK_SLEEP_DISABLE __HAL_RCC_OTGFS_CLK_SLEEP_DISABLE +#define __OTGFS_CLK_SLEEP_ENABLE __HAL_RCC_OTGFS_CLK_SLEEP_ENABLE +#define __OTGFS_FORCE_RESET __HAL_RCC_OTGFS_FORCE_RESET +#define __OTGFS_RELEASE_RESET __HAL_RCC_OTGFS_RELEASE_RESET +#define __PWR_CLK_DISABLE __HAL_RCC_PWR_CLK_DISABLE +#define __PWR_CLK_ENABLE __HAL_RCC_PWR_CLK_ENABLE +#define __PWR_CLK_SLEEP_DISABLE __HAL_RCC_PWR_CLK_SLEEP_DISABLE +#define __PWR_CLK_SLEEP_ENABLE __HAL_RCC_PWR_CLK_SLEEP_ENABLE +#define __PWR_FORCE_RESET __HAL_RCC_PWR_FORCE_RESET +#define __PWR_RELEASE_RESET __HAL_RCC_PWR_RELEASE_RESET +#define __QSPI_CLK_DISABLE __HAL_RCC_QSPI_CLK_DISABLE +#define __QSPI_CLK_ENABLE __HAL_RCC_QSPI_CLK_ENABLE +#define __QSPI_CLK_SLEEP_DISABLE __HAL_RCC_QSPI_CLK_SLEEP_DISABLE +#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 +#define __RNG_CLK_SLEEP_ENABLE __HAL_RCC_RNG_CLK_SLEEP_ENABLE +#define __RNG_FORCE_RESET __HAL_RCC_RNG_FORCE_RESET +#define __RNG_RELEASE_RESET __HAL_RCC_RNG_RELEASE_RESET +#define __SAI1_CLK_DISABLE __HAL_RCC_SAI1_CLK_DISABLE +#define __SAI1_CLK_ENABLE __HAL_RCC_SAI1_CLK_ENABLE +#define __SAI1_CLK_SLEEP_DISABLE __HAL_RCC_SAI1_CLK_SLEEP_DISABLE +#define __SAI1_CLK_SLEEP_ENABLE __HAL_RCC_SAI1_CLK_SLEEP_ENABLE +#define __SAI1_FORCE_RESET __HAL_RCC_SAI1_FORCE_RESET +#define __SAI1_RELEASE_RESET __HAL_RCC_SAI1_RELEASE_RESET +#define __SAI2_CLK_DISABLE __HAL_RCC_SAI2_CLK_DISABLE +#define __SAI2_CLK_ENABLE __HAL_RCC_SAI2_CLK_ENABLE +#define __SAI2_CLK_SLEEP_DISABLE __HAL_RCC_SAI2_CLK_SLEEP_DISABLE +#define __SAI2_CLK_SLEEP_ENABLE __HAL_RCC_SAI2_CLK_SLEEP_ENABLE +#define __SAI2_FORCE_RESET __HAL_RCC_SAI2_FORCE_RESET +#define __SAI2_RELEASE_RESET __HAL_RCC_SAI2_RELEASE_RESET +#define __SDIO_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE +#define __SDIO_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE +#define __SDMMC_CLK_DISABLE __HAL_RCC_SDMMC_CLK_DISABLE +#define __SDMMC_CLK_ENABLE __HAL_RCC_SDMMC_CLK_ENABLE +#define __SDMMC_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC_CLK_SLEEP_DISABLE +#define __SDMMC_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC_CLK_SLEEP_ENABLE +#define __SDMMC_FORCE_RESET __HAL_RCC_SDMMC_FORCE_RESET +#define __SDMMC_RELEASE_RESET __HAL_RCC_SDMMC_RELEASE_RESET +#define __SPI1_CLK_DISABLE __HAL_RCC_SPI1_CLK_DISABLE +#define __SPI1_CLK_ENABLE __HAL_RCC_SPI1_CLK_ENABLE +#define __SPI1_CLK_SLEEP_DISABLE __HAL_RCC_SPI1_CLK_SLEEP_DISABLE +#define __SPI1_CLK_SLEEP_ENABLE __HAL_RCC_SPI1_CLK_SLEEP_ENABLE +#define __SPI1_FORCE_RESET __HAL_RCC_SPI1_FORCE_RESET +#define __SPI1_RELEASE_RESET __HAL_RCC_SPI1_RELEASE_RESET +#define __SPI2_CLK_DISABLE __HAL_RCC_SPI2_CLK_DISABLE +#define __SPI2_CLK_ENABLE __HAL_RCC_SPI2_CLK_ENABLE +#define __SPI2_CLK_SLEEP_DISABLE __HAL_RCC_SPI2_CLK_SLEEP_DISABLE +#define __SPI2_CLK_SLEEP_ENABLE __HAL_RCC_SPI2_CLK_SLEEP_ENABLE +#define __SPI2_FORCE_RESET __HAL_RCC_SPI2_FORCE_RESET +#define __SPI2_RELEASE_RESET __HAL_RCC_SPI2_RELEASE_RESET +#define __SPI3_CLK_DISABLE __HAL_RCC_SPI3_CLK_DISABLE +#define __SPI3_CLK_ENABLE __HAL_RCC_SPI3_CLK_ENABLE +#define __SPI3_CLK_SLEEP_DISABLE __HAL_RCC_SPI3_CLK_SLEEP_DISABLE +#define __SPI3_CLK_SLEEP_ENABLE __HAL_RCC_SPI3_CLK_SLEEP_ENABLE +#define __SPI3_FORCE_RESET __HAL_RCC_SPI3_FORCE_RESET +#define __SPI3_RELEASE_RESET __HAL_RCC_SPI3_RELEASE_RESET +#define __SRAM_CLK_DISABLE __HAL_RCC_SRAM_CLK_DISABLE +#define __SRAM_CLK_ENABLE __HAL_RCC_SRAM_CLK_ENABLE +#define __SRAM1_CLK_SLEEP_DISABLE __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE +#define __SRAM1_CLK_SLEEP_ENABLE __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE +#define __SRAM2_CLK_SLEEP_DISABLE __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE +#define __SRAM2_CLK_SLEEP_ENABLE __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE +#define __SWPMI1_CLK_DISABLE __HAL_RCC_SWPMI1_CLK_DISABLE +#define __SWPMI1_CLK_ENABLE __HAL_RCC_SWPMI1_CLK_ENABLE +#define __SWPMI1_CLK_SLEEP_DISABLE __HAL_RCC_SWPMI1_CLK_SLEEP_DISABLE +#define __SWPMI1_CLK_SLEEP_ENABLE __HAL_RCC_SWPMI1_CLK_SLEEP_ENABLE +#define __SWPMI1_FORCE_RESET __HAL_RCC_SWPMI1_FORCE_RESET +#define __SWPMI1_RELEASE_RESET __HAL_RCC_SWPMI1_RELEASE_RESET +#define __SYSCFG_CLK_DISABLE __HAL_RCC_SYSCFG_CLK_DISABLE +#define __SYSCFG_CLK_ENABLE __HAL_RCC_SYSCFG_CLK_ENABLE +#define __SYSCFG_CLK_SLEEP_DISABLE __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE +#define __SYSCFG_CLK_SLEEP_ENABLE __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE +#define __SYSCFG_FORCE_RESET __HAL_RCC_SYSCFG_FORCE_RESET +#define __SYSCFG_RELEASE_RESET __HAL_RCC_SYSCFG_RELEASE_RESET +#define __TIM1_CLK_DISABLE __HAL_RCC_TIM1_CLK_DISABLE +#define __TIM1_CLK_ENABLE __HAL_RCC_TIM1_CLK_ENABLE +#define __TIM1_CLK_SLEEP_DISABLE __HAL_RCC_TIM1_CLK_SLEEP_DISABLE +#define __TIM1_CLK_SLEEP_ENABLE __HAL_RCC_TIM1_CLK_SLEEP_ENABLE +#define __TIM1_FORCE_RESET __HAL_RCC_TIM1_FORCE_RESET +#define __TIM1_RELEASE_RESET __HAL_RCC_TIM1_RELEASE_RESET +#define __TIM10_CLK_DISABLE __HAL_RCC_TIM10_CLK_DISABLE +#define __TIM10_CLK_ENABLE __HAL_RCC_TIM10_CLK_ENABLE +#define __TIM10_FORCE_RESET __HAL_RCC_TIM10_FORCE_RESET +#define __TIM10_RELEASE_RESET __HAL_RCC_TIM10_RELEASE_RESET +#define __TIM11_CLK_DISABLE __HAL_RCC_TIM11_CLK_DISABLE +#define __TIM11_CLK_ENABLE __HAL_RCC_TIM11_CLK_ENABLE +#define __TIM11_FORCE_RESET __HAL_RCC_TIM11_FORCE_RESET +#define __TIM11_RELEASE_RESET __HAL_RCC_TIM11_RELEASE_RESET +#define __TIM12_CLK_DISABLE __HAL_RCC_TIM12_CLK_DISABLE +#define __TIM12_CLK_ENABLE __HAL_RCC_TIM12_CLK_ENABLE +#define __TIM12_FORCE_RESET __HAL_RCC_TIM12_FORCE_RESET +#define __TIM12_RELEASE_RESET __HAL_RCC_TIM12_RELEASE_RESET +#define __TIM13_CLK_DISABLE __HAL_RCC_TIM13_CLK_DISABLE +#define __TIM13_CLK_ENABLE __HAL_RCC_TIM13_CLK_ENABLE +#define __TIM13_FORCE_RESET __HAL_RCC_TIM13_FORCE_RESET +#define __TIM13_RELEASE_RESET __HAL_RCC_TIM13_RELEASE_RESET +#define __TIM14_CLK_DISABLE __HAL_RCC_TIM14_CLK_DISABLE +#define __TIM14_CLK_ENABLE __HAL_RCC_TIM14_CLK_ENABLE +#define __TIM14_FORCE_RESET __HAL_RCC_TIM14_FORCE_RESET +#define __TIM14_RELEASE_RESET __HAL_RCC_TIM14_RELEASE_RESET +#define __TIM15_CLK_DISABLE __HAL_RCC_TIM15_CLK_DISABLE +#define __TIM15_CLK_ENABLE __HAL_RCC_TIM15_CLK_ENABLE +#define __TIM15_CLK_SLEEP_DISABLE __HAL_RCC_TIM15_CLK_SLEEP_DISABLE +#define __TIM15_CLK_SLEEP_ENABLE __HAL_RCC_TIM15_CLK_SLEEP_ENABLE +#define __TIM15_FORCE_RESET __HAL_RCC_TIM15_FORCE_RESET +#define __TIM15_RELEASE_RESET __HAL_RCC_TIM15_RELEASE_RESET +#define __TIM16_CLK_DISABLE __HAL_RCC_TIM16_CLK_DISABLE +#define __TIM16_CLK_ENABLE __HAL_RCC_TIM16_CLK_ENABLE +#define __TIM16_CLK_SLEEP_DISABLE __HAL_RCC_TIM16_CLK_SLEEP_DISABLE +#define __TIM16_CLK_SLEEP_ENABLE __HAL_RCC_TIM16_CLK_SLEEP_ENABLE +#define __TIM16_FORCE_RESET __HAL_RCC_TIM16_FORCE_RESET +#define __TIM16_RELEASE_RESET __HAL_RCC_TIM16_RELEASE_RESET +#define __TIM17_CLK_DISABLE __HAL_RCC_TIM17_CLK_DISABLE +#define __TIM17_CLK_ENABLE __HAL_RCC_TIM17_CLK_ENABLE +#define __TIM17_CLK_SLEEP_DISABLE __HAL_RCC_TIM17_CLK_SLEEP_DISABLE +#define __TIM17_CLK_SLEEP_ENABLE __HAL_RCC_TIM17_CLK_SLEEP_ENABLE +#define __TIM17_FORCE_RESET __HAL_RCC_TIM17_FORCE_RESET +#define __TIM17_RELEASE_RESET __HAL_RCC_TIM17_RELEASE_RESET +#define __TIM2_CLK_DISABLE __HAL_RCC_TIM2_CLK_DISABLE +#define __TIM2_CLK_ENABLE __HAL_RCC_TIM2_CLK_ENABLE +#define __TIM2_CLK_SLEEP_DISABLE __HAL_RCC_TIM2_CLK_SLEEP_DISABLE +#define __TIM2_CLK_SLEEP_ENABLE __HAL_RCC_TIM2_CLK_SLEEP_ENABLE +#define __TIM2_FORCE_RESET __HAL_RCC_TIM2_FORCE_RESET +#define __TIM2_RELEASE_RESET __HAL_RCC_TIM2_RELEASE_RESET +#define __TIM3_CLK_DISABLE __HAL_RCC_TIM3_CLK_DISABLE +#define __TIM3_CLK_ENABLE __HAL_RCC_TIM3_CLK_ENABLE +#define __TIM3_CLK_SLEEP_DISABLE __HAL_RCC_TIM3_CLK_SLEEP_DISABLE +#define __TIM3_CLK_SLEEP_ENABLE __HAL_RCC_TIM3_CLK_SLEEP_ENABLE +#define __TIM3_FORCE_RESET __HAL_RCC_TIM3_FORCE_RESET +#define __TIM3_RELEASE_RESET __HAL_RCC_TIM3_RELEASE_RESET +#define __TIM4_CLK_DISABLE __HAL_RCC_TIM4_CLK_DISABLE +#define __TIM4_CLK_ENABLE __HAL_RCC_TIM4_CLK_ENABLE +#define __TIM4_CLK_SLEEP_DISABLE __HAL_RCC_TIM4_CLK_SLEEP_DISABLE +#define __TIM4_CLK_SLEEP_ENABLE __HAL_RCC_TIM4_CLK_SLEEP_ENABLE +#define __TIM4_FORCE_RESET __HAL_RCC_TIM4_FORCE_RESET +#define __TIM4_RELEASE_RESET __HAL_RCC_TIM4_RELEASE_RESET +#define __TIM5_CLK_DISABLE __HAL_RCC_TIM5_CLK_DISABLE +#define __TIM5_CLK_ENABLE __HAL_RCC_TIM5_CLK_ENABLE +#define __TIM5_CLK_SLEEP_DISABLE __HAL_RCC_TIM5_CLK_SLEEP_DISABLE +#define __TIM5_CLK_SLEEP_ENABLE __HAL_RCC_TIM5_CLK_SLEEP_ENABLE +#define __TIM5_FORCE_RESET __HAL_RCC_TIM5_FORCE_RESET +#define __TIM5_RELEASE_RESET __HAL_RCC_TIM5_RELEASE_RESET +#define __TIM6_CLK_DISABLE __HAL_RCC_TIM6_CLK_DISABLE +#define __TIM6_CLK_ENABLE __HAL_RCC_TIM6_CLK_ENABLE +#define __TIM6_CLK_SLEEP_DISABLE __HAL_RCC_TIM6_CLK_SLEEP_DISABLE +#define __TIM6_CLK_SLEEP_ENABLE __HAL_RCC_TIM6_CLK_SLEEP_ENABLE +#define __TIM6_FORCE_RESET __HAL_RCC_TIM6_FORCE_RESET +#define __TIM6_RELEASE_RESET __HAL_RCC_TIM6_RELEASE_RESET +#define __TIM7_CLK_DISABLE __HAL_RCC_TIM7_CLK_DISABLE +#define __TIM7_CLK_ENABLE __HAL_RCC_TIM7_CLK_ENABLE +#define __TIM7_CLK_SLEEP_DISABLE __HAL_RCC_TIM7_CLK_SLEEP_DISABLE +#define __TIM7_CLK_SLEEP_ENABLE __HAL_RCC_TIM7_CLK_SLEEP_ENABLE +#define __TIM7_FORCE_RESET __HAL_RCC_TIM7_FORCE_RESET +#define __TIM7_RELEASE_RESET __HAL_RCC_TIM7_RELEASE_RESET +#define __TIM8_CLK_DISABLE __HAL_RCC_TIM8_CLK_DISABLE +#define __TIM8_CLK_ENABLE __HAL_RCC_TIM8_CLK_ENABLE +#define __TIM8_CLK_SLEEP_DISABLE __HAL_RCC_TIM8_CLK_SLEEP_DISABLE +#define __TIM8_CLK_SLEEP_ENABLE __HAL_RCC_TIM8_CLK_SLEEP_ENABLE +#define __TIM8_FORCE_RESET __HAL_RCC_TIM8_FORCE_RESET +#define __TIM8_RELEASE_RESET __HAL_RCC_TIM8_RELEASE_RESET +#define __TIM9_CLK_DISABLE __HAL_RCC_TIM9_CLK_DISABLE +#define __TIM9_CLK_ENABLE __HAL_RCC_TIM9_CLK_ENABLE +#define __TIM9_FORCE_RESET __HAL_RCC_TIM9_FORCE_RESET +#define __TIM9_RELEASE_RESET __HAL_RCC_TIM9_RELEASE_RESET +#define __TSC_CLK_DISABLE __HAL_RCC_TSC_CLK_DISABLE +#define __TSC_CLK_ENABLE __HAL_RCC_TSC_CLK_ENABLE +#define __TSC_CLK_SLEEP_DISABLE __HAL_RCC_TSC_CLK_SLEEP_DISABLE +#define __TSC_CLK_SLEEP_ENABLE __HAL_RCC_TSC_CLK_SLEEP_ENABLE +#define __TSC_FORCE_RESET __HAL_RCC_TSC_FORCE_RESET +#define __TSC_RELEASE_RESET __HAL_RCC_TSC_RELEASE_RESET +#define __UART4_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE +#define __UART4_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE +#define __UART4_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE +#define __UART4_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE +#define __UART4_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET +#define __UART4_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET +#define __UART5_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE +#define __UART5_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE +#define __UART5_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE +#define __UART5_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE +#define __UART5_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET +#define __UART5_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET +#define __USART1_CLK_DISABLE __HAL_RCC_USART1_CLK_DISABLE +#define __USART1_CLK_ENABLE __HAL_RCC_USART1_CLK_ENABLE +#define __USART1_CLK_SLEEP_DISABLE __HAL_RCC_USART1_CLK_SLEEP_DISABLE +#define __USART1_CLK_SLEEP_ENABLE __HAL_RCC_USART1_CLK_SLEEP_ENABLE +#define __USART1_FORCE_RESET __HAL_RCC_USART1_FORCE_RESET +#define __USART1_RELEASE_RESET __HAL_RCC_USART1_RELEASE_RESET +#define __USART2_CLK_DISABLE __HAL_RCC_USART2_CLK_DISABLE +#define __USART2_CLK_ENABLE __HAL_RCC_USART2_CLK_ENABLE +#define __USART2_CLK_SLEEP_DISABLE __HAL_RCC_USART2_CLK_SLEEP_DISABLE +#define __USART2_CLK_SLEEP_ENABLE __HAL_RCC_USART2_CLK_SLEEP_ENABLE +#define __USART2_FORCE_RESET __HAL_RCC_USART2_FORCE_RESET +#define __USART2_RELEASE_RESET __HAL_RCC_USART2_RELEASE_RESET +#define __USART3_CLK_DISABLE __HAL_RCC_USART3_CLK_DISABLE +#define __USART3_CLK_ENABLE __HAL_RCC_USART3_CLK_ENABLE +#define __USART3_CLK_SLEEP_DISABLE __HAL_RCC_USART3_CLK_SLEEP_DISABLE +#define __USART3_CLK_SLEEP_ENABLE __HAL_RCC_USART3_CLK_SLEEP_ENABLE +#define __USART3_FORCE_RESET __HAL_RCC_USART3_FORCE_RESET +#define __USART3_RELEASE_RESET __HAL_RCC_USART3_RELEASE_RESET +#define __USART4_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE +#define __USART4_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE +#define __USART4_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE +#define __USART4_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE +#define __USART4_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET +#define __USART4_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET +#define __USART5_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE +#define __USART5_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE +#define __USART5_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE +#define __USART5_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE +#define __USART5_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET +#define __USART5_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET +#define __USART7_CLK_DISABLE __HAL_RCC_UART7_CLK_DISABLE +#define __USART7_CLK_ENABLE __HAL_RCC_UART7_CLK_ENABLE +#define __USART7_FORCE_RESET __HAL_RCC_UART7_FORCE_RESET +#define __USART7_RELEASE_RESET __HAL_RCC_UART7_RELEASE_RESET +#define __USART8_CLK_DISABLE __HAL_RCC_UART8_CLK_DISABLE +#define __USART8_CLK_ENABLE __HAL_RCC_UART8_CLK_ENABLE +#define __USART8_FORCE_RESET __HAL_RCC_UART8_FORCE_RESET +#define __USART8_RELEASE_RESET __HAL_RCC_UART8_RELEASE_RESET +#define __USB_CLK_DISABLE __HAL_RCC_USB_CLK_DISABLE +#define __USB_CLK_ENABLE __HAL_RCC_USB_CLK_ENABLE +#define __USB_FORCE_RESET __HAL_RCC_USB_FORCE_RESET +#define __USB_CLK_SLEEP_ENABLE __HAL_RCC_USB_CLK_SLEEP_ENABLE +#define __USB_CLK_SLEEP_DISABLE __HAL_RCC_USB_CLK_SLEEP_DISABLE +#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 +#define __TIM21_RELEASE_RESET __HAL_RCC_TIM21_RELEASE_RESET +#define __TIM21_CLK_SLEEP_ENABLE __HAL_RCC_TIM21_CLK_SLEEP_ENABLE +#define __TIM21_CLK_SLEEP_DISABLE __HAL_RCC_TIM21_CLK_SLEEP_DISABLE +#define __TIM22_CLK_ENABLE __HAL_RCC_TIM22_CLK_ENABLE +#define __TIM22_CLK_DISABLE __HAL_RCC_TIM22_CLK_DISABLE +#define __TIM22_FORCE_RESET __HAL_RCC_TIM22_FORCE_RESET +#define __TIM22_RELEASE_RESET __HAL_RCC_TIM22_RELEASE_RESET +#define __TIM22_CLK_SLEEP_ENABLE __HAL_RCC_TIM22_CLK_SLEEP_ENABLE +#define __TIM22_CLK_SLEEP_DISABLE __HAL_RCC_TIM22_CLK_SLEEP_DISABLE +#define __CRS_CLK_DISABLE __HAL_RCC_CRS_CLK_DISABLE +#define __CRS_CLK_ENABLE __HAL_RCC_CRS_CLK_ENABLE +#define __CRS_CLK_SLEEP_DISABLE __HAL_RCC_CRS_CLK_SLEEP_DISABLE +#define __CRS_CLK_SLEEP_ENABLE __HAL_RCC_CRS_CLK_SLEEP_ENABLE +#define __CRS_FORCE_RESET __HAL_RCC_CRS_FORCE_RESET +#define __CRS_RELEASE_RESET __HAL_RCC_CRS_RELEASE_RESET +#define __RCC_BACKUPRESET_FORCE __HAL_RCC_BACKUPRESET_FORCE +#define __RCC_BACKUPRESET_RELEASE __HAL_RCC_BACKUPRESET_RELEASE + +#define __USB_OTG_FS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET +#define __USB_OTG_FS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET +#define __USB_OTG_FS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE +#define __USB_OTG_FS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE +#define __USB_OTG_HS_CLK_DISABLE __HAL_RCC_USB_OTG_HS_CLK_DISABLE +#define __USB_OTG_HS_CLK_ENABLE __HAL_RCC_USB_OTG_HS_CLK_ENABLE +#define __USB_OTG_HS_ULPI_CLK_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE +#define __USB_OTG_HS_ULPI_CLK_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE +#define __TIM9_CLK_SLEEP_ENABLE __HAL_RCC_TIM9_CLK_SLEEP_ENABLE +#define __TIM9_CLK_SLEEP_DISABLE __HAL_RCC_TIM9_CLK_SLEEP_DISABLE +#define __TIM10_CLK_SLEEP_ENABLE __HAL_RCC_TIM10_CLK_SLEEP_ENABLE +#define __TIM10_CLK_SLEEP_DISABLE __HAL_RCC_TIM10_CLK_SLEEP_DISABLE +#define __TIM11_CLK_SLEEP_ENABLE __HAL_RCC_TIM11_CLK_SLEEP_ENABLE +#define __TIM11_CLK_SLEEP_DISABLE __HAL_RCC_TIM11_CLK_SLEEP_DISABLE +#define __ETHMACPTP_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE +#define __ETHMACPTP_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE +#define __ETHMACPTP_CLK_ENABLE __HAL_RCC_ETHMACPTP_CLK_ENABLE +#define __ETHMACPTP_CLK_DISABLE __HAL_RCC_ETHMACPTP_CLK_DISABLE +#define __HASH_CLK_ENABLE __HAL_RCC_HASH_CLK_ENABLE +#define __HASH_FORCE_RESET __HAL_RCC_HASH_FORCE_RESET +#define __HASH_RELEASE_RESET __HAL_RCC_HASH_RELEASE_RESET +#define __HASH_CLK_SLEEP_ENABLE __HAL_RCC_HASH_CLK_SLEEP_ENABLE +#define __HASH_CLK_SLEEP_DISABLE __HAL_RCC_HASH_CLK_SLEEP_DISABLE +#define __HASH_CLK_DISABLE __HAL_RCC_HASH_CLK_DISABLE +#define __SPI5_CLK_ENABLE __HAL_RCC_SPI5_CLK_ENABLE +#define __SPI5_CLK_DISABLE __HAL_RCC_SPI5_CLK_DISABLE +#define __SPI5_FORCE_RESET __HAL_RCC_SPI5_FORCE_RESET +#define __SPI5_RELEASE_RESET __HAL_RCC_SPI5_RELEASE_RESET +#define __SPI5_CLK_SLEEP_ENABLE __HAL_RCC_SPI5_CLK_SLEEP_ENABLE +#define __SPI5_CLK_SLEEP_DISABLE __HAL_RCC_SPI5_CLK_SLEEP_DISABLE +#define __SPI6_CLK_ENABLE __HAL_RCC_SPI6_CLK_ENABLE +#define __SPI6_CLK_DISABLE __HAL_RCC_SPI6_CLK_DISABLE +#define __SPI6_FORCE_RESET __HAL_RCC_SPI6_FORCE_RESET +#define __SPI6_RELEASE_RESET __HAL_RCC_SPI6_RELEASE_RESET +#define __SPI6_CLK_SLEEP_ENABLE __HAL_RCC_SPI6_CLK_SLEEP_ENABLE +#define __SPI6_CLK_SLEEP_DISABLE __HAL_RCC_SPI6_CLK_SLEEP_DISABLE +#define __LTDC_CLK_ENABLE __HAL_RCC_LTDC_CLK_ENABLE +#define __LTDC_CLK_DISABLE __HAL_RCC_LTDC_CLK_DISABLE +#define __LTDC_FORCE_RESET __HAL_RCC_LTDC_FORCE_RESET +#define __LTDC_RELEASE_RESET __HAL_RCC_LTDC_RELEASE_RESET +#define __LTDC_CLK_SLEEP_ENABLE __HAL_RCC_LTDC_CLK_SLEEP_ENABLE +#define __ETHMAC_CLK_SLEEP_ENABLE __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE +#define __ETHMAC_CLK_SLEEP_DISABLE __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE +#define __ETHMACTX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE +#define __ETHMACTX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE +#define __ETHMACRX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE +#define __ETHMACRX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE +#define __TIM12_CLK_SLEEP_ENABLE __HAL_RCC_TIM12_CLK_SLEEP_ENABLE +#define __TIM12_CLK_SLEEP_DISABLE __HAL_RCC_TIM12_CLK_SLEEP_DISABLE +#define __TIM13_CLK_SLEEP_ENABLE __HAL_RCC_TIM13_CLK_SLEEP_ENABLE +#define __TIM13_CLK_SLEEP_DISABLE __HAL_RCC_TIM13_CLK_SLEEP_DISABLE +#define __TIM14_CLK_SLEEP_ENABLE __HAL_RCC_TIM14_CLK_SLEEP_ENABLE +#define __TIM14_CLK_SLEEP_DISABLE __HAL_RCC_TIM14_CLK_SLEEP_DISABLE +#define __BKPSRAM_CLK_ENABLE __HAL_RCC_BKPSRAM_CLK_ENABLE +#define __BKPSRAM_CLK_DISABLE __HAL_RCC_BKPSRAM_CLK_DISABLE +#define __BKPSRAM_CLK_SLEEP_ENABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE +#define __BKPSRAM_CLK_SLEEP_DISABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE +#define __CCMDATARAMEN_CLK_ENABLE __HAL_RCC_CCMDATARAMEN_CLK_ENABLE +#define __CCMDATARAMEN_CLK_DISABLE __HAL_RCC_CCMDATARAMEN_CLK_DISABLE +#define __USART6_CLK_ENABLE __HAL_RCC_USART6_CLK_ENABLE +#define __USART6_CLK_DISABLE __HAL_RCC_USART6_CLK_DISABLE +#define __USART6_FORCE_RESET __HAL_RCC_USART6_FORCE_RESET +#define __USART6_RELEASE_RESET __HAL_RCC_USART6_RELEASE_RESET +#define __USART6_CLK_SLEEP_ENABLE __HAL_RCC_USART6_CLK_SLEEP_ENABLE +#define __USART6_CLK_SLEEP_DISABLE __HAL_RCC_USART6_CLK_SLEEP_DISABLE +#define __SPI4_CLK_ENABLE __HAL_RCC_SPI4_CLK_ENABLE +#define __SPI4_CLK_DISABLE __HAL_RCC_SPI4_CLK_DISABLE +#define __SPI4_FORCE_RESET __HAL_RCC_SPI4_FORCE_RESET +#define __SPI4_RELEASE_RESET __HAL_RCC_SPI4_RELEASE_RESET +#define __SPI4_CLK_SLEEP_ENABLE __HAL_RCC_SPI4_CLK_SLEEP_ENABLE +#define __SPI4_CLK_SLEEP_DISABLE __HAL_RCC_SPI4_CLK_SLEEP_DISABLE +#define __GPIOI_CLK_ENABLE __HAL_RCC_GPIOI_CLK_ENABLE +#define __GPIOI_CLK_DISABLE __HAL_RCC_GPIOI_CLK_DISABLE +#define __GPIOI_FORCE_RESET __HAL_RCC_GPIOI_FORCE_RESET +#define __GPIOI_RELEASE_RESET __HAL_RCC_GPIOI_RELEASE_RESET +#define __GPIOI_CLK_SLEEP_ENABLE __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE +#define __GPIOI_CLK_SLEEP_DISABLE __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE +#define __GPIOJ_CLK_ENABLE __HAL_RCC_GPIOJ_CLK_ENABLE +#define __GPIOJ_CLK_DISABLE __HAL_RCC_GPIOJ_CLK_DISABLE +#define __GPIOJ_FORCE_RESET __HAL_RCC_GPIOJ_FORCE_RESET +#define __GPIOJ_RELEASE_RESET __HAL_RCC_GPIOJ_RELEASE_RESET +#define __GPIOJ_CLK_SLEEP_ENABLE __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE +#define __GPIOJ_CLK_SLEEP_DISABLE __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE +#define __GPIOK_CLK_ENABLE __HAL_RCC_GPIOK_CLK_ENABLE +#define __GPIOK_CLK_DISABLE __HAL_RCC_GPIOK_CLK_DISABLE +#define __GPIOK_RELEASE_RESET __HAL_RCC_GPIOK_RELEASE_RESET +#define __GPIOK_CLK_SLEEP_ENABLE __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE +#define __GPIOK_CLK_SLEEP_DISABLE __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE +#define __ETH_CLK_ENABLE __HAL_RCC_ETH_CLK_ENABLE +#define __ETH_CLK_DISABLE __HAL_RCC_ETH_CLK_DISABLE +#define __DCMI_CLK_ENABLE __HAL_RCC_DCMI_CLK_ENABLE +#define __DCMI_CLK_DISABLE __HAL_RCC_DCMI_CLK_DISABLE +#define __DCMI_FORCE_RESET __HAL_RCC_DCMI_FORCE_RESET +#define __DCMI_RELEASE_RESET __HAL_RCC_DCMI_RELEASE_RESET +#define __DCMI_CLK_SLEEP_ENABLE __HAL_RCC_DCMI_CLK_SLEEP_ENABLE +#define __DCMI_CLK_SLEEP_DISABLE __HAL_RCC_DCMI_CLK_SLEEP_DISABLE +#define __UART7_CLK_ENABLE __HAL_RCC_UART7_CLK_ENABLE +#define __UART7_CLK_DISABLE __HAL_RCC_UART7_CLK_DISABLE +#define __UART7_RELEASE_RESET __HAL_RCC_UART7_RELEASE_RESET +#define __UART7_FORCE_RESET __HAL_RCC_UART7_FORCE_RESET +#define __UART7_CLK_SLEEP_ENABLE __HAL_RCC_UART7_CLK_SLEEP_ENABLE +#define __UART7_CLK_SLEEP_DISABLE __HAL_RCC_UART7_CLK_SLEEP_DISABLE +#define __UART8_CLK_ENABLE __HAL_RCC_UART8_CLK_ENABLE +#define __UART8_CLK_DISABLE __HAL_RCC_UART8_CLK_DISABLE +#define __UART8_FORCE_RESET __HAL_RCC_UART8_FORCE_RESET +#define __UART8_RELEASE_RESET __HAL_RCC_UART8_RELEASE_RESET +#define __UART8_CLK_SLEEP_ENABLE __HAL_RCC_UART8_CLK_SLEEP_ENABLE +#define __UART8_CLK_SLEEP_DISABLE __HAL_RCC_UART8_CLK_SLEEP_DISABLE +#define __OTGHS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE +#define __OTGHS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE +#define __OTGHS_FORCE_RESET __HAL_RCC_USB_OTG_HS_FORCE_RESET +#define __OTGHS_RELEASE_RESET __HAL_RCC_USB_OTG_HS_RELEASE_RESET +#define __OTGHSULPI_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE +#define __OTGHSULPI_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE +#define __HAL_RCC_OTGHS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE +#define __HAL_RCC_OTGHS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE +#define __HAL_RCC_OTGHS_IS_CLK_SLEEP_ENABLED __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_ENABLED +#define __HAL_RCC_OTGHS_IS_CLK_SLEEP_DISABLED __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_DISABLED +#define __HAL_RCC_OTGHS_FORCE_RESET __HAL_RCC_USB_OTG_HS_FORCE_RESET +#define __HAL_RCC_OTGHS_RELEASE_RESET __HAL_RCC_USB_OTG_HS_RELEASE_RESET +#define __HAL_RCC_OTGHSULPI_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE +#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 __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 +#define __DAC_CLK_SLEEP_ENABLE __HAL_RCC_DAC_CLK_SLEEP_ENABLE +#define __DAC_CLK_SLEEP_DISABLE __HAL_RCC_DAC_CLK_SLEEP_DISABLE +#define __ADC2_CLK_SLEEP_ENABLE __HAL_RCC_ADC2_CLK_SLEEP_ENABLE +#define __ADC2_CLK_SLEEP_DISABLE __HAL_RCC_ADC2_CLK_SLEEP_DISABLE +#define __ADC3_CLK_SLEEP_ENABLE __HAL_RCC_ADC3_CLK_SLEEP_ENABLE +#define __ADC3_CLK_SLEEP_DISABLE __HAL_RCC_ADC3_CLK_SLEEP_DISABLE +#define __FSMC_FORCE_RESET __HAL_RCC_FSMC_FORCE_RESET +#define __FSMC_RELEASE_RESET __HAL_RCC_FSMC_RELEASE_RESET +#define __FSMC_CLK_SLEEP_ENABLE __HAL_RCC_FSMC_CLK_SLEEP_ENABLE +#define __FSMC_CLK_SLEEP_DISABLE __HAL_RCC_FSMC_CLK_SLEEP_DISABLE +#define __SDIO_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET +#define __SDIO_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET +#define __SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE +#define __SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE +#define __DMA2D_CLK_ENABLE __HAL_RCC_DMA2D_CLK_ENABLE +#define __DMA2D_CLK_DISABLE __HAL_RCC_DMA2D_CLK_DISABLE +#define __DMA2D_FORCE_RESET __HAL_RCC_DMA2D_FORCE_RESET +#define __DMA2D_RELEASE_RESET __HAL_RCC_DMA2D_RELEASE_RESET +#define __DMA2D_CLK_SLEEP_ENABLE __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE +#define __DMA2D_CLK_SLEEP_DISABLE __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE + +/* alias define maintained for legacy */ +#define __HAL_RCC_OTGFS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET +#define __HAL_RCC_OTGFS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET + +#define __ADC12_CLK_ENABLE __HAL_RCC_ADC12_CLK_ENABLE +#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 __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 +#define __TIM18_CLK_DISABLE __HAL_RCC_TIM18_CLK_DISABLE +#define __TIM19_CLK_ENABLE __HAL_RCC_TIM19_CLK_ENABLE +#define __TIM19_CLK_DISABLE __HAL_RCC_TIM19_CLK_DISABLE +#define __TIM20_CLK_ENABLE __HAL_RCC_TIM20_CLK_ENABLE +#define __TIM20_CLK_DISABLE __HAL_RCC_TIM20_CLK_DISABLE +#define __HRTIM1_CLK_ENABLE __HAL_RCC_HRTIM1_CLK_ENABLE +#define __HRTIM1_CLK_DISABLE __HAL_RCC_HRTIM1_CLK_DISABLE +#define __SDADC1_CLK_ENABLE __HAL_RCC_SDADC1_CLK_ENABLE +#define __SDADC2_CLK_ENABLE __HAL_RCC_SDADC2_CLK_ENABLE +#define __SDADC3_CLK_ENABLE __HAL_RCC_SDADC3_CLK_ENABLE +#define __SDADC1_CLK_DISABLE __HAL_RCC_SDADC1_CLK_DISABLE +#define __SDADC2_CLK_DISABLE __HAL_RCC_SDADC2_CLK_DISABLE +#define __SDADC3_CLK_DISABLE __HAL_RCC_SDADC3_CLK_DISABLE + +#define __ADC12_FORCE_RESET __HAL_RCC_ADC12_FORCE_RESET +#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 __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 +#define __TIM18_RELEASE_RESET __HAL_RCC_TIM18_RELEASE_RESET +#define __TIM19_FORCE_RESET __HAL_RCC_TIM19_FORCE_RESET +#define __TIM19_RELEASE_RESET __HAL_RCC_TIM19_RELEASE_RESET +#define __TIM20_FORCE_RESET __HAL_RCC_TIM20_FORCE_RESET +#define __TIM20_RELEASE_RESET __HAL_RCC_TIM20_RELEASE_RESET +#define __HRTIM1_FORCE_RESET __HAL_RCC_HRTIM1_FORCE_RESET +#define __HRTIM1_RELEASE_RESET __HAL_RCC_HRTIM1_RELEASE_RESET +#define __SDADC1_FORCE_RESET __HAL_RCC_SDADC1_FORCE_RESET +#define __SDADC2_FORCE_RESET __HAL_RCC_SDADC2_FORCE_RESET +#define __SDADC3_FORCE_RESET __HAL_RCC_SDADC3_FORCE_RESET +#define __SDADC1_RELEASE_RESET __HAL_RCC_SDADC1_RELEASE_RESET +#define __SDADC2_RELEASE_RESET __HAL_RCC_SDADC2_RELEASE_RESET +#define __SDADC3_RELEASE_RESET __HAL_RCC_SDADC3_RELEASE_RESET + +#define __ADC1_IS_CLK_ENABLED __HAL_RCC_ADC1_IS_CLK_ENABLED +#define __ADC1_IS_CLK_DISABLED __HAL_RCC_ADC1_IS_CLK_DISABLED +#define __ADC12_IS_CLK_ENABLED __HAL_RCC_ADC12_IS_CLK_ENABLED +#define __ADC12_IS_CLK_DISABLED __HAL_RCC_ADC12_IS_CLK_DISABLED +#define __ADC34_IS_CLK_ENABLED __HAL_RCC_ADC34_IS_CLK_ENABLED +#define __ADC34_IS_CLK_DISABLED __HAL_RCC_ADC34_IS_CLK_DISABLED +#define __CEC_IS_CLK_ENABLED __HAL_RCC_CEC_IS_CLK_ENABLED +#define __CEC_IS_CLK_DISABLED __HAL_RCC_CEC_IS_CLK_DISABLED +#define __CRC_IS_CLK_ENABLED __HAL_RCC_CRC_IS_CLK_ENABLED +#define __CRC_IS_CLK_DISABLED __HAL_RCC_CRC_IS_CLK_DISABLED +#define __DAC1_IS_CLK_ENABLED __HAL_RCC_DAC1_IS_CLK_ENABLED +#define __DAC1_IS_CLK_DISABLED __HAL_RCC_DAC1_IS_CLK_DISABLED +#define __DAC2_IS_CLK_ENABLED __HAL_RCC_DAC2_IS_CLK_ENABLED +#define __DAC2_IS_CLK_DISABLED __HAL_RCC_DAC2_IS_CLK_DISABLED +#define __DMA1_IS_CLK_ENABLED __HAL_RCC_DMA1_IS_CLK_ENABLED +#define __DMA1_IS_CLK_DISABLED __HAL_RCC_DMA1_IS_CLK_DISABLED +#define __DMA2_IS_CLK_ENABLED __HAL_RCC_DMA2_IS_CLK_ENABLED +#define __DMA2_IS_CLK_DISABLED __HAL_RCC_DMA2_IS_CLK_DISABLED +#define __FLITF_IS_CLK_ENABLED __HAL_RCC_FLITF_IS_CLK_ENABLED +#define __FLITF_IS_CLK_DISABLED __HAL_RCC_FLITF_IS_CLK_DISABLED +#define __FMC_IS_CLK_ENABLED __HAL_RCC_FMC_IS_CLK_ENABLED +#define __FMC_IS_CLK_DISABLED __HAL_RCC_FMC_IS_CLK_DISABLED +#define __GPIOA_IS_CLK_ENABLED __HAL_RCC_GPIOA_IS_CLK_ENABLED +#define __GPIOA_IS_CLK_DISABLED __HAL_RCC_GPIOA_IS_CLK_DISABLED +#define __GPIOB_IS_CLK_ENABLED __HAL_RCC_GPIOB_IS_CLK_ENABLED +#define __GPIOB_IS_CLK_DISABLED __HAL_RCC_GPIOB_IS_CLK_DISABLED +#define __GPIOC_IS_CLK_ENABLED __HAL_RCC_GPIOC_IS_CLK_ENABLED +#define __GPIOC_IS_CLK_DISABLED __HAL_RCC_GPIOC_IS_CLK_DISABLED +#define __GPIOD_IS_CLK_ENABLED __HAL_RCC_GPIOD_IS_CLK_ENABLED +#define __GPIOD_IS_CLK_DISABLED __HAL_RCC_GPIOD_IS_CLK_DISABLED +#define __GPIOE_IS_CLK_ENABLED __HAL_RCC_GPIOE_IS_CLK_ENABLED +#define __GPIOE_IS_CLK_DISABLED __HAL_RCC_GPIOE_IS_CLK_DISABLED +#define __GPIOF_IS_CLK_ENABLED __HAL_RCC_GPIOF_IS_CLK_ENABLED +#define __GPIOF_IS_CLK_DISABLED __HAL_RCC_GPIOF_IS_CLK_DISABLED +#define __GPIOG_IS_CLK_ENABLED __HAL_RCC_GPIOG_IS_CLK_ENABLED +#define __GPIOG_IS_CLK_DISABLED __HAL_RCC_GPIOG_IS_CLK_DISABLED +#define __GPIOH_IS_CLK_ENABLED __HAL_RCC_GPIOH_IS_CLK_ENABLED +#define __GPIOH_IS_CLK_DISABLED __HAL_RCC_GPIOH_IS_CLK_DISABLED +#define __HRTIM1_IS_CLK_ENABLED __HAL_RCC_HRTIM1_IS_CLK_ENABLED +#define __HRTIM1_IS_CLK_DISABLED __HAL_RCC_HRTIM1_IS_CLK_DISABLED +#define __I2C1_IS_CLK_ENABLED __HAL_RCC_I2C1_IS_CLK_ENABLED +#define __I2C1_IS_CLK_DISABLED __HAL_RCC_I2C1_IS_CLK_DISABLED +#define __I2C2_IS_CLK_ENABLED __HAL_RCC_I2C2_IS_CLK_ENABLED +#define __I2C2_IS_CLK_DISABLED __HAL_RCC_I2C2_IS_CLK_DISABLED +#define __I2C3_IS_CLK_ENABLED __HAL_RCC_I2C3_IS_CLK_ENABLED +#define __I2C3_IS_CLK_DISABLED __HAL_RCC_I2C3_IS_CLK_DISABLED +#define __PWR_IS_CLK_ENABLED __HAL_RCC_PWR_IS_CLK_ENABLED +#define __PWR_IS_CLK_DISABLED __HAL_RCC_PWR_IS_CLK_DISABLED +#define __SYSCFG_IS_CLK_ENABLED __HAL_RCC_SYSCFG_IS_CLK_ENABLED +#define __SYSCFG_IS_CLK_DISABLED __HAL_RCC_SYSCFG_IS_CLK_DISABLED +#define __SPI1_IS_CLK_ENABLED __HAL_RCC_SPI1_IS_CLK_ENABLED +#define __SPI1_IS_CLK_DISABLED __HAL_RCC_SPI1_IS_CLK_DISABLED +#define __SPI2_IS_CLK_ENABLED __HAL_RCC_SPI2_IS_CLK_ENABLED +#define __SPI2_IS_CLK_DISABLED __HAL_RCC_SPI2_IS_CLK_DISABLED +#define __SPI3_IS_CLK_ENABLED __HAL_RCC_SPI3_IS_CLK_ENABLED +#define __SPI3_IS_CLK_DISABLED __HAL_RCC_SPI3_IS_CLK_DISABLED +#define __SPI4_IS_CLK_ENABLED __HAL_RCC_SPI4_IS_CLK_ENABLED +#define __SPI4_IS_CLK_DISABLED __HAL_RCC_SPI4_IS_CLK_DISABLED +#define __SDADC1_IS_CLK_ENABLED __HAL_RCC_SDADC1_IS_CLK_ENABLED +#define __SDADC1_IS_CLK_DISABLED __HAL_RCC_SDADC1_IS_CLK_DISABLED +#define __SDADC2_IS_CLK_ENABLED __HAL_RCC_SDADC2_IS_CLK_ENABLED +#define __SDADC2_IS_CLK_DISABLED __HAL_RCC_SDADC2_IS_CLK_DISABLED +#define __SDADC3_IS_CLK_ENABLED __HAL_RCC_SDADC3_IS_CLK_ENABLED +#define __SDADC3_IS_CLK_DISABLED __HAL_RCC_SDADC3_IS_CLK_DISABLED +#define __SRAM_IS_CLK_ENABLED __HAL_RCC_SRAM_IS_CLK_ENABLED +#define __SRAM_IS_CLK_DISABLED __HAL_RCC_SRAM_IS_CLK_DISABLED +#define __TIM1_IS_CLK_ENABLED __HAL_RCC_TIM1_IS_CLK_ENABLED +#define __TIM1_IS_CLK_DISABLED __HAL_RCC_TIM1_IS_CLK_DISABLED +#define __TIM2_IS_CLK_ENABLED __HAL_RCC_TIM2_IS_CLK_ENABLED +#define __TIM2_IS_CLK_DISABLED __HAL_RCC_TIM2_IS_CLK_DISABLED +#define __TIM3_IS_CLK_ENABLED __HAL_RCC_TIM3_IS_CLK_ENABLED +#define __TIM3_IS_CLK_DISABLED __HAL_RCC_TIM3_IS_CLK_DISABLED +#define __TIM4_IS_CLK_ENABLED __HAL_RCC_TIM4_IS_CLK_ENABLED +#define __TIM4_IS_CLK_DISABLED __HAL_RCC_TIM4_IS_CLK_DISABLED +#define __TIM5_IS_CLK_ENABLED __HAL_RCC_TIM5_IS_CLK_ENABLED +#define __TIM5_IS_CLK_DISABLED __HAL_RCC_TIM5_IS_CLK_DISABLED +#define __TIM6_IS_CLK_ENABLED __HAL_RCC_TIM6_IS_CLK_ENABLED +#define __TIM6_IS_CLK_DISABLED __HAL_RCC_TIM6_IS_CLK_DISABLED +#define __TIM7_IS_CLK_ENABLED __HAL_RCC_TIM7_IS_CLK_ENABLED +#define __TIM7_IS_CLK_DISABLED __HAL_RCC_TIM7_IS_CLK_DISABLED +#define __TIM8_IS_CLK_ENABLED __HAL_RCC_TIM8_IS_CLK_ENABLED +#define __TIM8_IS_CLK_DISABLED __HAL_RCC_TIM8_IS_CLK_DISABLED +#define __TIM12_IS_CLK_ENABLED __HAL_RCC_TIM12_IS_CLK_ENABLED +#define __TIM12_IS_CLK_DISABLED __HAL_RCC_TIM12_IS_CLK_DISABLED +#define __TIM13_IS_CLK_ENABLED __HAL_RCC_TIM13_IS_CLK_ENABLED +#define __TIM13_IS_CLK_DISABLED __HAL_RCC_TIM13_IS_CLK_DISABLED +#define __TIM14_IS_CLK_ENABLED __HAL_RCC_TIM14_IS_CLK_ENABLED +#define __TIM14_IS_CLK_DISABLED __HAL_RCC_TIM14_IS_CLK_DISABLED +#define __TIM15_IS_CLK_ENABLED __HAL_RCC_TIM15_IS_CLK_ENABLED +#define __TIM15_IS_CLK_DISABLED __HAL_RCC_TIM15_IS_CLK_DISABLED +#define __TIM16_IS_CLK_ENABLED __HAL_RCC_TIM16_IS_CLK_ENABLED +#define __TIM16_IS_CLK_DISABLED __HAL_RCC_TIM16_IS_CLK_DISABLED +#define __TIM17_IS_CLK_ENABLED __HAL_RCC_TIM17_IS_CLK_ENABLED +#define __TIM17_IS_CLK_DISABLED __HAL_RCC_TIM17_IS_CLK_DISABLED +#define __TIM18_IS_CLK_ENABLED __HAL_RCC_TIM18_IS_CLK_ENABLED +#define __TIM18_IS_CLK_DISABLED __HAL_RCC_TIM18_IS_CLK_DISABLED +#define __TIM19_IS_CLK_ENABLED __HAL_RCC_TIM19_IS_CLK_ENABLED +#define __TIM19_IS_CLK_DISABLED __HAL_RCC_TIM19_IS_CLK_DISABLED +#define __TIM20_IS_CLK_ENABLED __HAL_RCC_TIM20_IS_CLK_ENABLED +#define __TIM20_IS_CLK_DISABLED __HAL_RCC_TIM20_IS_CLK_DISABLED +#define __TSC_IS_CLK_ENABLED __HAL_RCC_TSC_IS_CLK_ENABLED +#define __TSC_IS_CLK_DISABLED __HAL_RCC_TSC_IS_CLK_DISABLED +#define __UART4_IS_CLK_ENABLED __HAL_RCC_UART4_IS_CLK_ENABLED +#define __UART4_IS_CLK_DISABLED __HAL_RCC_UART4_IS_CLK_DISABLED +#define __UART5_IS_CLK_ENABLED __HAL_RCC_UART5_IS_CLK_ENABLED +#define __UART5_IS_CLK_DISABLED __HAL_RCC_UART5_IS_CLK_DISABLED +#define __USART1_IS_CLK_ENABLED __HAL_RCC_USART1_IS_CLK_ENABLED +#define __USART1_IS_CLK_DISABLED __HAL_RCC_USART1_IS_CLK_DISABLED +#define __USART2_IS_CLK_ENABLED __HAL_RCC_USART2_IS_CLK_ENABLED +#define __USART2_IS_CLK_DISABLED __HAL_RCC_USART2_IS_CLK_DISABLED +#define __USART3_IS_CLK_ENABLED __HAL_RCC_USART3_IS_CLK_ENABLED +#define __USART3_IS_CLK_DISABLED __HAL_RCC_USART3_IS_CLK_DISABLED +#define __USB_IS_CLK_ENABLED __HAL_RCC_USB_IS_CLK_ENABLED +#define __USB_IS_CLK_DISABLED __HAL_RCC_USB_IS_CLK_DISABLED +#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 +#define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE +#define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE +#define __HAL_RCC_SDMMC1_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE +#define __HAL_RCC_SDMMC1_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE +#define __HAL_RCC_SDMMC1_IS_CLK_ENABLED __HAL_RCC_SDIO_IS_CLK_ENABLED +#define __HAL_RCC_SDMMC1_IS_CLK_DISABLED __HAL_RCC_SDIO_IS_CLK_DISABLED +#define Sdmmc1ClockSelection SdioClockSelection +#define RCC_PERIPHCLK_SDMMC1 RCC_PERIPHCLK_SDIO +#define RCC_SDMMC1CLKSOURCE_CLK48 RCC_SDIOCLKSOURCE_CK48 +#define RCC_SDMMC1CLKSOURCE_SYSCLK RCC_SDIOCLKSOURCE_SYSCLK +#define __HAL_RCC_SDMMC1_CONFIG __HAL_RCC_SDIO_CONFIG +#define __HAL_RCC_GET_SDMMC1_SOURCE __HAL_RCC_GET_SDIO_SOURCE +#endif + +#if defined(STM32F7) || defined(STM32L4) +#define __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SDMMC1_FORCE_RESET +#define __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SDMMC1_RELEASE_RESET +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE +#define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE +#define __HAL_RCC_SDIO_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE +#define __HAL_RCC_SDIO_IS_CLK_ENABLED __HAL_RCC_SDMMC1_IS_CLK_ENABLED +#define __HAL_RCC_SDIO_IS_CLK_DISABLED __HAL_RCC_SDMMC1_IS_CLK_DISABLED +#define SdioClockSelection Sdmmc1ClockSelection +#define RCC_PERIPHCLK_SDIO RCC_PERIPHCLK_SDMMC1 +#define __HAL_RCC_SDIO_CONFIG __HAL_RCC_SDMMC1_CONFIG +#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() +#define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() __HAL_RCC_USB1_OTG_HS_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_HS_FORCE_RESET() __HAL_RCC_USB1_OTG_HS_FORCE_RESET() +#define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() __HAL_RCC_USB1_OTG_HS_RELEASE_RESET() +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_DISABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_DISABLE() + +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() __HAL_RCC_USB2_OTG_FS_CLK_ENABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_ENABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_ENABLE() +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() __HAL_RCC_USB2_OTG_FS_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_DISABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() __HAL_RCC_USB2_OTG_FS_FORCE_RESET() +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() __HAL_RCC_USB2_OTG_FS_RELEASE_RESET() +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_SLEEP_ENABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_DISABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_SLEEP_DISABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE() +#endif + +#define __HAL_RCC_I2SCLK __HAL_RCC_I2S_CONFIG +#define __HAL_RCC_I2SCLK_CONFIG __HAL_RCC_I2S_CONFIG + +#define __RCC_PLLSRC RCC_GET_PLL_OSCSOURCE + +#define IS_RCC_MSIRANGE IS_RCC_MSI_CLOCK_RANGE +#define IS_RCC_RTCCLK_SOURCE IS_RCC_RTCCLKSOURCE +#define IS_RCC_SYSCLK_DIV IS_RCC_HCLK +#define IS_RCC_HCLK_DIV IS_RCC_PCLK +#define IS_RCC_PERIPHCLK IS_RCC_PERIPHCLOCK + +#define RCC_IT_HSI14 RCC_IT_HSI14RDY + +#define RCC_IT_CSSLSE RCC_IT_LSECSS +#define RCC_IT_CSSHSE RCC_IT_CSS + +#define RCC_PLLMUL_3 RCC_PLL_MUL3 +#define RCC_PLLMUL_4 RCC_PLL_MUL4 +#define RCC_PLLMUL_6 RCC_PLL_MUL6 +#define RCC_PLLMUL_8 RCC_PLL_MUL8 +#define RCC_PLLMUL_12 RCC_PLL_MUL12 +#define RCC_PLLMUL_16 RCC_PLL_MUL16 +#define RCC_PLLMUL_24 RCC_PLL_MUL24 +#define RCC_PLLMUL_32 RCC_PLL_MUL32 +#define RCC_PLLMUL_48 RCC_PLL_MUL48 + +#define RCC_PLLDIV_2 RCC_PLL_DIV2 +#define RCC_PLLDIV_3 RCC_PLL_DIV3 +#define RCC_PLLDIV_4 RCC_PLL_DIV4 + +#define IS_RCC_MCOSOURCE IS_RCC_MCO1SOURCE +#define __HAL_RCC_MCO_CONFIG __HAL_RCC_MCO1_CONFIG +#define RCC_MCO_NODIV RCC_MCODIV_1 +#define RCC_MCO_DIV1 RCC_MCODIV_1 +#define RCC_MCO_DIV2 RCC_MCODIV_2 +#define RCC_MCO_DIV4 RCC_MCODIV_4 +#define RCC_MCO_DIV8 RCC_MCODIV_8 +#define RCC_MCO_DIV16 RCC_MCODIV_16 +#define RCC_MCO_DIV32 RCC_MCODIV_32 +#define RCC_MCO_DIV64 RCC_MCODIV_64 +#define RCC_MCO_DIV128 RCC_MCODIV_128 +#define RCC_MCOSOURCE_NONE RCC_MCO1SOURCE_NOCLOCK +#define RCC_MCOSOURCE_LSI RCC_MCO1SOURCE_LSI +#define RCC_MCOSOURCE_LSE RCC_MCO1SOURCE_LSE +#define RCC_MCOSOURCE_SYSCLK RCC_MCO1SOURCE_SYSCLK +#define RCC_MCOSOURCE_HSI RCC_MCO1SOURCE_HSI +#define RCC_MCOSOURCE_HSI14 RCC_MCO1SOURCE_HSI14 +#define RCC_MCOSOURCE_HSI48 RCC_MCO1SOURCE_HSI48 +#define RCC_MCOSOURCE_HSE RCC_MCO1SOURCE_HSE +#define RCC_MCOSOURCE_PLLCLK_DIV1 RCC_MCO1SOURCE_PLLCLK +#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) || defined(STM32G4) || defined(STM32L5) +#else +#define RCC_RTCCLKSOURCE_NONE RCC_RTCCLKSOURCE_NO_CLK +#endif + +#define RCC_USBCLK_PLLSAI1 RCC_USBCLKSOURCE_PLLSAI1 +#define RCC_USBCLK_PLL RCC_USBCLKSOURCE_PLL +#define RCC_USBCLK_MSI RCC_USBCLKSOURCE_MSI +#define RCC_USBCLKSOURCE_PLLCLK RCC_USBCLKSOURCE_PLL +#define RCC_USBPLLCLK_DIV1 RCC_USBCLKSOURCE_PLL +#define RCC_USBPLLCLK_DIV1_5 RCC_USBCLKSOURCE_PLL_DIV1_5 +#define RCC_USBPLLCLK_DIV2 RCC_USBCLKSOURCE_PLL_DIV2 +#define RCC_USBPLLCLK_DIV3 RCC_USBCLKSOURCE_PLL_DIV3 + +#define HSION_BitNumber RCC_HSION_BIT_NUMBER +#define HSION_BITNUMBER RCC_HSION_BIT_NUMBER +#define HSEON_BitNumber RCC_HSEON_BIT_NUMBER +#define HSEON_BITNUMBER RCC_HSEON_BIT_NUMBER +#define MSION_BITNUMBER RCC_MSION_BIT_NUMBER +#define CSSON_BitNumber RCC_CSSON_BIT_NUMBER +#define CSSON_BITNUMBER RCC_CSSON_BIT_NUMBER +#define PLLON_BitNumber RCC_PLLON_BIT_NUMBER +#define PLLON_BITNUMBER RCC_PLLON_BIT_NUMBER +#define PLLI2SON_BitNumber RCC_PLLI2SON_BIT_NUMBER +#define I2SSRC_BitNumber RCC_I2SSRC_BIT_NUMBER +#define RTCEN_BitNumber RCC_RTCEN_BIT_NUMBER +#define RTCEN_BITNUMBER RCC_RTCEN_BIT_NUMBER +#define BDRST_BitNumber RCC_BDRST_BIT_NUMBER +#define BDRST_BITNUMBER RCC_BDRST_BIT_NUMBER +#define RTCRST_BITNUMBER RCC_RTCRST_BIT_NUMBER +#define LSION_BitNumber RCC_LSION_BIT_NUMBER +#define LSION_BITNUMBER RCC_LSION_BIT_NUMBER +#define LSEON_BitNumber RCC_LSEON_BIT_NUMBER +#define LSEON_BITNUMBER RCC_LSEON_BIT_NUMBER +#define LSEBYP_BITNUMBER RCC_LSEBYP_BIT_NUMBER +#define PLLSAION_BitNumber RCC_PLLSAION_BIT_NUMBER +#define TIMPRE_BitNumber RCC_TIMPRE_BIT_NUMBER +#define RMVF_BitNumber RCC_RMVF_BIT_NUMBER +#define RMVF_BITNUMBER RCC_RMVF_BIT_NUMBER +#define RCC_CR2_HSI14TRIM_BitNumber RCC_HSI14TRIM_BIT_NUMBER +#define CR_BYTE2_ADDRESS RCC_CR_BYTE2_ADDRESS +#define CIR_BYTE1_ADDRESS RCC_CIR_BYTE1_ADDRESS +#define CIR_BYTE2_ADDRESS RCC_CIR_BYTE2_ADDRESS +#define BDCR_BYTE0_ADDRESS RCC_BDCR_BYTE0_ADDRESS +#define DBP_TIMEOUT_VALUE RCC_DBP_TIMEOUT_VALUE +#define LSE_TIMEOUT_VALUE RCC_LSE_TIMEOUT_VALUE + +#define CR_HSION_BB RCC_CR_HSION_BB +#define CR_CSSON_BB RCC_CR_CSSON_BB +#define CR_PLLON_BB RCC_CR_PLLON_BB +#define CR_PLLI2SON_BB RCC_CR_PLLI2SON_BB +#define CR_MSION_BB RCC_CR_MSION_BB +#define CSR_LSION_BB RCC_CSR_LSION_BB +#define CSR_LSEON_BB RCC_CSR_LSEON_BB +#define CSR_LSEBYP_BB RCC_CSR_LSEBYP_BB +#define CSR_RTCEN_BB RCC_CSR_RTCEN_BB +#define CSR_RTCRST_BB RCC_CSR_RTCRST_BB +#define CFGR_I2SSRC_BB RCC_CFGR_I2SSRC_BB +#define BDCR_RTCEN_BB RCC_BDCR_RTCEN_BB +#define BDCR_BDRST_BB RCC_BDCR_BDRST_BB +#define CR_HSEON_BB RCC_CR_HSEON_BB +#define CSR_RMVF_BB RCC_CSR_RMVF_BB +#define CR_PLLSAION_BB RCC_CR_PLLSAION_BB +#define DCKCFGR_TIMPRE_BB RCC_DCKCFGR_TIMPRE_BB + +#define __HAL_RCC_CRS_ENABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE +#define __HAL_RCC_CRS_DISABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE +#define __HAL_RCC_CRS_ENABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE +#define __HAL_RCC_CRS_DISABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE +#define __HAL_RCC_CRS_CALCULATE_RELOADVALUE __HAL_RCC_CRS_RELOADVALUE_CALCULATE + +#define __HAL_RCC_GET_IT_SOURCE __HAL_RCC_GET_IT + +#define RCC_CRS_SYNCWARM RCC_CRS_SYNCWARN +#define RCC_CRS_TRIMOV RCC_CRS_TRIMOVF + +#define RCC_PERIPHCLK_CK48 RCC_PERIPHCLK_CLK48 +#define RCC_CK48CLKSOURCE_PLLQ RCC_CLK48CLKSOURCE_PLLQ +#define RCC_CK48CLKSOURCE_PLLSAIP RCC_CLK48CLKSOURCE_PLLSAIP +#define RCC_CK48CLKSOURCE_PLLI2SQ RCC_CLK48CLKSOURCE_PLLI2SQ +#define IS_RCC_CK48CLKSOURCE IS_RCC_CLK48CLKSOURCE +#define RCC_SDIOCLKSOURCE_CK48 RCC_SDIOCLKSOURCE_CLK48 + +#define __HAL_RCC_DFSDM_CLK_ENABLE __HAL_RCC_DFSDM1_CLK_ENABLE +#define __HAL_RCC_DFSDM_CLK_DISABLE __HAL_RCC_DFSDM1_CLK_DISABLE +#define __HAL_RCC_DFSDM_IS_CLK_ENABLED __HAL_RCC_DFSDM1_IS_CLK_ENABLED +#define __HAL_RCC_DFSDM_IS_CLK_DISABLED __HAL_RCC_DFSDM1_IS_CLK_DISABLED +#define __HAL_RCC_DFSDM_FORCE_RESET __HAL_RCC_DFSDM1_FORCE_RESET +#define __HAL_RCC_DFSDM_RELEASE_RESET __HAL_RCC_DFSDM1_RELEASE_RESET +#define __HAL_RCC_DFSDM_CLK_SLEEP_ENABLE __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE +#define __HAL_RCC_DFSDM_CLK_SLEEP_DISABLE __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE +#define __HAL_RCC_DFSDM_IS_CLK_SLEEP_ENABLED __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED +#define __HAL_RCC_DFSDM_IS_CLK_SLEEP_DISABLED __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED +#define DfsdmClockSelection Dfsdm1ClockSelection +#define RCC_PERIPHCLK_DFSDM RCC_PERIPHCLK_DFSDM1 +#define RCC_DFSDMCLKSOURCE_PCLK RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_DFSDMCLKSOURCE_SYSCLK RCC_DFSDM1CLKSOURCE_SYSCLK +#define __HAL_RCC_DFSDM_CONFIG __HAL_RCC_DFSDM1_CONFIG +#define __HAL_RCC_GET_DFSDM_SOURCE __HAL_RCC_GET_DFSDM1_SOURCE +#define RCC_DFSDM1CLKSOURCE_PCLK RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_SWPMI1CLKSOURCE_PCLK RCC_SWPMI1CLKSOURCE_PCLK1 +#define RCC_LPTIM1CLKSOURCE_PCLK RCC_LPTIM1CLKSOURCE_PCLK1 +#define RCC_LPTIM2CLKSOURCE_PCLK RCC_LPTIM2CLKSOURCE_PCLK1 + +#define RCC_DFSDM1AUDIOCLKSOURCE_I2SAPB1 RCC_DFSDM1AUDIOCLKSOURCE_I2S1 +#define RCC_DFSDM1AUDIOCLKSOURCE_I2SAPB2 RCC_DFSDM1AUDIOCLKSOURCE_I2S2 +#define RCC_DFSDM2AUDIOCLKSOURCE_I2SAPB1 RCC_DFSDM2AUDIOCLKSOURCE_I2S1 +#define RCC_DFSDM2AUDIOCLKSOURCE_I2SAPB2 RCC_DFSDM2AUDIOCLKSOURCE_I2S2 +#define RCC_DFSDM1CLKSOURCE_APB2 RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_DFSDM2CLKSOURCE_APB2 RCC_DFSDM2CLKSOURCE_PCLK2 +#define RCC_FMPI2C1CLKSOURCE_APB RCC_FMPI2C1CLKSOURCE_PCLK1 + +/** + * @} + */ + +/** @defgroup HAL_RNG_Aliased_Macros HAL RNG Aliased Macros maintained for legacy purpose + * @{ + */ +#define HAL_RNG_ReadyCallback(__HANDLE__) HAL_RNG_ReadyDataCallback((__HANDLE__), uint32_t random32bit) + +/** + * @} + */ + +/** @defgroup HAL_RTC_Aliased_Macros HAL RTC Aliased Macros maintained for legacy purpose + * @{ + */ +#if defined (STM32G0) || defined (STM32L5) || defined (STM32L412xx) || defined (STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) || defined (STM32G4) +#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 + +#if defined (STM32F1) +#define __HAL_RTC_EXTI_CLEAR_FLAG(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() + +#define __HAL_RTC_EXTI_ENABLE_IT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_ENABLE_IT() + +#define __HAL_RTC_EXTI_DISABLE_IT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_DISABLE_IT() + +#define __HAL_RTC_EXTI_GET_FLAG(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_GET_FLAG() + +#define __HAL_RTC_EXTI_GENERATE_SWIT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() +#else +#define __HAL_RTC_EXTI_CLEAR_FLAG(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG())) +#define __HAL_RTC_EXTI_ENABLE_IT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_ENABLE_IT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT())) +#define __HAL_RTC_EXTI_DISABLE_IT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_DISABLE_IT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT())) +#define __HAL_RTC_EXTI_GET_FLAG(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_GET_FLAG() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG())) +#define __HAL_RTC_EXTI_GENERATE_SWIT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT())) +#endif /* STM32F1 */ + +#define IS_ALARM IS_RTC_ALARM +#define IS_ALARM_MASK IS_RTC_ALARM_MASK +#define IS_TAMPER IS_RTC_TAMPER +#define IS_TAMPER_ERASE_MODE IS_RTC_TAMPER_ERASE_MODE +#define IS_TAMPER_FILTER IS_RTC_TAMPER_FILTER +#define IS_TAMPER_INTERRUPT IS_RTC_TAMPER_INTERRUPT +#define IS_TAMPER_MASKFLAG_STATE IS_RTC_TAMPER_MASKFLAG_STATE +#define IS_TAMPER_PRECHARGE_DURATION IS_RTC_TAMPER_PRECHARGE_DURATION +#define IS_TAMPER_PULLUP_STATE IS_RTC_TAMPER_PULLUP_STATE +#define IS_TAMPER_SAMPLING_FREQ IS_RTC_TAMPER_SAMPLING_FREQ +#define IS_TAMPER_TIMESTAMPONTAMPER_DETECTION IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION +#define IS_TAMPER_TRIGGER IS_RTC_TAMPER_TRIGGER +#define IS_WAKEUP_CLOCK IS_RTC_WAKEUP_CLOCK +#define IS_WAKEUP_COUNTER IS_RTC_WAKEUP_COUNTER + +#define __RTC_WRITEPROTECTION_ENABLE __HAL_RTC_WRITEPROTECTION_ENABLE +#define __RTC_WRITEPROTECTION_DISABLE __HAL_RTC_WRITEPROTECTION_DISABLE + +/** + * @} + */ + +/** @defgroup HAL_SD_Aliased_Macros HAL SD Aliased Macros maintained for legacy purpose + * @{ + */ + +#define SD_OCR_CID_CSD_OVERWRIETE SD_OCR_CID_CSD_OVERWRITE +#define SD_CMD_SD_APP_STAUS SD_CMD_SD_APP_STATUS + +#if defined(STM32F4) || defined(STM32F2) +#define SD_SDMMC_DISABLED SD_SDIO_DISABLED +#define SD_SDMMC_FUNCTION_BUSY SD_SDIO_FUNCTION_BUSY +#define SD_SDMMC_FUNCTION_FAILED SD_SDIO_FUNCTION_FAILED +#define SD_SDMMC_UNKNOWN_FUNCTION SD_SDIO_UNKNOWN_FUNCTION +#define SD_CMD_SDMMC_SEN_OP_COND SD_CMD_SDIO_SEN_OP_COND +#define SD_CMD_SDMMC_RW_DIRECT SD_CMD_SDIO_RW_DIRECT +#define SD_CMD_SDMMC_RW_EXTENDED SD_CMD_SDIO_RW_EXTENDED +#define __HAL_SD_SDMMC_ENABLE __HAL_SD_SDIO_ENABLE +#define __HAL_SD_SDMMC_DISABLE __HAL_SD_SDIO_DISABLE +#define __HAL_SD_SDMMC_DMA_ENABLE __HAL_SD_SDIO_DMA_ENABLE +#define __HAL_SD_SDMMC_DMA_DISABLE __HAL_SD_SDIO_DMA_DISABL +#define __HAL_SD_SDMMC_ENABLE_IT __HAL_SD_SDIO_ENABLE_IT +#define __HAL_SD_SDMMC_DISABLE_IT __HAL_SD_SDIO_DISABLE_IT +#define __HAL_SD_SDMMC_GET_FLAG __HAL_SD_SDIO_GET_FLAG +#define __HAL_SD_SDMMC_CLEAR_FLAG __HAL_SD_SDIO_CLEAR_FLAG +#define __HAL_SD_SDMMC_GET_IT __HAL_SD_SDIO_GET_IT +#define __HAL_SD_SDMMC_CLEAR_IT __HAL_SD_SDIO_CLEAR_IT +#define SDMMC_STATIC_FLAGS SDIO_STATIC_FLAGS +#define SDMMC_CMD0TIMEOUT SDIO_CMD0TIMEOUT +#define SD_SDMMC_SEND_IF_COND SD_SDIO_SEND_IF_COND +/* alias CMSIS */ +#define SDMMC1_IRQn SDIO_IRQn +#define SDMMC1_IRQHandler SDIO_IRQHandler +#endif + +#if defined(STM32F7) || defined(STM32L4) +#define SD_SDIO_DISABLED SD_SDMMC_DISABLED +#define SD_SDIO_FUNCTION_BUSY SD_SDMMC_FUNCTION_BUSY +#define SD_SDIO_FUNCTION_FAILED SD_SDMMC_FUNCTION_FAILED +#define SD_SDIO_UNKNOWN_FUNCTION SD_SDMMC_UNKNOWN_FUNCTION +#define SD_CMD_SDIO_SEN_OP_COND SD_CMD_SDMMC_SEN_OP_COND +#define SD_CMD_SDIO_RW_DIRECT SD_CMD_SDMMC_RW_DIRECT +#define SD_CMD_SDIO_RW_EXTENDED SD_CMD_SDMMC_RW_EXTENDED +#define __HAL_SD_SDIO_ENABLE __HAL_SD_SDMMC_ENABLE +#define __HAL_SD_SDIO_DISABLE __HAL_SD_SDMMC_DISABLE +#define __HAL_SD_SDIO_DMA_ENABLE __HAL_SD_SDMMC_DMA_ENABLE +#define __HAL_SD_SDIO_DMA_DISABL __HAL_SD_SDMMC_DMA_DISABLE +#define __HAL_SD_SDIO_ENABLE_IT __HAL_SD_SDMMC_ENABLE_IT +#define __HAL_SD_SDIO_DISABLE_IT __HAL_SD_SDMMC_DISABLE_IT +#define __HAL_SD_SDIO_GET_FLAG __HAL_SD_SDMMC_GET_FLAG +#define __HAL_SD_SDIO_CLEAR_FLAG __HAL_SD_SDMMC_CLEAR_FLAG +#define __HAL_SD_SDIO_GET_IT __HAL_SD_SDMMC_GET_IT +#define __HAL_SD_SDIO_CLEAR_IT __HAL_SD_SDMMC_CLEAR_IT +#define SDIO_STATIC_FLAGS SDMMC_STATIC_FLAGS +#define SDIO_CMD0TIMEOUT SDMMC_CMD0TIMEOUT +#define SD_SDIO_SEND_IF_COND SD_SDMMC_SEND_IF_COND +/* alias CMSIS for compatibilities */ +#define SDIO_IRQn SDMMC1_IRQn +#define SDIO_IRQHandler SDMMC1_IRQHandler +#endif + +#if defined(STM32F7) || defined(STM32F4) || defined(STM32F2) || defined(STM32L4) || defined(STM32H7) +#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) || defined(STM32L5) +#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 +/** + * @} + */ + +/** @defgroup HAL_SMARTCARD_Aliased_Macros HAL SMARTCARD Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __SMARTCARD_ENABLE_IT __HAL_SMARTCARD_ENABLE_IT +#define __SMARTCARD_DISABLE_IT __HAL_SMARTCARD_DISABLE_IT +#define __SMARTCARD_ENABLE __HAL_SMARTCARD_ENABLE +#define __SMARTCARD_DISABLE __HAL_SMARTCARD_DISABLE +#define __SMARTCARD_DMA_REQUEST_ENABLE __HAL_SMARTCARD_DMA_REQUEST_ENABLE +#define __SMARTCARD_DMA_REQUEST_DISABLE __HAL_SMARTCARD_DMA_REQUEST_DISABLE + +#define __HAL_SMARTCARD_GETCLOCKSOURCE SMARTCARD_GETCLOCKSOURCE +#define __SMARTCARD_GETCLOCKSOURCE SMARTCARD_GETCLOCKSOURCE + +#define IS_SMARTCARD_ONEBIT_SAMPLING IS_SMARTCARD_ONE_BIT_SAMPLE + +/** + * @} + */ + +/** @defgroup HAL_SMBUS_Aliased_Macros HAL SMBUS Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_SMBUS_RESET_CR1 SMBUS_RESET_CR1 +#define __HAL_SMBUS_RESET_CR2 SMBUS_RESET_CR2 +#define __HAL_SMBUS_GENERATE_START SMBUS_GENERATE_START +#define __HAL_SMBUS_GET_ADDR_MATCH SMBUS_GET_ADDR_MATCH +#define __HAL_SMBUS_GET_DIR SMBUS_GET_DIR +#define __HAL_SMBUS_GET_STOP_MODE SMBUS_GET_STOP_MODE +#define __HAL_SMBUS_GET_PEC_MODE SMBUS_GET_PEC_MODE +#define __HAL_SMBUS_GET_ALERT_ENABLED SMBUS_GET_ALERT_ENABLED +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Macros HAL SPI Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_SPI_1LINE_TX SPI_1LINE_TX +#define __HAL_SPI_1LINE_RX SPI_1LINE_RX +#define __HAL_SPI_RESET_CRC SPI_RESET_CRC + +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Macros HAL UART Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_UART_GETCLOCKSOURCE UART_GETCLOCKSOURCE +#define __HAL_UART_MASK_COMPUTATION UART_MASK_COMPUTATION +#define __UART_GETCLOCKSOURCE UART_GETCLOCKSOURCE +#define __UART_MASK_COMPUTATION UART_MASK_COMPUTATION + +#define IS_UART_WAKEUPMETHODE IS_UART_WAKEUPMETHOD + +#define IS_UART_ONEBIT_SAMPLE IS_UART_ONE_BIT_SAMPLE +#define IS_UART_ONEBIT_SAMPLING IS_UART_ONE_BIT_SAMPLE + +/** + * @} + */ + + +/** @defgroup HAL_USART_Aliased_Macros HAL USART Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __USART_ENABLE_IT __HAL_USART_ENABLE_IT +#define __USART_DISABLE_IT __HAL_USART_DISABLE_IT +#define __USART_ENABLE __HAL_USART_ENABLE +#define __USART_DISABLE __HAL_USART_DISABLE + +#define __HAL_USART_GETCLOCKSOURCE USART_GETCLOCKSOURCE +#define __USART_GETCLOCKSOURCE USART_GETCLOCKSOURCE + +/** + * @} + */ + +/** @defgroup HAL_USB_Aliased_Macros HAL USB Aliased Macros maintained for legacy purpose + * @{ + */ +#define USB_EXTI_LINE_WAKEUP USB_WAKEUP_EXTI_LINE + +#define USB_FS_EXTI_TRIGGER_RISING_EDGE USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE +#define USB_FS_EXTI_TRIGGER_FALLING_EDGE USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE +#define USB_FS_EXTI_TRIGGER_BOTH_EDGE USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE +#define USB_FS_EXTI_LINE_WAKEUP USB_OTG_FS_WAKEUP_EXTI_LINE + +#define USB_HS_EXTI_TRIGGER_RISING_EDGE USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE +#define USB_HS_EXTI_TRIGGER_FALLING_EDGE USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE +#define USB_HS_EXTI_TRIGGER_BOTH_EDGE USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE +#define USB_HS_EXTI_LINE_WAKEUP USB_OTG_HS_WAKEUP_EXTI_LINE + +#define __HAL_USB_EXTI_ENABLE_IT __HAL_USB_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_EXTI_DISABLE_IT __HAL_USB_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_EXTI_GET_FLAG __HAL_USB_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_EXTI_CLEAR_FLAG __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_EXTI_SET_RISING_EDGE_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_EXTI_SET_FALLING_EDGE_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE + +#define __HAL_USB_FS_EXTI_ENABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_FS_EXTI_DISABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_FS_EXTI_GET_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_FS_EXTI_CLEAR_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_FS_EXTI_SET_RISING_EGDE_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_FS_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_FS_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE +#define __HAL_USB_FS_EXTI_GENERATE_SWIT __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT + +#define __HAL_USB_HS_EXTI_ENABLE_IT __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_HS_EXTI_DISABLE_IT __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_HS_EXTI_GET_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_HS_EXTI_CLEAR_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_HS_EXTI_SET_RISING_EGDE_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_HS_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_HS_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE +#define __HAL_USB_HS_EXTI_GENERATE_SWIT __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT + +#define HAL_PCD_ActiveRemoteWakeup HAL_PCD_ActivateRemoteWakeup +#define HAL_PCD_DeActiveRemoteWakeup HAL_PCD_DeActivateRemoteWakeup + +#define HAL_PCD_SetTxFiFo HAL_PCDEx_SetTxFiFo +#define HAL_PCD_SetRxFiFo HAL_PCDEx_SetRxFiFo +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Macros HAL TIM Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_TIM_SetICPrescalerValue TIM_SET_ICPRESCALERVALUE +#define __HAL_TIM_ResetICPrescalerValue TIM_RESET_ICPRESCALERVALUE + +#define TIM_GET_ITSTATUS __HAL_TIM_GET_IT_SOURCE +#define TIM_GET_CLEAR_IT __HAL_TIM_CLEAR_IT + +#define __HAL_TIM_GET_ITSTATUS __HAL_TIM_GET_IT_SOURCE + +#define __HAL_TIM_DIRECTION_STATUS __HAL_TIM_IS_TIM_COUNTING_DOWN +#define __HAL_TIM_PRESCALER __HAL_TIM_SET_PRESCALER +#define __HAL_TIM_SetCounter __HAL_TIM_SET_COUNTER +#define __HAL_TIM_GetCounter __HAL_TIM_GET_COUNTER +#define __HAL_TIM_SetAutoreload __HAL_TIM_SET_AUTORELOAD +#define __HAL_TIM_GetAutoreload __HAL_TIM_GET_AUTORELOAD +#define __HAL_TIM_SetClockDivision __HAL_TIM_SET_CLOCKDIVISION +#define __HAL_TIM_GetClockDivision __HAL_TIM_GET_CLOCKDIVISION +#define __HAL_TIM_SetICPrescaler __HAL_TIM_SET_ICPRESCALER +#define __HAL_TIM_GetICPrescaler __HAL_TIM_GET_ICPRESCALER +#define __HAL_TIM_SetCompare __HAL_TIM_SET_COMPARE +#define __HAL_TIM_GetCompare __HAL_TIM_GET_COMPARE + +#define TIM_BREAKINPUTSOURCE_DFSDM TIM_BREAKINPUTSOURCE_DFSDM1 +/** + * @} + */ + +/** @defgroup HAL_ETH_Aliased_Macros HAL ETH Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_ETH_EXTI_ENABLE_IT __HAL_ETH_WAKEUP_EXTI_ENABLE_IT +#define __HAL_ETH_EXTI_DISABLE_IT __HAL_ETH_WAKEUP_EXTI_DISABLE_IT +#define __HAL_ETH_EXTI_GET_FLAG __HAL_ETH_WAKEUP_EXTI_GET_FLAG +#define __HAL_ETH_EXTI_CLEAR_FLAG __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_ETH_EXTI_SET_RISING_EGDE_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER +#define __HAL_ETH_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE_TRIGGER +#define __HAL_ETH_EXTI_SET_FALLINGRISING_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLINGRISING_TRIGGER + +#define ETH_PROMISCIOUSMODE_ENABLE ETH_PROMISCUOUS_MODE_ENABLE +#define ETH_PROMISCIOUSMODE_DISABLE ETH_PROMISCUOUS_MODE_DISABLE +#define IS_ETH_PROMISCIOUS_MODE IS_ETH_PROMISCUOUS_MODE +/** + * @} + */ + +/** @defgroup HAL_LTDC_Aliased_Macros HAL LTDC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_LTDC_LAYER LTDC_LAYER +#define __HAL_LTDC_RELOAD_CONFIG __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG +/** + * @} + */ + +/** @defgroup HAL_SAI_Aliased_Macros HAL SAI Aliased Macros maintained for legacy purpose + * @{ + */ +#define SAI_OUTPUTDRIVE_DISABLED SAI_OUTPUTDRIVE_DISABLE +#define SAI_OUTPUTDRIVE_ENABLED SAI_OUTPUTDRIVE_ENABLE +#define SAI_MASTERDIVIDER_ENABLED SAI_MASTERDIVIDER_ENABLE +#define SAI_MASTERDIVIDER_DISABLED SAI_MASTERDIVIDER_DISABLE +#define SAI_STREOMODE SAI_STEREOMODE +#define SAI_FIFOStatus_Empty SAI_FIFOSTATUS_EMPTY +#define SAI_FIFOStatus_Less1QuarterFull SAI_FIFOSTATUS_LESS1QUARTERFULL +#define SAI_FIFOStatus_1QuarterFull SAI_FIFOSTATUS_1QUARTERFULL +#define SAI_FIFOStatus_HalfFull SAI_FIFOSTATUS_HALFFULL +#define SAI_FIFOStatus_3QuartersFull SAI_FIFOSTATUS_3QUARTERFULL +#define SAI_FIFOStatus_Full SAI_FIFOSTATUS_FULL +#define IS_SAI_BLOCK_MONO_STREO_MODE IS_SAI_BLOCK_MONO_STEREO_MODE +#define SAI_SYNCHRONOUS_EXT SAI_SYNCHRONOUS_EXT_SAI1 +#define SAI_SYNCEXT_IN_ENABLE SAI_SYNCEXT_OUTBLOCKA_ENABLE +/** + * @} + */ + +/** @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 (STM32G4) || 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) || defined (STM32F4) || defined (STM32F7) +#define HAL_QPSI_TIMEOUT_DEFAULT_VALUE HAL_QSPI_TIMEOUT_DEFAULT_VALUE +#endif /* STM32L4 || STM32F4 || STM32F7 */ +/** + * @} + */ + +/** @defgroup HAL_PPP_Aliased_Macros HAL PPP Aliased Macros maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32_HAL_LEGACY */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h new file mode 100644 index 0000000..209864d --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h @@ -0,0 +1,298 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the HAL + * module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_H +#define __STM32F4xx_HAL_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_conf.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup HAL + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup HAL_Exported_Constants HAL Exported Constants + * @{ + */ + +/** @defgroup HAL_TICK_FREQ Tick Frequency + * @{ + */ +typedef enum +{ + HAL_TICK_FREQ_10HZ = 100U, + HAL_TICK_FREQ_100HZ = 10U, + HAL_TICK_FREQ_1KHZ = 1U, + HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ +} HAL_TickFreqTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup HAL_Exported_Macros HAL Exported Macros + * @{ + */ + +/** @brief Freeze/Unfreeze Peripherals in Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM3() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM4() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM5() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM6() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM7() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM12() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM13() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM14() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP)) +#define __HAL_DBGMCU_FREEZE_RTC() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP)) +#define __HAL_DBGMCU_FREEZE_WWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP)) +#define __HAL_DBGMCU_FREEZE_IWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP)) +#define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_FREEZE_CAN1() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP)) +#define __HAL_DBGMCU_FREEZE_CAN2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM1() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM8() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM9() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM10() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP)) +#define __HAL_DBGMCU_FREEZE_TIM11() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP)) + +#define __HAL_DBGMCU_UNFREEZE_TIM2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM3() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM4() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM5() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM6() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM7() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM12() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM13() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM14() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP)) +#define __HAL_DBGMCU_UNFREEZE_RTC() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP)) +#define __HAL_DBGMCU_UNFREEZE_WWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP)) +#define __HAL_DBGMCU_UNFREEZE_IWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP)) +#define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT)) +#define __HAL_DBGMCU_UNFREEZE_CAN1() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN1_STOP)) +#define __HAL_DBGMCU_UNFREEZE_CAN2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN2_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM1() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM1_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM8() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM8_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM9() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM9_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM10() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM10_STOP)) +#define __HAL_DBGMCU_UNFREEZE_TIM11() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM11_STOP)) + +/** @brief Main Flash memory mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_FLASH() (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE)) + +/** @brief System Flash memory mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\ + SYSCFG->MEMRMP |= SYSCFG_MEMRMP_MEM_MODE_0;\ + }while(0); + +/** @brief Embedded SRAM mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_SRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\ + SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_0 | SYSCFG_MEMRMP_MEM_MODE_1);\ + }while(0); + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) +/** @brief FSMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_FSMC() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\ + SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\ + }while(0); +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +/** @brief FMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_FMC() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\ + SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\ + }while(0); + +/** @brief FMC/SDRAM Bank 1 and 2 mapped at 0x00000000 + */ +#define __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\ + SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_2);\ + }while(0); +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup Cortex_Lockup_Enable Cortex Lockup Enable + * @{ + */ +/** @brief SYSCFG Break Lockup lock + * Enables and locks the connection of Cortex-M4 LOCKUP (Hardfault) output to TIM1/8 input + * @note The selected configuration is locked and can be unlocked by system reset + */ +#define __HAL_SYSCFG_BREAK_PVD_LOCK() do {SYSCFG->CFGR2 &= ~(SYSCFG_CFGR2_PVD_LOCK); \ + SYSCFG->CFGR2 |= SYSCFG_CFGR2_PVD_LOCK; \ + }while(0) +/** + * @} + */ + +/** @defgroup PVD_Lock_Enable PVD Lock + * @{ + */ +/** @brief SYSCFG Break PVD lock + * Enables and locks the PVD connection with Timer1/8 Break Input, , as well as the PVDE and PLS[2:0] in the PWR_CR register + * @note The selected configuration is locked and can be unlocked by system reset + */ +#define __HAL_SYSCFG_BREAK_LOCKUP_LOCK() do {SYSCFG->CFGR2 &= ~(SYSCFG_CFGR2_LOCKUP_LOCK); \ + SYSCFG->CFGR2 |= SYSCFG_CFGR2_LOCKUP_LOCK; \ + }while(0) +/** + * @} + */ +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup HAL_Private_Macros HAL Private Macros + * @{ + */ +#define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \ + ((FREQ) == HAL_TICK_FREQ_100HZ) || \ + ((FREQ) == HAL_TICK_FREQ_1KHZ)) +/** + * @} + */ + +/* Exported variables --------------------------------------------------------*/ + +/** @addtogroup HAL_Exported_Variables + * @{ + */ +extern __IO uint32_t uwTick; +extern uint32_t uwTickPrio; +extern HAL_TickFreqTypeDef uwTickFreq; +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_Exported_Functions + * @{ + */ +/** @addtogroup HAL_Exported_Functions_Group1 + * @{ + */ +/* Initialization and Configuration functions ******************************/ +HAL_StatusTypeDef HAL_Init(void); +HAL_StatusTypeDef HAL_DeInit(void); +void HAL_MspInit(void); +void HAL_MspDeInit(void); +HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority); +/** + * @} + */ + +/** @addtogroup HAL_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ************************************************/ +void HAL_IncTick(void); +void HAL_Delay(uint32_t Delay); +uint32_t HAL_GetTick(void); +uint32_t HAL_GetTickPrio(void); +HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); +HAL_TickFreqTypeDef HAL_GetTickFreq(void); +void HAL_SuspendTick(void); +void HAL_ResumeTick(void); +uint32_t HAL_GetHalVersion(void); +uint32_t HAL_GetREVID(void); +uint32_t HAL_GetDEVID(void); +void HAL_DBGMCU_EnableDBGSleepMode(void); +void HAL_DBGMCU_DisableDBGSleepMode(void); +void HAL_DBGMCU_EnableDBGStopMode(void); +void HAL_DBGMCU_DisableDBGStopMode(void); +void HAL_DBGMCU_EnableDBGStandbyMode(void); +void HAL_DBGMCU_DisableDBGStandbyMode(void); +void HAL_EnableCompensationCell(void); +void HAL_DisableCompensationCell(void); +uint32_t HAL_GetUIDw0(void); +uint32_t HAL_GetUIDw1(void); +uint32_t HAL_GetUIDw2(void); +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +void HAL_EnableMemorySwappingBank(void); +void HAL_DisableMemorySwappingBank(void); +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup HAL_Private_Variables HAL Private Variables + * @{ + */ +/** + * @} + */ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup HAL_Private_Constants HAL Private Constants + * @{ + */ +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h new file mode 100644 index 0000000..0611a65 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h @@ -0,0 +1,848 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_can.h + * @author MCD Application Team + * @brief Header file of CAN HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F4xx_HAL_CAN_H +#define STM32F4xx_HAL_CAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +#if defined (CAN1) +/** @addtogroup CAN + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CAN_Exported_Types CAN Exported Types + * @{ + */ +/** + * @brief HAL State structures definition + */ +typedef enum +{ + HAL_CAN_STATE_RESET = 0x00U, /*!< CAN not yet initialized or disabled */ + HAL_CAN_STATE_READY = 0x01U, /*!< CAN initialized and ready for use */ + HAL_CAN_STATE_LISTENING = 0x02U, /*!< CAN receive process is ongoing */ + HAL_CAN_STATE_SLEEP_PENDING = 0x03U, /*!< CAN sleep request is pending */ + HAL_CAN_STATE_SLEEP_ACTIVE = 0x04U, /*!< CAN sleep mode is active */ + HAL_CAN_STATE_ERROR = 0x05U /*!< CAN error state */ + +} HAL_CAN_StateTypeDef; + +/** + * @brief CAN init structure definition + */ +typedef struct +{ + uint32_t Prescaler; /*!< Specifies the length of a time quantum. + This parameter must be a number between Min_Data = 1 and Max_Data = 1024. */ + + uint32_t Mode; /*!< Specifies the CAN operating mode. + This parameter can be a value of @ref CAN_operating_mode */ + + uint32_t SyncJumpWidth; /*!< Specifies the maximum number of time quanta the CAN hardware + is allowed to lengthen or shorten a bit to perform resynchronization. + This parameter can be a value of @ref CAN_synchronisation_jump_width */ + + uint32_t TimeSeg1; /*!< Specifies the number of time quanta in Bit Segment 1. + This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ + + uint32_t TimeSeg2; /*!< Specifies the number of time quanta in Bit Segment 2. + This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ + + FunctionalState TimeTriggeredMode; /*!< Enable or disable the time triggered communication mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoBusOff; /*!< Enable or disable the automatic bus-off management. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoWakeUp; /*!< Enable or disable the automatic wake-up mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoRetransmission; /*!< Enable or disable the non-automatic retransmission mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState ReceiveFifoLocked; /*!< Enable or disable the Receive FIFO Locked mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState TransmitFifoPriority;/*!< Enable or disable the transmit FIFO priority. + This parameter can be set to ENABLE or DISABLE. */ + +} CAN_InitTypeDef; + +/** + * @brief CAN filter configuration structure definition + */ +typedef struct +{ + uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit + configuration, first one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit + configuration, second one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, + according to the mode (MSBs for a 32-bit configuration, + first one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, + according to the mode (LSBs for a 32-bit configuration, + second one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1U) which will be assigned to the filter. + This parameter can be a value of @ref CAN_filter_FIFO */ + + uint32_t FilterBank; /*!< Specifies the filter bank which will be initialized. + For single CAN instance(14 dedicated filter banks), + this parameter must be a number between Min_Data = 0 and Max_Data = 13. + For dual CAN instances(28 filter banks shared), + this parameter must be a number between Min_Data = 0 and Max_Data = 27. */ + + uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. + This parameter can be a value of @ref CAN_filter_mode */ + + uint32_t FilterScale; /*!< Specifies the filter scale. + This parameter can be a value of @ref CAN_filter_scale */ + + uint32_t FilterActivation; /*!< Enable or disable the filter. + This parameter can be a value of @ref CAN_filter_activation */ + + uint32_t SlaveStartFilterBank; /*!< Select the start filter bank for the slave CAN instance. + For single CAN instances, this parameter is meaningless. + For dual CAN instances, all filter banks with lower index are assigned to master + CAN instance, whereas all filter banks with greater index are assigned to slave + CAN instance. + This parameter must be a number between Min_Data = 0 and Max_Data = 27. */ + +} CAN_FilterTypeDef; + +/** + * @brief CAN Tx message header structure definition + */ +typedef struct +{ + uint32_t StdId; /*!< Specifies the standard identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ + + uint32_t ExtId; /*!< Specifies the extended identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ + + uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. + This parameter can be a value of @ref CAN_identifier_type */ + + uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. + This parameter can be a value of @ref CAN_remote_transmission_request */ + + uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. + This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ + + FunctionalState TransmitGlobalTime; /*!< Specifies whether the timestamp counter value captured on start + of frame transmission, is sent in DATA6 and DATA7 replacing pData[6] and pData[7]. + @note: Time Triggered Communication Mode must be enabled. + @note: DLC must be programmed as 8 bytes, in order these 2 bytes are sent. + This parameter can be set to ENABLE or DISABLE. */ + +} CAN_TxHeaderTypeDef; + +/** + * @brief CAN Rx message header structure definition + */ +typedef struct +{ + uint32_t StdId; /*!< Specifies the standard identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ + + uint32_t ExtId; /*!< Specifies the extended identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ + + uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. + This parameter can be a value of @ref CAN_identifier_type */ + + uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. + This parameter can be a value of @ref CAN_remote_transmission_request */ + + uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. + This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ + + uint32_t Timestamp; /*!< Specifies the timestamp counter value captured on start of frame reception. + @note: Time Triggered Communication Mode must be enabled. + This parameter must be a number between Min_Data = 0 and Max_Data = 0xFFFF. */ + + uint32_t FilterMatchIndex; /*!< Specifies the index of matching acceptance filter element. + This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */ + +} CAN_RxHeaderTypeDef; + +/** + * @brief CAN handle Structure definition + */ +typedef struct __CAN_HandleTypeDef +{ + CAN_TypeDef *Instance; /*!< Register base address */ + + CAN_InitTypeDef Init; /*!< CAN required parameters */ + + __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ + + __IO uint32_t ErrorCode; /*!< CAN Error code. + This parameter can be a value of @ref CAN_Error_Code */ + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + void (* TxMailbox0CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 0 complete callback */ + void (* TxMailbox1CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 1 complete callback */ + void (* TxMailbox2CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 2 complete callback */ + void (* TxMailbox0AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 0 abort callback */ + void (* TxMailbox1AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 1 abort callback */ + void (* TxMailbox2AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 2 abort callback */ + void (* RxFifo0MsgPendingCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 0 msg pending callback */ + void (* RxFifo0FullCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 0 full callback */ + void (* RxFifo1MsgPendingCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 1 msg pending callback */ + void (* RxFifo1FullCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 1 full callback */ + void (* SleepCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Sleep callback */ + void (* WakeUpFromRxMsgCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Wake Up from Rx msg callback */ + void (* ErrorCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Error callback */ + + void (* MspInitCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Msp Init callback */ + void (* MspDeInitCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Msp DeInit callback */ + +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ +} CAN_HandleTypeDef; + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/** + * @brief HAL CAN common Callback ID enumeration definition + */ +typedef enum +{ + HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID = 0x00U, /*!< CAN Tx Mailbox 0 complete callback ID */ + HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID = 0x01U, /*!< CAN Tx Mailbox 1 complete callback ID */ + HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID = 0x02U, /*!< CAN Tx Mailbox 2 complete callback ID */ + HAL_CAN_TX_MAILBOX0_ABORT_CB_ID = 0x03U, /*!< CAN Tx Mailbox 0 abort callback ID */ + HAL_CAN_TX_MAILBOX1_ABORT_CB_ID = 0x04U, /*!< CAN Tx Mailbox 1 abort callback ID */ + HAL_CAN_TX_MAILBOX2_ABORT_CB_ID = 0x05U, /*!< CAN Tx Mailbox 2 abort callback ID */ + HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID = 0x06U, /*!< CAN Rx FIFO 0 message pending callback ID */ + HAL_CAN_RX_FIFO0_FULL_CB_ID = 0x07U, /*!< CAN Rx FIFO 0 full callback ID */ + HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID = 0x08U, /*!< CAN Rx FIFO 1 message pending callback ID */ + HAL_CAN_RX_FIFO1_FULL_CB_ID = 0x09U, /*!< CAN Rx FIFO 1 full callback ID */ + HAL_CAN_SLEEP_CB_ID = 0x0AU, /*!< CAN Sleep callback ID */ + HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID = 0x0BU, /*!< CAN Wake Up fropm Rx msg callback ID */ + HAL_CAN_ERROR_CB_ID = 0x0CU, /*!< CAN Error callback ID */ + + HAL_CAN_MSPINIT_CB_ID = 0x0DU, /*!< CAN MspInit callback ID */ + HAL_CAN_MSPDEINIT_CB_ID = 0x0EU, /*!< CAN MspDeInit callback ID */ + +} HAL_CAN_CallbackIDTypeDef; + +/** + * @brief HAL CAN Callback pointer definition + */ +typedef void (*pCAN_CallbackTypeDef)(CAN_HandleTypeDef *hcan); /*!< pointer to a CAN callback function */ + +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup CAN_Exported_Constants CAN Exported Constants + * @{ + */ + +/** @defgroup CAN_Error_Code CAN Error Code + * @{ + */ +#define HAL_CAN_ERROR_NONE (0x00000000U) /*!< No error */ +#define HAL_CAN_ERROR_EWG (0x00000001U) /*!< Protocol Error Warning */ +#define HAL_CAN_ERROR_EPV (0x00000002U) /*!< Error Passive */ +#define HAL_CAN_ERROR_BOF (0x00000004U) /*!< Bus-off error */ +#define HAL_CAN_ERROR_STF (0x00000008U) /*!< Stuff error */ +#define HAL_CAN_ERROR_FOR (0x00000010U) /*!< Form error */ +#define HAL_CAN_ERROR_ACK (0x00000020U) /*!< Acknowledgment error */ +#define HAL_CAN_ERROR_BR (0x00000040U) /*!< Bit recessive error */ +#define HAL_CAN_ERROR_BD (0x00000080U) /*!< Bit dominant error */ +#define HAL_CAN_ERROR_CRC (0x00000100U) /*!< CRC error */ +#define HAL_CAN_ERROR_RX_FOV0 (0x00000200U) /*!< Rx FIFO0 overrun error */ +#define HAL_CAN_ERROR_RX_FOV1 (0x00000400U) /*!< Rx FIFO1 overrun error */ +#define HAL_CAN_ERROR_TX_ALST0 (0x00000800U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR0 (0x00001000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ +#define HAL_CAN_ERROR_TX_ALST1 (0x00002000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR1 (0x00004000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ +#define HAL_CAN_ERROR_TX_ALST2 (0x00008000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR2 (0x00010000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ +#define HAL_CAN_ERROR_TIMEOUT (0x00020000U) /*!< Timeout error */ +#define HAL_CAN_ERROR_NOT_INITIALIZED (0x00040000U) /*!< Peripheral not initialized */ +#define HAL_CAN_ERROR_NOT_READY (0x00080000U) /*!< Peripheral not ready */ +#define HAL_CAN_ERROR_NOT_STARTED (0x00100000U) /*!< Peripheral not started */ +#define HAL_CAN_ERROR_PARAM (0x00200000U) /*!< Parameter error */ + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +#define HAL_CAN_ERROR_INVALID_CALLBACK (0x00400000U) /*!< Invalid Callback error */ +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ +#define HAL_CAN_ERROR_INTERNAL (0x00800000U) /*!< Internal error */ + +/** + * @} + */ + +/** @defgroup CAN_InitStatus CAN InitStatus + * @{ + */ +#define CAN_INITSTATUS_FAILED (0x00000000U) /*!< CAN initialization failed */ +#define CAN_INITSTATUS_SUCCESS (0x00000001U) /*!< CAN initialization OK */ +/** + * @} + */ + +/** @defgroup CAN_operating_mode CAN Operating Mode + * @{ + */ +#define CAN_MODE_NORMAL (0x00000000U) /*!< Normal mode */ +#define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ +#define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ +#define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ +/** + * @} + */ + + +/** @defgroup CAN_synchronisation_jump_width CAN Synchronization Jump Width + * @{ + */ +#define CAN_SJW_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ +#define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ +#define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in Bit Segment 1 + * @{ + */ +#define CAN_BS1_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ +#define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ +#define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ +#define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ +#define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ +#define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ +#define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ +#define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ +#define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ +#define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ +#define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ +#define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ +#define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ +#define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ +#define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in Bit Segment 2 + * @{ + */ +#define CAN_BS2_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ +#define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ +#define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ +#define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ +#define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ +#define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ +#define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_filter_mode CAN Filter Mode + * @{ + */ +#define CAN_FILTERMODE_IDMASK (0x00000000U) /*!< Identifier mask mode */ +#define CAN_FILTERMODE_IDLIST (0x00000001U) /*!< Identifier list mode */ +/** + * @} + */ + +/** @defgroup CAN_filter_scale CAN Filter Scale + * @{ + */ +#define CAN_FILTERSCALE_16BIT (0x00000000U) /*!< Two 16-bit filters */ +#define CAN_FILTERSCALE_32BIT (0x00000001U) /*!< One 32-bit filter */ +/** + * @} + */ + +/** @defgroup CAN_filter_activation CAN Filter Activation + * @{ + */ +#define CAN_FILTER_DISABLE (0x00000000U) /*!< Disable filter */ +#define CAN_FILTER_ENABLE (0x00000001U) /*!< Enable filter */ +/** + * @} + */ + +/** @defgroup CAN_filter_FIFO CAN Filter FIFO + * @{ + */ +#define CAN_FILTER_FIFO0 (0x00000000U) /*!< Filter FIFO 0 assignment for filter x */ +#define CAN_FILTER_FIFO1 (0x00000001U) /*!< Filter FIFO 1 assignment for filter x */ +/** + * @} + */ + +/** @defgroup CAN_identifier_type CAN Identifier Type + * @{ + */ +#define CAN_ID_STD (0x00000000U) /*!< Standard Id */ +#define CAN_ID_EXT (0x00000004U) /*!< Extended Id */ +/** + * @} + */ + +/** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request + * @{ + */ +#define CAN_RTR_DATA (0x00000000U) /*!< Data frame */ +#define CAN_RTR_REMOTE (0x00000002U) /*!< Remote frame */ +/** + * @} + */ + +/** @defgroup CAN_receive_FIFO_number CAN Receive FIFO Number + * @{ + */ +#define CAN_RX_FIFO0 (0x00000000U) /*!< CAN receive FIFO 0 */ +#define CAN_RX_FIFO1 (0x00000001U) /*!< CAN receive FIFO 1 */ +/** + * @} + */ + +/** @defgroup CAN_Tx_Mailboxes CAN Tx Mailboxes + * @{ + */ +#define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */ +#define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */ +#define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */ +/** + * @} + */ + +/** @defgroup CAN_flags CAN Flags + * @{ + */ +/* Transmit Flags */ +#define CAN_FLAG_RQCP0 (0x00000500U) /*!< Request complete MailBox 0 flag */ +#define CAN_FLAG_TXOK0 (0x00000501U) /*!< Transmission OK MailBox 0 flag */ +#define CAN_FLAG_ALST0 (0x00000502U) /*!< Arbitration Lost MailBox 0 flag */ +#define CAN_FLAG_TERR0 (0x00000503U) /*!< Transmission error MailBox 0 flag */ +#define CAN_FLAG_RQCP1 (0x00000508U) /*!< Request complete MailBox1 flag */ +#define CAN_FLAG_TXOK1 (0x00000509U) /*!< Transmission OK MailBox 1 flag */ +#define CAN_FLAG_ALST1 (0x0000050AU) /*!< Arbitration Lost MailBox 1 flag */ +#define CAN_FLAG_TERR1 (0x0000050BU) /*!< Transmission error MailBox 1 flag */ +#define CAN_FLAG_RQCP2 (0x00000510U) /*!< Request complete MailBox2 flag */ +#define CAN_FLAG_TXOK2 (0x00000511U) /*!< Transmission OK MailBox 2 flag */ +#define CAN_FLAG_ALST2 (0x00000512U) /*!< Arbitration Lost MailBox 2 flag */ +#define CAN_FLAG_TERR2 (0x00000513U) /*!< Transmission error MailBox 2 flag */ +#define CAN_FLAG_TME0 (0x0000051AU) /*!< Transmit mailbox 0 empty flag */ +#define CAN_FLAG_TME1 (0x0000051BU) /*!< Transmit mailbox 1 empty flag */ +#define CAN_FLAG_TME2 (0x0000051CU) /*!< Transmit mailbox 2 empty flag */ +#define CAN_FLAG_LOW0 (0x0000051DU) /*!< Lowest priority mailbox 0 flag */ +#define CAN_FLAG_LOW1 (0x0000051EU) /*!< Lowest priority mailbox 1 flag */ +#define CAN_FLAG_LOW2 (0x0000051FU) /*!< Lowest priority mailbox 2 flag */ + +/* Receive Flags */ +#define CAN_FLAG_FF0 (0x00000203U) /*!< RX FIFO 0 Full flag */ +#define CAN_FLAG_FOV0 (0x00000204U) /*!< RX FIFO 0 Overrun flag */ +#define CAN_FLAG_FF1 (0x00000403U) /*!< RX FIFO 1 Full flag */ +#define CAN_FLAG_FOV1 (0x00000404U) /*!< RX FIFO 1 Overrun flag */ + +/* Operating Mode Flags */ +#define CAN_FLAG_INAK (0x00000100U) /*!< Initialization acknowledge flag */ +#define CAN_FLAG_SLAK (0x00000101U) /*!< Sleep acknowledge flag */ +#define CAN_FLAG_ERRI (0x00000102U) /*!< Error flag */ +#define CAN_FLAG_WKU (0x00000103U) /*!< Wake up interrupt flag */ +#define CAN_FLAG_SLAKI (0x00000104U) /*!< Sleep acknowledge interrupt flag */ + +/* Error Flags */ +#define CAN_FLAG_EWG (0x00000300U) /*!< Error warning flag */ +#define CAN_FLAG_EPV (0x00000301U) /*!< Error passive flag */ +#define CAN_FLAG_BOF (0x00000302U) /*!< Bus-Off flag */ +/** + * @} + */ + + +/** @defgroup CAN_Interrupts CAN Interrupts + * @{ + */ +/* Transmit Interrupt */ +#define CAN_IT_TX_MAILBOX_EMPTY ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ + +/* Receive Interrupts */ +#define CAN_IT_RX_FIFO0_MSG_PENDING ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ +#define CAN_IT_RX_FIFO0_FULL ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ +#define CAN_IT_RX_FIFO0_OVERRUN ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ +#define CAN_IT_RX_FIFO1_MSG_PENDING ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ +#define CAN_IT_RX_FIFO1_FULL ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ +#define CAN_IT_RX_FIFO1_OVERRUN ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ + +/* Operating Mode Interrupts */ +#define CAN_IT_WAKEUP ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ +#define CAN_IT_SLEEP_ACK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ + +/* Error Interrupts */ +#define CAN_IT_ERROR_WARNING ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ +#define CAN_IT_ERROR_PASSIVE ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ +#define CAN_IT_BUSOFF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ +#define CAN_IT_LAST_ERROR_CODE ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ +#define CAN_IT_ERROR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup CAN_Exported_Macros CAN Exported Macros + * @{ + */ + +/** @brief Reset CAN handle state + * @param __HANDLE__ CAN handle. + * @retval None + */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +#define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) do{ \ + (__HANDLE__)->State = HAL_CAN_STATE_RESET; \ + (__HANDLE__)->MspInitCallback = NULL; \ + (__HANDLE__)->MspDeInitCallback = NULL; \ + } while(0) +#else +#define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) +#endif /*USE_HAL_CAN_REGISTER_CALLBACKS */ + +/** + * @brief Enable the specified CAN interrupts. + * @param __HANDLE__ CAN handle. + * @param __INTERRUPT__ CAN Interrupt sources to enable. + * This parameter can be any combination of @arg CAN_Interrupts + * @retval None + */ +#define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) + +/** + * @brief Disable the specified CAN interrupts. + * @param __HANDLE__ CAN handle. + * @param __INTERRUPT__ CAN Interrupt sources to disable. + * This parameter can be any combination of @arg CAN_Interrupts + * @retval None + */ +#define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) + +/** @brief Check if the specified CAN interrupt source is enabled or disabled. + * @param __HANDLE__ specifies the CAN Handle. + * @param __INTERRUPT__ specifies the CAN interrupt source to check. + * This parameter can be a value of @arg CAN_Interrupts + * @retval The state of __IT__ (TRUE or FALSE). + */ +#define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) & (__INTERRUPT__)) + +/** @brief Check whether the specified CAN flag is set or not. + * @param __HANDLE__ specifies the CAN Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of @arg CAN_flags + * @retval The state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ + ((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 3U)? ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) + +/** @brief Clear the specified CAN pending flag. + * @param __HANDLE__ specifies the CAN Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg CAN_FLAG_RQCP0: Request complete MailBox 0 Flag + * @arg CAN_FLAG_TXOK0: Transmission OK MailBox 0 Flag + * @arg CAN_FLAG_ALST0: Arbitration Lost MailBox 0 Flag + * @arg CAN_FLAG_TERR0: Transmission error MailBox 0 Flag + * @arg CAN_FLAG_RQCP1: Request complete MailBox 1 Flag + * @arg CAN_FLAG_TXOK1: Transmission OK MailBox 1 Flag + * @arg CAN_FLAG_ALST1: Arbitration Lost MailBox 1 Flag + * @arg CAN_FLAG_TERR1: Transmission error MailBox 1 Flag + * @arg CAN_FLAG_RQCP2: Request complete MailBox 2 Flag + * @arg CAN_FLAG_TXOK2: Transmission OK MailBox 2 Flag + * @arg CAN_FLAG_ALST2: Arbitration Lost MailBox 2 Flag + * @arg CAN_FLAG_TERR2: Transmission error MailBox 2 Flag + * @arg CAN_FLAG_FF0: RX FIFO 0 Full Flag + * @arg CAN_FLAG_FOV0: RX FIFO 0 Overrun Flag + * @arg CAN_FLAG_FF1: RX FIFO 1 Full Flag + * @arg CAN_FLAG_FOV1: RX FIFO 1 Overrun Flag + * @arg CAN_FLAG_WKUI: Wake up Interrupt Flag + * @arg CAN_FLAG_SLAKI: Sleep acknowledge Interrupt Flag + * @retval None + */ +#define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ + ((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 1U)? (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CAN_Exported_Functions CAN Exported Functions + * @{ + */ + +/** @addtogroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/* Initialization and de-initialization functions *****************************/ +HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan); +void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan); +void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/* Callbacks Register/UnRegister functions ***********************************/ +HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID, void (* pCallback)(CAN_HandleTypeDef *_hcan)); +HAL_StatusTypeDef HAL_CAN_UnRegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID); + +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group2 Configuration functions + * @brief Configuration functions + * @{ + */ + +/* Configuration functions ****************************************************/ +HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group3 Control functions + * @brief Control functions + * @{ + */ + +/* Control functions **********************************************************/ +HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox); +HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); +uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); +uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox); +HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]); +uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group4 Interrupts management + * @brief Interrupts management + * @{ + */ +/* Interrupts management ******************************************************/ +HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs); +HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs); +void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group5 Callback functions + * @brief Callback functions + * @{ + */ +/* Callbacks functions ********************************************************/ + +void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group6 Peripheral State and Error functions + * @brief CAN Peripheral State functions + * @{ + */ +/* Peripheral State and Error functions ***************************************/ +HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/** @defgroup CAN_Private_Types CAN Private Types + * @{ + */ + +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/** @defgroup CAN_Private_Variables CAN Private Variables + * @{ + */ + +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup CAN_Private_Constants CAN Private Constants + * @{ + */ +#define CAN_FLAG_MASK (0x000000FFU) +/** + * @} + */ + +/* Private Macros -----------------------------------------------------------*/ +/** @defgroup CAN_Private_Macros CAN Private Macros + * @{ + */ + +#define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ + ((MODE) == CAN_MODE_LOOPBACK)|| \ + ((MODE) == CAN_MODE_SILENT) || \ + ((MODE) == CAN_MODE_SILENT_LOOPBACK)) +#define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ) || \ + ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) +#define IS_CAN_BS1(BS1) (((BS1) == CAN_BS1_1TQ) || ((BS1) == CAN_BS1_2TQ) || \ + ((BS1) == CAN_BS1_3TQ) || ((BS1) == CAN_BS1_4TQ) || \ + ((BS1) == CAN_BS1_5TQ) || ((BS1) == CAN_BS1_6TQ) || \ + ((BS1) == CAN_BS1_7TQ) || ((BS1) == CAN_BS1_8TQ) || \ + ((BS1) == CAN_BS1_9TQ) || ((BS1) == CAN_BS1_10TQ)|| \ + ((BS1) == CAN_BS1_11TQ)|| ((BS1) == CAN_BS1_12TQ)|| \ + ((BS1) == CAN_BS1_13TQ)|| ((BS1) == CAN_BS1_14TQ)|| \ + ((BS1) == CAN_BS1_15TQ)|| ((BS1) == CAN_BS1_16TQ)) +#define IS_CAN_BS2(BS2) (((BS2) == CAN_BS2_1TQ) || ((BS2) == CAN_BS2_2TQ) || \ + ((BS2) == CAN_BS2_3TQ) || ((BS2) == CAN_BS2_4TQ) || \ + ((BS2) == CAN_BS2_5TQ) || ((BS2) == CAN_BS2_6TQ) || \ + ((BS2) == CAN_BS2_7TQ) || ((BS2) == CAN_BS2_8TQ)) +#define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U)) +#define IS_CAN_FILTER_ID_HALFWORD(HALFWORD) ((HALFWORD) <= 0xFFFFU) +#define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 27U) +#define IS_CAN_FILTER_BANK_SINGLE(BANK) ((BANK) <= 13U) +#define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ + ((MODE) == CAN_FILTERMODE_IDLIST)) +#define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ + ((SCALE) == CAN_FILTERSCALE_32BIT)) +#define IS_CAN_FILTER_ACTIVATION(ACTIVATION) (((ACTIVATION) == CAN_FILTER_DISABLE) || \ + ((ACTIVATION) == CAN_FILTER_ENABLE)) +#define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ + ((FIFO) == CAN_FILTER_FIFO1)) +#define IS_CAN_TX_MAILBOX(TRANSMITMAILBOX) (((TRANSMITMAILBOX) == CAN_TX_MAILBOX0 ) || \ + ((TRANSMITMAILBOX) == CAN_TX_MAILBOX1 ) || \ + ((TRANSMITMAILBOX) == CAN_TX_MAILBOX2 )) +#define IS_CAN_TX_MAILBOX_LIST(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= (CAN_TX_MAILBOX0 | CAN_TX_MAILBOX1 | CAN_TX_MAILBOX2)) +#define IS_CAN_STDID(STDID) ((STDID) <= 0x7FFU) +#define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU) +#define IS_CAN_DLC(DLC) ((DLC) <= 8U) +#define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ + ((IDTYPE) == CAN_ID_EXT)) +#define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) +#define IS_CAN_RX_FIFO(FIFO) (((FIFO) == CAN_RX_FIFO0) || ((FIFO) == CAN_RX_FIFO1)) +#define IS_CAN_IT(IT) ((IT) <= (CAN_IT_TX_MAILBOX_EMPTY | CAN_IT_RX_FIFO0_MSG_PENDING | \ + CAN_IT_RX_FIFO0_FULL | CAN_IT_RX_FIFO0_OVERRUN | \ + CAN_IT_RX_FIFO1_MSG_PENDING | CAN_IT_RX_FIFO1_FULL | \ + CAN_IT_RX_FIFO1_OVERRUN | CAN_IT_WAKEUP | \ + CAN_IT_SLEEP_ACK | CAN_IT_ERROR_WARNING | \ + CAN_IT_ERROR_PASSIVE | CAN_IT_BUSOFF | \ + CAN_IT_LAST_ERROR_CODE | CAN_IT_ERROR)) + +/** + * @} + */ +/* End of private macros -----------------------------------------------------*/ + +/** + * @} + */ + + +#endif /* CAN1 */ +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F4xx_HAL_CAN_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h new file mode 100644 index 0000000..95218cf --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h @@ -0,0 +1,410 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_cortex.h + * @author MCD Application Team + * @brief Header file of CORTEX HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_CORTEX_H +#define __STM32F4xx_HAL_CORTEX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup CORTEX + * @{ + */ +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CORTEX_Exported_Types Cortex Exported Types + * @{ + */ + +#if (__MPU_PRESENT == 1U) +/** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition + * @brief MPU Region initialization structure + * @{ + */ +typedef struct +{ + uint8_t Enable; /*!< Specifies the status of the region. + This parameter can be a value of @ref CORTEX_MPU_Region_Enable */ + uint8_t Number; /*!< Specifies the number of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Number */ + uint32_t BaseAddress; /*!< Specifies the base address of the region to protect. */ + uint8_t Size; /*!< Specifies the size of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Size */ + uint8_t SubRegionDisable; /*!< Specifies the number of the subregion protection to disable. + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ + uint8_t TypeExtField; /*!< Specifies the TEX field level. + This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */ + uint8_t AccessPermission; /*!< Specifies the region access permission type. + This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */ + uint8_t DisableExec; /*!< Specifies the instruction access status. + This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */ + uint8_t IsShareable; /*!< Specifies the shareability status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */ + uint8_t IsCacheable; /*!< Specifies the cacheable status of the region protected. + This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */ + uint8_t IsBufferable; /*!< Specifies the bufferable status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */ +}MPU_Region_InitTypeDef; +/** + * @} + */ +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants + * @{ + */ + +/** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group + * @{ + */ +#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority + 4 bits for subpriority */ +#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority + 3 bits for subpriority */ +#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority + 2 bits for subpriority */ +#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority + 1 bits for subpriority */ +#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority + 0 bits for subpriority */ +/** + * @} + */ + +/** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source + * @{ + */ +#define SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U +#define SYSTICK_CLKSOURCE_HCLK 0x00000004U + +/** + * @} + */ + +#if (__MPU_PRESENT == 1) +/** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control + * @{ + */ +#define MPU_HFNMI_PRIVDEF_NONE 0x00000000U +#define MPU_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk +#define MPU_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk +#define MPU_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) + +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable + * @{ + */ +#define MPU_REGION_ENABLE ((uint8_t)0x01) +#define MPU_REGION_DISABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access + * @{ + */ +#define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00) +#define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable + * @{ + */ +#define MPU_ACCESS_SHAREABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable + * @{ + */ +#define MPU_ACCESS_CACHEABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable + * @{ + */ +#define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels + * @{ + */ +#define MPU_TEX_LEVEL0 ((uint8_t)0x00) +#define MPU_TEX_LEVEL1 ((uint8_t)0x01) +#define MPU_TEX_LEVEL2 ((uint8_t)0x02) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size + * @{ + */ +#define MPU_REGION_SIZE_32B ((uint8_t)0x04) +#define MPU_REGION_SIZE_64B ((uint8_t)0x05) +#define MPU_REGION_SIZE_128B ((uint8_t)0x06) +#define MPU_REGION_SIZE_256B ((uint8_t)0x07) +#define MPU_REGION_SIZE_512B ((uint8_t)0x08) +#define MPU_REGION_SIZE_1KB ((uint8_t)0x09) +#define MPU_REGION_SIZE_2KB ((uint8_t)0x0A) +#define MPU_REGION_SIZE_4KB ((uint8_t)0x0B) +#define MPU_REGION_SIZE_8KB ((uint8_t)0x0C) +#define MPU_REGION_SIZE_16KB ((uint8_t)0x0D) +#define MPU_REGION_SIZE_32KB ((uint8_t)0x0E) +#define MPU_REGION_SIZE_64KB ((uint8_t)0x0F) +#define MPU_REGION_SIZE_128KB ((uint8_t)0x10) +#define MPU_REGION_SIZE_256KB ((uint8_t)0x11) +#define MPU_REGION_SIZE_512KB ((uint8_t)0x12) +#define MPU_REGION_SIZE_1MB ((uint8_t)0x13) +#define MPU_REGION_SIZE_2MB ((uint8_t)0x14) +#define MPU_REGION_SIZE_4MB ((uint8_t)0x15) +#define MPU_REGION_SIZE_8MB ((uint8_t)0x16) +#define MPU_REGION_SIZE_16MB ((uint8_t)0x17) +#define MPU_REGION_SIZE_32MB ((uint8_t)0x18) +#define MPU_REGION_SIZE_64MB ((uint8_t)0x19) +#define MPU_REGION_SIZE_128MB ((uint8_t)0x1A) +#define MPU_REGION_SIZE_256MB ((uint8_t)0x1B) +#define MPU_REGION_SIZE_512MB ((uint8_t)0x1C) +#define MPU_REGION_SIZE_1GB ((uint8_t)0x1D) +#define MPU_REGION_SIZE_2GB ((uint8_t)0x1E) +#define MPU_REGION_SIZE_4GB ((uint8_t)0x1F) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes + * @{ + */ +#define MPU_REGION_NO_ACCESS ((uint8_t)0x00) +#define MPU_REGION_PRIV_RW ((uint8_t)0x01) +#define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02) +#define MPU_REGION_FULL_ACCESS ((uint8_t)0x03) +#define MPU_REGION_PRIV_RO ((uint8_t)0x05) +#define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number + * @{ + */ +#define MPU_REGION_NUMBER0 ((uint8_t)0x00) +#define MPU_REGION_NUMBER1 ((uint8_t)0x01) +#define MPU_REGION_NUMBER2 ((uint8_t)0x02) +#define MPU_REGION_NUMBER3 ((uint8_t)0x03) +#define MPU_REGION_NUMBER4 ((uint8_t)0x04) +#define MPU_REGION_NUMBER5 ((uint8_t)0x05) +#define MPU_REGION_NUMBER6 ((uint8_t)0x06) +#define MPU_REGION_NUMBER7 ((uint8_t)0x07) +/** + * @} + */ +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + + +/* Exported Macros -----------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CORTEX_Exported_Functions + * @{ + */ + +/** @addtogroup CORTEX_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup); +void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority); +void HAL_NVIC_EnableIRQ(IRQn_Type IRQn); +void HAL_NVIC_DisableIRQ(IRQn_Type IRQn); +void HAL_NVIC_SystemReset(void); +uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); +/** + * @} + */ + +/** @addtogroup CORTEX_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ***********************************************/ +uint32_t HAL_NVIC_GetPriorityGrouping(void); +void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority); +uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); +void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn); +void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn); +uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn); +void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource); +void HAL_SYSTICK_IRQHandler(void); +void HAL_SYSTICK_Callback(void); + +#if (__MPU_PRESENT == 1U) +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 */ +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup CORTEX_Private_Macros CORTEX Private Macros + * @{ + */ +#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \ + ((GROUP) == NVIC_PRIORITYGROUP_1) || \ + ((GROUP) == NVIC_PRIORITYGROUP_2) || \ + ((GROUP) == NVIC_PRIORITYGROUP_3) || \ + ((GROUP) == NVIC_PRIORITYGROUP_4)) + +#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U) + +#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U) + +#define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= (IRQn_Type)0x00U) + +#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \ + ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) + +#if (__MPU_PRESENT == 1U) +#define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \ + ((STATE) == MPU_REGION_DISABLE)) + +#define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \ + ((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE)) + +#define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \ + ((STATE) == MPU_ACCESS_NOT_SHAREABLE)) + +#define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \ + ((STATE) == MPU_ACCESS_NOT_CACHEABLE)) + +#define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \ + ((STATE) == MPU_ACCESS_NOT_BUFFERABLE)) + +#define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \ + ((TYPE) == MPU_TEX_LEVEL1) || \ + ((TYPE) == MPU_TEX_LEVEL2)) + +#define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \ + ((TYPE) == MPU_REGION_PRIV_RW) || \ + ((TYPE) == MPU_REGION_PRIV_RW_URO) || \ + ((TYPE) == MPU_REGION_FULL_ACCESS) || \ + ((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) || \ + ((NUMBER) == MPU_REGION_NUMBER7)) + +#define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \ + ((SIZE) == MPU_REGION_SIZE_64B) || \ + ((SIZE) == MPU_REGION_SIZE_128B) || \ + ((SIZE) == MPU_REGION_SIZE_256B) || \ + ((SIZE) == MPU_REGION_SIZE_512B) || \ + ((SIZE) == MPU_REGION_SIZE_1KB) || \ + ((SIZE) == MPU_REGION_SIZE_2KB) || \ + ((SIZE) == MPU_REGION_SIZE_4KB) || \ + ((SIZE) == MPU_REGION_SIZE_8KB) || \ + ((SIZE) == MPU_REGION_SIZE_16KB) || \ + ((SIZE) == MPU_REGION_SIZE_32KB) || \ + ((SIZE) == MPU_REGION_SIZE_64KB) || \ + ((SIZE) == MPU_REGION_SIZE_128KB) || \ + ((SIZE) == MPU_REGION_SIZE_256KB) || \ + ((SIZE) == MPU_REGION_SIZE_512KB) || \ + ((SIZE) == MPU_REGION_SIZE_1MB) || \ + ((SIZE) == MPU_REGION_SIZE_2MB) || \ + ((SIZE) == MPU_REGION_SIZE_4MB) || \ + ((SIZE) == MPU_REGION_SIZE_8MB) || \ + ((SIZE) == MPU_REGION_SIZE_16MB) || \ + ((SIZE) == MPU_REGION_SIZE_32MB) || \ + ((SIZE) == MPU_REGION_SIZE_64MB) || \ + ((SIZE) == MPU_REGION_SIZE_128MB) || \ + ((SIZE) == MPU_REGION_SIZE_256MB) || \ + ((SIZE) == MPU_REGION_SIZE_512MB) || \ + ((SIZE) == MPU_REGION_SIZE_1GB) || \ + ((SIZE) == MPU_REGION_SIZE_2GB) || \ + ((SIZE) == MPU_REGION_SIZE_4GB)) + +#define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF) +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CORTEX_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h new file mode 100644 index 0000000..e32e362 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h @@ -0,0 +1,197 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_def.h + * @author MCD Application Team + * @brief This file contains HAL common defines, enumeration, macros and + * structures definitions. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_DEF +#define __STM32F4xx_HAL_DEF + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" +#include "Legacy/stm32_hal_legacy.h" +#include + +/* Exported types ------------------------------------------------------------*/ + +/** + * @brief HAL Status structures definition + */ +typedef enum +{ + HAL_OK = 0x00U, + HAL_ERROR = 0x01U, + HAL_BUSY = 0x02U, + HAL_TIMEOUT = 0x03U +} HAL_StatusTypeDef; + +/** + * @brief HAL Lock structures definition + */ +typedef enum +{ + HAL_UNLOCKED = 0x00U, + HAL_LOCKED = 0x01U +} HAL_LockTypeDef; + +/* Exported macro ------------------------------------------------------------*/ + +#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ + +#define HAL_MAX_DELAY 0xFFFFFFFFU + +#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{ \ + (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ + (__DMA_HANDLE__).Parent = (__HANDLE__); \ + } while(0U) + +/** @brief Reset the Handle's State field. + * @param __HANDLE__ specifies the Peripheral Handle. + * @note This macro can be used for the following purpose: + * - When the Handle is declared as local variable; before passing it as parameter + * to HAL_PPP_Init() for the first time, it is mandatory to use this macro + * to set to 0 the Handle's "State" field. + * Otherwise, "State" field may have any random value and the first time the function + * HAL_PPP_Init() is called, the low level hardware initialization will be missed + * (i.e. HAL_PPP_MspInit() will not be executed). + * - When there is a need to reconfigure the low level hardware: instead of calling + * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). + * In this later function, when the Handle's "State" field is set to 0, it will execute the function + * HAL_PPP_MspInit() which will reconfigure the low level hardware. + * @retval None + */ +#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) + +#if (USE_RTOS == 1U) + /* Reserved for future use */ + #error "USE_RTOS should be 0 in the current HAL release" +#else + #define __HAL_LOCK(__HANDLE__) \ + do{ \ + if((__HANDLE__)->Lock == HAL_LOCKED) \ + { \ + return HAL_BUSY; \ + } \ + else \ + { \ + (__HANDLE__)->Lock = HAL_LOCKED; \ + } \ + }while (0U) + + #define __HAL_UNLOCK(__HANDLE__) \ + do{ \ + (__HANDLE__)->Lock = HAL_UNLOCKED; \ + }while (0U) +#endif /* USE_RTOS */ + +#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ + #ifndef __weak + #define __weak __attribute__((weak)) + #endif /* __weak */ + #ifndef __packed + #define __packed __attribute__((__packed__)) + #endif /* __packed */ +#endif /* __GNUC__ */ + + +/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ +#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ + #ifndef __ALIGN_END +#define __ALIGN_END __attribute__ ((aligned (4))) + #endif /* __ALIGN_END */ + #ifndef __ALIGN_BEGIN + #define __ALIGN_BEGIN + #endif /* __ALIGN_BEGIN */ +#else + #ifndef __ALIGN_END + #define __ALIGN_END + #endif /* __ALIGN_END */ + #ifndef __ALIGN_BEGIN + #if defined (__CC_ARM) /* ARM Compiler */ +#define __ALIGN_BEGIN __align(4) + #elif defined (__ICCARM__) /* IAR Compiler */ + #define __ALIGN_BEGIN + #endif /* __CC_ARM */ + #endif /* __ALIGN_BEGIN */ +#endif /* __GNUC__ */ + + +/** + * @brief __RAM_FUNC definition + */ +#if defined ( __CC_ARM ) +/* ARM Compiler + ------------ + RAM functions are defined using the toolchain options. + Functions that are executed in RAM should reside in a separate source module. + Using the 'Options for File' dialog you can simply change the 'Code / Const' + area of a module to a memory space in physical RAM. + Available memory areas are declared in the 'Target' tab of the 'Options for Target' + dialog. +*/ +#define __RAM_FUNC + +#elif defined ( __ICCARM__ ) +/* ICCARM Compiler + --------------- + RAM functions are defined using a specific toolchain keyword "__ramfunc". +*/ +#define __RAM_FUNC __ramfunc + +#elif defined ( __GNUC__ ) +/* GNU Compiler + ------------ + RAM functions are defined using a specific toolchain attribute + "__attribute__((section(".RamFunc")))". +*/ +#define __RAM_FUNC __attribute__((section(".RamFunc"))) + +#endif + +/** + * @brief __NOINLINE definition + */ +#if defined ( __CC_ARM ) || defined ( __GNUC__ ) +/* ARM & GNUCompiler + ---------------- +*/ +#define __NOINLINE __attribute__ ( (noinline) ) + +#elif defined ( __ICCARM__ ) +/* ICCARM Compiler + --------------- +*/ +#define __NOINLINE _Pragma("optimize = no_inline") + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ___STM32F4xx_HAL_DEF */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h new file mode 100644 index 0000000..90dd292 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h @@ -0,0 +1,804 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_dma.h + * @author MCD Application Team + * @brief Header file of DMA HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_DMA_H +#define __STM32F4xx_HAL_DMA_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup DMA + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Types DMA Exported Types + * @brief DMA Exported Types + * @{ + */ + +/** + * @brief DMA Configuration Structure definition + */ +typedef struct +{ + uint32_t Channel; /*!< Specifies the channel used for the specified stream. + This parameter can be a value of @ref DMA_Channel_selection */ + + uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory. + This parameter can be a value of @ref DMA_Data_transfer_direction */ + + uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not. + This parameter can be a value of @ref DMA_Peripheral_incremented_mode */ + + uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not. + This parameter can be a value of @ref DMA_Memory_incremented_mode */ + + uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width. + This parameter can be a value of @ref DMA_Peripheral_data_size */ + + uint32_t MemDataAlignment; /*!< Specifies the Memory data width. + This parameter can be a value of @ref DMA_Memory_data_size */ + + uint32_t Mode; /*!< Specifies the operation mode of the DMAy Streamx. + This parameter can be a value of @ref DMA_mode + @note The circular buffer mode cannot be used if the memory-to-memory + data transfer is configured on the selected Stream */ + + uint32_t Priority; /*!< Specifies the software priority for the DMAy Streamx. + This parameter can be a value of @ref DMA_Priority_level */ + + uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream. + This parameter can be a value of @ref DMA_FIFO_direct_mode + @note The Direct mode (FIFO mode disabled) cannot be used if the + memory-to-memory data transfer is configured on the selected stream */ + + uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level. + This parameter can be a value of @ref DMA_FIFO_threshold_level */ + + uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers. + It specifies the amount of data to be transferred in a single non interruptible + transaction. + This parameter can be a value of @ref DMA_Memory_burst + @note The burst mode is possible only if the address Increment mode is enabled. */ + + uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers. + It specifies the amount of data to be transferred in a single non interruptible + transaction. + This parameter can be a value of @ref DMA_Peripheral_burst + @note The burst mode is possible only if the address Increment mode is enabled. */ +}DMA_InitTypeDef; + + +/** + * @brief HAL DMA State structures definition + */ +typedef enum +{ + HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */ + HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */ + HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */ + HAL_DMA_STATE_TIMEOUT = 0x03U, /*!< DMA timeout state */ + HAL_DMA_STATE_ERROR = 0x04U, /*!< DMA error state */ + HAL_DMA_STATE_ABORT = 0x05U, /*!< DMA Abort state */ +}HAL_DMA_StateTypeDef; + +/** + * @brief HAL DMA Error Code structure definition + */ +typedef enum +{ + HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */ + HAL_DMA_HALF_TRANSFER = 0x01U /*!< Half Transfer */ +}HAL_DMA_LevelCompleteTypeDef; + +/** + * @brief HAL DMA Error Code structure definition + */ +typedef enum +{ + HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */ + HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half Transfer */ + HAL_DMA_XFER_M1CPLT_CB_ID = 0x02U, /*!< M1 Full Transfer */ + HAL_DMA_XFER_M1HALFCPLT_CB_ID = 0x03U, /*!< M1 Half Transfer */ + HAL_DMA_XFER_ERROR_CB_ID = 0x04U, /*!< Error */ + HAL_DMA_XFER_ABORT_CB_ID = 0x05U, /*!< Abort */ + HAL_DMA_XFER_ALL_CB_ID = 0x06U /*!< All */ +}HAL_DMA_CallbackIDTypeDef; + +/** + * @brief DMA handle Structure definition + */ +typedef struct __DMA_HandleTypeDef +{ + DMA_Stream_TypeDef *Instance; /*!< Register base address */ + + DMA_InitTypeDef Init; /*!< DMA communication parameters */ + + HAL_LockTypeDef Lock; /*!< DMA locking object */ + + __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */ + + void *Parent; /*!< Parent object state */ + + void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */ + + void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */ + + void (* XferM1CpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete Memory1 callback */ + + void (* XferM1HalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Half complete Memory1 callback */ + + void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */ + + void (* XferAbortCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Abort callback */ + + __IO uint32_t ErrorCode; /*!< DMA Error code */ + + uint32_t StreamBaseAddress; /*!< DMA Stream Base Address */ + + uint32_t StreamIndex; /*!< DMA Stream Index */ + +}DMA_HandleTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Constants DMA Exported Constants + * @brief DMA Exported constants + * @{ + */ + +/** @defgroup DMA_Error_Code DMA Error Code + * @brief DMA Error Code + * @{ + */ +#define HAL_DMA_ERROR_NONE 0x00000000U /*!< No error */ +#define HAL_DMA_ERROR_TE 0x00000001U /*!< Transfer error */ +#define HAL_DMA_ERROR_FE 0x00000002U /*!< FIFO error */ +#define HAL_DMA_ERROR_DME 0x00000004U /*!< Direct Mode error */ +#define HAL_DMA_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */ +#define HAL_DMA_ERROR_PARAM 0x00000040U /*!< Parameter error */ +#define HAL_DMA_ERROR_NO_XFER 0x00000080U /*!< Abort requested with no Xfer ongoing */ +#define HAL_DMA_ERROR_NOT_SUPPORTED 0x00000100U /*!< Not supported mode */ +/** + * @} + */ + +/** @defgroup DMA_Channel_selection DMA Channel selection + * @brief DMA channel selection + * @{ + */ +#define DMA_CHANNEL_0 0x00000000U /*!< DMA Channel 0 */ +#define DMA_CHANNEL_1 0x02000000U /*!< DMA Channel 1 */ +#define DMA_CHANNEL_2 0x04000000U /*!< DMA Channel 2 */ +#define DMA_CHANNEL_3 0x06000000U /*!< DMA Channel 3 */ +#define DMA_CHANNEL_4 0x08000000U /*!< DMA Channel 4 */ +#define DMA_CHANNEL_5 0x0A000000U /*!< DMA Channel 5 */ +#define DMA_CHANNEL_6 0x0C000000U /*!< DMA Channel 6 */ +#define DMA_CHANNEL_7 0x0E000000U /*!< DMA Channel 7 */ +#if defined (DMA_SxCR_CHSEL_3) +#define DMA_CHANNEL_8 0x10000000U /*!< DMA Channel 8 */ +#define DMA_CHANNEL_9 0x12000000U /*!< DMA Channel 9 */ +#define DMA_CHANNEL_10 0x14000000U /*!< DMA Channel 10 */ +#define DMA_CHANNEL_11 0x16000000U /*!< DMA Channel 11 */ +#define DMA_CHANNEL_12 0x18000000U /*!< DMA Channel 12 */ +#define DMA_CHANNEL_13 0x1A000000U /*!< DMA Channel 13 */ +#define DMA_CHANNEL_14 0x1C000000U /*!< DMA Channel 14 */ +#define DMA_CHANNEL_15 0x1E000000U /*!< DMA Channel 15 */ +#endif /* DMA_SxCR_CHSEL_3 */ +/** + * @} + */ + +/** @defgroup DMA_Data_transfer_direction DMA Data transfer direction + * @brief DMA data transfer direction + * @{ + */ +#define DMA_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */ +#define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_SxCR_DIR_0) /*!< Memory to peripheral direction */ +#define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_SxCR_DIR_1) /*!< Memory to memory direction */ +/** + * @} + */ + +/** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode + * @brief DMA peripheral incremented mode + * @{ + */ +#define DMA_PINC_ENABLE ((uint32_t)DMA_SxCR_PINC) /*!< Peripheral increment mode enable */ +#define DMA_PINC_DISABLE 0x00000000U /*!< Peripheral increment mode disable */ +/** + * @} + */ + +/** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode + * @brief DMA memory incremented mode + * @{ + */ +#define DMA_MINC_ENABLE ((uint32_t)DMA_SxCR_MINC) /*!< Memory increment mode enable */ +#define DMA_MINC_DISABLE 0x00000000U /*!< Memory increment mode disable */ +/** + * @} + */ + +/** @defgroup DMA_Peripheral_data_size DMA Peripheral data size + * @brief DMA peripheral data size + * @{ + */ +#define DMA_PDATAALIGN_BYTE 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 */ +/** + * @} + */ + +/** @defgroup DMA_Memory_data_size DMA Memory data size + * @brief DMA memory data size + * @{ + */ +#define DMA_MDATAALIGN_BYTE 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 */ +/** + * @} + */ + +/** @defgroup DMA_mode DMA mode + * @brief DMA mode + * @{ + */ +#define DMA_NORMAL 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 */ +/** + * @} + */ + +/** @defgroup DMA_Priority_level DMA Priority level + * @brief DMA priority levels + * @{ + */ +#define DMA_PRIORITY_LOW 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 */ +/** + * @} + */ + +/** @defgroup DMA_FIFO_direct_mode DMA FIFO direct mode + * @brief DMA FIFO direct mode + * @{ + */ +#define DMA_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */ +#define DMA_FIFOMODE_ENABLE ((uint32_t)DMA_SxFCR_DMDIS) /*!< FIFO mode enable */ +/** + * @} + */ + +/** @defgroup DMA_FIFO_threshold_level DMA FIFO threshold level + * @brief DMA FIFO level + * @{ + */ +#define DMA_FIFO_THRESHOLD_1QUARTERFULL 0x00000000U /*!< FIFO threshold 1 quart full configuration */ +#define DMA_FIFO_THRESHOLD_HALFFULL ((uint32_t)DMA_SxFCR_FTH_0) /*!< FIFO threshold half full configuration */ +#define DMA_FIFO_THRESHOLD_3QUARTERSFULL ((uint32_t)DMA_SxFCR_FTH_1) /*!< FIFO threshold 3 quarts full configuration */ +#define DMA_FIFO_THRESHOLD_FULL ((uint32_t)DMA_SxFCR_FTH) /*!< FIFO threshold full configuration */ +/** + * @} + */ + +/** @defgroup DMA_Memory_burst DMA Memory burst + * @brief DMA memory burst + * @{ + */ +#define DMA_MBURST_SINGLE 0x00000000U +#define DMA_MBURST_INC4 ((uint32_t)DMA_SxCR_MBURST_0) +#define DMA_MBURST_INC8 ((uint32_t)DMA_SxCR_MBURST_1) +#define DMA_MBURST_INC16 ((uint32_t)DMA_SxCR_MBURST) +/** + * @} + */ + +/** @defgroup DMA_Peripheral_burst DMA Peripheral burst + * @brief DMA peripheral burst + * @{ + */ +#define DMA_PBURST_SINGLE 0x00000000U +#define DMA_PBURST_INC4 ((uint32_t)DMA_SxCR_PBURST_0) +#define DMA_PBURST_INC8 ((uint32_t)DMA_SxCR_PBURST_1) +#define DMA_PBURST_INC16 ((uint32_t)DMA_SxCR_PBURST) +/** + * @} + */ + +/** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions + * @brief DMA interrupts definition + * @{ + */ +#define DMA_IT_TC ((uint32_t)DMA_SxCR_TCIE) +#define DMA_IT_HT ((uint32_t)DMA_SxCR_HTIE) +#define DMA_IT_TE ((uint32_t)DMA_SxCR_TEIE) +#define DMA_IT_DME ((uint32_t)DMA_SxCR_DMEIE) +#define DMA_IT_FE 0x00000080U +/** + * @} + */ + +/** @defgroup DMA_flag_definitions DMA flag definitions + * @brief DMA flag definitions + * @{ + */ +#define DMA_FLAG_FEIF0_4 0x00000001U +#define DMA_FLAG_DMEIF0_4 0x00000004U +#define DMA_FLAG_TEIF0_4 0x00000008U +#define DMA_FLAG_HTIF0_4 0x00000010U +#define DMA_FLAG_TCIF0_4 0x00000020U +#define DMA_FLAG_FEIF1_5 0x00000040U +#define DMA_FLAG_DMEIF1_5 0x00000100U +#define DMA_FLAG_TEIF1_5 0x00000200U +#define DMA_FLAG_HTIF1_5 0x00000400U +#define DMA_FLAG_TCIF1_5 0x00000800U +#define DMA_FLAG_FEIF2_6 0x00010000U +#define DMA_FLAG_DMEIF2_6 0x00040000U +#define DMA_FLAG_TEIF2_6 0x00080000U +#define DMA_FLAG_HTIF2_6 0x00100000U +#define DMA_FLAG_TCIF2_6 0x00200000U +#define DMA_FLAG_FEIF3_7 0x00400000U +#define DMA_FLAG_DMEIF3_7 0x01000000U +#define DMA_FLAG_TEIF3_7 0x02000000U +#define DMA_FLAG_HTIF3_7 0x04000000U +#define DMA_FLAG_TCIF3_7 0x08000000U +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/** @brief Reset DMA handle state + * @param __HANDLE__ specifies the DMA handle. + * @retval None + */ +#define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET) + +/** + * @brief Return the current DMA Stream FIFO filled level. + * @param __HANDLE__ DMA handle + * @retval The FIFO filling state. + * - DMA_FIFOStatus_Less1QuarterFull: when FIFO is less than 1 quarter-full + * and not empty. + * - DMA_FIFOStatus_1QuarterFull: if more than 1 quarter-full. + * - DMA_FIFOStatus_HalfFull: if more than 1 half-full. + * - DMA_FIFOStatus_3QuartersFull: if more than 3 quarters-full. + * - DMA_FIFOStatus_Empty: when FIFO is empty + * - DMA_FIFOStatus_Full: when FIFO is full + */ +#define __HAL_DMA_GET_FS(__HANDLE__) (((__HANDLE__)->Instance->FCR & (DMA_SxFCR_FS))) + +/** + * @brief Enable the specified DMA Stream. + * @param __HANDLE__ DMA handle + * @retval None + */ +#define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA_SxCR_EN) + +/** + * @brief Disable the specified DMA Stream. + * @param __HANDLE__ DMA handle + * @retval None + */ +#define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~DMA_SxCR_EN) + +/* Interrupt & Flag management */ + +/** + * @brief Return the current DMA Stream transfer complete flag. + * @param __HANDLE__ DMA handle + * @retval The specified transfer complete flag index. + */ +#define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TCIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TCIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TCIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TCIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TCIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TCIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TCIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TCIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TCIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TCIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TCIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TCIF2_6 :\ + DMA_FLAG_TCIF3_7) + +/** + * @brief Return the current DMA Stream half transfer complete flag. + * @param __HANDLE__ DMA handle + * @retval The specified half transfer complete flag index. + */ +#define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_HTIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_HTIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_HTIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_HTIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_HTIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_HTIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_HTIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_HTIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_HTIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_HTIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_HTIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_HTIF2_6 :\ + DMA_FLAG_HTIF3_7) + +/** + * @brief Return the current DMA Stream transfer error flag. + * @param __HANDLE__ DMA handle + * @retval The specified transfer error flag index. + */ +#define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TEIF2_6 :\ + DMA_FLAG_TEIF3_7) + +/** + * @brief Return the current DMA Stream FIFO error flag. + * @param __HANDLE__ DMA handle + * @retval The specified FIFO error flag index. + */ +#define __HAL_DMA_GET_FE_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_FEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_FEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_FEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_FEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_FEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_FEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_FEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_FEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_FEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_FEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_FEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_FEIF2_6 :\ + DMA_FLAG_FEIF3_7) + +/** + * @brief Return the current DMA Stream direct mode error flag. + * @param __HANDLE__ DMA handle + * @retval The specified direct mode error flag index. + */ +#define __HAL_DMA_GET_DME_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_DMEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_DMEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_DMEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_DMEIF0_4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_DMEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_DMEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_DMEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_DMEIF1_5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_DMEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_DMEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_DMEIF2_6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_DMEIF2_6 :\ + DMA_FLAG_DMEIF3_7) + +/** + * @brief Get the DMA Stream pending flags. + * @param __HANDLE__ DMA handle + * @param __FLAG__ Get the specified flag. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCIFx: Transfer complete flag. + * @arg DMA_FLAG_HTIFx: Half transfer complete flag. + * @arg DMA_FLAG_TEIFx: Transfer error flag. + * @arg DMA_FLAG_DMEIFx: Direct mode error flag. + * @arg DMA_FLAG_FEIFx: FIFO error flag. + * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\ +(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HISR & (__FLAG__)) :\ + ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LISR & (__FLAG__)) :\ + ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HISR & (__FLAG__)) : (DMA1->LISR & (__FLAG__))) + +/** + * @brief Clear the DMA Stream pending flags. + * @param __HANDLE__ DMA handle + * @param __FLAG__ specifies the flag to clear. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCIFx: Transfer complete flag. + * @arg DMA_FLAG_HTIFx: Half transfer complete flag. + * @arg DMA_FLAG_TEIFx: Transfer error flag. + * @arg DMA_FLAG_DMEIFx: Direct mode error flag. + * @arg DMA_FLAG_FEIFx: FIFO error flag. + * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag. + * @retval None + */ +#define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \ +(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HIFCR = (__FLAG__)) :\ + ((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__))) + +/** + * @brief Enable the specified DMA Stream interrupts. + * @param __HANDLE__ DMA handle + * @param __INTERRUPT__ specifies the DMA interrupt sources to be enabled or disabled. + * This parameter can be any combination of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask. + * @arg DMA_IT_HT: Half transfer complete interrupt mask. + * @arg DMA_IT_TE: Transfer error interrupt mask. + * @arg DMA_IT_FE: FIFO error interrupt mask. + * @arg DMA_IT_DME: Direct mode error interrupt. + * @retval None + */ +#define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ +((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR |= (__INTERRUPT__))) + +/** + * @brief Disable the specified DMA Stream interrupts. + * @param __HANDLE__ DMA handle + * @param __INTERRUPT__ specifies the DMA interrupt sources to be enabled or disabled. + * This parameter can be any combination of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask. + * @arg DMA_IT_HT: Half transfer complete interrupt mask. + * @arg DMA_IT_TE: Transfer error interrupt mask. + * @arg DMA_IT_FE: FIFO error interrupt mask. + * @arg DMA_IT_DME: Direct mode error interrupt. + * @retval None + */ +#define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ +((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR &= ~(__INTERRUPT__))) + +/** + * @brief Check whether the specified DMA Stream interrupt is enabled or disabled. + * @param __HANDLE__ DMA handle + * @param __INTERRUPT__ specifies the DMA interrupt source to check. + * This parameter can be one of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask. + * @arg DMA_IT_HT: Half transfer complete interrupt mask. + * @arg DMA_IT_TE: Transfer error interrupt mask. + * @arg DMA_IT_FE: FIFO error interrupt mask. + * @arg DMA_IT_DME: Direct mode error interrupt. + * @retval The state of DMA_IT. + */ +#define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ + ((__HANDLE__)->Instance->CR & (__INTERRUPT__)) : \ + ((__HANDLE__)->Instance->FCR & (__INTERRUPT__))) + +/** + * @brief Writes the number of data units to be transferred on the DMA Stream. + * @param __HANDLE__ DMA handle + * @param __COUNTER__ Number of data units to be transferred (from 0 to 65535) + * Number of data items depends only on the Peripheral data format. + * + * @note If Peripheral data format is Bytes: number of data units is equal + * to total number of bytes to be transferred. + * + * @note If Peripheral data format is Half-Word: number of data units is + * equal to total number of bytes to be transferred / 2. + * + * @note If Peripheral data format is Word: number of data units is equal + * to total number of bytes to be transferred / 4. + * + * @retval The number of remaining data units in the current DMAy Streamx transfer. + */ +#define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->NDTR = (uint16_t)(__COUNTER__)) + +/** + * @brief Returns the number of remaining data units in the current DMAy Streamx transfer. + * @param __HANDLE__ DMA handle + * + * @retval The number of remaining data units in the current DMA Stream transfer. + */ +#define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->NDTR) + + +/* Include DMA HAL Extension module */ +#include "stm32f4xx_hal_dma_ex.h" + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Functions DMA Exported Functions + * @brief DMA Exported functions + * @{ + */ + +/** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * @{ + */ +HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma); +/** + * @} + */ + +/** @defgroup DMA_Exported_Functions_Group2 I/O operation functions + * @brief I/O operation functions + * @{ + */ +HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout); +void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_CleanCallbacks(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)(DMA_HandleTypeDef *_hdma)); +HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID); + +/** + * @} + */ + +/** @defgroup DMA_Exported_Functions_Group3 Peripheral State functions + * @brief Peripheral State functions + * @{ + */ +HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma); +uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); +/** + * @} + */ +/** + * @} + */ +/* Private Constants -------------------------------------------------------------*/ +/** @defgroup DMA_Private_Constants DMA Private Constants + * @brief DMA private defines and constants + * @{ + */ +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup DMA_Private_Macros DMA Private Macros + * @brief DMA private macros + * @{ + */ +#if defined (DMA_SxCR_CHSEL_3) +#define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \ + ((CHANNEL) == DMA_CHANNEL_1) || \ + ((CHANNEL) == DMA_CHANNEL_2) || \ + ((CHANNEL) == DMA_CHANNEL_3) || \ + ((CHANNEL) == DMA_CHANNEL_4) || \ + ((CHANNEL) == DMA_CHANNEL_5) || \ + ((CHANNEL) == DMA_CHANNEL_6) || \ + ((CHANNEL) == DMA_CHANNEL_7) || \ + ((CHANNEL) == DMA_CHANNEL_8) || \ + ((CHANNEL) == DMA_CHANNEL_9) || \ + ((CHANNEL) == DMA_CHANNEL_10)|| \ + ((CHANNEL) == DMA_CHANNEL_11)|| \ + ((CHANNEL) == DMA_CHANNEL_12)|| \ + ((CHANNEL) == DMA_CHANNEL_13)|| \ + ((CHANNEL) == DMA_CHANNEL_14)|| \ + ((CHANNEL) == DMA_CHANNEL_15)) +#else +#define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \ + ((CHANNEL) == DMA_CHANNEL_1) || \ + ((CHANNEL) == DMA_CHANNEL_2) || \ + ((CHANNEL) == DMA_CHANNEL_3) || \ + ((CHANNEL) == DMA_CHANNEL_4) || \ + ((CHANNEL) == DMA_CHANNEL_5) || \ + ((CHANNEL) == DMA_CHANNEL_6) || \ + ((CHANNEL) == DMA_CHANNEL_7)) +#endif /* DMA_SxCR_CHSEL_3 */ + +#define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ + ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ + ((DIRECTION) == DMA_MEMORY_TO_MEMORY)) + +#define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x01U) && ((SIZE) < 0x10000U)) + +#define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \ + ((STATE) == DMA_PINC_DISABLE)) + +#define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \ + ((STATE) == DMA_MINC_DISABLE)) + +#define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \ + ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \ + ((SIZE) == DMA_PDATAALIGN_WORD)) + +#define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \ + ((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_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \ + ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \ + ((PRIORITY) == DMA_PRIORITY_HIGH) || \ + ((PRIORITY) == DMA_PRIORITY_VERY_HIGH)) + +#define IS_DMA_FIFO_MODE_STATE(STATE) (((STATE) == DMA_FIFOMODE_DISABLE ) || \ + ((STATE) == DMA_FIFOMODE_ENABLE)) + +#define IS_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == DMA_FIFO_THRESHOLD_1QUARTERFULL ) || \ + ((THRESHOLD) == DMA_FIFO_THRESHOLD_HALFFULL) || \ + ((THRESHOLD) == DMA_FIFO_THRESHOLD_3QUARTERSFULL) || \ + ((THRESHOLD) == DMA_FIFO_THRESHOLD_FULL)) + +#define IS_DMA_MEMORY_BURST(BURST) (((BURST) == DMA_MBURST_SINGLE) || \ + ((BURST) == DMA_MBURST_INC4) || \ + ((BURST) == DMA_MBURST_INC8) || \ + ((BURST) == DMA_MBURST_INC16)) + +#define IS_DMA_PERIPHERAL_BURST(BURST) (((BURST) == DMA_PBURST_SINGLE) || \ + ((BURST) == DMA_PBURST_INC4) || \ + ((BURST) == DMA_PBURST_INC8) || \ + ((BURST) == DMA_PBURST_INC16)) +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup DMA_Private_Functions DMA Private Functions + * @brief DMA private functions + * @{ + */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_DMA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h new file mode 100644 index 0000000..2e60aff --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h @@ -0,0 +1,104 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_dma_ex.h + * @author MCD Application Team + * @brief Header file of DMA HAL extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_DMA_EX_H +#define __STM32F4xx_HAL_DMA_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup DMAEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup DMAEx_Exported_Types DMAEx Exported Types + * @brief DMAEx Exported types + * @{ + */ + +/** + * @brief HAL DMA Memory definition + */ +typedef enum +{ + MEMORY0 = 0x00U, /*!< Memory 0 */ + MEMORY1 = 0x01U /*!< Memory 1 */ +}HAL_DMA_MemoryTypeDef; + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions + * @brief DMAEx Exported functions + * @{ + */ + +/** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions + * @brief Extended features functions + * @{ + */ + +/* IO operation functions *******************************************************/ +HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory); + +/** + * @} + */ +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup DMAEx_Private_Functions DMAEx Private Functions + * @brief DMAEx Private functions + * @{ + */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /*__STM32F4xx_HAL_DMA_EX_H*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h new file mode 100644 index 0000000..ff74222 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h @@ -0,0 +1,368 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_exti.h + * @author MCD Application Team + * @brief Header file of EXTI HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2018 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32f4xx_HAL_EXTI_H +#define STM32f4xx_HAL_EXTI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_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 */ +} EXTI_ConfigTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EXTI_Exported_Constants EXTI Exported Constants + * @{ + */ + +/** @defgroup EXTI_Line EXTI Line + * @{ + */ +#define EXTI_LINE_0 (EXTI_GPIO | 0x00u) /*!< External interrupt line 0 */ +#define EXTI_LINE_1 (EXTI_GPIO | 0x01u) /*!< External interrupt line 1 */ +#define EXTI_LINE_2 (EXTI_GPIO | 0x02u) /*!< External interrupt line 2 */ +#define EXTI_LINE_3 (EXTI_GPIO | 0x03u) /*!< External interrupt line 3 */ +#define EXTI_LINE_4 (EXTI_GPIO | 0x04u) /*!< External interrupt line 4 */ +#define EXTI_LINE_5 (EXTI_GPIO | 0x05u) /*!< External interrupt line 5 */ +#define EXTI_LINE_6 (EXTI_GPIO | 0x06u) /*!< External interrupt line 6 */ +#define EXTI_LINE_7 (EXTI_GPIO | 0x07u) /*!< External interrupt line 7 */ +#define EXTI_LINE_8 (EXTI_GPIO | 0x08u) /*!< External interrupt line 8 */ +#define EXTI_LINE_9 (EXTI_GPIO | 0x09u) /*!< External interrupt line 9 */ +#define EXTI_LINE_10 (EXTI_GPIO | 0x0Au) /*!< External interrupt line 10 */ +#define EXTI_LINE_11 (EXTI_GPIO | 0x0Bu) /*!< External interrupt line 11 */ +#define EXTI_LINE_12 (EXTI_GPIO | 0x0Cu) /*!< External interrupt line 12 */ +#define EXTI_LINE_13 (EXTI_GPIO | 0x0Du) /*!< External interrupt line 13 */ +#define EXTI_LINE_14 (EXTI_GPIO | 0x0Eu) /*!< External interrupt line 14 */ +#define EXTI_LINE_15 (EXTI_GPIO | 0x0Fu) /*!< External interrupt line 15 */ +#define EXTI_LINE_16 (EXTI_CONFIG | 0x10u) /*!< External interrupt line 16 Connected to the PVD Output */ +#define EXTI_LINE_17 (EXTI_CONFIG | 0x11u) /*!< External interrupt line 17 Connected to the RTC Alarm event */ +#if defined(EXTI_IMR_IM18) +#define EXTI_LINE_18 (EXTI_CONFIG | 0x12u) /*!< External interrupt line 18 Connected to the USB OTG FS Wakeup from suspend event */ +#else +#define EXTI_LINE_18 (EXTI_RESERVED | 0x12u) /*!< No interrupt supported in this line */ +#endif /* EXTI_IMR_IM18 */ +#if defined(EXTI_IMR_IM19) +#define EXTI_LINE_19 (EXTI_CONFIG | 0x13u) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ +#else +#define EXTI_LINE_19 (EXTI_RESERVED | 0x13u) /*!< No interrupt supported in this line */ +#endif /* EXTI_IMR_IM19 */ +#if defined(EXTI_IMR_IM20) +#define EXTI_LINE_20 (EXTI_CONFIG | 0x14u) /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) Wakeup event */ +#else +#define EXTI_LINE_20 (EXTI_RESERVED | 0x14u) /*!< No interrupt supported in this line */ +#endif /* EXTI_IMR_IM20 */ +#define EXTI_LINE_21 (EXTI_CONFIG | 0x15u) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */ +#define EXTI_LINE_22 (EXTI_CONFIG | 0x16u) /*!< External interrupt line 22 Connected to the RTC Wakeup event */ +#if defined(EXTI_IMR_IM23) +#define EXTI_LINE_23 (EXTI_CONFIG | 0x17u) /*!< External interrupt line 23 Connected to the LPTIM1 asynchronous event */ +#endif /* EXTI_IMR_IM23 */ + +/** + * @} + */ + +/** @defgroup EXTI_Mode EXTI Mode + * @{ + */ +#define EXTI_MODE_NONE 0x00000000u +#define EXTI_MODE_INTERRUPT 0x00000001u +#define EXTI_MODE_EVENT 0x00000002u +/** + * @} + */ + +/** @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 +#if defined (GPIOD) +#define EXTI_GPIOD 0x00000003u +#endif /* GPIOD */ +#if defined (GPIOE) +#define EXTI_GPIOE 0x00000004u +#endif /* GPIOE */ +#if defined (GPIOF) +#define EXTI_GPIOF 0x00000005u +#endif /* GPIOF */ +#if defined (GPIOG) +#define EXTI_GPIOG 0x00000006u +#endif /* GPIOG */ +#if defined (GPIOH) +#define EXTI_GPIOH 0x00000007u +#endif /* GPIOH */ +#if defined (GPIOI) +#define EXTI_GPIOI 0x00000008u +#endif /* GPIOI */ +#if defined (GPIOJ) +#define EXTI_GPIOJ 0x00000009u +#endif /* GPIOJ */ +#if defined (GPIOK) +#define EXTI_GPIOK 0x0000000Au +#endif /* GPIOK */ + +/** + * @} + */ + +/** + * @} + */ + +/* 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_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_CONFIG | EXTI_GPIO) + +/** + * @brief EXTI bit usage + */ +#define EXTI_PIN_MASK 0x0000001Fu + +/** + * @brief EXTI Mask for interrupt & event mode + */ +#define EXTI_MODE_MASK (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT) + +/** + * @brief EXTI Mask for trigger possibilities + */ +#define EXTI_TRIGGER_MASK (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING) + +/** + * @brief EXTI Line number + */ +#if defined(EXTI_IMR_IM23) +#define EXTI_LINE_NB 24UL +#else +#define EXTI_LINE_NB 23UL +#endif /* EXTI_IMR_IM23 */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup EXTI_Private_Macros EXTI Private Macros + * @{ + */ +#define IS_EXTI_LINE(__LINE__) ((((__LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_PIN_MASK)) == 0x00u) && \ + ((((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG) || \ + (((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO)) && \ + (((__LINE__) & EXTI_PIN_MASK) < EXTI_LINE_NB)) + +#define IS_EXTI_MODE(__LINE__) ((((__LINE__) & EXTI_MODE_MASK) != 0x00u) && \ + (((__LINE__) & ~EXTI_MODE_MASK) == 0x00u)) + +#define IS_EXTI_TRIGGER(__LINE__) (((__LINE__) & ~EXTI_TRIGGER_MASK) == 0x00u) + +#define IS_EXTI_PENDING_EDGE(__LINE__) ((__LINE__) == EXTI_TRIGGER_RISING_FALLING) + +#define IS_EXTI_CONFIG_LINE(__LINE__) (((__LINE__) & EXTI_CONFIG) != 0x00u) + +#if !defined (GPIOD) +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOH)) +#elif !defined (GPIOE) +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOD) || \ + ((__PORT__) == EXTI_GPIOH)) +#elif !defined (GPIOF) +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOD) || \ + ((__PORT__) == EXTI_GPIOE) || \ + ((__PORT__) == EXTI_GPIOH)) +#elif !defined (GPIOI) +#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)) +#elif !defined (GPIOJ) +#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)) +#else +#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)) +#endif /* GPIOD */ + +#define IS_EXTI_GPIO_PIN(__PIN__) ((__PIN__) < 16U) +/** + * @} + */ + +/* 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 /* STM32f4xx_HAL_EXTI_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h new file mode 100644 index 0000000..b817f63 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h @@ -0,0 +1,428 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash.h + * @author MCD Application Team + * @brief Header file of FLASH HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_FLASH_H +#define __STM32F4xx_HAL_FLASH_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup FLASH + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Types FLASH Exported Types + * @{ + */ + +/** + * @brief FLASH Procedure structure definition + */ +typedef enum +{ + FLASH_PROC_NONE = 0U, + FLASH_PROC_SECTERASE, + FLASH_PROC_MASSERASE, + FLASH_PROC_PROGRAM +} FLASH_ProcedureTypeDef; + +/** + * @brief FLASH handle Structure definition + */ +typedef struct +{ + __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/ + + __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 Sector; /*Internal variable to define the current sector which is erasing*/ + + __IO uint32_t Bank; /*Internal variable to save current bank selected during mass erase*/ + + __IO uint32_t Address; /*Internal variable to save address selected for program*/ + + HAL_LockTypeDef Lock; /* FLASH locking object */ + + __IO uint32_t ErrorCode; /* FLASH error code */ + +}FLASH_ProcessTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Constants FLASH Exported Constants + * @{ + */ +/** @defgroup FLASH_Error_Code FLASH Error Code + * @brief FLASH Error Code + * @{ + */ +#define HAL_FLASH_ERROR_NONE 0x00000000U /*!< No error */ +#define HAL_FLASH_ERROR_RD 0x00000001U /*!< Read Protection error */ +#define HAL_FLASH_ERROR_PGS 0x00000002U /*!< Programming Sequence error */ +#define HAL_FLASH_ERROR_PGP 0x00000004U /*!< Programming Parallelism error */ +#define HAL_FLASH_ERROR_PGA 0x00000008U /*!< Programming Alignment error */ +#define HAL_FLASH_ERROR_WRP 0x00000010U /*!< Write protection error */ +#define HAL_FLASH_ERROR_OPERATION 0x00000020U /*!< Operation Error */ +/** + * @} + */ + +/** @defgroup FLASH_Type_Program FLASH Type Program + * @{ + */ +#define FLASH_TYPEPROGRAM_BYTE 0x00000000U /*!< Program byte (8-bit) at a specified address */ +#define FLASH_TYPEPROGRAM_HALFWORD 0x00000001U /*!< Program a half-word (16-bit) at a specified address */ +#define FLASH_TYPEPROGRAM_WORD 0x00000002U /*!< Program a word (32-bit) at a specified address */ +#define FLASH_TYPEPROGRAM_DOUBLEWORD 0x00000003U /*!< Program a double word (64-bit) at a specified address */ +/** + * @} + */ + +/** @defgroup FLASH_Flag_definition FLASH Flag definition + * @brief Flag definition + * @{ + */ +#define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */ +#define FLASH_FLAG_OPERR FLASH_SR_SOP /*!< FLASH operation Error flag */ +#define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ +#define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ +#define FLASH_FLAG_PGPERR FLASH_SR_PGPERR /*!< FLASH Programming Parallelism error flag */ +#define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< FLASH Programming Sequence error flag */ +#if defined(FLASH_SR_RDERR) +#define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< Read Protection error flag (PCROP) */ +#endif /* FLASH_SR_RDERR */ +#define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ +/** + * @} + */ + +/** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition + * @brief FLASH Interrupt definition + * @{ + */ +#define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */ +#define FLASH_IT_ERR 0x02000000U /*!< Error Interrupt source */ +/** + * @} + */ + +/** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism + * @{ + */ +#define FLASH_PSIZE_BYTE 0x00000000U +#define FLASH_PSIZE_HALF_WORD 0x00000100U +#define FLASH_PSIZE_WORD 0x00000200U +#define FLASH_PSIZE_DOUBLE_WORD 0x00000300U +#define CR_PSIZE_MASK 0xFFFFFCFFU +/** + * @} + */ + +/** @defgroup FLASH_Keys FLASH Keys + * @{ + */ +#define RDP_KEY ((uint16_t)0x00A5) +#define FLASH_KEY1 0x45670123U +#define FLASH_KEY2 0xCDEF89ABU +#define FLASH_OPT_KEY1 0x08192A3BU +#define FLASH_OPT_KEY2 0x4C5D6E7FU +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Macros FLASH Exported Macros + * @{ + */ +/** + * @brief Set the FLASH Latency. + * @param __LATENCY__ FLASH Latency + * The value of this parameter depend on device used within the same series + * @retval none + */ +#define __HAL_FLASH_SET_LATENCY(__LATENCY__) (*(__IO uint8_t *)ACR_BYTE0_ADDRESS = (uint8_t)(__LATENCY__)) + +/** + * @brief Get the FLASH Latency. + * @retval FLASH Latency + * The value of this parameter depend on device used within the same series + */ +#define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)) + +/** + * @brief Enable the FLASH prefetch buffer. + * @retval none + */ +#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN) + +/** + * @brief Disable the FLASH prefetch buffer. + * @retval none + */ +#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN)) + +/** + * @brief Enable the FLASH instruction cache. + * @retval none + */ +#define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN) + +/** + * @brief Disable the FLASH instruction cache. + * @retval none + */ +#define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN)) + +/** + * @brief Enable the FLASH data cache. + * @retval none + */ +#define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN) + +/** + * @brief Disable the FLASH data cache. + * @retval none + */ +#define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN)) + +/** + * @brief Resets the FLASH instruction Cache. + * @note This function must be used only when the Instruction Cache is disabled. + * @retval None + */ +#define __HAL_FLASH_INSTRUCTION_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_ICRST; \ + FLASH->ACR &= ~FLASH_ACR_ICRST; \ + }while(0U) + +/** + * @brief Resets the FLASH data Cache. + * @note This function must be used only when the data Cache is disabled. + * @retval None + */ +#define __HAL_FLASH_DATA_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_DCRST; \ + FLASH->ACR &= ~FLASH_ACR_DCRST; \ + }while(0U) +/** + * @brief Enable the specified FLASH interrupt. + * @param __INTERRUPT__ FLASH interrupt + * This parameter can be any combination of the following values: + * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt + * @arg FLASH_IT_ERR: Error Interrupt + * @retval none + */ +#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) + +/** + * @brief Disable the specified FLASH interrupt. + * @param __INTERRUPT__ FLASH interrupt + * This parameter can be any combination of the following values: + * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt + * @arg FLASH_IT_ERR: Error Interrupt + * @retval none + */ +#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__)) + +/** + * @brief Get the specified FLASH flag status. + * @param __FLAG__ specifies the FLASH flags to check. + * This parameter can be any combination of the following values: + * @arg FLASH_FLAG_EOP : FLASH End of Operation flag + * @arg FLASH_FLAG_OPERR : FLASH operation Error flag + * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag + * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag + * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag + * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag + * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (*) + * @arg FLASH_FLAG_BSY : FLASH Busy flag + * (*) FLASH_FLAG_RDERR is not available for STM32F405xx/407xx/415xx/417xx devices + * @retval The new state of __FLAG__ (SET or RESET). + */ +#define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))) + +/** + * @brief Clear the specified FLASH flags. + * @param __FLAG__ specifies the FLASH flags to clear. + * This parameter can be any combination of the following values: + * @arg FLASH_FLAG_EOP : FLASH End of Operation flag + * @arg FLASH_FLAG_OPERR : FLASH operation Error flag + * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag + * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag + * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag + * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag + * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (*) + * (*) FLASH_FLAG_RDERR is not available for STM32F405xx/407xx/415xx/417xx devices + * @retval none + */ +#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) +/** + * @} + */ + +/* Include FLASH HAL Extension module */ +#include "stm32f4xx_hal_flash_ex.h" +#include "stm32f4xx_hal_flash_ramfunc.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup FLASH_Exported_Functions + * @{ + */ +/** @addtogroup FLASH_Exported_Functions_Group1 + * @{ + */ +/* Program operation functions ***********************************************/ +HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); +HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); +/* FLASH IRQ handler method */ +void HAL_FLASH_IRQHandler(void); +/* Callbacks in non blocking modes */ +void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); +void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); +/** + * @} + */ + +/** @addtogroup FLASH_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions **********************************************/ +HAL_StatusTypeDef HAL_FLASH_Unlock(void); +HAL_StatusTypeDef HAL_FLASH_Lock(void); +HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); +HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); +/* Option bytes control */ +HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); +/** + * @} + */ + +/** @addtogroup FLASH_Exported_Functions_Group3 + * @{ + */ +/* Peripheral State functions ************************************************/ +uint32_t HAL_FLASH_GetError(void); +HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup FLASH_Private_Variables FLASH Private Variables + * @{ + */ + +/** + * @} + */ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup FLASH_Private_Constants FLASH Private Constants + * @{ + */ + +/** + * @brief ACR register byte 0 (Bits[7:0]) base address + */ +#define ACR_BYTE0_ADDRESS 0x40023C00U +/** + * @brief OPTCR register byte 0 (Bits[7:0]) base address + */ +#define OPTCR_BYTE0_ADDRESS 0x40023C14U +/** + * @brief OPTCR register byte 1 (Bits[15:8]) base address + */ +#define OPTCR_BYTE1_ADDRESS 0x40023C15U +/** + * @brief OPTCR register byte 2 (Bits[23:16]) base address + */ +#define OPTCR_BYTE2_ADDRESS 0x40023C16U +/** + * @brief OPTCR register byte 3 (Bits[31:24]) base address + */ +#define OPTCR_BYTE3_ADDRESS 0x40023C17U + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup FLASH_Private_Macros FLASH Private Macros + * @{ + */ + +/** @defgroup FLASH_IS_FLASH_Definitions FLASH Private macros to check input parameters + * @{ + */ +#define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \ + ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \ + ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \ + ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD)) +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup FLASH_Private_Functions FLASH Private Functions + * @{ + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_FLASH_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h new file mode 100644 index 0000000..4dbad67 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h @@ -0,0 +1,1066 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash_ex.h + * @author MCD Application Team + * @brief Header file of FLASH HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_FLASH_EX_H +#define __STM32F4xx_HAL_FLASH_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup FLASHEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup FLASHEx_Exported_Types FLASH Exported Types + * @{ + */ + +/** + * @brief FLASH Erase structure definition + */ +typedef struct +{ + uint32_t TypeErase; /*!< Mass erase or sector Erase. + This parameter can be a value of @ref FLASHEx_Type_Erase */ + + uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled. + This parameter must be a value of @ref FLASHEx_Banks */ + + uint32_t Sector; /*!< Initial FLASH sector to erase when Mass erase is disabled + This parameter must be a value of @ref FLASHEx_Sectors */ + + uint32_t NbSectors; /*!< Number of sectors to be erased. + This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/ + + uint32_t VoltageRange;/*!< The device voltage range which defines the erase parallelism + This parameter must be a value of @ref FLASHEx_Voltage_Range */ + +} FLASH_EraseInitTypeDef; + +/** + * @brief FLASH Option Bytes Program structure definition + */ +typedef struct +{ + uint32_t OptionType; /*!< Option byte to be configured. + This parameter can be a value of @ref FLASHEx_Option_Type */ + + uint32_t WRPState; /*!< Write protection activation or deactivation. + This parameter can be a value of @ref FLASHEx_WRP_State */ + + uint32_t WRPSector; /*!< Specifies the sector(s) to be write protected. + The value of this parameter depend on device used within the same series */ + + uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors. + This parameter must be a value of @ref FLASHEx_Banks */ + + uint32_t RDPLevel; /*!< Set the read protection level. + This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */ + + uint32_t BORLevel; /*!< Set the BOR Level. + This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */ + + uint8_t USERConfig; /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */ + +} FLASH_OBProgramInitTypeDef; + +/** + * @brief FLASH Advanced Option Bytes Program structure definition + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +typedef struct +{ + uint32_t OptionType; /*!< Option byte to be configured for extension. + This parameter can be a value of @ref FLASHEx_Advanced_Option_Type */ + + uint32_t PCROPState; /*!< PCROP activation or deactivation. + This parameter can be a value of @ref FLASHEx_PCROP_State */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) + uint16_t Sectors; /*!< specifies the sector(s) set for PCROP. + This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx ||\ + STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + uint32_t Banks; /*!< Select banks for PCROP activation/deactivation of all sectors. + This parameter must be a value of @ref FLASHEx_Banks */ + + uint16_t SectorsBank1; /*!< Specifies the sector(s) set for PCROP for Bank1. + This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ + + uint16_t SectorsBank2; /*!< Specifies the sector(s) set for PCROP for Bank2. + This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ + + uint8_t BootConfig; /*!< Specifies Option bytes for boot config. + This parameter can be a value of @ref FLASHEx_Dual_Boot */ + +#endif /*STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +}FLASH_AdvOBProgramInitTypeDef; +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || + STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants + * @{ + */ + +/** @defgroup FLASHEx_Type_Erase FLASH Type Erase + * @{ + */ +#define FLASH_TYPEERASE_SECTORS 0x00000000U /*!< Sectors erase only */ +#define FLASH_TYPEERASE_MASSERASE 0x00000001U /*!< Flash Mass erase activation */ +/** + * @} + */ + +/** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range + * @{ + */ +#define FLASH_VOLTAGE_RANGE_1 0x00000000U /*!< Device operating range: 1.8V to 2.1V */ +#define FLASH_VOLTAGE_RANGE_2 0x00000001U /*!< Device operating range: 2.1V to 2.7V */ +#define FLASH_VOLTAGE_RANGE_3 0x00000002U /*!< Device operating range: 2.7V to 3.6V */ +#define FLASH_VOLTAGE_RANGE_4 0x00000003U /*!< Device operating range: 2.7V to 3.6V + External Vpp */ +/** + * @} + */ + +/** @defgroup FLASHEx_WRP_State FLASH WRP State + * @{ + */ +#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 */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Type FLASH Option Type + * @{ + */ +#define OPTIONBYTE_WRP 0x00000001U /*!< WRP option byte configuration */ +#define OPTIONBYTE_RDP 0x00000002U /*!< RDP option byte configuration */ +#define OPTIONBYTE_USER 0x00000004U /*!< USER option byte configuration */ +#define OPTIONBYTE_BOR 0x00000008U /*!< BOR option byte configuration */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection + * @{ + */ +#define OB_RDP_LEVEL_0 ((uint8_t)0xAA) +#define OB_RDP_LEVEL_1 ((uint8_t)0x55) +#define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2 + it s no more possible to go back to level 1 or 0 */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog + * @{ + */ +#define OB_IWDG_SW ((uint8_t)0x20) /*!< Software IWDG selected */ +#define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP + * @{ + */ +#define OB_STOP_NO_RST ((uint8_t)0x40) /*!< No reset generated when entering in STOP */ +#define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */ +/** + * @} + */ + + +/** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY + * @{ + */ +#define OB_STDBY_NO_RST ((uint8_t)0x80) /*!< No reset generated when entering in STANDBY */ +#define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */ +/** + * @} + */ + +/** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level + * @{ + */ +#define OB_BOR_LEVEL3 ((uint8_t)0x00) /*!< Supply voltage ranges from 2.70 to 3.60 V */ +#define OB_BOR_LEVEL2 ((uint8_t)0x04) /*!< Supply voltage ranges from 2.40 to 2.70 V */ +#define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< Supply voltage ranges from 2.10 to 2.40 V */ +#define OB_BOR_OFF ((uint8_t)0x0C) /*!< Supply voltage ranges from 1.62 to 2.10 V */ +/** + * @} + */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup FLASHEx_PCROP_State FLASH PCROP State + * @{ + */ +#define OB_PCROP_STATE_DISABLE 0x00000000U /*!< Disable PCROP */ +#define OB_PCROP_STATE_ENABLE 0x00000001U /*!< Enable PCROP */ +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ + STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +/** @defgroup FLASHEx_Advanced_Option_Type FLASH Advanced Option Type + * @{ + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +#define OPTIONBYTE_PCROP 0x00000001U /*!< PCROP option byte configuration */ +#define OPTIONBYTE_BOOTCONFIG 0x00000002U /*!< BOOTConfig option byte configuration */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +#define OPTIONBYTE_PCROP 0x00000001U /*!= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) || \ + (((ADDRESS) >= FLASH_OTP_BASE) && ((ADDRESS) <= FLASH_OTP_END))) + +#define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL)) + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFF000000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F413xx) || defined(STM32F423xx) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F413xx || STM32F423xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ + +#if defined(STM32F401xC) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F401xC */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ + defined(STM32F412Rx) || defined(STM32F412Cx) +#define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F413xx) || defined(STM32F423xx) +#define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F413xx || STM32F423xx */ + +#if defined(STM32F401xC) +#define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F401xC */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ + defined(STM32F412Rx) || defined(STM32F412Cx) +#define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) +#endif /* STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +#define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +#define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ + STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup FLASHEx_Private_Functions FLASH Private Functions + * @{ + */ +void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange); +void FLASH_FlushCaches(void); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_FLASH_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h new file mode 100644 index 0000000..9fab0c9 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h @@ -0,0 +1,79 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash_ramfunc.h + * @author MCD Application Team + * @brief Header file of FLASH RAMFUNC driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_FLASH_RAMFUNC_H +#define __STM32F4xx_FLASH_RAMFUNC_H + +#ifdef __cplusplus + extern "C" { +#endif +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup FLASH_RAMFUNC + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup FLASH_RAMFUNC_Exported_Functions + * @{ + */ + +/** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1 + * @{ + */ +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void); +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void); +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void); +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ +#ifdef __cplusplus +} +#endif + + +#endif /* __STM32F4xx_FLASH_RAMFUNC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h new file mode 100644 index 0000000..5a17538 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h @@ -0,0 +1,309 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_gpio.h + * @author MCD Application Team + * @brief Header file of GPIO HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_GPIO_H +#define __STM32F4xx_HAL_GPIO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup GPIO + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Types GPIO Exported Types + * @{ + */ + +/** + * @brief GPIO Init structure definition + */ +typedef struct +{ + uint32_t Pin; /*!< Specifies the GPIO pins to be configured. + This parameter can be any value of @ref GPIO_pins_define */ + + uint32_t Mode; /*!< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_mode_define */ + + uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins. + This parameter can be a value of @ref GPIO_pull_define */ + + uint32_t Speed; /*!< Specifies the speed for the selected pins. + This parameter can be a value of @ref GPIO_speed_define */ + + 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; + +/** + * @brief GPIO Bit SET and Bit RESET enumeration + */ +typedef enum +{ + GPIO_PIN_RESET = 0, + GPIO_PIN_SET +}GPIO_PinState; +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup GPIO_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_pins_define GPIO pins define + * @{ + */ +#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 */ +/** + * @} + */ + +/** @defgroup GPIO_mode_define GPIO mode define + * @brief GPIO Configuration Mode + * Elements values convention: 0xX0yz00YZ + * - X : GPIO mode or EXTI Mode + * - y : External IT or Event trigger detection + * - z : IO configuration on External IT or Event + * - Y : Output type (Push Pull or Open Drain) + * - Z : IO Direction mode (Input, Output, Alternate or Analog) + * @{ + */ +#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 0x00000003U /*!< Analog Mode */ + +#define GPIO_MODE_IT_RISING 0x10110000U /*!< External Interrupt Mode with Rising edge trigger detection */ +#define GPIO_MODE_IT_FALLING 0x10210000U /*!< External Interrupt Mode with Falling edge trigger detection */ +#define GPIO_MODE_IT_RISING_FALLING 0x10310000U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ + +#define GPIO_MODE_EVT_RISING 0x10120000U /*!< External Event Mode with Rising edge trigger detection */ +#define GPIO_MODE_EVT_FALLING 0x10220000U /*!< External Event Mode with Falling edge trigger detection */ +#define GPIO_MODE_EVT_RISING_FALLING 0x10320000U /*!< External Event Mode with Rising/Falling edge trigger detection */ +/** + * @} + */ + +/** @defgroup GPIO_speed_define GPIO speed define + * @brief GPIO Output Maximum frequency + * @{ + */ +#define GPIO_SPEED_FREQ_LOW 0x00000000U /*!< IO works at 2 MHz, please refer to the product datasheet */ +#define GPIO_SPEED_FREQ_MEDIUM 0x00000001U /*!< range 12,5 MHz to 50 MHz, please refer to the product datasheet */ +#define GPIO_SPEED_FREQ_HIGH 0x00000002U /*!< range 25 MHz to 100 MHz, please refer to the product datasheet */ +#define GPIO_SPEED_FREQ_VERY_HIGH 0x00000003U /*!< range 50 MHz to 200 MHz, please refer to the product datasheet */ +/** + * @} + */ + + /** @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 */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** + * @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_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR & (__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_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR = (__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_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR & (__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_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR = (__EXTI_LINE__)) + +/** + * @brief Generates a Software interrupt on selected EXTI line. + * @param __EXTI_LINE__ specifies the EXTI line to check. + * This parameter can be GPIO_PIN_x where x can be(0..15) + * @retval None + */ +#define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER |= (__EXTI_LINE__)) +/** + * @} + */ + +/* Include GPIO HAL Extension module */ +#include "stm32f4xx_hal_gpio_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup GPIO_Exported_Functions + * @{ + */ + +/** @addtogroup GPIO_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init); +void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin); +/** + * @} + */ + +/** @addtogroup GPIO_Exported_Functions_Group2 + * @{ + */ +/* 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); +void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin); +void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); + +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup GPIO_Private_Constants GPIO Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup GPIO_Private_Macros GPIO Private Macros + * @{ + */ +#define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) +#define IS_GPIO_PIN(PIN) (((((uint32_t)PIN) & GPIO_PIN_MASK ) != 0x00U) && ((((uint32_t)PIN) & ~GPIO_PIN_MASK) == 0x00U)) +#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\ + ((MODE) == GPIO_MODE_OUTPUT_PP) ||\ + ((MODE) == GPIO_MODE_OUTPUT_OD) ||\ + ((MODE) == GPIO_MODE_AF_PP) ||\ + ((MODE) == GPIO_MODE_AF_OD) ||\ + ((MODE) == GPIO_MODE_IT_RISING) ||\ + ((MODE) == GPIO_MODE_IT_FALLING) ||\ + ((MODE) == GPIO_MODE_IT_RISING_FALLING) ||\ + ((MODE) == GPIO_MODE_EVT_RISING) ||\ + ((MODE) == GPIO_MODE_EVT_FALLING) ||\ + ((MODE) == GPIO_MODE_EVT_RISING_FALLING) ||\ + ((MODE) == GPIO_MODE_ANALOG)) +#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_SPEED_FREQ_LOW) || ((SPEED) == GPIO_SPEED_FREQ_MEDIUM) || \ + ((SPEED) == GPIO_SPEED_FREQ_HIGH) || ((SPEED) == GPIO_SPEED_FREQ_VERY_HIGH)) +#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \ + ((PULL) == GPIO_PULLDOWN)) +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup GPIO_Private_Functions GPIO Private Functions + * @{ + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_GPIO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h new file mode 100644 index 0000000..aa1e34d --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h @@ -0,0 +1,1592 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_gpio_ex.h + * @author MCD Application Team + * @brief Header file of GPIO HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_GPIO_EX_H +#define __STM32F4xx_HAL_GPIO_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup GPIOEx GPIOEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIOEx_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_Alternate_function_selection GPIO Alternate Function Selection + * @{ + */ + +/*------------------------------------------ STM32F429xx/STM32F439xx ---------*/ +#if defined(STM32F429xx) || defined(STM32F439xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ +#define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ +#define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ +#define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */ +#define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#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_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 13 selection + */ +#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ + +/** + * @brief AF 14 selection + */ +#define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F429xx || STM32F439xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F427xx/STM32F437xx------------------*/ +#if defined(STM32F427xx) || defined(STM32F437xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ +#define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ +#define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ +/** @brief GPIO_Legacy + */ +#define GPIO_AF5_I2S3ext GPIO_AF5_SPI3 /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ +#define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */ +#define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ +#define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 13 selection + */ +#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F427xx || STM32F437xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F407xx/STM32F417xx------------------*/ +#if defined(STM32F407xx) || defined(STM32F417xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ +#define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FSMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 13 selection + */ +#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F407xx || STM32F417xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F405xx/STM32F415xx------------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ +#define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FSMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F405xx || STM32F415xx */ + +/*----------------------------------------------------------------------------*/ + +/*---------------------------------------- STM32F401xx------------------------*/ +#if defined(STM32F401xC) || defined(STM32F401xE) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */ +#define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */ + + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F401xC || STM32F401xE */ +/*----------------------------------------------------------------------------*/ + +/*--------------- STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx-------------*/ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ +#define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */ +#define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ +#define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */ +#define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM1 Alternate Function mapping */ +#define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#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_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */ +#define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */ +#define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_DFSDM1 ((uint8_t)0x0A) /* DFSDM1 Alternate Function mapping */ +#define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */ +#define GPIO_AF10_FMC ((uint8_t)0x0A) /* FMC Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ +#define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + +/*----------------------------------------------------------------------------*/ + +/*--------------- STM32F413xx/STM32F423xx-------------------------------------*/ +#if defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief AF 0 selection + */ +#define GPIO_AF0_RTC_50Hz ((uint8_t)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_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ +#define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ +#define GPIO_AF3_DFSDM2 ((uint8_t)0x03) /* DFSDM2 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ +#define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */ +#define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ +#define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ +#define GPIO_AF6_DFSDM2 ((uint8_t)0x06) /* DFSDM2 Alternate Function mapping */ +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF7_SAI1 ((uint8_t)0x07) /* SAI1 Alternate Function mapping */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ +#define GPIO_AF7_DFSDM2 ((uint8_t)0x07) /* DFSDM2 Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ +#define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ +#define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM1 Alternate Function mapping */ +#define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#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_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */ +#define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */ +#define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_SAI1 ((uint8_t)0x0A) /* SAI1 Alternate Function mapping */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_DFSDM1 ((uint8_t)0x0A) /* DFSDM1 Alternate Function mapping */ +#define GPIO_AF10_DFSDM2 ((uint8_t)0x0A) /* DFSDM2 Alternate Function mapping */ +#define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */ +#define GPIO_AF10_FSMC ((uint8_t)0x0A) /* FSMC Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_UART4 ((uint8_t)0x0B) /* UART4 Alternate Function mapping */ +#define GPIO_AF11_UART5 ((uint8_t)0x0B) /* UART5 Alternate Function mapping */ +#define GPIO_AF11_UART9 ((uint8_t)0x0B) /* UART9 Alternate Function mapping */ +#define GPIO_AF11_UART10 ((uint8_t)0x0B) /* UART10 Alternate Function mapping */ +#define GPIO_AF11_CAN3 ((uint8_t)0x0B) /* CAN3 Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ +#define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ + +/** + * @brief AF 14 selection + */ +#define GPIO_AF14_RNG ((uint8_t)0x0E) /* RNG Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F413xx || STM32F423xx */ + +/*---------------------------------------- STM32F411xx------------------------*/ +#if defined(STM32F411xE) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */ +#define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ +#define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */ +#define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F411xE */ + +/*---------------------------------------- STM32F410xx------------------------*/ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ +#if defined(STM32F410Cx) || defined(STM32F410Rx) +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#endif /* STM32F410Cx || STM32F410Rx */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1 Alternate Function mapping */ +#if defined(STM32F410Cx) || defined(STM32F410Rx) +#define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */ +#endif /* STM32F410Cx || STM32F410Rx */ +#define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */ +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */ +#define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +/*---------------------------------------- STM32F446xx -----------------------*/ +#if defined(STM32F446xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ +#define GPIO_AF3_CEC ((uint8_t)0x03) /* CEC Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ +#define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */ +#define GPIO_AF4_CEC ((uint8_t)0x04) /* CEC Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4 Alternate Function mapping */ +#define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_UART5 ((uint8_t)0x07) /* UART5 Alternate Function mapping */ +#define GPIO_AF7_SPI2 ((uint8_t)0x07) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF7_SPDIFRX ((uint8_t)0x07) /* SPDIFRX Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_SPDIFRX ((uint8_t)0x08) /* SPDIFRX Alternate Function mapping */ +#define GPIO_AF8_SAI2 ((uint8_t)0x08) /* SAI2 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#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_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ +#define GPIO_AF10_SAI2 ((uint8_t)0x0A) /* SAI2 Alternate Function mapping */ +#define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 13 selection + */ +#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ + +#endif /* STM32F446xx */ +/*----------------------------------------------------------------------------*/ + +/*-------------------------------- STM32F469xx/STM32F479xx--------------------*/ +#if defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief AF 0 selection + */ +#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_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ +#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ +#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ + +/** + * @brief AF 1 selection + */ +#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ +#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ + +/** + * @brief AF 2 selection + */ +#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ +#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ +#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ + +/** + * @brief AF 3 selection + */ +#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ +#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ +#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ +#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ + +/** + * @brief AF 4 selection + */ +#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ +#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ +#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ + +/** + * @brief AF 5 selection + */ +#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ +#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ +#define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ +#define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ +#define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ +#define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 6 selection + */ +#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ +#define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */ +#define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ + +/** + * @brief AF 7 selection + */ +#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ +#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ +#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ +#define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */ + +/** + * @brief AF 8 selection + */ +#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ +#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ +#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ +#define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */ +#define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ + +/** + * @brief AF 9 selection + */ +#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ +#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ +#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ +#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_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */ +#define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 10 selection + */ +#define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ +#define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */ +#define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */ + +/** + * @brief AF 11 selection + */ +#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ + +/** + * @brief AF 12 selection + */ +#define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ +#define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */ +#define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */ + +/** + * @brief AF 13 selection + */ +#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ +#define GPIO_AF13_DSI ((uint8_t)0x0D) /* DSI Alternate Function mapping */ + +/** + * @brief AF 14 selection + */ +#define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */ + +/** + * @brief AF 15 selection + */ +#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ + +#endif /* STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIOEx_Exported_Macros GPIO Exported Macros + * @{ + */ +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIOEx_Exported_Functions GPIO Exported Functions + * @{ + */ +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup GPIOEx_Private_Constants GPIO Private Constants + * @{ + */ +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup GPIOEx_Private_Macros GPIO Private Macros + * @{ + */ +/** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index + * @{ + */ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) +#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 : 8U) +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +#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) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ + ((__GPIOx__) == (GPIOB))? 1U :\ + ((__GPIOx__) == (GPIOC))? 2U : 7U) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +#define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ + ((__GPIOx__) == (GPIOB))? 1U :\ + ((__GPIOx__) == (GPIOC))? 2U :\ + ((__GPIOx__) == (GPIOD))? 3U :\ + ((__GPIOx__) == (GPIOE))? 4U : 7U) +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ + +#if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#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 : 7U) +#endif /* STM32F446xx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) +#define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ + ((__GPIOx__) == (GPIOB))? 1U :\ + ((__GPIOx__) == (GPIOC))? 2U :\ + ((__GPIOx__) == (GPIOD))? 3U :\ + ((__GPIOx__) == (GPIOE))? 4U : 7U) +#endif /* STM32F412Vx */ +#if defined(STM32F412Rx) +#define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ + ((__GPIOx__) == (GPIOB))? 1U :\ + ((__GPIOx__) == (GPIOC))? 2U :\ + ((__GPIOx__) == (GPIOD))? 3U : 7U) +#endif /* STM32F412Rx */ +#if defined(STM32F412Cx) +#define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ + ((__GPIOx__) == (GPIOB))? 1U :\ + ((__GPIOx__) == (GPIOC))? 2U : 7U) +#endif /* STM32F412Cx */ + +/** + * @} + */ + +/** @defgroup GPIOEx_IS_Alternat_function_selection GPIO Check Alternate Function + * @{ + */ +/*------------------------- STM32F429xx/STM32F439xx---------------------------*/ +#if defined(STM32F429xx) || defined(STM32F439xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \ + ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \ + ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \ + ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \ + ((AF) == GPIO_AF14_LTDC)) + +#endif /* STM32F429xx || STM32F439xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F427xx/STM32F437xx------------------*/ +#if defined(STM32F427xx) || defined(STM32F437xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \ + ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \ + ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \ + ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1)) + +#endif /* STM32F427xx || STM32F437xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F407xx/STM32F417xx------------------*/ +#if defined(STM32F407xx) || defined(STM32F417xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \ + ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT)) + +#endif /* STM32F407xx || STM32F417xx */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F405xx/STM32F415xx------------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO) || \ + ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT)) + +#endif /* STM32F405xx || STM32F415xx */ + +/*----------------------------------------------------------------------------*/ + +/*---------------------------------------- STM32F401xx------------------------*/ +#if defined(STM32F401xC) || defined(STM32F401xE) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF12_SDIO) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \ + ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \ + ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \ + ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \ + ((AF) == GPIO_AF15_EVENTOUT)) + +#endif /* STM32F401xC || STM32F401xE */ +/*----------------------------------------------------------------------------*/ +/*---------------------------------------- STM32F410xx------------------------*/ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_GPIO_AF(AF) (((AF) < 10U) || ((AF) == 15U)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +/*---------------------------------------- STM32F411xx------------------------*/ +#if defined(STM32F411xE) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \ + ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \ + ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \ + ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI4) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF6_SPI5) || ((AF) == GPIO_AF7_SPI3) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \ + ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT)) + +#endif /* STM32F411xE */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------- STM32F446xx ----------------*/ +#if defined(STM32F446xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \ + ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \ + ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \ + ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI2) || \ + ((AF) == GPIO_AF6_SPI4) || ((AF) == GPIO_AF7_UART5) || \ + ((AF) == GPIO_AF7_SPI2) || ((AF) == GPIO_AF7_SPI3) || \ + ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \ + ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF9_QSPI) || \ + ((AF) == GPIO_AF10_SAI2) || ((AF) == GPIO_AF10_QSPI)) + +#endif /* STM32F446xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------------------------------- STM32F469xx/STM32F479xx --------*/ +#if defined(STM32F469xx) || defined(STM32F479xx) +#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \ + ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \ + ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \ + ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \ + ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \ + ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \ + ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \ + ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \ + ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \ + ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \ + ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \ + ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \ + ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \ + ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \ + ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \ + ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \ + ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \ + ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \ + ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \ + ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \ + ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \ + ((AF) == GPIO_AF14_LTDC) || ((AF) == GPIO_AF13_DSI) || \ + ((AF) == GPIO_AF9_QSPI) || ((AF) == GPIO_AF10_QSPI)) + +#endif /* STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx-----------*/ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) +#define IS_GPIO_AF(AF) (((AF) < 16U) && ((AF) != 11U) && ((AF) != 14U) && ((AF) != 13U)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ +/*----------------------------------------------------------------------------*/ + +/*------------------STM32F413xx/STM32F423xx-----------------------------------*/ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define IS_GPIO_AF(AF) (((AF) < 16U) && ((AF) != 13U)) +#endif /* STM32F413xx || STM32F423xx */ +/*----------------------------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup GPIOEx_Private_Functions GPIO Private Functions + * @{ + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_GPIO_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h new file mode 100644 index 0000000..6f3bf71 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h @@ -0,0 +1,431 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_pwr.h + * @author MCD Application Team + * @brief Header file of PWR HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_PWR_H +#define __STM32F4xx_HAL_PWR_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup PWR + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup PWR_Exported_Types PWR Exported Types + * @{ + */ + +/** + * @brief PWR PVD configuration structure definition + */ +typedef struct +{ + uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. + 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 */ +}PWR_PVDTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWR_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins + * @{ + */ +#define PWR_WAKEUP_PIN1 0x00000100U +/** + * @} + */ + +/** @defgroup PWR_PVD_detection_level PWR PVD detection level + * @{ + */ +#define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0 +#define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1 +#define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2 +#define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3 +#define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4 +#define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5 +#define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6 +#define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7/* External input analog voltage + (Compare internally to VREFINT) */ +/** + * @} + */ + +/** @defgroup PWR_PVD_Mode PWR PVD Mode + * @{ + */ +#define PWR_PVD_MODE_NORMAL 0x00000000U /*!< basic mode is used */ +#define PWR_PVD_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */ +#define PWR_PVD_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */ +#define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ +#define PWR_PVD_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */ +#define PWR_PVD_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */ +#define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */ +/** + * @} + */ + + +/** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in SLEEP/STOP mode + * @{ + */ +#define PWR_MAINREGULATOR_ON 0x00000000U +#define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS +/** + * @} + */ + +/** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry + * @{ + */ +#define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) +#define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) +/** + * @} + */ + +/** @defgroup PWR_STOP_mode_entry PWR STOP mode entry + * @{ + */ +#define PWR_STOPENTRY_WFI ((uint8_t)0x01) +#define PWR_STOPENTRY_WFE ((uint8_t)0x02) +/** + * @} + */ + +/** @defgroup PWR_Flag PWR Flag + * @{ + */ +#define PWR_FLAG_WU PWR_CSR_WUF +#define PWR_FLAG_SB PWR_CSR_SBF +#define PWR_FLAG_PVDO PWR_CSR_PVDO +#define PWR_FLAG_BRR PWR_CSR_BRR +#define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWR_Exported_Macro PWR Exported Macro + * @{ + */ + +/** @brief Check PWR flag is set or not. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event + * was received from the WKUP pin or from the RTC alarm (Alarm A + * or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup. + * An additional wakeup event is detected if the WKUP pin is enabled + * (by setting the EWUP bit) when the WKUP pin level is already high. + * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was + * resumed from StandBy mode. + * @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_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_VOSRDY: This flag indicates that the Regulator voltage + * scaling output selection is ready. + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the PWR's pending flags. + * @param __FLAG__ specifies the flag to clear. + * This parameter can be one of the following values: + * @arg PWR_FLAG_WU: Wake Up flag + * @arg PWR_FLAG_SB: StandBy flag + */ +#define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U) + +/** + * @brief Enable the PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD)) + +/** + * @brief Disable the PVD EXTI Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD)) + +/** + * @brief Enable event on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD)) + +/** + * @brief Disable event on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD)) + +/** + * @brief Enable the PVD Extended Interrupt Rising Trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) + +/** + * @brief Disable the PVD Extended Interrupt Rising Trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) + +/** + * @brief Enable the PVD Extended Interrupt Falling Trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) + + +/** + * @brief Disable the PVD Extended Interrupt Falling Trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) + + +/** + * @brief PVD EXTI line configuration: set rising & falling edge trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();\ + __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();\ + }while(0U) + +/** + * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger. + * This parameter can be: + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();\ + __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();\ + }while(0U) + +/** + * @brief checks whether the specified PVD Exti interrupt flag is set or not. + * @retval EXTI PVD Line Status. + */ +#define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD)) + +/** + * @brief Clear the PVD Exti flag. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD)) + +/** + * @brief Generates a Software interrupt on PVD EXTI line. + * @retval None + */ +#define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD)) + +/** + * @} + */ + +/* Include PWR HAL Extension module */ +#include "stm32f4xx_hal_pwr_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup PWR_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +void HAL_PWR_DeInit(void); +void HAL_PWR_EnableBkUpAccess(void); +void HAL_PWR_DisableBkUpAccess(void); +/** + * @} + */ + +/** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions + * @{ + */ +/* Peripheral Control functions **********************************************/ +/* PVD configuration */ +void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD); +void HAL_PWR_EnablePVD(void); +void HAL_PWR_DisablePVD(void); + +/* WakeUp pins configuration */ +void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); +void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); + +/* Low Power modes entry */ +void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); +void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); +void HAL_PWR_EnterSTANDBYMode(void); + +/* Power PVD IRQ Handler */ +void HAL_PWR_PVD_IRQHandler(void); +void HAL_PWR_PVDCallback(void); + +/* Cortex System Control functions *******************************************/ +void HAL_PWR_EnableSleepOnExit(void); +void HAL_PWR_DisableSleepOnExit(void); +void HAL_PWR_EnableSEVOnPend(void); +void HAL_PWR_DisableSEVOnPend(void); +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup PWR_Private_Constants PWR Private Constants + * @{ + */ + +/** @defgroup PWR_PVD_EXTI_Line PWR PVD EXTI Line + * @{ + */ +#define PWR_EXTI_LINE_PVD ((uint32_t)EXTI_IMR_MR16) /*!< External interrupt line 16 Connected to the PVD EXTI Line */ +/** + * @} + */ + +/** @defgroup PWR_register_alias_address PWR Register alias address + * @{ + */ +/* ------------- PWR registers bit address in the alias region ---------------*/ +#define PWR_OFFSET (PWR_BASE - PERIPH_BASE) +#define PWR_CR_OFFSET 0x00U +#define PWR_CSR_OFFSET 0x04U +#define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET) +#define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET) +/** + * @} + */ + +/** @defgroup PWR_CR_register_alias PWR CR Register alias address + * @{ + */ +/* --- CR Register ---*/ +/* Alias word address of DBP bit */ +#define DBP_BIT_NUMBER PWR_CR_DBP_Pos +#define CR_DBP_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (DBP_BIT_NUMBER * 4U)) + +/* Alias word address of PVDE bit */ +#define PVDE_BIT_NUMBER PWR_CR_PVDE_Pos +#define CR_PVDE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PVDE_BIT_NUMBER * 4U)) + +/* Alias word address of VOS bit */ +#define VOS_BIT_NUMBER PWR_CR_VOS_Pos +#define CR_VOS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (VOS_BIT_NUMBER * 4U)) +/** + * @} + */ + +/** @defgroup PWR_CSR_register_alias PWR CSR Register alias address + * @{ + */ +/* --- CSR Register ---*/ +/* Alias word address of EWUP bit */ +#define EWUP_BIT_NUMBER PWR_CSR_EWUP_Pos +#define CSR_EWUP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (EWUP_BIT_NUMBER * 4U)) +/** + * @} + */ + +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PWR_Private_Macros PWR Private Macros + * @{ + */ + +/** @defgroup PWR_IS_PWR_Definitions PWR Private macros to check input parameters + * @{ + */ +#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \ + ((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)) +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __STM32F4xx_HAL_PWR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h new file mode 100644 index 0000000..10e017a --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h @@ -0,0 +1,344 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_pwr_ex.h + * @author MCD Application Team + * @brief Header file of PWR HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_PWR_EX_H +#define __STM32F4xx_HAL_PWR_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup PWREx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWREx_Exported_Constants PWREx Exported Constants + * @{ + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/** @defgroup PWREx_Regulator_state_in_UnderDrive_mode PWREx Regulator state in UnderDrive mode + * @{ + */ +#define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS +#define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS)) +/** + * @} + */ + +/** @defgroup PWREx_Over_Under_Drive_Flag PWREx Over Under Drive Flag + * @{ + */ +#define PWR_FLAG_ODRDY PWR_CSR_ODRDY +#define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY +#define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +/** @defgroup PWREx_Regulator_Voltage_Scale PWREx Regulator Voltage Scale + * @{ + */ +#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx) +#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK = 168 MHz. */ +#define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U /* Scale 2 mode: the maximum value of fHCLK = 144 MHz. */ +#else +#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK is 168 MHz. It can be extended to + 180 MHz by activating the over-drive mode. */ +#define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1 /* Scale 2 mode: the maximum value of fHCLK is 144 MHz. It can be extended to + 168 MHz by activating the over-drive mode. */ +#define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0 /* Scale 3 mode: the maximum value of fHCLK is 120 MHz. */ +#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */ +/** + * @} + */ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup PWREx_WakeUp_Pins PWREx WakeUp Pins + * @{ + */ +#define PWR_WAKEUP_PIN2 0x00000080U +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +#define PWR_WAKEUP_PIN3 0x00000040U +#endif /* STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Zx || STM32F412Vx || \ + STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +/** + * @} + */ +#endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || + STM32F413xx || STM32F423xx */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWREx_Exported_Constants PWREx Exported Constants + * @{ + */ + +#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx) +/** @brief macros configure the main internal regulator output voltage. + * @param __REGULATOR__ specifies the regulator output voltage to achieve + * 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_SCALE1: Regulator voltage output Scale 1 mode + * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode + * @retval None + */ +#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \ + __IO uint32_t tmpreg = 0x00U; \ + MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \ + UNUSED(tmpreg); \ + } while(0U) +#else +/** @brief macros configure the main internal regulator output voltage. + * @param __REGULATOR__ specifies the regulator output voltage to achieve + * 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_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 + * @retval None + */ +#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \ + __IO uint32_t tmpreg = 0x00U; \ + MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macros to enable or disable the Over drive mode. + * @note These macros can be used only for STM32F42xx/STM3243xx devices. + */ +#define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE) +#define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE) + +/** @brief Macros to enable or disable the Over drive switching. + * @note These macros can be used only for STM32F42xx/STM3243xx devices. + */ +#define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE) +#define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE) + +/** @brief Macros to enable or disable the Under drive mode. + * @note This mode is enabled only with STOP low power mode. + * In this mode, the 1.2V domain is preserved in reduced leakage mode. This + * mode is only available when the main regulator or the low power regulator + * is in low voltage mode. + * @note If the Under-drive mode was enabled, it is automatically disabled after + * exiting Stop mode. + * When the voltage regulator operates in Under-drive mode, an additional + * startup delay is induced when waking up from Stop mode. + */ +#define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN) +#define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN)) + +/** @brief Check PWR flag is set or not. + * @note These macros can be used only for STM32F42xx/STM3243xx devices. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode + * is ready + * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode + * switching is ready + * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode + * is enabled in Stop mode + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the Under-Drive Ready flag. + * @note These macros can be used only for STM32F42xx/STM3243xx devices. + */ +#define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY) + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup PWREx_Exported_Functions PWREx Exported Functions + * @{ + */ + +/** @addtogroup PWREx_Exported_Functions_Group1 + * @{ + */ +void HAL_PWREx_EnableFlashPowerDown(void); +void HAL_PWREx_DisableFlashPowerDown(void); +HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void); +HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void); +uint32_t HAL_PWREx_GetVoltageRange(void); +HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling); + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\ + defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +void HAL_PWREx_EnableMainRegulatorLowVoltage(void); +void HAL_PWREx_DisableMainRegulatorLowVoltage(void); +void HAL_PWREx_EnableLowRegulatorLowVoltage(void); +void HAL_PWREx_DisableLowRegulatorLowVoltage(void); +#endif /* STM32F410xx || STM32F401xC || STM32F401xE || STM32F411xE || STM32F412Zx || STM32F412Vx ||\ + STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void); +HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void); +HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry); +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup PWREx_Private_Constants PWREx Private Constants + * @{ + */ + +/** @defgroup PWREx_register_alias_address PWREx Register alias address + * @{ + */ +/* ------------- PWR registers bit address in the alias region ---------------*/ +/* --- CR Register ---*/ +/* Alias word address of FPDS bit */ +#define FPDS_BIT_NUMBER PWR_CR_FPDS_Pos +#define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U)) + +/* Alias word address of ODEN bit */ +#define ODEN_BIT_NUMBER PWR_CR_ODEN_Pos +#define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U)) + +/* Alias word address of ODSWEN bit */ +#define ODSWEN_BIT_NUMBER PWR_CR_ODSWEN_Pos +#define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U)) + +/* Alias word address of MRLVDS bit */ +#define MRLVDS_BIT_NUMBER PWR_CR_MRLVDS_Pos +#define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U)) + +/* Alias word address of LPLVDS bit */ +#define LPLVDS_BIT_NUMBER PWR_CR_LPLVDS_Pos +#define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U)) + + /** + * @} + */ + +/** @defgroup PWREx_CSR_register_alias PWRx CSR Register alias address + * @{ + */ +/* --- CSR Register ---*/ +/* Alias word address of BRE bit */ +#define BRE_BIT_NUMBER PWR_CSR_BRE_Pos +#define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U)) + +/** + * @} + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PWREx_Private_Macros PWREx Private Macros + * @{ + */ + +/** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters + * @{ + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \ + ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx) +#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \ + ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2)) +#else +#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \ + ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \ + ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3)) +#endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */ + +#if defined(STM32F446xx) +#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2)) +#elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \ + ((PIN) == PWR_WAKEUP_PIN3)) +#else +#define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1) +#endif /* STM32F446xx */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __STM32F4xx_HAL_PWR_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h new file mode 100644 index 0000000..36a639b --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h @@ -0,0 +1,1464 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_rcc.h + * @author MCD Application Team + * @brief Header file of RCC HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_RCC_H +#define __STM32F4xx_HAL_RCC_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/* Include RCC HAL Extended module */ +/* (include on top of file since RCC structures are defined in extended file) */ +#include "stm32f4xx_hal_rcc_ex.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup RCC + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup RCC_Exported_Types RCC Exported Types + * @{ + */ + +/** + * @brief RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition + */ +typedef struct +{ + uint32_t OscillatorType; /*!< The oscillators to be configured. + This parameter can be a value of @ref RCC_Oscillator_Type */ + + uint32_t HSEState; /*!< The new state of the HSE. + This parameter can be a value of @ref RCC_HSE_Config */ + + uint32_t LSEState; /*!< The new state of the LSE. + This parameter can be a value of @ref RCC_LSE_Config */ + + uint32_t HSIState; /*!< The new state of the HSI. + This parameter can be a value of @ref RCC_HSI_Config */ + + uint32_t HSICalibrationValue; /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT). + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */ + + uint32_t LSIState; /*!< The new state of the LSI. + This parameter can be a value of @ref RCC_LSI_Config */ + + RCC_PLLInitTypeDef PLL; /*!< PLL structure parameters */ +}RCC_OscInitTypeDef; + +/** + * @brief RCC System, AHB and APB busses clock configuration structure definition + */ +typedef struct +{ + uint32_t ClockType; /*!< The clock to be configured. + This parameter can be a value of @ref RCC_System_Clock_Type */ + + uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock. + This parameter can be a value of @ref RCC_System_Clock_Source */ + + uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). + This parameter can be a value of @ref RCC_AHB_Clock_Source */ + + uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ + + uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ + +}RCC_ClkInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RCC_Exported_Constants RCC Exported Constants + * @{ + */ + +/** @defgroup RCC_Oscillator_Type Oscillator Type + * @{ + */ +#define RCC_OSCILLATORTYPE_NONE 0x00000000U +#define RCC_OSCILLATORTYPE_HSE 0x00000001U +#define RCC_OSCILLATORTYPE_HSI 0x00000002U +#define RCC_OSCILLATORTYPE_LSE 0x00000004U +#define RCC_OSCILLATORTYPE_LSI 0x00000008U +/** + * @} + */ + +/** @defgroup RCC_HSE_Config HSE Config + * @{ + */ +#define RCC_HSE_OFF 0x00000000U +#define RCC_HSE_ON RCC_CR_HSEON +#define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON)) +/** + * @} + */ + +/** @defgroup RCC_LSE_Config LSE Config + * @{ + */ +#define RCC_LSE_OFF 0x00000000U +#define RCC_LSE_ON RCC_BDCR_LSEON +#define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) +/** + * @} + */ + +/** @defgroup RCC_HSI_Config HSI Config + * @{ + */ +#define RCC_HSI_OFF ((uint8_t)0x00) +#define RCC_HSI_ON ((uint8_t)0x01) + +#define RCC_HSICALIBRATION_DEFAULT 0x10U /* Default HSI calibration trimming value */ +/** + * @} + */ + +/** @defgroup RCC_LSI_Config LSI Config + * @{ + */ +#define RCC_LSI_OFF ((uint8_t)0x00) +#define RCC_LSI_ON ((uint8_t)0x01) +/** + * @} + */ + +/** @defgroup RCC_PLL_Config PLL Config + * @{ + */ +#define RCC_PLL_NONE ((uint8_t)0x00) +#define RCC_PLL_OFF ((uint8_t)0x01) +#define RCC_PLL_ON ((uint8_t)0x02) +/** + * @} + */ + +/** @defgroup RCC_PLLP_Clock_Divider PLLP Clock Divider + * @{ + */ +#define RCC_PLLP_DIV2 0x00000002U +#define RCC_PLLP_DIV4 0x00000004U +#define RCC_PLLP_DIV6 0x00000006U +#define RCC_PLLP_DIV8 0x00000008U +/** + * @} + */ + +/** @defgroup RCC_PLL_Clock_Source PLL Clock Source + * @{ + */ +#define RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI +#define RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Type System Clock Type + * @{ + */ +#define RCC_CLOCKTYPE_SYSCLK 0x00000001U +#define RCC_CLOCKTYPE_HCLK 0x00000002U +#define RCC_CLOCKTYPE_PCLK1 0x00000004U +#define RCC_CLOCKTYPE_PCLK2 0x00000008U +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Source System Clock Source + * @note The RCC_SYSCLKSOURCE_PLLRCLK parameter is available only for + * STM32F446xx devices. + * @{ + */ +#define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI +#define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE +#define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL +#define RCC_SYSCLKSOURCE_PLLRCLK ((uint32_t)(RCC_CFGR_SW_0 | RCC_CFGR_SW_1)) +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Source_Status System Clock Source Status + * @note The RCC_SYSCLKSOURCE_STATUS_PLLRCLK parameter is available only for + * STM32F446xx devices. + * @{ + */ +#define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */ +#define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */ +#define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */ +#define RCC_SYSCLKSOURCE_STATUS_PLLRCLK ((uint32_t)(RCC_CFGR_SWS_0 | RCC_CFGR_SWS_1)) /*!< PLLR used as system clock */ +/** + * @} + */ + +/** @defgroup RCC_AHB_Clock_Source AHB Clock Source + * @{ + */ +#define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 +#define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 +#define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 +#define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 +#define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 +#define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 +#define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 +#define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 +#define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 +/** + * @} + */ + +/** @defgroup RCC_APB1_APB2_Clock_Source APB1/APB2 Clock Source + * @{ + */ +#define RCC_HCLK_DIV1 RCC_CFGR_PPRE1_DIV1 +#define RCC_HCLK_DIV2 RCC_CFGR_PPRE1_DIV2 +#define RCC_HCLK_DIV4 RCC_CFGR_PPRE1_DIV4 +#define RCC_HCLK_DIV8 RCC_CFGR_PPRE1_DIV8 +#define RCC_HCLK_DIV16 RCC_CFGR_PPRE1_DIV16 +/** + * @} + */ + +/** @defgroup RCC_RTC_Clock_Source RTC Clock Source + * @{ + */ +#define RCC_RTCCLKSOURCE_NO_CLK 0x00000000U +#define RCC_RTCCLKSOURCE_LSE 0x00000100U +#define RCC_RTCCLKSOURCE_LSI 0x00000200U +#define RCC_RTCCLKSOURCE_HSE_DIVX 0x00000300U +#define RCC_RTCCLKSOURCE_HSE_DIV2 0x00020300U +#define RCC_RTCCLKSOURCE_HSE_DIV3 0x00030300U +#define RCC_RTCCLKSOURCE_HSE_DIV4 0x00040300U +#define RCC_RTCCLKSOURCE_HSE_DIV5 0x00050300U +#define RCC_RTCCLKSOURCE_HSE_DIV6 0x00060300U +#define RCC_RTCCLKSOURCE_HSE_DIV7 0x00070300U +#define RCC_RTCCLKSOURCE_HSE_DIV8 0x00080300U +#define RCC_RTCCLKSOURCE_HSE_DIV9 0x00090300U +#define RCC_RTCCLKSOURCE_HSE_DIV10 0x000A0300U +#define RCC_RTCCLKSOURCE_HSE_DIV11 0x000B0300U +#define RCC_RTCCLKSOURCE_HSE_DIV12 0x000C0300U +#define RCC_RTCCLKSOURCE_HSE_DIV13 0x000D0300U +#define RCC_RTCCLKSOURCE_HSE_DIV14 0x000E0300U +#define RCC_RTCCLKSOURCE_HSE_DIV15 0x000F0300U +#define RCC_RTCCLKSOURCE_HSE_DIV16 0x00100300U +#define RCC_RTCCLKSOURCE_HSE_DIV17 0x00110300U +#define RCC_RTCCLKSOURCE_HSE_DIV18 0x00120300U +#define RCC_RTCCLKSOURCE_HSE_DIV19 0x00130300U +#define RCC_RTCCLKSOURCE_HSE_DIV20 0x00140300U +#define RCC_RTCCLKSOURCE_HSE_DIV21 0x00150300U +#define RCC_RTCCLKSOURCE_HSE_DIV22 0x00160300U +#define RCC_RTCCLKSOURCE_HSE_DIV23 0x00170300U +#define RCC_RTCCLKSOURCE_HSE_DIV24 0x00180300U +#define RCC_RTCCLKSOURCE_HSE_DIV25 0x00190300U +#define RCC_RTCCLKSOURCE_HSE_DIV26 0x001A0300U +#define RCC_RTCCLKSOURCE_HSE_DIV27 0x001B0300U +#define RCC_RTCCLKSOURCE_HSE_DIV28 0x001C0300U +#define RCC_RTCCLKSOURCE_HSE_DIV29 0x001D0300U +#define RCC_RTCCLKSOURCE_HSE_DIV30 0x001E0300U +#define RCC_RTCCLKSOURCE_HSE_DIV31 0x001F0300U +/** + * @} + */ + +/** @defgroup RCC_MCO_Index MCO Index + * @{ + */ +#define RCC_MCO1 0x00000000U +#define RCC_MCO2 0x00000001U +/** + * @} + */ + +/** @defgroup RCC_MCO1_Clock_Source MCO1 Clock Source + * @{ + */ +#define RCC_MCO1SOURCE_HSI 0x00000000U +#define RCC_MCO1SOURCE_LSE RCC_CFGR_MCO1_0 +#define RCC_MCO1SOURCE_HSE RCC_CFGR_MCO1_1 +#define RCC_MCO1SOURCE_PLLCLK RCC_CFGR_MCO1 +/** + * @} + */ + +/** @defgroup RCC_MCOx_Clock_Prescaler MCOx Clock Prescaler + * @{ + */ +#define RCC_MCODIV_1 0x00000000U +#define RCC_MCODIV_2 RCC_CFGR_MCO1PRE_2 +#define RCC_MCODIV_3 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_2) +#define RCC_MCODIV_4 ((uint32_t)RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2) +#define RCC_MCODIV_5 RCC_CFGR_MCO1PRE +/** + * @} + */ + +/** @defgroup RCC_Interrupt Interrupts + * @{ + */ +#define RCC_IT_LSIRDY ((uint8_t)0x01) +#define RCC_IT_LSERDY ((uint8_t)0x02) +#define RCC_IT_HSIRDY ((uint8_t)0x04) +#define RCC_IT_HSERDY ((uint8_t)0x08) +#define RCC_IT_PLLRDY ((uint8_t)0x10) +#define RCC_IT_PLLI2SRDY ((uint8_t)0x20) +#define RCC_IT_CSS ((uint8_t)0x80) +/** + * @} + */ + +/** @defgroup RCC_Flag Flags + * Elements values convention: 0XXYYYYYb + * - YYYYY : Flag position in the register + * - 0XX : Register index + * - 01: CR register + * - 10: BDCR register + * - 11: CSR register + * @{ + */ +/* Flags in the CR register */ +#define RCC_FLAG_HSIRDY ((uint8_t)0x21) +#define RCC_FLAG_HSERDY ((uint8_t)0x31) +#define RCC_FLAG_PLLRDY ((uint8_t)0x39) +#define RCC_FLAG_PLLI2SRDY ((uint8_t)0x3B) + +/* Flags in the BDCR register */ +#define RCC_FLAG_LSERDY ((uint8_t)0x41) + +/* Flags in the CSR register */ +#define RCC_FLAG_LSIRDY ((uint8_t)0x61) +#define RCC_FLAG_BORRST ((uint8_t)0x79) +#define RCC_FLAG_PINRST ((uint8_t)0x7A) +#define RCC_FLAG_PORRST ((uint8_t)0x7B) +#define RCC_FLAG_SFTRST ((uint8_t)0x7C) +#define RCC_FLAG_IWDGRST ((uint8_t)0x7D) +#define RCC_FLAG_WWDGRST ((uint8_t)0x7E) +#define RCC_FLAG_LPWRRST ((uint8_t)0x7F) +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RCC_Exported_Macros RCC Exported Macros + * @{ + */ + +/** @defgroup RCC_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOA_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOB_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOH_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DMA1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DMA2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOAEN)) +#define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOBEN)) +#define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOCEN)) +#define __HAL_RCC_GPIOH_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOHEN)) +#define __HAL_RCC_DMA1_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA1EN)) +#define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2EN)) +/** + * @} + */ + +/** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOAEN)) != RESET) +#define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOBEN)) != RESET) +#define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOCEN)) != RESET) +#define __HAL_RCC_GPIOH_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOHEN)) != RESET) +#define __HAL_RCC_DMA1_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_DMA1EN)) != RESET) +#define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_DMA2EN)) != RESET) + +#define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOAEN)) == RESET) +#define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOBEN)) == RESET) +#define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOCEN)) == RESET) +#define __HAL_RCC_GPIOH_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_GPIOHEN)) == RESET) +#define __HAL_RCC_DMA1_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_DMA1EN)) == RESET) +#define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHB1ENR &(RCC_AHB1ENR_DMA2EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_WWDG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_PWR_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN)) +#define __HAL_RCC_WWDG_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_WWDGEN)) +#define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN)) +#define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN)) +#define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN)) +#define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN)) +#define __HAL_RCC_PWR_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN)) +/** + * @} + */ + +/** @defgroup RCC_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET) +#define __HAL_RCC_WWDG_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != RESET) +#define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET) +#define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET) +#define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET) +#define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET) +#define __HAL_RCC_PWR_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != RESET) + +#define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET) +#define __HAL_RCC_WWDG_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == RESET) +#define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET) +#define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET) +#define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET) +#define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET) +#define __HAL_RCC_PWR_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == RESET) +/** + * @} + */ + +/** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SYSCFG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM9_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM11_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN)) +#define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN)) +#define __HAL_RCC_USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN)) +#define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN)) +#define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN)) +#define __HAL_RCC_SYSCFG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SYSCFGEN)) +#define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN)) +#define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN)) +/** + * @} + */ + +/** @defgroup RCC_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET) +#define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET) +#define __HAL_RCC_USART6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) != RESET) +#define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET) +#define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET) +#define __HAL_RCC_SYSCFG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) != RESET) +#define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET) +#define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET) + +#define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET) +#define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET) +#define __HAL_RCC_USART6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) == RESET) +#define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET) +#define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET) +#define __HAL_RCC_SYSCFG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) == RESET) +#define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET) +#define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCC_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB1_FORCE_RESET() (RCC->AHB1RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOARST)) +#define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOBRST)) +#define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOCRST)) +#define __HAL_RCC_GPIOH_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOHRST)) +#define __HAL_RCC_DMA1_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA1RST)) +#define __HAL_RCC_DMA2_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2RST)) + +#define __HAL_RCC_AHB1_RELEASE_RESET() (RCC->AHB1RSTR = 0x00U) +#define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOARST)) +#define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOBRST)) +#define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOCRST)) +#define __HAL_RCC_GPIOH_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOHRST)) +#define __HAL_RCC_DMA1_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA1RST)) +#define __HAL_RCC_DMA2_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2RST)) +/** + * @} + */ + +/** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB1RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST)) +#define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST)) +#define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST)) +#define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST)) +#define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST)) +#define __HAL_RCC_PWR_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST)) + +#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00U) +#define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_WWDG_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_WWDGRST)) +#define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST)) +#define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST)) +#define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST)) +#define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST)) +#define __HAL_RCC_PWR_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_PWRRST)) +/** + * @} + */ + +/** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST)) +#define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST)) +#define __HAL_RCC_USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST)) +#define __HAL_RCC_ADC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADCRST)) +#define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST)) +#define __HAL_RCC_SYSCFG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SYSCFGRST)) +#define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST)) +#define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST)) + +#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00U) +#define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST)) +#define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST)) +#define __HAL_RCC_USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST)) +#define __HAL_RCC_ADC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADCRST)) +#define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST)) +#define __HAL_RCC_SYSCFG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SYSCFGRST)) +#define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST)) +#define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST)) +/** + * @} + */ + +/** @defgroup RCC_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOALPEN)) +#define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOBLPEN)) +#define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOCLPEN)) +#define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOHLPEN)) +#define __HAL_RCC_DMA1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA1LPEN)) +#define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2LPEN)) + +#define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOALPEN)) +#define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOBLPEN)) +#define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOCLPEN)) +#define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOHLPEN)) +#define __HAL_RCC_DMA1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA1LPEN)) +#define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2LPEN)) +/** + * @} + */ + +/** @defgroup RCC_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM5LPEN)) +#define __HAL_RCC_WWDG_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_WWDGLPEN)) +#define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI2LPEN)) +#define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART2LPEN)) +#define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C1LPEN)) +#define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C2LPEN)) +#define __HAL_RCC_PWR_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_PWRLPEN)) + +#define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM5LPEN)) +#define __HAL_RCC_WWDG_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_WWDGLPEN)) +#define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI2LPEN)) +#define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART2LPEN)) +#define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C1LPEN)) +#define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C2LPEN)) +#define __HAL_RCC_PWR_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_PWRLPEN)) +/** + * @} + */ + +/** @defgroup RCC_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM1LPEN)) +#define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART1LPEN)) +#define __HAL_RCC_USART6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART6LPEN)) +#define __HAL_RCC_ADC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC1LPEN)) +#define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI1LPEN)) +#define __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SYSCFGLPEN)) +#define __HAL_RCC_TIM9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM9LPEN)) +#define __HAL_RCC_TIM11_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM11LPEN)) + +#define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM1LPEN)) +#define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART1LPEN)) +#define __HAL_RCC_USART6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART6LPEN)) +#define __HAL_RCC_ADC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC1LPEN)) +#define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI1LPEN)) +#define __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SYSCFGLPEN)) +#define __HAL_RCC_TIM9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM9LPEN)) +#define __HAL_RCC_TIM11_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM11LPEN)) +/** + * @} + */ + +/** @defgroup RCC_HSI_Configuration HSI Configuration + * @{ + */ + +/** @brief Macros to enable or disable the Internal High Speed oscillator (HSI). + * @note The HSI is stopped by hardware when entering STOP and STANDBY modes. + * It is used (enabled by hardware) as system clock source after startup + * from Reset, wake-up from STOP and STANDBY mode, or in case of failure + * of the HSE used directly or indirectly as system clock (if the Clock + * Security System CSS is enabled). + * @note HSI can not be stopped if it is used as system clock source. In this case, + * you have to select another source of the system clock then stop the HSI. + * @note After enabling the HSI, the application software should wait on HSIRDY + * flag to be set indicating that HSI clock is stable and can be used as + * system clock source. + * This parameter can be: ENABLE or DISABLE. + * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator + * clock cycles. + */ +#define __HAL_RCC_HSI_ENABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = ENABLE) +#define __HAL_RCC_HSI_DISABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = DISABLE) + +/** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value. + * @note The calibration is used to compensate for the variations in voltage + * and temperature that influence the frequency of the internal HSI RC. + * @param __HSICalibrationValue__ specifies the calibration trimming value. + * (default is RCC_HSICALIBRATION_DEFAULT). + * This parameter must be a number between 0 and 0x1F. + */ +#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICalibrationValue__) (MODIFY_REG(RCC->CR,\ + RCC_CR_HSITRIM, (uint32_t)(__HSICalibrationValue__) << RCC_CR_HSITRIM_Pos)) +/** + * @} + */ + +/** @defgroup RCC_LSI_Configuration LSI Configuration + * @{ + */ + +/** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI). + * @note After enabling the LSI, the application software should wait on + * LSIRDY flag to be set indicating that LSI clock is stable and can + * be used to clock the IWDG and/or the RTC. + * @note LSI can not be disabled if the IWDG is running. + * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator + * clock cycles. + */ +#define __HAL_RCC_LSI_ENABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE) +#define __HAL_RCC_LSI_DISABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = DISABLE) +/** + * @} + */ + +/** @defgroup RCC_HSE_Configuration HSE Configuration + * @{ + */ + +/** + * @brief Macro to configure the External High Speed oscillator (HSE). + * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not supported by this macro. + * User should request a transition to HSE Off first and then HSE On or HSE Bypass. + * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application + * software should wait on HSERDY flag to be set indicating that HSE clock + * is stable and can be used to clock the PLL and/or system clock. + * @note HSE state can not be changed if it is used directly or through the + * PLL as system clock. In this case, you have to select another source + * of the system clock then change the HSE state (ex. disable it). + * @note The HSE is stopped by hardware when entering STOP and STANDBY modes. + * @note This function reset the CSSON bit, so if the clock security system(CSS) + * was previously enabled you have to enable it again after calling this + * function. + * @param __STATE__ specifies the new state of the HSE. + * This parameter can be one of the following values: + * @arg RCC_HSE_OFF: turn OFF the HSE oscillator, HSERDY flag goes low after + * 6 HSE oscillator clock cycles. + * @arg RCC_HSE_ON: turn ON the HSE oscillator. + * @arg RCC_HSE_BYPASS: HSE oscillator bypassed with external clock. + */ +#define __HAL_RCC_HSE_CONFIG(__STATE__) \ + do { \ + if ((__STATE__) == RCC_HSE_ON) \ + { \ + SET_BIT(RCC->CR, RCC_CR_HSEON); \ + } \ + else if ((__STATE__) == RCC_HSE_BYPASS) \ + { \ + SET_BIT(RCC->CR, RCC_CR_HSEBYP); \ + SET_BIT(RCC->CR, RCC_CR_HSEON); \ + } \ + else \ + { \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \ + } \ + } while(0U) +/** + * @} + */ + +/** @defgroup RCC_LSE_Configuration LSE Configuration + * @{ + */ + +/** + * @brief Macro to configure the External Low Speed oscillator (LSE). + * @note Transition LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro. + * User should request a transition to LSE Off first and then LSE On or LSE Bypass. + * @note As the LSE is in the Backup domain and write access is denied to + * this domain after reset, you have to enable write access using + * HAL_PWR_EnableBkUpAccess() function before to configure the LSE + * (to be done once after reset). + * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application + * software should wait on LSERDY flag to be set indicating that LSE clock + * is stable and can be used to clock the RTC. + * @param __STATE__ specifies the new state of the LSE. + * This parameter can be one of the following values: + * @arg RCC_LSE_OFF: turn OFF the LSE oscillator, LSERDY flag goes low after + * 6 LSE oscillator clock cycles. + * @arg RCC_LSE_ON: turn ON the LSE oscillator. + * @arg RCC_LSE_BYPASS: LSE oscillator bypassed with external clock. + */ +#define __HAL_RCC_LSE_CONFIG(__STATE__) \ + do { \ + if((__STATE__) == RCC_LSE_ON) \ + { \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + } \ + else if((__STATE__) == RCC_LSE_BYPASS) \ + { \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + } \ + else \ + { \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ + } \ + } while(0U) +/** + * @} + */ + +/** @defgroup RCC_Internal_RTC_Clock_Configuration RTC Clock Configuration + * @{ + */ + +/** @brief Macros to enable or disable the RTC clock. + * @note These macros must be used only after the RTC clock source was selected. + */ +#define __HAL_RCC_RTC_ENABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = ENABLE) +#define __HAL_RCC_RTC_DISABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = DISABLE) + +/** @brief Macros to configure the RTC clock (RTCCLK). + * @note As the RTC clock configuration bits are in the Backup domain and write + * access is denied to this domain after reset, you have to enable write + * access using the Power Backup Access macro before to configure + * the RTC clock source (to be done once after reset). + * @note Once the RTC clock is configured it can't be changed unless the + * Backup domain is reset using __HAL_RCC_BackupReset_RELEASE() macro, or by + * a Power On Reset (POR). + * @param __RTCCLKSource__ specifies the RTC clock source. + * This parameter can be one of the following values: + @arg @ref RCC_RTCCLKSOURCE_NO_CLK: No clock selected as RTC clock. + * @arg @ref RCC_RTCCLKSOURCE_LSE: LSE selected as RTC clock. + * @arg @ref RCC_RTCCLKSOURCE_LSI: LSI selected as RTC clock. + * @arg @ref RCC_RTCCLKSOURCE_HSE_DIVX: HSE clock divided by x selected + * as RTC clock, where x:[2,31] + * @note If the LSE or LSI is used as RTC clock source, the RTC continues to + * work in STOP and STANDBY modes, and can be used as wake-up source. + * However, when the HSE clock is used as RTC clock source, the RTC + * cannot be used in STOP and STANDBY modes. + * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as + * RTC clock source). + */ +#define __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__) (((__RTCCLKSource__) & RCC_BDCR_RTCSEL) == RCC_BDCR_RTCSEL) ? \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_RTCPRE, ((__RTCCLKSource__) & 0xFFFFCFFU)) : CLEAR_BIT(RCC->CFGR, RCC_CFGR_RTCPRE) + +#define __HAL_RCC_RTC_CONFIG(__RTCCLKSource__) do { __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__); \ + RCC->BDCR |= ((__RTCCLKSource__) & 0x00000FFFU); \ + } while(0U) + +/** @brief Macro to get the RTC clock source. + * @retval The clock source can be one of the following values: + * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_HSE_DIVX HSE divided by X selected as RTC clock (X can be retrieved thanks to @ref __HAL_RCC_GET_RTC_HSE_PRESCALER() + */ +#define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)) + +/** + * @brief Get the RTC and HSE clock divider (RTCPRE). + * @retval Returned value can be one of the following values: + * @arg @ref RCC_RTCCLKSOURCE_HSE_DIVX: HSE clock divided by x selected + * as RTC clock, where x:[2,31] + */ +#define __HAL_RCC_GET_RTC_HSE_PRESCALER() (READ_BIT(RCC->CFGR, RCC_CFGR_RTCPRE) | RCC_BDCR_RTCSEL) + +/** @brief Macros to force or release the Backup domain reset. + * @note This function resets the RTC peripheral (including the backup registers) + * and the RTC clock source selection in RCC_CSR register. + * @note The BKPSRAM is not affected by this reset. + */ +#define __HAL_RCC_BACKUPRESET_FORCE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = ENABLE) +#define __HAL_RCC_BACKUPRESET_RELEASE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = DISABLE) +/** + * @} + */ + +/** @defgroup RCC_PLL_Configuration PLL Configuration + * @{ + */ + +/** @brief Macros to enable or disable the main PLL. + * @note After enabling the main PLL, the application software should wait on + * PLLRDY flag to be set indicating that PLL clock is stable and can + * be used as system clock source. + * @note The main PLL can not be disabled if it is used as system clock source + * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLL_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = ENABLE) +#define __HAL_RCC_PLL_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = DISABLE) + +/** @brief Macro to configure the PLL clock source. + * @note This function must be used only when the main PLL is disabled. + * @param __PLLSOURCE__ specifies the PLL entry clock source. + * This parameter can be one of the following values: + * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry + * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry + * + */ +#define __HAL_RCC_PLL_PLLSOURCE_CONFIG(__PLLSOURCE__) MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__)) + +/** @brief Macro to configure the PLL multiplication factor. + * @note This function must be used only when the main PLL is disabled. + * @param __PLLM__ specifies the division factor for PLL VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 2 MHz to limit PLL jitter. + * + */ +#define __HAL_RCC_PLL_PLLM_CONFIG(__PLLM__) MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, (__PLLM__)) +/** + * @} + */ + +/** @defgroup RCC_Get_Clock_source Get Clock source + * @{ + */ +/** + * @brief Macro to configure the system clock source. + * @param __RCC_SYSCLKSOURCE__ specifies the system clock source. + * This parameter can be one of the following values: + * - RCC_SYSCLKSOURCE_HSI: HSI oscillator is used as system clock source. + * - RCC_SYSCLKSOURCE_HSE: HSE oscillator is used as system clock source. + * - RCC_SYSCLKSOURCE_PLLCLK: PLL output is used as system clock source. + * - RCC_SYSCLKSOURCE_PLLRCLK: PLLR output is used as system clock source. This + * parameter is available only for STM32F446xx devices. + */ +#define __HAL_RCC_SYSCLK_CONFIG(__RCC_SYSCLKSOURCE__) MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__RCC_SYSCLKSOURCE__)) + +/** @brief Macro to get the clock source used as system clock. + * @retval The clock source used as system clock. The returned value can be one + * of the following: + * - RCC_SYSCLKSOURCE_STATUS_HSI: HSI used as system clock. + * - RCC_SYSCLKSOURCE_STATUS_HSE: HSE used as system clock. + * - RCC_SYSCLKSOURCE_STATUS_PLLCLK: PLL used as system clock. + * - RCC_SYSCLKSOURCE_STATUS_PLLRCLK: PLLR used as system clock. This parameter + * is available only for STM32F446xx devices. + */ +#define __HAL_RCC_GET_SYSCLK_SOURCE() (RCC->CFGR & RCC_CFGR_SWS) + +/** @brief Macro to get the oscillator used as PLL clock source. + * @retval The oscillator used as PLL clock source. The returned value can be one + * of the following: + * - RCC_PLLSOURCE_HSI: HSI oscillator is used as PLL clock source. + * - RCC_PLLSOURCE_HSE: HSE oscillator is used as PLL clock source. + */ +#define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC)) +/** + * @} + */ + +/** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config + * @{ + */ + +/** @brief Macro to configure the MCO1 clock. + * @param __MCOCLKSOURCE__ specifies the MCO clock source. + * This parameter can be one of the following values: + * @arg RCC_MCO1SOURCE_HSI: HSI clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_LSE: LSE clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_HSE: HSE clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_PLLCLK: main PLL clock selected as MCO1 source + * @param __MCODIV__ specifies the MCO clock prescaler. + * This parameter can be one of the following values: + * @arg RCC_MCODIV_1: no division applied to MCOx clock + * @arg RCC_MCODIV_2: division by 2 applied to MCOx clock + * @arg RCC_MCODIV_3: division by 3 applied to MCOx clock + * @arg RCC_MCODIV_4: division by 4 applied to MCOx clock + * @arg RCC_MCODIV_5: division by 5 applied to MCOx clock + */ +#define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \ + MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO1 | RCC_CFGR_MCO1PRE), ((__MCOCLKSOURCE__) | (__MCODIV__))) + +/** @brief Macro to configure the MCO2 clock. + * @param __MCOCLKSOURCE__ specifies the MCO clock source. + * This parameter can be one of the following values: + * @arg RCC_MCO2SOURCE_SYSCLK: System clock (SYSCLK) selected as MCO2 source + * @arg RCC_MCO2SOURCE_PLLI2SCLK: PLLI2S clock selected as MCO2 source, available for all STM32F4 devices except STM32F410xx + * @arg RCC_MCO2SOURCE_I2SCLK: I2SCLK clock selected as MCO2 source, available only for STM32F410Rx devices + * @arg RCC_MCO2SOURCE_HSE: HSE clock selected as MCO2 source + * @arg RCC_MCO2SOURCE_PLLCLK: main PLL clock selected as MCO2 source + * @param __MCODIV__ specifies the MCO clock prescaler. + * This parameter can be one of the following values: + * @arg RCC_MCODIV_1: no division applied to MCOx clock + * @arg RCC_MCODIV_2: division by 2 applied to MCOx clock + * @arg RCC_MCODIV_3: division by 3 applied to MCOx clock + * @arg RCC_MCODIV_4: division by 4 applied to MCOx clock + * @arg RCC_MCODIV_5: division by 5 applied to MCOx clock + * @note For STM32F410Rx devices, to output I2SCLK clock on MCO2, you should have + * at least one of the SPI clocks enabled (SPI1, SPI2 or SPI5). + */ +#define __HAL_RCC_MCO2_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \ + MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO2 | RCC_CFGR_MCO2PRE), ((__MCOCLKSOURCE__) | ((__MCODIV__) << 3U))); +/** + * @} + */ + +/** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management + * @brief macros to manage the specified RCC Flags and interrupts. + * @{ + */ + +/** @brief Enable RCC interrupt (Perform Byte access to RCC_CIR[14:8] bits to enable + * the selected interrupts). + * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled. + * This parameter can be any combination of the following values: + * @arg RCC_IT_LSIRDY: LSI ready interrupt. + * @arg RCC_IT_LSERDY: LSE ready interrupt. + * @arg RCC_IT_HSIRDY: HSI ready interrupt. + * @arg RCC_IT_HSERDY: HSE ready interrupt. + * @arg RCC_IT_PLLRDY: Main PLL ready interrupt. + * @arg RCC_IT_PLLI2SRDY: PLLI2S ready interrupt. + */ +#define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__)) + +/** @brief Disable RCC interrupt (Perform Byte access to RCC_CIR[14:8] bits to disable + * the selected interrupts). + * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled. + * This parameter can be any combination of the following values: + * @arg RCC_IT_LSIRDY: LSI ready interrupt. + * @arg RCC_IT_LSERDY: LSE ready interrupt. + * @arg RCC_IT_HSIRDY: HSI ready interrupt. + * @arg RCC_IT_HSERDY: HSE ready interrupt. + * @arg RCC_IT_PLLRDY: Main PLL ready interrupt. + * @arg RCC_IT_PLLI2SRDY: PLLI2S ready interrupt. + */ +#define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= (uint8_t)(~(__INTERRUPT__))) + +/** @brief Clear the RCC's interrupt pending bits (Perform Byte access to RCC_CIR[23:16] + * bits to clear the selected interrupt pending bits. + * @param __INTERRUPT__ specifies the interrupt pending bit to clear. + * This parameter can be any combination of the following values: + * @arg RCC_IT_LSIRDY: LSI ready interrupt. + * @arg RCC_IT_LSERDY: LSE ready interrupt. + * @arg RCC_IT_HSIRDY: HSI ready interrupt. + * @arg RCC_IT_HSERDY: HSE ready interrupt. + * @arg RCC_IT_PLLRDY: Main PLL ready interrupt. + * @arg RCC_IT_PLLI2SRDY: PLLI2S ready interrupt. + * @arg RCC_IT_CSS: Clock Security System interrupt + */ +#define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__)) + +/** @brief Check the RCC's interrupt has occurred or not. + * @param __INTERRUPT__ specifies the RCC interrupt source to check. + * This parameter can be one of the following values: + * @arg RCC_IT_LSIRDY: LSI ready interrupt. + * @arg RCC_IT_LSERDY: LSE ready interrupt. + * @arg RCC_IT_HSIRDY: HSI ready interrupt. + * @arg RCC_IT_HSERDY: HSE ready interrupt. + * @arg RCC_IT_PLLRDY: Main PLL ready interrupt. + * @arg RCC_IT_PLLI2SRDY: PLLI2S ready interrupt. + * @arg RCC_IT_CSS: Clock Security System interrupt + * @retval The new state of __INTERRUPT__ (TRUE or FALSE). + */ +#define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__)) + +/** @brief Set RMVF bit to clear the reset flags: RCC_FLAG_PINRST, RCC_FLAG_PORRST, + * RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST and RCC_FLAG_LPWRRST. + */ +#define __HAL_RCC_CLEAR_RESET_FLAGS() (RCC->CSR |= RCC_CSR_RMVF) + +/** @brief Check RCC flag is set or not. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg RCC_FLAG_HSIRDY: HSI oscillator clock ready. + * @arg RCC_FLAG_HSERDY: HSE oscillator clock ready. + * @arg RCC_FLAG_PLLRDY: Main PLL clock ready. + * @arg RCC_FLAG_PLLI2SRDY: PLLI2S clock ready. + * @arg RCC_FLAG_LSERDY: LSE oscillator clock ready. + * @arg RCC_FLAG_LSIRDY: LSI oscillator clock ready. + * @arg RCC_FLAG_BORRST: POR/PDR or BOR reset. + * @arg RCC_FLAG_PINRST: Pin reset. + * @arg RCC_FLAG_PORRST: POR/PDR reset. + * @arg RCC_FLAG_SFTRST: Software reset. + * @arg RCC_FLAG_IWDGRST: Independent Watchdog reset. + * @arg RCC_FLAG_WWDGRST: Window Watchdog reset. + * @arg RCC_FLAG_LPWRRST: Low Power reset. + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define RCC_FLAG_MASK ((uint8_t)0x1FU) +#define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == 1U)? RCC->CR :((((__FLAG__) >> 5U) == 2U) ? RCC->BDCR :((((__FLAG__) >> 5U) == 3U)? RCC->CSR :RCC->CIR))) & (1U << ((__FLAG__) & RCC_FLAG_MASK)))!= 0U)? 1U : 0U) + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + /** @addtogroup RCC_Exported_Functions + * @{ + */ + +/** @addtogroup RCC_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions ******************************/ +HAL_StatusTypeDef HAL_RCC_DeInit(void); +HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct); +HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency); +/** + * @} + */ + +/** @addtogroup RCC_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ************************************************/ +void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv); +void HAL_RCC_EnableCSS(void); +void HAL_RCC_DisableCSS(void); +uint32_t HAL_RCC_GetSysClockFreq(void); +uint32_t HAL_RCC_GetHCLKFreq(void); +uint32_t HAL_RCC_GetPCLK1Freq(void); +uint32_t HAL_RCC_GetPCLK2Freq(void); +void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct); +void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency); + +/* CSS NMI IRQ handler */ +void HAL_RCC_NMI_IRQHandler(void); + +/* User Callbacks in non blocking mode (IT mode) */ +void HAL_RCC_CSSCallback(void); + +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup RCC_Private_Constants RCC Private Constants + * @{ + */ + +/** @defgroup RCC_BitAddress_AliasRegion RCC BitAddress AliasRegion + * @brief RCC registers bit address in the alias region + * @{ + */ +#define RCC_OFFSET (RCC_BASE - PERIPH_BASE) +/* --- CR Register --- */ +/* Alias word address of HSION bit */ +#define RCC_CR_OFFSET (RCC_OFFSET + 0x00U) +#define RCC_HSION_BIT_NUMBER 0x00U +#define RCC_CR_HSION_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_HSION_BIT_NUMBER * 4U)) +/* Alias word address of CSSON bit */ +#define RCC_CSSON_BIT_NUMBER 0x13U +#define RCC_CR_CSSON_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_CSSON_BIT_NUMBER * 4U)) +/* Alias word address of PLLON bit */ +#define RCC_PLLON_BIT_NUMBER 0x18U +#define RCC_CR_PLLON_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLON_BIT_NUMBER * 4U)) + +/* --- BDCR Register --- */ +/* Alias word address of RTCEN bit */ +#define RCC_BDCR_OFFSET (RCC_OFFSET + 0x70U) +#define RCC_RTCEN_BIT_NUMBER 0x0FU +#define RCC_BDCR_RTCEN_BB (PERIPH_BB_BASE + (RCC_BDCR_OFFSET * 32U) + (RCC_RTCEN_BIT_NUMBER * 4U)) +/* Alias word address of BDRST bit */ +#define RCC_BDRST_BIT_NUMBER 0x10U +#define RCC_BDCR_BDRST_BB (PERIPH_BB_BASE + (RCC_BDCR_OFFSET * 32U) + (RCC_BDRST_BIT_NUMBER * 4U)) + +/* --- CSR Register --- */ +/* Alias word address of LSION bit */ +#define RCC_CSR_OFFSET (RCC_OFFSET + 0x74U) +#define RCC_LSION_BIT_NUMBER 0x00U +#define RCC_CSR_LSION_BB (PERIPH_BB_BASE + (RCC_CSR_OFFSET * 32U) + (RCC_LSION_BIT_NUMBER * 4U)) + +/* CR register byte 3 (Bits[23:16]) base address */ +#define RCC_CR_BYTE2_ADDRESS 0x40023802U + +/* CIR register byte 2 (Bits[15:8]) base address */ +#define RCC_CIR_BYTE1_ADDRESS ((uint32_t)(RCC_BASE + 0x0CU + 0x01U)) + +/* CIR register byte 3 (Bits[23:16]) base address */ +#define RCC_CIR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + 0x0CU + 0x02U)) + +/* BDCR register base address */ +#define RCC_BDCR_BYTE0_ADDRESS (PERIPH_BASE + RCC_BDCR_OFFSET) + +#define RCC_DBP_TIMEOUT_VALUE 2U +#define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT + +#define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT +#define HSI_TIMEOUT_VALUE 2U /* 2 ms */ +#define LSI_TIMEOUT_VALUE 2U /* 2 ms */ +#define CLOCKSWITCH_TIMEOUT_VALUE 5000U /* 5 s */ + +/** + * @} + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup RCC_Private_Macros RCC Private Macros + * @{ + */ + +/** @defgroup RCC_IS_RCC_Definitions RCC Private macros to check input parameters + * @{ + */ +#define IS_RCC_OSCILLATORTYPE(OSCILLATOR) ((OSCILLATOR) <= 15U) + +#define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \ + ((HSE) == RCC_HSE_BYPASS)) + +#define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \ + ((LSE) == RCC_LSE_BYPASS)) + +#define IS_RCC_HSI(HSI) (((HSI) == RCC_HSI_OFF) || ((HSI) == RCC_HSI_ON)) + +#define IS_RCC_LSI(LSI) (((LSI) == RCC_LSI_OFF) || ((LSI) == RCC_LSI_ON)) + +#define IS_RCC_PLL(PLL) (((PLL) == RCC_PLL_NONE) ||((PLL) == RCC_PLL_OFF) || ((PLL) == RCC_PLL_ON)) + +#define IS_RCC_PLLSOURCE(SOURCE) (((SOURCE) == RCC_PLLSOURCE_HSI) || \ + ((SOURCE) == RCC_PLLSOURCE_HSE)) + +#define IS_RCC_SYSCLKSOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSOURCE_HSI) || \ + ((SOURCE) == RCC_SYSCLKSOURCE_HSE) || \ + ((SOURCE) == RCC_SYSCLKSOURCE_PLLCLK) || \ + ((SOURCE) == RCC_SYSCLKSOURCE_PLLRCLK)) + +#define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV2) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV3) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV4) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV5) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV6) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV7) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV8) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV9) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV10) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV11) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV12) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV13) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV14) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV15) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV16) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV17) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV18) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV19) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV20) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV21) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV22) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV23) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV24) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV25) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV26) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV27) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV28) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV29) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV30) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV31)) + +#define IS_RCC_PLLM_VALUE(VALUE) ((VALUE) <= 63U) + +#define IS_RCC_PLLP_VALUE(VALUE) (((VALUE) == 2U) || ((VALUE) == 4U) || ((VALUE) == 6U) || ((VALUE) == 8U)) + +#define IS_RCC_PLLQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U)) + +#define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_DIV1) || ((HCLK) == RCC_SYSCLK_DIV2) || \ + ((HCLK) == RCC_SYSCLK_DIV4) || ((HCLK) == RCC_SYSCLK_DIV8) || \ + ((HCLK) == RCC_SYSCLK_DIV16) || ((HCLK) == RCC_SYSCLK_DIV64) || \ + ((HCLK) == RCC_SYSCLK_DIV128) || ((HCLK) == RCC_SYSCLK_DIV256) || \ + ((HCLK) == RCC_SYSCLK_DIV512)) + +#define IS_RCC_CLOCKTYPE(CLK) ((1U <= (CLK)) && ((CLK) <= 15U)) + +#define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_DIV1) || ((PCLK) == RCC_HCLK_DIV2) || \ + ((PCLK) == RCC_HCLK_DIV4) || ((PCLK) == RCC_HCLK_DIV8) || \ + ((PCLK) == RCC_HCLK_DIV16)) + +#define IS_RCC_MCO(MCOx) (((MCOx) == RCC_MCO1) || ((MCOx) == RCC_MCO2)) + +#define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1SOURCE_HSI) || ((SOURCE) == RCC_MCO1SOURCE_LSE) || \ + ((SOURCE) == RCC_MCO1SOURCE_HSE) || ((SOURCE) == RCC_MCO1SOURCE_PLLCLK)) + +#define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCODIV_1) || ((DIV) == RCC_MCODIV_2) || \ + ((DIV) == RCC_MCODIV_3) || ((DIV) == RCC_MCODIV_4) || \ + ((DIV) == RCC_MCODIV_5)) +#define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1FU) + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_RCC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h new file mode 100644 index 0000000..0b8152b --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h @@ -0,0 +1,7138 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_rcc_ex.h + * @author MCD Application Team + * @brief Header file of RCC HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_RCC_EX_H +#define __STM32F4xx_HAL_RCC_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup RCCEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup RCCEx_Exported_Types RCCEx Exported Types + * @{ + */ + +/** + * @brief RCC PLL configuration structure definition + */ +typedef struct +{ + uint32_t PLLState; /*!< The new state of the PLL. + This parameter can be a value of @ref RCC_PLL_Config */ + + uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source. + This parameter must be a value of @ref RCC_PLL_Clock_Source */ + + uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock. + This parameter must be a number between Min_Data = 0 and Max_Data = 63 */ + + uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432 + except for STM32F411xE devices where the Min_Data = 192 */ + + uint32_t PLLP; /*!< PLLP: Division factor for main system clock (SYSCLK). + This parameter must be a value of @ref RCC_PLLP_Clock_Divider */ + + uint32_t PLLQ; /*!< PLLQ: Division factor for OTG FS, SDIO and RNG clocks. + This parameter must be a number between Min_Data = 2 and Max_Data = 15 */ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) + uint32_t PLLR; /*!< PLLR: PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks. + This parameter is only available in STM32F410xx/STM32F446xx/STM32F469xx/STM32F479xx + and STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices. + This parameter must be a number between Min_Data = 2 and Max_Data = 7 */ +#endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +}RCC_PLLInitTypeDef; + +#if defined(STM32F446xx) +/** + * @brief PLLI2S Clock structure definition + */ +typedef struct +{ + uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 63 */ + + uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432 */ + + uint32_t PLLI2SP; /*!< Specifies division factor for SPDIFRX Clock. + This parameter must be a value of @ref RCCEx_PLLI2SP_Clock_Divider */ + + uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 15. + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ + + uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 7. + This parameter will be used only when PLLI2S is selected as Clock Source I2S */ +}RCC_PLLI2SInitTypeDef; + +/** + * @brief PLLSAI Clock structure definition + */ +typedef struct +{ + uint32_t PLLSAIM; /*!< Spcifies division factor for PLL VCO input clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 63 */ + + uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432 */ + + uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS, SDIO and RNG clocks. + This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */ + + uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 15. + This parameter will be used only when PLLSAI is selected as Clock Source SAI */ +}RCC_PLLSAIInitTypeDef; + +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */ + + uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ + + uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLLSAI is selected as Clock Source SAI */ + + uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */ + + uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Source Selection. + This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */ + + uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */ + + uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection. + This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */ + + uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ + + uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection. + This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */ + + uint32_t CecClockSelection; /*!< Specifies CEC Clock Source Selection. + This parameter can be a value of @ref RCCEx_CEC_Clock_Source */ + + uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */ + + uint32_t SpdifClockSelection; /*!< Specifies SPDIFRX Clock Source Selection. + This parameter can be a value of @ref RCCEx_SPDIFRX_Clock_Source */ + + uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks. + This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */ + + uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection. + This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */ +}RCC_PeriphCLKInitTypeDef; +#endif /* STM32F446xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + uint32_t I2SClockSelection; /*!< Specifies RTC Clock Source Selection. + This parameter can be a value of @ref RCCEx_I2S_APB_Clock_Source */ + + uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ + + uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */ + + uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */ + + uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection. + This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */ +}RCC_PeriphCLKInitTypeDef; +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief PLLI2S Clock structure definition + */ +typedef struct +{ + uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 63 */ + + uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432 */ + + uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 15. + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ + + uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 7. + This parameter will be used only when PLLI2S is selected as Clock Source I2S */ +}RCC_PLLI2SInitTypeDef; + +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source I2S */ + +#if defined(STM32F413xx) || defined(STM32F423xx) + uint32_t PLLDivR; /*!< Specifies the PLL division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLL is selected as Clock Source SAI */ + + uint32_t PLLI2SDivR; /*!< Specifies the PLLI2S division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ +#endif /* STM32F413xx || STM32F423xx */ + + uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */ + + uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection. + This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */ + + uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ + + uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection. + This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */ + + uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */ + + uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks. + This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */ + + uint32_t Dfsdm1ClockSelection; /*!< Specifies DFSDM1 Clock Selection. + This parameter can be a value of @ref RCCEx_DFSDM1_Kernel_Clock_Source */ + + uint32_t Dfsdm1AudioClockSelection;/*!< Specifies DFSDM1 Audio Clock Selection. + This parameter can be a value of @ref RCCEx_DFSDM1_Audio_Clock_Source */ + +#if defined(STM32F413xx) || defined(STM32F423xx) + uint32_t Dfsdm2ClockSelection; /*!< Specifies DFSDM2 Clock Selection. + This parameter can be a value of @ref RCCEx_DFSDM2_Kernel_Clock_Source */ + + uint32_t Dfsdm2AudioClockSelection;/*!< Specifies DFSDM2 Audio Clock Selection. + This parameter can be a value of @ref RCCEx_DFSDM2_Audio_Clock_Source */ + + uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection. + This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */ + + uint32_t SaiAClockSelection; /*!< Specifies SAI1_A Clock Prescalers Selection + This parameter can be a value of @ref RCCEx_SAI1_BlockA_Clock_Source */ + + uint32_t SaiBClockSelection; /*!< Specifies SAI1_B Clock Prescalers Selection + This parameter can be a value of @ref RCCEx_SAI1_BlockB_Clock_Source */ +#endif /* STM32F413xx || STM32F423xx */ + + uint32_t PLLI2SSelection; /*!< Specifies PLL I2S Clock Source Selection. + This parameter can be a value of @ref RCCEx_PLL_I2S_Clock_Source */ + + uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection. + This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */ +}RCC_PeriphCLKInitTypeDef; +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/** + * @brief PLLI2S Clock structure definition + */ +typedef struct +{ + uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 7. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 15. + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ +}RCC_PLLI2SInitTypeDef; + +/** + * @brief PLLSAI Clock structure definition + */ +typedef struct +{ + uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432. + This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */ +#if defined(STM32F469xx) || defined(STM32F479xx) + uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS and SDIO clocks. + This parameter is only available in STM32F469xx/STM32F479xx devices. + This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */ +#endif /* STM32F469xx || STM32F479xx */ + + uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 15. + This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */ + + uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock + This parameter must be a number between Min_Data = 2 and Max_Data = 7. + This parameter will be used only when PLLSAI is selected as Clock Source LTDC */ + +}RCC_PLLSAIInitTypeDef; + +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */ + + uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLLI2S is selected as Clock Source SAI */ + + uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock. + This parameter must be a number between Min_Data = 1 and Max_Data = 32 + This parameter will be used only when PLLSAI is selected as Clock Source SAI */ + + uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock. + This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */ + + uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ + + uint8_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection. + This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */ +#if defined(STM32F469xx) || defined(STM32F479xx) + uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks. + This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */ + + uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection. + This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */ +#endif /* STM32F469xx || STM32F479xx */ +}RCC_PeriphCLKInitTypeDef; + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +/** + * @brief PLLI2S Clock structure definition + */ +typedef struct +{ +#if defined(STM32F411xE) + uint32_t PLLI2SM; /*!< PLLM: Division factor for PLLI2S VCO input clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 62 */ +#endif /* STM32F411xE */ + + uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock. + This parameter must be a number between Min_Data = 50 and Max_Data = 432 + Except for STM32F411xE devices where the Min_Data = 192. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock. + This parameter must be a number between Min_Data = 2 and Max_Data = 7. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + +}RCC_PLLI2SInitTypeDef; + +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters. + This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */ + + uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) + uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection. + This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */ +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ +}RCC_PeriphCLKInitTypeDef; +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */ +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants + * @{ + */ + +/** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection + * @{ + */ +/* Peripheral Clock source for STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx */ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) +#define RCC_PERIPHCLK_I2S_APB1 0x00000001U +#define RCC_PERIPHCLK_I2S_APB2 0x00000002U +#define RCC_PERIPHCLK_TIM 0x00000004U +#define RCC_PERIPHCLK_RTC 0x00000008U +#define RCC_PERIPHCLK_FMPI2C1 0x00000010U +#define RCC_PERIPHCLK_CLK48 0x00000020U +#define RCC_PERIPHCLK_SDIO 0x00000040U +#define RCC_PERIPHCLK_PLLI2S 0x00000080U +#define RCC_PERIPHCLK_DFSDM1 0x00000100U +#define RCC_PERIPHCLK_DFSDM1_AUDIO 0x00000200U +#endif /* STM32F412Zx || STM32F412Vx) || STM32F412Rx || STM32F412Cx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define RCC_PERIPHCLK_DFSDM2 0x00000400U +#define RCC_PERIPHCLK_DFSDM2_AUDIO 0x00000800U +#define RCC_PERIPHCLK_LPTIM1 0x00001000U +#define RCC_PERIPHCLK_SAIA 0x00002000U +#define RCC_PERIPHCLK_SAIB 0x00004000U +#endif /* STM32F413xx || STM32F423xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------- Peripheral Clock source for STM32F410xx ----------------*/ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define RCC_PERIPHCLK_I2S 0x00000001U +#define RCC_PERIPHCLK_TIM 0x00000002U +#define RCC_PERIPHCLK_RTC 0x00000004U +#define RCC_PERIPHCLK_FMPI2C1 0x00000008U +#define RCC_PERIPHCLK_LPTIM1 0x00000010U +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ +/*----------------------------------------------------------------------------*/ + +/*------------------- Peripheral Clock source for STM32F446xx ----------------*/ +#if defined(STM32F446xx) +#define RCC_PERIPHCLK_I2S_APB1 0x00000001U +#define RCC_PERIPHCLK_I2S_APB2 0x00000002U +#define RCC_PERIPHCLK_SAI1 0x00000004U +#define RCC_PERIPHCLK_SAI2 0x00000008U +#define RCC_PERIPHCLK_TIM 0x00000010U +#define RCC_PERIPHCLK_RTC 0x00000020U +#define RCC_PERIPHCLK_CEC 0x00000040U +#define RCC_PERIPHCLK_FMPI2C1 0x00000080U +#define RCC_PERIPHCLK_CLK48 0x00000100U +#define RCC_PERIPHCLK_SDIO 0x00000200U +#define RCC_PERIPHCLK_SPDIFRX 0x00000400U +#define RCC_PERIPHCLK_PLLI2S 0x00000800U +#endif /* STM32F446xx */ +/*-----------------------------------------------------------------------------*/ + +/*----------- Peripheral Clock source for STM32F469xx/STM32F479xx -------------*/ +#if defined(STM32F469xx) || defined(STM32F479xx) +#define RCC_PERIPHCLK_I2S 0x00000001U +#define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U +#define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U +#define RCC_PERIPHCLK_LTDC 0x00000008U +#define RCC_PERIPHCLK_TIM 0x00000010U +#define RCC_PERIPHCLK_RTC 0x00000020U +#define RCC_PERIPHCLK_PLLI2S 0x00000040U +#define RCC_PERIPHCLK_CLK48 0x00000080U +#define RCC_PERIPHCLK_SDIO 0x00000100U +#endif /* STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*-------- Peripheral Clock source for STM32F42xxx/STM32F43xxx ---------------*/ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +#define RCC_PERIPHCLK_I2S 0x00000001U +#define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U +#define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U +#define RCC_PERIPHCLK_LTDC 0x00000008U +#define RCC_PERIPHCLK_TIM 0x00000010U +#define RCC_PERIPHCLK_RTC 0x00000020U +#define RCC_PERIPHCLK_PLLI2S 0x00000040U +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ +/*----------------------------------------------------------------------------*/ + +/*-------- Peripheral Clock source for STM32F40xxx/STM32F41xxx ---------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +#define RCC_PERIPHCLK_I2S 0x00000001U +#define RCC_PERIPHCLK_RTC 0x00000002U +#define RCC_PERIPHCLK_PLLI2S 0x00000004U +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */ +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +#define RCC_PERIPHCLK_TIM 0x00000008U +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ +/*----------------------------------------------------------------------------*/ +/** + * @} + */ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \ + defined(STM32F479xx) +/** @defgroup RCCEx_I2S_Clock_Source I2S Clock Source + * @{ + */ +#define RCC_I2SCLKSOURCE_PLLI2S 0x00000000U +#define RCC_I2SCLKSOURCE_EXT 0x00000001U +/** + * @} + */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */ + +/** @defgroup RCCEx_PLLSAI_DIVR RCC PLLSAI DIVR + * @{ + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +#define RCC_PLLSAIDIVR_2 0x00000000U +#define RCC_PLLSAIDIVR_4 0x00010000U +#define RCC_PLLSAIDIVR_8 0x00020000U +#define RCC_PLLSAIDIVR_16 0x00030000U +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_PLLI2SP_Clock_Divider RCC PLLI2SP Clock Divider + * @{ + */ +#if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) +#define RCC_PLLI2SP_DIV2 0x00000002U +#define RCC_PLLI2SP_DIV4 0x00000004U +#define RCC_PLLI2SP_DIV6 0x00000006U +#define RCC_PLLI2SP_DIV8 0x00000008U +#endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ +/** + * @} + */ + +/** @defgroup RCCEx_PLLSAIP_Clock_Divider RCC PLLSAIP Clock Divider + * @{ + */ +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define RCC_PLLSAIP_DIV2 0x00000002U +#define RCC_PLLSAIP_DIV4 0x00000004U +#define RCC_PLLSAIP_DIV6 0x00000006U +#define RCC_PLLSAIP_DIV8 0x00000008U +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @defgroup RCCEx_SAI_BlockA_Clock_Source RCC SAI BlockA Clock Source + * @{ + */ +#define RCC_SAIACLKSOURCE_PLLSAI 0x00000000U +#define RCC_SAIACLKSOURCE_PLLI2S 0x00100000U +#define RCC_SAIACLKSOURCE_EXT 0x00200000U +/** + * @} + */ + +/** @defgroup RCCEx_SAI_BlockB_Clock_Source RCC SAI BlockB Clock Source + * @{ + */ +#define RCC_SAIBCLKSOURCE_PLLSAI 0x00000000U +#define RCC_SAIBCLKSOURCE_PLLI2S 0x00400000U +#define RCC_SAIBCLKSOURCE_EXT 0x00800000U +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +/** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source + * @{ + */ +#define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U +#define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR_CK48MSEL) +/** + * @} + */ + +/** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source + * @{ + */ +#define RCC_SDIOCLKSOURCE_CLK48 0x00000000U +#define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_SDIOSEL) +/** + * @} + */ + +/** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source + * @{ + */ +#define RCC_DSICLKSOURCE_DSIPHY 0x00000000U +#define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_DSISEL) +/** + * @} + */ +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F446xx) +/** @defgroup RCCEx_SAI1_Clock_Source RCC SAI1 Clock Source + * @{ + */ +#define RCC_SAI1CLKSOURCE_PLLSAI 0x00000000U +#define RCC_SAI1CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI1SRC_0) +#define RCC_SAI1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1SRC_1) +#define RCC_SAI1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1SRC) +/** + * @} + */ + +/** @defgroup RCCEx_SAI2_Clock_Source RCC SAI2 Clock Source + * @{ + */ +#define RCC_SAI2CLKSOURCE_PLLSAI 0x00000000U +#define RCC_SAI2CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI2SRC_0) +#define RCC_SAI2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI2SRC_1) +#define RCC_SAI2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI2SRC) +/** + * @} + */ + +/** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source + * @{ + */ +#define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U +#define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0) +#define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1) +#define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC) +/** + * @} + */ + +/** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source + * @{ + */ +#define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U +#define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0) +#define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1) +#define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC) +/** + * @} + */ + +/** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source + * @{ + */ +#define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U +#define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0) +#define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1) +/** + * @} + */ + +/** @defgroup RCCEx_CEC_Clock_Source RCC CEC Clock Source + * @{ + */ +#define RCC_CECCLKSOURCE_HSI 0x00000000U +#define RCC_CECCLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_CECSEL) +/** + * @} + */ + +/** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source + * @{ + */ +#define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U +#define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR2_CK48MSEL) +/** + * @} + */ + +/** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source + * @{ + */ +#define RCC_SDIOCLKSOURCE_CLK48 0x00000000U +#define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL) +/** + * @} + */ + +/** @defgroup RCCEx_SPDIFRX_Clock_Source RCC SPDIFRX Clock Source + * @{ + */ +#define RCC_SPDIFRXCLKSOURCE_PLLR 0x00000000U +#define RCC_SPDIFRXCLKSOURCE_PLLI2SP ((uint32_t)RCC_DCKCFGR2_SPDIFRXSEL) +/** + * @} + */ + +#endif /* STM32F446xx */ + +#if defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup RCCEx_SAI1_BlockA_Clock_Source RCC SAI BlockA Clock Source + * @{ + */ +#define RCC_SAIACLKSOURCE_PLLI2SR 0x00000000U +#define RCC_SAIACLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0) +#define RCC_SAIACLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1ASRC_1) +#define RCC_SAIACLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0 | RCC_DCKCFGR_SAI1ASRC_1) +/** + * @} + */ + +/** @defgroup RCCEx_SAI1_BlockB_Clock_Source RCC SAI BlockB Clock Source + * @{ + */ +#define RCC_SAIBCLKSOURCE_PLLI2SR 0x00000000U +#define RCC_SAIBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0) +#define RCC_SAIBCLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1BSRC_1) +#define RCC_SAIBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0 | RCC_DCKCFGR_SAI1BSRC_1) +/** + * @} + */ + +/** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source + * @{ + */ +#define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U +#define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0) +#define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1) +#define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1) +/** + * @} + */ + + +/** @defgroup RCCEx_DFSDM2_Audio_Clock_Source RCC DFSDM2 Audio Clock Source + * @{ + */ +#define RCC_DFSDM2AUDIOCLKSOURCE_I2S1 0x00000000U +#define RCC_DFSDM2AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM2ASEL) +/** + * @} + */ + +/** @defgroup RCCEx_DFSDM2_Kernel_Clock_Source RCC DFSDM2 Kernel Clock Source + * @{ + */ +#define RCC_DFSDM2CLKSOURCE_PCLK2 0x00000000U +#define RCC_DFSDM2CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL) +/** + * @} + */ + +#endif /* STM32F413xx || STM32F423xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup RCCEx_PLL_I2S_Clock_Source PLL I2S Clock Source + * @{ + */ +#define RCC_PLLI2SCLKSOURCE_PLLSRC 0x00000000U +#define RCC_PLLI2SCLKSOURCE_EXT ((uint32_t)RCC_PLLI2SCFGR_PLLI2SSRC) +/** + * @} + */ + +/** @defgroup RCCEx_DFSDM1_Audio_Clock_Source RCC DFSDM1 Audio Clock Source + * @{ + */ +#define RCC_DFSDM1AUDIOCLKSOURCE_I2S1 0x00000000U +#define RCC_DFSDM1AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM1ASEL) +/** + * @} + */ + +/** @defgroup RCCEx_DFSDM1_Kernel_Clock_Source RCC DFSDM1 Kernel Clock Source + * @{ + */ +#define RCC_DFSDM1CLKSOURCE_PCLK2 0x00000000U +#define RCC_DFSDM1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL) +/** + * @} + */ + +/** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source + * @{ + */ +#define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U +#define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0) +#define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1) +#define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC) +/** + * @} + */ + +/** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source + * @{ + */ +#define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U +#define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0) +#define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1) +#define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC) +/** + * @} + */ + +/** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source + * @{ + */ +#define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U +#define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0) +#define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1) +/** + * @} + */ + +/** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source + * @{ + */ +#define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U +#define RCC_CLK48CLKSOURCE_PLLI2SQ ((uint32_t)RCC_DCKCFGR2_CK48MSEL) +/** + * @} + */ + +/** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source + * @{ + */ +#define RCC_SDIOCLKSOURCE_CLK48 0x00000000U +#define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL) +/** + * @} + */ +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) + +/** @defgroup RCCEx_I2S_APB_Clock_Source RCC I2S APB Clock Source + * @{ + */ +#define RCC_I2SAPBCLKSOURCE_PLLR 0x00000000U +#define RCC_I2SAPBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2SSRC_0) +#define RCC_I2SAPBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2SSRC_1) +/** + * @} + */ + +/** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source + * @{ + */ +#define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U +#define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0) +#define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1) +/** + * @} + */ + +/** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source + * @{ + */ +#define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U +#define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0) +#define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1) +#define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1) +/** + * @} + */ +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup RCCEx_TIM_PRescaler_Selection RCC TIM PRescaler Selection + * @{ + */ +#define RCC_TIMPRES_DESACTIVATED ((uint8_t)0x00) +#define RCC_TIMPRES_ACTIVATED ((uint8_t)0x01) +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ + STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +/** @defgroup RCCEx_LSE_Dual_Mode_Selection RCC LSE Dual Mode Selection + * @{ + */ +#define RCC_LSE_LOWPOWER_MODE ((uint8_t)0x00) +#define RCC_LSE_HIGHDRIVE_MODE ((uint8_t)0x01) +/** + * @} + */ +#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||\ + STM32F412Rx || STM32F412Cx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ + defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source + * @{ + */ +#define RCC_MCO2SOURCE_SYSCLK 0x00000000U +#define RCC_MCO2SOURCE_PLLI2SCLK RCC_CFGR_MCO2_0 +#define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1 +#define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2 +/** + * @} + */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || + STM32F412Rx || STM32F413xx | STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source + * @{ + */ +#define RCC_MCO2SOURCE_SYSCLK 0x00000000U +#define RCC_MCO2SOURCE_I2SCLK RCC_CFGR_MCO2_0 +#define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1 +#define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2 +/** + * @} + */ +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros + * @{ + */ +/*------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx --------*/ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOK_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DMA2D_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN)) +#define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN)) +#define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN)) +#define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN)) +#define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN)) +#define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN)) +#define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN)) +#define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN)) +#define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN)) +#define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN)) +#define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) + +/** + * @brief Enable ETHERNET clock. + */ +#define __HAL_RCC_ETH_CLK_ENABLE() do { \ + __HAL_RCC_ETHMAC_CLK_ENABLE(); \ + __HAL_RCC_ETHMACTX_CLK_ENABLE(); \ + __HAL_RCC_ETHMACRX_CLK_ENABLE(); \ + } while(0U) +/** + * @brief Disable ETHERNET clock. + */ +#define __HAL_RCC_ETH_CLK_DISABLE() do { \ + __HAL_RCC_ETHMACTX_CLK_DISABLE(); \ + __HAL_RCC_ETHMACRX_CLK_DISABLE(); \ + __HAL_RCC_ETHMAC_CLK_DISABLE(); \ + } while(0U) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET) +#define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET) +#define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET) +#define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET) +#define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET) +#define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET) +#define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET) +#define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) +#define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \ + __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \ + __HAL_RCC_ETHMACRX_IS_CLK_ENABLED()) + +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET) +#define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET) +#define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET) +#define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET) +#define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET) +#define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET) +#define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET) +#define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +#define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \ + __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \ + __HAL_RCC_ETHMACRX_IS_CLK_DISABLED()) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + #define __HAL_RCC_DCMI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN)) + +#if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx) +#define __HAL_RCC_CRYP_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_HASH_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN)) +#define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN)) +#endif /* STM32F437xx || STM32F439xx || STM32F479xx */ + +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) + +#define __HAL_RCC_RNG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET) +#define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET) + +#if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx) +#define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET) +#define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET) + +#define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET) +#define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET) +#endif /* STM32F437xx || STM32F439xx || STM32F479xx */ + +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) + +#define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET) +#define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FMC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN)) +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_QSPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + + +/** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET) +#define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET) +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET) +#define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) +#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +#define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN)) +#define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET) +#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) +#define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET) +#define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET) + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) +#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +#define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET) +#define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SAI1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) +#define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN)) +#define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN)) +#define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN)) +#define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN)) +#define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN)) + +#if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_LTDC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN)) +#endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_DSI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) +#define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET) +#define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET) +#define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET) +#define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET) +#define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET) +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))!= RESET) + +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))== RESET) +#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) +#define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET) +#define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET) +#define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET) +#define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET) +#define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET) + +#if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET) +#define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET) +#endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_DSI_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) != RESET) +#define __HAL_RCC_DSI_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) == RESET) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST)) +#define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST)) +#define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST)) +#define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST)) +#define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST)) +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST)) +#define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST)) +#define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST)) +#define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST)) +#define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST)) + +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST)) + +#if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx) +#define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST)) +#define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST)) + +#define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST)) +#define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST)) +#endif /* STM32F437xx || STM32F439xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) +#define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST)) +#define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST)) + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST)) +#define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST)) +#define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST)) +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) + +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST)) +#define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST)) +#define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST)) +#define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST)) +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) + +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST)) +#define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST)) +#define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST)) + +#if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST)) +#define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST)) +#endif /* STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_DSI_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DSIRST)) +#define __HAL_RCC_DSI_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DSIRST)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN)) +#define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN)) +#define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN)) +#define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN)) +#define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN)) +#define __HAL_RCC_SRAM3_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM3LPEN)) +#define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN)) + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN)) +#define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN)) +#define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN)) +#define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN)) +#define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN)) +#define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) + +#define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN)) +#define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN)) + +#define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN)) +#define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN)) + +#if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx) +#define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN)) +#define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN)) + +#define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN)) +#define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN)) +#endif /* STM32F437xx || STM32F439xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN)) +#define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN)) + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN)) +#define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN)) +#define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN)) +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +#define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN)) +#define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN)) +#define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN)) +#define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN)) +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) + +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN)) +#define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN)) +#define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN)) + +#if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN)) + +#define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN)) +#endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DSILPEN)) +#define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DSILPEN)) +#endif /* STM32F469xx || STM32F479xx */ +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------- STM32F40xxx/STM32F41xxx-----------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN)) +#define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN)) +#define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN)) +#define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +#if defined(STM32F407xx)|| defined(STM32F417xx) +/** + * @brief Enable ETHERNET clock. + */ +#define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ETH_CLK_ENABLE() do { \ + __HAL_RCC_ETHMAC_CLK_ENABLE(); \ + __HAL_RCC_ETHMACTX_CLK_ENABLE(); \ + __HAL_RCC_ETHMACRX_CLK_ENABLE(); \ + } while(0U) + +/** + * @brief Disable ETHERNET clock. + */ +#define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN)) +#define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN)) +#define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN)) +#define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN)) +#define __HAL_RCC_ETH_CLK_DISABLE() do { \ + __HAL_RCC_ETHMACTX_CLK_DISABLE(); \ + __HAL_RCC_ETHMACRX_CLK_DISABLE(); \ + __HAL_RCC_ETHMAC_CLK_DISABLE(); \ + } while(0U) +#endif /* STM32F407xx || STM32F417xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET) + +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET) +#define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN))== RESET) +#define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +#if defined(STM32F407xx)|| defined(STM32F417xx) +/** + * @brief Enable ETHERNET clock. + */ +#define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET) +#define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET) +#define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \ + __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \ + __HAL_RCC_ETHMACRX_IS_CLK_ENABLED()) +/** + * @brief Disable ETHERNET clock. + */ +#define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET) +#define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET) +#define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \ + __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \ + __HAL_RCC_ETHMACRX_IS_CLK_DISABLED()) +#endif /* STM32F407xx || STM32F417xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) + +#define __HAL_RCC_RNG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN)) + +#if defined(STM32F407xx)|| defined(STM32F417xx) +#define __HAL_RCC_DCMI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN)) +#endif /* STM32F407xx || STM32F417xx */ + +#if defined(STM32F415xx) || defined(STM32F417xx) +#define __HAL_RCC_CRYP_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_HASH_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN)) +#define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN)) +#endif /* STM32F415xx || STM32F417xx */ +/** + * @} + */ + + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) + +#define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET) +#define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET) + +#if defined(STM32F407xx)|| defined(STM32F417xx) +#define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET) +#define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET) +#endif /* STM32F407xx || STM32F417xx */ + +#if defined(STM32F415xx) || defined(STM32F417xx) +#define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET) +#define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET) + +#define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET) +#define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET) +#endif /* STM32F415xx || STM32F417xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FSMC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET) +#define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) +#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET) +#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) +#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) + /** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) +#define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN)) +#define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) +#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) +#define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET) +#define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET) + +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) +#define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET) +#define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST)) +#define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST)) +#define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST)) +#define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST)) +#define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) + +#if defined(STM32F407xx)|| defined(STM32F417xx) +#define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST)) +#define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST)) +#endif /* STM32F407xx || STM32F417xx */ + +#if defined(STM32F415xx) || defined(STM32F417xx) +#define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST)) +#define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST)) + +#define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST)) +#define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST)) +#endif /* STM32F415xx || STM32F417xx */ + +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) + +#define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) + +#define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST)) +#define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) + +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) + +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN)) +#define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN)) +#define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN)) +#define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN)) + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN)) +#define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN)) +#define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN)) +#define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) + +#define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN)) +#define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN)) + +#if defined(STM32F407xx)|| defined(STM32F417xx) +#define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN)) +#define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN)) +#endif /* STM32F407xx || STM32F417xx */ + +#if defined(STM32F415xx) || defined(STM32F417xx) +#define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN)) +#define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN)) + +#define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN)) +#define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN)) +#endif /* STM32F415xx || STM32F417xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN)) +#define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +#define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN)) +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) + +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN)) +/** + * @} + */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------------- STM32F401xE/STM32F401xC --------------------------*/ +#if defined(STM32F401xC) || defined(STM32F401xE) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +#define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET) + +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) + +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +/** + * @} + */ +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB1_FORCE_RESET() (RCC->AHB1RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#define __HAL_RCC_AHB1_RELEASE_RESET() (RCC->AHB1RSTR = 0x00U) +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) + +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB1RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) + +#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00U) +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) + +#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00U) +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) + +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) + +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +/** + * @} + */ +#endif /* STM32F401xC || STM32F401xE*/ +/*----------------------------------------------------------------------------*/ + +/*-------------------------------- STM32F410xx -------------------------------*/ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RNG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +#define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_RNGEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) +#define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) != RESET) + +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +#define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB1) peripheral clock. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN)) +#define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN)) +#define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET) +#define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) + +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET) +#define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @{ + */ +#define __HAL_RCC_SPI5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_EXTIT_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN)) +#define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET) +#define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET) + +#define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET) +#define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) +#define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_RNGRST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +#define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_RNGRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() +#define __HAL_RCC_AHB2_RELEASE_RESET() +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() +#define __HAL_RCC_AHB3_RELEASE_RESET() +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST)) +#define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) + +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST)) +#define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST)) +#define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_RNGLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) + +#define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_RNGLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN)) +#define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN)) + +#define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN)) +#define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @{ + */ +#define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN)) +#define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN)) +#define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN)) +/** + * @} + */ + +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ +/*----------------------------------------------------------------------------*/ + +/*-------------------------------- STM32F411xx -------------------------------*/ +#if defined(STM32F411xE) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) + +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEX_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @{ + */ +#define __HAL_RCC_SPI5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) +#define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET) + +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +#define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) + +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) + +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST)) +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) + +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @{ + */ +#define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN)) +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) + +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN)) +/** + * @} + */ +#endif /* STM32F411xE */ +/*----------------------------------------------------------------------------*/ + +/*---------------------------------- STM32F446xx -----------------------------*/ +#if defined(STM32F446xx) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN)) +#define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN)) +#define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET) +#define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN))!= RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) + +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET) +#define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET) +#define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET) +#define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_DCMI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) + +#define __HAL_RCC_RNG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET) +#define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET) + +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) + +#define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET) +#define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FMC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_QSPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN)) +#define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET) +#define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET) + +#define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET) +#define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_USART3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CEC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#define __HAL_RCC_SPDIFRX_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN)) +#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN)) +#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) +#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) +#define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET) +#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET) +#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET) +#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) +#define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET) +#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET) +#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) +#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) +#define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_ADC3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SAI1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SAI2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) +#define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN)) +#define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN)) +#define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN)) +#define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) +#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) +#define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET) +#define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET) +#define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET) +#define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET) + +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) +#define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET) +#define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET) +#define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET) +#define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST)) +#define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST)) +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST)) + +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) + +#define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST)) +#define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST)) + +#define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST)) +#define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST)) +#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) + +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_SPDIFRX_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST)) +#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) +#define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST)) +#define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST)) +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) + +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST)) +#define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN)) + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN)) +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN)) +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +#define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) + +#define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN)) +#define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN)) + +#define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN)) +#define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN)) +#define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN)) + +#define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN)) +#define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +#define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN)) +#define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN)) +#define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN)) +#define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN)) +#define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN)) +#define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN)) +#define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN)) +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) + +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN)) +#define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN)) +#define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN)) +#define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN)) +#define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN)) +/** + * @} + */ + +#endif /* STM32F446xx */ +/*----------------------------------------------------------------------------*/ + +/*-------STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx-------*/ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN)) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN)) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN)) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET) + +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable + * @brief Enable or disable the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F423xx) +#define __HAL_RCC_AES_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_AES_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_AESEN)) +#endif /* STM32F423xx */ + +#define __HAL_RCC_RNG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN)) + +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\ + __HAL_RCC_SYSCFG_CLK_ENABLE();\ + }while(0U) + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F423xx) +#define __HAL_RCC_AES_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) != RESET) +#define __HAL_RCC_AES_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) == RESET) +#endif /* STM32F423xx */ + +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET) + +#define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET) +#define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable + * @brief Enables or disables the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_FSMC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_QSPI_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN)) +#define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB3 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET) +#define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET) + +#define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET) +#define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ + +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_CAN2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_I2C3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN)) +#define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN)) +#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) +#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN3EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +#define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN)) +#define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN)) +#endif /* STM32F413xx || STM32F423xx */ + +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET) +#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN))!= RESET) +#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) +#define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET) +#define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET) +#define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET) +#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) +#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +#define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET) +#define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_UART10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_EXTIT_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) +#define __HAL_RCC_SPI5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\ + UNUSED(tmpreg); \ + } while(0U) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg = 0x00U; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\ + UNUSED(tmpreg); \ + } while(0U) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART9EN)) +#define __HAL_RCC_UART10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART10EN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN)) +#define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN)) +#define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM1EN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM2EN)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) != RESET) +#define __HAL_RCC_UART10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET) +#define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET) +#define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) +#define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) != RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) != RESET) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) == RESET) +#define __HAL_RCC_UART10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET) +#define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET) +#define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +#define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) == RESET) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) == RESET) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset + * @brief Force or release AHB1 peripheral reset. + * @{ + */ +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST)) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST)) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST)) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST)) + +#if defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST)) +#endif /* STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST)) +#endif /* STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST)) +#endif /* STM32F412Zx || STM32F413xx || STM32F423xx */ +#define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset + * @brief Force or release AHB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U) + +#if defined(STM32F423xx) +#define __HAL_RCC_AES_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_AESRST)) +#define __HAL_RCC_AES_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_AESRST)) +#endif /* STM32F423xx */ + +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST)) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST)) + +#define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST)) +#define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset + * @brief Force or release AHB3 peripheral reset. + * @{ + */ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U) + +#define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST)) +#define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST)) + +#define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST)) +#define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F412Cx) +#define __HAL_RCC_AHB3_FORCE_RESET() +#define __HAL_RCC_AHB3_RELEASE_RESET() + +#define __HAL_RCC_FSMC_FORCE_RESET() +#define __HAL_RCC_QSPI_FORCE_RESET() + +#define __HAL_RCC_FSMC_RELEASE_RESET() +#define __HAL_RCC_QSPI_RELEASE_RESET() +#endif /* STM32F412Cx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST)) +#define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN3RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST)) +#define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST)) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST)) +#define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST)) +#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) +#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN3RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST)) +#define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART9RST)) +#define __HAL_RCC_UART10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART10RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM1RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM2RST)) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART9RST)) +#define __HAL_RCC_UART10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART10RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST)) +#define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM1RST)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM2RST)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN)) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN)) +#define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN)) +#define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN)) +#define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN)) +#define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN)) +#define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN)) +#define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wake-up from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#if defined(STM32F423xx) +#define __HAL_RCC_AES_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_AESLPEN)) +#define __HAL_RCC_AES_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_AESLPEN)) +#endif /* STM32F423xx */ + +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN)) +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN)) + +#define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN)) +#define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN)) +/** + * @} + */ + +/** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable + * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN)) +#define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN)) + +#define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN)) +#define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ + +/** + * @} + */ + +/** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN)) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN3LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN)) +#define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN)) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN)) +#define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN)) +#define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN)) +#define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN)) +#define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN)) +#define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN)) +#define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN)) +#define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN)) +#define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN)) +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN)) +#define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN)) +#define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN)) +#define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN)) +#define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_CAN3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN3LPEN)) +#define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN)) +#define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN)) +#define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ + +/** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable + * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode. + * @note Peripheral clock gating in SLEEP mode can be used to further reduce + * power consumption. + * @note After wakeup from SLEEP mode, the peripheral clock is enabled again. + * @note By default, all peripheral clocks are enabled during SLEEP mode. + * @{ + */ +#define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART9LPEN)) +#define __HAL_RCC_UART10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART10LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM1LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM2LPEN)) +#endif /* STM32F413xx || STM32F423xx */ + +#define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_UART9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART9LPEN)) +#define __HAL_RCC_UART10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART10LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN)) +#define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN)) +#define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN)) +#define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN)) +#define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +#define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM1LPEN)) +#if defined(STM32F413xx) || defined(STM32F423xx) +#define __HAL_RCC_DFSDM2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM2LPEN)) +#endif /* STM32F413xx || STM32F423xx */ +/** + * @} + */ +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------------------- PLL Configuration --------------------------*/ +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @brief Macro to configure the main PLL clock source, multiplication and division factors. + * @note This function must be used only when the main PLL is disabled. + * @param __RCC_PLLSource__ specifies the PLL entry clock source. + * This parameter can be one of the following values: + * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry + * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry + * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S. + * @param __PLLM__ specifies the division factor for PLL VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 2 MHz to limit PLL jitter. + * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLN parameter correctly to ensure that the VCO + * output frequency is between 100 and 432 MHz. + * + * @param __PLLP__ specifies the division factor for main system clock (SYSCLK) + * This parameter must be a number in the range {2, 4, 6, or 8}. + * + * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * @note If the USB OTG FS is used in your application, you have to set the + * PLLQ parameter correctly to have 48 MHz clock for the USB. However, + * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work + * correctly. + * + * @param __PLLR__ PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks. + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note This parameter is only available in STM32F446xx/STM32F469xx/STM32F479xx/ + STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices. + * + */ +#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__) \ + (RCC->PLLCFGR = ((__RCC_PLLSource__) | (__PLLM__) | \ + ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \ + ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \ + ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos) | \ + ((__PLLR__) << RCC_PLLCFGR_PLLR_Pos))) +#else +/** @brief Macro to configure the main PLL clock source, multiplication and division factors. + * @note This function must be used only when the main PLL is disabled. + * @param __RCC_PLLSource__ specifies the PLL entry clock source. + * This parameter can be one of the following values: + * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry + * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry + * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S. + * @param __PLLM__ specifies the division factor for PLL VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 2 MHz to limit PLL jitter. + * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock + * This parameter must be a number between Min_Data = 50 and Max_Data = 432 + * Except for STM32F411xE devices where Min_Data = 192. + * @note You have to set the PLLN parameter correctly to ensure that the VCO + * output frequency is between 100 and 432 MHz, Except for STM32F411xE devices + * where frequency is between 192 and 432 MHz. + * @param __PLLP__ specifies the division factor for main system clock (SYSCLK) + * This parameter must be a number in the range {2, 4, 6, or 8}. + * + * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * @note If the USB OTG FS is used in your application, you have to set the + * PLLQ parameter correctly to have 48 MHz clock for the USB. However, + * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work + * correctly. + * + */ +#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__) \ + (RCC->PLLCFGR = (0x20000000U | (__RCC_PLLSource__) | (__PLLM__)| \ + ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \ + ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \ + ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos))) + #endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------PLLI2S Configuration ---------------------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ + defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) + +/** @brief Macros to enable or disable the PLLI2S. + * @note The PLLI2S is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE) +#define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE) + +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || + STM32F412Rx || STM32F412Cx */ +#if defined(STM32F446xx) +/** @brief Macro to configure the PLLI2S clock multiplication and division factors . + * @note This macro must be used only when the PLLI2S is disabled. + * @note PLLI2S clock source is common with the main PLL (configured in + * HAL_RCC_ClockConfig() API). + * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 1 MHz to limit PLLI2S jitter. + * + * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLI2SP__ specifies division factor for SPDIFRX Clock. + * This parameter must be a number in the range {2, 4, 6, or 8}. + * @note the PLLI2SP parameter is only available with STM32F446xx Devices + * + * @param __PLLI2SR__ specifies the division factor for I2S clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz + * on the I2S clock frequency. + * + * @param __PLLI2SQ__ specifies the division factor for SAI clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + */ +#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) \ + (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\ + ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\ + ((((__PLLI2SP__) >> 1U) -1U) << RCC_PLLI2SCFGR_PLLI2SP_Pos) |\ + ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\ + ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))) +#elif defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) +/** @brief Macro to configure the PLLI2S clock multiplication and division factors . + * @note This macro must be used only when the PLLI2S is disabled. + * @note PLLI2S clock source is common with the main PLL (configured in + * HAL_RCC_ClockConfig() API). + * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 1 MHz to limit PLLI2S jitter. + * + * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLI2SR__ specifies the division factor for I2S clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz + * on the I2S clock frequency. + * + * @param __PLLI2SQ__ specifies the division factor for SAI clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + */ +#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) \ + (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\ + ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\ + ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\ + ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))) +#else +/** @brief Macro to configure the PLLI2S clock multiplication and division factors . + * @note This macro must be used only when the PLLI2S is disabled. + * @note PLLI2S clock source is common with the main PLL (configured in + * HAL_RCC_ClockConfig() API). + * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLI2SR__ specifies the division factor for I2S clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz + * on the I2S clock frequency. + * + */ +#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SR__) \ + (RCC->PLLI2SCFGR = (((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\ + ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))) +#endif /* STM32F446xx */ + +#if defined(STM32F411xE) +/** @brief Macro to configure the PLLI2S clock multiplication and division factors . + * @note This macro must be used only when the PLLI2S is disabled. + * @note This macro must be used only when the PLLI2S is disabled. + * @note PLLI2S clock source is common with the main PLL (configured in + * HAL_RCC_ClockConfig() API). + * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note The PLLI2SM parameter is only used with STM32F411xE/STM32F410xx Devices + * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 2 MHz to limit PLLI2S jitter. + * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock + * This parameter must be a number between Min_Data = 192 and Max_Data = 432. + * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 192 and Max_Data = 432 MHz. + * @param __PLLI2SR__ specifies the division factor for I2S clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz + * on the I2S clock frequency. + */ +#define __HAL_RCC_PLLI2S_I2SCLK_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\ + ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\ + ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))) +#endif /* STM32F411xE */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macro used by the SAI HAL driver to configure the PLLI2S clock multiplication and division factors. + * @note This macro must be used only when the PLLI2S is disabled. + * @note PLLI2S clock source is common with the main PLL (configured in + * HAL_RCC_ClockConfig() API) + * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock. + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * @param __PLLI2SQ__ specifies the division factor for SAI1 clock. + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * @note the PLLI2SQ parameter is only available with STM32F427xx/437xx/429xx/439xx/469xx/479xx + * Devices and can be configured using the __HAL_RCC_PLLI2S_PLLSAICLK_CONFIG() macro + * @param __PLLI2SR__ specifies the division factor for I2S clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz + * on the I2S clock frequency. + */ +#define __HAL_RCC_PLLI2S_SAICLK_CONFIG(__PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SN__) << 6U) |\ + ((__PLLI2SQ__) << 24U) |\ + ((__PLLI2SR__) << 28U)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------------------ PLLSAI Configuration ------------------------*/ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macros to Enable or Disable the PLLISAI. + * @note The PLLSAI is only available with STM32F429x/439x Devices. + * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLLSAI_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = ENABLE) +#define __HAL_RCC_PLLSAI_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = DISABLE) + +#if defined(STM32F446xx) +/** @brief Macro to configure the PLLSAI clock multiplication and division factors. + * + * @param __PLLSAIM__ specifies the division factor for PLLSAI VCO input clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 63. + * @note You have to set the PLLSAIM parameter correctly to ensure that the VCO input + * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency + * of 1 MHz to limit PLLI2S jitter. + * @note The PLLSAIM parameter is only used with STM32F446xx Devices + * + * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock. + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLSAIP__ specifies division factor for OTG FS, SDIO and RNG clocks. + * This parameter must be a number in the range {2, 4, 6, or 8}. + * @note the PLLSAIP parameter is only available with STM32F446xx Devices + * + * @param __PLLSAIQ__ specifies the division factor for SAI clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * + * @param __PLLSAIR__ specifies the division factor for LTDC clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices + */ +#define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIM__, __PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \ + (RCC->PLLSAICFGR = ((__PLLSAIM__) | \ + ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \ + ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) | \ + ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos))) +#endif /* STM32F446xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macro to configure the PLLSAI clock multiplication and division factors. + * + * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock. + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLSAIP__ specifies division factor for SDIO and CLK48 clocks. + * This parameter must be a number in the range {2, 4, 6, or 8}. + * + * @param __PLLSAIQ__ specifies the division factor for SAI clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * + * @param __PLLSAIR__ specifies the division factor for LTDC clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + */ +#define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \ + (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\ + ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\ + ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) |\ + ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos))) +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** @brief Macro to configure the PLLSAI clock multiplication and division factors. + * + * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock. + * This parameter must be a number between Min_Data = 50 and Max_Data = 432. + * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO + * output frequency is between Min_Data = 100 and Max_Data = 432 MHz. + * + * @param __PLLSAIQ__ specifies the division factor for SAI clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 15. + * + * @param __PLLSAIR__ specifies the division factor for LTDC clock + * This parameter must be a number between Min_Data = 2 and Max_Data = 7. + * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices + */ +#define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIQ__, __PLLSAIR__) \ + (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \ + ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) | \ + ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos))) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------- PLLSAI/PLLI2S Dividers Configuration -------------------*/ +#if defined(STM32F413xx) || defined(STM32F423xx) +/** @brief Macro to configure the SAI clock Divider coming from PLLI2S. + * @note This function must be called before enabling the PLLI2S. + * @param __PLLI2SDivR__ specifies the PLLI2S division factor for SAI1 clock. + * This parameter must be a number between 1 and 32. + * SAI1 clock frequency = f(PLLI2SR) / __PLLI2SDivR__ + */ +#define __HAL_RCC_PLLI2S_PLLSAICLKDIVR_CONFIG(__PLLI2SDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVR, (__PLLI2SDivR__)-1U)) + +/** @brief Macro to configure the SAI clock Divider coming from PLL. + * @param __PLLDivR__ specifies the PLL division factor for SAI1 clock. + * This parameter must be a number between 1 and 32. + * SAI1 clock frequency = f(PLLR) / __PLLDivR__ + */ +#define __HAL_RCC_PLL_PLLSAICLKDIVR_CONFIG(__PLLDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLDIVR, ((__PLLDivR__)-1U)<<8U)) +#endif /* STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macro to configure the SAI clock Divider coming from PLLI2S. + * @note This function must be called before enabling the PLLI2S. + * @param __PLLI2SDivQ__ specifies the PLLI2S division factor for SAI1 clock. + * This parameter must be a number between 1 and 32. + * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__ + */ +#define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVQ, (__PLLI2SDivQ__)-1U)) + +/** @brief Macro to configure the SAI clock Divider coming from PLLSAI. + * @note This function must be called before enabling the PLLSAI. + * @param __PLLSAIDivQ__ specifies the PLLSAI division factor for SAI1 clock . + * This parameter must be a number between Min_Data = 1 and Max_Data = 32. + * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__ + */ +#define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1U)<<8U)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Macro to configure the LTDC clock Divider coming from PLLSAI. + * + * @note The LTDC peripheral is only available with STM32F427/437/429/439/469/479xx Devices. + * @note This function must be called before enabling the PLLSAI. + * @param __PLLSAIDivR__ specifies the PLLSAI division factor for LTDC clock . + * This parameter must be a number between Min_Data = 2 and Max_Data = 16. + * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__ + */ +#define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVR, (__PLLSAIDivR__))) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +/*----------------------------------------------------------------------------*/ + +/*------------------------- Peripheral Clock selection -----------------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) ||\ + defined(STM32F479xx) +/** @brief Macro to configure the I2S clock source (I2SCLK). + * @note This function must be called before enabling the I2S APB clock. + * @param __SOURCE__ specifies the I2S clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source. + * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin + * used as I2S clock source. + */ +#define __HAL_RCC_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_CFGR_I2SSRC_BB = (__SOURCE__)) + + +/** @brief Macro to get the I2S clock source (I2SCLK). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source. + * @arg @ref RCC_I2SCLKSOURCE_EXT External clock mapped on the I2S_CKIN pin + * used as I2S clock source + */ +#define __HAL_RCC_GET_I2S_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC))) +#endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/** @brief Macro to configure SAI1BlockA clock source selection. + * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices. + * @note This function must be called before enabling PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI Block A clock source. + * This parameter can be one of the following values: + * @arg RCC_SAIACLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used + * as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used + * as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin + * used as SAI1 Block A clock. + */ +#define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__))) + +/** @brief Macro to configure SAI1BlockB clock source selection. + * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices. + * @note This function must be called before enabling PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI Block B clock source. + * This parameter can be one of the following values: + * @arg RCC_SAIBCLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used + * as SAI1 Block B clock. + * @arg RCC_SAIBCLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used + * as SAI1 Block B clock. + * @arg RCC_SAIBCLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin + * used as SAI1 Block B clock. + */ +#define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__))) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F446xx) +/** @brief Macro to configure SAI1 clock source selection. + * @note This configuration is only available with STM32F446xx Devices. + * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI1 clock source. + * This parameter can be one of the following values: + * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock. + */ +#define __HAL_RCC_SAI1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC, (__SOURCE__))) + +/** @brief Macro to Get SAI1 clock source selection. + * @note This configuration is only available with STM32F446xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock. + * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock. + */ +#define __HAL_RCC_GET_SAI1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC)) + +/** @brief Macro to configure SAI2 clock source selection. + * @note This configuration is only available with STM32F446xx Devices. + * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI2 clock source. + * This parameter can be one of the following values: + * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock. + */ +#define __HAL_RCC_SAI2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC, (__SOURCE__))) + +/** @brief Macro to Get SAI2 clock source selection. + * @note This configuration is only available with STM32F446xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock. + * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock. + */ +#define __HAL_RCC_GET_SAI2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC)) + +/** @brief Macro to configure I2S APB1 clock source selection. + * @note This function must be called before enabling PLL, PLLI2S and the I2S clock. + * @param __SOURCE__ specifies the I2S APB1 clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock. + * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock. + * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock. + * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__))) + +/** @brief Macro to Get I2S APB1 clock source selection. + * @retval The clock source can be one of the following values: + * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock. + * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock. + * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock. + * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC)) + +/** @brief Macro to configure I2S APB2 clock source selection. + * @note This function must be called before enabling PLL, PLLI2S and the I2S clock. + * @param __SOURCE__ specifies the SAI Block A clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock. + * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock. + * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock. + * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__))) + +/** @brief Macro to Get I2S APB2 clock source selection. + * @retval The clock source can be one of the following values: + * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock. + * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock. + * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock. + * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC)) + +/** @brief Macro to configure the CEC clock. + * @param __SOURCE__ specifies the CEC clock source. + * This parameter can be one of the following values: + * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock + * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock + */ +#define __HAL_RCC_CEC_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the CEC clock. + * @retval The clock source can be one of the following values: + * @arg RCC_CECCLKSOURCE_HSI488: HSI selected as CEC clock + * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock + */ +#define __HAL_RCC_GET_CEC_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL)) + +/** @brief Macro to configure the FMPI2C1 clock. + * @param __SOURCE__ specifies the FMPI2C1 clock source. + * This parameter can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the FMPI2C1 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL)) + +/** @brief Macro to configure the CLK48 clock. + * @param __SOURCE__ specifies the CLK48 clock source. + * This parameter can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock. + */ +#define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the CLK48 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock. + */ +#define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL)) + +/** @brief Macro to configure the SDIO clock. + * @param __SOURCE__ specifies the SDIO clock source. + * This parameter can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the SDIO clock. + * @retval The clock source can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL)) + +/** @brief Macro to configure the SPDIFRX clock. + * @param __SOURCE__ specifies the SPDIFRX clock source. + * This parameter can be one of the following values: + * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock. + * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock. + */ +#define __HAL_RCC_SPDIFRX_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the SPDIFRX clock. + * @retval The clock source can be one of the following values: + * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock. + * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock. + */ +#define __HAL_RCC_GET_SPDIFRX_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL)) +#endif /* STM32F446xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) + +/** @brief Macro to configure the CLK48 clock. + * @param __SOURCE__ specifies the CLK48 clock source. + * This parameter can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock. + */ +#define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the CLK48 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock. + */ +#define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL)) + +/** @brief Macro to configure the SDIO clock. + * @param __SOURCE__ specifies the SDIO clock source. + * This parameter can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the SDIO clock. + * @retval The clock source can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL)) + +/** @brief Macro to configure the DSI clock. + * @param __SOURCE__ specifies the DSI clock source. + * This parameter can be one of the following values: + * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock. + * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock. + */ +#define __HAL_RCC_DSI_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the DSI clock. + * @retval The clock source can be one of the following values: + * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock. + * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock. + */ +#define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL)) + +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) + /** @brief Macro to configure the DFSDM1 clock. + * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source. + * This parameter can be one of the following values: + * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock. + * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock. + * @retval None + */ +#define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM1_CLKSOURCE__)) + +/** @brief Macro to get the DFSDM1 clock source. + * @retval The clock source can be one of the following values: + * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock. + * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock. + */ +#define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL))) + +/** @brief Macro to configure DFSDM1 Audio clock source selection. + * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/ + STM32F413xx/STM32F423xx Devices. + * @param __SOURCE__ specifies the DFSDM1 Audio clock source. + * This parameter can be one of the following values: + * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock + * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock + */ +#define __HAL_RCC_DFSDM1AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL, (__SOURCE__))) + +/** @brief Macro to Get DFSDM1 Audio clock source selection. + * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/ + STM32F413xx/STM32F423xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock + * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock + */ +#define __HAL_RCC_GET_DFSDM1AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL)) + +#if defined(STM32F413xx) || defined(STM32F423xx) + /** @brief Macro to configure the DFSDM2 clock. + * @param __DFSDM2_CLKSOURCE__ specifies the DFSDM1 clock source. + * This parameter can be one of the following values: + * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock. + * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock. + * @retval None + */ +#define __HAL_RCC_DFSDM2_CONFIG(__DFSDM2_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM2_CLKSOURCE__)) + +/** @brief Macro to get the DFSDM2 clock source. + * @retval The clock source can be one of the following values: + * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock. + * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock. + */ +#define __HAL_RCC_GET_DFSDM2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL))) + +/** @brief Macro to configure DFSDM1 Audio clock source selection. + * @note This configuration is only available with STM32F413xx/STM32F423xx Devices. + * @param __SOURCE__ specifies the DFSDM2 Audio clock source. + * This parameter can be one of the following values: + * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock + * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock + */ +#define __HAL_RCC_DFSDM2AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL, (__SOURCE__))) + +/** @brief Macro to Get DFSDM2 Audio clock source selection. + * @note This configuration is only available with STM32F413xx/STM32F423xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock + * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock + */ +#define __HAL_RCC_GET_DFSDM2AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL)) + +/** @brief Macro to configure SAI1BlockA clock source selection. + * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices. + * @note This function must be called before enabling PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI Block A clock source. + * This parameter can be one of the following values: + * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__))) + +/** @brief Macro to Get SAI1 BlockA clock source selection. + * @note This configuration is only available with STM32F413xx/STM32F423xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock. + * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_SAI_BLOCKA_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC)) + +/** @brief Macro to configure SAI1 BlockB clock source selection. + * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices. + * @note This function must be called before enabling PLLSAI, PLLI2S and + * the SAI clock. + * @param __SOURCE__ specifies the SAI Block B clock source. + * This parameter can be one of the following values: + * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__))) + +/** @brief Macro to Get SAI1 BlockB clock source selection. + * @note This configuration is only available with STM32F413xx/STM32F423xx Devices. + * @retval The clock source can be one of the following values: + * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock. + * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_SAI_BLOCKB_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC)) + +/** @brief Macro to configure the LPTIM1 clock. + * @param __SOURCE__ specifies the LPTIM1 clock source. + * This parameter can be one of the following values: + * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock + */ +#define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the LPTIM1 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock + */ +#define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)) +#endif /* STM32F413xx || STM32F423xx */ + +/** @brief Macro to configure I2S APB1 clock source selection. + * @param __SOURCE__ specifies the I2S APB1 clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR. + * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR. + * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__))) + +/** @brief Macro to Get I2S APB1 clock source selection. + * @retval The clock source can be one of the following values: + * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR. + * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR. + * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC)) + +/** @brief Macro to configure I2S APB2 clock source selection. + * @param __SOURCE__ specifies the I2S APB2 clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR. + * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR. + * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__))) + +/** @brief Macro to Get I2S APB2 clock source selection. + * @retval The clock source can be one of the following values: + * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR. + * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR. + * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + */ +#define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC)) + +/** @brief Macro to configure the PLL I2S clock source (PLLI2SCLK). + * @note This macro must be called before enabling the I2S APB clock. + * @param __SOURCE__ specifies the I2S clock source. + * This parameter can be one of the following values: + * @arg RCC_PLLI2SCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock. + * @arg RCC_PLLI2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin + * used as I2S clock source. + */ +#define __HAL_RCC_PLL_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_PLLI2SCFGR_PLLI2SSRC_BB = (__SOURCE__)) + +/** @brief Macro to configure the FMPI2C1 clock. + * @param __SOURCE__ specifies the FMPI2C1 clock source. + * This parameter can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the FMPI2C1 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL)) + +/** @brief Macro to configure the CLK48 clock. + * @param __SOURCE__ specifies the CLK48 clock source. + * This parameter can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock. + */ +#define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the CLK48 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock. + * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock + */ +#define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL)) + +/** @brief Macro to configure the SDIO clock. + * @param __SOURCE__ specifies the SDIO clock source. + * This parameter can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the SDIO clock. + * @retval The clock source can be one of the following values: + * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock. + * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock. + */ +#define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL)) + +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** @brief Macro to configure I2S clock source selection. + * @param __SOURCE__ specifies the I2S clock source. + * This parameter can be one of the following values: + * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR. + * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC. + */ +#define __HAL_RCC_I2S_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC, (__SOURCE__))) + +/** @brief Macro to Get I2S clock source selection. + * @retval The clock source can be one of the following values: + * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR. + * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin. + * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC. + */ +#define __HAL_RCC_GET_I2S_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC)) + +/** @brief Macro to configure the FMPI2C1 clock. + * @param __SOURCE__ specifies the FMPI2C1 clock source. + * This parameter can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the FMPI2C1 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock + * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock + */ +#define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL)) + +/** @brief Macro to configure the LPTIM1 clock. + * @param __SOURCE__ specifies the LPTIM1 clock source. + * This parameter can be one of the following values: + * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock + */ +#define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__))) + +/** @brief Macro to Get the LPTIM1 clock. + * @retval The clock source can be one of the following values: + * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock + * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock + */ +#define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** @brief Macro to configure the Timers clocks prescalers + * @note This feature is only available with STM32F429x/439x Devices. + * @param __PRESC__ specifies the Timers clocks prescalers selection + * This parameter can be one of the following values: + * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is + * equal to HPRE if PPREx is corresponding to division by 1 or 2, + * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to + * division by 4 or more. + * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is + * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4, + * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding + * to division by 8 or more. + */ +#define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) (*(__IO uint32_t *) RCC_DCKCFGR_TIMPRE_BB = (__PRESC__)) + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx) || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE ||\ + STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx ||\ + STM32F423xx */ + +/*----------------------------------------------------------------------------*/ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @brief Enable PLLSAI_RDY interrupt. + */ +#define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE)) + +/** @brief Disable PLLSAI_RDY interrupt. + */ +#define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE)) + +/** @brief Clear the PLLSAI RDY interrupt pending bits. + */ +#define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF)) + +/** @brief Check the PLLSAI RDY interrupt has occurred or not. + * @retval The new state (TRUE or FALSE). + */ +#define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE)) + +/** @brief Check PLLSAI RDY flag is set or not. + * @retval The new state (TRUE or FALSE). + */ +#define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY)) + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** @brief Macros to enable or disable the RCC MCO1 feature. + */ +#define __HAL_RCC_MCO1_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = ENABLE) +#define __HAL_RCC_MCO1_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = DISABLE) + +/** @brief Macros to enable or disable the RCC MCO2 feature. + */ +#define __HAL_RCC_MCO2_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = ENABLE) +#define __HAL_RCC_MCO2_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = DISABLE) + +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup RCCEx_Exported_Functions + * @{ + */ + +/** @addtogroup RCCEx_Exported_Functions_Group1 + * @{ + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); + +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk); + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +void HAL_RCCEx_SelectLSEMode(uint8_t Mode); +#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +#if defined(RCC_PLLI2S_SUPPORT) +HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit); +HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void); +#endif /* RCC_PLLI2S_SUPPORT */ +#if defined(RCC_PLLSAI_SUPPORT) +HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit); +HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void); +#endif /* RCC_PLLSAI_SUPPORT */ +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup RCCEx_Private_Constants RCCEx Private Constants + * @{ + */ + +/** @defgroup RCCEx_BitAddress_AliasRegion RCC BitAddress AliasRegion + * @brief RCC registers bit address in the alias region + * @{ + */ +/* --- CR Register ---*/ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/* Alias word address of PLLSAION bit */ +#define RCC_PLLSAION_BIT_NUMBER 0x1CU +#define RCC_CR_PLLSAION_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLSAION_BIT_NUMBER * 4U)) + +#define PLLSAI_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ + defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/* Alias word address of PLLI2SON bit */ +#define RCC_PLLI2SON_BIT_NUMBER 0x1AU +#define RCC_CR_PLLI2SON_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLI2SON_BIT_NUMBER * 4U)) +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || + STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +/* --- DCKCFGR Register ---*/ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\ + defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/* Alias word address of TIMPRE bit */ +#define RCC_DCKCFGR_OFFSET (RCC_OFFSET + 0x8CU) +#define RCC_TIMPRE_BIT_NUMBER 0x18U +#define RCC_DCKCFGR_TIMPRE_BB (PERIPH_BB_BASE + (RCC_DCKCFGR_OFFSET * 32U) + (RCC_TIMPRE_BIT_NUMBER * 4U)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F410xx || STM32F401xC ||\ + STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +/* --- CFGR Register ---*/ +#define RCC_CFGR_OFFSET (RCC_OFFSET + 0x08U) +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ + defined(STM32F469xx) || defined(STM32F479xx) +/* Alias word address of I2SSRC bit */ +#define RCC_I2SSRC_BIT_NUMBER 0x17U +#define RCC_CFGR_I2SSRC_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_I2SSRC_BIT_NUMBER * 4U)) + +#define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) +/* --- PLLI2SCFGR Register ---*/ +#define RCC_PLLI2SCFGR_OFFSET (RCC_OFFSET + 0x84U) +/* Alias word address of PLLI2SSRC bit */ +#define RCC_PLLI2SSRC_BIT_NUMBER 0x16U +#define RCC_PLLI2SCFGR_PLLI2SSRC_BB (PERIPH_BB_BASE + (RCC_PLLI2SCFGR_OFFSET * 32U) + (RCC_PLLI2SSRC_BIT_NUMBER * 4U)) + +#define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */ +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx | STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/* Alias word address of MCO1EN bit */ +#define RCC_MCO1EN_BIT_NUMBER 0x8U +#define RCC_CFGR_MCO1EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO1EN_BIT_NUMBER * 4U)) + +/* Alias word address of MCO2EN bit */ +#define RCC_MCO2EN_BIT_NUMBER 0x9U +#define RCC_CFGR_MCO2EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO2EN_BIT_NUMBER * 4U)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#define PLL_TIMEOUT_VALUE 2U /* 2 ms */ +/** + * @} + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup RCCEx_Private_Macros RCCEx Private Macros + * @{ + */ +/** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters + * @{ + */ +#if defined(STM32F411xE) +#define IS_RCC_PLLN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U)) +#define IS_RCC_PLLI2SN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U)) +#else /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || + STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410Tx || STM32F410Cx || + STM32F410Rx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Cx || STM32F412Rx || + STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */ +#define IS_RCC_PLLN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U)) +#define IS_RCC_PLLI2SN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U)) +#endif /* STM32F411xE */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000007FU)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000007U)) +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000000FU)) +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000001FU)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F446xx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000FFFU)) +#endif /* STM32F446xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000001FFU)) +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000003FFU)) +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + +#if defined(STM32F413xx) || defined(STM32F423xx) +#define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00007FFFU)) +#endif /* STM32F413xx || STM32F423xx */ + +#define IS_RCC_PLLI2SR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U)) + +#define IS_RCC_PLLSAIN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U)) + +#define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U)) + +#define IS_RCC_PLLSAIR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U)) + +#define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U)) + +#define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\ + ((VALUE) == RCC_PLLSAIDIVR_4) ||\ + ((VALUE) == RCC_PLLSAIDIVR_8) ||\ + ((VALUE) == RCC_PLLSAIDIVR_16)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +#define IS_RCC_PLLI2SM_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 63U)) + +#define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\ + ((MODE) == RCC_LSE_HIGHDRIVE_MODE)) +#endif /* STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\ + ((MODE) == RCC_LSE_HIGHDRIVE_MODE)) + +#define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI)) + +#define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE)) + +#define IS_RCC_I2SAPBCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_I2SAPBCLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLSRC)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F446xx) +#define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == RCC_PLLI2SP_DIV2) ||\ + ((VALUE) == RCC_PLLI2SP_DIV4) ||\ + ((VALUE) == RCC_PLLI2SP_DIV6) ||\ + ((VALUE) == RCC_PLLI2SP_DIV8)) + +#define IS_RCC_PLLSAIM_VALUE(VALUE) ((VALUE) <= 63U) + +#define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\ + ((VALUE) == RCC_PLLSAIP_DIV4) ||\ + ((VALUE) == RCC_PLLSAIP_DIV6) ||\ + ((VALUE) == RCC_PLLSAIP_DIV8)) + +#define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) ||\ + ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_SAI1CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_SAI1CLKSOURCE_EXT)) + +#define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) ||\ + ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_SAI2CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_SAI2CLKSOURCE_PLLSRC)) + +#define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC)) + + #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC)) + +#define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI)) + +#define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) ||\ + ((SOURCE) == RCC_CECCLKSOURCE_LSE)) + +#define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\ + ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP)) + +#define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\ + ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK)) + +#define IS_RCC_SPDIFRXCLKSOURCE(SOURCE) (((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLI2SP)) +#endif /* STM32F446xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +#define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\ + ((VALUE) == RCC_PLLSAIP_DIV4) ||\ + ((VALUE) == RCC_PLLSAIP_DIV6) ||\ + ((VALUE) == RCC_PLLSAIP_DIV8)) + +#define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\ + ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP)) + +#define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\ + ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK)) + +#define IS_RCC_DSIBYTELANECLKSOURCE(SOURCE) (((SOURCE) == RCC_DSICLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_DSICLKSOURCE_DSIPHY)) + +#define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\ + ((MODE) == RCC_LSE_HIGHDRIVE_MODE)) +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) +#define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U)) + +#define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U)) + +#define IS_RCC_PLLI2SCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLI2SCLKSOURCE_PLLSRC) || \ + ((__SOURCE__) == RCC_PLLI2SCLKSOURCE_EXT)) + +#define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC)) + + #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC)) + +#define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\ + ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI)) + +#define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\ + ((SOURCE) == RCC_CLK48CLKSOURCE_PLLI2SQ)) + +#define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\ + ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK)) + +#define IS_RCC_DFSDM1CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1CLKSOURCE_PCLK2) || \ + ((__SOURCE__) == RCC_DFSDM1CLKSOURCE_SYSCLK)) + +#define IS_RCC_DFSDM1AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S1) || \ + ((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S2)) + +#if defined(STM32F413xx) || defined(STM32F423xx) +#define IS_RCC_DFSDM2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2CLKSOURCE_PCLK2) || \ + ((__SOURCE__) == RCC_DFSDM2CLKSOURCE_SYSCLK)) + +#define IS_RCC_DFSDM2AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S1) || \ + ((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S2)) + +#define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\ + ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE)) + +#define IS_RCC_SAIACLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIACLKSOURCE_PLLI2SR) ||\ + ((SOURCE) == RCC_SAIACLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_SAIACLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_SAIACLKSOURCE_PLLSRC)) + +#define IS_RCC_SAIBCLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIBCLKSOURCE_PLLI2SR) ||\ + ((SOURCE) == RCC_SAIBCLKSOURCE_EXT) ||\ + ((SOURCE) == RCC_SAIBCLKSOURCE_PLLR) ||\ + ((SOURCE) == RCC_SAIBCLKSOURCE_PLLSRC)) + +#define IS_RCC_PLL_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U)) + +#define IS_RCC_PLLI2S_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U)) + +#endif /* STM32F413xx || STM32F423xx */ +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ + defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) + +#define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_PLLI2SCLK)|| \ + ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK)) + +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || + STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || \ + STM32F412Rx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +#define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_I2SCLK)|| \ + ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK)) +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_RCC_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sdram.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sdram.h new file mode 100644 index 0000000..3dd7802 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sdram.h @@ -0,0 +1,226 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_sdram.h + * @author MCD Application Team + * @brief Header file of SDRAM HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_SDRAM_H +#define __STM32F4xx_HAL_SDRAM_H + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_fmc.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup SDRAM + * @{ + */ + +/* Exported typedef ----------------------------------------------------------*/ +/** @defgroup SDRAM_Exported_Types SDRAM Exported Types + * @{ + */ + +/** + * @brief HAL SDRAM State structure definition + */ +typedef enum +{ + HAL_SDRAM_STATE_RESET = 0x00U, /*!< SDRAM not yet initialized or disabled */ + HAL_SDRAM_STATE_READY = 0x01U, /*!< SDRAM initialized and ready for use */ + HAL_SDRAM_STATE_BUSY = 0x02U, /*!< SDRAM internal process is ongoing */ + HAL_SDRAM_STATE_ERROR = 0x03U, /*!< SDRAM error state */ + HAL_SDRAM_STATE_WRITE_PROTECTED = 0x04U, /*!< SDRAM device write protected */ + HAL_SDRAM_STATE_PRECHARGED = 0x05U /*!< SDRAM device precharged */ + +} HAL_SDRAM_StateTypeDef; + +/** + * @brief SDRAM handle Structure definition + */ +#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 */ + + FMC_SDRAM_InitTypeDef Init; /*!< SDRAM device configuration parameters */ + + __IO HAL_SDRAM_StateTypeDef State; /*!< SDRAM access state */ + + HAL_LockTypeDef Lock; /*!< SDRAM locking object */ + + DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ + +#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) ( DMA_HandleTypeDef * hdma); /*!< SDRAM DMA Xfer Complete callback */ + void (* DmaXferErrorCallback) ( DMA_HandleTypeDef * hdma); /*!< 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; + +/** + * @brief HAL SDRAM Callback pointer definition + */ +typedef void (*pSDRAM_CallbackTypeDef)(SDRAM_HandleTypeDef *hsdram); +typedef void (*pSDRAM_DmaCallbackTypeDef)(DMA_HandleTypeDef *hdma); +#endif +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup SDRAM_Exported_Macros SDRAM Exported Macros + * @{ + */ + +/** @brief Reset SDRAM handle state + * @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 +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup SDRAM_Exported_Functions SDRAM Exported Functions + * @{ + */ + +/** @addtogroup SDRAM_Exported_Functions_Group1 + * @{ + */ + +/* Initialization/de-initialization functions *********************************/ +HAL_StatusTypeDef HAL_SDRAM_Init(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_TimingTypeDef *Timing); +HAL_StatusTypeDef HAL_SDRAM_DeInit(SDRAM_HandleTypeDef *hsdram); +void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram); +void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram); + +void HAL_SDRAM_IRQHandler(SDRAM_HandleTypeDef *hsdram); +void HAL_SDRAM_RefreshErrorCallback(SDRAM_HandleTypeDef *hsdram); +void HAL_SDRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); +void HAL_SDRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); +/** + * @} + */ + +/** @addtogroup SDRAM_Exported_Functions_Group2 + * @{ + */ +/* I/O operation functions ****************************************************/ +HAL_StatusTypeDef HAL_SDRAM_Read_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Write_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Write_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Read_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Write_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); + +HAL_StatusTypeDef HAL_SDRAM_Read_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t * pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SDRAM_Write_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); + +#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 + +/** + * @} + */ + +/** @addtogroup SDRAM_Exported_Functions_Group3 + * @{ + */ +/* SDRAM Control functions *****************************************************/ +HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram); +HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram); +HAL_StatusTypeDef HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout); +HAL_StatusTypeDef HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram, uint32_t RefreshRate); +HAL_StatusTypeDef HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram, uint32_t AutoRefreshNumber); +uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram); +/** + * @} + */ + +/** @addtogroup SDRAM_Exported_Functions_Group4 + * @{ + */ +/* SDRAM State functions ********************************************************/ +HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_SDRAM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h new file mode 100644 index 0000000..0c7b08d --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h @@ -0,0 +1,232 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_sram.h + * @author MCD Application Team + * @brief Header file of SRAM HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_HAL_SRAM_H +#define __STM32F4xx_HAL_SRAM_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) + #include "stm32f4xx_ll_fsmc.h" +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + #include "stm32f4xx_ll_fmc.h" +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ + + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) + +/** @addtogroup SRAM + * @{ + */ + +/* Exported typedef ----------------------------------------------------------*/ + +/** @defgroup SRAM_Exported_Types SRAM Exported Types + * @{ + */ +/** + * @brief HAL SRAM State structures definition + */ +typedef enum +{ + HAL_SRAM_STATE_RESET = 0x00U, /*!< SRAM not yet initialized or disabled */ + HAL_SRAM_STATE_READY = 0x01U, /*!< SRAM initialized and ready for use */ + HAL_SRAM_STATE_BUSY = 0x02U, /*!< SRAM internal process is ongoing */ + HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */ + HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */ + +} HAL_SRAM_StateTypeDef; + +/** + * @brief SRAM handle Structure definition + */ +#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 */ + + FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ + + FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */ + + HAL_LockTypeDef Lock; /*!< SRAM locking object */ + + __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */ + + DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ + +#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) ( DMA_HandleTypeDef * hdma); /*!< SRAM DMA Xfer Complete callback */ + void (* DmaXferErrorCallback) ( DMA_HandleTypeDef * hdma); /*!< 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)(DMA_HandleTypeDef *hdma); +#endif +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ + +/** @defgroup SRAM_Exported_Macros SRAM Exported Macros + * @{ + */ +/** @brief Reset SRAM handle state + * @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 + +/** + * @} + */ +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup SRAM_Exported_Functions + * @{ + */ + +/** @addtogroup SRAM_Exported_Functions_Group1 + * @{ + */ +/* Initialization/de-initialization functions **********************************/ +HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming); +HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram); +void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram); +void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram); + +void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); +void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); +/** + * @} + */ + +/** @addtogroup SRAM_Exported_Functions_Group2 + * @{ + */ +/* I/O operation functions *****************************************************/ +HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); +HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); +#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 +/** + * @} + */ + +/** @addtogroup SRAM_Exported_Functions_Group3 + * @{ + */ +/* SRAM Control functions ******************************************************/ +HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram); +HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram); +/** + * @} + */ + +/** @addtogroup SRAM_Exported_Functions_Group4 + * @{ + */ +/* SRAM State functions *********************************************************/ +HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram); +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** + * @} + */ + +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ + STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_SRAM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h new file mode 100644 index 0000000..d6f1a1a --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h @@ -0,0 +1,2030 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_tim.h + * @author MCD Application Team + * @brief Header file of TIM HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F4xx_HAL_TIM_H +#define STM32F4xx_HAL_TIM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup TIM + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIM_Exported_Types TIM Exported Types + * @{ + */ + +/** + * @brief TIM Time base Configuration Structure definition + */ +typedef struct +{ + uint32_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ + + uint32_t CounterMode; /*!< Specifies the counter mode. + This parameter can be a value of @ref TIM_Counter_Mode */ + + uint32_t Period; /*!< Specifies the period value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t ClockDivision; /*!< Specifies the clock division. + This parameter can be a value of @ref TIM_ClockDivision */ + + uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter + reaches zero, an update event is generated and counting restarts + from the RCR value (N). + This means in PWM mode that (N+1) corresponds to: + - the number of PWM periods in edge-aligned mode + - the number of half PWM period in center-aligned mode + GP timers: this parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. + Advanced timers: this parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t AutoReloadPreload; /*!< Specifies the auto-reload preload. + This parameter can be a value of @ref TIM_AutoReloadPreload */ +} TIM_Base_InitTypeDef; + +/** + * @brief TIM Output Compare Configuration Structure definition + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the TIM mode. + This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ + + uint32_t Pulse; /*!< 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 */ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_Output_Compare_Polarity */ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_Output_Compare_N_Polarity + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCFastMode; /*!< Specifies the Fast mode state. + This parameter can be a value of @ref TIM_Output_Fast_State + @note This parameter is valid only in PWM1 and PWM2 mode. */ + + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ +} TIM_OC_InitTypeDef; + +/** + * @brief TIM One Pulse Mode Configuration Structure definition + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the TIM mode. + This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ + + uint32_t Pulse; /*!< 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 */ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_Output_Compare_Polarity */ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_Output_Compare_N_Polarity + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Input_Capture_Polarity */ + + uint32_t ICSelection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_OnePulse_InitTypeDef; + +/** + * @brief TIM Input Capture Configuration Structure definition + */ +typedef struct +{ + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Input_Capture_Polarity */ + + uint32_t ICSelection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_IC_InitTypeDef; + +/** + * @brief TIM Encoder Configuration Structure definition + */ +typedef struct +{ + uint32_t EncoderMode; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Mode */ + + uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Input_Polarity */ + + uint32_t IC1Selection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + 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 IC2Polarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Input_Polarity */ + + uint32_t IC2Selection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t IC2Prescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ + + uint32_t IC2Filter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_Encoder_InitTypeDef; + +/** + * @brief Clock Configuration Handle Structure definition + */ +typedef struct +{ + uint32_t ClockSource; /*!< TIM clock sources + This parameter can be a value of @ref TIM_Clock_Source */ + uint32_t ClockPolarity; /*!< TIM clock polarity + This parameter can be a value of @ref TIM_Clock_Polarity */ + uint32_t ClockPrescaler; /*!< TIM clock prescaler + This parameter can be a value of @ref TIM_Clock_Prescaler */ + uint32_t ClockFilter; /*!< TIM clock filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_ClockConfigTypeDef; + +/** + * @brief TIM Clear Input Configuration Handle Structure definition + */ +typedef struct +{ + uint32_t ClearInputState; /*!< TIM clear Input state + This parameter can be ENABLE or DISABLE */ + uint32_t ClearInputSource; /*!< TIM clear Input sources + This parameter can be a value of @ref TIM_ClearInput_Source */ + uint32_t ClearInputPolarity; /*!< TIM Clear Input polarity + This parameter can be a value of @ref TIM_ClearInput_Polarity */ + uint32_t ClearInputPrescaler; /*!< TIM Clear Input prescaler + This parameter must be 0: When OCRef clear feature is used with ETR source, ETR prescaler must be off */ + uint32_t ClearInputFilter; /*!< TIM Clear Input filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_ClearInputConfigTypeDef; + +/** + * @brief TIM Master configuration Structure definition + */ +typedef struct +{ + uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection + This parameter can be a value of @ref TIM_Master_Mode_Selection */ + uint32_t MasterSlaveMode; /*!< Master/slave mode selection + This parameter can be a value of @ref TIM_Master_Slave_Mode + @note When the Master/slave mode is enabled, the effect of + an event on the trigger input (TRGI) is delayed to allow a + perfect synchronization between the current timer and its + slaves (through TRGO). It is not mandatory in case of timer + synchronization mode. */ +} TIM_MasterConfigTypeDef; + +/** + * @brief TIM Slave configuration Structure definition + */ +typedef struct +{ + uint32_t SlaveMode; /*!< Slave mode selection + This parameter can be a value of @ref TIM_Slave_Mode */ + uint32_t InputTrigger; /*!< Input Trigger source + This parameter can be a value of @ref TIM_Trigger_Selection */ + uint32_t TriggerPolarity; /*!< Input Trigger polarity + This parameter can be a value of @ref TIM_Trigger_Polarity */ + uint32_t TriggerPrescaler; /*!< Input trigger prescaler + This parameter can be a value of @ref TIM_Trigger_Prescaler */ + uint32_t TriggerFilter; /*!< Input trigger filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ + +} TIM_SlaveConfigTypeDef; + +/** + * @brief TIM Break input(s) and Dead time configuration Structure definition + * @note 2 break inputs can be configured (BKIN and BKIN2) with configurable + * filter and polarity. + */ +typedef struct +{ + uint32_t OffStateRunMode; /*!< TIM off state in run mode + This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */ + uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode + This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */ + uint32_t LockLevel; /*!< TIM Lock level + This parameter can be a value of @ref TIM_Lock_level */ + uint32_t DeadTime; /*!< TIM dead Time + This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */ + uint32_t BreakState; /*!< TIM Break State + This parameter can be a value of @ref TIM_Break_Input_enable_disable */ + uint32_t BreakPolarity; /*!< TIM Break input polarity + This parameter can be a value of @ref TIM_Break_Polarity */ + uint32_t BreakFilter; /*!< Specifies the break input filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ + uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state + This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */ +} TIM_BreakDeadTimeConfigTypeDef; + +/** + * @brief HAL State structures definition + */ +typedef enum +{ + HAL_TIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */ + HAL_TIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ + HAL_TIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */ + HAL_TIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ + HAL_TIM_STATE_ERROR = 0x04U /*!< Reception process is ongoing */ +} HAL_TIM_StateTypeDef; + +/** + * @brief HAL Active channel structures definition + */ +typedef enum +{ + HAL_TIM_ACTIVE_CHANNEL_1 = 0x01U, /*!< The active channel is 1 */ + HAL_TIM_ACTIVE_CHANNEL_2 = 0x02U, /*!< The active channel is 2 */ + HAL_TIM_ACTIVE_CHANNEL_3 = 0x04U, /*!< The active channel is 3 */ + HAL_TIM_ACTIVE_CHANNEL_4 = 0x08U, /*!< The active channel is 4 */ + HAL_TIM_ACTIVE_CHANNEL_CLEARED = 0x00U /*!< All active channels cleared */ +} HAL_TIM_ActiveChannel; + +/** + * @brief TIM Time Base Handle Structure definition + */ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +typedef struct __TIM_HandleTypeDef +#else +typedef struct +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +{ + TIM_TypeDef *Instance; /*!< Register base address */ + TIM_Base_InitTypeDef Init; /*!< TIM Time Base required parameters */ + HAL_TIM_ActiveChannel Channel; /*!< Active channel */ + DMA_HandleTypeDef *hdma[7]; /*!< DMA Handlers array + This array is accessed by a @ref DMA_Handle_index */ + HAL_LockTypeDef Lock; /*!< Locking object */ + __IO HAL_TIM_StateTypeDef State; /*!< TIM operation state */ + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + void (* Base_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Base Msp Init Callback */ + void (* Base_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Base Msp DeInit Callback */ + void (* IC_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM IC Msp Init Callback */ + void (* IC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM IC Msp DeInit Callback */ + void (* OC_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM OC Msp Init Callback */ + void (* OC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM OC Msp DeInit Callback */ + void (* PWM_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Msp Init Callback */ + void (* PWM_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Msp DeInit Callback */ + void (* OnePulse_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM One Pulse Msp Init Callback */ + void (* OnePulse_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM One Pulse Msp DeInit Callback */ + void (* Encoder_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Encoder Msp Init Callback */ + void (* Encoder_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Encoder Msp DeInit Callback */ + void (* HallSensor_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Hall Sensor Msp Init Callback */ + void (* HallSensor_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Hall Sensor Msp DeInit Callback */ + void (* PeriodElapsedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Period Elapsed Callback */ + void (* PeriodElapsedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Period Elapsed half complete Callback */ + void (* TriggerCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Trigger Callback */ + void (* TriggerHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Trigger half complete Callback */ + void (* IC_CaptureCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Input Capture Callback */ + void (* IC_CaptureHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Input Capture half complete Callback */ + void (* OC_DelayElapsedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Output Compare Delay Elapsed Callback */ + void (* PWM_PulseFinishedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Pulse Finished Callback */ + void (* PWM_PulseFinishedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Pulse Finished half complete Callback */ + void (* ErrorCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Error Callback */ + void (* CommutationCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Commutation Callback */ + void (* CommutationHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Commutation half complete Callback */ + void (* BreakCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Break Callback */ +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} TIM_HandleTypeDef; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief HAL TIM Callback ID enumeration definition + */ +typedef enum +{ + HAL_TIM_BASE_MSPINIT_CB_ID = 0x00U /*!< TIM Base MspInit Callback ID */ + ,HAL_TIM_BASE_MSPDEINIT_CB_ID = 0x01U /*!< TIM Base MspDeInit Callback ID */ + ,HAL_TIM_IC_MSPINIT_CB_ID = 0x02U /*!< TIM IC MspInit Callback ID */ + ,HAL_TIM_IC_MSPDEINIT_CB_ID = 0x03U /*!< TIM IC MspDeInit Callback ID */ + ,HAL_TIM_OC_MSPINIT_CB_ID = 0x04U /*!< TIM OC MspInit Callback ID */ + ,HAL_TIM_OC_MSPDEINIT_CB_ID = 0x05U /*!< TIM OC MspDeInit Callback ID */ + ,HAL_TIM_PWM_MSPINIT_CB_ID = 0x06U /*!< TIM PWM MspInit Callback ID */ + ,HAL_TIM_PWM_MSPDEINIT_CB_ID = 0x07U /*!< TIM PWM MspDeInit Callback ID */ + ,HAL_TIM_ONE_PULSE_MSPINIT_CB_ID = 0x08U /*!< TIM One Pulse MspInit Callback ID */ + ,HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID = 0x09U /*!< TIM One Pulse MspDeInit Callback ID */ + ,HAL_TIM_ENCODER_MSPINIT_CB_ID = 0x0AU /*!< TIM Encoder MspInit Callback ID */ + ,HAL_TIM_ENCODER_MSPDEINIT_CB_ID = 0x0BU /*!< TIM Encoder MspDeInit Callback ID */ + ,HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID = 0x0CU /*!< TIM Hall Sensor MspDeInit Callback ID */ + ,HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID = 0x0DU /*!< TIM Hall Sensor MspDeInit Callback ID */ + ,HAL_TIM_PERIOD_ELAPSED_CB_ID = 0x0EU /*!< TIM Period Elapsed Callback ID */ + ,HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID = 0x0FU /*!< TIM Period Elapsed half complete Callback ID */ + ,HAL_TIM_TRIGGER_CB_ID = 0x10U /*!< TIM Trigger Callback ID */ + ,HAL_TIM_TRIGGER_HALF_CB_ID = 0x11U /*!< TIM Trigger half complete Callback ID */ + + ,HAL_TIM_IC_CAPTURE_CB_ID = 0x12U /*!< TIM Input Capture Callback ID */ + ,HAL_TIM_IC_CAPTURE_HALF_CB_ID = 0x13U /*!< TIM Input Capture half complete Callback ID */ + ,HAL_TIM_OC_DELAY_ELAPSED_CB_ID = 0x14U /*!< TIM Output Compare Delay Elapsed Callback ID */ + ,HAL_TIM_PWM_PULSE_FINISHED_CB_ID = 0x15U /*!< TIM PWM Pulse Finished Callback ID */ + ,HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID = 0x16U /*!< TIM PWM Pulse Finished half complete Callback ID */ + ,HAL_TIM_ERROR_CB_ID = 0x17U /*!< TIM Error Callback ID */ + ,HAL_TIM_COMMUTATION_CB_ID = 0x18U /*!< TIM Commutation Callback ID */ + ,HAL_TIM_COMMUTATION_HALF_CB_ID = 0x19U /*!< TIM Commutation half complete Callback ID */ + ,HAL_TIM_BREAK_CB_ID = 0x1AU /*!< TIM Break Callback ID */ +} HAL_TIM_CallbackIDTypeDef; + +/** + * @brief HAL TIM Callback pointer definition + */ +typedef void (*pTIM_CallbackTypeDef)(TIM_HandleTypeDef *htim); /*!< pointer to the TIM callback function */ + +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ +/* End of exported types -----------------------------------------------------*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIM_Exported_Constants TIM Exported Constants + * @{ + */ + +/** @defgroup TIM_ClearInput_Source TIM Clear Input Source + * @{ + */ +#define TIM_CLEARINPUTSOURCE_NONE 0x00000000U /*!< OCREF_CLR is disabled */ +#define TIM_CLEARINPUTSOURCE_ETR 0x00000001U /*!< OCREF_CLR is connected to ETRF input */ +/** + * @} + */ + +/** @defgroup TIM_DMA_Base_address TIM DMA Base Address + * @{ + */ +#define TIM_DMABASE_CR1 0x00000000U +#define TIM_DMABASE_CR2 0x00000001U +#define TIM_DMABASE_SMCR 0x00000002U +#define TIM_DMABASE_DIER 0x00000003U +#define TIM_DMABASE_SR 0x00000004U +#define TIM_DMABASE_EGR 0x00000005U +#define TIM_DMABASE_CCMR1 0x00000006U +#define TIM_DMABASE_CCMR2 0x00000007U +#define TIM_DMABASE_CCER 0x00000008U +#define TIM_DMABASE_CNT 0x00000009U +#define TIM_DMABASE_PSC 0x0000000AU +#define TIM_DMABASE_ARR 0x0000000BU +#define TIM_DMABASE_RCR 0x0000000CU +#define TIM_DMABASE_CCR1 0x0000000DU +#define TIM_DMABASE_CCR2 0x0000000EU +#define TIM_DMABASE_CCR3 0x0000000FU +#define TIM_DMABASE_CCR4 0x00000010U +#define TIM_DMABASE_BDTR 0x00000011U +#define TIM_DMABASE_DCR 0x00000012U +#define TIM_DMABASE_DMAR 0x00000013U +/** + * @} + */ + +/** @defgroup TIM_Event_Source TIM Event 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 */ +/** + * @} + */ + +/** @defgroup TIM_Input_Channel_Polarity TIM Input Channel polarity + * @{ + */ +#define TIM_INPUTCHANNELPOLARITY_RISING 0x00000000U /*!< Polarity for TIx source */ +#define TIM_INPUTCHANNELPOLARITY_FALLING TIM_CCER_CC1P /*!< Polarity for TIx source */ +#define TIM_INPUTCHANNELPOLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP) /*!< Polarity for TIx source */ +/** + * @} + */ + +/** @defgroup TIM_ETR_Polarity TIM ETR Polarity + * @{ + */ +#define TIM_ETRPOLARITY_INVERTED TIM_SMCR_ETP /*!< Polarity for ETR source */ +#define TIM_ETRPOLARITY_NONINVERTED 0x00000000U /*!< Polarity for ETR source */ +/** + * @} + */ + +/** @defgroup TIM_ETR_Prescaler TIM ETR Prescaler + * @{ + */ +#define TIM_ETRPRESCALER_DIV1 0x00000000U /*!< No prescaler is used */ +#define TIM_ETRPRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR input source is divided by 2 */ +#define TIM_ETRPRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR input source is divided by 4 */ +#define TIM_ETRPRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR input source is divided by 8 */ +/** + * @} + */ + +/** @defgroup TIM_Counter_Mode TIM Counter Mode + * @{ + */ +#define TIM_COUNTERMODE_UP 0x00000000U /*!< Counter used as up-counter */ +#define TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as down-counter */ +#define TIM_COUNTERMODE_CENTERALIGNED1 TIM_CR1_CMS_0 /*!< Center-aligned mode 1 */ +#define TIM_COUNTERMODE_CENTERALIGNED2 TIM_CR1_CMS_1 /*!< Center-aligned mode 2 */ +#define TIM_COUNTERMODE_CENTERALIGNED3 TIM_CR1_CMS /*!< Center-aligned mode 3 */ +/** + * @} + */ + +/** @defgroup TIM_ClockDivision TIM Clock Division + * @{ + */ +#define TIM_CLOCKDIVISION_DIV1 0x00000000U /*!< Clock division: tDTS=tCK_INT */ +#define TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< Clock division: tDTS=2*tCK_INT */ +#define TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< Clock division: tDTS=4*tCK_INT */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_State TIM Output Compare State + * @{ + */ +#define TIM_OUTPUTSTATE_DISABLE 0x00000000U /*!< Capture/Compare 1 output disabled */ +#define TIM_OUTPUTSTATE_ENABLE TIM_CCER_CC1E /*!< Capture/Compare 1 output enabled */ +/** + * @} + */ + +/** @defgroup TIM_AutoReloadPreload TIM Auto-Reload Preload + * @{ + */ +#define TIM_AUTORELOAD_PRELOAD_DISABLE 0x00000000U /*!< TIMx_ARR register is not buffered */ +#define TIM_AUTORELOAD_PRELOAD_ENABLE TIM_CR1_ARPE /*!< TIMx_ARR register is buffered */ + +/** + * @} + */ + +/** @defgroup TIM_Output_Fast_State TIM Output Fast State + * @{ + */ +#define TIM_OCFAST_DISABLE 0x00000000U /*!< Output Compare fast disable */ +#define TIM_OCFAST_ENABLE TIM_CCMR1_OC1FE /*!< Output Compare fast enable */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_State TIM Complementary Output Compare State + * @{ + */ +#define TIM_OUTPUTNSTATE_DISABLE 0x00000000U /*!< OCxN is disabled */ +#define TIM_OUTPUTNSTATE_ENABLE TIM_CCER_CC1NE /*!< OCxN is enabled */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_Polarity TIM Output Compare Polarity + * @{ + */ +#define TIM_OCPOLARITY_HIGH 0x00000000U /*!< Capture/Compare output polarity */ +#define TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< Capture/Compare output polarity */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_Polarity TIM Complementary Output Compare Polarity + * @{ + */ +#define TIM_OCNPOLARITY_HIGH 0x00000000U /*!< Capture/Compare complementary output polarity */ +#define TIM_OCNPOLARITY_LOW TIM_CCER_CC1NP /*!< Capture/Compare complementary output polarity */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_Idle_State TIM Output Compare Idle State + * @{ + */ +#define TIM_OCIDLESTATE_SET TIM_CR2_OIS1 /*!< Output Idle state: OCx=1 when MOE=0 */ +#define TIM_OCIDLESTATE_RESET 0x00000000U /*!< Output Idle state: OCx=0 when MOE=0 */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_Idle_State TIM Complementary Output Compare Idle State + * @{ + */ +#define TIM_OCNIDLESTATE_SET TIM_CR2_OIS1N /*!< Complementary output Idle state: OCxN=1 when MOE=0 */ +#define TIM_OCNIDLESTATE_RESET 0x00000000U /*!< Complementary output Idle state: OCxN=0 when MOE=0 */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Polarity TIM Input Capture Polarity + * @{ + */ +#define TIM_ICPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Capture triggered by rising edge on timer input */ +#define TIM_ICPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Capture triggered by falling edge on timer input */ +#define TIM_ICPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Capture triggered by both rising and falling edges on timer input*/ +/** + * @} + */ + +/** @defgroup TIM_Encoder_Input_Polarity TIM Encoder Input Polarity + * @{ + */ +#define TIM_ENCODERINPUTPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Encoder input with rising edge polarity */ +#define TIM_ENCODERINPUTPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Encoder input with falling edge polarity */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Selection TIM Input Capture Selection + * @{ + */ +#define TIM_ICSELECTION_DIRECTTI TIM_CCMR1_CC1S_0 /*!< TIM Input 1, 2, 3 or 4 is selected to be + connected to IC1, IC2, IC3 or IC4, respectively */ +#define TIM_ICSELECTION_INDIRECTTI TIM_CCMR1_CC1S_1 /*!< TIM Input 1, 2, 3 or 4 is selected to be + connected to IC2, IC1, IC4 or IC3, respectively */ +#define TIM_ICSELECTION_TRC TIM_CCMR1_CC1S /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Prescaler TIM Input Capture Prescaler + * @{ + */ +#define TIM_ICPSC_DIV1 0x00000000U /*!< Capture performed each time an edge is detected on the capture input */ +#define TIM_ICPSC_DIV2 TIM_CCMR1_IC1PSC_0 /*!< Capture performed once every 2 events */ +#define TIM_ICPSC_DIV4 TIM_CCMR1_IC1PSC_1 /*!< Capture performed once every 4 events */ +#define TIM_ICPSC_DIV8 TIM_CCMR1_IC1PSC /*!< Capture performed once every 8 events */ +/** + * @} + */ + +/** @defgroup TIM_One_Pulse_Mode TIM One Pulse Mode + * @{ + */ +#define TIM_OPMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */ +#define TIM_OPMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */ +/** + * @} + */ + +/** @defgroup TIM_Encoder_Mode TIM Encoder Mode + * @{ + */ +#define TIM_ENCODERMODE_TI1 TIM_SMCR_SMS_0 /*!< Quadrature encoder mode 1, x2 mode, counts up/down on TI1FP1 edge depending on TI2FP2 level */ +#define TIM_ENCODERMODE_TI2 TIM_SMCR_SMS_1 /*!< Quadrature encoder mode 2, x2 mode, counts up/down on TI2FP2 edge depending on TI1FP1 level. */ +#define TIM_ENCODERMODE_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode 3, x4 mode, counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input. */ +/** + * @} + */ + +/** @defgroup TIM_Interrupt_definition TIM interrupt Definition + * @{ + */ +#define TIM_IT_UPDATE TIM_DIER_UIE /*!< Update interrupt */ +#define TIM_IT_CC1 TIM_DIER_CC1IE /*!< Capture/Compare 1 interrupt */ +#define TIM_IT_CC2 TIM_DIER_CC2IE /*!< Capture/Compare 2 interrupt */ +#define TIM_IT_CC3 TIM_DIER_CC3IE /*!< Capture/Compare 3 interrupt */ +#define TIM_IT_CC4 TIM_DIER_CC4IE /*!< Capture/Compare 4 interrupt */ +#define TIM_IT_COM TIM_DIER_COMIE /*!< Commutation interrupt */ +#define TIM_IT_TRIGGER TIM_DIER_TIE /*!< Trigger interrupt */ +#define TIM_IT_BREAK TIM_DIER_BIE /*!< Break interrupt */ +/** + * @} + */ + +/** @defgroup TIM_Commutation_Source TIM Commutation Source + * @{ + */ +#define TIM_COMMUTATION_TRGI TIM_CR2_CCUS /*!< When Capture/compare control bits are preloaded, they are updated by setting the COMG bit or when an rising edge occurs on trigger input */ +#define TIM_COMMUTATION_SOFTWARE 0x00000000U /*!< When Capture/compare control bits are preloaded, they are updated by setting the COMG bit */ +/** + * @} + */ + +/** @defgroup TIM_DMA_sources TIM DMA Sources + * @{ + */ +#define TIM_DMA_UPDATE TIM_DIER_UDE /*!< DMA request is triggered by the update event */ +#define TIM_DMA_CC1 TIM_DIER_CC1DE /*!< DMA request is triggered by the capture/compare macth 1 event */ +#define TIM_DMA_CC2 TIM_DIER_CC2DE /*!< DMA request is triggered by the capture/compare macth 2 event event */ +#define TIM_DMA_CC3 TIM_DIER_CC3DE /*!< DMA request is triggered by the capture/compare macth 3 event event */ +#define TIM_DMA_CC4 TIM_DIER_CC4DE /*!< DMA request is triggered by the capture/compare macth 4 event event */ +#define TIM_DMA_COM TIM_DIER_COMDE /*!< DMA request is triggered by the commutation event */ +#define TIM_DMA_TRIGGER TIM_DIER_TDE /*!< DMA request is triggered by the trigger event */ +/** + * @} + */ + +/** @defgroup TIM_Flag_definition TIM Flag Definition + * @{ + */ +#define TIM_FLAG_UPDATE TIM_SR_UIF /*!< Update interrupt flag */ +#define TIM_FLAG_CC1 TIM_SR_CC1IF /*!< Capture/Compare 1 interrupt flag */ +#define TIM_FLAG_CC2 TIM_SR_CC2IF /*!< Capture/Compare 2 interrupt flag */ +#define TIM_FLAG_CC3 TIM_SR_CC3IF /*!< Capture/Compare 3 interrupt flag */ +#define TIM_FLAG_CC4 TIM_SR_CC4IF /*!< Capture/Compare 4 interrupt flag */ +#define TIM_FLAG_COM TIM_SR_COMIF /*!< Commutation interrupt flag */ +#define TIM_FLAG_TRIGGER TIM_SR_TIF /*!< Trigger interrupt flag */ +#define TIM_FLAG_BREAK TIM_SR_BIF /*!< Break interrupt flag */ +#define TIM_FLAG_CC1OF TIM_SR_CC1OF /*!< Capture 1 overcapture flag */ +#define TIM_FLAG_CC2OF TIM_SR_CC2OF /*!< Capture 2 overcapture flag */ +#define TIM_FLAG_CC3OF TIM_SR_CC3OF /*!< Capture 3 overcapture flag */ +#define TIM_FLAG_CC4OF TIM_SR_CC4OF /*!< Capture 4 overcapture flag */ +/** + * @} + */ + +/** @defgroup TIM_Channel TIM Channel + * @{ + */ +#define TIM_CHANNEL_1 0x00000000U /*!< Capture/compare channel 1 identifier */ +#define TIM_CHANNEL_2 0x00000004U /*!< Capture/compare channel 2 identifier */ +#define TIM_CHANNEL_3 0x00000008U /*!< Capture/compare channel 3 identifier */ +#define TIM_CHANNEL_4 0x0000000CU /*!< Capture/compare channel 4 identifier */ +#define TIM_CHANNEL_ALL 0x0000003CU /*!< Global Capture/compare channel identifier */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Source TIM Clock Source + * @{ + */ +#define TIM_CLOCKSOURCE_ETRMODE2 TIM_SMCR_ETPS_1 /*!< External clock source mode 2 */ +#define TIM_CLOCKSOURCE_INTERNAL TIM_SMCR_ETPS_0 /*!< Internal clock source */ +#define TIM_CLOCKSOURCE_ITR0 TIM_TS_ITR0 /*!< External clock source mode 1 (ITR0) */ +#define TIM_CLOCKSOURCE_ITR1 TIM_TS_ITR1 /*!< External clock source mode 1 (ITR1) */ +#define TIM_CLOCKSOURCE_ITR2 TIM_TS_ITR2 /*!< External clock source mode 1 (ITR2) */ +#define TIM_CLOCKSOURCE_ITR3 TIM_TS_ITR3 /*!< External clock source mode 1 (ITR3) */ +#define TIM_CLOCKSOURCE_TI1ED TIM_TS_TI1F_ED /*!< External clock source mode 1 (TTI1FP1 + edge detect.) */ +#define TIM_CLOCKSOURCE_TI1 TIM_TS_TI1FP1 /*!< External clock source mode 1 (TTI1FP1) */ +#define TIM_CLOCKSOURCE_TI2 TIM_TS_TI2FP2 /*!< External clock source mode 1 (TTI2FP2) */ +#define TIM_CLOCKSOURCE_ETRMODE1 TIM_TS_ETRF /*!< External clock source mode 1 (ETRF) */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Polarity TIM Clock Polarity + * @{ + */ +#define TIM_CLOCKPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx clock sources */ +#define TIM_CLOCKPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx clock sources */ +#define TIM_CLOCKPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIx clock sources */ +#define TIM_CLOCKPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIx clock sources */ +#define TIM_CLOCKPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIx clock sources */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Prescaler TIM Clock Prescaler + * @{ + */ +#define TIM_CLOCKPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_CLOCKPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Clock: Capture performed once every 2 events. */ +#define TIM_CLOCKPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Clock: Capture performed once every 4 events. */ +#define TIM_CLOCKPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Clock: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_ClearInput_Polarity TIM Clear Input Polarity + * @{ + */ +#define TIM_CLEARINPUTPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx pin */ +#define TIM_CLEARINPUTPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx pin */ +/** + * @} + */ + +/** @defgroup TIM_ClearInput_Prescaler TIM Clear Input Prescaler + * @{ + */ +#define TIM_CLEARINPUTPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_CLEARINPUTPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR pin: Capture performed once every 2 events. */ +#define TIM_CLEARINPUTPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR pin: Capture performed once every 4 events. */ +#define TIM_CLEARINPUTPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR pin: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_OSSR_Off_State_Selection_for_Run_mode_state TIM OSSR OffState Selection for Run mode state + * @{ + */ +#define TIM_OSSR_ENABLE TIM_BDTR_OSSR /*!< When inactive, OC/OCN outputs are enabled (still controlled by the timer) */ +#define TIM_OSSR_DISABLE 0x00000000U /*!< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer) */ +/** + * @} + */ + +/** @defgroup TIM_OSSI_Off_State_Selection_for_Idle_mode_state TIM OSSI OffState Selection for Idle mode state + * @{ + */ +#define TIM_OSSI_ENABLE TIM_BDTR_OSSI /*!< When inactive, OC/OCN outputs are enabled (still controlled by the timer) */ +#define TIM_OSSI_DISABLE 0x00000000U /*!< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer) */ +/** + * @} + */ +/** @defgroup TIM_Lock_level TIM Lock level + * @{ + */ +#define TIM_LOCKLEVEL_OFF 0x00000000U /*!< LOCK OFF */ +#define TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0 /*!< LOCK Level 1 */ +#define TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1 /*!< LOCK Level 2 */ +#define TIM_LOCKLEVEL_3 TIM_BDTR_LOCK /*!< LOCK Level 3 */ +/** + * @} + */ + +/** @defgroup TIM_Break_Input_enable_disable TIM Break Input Enable + * @{ + */ +#define TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break input BRK is enabled */ +#define TIM_BREAK_DISABLE 0x00000000U /*!< Break input BRK is disabled */ +/** + * @} + */ + +/** @defgroup TIM_Break_Polarity TIM Break Input Polarity + * @{ + */ +#define TIM_BREAKPOLARITY_LOW 0x00000000U /*!< Break input BRK is active low */ +#define TIM_BREAKPOLARITY_HIGH TIM_BDTR_BKP /*!< Break input BRK is active high */ +/** + * @} + */ + +/** @defgroup TIM_AOE_Bit_Set_Reset TIM Automatic Output Enable + * @{ + */ +#define TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */ +#define TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event + (if none of the break inputs BRK and BRK2 is active) */ +/** + * @} + */ + +/** @defgroup TIM_Master_Mode_Selection TIM Master Mode Selection + * @{ + */ +#define TIM_TRGO_RESET 0x00000000U /*!< TIMx_EGR.UG bit is used as trigger output (TRGO) */ +#define TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< TIMx_CR1.CEN bit is used as trigger output (TRGO) */ +#define TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output (TRGO) */ +#define TIM_TRGO_OC1 (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< Capture or a compare match 1 is used as trigger output (TRGO) */ +#define TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output (TRGO) */ +#define TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output(TRGO) */ +#define TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output(TRGO) */ +#define TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output(TRGO) */ +/** + * @} + */ + +/** @defgroup TIM_Master_Slave_Mode TIM Master/Slave Mode + * @{ + */ +#define TIM_MASTERSLAVEMODE_ENABLE TIM_SMCR_MSM /*!< No action */ +#define TIM_MASTERSLAVEMODE_DISABLE 0x00000000U /*!< Master/slave mode is selected */ +/** + * @} + */ + +/** @defgroup TIM_Slave_Mode TIM Slave mode + * @{ + */ +#define TIM_SLAVEMODE_DISABLE 0x00000000U /*!< Slave mode disabled */ +#define TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode */ +#define TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Gated Mode */ +#define TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Trigger Mode */ +#define TIM_SLAVEMODE_EXTERNAL1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< External Clock Mode 1 */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_and_PWM_modes TIM Output Compare and PWM Modes + * @{ + */ +#define TIM_OCMODE_TIMING 0x00000000U /*!< Frozen */ +#define TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!< Set channel to active level on match */ +#define TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!< Set channel to inactive level on match */ +#define TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< Toggle */ +#define TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!< PWM mode 1 */ +#define TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< PWM mode 2 */ +#define TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!< Force active level */ +#define TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!< Force inactive level */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Selection TIM Trigger Selection + * @{ + */ +#define TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) */ +#define TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) */ +#define TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) */ +#define TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) */ +#define TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) */ +#define TIM_TS_TI1FP1 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2) /*!< Filtered Timer Input 1 (TI1FP1) */ +#define TIM_TS_TI2FP2 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2) /*!< Filtered Timer Input 2 (TI2FP2) */ +#define TIM_TS_ETRF (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2) /*!< Filtered External Trigger input (ETRF) */ +#define TIM_TS_NONE 0x0000FFFFU /*!< No trigger selected */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Polarity TIM Trigger Polarity + * @{ + */ +#define TIM_TRIGGERPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx trigger sources */ +#define TIM_TRIGGERPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx trigger sources */ +#define TIM_TRIGGERPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +#define TIM_TRIGGERPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +#define TIM_TRIGGERPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Prescaler TIM Trigger Prescaler + * @{ + */ +#define TIM_TRIGGERPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_TRIGGERPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Trigger: Capture performed once every 2 events. */ +#define TIM_TRIGGERPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Trigger: Capture performed once every 4 events. */ +#define TIM_TRIGGERPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Trigger: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_TI1_Selection TIM TI1 Input Selection + * @{ + */ +#define TIM_TI1SELECTION_CH1 0x00000000U /*!< The TIMx_CH1 pin is connected to TI1 input */ +#define TIM_TI1SELECTION_XORCOMBINATION TIM_CR2_TI1S /*!< The TIMx_CH1, CH2 and CH3 pins are connected to the TI1 input (XOR combination) */ +/** + * @} + */ + +/** @defgroup TIM_DMA_Burst_Length TIM DMA Burst Length + * @{ + */ +#define TIM_DMABURSTLENGTH_1TRANSFER 0x00000000U /*!< The transfer is done to 1 register starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_2TRANSFERS 0x00000100U /*!< The transfer is done to 2 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_3TRANSFERS 0x00000200U /*!< The transfer is done to 3 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_4TRANSFERS 0x00000300U /*!< The transfer is done to 4 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_5TRANSFERS 0x00000400U /*!< The transfer is done to 5 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_6TRANSFERS 0x00000500U /*!< The transfer is done to 6 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_7TRANSFERS 0x00000600U /*!< The transfer is done to 7 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_8TRANSFERS 0x00000700U /*!< The transfer is done to 8 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_9TRANSFERS 0x00000800U /*!< The transfer is done to 9 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_10TRANSFERS 0x00000900U /*!< The transfer is done to 10 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_11TRANSFERS 0x00000A00U /*!< The transfer is done to 11 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_12TRANSFERS 0x00000B00U /*!< The transfer is done to 12 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_13TRANSFERS 0x00000C00U /*!< The transfer is done to 13 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_14TRANSFERS 0x00000D00U /*!< The transfer is done to 14 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_15TRANSFERS 0x00000E00U /*!< The transfer is done to 15 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_16TRANSFERS 0x00000F00U /*!< The transfer is done to 16 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_17TRANSFERS 0x00001000U /*!< The transfer is done to 17 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_18TRANSFERS 0x00001100U /*!< The transfer is done to 18 registers starting trom TIMx_CR1 + TIMx_DCR.DBA */ +/** + * @} + */ + +/** @defgroup DMA_Handle_index TIM DMA Handle Index + * @{ + */ +#define TIM_DMA_ID_UPDATE ((uint16_t) 0x0000) /*!< Index of the DMA handle used for Update DMA requests */ +#define TIM_DMA_ID_CC1 ((uint16_t) 0x0001) /*!< Index of the DMA handle used for Capture/Compare 1 DMA requests */ +#define TIM_DMA_ID_CC2 ((uint16_t) 0x0002) /*!< Index of the DMA handle used for Capture/Compare 2 DMA requests */ +#define TIM_DMA_ID_CC3 ((uint16_t) 0x0003) /*!< Index of the DMA handle used for Capture/Compare 3 DMA requests */ +#define TIM_DMA_ID_CC4 ((uint16_t) 0x0004) /*!< Index of the DMA handle used for Capture/Compare 4 DMA requests */ +#define TIM_DMA_ID_COMMUTATION ((uint16_t) 0x0005) /*!< Index of the DMA handle used for Commutation DMA requests */ +#define TIM_DMA_ID_TRIGGER ((uint16_t) 0x0006) /*!< Index of the DMA handle used for Trigger DMA requests */ +/** + * @} + */ + +/** @defgroup Channel_CC_State TIM Capture/Compare Channel State + * @{ + */ +#define TIM_CCx_ENABLE 0x00000001U /*!< Input or output channel is enabled */ +#define TIM_CCx_DISABLE 0x00000000U /*!< Input or output channel is disabled */ +#define TIM_CCxN_ENABLE 0x00000004U /*!< Complementary output channel is enabled */ +#define TIM_CCxN_DISABLE 0x00000000U /*!< Complementary output channel is enabled */ +/** + * @} + */ + +/** + * @} + */ +/* End of exported constants -------------------------------------------------*/ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup TIM_Exported_Macros TIM Exported Macros + * @{ + */ + +/** @brief Reset TIM handle state. + * @param __HANDLE__ TIM handle. + * @retval None + */ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \ + (__HANDLE__)->State = HAL_TIM_STATE_RESET; \ + (__HANDLE__)->Base_MspInitCallback = NULL; \ + (__HANDLE__)->Base_MspDeInitCallback = NULL; \ + (__HANDLE__)->IC_MspInitCallback = NULL; \ + (__HANDLE__)->IC_MspDeInitCallback = NULL; \ + (__HANDLE__)->OC_MspInitCallback = NULL; \ + (__HANDLE__)->OC_MspDeInitCallback = NULL; \ + (__HANDLE__)->PWM_MspInitCallback = NULL; \ + (__HANDLE__)->PWM_MspDeInitCallback = NULL; \ + (__HANDLE__)->OnePulse_MspInitCallback = NULL; \ + (__HANDLE__)->OnePulse_MspDeInitCallback = NULL; \ + (__HANDLE__)->Encoder_MspInitCallback = NULL; \ + (__HANDLE__)->Encoder_MspDeInitCallback = NULL; \ + (__HANDLE__)->HallSensor_MspInitCallback = NULL; \ + (__HANDLE__)->HallSensor_MspDeInitCallback = NULL; \ + } while(0) +#else +#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_TIM_STATE_RESET) +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @brief Enable the TIM peripheral. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN)) + +/** + * @brief Enable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_MOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE)) + +/** + * @brief Disable the TIM peripheral. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_DISABLE(__HANDLE__) \ + do { \ + if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \ + { \ + if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \ + { \ + (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \ + } \ + } \ + } while(0) + +/** + * @brief Disable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + * @note The Main Output Enable of a timer instance is disabled only if all the CCx and CCxN channels have been disabled + */ +#define __HAL_TIM_MOE_DISABLE(__HANDLE__) \ + do { \ + if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \ + { \ + if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \ + { \ + (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \ + } \ + } \ + } while(0) + +/** + * @brief Disable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + * @note The Main Output Enable of a timer instance is disabled unconditionally + */ +#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__) (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE) + +/** @brief Enable the specified TIM interrupt. + * @param __HANDLE__ specifies the TIM Handle. + * @param __INTERRUPT__ specifies the TIM interrupt source to enable. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__)) + +/** @brief Disable the specified TIM interrupt. + * @param __HANDLE__ specifies the TIM Handle. + * @param __INTERRUPT__ specifies the TIM interrupt source to disable. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__)) + +/** @brief Enable the specified DMA request. + * @param __HANDLE__ specifies the TIM Handle. + * @param __DMA__ specifies the TIM DMA request to enable. + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: Update DMA request + * @arg TIM_DMA_CC1: Capture/Compare 1 DMA request + * @arg TIM_DMA_CC2: Capture/Compare 2 DMA request + * @arg TIM_DMA_CC3: Capture/Compare 3 DMA request + * @arg TIM_DMA_CC4: Capture/Compare 4 DMA request + * @arg TIM_DMA_COM: Commutation DMA request + * @arg TIM_DMA_TRIGGER: Trigger DMA request + * @retval None + */ +#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER |= (__DMA__)) + +/** @brief Disable the specified DMA request. + * @param __HANDLE__ specifies the TIM Handle. + * @param __DMA__ specifies the TIM DMA request to disable. + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: Update DMA request + * @arg TIM_DMA_CC1: Capture/Compare 1 DMA request + * @arg TIM_DMA_CC2: Capture/Compare 2 DMA request + * @arg TIM_DMA_CC3: Capture/Compare 3 DMA request + * @arg TIM_DMA_CC4: Capture/Compare 4 DMA request + * @arg TIM_DMA_COM: Commutation DMA request + * @arg TIM_DMA_TRIGGER: Trigger DMA request + * @retval None + */ +#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER &= ~(__DMA__)) + +/** @brief Check whether the specified TIM interrupt flag is set or not. + * @param __HANDLE__ specifies the TIM Handle. + * @param __FLAG__ specifies the TIM interrupt flag to check. + * This parameter can be one of the following values: + * @arg TIM_FLAG_UPDATE: Update interrupt flag + * @arg TIM_FLAG_CC1: Capture/Compare 1 interrupt flag + * @arg TIM_FLAG_CC2: Capture/Compare 2 interrupt flag + * @arg TIM_FLAG_CC3: Capture/Compare 3 interrupt flag + * @arg TIM_FLAG_CC4: Capture/Compare 4 interrupt flag + * @arg TIM_FLAG_COM: Commutation interrupt flag + * @arg TIM_FLAG_TRIGGER: Trigger interrupt flag + * @arg TIM_FLAG_BREAK: Break interrupt flag + * @arg TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag + * @arg TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag + * @arg TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag + * @arg TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified TIM interrupt flag. + * @param __HANDLE__ specifies the TIM Handle. + * @param __FLAG__ specifies the TIM interrupt flag to clear. + * This parameter can be one of the following values: + * @arg TIM_FLAG_UPDATE: Update interrupt flag + * @arg TIM_FLAG_CC1: Capture/Compare 1 interrupt flag + * @arg TIM_FLAG_CC2: Capture/Compare 2 interrupt flag + * @arg TIM_FLAG_CC3: Capture/Compare 3 interrupt flag + * @arg TIM_FLAG_CC4: Capture/Compare 4 interrupt flag + * @arg TIM_FLAG_COM: Commutation interrupt flag + * @arg TIM_FLAG_TRIGGER: Trigger interrupt flag + * @arg TIM_FLAG_BREAK: Break interrupt flag + * @arg TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag + * @arg TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag + * @arg TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag + * @arg TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) + +/** + * @brief Check whether the specified TIM interrupt source is enabled or not. + * @param __HANDLE__ TIM handle + * @param __INTERRUPT__ specifies the TIM interrupt source to check. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval The state of TIM_IT (SET or RESET). + */ +#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) \ + == (__INTERRUPT__)) ? SET : RESET) + +/** @brief Clear the TIM interrupt pending bits. + * @param __HANDLE__ TIM handle + * @param __INTERRUPT__ specifies the interrupt pending bit to clear. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__)) + +/** + * @brief Indicates whether or not the TIM Counter is used as downcounter. + * @param __HANDLE__ TIM handle. + * @retval False (Counter used as upcounter) or True (Counter used as downcounter) + * @note This macro is particularly useful to get the counting mode when the timer operates in Center-aligned mode or Encoder +mode. + */ +#define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__) (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR)) + +/** + * @brief Set the TIM Prescaler on runtime. + * @param __HANDLE__ TIM handle. + * @param __PRESC__ specifies the Prescaler new value. + * @retval None + */ +#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__)) + +/** + * @brief Set the TIM Counter Register value on runtime. + * @param __HANDLE__ TIM handle. + * @param __COUNTER__ specifies the Counter register new value. + * @retval None + */ +#define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__)) + +/** + * @brief Get the TIM Counter Register value on runtime. + * @param __HANDLE__ TIM handle. + * @retval 16-bit or 32-bit value of the timer counter register (TIMx_CNT) + */ +#define __HAL_TIM_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNT) + +/** + * @brief Set the TIM Autoreload Register value on runtime without calling another time any Init function. + * @param __HANDLE__ TIM handle. + * @param __AUTORELOAD__ specifies the Counter register new value. + * @retval None + */ +#define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__) \ + do{ \ + (__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \ + (__HANDLE__)->Init.Period = (__AUTORELOAD__); \ + } while(0) + +/** + * @brief Get the TIM Autoreload Register value on runtime. + * @param __HANDLE__ TIM handle. + * @retval 16-bit or 32-bit value of the timer auto-reload register(TIMx_ARR) + */ +#define __HAL_TIM_GET_AUTORELOAD(__HANDLE__) ((__HANDLE__)->Instance->ARR) + +/** + * @brief Set the TIM Clock Division value on runtime without calling another time any Init function. + * @param __HANDLE__ TIM handle. + * @param __CKD__ specifies the clock division value. + * This parameter can be one of the following value: + * @arg TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT + * @arg TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT + * @arg TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT + * @retval None + */ +#define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__) \ + do{ \ + (__HANDLE__)->Instance->CR1 &= (~TIM_CR1_CKD); \ + (__HANDLE__)->Instance->CR1 |= (__CKD__); \ + (__HANDLE__)->Init.ClockDivision = (__CKD__); \ + } while(0) + +/** + * @brief Get the TIM Clock Division value on runtime. + * @param __HANDLE__ TIM handle. + * @retval The clock division can be one of the following values: + * @arg TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT + * @arg TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT + * @arg TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT + */ +#define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__) ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD) + +/** + * @brief Set the TIM Input Capture prescaler on runtime without calling another time HAL_TIM_IC_ConfigChannel() function. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __ICPSC__ specifies the Input Capture4 prescaler new value. + * This parameter can be one of the following values: + * @arg TIM_ICPSC_DIV1: no prescaler + * @arg TIM_ICPSC_DIV2: capture is done once every 2 events + * @arg TIM_ICPSC_DIV4: capture is done once every 4 events + * @arg TIM_ICPSC_DIV8: capture is done once every 8 events + * @retval None + */ +#define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__) \ + do{ \ + TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \ + TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \ + } while(0) + +/** + * @brief Get the TIM Input Capture prescaler on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: get input capture 1 prescaler value + * @arg TIM_CHANNEL_2: get input capture 2 prescaler value + * @arg TIM_CHANNEL_3: get input capture 3 prescaler value + * @arg TIM_CHANNEL_4: get input capture 4 prescaler value + * @retval The input capture prescaler can be one of the following values: + * @arg TIM_ICPSC_DIV1: no prescaler + * @arg TIM_ICPSC_DIV2: capture is done once every 2 events + * @arg TIM_ICPSC_DIV4: capture is done once every 4 events + * @arg TIM_ICPSC_DIV8: capture is done once every 8 events + */ +#define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8U) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\ + (((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8U) + +/** + * @brief Set the TIM Capture Compare Register value on runtime without calling another time ConfigChannel function. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __COMPARE__ specifies the Capture Compare register new value. + * @retval None + */ +#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\ + ((__HANDLE__)->Instance->CCR4 = (__COMPARE__))) + +/** + * @brief Get the TIM Capture Compare Register value on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channel associated with the capture compare register + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: get capture/compare 1 register value + * @arg TIM_CHANNEL_2: get capture/compare 2 register value + * @arg TIM_CHANNEL_3: get capture/compare 3 register value + * @arg TIM_CHANNEL_4: get capture/compare 4 register value + * @retval 16-bit or 32-bit value of the capture/compare register (TIMx_CCRy) + */ +#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3) :\ + ((__HANDLE__)->Instance->CCR4)) + +/** + * @brief Set the TIM Output compare preload. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval None + */ +#define __HAL_TIM_ENABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3PE) :\ + ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4PE)) + +/** + * @brief Reset the TIM Output compare preload. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval None + */ +#define __HAL_TIM_DISABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3PE) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4PE)) + +/** + * @brief Enable fast mode for a given channel. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @note When fast mode is enabled an active edge on the trigger input acts + * like a compare match on CCx output. Delay to sample the trigger + * input and to activate CCx output is reduced to 3 clock cycles. + * @note Fast mode acts only if the channel is configured in PWM1 or PWM2 mode. + * @retval None + */ +#define __HAL_TIM_ENABLE_OCxFAST(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3FE) :\ + ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4FE)) + +/** + * @brief Disable fast mode for a given channel. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @note When fast mode is disabled CCx output behaves normally depending + * on counter and CCRx values even when the trigger is ON. The minimum + * delay to activate CCx output when an active edge occurs on the + * trigger input is 5 clock cycles. + * @retval None + */ +#define __HAL_TIM_DISABLE_OCxFAST(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE)) + +/** + * @brief Set the Update Request Source (URS) bit of the TIMx_CR1 register. + * @param __HANDLE__ TIM handle. + * @note When the URS bit of the TIMx_CR1 register is set, only counter + * overflow/underflow generates an update interrupt or DMA request (if + * enabled) + * @retval None + */ +#define __HAL_TIM_URS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS) + +/** + * @brief Reset the Update Request Source (URS) bit of the TIMx_CR1 register. + * @param __HANDLE__ TIM handle. + * @note When the URS bit of the TIMx_CR1 register is reset, any of the + * following events generate an update interrupt or DMA request (if + * enabled): + * _ Counter overflow underflow + * _ Setting the UG bit + * _ Update generation through the slave mode controller + * @retval None + */ +#define __HAL_TIM_URS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS) + +/** + * @brief Set the TIM Capture x input polarity on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __POLARITY__ Polarity for TIx source + * @arg TIM_INPUTCHANNELPOLARITY_RISING: Rising Edge + * @arg TIM_INPUTCHANNELPOLARITY_FALLING: Falling Edge + * @arg TIM_INPUTCHANNELPOLARITY_BOTHEDGE: Rising and Falling Edge + * @retval None + */ +#define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \ + do{ \ + TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \ + TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \ + }while(0) + +/** + * @} + */ +/* End of exported macros ----------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup TIM_Private_Constants TIM Private Constants + * @{ + */ +/* The counter of a timer instance is disabled only if all the CCx and CCxN + channels have been disabled */ +#define TIM_CCER_CCxE_MASK ((uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E)) +#define TIM_CCER_CCxNE_MASK ((uint32_t)(TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) +/** + * @} + */ +/* End of private constants --------------------------------------------------*/ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup TIM_Private_Macros TIM Private Macros + * @{ + */ +#define IS_TIM_CLEARINPUT_SOURCE(__MODE__) (((__MODE__) == TIM_CLEARINPUTSOURCE_NONE) || \ + ((__MODE__) == TIM_CLEARINPUTSOURCE_ETR)) + +#define IS_TIM_DMA_BASE(__BASE__) (((__BASE__) == TIM_DMABASE_CR1) || \ + ((__BASE__) == TIM_DMABASE_CR2) || \ + ((__BASE__) == TIM_DMABASE_SMCR) || \ + ((__BASE__) == TIM_DMABASE_DIER) || \ + ((__BASE__) == TIM_DMABASE_SR) || \ + ((__BASE__) == TIM_DMABASE_EGR) || \ + ((__BASE__) == TIM_DMABASE_CCMR1) || \ + ((__BASE__) == TIM_DMABASE_CCMR2) || \ + ((__BASE__) == TIM_DMABASE_CCER) || \ + ((__BASE__) == TIM_DMABASE_CNT) || \ + ((__BASE__) == TIM_DMABASE_PSC) || \ + ((__BASE__) == TIM_DMABASE_ARR) || \ + ((__BASE__) == TIM_DMABASE_RCR) || \ + ((__BASE__) == TIM_DMABASE_CCR1) || \ + ((__BASE__) == TIM_DMABASE_CCR2) || \ + ((__BASE__) == TIM_DMABASE_CCR3) || \ + ((__BASE__) == TIM_DMABASE_CCR4) || \ + ((__BASE__) == TIM_DMABASE_BDTR)) + +#define IS_TIM_EVENT_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFFFF00U) == 0x00000000U) && ((__SOURCE__) != 0x00000000U)) + +#define IS_TIM_COUNTER_MODE(__MODE__) (((__MODE__) == TIM_COUNTERMODE_UP) || \ + ((__MODE__) == TIM_COUNTERMODE_DOWN) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED1) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED2) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED3)) + +#define IS_TIM_CLOCKDIVISION_DIV(__DIV__) (((__DIV__) == TIM_CLOCKDIVISION_DIV1) || \ + ((__DIV__) == TIM_CLOCKDIVISION_DIV2) || \ + ((__DIV__) == TIM_CLOCKDIVISION_DIV4)) + +#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD) (((PRELOAD) == TIM_AUTORELOAD_PRELOAD_DISABLE) || \ + ((PRELOAD) == TIM_AUTORELOAD_PRELOAD_ENABLE)) + +#define IS_TIM_FAST_STATE(__STATE__) (((__STATE__) == TIM_OCFAST_DISABLE) || \ + ((__STATE__) == TIM_OCFAST_ENABLE)) + +#define IS_TIM_OC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCPOLARITY_HIGH) || \ + ((__POLARITY__) == TIM_OCPOLARITY_LOW)) + +#define IS_TIM_OCN_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCNPOLARITY_HIGH) || \ + ((__POLARITY__) == TIM_OCNPOLARITY_LOW)) + +#define IS_TIM_OCIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCIDLESTATE_SET) || \ + ((__STATE__) == TIM_OCIDLESTATE_RESET)) + +#define IS_TIM_OCNIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCNIDLESTATE_SET) || \ + ((__STATE__) == TIM_OCNIDLESTATE_RESET)) + +#define IS_TIM_ENCODERINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_FALLING)) + +#define IS_TIM_IC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ICPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_ICPOLARITY_FALLING) || \ + ((__POLARITY__) == TIM_ICPOLARITY_BOTHEDGE)) + +#define IS_TIM_IC_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_ICSELECTION_DIRECTTI) || \ + ((__SELECTION__) == TIM_ICSELECTION_INDIRECTTI) || \ + ((__SELECTION__) == TIM_ICSELECTION_TRC)) + +#define IS_TIM_IC_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ICPSC_DIV1) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV2) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV4) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV8)) + +#define IS_TIM_OPM_MODE(__MODE__) (((__MODE__) == TIM_OPMODE_SINGLE) || \ + ((__MODE__) == TIM_OPMODE_REPETITIVE)) + +#define IS_TIM_ENCODER_MODE(__MODE__) (((__MODE__) == TIM_ENCODERMODE_TI1) || \ + ((__MODE__) == TIM_ENCODERMODE_TI2) || \ + ((__MODE__) == TIM_ENCODERMODE_TI12)) + +#define IS_TIM_DMA_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFF80FFU) == 0x00000000U) && ((__SOURCE__) != 0x00000000U)) + +#define IS_TIM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2) || \ + ((__CHANNEL__) == TIM_CHANNEL_3) || \ + ((__CHANNEL__) == TIM_CHANNEL_4) || \ + ((__CHANNEL__) == TIM_CHANNEL_ALL)) + +#define IS_TIM_OPM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2)) + +#define IS_TIM_COMPLEMENTARY_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2) || \ + ((__CHANNEL__) == TIM_CHANNEL_3)) + +#define IS_TIM_CLOCKSOURCE(__CLOCK__) (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR3) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1)) + +#define IS_TIM_CLOCKPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLOCKPOLARITY_INVERTED) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_NONINVERTED) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_FALLING) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_BOTHEDGE)) + +#define IS_TIM_CLOCKPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV8)) + +#define IS_TIM_CLOCKFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLEARINPUTPOLARITY_INVERTED) || \ + ((__POLARITY__) == TIM_CLEARINPUTPOLARITY_NONINVERTED)) + +#define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV8)) + +#define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_OSSR_STATE(__STATE__) (((__STATE__) == TIM_OSSR_ENABLE) || \ + ((__STATE__) == TIM_OSSR_DISABLE)) + +#define IS_TIM_OSSI_STATE(__STATE__) (((__STATE__) == TIM_OSSI_ENABLE) || \ + ((__STATE__) == TIM_OSSI_DISABLE)) + +#define IS_TIM_LOCK_LEVEL(__LEVEL__) (((__LEVEL__) == TIM_LOCKLEVEL_OFF) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_1) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_2) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_3)) + +#define IS_TIM_BREAK_FILTER(__BRKFILTER__) ((__BRKFILTER__) <= 0xFUL) + + +#define IS_TIM_BREAK_STATE(__STATE__) (((__STATE__) == TIM_BREAK_ENABLE) || \ + ((__STATE__) == TIM_BREAK_DISABLE)) + +#define IS_TIM_BREAK_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKPOLARITY_LOW) || \ + ((__POLARITY__) == TIM_BREAKPOLARITY_HIGH)) + +#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__) (((__STATE__) == TIM_AUTOMATICOUTPUT_ENABLE) || \ + ((__STATE__) == TIM_AUTOMATICOUTPUT_DISABLE)) + +#define IS_TIM_TRGO_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO_RESET) || \ + ((__SOURCE__) == TIM_TRGO_ENABLE) || \ + ((__SOURCE__) == TIM_TRGO_UPDATE) || \ + ((__SOURCE__) == TIM_TRGO_OC1) || \ + ((__SOURCE__) == TIM_TRGO_OC1REF) || \ + ((__SOURCE__) == TIM_TRGO_OC2REF) || \ + ((__SOURCE__) == TIM_TRGO_OC3REF) || \ + ((__SOURCE__) == TIM_TRGO_OC4REF)) + +#define IS_TIM_MSM_STATE(__STATE__) (((__STATE__) == TIM_MASTERSLAVEMODE_ENABLE) || \ + ((__STATE__) == TIM_MASTERSLAVEMODE_DISABLE)) + +#define IS_TIM_SLAVE_MODE(__MODE__) (((__MODE__) == TIM_SLAVEMODE_DISABLE) || \ + ((__MODE__) == TIM_SLAVEMODE_RESET) || \ + ((__MODE__) == TIM_SLAVEMODE_GATED) || \ + ((__MODE__) == TIM_SLAVEMODE_TRIGGER) || \ + ((__MODE__) == TIM_SLAVEMODE_EXTERNAL1)) + +#define IS_TIM_PWM_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_PWM1) || \ + ((__MODE__) == TIM_OCMODE_PWM2)) + +#define IS_TIM_OC_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_TIMING) || \ + ((__MODE__) == TIM_OCMODE_ACTIVE) || \ + ((__MODE__) == TIM_OCMODE_INACTIVE) || \ + ((__MODE__) == TIM_OCMODE_TOGGLE) || \ + ((__MODE__) == TIM_OCMODE_FORCED_ACTIVE) || \ + ((__MODE__) == TIM_OCMODE_FORCED_INACTIVE)) + +#define IS_TIM_TRIGGER_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \ + ((__SELECTION__) == TIM_TS_ITR1) || \ + ((__SELECTION__) == TIM_TS_ITR2) || \ + ((__SELECTION__) == TIM_TS_ITR3) || \ + ((__SELECTION__) == TIM_TS_TI1F_ED) || \ + ((__SELECTION__) == TIM_TS_TI1FP1) || \ + ((__SELECTION__) == TIM_TS_TI2FP2) || \ + ((__SELECTION__) == TIM_TS_ETRF)) + +#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \ + ((__SELECTION__) == TIM_TS_ITR1) || \ + ((__SELECTION__) == TIM_TS_ITR2) || \ + ((__SELECTION__) == TIM_TS_ITR3) || \ + ((__SELECTION__) == TIM_TS_NONE)) + +#define IS_TIM_TRIGGERPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_TRIGGERPOLARITY_INVERTED ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_NONINVERTED) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_RISING ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_FALLING ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_BOTHEDGE )) + +#define IS_TIM_TRIGGERPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV8)) + +#define IS_TIM_TRIGGERFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_TI1SELECTION(__TI1SELECTION__) (((__TI1SELECTION__) == TIM_TI1SELECTION_CH1) || \ + ((__TI1SELECTION__) == TIM_TI1SELECTION_XORCOMBINATION)) + +#define IS_TIM_DMA_LENGTH(__LENGTH__) (((__LENGTH__) == TIM_DMABURSTLENGTH_1TRANSFER) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_2TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_3TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_4TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_5TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_6TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_7TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_8TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_9TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_10TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_11TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_12TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_13TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_14TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_15TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_16TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_17TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_18TRANSFERS)) + +#define IS_TIM_IC_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_DEADTIME(__DEADTIME__) ((__DEADTIME__) <= 0xFFU) + +#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__) ((__TRIGGER__) == TIM_SLAVEMODE_TRIGGER) + +#define TIM_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= (__ICPSC__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= ((__ICPSC__) << 8U)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= (__ICPSC__)) :\ + ((__HANDLE__)->Instance->CCMR2 |= ((__ICPSC__) << 8U))) + +#define TIM_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC)) + +#define TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER |= (__POLARITY__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 4U)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 8U)) :\ + ((__HANDLE__)->Instance->CCER |= (((__POLARITY__) << 12U)))) + +#define TIM_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP)) :\ + ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP))) + +/** + * @} + */ +/* End of private macros -----------------------------------------------------*/ + +/* Include TIM HAL Extended module */ +#include "stm32f4xx_hal_tim_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIM_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @addtogroup TIM_Exported_Functions_Group1 TIM Time Base functions + * @brief Time Base functions + * @{ + */ +/* Time Base functions ********************************************************/ +HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group2 TIM Output Compare functions + * @brief TIM Output Compare functions + * @{ + */ +/* Timer Output Compare functions *********************************************/ +HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group3 TIM PWM functions + * @brief TIM PWM functions + * @{ + */ +/* Timer PWM functions ********************************************************/ +HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group4 TIM Input Capture functions + * @brief TIM Input Capture functions + * @{ + */ +/* Timer Input Capture functions **********************************************/ +HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group5 TIM One Pulse functions + * @brief TIM One Pulse functions + * @{ + */ +/* Timer One Pulse functions **************************************************/ +HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode); +HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group6 TIM Encoder functions + * @brief TIM Encoder functions + * @{ + */ +/* Timer Encoder functions ****************************************************/ +HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig); +HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, + uint32_t *pData2, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group7 TIM IRQ handler management + * @brief IRQ handler management + * @{ + */ +/* Interrupt Handler functions ***********************************************/ +void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group8 TIM Peripheral Control functions + * @brief Peripheral Control functions + * @{ + */ +/* Control functions *********************************************************/ +HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, + uint32_t OutputChannel, uint32_t InputChannel); +HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef *sClearInputConfig, + uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig); +HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection); +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig); +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig); +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc); +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc); +HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource); +uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group9 TIM Callbacks functions + * @brief TIM Callbacks functions + * @{ + */ +/* Callback in non blocking modes (Interrupt and DMA) *************************/ +void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim); + +/* Callbacks Register/UnRegister functions ***********************************/ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, + pTIM_CallbackTypeDef pCallback); +HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group10 TIM Peripheral State functions + * @brief Peripheral State functions + * @{ + */ +/* Peripheral State functions ************************************************/ +HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** + * @} + */ +/* End of exported functions -------------------------------------------------*/ + +/* Private functions----------------------------------------------------------*/ +/** @defgroup TIM_Private_Functions TIM Private Functions + * @{ + */ +void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure); +void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter); +void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, + uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter); + +void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma); +void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma); +void TIM_DMAError(DMA_HandleTypeDef *hdma); +void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma); +void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma); +void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +void TIM_ResetCallback(TIM_HandleTypeDef *htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ +/* End of private functions --------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F4xx_HAL_TIM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h new file mode 100644 index 0000000..88ce281 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h @@ -0,0 +1,356 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_tim_ex.h + * @author MCD Application Team + * @brief Header file of TIM HAL Extended module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F4xx_HAL_TIM_EX_H +#define STM32F4xx_HAL_TIM_EX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup TIMEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Types TIM Extended Exported Types + * @{ + */ + +/** + * @brief TIM Hall sensor Configuration Structure definition + */ + +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 */ + + 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 */ +} TIM_HallSensor_InitTypeDef; +/** + * @} + */ +/* End of exported types -----------------------------------------------------*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants + * @{ + */ + +/** @defgroup TIMEx_Remap TIM Extended Remapping + * @{ + */ +#if defined (TIM2) +#if defined(TIM8) +#define TIM_TIM2_TIM8_TRGO 0x00000000U /*!< TIM2 ITR1 is connected to TIM8 TRGO */ +#else +#define TIM_TIM2_ETH_PTP TIM_OR_ITR1_RMP_0 /*!< TIM2 ITR1 is connected to PTP trigger output */ +#endif /* TIM8 */ +#define TIM_TIM2_USBFS_SOF TIM_OR_ITR1_RMP_1 /*!< TIM2 ITR1 is connected to OTG FS SOF */ +#define TIM_TIM2_USBHS_SOF (TIM_OR_ITR1_RMP_1 | TIM_OR_ITR1_RMP_0) /*!< TIM2 ITR1 is connected to OTG HS SOF */ +#endif /* TIM2 */ + +#define TIM_TIM5_GPIO 0x00000000U /*!< TIM5 TI4 is connected to GPIO */ +#define TIM_TIM5_LSI TIM_OR_TI4_RMP_0 /*!< TIM5 TI4 is connected to LSI */ +#define TIM_TIM5_LSE TIM_OR_TI4_RMP_1 /*!< TIM5 TI4 is connected to LSE */ +#define TIM_TIM5_RTC (TIM_OR_TI4_RMP_1 | TIM_OR_TI4_RMP_0) /*!< TIM5 TI4 is connected to the RTC wakeup interrupt */ + +#define TIM_TIM11_GPIO 0x00000000U /*!< TIM11 TI1 is connected to GPIO */ +#define TIM_TIM11_HSE TIM_OR_TI1_RMP_1 /*!< TIM11 TI1 is connected to HSE_RTC clock */ +#if defined(SPDIFRX) +#define TIM_TIM11_SPDIFRX TIM_OR_TI1_RMP_0 /*!< TIM11 TI1 is connected to SPDIFRX_FRAME_SYNC */ +#endif /* SPDIFRX*/ + +#if defined(LPTIM_OR_TIM1_ITR2_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) +#define LPTIM_REMAP_MASK 0x10000000U + +#define TIM_TIM9_TIM3_TRGO LPTIM_REMAP_MASK /*!< TIM9 ITR1 is connected to TIM3 TRGO */ +#define TIM_TIM9_LPTIM (LPTIM_REMAP_MASK | LPTIM_OR_TIM9_ITR1_RMP) /*!< TIM9 ITR1 is connected to LPTIM1 output */ + +#define TIM_TIM5_TIM3_TRGO LPTIM_REMAP_MASK /*!< TIM5 ITR1 is connected to TIM3 TRGO */ +#define TIM_TIM5_LPTIM (LPTIM_REMAP_MASK | LPTIM_OR_TIM5_ITR1_RMP) /*!< TIM5 ITR1 is connected to LPTIM1 output */ + +#define TIM_TIM1_TIM3_TRGO LPTIM_REMAP_MASK /*!< TIM1 ITR2 is connected to TIM3 TRGO */ +#define TIM_TIM1_LPTIM (LPTIM_REMAP_MASK | LPTIM_OR_TIM1_ITR2_RMP) /*!< TIM1 ITR2 is connected to LPTIM1 output */ +#endif /* LPTIM_OR_TIM1_ITR2_RMP && LPTIM_OR_TIM5_ITR1_RMP && LPTIM_OR_TIM5_ITR1_RMP */ +/** + * @} + */ + +/** + * @} + */ +/* End of exported constants -------------------------------------------------*/ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros + * @{ + */ + +/** + * @} + */ +/* End of exported macro -----------------------------------------------------*/ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup TIMEx_Private_Macros TIM Extended Private Macros + * @{ + */ +#if defined(SPDIFRX) +#define IS_TIM_REMAP(INSTANCE, TIM_REMAP) \ + ((((INSTANCE) == TIM2) && (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO) || \ + ((TIM_REMAP) == TIM_TIM2_USBFS_SOF) || \ + ((TIM_REMAP) == TIM_TIM2_USBHS_SOF))) || \ + (((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_GPIO) || \ + ((TIM_REMAP) == TIM_TIM5_LSI) || \ + ((TIM_REMAP) == TIM_TIM5_LSE) || \ + ((TIM_REMAP) == TIM_TIM5_RTC))) || \ + (((INSTANCE) == TIM11) && (((TIM_REMAP) == TIM_TIM11_GPIO) || \ + ((TIM_REMAP) == TIM_TIM11_SPDIFRX) || \ + ((TIM_REMAP) == TIM_TIM11_HSE)))) +#elif defined(TIM2) +#if defined(LPTIM_OR_TIM1_ITR2_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) +#define IS_TIM_REMAP(INSTANCE, TIM_REMAP) \ + ((((INSTANCE) == TIM2) && (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO) || \ + ((TIM_REMAP) == TIM_TIM2_USBFS_SOF) || \ + ((TIM_REMAP) == TIM_TIM2_USBHS_SOF))) || \ + (((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_GPIO) || \ + ((TIM_REMAP) == TIM_TIM5_LSI) || \ + ((TIM_REMAP) == TIM_TIM5_LSE) || \ + ((TIM_REMAP) == TIM_TIM5_RTC))) || \ + (((INSTANCE) == TIM11) && (((TIM_REMAP) == TIM_TIM11_GPIO) || \ + ((TIM_REMAP) == TIM_TIM11_HSE))) || \ + (((INSTANCE) == TIM1) && (((TIM_REMAP) == TIM_TIM1_TIM3_TRGO) || \ + ((TIM_REMAP) == TIM_TIM1_LPTIM))) || \ + (((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_TIM3_TRGO) || \ + ((TIM_REMAP) == TIM_TIM5_LPTIM))) || \ + (((INSTANCE) == TIM9) && (((TIM_REMAP) == TIM_TIM9_TIM3_TRGO) || \ + ((TIM_REMAP) == TIM_TIM9_LPTIM)))) +#elif defined(TIM8) +#define IS_TIM_REMAP(INSTANCE, TIM_REMAP) \ + ((((INSTANCE) == TIM2) && (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO) || \ + ((TIM_REMAP) == TIM_TIM2_USBFS_SOF) || \ + ((TIM_REMAP) == TIM_TIM2_USBHS_SOF))) || \ + (((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_GPIO) || \ + ((TIM_REMAP) == TIM_TIM5_LSI) || \ + ((TIM_REMAP) == TIM_TIM5_LSE) || \ + ((TIM_REMAP) == TIM_TIM5_RTC))) || \ + (((INSTANCE) == TIM11) && (((TIM_REMAP) == TIM_TIM11_GPIO) || \ + ((TIM_REMAP) == TIM_TIM11_HSE)))) +#else +#define IS_TIM_REMAP(INSTANCE, TIM_REMAP) \ + ((((INSTANCE) == TIM2) && (((TIM_REMAP) == TIM_TIM2_ETH_PTP) || \ + ((TIM_REMAP) == TIM_TIM2_USBFS_SOF) || \ + ((TIM_REMAP) == TIM_TIM2_USBHS_SOF))) || \ + (((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_GPIO) || \ + ((TIM_REMAP) == TIM_TIM5_LSI) || \ + ((TIM_REMAP) == TIM_TIM5_LSE) || \ + ((TIM_REMAP) == TIM_TIM5_RTC))) || \ + (((INSTANCE) == TIM11) && (((TIM_REMAP) == TIM_TIM11_GPIO) || \ + ((TIM_REMAP) == TIM_TIM11_HSE)))) +#endif /* LPTIM_OR_TIM1_ITR2_RMP && LPTIM_OR_TIM5_ITR1_RMP && LPTIM_OR_TIM5_ITR1_RMP */ +#else +#define IS_TIM_REMAP(INSTANCE, TIM_REMAP) \ + ((((INSTANCE) == TIM5) && (((TIM_REMAP) == TIM_TIM5_GPIO) || \ + ((TIM_REMAP) == TIM_TIM5_LSI) || \ + ((TIM_REMAP) == TIM_TIM5_LSE) || \ + ((TIM_REMAP) == TIM_TIM5_RTC))) || \ + (((INSTANCE) == TIM11) && (((TIM_REMAP) == TIM_TIM11_GPIO) || \ + ((TIM_REMAP) == TIM_TIM11_HSE)))) +#endif /* SPDIFRX */ + +/** + * @} + */ +/* End of private macro ------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions + * @{ + */ + +/** @addtogroup TIMEx_Exported_Functions_Group1 Extended 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_DeInit(TIM_HandleTypeDef *htim); + +void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); + +/* 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 */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); +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 + * @{ + */ +/* Timer Complementary Output Compare functions *****************************/ +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group3 Extended 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); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group4 Extended 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); +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions + * @brief Peripheral Control functions + * @{ + */ +/* Extended Control functions ************************************************/ +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); +HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions + * @brief Extended Callbacks functions + * @{ + */ +/* Extended Callback **********************************************************/ +void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); +void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions + * @brief Extended Peripheral State functions + * @{ + */ +/* Extended Peripheral State functions ***************************************/ +HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** + * @} + */ +/* End of exported functions -------------------------------------------------*/ + +/* 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 --------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif /* STM32F4xx_HAL_TIM_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h new file mode 100644 index 0000000..66da28f --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h @@ -0,0 +1,2108 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_bus.h + * @author MCD Application Team + * @brief Header file of BUS LL module. + + @verbatim + ##### RCC Limitations ##### + ============================================================================== + [..] + A delay between an RCC peripheral clock enable and the effective peripheral + enabling should be taken into account in order to manage the peripheral read/write + from/to registers. + (+) This delay depends on the peripheral mapping. + (++) AHB & APB peripherals, 1 dummy read is necessary + + [..] + Workarounds: + (#) For AHB & APB peripherals, a dummy read to the peripheral register has been + inserted in each LL_{BUS}_GRP{x}_EnableClock() function. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_BUS_H +#define __STM32F4xx_LL_BUS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @defgroup BUS_LL BUS + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup BUS_LL_Exported_Constants BUS Exported Constants + * @{ + */ + +/** @defgroup BUS_LL_EC_AHB1_GRP1_PERIPH AHB1 GRP1 PERIPH + * @{ + */ +#define LL_AHB1_GRP1_PERIPH_ALL 0xFFFFFFFFU +#define LL_AHB1_GRP1_PERIPH_GPIOA RCC_AHB1ENR_GPIOAEN +#define LL_AHB1_GRP1_PERIPH_GPIOB RCC_AHB1ENR_GPIOBEN +#define LL_AHB1_GRP1_PERIPH_GPIOC RCC_AHB1ENR_GPIOCEN +#if defined(GPIOD) +#define LL_AHB1_GRP1_PERIPH_GPIOD RCC_AHB1ENR_GPIODEN +#endif /* GPIOD */ +#if defined(GPIOE) +#define LL_AHB1_GRP1_PERIPH_GPIOE RCC_AHB1ENR_GPIOEEN +#endif /* GPIOE */ +#if defined(GPIOF) +#define LL_AHB1_GRP1_PERIPH_GPIOF RCC_AHB1ENR_GPIOFEN +#endif /* GPIOF */ +#if defined(GPIOG) +#define LL_AHB1_GRP1_PERIPH_GPIOG RCC_AHB1ENR_GPIOGEN +#endif /* GPIOG */ +#if defined(GPIOH) +#define LL_AHB1_GRP1_PERIPH_GPIOH RCC_AHB1ENR_GPIOHEN +#endif /* GPIOH */ +#if defined(GPIOI) +#define LL_AHB1_GRP1_PERIPH_GPIOI RCC_AHB1ENR_GPIOIEN +#endif /* GPIOI */ +#if defined(GPIOJ) +#define LL_AHB1_GRP1_PERIPH_GPIOJ RCC_AHB1ENR_GPIOJEN +#endif /* GPIOJ */ +#if defined(GPIOK) +#define LL_AHB1_GRP1_PERIPH_GPIOK RCC_AHB1ENR_GPIOKEN +#endif /* GPIOK */ +#define LL_AHB1_GRP1_PERIPH_CRC RCC_AHB1ENR_CRCEN +#if defined(RCC_AHB1ENR_BKPSRAMEN) +#define LL_AHB1_GRP1_PERIPH_BKPSRAM RCC_AHB1ENR_BKPSRAMEN +#endif /* RCC_AHB1ENR_BKPSRAMEN */ +#if defined(RCC_AHB1ENR_CCMDATARAMEN) +#define LL_AHB1_GRP1_PERIPH_CCMDATARAM RCC_AHB1ENR_CCMDATARAMEN +#endif /* RCC_AHB1ENR_CCMDATARAMEN */ +#define LL_AHB1_GRP1_PERIPH_DMA1 RCC_AHB1ENR_DMA1EN +#define LL_AHB1_GRP1_PERIPH_DMA2 RCC_AHB1ENR_DMA2EN +#if defined(RCC_AHB1ENR_RNGEN) +#define LL_AHB1_GRP1_PERIPH_RNG RCC_AHB1ENR_RNGEN +#endif /* RCC_AHB1ENR_RNGEN */ +#if defined(DMA2D) +#define LL_AHB1_GRP1_PERIPH_DMA2D RCC_AHB1ENR_DMA2DEN +#endif /* DMA2D */ +#if defined(ETH) +#define LL_AHB1_GRP1_PERIPH_ETHMAC RCC_AHB1ENR_ETHMACEN +#define LL_AHB1_GRP1_PERIPH_ETHMACTX RCC_AHB1ENR_ETHMACTXEN +#define LL_AHB1_GRP1_PERIPH_ETHMACRX RCC_AHB1ENR_ETHMACRXEN +#define LL_AHB1_GRP1_PERIPH_ETHMACPTP RCC_AHB1ENR_ETHMACPTPEN +#endif /* ETH */ +#if defined(USB_OTG_HS) +#define LL_AHB1_GRP1_PERIPH_OTGHS RCC_AHB1ENR_OTGHSEN +#define LL_AHB1_GRP1_PERIPH_OTGHSULPI RCC_AHB1ENR_OTGHSULPIEN +#endif /* USB_OTG_HS */ +#define LL_AHB1_GRP1_PERIPH_FLITF RCC_AHB1LPENR_FLITFLPEN +#define LL_AHB1_GRP1_PERIPH_SRAM1 RCC_AHB1LPENR_SRAM1LPEN +#if defined(RCC_AHB1LPENR_SRAM2LPEN) +#define LL_AHB1_GRP1_PERIPH_SRAM2 RCC_AHB1LPENR_SRAM2LPEN +#endif /* RCC_AHB1LPENR_SRAM2LPEN */ +#if defined(RCC_AHB1LPENR_SRAM3LPEN) +#define LL_AHB1_GRP1_PERIPH_SRAM3 RCC_AHB1LPENR_SRAM3LPEN +#endif /* RCC_AHB1LPENR_SRAM3LPEN */ +/** + * @} + */ + +#if defined(RCC_AHB2_SUPPORT) +/** @defgroup BUS_LL_EC_AHB2_GRP1_PERIPH AHB2 GRP1 PERIPH + * @{ + */ +#define LL_AHB2_GRP1_PERIPH_ALL 0xFFFFFFFFU +#if defined(DCMI) +#define LL_AHB2_GRP1_PERIPH_DCMI RCC_AHB2ENR_DCMIEN +#endif /* DCMI */ +#if defined(CRYP) +#define LL_AHB2_GRP1_PERIPH_CRYP RCC_AHB2ENR_CRYPEN +#endif /* CRYP */ +#if defined(AES) +#define LL_AHB2_GRP1_PERIPH_AES RCC_AHB2ENR_AESEN +#endif /* AES */ +#if defined(HASH) +#define LL_AHB2_GRP1_PERIPH_HASH RCC_AHB2ENR_HASHEN +#endif /* HASH */ +#if defined(RCC_AHB2ENR_RNGEN) +#define LL_AHB2_GRP1_PERIPH_RNG RCC_AHB2ENR_RNGEN +#endif /* RCC_AHB2ENR_RNGEN */ +#if defined(USB_OTG_FS) +#define LL_AHB2_GRP1_PERIPH_OTGFS RCC_AHB2ENR_OTGFSEN +#endif /* USB_OTG_FS */ +/** + * @} + */ +#endif /* RCC_AHB2_SUPPORT */ + +#if defined(RCC_AHB3_SUPPORT) +/** @defgroup BUS_LL_EC_AHB3_GRP1_PERIPH AHB3 GRP1 PERIPH + * @{ + */ +#define LL_AHB3_GRP1_PERIPH_ALL 0xFFFFFFFFU +#if defined(FSMC_Bank1) +#define LL_AHB3_GRP1_PERIPH_FSMC RCC_AHB3ENR_FSMCEN +#endif /* FSMC_Bank1 */ +#if defined(FMC_Bank1) +#define LL_AHB3_GRP1_PERIPH_FMC RCC_AHB3ENR_FMCEN +#endif /* FMC_Bank1 */ +#if defined(QUADSPI) +#define LL_AHB3_GRP1_PERIPH_QSPI RCC_AHB3ENR_QSPIEN +#endif /* QUADSPI */ +/** + * @} + */ +#endif /* RCC_AHB3_SUPPORT */ + +/** @defgroup BUS_LL_EC_APB1_GRP1_PERIPH APB1 GRP1 PERIPH + * @{ + */ +#define LL_APB1_GRP1_PERIPH_ALL 0xFFFFFFFFU +#if defined(TIM2) +#define LL_APB1_GRP1_PERIPH_TIM2 RCC_APB1ENR_TIM2EN +#endif /* TIM2 */ +#if defined(TIM3) +#define LL_APB1_GRP1_PERIPH_TIM3 RCC_APB1ENR_TIM3EN +#endif /* TIM3 */ +#if defined(TIM4) +#define LL_APB1_GRP1_PERIPH_TIM4 RCC_APB1ENR_TIM4EN +#endif /* TIM4 */ +#define LL_APB1_GRP1_PERIPH_TIM5 RCC_APB1ENR_TIM5EN +#if defined(TIM6) +#define LL_APB1_GRP1_PERIPH_TIM6 RCC_APB1ENR_TIM6EN +#endif /* TIM6 */ +#if defined(TIM7) +#define LL_APB1_GRP1_PERIPH_TIM7 RCC_APB1ENR_TIM7EN +#endif /* TIM7 */ +#if defined(TIM12) +#define LL_APB1_GRP1_PERIPH_TIM12 RCC_APB1ENR_TIM12EN +#endif /* TIM12 */ +#if defined(TIM13) +#define LL_APB1_GRP1_PERIPH_TIM13 RCC_APB1ENR_TIM13EN +#endif /* TIM13 */ +#if defined(TIM14) +#define LL_APB1_GRP1_PERIPH_TIM14 RCC_APB1ENR_TIM14EN +#endif /* TIM14 */ +#if defined(LPTIM1) +#define LL_APB1_GRP1_PERIPH_LPTIM1 RCC_APB1ENR_LPTIM1EN +#endif /* LPTIM1 */ +#if defined(RCC_APB1ENR_RTCAPBEN) +#define LL_APB1_GRP1_PERIPH_RTCAPB RCC_APB1ENR_RTCAPBEN +#endif /* RCC_APB1ENR_RTCAPBEN */ +#define LL_APB1_GRP1_PERIPH_WWDG RCC_APB1ENR_WWDGEN +#if defined(SPI2) +#define LL_APB1_GRP1_PERIPH_SPI2 RCC_APB1ENR_SPI2EN +#endif /* SPI2 */ +#if defined(SPI3) +#define LL_APB1_GRP1_PERIPH_SPI3 RCC_APB1ENR_SPI3EN +#endif /* SPI3 */ +#if defined(SPDIFRX) +#define LL_APB1_GRP1_PERIPH_SPDIFRX RCC_APB1ENR_SPDIFRXEN +#endif /* SPDIFRX */ +#define LL_APB1_GRP1_PERIPH_USART2 RCC_APB1ENR_USART2EN +#if defined(USART3) +#define LL_APB1_GRP1_PERIPH_USART3 RCC_APB1ENR_USART3EN +#endif /* USART3 */ +#if defined(UART4) +#define LL_APB1_GRP1_PERIPH_UART4 RCC_APB1ENR_UART4EN +#endif /* UART4 */ +#if defined(UART5) +#define LL_APB1_GRP1_PERIPH_UART5 RCC_APB1ENR_UART5EN +#endif /* UART5 */ +#define LL_APB1_GRP1_PERIPH_I2C1 RCC_APB1ENR_I2C1EN +#define LL_APB1_GRP1_PERIPH_I2C2 RCC_APB1ENR_I2C2EN +#if defined(I2C3) +#define LL_APB1_GRP1_PERIPH_I2C3 RCC_APB1ENR_I2C3EN +#endif /* I2C3 */ +#if defined(FMPI2C1) +#define LL_APB1_GRP1_PERIPH_FMPI2C1 RCC_APB1ENR_FMPI2C1EN +#endif /* FMPI2C1 */ +#if defined(CAN1) +#define LL_APB1_GRP1_PERIPH_CAN1 RCC_APB1ENR_CAN1EN +#endif /* CAN1 */ +#if defined(CAN2) +#define LL_APB1_GRP1_PERIPH_CAN2 RCC_APB1ENR_CAN2EN +#endif /* CAN2 */ +#if defined(CAN3) +#define LL_APB1_GRP1_PERIPH_CAN3 RCC_APB1ENR_CAN3EN +#endif /* CAN3 */ +#if defined(CEC) +#define LL_APB1_GRP1_PERIPH_CEC RCC_APB1ENR_CECEN +#endif /* CEC */ +#define LL_APB1_GRP1_PERIPH_PWR RCC_APB1ENR_PWREN +#if defined(DAC1) +#define LL_APB1_GRP1_PERIPH_DAC1 RCC_APB1ENR_DACEN +#endif /* DAC1 */ +#if defined(UART7) +#define LL_APB1_GRP1_PERIPH_UART7 RCC_APB1ENR_UART7EN +#endif /* UART7 */ +#if defined(UART8) +#define LL_APB1_GRP1_PERIPH_UART8 RCC_APB1ENR_UART8EN +#endif /* UART8 */ +/** + * @} + */ + +/** @defgroup BUS_LL_EC_APB2_GRP1_PERIPH APB2 GRP1 PERIPH + * @{ + */ +#define LL_APB2_GRP1_PERIPH_ALL 0xFFFFFFFFU +#define LL_APB2_GRP1_PERIPH_TIM1 RCC_APB2ENR_TIM1EN +#if defined(TIM8) +#define LL_APB2_GRP1_PERIPH_TIM8 RCC_APB2ENR_TIM8EN +#endif /* TIM8 */ +#define LL_APB2_GRP1_PERIPH_USART1 RCC_APB2ENR_USART1EN +#if defined(USART6) +#define LL_APB2_GRP1_PERIPH_USART6 RCC_APB2ENR_USART6EN +#endif /* USART6 */ +#if defined(UART9) +#define LL_APB2_GRP1_PERIPH_UART9 RCC_APB2ENR_UART9EN +#endif /* UART9 */ +#if defined(UART10) +#define LL_APB2_GRP1_PERIPH_UART10 RCC_APB2ENR_UART10EN +#endif /* UART10 */ +#define LL_APB2_GRP1_PERIPH_ADC1 RCC_APB2ENR_ADC1EN +#if defined(ADC2) +#define LL_APB2_GRP1_PERIPH_ADC2 RCC_APB2ENR_ADC2EN +#endif /* ADC2 */ +#if defined(ADC3) +#define LL_APB2_GRP1_PERIPH_ADC3 RCC_APB2ENR_ADC3EN +#endif /* ADC3 */ +#if defined(SDIO) +#define LL_APB2_GRP1_PERIPH_SDIO RCC_APB2ENR_SDIOEN +#endif /* SDIO */ +#define LL_APB2_GRP1_PERIPH_SPI1 RCC_APB2ENR_SPI1EN +#if defined(SPI4) +#define LL_APB2_GRP1_PERIPH_SPI4 RCC_APB2ENR_SPI4EN +#endif /* SPI4 */ +#define LL_APB2_GRP1_PERIPH_SYSCFG RCC_APB2ENR_SYSCFGEN +#if defined(RCC_APB2ENR_EXTITEN) +#define LL_APB2_GRP1_PERIPH_EXTI RCC_APB2ENR_EXTITEN +#endif /* RCC_APB2ENR_EXTITEN */ +#define LL_APB2_GRP1_PERIPH_TIM9 RCC_APB2ENR_TIM9EN +#if defined(TIM10) +#define LL_APB2_GRP1_PERIPH_TIM10 RCC_APB2ENR_TIM10EN +#endif /* TIM10 */ +#define LL_APB2_GRP1_PERIPH_TIM11 RCC_APB2ENR_TIM11EN +#if defined(SPI5) +#define LL_APB2_GRP1_PERIPH_SPI5 RCC_APB2ENR_SPI5EN +#endif /* SPI5 */ +#if defined(SPI6) +#define LL_APB2_GRP1_PERIPH_SPI6 RCC_APB2ENR_SPI6EN +#endif /* SPI6 */ +#if defined(SAI1) +#define LL_APB2_GRP1_PERIPH_SAI1 RCC_APB2ENR_SAI1EN +#endif /* SAI1 */ +#if defined(SAI2) +#define LL_APB2_GRP1_PERIPH_SAI2 RCC_APB2ENR_SAI2EN +#endif /* SAI2 */ +#if defined(LTDC) +#define LL_APB2_GRP1_PERIPH_LTDC RCC_APB2ENR_LTDCEN +#endif /* LTDC */ +#if defined(DSI) +#define LL_APB2_GRP1_PERIPH_DSI RCC_APB2ENR_DSIEN +#endif /* DSI */ +#if defined(DFSDM1_Channel0) +#define LL_APB2_GRP1_PERIPH_DFSDM1 RCC_APB2ENR_DFSDM1EN +#endif /* DFSDM1_Channel0 */ +#if defined(DFSDM2_Channel0) +#define LL_APB2_GRP1_PERIPH_DFSDM2 RCC_APB2ENR_DFSDM2EN +#endif /* DFSDM2_Channel0 */ +#define LL_APB2_GRP1_PERIPH_ADC RCC_APB2RSTR_ADCRST +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup BUS_LL_Exported_Functions BUS Exported Functions + * @{ + */ + +/** @defgroup BUS_LL_EF_AHB1 AHB1 + * @{ + */ + +/** + * @brief Enable AHB1 peripherals clock. + * @rmtoll AHB1ENR GPIOAEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOBEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOCEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIODEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOEEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOFEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOGEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOHEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOIEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOJEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR GPIOKEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR CRCEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR BKPSRAMEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR CCMDATARAMEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR DMA1EN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR DMA2EN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR RNGEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR DMA2DEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR ETHMACEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR ETHMACTXEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR ETHMACRXEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR ETHMACPTPEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR OTGHSEN LL_AHB1_GRP1_EnableClock\n + * AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_BKPSRAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CCMDATARAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHSULPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB1ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB1ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if AHB1 peripheral clock is enabled or not + * @rmtoll AHB1ENR GPIOAEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOBEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOCEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIODEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOEEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOFEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOGEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOHEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOIEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOJEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR GPIOKEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR CRCEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR BKPSRAMEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR CCMDATARAMEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR DMA1EN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR DMA2EN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR RNGEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR DMA2DEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR ETHMACEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR ETHMACTXEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR ETHMACRXEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR ETHMACPTPEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR OTGHSEN LL_AHB1_GRP1_IsEnabledClock\n + * AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_BKPSRAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CCMDATARAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHSULPI (*) + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->AHB1ENR, Periphs) == Periphs); +} + +/** + * @brief Disable AHB1 peripherals clock. + * @rmtoll AHB1ENR GPIOAEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOBEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOCEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIODEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOEEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOFEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOGEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOHEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOIEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOJEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR GPIOKEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR CRCEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR BKPSRAMEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR CCMDATARAMEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR DMA1EN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR DMA2EN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR RNGEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR DMA2DEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR ETHMACEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR ETHMACTXEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR ETHMACRXEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR ETHMACPTPEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR OTGHSEN LL_AHB1_GRP1_DisableClock\n + * AHB1ENR OTGHSULPIEN LL_AHB1_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_BKPSRAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CCMDATARAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHSULPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB1ENR, Periphs); +} + +/** + * @brief Force AHB1 peripherals reset. + * @rmtoll AHB1RSTR GPIOARST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOBRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOCRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIODRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOERST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOFRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOGRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOHRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOIRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOJRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR GPIOKRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR CRCRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR DMA1RST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR DMA2RST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR RNGRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR DMA2DRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR ETHMACRST LL_AHB1_GRP1_ForceReset\n + * AHB1RSTR OTGHSRST LL_AHB1_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_ALL + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->AHB1RSTR, Periphs); +} + +/** + * @brief Release AHB1 peripherals reset. + * @rmtoll AHB1RSTR GPIOARST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOBRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOCRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIODRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOERST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOFRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOGRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOHRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOIRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOJRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR GPIOKRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR CRCRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR DMA1RST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR DMA2RST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR RNGRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR DMA2DRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR ETHMACRST LL_AHB1_GRP1_ReleaseReset\n + * AHB1RSTR OTGHSRST LL_AHB1_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_ALL + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB1RSTR, Periphs); +} + +/** + * @brief Enable AHB1 peripheral clocks in low-power mode + * @rmtoll AHB1LPENR GPIOALPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOBLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOCLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIODLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOELPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOFLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOGLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOHLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOILPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOJLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR GPIOKLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR CRCLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR FLITFLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR SRAM1LPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR SRAM2LPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR SRAM3LPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR DMA1LPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR DMA2LPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR DMA2DLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR RNGLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR ETHMACLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR ETHMACTXLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR ETHMACRXLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR ETHMACPTPLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR OTGHSLPEN LL_AHB1_GRP1_EnableClockLowPower\n + * AHB1LPENR OTGHSULPILPEN LL_AHB1_GRP1_EnableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_BKPSRAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_FLITF + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM1 + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM2 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM3 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHSULPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_EnableClockLowPower(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB1LPENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB1LPENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Disable AHB1 peripheral clocks in low-power mode + * @rmtoll AHB1LPENR GPIOALPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOBLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOCLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIODLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOELPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOFLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOGLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOHLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOILPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOJLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR GPIOKLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR CRCLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR FLITFLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR SRAM1LPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR SRAM2LPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR SRAM3LPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR BKPSRAMLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR DMA1LPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR DMA2LPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR DMA2DLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR RNGLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR ETHMACLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR ETHMACTXLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR ETHMACRXLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR ETHMACPTPLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR OTGHSLPEN LL_AHB1_GRP1_DisableClockLowPower\n + * AHB1LPENR OTGHSULPILPEN LL_AHB1_GRP1_DisableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOA + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOB + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOC + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOD (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOH (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOI (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOJ (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_GPIOK (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_BKPSRAM (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_FLITF + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM1 + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM2 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM3 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 + * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2D (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACPTP (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGHSULPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_DisableClockLowPower(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB1LPENR, Periphs); +} + +/** + * @} + */ + +#if defined(RCC_AHB2_SUPPORT) +/** @defgroup BUS_LL_EF_AHB2 AHB2 + * @{ + */ + +/** + * @brief Enable AHB2 peripherals clock. + * @rmtoll AHB2ENR DCMIEN LL_AHB2_GRP1_EnableClock\n + * AHB2ENR CRYPEN LL_AHB2_GRP1_EnableClock\n + * AHB2ENR AESEN LL_AHB2_GRP1_EnableClock\n + * AHB2ENR HASHEN LL_AHB2_GRP1_EnableClock\n + * AHB2ENR RNGEN LL_AHB2_GRP1_EnableClock\n + * AHB2ENR OTGFSEN LL_AHB2_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB2ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB2ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if AHB2 peripheral clock is enabled or not + * @rmtoll AHB2ENR DCMIEN LL_AHB2_GRP1_IsEnabledClock\n + * AHB2ENR CRYPEN LL_AHB2_GRP1_IsEnabledClock\n + * AHB2ENR AESEN LL_AHB2_GRP1_IsEnabledClock\n + * AHB2ENR HASHEN LL_AHB2_GRP1_IsEnabledClock\n + * AHB2ENR RNGEN LL_AHB2_GRP1_IsEnabledClock\n + * AHB2ENR OTGFSEN LL_AHB2_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_AHB2_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->AHB2ENR, Periphs) == Periphs); +} + +/** + * @brief Disable AHB2 peripherals clock. + * @rmtoll AHB2ENR DCMIEN LL_AHB2_GRP1_DisableClock\n + * AHB2ENR CRYPEN LL_AHB2_GRP1_DisableClock\n + * AHB2ENR AESEN LL_AHB2_GRP1_DisableClock\n + * AHB2ENR HASHEN LL_AHB2_GRP1_DisableClock\n + * AHB2ENR RNGEN LL_AHB2_GRP1_DisableClock\n + * AHB2ENR OTGFSEN LL_AHB2_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB2ENR, Periphs); +} + +/** + * @brief Force AHB2 peripherals reset. + * @rmtoll AHB2RSTR DCMIRST LL_AHB2_GRP1_ForceReset\n + * AHB2RSTR CRYPRST LL_AHB2_GRP1_ForceReset\n + * AHB2RSTR AESRST LL_AHB2_GRP1_ForceReset\n + * AHB2RSTR HASHRST LL_AHB2_GRP1_ForceReset\n + * AHB2RSTR RNGRST LL_AHB2_GRP1_ForceReset\n + * AHB2RSTR OTGFSRST LL_AHB2_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_ALL + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->AHB2RSTR, Periphs); +} + +/** + * @brief Release AHB2 peripherals reset. + * @rmtoll AHB2RSTR DCMIRST LL_AHB2_GRP1_ReleaseReset\n + * AHB2RSTR CRYPRST LL_AHB2_GRP1_ReleaseReset\n + * AHB2RSTR AESRST LL_AHB2_GRP1_ReleaseReset\n + * AHB2RSTR HASHRST LL_AHB2_GRP1_ReleaseReset\n + * AHB2RSTR RNGRST LL_AHB2_GRP1_ReleaseReset\n + * AHB2RSTR OTGFSRST LL_AHB2_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_ALL + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB2RSTR, Periphs); +} + +/** + * @brief Enable AHB2 peripheral clocks in low-power mode + * @rmtoll AHB2LPENR DCMILPEN LL_AHB2_GRP1_EnableClockLowPower\n + * AHB2LPENR CRYPLPEN LL_AHB2_GRP1_EnableClockLowPower\n + * AHB2LPENR AESLPEN LL_AHB2_GRP1_EnableClockLowPower\n + * AHB2LPENR HASHLPEN LL_AHB2_GRP1_EnableClockLowPower\n + * AHB2LPENR RNGLPEN LL_AHB2_GRP1_EnableClockLowPower\n + * AHB2LPENR OTGFSLPEN LL_AHB2_GRP1_EnableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_EnableClockLowPower(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB2LPENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB2LPENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Disable AHB2 peripheral clocks in low-power mode + * @rmtoll AHB2LPENR DCMILPEN LL_AHB2_GRP1_DisableClockLowPower\n + * AHB2LPENR CRYPLPEN LL_AHB2_GRP1_DisableClockLowPower\n + * AHB2LPENR AESLPEN LL_AHB2_GRP1_DisableClockLowPower\n + * AHB2LPENR HASHLPEN LL_AHB2_GRP1_DisableClockLowPower\n + * AHB2LPENR RNGLPEN LL_AHB2_GRP1_DisableClockLowPower\n + * AHB2LPENR OTGFSLPEN LL_AHB2_GRP1_DisableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_DCMI (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_CRYP (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_AES (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_HASH (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_RNG (*) + * @arg @ref LL_AHB2_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB2_GRP1_DisableClockLowPower(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB2LPENR, Periphs); +} + +/** + * @} + */ +#endif /* RCC_AHB2_SUPPORT */ + +#if defined(RCC_AHB3_SUPPORT) +/** @defgroup BUS_LL_EF_AHB3 AHB3 + * @{ + */ + +/** + * @brief Enable AHB3 peripherals clock. + * @rmtoll AHB3ENR FMCEN LL_AHB3_GRP1_EnableClock\n + * AHB3ENR FSMCEN LL_AHB3_GRP1_EnableClock\n + * AHB3ENR QSPIEN LL_AHB3_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB3ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB3ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if AHB3 peripheral clock is enabled or not + * @rmtoll AHB3ENR FMCEN LL_AHB3_GRP1_IsEnabledClock\n + * AHB3ENR FSMCEN LL_AHB3_GRP1_IsEnabledClock\n + * AHB3ENR QSPIEN LL_AHB3_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_AHB3_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->AHB3ENR, Periphs) == Periphs); +} + +/** + * @brief Disable AHB3 peripherals clock. + * @rmtoll AHB3ENR FMCEN LL_AHB3_GRP1_DisableClock\n + * AHB3ENR FSMCEN LL_AHB3_GRP1_DisableClock\n + * AHB3ENR QSPIEN LL_AHB3_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB3ENR, Periphs); +} + +/** + * @brief Force AHB3 peripherals reset. + * @rmtoll AHB3RSTR FMCRST LL_AHB3_GRP1_ForceReset\n + * AHB3RSTR FSMCRST LL_AHB3_GRP1_ForceReset\n + * AHB3RSTR QSPIRST LL_AHB3_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_ALL + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->AHB3RSTR, Periphs); +} + +/** + * @brief Release AHB3 peripherals reset. + * @rmtoll AHB3RSTR FMCRST LL_AHB3_GRP1_ReleaseReset\n + * AHB3RSTR FSMCRST LL_AHB3_GRP1_ReleaseReset\n + * AHB3RSTR QSPIRST LL_AHB3_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB2_GRP1_PERIPH_ALL + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB3RSTR, Periphs); +} + +/** + * @brief Enable AHB3 peripheral clocks in low-power mode + * @rmtoll AHB3LPENR FMCLPEN LL_AHB3_GRP1_EnableClockLowPower\n + * AHB3LPENR FSMCLPEN LL_AHB3_GRP1_EnableClockLowPower\n + * AHB3LPENR QSPILPEN LL_AHB3_GRP1_EnableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_EnableClockLowPower(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHB3LPENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHB3LPENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Disable AHB3 peripheral clocks in low-power mode + * @rmtoll AHB3LPENR FMCLPEN LL_AHB3_GRP1_DisableClockLowPower\n + * AHB3LPENR FSMCLPEN LL_AHB3_GRP1_DisableClockLowPower\n + * AHB3LPENR QSPILPEN LL_AHB3_GRP1_DisableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB3_GRP1_PERIPH_FMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB3_GRP1_PERIPH_QSPI (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB3_GRP1_DisableClockLowPower(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHB3LPENR, Periphs); +} + +/** + * @} + */ +#endif /* RCC_AHB3_SUPPORT */ + +/** @defgroup BUS_LL_EF_APB1 APB1 + * @{ + */ + +/** + * @brief Enable APB1 peripherals clock. + * @rmtoll APB1ENR TIM2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_EnableClock\n + * APB1ENR LPTIM1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_EnableClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR SPDIFRXEN LL_APB1_GRP1_EnableClock\n + * APB1ENR USART2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR USART3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART4EN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART5EN LL_APB1_GRP1_EnableClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR I2C3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR FMPI2C1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CAN3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CECEN LL_APB1_GRP1_EnableClock\n + * APB1ENR PWREN LL_APB1_GRP1_EnableClock\n + * APB1ENR DACEN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART7EN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART8EN LL_APB1_GRP1_EnableClock\n + * APB1ENR RTCAPBEN LL_APB1_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_RTCAPB (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB1ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB1ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if APB1 peripheral clock is enabled or not + * @rmtoll APB1ENR TIM2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR LPTIM1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR SPDIFRXEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR USART2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR USART3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART4EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART5EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR I2C3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR FMPI2C1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CAN3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CECEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR PWREN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR DACEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART7EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART8EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR RTCAPBEN LL_APB1_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_RTCAPB (*) + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_APB1_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->APB1ENR, Periphs) == Periphs); +} + +/** + * @brief Disable APB1 peripherals clock. + * @rmtoll APB1ENR TIM2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_DisableClock\n + * APB1ENR LPTIM1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_DisableClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR SPDIFRXEN LL_APB1_GRP1_DisableClock\n + * APB1ENR USART2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR USART3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART4EN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART5EN LL_APB1_GRP1_DisableClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR I2C3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR FMPI2C1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CAN3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CECEN LL_APB1_GRP1_DisableClock\n + * APB1ENR PWREN LL_APB1_GRP1_DisableClock\n + * APB1ENR DACEN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART7EN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART8EN LL_APB1_GRP1_DisableClock\n + * APB1ENR RTCAPBEN LL_APB1_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_RTCAPB (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB1ENR, Periphs); +} + +/** + * @brief Force APB1 peripherals reset. + * @rmtoll APB1RSTR TIM2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM4RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM5RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM6RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM7RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM12RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM13RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM14RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR LPTIM1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR WWDGRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR SPI2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR SPI3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR SPDIFRXRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR USART2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR USART3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART4RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART5RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR I2C1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR I2C2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR I2C3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR FMPI2C1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CAN1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CAN2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CAN3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CECRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR PWRRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR DACRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART7RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART8RST LL_APB1_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->APB1RSTR, Periphs); +} + +/** + * @brief Release APB1 peripherals reset. + * @rmtoll APB1RSTR TIM2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM4RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM5RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM6RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM7RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM12RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM13RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM14RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR LPTIM1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR WWDGRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR SPI2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR SPI3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR SPDIFRXRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR USART2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR USART3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART4RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART5RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR I2C1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR I2C2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR I2C3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR FMPI2C1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CAN1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CAN2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CAN3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CECRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR PWRRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR DACRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART7RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART8RST LL_APB1_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB1RSTR, Periphs); +} + +/** + * @brief Enable APB1 peripheral clocks in low-power mode + * @rmtoll APB1LPENR TIM2LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM3LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM4LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM5LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM6LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM7LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM12LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM13LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR TIM14LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR LPTIM1LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR WWDGLPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR SPI2LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR SPI3LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR SPDIFRXLPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR USART2LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR USART3LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR UART4LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR UART5LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR I2C1LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR I2C2LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR I2C3LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR FMPI2C1LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR CAN1LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR CAN2LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR CAN3LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR CECLPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR PWRLPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR DACLPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR UART7LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR UART8LPEN LL_APB1_GRP1_EnableClockLowPower\n + * APB1LPENR RTCAPBLPEN LL_APB1_GRP1_EnableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_RTCAPB (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_EnableClockLowPower(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB1LPENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB1LPENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Disable APB1 peripheral clocks in low-power mode + * @rmtoll APB1LPENR TIM2LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM3LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM4LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM5LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM6LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM7LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM12LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM13LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR TIM14LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR LPTIM1LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR WWDGLPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR SPI2LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR SPI3LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR SPDIFRXLPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR USART2LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR USART3LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR UART4LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR UART5LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR I2C1LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR I2C2LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR I2C3LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR FMPI2C1LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR CAN1LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR CAN2LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR CAN3LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR CECLPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR PWRLPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR DACLPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR UART7LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR UART8LPEN LL_APB1_GRP1_DisableClockLowPower\n + * APB1LPENR RTCAPBLPEN LL_APB1_GRP1_DisableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPDIFRX (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_FMPI2C1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART8 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_RTCAPB (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_DisableClockLowPower(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB1LPENR, Periphs); +} + +/** + * @} + */ + +/** @defgroup BUS_LL_EF_APB2 APB2 + * @{ + */ + +/** + * @brief Enable APB2 peripherals clock. + * @rmtoll APB2ENR TIM1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_EnableClock\n + * APB2ENR USART1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR USART6EN LL_APB2_GRP1_EnableClock\n + * APB2ENR UART9EN LL_APB2_GRP1_EnableClock\n + * APB2ENR UART10EN LL_APB2_GRP1_EnableClock\n + * APB2ENR ADC1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_EnableClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SDIOEN LL_APB2_GRP1_EnableClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SPI4EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SYSCFGEN LL_APB2_GRP1_EnableClock\n + * APB2ENR EXTITEN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SPI5EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SPI6EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SAI1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR SAI2EN LL_APB2_GRP1_EnableClock\n + * APB2ENR LTDCEN LL_APB2_GRP1_EnableClock\n + * APB2ENR DSIEN LL_APB2_GRP1_EnableClock\n + * APB2ENR DFSDM1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR DFSDM2EN LL_APB2_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB2ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB2ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if APB2 peripheral clock is enabled or not + * @rmtoll APB2ENR TIM1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR USART1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR USART6EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR UART9EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR UART10EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR ADC1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SDIOEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SPI4EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SYSCFGEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR EXTITEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SPI5EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SPI6EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SAI1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SAI2EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR LTDCEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR DSIEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR DFSDM1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR DFSDM2EN LL_APB2_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_APB2_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->APB2ENR, Periphs) == Periphs); +} + +/** + * @brief Disable APB2 peripherals clock. + * @rmtoll APB2ENR TIM1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_DisableClock\n + * APB2ENR USART1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR USART6EN LL_APB2_GRP1_DisableClock\n + * APB2ENR UART9EN LL_APB2_GRP1_DisableClock\n + * APB2ENR UART10EN LL_APB2_GRP1_DisableClock\n + * APB2ENR ADC1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_DisableClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SDIOEN LL_APB2_GRP1_DisableClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SPI4EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SYSCFGEN LL_APB2_GRP1_DisableClock\n + * APB2ENR EXTITEN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SPI5EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SPI6EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SAI1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR SAI2EN LL_APB2_GRP1_DisableClock\n + * APB2ENR LTDCEN LL_APB2_GRP1_DisableClock\n + * APB2ENR DSIEN LL_APB2_GRP1_DisableClock\n + * APB2ENR DFSDM1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR DFSDM2EN LL_APB2_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB2ENR, Periphs); +} + +/** + * @brief Force APB2 peripherals reset. + * @rmtoll APB2RSTR TIM1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM8RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR USART1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR USART6RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR UART9RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR UART10RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR ADCRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SDIORST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SPI1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SPI4RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SYSCFGRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM9RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM10RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM11RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SPI5RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SPI6RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SAI1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SAI2RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR LTDCRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR DSIRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR DFSDM1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR DFSDM2RST LL_APB2_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ALL + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->APB2RSTR, Periphs); +} + +/** + * @brief Release APB2 peripherals reset. + * @rmtoll APB2RSTR TIM1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM8RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR USART1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR USART6RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR UART9RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR UART10RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR ADCRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SDIORST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SPI1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SPI4RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SYSCFGRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM9RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM10RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM11RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SPI5RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SPI6RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SAI1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SAI2RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR LTDCRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR DSIRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR DFSDM1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR DFSDM2RST LL_APB2_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ALL + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB2RSTR, Periphs); +} + +/** + * @brief Enable APB2 peripheral clocks in low-power mode + * @rmtoll APB2LPENR TIM1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR TIM8LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR USART1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR USART6LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR UART9LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR UART10LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR ADC1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR ADC2LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR ADC3LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SDIOLPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SPI1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SPI4LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SYSCFGLPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR EXTITLPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR TIM9LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR TIM10LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR TIM11LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SPI5LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SPI6LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SAI1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR SAI2LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR LTDCLPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR DSILPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR DFSDM1LPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR DSILPEN LL_APB2_GRP1_EnableClockLowPower\n + * APB2LPENR DFSDM2LPEN LL_APB2_GRP1_EnableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_EnableClockLowPower(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB2LPENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB2LPENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Disable APB2 peripheral clocks in low-power mode + * @rmtoll APB2LPENR TIM1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR TIM8LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR USART1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR USART6LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR UART9LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR UART10LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR ADC1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR ADC2LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR ADC3LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SDIOLPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SPI1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SPI4LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SYSCFGLPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR EXTITLPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR TIM9LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR TIM10LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR TIM11LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SPI5LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SPI6LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SAI1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR SAI2LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR LTDCLPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR DSILPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR DFSDM1LPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR DSILPEN LL_APB2_GRP1_DisableClockLowPower\n + * APB2LPENR DFSDM2LPEN LL_APB2_GRP1_DisableClockLowPower + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * @arg @ref LL_APB2_GRP1_PERIPH_USART6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_UART10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI4 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG + * @arg @ref LL_APB2_GRP1_PERIPH_EXTI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 + * @arg @ref LL_APB2_GRP1_PERIPH_SPI5 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI6 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SAI2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_LTDC (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DSI (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM1 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_DFSDM2 (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_DisableClockLowPower(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB2LPENR, Periphs); +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(RCC) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_BUS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h new file mode 100644 index 0000000..cfa8fbe --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h @@ -0,0 +1,640 @@ +/** + ****************************************************************************** + * @file stm32f4xx_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 + (MPU services provided only on some devices) + (+) API to access to MCU info (CPUID register) + (+) API to enable fault handler (SHCSR accesses) + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_CORTEX_H +#define __STM32F4xx_LL_CORTEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_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 0x00000000U /*!< 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 0x00000000U /*!< 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 0x00U /*!< REGION Number 0 */ +#define LL_MPU_REGION_NUMBER1 0x01U /*!< REGION Number 1 */ +#define LL_MPU_REGION_NUMBER2 0x02U /*!< REGION Number 2 */ +#define LL_MPU_REGION_NUMBER3 0x03U /*!< REGION Number 3 */ +#define LL_MPU_REGION_NUMBER4 0x04U /*!< REGION Number 4 */ +#define LL_MPU_REGION_NUMBER5 0x05U /*!< REGION Number 5 */ +#define LL_MPU_REGION_NUMBER6 0x06U /*!< REGION Number 6 */ +#define LL_MPU_REGION_NUMBER7 0x07U /*!< REGION Number 7 */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_REGION_SIZE MPU Region Size + * @{ + */ +#define LL_MPU_REGION_SIZE_32B (0x04U << MPU_RASR_SIZE_Pos) /*!< 32B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64B (0x05U << MPU_RASR_SIZE_Pos) /*!< 64B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128B (0x06U << MPU_RASR_SIZE_Pos) /*!< 128B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256B (0x07U << MPU_RASR_SIZE_Pos) /*!< 256B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512B (0x08U << MPU_RASR_SIZE_Pos) /*!< 512B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1KB (0x09U << MPU_RASR_SIZE_Pos) /*!< 1KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2KB (0x0AU << MPU_RASR_SIZE_Pos) /*!< 2KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4KB (0x0BU << MPU_RASR_SIZE_Pos) /*!< 4KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_8KB (0x0CU << MPU_RASR_SIZE_Pos) /*!< 8KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_16KB (0x0DU << MPU_RASR_SIZE_Pos) /*!< 16KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_32KB (0x0EU << MPU_RASR_SIZE_Pos) /*!< 32KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64KB (0x0FU << MPU_RASR_SIZE_Pos) /*!< 64KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128KB (0x10U << MPU_RASR_SIZE_Pos) /*!< 128KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256KB (0x11U << MPU_RASR_SIZE_Pos) /*!< 256KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512KB (0x12U << MPU_RASR_SIZE_Pos) /*!< 512KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1MB (0x13U << MPU_RASR_SIZE_Pos) /*!< 1MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2MB (0x14U << MPU_RASR_SIZE_Pos) /*!< 2MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4MB (0x15U << MPU_RASR_SIZE_Pos) /*!< 4MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_8MB (0x16U << MPU_RASR_SIZE_Pos) /*!< 8MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_16MB (0x17U << MPU_RASR_SIZE_Pos) /*!< 16MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_32MB (0x18U << MPU_RASR_SIZE_Pos) /*!< 32MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64MB (0x19U << MPU_RASR_SIZE_Pos) /*!< 64MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128MB (0x1AU << MPU_RASR_SIZE_Pos) /*!< 128MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256MB (0x1BU << MPU_RASR_SIZE_Pos) /*!< 256MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512MB (0x1CU << MPU_RASR_SIZE_Pos) /*!< 512MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1GB (0x1DU << MPU_RASR_SIZE_Pos) /*!< 1GB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2GB (0x1EU << MPU_RASR_SIZE_Pos) /*!< 2GB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4GB (0x1FU << 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 (0x00U << MPU_RASR_AP_Pos) /*!< No access*/ +#define LL_MPU_REGION_PRIV_RW (0x01U << MPU_RASR_AP_Pos) /*!< RW privileged (privileged access only)*/ +#define LL_MPU_REGION_PRIV_RW_URO (0x02U << MPU_RASR_AP_Pos) /*!< RW privileged - RO user (Write in a user program generates a fault) */ +#define LL_MPU_REGION_FULL_ACCESS (0x03U << MPU_RASR_AP_Pos) /*!< RW privileged & user (Full access) */ +#define LL_MPU_REGION_PRIV_RO (0x05U << MPU_RASR_AP_Pos) /*!< RO privileged (privileged read only)*/ +#define LL_MPU_REGION_PRIV_RO_URO (0x06U << MPU_RASR_AP_Pos) /*!< RO privileged & user (read only) */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_TEX MPU TEX Level + * @{ + */ +#define LL_MPU_TEX_LEVEL0 (0x00U << MPU_RASR_TEX_Pos) /*!< b000 for TEX bits */ +#define LL_MPU_TEX_LEVEL1 (0x01U << MPU_RASR_TEX_Pos) /*!< b001 for TEX bits */ +#define LL_MPU_TEX_LEVEL2 (0x02U << MPU_RASR_TEX_Pos) /*!< b010 for TEX bits */ +#define LL_MPU_TEX_LEVEL4 (0x04U << MPU_RASR_TEX_Pos) /*!< b100 for TEX bits */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_INSTRUCTION_ACCESS MPU Instruction Access + * @{ + */ +#define LL_MPU_INSTRUCTION_ACCESS_ENABLE 0x00U /*!< 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 0x00U /*!< 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 0x00U /*!< 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 0x00U /*!< 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)); +} + +/** + * @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) +{ + if (Source == LL_SYSTICK_CLKSOURCE_HCLK) + { + SET_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK); + } + else + { + CLEAR_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK); + } +} + +/** + * @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 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)); +} + +/** + * @} + */ + +/** @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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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-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 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)); +} + +/** + * @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 + * @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 + * @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 + * @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 + * @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 /* __STM32F4xx_LL_CORTEX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h new file mode 100644 index 0000000..a1560d6 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h @@ -0,0 +1,2860 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_dma.h + * @author MCD Application Team + * @brief Header file of DMA LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_DMA_H +#define __STM32F4xx_LL_DMA_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (DMA1) || defined (DMA2) + +/** @defgroup DMA_LL DMA + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup DMA_LL_Private_Variables DMA Private Variables + * @{ + */ +/* Array used to get the DMA stream register offset versus stream index LL_DMA_STREAM_x */ +static const uint8_t STREAM_OFFSET_TAB[] = +{ + (uint8_t)(DMA1_Stream0_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream1_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream2_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream3_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream4_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream5_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream6_BASE - DMA1_BASE), + (uint8_t)(DMA1_Stream7_BASE - DMA1_BASE) +}; + +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup DMA_LL_Private_Constants DMA Private Constants + * @{ + */ +/** + * @} + */ + + +/* Private macros ------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup DMA_LL_ES_INIT DMA Exported Init structure + * @{ + */ +typedef struct +{ + uint32_t PeriphOrM2MSrcAddress; /*!< Specifies the peripheral base address for DMA transfer + or as Source base address in case of memory to memory transfer direction. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t MemoryOrM2MDstAddress; /*!< Specifies the memory base address for DMA transfer + or as Destination base address in case of memory to memory transfer direction. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory. + This parameter can be a value of @ref DMA_LL_EC_DIRECTION + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataTransferDirection(). */ + + uint32_t Mode; /*!< Specifies the normal or circular operation mode. + This parameter can be a value of @ref DMA_LL_EC_MODE + @note The circular buffer mode cannot be used if the memory to memory + data transfer direction is configured on the selected Stream + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMode(). */ + + uint32_t PeriphOrM2MSrcIncMode; /*!< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction + is incremented or not. + This parameter can be a value of @ref DMA_LL_EC_PERIPH + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphIncMode(). */ + + uint32_t MemoryOrM2MDstIncMode; /*!< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction + is incremented or not. + This parameter can be a value of @ref DMA_LL_EC_MEMORY + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryIncMode(). */ + + uint32_t PeriphOrM2MSrcDataSize; /*!< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word) + in case of memory to memory transfer direction. + This parameter can be a value of @ref DMA_LL_EC_PDATAALIGN + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphSize(). */ + + uint32_t MemoryOrM2MDstDataSize; /*!< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word) + in case of memory to memory transfer direction. + This parameter can be a value of @ref DMA_LL_EC_MDATAALIGN + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemorySize(). */ + + uint32_t NbData; /*!< Specifies the number of data to transfer, in data unit. + The data unit is equal to the source buffer configuration set in PeripheralSize + or MemorySize parameters depending in the transfer direction. + This parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataLength(). */ + + uint32_t Channel; /*!< Specifies the peripheral channel. + This parameter can be a value of @ref DMA_LL_EC_CHANNEL + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetChannelSelection(). */ + + uint32_t Priority; /*!< Specifies the channel priority level. + This parameter can be a value of @ref DMA_LL_EC_PRIORITY + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetStreamPriorityLevel(). */ + + uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream. + This parameter can be a value of @ref DMA_LL_FIFOMODE + @note The Direct mode (FIFO mode disabled) cannot be used if the + memory-to-memory data transfer is configured on the selected stream + + This feature can be modified afterwards using unitary functions @ref LL_DMA_EnableFifoMode() or @ref LL_DMA_EnableFifoMode() . */ + + uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level. + This parameter can be a value of @ref DMA_LL_EC_FIFOTHRESHOLD + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetFIFOThreshold(). */ + + uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers. + It specifies the amount of data to be transferred in a single non interruptible + transaction. + This parameter can be a value of @ref DMA_LL_EC_MBURST + @note The burst mode is possible only if the address Increment mode is enabled. + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryBurstxfer(). */ + + uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers. + It specifies the amount of data to be transferred in a single non interruptible + transaction. + This parameter can be a value of @ref DMA_LL_EC_PBURST + @note The burst mode is possible only if the address Increment mode is enabled. + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphBurstxfer(). */ + +} LL_DMA_InitTypeDef; +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Constants DMA Exported Constants + * @{ + */ + +/** @defgroup DMA_LL_EC_STREAM STREAM + * @{ + */ +#define LL_DMA_STREAM_0 0x00000000U +#define LL_DMA_STREAM_1 0x00000001U +#define LL_DMA_STREAM_2 0x00000002U +#define LL_DMA_STREAM_3 0x00000003U +#define LL_DMA_STREAM_4 0x00000004U +#define LL_DMA_STREAM_5 0x00000005U +#define LL_DMA_STREAM_6 0x00000006U +#define LL_DMA_STREAM_7 0x00000007U +#define LL_DMA_STREAM_ALL 0xFFFF0000U +/** + * @} + */ + +/** @defgroup DMA_LL_EC_DIRECTION DIRECTION + * @{ + */ +#define LL_DMA_DIRECTION_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */ +#define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_SxCR_DIR_0 /*!< Memory to peripheral direction */ +#define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_SxCR_DIR_1 /*!< Memory to memory direction */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MODE MODE + * @{ + */ +#define LL_DMA_MODE_NORMAL 0x00000000U /*!< Normal Mode */ +#define LL_DMA_MODE_CIRCULAR DMA_SxCR_CIRC /*!< Circular Mode */ +#define LL_DMA_MODE_PFCTRL DMA_SxCR_PFCTRL /*!< Peripheral flow control mode */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_DOUBLEBUFFER_MODE DOUBLEBUFFER MODE + * @{ + */ +#define LL_DMA_DOUBLEBUFFER_MODE_DISABLE 0x00000000U /*!< Disable double buffering mode */ +#define LL_DMA_DOUBLEBUFFER_MODE_ENABLE DMA_SxCR_DBM /*!< Enable double buffering mode */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PERIPH PERIPH + * @{ + */ +#define LL_DMA_PERIPH_NOINCREMENT 0x00000000U /*!< Peripheral increment mode Disable */ +#define LL_DMA_PERIPH_INCREMENT DMA_SxCR_PINC /*!< Peripheral increment mode Enable */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MEMORY MEMORY + * @{ + */ +#define LL_DMA_MEMORY_NOINCREMENT 0x00000000U /*!< Memory increment mode Disable */ +#define LL_DMA_MEMORY_INCREMENT DMA_SxCR_MINC /*!< Memory increment mode Enable */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PDATAALIGN PDATAALIGN + * @{ + */ +#define LL_DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */ +#define LL_DMA_PDATAALIGN_HALFWORD DMA_SxCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */ +#define LL_DMA_PDATAALIGN_WORD DMA_SxCR_PSIZE_1 /*!< Peripheral data alignment : Word */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MDATAALIGN MDATAALIGN + * @{ + */ +#define LL_DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */ +#define LL_DMA_MDATAALIGN_HALFWORD DMA_SxCR_MSIZE_0 /*!< Memory data alignment : HalfWord */ +#define LL_DMA_MDATAALIGN_WORD DMA_SxCR_MSIZE_1 /*!< Memory data alignment : Word */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_OFFSETSIZE OFFSETSIZE + * @{ + */ +#define LL_DMA_OFFSETSIZE_PSIZE 0x00000000U /*!< Peripheral increment offset size is linked to the PSIZE */ +#define LL_DMA_OFFSETSIZE_FIXEDTO4 DMA_SxCR_PINCOS /*!< Peripheral increment offset size is fixed to 4 (32-bit alignment) */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PRIORITY PRIORITY + * @{ + */ +#define LL_DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */ +#define LL_DMA_PRIORITY_MEDIUM DMA_SxCR_PL_0 /*!< Priority level : Medium */ +#define LL_DMA_PRIORITY_HIGH DMA_SxCR_PL_1 /*!< Priority level : High */ +#define LL_DMA_PRIORITY_VERYHIGH DMA_SxCR_PL /*!< Priority level : Very_High */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_CHANNEL CHANNEL + * @{ + */ +#define LL_DMA_CHANNEL_0 0x00000000U /* Select Channel0 of DMA Instance */ +#define LL_DMA_CHANNEL_1 DMA_SxCR_CHSEL_0 /* Select Channel1 of DMA Instance */ +#define LL_DMA_CHANNEL_2 DMA_SxCR_CHSEL_1 /* Select Channel2 of DMA Instance */ +#define LL_DMA_CHANNEL_3 (DMA_SxCR_CHSEL_0 | DMA_SxCR_CHSEL_1) /* Select Channel3 of DMA Instance */ +#define LL_DMA_CHANNEL_4 DMA_SxCR_CHSEL_2 /* Select Channel4 of DMA Instance */ +#define LL_DMA_CHANNEL_5 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_0) /* Select Channel5 of DMA Instance */ +#define LL_DMA_CHANNEL_6 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_1) /* Select Channel6 of DMA Instance */ +#define LL_DMA_CHANNEL_7 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0) /* Select Channel7 of DMA Instance */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MBURST MBURST + * @{ + */ +#define LL_DMA_MBURST_SINGLE 0x00000000U /*!< Memory burst single transfer configuration */ +#define LL_DMA_MBURST_INC4 DMA_SxCR_MBURST_0 /*!< Memory burst of 4 beats transfer configuration */ +#define LL_DMA_MBURST_INC8 DMA_SxCR_MBURST_1 /*!< Memory burst of 8 beats transfer configuration */ +#define LL_DMA_MBURST_INC16 (DMA_SxCR_MBURST_0 | DMA_SxCR_MBURST_1) /*!< Memory burst of 16 beats transfer configuration */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PBURST PBURST + * @{ + */ +#define LL_DMA_PBURST_SINGLE 0x00000000U /*!< Peripheral burst single transfer configuration */ +#define LL_DMA_PBURST_INC4 DMA_SxCR_PBURST_0 /*!< Peripheral burst of 4 beats transfer configuration */ +#define LL_DMA_PBURST_INC8 DMA_SxCR_PBURST_1 /*!< Peripheral burst of 8 beats transfer configuration */ +#define LL_DMA_PBURST_INC16 (DMA_SxCR_PBURST_0 | DMA_SxCR_PBURST_1) /*!< Peripheral burst of 16 beats transfer configuration */ +/** + * @} + */ + +/** @defgroup DMA_LL_FIFOMODE DMA_LL_FIFOMODE + * @{ + */ +#define LL_DMA_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable (direct mode is enabled) */ +#define LL_DMA_FIFOMODE_ENABLE DMA_SxFCR_DMDIS /*!< FIFO mode enable */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_FIFOSTATUS_0 FIFOSTATUS 0 + * @{ + */ +#define LL_DMA_FIFOSTATUS_0_25 0x00000000U /*!< 0 < fifo_level < 1/4 */ +#define LL_DMA_FIFOSTATUS_25_50 DMA_SxFCR_FS_0 /*!< 1/4 < fifo_level < 1/2 */ +#define LL_DMA_FIFOSTATUS_50_75 DMA_SxFCR_FS_1 /*!< 1/2 < fifo_level < 3/4 */ +#define LL_DMA_FIFOSTATUS_75_100 (DMA_SxFCR_FS_1 | DMA_SxFCR_FS_0) /*!< 3/4 < fifo_level < full */ +#define LL_DMA_FIFOSTATUS_EMPTY DMA_SxFCR_FS_2 /*!< FIFO is empty */ +#define LL_DMA_FIFOSTATUS_FULL (DMA_SxFCR_FS_2 | DMA_SxFCR_FS_0) /*!< FIFO is full */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_FIFOTHRESHOLD FIFOTHRESHOLD + * @{ + */ +#define LL_DMA_FIFOTHRESHOLD_1_4 0x00000000U /*!< FIFO threshold 1 quart full configuration */ +#define LL_DMA_FIFOTHRESHOLD_1_2 DMA_SxFCR_FTH_0 /*!< FIFO threshold half full configuration */ +#define LL_DMA_FIFOTHRESHOLD_3_4 DMA_SxFCR_FTH_1 /*!< FIFO threshold 3 quarts full configuration */ +#define LL_DMA_FIFOTHRESHOLD_FULL DMA_SxFCR_FTH /*!< FIFO threshold full configuration */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_CURRENTTARGETMEM CURRENTTARGETMEM + * @{ + */ +#define LL_DMA_CURRENTTARGETMEM0 0x00000000U /*!< Set CurrentTarget Memory to Memory 0 */ +#define LL_DMA_CURRENTTARGETMEM1 DMA_SxCR_CT /*!< Set CurrentTarget Memory to Memory 1 */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Macros DMA Exported Macros + * @{ + */ + +/** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers macros + * @{ + */ +/** + * @brief Write a value in DMA register + * @param __INSTANCE__ DMA Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_DMA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in DMA register + * @param __INSTANCE__ DMA Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_DMA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** @defgroup DMA_LL_EM_CONVERT_DMAxCHANNELy Convert DMAxStreamy + * @{ + */ +/** + * @brief Convert DMAx_Streamy into DMAx + * @param __STREAM_INSTANCE__ DMAx_Streamy + * @retval DMAx + */ +#define __LL_DMA_GET_INSTANCE(__STREAM_INSTANCE__) \ +(((uint32_t)(__STREAM_INSTANCE__) > ((uint32_t)DMA1_Stream7)) ? DMA2 : DMA1) + +/** + * @brief Convert DMAx_Streamy into LL_DMA_STREAM_y + * @param __STREAM_INSTANCE__ DMAx_Streamy + * @retval LL_DMA_CHANNEL_y + */ +#define __LL_DMA_GET_STREAM(__STREAM_INSTANCE__) \ +(((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream0)) ? LL_DMA_STREAM_0 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream0)) ? LL_DMA_STREAM_0 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream1)) ? LL_DMA_STREAM_1 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream1)) ? LL_DMA_STREAM_1 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream2)) ? LL_DMA_STREAM_2 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream2)) ? LL_DMA_STREAM_2 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream3)) ? LL_DMA_STREAM_3 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream3)) ? LL_DMA_STREAM_3 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream4)) ? LL_DMA_STREAM_4 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream4)) ? LL_DMA_STREAM_4 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream5)) ? LL_DMA_STREAM_5 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream5)) ? LL_DMA_STREAM_5 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream6)) ? LL_DMA_STREAM_6 : \ + ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream6)) ? LL_DMA_STREAM_6 : \ + LL_DMA_STREAM_7) + +/** + * @brief Convert DMA Instance DMAx and LL_DMA_STREAM_y into DMAx_Streamy + * @param __DMA_INSTANCE__ DMAx + * @param __STREAM__ LL_DMA_STREAM_y + * @retval DMAx_Streamy + */ +#define __LL_DMA_GET_STREAM_INSTANCE(__DMA_INSTANCE__, __STREAM__) \ +((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_0))) ? DMA1_Stream0 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_0))) ? DMA2_Stream0 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_1))) ? DMA1_Stream1 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_1))) ? DMA2_Stream1 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_2))) ? DMA1_Stream2 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_2))) ? DMA2_Stream2 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_3))) ? DMA1_Stream3 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_3))) ? DMA2_Stream3 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_4))) ? DMA1_Stream4 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_4))) ? DMA2_Stream4 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_5))) ? DMA1_Stream5 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_5))) ? DMA2_Stream5 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_6))) ? DMA1_Stream6 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_6))) ? DMA2_Stream6 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_7))) ? DMA1_Stream7 : \ + DMA2_Stream7) + +/** + * @} + */ + +/** + * @} + */ + + +/* Exported functions --------------------------------------------------------*/ + /** @defgroup DMA_LL_Exported_Functions DMA Exported Functions + * @{ + */ + +/** @defgroup DMA_LL_EF_Configuration Configuration + * @{ + */ +/** + * @brief Enable DMA stream. + * @rmtoll CR EN LL_DMA_EnableStream + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableStream(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN); +} + +/** + * @brief Disable DMA stream. + * @rmtoll CR EN LL_DMA_DisableStream + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableStream(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN); +} + +/** + * @brief Check if DMA stream is enabled or disabled. + * @rmtoll CR EN LL_DMA_IsEnabledStream + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledStream(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN) == (DMA_SxCR_EN)); +} + +/** + * @brief Configure all parameters linked to DMA transfer. + * @rmtoll CR DIR LL_DMA_ConfigTransfer\n + * CR CIRC LL_DMA_ConfigTransfer\n + * CR PINC LL_DMA_ConfigTransfer\n + * CR MINC LL_DMA_ConfigTransfer\n + * CR PSIZE LL_DMA_ConfigTransfer\n + * CR MSIZE LL_DMA_ConfigTransfer\n + * CR PL LL_DMA_ConfigTransfer\n + * CR PFCTRL LL_DMA_ConfigTransfer + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY or @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH or @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @arg @ref LL_DMA_MODE_NORMAL or @ref LL_DMA_MODE_CIRCULAR or @ref LL_DMA_MODE_PFCTRL + * @arg @ref LL_DMA_PERIPH_INCREMENT or @ref LL_DMA_PERIPH_NOINCREMENT + * @arg @ref LL_DMA_MEMORY_INCREMENT or @ref LL_DMA_MEMORY_NOINCREMENT + * @arg @ref LL_DMA_PDATAALIGN_BYTE or @ref LL_DMA_PDATAALIGN_HALFWORD or @ref LL_DMA_PDATAALIGN_WORD + * @arg @ref LL_DMA_MDATAALIGN_BYTE or @ref LL_DMA_MDATAALIGN_HALFWORD or @ref LL_DMA_MDATAALIGN_WORD + * @arg @ref LL_DMA_PRIORITY_LOW or @ref LL_DMA_PRIORITY_MEDIUM or @ref LL_DMA_PRIORITY_HIGH or @ref LL_DMA_PRIORITY_VERYHIGH + *@retval None + */ +__STATIC_INLINE void LL_DMA_ConfigTransfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Configuration) +{ + MODIFY_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, + DMA_SxCR_DIR | DMA_SxCR_CIRC | DMA_SxCR_PINC | DMA_SxCR_MINC | DMA_SxCR_PSIZE | DMA_SxCR_MSIZE | DMA_SxCR_PL | DMA_SxCR_PFCTRL, + Configuration); +} + +/** + * @brief Set Data transfer direction (read from peripheral or from memory). + * @rmtoll CR DIR LL_DMA_SetDataTransferDirection + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Direction) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DIR, Direction); +} + +/** + * @brief Get Data transfer direction (read from peripheral or from memory). + * @rmtoll CR DIR LL_DMA_GetDataTransferDirection + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + */ +__STATIC_INLINE uint32_t LL_DMA_GetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DIR)); +} + +/** + * @brief Set DMA mode normal, circular or peripheral flow control. + * @rmtoll CR CIRC LL_DMA_SetMode\n + * CR PFCTRL LL_DMA_SetMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_DMA_MODE_NORMAL + * @arg @ref LL_DMA_MODE_CIRCULAR + * @arg @ref LL_DMA_MODE_PFCTRL + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Mode) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CIRC | DMA_SxCR_PFCTRL, Mode); +} + +/** + * @brief Get DMA mode normal, circular or peripheral flow control. + * @rmtoll CR CIRC LL_DMA_GetMode\n + * CR PFCTRL LL_DMA_GetMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MODE_NORMAL + * @arg @ref LL_DMA_MODE_CIRCULAR + * @arg @ref LL_DMA_MODE_PFCTRL + */ +__STATIC_INLINE uint32_t LL_DMA_GetMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CIRC | DMA_SxCR_PFCTRL)); +} + +/** + * @brief Set Peripheral increment mode. + * @rmtoll CR PINC LL_DMA_SetPeriphIncMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param IncrementMode This parameter can be one of the following values: + * @arg @ref LL_DMA_PERIPH_NOINCREMENT + * @arg @ref LL_DMA_PERIPH_INCREMENT + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t IncrementMode) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINC, IncrementMode); +} + +/** + * @brief Get Peripheral increment mode. + * @rmtoll CR PINC LL_DMA_GetPeriphIncMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PERIPH_NOINCREMENT + * @arg @ref LL_DMA_PERIPH_INCREMENT + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINC)); +} + +/** + * @brief Set Memory increment mode. + * @rmtoll CR MINC LL_DMA_SetMemoryIncMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param IncrementMode This parameter can be one of the following values: + * @arg @ref LL_DMA_MEMORY_NOINCREMENT + * @arg @ref LL_DMA_MEMORY_INCREMENT + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t IncrementMode) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MINC, IncrementMode); +} + +/** + * @brief Get Memory increment mode. + * @rmtoll CR MINC LL_DMA_GetMemoryIncMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MEMORY_NOINCREMENT + * @arg @ref LL_DMA_MEMORY_INCREMENT + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MINC)); +} + +/** + * @brief Set Peripheral size. + * @rmtoll CR PSIZE LL_DMA_SetPeriphSize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Size This parameter can be one of the following values: + * @arg @ref LL_DMA_PDATAALIGN_BYTE + * @arg @ref LL_DMA_PDATAALIGN_HALFWORD + * @arg @ref LL_DMA_PDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphSize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Size) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PSIZE, Size); +} + +/** + * @brief Get Peripheral size. + * @rmtoll CR PSIZE LL_DMA_GetPeriphSize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PDATAALIGN_BYTE + * @arg @ref LL_DMA_PDATAALIGN_HALFWORD + * @arg @ref LL_DMA_PDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphSize(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PSIZE)); +} + +/** + * @brief Set Memory size. + * @rmtoll CR MSIZE LL_DMA_SetMemorySize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Size This parameter can be one of the following values: + * @arg @ref LL_DMA_MDATAALIGN_BYTE + * @arg @ref LL_DMA_MDATAALIGN_HALFWORD + * @arg @ref LL_DMA_MDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemorySize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Size) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MSIZE, Size); +} + +/** + * @brief Get Memory size. + * @rmtoll CR MSIZE LL_DMA_GetMemorySize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MDATAALIGN_BYTE + * @arg @ref LL_DMA_MDATAALIGN_HALFWORD + * @arg @ref LL_DMA_MDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemorySize(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MSIZE)); +} + +/** + * @brief Set Peripheral increment offset size. + * @rmtoll CR PINCOS LL_DMA_SetIncOffsetSize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param OffsetSize This parameter can be one of the following values: + * @arg @ref LL_DMA_OFFSETSIZE_PSIZE + * @arg @ref LL_DMA_OFFSETSIZE_FIXEDTO4 + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetIncOffsetSize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t OffsetSize) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINCOS, OffsetSize); +} + +/** + * @brief Get Peripheral increment offset size. + * @rmtoll CR PINCOS LL_DMA_GetIncOffsetSize + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_OFFSETSIZE_PSIZE + * @arg @ref LL_DMA_OFFSETSIZE_FIXEDTO4 + */ +__STATIC_INLINE uint32_t LL_DMA_GetIncOffsetSize(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINCOS)); +} + +/** + * @brief Set Stream priority level. + * @rmtoll CR PL LL_DMA_SetStreamPriorityLevel + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Priority This parameter can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_LOW + * @arg @ref LL_DMA_PRIORITY_MEDIUM + * @arg @ref LL_DMA_PRIORITY_HIGH + * @arg @ref LL_DMA_PRIORITY_VERYHIGH + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetStreamPriorityLevel(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Priority) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PL, Priority); +} + +/** + * @brief Get Stream priority level. + * @rmtoll CR PL LL_DMA_GetStreamPriorityLevel + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_LOW + * @arg @ref LL_DMA_PRIORITY_MEDIUM + * @arg @ref LL_DMA_PRIORITY_HIGH + * @arg @ref LL_DMA_PRIORITY_VERYHIGH + */ +__STATIC_INLINE uint32_t LL_DMA_GetStreamPriorityLevel(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PL)); +} + +/** + * @brief Set Number of data to transfer. + * @rmtoll NDTR NDT LL_DMA_SetDataLength + * @note This action has no effect if + * stream is enabled. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param NbData Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetDataLength(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t NbData) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->NDTR, DMA_SxNDT, NbData); +} + +/** + * @brief Get Number of data to transfer. + * @rmtoll NDTR NDT LL_DMA_GetDataLength + * @note Once the stream is enabled, the return value indicate the + * remaining bytes to be transmitted. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetDataLength(DMA_TypeDef* DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->NDTR, DMA_SxNDT)); +} + +/** + * @brief Select Channel number associated to the Stream. + * @rmtoll CR CHSEL LL_DMA_SetChannelSelection + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetChannelSelection(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Channel) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CHSEL, Channel); +} + +/** + * @brief Get the Channel number associated to the Stream. + * @rmtoll CR CHSEL LL_DMA_GetChannelSelection + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + */ +__STATIC_INLINE uint32_t LL_DMA_GetChannelSelection(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CHSEL)); +} + +/** + * @brief Set Memory burst transfer configuration. + * @rmtoll CR MBURST LL_DMA_SetMemoryBurstxfer + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Mburst This parameter can be one of the following values: + * @arg @ref LL_DMA_MBURST_SINGLE + * @arg @ref LL_DMA_MBURST_INC4 + * @arg @ref LL_DMA_MBURST_INC8 + * @arg @ref LL_DMA_MBURST_INC16 + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemoryBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Mburst) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MBURST, Mburst); +} + +/** + * @brief Get Memory burst transfer configuration. + * @rmtoll CR MBURST LL_DMA_GetMemoryBurstxfer + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MBURST_SINGLE + * @arg @ref LL_DMA_MBURST_INC4 + * @arg @ref LL_DMA_MBURST_INC8 + * @arg @ref LL_DMA_MBURST_INC16 + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemoryBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MBURST)); +} + +/** + * @brief Set Peripheral burst transfer configuration. + * @rmtoll CR PBURST LL_DMA_SetPeriphBurstxfer + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Pburst This parameter can be one of the following values: + * @arg @ref LL_DMA_PBURST_SINGLE + * @arg @ref LL_DMA_PBURST_INC4 + * @arg @ref LL_DMA_PBURST_INC8 + * @arg @ref LL_DMA_PBURST_INC16 + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Pburst) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PBURST, Pburst); +} + +/** + * @brief Get Peripheral burst transfer configuration. + * @rmtoll CR PBURST LL_DMA_GetPeriphBurstxfer + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PBURST_SINGLE + * @arg @ref LL_DMA_PBURST_INC4 + * @arg @ref LL_DMA_PBURST_INC8 + * @arg @ref LL_DMA_PBURST_INC16 + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PBURST)); +} + +/** + * @brief Set Current target (only in double buffer mode) to Memory 1 or Memory 0. + * @rmtoll CR CT LL_DMA_SetCurrentTargetMem + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param CurrentMemory This parameter can be one of the following values: + * @arg @ref LL_DMA_CURRENTTARGETMEM0 + * @arg @ref LL_DMA_CURRENTTARGETMEM1 + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetCurrentTargetMem(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t CurrentMemory) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CT, CurrentMemory); +} + +/** + * @brief Set Current target (only in double buffer mode) to Memory 1 or Memory 0. + * @rmtoll CR CT LL_DMA_GetCurrentTargetMem + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_CURRENTTARGETMEM0 + * @arg @ref LL_DMA_CURRENTTARGETMEM1 + */ +__STATIC_INLINE uint32_t LL_DMA_GetCurrentTargetMem(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CT)); +} + +/** + * @brief Enable the double buffer mode. + * @rmtoll CR DBM LL_DMA_EnableDoubleBufferMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableDoubleBufferMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DBM); +} + +/** + * @brief Disable the double buffer mode. + * @rmtoll CR DBM LL_DMA_DisableDoubleBufferMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableDoubleBufferMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DBM); +} + +/** + * @brief Get FIFO status. + * @rmtoll FCR FS LL_DMA_GetFIFOStatus + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_FIFOSTATUS_0_25 + * @arg @ref LL_DMA_FIFOSTATUS_25_50 + * @arg @ref LL_DMA_FIFOSTATUS_50_75 + * @arg @ref LL_DMA_FIFOSTATUS_75_100 + * @arg @ref LL_DMA_FIFOSTATUS_EMPTY + * @arg @ref LL_DMA_FIFOSTATUS_FULL + */ +__STATIC_INLINE uint32_t LL_DMA_GetFIFOStatus(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FS)); +} + +/** + * @brief Disable Fifo mode. + * @rmtoll FCR DMDIS LL_DMA_DisableFifoMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableFifoMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_DMDIS); +} + +/** + * @brief Enable Fifo mode. + * @rmtoll FCR DMDIS LL_DMA_EnableFifoMode + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableFifoMode(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_DMDIS); +} + +/** + * @brief Select FIFO threshold. + * @rmtoll FCR FTH LL_DMA_SetFIFOThreshold + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Threshold This parameter can be one of the following values: + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2 + * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetFIFOThreshold(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Threshold) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH, Threshold); +} + +/** + * @brief Get FIFO threshold. + * @rmtoll FCR FTH LL_DMA_GetFIFOThreshold + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2 + * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL + */ +__STATIC_INLINE uint32_t LL_DMA_GetFIFOThreshold(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH)); +} + +/** + * @brief Configure the FIFO . + * @rmtoll FCR FTH LL_DMA_ConfigFifo\n + * FCR DMDIS LL_DMA_ConfigFifo + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param FifoMode This parameter can be one of the following values: + * @arg @ref LL_DMA_FIFOMODE_ENABLE + * @arg @ref LL_DMA_FIFOMODE_DISABLE + * @param FifoThreshold This parameter can be one of the following values: + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2 + * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4 + * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL + * @retval None + */ +__STATIC_INLINE void LL_DMA_ConfigFifo(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t FifoMode, uint32_t FifoThreshold) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH|DMA_SxFCR_DMDIS, FifoMode|FifoThreshold); +} + +/** + * @brief Configure the Source and Destination addresses. + * @note This API must not be called when the DMA stream is enabled. + * @rmtoll M0AR M0A LL_DMA_ConfigAddresses\n + * PAR PA LL_DMA_ConfigAddresses + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param SrcAddress Between 0 to 0xFFFFFFFF + * @param DstAddress Between 0 to 0xFFFFFFFF + * @param Direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @retval None + */ +__STATIC_INLINE void LL_DMA_ConfigAddresses(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t SrcAddress, uint32_t DstAddress, uint32_t Direction) +{ + /* Direction Memory to Periph */ + if (Direction == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) + { + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, SrcAddress); + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, DstAddress); + } + /* Direction Periph to Memory and Memory to Memory */ + else + { + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, SrcAddress); + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, DstAddress); + } +} + +/** + * @brief Set the Memory address. + * @rmtoll M0AR M0A LL_DMA_SetMemoryAddress + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @note This API must not be called when the DMA channel is enabled. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param MemoryAddress Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemoryAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress) +{ + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, MemoryAddress); +} + +/** + * @brief Set the Peripheral address. + * @rmtoll PAR PA LL_DMA_SetPeriphAddress + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @note This API must not be called when the DMA channel is enabled. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param PeriphAddress Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t PeriphAddress) +{ + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, PeriphAddress); +} + +/** + * @brief Get the Memory address. + * @rmtoll M0AR M0A LL_DMA_GetMemoryAddress + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemoryAddress(DMA_TypeDef* DMAx, uint32_t Stream) +{ + return (READ_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR)); +} + +/** + * @brief Get the Peripheral address. + * @rmtoll PAR PA LL_DMA_GetPeriphAddress + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress(DMA_TypeDef* DMAx, uint32_t Stream) +{ + return (READ_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR)); +} + +/** + * @brief Set the Memory to Memory Source address. + * @rmtoll PAR PA LL_DMA_SetM2MSrcAddress + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @note This API must not be called when the DMA channel is enabled. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param MemoryAddress Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress) +{ + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, MemoryAddress); +} + +/** + * @brief Set the Memory to Memory Destination address. + * @rmtoll M0AR M0A LL_DMA_SetM2MDstAddress + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @note This API must not be called when the DMA channel is enabled. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param MemoryAddress Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress) + { + WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, MemoryAddress); + } + +/** + * @brief Get the Memory to Memory Source address. + * @rmtoll PAR PA LL_DMA_GetM2MSrcAddress + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream) + { + return (READ_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR)); + } + +/** + * @brief Get the Memory to Memory Destination address. + * @rmtoll M0AR M0A LL_DMA_GetM2MDstAddress + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream) +{ + return (READ_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR)); +} + +/** + * @brief Set Memory 1 address (used in case of Double buffer mode). + * @rmtoll M1AR M1A LL_DMA_SetMemory1Address + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param Address Between 0 to 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemory1Address(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Address) +{ + MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M1AR, DMA_SxM1AR_M1A, Address); +} + +/** + * @brief Get Memory 1 address (used in case of Double buffer mode). + * @rmtoll M1AR M1A LL_DMA_GetMemory1Address + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval Between 0 to 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemory1Address(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M1AR); +} + +/** + * @} + */ + +/** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get Stream 0 half transfer flag. + * @rmtoll LISR HTIF0 LL_DMA_IsActiveFlag_HT0 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT0(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF0)==(DMA_LISR_HTIF0)); +} + +/** + * @brief Get Stream 1 half transfer flag. + * @rmtoll LISR HTIF1 LL_DMA_IsActiveFlag_HT1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF1)==(DMA_LISR_HTIF1)); +} + +/** + * @brief Get Stream 2 half transfer flag. + * @rmtoll LISR HTIF2 LL_DMA_IsActiveFlag_HT2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF2)==(DMA_LISR_HTIF2)); +} + +/** + * @brief Get Stream 3 half transfer flag. + * @rmtoll LISR HTIF3 LL_DMA_IsActiveFlag_HT3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF3)==(DMA_LISR_HTIF3)); +} + +/** + * @brief Get Stream 4 half transfer flag. + * @rmtoll HISR HTIF4 LL_DMA_IsActiveFlag_HT4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF4)==(DMA_HISR_HTIF4)); +} + +/** + * @brief Get Stream 5 half transfer flag. + * @rmtoll HISR HTIF0 LL_DMA_IsActiveFlag_HT5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF5)==(DMA_HISR_HTIF5)); +} + +/** + * @brief Get Stream 6 half transfer flag. + * @rmtoll HISR HTIF6 LL_DMA_IsActiveFlag_HT6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF6)==(DMA_HISR_HTIF6)); +} + +/** + * @brief Get Stream 7 half transfer flag. + * @rmtoll HISR HTIF7 LL_DMA_IsActiveFlag_HT7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF7)==(DMA_HISR_HTIF7)); +} + +/** + * @brief Get Stream 0 transfer complete flag. + * @rmtoll LISR TCIF0 LL_DMA_IsActiveFlag_TC0 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC0(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF0)==(DMA_LISR_TCIF0)); +} + +/** + * @brief Get Stream 1 transfer complete flag. + * @rmtoll LISR TCIF1 LL_DMA_IsActiveFlag_TC1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF1)==(DMA_LISR_TCIF1)); +} + +/** + * @brief Get Stream 2 transfer complete flag. + * @rmtoll LISR TCIF2 LL_DMA_IsActiveFlag_TC2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF2)==(DMA_LISR_TCIF2)); +} + +/** + * @brief Get Stream 3 transfer complete flag. + * @rmtoll LISR TCIF3 LL_DMA_IsActiveFlag_TC3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF3)==(DMA_LISR_TCIF3)); +} + +/** + * @brief Get Stream 4 transfer complete flag. + * @rmtoll HISR TCIF4 LL_DMA_IsActiveFlag_TC4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF4)==(DMA_HISR_TCIF4)); +} + +/** + * @brief Get Stream 5 transfer complete flag. + * @rmtoll HISR TCIF0 LL_DMA_IsActiveFlag_TC5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF5)==(DMA_HISR_TCIF5)); +} + +/** + * @brief Get Stream 6 transfer complete flag. + * @rmtoll HISR TCIF6 LL_DMA_IsActiveFlag_TC6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF6)==(DMA_HISR_TCIF6)); +} + +/** + * @brief Get Stream 7 transfer complete flag. + * @rmtoll HISR TCIF7 LL_DMA_IsActiveFlag_TC7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF7)==(DMA_HISR_TCIF7)); +} + +/** + * @brief Get Stream 0 transfer error flag. + * @rmtoll LISR TEIF0 LL_DMA_IsActiveFlag_TE0 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE0(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF0)==(DMA_LISR_TEIF0)); +} + +/** + * @brief Get Stream 1 transfer error flag. + * @rmtoll LISR TEIF1 LL_DMA_IsActiveFlag_TE1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF1)==(DMA_LISR_TEIF1)); +} + +/** + * @brief Get Stream 2 transfer error flag. + * @rmtoll LISR TEIF2 LL_DMA_IsActiveFlag_TE2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF2)==(DMA_LISR_TEIF2)); +} + +/** + * @brief Get Stream 3 transfer error flag. + * @rmtoll LISR TEIF3 LL_DMA_IsActiveFlag_TE3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF3)==(DMA_LISR_TEIF3)); +} + +/** + * @brief Get Stream 4 transfer error flag. + * @rmtoll HISR TEIF4 LL_DMA_IsActiveFlag_TE4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF4)==(DMA_HISR_TEIF4)); +} + +/** + * @brief Get Stream 5 transfer error flag. + * @rmtoll HISR TEIF0 LL_DMA_IsActiveFlag_TE5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF5)==(DMA_HISR_TEIF5)); +} + +/** + * @brief Get Stream 6 transfer error flag. + * @rmtoll HISR TEIF6 LL_DMA_IsActiveFlag_TE6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF6)==(DMA_HISR_TEIF6)); +} + +/** + * @brief Get Stream 7 transfer error flag. + * @rmtoll HISR TEIF7 LL_DMA_IsActiveFlag_TE7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF7)==(DMA_HISR_TEIF7)); +} + +/** + * @brief Get Stream 0 direct mode error flag. + * @rmtoll LISR DMEIF0 LL_DMA_IsActiveFlag_DME0 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME0(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF0)==(DMA_LISR_DMEIF0)); +} + +/** + * @brief Get Stream 1 direct mode error flag. + * @rmtoll LISR DMEIF1 LL_DMA_IsActiveFlag_DME1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF1)==(DMA_LISR_DMEIF1)); +} + +/** + * @brief Get Stream 2 direct mode error flag. + * @rmtoll LISR DMEIF2 LL_DMA_IsActiveFlag_DME2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF2)==(DMA_LISR_DMEIF2)); +} + +/** + * @brief Get Stream 3 direct mode error flag. + * @rmtoll LISR DMEIF3 LL_DMA_IsActiveFlag_DME3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF3)==(DMA_LISR_DMEIF3)); +} + +/** + * @brief Get Stream 4 direct mode error flag. + * @rmtoll HISR DMEIF4 LL_DMA_IsActiveFlag_DME4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF4)==(DMA_HISR_DMEIF4)); +} + +/** + * @brief Get Stream 5 direct mode error flag. + * @rmtoll HISR DMEIF0 LL_DMA_IsActiveFlag_DME5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF5)==(DMA_HISR_DMEIF5)); +} + +/** + * @brief Get Stream 6 direct mode error flag. + * @rmtoll HISR DMEIF6 LL_DMA_IsActiveFlag_DME6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF6)==(DMA_HISR_DMEIF6)); +} + +/** + * @brief Get Stream 7 direct mode error flag. + * @rmtoll HISR DMEIF7 LL_DMA_IsActiveFlag_DME7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF7)==(DMA_HISR_DMEIF7)); +} + +/** + * @brief Get Stream 0 FIFO error flag. + * @rmtoll LISR FEIF0 LL_DMA_IsActiveFlag_FE0 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE0(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF0)==(DMA_LISR_FEIF0)); +} + +/** + * @brief Get Stream 1 FIFO error flag. + * @rmtoll LISR FEIF1 LL_DMA_IsActiveFlag_FE1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF1)==(DMA_LISR_FEIF1)); +} + +/** + * @brief Get Stream 2 FIFO error flag. + * @rmtoll LISR FEIF2 LL_DMA_IsActiveFlag_FE2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF2)==(DMA_LISR_FEIF2)); +} + +/** + * @brief Get Stream 3 FIFO error flag. + * @rmtoll LISR FEIF3 LL_DMA_IsActiveFlag_FE3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF3)==(DMA_LISR_FEIF3)); +} + +/** + * @brief Get Stream 4 FIFO error flag. + * @rmtoll HISR FEIF4 LL_DMA_IsActiveFlag_FE4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF4)==(DMA_HISR_FEIF4)); +} + +/** + * @brief Get Stream 5 FIFO error flag. + * @rmtoll HISR FEIF0 LL_DMA_IsActiveFlag_FE5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF5)==(DMA_HISR_FEIF5)); +} + +/** + * @brief Get Stream 6 FIFO error flag. + * @rmtoll HISR FEIF6 LL_DMA_IsActiveFlag_FE6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF6)==(DMA_HISR_FEIF6)); +} + +/** + * @brief Get Stream 7 FIFO error flag. + * @rmtoll HISR FEIF7 LL_DMA_IsActiveFlag_FE7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF7)==(DMA_HISR_FEIF7)); +} + +/** + * @brief Clear Stream 0 half transfer flag. + * @rmtoll LIFCR CHTIF0 LL_DMA_ClearFlag_HT0 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT0(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF0); +} + +/** + * @brief Clear Stream 1 half transfer flag. + * @rmtoll LIFCR CHTIF1 LL_DMA_ClearFlag_HT1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF1); +} + +/** + * @brief Clear Stream 2 half transfer flag. + * @rmtoll LIFCR CHTIF2 LL_DMA_ClearFlag_HT2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF2); +} + +/** + * @brief Clear Stream 3 half transfer flag. + * @rmtoll LIFCR CHTIF3 LL_DMA_ClearFlag_HT3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF3); +} + +/** + * @brief Clear Stream 4 half transfer flag. + * @rmtoll HIFCR CHTIF4 LL_DMA_ClearFlag_HT4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF4); +} + +/** + * @brief Clear Stream 5 half transfer flag. + * @rmtoll HIFCR CHTIF5 LL_DMA_ClearFlag_HT5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF5); +} + +/** + * @brief Clear Stream 6 half transfer flag. + * @rmtoll HIFCR CHTIF6 LL_DMA_ClearFlag_HT6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF6); +} + +/** + * @brief Clear Stream 7 half transfer flag. + * @rmtoll HIFCR CHTIF7 LL_DMA_ClearFlag_HT7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF7); +} + +/** + * @brief Clear Stream 0 transfer complete flag. + * @rmtoll LIFCR CTCIF0 LL_DMA_ClearFlag_TC0 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC0(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF0); +} + +/** + * @brief Clear Stream 1 transfer complete flag. + * @rmtoll LIFCR CTCIF1 LL_DMA_ClearFlag_TC1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF1); +} + +/** + * @brief Clear Stream 2 transfer complete flag. + * @rmtoll LIFCR CTCIF2 LL_DMA_ClearFlag_TC2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF2); +} + +/** + * @brief Clear Stream 3 transfer complete flag. + * @rmtoll LIFCR CTCIF3 LL_DMA_ClearFlag_TC3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF3); +} + +/** + * @brief Clear Stream 4 transfer complete flag. + * @rmtoll HIFCR CTCIF4 LL_DMA_ClearFlag_TC4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF4); +} + +/** + * @brief Clear Stream 5 transfer complete flag. + * @rmtoll HIFCR CTCIF5 LL_DMA_ClearFlag_TC5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF5); +} + +/** + * @brief Clear Stream 6 transfer complete flag. + * @rmtoll HIFCR CTCIF6 LL_DMA_ClearFlag_TC6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF6); +} + +/** + * @brief Clear Stream 7 transfer complete flag. + * @rmtoll HIFCR CTCIF7 LL_DMA_ClearFlag_TC7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF7); +} + +/** + * @brief Clear Stream 0 transfer error flag. + * @rmtoll LIFCR CTEIF0 LL_DMA_ClearFlag_TE0 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE0(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF0); +} + +/** + * @brief Clear Stream 1 transfer error flag. + * @rmtoll LIFCR CTEIF1 LL_DMA_ClearFlag_TE1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF1); +} + +/** + * @brief Clear Stream 2 transfer error flag. + * @rmtoll LIFCR CTEIF2 LL_DMA_ClearFlag_TE2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF2); +} + +/** + * @brief Clear Stream 3 transfer error flag. + * @rmtoll LIFCR CTEIF3 LL_DMA_ClearFlag_TE3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF3); +} + +/** + * @brief Clear Stream 4 transfer error flag. + * @rmtoll HIFCR CTEIF4 LL_DMA_ClearFlag_TE4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF4); +} + +/** + * @brief Clear Stream 5 transfer error flag. + * @rmtoll HIFCR CTEIF5 LL_DMA_ClearFlag_TE5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF5); +} + +/** + * @brief Clear Stream 6 transfer error flag. + * @rmtoll HIFCR CTEIF6 LL_DMA_ClearFlag_TE6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF6); +} + +/** + * @brief Clear Stream 7 transfer error flag. + * @rmtoll HIFCR CTEIF7 LL_DMA_ClearFlag_TE7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF7); +} + +/** + * @brief Clear Stream 0 direct mode error flag. + * @rmtoll LIFCR CDMEIF0 LL_DMA_ClearFlag_DME0 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME0(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF0); +} + +/** + * @brief Clear Stream 1 direct mode error flag. + * @rmtoll LIFCR CDMEIF1 LL_DMA_ClearFlag_DME1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF1); +} + +/** + * @brief Clear Stream 2 direct mode error flag. + * @rmtoll LIFCR CDMEIF2 LL_DMA_ClearFlag_DME2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF2); +} + +/** + * @brief Clear Stream 3 direct mode error flag. + * @rmtoll LIFCR CDMEIF3 LL_DMA_ClearFlag_DME3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF3); +} + +/** + * @brief Clear Stream 4 direct mode error flag. + * @rmtoll HIFCR CDMEIF4 LL_DMA_ClearFlag_DME4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF4); +} + +/** + * @brief Clear Stream 5 direct mode error flag. + * @rmtoll HIFCR CDMEIF5 LL_DMA_ClearFlag_DME5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF5); +} + +/** + * @brief Clear Stream 6 direct mode error flag. + * @rmtoll HIFCR CDMEIF6 LL_DMA_ClearFlag_DME6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF6); +} + +/** + * @brief Clear Stream 7 direct mode error flag. + * @rmtoll HIFCR CDMEIF7 LL_DMA_ClearFlag_DME7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_DME7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF7); +} + +/** + * @brief Clear Stream 0 FIFO error flag. + * @rmtoll LIFCR CFEIF0 LL_DMA_ClearFlag_FE0 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE0(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF0); +} + +/** + * @brief Clear Stream 1 FIFO error flag. + * @rmtoll LIFCR CFEIF1 LL_DMA_ClearFlag_FE1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF1); +} + +/** + * @brief Clear Stream 2 FIFO error flag. + * @rmtoll LIFCR CFEIF2 LL_DMA_ClearFlag_FE2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF2); +} + +/** + * @brief Clear Stream 3 FIFO error flag. + * @rmtoll LIFCR CFEIF3 LL_DMA_ClearFlag_FE3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF3); +} + +/** + * @brief Clear Stream 4 FIFO error flag. + * @rmtoll HIFCR CFEIF4 LL_DMA_ClearFlag_FE4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF4); +} + +/** + * @brief Clear Stream 5 FIFO error flag. + * @rmtoll HIFCR CFEIF5 LL_DMA_ClearFlag_FE5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF5); +} + +/** + * @brief Clear Stream 6 FIFO error flag. + * @rmtoll HIFCR CFEIF6 LL_DMA_ClearFlag_FE6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF6); +} + +/** + * @brief Clear Stream 7 FIFO error flag. + * @rmtoll HIFCR CFEIF7 LL_DMA_ClearFlag_FE7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_FE7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF7); +} + +/** + * @} + */ + +/** @defgroup DMA_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable Half transfer interrupt. + * @rmtoll CR HTIE LL_DMA_EnableIT_HT + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_HT(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE); +} + +/** + * @brief Enable Transfer error interrupt. + * @rmtoll CR TEIE LL_DMA_EnableIT_TE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE); +} + +/** + * @brief Enable Transfer complete interrupt. + * @rmtoll CR TCIE LL_DMA_EnableIT_TC + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE); +} + +/** + * @brief Enable Direct mode error interrupt. + * @rmtoll CR DMEIE LL_DMA_EnableIT_DME + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_DME(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE); +} + +/** + * @brief Enable FIFO error interrupt. + * @rmtoll FCR FEIE LL_DMA_EnableIT_FE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_FE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE); +} + +/** + * @brief Disable Half transfer interrupt. + * @rmtoll CR HTIE LL_DMA_DisableIT_HT + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_HT(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE); +} + +/** + * @brief Disable Transfer error interrupt. + * @rmtoll CR TEIE LL_DMA_DisableIT_TE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE); +} + +/** + * @brief Disable Transfer complete interrupt. + * @rmtoll CR TCIE LL_DMA_DisableIT_TC + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE); +} + +/** + * @brief Disable Direct mode error interrupt. + * @rmtoll CR DMEIE LL_DMA_DisableIT_DME + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_DME(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE); +} + +/** + * @brief Disable FIFO error interrupt. + * @rmtoll FCR FEIE LL_DMA_DisableIT_FE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_FE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE); +} + +/** + * @brief Check if Half transfer interrup is enabled. + * @rmtoll CR HTIE LL_DMA_IsEnabledIT_HT + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_HT(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE) == DMA_SxCR_HTIE); +} + +/** + * @brief Check if Transfer error nterrup is enabled. + * @rmtoll CR TEIE LL_DMA_IsEnabledIT_TE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE) == DMA_SxCR_TEIE); +} + +/** + * @brief Check if Transfer complete interrup is enabled. + * @rmtoll CR TCIE LL_DMA_IsEnabledIT_TC + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE) == DMA_SxCR_TCIE); +} + +/** + * @brief Check if Direct mode error interrupt is enabled. + * @rmtoll CR DMEIE LL_DMA_IsEnabledIT_DME + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_DME(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE) == DMA_SxCR_DMEIE); +} + +/** + * @brief Check if FIFO error interrup is enabled. + * @rmtoll FCR FEIE LL_DMA_IsEnabledIT_FE + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_FE(DMA_TypeDef *DMAx, uint32_t Stream) +{ + return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE) == DMA_SxFCR_FEIE); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Stream, LL_DMA_InitTypeDef *DMA_InitStruct); +uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Stream); +void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct); + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* DMA1 || DMA2 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_DMA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h new file mode 100644 index 0000000..c816e26 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h @@ -0,0 +1,956 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_exti.h + * @author MCD Application Team + * @brief Header file of EXTI LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_EXTI_H +#define __STM32F4xx_LL_EXTI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (EXTI) + +/** @defgroup EXTI_LL EXTI + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private Macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_Private_Macros EXTI Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_ES_INIT EXTI Exported Init structure + * @{ + */ +typedef struct +{ + + uint32_t Line_0_31; /*!< Specifies the EXTI lines to be enabled or disabled for Lines in range 0 to 31 + This parameter can be any combination of @ref EXTI_LL_EC_LINE */ + + FunctionalState LineCommand; /*!< Specifies the new state of the selected EXTI lines. + This parameter can be set either to ENABLE or DISABLE */ + + uint8_t Mode; /*!< Specifies the mode for the EXTI lines. + This parameter can be a value of @ref EXTI_LL_EC_MODE. */ + + uint8_t Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines. + This parameter can be a value of @ref EXTI_LL_EC_TRIGGER. */ +} LL_EXTI_InitTypeDef; + +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Constants EXTI Exported Constants + * @{ + */ + +/** @defgroup EXTI_LL_EC_LINE LINE + * @{ + */ +#define LL_EXTI_LINE_0 EXTI_IMR_IM0 /*!< Extended line 0 */ +#define LL_EXTI_LINE_1 EXTI_IMR_IM1 /*!< Extended line 1 */ +#define LL_EXTI_LINE_2 EXTI_IMR_IM2 /*!< Extended line 2 */ +#define LL_EXTI_LINE_3 EXTI_IMR_IM3 /*!< Extended line 3 */ +#define LL_EXTI_LINE_4 EXTI_IMR_IM4 /*!< Extended line 4 */ +#define LL_EXTI_LINE_5 EXTI_IMR_IM5 /*!< Extended line 5 */ +#define LL_EXTI_LINE_6 EXTI_IMR_IM6 /*!< Extended line 6 */ +#define LL_EXTI_LINE_7 EXTI_IMR_IM7 /*!< Extended line 7 */ +#define LL_EXTI_LINE_8 EXTI_IMR_IM8 /*!< Extended line 8 */ +#define LL_EXTI_LINE_9 EXTI_IMR_IM9 /*!< Extended line 9 */ +#define LL_EXTI_LINE_10 EXTI_IMR_IM10 /*!< Extended line 10 */ +#define LL_EXTI_LINE_11 EXTI_IMR_IM11 /*!< Extended line 11 */ +#define LL_EXTI_LINE_12 EXTI_IMR_IM12 /*!< Extended line 12 */ +#define LL_EXTI_LINE_13 EXTI_IMR_IM13 /*!< Extended line 13 */ +#define LL_EXTI_LINE_14 EXTI_IMR_IM14 /*!< Extended line 14 */ +#define LL_EXTI_LINE_15 EXTI_IMR_IM15 /*!< Extended line 15 */ +#if defined(EXTI_IMR_IM16) +#define LL_EXTI_LINE_16 EXTI_IMR_IM16 /*!< Extended line 16 */ +#endif +#define LL_EXTI_LINE_17 EXTI_IMR_IM17 /*!< Extended line 17 */ +#if defined(EXTI_IMR_IM18) +#define LL_EXTI_LINE_18 EXTI_IMR_IM18 /*!< Extended line 18 */ +#endif +#define LL_EXTI_LINE_19 EXTI_IMR_IM19 /*!< Extended line 19 */ +#if defined(EXTI_IMR_IM20) +#define LL_EXTI_LINE_20 EXTI_IMR_IM20 /*!< Extended line 20 */ +#endif +#if defined(EXTI_IMR_IM21) +#define LL_EXTI_LINE_21 EXTI_IMR_IM21 /*!< Extended line 21 */ +#endif +#if defined(EXTI_IMR_IM22) +#define LL_EXTI_LINE_22 EXTI_IMR_IM22 /*!< Extended line 22 */ +#endif +#if defined(EXTI_IMR_IM23) +#define LL_EXTI_LINE_23 EXTI_IMR_IM23 /*!< Extended line 23 */ +#endif +#if defined(EXTI_IMR_IM24) +#define LL_EXTI_LINE_24 EXTI_IMR_IM24 /*!< Extended line 24 */ +#endif +#if defined(EXTI_IMR_IM25) +#define LL_EXTI_LINE_25 EXTI_IMR_IM25 /*!< Extended line 25 */ +#endif +#if defined(EXTI_IMR_IM26) +#define LL_EXTI_LINE_26 EXTI_IMR_IM26 /*!< Extended line 26 */ +#endif +#if defined(EXTI_IMR_IM27) +#define LL_EXTI_LINE_27 EXTI_IMR_IM27 /*!< Extended line 27 */ +#endif +#if defined(EXTI_IMR_IM28) +#define LL_EXTI_LINE_28 EXTI_IMR_IM28 /*!< Extended line 28 */ +#endif +#if defined(EXTI_IMR_IM29) +#define LL_EXTI_LINE_29 EXTI_IMR_IM29 /*!< Extended line 29 */ +#endif +#if defined(EXTI_IMR_IM30) +#define LL_EXTI_LINE_30 EXTI_IMR_IM30 /*!< Extended line 30 */ +#endif +#if defined(EXTI_IMR_IM31) +#define LL_EXTI_LINE_31 EXTI_IMR_IM31 /*!< Extended line 31 */ +#endif +#define LL_EXTI_LINE_ALL_0_31 EXTI_IMR_IM /*!< All Extended line not reserved*/ + + +#define LL_EXTI_LINE_ALL ((uint32_t)0xFFFFFFFFU) /*!< All Extended line */ + +#if defined(USE_FULL_LL_DRIVER) +#define LL_EXTI_LINE_NONE ((uint32_t)0x00000000U) /*!< None Extended line */ +#endif /*USE_FULL_LL_DRIVER*/ + +/** + * @} + */ +#if defined(USE_FULL_LL_DRIVER) + +/** @defgroup EXTI_LL_EC_MODE Mode + * @{ + */ +#define LL_EXTI_MODE_IT ((uint8_t)0x00U) /*!< Interrupt Mode */ +#define LL_EXTI_MODE_EVENT ((uint8_t)0x01U) /*!< Event Mode */ +#define LL_EXTI_MODE_IT_EVENT ((uint8_t)0x02U) /*!< Interrupt & Event Mode */ +/** + * @} + */ + +/** @defgroup EXTI_LL_EC_TRIGGER Edge Trigger + * @{ + */ +#define LL_EXTI_TRIGGER_NONE ((uint8_t)0x00U) /*!< No Trigger Mode */ +#define LL_EXTI_TRIGGER_RISING ((uint8_t)0x01U) /*!< Trigger Rising Mode */ +#define LL_EXTI_TRIGGER_FALLING ((uint8_t)0x02U) /*!< Trigger Falling Mode */ +#define LL_EXTI_TRIGGER_RISING_FALLING ((uint8_t)0x03U) /*!< Trigger Rising & Falling Mode */ + +/** + * @} + */ + + +#endif /*USE_FULL_LL_DRIVER*/ + + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Macros EXTI Exported Macros + * @{ + */ + +/** @defgroup EXTI_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in EXTI register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_EXTI_WriteReg(__REG__, __VALUE__) WRITE_REG(EXTI->__REG__, (__VALUE__)) + +/** + * @brief Read a value in EXTI register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_EXTI_ReadReg(__REG__) READ_REG(EXTI->__REG__) +/** + * @} + */ + + +/** + * @} + */ + + + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Functions EXTI Exported Functions + * @{ + */ +/** @defgroup EXTI_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Interrupt request for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_EnableIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->IMR, ExtiLine); +} + +/** + * @brief Disable ExtiLine Interrupt request for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_DisableIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->IMR, ExtiLine); +} + + +/** + * @brief Indicate if ExtiLine Interrupt request is enabled for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_IsEnabledIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledIT_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->IMR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Event_Management Event_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Event request for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_EnableEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->EMR, ExtiLine); + +} + + +/** + * @brief Disable ExtiLine Event request for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_DisableEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->EMR, ExtiLine); +} + + +/** + * @brief Indicate if ExtiLine Event request is enabled for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_IsEnabledEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @arg @ref LL_EXTI_LINE_23(*) + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledEvent_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->EMR, ExtiLine) == (ExtiLine)); + +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Rising_Trigger_Management Rising_Trigger_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a rising edge on a configurable interrupt + * line occurs during a write operation in the EXTI_RTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll RTSR RTx LL_EXTI_EnableRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->RTSR, ExtiLine); + +} + + +/** + * @brief Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a rising edge on a configurable interrupt + * line occurs during a write operation in the EXTI_RTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll RTSR RTx LL_EXTI_DisableRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->RTSR, ExtiLine); + +} + + +/** + * @brief Check if rising edge trigger is enabled for Lines in range 0 to 31 + * @rmtoll RTSR RTx LL_EXTI_IsEnabledRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledRisingTrig_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->RTSR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Falling_Trigger_Management Falling_Trigger_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a falling edge on a configurable interrupt + * line occurs during a write operation in the EXTI_FTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll FTSR FTx LL_EXTI_EnableFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->FTSR, ExtiLine); +} + + +/** + * @brief Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a Falling edge on a configurable interrupt + * line occurs during a write operation in the EXTI_FTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for the same interrupt line. + * In this case, both generate a trigger condition. + * @rmtoll FTSR FTx LL_EXTI_DisableFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->FTSR, ExtiLine); +} + + +/** + * @brief Check if falling edge trigger is enabled for Lines in range 0 to 31 + * @rmtoll FTSR FTx LL_EXTI_IsEnabledFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledFallingTrig_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->FTSR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Software_Interrupt_Management Software_Interrupt_Management + * @{ + */ + +/** + * @brief Generate a software Interrupt Event for Lines in range 0 to 31 + * @note If the interrupt is enabled on this line in the EXTI_IMR, writing a 1 to + * this bit when it is at '0' sets the corresponding pending bit in EXTI_PR + * resulting in an interrupt request generation. + * This bit is cleared by clearing the corresponding bit in the EXTI_PR + * register (by writing a 1 into the bit) + * @rmtoll SWIER SWIx LL_EXTI_GenerateSWI_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_GenerateSWI_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->SWIER, ExtiLine); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Flag_Management Flag_Management + * @{ + */ + +/** + * @brief Check if the ExtLine Flag is set or not for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_IsActiveFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->PR, ExtiLine) == (ExtiLine)); +} + + +/** + * @brief Read ExtLine Combination Flag for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_ReadFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval @note This bit is set when the selected edge event arrives on the interrupt + */ +__STATIC_INLINE uint32_t LL_EXTI_ReadFlag_0_31(uint32_t ExtiLine) +{ + return (uint32_t)(READ_BIT(EXTI->PR, ExtiLine)); +} + + +/** + * @brief Clear ExtLine Flags for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_ClearFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19(*) + * @arg @ref LL_EXTI_LINE_20(*) + * @arg @ref LL_EXTI_LINE_21 + * @arg @ref LL_EXTI_LINE_22 + * @note (*): Available in some devices + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine) +{ + WRITE_REG(EXTI->PR, ExtiLine); +} + + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct); +uint32_t LL_EXTI_DeInit(void); +void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct); + + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* EXTI */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_EXTI_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h new file mode 100644 index 0000000..71e7c74 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fmc.h @@ -0,0 +1,1403 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_fmc.h + * @author MCD Application Team + * @brief Header file of FMC HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_FMC_H +#define __STM32F4xx_LL_FMC_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal_def.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup FMC_LL + * @{ + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/* Private types -------------------------------------------------------------*/ +/** @defgroup FMC_LL_Private_Types FMC Private Types + * @{ + */ + +/** + * @brief FMC NORSRAM Configuration Structure definition + */ +typedef struct +{ + uint32_t NSBank; /*!< Specifies the NORSRAM memory device that will be used. + This parameter can be a value of @ref FMC_NORSRAM_Bank */ + + uint32_t DataAddressMux; /*!< Specifies whether the address and data values are + multiplexed on the data bus or not. + This parameter can be a value of @ref FMC_Data_Address_Bus_Multiplexing */ + + uint32_t MemoryType; /*!< Specifies the type of external memory attached to + the corresponding memory device. + This parameter can be a value of @ref FMC_Memory_Type */ + + uint32_t MemoryDataWidth; /*!< Specifies the external memory device width. + This parameter can be a value of @ref FMC_NORSRAM_Data_Width */ + + uint32_t BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory, + valid only with synchronous burst Flash memories. + This parameter can be a value of @ref FMC_Burst_Access_Mode */ + + uint32_t WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing + the Flash memory in burst mode. + This parameter can be a value of @ref FMC_Wait_Signal_Polarity */ + + uint32_t WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash + memory, valid only when accessing Flash memories in burst mode. + This parameter can be a value of @ref FMC_Wrap_Mode + This mode is not available for the STM32F446/467/479xx devices */ + + uint32_t WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one + clock cycle before the wait state or during the wait state, + valid only when accessing memories in burst mode. + This parameter can be a value of @ref FMC_Wait_Timing */ + + uint32_t WriteOperation; /*!< Enables or disables the write operation in the selected device by the FMC. + This parameter can be a value of @ref FMC_Write_Operation */ + + uint32_t WaitSignal; /*!< Enables or disables the wait state insertion via wait + signal, valid for Flash memory access in burst mode. + This parameter can be a value of @ref FMC_Wait_Signal */ + + uint32_t ExtendedMode; /*!< Enables or disables the extended mode. + This parameter can be a value of @ref FMC_Extended_Mode */ + + uint32_t AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers, + valid only with asynchronous Flash memories. + This parameter can be a value of @ref FMC_AsynchronousWait */ + + uint32_t WriteBurst; /*!< Enables or disables the write burst operation. + This parameter can be a value of @ref FMC_Write_Burst */ + + uint32_t ContinuousClock; /*!< Enables or disables the FMC clock output to external memory devices. + This parameter is only enabled through the FMC_BCR1 register, and don't care + through FMC_BCR2..4 registers. + This parameter can be a value of @ref FMC_Continous_Clock */ + + uint32_t WriteFifo; /*!< Enables or disables the write FIFO used by the FMC controller. + This parameter is only enabled through the FMC_BCR1 register, and don't care + through FMC_BCR2..4 registers. + This parameter can be a value of @ref FMC_Write_FIFO + This mode is available only for the STM32F446/469/479xx devices */ + + uint32_t PageSize; /*!< Specifies the memory page size. + This parameter can be a value of @ref FMC_Page_Size */ +}FMC_NORSRAM_InitTypeDef; + +/** + * @brief FMC NORSRAM Timing parameters structure definition + */ +typedef struct +{ + uint32_t AddressSetupTime; /*!< Defines the number of HCLK cycles to configure + the duration of the address setup time. + This parameter can be a value between Min_Data = 0 and Max_Data = 15. + @note This parameter is not used with synchronous NOR Flash memories. */ + + uint32_t AddressHoldTime; /*!< Defines the number of HCLK cycles to configure + the duration of the address hold time. + This parameter can be a value between Min_Data = 1 and Max_Data = 15. + @note This parameter is not used with synchronous NOR Flash memories. */ + + uint32_t DataSetupTime; /*!< Defines the number of HCLK cycles to configure + the duration of the data setup time. + This parameter can be a value between Min_Data = 1 and Max_Data = 255. + @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed + NOR Flash memories. */ + + uint32_t BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure + the duration of the bus turnaround. + This parameter can be a value between Min_Data = 0 and Max_Data = 15. + @note This parameter is only used for multiplexed NOR Flash memories. */ + + uint32_t CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of + HCLK cycles. This parameter can be a value between Min_Data = 2 and Max_Data = 16. + @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM + accesses. */ + + uint32_t DataLatency; /*!< Defines the number of memory clock cycles to issue + to the memory before getting the first data. + The parameter value depends on the memory type as shown below: + - It must be set to 0 in case of a CRAM + - It is don't care in asynchronous NOR, SRAM or ROM accesses + - It may assume a value between Min_Data = 2 and Max_Data = 17 in NOR Flash memories + with synchronous burst mode enable */ + + uint32_t AccessMode; /*!< Specifies the asynchronous access mode. + This parameter can be a value of @ref FMC_Access_Mode */ +}FMC_NORSRAM_TimingTypeDef; + +/** + * @brief FMC NAND Configuration Structure definition + */ +typedef struct +{ + uint32_t NandBank; /*!< Specifies the NAND memory device that will be used. + This parameter can be a value of @ref FMC_NAND_Bank */ + + uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory device. + This parameter can be any value of @ref FMC_Wait_feature */ + + uint32_t MemoryDataWidth; /*!< Specifies the external memory device width. + This parameter can be any value of @ref FMC_NAND_Data_Width */ + + uint32_t EccComputation; /*!< Enables or disables the ECC computation. + This parameter can be any value of @ref FMC_ECC */ + + uint32_t ECCPageSize; /*!< Defines the page size for the extended ECC. + This parameter can be any value of @ref FMC_ECC_Page_Size */ + + uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the + delay between CLE low and RE low. + This parameter can be a value between Min_Data = 0 and Max_Data = 255 */ + + uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the + delay between ALE low and RE low. + This parameter can be a number between Min_Data = 0 and Max_Data = 255 */ +}FMC_NAND_InitTypeDef; + +/** + * @brief FMC NAND/PCCARD Timing parameters structure definition + */ +typedef struct +{ + uint32_t SetupTime; /*!< Defines the number of HCLK cycles to setup address before + the command assertion for NAND-Flash read or write access + to common/Attribute or I/O memory space (depending on + the memory space timing to be configured). + This parameter can be a value between Min_Data = 0 and Max_Data = 255 */ + + uint32_t WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the + command for NAND-Flash read or write access to + common/Attribute or I/O memory space (depending on the + memory space timing to be configured). + This parameter can be a number between Min_Data = 0 and Max_Data = 255 */ + + uint32_t HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address + (and data for write access) after the command de-assertion + for NAND-Flash read or write access to common/Attribute + or I/O memory space (depending on the memory space timing + to be configured). + This parameter can be a number between Min_Data = 0 and Max_Data = 255 */ + + uint32_t HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the + data bus is kept in HiZ after the start of a NAND-Flash + write access to common/Attribute or I/O memory space (depending + on the memory space timing to be configured). + This parameter can be a number between Min_Data = 0 and Max_Data = 255 */ +}FMC_NAND_PCC_TimingTypeDef; + +/** + * @brief FMC NAND Configuration Structure definition + */ +typedef struct +{ + uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the PCCARD Memory device. + This parameter can be any value of @ref FMC_Wait_feature */ + + uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the + delay between CLE low and RE low. + This parameter can be a value between Min_Data = 0 and Max_Data = 255 */ + + uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the + delay between ALE low and RE low. + This parameter can be a number between Min_Data = 0 and Max_Data = 255 */ +}FMC_PCCARD_InitTypeDef; + +/** + * @brief FMC SDRAM Configuration Structure definition + */ +typedef struct +{ + uint32_t SDBank; /*!< Specifies the SDRAM memory device that will be used. + This parameter can be a value of @ref FMC_SDRAM_Bank */ + + uint32_t ColumnBitsNumber; /*!< Defines the number of bits of column address. + This parameter can be a value of @ref FMC_SDRAM_Column_Bits_number. */ + + uint32_t RowBitsNumber; /*!< Defines the number of bits of column address. + This parameter can be a value of @ref FMC_SDRAM_Row_Bits_number. */ + + uint32_t MemoryDataWidth; /*!< Defines the memory device width. + This parameter can be a value of @ref FMC_SDRAM_Memory_Bus_Width. */ + + uint32_t InternalBankNumber; /*!< Defines the number of the device's internal banks. + This parameter can be of @ref FMC_SDRAM_Internal_Banks_Number. */ + + uint32_t CASLatency; /*!< Defines the SDRAM CAS latency in number of memory clock cycles. + This parameter can be a value of @ref FMC_SDRAM_CAS_Latency. */ + + uint32_t WriteProtection; /*!< Enables the SDRAM device to be accessed in write mode. + This parameter can be a value of @ref FMC_SDRAM_Write_Protection. */ + + uint32_t SDClockPeriod; /*!< Define the SDRAM Clock Period for both SDRAM devices and they allow + to disable the clock before changing frequency. + This parameter can be a value of @ref FMC_SDRAM_Clock_Period. */ + + uint32_t ReadBurst; /*!< This bit enable the SDRAM controller to anticipate the next read + commands during the CAS latency and stores data in the Read FIFO. + This parameter can be a value of @ref FMC_SDRAM_Read_Burst. */ + + uint32_t ReadPipeDelay; /*!< Define the delay in system clock cycles on read data path. + This parameter can be a value of @ref FMC_SDRAM_Read_Pipe_Delay. */ +}FMC_SDRAM_InitTypeDef; + +/** + * @brief FMC SDRAM Timing parameters structure definition + */ +typedef struct +{ + uint32_t LoadToActiveDelay; /*!< Defines the delay between a Load Mode Register command and + an active or Refresh command in number of memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t ExitSelfRefreshDelay; /*!< Defines the delay from releasing the self refresh command to + issuing the Activate command in number of memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t SelfRefreshTime; /*!< Defines the minimum Self Refresh period in number of memory clock + cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t RowCycleDelay; /*!< Defines the delay between the Refresh command and the Activate command + and the delay between two consecutive Refresh commands in number of + memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t WriteRecoveryTime; /*!< Defines the Write recovery Time in number of memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t RPDelay; /*!< Defines the delay between a Precharge Command and an other command + in number of memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + + uint32_t RCDDelay; /*!< Defines the delay between the Activate Command and a Read/Write + command in number of memory clock cycles. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ +}FMC_SDRAM_TimingTypeDef; + +/** + * @brief SDRAM command parameters structure definition + */ +typedef struct +{ + uint32_t CommandMode; /*!< Defines the command issued to the SDRAM device. + This parameter can be a value of @ref FMC_SDRAM_Command_Mode. */ + + uint32_t CommandTarget; /*!< Defines which device (1 or 2) the command will be issued to. + This parameter can be a value of @ref FMC_SDRAM_Command_Target. */ + + uint32_t AutoRefreshNumber; /*!< Defines the number of consecutive auto refresh command issued + in auto refresh mode. + This parameter can be a value between Min_Data = 1 and Max_Data = 16 */ + uint32_t ModeRegisterDefinition; /*!< Defines the SDRAM Mode register content */ +}FMC_SDRAM_CommandTypeDef; +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup FMC_LL_Private_Constants FMC Private Constants + * @{ + */ + +/** @defgroup FMC_LL_NOR_SRAM_Controller FMC NOR/SRAM Controller + * @{ + */ +/** @defgroup FMC_NORSRAM_Bank FMC NOR/SRAM Bank + * @{ + */ +#define FMC_NORSRAM_BANK1 0x00000000U +#define FMC_NORSRAM_BANK2 0x00000002U +#define FMC_NORSRAM_BANK3 0x00000004U +#define FMC_NORSRAM_BANK4 0x00000006U +/** + * @} + */ + +/** @defgroup FMC_Data_Address_Bus_Multiplexing FMC Data Address Bus Multiplexing + * @{ + */ +#define FMC_DATA_ADDRESS_MUX_DISABLE 0x00000000U +#define FMC_DATA_ADDRESS_MUX_ENABLE 0x00000002U +/** + * @} + */ + +/** @defgroup FMC_Memory_Type FMC Memory Type + * @{ + */ +#define FMC_MEMORY_TYPE_SRAM 0x00000000U +#define FMC_MEMORY_TYPE_PSRAM 0x00000004U +#define FMC_MEMORY_TYPE_NOR 0x00000008U +/** + * @} + */ + +/** @defgroup FMC_NORSRAM_Data_Width FMC NORSRAM Data Width + * @{ + */ +#define FMC_NORSRAM_MEM_BUS_WIDTH_8 0x00000000U +#define FMC_NORSRAM_MEM_BUS_WIDTH_16 0x00000010U +#define FMC_NORSRAM_MEM_BUS_WIDTH_32 0x00000020U +/** + * @} + */ + +/** @defgroup FMC_NORSRAM_Flash_Access FMC NOR/SRAM Flash Access + * @{ + */ +#define FMC_NORSRAM_FLASH_ACCESS_ENABLE 0x00000040U +#define FMC_NORSRAM_FLASH_ACCESS_DISABLE 0x00000000U +/** + * @} + */ + +/** @defgroup FMC_Burst_Access_Mode FMC Burst Access Mode + * @{ + */ +#define FMC_BURST_ACCESS_MODE_DISABLE 0x00000000U +#define FMC_BURST_ACCESS_MODE_ENABLE 0x00000100U +/** + * @} + */ + +/** @defgroup FMC_Wait_Signal_Polarity FMC Wait Signal Polarity + * @{ + */ +#define FMC_WAIT_SIGNAL_POLARITY_LOW 0x00000000U +#define FMC_WAIT_SIGNAL_POLARITY_HIGH 0x00000200U +/** + * @} + */ + +/** @defgroup FMC_Wrap_Mode FMC Wrap Mode + * @{ + */ +/** @note This mode is not available for the STM32F446/469/479xx devices + */ +#define FMC_WRAP_MODE_DISABLE 0x00000000U +#define FMC_WRAP_MODE_ENABLE 0x00000400U +/** + * @} + */ + +/** @defgroup FMC_Wait_Timing FMC Wait Timing + * @{ + */ +#define FMC_WAIT_TIMING_BEFORE_WS 0x00000000U +#define FMC_WAIT_TIMING_DURING_WS 0x00000800U +/** + * @} + */ + +/** @defgroup FMC_Write_Operation FMC Write Operation + * @{ + */ +#define FMC_WRITE_OPERATION_DISABLE 0x00000000U +#define FMC_WRITE_OPERATION_ENABLE 0x00001000U +/** + * @} + */ + +/** @defgroup FMC_Wait_Signal FMC Wait Signal + * @{ + */ +#define FMC_WAIT_SIGNAL_DISABLE 0x00000000U +#define FMC_WAIT_SIGNAL_ENABLE 0x00002000U +/** + * @} + */ + +/** @defgroup FMC_Extended_Mode FMC Extended Mode + * @{ + */ +#define FMC_EXTENDED_MODE_DISABLE 0x00000000U +#define FMC_EXTENDED_MODE_ENABLE 0x00004000U +/** + * @} + */ + +/** @defgroup FMC_AsynchronousWait FMC Asynchronous Wait + * @{ + */ +#define FMC_ASYNCHRONOUS_WAIT_DISABLE 0x00000000U +#define FMC_ASYNCHRONOUS_WAIT_ENABLE 0x00008000U +/** + * @} + */ + +/** @defgroup FMC_Page_Size FMC Page Size + * @{ + */ +#define FMC_PAGE_SIZE_NONE 0x00000000U +#define FMC_PAGE_SIZE_128 ((uint32_t)FMC_BCR1_CPSIZE_0) +#define FMC_PAGE_SIZE_256 ((uint32_t)FMC_BCR1_CPSIZE_1) +#define FMC_PAGE_SIZE_512 ((uint32_t)(FMC_BCR1_CPSIZE_0 | FMC_BCR1_CPSIZE_1)) +#define FMC_PAGE_SIZE_1024 ((uint32_t)FMC_BCR1_CPSIZE_2) +/** + * @} + */ + +/** @defgroup FMC_Write_FIFO FMC Write FIFO + * @note These values are available only for the STM32F446/469/479xx devices. + * @{ + */ +#define FMC_WRITE_FIFO_DISABLE ((uint32_t)FMC_BCR1_WFDIS) +#define FMC_WRITE_FIFO_ENABLE 0x00000000U +/** + * @} + */ + +/** @defgroup FMC_Write_Burst FMC Write Burst + * @{ + */ +#define FMC_WRITE_BURST_DISABLE 0x00000000U +#define FMC_WRITE_BURST_ENABLE 0x00080000U +/** + * @} + */ + +/** @defgroup FMC_Continous_Clock FMC Continuous Clock + * @{ + */ +#define FMC_CONTINUOUS_CLOCK_SYNC_ONLY 0x00000000U +#define FMC_CONTINUOUS_CLOCK_SYNC_ASYNC 0x00100000U +/** + * @} + */ + +/** @defgroup FMC_Access_Mode FMC Access Mode + * @{ + */ +#define FMC_ACCESS_MODE_A 0x00000000U +#define FMC_ACCESS_MODE_B 0x10000000U +#define FMC_ACCESS_MODE_C 0x20000000U +#define FMC_ACCESS_MODE_D 0x30000000U +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup FMC_LL_NAND_Controller FMC NAND Controller + * @{ + */ +/** @defgroup FMC_NAND_Bank FMC NAND Bank + * @{ + */ +#define FMC_NAND_BANK2 0x00000010U +#define FMC_NAND_BANK3 0x00000100U +/** + * @} + */ + +/** @defgroup FMC_Wait_feature FMC Wait feature + * @{ + */ +#define FMC_NAND_PCC_WAIT_FEATURE_DISABLE 0x00000000U +#define FMC_NAND_PCC_WAIT_FEATURE_ENABLE 0x00000002U +/** + * @} + */ + +/** @defgroup FMC_PCR_Memory_Type FMC PCR Memory Type + * @{ + */ +#define FMC_PCR_MEMORY_TYPE_PCCARD 0x00000000U +#define FMC_PCR_MEMORY_TYPE_NAND 0x00000008U +/** + * @} + */ + +/** @defgroup FMC_NAND_Data_Width FMC NAND Data Width + * @{ + */ +#define FMC_NAND_PCC_MEM_BUS_WIDTH_8 0x00000000U +#define FMC_NAND_PCC_MEM_BUS_WIDTH_16 0x00000010U +/** + * @} + */ + +/** @defgroup FMC_ECC FMC ECC + * @{ + */ +#define FMC_NAND_ECC_DISABLE 0x00000000U +#define FMC_NAND_ECC_ENABLE 0x00000040U +/** + * @} + */ + +/** @defgroup FMC_ECC_Page_Size FMC ECC Page Size + * @{ + */ +#define FMC_NAND_ECC_PAGE_SIZE_256BYTE 0x00000000U +#define FMC_NAND_ECC_PAGE_SIZE_512BYTE 0x00020000U +#define FMC_NAND_ECC_PAGE_SIZE_1024BYTE 0x00040000U +#define FMC_NAND_ECC_PAGE_SIZE_2048BYTE 0x00060000U +#define FMC_NAND_ECC_PAGE_SIZE_4096BYTE 0x00080000U +#define FMC_NAND_ECC_PAGE_SIZE_8192BYTE 0x000A0000U +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup FMC_LL_SDRAM_Controller FMC SDRAM Controller + * @{ + */ +/** @defgroup FMC_SDRAM_Bank FMC SDRAM Bank + * @{ + */ +#define FMC_SDRAM_BANK1 0x00000000U +#define FMC_SDRAM_BANK2 0x00000001U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Column_Bits_number FMC SDRAM Column Bits number + * @{ + */ +#define FMC_SDRAM_COLUMN_BITS_NUM_8 0x00000000U +#define FMC_SDRAM_COLUMN_BITS_NUM_9 0x00000001U +#define FMC_SDRAM_COLUMN_BITS_NUM_10 0x00000002U +#define FMC_SDRAM_COLUMN_BITS_NUM_11 0x00000003U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Row_Bits_number FMC SDRAM Row Bits number + * @{ + */ +#define FMC_SDRAM_ROW_BITS_NUM_11 0x00000000U +#define FMC_SDRAM_ROW_BITS_NUM_12 0x00000004U +#define FMC_SDRAM_ROW_BITS_NUM_13 0x00000008U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Memory_Bus_Width FMC SDRAM Memory Bus Width + * @{ + */ +#define FMC_SDRAM_MEM_BUS_WIDTH_8 0x00000000U +#define FMC_SDRAM_MEM_BUS_WIDTH_16 0x00000010U +#define FMC_SDRAM_MEM_BUS_WIDTH_32 0x00000020U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Internal_Banks_Number FMC SDRAM Internal Banks Number + * @{ + */ +#define FMC_SDRAM_INTERN_BANKS_NUM_2 0x00000000U +#define FMC_SDRAM_INTERN_BANKS_NUM_4 0x00000040U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_CAS_Latency FMC SDRAM CAS Latency + * @{ + */ +#define FMC_SDRAM_CAS_LATENCY_1 0x00000080U +#define FMC_SDRAM_CAS_LATENCY_2 0x00000100U +#define FMC_SDRAM_CAS_LATENCY_3 0x00000180U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Write_Protection FMC SDRAM Write Protection + * @{ + */ +#define FMC_SDRAM_WRITE_PROTECTION_DISABLE 0x00000000U +#define FMC_SDRAM_WRITE_PROTECTION_ENABLE 0x00000200U + +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Clock_Period FMC SDRAM Clock Period + * @{ + */ +#define FMC_SDRAM_CLOCK_DISABLE 0x00000000U +#define FMC_SDRAM_CLOCK_PERIOD_2 0x00000800U +#define FMC_SDRAM_CLOCK_PERIOD_3 0x00000C00U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Read_Burst FMC SDRAM Read Burst + * @{ + */ +#define FMC_SDRAM_RBURST_DISABLE 0x00000000U +#define FMC_SDRAM_RBURST_ENABLE 0x00001000U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Read_Pipe_Delay FMC SDRAM Read Pipe Delay + * @{ + */ +#define FMC_SDRAM_RPIPE_DELAY_0 0x00000000U +#define FMC_SDRAM_RPIPE_DELAY_1 0x00002000U +#define FMC_SDRAM_RPIPE_DELAY_2 0x00004000U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Command_Mode FMC SDRAM Command Mode + * @{ + */ +#define FMC_SDRAM_CMD_NORMAL_MODE 0x00000000U +#define FMC_SDRAM_CMD_CLK_ENABLE 0x00000001U +#define FMC_SDRAM_CMD_PALL 0x00000002U +#define FMC_SDRAM_CMD_AUTOREFRESH_MODE 0x00000003U +#define FMC_SDRAM_CMD_LOAD_MODE 0x00000004U +#define FMC_SDRAM_CMD_SELFREFRESH_MODE 0x00000005U +#define FMC_SDRAM_CMD_POWERDOWN_MODE 0x00000006U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Command_Target FMC SDRAM Command Target + * @{ + */ +#define FMC_SDRAM_CMD_TARGET_BANK2 FMC_SDCMR_CTB2 +#define FMC_SDRAM_CMD_TARGET_BANK1 FMC_SDCMR_CTB1 +#define FMC_SDRAM_CMD_TARGET_BANK1_2 0x00000018U +/** + * @} + */ + +/** @defgroup FMC_SDRAM_Mode_Status FMC SDRAM Mode Status + * @{ + */ +#define FMC_SDRAM_NORMAL_MODE 0x00000000U +#define FMC_SDRAM_SELF_REFRESH_MODE FMC_SDSR_MODES1_0 +#define FMC_SDRAM_POWER_DOWN_MODE FMC_SDSR_MODES1_1 +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup FMC_LL_Interrupt_definition FMC Interrupt definition + * @{ + */ +#define FMC_IT_RISING_EDGE 0x00000008U +#define FMC_IT_LEVEL 0x00000010U +#define FMC_IT_FALLING_EDGE 0x00000020U +#define FMC_IT_REFRESH_ERROR 0x00004000U +/** + * @} + */ + +/** @defgroup FMC_LL_Flag_definition FMC Flag definition + * @{ + */ +#define FMC_FLAG_RISING_EDGE 0x00000001U +#define FMC_FLAG_LEVEL 0x00000002U +#define FMC_FLAG_FALLING_EDGE 0x00000004U +#define FMC_FLAG_FEMPT 0x00000040U +#define FMC_SDRAM_FLAG_REFRESH_IT FMC_SDSR_RE +#define FMC_SDRAM_FLAG_BUSY FMC_SDSR_BUSY +#define FMC_SDRAM_FLAG_REFRESH_ERROR FMC_SDRTR_CRE +/** + * @} + */ + +/** @defgroup FMC_LL_Alias_definition FMC Alias definition + * @{ + */ +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + #define FMC_NAND_TypeDef FMC_Bank3_TypeDef +#else + #define FMC_NAND_TypeDef FMC_Bank2_3_TypeDef + #define FMC_PCCARD_TypeDef FMC_Bank4_TypeDef +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ + #define FMC_NORSRAM_TypeDef FMC_Bank1_TypeDef + #define FMC_NORSRAM_EXTENDED_TypeDef FMC_Bank1E_TypeDef + #define FMC_SDRAM_TypeDef FMC_Bank5_6_TypeDef + + +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + #define FMC_NAND_DEVICE FMC_Bank3 +#else + #define FMC_NAND_DEVICE FMC_Bank2_3 + #define FMC_PCCARD_DEVICE FMC_Bank4 +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ + #define FMC_NORSRAM_DEVICE FMC_Bank1 + #define FMC_NORSRAM_EXTENDED_DEVICE FMC_Bank1E + #define FMC_SDRAM_DEVICE FMC_Bank5_6 +/** + * @} + */ + +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup FMC_LL_Private_Macros FMC Private Macros + * @{ + */ + +/** @defgroup FMC_LL_NOR_Macros FMC NOR/SRAM Macros + * @brief macros to handle NOR device enable/disable and read/write operations + * @{ + */ +/** + * @brief Enable the NORSRAM device access. + * @param __INSTANCE__ FMC_NORSRAM Instance + * @param __BANK__ FMC_NORSRAM Bank + * @retval None + */ +#define __FMC_NORSRAM_ENABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] |= FMC_BCR1_MBKEN) + +/** + * @brief Disable the NORSRAM device access. + * @param __INSTANCE__ FMC_NORSRAM Instance + * @param __BANK__ FMC_NORSRAM Bank + * @retval None + */ +#define __FMC_NORSRAM_DISABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] &= ~FMC_BCR1_MBKEN) +/** + * @} + */ + +/** @defgroup FMC_LL_NAND_Macros FMC NAND Macros + * @brief macros to handle NAND device enable/disable + * @{ + */ +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Enable the NAND device access. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @retval None + */ +#define __FMC_NAND_ENABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->PCR |= FMC_PCR_PBKEN) + +/** + * @brief Disable the NAND device access. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @retval None + */ +#define __FMC_NAND_DISABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->PCR &= ~FMC_PCR_PBKEN) +#else /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ +/** + * @brief Enable the NAND device access. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @retval None + */ +#define __FMC_NAND_ENABLE(__INSTANCE__, __BANK__) (((__BANK__) == FMC_NAND_BANK2)? ((__INSTANCE__)->PCR2 |= FMC_PCR2_PBKEN): \ + ((__INSTANCE__)->PCR3 |= FMC_PCR3_PBKEN)) + +/** + * @brief Disable the NAND device access. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @retval None + */ +#define __FMC_NAND_DISABLE(__INSTANCE__, __BANK__) (((__BANK__) == FMC_NAND_BANK2)? ((__INSTANCE__)->PCR2 &= ~FMC_PCR2_PBKEN): \ + ((__INSTANCE__)->PCR3 &= ~FMC_PCR3_PBKEN)) + +#endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) */ +/** + * @} + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** @defgroup FMC_LL_PCCARD_Macros FMC PCCARD Macros + * @brief macros to handle SRAM read/write operations + * @{ + */ +/** + * @brief Enable the PCCARD device access. + * @param __INSTANCE__ FMC_PCCARD Instance + * @retval None + */ +#define __FMC_PCCARD_ENABLE(__INSTANCE__) ((__INSTANCE__)->PCR4 |= FMC_PCR4_PBKEN) + +/** + * @brief Disable the PCCARD device access. + * @param __INSTANCE__ FMC_PCCARD Instance + * @retval None + */ +#define __FMC_PCCARD_DISABLE(__INSTANCE__) ((__INSTANCE__)->PCR4 &= ~FMC_PCR4_PBKEN) +/** + * @} + */ +#endif /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ + +/** @defgroup FMC_LL_Flag_Interrupt_Macros FMC Flag&Interrupt Macros + * @brief macros to handle FMC flags and interrupts + * @{ + */ +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Enable the NAND device interrupt. + * @param __INSTANCE__ FMC_NAND instance + * @param __BANK__ FMC_NAND Bank + * @param __INTERRUPT__ FMC_NAND interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_NAND_ENABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) ((__INSTANCE__)->SR |= (__INTERRUPT__)) + +/** + * @brief Disable the NAND device interrupt. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __INTERRUPT__ FMC_NAND interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_NAND_DISABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) ((__INSTANCE__)->SR &= ~(__INTERRUPT__)) + +/** + * @brief Get flag status of the NAND device. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __FLAG__ FMC_NAND flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __FMC_NAND_GET_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__INSTANCE__)->SR &(__FLAG__)) == (__FLAG__)) +/** + * @brief Clear flag status of the NAND device. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __FLAG__ FMC_NAND flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval None + */ +#define __FMC_NAND_CLEAR_FLAG(__INSTANCE__, __BANK__, __FLAG__) ((__INSTANCE__)->SR &= ~(__FLAG__)) +#else /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ +/** + * @brief Enable the NAND device interrupt. + * @param __INSTANCE__ FMC_NAND instance + * @param __BANK__ FMC_NAND Bank + * @param __INTERRUPT__ FMC_NAND interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_NAND_ENABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FMC_NAND_BANK2)? ((__INSTANCE__)->SR2 |= (__INTERRUPT__)): \ + ((__INSTANCE__)->SR3 |= (__INTERRUPT__))) + +/** + * @brief Disable the NAND device interrupt. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __INTERRUPT__ FMC_NAND interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_NAND_DISABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FMC_NAND_BANK2)? ((__INSTANCE__)->SR2 &= ~(__INTERRUPT__)): \ + ((__INSTANCE__)->SR3 &= ~(__INTERRUPT__))) + +/** + * @brief Get flag status of the NAND device. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __FLAG__ FMC_NAND flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __FMC_NAND_GET_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FMC_NAND_BANK2)? (((__INSTANCE__)->SR2 &(__FLAG__)) == (__FLAG__)): \ + (((__INSTANCE__)->SR3 &(__FLAG__)) == (__FLAG__))) +/** + * @brief Clear flag status of the NAND device. + * @param __INSTANCE__ FMC_NAND Instance + * @param __BANK__ FMC_NAND Bank + * @param __FLAG__ FMC_NAND flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval None + */ +#define __FMC_NAND_CLEAR_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FMC_NAND_BANK2)? ((__INSTANCE__)->SR2 &= ~(__FLAG__)): \ + ((__INSTANCE__)->SR3 &= ~(__FLAG__))) +#endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** + * @brief Enable the PCCARD device interrupt. + * @param __INSTANCE__ FMC_PCCARD instance + * @param __INTERRUPT__ FMC_PCCARD interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_PCCARD_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR4 |= (__INTERRUPT__)) + +/** + * @brief Disable the PCCARD device interrupt. + * @param __INSTANCE__ FMC_PCCARD instance + * @param __INTERRUPT__ FMC_PCCARD interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_RISING_EDGE: Interrupt rising edge. + * @arg FMC_IT_LEVEL: Interrupt level. + * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge. + * @retval None + */ +#define __FMC_PCCARD_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR4 &= ~(__INTERRUPT__)) + +/** + * @brief Get flag status of the PCCARD device. + * @param __INSTANCE__ FMC_PCCARD instance + * @param __FLAG__ FMC_PCCARD flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __FMC_PCCARD_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->SR4 &(__FLAG__)) == (__FLAG__)) + +/** + * @brief Clear flag status of the PCCARD device. + * @param __INSTANCE__ FMC_PCCARD instance + * @param __FLAG__ FMC_PCCARD flag + * This parameter can be any combination of the following values: + * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag. + * @arg FMC_FLAG_LEVEL: Interrupt level edge flag. + * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag. + * @arg FMC_FLAG_FEMPT: FIFO empty flag. + * @retval None + */ +#define __FMC_PCCARD_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->SR4 &= ~(__FLAG__)) +#endif /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ + +/** + * @brief Enable the SDRAM device interrupt. + * @param __INSTANCE__ FMC_SDRAM instance + * @param __INTERRUPT__ FMC_SDRAM interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_REFRESH_ERROR: Interrupt refresh error + * @retval None + */ +#define __FMC_SDRAM_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SDRTR |= (__INTERRUPT__)) + +/** + * @brief Disable the SDRAM device interrupt. + * @param __INSTANCE__ FMC_SDRAM instance + * @param __INTERRUPT__ FMC_SDRAM interrupt + * This parameter can be any combination of the following values: + * @arg FMC_IT_REFRESH_ERROR: Interrupt refresh error + * @retval None + */ +#define __FMC_SDRAM_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SDRTR &= ~(__INTERRUPT__)) + +/** + * @brief Get flag status of the SDRAM device. + * @param __INSTANCE__ FMC_SDRAM instance + * @param __FLAG__ FMC_SDRAM flag + * This parameter can be any combination of the following values: + * @arg FMC_SDRAM_FLAG_REFRESH_IT: Interrupt refresh error. + * @arg FMC_SDRAM_FLAG_BUSY: SDRAM busy flag. + * @arg FMC_SDRAM_FLAG_REFRESH_ERROR: Refresh error flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __FMC_SDRAM_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->SDSR &(__FLAG__)) == (__FLAG__)) + +/** + * @brief Clear flag status of the SDRAM device. + * @param __INSTANCE__ FMC_SDRAM instance + * @param __FLAG__ FMC_SDRAM flag + * This parameter can be any combination of the following values: + * @arg FMC_SDRAM_FLAG_REFRESH_ERROR + * @retval None + */ +#define __FMC_SDRAM_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->SDRTR |= (__FLAG__)) +/** + * @} + */ + +/** @defgroup FSMC_LL_Assert_Macros FSMC Assert Macros + * @{ + */ +#define IS_FMC_NORSRAM_BANK(BANK) (((BANK) == FMC_NORSRAM_BANK1) || \ + ((BANK) == FMC_NORSRAM_BANK2) || \ + ((BANK) == FMC_NORSRAM_BANK3) || \ + ((BANK) == FMC_NORSRAM_BANK4)) + +#define IS_FMC_MUX(__MUX__) (((__MUX__) == FMC_DATA_ADDRESS_MUX_DISABLE) || \ + ((__MUX__) == FMC_DATA_ADDRESS_MUX_ENABLE)) + +#define IS_FMC_MEMORY(__MEMORY__) (((__MEMORY__) == FMC_MEMORY_TYPE_SRAM) || \ + ((__MEMORY__) == FMC_MEMORY_TYPE_PSRAM)|| \ + ((__MEMORY__) == FMC_MEMORY_TYPE_NOR)) + +#define IS_FMC_NORSRAM_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_8) || \ + ((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_16) || \ + ((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_32)) + +#define IS_FMC_ACCESS_MODE(__MODE__) (((__MODE__) == FMC_ACCESS_MODE_A) || \ + ((__MODE__) == FMC_ACCESS_MODE_B) || \ + ((__MODE__) == FMC_ACCESS_MODE_C) || \ + ((__MODE__) == FMC_ACCESS_MODE_D)) + +#define IS_FMC_NAND_BANK(BANK) (((BANK) == FMC_NAND_BANK2) || \ + ((BANK) == FMC_NAND_BANK3)) + +#define IS_FMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FMC_NAND_PCC_WAIT_FEATURE_DISABLE) || \ + ((FEATURE) == FMC_NAND_PCC_WAIT_FEATURE_ENABLE)) + +#define IS_FMC_NAND_MEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_NAND_PCC_MEM_BUS_WIDTH_8) || \ + ((WIDTH) == FMC_NAND_PCC_MEM_BUS_WIDTH_16)) + +#define IS_FMC_ECC_STATE(STATE) (((STATE) == FMC_NAND_ECC_DISABLE) || \ + ((STATE) == FMC_NAND_ECC_ENABLE)) + +#define IS_FMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FMC_NAND_ECC_PAGE_SIZE_256BYTE) || \ + ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_512BYTE) || \ + ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_1024BYTE) || \ + ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_2048BYTE) || \ + ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_4096BYTE) || \ + ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_8192BYTE)) + +#define IS_FMC_TCLR_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_TAR_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_SETUP_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_WAIT_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_HOLD_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_HIZ_TIME(TIME) ((TIME) <= 255U) + +#define IS_FMC_NORSRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NORSRAM_DEVICE) + +#define IS_FMC_NORSRAM_EXTENDED_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NORSRAM_EXTENDED_DEVICE) + +#define IS_FMC_NAND_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NAND_DEVICE) + +#define IS_FMC_PCCARD_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_PCCARD_DEVICE) + +#define IS_FMC_BURSTMODE(__STATE__) (((__STATE__) == FMC_BURST_ACCESS_MODE_DISABLE) || \ + ((__STATE__) == FMC_BURST_ACCESS_MODE_ENABLE)) + +#define IS_FMC_WAIT_POLARITY(__POLARITY__) (((__POLARITY__) == FMC_WAIT_SIGNAL_POLARITY_LOW) || \ + ((__POLARITY__) == FMC_WAIT_SIGNAL_POLARITY_HIGH)) + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +#define IS_FMC_WRAP_MODE(__MODE__) (((__MODE__) == FMC_WRAP_MODE_DISABLE) || \ + ((__MODE__) == FMC_WRAP_MODE_ENABLE)) +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + +#define IS_FMC_WAIT_SIGNAL_ACTIVE(__ACTIVE__) (((__ACTIVE__) == FMC_WAIT_TIMING_BEFORE_WS) || \ + ((__ACTIVE__) == FMC_WAIT_TIMING_DURING_WS)) + +#define IS_FMC_WRITE_OPERATION(__OPERATION__) (((__OPERATION__) == FMC_WRITE_OPERATION_DISABLE) || \ + ((__OPERATION__) == FMC_WRITE_OPERATION_ENABLE)) + +#define IS_FMC_WAITE_SIGNAL(__SIGNAL__) (((__SIGNAL__) == FMC_WAIT_SIGNAL_DISABLE) || \ + ((__SIGNAL__) == FMC_WAIT_SIGNAL_ENABLE)) + +#define IS_FMC_EXTENDED_MODE(__MODE__) (((__MODE__) == FMC_EXTENDED_MODE_DISABLE) || \ + ((__MODE__) == FMC_EXTENDED_MODE_ENABLE)) + +#define IS_FMC_ASYNWAIT(__STATE__) (((__STATE__) == FMC_ASYNCHRONOUS_WAIT_DISABLE) || \ + ((__STATE__) == FMC_ASYNCHRONOUS_WAIT_ENABLE)) + +#define IS_FMC_WRITE_BURST(__BURST__) (((__BURST__) == FMC_WRITE_BURST_DISABLE) || \ + ((__BURST__) == FMC_WRITE_BURST_ENABLE)) + +#define IS_FMC_CONTINOUS_CLOCK(CCLOCK) (((CCLOCK) == FMC_CONTINUOUS_CLOCK_SYNC_ONLY) || \ + ((CCLOCK) == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC)) + +#define IS_FMC_ADDRESS_SETUP_TIME(__TIME__) ((__TIME__) <= 15U) + +#define IS_FMC_ADDRESS_HOLD_TIME(__TIME__) (((__TIME__) > 0U) && ((__TIME__) <= 15U)) + +#define IS_FMC_DATASETUP_TIME(__TIME__) (((__TIME__) > 0U) && ((__TIME__) <= 255U)) + +#define IS_FMC_TURNAROUND_TIME(__TIME__) ((__TIME__) <= 15U) + +#define IS_FMC_DATA_LATENCY(__LATENCY__) (((__LATENCY__) > 1U) && ((__LATENCY__) <= 17U)) + +#define IS_FMC_CLK_DIV(DIV) (((DIV) > 1U) && ((DIV) <= 16U)) + +#define IS_FMC_SDRAM_BANK(BANK) (((BANK) == FMC_SDRAM_BANK1) || \ + ((BANK) == FMC_SDRAM_BANK2)) + +#define IS_FMC_COLUMNBITS_NUMBER(COLUMN) (((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_8) || \ + ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_9) || \ + ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_10) || \ + ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_11)) + +#define IS_FMC_ROWBITS_NUMBER(ROW) (((ROW) == FMC_SDRAM_ROW_BITS_NUM_11) || \ + ((ROW) == FMC_SDRAM_ROW_BITS_NUM_12) || \ + ((ROW) == FMC_SDRAM_ROW_BITS_NUM_13)) + +#define IS_FMC_SDMEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_8) || \ + ((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_16) || \ + ((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_32)) + +#define IS_FMC_INTERNALBANK_NUMBER(NUMBER) (((NUMBER) == FMC_SDRAM_INTERN_BANKS_NUM_2) || \ + ((NUMBER) == FMC_SDRAM_INTERN_BANKS_NUM_4)) + + +#define IS_FMC_CAS_LATENCY(LATENCY) (((LATENCY) == FMC_SDRAM_CAS_LATENCY_1) || \ + ((LATENCY) == FMC_SDRAM_CAS_LATENCY_2) || \ + ((LATENCY) == FMC_SDRAM_CAS_LATENCY_3)) + +#define IS_FMC_SDCLOCK_PERIOD(PERIOD) (((PERIOD) == FMC_SDRAM_CLOCK_DISABLE) || \ + ((PERIOD) == FMC_SDRAM_CLOCK_PERIOD_2) || \ + ((PERIOD) == FMC_SDRAM_CLOCK_PERIOD_3)) + +#define IS_FMC_READ_BURST(RBURST) (((RBURST) == FMC_SDRAM_RBURST_DISABLE) || \ + ((RBURST) == FMC_SDRAM_RBURST_ENABLE)) + + +#define IS_FMC_READPIPE_DELAY(DELAY) (((DELAY) == FMC_SDRAM_RPIPE_DELAY_0) || \ + ((DELAY) == FMC_SDRAM_RPIPE_DELAY_1) || \ + ((DELAY) == FMC_SDRAM_RPIPE_DELAY_2)) + +#define IS_FMC_LOADTOACTIVE_DELAY(DELAY) (((DELAY) > 0U) && ((DELAY) <= 16U)) + +#define IS_FMC_EXITSELFREFRESH_DELAY(DELAY) (((DELAY) > 0U) && ((DELAY) <= 16U)) + +#define IS_FMC_SELFREFRESH_TIME(TIME) (((TIME) > 0U) && ((TIME) <= 16U)) + +#define IS_FMC_ROWCYCLE_DELAY(DELAY) (((DELAY) > 0U) && ((DELAY) <= 16U)) + +#define IS_FMC_WRITE_RECOVERY_TIME(TIME) (((TIME) > 0U) && ((TIME) <= 16U)) + +#define IS_FMC_RP_DELAY(DELAY) (((DELAY) > 0U) && ((DELAY) <= 16U)) + +#define IS_FMC_RCD_DELAY(DELAY) (((DELAY) > 0U) && ((DELAY) <= 16U)) + +#define IS_FMC_COMMAND_MODE(COMMAND) (((COMMAND) == FMC_SDRAM_CMD_NORMAL_MODE) || \ + ((COMMAND) == FMC_SDRAM_CMD_CLK_ENABLE) || \ + ((COMMAND) == FMC_SDRAM_CMD_PALL) || \ + ((COMMAND) == FMC_SDRAM_CMD_AUTOREFRESH_MODE) || \ + ((COMMAND) == FMC_SDRAM_CMD_LOAD_MODE) || \ + ((COMMAND) == FMC_SDRAM_CMD_SELFREFRESH_MODE) || \ + ((COMMAND) == FMC_SDRAM_CMD_POWERDOWN_MODE)) + +#define IS_FMC_COMMAND_TARGET(TARGET) (((TARGET) == FMC_SDRAM_CMD_TARGET_BANK1) || \ + ((TARGET) == FMC_SDRAM_CMD_TARGET_BANK2) || \ + ((TARGET) == FMC_SDRAM_CMD_TARGET_BANK1_2)) + +#define IS_FMC_AUTOREFRESH_NUMBER(NUMBER) (((NUMBER) > 0U) && ((NUMBER) <= 16U)) + +#define IS_FMC_MODE_REGISTER(CONTENT) ((CONTENT) <= 8191U) + +#define IS_FMC_REFRESH_RATE(RATE) ((RATE) <= 8191U) + +#define IS_FMC_SDRAM_DEVICE(INSTANCE) ((INSTANCE) == FMC_SDRAM_DEVICE) + +#define IS_FMC_WRITE_PROTECTION(WRITE) (((WRITE) == FMC_SDRAM_WRITE_PROTECTION_DISABLE) || \ + ((WRITE) == FMC_SDRAM_WRITE_PROTECTION_ENABLE)) + +#define IS_FMC_PAGESIZE(SIZE) (((SIZE) == FMC_PAGE_SIZE_NONE) || \ + ((SIZE) == FMC_PAGE_SIZE_128) || \ + ((SIZE) == FMC_PAGE_SIZE_256) || \ + ((SIZE) == FMC_PAGE_SIZE_512) || \ + ((SIZE) == FMC_PAGE_SIZE_1024)) + +#if defined (STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +#define IS_FMC_WRITE_FIFO(FIFO) (((FIFO) == FMC_WRITE_FIFO_DISABLE) || \ + ((FIFO) == FMC_WRITE_FIFO_ENABLE)) +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ + +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup FMC_LL_Private_Functions FMC LL Private Functions + * @{ + */ + +/** @defgroup FMC_LL_NORSRAM NOR SRAM + * @{ + */ +/** @defgroup FMC_LL_NORSRAM_Private_Functions_Group1 NOR SRAM Initialization/de-initialization functions + * @{ + */ +HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef *Init); +HAL_StatusTypeDef FMC_NORSRAM_Timing_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank); +HAL_StatusTypeDef FMC_NORSRAM_Extended_Timing_Init(FMC_NORSRAM_EXTENDED_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode); +HAL_StatusTypeDef FMC_NORSRAM_DeInit(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank); +/** + * @} + */ + +/** @defgroup FMC_LL_NORSRAM_Private_Functions_Group2 NOR SRAM Control functions + * @{ + */ +HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Enable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank); +HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Disable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank); +/** + * @} + */ +/** + * @} + */ + +/** @defgroup FMC_LL_NAND NAND + * @{ + */ +/** @defgroup FMC_LL_NAND_Private_Functions_Group1 NAND Initialization/de-initialization functions + * @{ + */ +HAL_StatusTypeDef FMC_NAND_Init(FMC_NAND_TypeDef *Device, FMC_NAND_InitTypeDef *Init); +HAL_StatusTypeDef FMC_NAND_CommonSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank); +HAL_StatusTypeDef FMC_NAND_AttributeSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank); +HAL_StatusTypeDef FMC_NAND_DeInit(FMC_NAND_TypeDef *Device, uint32_t Bank); +/** + * @} + */ + +/** @defgroup FMC_LL_NAND_Private_Functions_Group2 NAND Control functions + * @{ + */ +HAL_StatusTypeDef FMC_NAND_ECC_Enable(FMC_NAND_TypeDef *Device, uint32_t Bank); +HAL_StatusTypeDef FMC_NAND_ECC_Disable(FMC_NAND_TypeDef *Device, uint32_t Bank); +HAL_StatusTypeDef FMC_NAND_GetECC(FMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout); + +/** + * @} + */ +/** + * @} + */ +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** @defgroup FMC_LL_PCCARD PCCARD + * @{ + */ +/** @defgroup FMC_LL_PCCARD_Private_Functions_Group1 PCCARD Initialization/de-initialization functions + * @{ + */ +HAL_StatusTypeDef FMC_PCCARD_Init(FMC_PCCARD_TypeDef *Device, FMC_PCCARD_InitTypeDef *Init); +HAL_StatusTypeDef FMC_PCCARD_CommonSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing); +HAL_StatusTypeDef FMC_PCCARD_AttributeSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing); +HAL_StatusTypeDef FMC_PCCARD_IOSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing); +HAL_StatusTypeDef FMC_PCCARD_DeInit(FMC_PCCARD_TypeDef *Device); +/** + * @} + */ +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + +/** @defgroup FMC_LL_SDRAM SDRAM + * @{ + */ +/** @defgroup FMC_LL_SDRAM_Private_Functions_Group1 SDRAM Initialization/de-initialization functions + * @{ + */ +HAL_StatusTypeDef FMC_SDRAM_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_InitTypeDef *Init); +HAL_StatusTypeDef FMC_SDRAM_Timing_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_TimingTypeDef *Timing, uint32_t Bank); +HAL_StatusTypeDef FMC_SDRAM_DeInit(FMC_SDRAM_TypeDef *Device, uint32_t Bank); +/** + * @} + */ + +/** @defgroup FMC_LL_SDRAM_Private_Functions_Group2 SDRAM Control functions + * @{ + */ +HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Enable(FMC_SDRAM_TypeDef *Device, uint32_t Bank); +HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Disable(FMC_SDRAM_TypeDef *Device, uint32_t Bank); +HAL_StatusTypeDef FMC_SDRAM_SendCommand(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout); +HAL_StatusTypeDef FMC_SDRAM_ProgramRefreshRate(FMC_SDRAM_TypeDef *Device, uint32_t RefreshRate); +HAL_StatusTypeDef FMC_SDRAM_SetAutoRefreshNumber(FMC_SDRAM_TypeDef *Device, uint32_t AutoRefreshNumber); +uint32_t FMC_SDRAM_GetModeStatus(FMC_SDRAM_TypeDef *Device, uint32_t Bank); +/** + * @} + */ +/** + * @} + */ + +/** + * @} + */ + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_FMC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h new file mode 100644 index 0000000..3f1b3a1 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h @@ -0,0 +1,982 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_gpio.h + * @author MCD Application Team + * @brief Header file of GPIO LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_GPIO_H +#define __STM32F4xx_LL_GPIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) + +/** @defgroup GPIO_LL GPIO + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_Private_Macros GPIO Private Macros + * @{ + */ + +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures + * @{ + */ + +/** + * @brief LL GPIO Init Structure definition + */ +typedef struct +{ + uint32_t Pin; /*!< Specifies the GPIO pins to be configured. + This parameter can be any value of @ref GPIO_LL_EC_PIN */ + + uint32_t Mode; /*!< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_MODE. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/ + + uint32_t Speed; /*!< Specifies the speed for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_SPEED. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/ + + uint32_t OutputType; /*!< Specifies the operating output type for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_OUTPUT. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/ + + uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_PULL. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/ + + uint32_t Alternate; /*!< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_AF. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/ +} LL_GPIO_InitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_LL_EC_PIN PIN + * @{ + */ +#define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */ +#define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */ +#define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */ +#define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */ +#define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */ +#define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */ +#define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */ +#define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */ +#define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */ +#define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */ +#define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */ +#define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */ +#define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */ +#define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */ +#define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */ +#define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */ +#define LL_GPIO_PIN_ALL (GPIO_BSRR_BS_0 | GPIO_BSRR_BS_1 | GPIO_BSRR_BS_2 | \ + GPIO_BSRR_BS_3 | GPIO_BSRR_BS_4 | GPIO_BSRR_BS_5 | \ + GPIO_BSRR_BS_6 | GPIO_BSRR_BS_7 | GPIO_BSRR_BS_8 | \ + GPIO_BSRR_BS_9 | GPIO_BSRR_BS_10 | GPIO_BSRR_BS_11 | \ + GPIO_BSRR_BS_12 | GPIO_BSRR_BS_13 | GPIO_BSRR_BS_14 | \ + GPIO_BSRR_BS_15) /*!< Select all pins */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_MODE Mode + * @{ + */ +#define LL_GPIO_MODE_INPUT (0x00000000U) /*!< Select input mode */ +#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */ +#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */ +#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_OUTPUT Output Type + * @{ + */ +#define LL_GPIO_OUTPUT_PUSHPULL (0x00000000U) /*!< Select push-pull as output type */ +#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_SPEED Output Speed + * @{ + */ +#define LL_GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Select I/O low output speed */ +#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */ +#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */ +#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down + * @{ + */ +#define LL_GPIO_PULL_NO (0x00000000U) /*!< Select I/O no pull */ +#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */ +#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_AF Alternate Function + * @{ + */ +#define LL_GPIO_AF_0 (0x0000000U) /*!< Select alternate function 0 */ +#define LL_GPIO_AF_1 (0x0000001U) /*!< Select alternate function 1 */ +#define LL_GPIO_AF_2 (0x0000002U) /*!< Select alternate function 2 */ +#define LL_GPIO_AF_3 (0x0000003U) /*!< Select alternate function 3 */ +#define LL_GPIO_AF_4 (0x0000004U) /*!< Select alternate function 4 */ +#define LL_GPIO_AF_5 (0x0000005U) /*!< Select alternate function 5 */ +#define LL_GPIO_AF_6 (0x0000006U) /*!< Select alternate function 6 */ +#define LL_GPIO_AF_7 (0x0000007U) /*!< Select alternate function 7 */ +#define LL_GPIO_AF_8 (0x0000008U) /*!< Select alternate function 8 */ +#define LL_GPIO_AF_9 (0x0000009U) /*!< Select alternate function 9 */ +#define LL_GPIO_AF_10 (0x000000AU) /*!< Select alternate function 10 */ +#define LL_GPIO_AF_11 (0x000000BU) /*!< Select alternate function 11 */ +#define LL_GPIO_AF_12 (0x000000CU) /*!< Select alternate function 12 */ +#define LL_GPIO_AF_13 (0x000000DU) /*!< Select alternate function 13 */ +#define LL_GPIO_AF_14 (0x000000EU) /*!< Select alternate function 14 */ +#define LL_GPIO_AF_15 (0x000000FU) /*!< Select alternate function 15 */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in GPIO register + * @param __INSTANCE__ GPIO Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in GPIO register + * @param __INSTANCE__ GPIO Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions + * @{ + */ + +/** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration + * @{ + */ + +/** + * @brief Configure gpio mode for a dedicated pin on dedicated port. + * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll MODER MODEy LL_GPIO_SetPinMode + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + * @arg @ref LL_GPIO_MODE_ALTERNATE + * @arg @ref LL_GPIO_MODE_ANALOG + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) +{ + MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); +} + +/** + * @brief Return gpio mode for a dedicated pin on dedicated port. + * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll MODER MODEy LL_GPIO_GetPinMode + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + * @arg @ref LL_GPIO_MODE_ALTERNATE + * @arg @ref LL_GPIO_MODE_ANALOG + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->MODER, + (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); +} + +/** + * @brief Configure gpio output type for several pins on dedicated port. + * @note Output type as to be set when gpio pin is in output or + * alternate modes. Possible type are Push-pull or Open-drain. + * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @param OutputType This parameter can be one of the following values: + * @arg @ref LL_GPIO_OUTPUT_PUSHPULL + * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType) +{ + MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType)); +} + +/** + * @brief Return gpio output type for several pins on dedicated port. + * @note Output type as to be set when gpio pin is in output or + * alternate modes. Possible type are Push-pull or Open-drain. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_OUTPUT_PUSHPULL + * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) >> POSITION_VAL(Pin)); +} + +/** + * @brief Configure gpio speed for a dedicated pin on dedicated port. + * @note I/O speed can be Low, Medium, Fast or High speed. + * @note Warning: only one pin can be passed as parameter. + * @note Refer to datasheet for frequency specifications and the power + * supply and load conditions for each speed. + * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Speed This parameter can be one of the following values: + * @arg @ref LL_GPIO_SPEED_FREQ_LOW + * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM + * @arg @ref LL_GPIO_SPEED_FREQ_HIGH + * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) +{ + MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)), + (Speed << (POSITION_VAL(Pin) * 2U))); +} + +/** + * @brief Return gpio speed for a dedicated pin on dedicated port. + * @note I/O speed can be Low, Medium, Fast or High speed. + * @note Warning: only one pin can be passed as parameter. + * @note Refer to datasheet for frequency specifications and the power + * supply and load conditions for each speed. + * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_SPEED_FREQ_LOW + * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM + * @arg @ref LL_GPIO_SPEED_FREQ_HIGH + * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, + (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); +} + +/** + * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Pull This parameter can be one of the following values: + * @arg @ref LL_GPIO_PULL_NO + * @arg @ref LL_GPIO_PULL_UP + * @arg @ref LL_GPIO_PULL_DOWN + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) +{ + MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); +} + +/** + * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port + * @note Warning: only one pin can be passed as parameter. + * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_PULL_NO + * @arg @ref LL_GPIO_PULL_UP + * @arg @ref LL_GPIO_PULL_DOWN + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->PUPDR, + (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); +} + +/** + * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7 + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @param Alternate This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_0 + * @arg @ref LL_GPIO_AF_1 + * @arg @ref LL_GPIO_AF_2 + * @arg @ref LL_GPIO_AF_3 + * @arg @ref LL_GPIO_AF_4 + * @arg @ref LL_GPIO_AF_5 + * @arg @ref LL_GPIO_AF_6 + * @arg @ref LL_GPIO_AF_7 + * @arg @ref LL_GPIO_AF_8 + * @arg @ref LL_GPIO_AF_9 + * @arg @ref LL_GPIO_AF_10 + * @arg @ref LL_GPIO_AF_11 + * @arg @ref LL_GPIO_AF_12 + * @arg @ref LL_GPIO_AF_13 + * @arg @ref LL_GPIO_AF_14 + * @arg @ref LL_GPIO_AF_15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) +{ + MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)), + (Alternate << (POSITION_VAL(Pin) * 4U))); +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. + * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7 + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_AF_0 + * @arg @ref LL_GPIO_AF_1 + * @arg @ref LL_GPIO_AF_2 + * @arg @ref LL_GPIO_AF_3 + * @arg @ref LL_GPIO_AF_4 + * @arg @ref LL_GPIO_AF_5 + * @arg @ref LL_GPIO_AF_6 + * @arg @ref LL_GPIO_AF_7 + * @arg @ref LL_GPIO_AF_8 + * @arg @ref LL_GPIO_AF_9 + * @arg @ref LL_GPIO_AF_10 + * @arg @ref LL_GPIO_AF_11 + * @arg @ref LL_GPIO_AF_12 + * @arg @ref LL_GPIO_AF_13 + * @arg @ref LL_GPIO_AF_14 + * @arg @ref LL_GPIO_AF_15 + */ +__STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->AFR[0], + (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); +} + +/** + * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15 + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Alternate This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_0 + * @arg @ref LL_GPIO_AF_1 + * @arg @ref LL_GPIO_AF_2 + * @arg @ref LL_GPIO_AF_3 + * @arg @ref LL_GPIO_AF_4 + * @arg @ref LL_GPIO_AF_5 + * @arg @ref LL_GPIO_AF_6 + * @arg @ref LL_GPIO_AF_7 + * @arg @ref LL_GPIO_AF_8 + * @arg @ref LL_GPIO_AF_9 + * @arg @ref LL_GPIO_AF_10 + * @arg @ref LL_GPIO_AF_11 + * @arg @ref LL_GPIO_AF_12 + * @arg @ref LL_GPIO_AF_13 + * @arg @ref LL_GPIO_AF_14 + * @arg @ref LL_GPIO_AF_15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) +{ + MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)), + (Alternate << (POSITION_VAL(Pin >> 8U) * 4U))); +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15 + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_AF_0 + * @arg @ref LL_GPIO_AF_1 + * @arg @ref LL_GPIO_AF_2 + * @arg @ref LL_GPIO_AF_3 + * @arg @ref LL_GPIO_AF_4 + * @arg @ref LL_GPIO_AF_5 + * @arg @ref LL_GPIO_AF_6 + * @arg @ref LL_GPIO_AF_7 + * @arg @ref LL_GPIO_AF_8 + * @arg @ref LL_GPIO_AF_9 + * @arg @ref LL_GPIO_AF_10 + * @arg @ref LL_GPIO_AF_11 + * @arg @ref LL_GPIO_AF_12 + * @arg @ref LL_GPIO_AF_13 + * @arg @ref LL_GPIO_AF_14 + * @arg @ref LL_GPIO_AF_15 + */ +__STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (uint32_t)(READ_BIT(GPIOx->AFR[1], + (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U))) >> (POSITION_VAL(Pin >> 8U) * 4U)); +} + + +/** + * @brief Lock configuration of several pins for a dedicated port. + * @note When the lock sequence has been applied on a port bit, the + * value of this port bit can no longer be modified until the + * next reset. + * @note Each lock bit freezes a specific configuration register + * (control and alternate function registers). + * @rmtoll LCKR LCKK LL_GPIO_LockPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + __IO uint32_t temp; + WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask); + WRITE_REG(GPIOx->LCKR, PinMask); + WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask); + temp = READ_REG(GPIOx->LCKR); + (void) temp; +} + +/** + * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0. + * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->LCKR, PinMask) == (PinMask)); +} + +/** + * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0. + * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked + * @param GPIOx GPIO Port + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx) +{ + return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)); +} + +/** + * @} + */ + +/** @defgroup GPIO_LL_EF_Data_Access Data Access + * @{ + */ + +/** + * @brief Return full input data register value for a dedicated port. + * @rmtoll IDR IDy LL_GPIO_ReadInputPort + * @param GPIOx GPIO Port + * @retval Input data register value of port + */ +__STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx) +{ + return (uint32_t)(READ_REG(GPIOx->IDR)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * @rmtoll IDR IDy LL_GPIO_IsInputPinSet + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->IDR, PinMask) == (PinMask)); +} + +/** + * @brief Write output data register for the port. + * @rmtoll ODR ODy LL_GPIO_WriteOutputPort + * @param GPIOx GPIO Port + * @param PortValue Level value for each pin of the port + * @retval None + */ +__STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue) +{ + WRITE_REG(GPIOx->ODR, PortValue); +} + +/** + * @brief Return full output data register value for a dedicated port. + * @rmtoll ODR ODy LL_GPIO_ReadOutputPort + * @param GPIOx GPIO Port + * @retval Output data register value of port + */ +__STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx) +{ + return (uint32_t)(READ_REG(GPIOx->ODR)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->ODR, PinMask) == (PinMask)); +} + +/** + * @brief Set several pins to high level on dedicated gpio port. + * @rmtoll BSRR BSy LL_GPIO_SetOutputPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + WRITE_REG(GPIOx->BSRR, PinMask); +} + +/** + * @brief Set several pins to low level on dedicated gpio port. + * @rmtoll BSRR BRy LL_GPIO_ResetOutputPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + WRITE_REG(GPIOx->BSRR, (PinMask << 16)); +} + +/** + * @brief Toggle data value for several pin of dedicated port. + * @rmtoll ODR ODy LL_GPIO_TogglePin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx); +ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct); +void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct); + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) */ +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_GPIO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h new file mode 100644 index 0000000..03b8706 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h @@ -0,0 +1,989 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_pwr.h + * @author MCD Application Team + * @brief Header file of PWR LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_PWR_H +#define __STM32F4xx_LL_PWR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined(PWR) + +/** @defgroup PWR_LL PWR + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines + * @brief Flags defines which can be used with LL_PWR_WriteReg function + * @{ + */ +#define LL_PWR_CR_CSBF PWR_CR_CSBF /*!< Clear standby flag */ +#define LL_PWR_CR_CWUF PWR_CR_CWUF /*!< Clear wakeup flag */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_PWR_ReadReg function + * @{ + */ +#define LL_PWR_CSR_WUF PWR_CSR_WUF /*!< Wakeup flag */ +#define LL_PWR_CSR_SBF PWR_CSR_SBF /*!< Standby flag */ +#define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */ +#define LL_PWR_CSR_VOS PWR_CSR_VOSRDY /*!< Voltage scaling select flag */ +#if defined(PWR_CSR_EWUP) +#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP /*!< Enable WKUP pin */ +#elif defined(PWR_CSR_EWUP1) +#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP1 /*!< Enable WKUP pin 1 */ +#endif /* PWR_CSR_EWUP */ +#if defined(PWR_CSR_EWUP2) +#define LL_PWR_CSR_EWUP2 PWR_CSR_EWUP2 /*!< Enable WKUP pin 2 */ +#endif /* PWR_CSR_EWUP2 */ +#if defined(PWR_CSR_EWUP3) +#define LL_PWR_CSR_EWUP3 PWR_CSR_EWUP3 /*!< Enable WKUP pin 3 */ +#endif /* PWR_CSR_EWUP3 */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_REGU_VOLTAGE Regulator Voltage + * @{ + */ +#if defined(PWR_CR_VOS_0) +#define LL_PWR_REGU_VOLTAGE_SCALE3 (PWR_CR_VOS_0) +#define LL_PWR_REGU_VOLTAGE_SCALE2 (PWR_CR_VOS_1) +#define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS_0 | PWR_CR_VOS_1) /* The SCALE1 is not available for STM32F401xx devices */ +#else +#define LL_PWR_REGU_VOLTAGE_SCALE1 (PWR_CR_VOS) +#define LL_PWR_REGU_VOLTAGE_SCALE2 0x00000000U +#endif /* PWR_CR_VOS_0 */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_MODE_PWR Mode Power + * @{ + */ +#define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */ +#define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */ +#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS) +#define LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (PWR_CR_MRUDS | PWR_CR_FPDS) /*!< Enter Stop mode (with main Regulator in under-drive mode) when the CPU enters deepsleep */ +#define LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (PWR_CR_LPDS | PWR_CR_LPUDS | PWR_CR_FPDS) /*!< Enter Stop mode (with low power Regulator in under-drive mode) when the CPU enters deepsleep */ +#endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */ +#if defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS) +#define LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (PWR_CR_MRLVDS | PWR_CR_FPDS) /*!< Enter Stop mode (with main Regulator in Deep Sleep mode) when the CPU enters deepsleep */ +#define LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (PWR_CR_LPDS | PWR_CR_LPLVDS | PWR_CR_FPDS) /*!< Enter Stop mode (with low power Regulator in Deep Sleep mode) when the CPU enters deepsleep */ +#endif /* PWR_CR_MRLVDS && PWR_CR_LPLVDS && PWR_CR_FPDS */ +#define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode + * @{ + */ +#define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */ +#define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level + * @{ + */ +#define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold detected by PVD 2.2 V */ +#define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold detected by PVD 2.3 V */ +#define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold detected by PVD 2.4 V */ +#define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold detected by PVD 2.5 V */ +#define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold detected by PVD 2.6 V */ +#define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold detected by PVD 2.7 V */ +#define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold detected by PVD 2.8 V */ +#define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold detected by PVD 2.9 V */ +/** + * @} + */ +/** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins + * @{ + */ +#if defined(PWR_CSR_EWUP) +#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP) /*!< WKUP pin : PA0 */ +#endif /* PWR_CSR_EWUP */ +#if defined(PWR_CSR_EWUP1) +#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP1) /*!< WKUP pin 1 : PA0 */ +#endif /* PWR_CSR_EWUP1 */ +#if defined(PWR_CSR_EWUP2) +#define LL_PWR_WAKEUP_PIN2 (PWR_CSR_EWUP2) /*!< WKUP pin 2 : PC0 or PC13 according to device */ +#endif /* PWR_CSR_EWUP2 */ +#if defined(PWR_CSR_EWUP3) +#define LL_PWR_WAKEUP_PIN3 (PWR_CSR_EWUP3) /*!< WKUP pin 3 : PC1 */ +#endif /* PWR_CSR_EWUP3 */ +/** + * @} + */ + +/** + * @} + */ + + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Macros PWR Exported Macros + * @{ + */ + +/** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in PWR register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__)) + +/** + * @brief Read a value in PWR register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__) +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @defgroup PWR_LL_EF_Configuration Configuration + * @{ + */ +#if defined(PWR_CR_FISSR) +/** + * @brief Enable FLASH interface STOP while system Run is ON + * @rmtoll CR FISSR LL_PWR_EnableFLASHInterfaceSTOP + * @note This mode is enabled only with STOP low power mode. + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableFLASHInterfaceSTOP(void) +{ + SET_BIT(PWR->CR, PWR_CR_FISSR); +} + +/** + * @brief Disable FLASH Interface STOP while system Run is ON + * @rmtoll CR FISSR LL_PWR_DisableFLASHInterfaceSTOP + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableFLASHInterfaceSTOP(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_FISSR); +} + +/** + * @brief Check if FLASH Interface STOP while system Run feature is enabled + * @rmtoll CR FISSR LL_PWR_IsEnabledFLASHInterfaceSTOP + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHInterfaceSTOP(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_FISSR) == (PWR_CR_FISSR)); +} +#endif /* PWR_CR_FISSR */ + +#if defined(PWR_CR_FMSSR) +/** + * @brief Enable FLASH Memory STOP while system Run is ON + * @rmtoll CR FMSSR LL_PWR_EnableFLASHMemorySTOP + * @note This mode is enabled only with STOP low power mode. + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableFLASHMemorySTOP(void) +{ + SET_BIT(PWR->CR, PWR_CR_FMSSR); +} + +/** + * @brief Disable FLASH Memory STOP while system Run is ON + * @rmtoll CR FMSSR LL_PWR_DisableFLASHMemorySTOP + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableFLASHMemorySTOP(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_FMSSR); +} + +/** + * @brief Check if FLASH Memory STOP while system Run feature is enabled + * @rmtoll CR FMSSR LL_PWR_IsEnabledFLASHMemorySTOP + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledFLASHMemorySTOP(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_FMSSR) == (PWR_CR_FMSSR)); +} +#endif /* PWR_CR_FMSSR */ +#if defined(PWR_CR_UDEN) +/** + * @brief Enable Under Drive Mode + * @rmtoll CR UDEN LL_PWR_EnableUnderDriveMode + * @note This mode is enabled only with STOP low power mode. + * In this mode, the 1.2V domain is preserved in reduced leakage mode. This + * mode is only available when the main Regulator or the low power Regulator + * is in low voltage mode. + * @note If the Under-drive mode was enabled, it is automatically disabled after + * exiting Stop mode. + * When the voltage Regulator operates in Under-drive mode, an additional + * startup delay is induced when waking up from Stop mode. + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableUnderDriveMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_UDEN); +} + +/** + * @brief Disable Under Drive Mode + * @rmtoll CR UDEN LL_PWR_DisableUnderDriveMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableUnderDriveMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_UDEN); +} + +/** + * @brief Check if Under Drive Mode is enabled + * @rmtoll CR UDEN LL_PWR_IsEnabledUnderDriveMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledUnderDriveMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_UDEN) == (PWR_CR_UDEN)); +} +#endif /* PWR_CR_UDEN */ + +#if defined(PWR_CR_ODSWEN) +/** + * @brief Enable Over drive switching + * @rmtoll CR ODSWEN LL_PWR_EnableOverDriveSwitching + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableOverDriveSwitching(void) +{ + SET_BIT(PWR->CR, PWR_CR_ODSWEN); +} + +/** + * @brief Disable Over drive switching + * @rmtoll CR ODSWEN LL_PWR_DisableOverDriveSwitching + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableOverDriveSwitching(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_ODSWEN); +} + +/** + * @brief Check if Over drive switching is enabled + * @rmtoll CR ODSWEN LL_PWR_IsEnabledOverDriveSwitching + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveSwitching(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_ODSWEN) == (PWR_CR_ODSWEN)); +} +#endif /* PWR_CR_ODSWEN */ +#if defined(PWR_CR_ODEN) +/** + * @brief Enable Over drive Mode + * @rmtoll CR ODEN LL_PWR_EnableOverDriveMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableOverDriveMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_ODEN); +} + +/** + * @brief Disable Over drive Mode + * @rmtoll CR ODEN LL_PWR_DisableOverDriveMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableOverDriveMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_ODEN); +} + +/** + * @brief Check if Over drive switching is enabled + * @rmtoll CR ODEN LL_PWR_IsEnabledOverDriveMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledOverDriveMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_ODEN) == (PWR_CR_ODEN)); +} +#endif /* PWR_CR_ODEN */ +#if defined(PWR_CR_MRUDS) +/** + * @brief Enable Main Regulator in deepsleep under-drive Mode + * @rmtoll CR MRUDS LL_PWR_EnableMainRegulatorDeepSleepUDMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableMainRegulatorDeepSleepUDMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_MRUDS); +} + +/** + * @brief Disable Main Regulator in deepsleep under-drive Mode + * @rmtoll CR MRUDS LL_PWR_DisableMainRegulatorDeepSleepUDMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableMainRegulatorDeepSleepUDMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_MRUDS); +} + +/** + * @brief Check if Main Regulator in deepsleep under-drive Mode is enabled + * @rmtoll CR MRUDS LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorDeepSleepUDMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_MRUDS) == (PWR_CR_MRUDS)); +} +#endif /* PWR_CR_MRUDS */ + +#if defined(PWR_CR_LPUDS) +/** + * @brief Enable Low Power Regulator in deepsleep under-drive Mode + * @rmtoll CR LPUDS LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorDeepSleepUDMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_LPUDS); +} + +/** + * @brief Disable Low Power Regulator in deepsleep under-drive Mode + * @rmtoll CR LPUDS LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorDeepSleepUDMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_LPUDS); +} + +/** + * @brief Check if Low Power Regulator in deepsleep under-drive Mode is enabled + * @rmtoll CR LPUDS LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorDeepSleepUDMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_LPUDS) == (PWR_CR_LPUDS)); +} +#endif /* PWR_CR_LPUDS */ + +#if defined(PWR_CR_MRLVDS) +/** + * @brief Enable Main Regulator low voltage Mode + * @rmtoll CR MRLVDS LL_PWR_EnableMainRegulatorLowVoltageMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableMainRegulatorLowVoltageMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_MRLVDS); +} + +/** + * @brief Disable Main Regulator low voltage Mode + * @rmtoll CR MRLVDS LL_PWR_DisableMainRegulatorLowVoltageMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableMainRegulatorLowVoltageMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_MRLVDS); +} + +/** + * @brief Check if Main Regulator low voltage Mode is enabled + * @rmtoll CR MRLVDS LL_PWR_IsEnabledMainRegulatorLowVoltageMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledMainRegulatorLowVoltageMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_MRLVDS) == (PWR_CR_MRLVDS)); +} +#endif /* PWR_CR_MRLVDS */ + +#if defined(PWR_CR_LPLVDS) +/** + * @brief Enable Low Power Regulator low voltage Mode + * @rmtoll CR LPLVDS LL_PWR_EnableLowPowerRegulatorLowVoltageMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableLowPowerRegulatorLowVoltageMode(void) +{ + SET_BIT(PWR->CR, PWR_CR_LPLVDS); +} + +/** + * @brief Disable Low Power Regulator low voltage Mode + * @rmtoll CR LPLVDS LL_PWR_DisableLowPowerRegulatorLowVoltageMode + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableLowPowerRegulatorLowVoltageMode(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_LPLVDS); +} + +/** + * @brief Check if Low Power Regulator low voltage Mode is enabled + * @rmtoll CR LPLVDS LL_PWR_IsEnabledLowPowerRegulatorLowVoltageMode + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledLowPowerRegulatorLowVoltageMode(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_LPLVDS) == (PWR_CR_LPLVDS)); +} +#endif /* PWR_CR_LPLVDS */ +/** + * @brief Set the main internal Regulator output voltage + * @rmtoll CR VOS LL_PWR_SetRegulVoltageScaling + * @param VoltageScaling This parameter can be one of the following values: + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1 (*) + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2 + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3 + * (*) LL_PWR_REGU_VOLTAGE_SCALE1 is not available for STM32F401xx devices + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetRegulVoltageScaling(uint32_t VoltageScaling) +{ + MODIFY_REG(PWR->CR, PWR_CR_VOS, VoltageScaling); +} + +/** + * @brief Get the main internal Regulator output voltage + * @rmtoll CR VOS LL_PWR_GetRegulVoltageScaling + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE1 (*) + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE2 + * @arg @ref LL_PWR_REGU_VOLTAGE_SCALE3 + * (*) LL_PWR_REGU_VOLTAGE_SCALE1 is not available for STM32F401xx devices + */ +__STATIC_INLINE uint32_t LL_PWR_GetRegulVoltageScaling(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_VOS)); +} +/** + * @brief Enable the Flash Power Down in Stop Mode + * @rmtoll CR FPDS LL_PWR_EnableFlashPowerDown + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableFlashPowerDown(void) +{ + SET_BIT(PWR->CR, PWR_CR_FPDS); +} + +/** + * @brief Disable the Flash Power Down in Stop Mode + * @rmtoll CR FPDS LL_PWR_DisableFlashPowerDown + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableFlashPowerDown(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_FPDS); +} + +/** + * @brief Check if the Flash Power Down in Stop Mode is enabled + * @rmtoll CR FPDS LL_PWR_IsEnabledFlashPowerDown + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledFlashPowerDown(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_FPDS) == (PWR_CR_FPDS)); +} + +/** + * @brief Enable access to the backup domain + * @rmtoll CR DBP LL_PWR_EnableBkUpAccess + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableBkUpAccess(void) +{ + SET_BIT(PWR->CR, PWR_CR_DBP); +} + +/** + * @brief Disable access to the backup domain + * @rmtoll CR DBP LL_PWR_DisableBkUpAccess + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableBkUpAccess(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_DBP); +} + +/** + * @brief Check if the backup domain is enabled + * @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP)); +} +/** + * @brief Enable the backup Regulator + * @rmtoll CSR BRE LL_PWR_EnableBkUpRegulator + * @note The BRE bit of the PWR_CSR register is protected against parasitic write access. + * The LL_PWR_EnableBkUpAccess() must be called before using this API. + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableBkUpRegulator(void) +{ + SET_BIT(PWR->CSR, PWR_CSR_BRE); +} + +/** + * @brief Disable the backup Regulator + * @rmtoll CSR BRE LL_PWR_DisableBkUpRegulator + * @note The BRE bit of the PWR_CSR register is protected against parasitic write access. + * The LL_PWR_EnableBkUpAccess() must be called before using this API. + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableBkUpRegulator(void) +{ + CLEAR_BIT(PWR->CSR, PWR_CSR_BRE); +} + +/** + * @brief Check if the backup Regulator is enabled + * @rmtoll CSR BRE LL_PWR_IsEnabledBkUpRegulator + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpRegulator(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_BRE) == (PWR_CSR_BRE)); +} + +/** + * @brief Set voltage Regulator mode during deep sleep mode + * @rmtoll CR LPDS LL_PWR_SetRegulModeDS + * @param RegulMode This parameter can be one of the following values: + * @arg @ref LL_PWR_REGU_DSMODE_MAIN + * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode) +{ + MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode); +} + +/** + * @brief Get voltage Regulator mode during deep sleep mode + * @rmtoll CR LPDS LL_PWR_GetRegulModeDS + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_REGU_DSMODE_MAIN + * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER + */ +__STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS)); +} + +/** + * @brief Set Power Down mode when CPU enters deepsleep + * @rmtoll CR PDDS LL_PWR_SetPowerMode\n + * @rmtoll CR MRUDS LL_PWR_SetPowerMode\n + * @rmtoll CR LPUDS LL_PWR_SetPowerMode\n + * @rmtoll CR FPDS LL_PWR_SetPowerMode\n + * @rmtoll CR MRLVDS LL_PWR_SetPowerMode\n + * @rmtoll CR LPlVDS LL_PWR_SetPowerMode\n + * @rmtoll CR FPDS LL_PWR_SetPowerMode\n + * @rmtoll CR LPDS LL_PWR_SetPowerMode + * @param PDMode This parameter can be one of the following values: + * @arg @ref LL_PWR_MODE_STOP_MAINREGU + * @arg @ref LL_PWR_MODE_STOP_LPREGU + * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (*) + * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (*) + * @arg @ref LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (*) + * @arg @ref LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (*) + * + * (*) not available on all devices + * @arg @ref LL_PWR_MODE_STANDBY + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode) +{ +#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS) + MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS), PDMode); +#elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS) + MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS), PDMode); +#else + MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode); +#endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */ +} + +/** + * @brief Get Power Down mode when CPU enters deepsleep + * @rmtoll CR PDDS LL_PWR_GetPowerMode\n + * @rmtoll CR MRUDS LL_PWR_GetPowerMode\n + * @rmtoll CR LPUDS LL_PWR_GetPowerMode\n + * @rmtoll CR FPDS LL_PWR_GetPowerMode\n + * @rmtoll CR MRLVDS LL_PWR_GetPowerMode\n + * @rmtoll CR LPLVDS LL_PWR_GetPowerMode\n + * @rmtoll CR FPDS LL_PWR_GetPowerMode\n + * @rmtoll CR LPDS LL_PWR_GetPowerMode + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_MODE_STOP_MAINREGU + * @arg @ref LL_PWR_MODE_STOP_LPREGU + * @arg @ref LL_PWR_MODE_STOP_MAINREGU_UNDERDRIVE (*) + * @arg @ref LL_PWR_MODE_STOP_LPREGU_UNDERDRIVE (*) + * @arg @ref LL_PWR_MODE_STOP_MAINREGU_DEEPSLEEP (*) + * @arg @ref LL_PWR_MODE_STOP_LPREGU_DEEPSLEEP (*) + * + * (*) not available on all devices + * @arg @ref LL_PWR_MODE_STANDBY + */ +__STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void) +{ +#if defined(PWR_CR_MRUDS) && defined(PWR_CR_LPUDS) && defined(PWR_CR_FPDS) + return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPUDS | PWR_CR_MRUDS))); +#elif defined(PWR_CR_MRLVDS) && defined(PWR_CR_LPLVDS) && defined(PWR_CR_FPDS) + return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_FPDS | PWR_CR_LPLVDS | PWR_CR_MRLVDS))); +#else + return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS))); +#endif /* PWR_CR_MRUDS && PWR_CR_LPUDS && PWR_CR_FPDS */ +} + +/** + * @brief Configure the voltage threshold detected by the Power Voltage Detector + * @rmtoll CR PLS LL_PWR_SetPVDLevel + * @param PVDLevel This parameter can be one of the following values: + * @arg @ref LL_PWR_PVDLEVEL_0 + * @arg @ref LL_PWR_PVDLEVEL_1 + * @arg @ref LL_PWR_PVDLEVEL_2 + * @arg @ref LL_PWR_PVDLEVEL_3 + * @arg @ref LL_PWR_PVDLEVEL_4 + * @arg @ref LL_PWR_PVDLEVEL_5 + * @arg @ref LL_PWR_PVDLEVEL_6 + * @arg @ref LL_PWR_PVDLEVEL_7 + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel) +{ + MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel); +} + +/** + * @brief Get the voltage threshold detection + * @rmtoll CR PLS LL_PWR_GetPVDLevel + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_PVDLEVEL_0 + * @arg @ref LL_PWR_PVDLEVEL_1 + * @arg @ref LL_PWR_PVDLEVEL_2 + * @arg @ref LL_PWR_PVDLEVEL_3 + * @arg @ref LL_PWR_PVDLEVEL_4 + * @arg @ref LL_PWR_PVDLEVEL_5 + * @arg @ref LL_PWR_PVDLEVEL_6 + * @arg @ref LL_PWR_PVDLEVEL_7 + */ +__STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS)); +} + +/** + * @brief Enable Power Voltage Detector + * @rmtoll CR PVDE LL_PWR_EnablePVD + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnablePVD(void) +{ + SET_BIT(PWR->CR, PWR_CR_PVDE); +} + +/** + * @brief Disable Power Voltage Detector + * @rmtoll CR PVDE LL_PWR_DisablePVD + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisablePVD(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_PVDE); +} + +/** + * @brief Check if Power Voltage Detector is enabled + * @rmtoll CR PVDE LL_PWR_IsEnabledPVD + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE)); +} + +/** + * @brief Enable the WakeUp PINx functionality + * @rmtoll CSR EWUP LL_PWR_EnableWakeUpPin\n + * @rmtoll CSR EWUP1 LL_PWR_EnableWakeUpPin\n + * @rmtoll CSR EWUP2 LL_PWR_EnableWakeUpPin\n + * @rmtoll CSR EWUP3 LL_PWR_EnableWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @arg @ref LL_PWR_WAKEUP_PIN2 (*) + * @arg @ref LL_PWR_WAKEUP_PIN3 (*) + * + * (*) not available on all devices + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin) +{ + SET_BIT(PWR->CSR, WakeUpPin); +} + +/** + * @brief Disable the WakeUp PINx functionality + * @rmtoll CSR EWUP LL_PWR_DisableWakeUpPin\n + * @rmtoll CSR EWUP1 LL_PWR_DisableWakeUpPin\n + * @rmtoll CSR EWUP2 LL_PWR_DisableWakeUpPin\n + * @rmtoll CSR EWUP3 LL_PWR_DisableWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @arg @ref LL_PWR_WAKEUP_PIN2 (*) + * @arg @ref LL_PWR_WAKEUP_PIN3 (*) + * + * (*) not available on all devices + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin) +{ + CLEAR_BIT(PWR->CSR, WakeUpPin); +} + +/** + * @brief Check if the WakeUp PINx functionality is enabled + * @rmtoll CSR EWUP LL_PWR_IsEnabledWakeUpPin\n + * @rmtoll CSR EWUP1 LL_PWR_IsEnabledWakeUpPin\n + * @rmtoll CSR EWUP2 LL_PWR_IsEnabledWakeUpPin\n + * @rmtoll CSR EWUP3 LL_PWR_IsEnabledWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @arg @ref LL_PWR_WAKEUP_PIN2 (*) + * @arg @ref LL_PWR_WAKEUP_PIN3 (*) + * + * (*) not available on all devices + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin) +{ + return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin)); +} + + +/** + * @} + */ + +/** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get Wake-up Flag + * @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF)); +} + +/** + * @brief Get Standby Flag + * @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF)); +} + +/** + * @brief Get Backup Regulator ready Flag + * @rmtoll CSR BRR LL_PWR_IsActiveFlag_BRR + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_BRR(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_BRR) == (PWR_CSR_BRR)); +} +/** + * @brief Indicate whether VDD voltage is below the selected PVD threshold + * @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO)); +} + +/** + * @brief Indicate whether the Regulator is ready in the selected voltage range or if its output voltage is still changing to the required voltage level + * @rmtoll CSR VOS LL_PWR_IsActiveFlag_VOS + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_VOS(void) +{ + return (READ_BIT(PWR->CSR, LL_PWR_CSR_VOS) == (LL_PWR_CSR_VOS)); +} +#if defined(PWR_CR_ODEN) +/** + * @brief Indicate whether the Over-Drive mode is ready or not + * @rmtoll CSR ODRDY LL_PWR_IsActiveFlag_OD + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_OD(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_ODRDY) == (PWR_CSR_ODRDY)); +} +#endif /* PWR_CR_ODEN */ + +#if defined(PWR_CR_ODSWEN) +/** + * @brief Indicate whether the Over-Drive mode switching is ready or not + * @rmtoll CSR ODSWRDY LL_PWR_IsActiveFlag_ODSW + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_ODSW(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_ODSWRDY) == (PWR_CSR_ODSWRDY)); +} +#endif /* PWR_CR_ODSWEN */ + +#if defined(PWR_CR_UDEN) +/** + * @brief Indicate whether the Under-Drive mode is ready or not + * @rmtoll CSR UDRDY LL_PWR_IsActiveFlag_UD + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_UD(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_UDRDY) == (PWR_CSR_UDRDY)); +} +#endif /* PWR_CR_UDEN */ +/** + * @brief Clear Standby Flag + * @rmtoll CR CSBF LL_PWR_ClearFlag_SB + * @retval None + */ +__STATIC_INLINE void LL_PWR_ClearFlag_SB(void) +{ + SET_BIT(PWR->CR, PWR_CR_CSBF); +} + +/** + * @brief Clear Wake-up Flags + * @rmtoll CR CWUF LL_PWR_ClearFlag_WU + * @retval None + */ +__STATIC_INLINE void LL_PWR_ClearFlag_WU(void) +{ + SET_BIT(PWR->CR, PWR_CR_CWUF); +} +#if defined(PWR_CSR_UDRDY) +/** + * @brief Clear Under-Drive ready Flag + * @rmtoll CSR UDRDY LL_PWR_ClearFlag_UD + * @retval None + */ +__STATIC_INLINE void LL_PWR_ClearFlag_UD(void) +{ + WRITE_REG(PWR->CSR, PWR_CSR_UDRDY); +} +#endif /* PWR_CSR_UDRDY */ + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup PWR_LL_EF_Init De-initialization function + * @{ + */ +ErrorStatus LL_PWR_DeInit(void); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(PWR) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_PWR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h new file mode 100644 index 0000000..0cb4099 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h @@ -0,0 +1,7099 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_rcc.h + * @author MCD Application Team + * @brief Header file of RCC LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_RCC_H +#define __STM32F4xx_LL_RCC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @defgroup RCC_LL RCC + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup RCC_LL_Private_Variables RCC Private Variables + * @{ + */ + +#if defined(RCC_DCKCFGR_PLLSAIDIVR) +static const uint8_t aRCC_PLLSAIDIVRPrescTable[4] = {2, 4, 8, 16}; +#endif /* RCC_DCKCFGR_PLLSAIDIVR */ + +/** + * @} + */ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_Private_Macros RCC Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_Exported_Types RCC Exported Types + * @{ + */ + +/** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure + * @{ + */ + +/** + * @brief RCC Clocks Frequency Structure + */ +typedef struct +{ + uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency */ + uint32_t HCLK_Frequency; /*!< HCLK clock frequency */ + uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency */ + uint32_t PCLK2_Frequency; /*!< PCLK2 clock frequency */ +} LL_RCC_ClocksTypeDef; + +/** + * @} + */ + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Constants RCC Exported Constants + * @{ + */ + +/** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation + * @brief Defines used to adapt values of different oscillators + * @note These values could be modified in the user environment according to + * HW set-up. + * @{ + */ +#if !defined (HSE_VALUE) +#define HSE_VALUE 25000000U /*!< Value of the HSE oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSI_VALUE) +#define HSI_VALUE 16000000U /*!< Value of the HSI oscillator in Hz */ +#endif /* HSI_VALUE */ + +#if !defined (LSE_VALUE) +#define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSI_VALUE) +#define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */ +#endif /* LSI_VALUE */ + +#if !defined (EXTERNAL_CLOCK_VALUE) +#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the I2S_CKIN external oscillator in Hz */ +#endif /* EXTERNAL_CLOCK_VALUE */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines + * @brief Flags defines which can be used with LL_RCC_WriteReg function + * @{ + */ +#define LL_RCC_CIR_LSIRDYC RCC_CIR_LSIRDYC /*!< LSI Ready Interrupt Clear */ +#define LL_RCC_CIR_LSERDYC RCC_CIR_LSERDYC /*!< LSE Ready Interrupt Clear */ +#define LL_RCC_CIR_HSIRDYC RCC_CIR_HSIRDYC /*!< HSI Ready Interrupt Clear */ +#define LL_RCC_CIR_HSERDYC RCC_CIR_HSERDYC /*!< HSE Ready Interrupt Clear */ +#define LL_RCC_CIR_PLLRDYC RCC_CIR_PLLRDYC /*!< PLL Ready Interrupt Clear */ +#if defined(RCC_PLLI2S_SUPPORT) +#define LL_RCC_CIR_PLLI2SRDYC RCC_CIR_PLLI2SRDYC /*!< PLLI2S Ready Interrupt Clear */ +#endif /* RCC_PLLI2S_SUPPORT */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_CIR_PLLSAIRDYC RCC_CIR_PLLSAIRDYC /*!< PLLSAI Ready Interrupt Clear */ +#endif /* RCC_PLLSAI_SUPPORT */ +#define LL_RCC_CIR_CSSC RCC_CIR_CSSC /*!< Clock Security System Interrupt Clear */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_RCC_ReadReg function + * @{ + */ +#define LL_RCC_CIR_LSIRDYF RCC_CIR_LSIRDYF /*!< LSI Ready Interrupt flag */ +#define LL_RCC_CIR_LSERDYF RCC_CIR_LSERDYF /*!< LSE Ready Interrupt flag */ +#define LL_RCC_CIR_HSIRDYF RCC_CIR_HSIRDYF /*!< HSI Ready Interrupt flag */ +#define LL_RCC_CIR_HSERDYF RCC_CIR_HSERDYF /*!< HSE Ready Interrupt flag */ +#define LL_RCC_CIR_PLLRDYF RCC_CIR_PLLRDYF /*!< PLL Ready Interrupt flag */ +#if defined(RCC_PLLI2S_SUPPORT) +#define LL_RCC_CIR_PLLI2SRDYF RCC_CIR_PLLI2SRDYF /*!< PLLI2S Ready Interrupt flag */ +#endif /* RCC_PLLI2S_SUPPORT */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_CIR_PLLSAIRDYF RCC_CIR_PLLSAIRDYF /*!< PLLSAI Ready Interrupt flag */ +#endif /* RCC_PLLSAI_SUPPORT */ +#define LL_RCC_CIR_CSSF RCC_CIR_CSSF /*!< Clock Security System Interrupt flag */ +#define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset flag */ +#define LL_RCC_CSR_PINRSTF RCC_CSR_PINRSTF /*!< PIN reset flag */ +#define LL_RCC_CSR_PORRSTF RCC_CSR_PORRSTF /*!< POR/PDR reset flag */ +#define LL_RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */ +#define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */ +#define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */ +#if defined(RCC_CSR_BORRSTF) +#define LL_RCC_CSR_BORRSTF RCC_CSR_BORRSTF /*!< BOR reset flag */ +#endif /* RCC_CSR_BORRSTF */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions + * @{ + */ +#define LL_RCC_CIR_LSIRDYIE RCC_CIR_LSIRDYIE /*!< LSI Ready Interrupt Enable */ +#define LL_RCC_CIR_LSERDYIE RCC_CIR_LSERDYIE /*!< LSE Ready Interrupt Enable */ +#define LL_RCC_CIR_HSIRDYIE RCC_CIR_HSIRDYIE /*!< HSI Ready Interrupt Enable */ +#define LL_RCC_CIR_HSERDYIE RCC_CIR_HSERDYIE /*!< HSE Ready Interrupt Enable */ +#define LL_RCC_CIR_PLLRDYIE RCC_CIR_PLLRDYIE /*!< PLL Ready Interrupt Enable */ +#if defined(RCC_PLLI2S_SUPPORT) +#define LL_RCC_CIR_PLLI2SRDYIE RCC_CIR_PLLI2SRDYIE /*!< PLLI2S Ready Interrupt Enable */ +#endif /* RCC_PLLI2S_SUPPORT */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_CIR_PLLSAIRDYIE RCC_CIR_PLLSAIRDYIE /*!< PLLSAI Ready Interrupt Enable */ +#endif /* RCC_PLLSAI_SUPPORT */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch + * @{ + */ +#define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */ +#define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */ +#define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW_PLL /*!< PLL selection as system clock */ +#if defined(RCC_CFGR_SW_PLLR) +#define LL_RCC_SYS_CLKSOURCE_PLLR RCC_CFGR_SW_PLLR /*!< PLLR selection as system clock */ +#endif /* RCC_CFGR_SW_PLLR */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status + * @{ + */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_PLL RCC_CFGR_SWS_PLL /*!< PLL used as system clock */ +#if defined(RCC_PLLR_SYSCLK_SUPPORT) +#define LL_RCC_SYS_CLKSOURCE_STATUS_PLLR RCC_CFGR_SWS_PLLR /*!< PLLR used as system clock */ +#endif /* RCC_PLLR_SYSCLK_SUPPORT */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler + * @{ + */ +#define LL_RCC_SYSCLK_DIV_1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */ +#define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */ +#define LL_RCC_SYSCLK_DIV_4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */ +#define LL_RCC_SYSCLK_DIV_8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */ +#define LL_RCC_SYSCLK_DIV_16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */ +#define LL_RCC_SYSCLK_DIV_64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */ +#define LL_RCC_SYSCLK_DIV_128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */ +#define LL_RCC_SYSCLK_DIV_256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */ +#define LL_RCC_SYSCLK_DIV_512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1) + * @{ + */ +#define LL_RCC_APB1_DIV_1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */ +#define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */ +#define LL_RCC_APB1_DIV_4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */ +#define LL_RCC_APB1_DIV_8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */ +#define LL_RCC_APB1_DIV_16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_APB2_DIV APB high-speed prescaler (APB2) + * @{ + */ +#define LL_RCC_APB2_DIV_1 RCC_CFGR_PPRE2_DIV1 /*!< HCLK not divided */ +#define LL_RCC_APB2_DIV_2 RCC_CFGR_PPRE2_DIV2 /*!< HCLK divided by 2 */ +#define LL_RCC_APB2_DIV_4 RCC_CFGR_PPRE2_DIV4 /*!< HCLK divided by 4 */ +#define LL_RCC_APB2_DIV_8 RCC_CFGR_PPRE2_DIV8 /*!< HCLK divided by 8 */ +#define LL_RCC_APB2_DIV_16 RCC_CFGR_PPRE2_DIV16 /*!< HCLK divided by 16 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_MCOxSOURCE MCO source selection + * @{ + */ +#define LL_RCC_MCO1SOURCE_HSI (uint32_t)(RCC_CFGR_MCO1|0x00000000U) /*!< HSI selection as MCO1 source */ +#define LL_RCC_MCO1SOURCE_LSE (uint32_t)(RCC_CFGR_MCO1|(RCC_CFGR_MCO1_0 >> 16U)) /*!< LSE selection as MCO1 source */ +#define LL_RCC_MCO1SOURCE_HSE (uint32_t)(RCC_CFGR_MCO1|(RCC_CFGR_MCO1_1 >> 16U)) /*!< HSE selection as MCO1 source */ +#define LL_RCC_MCO1SOURCE_PLLCLK (uint32_t)(RCC_CFGR_MCO1|((RCC_CFGR_MCO1_1|RCC_CFGR_MCO1_0) >> 16U)) /*!< PLLCLK selection as MCO1 source */ +#if defined(RCC_CFGR_MCO2) +#define LL_RCC_MCO2SOURCE_SYSCLK (uint32_t)(RCC_CFGR_MCO2|0x00000000U) /*!< SYSCLK selection as MCO2 source */ +#define LL_RCC_MCO2SOURCE_PLLI2S (uint32_t)(RCC_CFGR_MCO2|(RCC_CFGR_MCO2_0 >> 16U)) /*!< PLLI2S selection as MCO2 source */ +#define LL_RCC_MCO2SOURCE_HSE (uint32_t)(RCC_CFGR_MCO2|(RCC_CFGR_MCO2_1 >> 16U)) /*!< HSE selection as MCO2 source */ +#define LL_RCC_MCO2SOURCE_PLLCLK (uint32_t)(RCC_CFGR_MCO2|((RCC_CFGR_MCO2_1|RCC_CFGR_MCO2_0) >> 16U)) /*!< PLLCLK selection as MCO2 source */ +#endif /* RCC_CFGR_MCO2 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_MCOx_DIV MCO prescaler + * @{ + */ +#define LL_RCC_MCO1_DIV_1 (uint32_t)(RCC_CFGR_MCO1PRE|0x00000000U) /*!< MCO1 not divided */ +#define LL_RCC_MCO1_DIV_2 (uint32_t)(RCC_CFGR_MCO1PRE|(RCC_CFGR_MCO1PRE_2 >> 16U)) /*!< MCO1 divided by 2 */ +#define LL_RCC_MCO1_DIV_3 (uint32_t)(RCC_CFGR_MCO1PRE|((RCC_CFGR_MCO1PRE_2|RCC_CFGR_MCO1PRE_0) >> 16U)) /*!< MCO1 divided by 3 */ +#define LL_RCC_MCO1_DIV_4 (uint32_t)(RCC_CFGR_MCO1PRE|((RCC_CFGR_MCO1PRE_2|RCC_CFGR_MCO1PRE_1) >> 16U)) /*!< MCO1 divided by 4 */ +#define LL_RCC_MCO1_DIV_5 (uint32_t)(RCC_CFGR_MCO1PRE|(RCC_CFGR_MCO1PRE >> 16U)) /*!< MCO1 divided by 5 */ +#if defined(RCC_CFGR_MCO2PRE) +#define LL_RCC_MCO2_DIV_1 (uint32_t)(RCC_CFGR_MCO2PRE|0x00000000U) /*!< MCO2 not divided */ +#define LL_RCC_MCO2_DIV_2 (uint32_t)(RCC_CFGR_MCO2PRE|(RCC_CFGR_MCO2PRE_2 >> 16U)) /*!< MCO2 divided by 2 */ +#define LL_RCC_MCO2_DIV_3 (uint32_t)(RCC_CFGR_MCO2PRE|((RCC_CFGR_MCO2PRE_2|RCC_CFGR_MCO2PRE_0) >> 16U)) /*!< MCO2 divided by 3 */ +#define LL_RCC_MCO2_DIV_4 (uint32_t)(RCC_CFGR_MCO2PRE|((RCC_CFGR_MCO2PRE_2|RCC_CFGR_MCO2PRE_1) >> 16U)) /*!< MCO2 divided by 4 */ +#define LL_RCC_MCO2_DIV_5 (uint32_t)(RCC_CFGR_MCO2PRE|(RCC_CFGR_MCO2PRE >> 16U)) /*!< MCO2 divided by 5 */ +#endif /* RCC_CFGR_MCO2PRE */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_RTC_HSEDIV HSE prescaler for RTC clock + * @{ + */ +#define LL_RCC_RTC_NOCLOCK 0x00000000U /*!< HSE not divided */ +#define LL_RCC_RTC_HSE_DIV_2 RCC_CFGR_RTCPRE_1 /*!< HSE clock divided by 2 */ +#define LL_RCC_RTC_HSE_DIV_3 (RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 3 */ +#define LL_RCC_RTC_HSE_DIV_4 RCC_CFGR_RTCPRE_2 /*!< HSE clock divided by 4 */ +#define LL_RCC_RTC_HSE_DIV_5 (RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 5 */ +#define LL_RCC_RTC_HSE_DIV_6 (RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 6 */ +#define LL_RCC_RTC_HSE_DIV_7 (RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 7 */ +#define LL_RCC_RTC_HSE_DIV_8 RCC_CFGR_RTCPRE_3 /*!< HSE clock divided by 8 */ +#define LL_RCC_RTC_HSE_DIV_9 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 9 */ +#define LL_RCC_RTC_HSE_DIV_10 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 10 */ +#define LL_RCC_RTC_HSE_DIV_11 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 11 */ +#define LL_RCC_RTC_HSE_DIV_12 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2) /*!< HSE clock divided by 12 */ +#define LL_RCC_RTC_HSE_DIV_13 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 13 */ +#define LL_RCC_RTC_HSE_DIV_14 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 14 */ +#define LL_RCC_RTC_HSE_DIV_15 (RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 15 */ +#define LL_RCC_RTC_HSE_DIV_16 RCC_CFGR_RTCPRE_4 /*!< HSE clock divided by 16 */ +#define LL_RCC_RTC_HSE_DIV_17 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 17 */ +#define LL_RCC_RTC_HSE_DIV_18 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 18 */ +#define LL_RCC_RTC_HSE_DIV_19 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 19 */ +#define LL_RCC_RTC_HSE_DIV_20 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2) /*!< HSE clock divided by 20 */ +#define LL_RCC_RTC_HSE_DIV_21 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 21 */ +#define LL_RCC_RTC_HSE_DIV_22 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 22 */ +#define LL_RCC_RTC_HSE_DIV_23 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 23 */ +#define LL_RCC_RTC_HSE_DIV_24 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3) /*!< HSE clock divided by 24 */ +#define LL_RCC_RTC_HSE_DIV_25 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 25 */ +#define LL_RCC_RTC_HSE_DIV_26 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 26 */ +#define LL_RCC_RTC_HSE_DIV_27 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 27 */ +#define LL_RCC_RTC_HSE_DIV_28 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2) /*!< HSE clock divided by 28 */ +#define LL_RCC_RTC_HSE_DIV_29 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 29 */ +#define LL_RCC_RTC_HSE_DIV_30 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1) /*!< HSE clock divided by 30 */ +#define LL_RCC_RTC_HSE_DIV_31 (RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0) /*!< HSE clock divided by 31 */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency + * @{ + */ +#define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */ +#define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +#if defined(FMPI2C1) +/** @defgroup RCC_LL_EC_FMPI2C1_CLKSOURCE Peripheral FMPI2C clock source selection + * @{ + */ +#define LL_RCC_FMPI2C1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 clock used as FMPI2C1 clock source */ +#define LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK RCC_DCKCFGR2_FMPI2C1SEL_0 /*!< SYSCLK clock used as FMPI2C1 clock source */ +#define LL_RCC_FMPI2C1_CLKSOURCE_HSI RCC_DCKCFGR2_FMPI2C1SEL_1 /*!< HSI clock used as FMPI2C1 clock source */ +/** + * @} + */ +#endif /* FMPI2C1 */ + +#if defined(LPTIM1) +/** @defgroup RCC_LL_EC_LPTIM1_CLKSOURCE Peripheral LPTIM clock source selection + * @{ + */ +#define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 clock used as LPTIM1 clock */ +#define LL_RCC_LPTIM1_CLKSOURCE_HSI RCC_DCKCFGR2_LPTIM1SEL_0 /*!< LSI oscillator clock used as LPTIM1 clock */ +#define LL_RCC_LPTIM1_CLKSOURCE_LSI RCC_DCKCFGR2_LPTIM1SEL_1 /*!< HSI oscillator clock used as LPTIM1 clock */ +#define LL_RCC_LPTIM1_CLKSOURCE_LSE (uint32_t)(RCC_DCKCFGR2_LPTIM1SEL_1 | RCC_DCKCFGR2_LPTIM1SEL_0) /*!< LSE oscillator clock used as LPTIM1 clock */ +/** + * @} + */ +#endif /* LPTIM1 */ + +#if defined(SAI1) +/** @defgroup RCC_LL_EC_SAIx_CLKSOURCE Peripheral SAI clock source selection + * @{ + */ +#if defined(RCC_DCKCFGR_SAI1SRC) +#define LL_RCC_SAI1_CLKSOURCE_PLLSAI (uint32_t)(RCC_DCKCFGR_SAI1SRC | 0x00000000U) /*!< PLLSAI clock used as SAI1 clock source */ +#define LL_RCC_SAI1_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI1SRC | (RCC_DCKCFGR_SAI1SRC_0 >> 16)) /*!< PLLI2S clock used as SAI1 clock source */ +#define LL_RCC_SAI1_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_SAI1SRC | (RCC_DCKCFGR_SAI1SRC_1 >> 16)) /*!< PLL clock used as SAI1 clock source */ +#define LL_RCC_SAI1_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_SAI1SRC | (RCC_DCKCFGR_SAI1SRC >> 16)) /*!< External pin clock used as SAI1 clock source */ +#endif /* RCC_DCKCFGR_SAI1SRC */ +#if defined(RCC_DCKCFGR_SAI2SRC) +#define LL_RCC_SAI2_CLKSOURCE_PLLSAI (uint32_t)(RCC_DCKCFGR_SAI2SRC | 0x00000000U) /*!< PLLSAI clock used as SAI2 clock source */ +#define LL_RCC_SAI2_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI2SRC | (RCC_DCKCFGR_SAI2SRC_0 >> 16)) /*!< PLLI2S clock used as SAI2 clock source */ +#define LL_RCC_SAI2_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_SAI2SRC | (RCC_DCKCFGR_SAI2SRC_1 >> 16)) /*!< PLL clock used as SAI2 clock source */ +#define LL_RCC_SAI2_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_SAI2SRC | (RCC_DCKCFGR_SAI2SRC >> 16)) /*!< PLL Main clock used as SAI2 clock source */ +#endif /* RCC_DCKCFGR_SAI2SRC */ +#if defined(RCC_DCKCFGR_SAI1ASRC) +#if defined(RCC_SAI1A_PLLSOURCE_SUPPORT) +#define LL_RCC_SAI1_A_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI1ASRC | 0x00000000U) /*!< PLLI2S clock used as SAI1 block A clock source */ +#define LL_RCC_SAI1_A_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_SAI1ASRC | (RCC_DCKCFGR_SAI1ASRC_0 >> 16)) /*!< External pin used as SAI1 block A clock source */ +#define LL_RCC_SAI1_A_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_SAI1ASRC | (RCC_DCKCFGR_SAI1ASRC_1 >> 16)) /*!< PLL clock used as SAI1 block A clock source */ +#define LL_RCC_SAI1_A_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_SAI1ASRC | (RCC_DCKCFGR_SAI1ASRC >> 16)) /*!< PLL Main clock used as SAI1 block A clock source */ +#else +#define LL_RCC_SAI1_A_CLKSOURCE_PLLSAI (uint32_t)(RCC_DCKCFGR_SAI1ASRC | 0x00000000U) /*!< PLLSAI clock used as SAI1 block A clock source */ +#define LL_RCC_SAI1_A_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI1ASRC | (RCC_DCKCFGR_SAI1ASRC_0 >> 16)) /*!< PLLI2S clock used as SAI1 block A clock source */ +#define LL_RCC_SAI1_A_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_SAI1ASRC | (RCC_DCKCFGR_SAI1ASRC_1 >> 16)) /*!< External pin clock used as SAI1 block A clock source */ +#endif /* RCC_SAI1A_PLLSOURCE_SUPPORT */ +#endif /* RCC_DCKCFGR_SAI1ASRC */ +#if defined(RCC_DCKCFGR_SAI1BSRC) +#if defined(RCC_SAI1B_PLLSOURCE_SUPPORT) +#define LL_RCC_SAI1_B_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI1BSRC | 0x00000000U) /*!< PLLI2S clock used as SAI1 block B clock source */ +#define LL_RCC_SAI1_B_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_SAI1BSRC | (RCC_DCKCFGR_SAI1BSRC_0 >> 16)) /*!< External pin used as SAI1 block B clock source */ +#define LL_RCC_SAI1_B_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_SAI1BSRC | (RCC_DCKCFGR_SAI1BSRC_1 >> 16)) /*!< PLL clock used as SAI1 block B clock source */ +#define LL_RCC_SAI1_B_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_SAI1BSRC | (RCC_DCKCFGR_SAI1BSRC >> 16)) /*!< PLL Main clock used as SAI1 block B clock source */ +#else +#define LL_RCC_SAI1_B_CLKSOURCE_PLLSAI (uint32_t)(RCC_DCKCFGR_SAI1BSRC | 0x00000000U) /*!< PLLSAI clock used as SAI1 block B clock source */ +#define LL_RCC_SAI1_B_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_SAI1BSRC | (RCC_DCKCFGR_SAI1BSRC_0 >> 16)) /*!< PLLI2S clock used as SAI1 block B clock source */ +#define LL_RCC_SAI1_B_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_SAI1BSRC | (RCC_DCKCFGR_SAI1BSRC_1 >> 16)) /*!< External pin clock used as SAI1 block B clock source */ +#endif /* RCC_SAI1B_PLLSOURCE_SUPPORT */ +#endif /* RCC_DCKCFGR_SAI1BSRC */ +/** + * @} + */ +#endif /* SAI1 */ + +#if defined(RCC_DCKCFGR_SDIOSEL) || defined(RCC_DCKCFGR2_SDIOSEL) +/** @defgroup RCC_LL_EC_SDIOx_CLKSOURCE Peripheral SDIO clock source selection + * @{ + */ +#define LL_RCC_SDIO_CLKSOURCE_PLL48CLK 0x00000000U /*!< PLL 48M domain clock used as SDIO clock */ +#if defined(RCC_DCKCFGR_SDIOSEL) +#define LL_RCC_SDIO_CLKSOURCE_SYSCLK RCC_DCKCFGR_SDIOSEL /*!< System clock clock used as SDIO clock */ +#else +#define LL_RCC_SDIO_CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDIOSEL /*!< System clock clock used as SDIO clock */ +#endif /* RCC_DCKCFGR_SDIOSEL */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_SDIOSEL || RCC_DCKCFGR2_SDIOSEL */ + +#if defined(DSI) +/** @defgroup RCC_LL_EC_DSI_CLKSOURCE Peripheral DSI clock source selection + * @{ + */ +#define LL_RCC_DSI_CLKSOURCE_PHY 0x00000000U /*!< DSI-PHY clock used as DSI byte lane clock source */ +#define LL_RCC_DSI_CLKSOURCE_PLL RCC_DCKCFGR_DSISEL /*!< PLL clock used as DSI byte lane clock source */ +/** + * @} + */ +#endif /* DSI */ + +#if defined(CEC) +/** @defgroup RCC_LL_EC_CEC_CLKSOURCE Peripheral CEC clock source selection + * @{ + */ +#define LL_RCC_CEC_CLKSOURCE_HSI_DIV488 0x00000000U /*!< HSI oscillator clock divided by 488 used as CEC clock */ +#define LL_RCC_CEC_CLKSOURCE_LSE RCC_DCKCFGR2_CECSEL /*!< LSE oscillator clock used as CEC clock */ +/** + * @} + */ +#endif /* CEC */ + +/** @defgroup RCC_LL_EC_I2S1_CLKSOURCE Peripheral I2S clock source selection + * @{ + */ +#if defined(RCC_CFGR_I2SSRC) +#define LL_RCC_I2S1_CLKSOURCE_PLLI2S 0x00000000U /*!< I2S oscillator clock used as I2S1 clock */ +#define LL_RCC_I2S1_CLKSOURCE_PIN RCC_CFGR_I2SSRC /*!< External pin clock used as I2S1 clock */ +#endif /* RCC_CFGR_I2SSRC */ +#if defined(RCC_DCKCFGR_I2SSRC) +#define LL_RCC_I2S1_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_I2SSRC | 0x00000000U) /*!< PLL clock used as I2S1 clock source */ +#define LL_RCC_I2S1_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_I2SSRC | (RCC_DCKCFGR_I2SSRC_0 >> 16)) /*!< External pin used as I2S1 clock source */ +#define LL_RCC_I2S1_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_I2SSRC | (RCC_DCKCFGR_I2SSRC_1 >> 16)) /*!< PLL Main clock used as I2S1 clock source */ +#endif /* RCC_DCKCFGR_I2SSRC */ +#if defined(RCC_DCKCFGR_I2S1SRC) +#define LL_RCC_I2S1_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_I2S1SRC | 0x00000000U) /*!< PLLI2S clock used as I2S1 clock source */ +#define LL_RCC_I2S1_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_I2S1SRC | (RCC_DCKCFGR_I2S1SRC_0 >> 16)) /*!< External pin used as I2S1 clock source */ +#define LL_RCC_I2S1_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_I2S1SRC | (RCC_DCKCFGR_I2S1SRC_1 >> 16)) /*!< PLL clock used as I2S1 clock source */ +#define LL_RCC_I2S1_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_I2S1SRC | (RCC_DCKCFGR_I2S1SRC >> 16)) /*!< PLL Main clock used as I2S1 clock source */ +#endif /* RCC_DCKCFGR_I2S1SRC */ +#if defined(RCC_DCKCFGR_I2S2SRC) +#define LL_RCC_I2S2_CLKSOURCE_PLLI2S (uint32_t)(RCC_DCKCFGR_I2S2SRC | 0x00000000U) /*!< PLLI2S clock used as I2S2 clock source */ +#define LL_RCC_I2S2_CLKSOURCE_PIN (uint32_t)(RCC_DCKCFGR_I2S2SRC | (RCC_DCKCFGR_I2S2SRC_0 >> 16)) /*!< External pin used as I2S2 clock source */ +#define LL_RCC_I2S2_CLKSOURCE_PLL (uint32_t)(RCC_DCKCFGR_I2S2SRC | (RCC_DCKCFGR_I2S2SRC_1 >> 16)) /*!< PLL clock used as I2S2 clock source */ +#define LL_RCC_I2S2_CLKSOURCE_PLLSRC (uint32_t)(RCC_DCKCFGR_I2S2SRC | (RCC_DCKCFGR_I2S2SRC >> 16)) /*!< PLL Main clock used as I2S2 clock source */ +#endif /* RCC_DCKCFGR_I2S2SRC */ +/** + * @} + */ + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +/** @defgroup RCC_LL_EC_CK48M_CLKSOURCE Peripheral 48Mhz domain clock source selection + * @{ + */ +#if defined(RCC_DCKCFGR_CK48MSEL) +#define LL_RCC_CK48M_CLKSOURCE_PLL 0x00000000U /*!< PLL oscillator clock used as 48Mhz domain clock */ +#define LL_RCC_CK48M_CLKSOURCE_PLLSAI RCC_DCKCFGR_CK48MSEL /*!< PLLSAI oscillator clock used as 48Mhz domain clock */ +#endif /* RCC_DCKCFGR_CK48MSEL */ +#if defined(RCC_DCKCFGR2_CK48MSEL) +#define LL_RCC_CK48M_CLKSOURCE_PLL 0x00000000U /*!< PLL oscillator clock used as 48Mhz domain clock */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_CK48M_CLKSOURCE_PLLSAI RCC_DCKCFGR2_CK48MSEL /*!< PLLSAI oscillator clock used as 48Mhz domain clock */ +#endif /* RCC_PLLSAI_SUPPORT */ +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +#define LL_RCC_CK48M_CLKSOURCE_PLLI2S RCC_DCKCFGR2_CK48MSEL /*!< PLLI2S oscillator clock used as 48Mhz domain clock */ +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +#endif /* RCC_DCKCFGR2_CK48MSEL */ +/** + * @} + */ + +#if defined(RNG) +/** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection + * @{ + */ +#define LL_RCC_RNG_CLKSOURCE_PLL LL_RCC_CK48M_CLKSOURCE_PLL /*!< PLL clock used as RNG clock source */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_RNG_CLKSOURCE_PLLSAI LL_RCC_CK48M_CLKSOURCE_PLLSAI /*!< PLLSAI clock used as RNG clock source */ +#endif /* RCC_PLLSAI_SUPPORT */ +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +#define LL_RCC_RNG_CLKSOURCE_PLLI2S LL_RCC_CK48M_CLKSOURCE_PLLI2S /*!< PLLI2S clock used as RNG clock source */ +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +/** + * @} + */ +#endif /* RNG */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +/** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection + * @{ + */ +#define LL_RCC_USB_CLKSOURCE_PLL LL_RCC_CK48M_CLKSOURCE_PLL /*!< PLL clock used as USB clock source */ +#if defined(RCC_PLLSAI_SUPPORT) +#define LL_RCC_USB_CLKSOURCE_PLLSAI LL_RCC_CK48M_CLKSOURCE_PLLSAI /*!< PLLSAI clock used as USB clock source */ +#endif /* RCC_PLLSAI_SUPPORT */ +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +#define LL_RCC_USB_CLKSOURCE_PLLI2S LL_RCC_CK48M_CLKSOURCE_PLLI2S /*!< PLLI2S clock used as USB clock source */ +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +/** + * @} + */ +#endif /* USB_OTG_FS || USB_OTG_HS */ + +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + +#if defined(DFSDM1_Channel0) || defined(DFSDM2_Channel0) +/** @defgroup RCC_LL_EC_DFSDM1_AUDIO_CLKSOURCE Peripheral DFSDM Audio clock source selection + * @{ + */ +#define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1 (uint32_t)(RCC_DCKCFGR_CKDFSDM1ASEL | 0x00000000U) /*!< I2S1 clock used as DFSDM1 Audio clock source */ +#define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S2 (uint32_t)(RCC_DCKCFGR_CKDFSDM1ASEL | (RCC_DCKCFGR_CKDFSDM1ASEL << 16)) /*!< I2S2 clock used as DFSDM1 Audio clock source */ +#if defined(DFSDM2_Channel0) +#define LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1 (uint32_t)(RCC_DCKCFGR_CKDFSDM2ASEL | 0x00000000U) /*!< I2S1 clock used as DFSDM2 Audio clock source */ +#define LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S2 (uint32_t)(RCC_DCKCFGR_CKDFSDM2ASEL | (RCC_DCKCFGR_CKDFSDM2ASEL << 16)) /*!< I2S2 clock used as DFSDM2 Audio clock source */ +#endif /* DFSDM2_Channel0 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_DFSDM1_CLKSOURCE Peripheral DFSDM clock source selection + * @{ + */ +#define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 0x00000000U /*!< PCLK2 clock used as DFSDM1 clock */ +#define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK RCC_DCKCFGR_CKDFSDM1SEL /*!< System clock used as DFSDM1 clock */ +#if defined(DFSDM2_Channel0) +#define LL_RCC_DFSDM2_CLKSOURCE_PCLK2 0x00000000U /*!< PCLK2 clock used as DFSDM2 clock */ +#define LL_RCC_DFSDM2_CLKSOURCE_SYSCLK RCC_DCKCFGR_CKDFSDM1SEL /*!< System clock used as DFSDM2 clock */ +#endif /* DFSDM2_Channel0 */ +/** + * @} + */ +#endif /* DFSDM1_Channel0 || DFSDM2_Channel0 */ + +#if defined(FMPI2C1) +/** @defgroup RCC_LL_EC_FMPI2C1 Peripheral FMPI2C get clock source + * @{ + */ +#define LL_RCC_FMPI2C1_CLKSOURCE RCC_DCKCFGR2_FMPI2C1SEL /*!< FMPI2C1 Clock source selection */ +/** + * @} + */ +#endif /* FMPI2C1 */ + +#if defined(SPDIFRX) +/** @defgroup RCC_LL_EC_SPDIFRX_CLKSOURCE Peripheral SPDIFRX clock source selection + * @{ + */ +#define LL_RCC_SPDIFRX1_CLKSOURCE_PLL 0x00000000U /*!< PLL clock used as SPDIFRX clock source */ +#define LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S RCC_DCKCFGR2_SPDIFRXSEL /*!< PLLI2S clock used as SPDIFRX clock source */ +/** + * @} + */ +#endif /* SPDIFRX */ + +#if defined(LPTIM1) +/** @defgroup RCC_LL_EC_LPTIM1 Peripheral LPTIM get clock source + * @{ + */ +#define LL_RCC_LPTIM1_CLKSOURCE RCC_DCKCFGR2_LPTIM1SEL /*!< LPTIM1 Clock source selection */ +/** + * @} + */ +#endif /* LPTIM1 */ + +#if defined(SAI1) +/** @defgroup RCC_LL_EC_SAIx Peripheral SAI get clock source + * @{ + */ +#if defined(RCC_DCKCFGR_SAI1ASRC) +#define LL_RCC_SAI1_A_CLKSOURCE RCC_DCKCFGR_SAI1ASRC /*!< SAI1 block A Clock source selection */ +#endif /* RCC_DCKCFGR_SAI1ASRC */ +#if defined(RCC_DCKCFGR_SAI1BSRC) +#define LL_RCC_SAI1_B_CLKSOURCE RCC_DCKCFGR_SAI1BSRC /*!< SAI1 block B Clock source selection */ +#endif /* RCC_DCKCFGR_SAI1BSRC */ +#if defined(RCC_DCKCFGR_SAI1SRC) +#define LL_RCC_SAI1_CLKSOURCE RCC_DCKCFGR_SAI1SRC /*!< SAI1 Clock source selection */ +#endif /* RCC_DCKCFGR_SAI1SRC */ +#if defined(RCC_DCKCFGR_SAI2SRC) +#define LL_RCC_SAI2_CLKSOURCE RCC_DCKCFGR_SAI2SRC /*!< SAI2 Clock source selection */ +#endif /* RCC_DCKCFGR_SAI2SRC */ +/** + * @} + */ +#endif /* SAI1 */ + +#if defined(SDIO) +/** @defgroup RCC_LL_EC_SDIOx Peripheral SDIO get clock source + * @{ + */ +#if defined(RCC_DCKCFGR_SDIOSEL) +#define LL_RCC_SDIO_CLKSOURCE RCC_DCKCFGR_SDIOSEL /*!< SDIO Clock source selection */ +#elif defined(RCC_DCKCFGR2_SDIOSEL) +#define LL_RCC_SDIO_CLKSOURCE RCC_DCKCFGR2_SDIOSEL /*!< SDIO Clock source selection */ +#else +#define LL_RCC_SDIO_CLKSOURCE RCC_PLLCFGR_PLLQ /*!< SDIO Clock source selection */ +#endif +/** + * @} + */ +#endif /* SDIO */ + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +/** @defgroup RCC_LL_EC_CK48M Peripheral CK48M get clock source + * @{ + */ +#if defined(RCC_DCKCFGR_CK48MSEL) +#define LL_RCC_CK48M_CLKSOURCE RCC_DCKCFGR_CK48MSEL /*!< CK48M Domain clock source selection */ +#endif /* RCC_DCKCFGR_CK48MSEL */ +#if defined(RCC_DCKCFGR2_CK48MSEL) +#define LL_RCC_CK48M_CLKSOURCE RCC_DCKCFGR2_CK48MSEL /*!< CK48M Domain clock source selection */ +#endif /* RCC_DCKCFGR_CK48MSEL */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + +#if defined(RNG) +/** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source + * @{ + */ +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +#define LL_RCC_RNG_CLKSOURCE LL_RCC_CK48M_CLKSOURCE /*!< RNG Clock source selection */ +#else +#define LL_RCC_RNG_CLKSOURCE RCC_PLLCFGR_PLLQ /*!< RNG Clock source selection */ +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ +/** + * @} + */ +#endif /* RNG */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +/** @defgroup RCC_LL_EC_USB Peripheral USB get clock source + * @{ + */ +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +#define LL_RCC_USB_CLKSOURCE LL_RCC_CK48M_CLKSOURCE /*!< USB Clock source selection */ +#else +#define LL_RCC_USB_CLKSOURCE RCC_PLLCFGR_PLLQ /*!< USB Clock source selection */ +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ +/** + * @} + */ +#endif /* USB_OTG_FS || USB_OTG_HS */ + +#if defined(CEC) +/** @defgroup RCC_LL_EC_CEC Peripheral CEC get clock source + * @{ + */ +#define LL_RCC_CEC_CLKSOURCE RCC_DCKCFGR2_CECSEL /*!< CEC Clock source selection */ +/** + * @} + */ +#endif /* CEC */ + +/** @defgroup RCC_LL_EC_I2S1 Peripheral I2S get clock source + * @{ + */ +#if defined(RCC_CFGR_I2SSRC) +#define LL_RCC_I2S1_CLKSOURCE RCC_CFGR_I2SSRC /*!< I2S1 Clock source selection */ +#endif /* RCC_CFGR_I2SSRC */ +#if defined(RCC_DCKCFGR_I2SSRC) +#define LL_RCC_I2S1_CLKSOURCE RCC_DCKCFGR_I2SSRC /*!< I2S1 Clock source selection */ +#endif /* RCC_DCKCFGR_I2SSRC */ +#if defined(RCC_DCKCFGR_I2S1SRC) +#define LL_RCC_I2S1_CLKSOURCE RCC_DCKCFGR_I2S1SRC /*!< I2S1 Clock source selection */ +#endif /* RCC_DCKCFGR_I2S1SRC */ +#if defined(RCC_DCKCFGR_I2S2SRC) +#define LL_RCC_I2S2_CLKSOURCE RCC_DCKCFGR_I2S2SRC /*!< I2S2 Clock source selection */ +#endif /* RCC_DCKCFGR_I2S2SRC */ +/** + * @} + */ + +#if defined(DFSDM1_Channel0) || defined(DFSDM2_Channel0) +/** @defgroup RCC_LL_EC_DFSDM_AUDIO Peripheral DFSDM Audio get clock source + * @{ + */ +#define LL_RCC_DFSDM1_AUDIO_CLKSOURCE RCC_DCKCFGR_CKDFSDM1ASEL /*!< DFSDM1 Audio Clock source selection */ +#if defined(DFSDM2_Channel0) +#define LL_RCC_DFSDM2_AUDIO_CLKSOURCE RCC_DCKCFGR_CKDFSDM2ASEL /*!< DFSDM2 Audio Clock source selection */ +#endif /* DFSDM2_Channel0 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_DFSDM Peripheral DFSDM get clock source + * @{ + */ +#define LL_RCC_DFSDM1_CLKSOURCE RCC_DCKCFGR_CKDFSDM1SEL /*!< DFSDM1 Clock source selection */ +#if defined(DFSDM2_Channel0) +#define LL_RCC_DFSDM2_CLKSOURCE RCC_DCKCFGR_CKDFSDM1SEL /*!< DFSDM2 Clock source selection */ +#endif /* DFSDM2_Channel0 */ +/** + * @} + */ +#endif /* DFSDM1_Channel0 || DFSDM2_Channel0 */ + +#if defined(SPDIFRX) +/** @defgroup RCC_LL_EC_SPDIFRX Peripheral SPDIFRX get clock source + * @{ + */ +#define LL_RCC_SPDIFRX1_CLKSOURCE RCC_DCKCFGR2_SPDIFRXSEL /*!< SPDIFRX Clock source selection */ +/** + * @} + */ +#endif /* SPDIFRX */ + +#if defined(DSI) +/** @defgroup RCC_LL_EC_DSI Peripheral DSI get clock source + * @{ + */ +#define LL_RCC_DSI_CLKSOURCE RCC_DCKCFGR_DSISEL /*!< DSI Clock source selection */ +/** + * @} + */ +#endif /* DSI */ + +#if defined(LTDC) +/** @defgroup RCC_LL_EC_LTDC Peripheral LTDC get clock source + * @{ + */ +#define LL_RCC_LTDC_CLKSOURCE RCC_DCKCFGR_PLLSAIDIVR /*!< LTDC Clock source selection */ +/** + * @} + */ +#endif /* LTDC */ + + +/** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection + * @{ + */ +#define LL_RCC_RTC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_HSE RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by HSE prescaler used as RTC clock */ +/** + * @} + */ + +#if defined(RCC_DCKCFGR_TIMPRE) +/** @defgroup RCC_LL_EC_TIM_CLKPRESCALER Timers clocks prescalers selection + * @{ + */ +#define LL_RCC_TIM_PRESCALER_TWICE 0x00000000U /*!< Timers clock to twice PCLK */ +#define LL_RCC_TIM_PRESCALER_FOUR_TIMES RCC_DCKCFGR_TIMPRE /*!< Timers clock to four time PCLK */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_TIMPRE */ + +/** @defgroup RCC_LL_EC_PLLSOURCE PLL, PLLI2S and PLLSAI entry clock source + * @{ + */ +#define LL_RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI16 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */ +#if defined(RCC_PLLI2SCFGR_PLLI2SSRC) +#define LL_RCC_PLLI2SSOURCE_PIN (RCC_PLLI2SCFGR_PLLI2SSRC | 0x80U) /*!< I2S External pin input clock selected as PLLI2S entry clock source */ +#endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLLM_DIV PLL, PLLI2S and PLLSAI division factor + * @{ + */ +#define LL_RCC_PLLM_DIV_2 (RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 2 */ +#define LL_RCC_PLLM_DIV_3 (RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 3 */ +#define LL_RCC_PLLM_DIV_4 (RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 4 */ +#define LL_RCC_PLLM_DIV_5 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 5 */ +#define LL_RCC_PLLM_DIV_6 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 6 */ +#define LL_RCC_PLLM_DIV_7 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 7 */ +#define LL_RCC_PLLM_DIV_8 (RCC_PLLCFGR_PLLM_3) /*!< PLL, PLLI2S and PLLSAI division factor by 8 */ +#define LL_RCC_PLLM_DIV_9 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 9 */ +#define LL_RCC_PLLM_DIV_10 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 10 */ +#define LL_RCC_PLLM_DIV_11 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 11 */ +#define LL_RCC_PLLM_DIV_12 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 12 */ +#define LL_RCC_PLLM_DIV_13 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 13 */ +#define LL_RCC_PLLM_DIV_14 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 14 */ +#define LL_RCC_PLLM_DIV_15 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 15 */ +#define LL_RCC_PLLM_DIV_16 (RCC_PLLCFGR_PLLM_4) /*!< PLL, PLLI2S and PLLSAI division factor by 16 */ +#define LL_RCC_PLLM_DIV_17 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 17 */ +#define LL_RCC_PLLM_DIV_18 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 18 */ +#define LL_RCC_PLLM_DIV_19 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 19 */ +#define LL_RCC_PLLM_DIV_20 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 20 */ +#define LL_RCC_PLLM_DIV_21 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 21 */ +#define LL_RCC_PLLM_DIV_22 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 22 */ +#define LL_RCC_PLLM_DIV_23 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 23 */ +#define LL_RCC_PLLM_DIV_24 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3) /*!< PLL, PLLI2S and PLLSAI division factor by 24 */ +#define LL_RCC_PLLM_DIV_25 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 25 */ +#define LL_RCC_PLLM_DIV_26 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 26 */ +#define LL_RCC_PLLM_DIV_27 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 27 */ +#define LL_RCC_PLLM_DIV_28 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 28 */ +#define LL_RCC_PLLM_DIV_29 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 29 */ +#define LL_RCC_PLLM_DIV_30 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 30 */ +#define LL_RCC_PLLM_DIV_31 (RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 31 */ +#define LL_RCC_PLLM_DIV_32 (RCC_PLLCFGR_PLLM_5) /*!< PLL, PLLI2S and PLLSAI division factor by 32 */ +#define LL_RCC_PLLM_DIV_33 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 33 */ +#define LL_RCC_PLLM_DIV_34 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 34 */ +#define LL_RCC_PLLM_DIV_35 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 35 */ +#define LL_RCC_PLLM_DIV_36 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 36 */ +#define LL_RCC_PLLM_DIV_37 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 37 */ +#define LL_RCC_PLLM_DIV_38 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 38 */ +#define LL_RCC_PLLM_DIV_39 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 39 */ +#define LL_RCC_PLLM_DIV_40 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3) /*!< PLL, PLLI2S and PLLSAI division factor by 40 */ +#define LL_RCC_PLLM_DIV_41 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 41 */ +#define LL_RCC_PLLM_DIV_42 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 42 */ +#define LL_RCC_PLLM_DIV_43 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 43 */ +#define LL_RCC_PLLM_DIV_44 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 44 */ +#define LL_RCC_PLLM_DIV_45 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 45 */ +#define LL_RCC_PLLM_DIV_46 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 46 */ +#define LL_RCC_PLLM_DIV_47 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 47 */ +#define LL_RCC_PLLM_DIV_48 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4) /*!< PLL, PLLI2S and PLLSAI division factor by 48 */ +#define LL_RCC_PLLM_DIV_49 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 49 */ +#define LL_RCC_PLLM_DIV_50 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 50 */ +#define LL_RCC_PLLM_DIV_51 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 51 */ +#define LL_RCC_PLLM_DIV_52 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 52 */ +#define LL_RCC_PLLM_DIV_53 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 53 */ +#define LL_RCC_PLLM_DIV_54 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 54 */ +#define LL_RCC_PLLM_DIV_55 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 55 */ +#define LL_RCC_PLLM_DIV_56 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3) /*!< PLL, PLLI2S and PLLSAI division factor by 56 */ +#define LL_RCC_PLLM_DIV_57 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 57 */ +#define LL_RCC_PLLM_DIV_58 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 58 */ +#define LL_RCC_PLLM_DIV_59 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 59 */ +#define LL_RCC_PLLM_DIV_60 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< PLL, PLLI2S and PLLSAI division factor by 60 */ +#define LL_RCC_PLLM_DIV_61 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 61 */ +#define LL_RCC_PLLM_DIV_62 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL, PLLI2S and PLLSAI division factor by 62 */ +#define LL_RCC_PLLM_DIV_63 (RCC_PLLCFGR_PLLM_5 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL, PLLI2S and PLLSAI division factor by 63 */ +/** + * @} + */ + +#if defined(RCC_PLLCFGR_PLLR) +/** @defgroup RCC_LL_EC_PLLR_DIV PLL division factor (PLLR) + * @{ + */ +#define LL_RCC_PLLR_DIV_2 (RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 2 */ +#define LL_RCC_PLLR_DIV_3 (RCC_PLLCFGR_PLLR_1|RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 3 */ +#define LL_RCC_PLLR_DIV_4 (RCC_PLLCFGR_PLLR_2) /*!< Main PLL division factor for PLLCLK (system clock) by 4 */ +#define LL_RCC_PLLR_DIV_5 (RCC_PLLCFGR_PLLR_2|RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 5 */ +#define LL_RCC_PLLR_DIV_6 (RCC_PLLCFGR_PLLR_2|RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 6 */ +#define LL_RCC_PLLR_DIV_7 (RCC_PLLCFGR_PLLR) /*!< Main PLL division factor for PLLCLK (system clock) by 7 */ +/** + * @} + */ +#endif /* RCC_PLLCFGR_PLLR */ + +#if defined(RCC_DCKCFGR_PLLDIVR) +/** @defgroup RCC_LL_EC_PLLDIVR PLLDIVR division factor (PLLDIVR) + * @{ + */ +#define LL_RCC_PLLDIVR_DIV_1 (RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 1 */ +#define LL_RCC_PLLDIVR_DIV_2 (RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 2 */ +#define LL_RCC_PLLDIVR_DIV_3 (RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 3 */ +#define LL_RCC_PLLDIVR_DIV_4 (RCC_DCKCFGR_PLLDIVR_2) /*!< PLL division factor for PLLDIVR output by 4 */ +#define LL_RCC_PLLDIVR_DIV_5 (RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 5 */ +#define LL_RCC_PLLDIVR_DIV_6 (RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 6 */ +#define LL_RCC_PLLDIVR_DIV_7 (RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 7 */ +#define LL_RCC_PLLDIVR_DIV_8 (RCC_DCKCFGR_PLLDIVR_3) /*!< PLL division factor for PLLDIVR output by 8 */ +#define LL_RCC_PLLDIVR_DIV_9 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 9 */ +#define LL_RCC_PLLDIVR_DIV_10 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 10 */ +#define LL_RCC_PLLDIVR_DIV_11 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 11 */ +#define LL_RCC_PLLDIVR_DIV_12 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2) /*!< PLL division factor for PLLDIVR output by 12 */ +#define LL_RCC_PLLDIVR_DIV_13 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 13 */ +#define LL_RCC_PLLDIVR_DIV_14 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 14 */ +#define LL_RCC_PLLDIVR_DIV_15 (RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 15 */ +#define LL_RCC_PLLDIVR_DIV_16 (RCC_DCKCFGR_PLLDIVR_4) /*!< PLL division factor for PLLDIVR output by 16 */ +#define LL_RCC_PLLDIVR_DIV_17 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 17 */ +#define LL_RCC_PLLDIVR_DIV_18 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 18 */ +#define LL_RCC_PLLDIVR_DIV_19 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 19 */ +#define LL_RCC_PLLDIVR_DIV_20 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_2) /*!< PLL division factor for PLLDIVR output by 20 */ +#define LL_RCC_PLLDIVR_DIV_21 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 21 */ +#define LL_RCC_PLLDIVR_DIV_22 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 22 */ +#define LL_RCC_PLLDIVR_DIV_23 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 23 */ +#define LL_RCC_PLLDIVR_DIV_24 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3) /*!< PLL division factor for PLLDIVR output by 24 */ +#define LL_RCC_PLLDIVR_DIV_25 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 25 */ +#define LL_RCC_PLLDIVR_DIV_26 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 26 */ +#define LL_RCC_PLLDIVR_DIV_27 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 27 */ +#define LL_RCC_PLLDIVR_DIV_28 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2) /*!< PLL division factor for PLLDIVR output by 28 */ +#define LL_RCC_PLLDIVR_DIV_29 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 29 */ +#define LL_RCC_PLLDIVR_DIV_30 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1) /*!< PLL division factor for PLLDIVR output by 30 */ +#define LL_RCC_PLLDIVR_DIV_31 (RCC_DCKCFGR_PLLDIVR_4 | RCC_DCKCFGR_PLLDIVR_3 | RCC_DCKCFGR_PLLDIVR_2 | RCC_DCKCFGR_PLLDIVR_1 | RCC_DCKCFGR_PLLDIVR_0) /*!< PLL division factor for PLLDIVR output by 31 */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_PLLDIVR */ + +/** @defgroup RCC_LL_EC_PLLP_DIV PLL division factor (PLLP) + * @{ + */ +#define LL_RCC_PLLP_DIV_2 0x00000000U /*!< Main PLL division factor for PLLP output by 2 */ +#define LL_RCC_PLLP_DIV_4 RCC_PLLCFGR_PLLP_0 /*!< Main PLL division factor for PLLP output by 4 */ +#define LL_RCC_PLLP_DIV_6 RCC_PLLCFGR_PLLP_1 /*!< Main PLL division factor for PLLP output by 6 */ +#define LL_RCC_PLLP_DIV_8 (RCC_PLLCFGR_PLLP_1 | RCC_PLLCFGR_PLLP_0) /*!< Main PLL division factor for PLLP output by 8 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLLQ_DIV PLL division factor (PLLQ) + * @{ + */ +#define LL_RCC_PLLQ_DIV_2 RCC_PLLCFGR_PLLQ_1 /*!< Main PLL division factor for PLLQ output by 2 */ +#define LL_RCC_PLLQ_DIV_3 (RCC_PLLCFGR_PLLQ_1|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 3 */ +#define LL_RCC_PLLQ_DIV_4 RCC_PLLCFGR_PLLQ_2 /*!< Main PLL division factor for PLLQ output by 4 */ +#define LL_RCC_PLLQ_DIV_5 (RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 5 */ +#define LL_RCC_PLLQ_DIV_6 (RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 6 */ +#define LL_RCC_PLLQ_DIV_7 (RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_1|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 7 */ +#define LL_RCC_PLLQ_DIV_8 RCC_PLLCFGR_PLLQ_3 /*!< Main PLL division factor for PLLQ output by 8 */ +#define LL_RCC_PLLQ_DIV_9 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 9 */ +#define LL_RCC_PLLQ_DIV_10 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 10 */ +#define LL_RCC_PLLQ_DIV_11 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_1|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 11 */ +#define LL_RCC_PLLQ_DIV_12 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_2) /*!< Main PLL division factor for PLLQ output by 12 */ +#define LL_RCC_PLLQ_DIV_13 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 13 */ +#define LL_RCC_PLLQ_DIV_14 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 14 */ +#define LL_RCC_PLLQ_DIV_15 (RCC_PLLCFGR_PLLQ_3|RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_1|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 15 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLL_SPRE_SEL PLL Spread Spectrum Selection + * @{ + */ +#define LL_RCC_SPREAD_SELECT_CENTER 0x00000000U /*!< PLL center spread spectrum selection */ +#define LL_RCC_SPREAD_SELECT_DOWN RCC_SSCGR_SPREADSEL /*!< PLL down spread spectrum selection */ +/** + * @} + */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** @defgroup RCC_LL_EC_PLLI2SM PLLI2SM division factor (PLLI2SM) + * @{ + */ +#if defined(RCC_PLLI2SCFGR_PLLI2SM) +#define LL_RCC_PLLI2SM_DIV_2 (RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 2 */ +#define LL_RCC_PLLI2SM_DIV_3 (RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 3 */ +#define LL_RCC_PLLI2SM_DIV_4 (RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 4 */ +#define LL_RCC_PLLI2SM_DIV_5 (RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 5 */ +#define LL_RCC_PLLI2SM_DIV_6 (RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 6 */ +#define LL_RCC_PLLI2SM_DIV_7 (RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 7 */ +#define LL_RCC_PLLI2SM_DIV_8 (RCC_PLLI2SCFGR_PLLI2SM_3) /*!< PLLI2S division factor for PLLI2SM output by 8 */ +#define LL_RCC_PLLI2SM_DIV_9 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 9 */ +#define LL_RCC_PLLI2SM_DIV_10 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 10 */ +#define LL_RCC_PLLI2SM_DIV_11 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 11 */ +#define LL_RCC_PLLI2SM_DIV_12 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 12 */ +#define LL_RCC_PLLI2SM_DIV_13 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 13 */ +#define LL_RCC_PLLI2SM_DIV_14 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 14 */ +#define LL_RCC_PLLI2SM_DIV_15 (RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 15 */ +#define LL_RCC_PLLI2SM_DIV_16 (RCC_PLLI2SCFGR_PLLI2SM_4) /*!< PLLI2S division factor for PLLI2SM output by 16 */ +#define LL_RCC_PLLI2SM_DIV_17 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 17 */ +#define LL_RCC_PLLI2SM_DIV_18 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 18 */ +#define LL_RCC_PLLI2SM_DIV_19 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 19 */ +#define LL_RCC_PLLI2SM_DIV_20 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 20 */ +#define LL_RCC_PLLI2SM_DIV_21 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 21 */ +#define LL_RCC_PLLI2SM_DIV_22 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 22 */ +#define LL_RCC_PLLI2SM_DIV_23 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 23 */ +#define LL_RCC_PLLI2SM_DIV_24 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3) /*!< PLLI2S division factor for PLLI2SM output by 24 */ +#define LL_RCC_PLLI2SM_DIV_25 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 25 */ +#define LL_RCC_PLLI2SM_DIV_26 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 26 */ +#define LL_RCC_PLLI2SM_DIV_27 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 27 */ +#define LL_RCC_PLLI2SM_DIV_28 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 28 */ +#define LL_RCC_PLLI2SM_DIV_29 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 29 */ +#define LL_RCC_PLLI2SM_DIV_30 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 30 */ +#define LL_RCC_PLLI2SM_DIV_31 (RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 31 */ +#define LL_RCC_PLLI2SM_DIV_32 (RCC_PLLI2SCFGR_PLLI2SM_5) /*!< PLLI2S division factor for PLLI2SM output by 32 */ +#define LL_RCC_PLLI2SM_DIV_33 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 33 */ +#define LL_RCC_PLLI2SM_DIV_34 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 34 */ +#define LL_RCC_PLLI2SM_DIV_35 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 35 */ +#define LL_RCC_PLLI2SM_DIV_36 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 36 */ +#define LL_RCC_PLLI2SM_DIV_37 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 37 */ +#define LL_RCC_PLLI2SM_DIV_38 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 38 */ +#define LL_RCC_PLLI2SM_DIV_39 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 39 */ +#define LL_RCC_PLLI2SM_DIV_40 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3) /*!< PLLI2S division factor for PLLI2SM output by 40 */ +#define LL_RCC_PLLI2SM_DIV_41 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 41 */ +#define LL_RCC_PLLI2SM_DIV_42 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 42 */ +#define LL_RCC_PLLI2SM_DIV_43 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 43 */ +#define LL_RCC_PLLI2SM_DIV_44 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 44 */ +#define LL_RCC_PLLI2SM_DIV_45 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 45 */ +#define LL_RCC_PLLI2SM_DIV_46 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 46 */ +#define LL_RCC_PLLI2SM_DIV_47 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 47 */ +#define LL_RCC_PLLI2SM_DIV_48 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4) /*!< PLLI2S division factor for PLLI2SM output by 48 */ +#define LL_RCC_PLLI2SM_DIV_49 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 49 */ +#define LL_RCC_PLLI2SM_DIV_50 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 50 */ +#define LL_RCC_PLLI2SM_DIV_51 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 51 */ +#define LL_RCC_PLLI2SM_DIV_52 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 52 */ +#define LL_RCC_PLLI2SM_DIV_53 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 53 */ +#define LL_RCC_PLLI2SM_DIV_54 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 54 */ +#define LL_RCC_PLLI2SM_DIV_55 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 55 */ +#define LL_RCC_PLLI2SM_DIV_56 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3) /*!< PLLI2S division factor for PLLI2SM output by 56 */ +#define LL_RCC_PLLI2SM_DIV_57 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 57 */ +#define LL_RCC_PLLI2SM_DIV_58 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 58 */ +#define LL_RCC_PLLI2SM_DIV_59 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 59 */ +#define LL_RCC_PLLI2SM_DIV_60 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2) /*!< PLLI2S division factor for PLLI2SM output by 60 */ +#define LL_RCC_PLLI2SM_DIV_61 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 61 */ +#define LL_RCC_PLLI2SM_DIV_62 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1) /*!< PLLI2S division factor for PLLI2SM output by 62 */ +#define LL_RCC_PLLI2SM_DIV_63 (RCC_PLLI2SCFGR_PLLI2SM_5 | RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SM_3 | RCC_PLLI2SCFGR_PLLI2SM_2 | RCC_PLLI2SCFGR_PLLI2SM_1 | RCC_PLLI2SCFGR_PLLI2SM_0) /*!< PLLI2S division factor for PLLI2SM output by 63 */ +#else +#define LL_RCC_PLLI2SM_DIV_2 LL_RCC_PLLM_DIV_2 /*!< PLLI2S division factor for PLLI2SM output by 2 */ +#define LL_RCC_PLLI2SM_DIV_3 LL_RCC_PLLM_DIV_3 /*!< PLLI2S division factor for PLLI2SM output by 3 */ +#define LL_RCC_PLLI2SM_DIV_4 LL_RCC_PLLM_DIV_4 /*!< PLLI2S division factor for PLLI2SM output by 4 */ +#define LL_RCC_PLLI2SM_DIV_5 LL_RCC_PLLM_DIV_5 /*!< PLLI2S division factor for PLLI2SM output by 5 */ +#define LL_RCC_PLLI2SM_DIV_6 LL_RCC_PLLM_DIV_6 /*!< PLLI2S division factor for PLLI2SM output by 6 */ +#define LL_RCC_PLLI2SM_DIV_7 LL_RCC_PLLM_DIV_7 /*!< PLLI2S division factor for PLLI2SM output by 7 */ +#define LL_RCC_PLLI2SM_DIV_8 LL_RCC_PLLM_DIV_8 /*!< PLLI2S division factor for PLLI2SM output by 8 */ +#define LL_RCC_PLLI2SM_DIV_9 LL_RCC_PLLM_DIV_9 /*!< PLLI2S division factor for PLLI2SM output by 9 */ +#define LL_RCC_PLLI2SM_DIV_10 LL_RCC_PLLM_DIV_10 /*!< PLLI2S division factor for PLLI2SM output by 10 */ +#define LL_RCC_PLLI2SM_DIV_11 LL_RCC_PLLM_DIV_11 /*!< PLLI2S division factor for PLLI2SM output by 11 */ +#define LL_RCC_PLLI2SM_DIV_12 LL_RCC_PLLM_DIV_12 /*!< PLLI2S division factor for PLLI2SM output by 12 */ +#define LL_RCC_PLLI2SM_DIV_13 LL_RCC_PLLM_DIV_13 /*!< PLLI2S division factor for PLLI2SM output by 13 */ +#define LL_RCC_PLLI2SM_DIV_14 LL_RCC_PLLM_DIV_14 /*!< PLLI2S division factor for PLLI2SM output by 14 */ +#define LL_RCC_PLLI2SM_DIV_15 LL_RCC_PLLM_DIV_15 /*!< PLLI2S division factor for PLLI2SM output by 15 */ +#define LL_RCC_PLLI2SM_DIV_16 LL_RCC_PLLM_DIV_16 /*!< PLLI2S division factor for PLLI2SM output by 16 */ +#define LL_RCC_PLLI2SM_DIV_17 LL_RCC_PLLM_DIV_17 /*!< PLLI2S division factor for PLLI2SM output by 17 */ +#define LL_RCC_PLLI2SM_DIV_18 LL_RCC_PLLM_DIV_18 /*!< PLLI2S division factor for PLLI2SM output by 18 */ +#define LL_RCC_PLLI2SM_DIV_19 LL_RCC_PLLM_DIV_19 /*!< PLLI2S division factor for PLLI2SM output by 19 */ +#define LL_RCC_PLLI2SM_DIV_20 LL_RCC_PLLM_DIV_20 /*!< PLLI2S division factor for PLLI2SM output by 20 */ +#define LL_RCC_PLLI2SM_DIV_21 LL_RCC_PLLM_DIV_21 /*!< PLLI2S division factor for PLLI2SM output by 21 */ +#define LL_RCC_PLLI2SM_DIV_22 LL_RCC_PLLM_DIV_22 /*!< PLLI2S division factor for PLLI2SM output by 22 */ +#define LL_RCC_PLLI2SM_DIV_23 LL_RCC_PLLM_DIV_23 /*!< PLLI2S division factor for PLLI2SM output by 23 */ +#define LL_RCC_PLLI2SM_DIV_24 LL_RCC_PLLM_DIV_24 /*!< PLLI2S division factor for PLLI2SM output by 24 */ +#define LL_RCC_PLLI2SM_DIV_25 LL_RCC_PLLM_DIV_25 /*!< PLLI2S division factor for PLLI2SM output by 25 */ +#define LL_RCC_PLLI2SM_DIV_26 LL_RCC_PLLM_DIV_26 /*!< PLLI2S division factor for PLLI2SM output by 26 */ +#define LL_RCC_PLLI2SM_DIV_27 LL_RCC_PLLM_DIV_27 /*!< PLLI2S division factor for PLLI2SM output by 27 */ +#define LL_RCC_PLLI2SM_DIV_28 LL_RCC_PLLM_DIV_28 /*!< PLLI2S division factor for PLLI2SM output by 28 */ +#define LL_RCC_PLLI2SM_DIV_29 LL_RCC_PLLM_DIV_29 /*!< PLLI2S division factor for PLLI2SM output by 29 */ +#define LL_RCC_PLLI2SM_DIV_30 LL_RCC_PLLM_DIV_30 /*!< PLLI2S division factor for PLLI2SM output by 30 */ +#define LL_RCC_PLLI2SM_DIV_31 LL_RCC_PLLM_DIV_31 /*!< PLLI2S division factor for PLLI2SM output by 31 */ +#define LL_RCC_PLLI2SM_DIV_32 LL_RCC_PLLM_DIV_32 /*!< PLLI2S division factor for PLLI2SM output by 32 */ +#define LL_RCC_PLLI2SM_DIV_33 LL_RCC_PLLM_DIV_33 /*!< PLLI2S division factor for PLLI2SM output by 33 */ +#define LL_RCC_PLLI2SM_DIV_34 LL_RCC_PLLM_DIV_34 /*!< PLLI2S division factor for PLLI2SM output by 34 */ +#define LL_RCC_PLLI2SM_DIV_35 LL_RCC_PLLM_DIV_35 /*!< PLLI2S division factor for PLLI2SM output by 35 */ +#define LL_RCC_PLLI2SM_DIV_36 LL_RCC_PLLM_DIV_36 /*!< PLLI2S division factor for PLLI2SM output by 36 */ +#define LL_RCC_PLLI2SM_DIV_37 LL_RCC_PLLM_DIV_37 /*!< PLLI2S division factor for PLLI2SM output by 37 */ +#define LL_RCC_PLLI2SM_DIV_38 LL_RCC_PLLM_DIV_38 /*!< PLLI2S division factor for PLLI2SM output by 38 */ +#define LL_RCC_PLLI2SM_DIV_39 LL_RCC_PLLM_DIV_39 /*!< PLLI2S division factor for PLLI2SM output by 39 */ +#define LL_RCC_PLLI2SM_DIV_40 LL_RCC_PLLM_DIV_40 /*!< PLLI2S division factor for PLLI2SM output by 40 */ +#define LL_RCC_PLLI2SM_DIV_41 LL_RCC_PLLM_DIV_41 /*!< PLLI2S division factor for PLLI2SM output by 41 */ +#define LL_RCC_PLLI2SM_DIV_42 LL_RCC_PLLM_DIV_42 /*!< PLLI2S division factor for PLLI2SM output by 42 */ +#define LL_RCC_PLLI2SM_DIV_43 LL_RCC_PLLM_DIV_43 /*!< PLLI2S division factor for PLLI2SM output by 43 */ +#define LL_RCC_PLLI2SM_DIV_44 LL_RCC_PLLM_DIV_44 /*!< PLLI2S division factor for PLLI2SM output by 44 */ +#define LL_RCC_PLLI2SM_DIV_45 LL_RCC_PLLM_DIV_45 /*!< PLLI2S division factor for PLLI2SM output by 45 */ +#define LL_RCC_PLLI2SM_DIV_46 LL_RCC_PLLM_DIV_46 /*!< PLLI2S division factor for PLLI2SM output by 46 */ +#define LL_RCC_PLLI2SM_DIV_47 LL_RCC_PLLM_DIV_47 /*!< PLLI2S division factor for PLLI2SM output by 47 */ +#define LL_RCC_PLLI2SM_DIV_48 LL_RCC_PLLM_DIV_48 /*!< PLLI2S division factor for PLLI2SM output by 48 */ +#define LL_RCC_PLLI2SM_DIV_49 LL_RCC_PLLM_DIV_49 /*!< PLLI2S division factor for PLLI2SM output by 49 */ +#define LL_RCC_PLLI2SM_DIV_50 LL_RCC_PLLM_DIV_50 /*!< PLLI2S division factor for PLLI2SM output by 50 */ +#define LL_RCC_PLLI2SM_DIV_51 LL_RCC_PLLM_DIV_51 /*!< PLLI2S division factor for PLLI2SM output by 51 */ +#define LL_RCC_PLLI2SM_DIV_52 LL_RCC_PLLM_DIV_52 /*!< PLLI2S division factor for PLLI2SM output by 52 */ +#define LL_RCC_PLLI2SM_DIV_53 LL_RCC_PLLM_DIV_53 /*!< PLLI2S division factor for PLLI2SM output by 53 */ +#define LL_RCC_PLLI2SM_DIV_54 LL_RCC_PLLM_DIV_54 /*!< PLLI2S division factor for PLLI2SM output by 54 */ +#define LL_RCC_PLLI2SM_DIV_55 LL_RCC_PLLM_DIV_55 /*!< PLLI2S division factor for PLLI2SM output by 55 */ +#define LL_RCC_PLLI2SM_DIV_56 LL_RCC_PLLM_DIV_56 /*!< PLLI2S division factor for PLLI2SM output by 56 */ +#define LL_RCC_PLLI2SM_DIV_57 LL_RCC_PLLM_DIV_57 /*!< PLLI2S division factor for PLLI2SM output by 57 */ +#define LL_RCC_PLLI2SM_DIV_58 LL_RCC_PLLM_DIV_58 /*!< PLLI2S division factor for PLLI2SM output by 58 */ +#define LL_RCC_PLLI2SM_DIV_59 LL_RCC_PLLM_DIV_59 /*!< PLLI2S division factor for PLLI2SM output by 59 */ +#define LL_RCC_PLLI2SM_DIV_60 LL_RCC_PLLM_DIV_60 /*!< PLLI2S division factor for PLLI2SM output by 60 */ +#define LL_RCC_PLLI2SM_DIV_61 LL_RCC_PLLM_DIV_61 /*!< PLLI2S division factor for PLLI2SM output by 61 */ +#define LL_RCC_PLLI2SM_DIV_62 LL_RCC_PLLM_DIV_62 /*!< PLLI2S division factor for PLLI2SM output by 62 */ +#define LL_RCC_PLLI2SM_DIV_63 LL_RCC_PLLM_DIV_63 /*!< PLLI2S division factor for PLLI2SM output by 63 */ +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ +/** + * @} + */ + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) +/** @defgroup RCC_LL_EC_PLLI2SQ PLLI2SQ division factor (PLLI2SQ) + * @{ + */ +#define LL_RCC_PLLI2SQ_DIV_2 RCC_PLLI2SCFGR_PLLI2SQ_1 /*!< PLLI2S division factor for PLLI2SQ output by 2 */ +#define LL_RCC_PLLI2SQ_DIV_3 (RCC_PLLI2SCFGR_PLLI2SQ_1 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 3 */ +#define LL_RCC_PLLI2SQ_DIV_4 RCC_PLLI2SCFGR_PLLI2SQ_2 /*!< PLLI2S division factor for PLLI2SQ output by 4 */ +#define LL_RCC_PLLI2SQ_DIV_5 (RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 5 */ +#define LL_RCC_PLLI2SQ_DIV_6 (RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_1) /*!< PLLI2S division factor for PLLI2SQ output by 6 */ +#define LL_RCC_PLLI2SQ_DIV_7 (RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_1 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 7 */ +#define LL_RCC_PLLI2SQ_DIV_8 RCC_PLLI2SCFGR_PLLI2SQ_3 /*!< PLLI2S division factor for PLLI2SQ output by 8 */ +#define LL_RCC_PLLI2SQ_DIV_9 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 9 */ +#define LL_RCC_PLLI2SQ_DIV_10 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_1) /*!< PLLI2S division factor for PLLI2SQ output by 10 */ +#define LL_RCC_PLLI2SQ_DIV_11 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_1 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 11 */ +#define LL_RCC_PLLI2SQ_DIV_12 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_2) /*!< PLLI2S division factor for PLLI2SQ output by 12 */ +#define LL_RCC_PLLI2SQ_DIV_13 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 13 */ +#define LL_RCC_PLLI2SQ_DIV_14 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_1) /*!< PLLI2S division factor for PLLI2SQ output by 14 */ +#define LL_RCC_PLLI2SQ_DIV_15 (RCC_PLLI2SCFGR_PLLI2SQ_3 | RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SQ_1 | RCC_PLLI2SCFGR_PLLI2SQ_0) /*!< PLLI2S division factor for PLLI2SQ output by 15 */ +/** + * @} + */ +#endif /* RCC_PLLI2SCFGR_PLLI2SQ */ + +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) +/** @defgroup RCC_LL_EC_PLLI2SDIVQ PLLI2SDIVQ division factor (PLLI2SDIVQ) + * @{ + */ +#define LL_RCC_PLLI2SDIVQ_DIV_1 0x00000000U /*!< PLLI2S division factor for PLLI2SDIVQ output by 1 */ +#define LL_RCC_PLLI2SDIVQ_DIV_2 RCC_DCKCFGR_PLLI2SDIVQ_0 /*!< PLLI2S division factor for PLLI2SDIVQ output by 2 */ +#define LL_RCC_PLLI2SDIVQ_DIV_3 RCC_DCKCFGR_PLLI2SDIVQ_1 /*!< PLLI2S division factor for PLLI2SDIVQ output by 3 */ +#define LL_RCC_PLLI2SDIVQ_DIV_4 (RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 4 */ +#define LL_RCC_PLLI2SDIVQ_DIV_5 RCC_DCKCFGR_PLLI2SDIVQ_2 /*!< PLLI2S division factor for PLLI2SDIVQ output by 5 */ +#define LL_RCC_PLLI2SDIVQ_DIV_6 (RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 6 */ +#define LL_RCC_PLLI2SDIVQ_DIV_7 (RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 7 */ +#define LL_RCC_PLLI2SDIVQ_DIV_8 (RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 8 */ +#define LL_RCC_PLLI2SDIVQ_DIV_9 RCC_DCKCFGR_PLLI2SDIVQ_3 /*!< PLLI2S division factor for PLLI2SDIVQ output by 9 */ +#define LL_RCC_PLLI2SDIVQ_DIV_10 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 10 */ +#define LL_RCC_PLLI2SDIVQ_DIV_11 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 11 */ +#define LL_RCC_PLLI2SDIVQ_DIV_12 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 12 */ +#define LL_RCC_PLLI2SDIVQ_DIV_13 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2) /*!< PLLI2S division factor for PLLI2SDIVQ output by 13 */ +#define LL_RCC_PLLI2SDIVQ_DIV_14 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 14 */ +#define LL_RCC_PLLI2SDIVQ_DIV_15 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 15 */ +#define LL_RCC_PLLI2SDIVQ_DIV_16 (RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 16 */ +#define LL_RCC_PLLI2SDIVQ_DIV_17 RCC_DCKCFGR_PLLI2SDIVQ_4 /*!< PLLI2S division factor for PLLI2SDIVQ output by 17 */ +#define LL_RCC_PLLI2SDIVQ_DIV_18 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 18 */ +#define LL_RCC_PLLI2SDIVQ_DIV_19 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 19 */ +#define LL_RCC_PLLI2SDIVQ_DIV_20 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 20 */ +#define LL_RCC_PLLI2SDIVQ_DIV_21 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_2) /*!< PLLI2S division factor for PLLI2SDIVQ output by 21 */ +#define LL_RCC_PLLI2SDIVQ_DIV_22 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 22 */ +#define LL_RCC_PLLI2SDIVQ_DIV_23 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 23 */ +#define LL_RCC_PLLI2SDIVQ_DIV_24 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 24 */ +#define LL_RCC_PLLI2SDIVQ_DIV_25 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3) /*!< PLLI2S division factor for PLLI2SDIVQ output by 25 */ +#define LL_RCC_PLLI2SDIVQ_DIV_26 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 26 */ +#define LL_RCC_PLLI2SDIVQ_DIV_27 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 27 */ +#define LL_RCC_PLLI2SDIVQ_DIV_28 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 28 */ +#define LL_RCC_PLLI2SDIVQ_DIV_29 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2) /*!< PLLI2S division factor for PLLI2SDIVQ output by 29 */ +#define LL_RCC_PLLI2SDIVQ_DIV_30 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 30 */ +#define LL_RCC_PLLI2SDIVQ_DIV_31 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1) /*!< PLLI2S division factor for PLLI2SDIVQ output by 31 */ +#define LL_RCC_PLLI2SDIVQ_DIV_32 (RCC_DCKCFGR_PLLI2SDIVQ_4 | RCC_DCKCFGR_PLLI2SDIVQ_3 | RCC_DCKCFGR_PLLI2SDIVQ_2 | RCC_DCKCFGR_PLLI2SDIVQ_1 | RCC_DCKCFGR_PLLI2SDIVQ_0) /*!< PLLI2S division factor for PLLI2SDIVQ output by 32 */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_PLLI2SDIVQ */ + +#if defined(RCC_DCKCFGR_PLLI2SDIVR) +/** @defgroup RCC_LL_EC_PLLI2SDIVR PLLI2SDIVR division factor (PLLI2SDIVR) + * @{ + */ +#define LL_RCC_PLLI2SDIVR_DIV_1 (RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 1 */ +#define LL_RCC_PLLI2SDIVR_DIV_2 (RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 2 */ +#define LL_RCC_PLLI2SDIVR_DIV_3 (RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 3 */ +#define LL_RCC_PLLI2SDIVR_DIV_4 (RCC_DCKCFGR_PLLI2SDIVR_2) /*!< PLLI2S division factor for PLLI2SDIVR output by 4 */ +#define LL_RCC_PLLI2SDIVR_DIV_5 (RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 5 */ +#define LL_RCC_PLLI2SDIVR_DIV_6 (RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 6 */ +#define LL_RCC_PLLI2SDIVR_DIV_7 (RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 7 */ +#define LL_RCC_PLLI2SDIVR_DIV_8 (RCC_DCKCFGR_PLLI2SDIVR_3) /*!< PLLI2S division factor for PLLI2SDIVR output by 8 */ +#define LL_RCC_PLLI2SDIVR_DIV_9 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 9 */ +#define LL_RCC_PLLI2SDIVR_DIV_10 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 10 */ +#define LL_RCC_PLLI2SDIVR_DIV_11 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 11 */ +#define LL_RCC_PLLI2SDIVR_DIV_12 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2) /*!< PLLI2S division factor for PLLI2SDIVR output by 12 */ +#define LL_RCC_PLLI2SDIVR_DIV_13 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 13 */ +#define LL_RCC_PLLI2SDIVR_DIV_14 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 14 */ +#define LL_RCC_PLLI2SDIVR_DIV_15 (RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 15 */ +#define LL_RCC_PLLI2SDIVR_DIV_16 (RCC_DCKCFGR_PLLI2SDIVR_4) /*!< PLLI2S division factor for PLLI2SDIVR output by 16 */ +#define LL_RCC_PLLI2SDIVR_DIV_17 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 17 */ +#define LL_RCC_PLLI2SDIVR_DIV_18 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 18 */ +#define LL_RCC_PLLI2SDIVR_DIV_19 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 19 */ +#define LL_RCC_PLLI2SDIVR_DIV_20 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_2) /*!< PLLI2S division factor for PLLI2SDIVR output by 20 */ +#define LL_RCC_PLLI2SDIVR_DIV_21 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 21 */ +#define LL_RCC_PLLI2SDIVR_DIV_22 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 22 */ +#define LL_RCC_PLLI2SDIVR_DIV_23 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 23 */ +#define LL_RCC_PLLI2SDIVR_DIV_24 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3) /*!< PLLI2S division factor for PLLI2SDIVR output by 24 */ +#define LL_RCC_PLLI2SDIVR_DIV_25 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 25 */ +#define LL_RCC_PLLI2SDIVR_DIV_26 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 26 */ +#define LL_RCC_PLLI2SDIVR_DIV_27 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 27 */ +#define LL_RCC_PLLI2SDIVR_DIV_28 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2) /*!< PLLI2S division factor for PLLI2SDIVR output by 28 */ +#define LL_RCC_PLLI2SDIVR_DIV_29 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 29 */ +#define LL_RCC_PLLI2SDIVR_DIV_30 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1) /*!< PLLI2S division factor for PLLI2SDIVR output by 30 */ +#define LL_RCC_PLLI2SDIVR_DIV_31 (RCC_DCKCFGR_PLLI2SDIVR_4 | RCC_DCKCFGR_PLLI2SDIVR_3 | RCC_DCKCFGR_PLLI2SDIVR_2 | RCC_DCKCFGR_PLLI2SDIVR_1 | RCC_DCKCFGR_PLLI2SDIVR_0) /*!< PLLI2S division factor for PLLI2SDIVR output by 31 */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_PLLI2SDIVR */ + +/** @defgroup RCC_LL_EC_PLLI2SR PLLI2SR division factor (PLLI2SR) + * @{ + */ +#define LL_RCC_PLLI2SR_DIV_2 RCC_PLLI2SCFGR_PLLI2SR_1 /*!< PLLI2S division factor for PLLI2SR output by 2 */ +#define LL_RCC_PLLI2SR_DIV_3 (RCC_PLLI2SCFGR_PLLI2SR_1 | RCC_PLLI2SCFGR_PLLI2SR_0) /*!< PLLI2S division factor for PLLI2SR output by 3 */ +#define LL_RCC_PLLI2SR_DIV_4 RCC_PLLI2SCFGR_PLLI2SR_2 /*!< PLLI2S division factor for PLLI2SR output by 4 */ +#define LL_RCC_PLLI2SR_DIV_5 (RCC_PLLI2SCFGR_PLLI2SR_2 | RCC_PLLI2SCFGR_PLLI2SR_0) /*!< PLLI2S division factor for PLLI2SR output by 5 */ +#define LL_RCC_PLLI2SR_DIV_6 (RCC_PLLI2SCFGR_PLLI2SR_2 | RCC_PLLI2SCFGR_PLLI2SR_1) /*!< PLLI2S division factor for PLLI2SR output by 6 */ +#define LL_RCC_PLLI2SR_DIV_7 (RCC_PLLI2SCFGR_PLLI2SR_2 | RCC_PLLI2SCFGR_PLLI2SR_1 | RCC_PLLI2SCFGR_PLLI2SR_0) /*!< PLLI2S division factor for PLLI2SR output by 7 */ +/** + * @} + */ + +#if defined(RCC_PLLI2SCFGR_PLLI2SP) +/** @defgroup RCC_LL_EC_PLLI2SP PLLI2SP division factor (PLLI2SP) + * @{ + */ +#define LL_RCC_PLLI2SP_DIV_2 0x00000000U /*!< PLLI2S division factor for PLLI2SP output by 2 */ +#define LL_RCC_PLLI2SP_DIV_4 RCC_PLLI2SCFGR_PLLI2SP_0 /*!< PLLI2S division factor for PLLI2SP output by 4 */ +#define LL_RCC_PLLI2SP_DIV_6 RCC_PLLI2SCFGR_PLLI2SP_1 /*!< PLLI2S division factor for PLLI2SP output by 6 */ +#define LL_RCC_PLLI2SP_DIV_8 (RCC_PLLI2SCFGR_PLLI2SP_1 | RCC_PLLI2SCFGR_PLLI2SP_0) /*!< PLLI2S division factor for PLLI2SP output by 8 */ +/** + * @} + */ +#endif /* RCC_PLLI2SCFGR_PLLI2SP */ +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** @defgroup RCC_LL_EC_PLLSAIM PLLSAIM division factor (PLLSAIM or PLLM) + * @{ + */ +#if defined(RCC_PLLSAICFGR_PLLSAIM) +#define LL_RCC_PLLSAIM_DIV_2 (RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 2 */ +#define LL_RCC_PLLSAIM_DIV_3 (RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 3 */ +#define LL_RCC_PLLSAIM_DIV_4 (RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 4 */ +#define LL_RCC_PLLSAIM_DIV_5 (RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 5 */ +#define LL_RCC_PLLSAIM_DIV_6 (RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 6 */ +#define LL_RCC_PLLSAIM_DIV_7 (RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 7 */ +#define LL_RCC_PLLSAIM_DIV_8 (RCC_PLLSAICFGR_PLLSAIM_3) /*!< PLLSAI division factor for PLLSAIM output by 8 */ +#define LL_RCC_PLLSAIM_DIV_9 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 9 */ +#define LL_RCC_PLLSAIM_DIV_10 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 10 */ +#define LL_RCC_PLLSAIM_DIV_11 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 11 */ +#define LL_RCC_PLLSAIM_DIV_12 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 12 */ +#define LL_RCC_PLLSAIM_DIV_13 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 13 */ +#define LL_RCC_PLLSAIM_DIV_14 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 14 */ +#define LL_RCC_PLLSAIM_DIV_15 (RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 15 */ +#define LL_RCC_PLLSAIM_DIV_16 (RCC_PLLSAICFGR_PLLSAIM_4) /*!< PLLSAI division factor for PLLSAIM output by 16 */ +#define LL_RCC_PLLSAIM_DIV_17 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 17 */ +#define LL_RCC_PLLSAIM_DIV_18 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 18 */ +#define LL_RCC_PLLSAIM_DIV_19 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 19 */ +#define LL_RCC_PLLSAIM_DIV_20 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 20 */ +#define LL_RCC_PLLSAIM_DIV_21 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 21 */ +#define LL_RCC_PLLSAIM_DIV_22 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 22 */ +#define LL_RCC_PLLSAIM_DIV_23 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 23 */ +#define LL_RCC_PLLSAIM_DIV_24 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3) /*!< PLLSAI division factor for PLLSAIM output by 24 */ +#define LL_RCC_PLLSAIM_DIV_25 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 25 */ +#define LL_RCC_PLLSAIM_DIV_26 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 26 */ +#define LL_RCC_PLLSAIM_DIV_27 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 27 */ +#define LL_RCC_PLLSAIM_DIV_28 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 28 */ +#define LL_RCC_PLLSAIM_DIV_29 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 29 */ +#define LL_RCC_PLLSAIM_DIV_30 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 30 */ +#define LL_RCC_PLLSAIM_DIV_31 (RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 31 */ +#define LL_RCC_PLLSAIM_DIV_32 (RCC_PLLSAICFGR_PLLSAIM_5) /*!< PLLSAI division factor for PLLSAIM output by 32 */ +#define LL_RCC_PLLSAIM_DIV_33 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 33 */ +#define LL_RCC_PLLSAIM_DIV_34 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 34 */ +#define LL_RCC_PLLSAIM_DIV_35 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 35 */ +#define LL_RCC_PLLSAIM_DIV_36 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 36 */ +#define LL_RCC_PLLSAIM_DIV_37 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 37 */ +#define LL_RCC_PLLSAIM_DIV_38 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 38 */ +#define LL_RCC_PLLSAIM_DIV_39 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 39 */ +#define LL_RCC_PLLSAIM_DIV_40 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3) /*!< PLLSAI division factor for PLLSAIM output by 40 */ +#define LL_RCC_PLLSAIM_DIV_41 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 41 */ +#define LL_RCC_PLLSAIM_DIV_42 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 42 */ +#define LL_RCC_PLLSAIM_DIV_43 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 43 */ +#define LL_RCC_PLLSAIM_DIV_44 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 44 */ +#define LL_RCC_PLLSAIM_DIV_45 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 45 */ +#define LL_RCC_PLLSAIM_DIV_46 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 46 */ +#define LL_RCC_PLLSAIM_DIV_47 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 47 */ +#define LL_RCC_PLLSAIM_DIV_48 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4) /*!< PLLSAI division factor for PLLSAIM output by 48 */ +#define LL_RCC_PLLSAIM_DIV_49 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 49 */ +#define LL_RCC_PLLSAIM_DIV_50 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 50 */ +#define LL_RCC_PLLSAIM_DIV_51 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 51 */ +#define LL_RCC_PLLSAIM_DIV_52 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 52 */ +#define LL_RCC_PLLSAIM_DIV_53 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 53 */ +#define LL_RCC_PLLSAIM_DIV_54 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 54 */ +#define LL_RCC_PLLSAIM_DIV_55 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 55 */ +#define LL_RCC_PLLSAIM_DIV_56 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3) /*!< PLLSAI division factor for PLLSAIM output by 56 */ +#define LL_RCC_PLLSAIM_DIV_57 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 57 */ +#define LL_RCC_PLLSAIM_DIV_58 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 58 */ +#define LL_RCC_PLLSAIM_DIV_59 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 59 */ +#define LL_RCC_PLLSAIM_DIV_60 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2) /*!< PLLSAI division factor for PLLSAIM output by 60 */ +#define LL_RCC_PLLSAIM_DIV_61 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 61 */ +#define LL_RCC_PLLSAIM_DIV_62 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1) /*!< PLLSAI division factor for PLLSAIM output by 62 */ +#define LL_RCC_PLLSAIM_DIV_63 (RCC_PLLSAICFGR_PLLSAIM_5 | RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIM_3 | RCC_PLLSAICFGR_PLLSAIM_2 | RCC_PLLSAICFGR_PLLSAIM_1 | RCC_PLLSAICFGR_PLLSAIM_0) /*!< PLLSAI division factor for PLLSAIM output by 63 */ +#else +#define LL_RCC_PLLSAIM_DIV_2 LL_RCC_PLLM_DIV_2 /*!< PLLSAI division factor for PLLSAIM output by 2 */ +#define LL_RCC_PLLSAIM_DIV_3 LL_RCC_PLLM_DIV_3 /*!< PLLSAI division factor for PLLSAIM output by 3 */ +#define LL_RCC_PLLSAIM_DIV_4 LL_RCC_PLLM_DIV_4 /*!< PLLSAI division factor for PLLSAIM output by 4 */ +#define LL_RCC_PLLSAIM_DIV_5 LL_RCC_PLLM_DIV_5 /*!< PLLSAI division factor for PLLSAIM output by 5 */ +#define LL_RCC_PLLSAIM_DIV_6 LL_RCC_PLLM_DIV_6 /*!< PLLSAI division factor for PLLSAIM output by 6 */ +#define LL_RCC_PLLSAIM_DIV_7 LL_RCC_PLLM_DIV_7 /*!< PLLSAI division factor for PLLSAIM output by 7 */ +#define LL_RCC_PLLSAIM_DIV_8 LL_RCC_PLLM_DIV_8 /*!< PLLSAI division factor for PLLSAIM output by 8 */ +#define LL_RCC_PLLSAIM_DIV_9 LL_RCC_PLLM_DIV_9 /*!< PLLSAI division factor for PLLSAIM output by 9 */ +#define LL_RCC_PLLSAIM_DIV_10 LL_RCC_PLLM_DIV_10 /*!< PLLSAI division factor for PLLSAIM output by 10 */ +#define LL_RCC_PLLSAIM_DIV_11 LL_RCC_PLLM_DIV_11 /*!< PLLSAI division factor for PLLSAIM output by 11 */ +#define LL_RCC_PLLSAIM_DIV_12 LL_RCC_PLLM_DIV_12 /*!< PLLSAI division factor for PLLSAIM output by 12 */ +#define LL_RCC_PLLSAIM_DIV_13 LL_RCC_PLLM_DIV_13 /*!< PLLSAI division factor for PLLSAIM output by 13 */ +#define LL_RCC_PLLSAIM_DIV_14 LL_RCC_PLLM_DIV_14 /*!< PLLSAI division factor for PLLSAIM output by 14 */ +#define LL_RCC_PLLSAIM_DIV_15 LL_RCC_PLLM_DIV_15 /*!< PLLSAI division factor for PLLSAIM output by 15 */ +#define LL_RCC_PLLSAIM_DIV_16 LL_RCC_PLLM_DIV_16 /*!< PLLSAI division factor for PLLSAIM output by 16 */ +#define LL_RCC_PLLSAIM_DIV_17 LL_RCC_PLLM_DIV_17 /*!< PLLSAI division factor for PLLSAIM output by 17 */ +#define LL_RCC_PLLSAIM_DIV_18 LL_RCC_PLLM_DIV_18 /*!< PLLSAI division factor for PLLSAIM output by 18 */ +#define LL_RCC_PLLSAIM_DIV_19 LL_RCC_PLLM_DIV_19 /*!< PLLSAI division factor for PLLSAIM output by 19 */ +#define LL_RCC_PLLSAIM_DIV_20 LL_RCC_PLLM_DIV_20 /*!< PLLSAI division factor for PLLSAIM output by 20 */ +#define LL_RCC_PLLSAIM_DIV_21 LL_RCC_PLLM_DIV_21 /*!< PLLSAI division factor for PLLSAIM output by 21 */ +#define LL_RCC_PLLSAIM_DIV_22 LL_RCC_PLLM_DIV_22 /*!< PLLSAI division factor for PLLSAIM output by 22 */ +#define LL_RCC_PLLSAIM_DIV_23 LL_RCC_PLLM_DIV_23 /*!< PLLSAI division factor for PLLSAIM output by 23 */ +#define LL_RCC_PLLSAIM_DIV_24 LL_RCC_PLLM_DIV_24 /*!< PLLSAI division factor for PLLSAIM output by 24 */ +#define LL_RCC_PLLSAIM_DIV_25 LL_RCC_PLLM_DIV_25 /*!< PLLSAI division factor for PLLSAIM output by 25 */ +#define LL_RCC_PLLSAIM_DIV_26 LL_RCC_PLLM_DIV_26 /*!< PLLSAI division factor for PLLSAIM output by 26 */ +#define LL_RCC_PLLSAIM_DIV_27 LL_RCC_PLLM_DIV_27 /*!< PLLSAI division factor for PLLSAIM output by 27 */ +#define LL_RCC_PLLSAIM_DIV_28 LL_RCC_PLLM_DIV_28 /*!< PLLSAI division factor for PLLSAIM output by 28 */ +#define LL_RCC_PLLSAIM_DIV_29 LL_RCC_PLLM_DIV_29 /*!< PLLSAI division factor for PLLSAIM output by 29 */ +#define LL_RCC_PLLSAIM_DIV_30 LL_RCC_PLLM_DIV_30 /*!< PLLSAI division factor for PLLSAIM output by 30 */ +#define LL_RCC_PLLSAIM_DIV_31 LL_RCC_PLLM_DIV_31 /*!< PLLSAI division factor for PLLSAIM output by 31 */ +#define LL_RCC_PLLSAIM_DIV_32 LL_RCC_PLLM_DIV_32 /*!< PLLSAI division factor for PLLSAIM output by 32 */ +#define LL_RCC_PLLSAIM_DIV_33 LL_RCC_PLLM_DIV_33 /*!< PLLSAI division factor for PLLSAIM output by 33 */ +#define LL_RCC_PLLSAIM_DIV_34 LL_RCC_PLLM_DIV_34 /*!< PLLSAI division factor for PLLSAIM output by 34 */ +#define LL_RCC_PLLSAIM_DIV_35 LL_RCC_PLLM_DIV_35 /*!< PLLSAI division factor for PLLSAIM output by 35 */ +#define LL_RCC_PLLSAIM_DIV_36 LL_RCC_PLLM_DIV_36 /*!< PLLSAI division factor for PLLSAIM output by 36 */ +#define LL_RCC_PLLSAIM_DIV_37 LL_RCC_PLLM_DIV_37 /*!< PLLSAI division factor for PLLSAIM output by 37 */ +#define LL_RCC_PLLSAIM_DIV_38 LL_RCC_PLLM_DIV_38 /*!< PLLSAI division factor for PLLSAIM output by 38 */ +#define LL_RCC_PLLSAIM_DIV_39 LL_RCC_PLLM_DIV_39 /*!< PLLSAI division factor for PLLSAIM output by 39 */ +#define LL_RCC_PLLSAIM_DIV_40 LL_RCC_PLLM_DIV_40 /*!< PLLSAI division factor for PLLSAIM output by 40 */ +#define LL_RCC_PLLSAIM_DIV_41 LL_RCC_PLLM_DIV_41 /*!< PLLSAI division factor for PLLSAIM output by 41 */ +#define LL_RCC_PLLSAIM_DIV_42 LL_RCC_PLLM_DIV_42 /*!< PLLSAI division factor for PLLSAIM output by 42 */ +#define LL_RCC_PLLSAIM_DIV_43 LL_RCC_PLLM_DIV_43 /*!< PLLSAI division factor for PLLSAIM output by 43 */ +#define LL_RCC_PLLSAIM_DIV_44 LL_RCC_PLLM_DIV_44 /*!< PLLSAI division factor for PLLSAIM output by 44 */ +#define LL_RCC_PLLSAIM_DIV_45 LL_RCC_PLLM_DIV_45 /*!< PLLSAI division factor for PLLSAIM output by 45 */ +#define LL_RCC_PLLSAIM_DIV_46 LL_RCC_PLLM_DIV_46 /*!< PLLSAI division factor for PLLSAIM output by 46 */ +#define LL_RCC_PLLSAIM_DIV_47 LL_RCC_PLLM_DIV_47 /*!< PLLSAI division factor for PLLSAIM output by 47 */ +#define LL_RCC_PLLSAIM_DIV_48 LL_RCC_PLLM_DIV_48 /*!< PLLSAI division factor for PLLSAIM output by 48 */ +#define LL_RCC_PLLSAIM_DIV_49 LL_RCC_PLLM_DIV_49 /*!< PLLSAI division factor for PLLSAIM output by 49 */ +#define LL_RCC_PLLSAIM_DIV_50 LL_RCC_PLLM_DIV_50 /*!< PLLSAI division factor for PLLSAIM output by 50 */ +#define LL_RCC_PLLSAIM_DIV_51 LL_RCC_PLLM_DIV_51 /*!< PLLSAI division factor for PLLSAIM output by 51 */ +#define LL_RCC_PLLSAIM_DIV_52 LL_RCC_PLLM_DIV_52 /*!< PLLSAI division factor for PLLSAIM output by 52 */ +#define LL_RCC_PLLSAIM_DIV_53 LL_RCC_PLLM_DIV_53 /*!< PLLSAI division factor for PLLSAIM output by 53 */ +#define LL_RCC_PLLSAIM_DIV_54 LL_RCC_PLLM_DIV_54 /*!< PLLSAI division factor for PLLSAIM output by 54 */ +#define LL_RCC_PLLSAIM_DIV_55 LL_RCC_PLLM_DIV_55 /*!< PLLSAI division factor for PLLSAIM output by 55 */ +#define LL_RCC_PLLSAIM_DIV_56 LL_RCC_PLLM_DIV_56 /*!< PLLSAI division factor for PLLSAIM output by 56 */ +#define LL_RCC_PLLSAIM_DIV_57 LL_RCC_PLLM_DIV_57 /*!< PLLSAI division factor for PLLSAIM output by 57 */ +#define LL_RCC_PLLSAIM_DIV_58 LL_RCC_PLLM_DIV_58 /*!< PLLSAI division factor for PLLSAIM output by 58 */ +#define LL_RCC_PLLSAIM_DIV_59 LL_RCC_PLLM_DIV_59 /*!< PLLSAI division factor for PLLSAIM output by 59 */ +#define LL_RCC_PLLSAIM_DIV_60 LL_RCC_PLLM_DIV_60 /*!< PLLSAI division factor for PLLSAIM output by 60 */ +#define LL_RCC_PLLSAIM_DIV_61 LL_RCC_PLLM_DIV_61 /*!< PLLSAI division factor for PLLSAIM output by 61 */ +#define LL_RCC_PLLSAIM_DIV_62 LL_RCC_PLLM_DIV_62 /*!< PLLSAI division factor for PLLSAIM output by 62 */ +#define LL_RCC_PLLSAIM_DIV_63 LL_RCC_PLLM_DIV_63 /*!< PLLSAI division factor for PLLSAIM output by 63 */ +#endif /* RCC_PLLSAICFGR_PLLSAIM */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLLSAIQ PLLSAIQ division factor (PLLSAIQ) + * @{ + */ +#define LL_RCC_PLLSAIQ_DIV_2 RCC_PLLSAICFGR_PLLSAIQ_1 /*!< PLLSAI division factor for PLLSAIQ output by 2 */ +#define LL_RCC_PLLSAIQ_DIV_3 (RCC_PLLSAICFGR_PLLSAIQ_1 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 3 */ +#define LL_RCC_PLLSAIQ_DIV_4 RCC_PLLSAICFGR_PLLSAIQ_2 /*!< PLLSAI division factor for PLLSAIQ output by 4 */ +#define LL_RCC_PLLSAIQ_DIV_5 (RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 5 */ +#define LL_RCC_PLLSAIQ_DIV_6 (RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_1) /*!< PLLSAI division factor for PLLSAIQ output by 6 */ +#define LL_RCC_PLLSAIQ_DIV_7 (RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_1 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 7 */ +#define LL_RCC_PLLSAIQ_DIV_8 RCC_PLLSAICFGR_PLLSAIQ_3 /*!< PLLSAI division factor for PLLSAIQ output by 8 */ +#define LL_RCC_PLLSAIQ_DIV_9 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 9 */ +#define LL_RCC_PLLSAIQ_DIV_10 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_1) /*!< PLLSAI division factor for PLLSAIQ output by 10 */ +#define LL_RCC_PLLSAIQ_DIV_11 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_1 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 11 */ +#define LL_RCC_PLLSAIQ_DIV_12 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_2) /*!< PLLSAI division factor for PLLSAIQ output by 12 */ +#define LL_RCC_PLLSAIQ_DIV_13 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 13 */ +#define LL_RCC_PLLSAIQ_DIV_14 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_1) /*!< PLLSAI division factor for PLLSAIQ output by 14 */ +#define LL_RCC_PLLSAIQ_DIV_15 (RCC_PLLSAICFGR_PLLSAIQ_3 | RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIQ_1 | RCC_PLLSAICFGR_PLLSAIQ_0) /*!< PLLSAI division factor for PLLSAIQ output by 15 */ +/** + * @} + */ + +#if defined(RCC_DCKCFGR_PLLSAIDIVQ) +/** @defgroup RCC_LL_EC_PLLSAIDIVQ PLLSAIDIVQ division factor (PLLSAIDIVQ) + * @{ + */ +#define LL_RCC_PLLSAIDIVQ_DIV_1 0x00000000U /*!< PLLSAI division factor for PLLSAIDIVQ output by 1 */ +#define LL_RCC_PLLSAIDIVQ_DIV_2 RCC_DCKCFGR_PLLSAIDIVQ_0 /*!< PLLSAI division factor for PLLSAIDIVQ output by 2 */ +#define LL_RCC_PLLSAIDIVQ_DIV_3 RCC_DCKCFGR_PLLSAIDIVQ_1 /*!< PLLSAI division factor for PLLSAIDIVQ output by 3 */ +#define LL_RCC_PLLSAIDIVQ_DIV_4 (RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 4 */ +#define LL_RCC_PLLSAIDIVQ_DIV_5 RCC_DCKCFGR_PLLSAIDIVQ_2 /*!< PLLSAI division factor for PLLSAIDIVQ output by 5 */ +#define LL_RCC_PLLSAIDIVQ_DIV_6 (RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 6 */ +#define LL_RCC_PLLSAIDIVQ_DIV_7 (RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 7 */ +#define LL_RCC_PLLSAIDIVQ_DIV_8 (RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 8 */ +#define LL_RCC_PLLSAIDIVQ_DIV_9 RCC_DCKCFGR_PLLSAIDIVQ_3 /*!< PLLSAI division factor for PLLSAIDIVQ output by 9 */ +#define LL_RCC_PLLSAIDIVQ_DIV_10 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 10 */ +#define LL_RCC_PLLSAIDIVQ_DIV_11 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 11 */ +#define LL_RCC_PLLSAIDIVQ_DIV_12 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 12 */ +#define LL_RCC_PLLSAIDIVQ_DIV_13 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2) /*!< PLLSAI division factor for PLLSAIDIVQ output by 13 */ +#define LL_RCC_PLLSAIDIVQ_DIV_14 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 14 */ +#define LL_RCC_PLLSAIDIVQ_DIV_15 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 15 */ +#define LL_RCC_PLLSAIDIVQ_DIV_16 (RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 16 */ +#define LL_RCC_PLLSAIDIVQ_DIV_17 RCC_DCKCFGR_PLLSAIDIVQ_4 /*!< PLLSAI division factor for PLLSAIDIVQ output by 17 */ +#define LL_RCC_PLLSAIDIVQ_DIV_18 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 18 */ +#define LL_RCC_PLLSAIDIVQ_DIV_19 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 19 */ +#define LL_RCC_PLLSAIDIVQ_DIV_20 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 20 */ +#define LL_RCC_PLLSAIDIVQ_DIV_21 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_2) /*!< PLLSAI division factor for PLLSAIDIVQ output by 21 */ +#define LL_RCC_PLLSAIDIVQ_DIV_22 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 22 */ +#define LL_RCC_PLLSAIDIVQ_DIV_23 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 23 */ +#define LL_RCC_PLLSAIDIVQ_DIV_24 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 24 */ +#define LL_RCC_PLLSAIDIVQ_DIV_25 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3) /*!< PLLSAI division factor for PLLSAIDIVQ output by 25 */ +#define LL_RCC_PLLSAIDIVQ_DIV_26 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 26 */ +#define LL_RCC_PLLSAIDIVQ_DIV_27 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 27 */ +#define LL_RCC_PLLSAIDIVQ_DIV_28 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 28 */ +#define LL_RCC_PLLSAIDIVQ_DIV_29 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2) /*!< PLLSAI division factor for PLLSAIDIVQ output by 29 */ +#define LL_RCC_PLLSAIDIVQ_DIV_30 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 30 */ +#define LL_RCC_PLLSAIDIVQ_DIV_31 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1) /*!< PLLSAI division factor for PLLSAIDIVQ output by 31 */ +#define LL_RCC_PLLSAIDIVQ_DIV_32 (RCC_DCKCFGR_PLLSAIDIVQ_4 | RCC_DCKCFGR_PLLSAIDIVQ_3 | RCC_DCKCFGR_PLLSAIDIVQ_2 | RCC_DCKCFGR_PLLSAIDIVQ_1 | RCC_DCKCFGR_PLLSAIDIVQ_0) /*!< PLLSAI division factor for PLLSAIDIVQ output by 32 */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_PLLSAIDIVQ */ + +#if defined(RCC_PLLSAICFGR_PLLSAIR) +/** @defgroup RCC_LL_EC_PLLSAIR PLLSAIR division factor (PLLSAIR) + * @{ + */ +#define LL_RCC_PLLSAIR_DIV_2 RCC_PLLSAICFGR_PLLSAIR_1 /*!< PLLSAI division factor for PLLSAIR output by 2 */ +#define LL_RCC_PLLSAIR_DIV_3 (RCC_PLLSAICFGR_PLLSAIR_1 | RCC_PLLSAICFGR_PLLSAIR_0) /*!< PLLSAI division factor for PLLSAIR output by 3 */ +#define LL_RCC_PLLSAIR_DIV_4 RCC_PLLSAICFGR_PLLSAIR_2 /*!< PLLSAI division factor for PLLSAIR output by 4 */ +#define LL_RCC_PLLSAIR_DIV_5 (RCC_PLLSAICFGR_PLLSAIR_2 | RCC_PLLSAICFGR_PLLSAIR_0) /*!< PLLSAI division factor for PLLSAIR output by 5 */ +#define LL_RCC_PLLSAIR_DIV_6 (RCC_PLLSAICFGR_PLLSAIR_2 | RCC_PLLSAICFGR_PLLSAIR_1) /*!< PLLSAI division factor for PLLSAIR output by 6 */ +#define LL_RCC_PLLSAIR_DIV_7 (RCC_PLLSAICFGR_PLLSAIR_2 | RCC_PLLSAICFGR_PLLSAIR_1 | RCC_PLLSAICFGR_PLLSAIR_0) /*!< PLLSAI division factor for PLLSAIR output by 7 */ +/** + * @} + */ +#endif /* RCC_PLLSAICFGR_PLLSAIR */ + +#if defined(RCC_DCKCFGR_PLLSAIDIVR) +/** @defgroup RCC_LL_EC_PLLSAIDIVR PLLSAIDIVR division factor (PLLSAIDIVR) + * @{ + */ +#define LL_RCC_PLLSAIDIVR_DIV_2 0x00000000U /*!< PLLSAI division factor for PLLSAIDIVR output by 2 */ +#define LL_RCC_PLLSAIDIVR_DIV_4 RCC_DCKCFGR_PLLSAIDIVR_0 /*!< PLLSAI division factor for PLLSAIDIVR output by 4 */ +#define LL_RCC_PLLSAIDIVR_DIV_8 RCC_DCKCFGR_PLLSAIDIVR_1 /*!< PLLSAI division factor for PLLSAIDIVR output by 8 */ +#define LL_RCC_PLLSAIDIVR_DIV_16 (RCC_DCKCFGR_PLLSAIDIVR_1 | RCC_DCKCFGR_PLLSAIDIVR_0) /*!< PLLSAI division factor for PLLSAIDIVR output by 16 */ +/** + * @} + */ +#endif /* RCC_DCKCFGR_PLLSAIDIVR */ + +#if defined(RCC_PLLSAICFGR_PLLSAIP) +/** @defgroup RCC_LL_EC_PLLSAIP PLLSAIP division factor (PLLSAIP) + * @{ + */ +#define LL_RCC_PLLSAIP_DIV_2 0x00000000U /*!< PLLSAI division factor for PLLSAIP output by 2 */ +#define LL_RCC_PLLSAIP_DIV_4 RCC_PLLSAICFGR_PLLSAIP_0 /*!< PLLSAI division factor for PLLSAIP output by 4 */ +#define LL_RCC_PLLSAIP_DIV_6 RCC_PLLSAICFGR_PLLSAIP_1 /*!< PLLSAI division factor for PLLSAIP output by 6 */ +#define LL_RCC_PLLSAIP_DIV_8 (RCC_PLLSAICFGR_PLLSAIP_1 | RCC_PLLSAICFGR_PLLSAIP_0) /*!< PLLSAI division factor for PLLSAIP output by 8 */ +/** + * @} + */ +#endif /* RCC_PLLSAICFGR_PLLSAIP */ +#endif /* RCC_PLLSAI_SUPPORT */ +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Macros RCC Exported Macros + * @{ + */ + +/** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in RCC register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__)) + +/** + * @brief Read a value in RCC register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__) +/** + * @} + */ + +/** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies + * @{ + */ + +/** + * @brief Helper macro to calculate the PLLCLK frequency on system domain + * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLP__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLP_DIV_2 + * @arg @ref LL_RCC_PLLP_DIV_4 + * @arg @ref LL_RCC_PLLP_DIV_6 + * @arg @ref LL_RCC_PLLP_DIV_8 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((((__PLLP__) >> RCC_PLLCFGR_PLLP_Pos ) + 1U) * 2U)) + +#if defined(RCC_PLLR_SYSCLK_SUPPORT) +/** + * @brief Helper macro to calculate the PLLRCLK frequency on system domain + * @note ex: @ref __LL_RCC_CALC_PLLRCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50 and 432 + * @param __PLLR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLRCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) + +#endif /* RCC_PLLR_SYSCLK_SUPPORT */ + +/** + * @brief Helper macro to calculate the PLLCLK frequency used on 48M domain + * @note ex: @ref __LL_RCC_CALC_PLLCLK_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLQ__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLQ_DIV_2 + * @arg @ref LL_RCC_PLLQ_DIV_3 + * @arg @ref LL_RCC_PLLQ_DIV_4 + * @arg @ref LL_RCC_PLLQ_DIV_5 + * @arg @ref LL_RCC_PLLQ_DIV_6 + * @arg @ref LL_RCC_PLLQ_DIV_7 + * @arg @ref LL_RCC_PLLQ_DIV_8 + * @arg @ref LL_RCC_PLLQ_DIV_9 + * @arg @ref LL_RCC_PLLQ_DIV_10 + * @arg @ref LL_RCC_PLLQ_DIV_11 + * @arg @ref LL_RCC_PLLQ_DIV_12 + * @arg @ref LL_RCC_PLLQ_DIV_13 + * @arg @ref LL_RCC_PLLQ_DIV_14 + * @arg @ref LL_RCC_PLLQ_DIV_15 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos )) + +#if defined(DSI) +/** + * @brief Helper macro to calculate the PLLCLK frequency used on DSI + * @note ex: @ref __LL_RCC_CALC_PLLCLK_DSI_FREQ (HSE_VALUE, @ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50 and 432 + * @param __PLLR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_DSI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) +#endif /* DSI */ + +#if defined(RCC_PLLR_I2S_CLKSOURCE_SUPPORT) +/** + * @brief Helper macro to calculate the PLLCLK frequency used on I2S + * @note ex: @ref __LL_RCC_CALC_PLLCLK_I2S_FREQ (HSE_VALUE, @ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50 and 432 + * @param __PLLR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_I2S_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) +#endif /* RCC_PLLR_I2S_CLKSOURCE_SUPPORT */ + +#if defined(SPDIFRX) +/** + * @brief Helper macro to calculate the PLLCLK frequency used on SPDIFRX + * @note ex: @ref __LL_RCC_CALC_PLLCLK_SPDIFRX_FREQ (HSE_VALUE, @ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50 and 432 + * @param __PLLR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_SPDIFRX_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) +#endif /* SPDIFRX */ + +#if defined(RCC_PLLCFGR_PLLR) +#if defined(SAI1) +/** + * @brief Helper macro to calculate the PLLCLK frequency used on SAI + * @note ex: @ref __LL_RCC_CALC_PLLCLK_SAI_FREQ (HSE_VALUE, @ref LL_RCC_PLL_GetDivider (), + * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR (), @ref LL_RCC_PLL_GetDIVR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param __PLLN__ Between 50 and 432 + * @param __PLLR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @param __PLLDIVR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLDIVR_DIV_1 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_2 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_3 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_4 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_5 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_6 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_7 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_8 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_9 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_10 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_11 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_12 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_13 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_14 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_15 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_16 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_17 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_18 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_19 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_20 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_21 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_22 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_23 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_24 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_25 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_26 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_27 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_28 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_29 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_30 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_31 (*) + * + * (*) value not defined in all devices. + * @retval PLL clock frequency (in Hz) + */ +#if defined(RCC_DCKCFGR_PLLDIVR) +#define __LL_RCC_CALC_PLLCLK_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__, __PLLDIVR__) (((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) / ((__PLLDIVR__) >> RCC_DCKCFGR_PLLDIVR_Pos )) +#else +#define __LL_RCC_CALC_PLLCLK_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / (__PLLM__) * (__PLLN__) / \ + ((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos )) +#endif /* RCC_DCKCFGR_PLLDIVR */ +#endif /* SAI1 */ +#endif /* RCC_PLLCFGR_PLLR */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Helper macro to calculate the PLLSAI frequency used for SAI domain + * @note ex: @ref __LL_RCC_CALC_PLLSAI_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI_GetDivider (), + * @ref LL_RCC_PLLSAI_GetN (), @ref LL_RCC_PLLSAI_GetQ (), @ref LL_RCC_PLLSAI_GetDIVQ ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param __PLLSAIN__ Between 49/50(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLSAIQ__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIQ_DIV_15 + * @param __PLLSAIDIVQ__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_1 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_15 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_16 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_17 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_18 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_19 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_20 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_21 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_22 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_23 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_24 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_25 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_26 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_27 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_28 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_29 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_30 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_31 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_32 + * @retval PLLSAI clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLSAI_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAIN__, __PLLSAIQ__, __PLLSAIDIVQ__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLSAIN__) / \ + (((__PLLSAIQ__) >> RCC_PLLSAICFGR_PLLSAIQ_Pos) * (((__PLLSAIDIVQ__) >> RCC_DCKCFGR_PLLSAIDIVQ_Pos) + 1U))) + +#if defined(RCC_PLLSAICFGR_PLLSAIP) +/** + * @brief Helper macro to calculate the PLLSAI frequency used on 48Mhz domain + * @note ex: @ref __LL_RCC_CALC_PLLSAI_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI_GetDivider (), + * @ref LL_RCC_PLLSAI_GetN (), @ref LL_RCC_PLLSAI_GetP ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param __PLLSAIN__ Between 50 and 432 + * @param __PLLSAIP__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIP_DIV_2 + * @arg @ref LL_RCC_PLLSAIP_DIV_4 + * @arg @ref LL_RCC_PLLSAIP_DIV_6 + * @arg @ref LL_RCC_PLLSAIP_DIV_8 + * @retval PLLSAI clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLSAI_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAIN__, __PLLSAIP__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLSAIN__) / \ + ((((__PLLSAIP__) >> RCC_PLLSAICFGR_PLLSAIP_Pos) + 1U) * 2U)) +#endif /* RCC_PLLSAICFGR_PLLSAIP */ + +#if defined(LTDC) +/** + * @brief Helper macro to calculate the PLLSAI frequency used for LTDC domain + * @note ex: @ref __LL_RCC_CALC_PLLSAI_LTDC_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI_GetDivider (), + * @ref LL_RCC_PLLSAI_GetN (), @ref LL_RCC_PLLSAI_GetR (), @ref LL_RCC_PLLSAI_GetDIVR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param __PLLSAIN__ Between 49/50(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLSAIR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIR_DIV_2 + * @arg @ref LL_RCC_PLLSAIR_DIV_3 + * @arg @ref LL_RCC_PLLSAIR_DIV_4 + * @arg @ref LL_RCC_PLLSAIR_DIV_5 + * @arg @ref LL_RCC_PLLSAIR_DIV_6 + * @arg @ref LL_RCC_PLLSAIR_DIV_7 + * @param __PLLSAIDIVR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_16 + * @retval PLLSAI clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLSAI_LTDC_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAIN__, __PLLSAIR__, __PLLSAIDIVR__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLSAIN__) / \ + (((__PLLSAIR__) >> RCC_PLLSAICFGR_PLLSAIR_Pos) * (aRCC_PLLSAIDIVRPrescTable[(__PLLSAIDIVR__) >> RCC_DCKCFGR_PLLSAIDIVR_Pos]))) +#endif /* LTDC */ +#endif /* RCC_PLLSAI_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) || defined(RCC_DCKCFGR_PLLI2SDIVR) +/** + * @brief Helper macro to calculate the PLLI2S frequency used for SAI domain + * @note ex: @ref __LL_RCC_CALC_PLLI2S_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLI2S_GetDivider (), + * @ref LL_RCC_PLLI2S_GetN (), @ref LL_RCC_PLLI2S_GetQ (), @ref LL_RCC_PLLI2S_GetDIVQ ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param __PLLI2SN__ Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLI2SQ_R__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SQ_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_7 (*) + * + * (*) value not defined in all devices. + * @param __PLLI2SDIVQ_R__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_1 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_16 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_17 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_18 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_19 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_20 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_21 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_22 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_23 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_24 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_25 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_26 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_27 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_28 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_29 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_30 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_31 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_32 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_1 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_16 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_17 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_18 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_19 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_20 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_21 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_22 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_23 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_24 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_25 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_26 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_27 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_28 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_29 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_30 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_31 (*) + * + * (*) value not defined in all devices. + * @retval PLLI2S clock frequency (in Hz) + */ +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) +#define __LL_RCC_CALC_PLLI2S_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLI2SN__, __PLLI2SQ_R__, __PLLI2SDIVQ_R__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLI2SN__) / \ + (((__PLLI2SQ_R__) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos) * (((__PLLI2SDIVQ_R__) >> RCC_DCKCFGR_PLLI2SDIVQ_Pos) + 1U))) +#else +#define __LL_RCC_CALC_PLLI2S_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLI2SN__, __PLLI2SQ_R__, __PLLI2SDIVQ_R__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLI2SN__) / \ + (((__PLLI2SQ_R__) >> RCC_PLLI2SCFGR_PLLI2SR_Pos) * ((__PLLI2SDIVQ_R__) >> RCC_DCKCFGR_PLLI2SDIVR_Pos))) + +#endif /* RCC_DCKCFGR_PLLI2SDIVQ */ +#endif /* RCC_DCKCFGR_PLLI2SDIVQ || RCC_DCKCFGR_PLLI2SDIVR */ + +#if defined(SPDIFRX) +/** + * @brief Helper macro to calculate the PLLI2S frequency used on SPDIFRX domain + * @note ex: @ref __LL_RCC_CALC_PLLI2S_SPDIFRX_FREQ (HSE_VALUE,@ref LL_RCC_PLLI2S_GetDivider (), + * @ref LL_RCC_PLLI2S_GetN (), @ref LL_RCC_PLLI2S_GetP ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param __PLLI2SN__ Between 50 and 432 + * @param __PLLI2SP__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SP_DIV_2 + * @arg @ref LL_RCC_PLLI2SP_DIV_4 + * @arg @ref LL_RCC_PLLI2SP_DIV_6 + * @arg @ref LL_RCC_PLLI2SP_DIV_8 + * @retval PLLI2S clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLI2S_SPDIFRX_FREQ(__INPUTFREQ__, __PLLM__, __PLLI2SN__, __PLLI2SP__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLI2SN__) / \ + ((((__PLLI2SP__) >> RCC_PLLI2SCFGR_PLLI2SP_Pos) + 1U) * 2U)) + +#endif /* SPDIFRX */ + +/** + * @brief Helper macro to calculate the PLLI2S frequency used for I2S domain + * @note ex: @ref __LL_RCC_CALC_PLLI2S_I2S_FREQ (HSE_VALUE,@ref LL_RCC_PLLI2S_GetDivider (), + * @ref LL_RCC_PLLI2S_GetN (), @ref LL_RCC_PLLI2S_GetR ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param __PLLI2SN__ Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param __PLLI2SR__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SR_DIV_2 + * @arg @ref LL_RCC_PLLI2SR_DIV_3 + * @arg @ref LL_RCC_PLLI2SR_DIV_4 + * @arg @ref LL_RCC_PLLI2SR_DIV_5 + * @arg @ref LL_RCC_PLLI2SR_DIV_6 + * @arg @ref LL_RCC_PLLI2SR_DIV_7 + * @retval PLLI2S clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLI2S_I2S_FREQ(__INPUTFREQ__, __PLLM__, __PLLI2SN__, __PLLI2SR__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLI2SN__) / \ + ((__PLLI2SR__) >> RCC_PLLI2SCFGR_PLLI2SR_Pos)) + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +/** + * @brief Helper macro to calculate the PLLI2S frequency used for 48Mhz domain + * @note ex: @ref __LL_RCC_CALC_PLLI2S_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLLI2S_GetDivider (), + * @ref LL_RCC_PLLI2S_GetN (), @ref LL_RCC_PLLI2S_GetQ ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI) + * @param __PLLM__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param __PLLI2SN__ Between 50 and 432 + * @param __PLLI2SQ__ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SQ_DIV_2 + * @arg @ref LL_RCC_PLLI2SQ_DIV_3 + * @arg @ref LL_RCC_PLLI2SQ_DIV_4 + * @arg @ref LL_RCC_PLLI2SQ_DIV_5 + * @arg @ref LL_RCC_PLLI2SQ_DIV_6 + * @arg @ref LL_RCC_PLLI2SQ_DIV_7 + * @arg @ref LL_RCC_PLLI2SQ_DIV_8 + * @arg @ref LL_RCC_PLLI2SQ_DIV_9 + * @arg @ref LL_RCC_PLLI2SQ_DIV_10 + * @arg @ref LL_RCC_PLLI2SQ_DIV_11 + * @arg @ref LL_RCC_PLLI2SQ_DIV_12 + * @arg @ref LL_RCC_PLLI2SQ_DIV_13 + * @arg @ref LL_RCC_PLLI2SQ_DIV_14 + * @arg @ref LL_RCC_PLLI2SQ_DIV_15 + * @retval PLLI2S clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLI2S_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLI2SN__, __PLLI2SQ__) (((__INPUTFREQ__) / (__PLLM__)) * (__PLLI2SN__) / \ + ((__PLLI2SQ__) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos)) + +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +#endif /* RCC_PLLI2S_SUPPORT */ + +/** + * @brief Helper macro to calculate the HCLK frequency + * @param __SYSCLKFREQ__ SYSCLK frequency (based on HSE/HSI/PLLCLK) + * @param __AHBPRESCALER__ This parameter can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + * @retval HCLK clock frequency (in Hz) + */ +#define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __AHBPRESCALER__) ((__SYSCLKFREQ__) >> AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos]) + +/** + * @brief Helper macro to calculate the PCLK1 frequency (ABP1) + * @param __HCLKFREQ__ HCLK frequency + * @param __APB1PRESCALER__ This parameter can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + * @retval PCLK1 clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE1_Pos]) + +/** + * @brief Helper macro to calculate the PCLK2 frequency (ABP2) + * @param __HCLKFREQ__ HCLK frequency + * @param __APB2PRESCALER__ This parameter can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + * @retval PCLK2 clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB2PRESCALER__) >> RCC_CFGR_PPRE2_Pos]) + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Functions RCC Exported Functions + * @{ + */ + +/** @defgroup RCC_LL_EF_HSE HSE + * @{ + */ + +/** + * @brief Enable the Clock Security System. + * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_EnableCSS(void) +{ + SET_BIT(RCC->CR, RCC_CR_CSSON); +} + +/** + * @brief Enable HSE external oscillator (HSE Bypass) + * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_EnableBypass(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSEBYP); +} + +/** + * @brief Disable HSE external oscillator (HSE Bypass) + * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_DisableBypass(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); +} + +/** + * @brief Enable HSE crystal oscillator (HSE ON) + * @rmtoll CR HSEON LL_RCC_HSE_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSEON); +} + +/** + * @brief Disable HSE crystal oscillator (HSE ON) + * @rmtoll CR HSEON LL_RCC_HSE_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON); +} + +/** + * @brief Check if HSE oscillator Ready + * @rmtoll CR HSERDY LL_RCC_HSE_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_HSI HSI + * @{ + */ + +/** + * @brief Enable HSI oscillator + * @rmtoll CR HSION LL_RCC_HSI_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSION); +} + +/** + * @brief Disable HSI oscillator + * @rmtoll CR HSION LL_RCC_HSI_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSION); +} + +/** + * @brief Check if HSI clock is ready + * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_HSIRDY) == (RCC_CR_HSIRDY)); +} + +/** + * @brief Get HSI Calibration value + * @note When HSITRIM is written, HSICAL is updated with the sum of + * HSITRIM and the factory trim value + * @rmtoll CR HSICAL LL_RCC_HSI_GetCalibration + * @retval Between Min_Data = 0x00 and Max_Data = 0xFF + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void) +{ + return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSICAL) >> RCC_CR_HSICAL_Pos); +} + +/** + * @brief Set HSI Calibration trimming + * @note user-programmable trimming value that is added to the HSICAL + * @note Default value is 16, which, when added to the HSICAL value, + * should trim the HSI to 16 MHz +/- 1 % + * @rmtoll CR HSITRIM LL_RCC_HSI_SetCalibTrimming + * @param Value Between Min_Data = 0 and Max_Data = 31 + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value) +{ + MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, Value << RCC_CR_HSITRIM_Pos); +} + +/** + * @brief Get HSI Calibration trimming + * @rmtoll CR HSITRIM LL_RCC_HSI_GetCalibTrimming + * @retval Between Min_Data = 0 and Max_Data = 31 + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void) +{ + return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_LSE LSE + * @{ + */ + +/** + * @brief Enable Low Speed External (LSE) crystal. + * @rmtoll BDCR LSEON LL_RCC_LSE_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_Enable(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); +} + +/** + * @brief Disable Low Speed External (LSE) crystal. + * @rmtoll BDCR LSEON LL_RCC_LSE_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_Disable(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); +} + +/** + * @brief Enable external clock source (LSE bypass). + * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_EnableBypass(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); +} + +/** + * @brief Disable external clock source (LSE bypass). + * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_DisableBypass(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); +} + +/** + * @brief Check if LSE oscillator Ready + * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void) +{ + return (READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == (RCC_BDCR_LSERDY)); +} + +#if defined(RCC_BDCR_LSEMOD) +/** + * @brief Enable LSE high drive mode. + * @note LSE high drive mode can be enabled only when the LSE clock is disabled + * @rmtoll BDCR LSEMOD LL_RCC_LSE_EnableHighDriveMode + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_EnableHighDriveMode(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEMOD); +} + +/** + * @brief Disable LSE high drive mode. + * @note LSE high drive mode can be disabled only when the LSE clock is disabled + * @rmtoll BDCR LSEMOD LL_RCC_LSE_DisableHighDriveMode + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_DisableHighDriveMode(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEMOD); +} +#endif /* RCC_BDCR_LSEMOD */ + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_LSI LSI + * @{ + */ + +/** + * @brief Enable LSI Oscillator + * @rmtoll CSR LSION LL_RCC_LSI_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSI_Enable(void) +{ + SET_BIT(RCC->CSR, RCC_CSR_LSION); +} + +/** + * @brief Disable LSI Oscillator + * @rmtoll CSR LSION LL_RCC_LSI_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSI_Disable(void) +{ + CLEAR_BIT(RCC->CSR, RCC_CSR_LSION); +} + +/** + * @brief Check if LSI is Ready + * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == (RCC_CSR_LSIRDY)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_System System + * @{ + */ + +/** + * @brief Configure the system clock source + * @rmtoll CFGR SW LL_RCC_SetSysClkSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI + * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL + * @arg @ref LL_RCC_SYS_CLKSOURCE_PLLR (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source); +} + +/** + * @brief Get the system clock source + * @rmtoll CFGR SWS LL_RCC_GetSysClkSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLLR (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS)); +} + +/** + * @brief Set AHB prescaler + * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler); +} + +/** + * @brief Set APB1 prescaler + * @rmtoll CFGR PPRE1 LL_RCC_SetAPB1Prescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler); +} + +/** + * @brief Set APB2 prescaler + * @rmtoll CFGR PPRE2 LL_RCC_SetAPB2Prescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler); +} + +/** + * @brief Get AHB prescaler + * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE)); +} + +/** + * @brief Get APB1 prescaler + * @rmtoll CFGR PPRE1 LL_RCC_GetAPB1Prescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE1)); +} + +/** + * @brief Get APB2 prescaler + * @rmtoll CFGR PPRE2 LL_RCC_GetAPB2Prescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAPB2Prescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE2)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_MCO MCO + * @{ + */ + +#if defined(RCC_CFGR_MCO1EN) +/** + * @brief Enable MCO1 output + * @rmtoll CFGR RCC_CFGR_MCO1EN LL_RCC_MCO1_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_MCO1_Enable(void) +{ + SET_BIT(RCC->CFGR, RCC_CFGR_MCO1EN); +} + +/** + * @brief Disable MCO1 output + * @rmtoll CFGR RCC_CFGR_MCO1EN LL_RCC_MCO1_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_MCO1_Disable(void) +{ + CLEAR_BIT(RCC->CFGR, RCC_CFGR_MCO1EN); +} +#endif /* RCC_CFGR_MCO1EN */ + +#if defined(RCC_CFGR_MCO2EN) +/** + * @brief Enable MCO2 output + * @rmtoll CFGR RCC_CFGR_MCO2EN LL_RCC_MCO2_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_MCO2_Enable(void) +{ + SET_BIT(RCC->CFGR, RCC_CFGR_MCO2EN); +} + +/** + * @brief Disable MCO2 output + * @rmtoll CFGR RCC_CFGR_MCO2EN LL_RCC_MCO2_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_MCO2_Disable(void) +{ + CLEAR_BIT(RCC->CFGR, RCC_CFGR_MCO2EN); +} +#endif /* RCC_CFGR_MCO2EN */ + +/** + * @brief Configure MCOx + * @rmtoll CFGR MCO1 LL_RCC_ConfigMCO\n + * CFGR MCO1PRE LL_RCC_ConfigMCO\n + * CFGR MCO2 LL_RCC_ConfigMCO\n + * CFGR MCO2PRE LL_RCC_ConfigMCO + * @param MCOxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_MCO1SOURCE_HSI + * @arg @ref LL_RCC_MCO1SOURCE_LSE + * @arg @ref LL_RCC_MCO1SOURCE_HSE + * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK + * @arg @ref LL_RCC_MCO2SOURCE_SYSCLK + * @arg @ref LL_RCC_MCO2SOURCE_PLLI2S + * @arg @ref LL_RCC_MCO2SOURCE_HSE + * @arg @ref LL_RCC_MCO2SOURCE_PLLCLK + * @param MCOxPrescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_MCO1_DIV_1 + * @arg @ref LL_RCC_MCO1_DIV_2 + * @arg @ref LL_RCC_MCO1_DIV_3 + * @arg @ref LL_RCC_MCO1_DIV_4 + * @arg @ref LL_RCC_MCO1_DIV_5 + * @arg @ref LL_RCC_MCO2_DIV_1 + * @arg @ref LL_RCC_MCO2_DIV_2 + * @arg @ref LL_RCC_MCO2_DIV_3 + * @arg @ref LL_RCC_MCO2_DIV_4 + * @arg @ref LL_RCC_MCO2_DIV_5 + * @retval None + */ +__STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler) +{ + MODIFY_REG(RCC->CFGR, (MCOxSource & 0xFFFF0000U) | (MCOxPrescaler & 0xFFFF0000U), (MCOxSource << 16U) | (MCOxPrescaler << 16U)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source + * @{ + */ +#if defined(FMPI2C1) +/** + * @brief Configure FMPI2C clock source + * @rmtoll DCKCFGR2 FMPI2C1SEL LL_RCC_SetFMPI2CClockSource + * @param FMPI2CxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_PCLK1 + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_HSI + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetFMPI2CClockSource(uint32_t FMPI2CxSource) +{ + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, FMPI2CxSource); +} +#endif /* FMPI2C1 */ + +#if defined(LPTIM1) +/** + * @brief Configure LPTIMx clock source + * @rmtoll DCKCFGR2 LPTIM1SEL LL_RCC_SetLPTIMClockSource + * @param LPTIMxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1 + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource) +{ + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, LPTIMxSource); +} +#endif /* LPTIM1 */ + +#if defined(SAI1) +/** + * @brief Configure SAIx clock source + * @rmtoll DCKCFGR SAI1SRC LL_RCC_SetSAIClockSource\n + * DCKCFGR SAI2SRC LL_RCC_SetSAIClockSource\n + * DCKCFGR SAI1ASRC LL_RCC_SetSAIClockSource\n + * DCKCFGR SAI1BSRC LL_RCC_SetSAIClockSource + * @param SAIxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLSRC (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSAIClockSource(uint32_t SAIxSource) +{ + MODIFY_REG(RCC->DCKCFGR, (SAIxSource & 0xFFFF0000U), (SAIxSource << 16U)); +} +#endif /* SAI1 */ + +#if defined(RCC_DCKCFGR_SDIOSEL) || defined(RCC_DCKCFGR2_SDIOSEL) +/** + * @brief Configure SDIO clock source + * @rmtoll DCKCFGR SDIOSEL LL_RCC_SetSDIOClockSource\n + * DCKCFGR2 SDIOSEL LL_RCC_SetSDIOClockSource + * @param SDIOxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SDIO_CLKSOURCE_PLL48CLK + * @arg @ref LL_RCC_SDIO_CLKSOURCE_SYSCLK + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSDIOClockSource(uint32_t SDIOxSource) +{ +#if defined(RCC_DCKCFGR_SDIOSEL) + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL, SDIOxSource); +#else + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, SDIOxSource); +#endif /* RCC_DCKCFGR_SDIOSEL */ +} +#endif /* RCC_DCKCFGR_SDIOSEL || RCC_DCKCFGR2_SDIOSEL */ + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +/** + * @brief Configure 48Mhz domain clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_SetCK48MClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_SetCK48MClockSource + * @param CK48MxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLL + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetCK48MClockSource(uint32_t CK48MxSource) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, CK48MxSource); +#else + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, CK48MxSource); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} + +#if defined(RNG) +/** + * @brief Configure RNG clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_SetRNGClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_SetRNGClockSource + * @param RNGxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetRNGClockSource(uint32_t RNGxSource) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, RNGxSource); +#else + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, RNGxSource); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} +#endif /* RNG */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +/** + * @brief Configure USB clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_SetUSBClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_SetUSBClockSource + * @param USBxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL + * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, USBxSource); +#else + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, USBxSource); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} +#endif /* USB_OTG_FS || USB_OTG_HS */ +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + +#if defined(CEC) +/** + * @brief Configure CEC clock source + * @rmtoll DCKCFGR2 CECSEL LL_RCC_SetCECClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV488 + * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetCECClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, Source); +} +#endif /* CEC */ + +/** + * @brief Configure I2S clock source + * @rmtoll CFGR I2SSRC LL_RCC_SetI2SClockSource\n + * DCKCFGR I2SSRC LL_RCC_SetI2SClockSource\n + * DCKCFGR I2S1SRC LL_RCC_SetI2SClockSource\n + * DCKCFGR I2S2SRC LL_RCC_SetI2SClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLSRC (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetI2SClockSource(uint32_t Source) +{ +#if defined(RCC_CFGR_I2SSRC) + MODIFY_REG(RCC->CFGR, RCC_CFGR_I2SSRC, Source); +#else + MODIFY_REG(RCC->DCKCFGR, (Source & 0xFFFF0000U), (Source << 16U)); +#endif /* RCC_CFGR_I2SSRC */ +} + +#if defined(DSI) +/** + * @brief Configure DSI clock source + * @rmtoll DCKCFGR DSISEL LL_RCC_SetDSIClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY + * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetDSIClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL, Source); +} +#endif /* DSI */ + +#if defined(DFSDM1_Channel0) +/** + * @brief Configure DFSDM Audio clock source + * @rmtoll DCKCFGR CKDFSDM1ASEL LL_RCC_SetDFSDMAudioClockSource\n + * DCKCFGR CKDFSDM2ASEL LL_RCC_SetDFSDMAudioClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1 + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S2 + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1 (*) + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S2 (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetDFSDMAudioClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->DCKCFGR, (Source & 0x0000FFFFU), (Source >> 16U)); +} + +/** + * @brief Configure DFSDM Kernel clock source + * @rmtoll DCKCFGR CKDFSDM1SEL LL_RCC_SetDFSDMClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2 + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_PCLK2 (*) + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_SYSCLK (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetDFSDMClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, Source); +} +#endif /* DFSDM1_Channel0 */ + +#if defined(SPDIFRX) +/** + * @brief Configure SPDIFRX clock source + * @rmtoll DCKCFGR2 SPDIFRXSEL LL_RCC_SetSPDIFRXClockSource + * @param SPDIFRXxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE_PLL + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSPDIFRXClockSource(uint32_t SPDIFRXxSource) +{ + MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL, SPDIFRXxSource); +} +#endif /* SPDIFRX */ + +#if defined(FMPI2C1) +/** + * @brief Get FMPI2C clock source + * @rmtoll DCKCFGR2 FMPI2C1SEL LL_RCC_GetFMPI2CClockSource + * @param FMPI2Cx This parameter can be one of the following values: + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_PCLK1 + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE_HSI + */ +__STATIC_INLINE uint32_t LL_RCC_GetFMPI2CClockSource(uint32_t FMPI2Cx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, FMPI2Cx)); +} +#endif /* FMPI2C1 */ + +#if defined(LPTIM1) +/** + * @brief Get LPTIMx clock source + * @rmtoll DCKCFGR2 LPTIM1SEL LL_RCC_GetLPTIMClockSource + * @param LPTIMx This parameter can be one of the following values: + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1 + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE + */ +__STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)); +} +#endif /* LPTIM1 */ + +#if defined(SAI1) +/** + * @brief Get SAIx clock source + * @rmtoll DCKCFGR SAI1SEL LL_RCC_GetSAIClockSource\n + * DCKCFGR SAI2SEL LL_RCC_GetSAIClockSource\n + * DCKCFGR SAI1ASRC LL_RCC_GetSAIClockSource\n + * DCKCFGR SAI1BSRC LL_RCC_GetSAIClockSource + * @param SAIx This parameter can be one of the following values: + * @arg @ref LL_RCC_SAI1_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE (*) + * + * (*) value not defined in all devices. + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE_PLLSRC (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetSAIClockSource(uint32_t SAIx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, SAIx) >> 16U | SAIx); +} +#endif /* SAI1 */ + +#if defined(RCC_DCKCFGR_SDIOSEL) || defined(RCC_DCKCFGR2_SDIOSEL) +/** + * @brief Get SDIOx clock source + * @rmtoll DCKCFGR SDIOSEL LL_RCC_GetSDIOClockSource\n + * DCKCFGR2 SDIOSEL LL_RCC_GetSDIOClockSource + * @param SDIOx This parameter can be one of the following values: + * @arg @ref LL_RCC_SDIO_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SDIO_CLKSOURCE_PLL48CLK + * @arg @ref LL_RCC_SDIO_CLKSOURCE_SYSCLK + */ +__STATIC_INLINE uint32_t LL_RCC_GetSDIOClockSource(uint32_t SDIOx) +{ +#if defined(RCC_DCKCFGR_SDIOSEL) + return (uint32_t)(READ_BIT(RCC->DCKCFGR, SDIOx)); +#else + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, SDIOx)); +#endif /* RCC_DCKCFGR_SDIOSEL */ +} +#endif /* RCC_DCKCFGR_SDIOSEL || RCC_DCKCFGR2_SDIOSEL */ + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) +/** + * @brief Get 48Mhz domain clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_GetCK48MClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_GetCK48MClockSource + * @param CK48Mx This parameter can be one of the following values: + * @arg @ref LL_RCC_CK48M_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLL + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_CK48M_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetCK48MClockSource(uint32_t CK48Mx) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + return (uint32_t)(READ_BIT(RCC->DCKCFGR, CK48Mx)); +#else + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, CK48Mx)); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} + +#if defined(RNG) +/** + * @brief Get RNGx clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_GetRNGClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_GetRNGClockSource + * @param RNGx This parameter can be one of the following values: + * @arg @ref LL_RCC_RNG_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RNGx)); +#else + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, RNGx)); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} +#endif /* RNG */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +/** + * @brief Get USBx clock source + * @rmtoll DCKCFGR CK48MSEL LL_RCC_GetUSBClockSource\n + * DCKCFGR2 CK48MSEL LL_RCC_GetUSBClockSource + * @param USBx This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL + * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLLI2S (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx) +{ +#if defined(RCC_DCKCFGR_CK48MSEL) + return (uint32_t)(READ_BIT(RCC->DCKCFGR, USBx)); +#else + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, USBx)); +#endif /* RCC_DCKCFGR_CK48MSEL */ +} +#endif /* USB_OTG_FS || USB_OTG_HS */ +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + +#if defined(CEC) +/** + * @brief Get CEC Clock Source + * @rmtoll DCKCFGR2 CECSEL LL_RCC_GetCECClockSource + * @param CECx This parameter can be one of the following values: + * @arg @ref LL_RCC_CEC_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV488 + * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE + */ +__STATIC_INLINE uint32_t LL_RCC_GetCECClockSource(uint32_t CECx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, CECx)); +} +#endif /* CEC */ + +/** + * @brief Get I2S Clock Source + * @rmtoll CFGR I2SSRC LL_RCC_GetI2SClockSource\n + * DCKCFGR I2SSRC LL_RCC_GetI2SClockSource\n + * DCKCFGR I2S1SRC LL_RCC_GetI2SClockSource\n + * DCKCFGR I2S2SRC LL_RCC_GetI2SClockSource + * @param I2Sx This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S1_CLKSOURCE + * @arg @ref LL_RCC_I2S2_CLKSOURCE (*) + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLLSRC (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLI2S (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PIN (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLSRC (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetI2SClockSource(uint32_t I2Sx) +{ +#if defined(RCC_CFGR_I2SSRC) + return (uint32_t)(READ_BIT(RCC->CFGR, I2Sx)); +#else + return (uint32_t)(READ_BIT(RCC->DCKCFGR, I2Sx) >> 16U | I2Sx); +#endif /* RCC_CFGR_I2SSRC */ +} + +#if defined(DFSDM1_Channel0) +/** + * @brief Get DFSDM Audio Clock Source + * @rmtoll DCKCFGR CKDFSDM1ASEL LL_RCC_GetDFSDMAudioClockSource\n + * DCKCFGR CKDFSDM2ASEL LL_RCC_GetDFSDMAudioClockSource + * @param DFSDMx This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE (*) + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1 + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S2 + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1 (*) + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S2 (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetDFSDMAudioClockSource(uint32_t DFSDMx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, DFSDMx) << 16U | DFSDMx); +} + +/** + * @brief Get DFSDM Audio Clock Source + * @rmtoll DCKCFGR CKDFSDM1SEL LL_RCC_GetDFSDMClockSource + * @param DFSDMx This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE (*) + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2 + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_PCLK2 (*) + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_SYSCLK (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetDFSDMClockSource(uint32_t DFSDMx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, DFSDMx)); +} +#endif /* DFSDM1_Channel0 */ + +#if defined(SPDIFRX) +/** + * @brief Get SPDIFRX clock source + * @rmtoll DCKCFGR2 SPDIFRXSEL LL_RCC_GetSPDIFRXClockSource + * @param SPDIFRXx This parameter can be one of the following values: + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE_PLL + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_GetSPDIFRXClockSource(uint32_t SPDIFRXx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR2, SPDIFRXx)); +} +#endif /* SPDIFRX */ + +#if defined(DSI) +/** + * @brief Get DSI Clock Source + * @rmtoll DCKCFGR DSISEL LL_RCC_GetDSIClockSource + * @param DSIx This parameter can be one of the following values: + * @arg @ref LL_RCC_DSI_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY + * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL + */ +__STATIC_INLINE uint32_t LL_RCC_GetDSIClockSource(uint32_t DSIx) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, DSIx)); +} +#endif /* DSI */ + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_RTC RTC + * @{ + */ + +/** + * @brief Set RTC Clock Source + * @note Once the RTC clock source has been selected, it cannot be changed anymore unless + * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is + * set). The BDRST bit can be used to reset them. + * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI + * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source); +} + +/** + * @brief Get RTC Clock Source + * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI + * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE + */ +__STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void) +{ + return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)); +} + +/** + * @brief Enable RTC + * @rmtoll BDCR RTCEN LL_RCC_EnableRTC + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableRTC(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN); +} + +/** + * @brief Disable RTC + * @rmtoll BDCR RTCEN LL_RCC_DisableRTC + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableRTC(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN); +} + +/** + * @brief Check if RTC has been enabled or not + * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void) +{ + return (READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == (RCC_BDCR_RTCEN)); +} + +/** + * @brief Force the Backup domain reset + * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset + * @retval None + */ +__STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_BDRST); +} + +/** + * @brief Release the Backup domain reset + * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset + * @retval None + */ +__STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST); +} + +/** + * @brief Set HSE Prescalers for RTC Clock + * @rmtoll CFGR RTCPRE LL_RCC_SetRTC_HSEPrescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_RTC_NOCLOCK + * @arg @ref LL_RCC_RTC_HSE_DIV_2 + * @arg @ref LL_RCC_RTC_HSE_DIV_3 + * @arg @ref LL_RCC_RTC_HSE_DIV_4 + * @arg @ref LL_RCC_RTC_HSE_DIV_5 + * @arg @ref LL_RCC_RTC_HSE_DIV_6 + * @arg @ref LL_RCC_RTC_HSE_DIV_7 + * @arg @ref LL_RCC_RTC_HSE_DIV_8 + * @arg @ref LL_RCC_RTC_HSE_DIV_9 + * @arg @ref LL_RCC_RTC_HSE_DIV_10 + * @arg @ref LL_RCC_RTC_HSE_DIV_11 + * @arg @ref LL_RCC_RTC_HSE_DIV_12 + * @arg @ref LL_RCC_RTC_HSE_DIV_13 + * @arg @ref LL_RCC_RTC_HSE_DIV_14 + * @arg @ref LL_RCC_RTC_HSE_DIV_15 + * @arg @ref LL_RCC_RTC_HSE_DIV_16 + * @arg @ref LL_RCC_RTC_HSE_DIV_17 + * @arg @ref LL_RCC_RTC_HSE_DIV_18 + * @arg @ref LL_RCC_RTC_HSE_DIV_19 + * @arg @ref LL_RCC_RTC_HSE_DIV_20 + * @arg @ref LL_RCC_RTC_HSE_DIV_21 + * @arg @ref LL_RCC_RTC_HSE_DIV_22 + * @arg @ref LL_RCC_RTC_HSE_DIV_23 + * @arg @ref LL_RCC_RTC_HSE_DIV_24 + * @arg @ref LL_RCC_RTC_HSE_DIV_25 + * @arg @ref LL_RCC_RTC_HSE_DIV_26 + * @arg @ref LL_RCC_RTC_HSE_DIV_27 + * @arg @ref LL_RCC_RTC_HSE_DIV_28 + * @arg @ref LL_RCC_RTC_HSE_DIV_29 + * @arg @ref LL_RCC_RTC_HSE_DIV_30 + * @arg @ref LL_RCC_RTC_HSE_DIV_31 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetRTC_HSEPrescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_RTCPRE, Prescaler); +} + +/** + * @brief Get HSE Prescalers for RTC Clock + * @rmtoll CFGR RTCPRE LL_RCC_GetRTC_HSEPrescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_RTC_NOCLOCK + * @arg @ref LL_RCC_RTC_HSE_DIV_2 + * @arg @ref LL_RCC_RTC_HSE_DIV_3 + * @arg @ref LL_RCC_RTC_HSE_DIV_4 + * @arg @ref LL_RCC_RTC_HSE_DIV_5 + * @arg @ref LL_RCC_RTC_HSE_DIV_6 + * @arg @ref LL_RCC_RTC_HSE_DIV_7 + * @arg @ref LL_RCC_RTC_HSE_DIV_8 + * @arg @ref LL_RCC_RTC_HSE_DIV_9 + * @arg @ref LL_RCC_RTC_HSE_DIV_10 + * @arg @ref LL_RCC_RTC_HSE_DIV_11 + * @arg @ref LL_RCC_RTC_HSE_DIV_12 + * @arg @ref LL_RCC_RTC_HSE_DIV_13 + * @arg @ref LL_RCC_RTC_HSE_DIV_14 + * @arg @ref LL_RCC_RTC_HSE_DIV_15 + * @arg @ref LL_RCC_RTC_HSE_DIV_16 + * @arg @ref LL_RCC_RTC_HSE_DIV_17 + * @arg @ref LL_RCC_RTC_HSE_DIV_18 + * @arg @ref LL_RCC_RTC_HSE_DIV_19 + * @arg @ref LL_RCC_RTC_HSE_DIV_20 + * @arg @ref LL_RCC_RTC_HSE_DIV_21 + * @arg @ref LL_RCC_RTC_HSE_DIV_22 + * @arg @ref LL_RCC_RTC_HSE_DIV_23 + * @arg @ref LL_RCC_RTC_HSE_DIV_24 + * @arg @ref LL_RCC_RTC_HSE_DIV_25 + * @arg @ref LL_RCC_RTC_HSE_DIV_26 + * @arg @ref LL_RCC_RTC_HSE_DIV_27 + * @arg @ref LL_RCC_RTC_HSE_DIV_28 + * @arg @ref LL_RCC_RTC_HSE_DIV_29 + * @arg @ref LL_RCC_RTC_HSE_DIV_30 + * @arg @ref LL_RCC_RTC_HSE_DIV_31 + */ +__STATIC_INLINE uint32_t LL_RCC_GetRTC_HSEPrescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_RTCPRE)); +} + +/** + * @} + */ + +#if defined(RCC_DCKCFGR_TIMPRE) +/** @defgroup RCC_LL_EF_TIM_CLOCK_PRESCALER TIM + * @{ + */ + +/** + * @brief Set Timers Clock Prescalers + * @rmtoll DCKCFGR TIMPRE LL_RCC_SetTIMPrescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_TIM_PRESCALER_TWICE + * @arg @ref LL_RCC_TIM_PRESCALER_FOUR_TIMES + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetTIMPrescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_TIMPRE, Prescaler); +} + +/** + * @brief Get Timers Clock Prescalers + * @rmtoll DCKCFGR TIMPRE LL_RCC_GetTIMPrescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_TIM_PRESCALER_TWICE + * @arg @ref LL_RCC_TIM_PRESCALER_FOUR_TIMES + */ +__STATIC_INLINE uint32_t LL_RCC_GetTIMPrescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_TIMPRE)); +} + +/** + * @} + */ +#endif /* RCC_DCKCFGR_TIMPRE */ + +/** @defgroup RCC_LL_EF_PLL PLL + * @{ + */ + +/** + * @brief Enable PLL + * @rmtoll CR PLLON LL_RCC_PLL_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLLON); +} + +/** + * @brief Disable PLL + * @note Cannot be disabled if the PLL clock is used as the system clock + * @rmtoll CR PLLON LL_RCC_PLL_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLLON); +} + +/** + * @brief Check if PLL Ready + * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == (RCC_CR_PLLRDY)); +} + +/** + * @brief Configure PLL used for SYSCLK Domain + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLP can be written only when PLL is disabled + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SYS\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SYS\n + * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SYS\n + * PLLCFGR PLLP LL_RCC_PLL_ConfigDomain_SYS + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLP_R This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLP_DIV_2 + * @arg @ref LL_RCC_PLLP_DIV_4 + * @arg @ref LL_RCC_PLLP_DIV_6 + * @arg @ref LL_RCC_PLLP_DIV_8 + * @arg @ref LL_RCC_PLLR_DIV_2 (*) + * @arg @ref LL_RCC_PLLR_DIV_3 (*) + * @arg @ref LL_RCC_PLLR_DIV_4 (*) + * @arg @ref LL_RCC_PLLR_DIV_5 (*) + * @arg @ref LL_RCC_PLLR_DIV_6 (*) + * @arg @ref LL_RCC_PLLR_DIV_7 (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP_R) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos); + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLP, PLLP_R); +#if defined(RCC_PLLR_SYSCLK_SUPPORT) + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLR, PLLP_R); +#endif /* RCC_PLLR_SYSCLK_SUPPORT */ +} + +/** + * @brief Configure PLL used for 48Mhz domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLQ can be written only when PLL is disabled + * @note This can be selected for USB, RNG, SDIO + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_48M\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_48M\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_48M\n + * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_48M + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLQ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLQ_DIV_2 + * @arg @ref LL_RCC_PLLQ_DIV_3 + * @arg @ref LL_RCC_PLLQ_DIV_4 + * @arg @ref LL_RCC_PLLQ_DIV_5 + * @arg @ref LL_RCC_PLLQ_DIV_6 + * @arg @ref LL_RCC_PLLQ_DIV_7 + * @arg @ref LL_RCC_PLLQ_DIV_8 + * @arg @ref LL_RCC_PLLQ_DIV_9 + * @arg @ref LL_RCC_PLLQ_DIV_10 + * @arg @ref LL_RCC_PLLQ_DIV_11 + * @arg @ref LL_RCC_PLLQ_DIV_12 + * @arg @ref LL_RCC_PLLQ_DIV_13 + * @arg @ref LL_RCC_PLLQ_DIV_14 + * @arg @ref LL_RCC_PLLQ_DIV_15 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos | PLLQ); +} + +#if defined(DSI) +/** + * @brief Configure PLL used for DSI clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI are disabled + * @note PLLN/PLLR can be written only when PLL is disabled + * @note This can be selected for DSI + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_DSI\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_DSI\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_DSI\n + * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_DSI + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_DSI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos | PLLR); +} +#endif /* DSI */ + +#if defined(RCC_PLLR_I2S_CLKSOURCE_SUPPORT) +/** + * @brief Configure PLL used for I2S clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI are disabled + * @note PLLN/PLLR can be written only when PLL is disabled + * @note This can be selected for I2S + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_I2S\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_I2S\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_I2S\n + * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_I2S + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_I2S(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos | PLLR); +} +#endif /* RCC_PLLR_I2S_CLKSOURCE_SUPPORT */ + +#if defined(SPDIFRX) +/** + * @brief Configure PLL used for SPDIFRX clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI are disabled + * @note PLLN/PLLR can be written only when PLL is disabled + * @note This can be selected for SPDIFRX + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SPDIFRX\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SPDIFRX\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SPDIFRX\n + * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SPDIFRX + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SPDIFRX(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos | PLLR); +} +#endif /* SPDIFRX */ + +#if defined(RCC_PLLCFGR_PLLR) +#if defined(SAI1) +/** + * @brief Configure PLL used for SAI clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI are disabled + * @note PLLN/PLLR can be written only when PLL is disabled + * @note This can be selected for SAI + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SAI\n + * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SAI\n + * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SAI\n + * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SAI\n + * DCKCFGR PLLDIVR LL_RCC_PLL_ConfigDomain_SAI + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + * @param PLLDIVR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLDIVR_DIV_1 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_2 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_3 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_4 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_5 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_6 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_7 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_8 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_9 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_10 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_11 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_12 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_13 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_14 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_15 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_16 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_17 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_18 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_19 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_20 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_21 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_22 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_23 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_24 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_25 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_26 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_27 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_28 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_29 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_30 (*) + * @arg @ref LL_RCC_PLLDIVR_DIV_31 (*) + * + * (*) value not defined in all devices. + * @retval None + */ +#if defined(RCC_DCKCFGR_PLLDIVR) +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR, uint32_t PLLDIVR) +#else +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR) +#endif /* RCC_DCKCFGR_PLLDIVR */ +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR, + Source | PLLM | PLLN << RCC_PLLCFGR_PLLN_Pos | PLLR); +#if defined(RCC_DCKCFGR_PLLDIVR) + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLDIVR, PLLDIVR); +#endif /* RCC_DCKCFGR_PLLDIVR */ +} +#endif /* SAI1 */ +#endif /* RCC_PLLCFGR_PLLR */ + +/** + * @brief Configure PLL clock source + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_SetMainSource + * @param PLLSource This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSource); +} + +/** + * @brief Get the oscillator used as PLL clock source. + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_GetMainSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC)); +} + +/** + * @brief Get Main PLL multiplication factor for VCO + * @rmtoll PLLCFGR PLLN LL_RCC_PLL_GetN + * @retval Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetN(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos); +} + +/** + * @brief Get Main PLL division factor for PLLP + * @rmtoll PLLCFGR PLLP LL_RCC_PLL_GetP + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLP_DIV_2 + * @arg @ref LL_RCC_PLLP_DIV_4 + * @arg @ref LL_RCC_PLLP_DIV_6 + * @arg @ref LL_RCC_PLLP_DIV_8 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetP(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLP)); +} + +/** + * @brief Get Main PLL division factor for PLLQ + * @note used for PLL48MCLK selected for USB, RNG, SDIO (48 MHz clock) + * @rmtoll PLLCFGR PLLQ LL_RCC_PLL_GetQ + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLQ_DIV_2 + * @arg @ref LL_RCC_PLLQ_DIV_3 + * @arg @ref LL_RCC_PLLQ_DIV_4 + * @arg @ref LL_RCC_PLLQ_DIV_5 + * @arg @ref LL_RCC_PLLQ_DIV_6 + * @arg @ref LL_RCC_PLLQ_DIV_7 + * @arg @ref LL_RCC_PLLQ_DIV_8 + * @arg @ref LL_RCC_PLLQ_DIV_9 + * @arg @ref LL_RCC_PLLQ_DIV_10 + * @arg @ref LL_RCC_PLLQ_DIV_11 + * @arg @ref LL_RCC_PLLQ_DIV_12 + * @arg @ref LL_RCC_PLLQ_DIV_13 + * @arg @ref LL_RCC_PLLQ_DIV_14 + * @arg @ref LL_RCC_PLLQ_DIV_15 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetQ(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQ)); +} + +#if defined(RCC_PLLCFGR_PLLR) +/** + * @brief Get Main PLL division factor for PLLR + * @note used for PLLCLK (system clock) + * @rmtoll PLLCFGR PLLR LL_RCC_PLL_GetR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLR_DIV_2 + * @arg @ref LL_RCC_PLLR_DIV_3 + * @arg @ref LL_RCC_PLLR_DIV_4 + * @arg @ref LL_RCC_PLLR_DIV_5 + * @arg @ref LL_RCC_PLLR_DIV_6 + * @arg @ref LL_RCC_PLLR_DIV_7 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetR(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLR)); +} +#endif /* RCC_PLLCFGR_PLLR */ + +#if defined(RCC_DCKCFGR_PLLDIVR) +/** + * @brief Get Main PLL division factor for PLLDIVR + * @note used for PLLSAICLK (SAI1 and SAI2 clock) + * @rmtoll DCKCFGR PLLDIVR LL_RCC_PLL_GetDIVR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLDIVR_DIV_1 + * @arg @ref LL_RCC_PLLDIVR_DIV_2 + * @arg @ref LL_RCC_PLLDIVR_DIV_3 + * @arg @ref LL_RCC_PLLDIVR_DIV_4 + * @arg @ref LL_RCC_PLLDIVR_DIV_5 + * @arg @ref LL_RCC_PLLDIVR_DIV_6 + * @arg @ref LL_RCC_PLLDIVR_DIV_7 + * @arg @ref LL_RCC_PLLDIVR_DIV_8 + * @arg @ref LL_RCC_PLLDIVR_DIV_9 + * @arg @ref LL_RCC_PLLDIVR_DIV_10 + * @arg @ref LL_RCC_PLLDIVR_DIV_11 + * @arg @ref LL_RCC_PLLDIVR_DIV_12 + * @arg @ref LL_RCC_PLLDIVR_DIV_13 + * @arg @ref LL_RCC_PLLDIVR_DIV_14 + * @arg @ref LL_RCC_PLLDIVR_DIV_15 + * @arg @ref LL_RCC_PLLDIVR_DIV_16 + * @arg @ref LL_RCC_PLLDIVR_DIV_17 + * @arg @ref LL_RCC_PLLDIVR_DIV_18 + * @arg @ref LL_RCC_PLLDIVR_DIV_19 + * @arg @ref LL_RCC_PLLDIVR_DIV_20 + * @arg @ref LL_RCC_PLLDIVR_DIV_21 + * @arg @ref LL_RCC_PLLDIVR_DIV_22 + * @arg @ref LL_RCC_PLLDIVR_DIV_23 + * @arg @ref LL_RCC_PLLDIVR_DIV_24 + * @arg @ref LL_RCC_PLLDIVR_DIV_25 + * @arg @ref LL_RCC_PLLDIVR_DIV_26 + * @arg @ref LL_RCC_PLLDIVR_DIV_27 + * @arg @ref LL_RCC_PLLDIVR_DIV_28 + * @arg @ref LL_RCC_PLLDIVR_DIV_29 + * @arg @ref LL_RCC_PLLDIVR_DIV_30 + * @arg @ref LL_RCC_PLLDIVR_DIV_31 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetDIVR(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_PLLDIVR)); +} +#endif /* RCC_DCKCFGR_PLLDIVR */ + +/** + * @brief Get Division factor for the main PLL and other PLL + * @rmtoll PLLCFGR PLLM LL_RCC_PLL_GetDivider + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLM_DIV_2 + * @arg @ref LL_RCC_PLLM_DIV_3 + * @arg @ref LL_RCC_PLLM_DIV_4 + * @arg @ref LL_RCC_PLLM_DIV_5 + * @arg @ref LL_RCC_PLLM_DIV_6 + * @arg @ref LL_RCC_PLLM_DIV_7 + * @arg @ref LL_RCC_PLLM_DIV_8 + * @arg @ref LL_RCC_PLLM_DIV_9 + * @arg @ref LL_RCC_PLLM_DIV_10 + * @arg @ref LL_RCC_PLLM_DIV_11 + * @arg @ref LL_RCC_PLLM_DIV_12 + * @arg @ref LL_RCC_PLLM_DIV_13 + * @arg @ref LL_RCC_PLLM_DIV_14 + * @arg @ref LL_RCC_PLLM_DIV_15 + * @arg @ref LL_RCC_PLLM_DIV_16 + * @arg @ref LL_RCC_PLLM_DIV_17 + * @arg @ref LL_RCC_PLLM_DIV_18 + * @arg @ref LL_RCC_PLLM_DIV_19 + * @arg @ref LL_RCC_PLLM_DIV_20 + * @arg @ref LL_RCC_PLLM_DIV_21 + * @arg @ref LL_RCC_PLLM_DIV_22 + * @arg @ref LL_RCC_PLLM_DIV_23 + * @arg @ref LL_RCC_PLLM_DIV_24 + * @arg @ref LL_RCC_PLLM_DIV_25 + * @arg @ref LL_RCC_PLLM_DIV_26 + * @arg @ref LL_RCC_PLLM_DIV_27 + * @arg @ref LL_RCC_PLLM_DIV_28 + * @arg @ref LL_RCC_PLLM_DIV_29 + * @arg @ref LL_RCC_PLLM_DIV_30 + * @arg @ref LL_RCC_PLLM_DIV_31 + * @arg @ref LL_RCC_PLLM_DIV_32 + * @arg @ref LL_RCC_PLLM_DIV_33 + * @arg @ref LL_RCC_PLLM_DIV_34 + * @arg @ref LL_RCC_PLLM_DIV_35 + * @arg @ref LL_RCC_PLLM_DIV_36 + * @arg @ref LL_RCC_PLLM_DIV_37 + * @arg @ref LL_RCC_PLLM_DIV_38 + * @arg @ref LL_RCC_PLLM_DIV_39 + * @arg @ref LL_RCC_PLLM_DIV_40 + * @arg @ref LL_RCC_PLLM_DIV_41 + * @arg @ref LL_RCC_PLLM_DIV_42 + * @arg @ref LL_RCC_PLLM_DIV_43 + * @arg @ref LL_RCC_PLLM_DIV_44 + * @arg @ref LL_RCC_PLLM_DIV_45 + * @arg @ref LL_RCC_PLLM_DIV_46 + * @arg @ref LL_RCC_PLLM_DIV_47 + * @arg @ref LL_RCC_PLLM_DIV_48 + * @arg @ref LL_RCC_PLLM_DIV_49 + * @arg @ref LL_RCC_PLLM_DIV_50 + * @arg @ref LL_RCC_PLLM_DIV_51 + * @arg @ref LL_RCC_PLLM_DIV_52 + * @arg @ref LL_RCC_PLLM_DIV_53 + * @arg @ref LL_RCC_PLLM_DIV_54 + * @arg @ref LL_RCC_PLLM_DIV_55 + * @arg @ref LL_RCC_PLLM_DIV_56 + * @arg @ref LL_RCC_PLLM_DIV_57 + * @arg @ref LL_RCC_PLLM_DIV_58 + * @arg @ref LL_RCC_PLLM_DIV_59 + * @arg @ref LL_RCC_PLLM_DIV_60 + * @arg @ref LL_RCC_PLLM_DIV_61 + * @arg @ref LL_RCC_PLLM_DIV_62 + * @arg @ref LL_RCC_PLLM_DIV_63 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetDivider(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM)); +} + +/** + * @brief Configure Spread Spectrum used for PLL + * @note These bits must be written before enabling PLL + * @rmtoll SSCGR MODPER LL_RCC_PLL_ConfigSpreadSpectrum\n + * SSCGR INCSTEP LL_RCC_PLL_ConfigSpreadSpectrum\n + * SSCGR SPREADSEL LL_RCC_PLL_ConfigSpreadSpectrum + * @param Mod Between Min_Data=0 and Max_Data=8191 + * @param Inc Between Min_Data=0 and Max_Data=32767 + * @param Sel This parameter can be one of the following values: + * @arg @ref LL_RCC_SPREAD_SELECT_CENTER + * @arg @ref LL_RCC_SPREAD_SELECT_DOWN + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigSpreadSpectrum(uint32_t Mod, uint32_t Inc, uint32_t Sel) +{ + MODIFY_REG(RCC->SSCGR, RCC_SSCGR_MODPER | RCC_SSCGR_INCSTEP | RCC_SSCGR_SPREADSEL, Mod | (Inc << RCC_SSCGR_INCSTEP_Pos) | Sel); +} + +/** + * @brief Get Spread Spectrum Modulation Period for PLL + * @rmtoll SSCGR MODPER LL_RCC_PLL_GetPeriodModulation + * @retval Between Min_Data=0 and Max_Data=8191 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetPeriodModulation(void) +{ + return (uint32_t)(READ_BIT(RCC->SSCGR, RCC_SSCGR_MODPER)); +} + +/** + * @brief Get Spread Spectrum Incrementation Step for PLL + * @note Must be written before enabling PLL + * @rmtoll SSCGR INCSTEP LL_RCC_PLL_GetStepIncrementation + * @retval Between Min_Data=0 and Max_Data=32767 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetStepIncrementation(void) +{ + return (uint32_t)(READ_BIT(RCC->SSCGR, RCC_SSCGR_INCSTEP) >> RCC_SSCGR_INCSTEP_Pos); +} + +/** + * @brief Get Spread Spectrum Selection for PLL + * @note Must be written before enabling PLL + * @rmtoll SSCGR SPREADSEL LL_RCC_PLL_GetSpreadSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SPREAD_SELECT_CENTER + * @arg @ref LL_RCC_SPREAD_SELECT_DOWN + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetSpreadSelection(void) +{ + return (uint32_t)(READ_BIT(RCC->SSCGR, RCC_SSCGR_SPREADSEL)); +} + +/** + * @brief Enable Spread Spectrum for PLL. + * @rmtoll SSCGR SSCGEN LL_RCC_PLL_SpreadSpectrum_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_SpreadSpectrum_Enable(void) +{ + SET_BIT(RCC->SSCGR, RCC_SSCGR_SSCGEN); +} + +/** + * @brief Disable Spread Spectrum for PLL. + * @rmtoll SSCGR SSCGEN LL_RCC_PLL_SpreadSpectrum_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_SpreadSpectrum_Disable(void) +{ + CLEAR_BIT(RCC->SSCGR, RCC_SSCGR_SSCGEN); +} + +/** + * @} + */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** @defgroup RCC_LL_EF_PLLI2S PLLI2S + * @{ + */ + +/** + * @brief Enable PLLI2S + * @rmtoll CR PLLI2SON LL_RCC_PLLI2S_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLLI2SON); +} + +/** + * @brief Disable PLLI2S + * @rmtoll CR PLLI2SON LL_RCC_PLLI2S_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLLI2SON); +} + +/** + * @brief Check if PLLI2S Ready + * @rmtoll CR PLLI2SRDY LL_RCC_PLLI2S_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLLI2SRDY) == (RCC_CR_PLLI2SRDY)); +} + +#if (defined(RCC_DCKCFGR_PLLI2SDIVQ) || defined(RCC_DCKCFGR_PLLI2SDIVR)) +/** + * @brief Configure PLLI2S used for SAI domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLQ/PLLR can be written only when PLLI2S is disabled + * @note This can be selected for SAI + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLI2SCFGR PLLI2SSRC LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLCFGR PLLM LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLI2SCFGR PLLI2SM LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLI2SCFGR PLLI2SN LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLI2SCFGR PLLI2SQ LL_RCC_PLLI2S_ConfigDomain_SAI\n + * PLLI2SCFGR PLLI2SR LL_RCC_PLLI2S_ConfigDomain_SAI\n + * DCKCFGR PLLI2SDIVQ LL_RCC_PLLI2S_ConfigDomain_SAI\n + * DCKCFGR PLLI2SDIVR LL_RCC_PLLI2S_ConfigDomain_SAI + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLI2SSOURCE_PIN (*) + * + * (*) value not defined in all devices. + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param PLLN Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLQ_R This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SQ_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SQ_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SR_DIV_7 (*) + * + * (*) value not defined in all devices. + * @param PLLDIVQ_R This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_1 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_16 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_17 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_18 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_19 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_20 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_21 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_22 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_23 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_24 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_25 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_26 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_27 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_28 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_29 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_30 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_31 (*) + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_32 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_1 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_2 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_3 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_4 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_5 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_6 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_7 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_8 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_9 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_10 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_11 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_12 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_13 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_14 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_15 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_16 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_17 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_18 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_19 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_20 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_21 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_22 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_23 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_24 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_25 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_26 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_27 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_28 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_29 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_30 (*) + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_31 (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ_R, uint32_t PLLDIVQ_R) +{ + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&RCC->PLLCFGR) + (Source & 0x80U))); + MODIFY_REG(*pReg, RCC_PLLCFGR_PLLSRC, (Source & (~0x80U))); +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SN, PLLN << RCC_PLLI2SCFGR_PLLI2SN_Pos); +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SQ, PLLQ_R); + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVQ, PLLDIVQ_R); +#else + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SR, PLLQ_R); + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVR, PLLDIVQ_R); +#endif /* RCC_DCKCFGR_PLLI2SDIVQ */ +} +#endif /* RCC_DCKCFGR_PLLI2SDIVQ && RCC_DCKCFGR_PLLI2SDIVR */ + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +/** + * @brief Configure PLLI2S used for 48Mhz domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLQ can be written only when PLLI2S is disabled + * @note This can be selected for RNG, USB, SDIO + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLI2S_ConfigDomain_48M\n + * PLLI2SCFGR PLLI2SSRC LL_RCC_PLLI2S_ConfigDomain_48M\n + * PLLCFGR PLLM LL_RCC_PLLI2S_ConfigDomain_48M\n + * PLLI2SCFGR PLLI2SM LL_RCC_PLLI2S_ConfigDomain_48M\n + * PLLI2SCFGR PLLI2SN LL_RCC_PLLI2S_ConfigDomain_48M\n + * PLLI2SCFGR PLLI2SQ LL_RCC_PLLI2S_ConfigDomain_48M + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLI2SSOURCE_PIN (*) + * + * (*) value not defined in all devices. + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLQ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SQ_DIV_2 + * @arg @ref LL_RCC_PLLI2SQ_DIV_3 + * @arg @ref LL_RCC_PLLI2SQ_DIV_4 + * @arg @ref LL_RCC_PLLI2SQ_DIV_5 + * @arg @ref LL_RCC_PLLI2SQ_DIV_6 + * @arg @ref LL_RCC_PLLI2SQ_DIV_7 + * @arg @ref LL_RCC_PLLI2SQ_DIV_8 + * @arg @ref LL_RCC_PLLI2SQ_DIV_9 + * @arg @ref LL_RCC_PLLI2SQ_DIV_10 + * @arg @ref LL_RCC_PLLI2SQ_DIV_11 + * @arg @ref LL_RCC_PLLI2SQ_DIV_12 + * @arg @ref LL_RCC_PLLI2SQ_DIV_13 + * @arg @ref LL_RCC_PLLI2SQ_DIV_14 + * @arg @ref LL_RCC_PLLI2SQ_DIV_15 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ) +{ + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&RCC->PLLCFGR) + (Source & 0x80U))); + MODIFY_REG(*pReg, RCC_PLLCFGR_PLLSRC, (Source & (~0x80U))); +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SN | RCC_PLLI2SCFGR_PLLI2SQ, PLLN << RCC_PLLI2SCFGR_PLLI2SN_Pos | PLLQ); +} +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ + +#if defined(SPDIFRX) +/** + * @brief Configure PLLI2S used for SPDIFRX domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLP can be written only when PLLI2S is disabled + * @note This can be selected for SPDIFRX + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLI2S_ConfigDomain_SPDIFRX\n + * PLLCFGR PLLM LL_RCC_PLLI2S_ConfigDomain_SPDIFRX\n + * PLLI2SCFGR PLLI2SM LL_RCC_PLLI2S_ConfigDomain_SPDIFRX\n + * PLLI2SCFGR PLLI2SN LL_RCC_PLLI2S_ConfigDomain_SPDIFRX\n + * PLLI2SCFGR PLLI2SP LL_RCC_PLLI2S_ConfigDomain_SPDIFRX + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLP This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SP_DIV_2 + * @arg @ref LL_RCC_PLLI2SP_DIV_4 + * @arg @ref LL_RCC_PLLI2SP_DIV_6 + * @arg @ref LL_RCC_PLLI2SP_DIV_8 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_ConfigDomain_SPDIFRX(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source); +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SN | RCC_PLLI2SCFGR_PLLI2SP, PLLN << RCC_PLLI2SCFGR_PLLI2SN_Pos | PLLP); +} +#endif /* SPDIFRX */ + +/** + * @brief Configure PLLI2S used for I2S1 domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLR can be written only when PLLI2S is disabled + * @note This can be selected for I2S + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLI2S_ConfigDomain_I2S\n + * PLLCFGR PLLM LL_RCC_PLLI2S_ConfigDomain_I2S\n + * PLLI2SCFGR PLLI2SSRC LL_RCC_PLLI2S_ConfigDomain_I2S\n + * PLLI2SCFGR PLLI2SM LL_RCC_PLLI2S_ConfigDomain_I2S\n + * PLLI2SCFGR PLLI2SN LL_RCC_PLLI2S_ConfigDomain_I2S\n + * PLLI2SCFGR PLLI2SR LL_RCC_PLLI2S_ConfigDomain_I2S + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLI2SSOURCE_PIN (*) + * + * (*) value not defined in all devices. + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + * @param PLLN Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2SR_DIV_2 + * @arg @ref LL_RCC_PLLI2SR_DIV_3 + * @arg @ref LL_RCC_PLLI2SR_DIV_4 + * @arg @ref LL_RCC_PLLI2SR_DIV_5 + * @arg @ref LL_RCC_PLLI2SR_DIV_6 + * @arg @ref LL_RCC_PLLI2SR_DIV_7 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_ConfigDomain_I2S(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR) +{ + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&RCC->PLLCFGR) + (Source & 0x80U))); + MODIFY_REG(*pReg, RCC_PLLCFGR_PLLSRC, (Source & (~0x80U))); +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ + MODIFY_REG(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SN | RCC_PLLI2SCFGR_PLLI2SR, PLLN << RCC_PLLI2SCFGR_PLLI2SN_Pos | PLLR); +} + +/** + * @brief Get I2SPLL multiplication factor for VCO + * @rmtoll PLLI2SCFGR PLLI2SN LL_RCC_PLLI2S_GetN + * @retval Between 50/192(*) and 432 + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetN(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); +} + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) +/** + * @brief Get I2SPLL division factor for PLLI2SQ + * @rmtoll PLLI2SCFGR PLLI2SQ LL_RCC_PLLI2S_GetQ + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SQ_DIV_2 + * @arg @ref LL_RCC_PLLI2SQ_DIV_3 + * @arg @ref LL_RCC_PLLI2SQ_DIV_4 + * @arg @ref LL_RCC_PLLI2SQ_DIV_5 + * @arg @ref LL_RCC_PLLI2SQ_DIV_6 + * @arg @ref LL_RCC_PLLI2SQ_DIV_7 + * @arg @ref LL_RCC_PLLI2SQ_DIV_8 + * @arg @ref LL_RCC_PLLI2SQ_DIV_9 + * @arg @ref LL_RCC_PLLI2SQ_DIV_10 + * @arg @ref LL_RCC_PLLI2SQ_DIV_11 + * @arg @ref LL_RCC_PLLI2SQ_DIV_12 + * @arg @ref LL_RCC_PLLI2SQ_DIV_13 + * @arg @ref LL_RCC_PLLI2SQ_DIV_14 + * @arg @ref LL_RCC_PLLI2SQ_DIV_15 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetQ(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SQ)); +} +#endif /* RCC_PLLI2SCFGR_PLLI2SQ */ + +/** + * @brief Get I2SPLL division factor for PLLI2SR + * @note used for PLLI2SCLK (I2S clock) + * @rmtoll PLLI2SCFGR PLLI2SR LL_RCC_PLLI2S_GetR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SR_DIV_2 + * @arg @ref LL_RCC_PLLI2SR_DIV_3 + * @arg @ref LL_RCC_PLLI2SR_DIV_4 + * @arg @ref LL_RCC_PLLI2SR_DIV_5 + * @arg @ref LL_RCC_PLLI2SR_DIV_6 + * @arg @ref LL_RCC_PLLI2SR_DIV_7 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetR(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SR)); +} + +#if defined(RCC_PLLI2SCFGR_PLLI2SP) +/** + * @brief Get I2SPLL division factor for PLLI2SP + * @note used for PLLSPDIFRXCLK (SPDIFRX clock) + * @rmtoll PLLI2SCFGR PLLI2SP LL_RCC_PLLI2S_GetP + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SP_DIV_2 + * @arg @ref LL_RCC_PLLI2SP_DIV_4 + * @arg @ref LL_RCC_PLLI2SP_DIV_6 + * @arg @ref LL_RCC_PLLI2SP_DIV_8 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetP(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SP)); +} +#endif /* RCC_PLLI2SCFGR_PLLI2SP */ + +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) +/** + * @brief Get I2SPLL division factor for PLLI2SDIVQ + * @note used PLLSAICLK selected (SAI clock) + * @rmtoll DCKCFGR PLLI2SDIVQ LL_RCC_PLLI2S_GetDIVQ + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_1 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_2 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_3 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_4 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_5 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_6 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_7 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_8 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_9 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_10 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_11 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_12 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_13 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_14 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_15 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_16 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_17 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_18 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_19 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_20 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_21 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_22 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_23 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_24 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_25 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_26 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_27 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_28 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_29 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_30 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_31 + * @arg @ref LL_RCC_PLLI2SDIVQ_DIV_32 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetDIVQ(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVQ)); +} +#endif /* RCC_DCKCFGR_PLLI2SDIVQ */ + +#if defined(RCC_DCKCFGR_PLLI2SDIVR) +/** + * @brief Get I2SPLL division factor for PLLI2SDIVR + * @note used PLLSAICLK selected (SAI clock) + * @rmtoll DCKCFGR PLLI2SDIVR LL_RCC_PLLI2S_GetDIVR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_1 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_2 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_3 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_4 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_5 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_6 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_7 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_8 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_9 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_10 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_11 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_12 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_13 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_14 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_15 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_16 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_17 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_18 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_19 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_20 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_21 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_22 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_23 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_24 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_25 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_26 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_27 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_28 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_29 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_30 + * @arg @ref LL_RCC_PLLI2SDIVR_DIV_31 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetDIVR(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVR)); +} +#endif /* RCC_DCKCFGR_PLLI2SDIVR */ + +/** + * @brief Get division factor for PLLI2S input clock + * @rmtoll PLLCFGR PLLM LL_RCC_PLLI2S_GetDivider\n + * PLLI2SCFGR PLLI2SM LL_RCC_PLLI2S_GetDivider + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2SM_DIV_2 + * @arg @ref LL_RCC_PLLI2SM_DIV_3 + * @arg @ref LL_RCC_PLLI2SM_DIV_4 + * @arg @ref LL_RCC_PLLI2SM_DIV_5 + * @arg @ref LL_RCC_PLLI2SM_DIV_6 + * @arg @ref LL_RCC_PLLI2SM_DIV_7 + * @arg @ref LL_RCC_PLLI2SM_DIV_8 + * @arg @ref LL_RCC_PLLI2SM_DIV_9 + * @arg @ref LL_RCC_PLLI2SM_DIV_10 + * @arg @ref LL_RCC_PLLI2SM_DIV_11 + * @arg @ref LL_RCC_PLLI2SM_DIV_12 + * @arg @ref LL_RCC_PLLI2SM_DIV_13 + * @arg @ref LL_RCC_PLLI2SM_DIV_14 + * @arg @ref LL_RCC_PLLI2SM_DIV_15 + * @arg @ref LL_RCC_PLLI2SM_DIV_16 + * @arg @ref LL_RCC_PLLI2SM_DIV_17 + * @arg @ref LL_RCC_PLLI2SM_DIV_18 + * @arg @ref LL_RCC_PLLI2SM_DIV_19 + * @arg @ref LL_RCC_PLLI2SM_DIV_20 + * @arg @ref LL_RCC_PLLI2SM_DIV_21 + * @arg @ref LL_RCC_PLLI2SM_DIV_22 + * @arg @ref LL_RCC_PLLI2SM_DIV_23 + * @arg @ref LL_RCC_PLLI2SM_DIV_24 + * @arg @ref LL_RCC_PLLI2SM_DIV_25 + * @arg @ref LL_RCC_PLLI2SM_DIV_26 + * @arg @ref LL_RCC_PLLI2SM_DIV_27 + * @arg @ref LL_RCC_PLLI2SM_DIV_28 + * @arg @ref LL_RCC_PLLI2SM_DIV_29 + * @arg @ref LL_RCC_PLLI2SM_DIV_30 + * @arg @ref LL_RCC_PLLI2SM_DIV_31 + * @arg @ref LL_RCC_PLLI2SM_DIV_32 + * @arg @ref LL_RCC_PLLI2SM_DIV_33 + * @arg @ref LL_RCC_PLLI2SM_DIV_34 + * @arg @ref LL_RCC_PLLI2SM_DIV_35 + * @arg @ref LL_RCC_PLLI2SM_DIV_36 + * @arg @ref LL_RCC_PLLI2SM_DIV_37 + * @arg @ref LL_RCC_PLLI2SM_DIV_38 + * @arg @ref LL_RCC_PLLI2SM_DIV_39 + * @arg @ref LL_RCC_PLLI2SM_DIV_40 + * @arg @ref LL_RCC_PLLI2SM_DIV_41 + * @arg @ref LL_RCC_PLLI2SM_DIV_42 + * @arg @ref LL_RCC_PLLI2SM_DIV_43 + * @arg @ref LL_RCC_PLLI2SM_DIV_44 + * @arg @ref LL_RCC_PLLI2SM_DIV_45 + * @arg @ref LL_RCC_PLLI2SM_DIV_46 + * @arg @ref LL_RCC_PLLI2SM_DIV_47 + * @arg @ref LL_RCC_PLLI2SM_DIV_48 + * @arg @ref LL_RCC_PLLI2SM_DIV_49 + * @arg @ref LL_RCC_PLLI2SM_DIV_50 + * @arg @ref LL_RCC_PLLI2SM_DIV_51 + * @arg @ref LL_RCC_PLLI2SM_DIV_52 + * @arg @ref LL_RCC_PLLI2SM_DIV_53 + * @arg @ref LL_RCC_PLLI2SM_DIV_54 + * @arg @ref LL_RCC_PLLI2SM_DIV_55 + * @arg @ref LL_RCC_PLLI2SM_DIV_56 + * @arg @ref LL_RCC_PLLI2SM_DIV_57 + * @arg @ref LL_RCC_PLLI2SM_DIV_58 + * @arg @ref LL_RCC_PLLI2SM_DIV_59 + * @arg @ref LL_RCC_PLLI2SM_DIV_60 + * @arg @ref LL_RCC_PLLI2SM_DIV_61 + * @arg @ref LL_RCC_PLLI2SM_DIV_62 + * @arg @ref LL_RCC_PLLI2SM_DIV_63 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetDivider(void) +{ +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + return (uint32_t)(READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SM)); +#else + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM)); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ +} + +/** + * @brief Get the oscillator used as PLL clock source. + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLI2S_GetMainSource\n + * PLLI2SCFGR PLLI2SSRC LL_RCC_PLLI2S_GetMainSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLI2SSOURCE_PIN (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetMainSource(void) +{ +#if defined(RCC_PLLI2SCFGR_PLLI2SSRC) + register uint32_t pllsrc = READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC); + register uint32_t plli2sssrc0 = READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SSRC); + register uint32_t plli2sssrc1 = READ_BIT(RCC->PLLI2SCFGR, RCC_PLLI2SCFGR_PLLI2SSRC) >> 15U; + return (uint32_t)(pllsrc | plli2sssrc0 | plli2sssrc1); +#else + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC)); +#endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ +} + +/** + * @} + */ +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** @defgroup RCC_LL_EF_PLLSAI PLLSAI + * @{ + */ + +/** + * @brief Enable PLLSAI + * @rmtoll CR PLLSAION LL_RCC_PLLSAI_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLSAI_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLLSAION); +} + +/** + * @brief Disable PLLSAI + * @rmtoll CR PLLSAION LL_RCC_PLLSAI_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLSAI_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLLSAION); +} + +/** + * @brief Check if PLLSAI Ready + * @rmtoll CR PLLSAIRDY LL_RCC_PLLSAI_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLLSAIRDY) == (RCC_CR_PLLSAIRDY)); +} + +/** + * @brief Configure PLLSAI used for SAI domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLQ can be written only when PLLSAI is disabled + * @note This can be selected for SAI + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI_ConfigDomain_SAI\n + * PLLCFGR PLLM LL_RCC_PLLSAI_ConfigDomain_SAI\n + * PLLSAICFGR PLLSAIM LL_RCC_PLLSAI_ConfigDomain_SAI\n + * PLLSAICFGR PLLSAIN LL_RCC_PLLSAI_ConfigDomain_SAI\n + * PLLSAICFGR PLLSAIQ LL_RCC_PLLSAI_ConfigDomain_SAI\n + * DCKCFGR PLLSAIDIVQ LL_RCC_PLLSAI_ConfigDomain_SAI + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param PLLN Between 49/50(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLQ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIQ_DIV_15 + * @param PLLDIVQ This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_1 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_15 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_16 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_17 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_18 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_19 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_20 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_21 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_22 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_23 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_24 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_25 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_26 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_27 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_28 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_29 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_30 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_31 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_32 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLSAI_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ, uint32_t PLLDIVQ) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source); +#if defined(RCC_PLLSAICFGR_PLLSAIM) + MODIFY_REG(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLSAICFGR_PLLSAIM */ + MODIFY_REG(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIN | RCC_PLLSAICFGR_PLLSAIQ, PLLN << RCC_PLLSAICFGR_PLLSAIN_Pos | PLLQ); + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVQ, PLLDIVQ); +} + +#if defined(RCC_PLLSAICFGR_PLLSAIP) +/** + * @brief Configure PLLSAI used for 48Mhz domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLP can be written only when PLLSAI is disabled + * @note This can be selected for USB, RNG, SDIO + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI_ConfigDomain_48M\n + * PLLCFGR PLLM LL_RCC_PLLSAI_ConfigDomain_48M\n + * PLLSAICFGR PLLSAIM LL_RCC_PLLSAI_ConfigDomain_48M\n + * PLLSAICFGR PLLSAIN LL_RCC_PLLSAI_ConfigDomain_48M\n + * PLLSAICFGR PLLSAIP LL_RCC_PLLSAI_ConfigDomain_48M + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param PLLN Between 50 and 432 + * @param PLLP This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIP_DIV_2 + * @arg @ref LL_RCC_PLLSAIP_DIV_4 + * @arg @ref LL_RCC_PLLSAIP_DIV_6 + * @arg @ref LL_RCC_PLLSAIP_DIV_8 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLSAI_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source); +#if defined(RCC_PLLSAICFGR_PLLSAIM) + MODIFY_REG(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIM, PLLM); +#else + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, PLLM); +#endif /* RCC_PLLSAICFGR_PLLSAIM */ + MODIFY_REG(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIN | RCC_PLLSAICFGR_PLLSAIP, PLLN << RCC_PLLSAICFGR_PLLSAIN_Pos | PLLP); +} +#endif /* RCC_PLLSAICFGR_PLLSAIP */ + +#if defined(LTDC) +/** + * @brief Configure PLLSAI used for LTDC domain clock + * @note PLL Source and PLLM Divider can be written only when PLL, + * PLLI2S and PLLSAI(*) are disabled + * @note PLLN/PLLR can be written only when PLLSAI is disabled + * @note This can be selected for LTDC + * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI_ConfigDomain_LTDC\n + * PLLCFGR PLLM LL_RCC_PLLSAI_ConfigDomain_LTDC\n + * PLLSAICFGR PLLSAIN LL_RCC_PLLSAI_ConfigDomain_LTDC\n + * PLLSAICFGR PLLSAIR LL_RCC_PLLSAI_ConfigDomain_LTDC\n + * DCKCFGR PLLSAIDIVR LL_RCC_PLLSAI_ConfigDomain_LTDC + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @param PLLM This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + * @param PLLN Between 49/50(*) and 432 + * + * (*) value not defined in all devices. + * @param PLLR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIR_DIV_2 + * @arg @ref LL_RCC_PLLSAIR_DIV_3 + * @arg @ref LL_RCC_PLLSAIR_DIV_4 + * @arg @ref LL_RCC_PLLSAIR_DIV_5 + * @arg @ref LL_RCC_PLLSAIR_DIV_6 + * @arg @ref LL_RCC_PLLSAIR_DIV_7 + * @param PLLDIVR This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLSAI_ConfigDomain_LTDC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR, uint32_t PLLDIVR) +{ + MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM); + MODIFY_REG(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIN | RCC_PLLSAICFGR_PLLSAIR, PLLN << RCC_PLLSAICFGR_PLLSAIN_Pos | PLLR); + MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVR, PLLDIVR); +} +#endif /* LTDC */ + +/** + * @brief Get division factor for PLLSAI input clock + * @rmtoll PLLCFGR PLLM LL_RCC_PLLSAI_GetDivider\n + * PLLSAICFGR PLLSAIM LL_RCC_PLLSAI_GetDivider + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIM_DIV_2 + * @arg @ref LL_RCC_PLLSAIM_DIV_3 + * @arg @ref LL_RCC_PLLSAIM_DIV_4 + * @arg @ref LL_RCC_PLLSAIM_DIV_5 + * @arg @ref LL_RCC_PLLSAIM_DIV_6 + * @arg @ref LL_RCC_PLLSAIM_DIV_7 + * @arg @ref LL_RCC_PLLSAIM_DIV_8 + * @arg @ref LL_RCC_PLLSAIM_DIV_9 + * @arg @ref LL_RCC_PLLSAIM_DIV_10 + * @arg @ref LL_RCC_PLLSAIM_DIV_11 + * @arg @ref LL_RCC_PLLSAIM_DIV_12 + * @arg @ref LL_RCC_PLLSAIM_DIV_13 + * @arg @ref LL_RCC_PLLSAIM_DIV_14 + * @arg @ref LL_RCC_PLLSAIM_DIV_15 + * @arg @ref LL_RCC_PLLSAIM_DIV_16 + * @arg @ref LL_RCC_PLLSAIM_DIV_17 + * @arg @ref LL_RCC_PLLSAIM_DIV_18 + * @arg @ref LL_RCC_PLLSAIM_DIV_19 + * @arg @ref LL_RCC_PLLSAIM_DIV_20 + * @arg @ref LL_RCC_PLLSAIM_DIV_21 + * @arg @ref LL_RCC_PLLSAIM_DIV_22 + * @arg @ref LL_RCC_PLLSAIM_DIV_23 + * @arg @ref LL_RCC_PLLSAIM_DIV_24 + * @arg @ref LL_RCC_PLLSAIM_DIV_25 + * @arg @ref LL_RCC_PLLSAIM_DIV_26 + * @arg @ref LL_RCC_PLLSAIM_DIV_27 + * @arg @ref LL_RCC_PLLSAIM_DIV_28 + * @arg @ref LL_RCC_PLLSAIM_DIV_29 + * @arg @ref LL_RCC_PLLSAIM_DIV_30 + * @arg @ref LL_RCC_PLLSAIM_DIV_31 + * @arg @ref LL_RCC_PLLSAIM_DIV_32 + * @arg @ref LL_RCC_PLLSAIM_DIV_33 + * @arg @ref LL_RCC_PLLSAIM_DIV_34 + * @arg @ref LL_RCC_PLLSAIM_DIV_35 + * @arg @ref LL_RCC_PLLSAIM_DIV_36 + * @arg @ref LL_RCC_PLLSAIM_DIV_37 + * @arg @ref LL_RCC_PLLSAIM_DIV_38 + * @arg @ref LL_RCC_PLLSAIM_DIV_39 + * @arg @ref LL_RCC_PLLSAIM_DIV_40 + * @arg @ref LL_RCC_PLLSAIM_DIV_41 + * @arg @ref LL_RCC_PLLSAIM_DIV_42 + * @arg @ref LL_RCC_PLLSAIM_DIV_43 + * @arg @ref LL_RCC_PLLSAIM_DIV_44 + * @arg @ref LL_RCC_PLLSAIM_DIV_45 + * @arg @ref LL_RCC_PLLSAIM_DIV_46 + * @arg @ref LL_RCC_PLLSAIM_DIV_47 + * @arg @ref LL_RCC_PLLSAIM_DIV_48 + * @arg @ref LL_RCC_PLLSAIM_DIV_49 + * @arg @ref LL_RCC_PLLSAIM_DIV_50 + * @arg @ref LL_RCC_PLLSAIM_DIV_51 + * @arg @ref LL_RCC_PLLSAIM_DIV_52 + * @arg @ref LL_RCC_PLLSAIM_DIV_53 + * @arg @ref LL_RCC_PLLSAIM_DIV_54 + * @arg @ref LL_RCC_PLLSAIM_DIV_55 + * @arg @ref LL_RCC_PLLSAIM_DIV_56 + * @arg @ref LL_RCC_PLLSAIM_DIV_57 + * @arg @ref LL_RCC_PLLSAIM_DIV_58 + * @arg @ref LL_RCC_PLLSAIM_DIV_59 + * @arg @ref LL_RCC_PLLSAIM_DIV_60 + * @arg @ref LL_RCC_PLLSAIM_DIV_61 + * @arg @ref LL_RCC_PLLSAIM_DIV_62 + * @arg @ref LL_RCC_PLLSAIM_DIV_63 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetDivider(void) +{ +#if defined(RCC_PLLSAICFGR_PLLSAIM) + return (uint32_t)(READ_BIT(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIM)); +#else + return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM)); +#endif /* RCC_PLLSAICFGR_PLLSAIM */ +} + +/** + * @brief Get SAIPLL multiplication factor for VCO + * @rmtoll PLLSAICFGR PLLSAIN LL_RCC_PLLSAI_GetN + * @retval Between 49/50(*) and 432 + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetN(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIN) >> RCC_PLLSAICFGR_PLLSAIN_Pos); +} + +/** + * @brief Get SAIPLL division factor for PLLSAIQ + * @rmtoll PLLSAICFGR PLLSAIQ LL_RCC_PLLSAI_GetQ + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIQ_DIV_15 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetQ(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIQ)); +} + +#if defined(RCC_PLLSAICFGR_PLLSAIR) +/** + * @brief Get SAIPLL division factor for PLLSAIR + * @note used for PLLSAICLK (SAI clock) + * @rmtoll PLLSAICFGR PLLSAIR LL_RCC_PLLSAI_GetR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIR_DIV_2 + * @arg @ref LL_RCC_PLLSAIR_DIV_3 + * @arg @ref LL_RCC_PLLSAIR_DIV_4 + * @arg @ref LL_RCC_PLLSAIR_DIV_5 + * @arg @ref LL_RCC_PLLSAIR_DIV_6 + * @arg @ref LL_RCC_PLLSAIR_DIV_7 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetR(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIR)); +} +#endif /* RCC_PLLSAICFGR_PLLSAIR */ + +#if defined(RCC_PLLSAICFGR_PLLSAIP) +/** + * @brief Get SAIPLL division factor for PLLSAIP + * @note used for PLL48MCLK (48M domain clock) + * @rmtoll PLLSAICFGR PLLSAIP LL_RCC_PLLSAI_GetP + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIP_DIV_2 + * @arg @ref LL_RCC_PLLSAIP_DIV_4 + * @arg @ref LL_RCC_PLLSAIP_DIV_6 + * @arg @ref LL_RCC_PLLSAIP_DIV_8 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetP(void) +{ + return (uint32_t)(READ_BIT(RCC->PLLSAICFGR, RCC_PLLSAICFGR_PLLSAIP)); +} +#endif /* RCC_PLLSAICFGR_PLLSAIP */ + +/** + * @brief Get SAIPLL division factor for PLLSAIDIVQ + * @note used PLLSAICLK selected (SAI clock) + * @rmtoll DCKCFGR PLLSAIDIVQ LL_RCC_PLLSAI_GetDIVQ + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_1 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_3 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_5 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_6 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_7 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_9 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_10 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_11 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_12 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_13 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_14 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_15 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_16 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_17 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_18 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_19 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_20 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_21 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_22 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_23 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_24 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_25 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_26 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_27 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_28 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_29 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_30 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_31 + * @arg @ref LL_RCC_PLLSAIDIVQ_DIV_32 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetDIVQ(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVQ)); +} + +#if defined(RCC_DCKCFGR_PLLSAIDIVR) +/** + * @brief Get SAIPLL division factor for PLLSAIDIVR + * @note used for LTDC domain clock + * @rmtoll DCKCFGR PLLSAIDIVR LL_RCC_PLLSAI_GetDIVR + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_2 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_4 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_8 + * @arg @ref LL_RCC_PLLSAIDIVR_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLSAI_GetDIVR(void) +{ + return (uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVR)); +} +#endif /* RCC_DCKCFGR_PLLSAIDIVR */ + +/** + * @} + */ +#endif /* RCC_PLLSAI_SUPPORT */ + +/** @defgroup RCC_LL_EF_FLAG_Management FLAG Management + * @{ + */ + +/** + * @brief Clear LSI ready interrupt flag + * @rmtoll CIR LSIRDYC LL_RCC_ClearFlag_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC); +} + +/** + * @brief Clear LSE ready interrupt flag + * @rmtoll CIR LSERDYC LL_RCC_ClearFlag_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSERDYC); +} + +/** + * @brief Clear HSI ready interrupt flag + * @rmtoll CIR HSIRDYC LL_RCC_ClearFlag_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSIRDYC); +} + +/** + * @brief Clear HSE ready interrupt flag + * @rmtoll CIR HSERDYC LL_RCC_ClearFlag_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSERDYC); +} + +/** + * @brief Clear PLL ready interrupt flag + * @rmtoll CIR PLLRDYC LL_RCC_ClearFlag_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLRDYC); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Clear PLLI2S ready interrupt flag + * @rmtoll CIR PLLI2SRDYC LL_RCC_ClearFlag_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLLI2SRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYC); +} + +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Clear PLLSAI ready interrupt flag + * @rmtoll CIR PLLSAIRDYC LL_RCC_ClearFlag_PLLSAIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLLSAIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYC); +} + +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @brief Clear Clock security system interrupt flag + * @rmtoll CIR CSSC LL_RCC_ClearFlag_HSECSS + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_CSSC); +} + +/** + * @brief Check if LSI ready interrupt occurred or not + * @rmtoll CIR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYF) == (RCC_CIR_LSIRDYF)); +} + +/** + * @brief Check if LSE ready interrupt occurred or not + * @rmtoll CIR LSERDYF LL_RCC_IsActiveFlag_LSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYF) == (RCC_CIR_LSERDYF)); +} + +/** + * @brief Check if HSI ready interrupt occurred or not + * @rmtoll CIR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYF) == (RCC_CIR_HSIRDYF)); +} + +/** + * @brief Check if HSE ready interrupt occurred or not + * @rmtoll CIR HSERDYF LL_RCC_IsActiveFlag_HSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYF) == (RCC_CIR_HSERDYF)); +} + +/** + * @brief Check if PLL ready interrupt occurred or not + * @rmtoll CIR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYF) == (RCC_CIR_PLLRDYF)); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Check if PLLI2S ready interrupt occurred or not + * @rmtoll CIR PLLI2SRDYF LL_RCC_IsActiveFlag_PLLI2SRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLI2SRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYF) == (RCC_CIR_PLLI2SRDYF)); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Check if PLLSAI ready interrupt occurred or not + * @rmtoll CIR PLLSAIRDYF LL_RCC_IsActiveFlag_PLLSAIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLSAIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYF) == (RCC_CIR_PLLSAIRDYF)); +} +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @brief Check if Clock security system interrupt occurred or not + * @rmtoll CIR CSSF LL_RCC_IsActiveFlag_HSECSS + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_CSSF) == (RCC_CIR_CSSF)); +} + +/** + * @brief Check if RCC flag Independent Watchdog reset is set or not. + * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == (RCC_CSR_IWDGRSTF)); +} + +/** + * @brief Check if RCC flag Low Power reset is set or not. + * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == (RCC_CSR_LPWRRSTF)); +} + +/** + * @brief Check if RCC flag Pin reset is set or not. + * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == (RCC_CSR_PINRSTF)); +} + +/** + * @brief Check if RCC flag POR/PDR reset is set or not. + * @rmtoll CSR PORRSTF LL_RCC_IsActiveFlag_PORRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PORRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_PORRSTF) == (RCC_CSR_PORRSTF)); +} + +/** + * @brief Check if RCC flag Software reset is set or not. + * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == (RCC_CSR_SFTRSTF)); +} + +/** + * @brief Check if RCC flag Window Watchdog reset is set or not. + * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == (RCC_CSR_WWDGRSTF)); +} + +#if defined(RCC_CSR_BORRSTF) +/** + * @brief Check if RCC flag BOR reset is set or not. + * @rmtoll CSR BORRSTF LL_RCC_IsActiveFlag_BORRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_BORRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_BORRSTF) == (RCC_CSR_BORRSTF)); +} +#endif /* RCC_CSR_BORRSTF */ + +/** + * @brief Set RMVF bit to clear the reset flags. + * @rmtoll CSR RMVF LL_RCC_ClearResetFlags + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearResetFlags(void) +{ + SET_BIT(RCC->CSR, RCC_CSR_RMVF); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_IT_Management IT Management + * @{ + */ + +/** + * @brief Enable LSI ready interrupt + * @rmtoll CIR LSIRDYIE LL_RCC_EnableIT_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYIE); +} + +/** + * @brief Enable LSE ready interrupt + * @rmtoll CIR LSERDYIE LL_RCC_EnableIT_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSERDYIE); +} + +/** + * @brief Enable HSI ready interrupt + * @rmtoll CIR HSIRDYIE LL_RCC_EnableIT_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSIRDYIE); +} + +/** + * @brief Enable HSE ready interrupt + * @rmtoll CIR HSERDYIE LL_RCC_EnableIT_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSERDYIE); +} + +/** + * @brief Enable PLL ready interrupt + * @rmtoll CIR PLLRDYIE LL_RCC_EnableIT_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLRDYIE); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Enable PLLI2S ready interrupt + * @rmtoll CIR PLLI2SRDYIE LL_RCC_EnableIT_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLLI2SRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Enable PLLSAI ready interrupt + * @rmtoll CIR PLLSAIRDYIE LL_RCC_EnableIT_PLLSAIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLLSAIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE); +} +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @brief Disable LSI ready interrupt + * @rmtoll CIR LSIRDYIE LL_RCC_DisableIT_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE); +} + +/** + * @brief Disable LSE ready interrupt + * @rmtoll CIR LSERDYIE LL_RCC_DisableIT_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSERDYIE); +} + +/** + * @brief Disable HSI ready interrupt + * @rmtoll CIR HSIRDYIE LL_RCC_DisableIT_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_HSIRDYIE); +} + +/** + * @brief Disable HSE ready interrupt + * @rmtoll CIR HSERDYIE LL_RCC_DisableIT_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_HSERDYIE); +} + +/** + * @brief Disable PLL ready interrupt + * @rmtoll CIR PLLRDYIE LL_RCC_DisableIT_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLRDYIE); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Disable PLLI2S ready interrupt + * @rmtoll CIR PLLI2SRDYIE LL_RCC_DisableIT_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLLI2SRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE); +} + +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Disable PLLSAI ready interrupt + * @rmtoll CIR PLLSAIRDYIE LL_RCC_DisableIT_PLLSAIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLLSAIRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE); +} +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @brief Checks if LSI ready interrupt source is enabled or disabled. + * @rmtoll CIR LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYIE) == (RCC_CIR_LSIRDYIE)); +} + +/** + * @brief Checks if LSE ready interrupt source is enabled or disabled. + * @rmtoll CIR LSERDYIE LL_RCC_IsEnabledIT_LSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYIE) == (RCC_CIR_LSERDYIE)); +} + +/** + * @brief Checks if HSI ready interrupt source is enabled or disabled. + * @rmtoll CIR HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYIE) == (RCC_CIR_HSIRDYIE)); +} + +/** + * @brief Checks if HSE ready interrupt source is enabled or disabled. + * @rmtoll CIR HSERDYIE LL_RCC_IsEnabledIT_HSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYIE) == (RCC_CIR_HSERDYIE)); +} + +/** + * @brief Checks if PLL ready interrupt source is enabled or disabled. + * @rmtoll CIR PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYIE) == (RCC_CIR_PLLRDYIE)); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Checks if PLLI2S ready interrupt source is enabled or disabled. + * @rmtoll CIR PLLI2SRDYIE LL_RCC_IsEnabledIT_PLLI2SRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLI2SRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE) == (RCC_CIR_PLLI2SRDYIE)); +} + +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Checks if PLLSAI ready interrupt source is enabled or disabled. + * @rmtoll CIR PLLSAIRDYIE LL_RCC_IsEnabledIT_PLLSAIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLSAIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE) == (RCC_CIR_PLLSAIRDYIE)); +} +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_EF_Init De-initialization function + * @{ + */ +ErrorStatus LL_RCC_DeInit(void); +/** + * @} + */ + +/** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions + * @{ + */ +void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks); +#if defined(FMPI2C1) +uint32_t LL_RCC_GetFMPI2CClockFreq(uint32_t FMPI2CxSource); +#endif /* FMPI2C1 */ +#if defined(LPTIM1) +uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource); +#endif /* LPTIM1 */ +#if defined(SAI1) +uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource); +#endif /* SAI1 */ +#if defined(SDIO) +uint32_t LL_RCC_GetSDIOClockFreq(uint32_t SDIOxSource); +#endif /* SDIO */ +#if defined(RNG) +uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource); +#endif /* RNG */ +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource); +#endif /* USB_OTG_FS || USB_OTG_HS */ +#if defined(DFSDM1_Channel0) +uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource); +uint32_t LL_RCC_GetDFSDMAudioClockFreq(uint32_t DFSDMxSource); +#endif /* DFSDM1_Channel0 */ +uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource); +#if defined(CEC) +uint32_t LL_RCC_GetCECClockFreq(uint32_t CECxSource); +#endif /* CEC */ +#if defined(LTDC) +uint32_t LL_RCC_GetLTDCClockFreq(uint32_t LTDCxSource); +#endif /* LTDC */ +#if defined(SPDIFRX) +uint32_t LL_RCC_GetSPDIFRXClockFreq(uint32_t SPDIFRXxSource); +#endif /* SPDIFRX */ +#if defined(DSI) +uint32_t LL_RCC_GetDSIClockFreq(uint32_t DSIxSource); +#endif /* DSI */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(RCC) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_RCC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h new file mode 100644 index 0000000..b8a330c --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h @@ -0,0 +1,2029 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_spi.h + * @author MCD Application Team + * @brief Header file of SPI LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F4xx_LL_SPI_H +#define STM32F4xx_LL_SPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) + +/** @defgroup SPI_LL SPI + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup SPI_LL_ES_INIT SPI Exported Init structure + * @{ + */ + +/** + * @brief SPI Init structures definition + */ +typedef struct +{ + uint32_t TransferDirection; /*!< Specifies the SPI unidirectional or bidirectional data mode. + This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferDirection().*/ + + uint32_t Mode; /*!< Specifies the SPI mode (Master/Slave). + This parameter can be a value of @ref SPI_LL_EC_MODE. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetMode().*/ + + uint32_t DataWidth; /*!< Specifies the SPI data width. + This parameter can be a value of @ref SPI_LL_EC_DATAWIDTH. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetDataWidth().*/ + + uint32_t ClockPolarity; /*!< Specifies the serial clock steady state. + This parameter can be a value of @ref SPI_LL_EC_POLARITY. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPolarity().*/ + + uint32_t ClockPhase; /*!< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref SPI_LL_EC_PHASE. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPhase().*/ + + uint32_t NSS; /*!< Specifies whether the NSS signal is managed by hardware (NSS pin) or by software using the SSI bit. + This parameter can be a value of @ref SPI_LL_EC_NSS_MODE. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetNSSMode().*/ + + uint32_t BaudRate; /*!< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock. + This parameter can be a value of @ref SPI_LL_EC_BAUDRATEPRESCALER. + @note The communication clock is derived from the master clock. The slave clock does not need to be set. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetBaudRatePrescaler().*/ + + uint32_t BitOrder; /*!< Specifies whether data transfers start from MSB or LSB bit. + This parameter can be a value of @ref SPI_LL_EC_BIT_ORDER. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferBitOrder().*/ + + uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not. + This parameter can be a value of @ref SPI_LL_EC_CRC_CALCULATION. + + This feature can be modified afterwards using unitary functions @ref LL_SPI_EnableCRC() and @ref LL_SPI_DisableCRC().*/ + + uint32_t CRCPoly; /*!< Specifies the polynomial used for the CRC calculation. + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF. + + This feature can be modified afterwards using unitary function @ref LL_SPI_SetCRCPolynomial().*/ + +} LL_SPI_InitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup SPI_LL_Exported_Constants SPI Exported Constants + * @{ + */ + +/** @defgroup SPI_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_SPI_ReadReg function + * @{ + */ +#define LL_SPI_SR_RXNE SPI_SR_RXNE /*!< Rx buffer not empty flag */ +#define LL_SPI_SR_TXE SPI_SR_TXE /*!< Tx buffer empty flag */ +#define LL_SPI_SR_BSY SPI_SR_BSY /*!< Busy flag */ +#define LL_SPI_SR_CRCERR SPI_SR_CRCERR /*!< CRC error flag */ +#define LL_SPI_SR_MODF SPI_SR_MODF /*!< Mode fault flag */ +#define LL_SPI_SR_OVR SPI_SR_OVR /*!< Overrun flag */ +#define LL_SPI_SR_FRE SPI_SR_FRE /*!< TI mode frame format error flag */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions + * @{ + */ +#define LL_SPI_CR2_RXNEIE SPI_CR2_RXNEIE /*!< Rx buffer not empty interrupt enable */ +#define LL_SPI_CR2_TXEIE SPI_CR2_TXEIE /*!< Tx buffer empty interrupt enable */ +#define LL_SPI_CR2_ERRIE SPI_CR2_ERRIE /*!< Error interrupt enable */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_MODE Operation Mode + * @{ + */ +#define LL_SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI) /*!< Master configuration */ +#define LL_SPI_MODE_SLAVE 0x00000000U /*!< Slave configuration */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_PROTOCOL Serial Protocol + * @{ + */ +#define LL_SPI_PROTOCOL_MOTOROLA 0x00000000U /*!< Motorola mode. Used as default value */ +#define LL_SPI_PROTOCOL_TI (SPI_CR2_FRF) /*!< TI mode */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_PHASE Clock Phase + * @{ + */ +#define LL_SPI_PHASE_1EDGE 0x00000000U /*!< First clock transition is the first data capture edge */ +#define LL_SPI_PHASE_2EDGE (SPI_CR1_CPHA) /*!< Second clock transition is the first data capture edge */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_POLARITY Clock Polarity + * @{ + */ +#define LL_SPI_POLARITY_LOW 0x00000000U /*!< Clock to 0 when idle */ +#define LL_SPI_POLARITY_HIGH (SPI_CR1_CPOL) /*!< Clock to 1 when idle */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_BAUDRATEPRESCALER Baud Rate Prescaler + * @{ + */ +#define LL_SPI_BAUDRATEPRESCALER_DIV2 0x00000000U /*!< BaudRate control equal to fPCLK/2 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV4 (SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/4 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV8 (SPI_CR1_BR_1) /*!< BaudRate control equal to fPCLK/8 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV16 (SPI_CR1_BR_1 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/16 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV32 (SPI_CR1_BR_2) /*!< BaudRate control equal to fPCLK/32 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV64 (SPI_CR1_BR_2 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/64 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV128 (SPI_CR1_BR_2 | SPI_CR1_BR_1) /*!< BaudRate control equal to fPCLK/128 */ +#define LL_SPI_BAUDRATEPRESCALER_DIV256 (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/256 */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_BIT_ORDER Transmission Bit Order + * @{ + */ +#define LL_SPI_LSB_FIRST (SPI_CR1_LSBFIRST) /*!< Data is transmitted/received with the LSB first */ +#define LL_SPI_MSB_FIRST 0x00000000U /*!< Data is transmitted/received with the MSB first */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_TRANSFER_MODE Transfer Mode + * @{ + */ +#define LL_SPI_FULL_DUPLEX 0x00000000U /*!< Full-Duplex mode. Rx and Tx transfer on 2 lines */ +#define LL_SPI_SIMPLEX_RX (SPI_CR1_RXONLY) /*!< Simplex Rx mode. Rx transfer only on 1 line */ +#define LL_SPI_HALF_DUPLEX_RX (SPI_CR1_BIDIMODE) /*!< Half-Duplex Rx mode. Rx transfer on 1 line */ +#define LL_SPI_HALF_DUPLEX_TX (SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE) /*!< Half-Duplex Tx mode. Tx transfer on 1 line */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_NSS_MODE Slave Select Pin Mode + * @{ + */ +#define LL_SPI_NSS_SOFT (SPI_CR1_SSM) /*!< NSS managed internally. NSS pin not used and free */ +#define LL_SPI_NSS_HARD_INPUT 0x00000000U /*!< NSS pin used in Input. Only used in Master mode */ +#define LL_SPI_NSS_HARD_OUTPUT (((uint32_t)SPI_CR2_SSOE << 16U)) /*!< NSS pin used in Output. Only used in Slave mode as chip select */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_DATAWIDTH Datawidth + * @{ + */ +#define LL_SPI_DATAWIDTH_8BIT 0x00000000U /*!< Data length for SPI transfer: 8 bits */ +#define LL_SPI_DATAWIDTH_16BIT (SPI_CR1_DFF) /*!< Data length for SPI transfer: 16 bits */ +/** + * @} + */ +#if defined(USE_FULL_LL_DRIVER) + +/** @defgroup SPI_LL_EC_CRC_CALCULATION CRC Calculation + * @{ + */ +#define LL_SPI_CRCCALCULATION_DISABLE 0x00000000U /*!< CRC calculation disabled */ +#define LL_SPI_CRCCALCULATION_ENABLE (SPI_CR1_CRCEN) /*!< CRC calculation enabled */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup SPI_LL_Exported_Macros SPI Exported Macros + * @{ + */ + +/** @defgroup SPI_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in SPI register + * @param __INSTANCE__ SPI Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_SPI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in SPI register + * @param __INSTANCE__ SPI Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_SPI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SPI_LL_Exported_Functions SPI Exported Functions + * @{ + */ + +/** @defgroup SPI_LL_EF_Configuration Configuration + * @{ + */ + +/** + * @brief Enable SPI peripheral + * @rmtoll CR1 SPE LL_SPI_Enable + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_Enable(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR1, SPI_CR1_SPE); +} + +/** + * @brief Disable SPI peripheral + * @note When disabling the SPI, follow the procedure described in the Reference Manual. + * @rmtoll CR1 SPE LL_SPI_Disable + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_Disable(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE); +} + +/** + * @brief Check if SPI peripheral is enabled + * @rmtoll CR1 SPE LL_SPI_IsEnabled + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabled(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR1, SPI_CR1_SPE) == (SPI_CR1_SPE)) ? 1UL : 0UL); +} + +/** + * @brief Set SPI operation mode to Master or Slave + * @note This bit should not be changed when communication is ongoing. + * @rmtoll CR1 MSTR LL_SPI_SetMode\n + * CR1 SSI LL_SPI_SetMode + * @param SPIx SPI Instance + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_SPI_MODE_MASTER + * @arg @ref LL_SPI_MODE_SLAVE + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetMode(SPI_TypeDef *SPIx, uint32_t Mode) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI, Mode); +} + +/** + * @brief Get SPI operation mode (Master or Slave) + * @rmtoll CR1 MSTR LL_SPI_GetMode\n + * CR1 SSI LL_SPI_GetMode + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_MODE_MASTER + * @arg @ref LL_SPI_MODE_SLAVE + */ +__STATIC_INLINE uint32_t LL_SPI_GetMode(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI)); +} + +/** + * @brief Set serial protocol used + * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation. + * @rmtoll CR2 FRF LL_SPI_SetStandard + * @param SPIx SPI Instance + * @param Standard This parameter can be one of the following values: + * @arg @ref LL_SPI_PROTOCOL_MOTOROLA + * @arg @ref LL_SPI_PROTOCOL_TI + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard) +{ + MODIFY_REG(SPIx->CR2, SPI_CR2_FRF, Standard); +} + +/** + * @brief Get serial protocol used + * @rmtoll CR2 FRF LL_SPI_GetStandard + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_PROTOCOL_MOTOROLA + * @arg @ref LL_SPI_PROTOCOL_TI + */ +__STATIC_INLINE uint32_t LL_SPI_GetStandard(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR2, SPI_CR2_FRF)); +} + +/** + * @brief Set clock phase + * @note This bit should not be changed when communication is ongoing. + * This bit is not used in SPI TI mode. + * @rmtoll CR1 CPHA LL_SPI_SetClockPhase + * @param SPIx SPI Instance + * @param ClockPhase This parameter can be one of the following values: + * @arg @ref LL_SPI_PHASE_1EDGE + * @arg @ref LL_SPI_PHASE_2EDGE + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetClockPhase(SPI_TypeDef *SPIx, uint32_t ClockPhase) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_CPHA, ClockPhase); +} + +/** + * @brief Get clock phase + * @rmtoll CR1 CPHA LL_SPI_GetClockPhase + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_PHASE_1EDGE + * @arg @ref LL_SPI_PHASE_2EDGE + */ +__STATIC_INLINE uint32_t LL_SPI_GetClockPhase(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPHA)); +} + +/** + * @brief Set clock polarity + * @note This bit should not be changed when communication is ongoing. + * This bit is not used in SPI TI mode. + * @rmtoll CR1 CPOL LL_SPI_SetClockPolarity + * @param SPIx SPI Instance + * @param ClockPolarity This parameter can be one of the following values: + * @arg @ref LL_SPI_POLARITY_LOW + * @arg @ref LL_SPI_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_CPOL, ClockPolarity); +} + +/** + * @brief Get clock polarity + * @rmtoll CR1 CPOL LL_SPI_GetClockPolarity + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_POLARITY_LOW + * @arg @ref LL_SPI_POLARITY_HIGH + */ +__STATIC_INLINE uint32_t LL_SPI_GetClockPolarity(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPOL)); +} + +/** + * @brief Set baud rate prescaler + * @note These bits should not be changed when communication is ongoing. SPI BaudRate = fPCLK/Prescaler. + * @rmtoll CR1 BR LL_SPI_SetBaudRatePrescaler + * @param SPIx SPI Instance + * @param BaudRate This parameter can be one of the following values: + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256 + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetBaudRatePrescaler(SPI_TypeDef *SPIx, uint32_t BaudRate) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_BR, BaudRate); +} + +/** + * @brief Get baud rate prescaler + * @rmtoll CR1 BR LL_SPI_GetBaudRatePrescaler + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128 + * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256 + */ +__STATIC_INLINE uint32_t LL_SPI_GetBaudRatePrescaler(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_BR)); +} + +/** + * @brief Set transfer bit order + * @note This bit should not be changed when communication is ongoing. This bit is not used in SPI TI mode. + * @rmtoll CR1 LSBFIRST LL_SPI_SetTransferBitOrder + * @param SPIx SPI Instance + * @param BitOrder This parameter can be one of the following values: + * @arg @ref LL_SPI_LSB_FIRST + * @arg @ref LL_SPI_MSB_FIRST + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_LSBFIRST, BitOrder); +} + +/** + * @brief Get transfer bit order + * @rmtoll CR1 LSBFIRST LL_SPI_GetTransferBitOrder + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_LSB_FIRST + * @arg @ref LL_SPI_MSB_FIRST + */ +__STATIC_INLINE uint32_t LL_SPI_GetTransferBitOrder(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_LSBFIRST)); +} + +/** + * @brief Set transfer direction mode + * @note For Half-Duplex mode, Rx Direction is set by default. + * In master mode, the MOSI pin is used and in slave mode, the MISO pin is used for Half-Duplex. + * @rmtoll CR1 RXONLY LL_SPI_SetTransferDirection\n + * CR1 BIDIMODE LL_SPI_SetTransferDirection\n + * CR1 BIDIOE LL_SPI_SetTransferDirection + * @param SPIx SPI Instance + * @param TransferDirection This parameter can be one of the following values: + * @arg @ref LL_SPI_FULL_DUPLEX + * @arg @ref LL_SPI_SIMPLEX_RX + * @arg @ref LL_SPI_HALF_DUPLEX_RX + * @arg @ref LL_SPI_HALF_DUPLEX_TX + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetTransferDirection(SPI_TypeDef *SPIx, uint32_t TransferDirection) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE, TransferDirection); +} + +/** + * @brief Get transfer direction mode + * @rmtoll CR1 RXONLY LL_SPI_GetTransferDirection\n + * CR1 BIDIMODE LL_SPI_GetTransferDirection\n + * CR1 BIDIOE LL_SPI_GetTransferDirection + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_FULL_DUPLEX + * @arg @ref LL_SPI_SIMPLEX_RX + * @arg @ref LL_SPI_HALF_DUPLEX_RX + * @arg @ref LL_SPI_HALF_DUPLEX_TX + */ +__STATIC_INLINE uint32_t LL_SPI_GetTransferDirection(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE)); +} + +/** + * @brief Set frame data width + * @rmtoll CR1 DFF LL_SPI_SetDataWidth + * @param SPIx SPI Instance + * @param DataWidth This parameter can be one of the following values: + * @arg @ref LL_SPI_DATAWIDTH_8BIT + * @arg @ref LL_SPI_DATAWIDTH_16BIT + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetDataWidth(SPI_TypeDef *SPIx, uint32_t DataWidth) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_DFF, DataWidth); +} + +/** + * @brief Get frame data width + * @rmtoll CR1 DFF LL_SPI_GetDataWidth + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_DATAWIDTH_8BIT + * @arg @ref LL_SPI_DATAWIDTH_16BIT + */ +__STATIC_INLINE uint32_t LL_SPI_GetDataWidth(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_DFF)); +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_CRC_Management CRC Management + * @{ + */ + +/** + * @brief Enable CRC + * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation. + * @rmtoll CR1 CRCEN LL_SPI_EnableCRC + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableCRC(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR1, SPI_CR1_CRCEN); +} + +/** + * @brief Disable CRC + * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation. + * @rmtoll CR1 CRCEN LL_SPI_DisableCRC + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableCRC(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR1, SPI_CR1_CRCEN); +} + +/** + * @brief Check if CRC is enabled + * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation. + * @rmtoll CR1 CRCEN LL_SPI_IsEnabledCRC + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledCRC(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR1, SPI_CR1_CRCEN) == (SPI_CR1_CRCEN)) ? 1UL : 0UL); +} + +/** + * @brief Set CRCNext to transfer CRC on the line + * @note This bit has to be written as soon as the last data is written in the SPIx_DR register. + * @rmtoll CR1 CRCNEXT LL_SPI_SetCRCNext + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetCRCNext(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR1, SPI_CR1_CRCNEXT); +} + +/** + * @brief Set polynomial for CRC calculation + * @rmtoll CRCPR CRCPOLY LL_SPI_SetCRCPolynomial + * @param SPIx SPI Instance + * @param CRCPoly This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetCRCPolynomial(SPI_TypeDef *SPIx, uint32_t CRCPoly) +{ + WRITE_REG(SPIx->CRCPR, (uint16_t)CRCPoly); +} + +/** + * @brief Get polynomial for CRC calculation + * @rmtoll CRCPR CRCPOLY LL_SPI_GetCRCPolynomial + * @param SPIx SPI Instance + * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF + */ +__STATIC_INLINE uint32_t LL_SPI_GetCRCPolynomial(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->CRCPR)); +} + +/** + * @brief Get Rx CRC + * @rmtoll RXCRCR RXCRC LL_SPI_GetRxCRC + * @param SPIx SPI Instance + * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF + */ +__STATIC_INLINE uint32_t LL_SPI_GetRxCRC(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->RXCRCR)); +} + +/** + * @brief Get Tx CRC + * @rmtoll TXCRCR TXCRC LL_SPI_GetTxCRC + * @param SPIx SPI Instance + * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF + */ +__STATIC_INLINE uint32_t LL_SPI_GetTxCRC(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->TXCRCR)); +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_NSS_Management Slave Select Pin Management + * @{ + */ + +/** + * @brief Set NSS mode + * @note LL_SPI_NSS_SOFT Mode is not used in SPI TI mode. + * @rmtoll CR1 SSM LL_SPI_SetNSSMode\n + * @rmtoll CR2 SSOE LL_SPI_SetNSSMode + * @param SPIx SPI Instance + * @param NSS This parameter can be one of the following values: + * @arg @ref LL_SPI_NSS_SOFT + * @arg @ref LL_SPI_NSS_HARD_INPUT + * @arg @ref LL_SPI_NSS_HARD_OUTPUT + * @retval None + */ +__STATIC_INLINE void LL_SPI_SetNSSMode(SPI_TypeDef *SPIx, uint32_t NSS) +{ + MODIFY_REG(SPIx->CR1, SPI_CR1_SSM, NSS); + MODIFY_REG(SPIx->CR2, SPI_CR2_SSOE, ((uint32_t)(NSS >> 16U))); +} + +/** + * @brief Get NSS mode + * @rmtoll CR1 SSM LL_SPI_GetNSSMode\n + * @rmtoll CR2 SSOE LL_SPI_GetNSSMode + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SPI_NSS_SOFT + * @arg @ref LL_SPI_NSS_HARD_INPUT + * @arg @ref LL_SPI_NSS_HARD_OUTPUT + */ +__STATIC_INLINE uint32_t LL_SPI_GetNSSMode(SPI_TypeDef *SPIx) +{ + register uint32_t Ssm = (READ_BIT(SPIx->CR1, SPI_CR1_SSM)); + register uint32_t Ssoe = (READ_BIT(SPIx->CR2, SPI_CR2_SSOE) << 16U); + return (Ssm | Ssoe); +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_FLAG_Management FLAG Management + * @{ + */ + +/** + * @brief Check if Rx buffer is not empty + * @rmtoll SR RXNE LL_SPI_IsActiveFlag_RXNE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXNE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_RXNE) == (SPI_SR_RXNE)) ? 1UL : 0UL); +} + +/** + * @brief Check if Tx buffer is empty + * @rmtoll SR TXE LL_SPI_IsActiveFlag_TXE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_TXE) == (SPI_SR_TXE)) ? 1UL : 0UL); +} + +/** + * @brief Get CRC error flag + * @rmtoll SR CRCERR LL_SPI_IsActiveFlag_CRCERR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_CRCERR(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_CRCERR) == (SPI_SR_CRCERR)) ? 1UL : 0UL); +} + +/** + * @brief Get mode fault error flag + * @rmtoll SR MODF LL_SPI_IsActiveFlag_MODF + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_MODF(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_MODF) == (SPI_SR_MODF)) ? 1UL : 0UL); +} + +/** + * @brief Get overrun error flag + * @rmtoll SR OVR LL_SPI_IsActiveFlag_OVR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_OVR(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_OVR) == (SPI_SR_OVR)) ? 1UL : 0UL); +} + +/** + * @brief Get busy flag + * @note The BSY flag is cleared under any one of the following conditions: + * -When the SPI is correctly disabled + * -When a fault is detected in Master mode (MODF bit set to 1) + * -In Master mode, when it finishes a data transmission and no new data is ready to be + * sent + * -In Slave mode, when the BSY flag is set to '0' for at least one SPI clock cycle between + * each data transfer. + * @rmtoll SR BSY LL_SPI_IsActiveFlag_BSY + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_BSY(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_BSY) == (SPI_SR_BSY)) ? 1UL : 0UL); +} + +/** + * @brief Get frame format error flag + * @rmtoll SR FRE LL_SPI_IsActiveFlag_FRE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_FRE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_FRE) == (SPI_SR_FRE)) ? 1UL : 0UL); +} + +/** + * @brief Clear CRC error flag + * @rmtoll SR CRCERR LL_SPI_ClearFlag_CRCERR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_ClearFlag_CRCERR(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->SR, SPI_SR_CRCERR); +} + +/** + * @brief Clear mode fault error flag + * @note Clearing this flag is done by a read access to the SPIx_SR + * register followed by a write access to the SPIx_CR1 register + * @rmtoll SR MODF LL_SPI_ClearFlag_MODF + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_ClearFlag_MODF(SPI_TypeDef *SPIx) +{ + __IO uint32_t tmpreg_sr; + tmpreg_sr = SPIx->SR; + (void) tmpreg_sr; + CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE); +} + +/** + * @brief Clear overrun error flag + * @note Clearing this flag is done by a read access to the SPIx_DR + * register followed by a read access to the SPIx_SR register + * @rmtoll SR OVR LL_SPI_ClearFlag_OVR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_ClearFlag_OVR(SPI_TypeDef *SPIx) +{ + __IO uint32_t tmpreg; + tmpreg = SPIx->DR; + (void) tmpreg; + tmpreg = SPIx->SR; + (void) tmpreg; +} + +/** + * @brief Clear frame format error flag + * @note Clearing this flag is done by reading SPIx_SR register + * @rmtoll SR FRE LL_SPI_ClearFlag_FRE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_ClearFlag_FRE(SPI_TypeDef *SPIx) +{ + __IO uint32_t tmpreg; + tmpreg = SPIx->SR; + (void) tmpreg; +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_IT_Management Interrupt Management + * @{ + */ + +/** + * @brief Enable error interrupt + * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode). + * @rmtoll CR2 ERRIE LL_SPI_EnableIT_ERR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableIT_ERR(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR2, SPI_CR2_ERRIE); +} + +/** + * @brief Enable Rx buffer not empty interrupt + * @rmtoll CR2 RXNEIE LL_SPI_EnableIT_RXNE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableIT_RXNE(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR2, SPI_CR2_RXNEIE); +} + +/** + * @brief Enable Tx buffer empty interrupt + * @rmtoll CR2 TXEIE LL_SPI_EnableIT_TXE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableIT_TXE(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR2, SPI_CR2_TXEIE); +} + +/** + * @brief Disable error interrupt + * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode). + * @rmtoll CR2 ERRIE LL_SPI_DisableIT_ERR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableIT_ERR(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR2, SPI_CR2_ERRIE); +} + +/** + * @brief Disable Rx buffer not empty interrupt + * @rmtoll CR2 RXNEIE LL_SPI_DisableIT_RXNE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableIT_RXNE(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR2, SPI_CR2_RXNEIE); +} + +/** + * @brief Disable Tx buffer empty interrupt + * @rmtoll CR2 TXEIE LL_SPI_DisableIT_TXE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableIT_TXE(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR2, SPI_CR2_TXEIE); +} + +/** + * @brief Check if error interrupt is enabled + * @rmtoll CR2 ERRIE LL_SPI_IsEnabledIT_ERR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_ERR(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR2, SPI_CR2_ERRIE) == (SPI_CR2_ERRIE)) ? 1UL : 0UL); +} + +/** + * @brief Check if Rx buffer not empty interrupt is enabled + * @rmtoll CR2 RXNEIE LL_SPI_IsEnabledIT_RXNE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_RXNE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR2, SPI_CR2_RXNEIE) == (SPI_CR2_RXNEIE)) ? 1UL : 0UL); +} + +/** + * @brief Check if Tx buffer empty interrupt + * @rmtoll CR2 TXEIE LL_SPI_IsEnabledIT_TXE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR2, SPI_CR2_TXEIE) == (SPI_CR2_TXEIE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_DMA_Management DMA Management + * @{ + */ + +/** + * @brief Enable DMA Rx + * @rmtoll CR2 RXDMAEN LL_SPI_EnableDMAReq_RX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableDMAReq_RX(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR2, SPI_CR2_RXDMAEN); +} + +/** + * @brief Disable DMA Rx + * @rmtoll CR2 RXDMAEN LL_SPI_DisableDMAReq_RX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableDMAReq_RX(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR2, SPI_CR2_RXDMAEN); +} + +/** + * @brief Check if DMA Rx is enabled + * @rmtoll CR2 RXDMAEN LL_SPI_IsEnabledDMAReq_RX + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_RX(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR2, SPI_CR2_RXDMAEN) == (SPI_CR2_RXDMAEN)) ? 1UL : 0UL); +} + +/** + * @brief Enable DMA Tx + * @rmtoll CR2 TXDMAEN LL_SPI_EnableDMAReq_TX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_EnableDMAReq_TX(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->CR2, SPI_CR2_TXDMAEN); +} + +/** + * @brief Disable DMA Tx + * @rmtoll CR2 TXDMAEN LL_SPI_DisableDMAReq_TX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_SPI_DisableDMAReq_TX(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->CR2, SPI_CR2_TXDMAEN); +} + +/** + * @brief Check if DMA Tx is enabled + * @rmtoll CR2 TXDMAEN LL_SPI_IsEnabledDMAReq_TX + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_TX(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->CR2, SPI_CR2_TXDMAEN) == (SPI_CR2_TXDMAEN)) ? 1UL : 0UL); +} + +/** + * @brief Get the data register address used for DMA transfer + * @rmtoll DR DR LL_SPI_DMA_GetRegAddr + * @param SPIx SPI Instance + * @retval Address of data register + */ +__STATIC_INLINE uint32_t LL_SPI_DMA_GetRegAddr(SPI_TypeDef *SPIx) +{ + return (uint32_t) &(SPIx->DR); +} + +/** + * @} + */ + +/** @defgroup SPI_LL_EF_DATA_Management DATA Management + * @{ + */ + +/** + * @brief Read 8-Bits in the data register + * @rmtoll DR DR LL_SPI_ReceiveData8 + * @param SPIx SPI Instance + * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx) +{ + return (uint8_t)(READ_REG(SPIx->DR)); +} + +/** + * @brief Read 16-Bits in the data register + * @rmtoll DR DR LL_SPI_ReceiveData16 + * @param SPIx SPI Instance + * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFFFF + */ +__STATIC_INLINE uint16_t LL_SPI_ReceiveData16(SPI_TypeDef *SPIx) +{ + return (uint16_t)(READ_REG(SPIx->DR)); +} + +/** + * @brief Write 8-Bits in the data register + * @rmtoll DR DR LL_SPI_TransmitData8 + * @param SPIx SPI Instance + * @param TxData Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData) +{ +#if defined (__GNUC__) + __IO uint8_t *spidr = ((__IO uint8_t *)&SPIx->DR); + *spidr = TxData; +#else + *((__IO uint8_t *)&SPIx->DR) = TxData; +#endif /* __GNUC__ */ +} + +/** + * @brief Write 16-Bits in the data register + * @rmtoll DR DR LL_SPI_TransmitData16 + * @param SPIx SPI Instance + * @param TxData Value between Min_Data=0x00 and Max_Data=0xFFFF + * @retval None + */ +__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData) +{ +#if defined (__GNUC__) + __IO uint16_t *spidr = ((__IO uint16_t *)&SPIx->DR); + *spidr = TxData; +#else + SPIx->DR = TxData; +#endif /* __GNUC__ */ +} + +/** + * @} + */ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup SPI_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +ErrorStatus LL_SPI_DeInit(SPI_TypeDef *SPIx); +ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct); +void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct); + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup I2S_LL I2S + * @{ + */ + +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup I2S_LL_ES_INIT I2S Exported Init structure + * @{ + */ + +/** + * @brief I2S Init structure definition + */ + +typedef struct +{ + uint32_t Mode; /*!< Specifies the I2S operating mode. + This parameter can be a value of @ref I2S_LL_EC_MODE + + This feature can be modified afterwards using unitary function @ref LL_I2S_SetTransferMode().*/ + + uint32_t Standard; /*!< Specifies the standard used for the I2S communication. + This parameter can be a value of @ref I2S_LL_EC_STANDARD + + This feature can be modified afterwards using unitary function @ref LL_I2S_SetStandard().*/ + + + uint32_t DataFormat; /*!< Specifies the data format for the I2S communication. + This parameter can be a value of @ref I2S_LL_EC_DATA_FORMAT + + This feature can be modified afterwards using unitary function @ref LL_I2S_SetDataFormat().*/ + + + uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not. + This parameter can be a value of @ref I2S_LL_EC_MCLK_OUTPUT + + This feature can be modified afterwards using unitary functions @ref LL_I2S_EnableMasterClock() or @ref LL_I2S_DisableMasterClock.*/ + + + uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication. + This parameter can be a value of @ref I2S_LL_EC_AUDIO_FREQ + + Audio Frequency can be modified afterwards using Reference manual formulas to calculate Prescaler Linear, Parity + and unitary functions @ref LL_I2S_SetPrescalerLinear() and @ref LL_I2S_SetPrescalerParity() to set it.*/ + + + uint32_t ClockPolarity; /*!< Specifies the idle state of the I2S clock. + This parameter can be a value of @ref I2S_LL_EC_POLARITY + + This feature can be modified afterwards using unitary function @ref LL_I2S_SetClockPolarity().*/ + +} LL_I2S_InitTypeDef; + +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup I2S_LL_Exported_Constants I2S Exported Constants + * @{ + */ + +/** @defgroup I2S_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_I2S_ReadReg function + * @{ + */ +#define LL_I2S_SR_RXNE LL_SPI_SR_RXNE /*!< Rx buffer not empty flag */ +#define LL_I2S_SR_TXE LL_SPI_SR_TXE /*!< Tx buffer empty flag */ +#define LL_I2S_SR_BSY LL_SPI_SR_BSY /*!< Busy flag */ +#define LL_I2S_SR_UDR SPI_SR_UDR /*!< Underrun flag */ +#define LL_I2S_SR_OVR LL_SPI_SR_OVR /*!< Overrun flag */ +#define LL_I2S_SR_FRE LL_SPI_SR_FRE /*!< TI mode frame format error flag */ +/** + * @} + */ + +/** @defgroup SPI_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions + * @{ + */ +#define LL_I2S_CR2_RXNEIE LL_SPI_CR2_RXNEIE /*!< Rx buffer not empty interrupt enable */ +#define LL_I2S_CR2_TXEIE LL_SPI_CR2_TXEIE /*!< Tx buffer empty interrupt enable */ +#define LL_I2S_CR2_ERRIE LL_SPI_CR2_ERRIE /*!< Error interrupt enable */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_DATA_FORMAT Data format + * @{ + */ +#define LL_I2S_DATAFORMAT_16B 0x00000000U /*!< Data length 16 bits, Channel lenght 16bit */ +#define LL_I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN) /*!< Data length 16 bits, Channel lenght 32bit */ +#define LL_I2S_DATAFORMAT_24B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0) /*!< Data length 24 bits, Channel lenght 32bit */ +#define LL_I2S_DATAFORMAT_32B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1) /*!< Data length 16 bits, Channel lenght 32bit */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_POLARITY Clock Polarity + * @{ + */ +#define LL_I2S_POLARITY_LOW 0x00000000U /*!< Clock steady state is low level */ +#define LL_I2S_POLARITY_HIGH (SPI_I2SCFGR_CKPOL) /*!< Clock steady state is high level */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_STANDARD I2s Standard + * @{ + */ +#define LL_I2S_STANDARD_PHILIPS 0x00000000U /*!< I2S standard philips */ +#define LL_I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0) /*!< MSB justified standard (left justified) */ +#define LL_I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1) /*!< LSB justified standard (right justified) */ +#define LL_I2S_STANDARD_PCM_SHORT (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1) /*!< PCM standard, short frame synchronization */ +#define LL_I2S_STANDARD_PCM_LONG (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC) /*!< PCM standard, long frame synchronization */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_MODE Operation Mode + * @{ + */ +#define LL_I2S_MODE_SLAVE_TX 0x00000000U /*!< Slave Tx configuration */ +#define LL_I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0) /*!< Slave Rx configuration */ +#define LL_I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1) /*!< Master Tx configuration */ +#define LL_I2S_MODE_MASTER_RX (SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1) /*!< Master Rx configuration */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_PRESCALER_FACTOR Prescaler Factor + * @{ + */ +#define LL_I2S_PRESCALER_PARITY_EVEN 0x00000000U /*!< Odd factor: Real divider value is = I2SDIV * 2 */ +#define LL_I2S_PRESCALER_PARITY_ODD (SPI_I2SPR_ODD >> 8U) /*!< Odd factor: Real divider value is = (I2SDIV * 2)+1 */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) + +/** @defgroup I2S_LL_EC_MCLK_OUTPUT MCLK Output + * @{ + */ +#define LL_I2S_MCLK_OUTPUT_DISABLE 0x00000000U /*!< Master clock output is disabled */ +#define LL_I2S_MCLK_OUTPUT_ENABLE (SPI_I2SPR_MCKOE) /*!< Master clock output is enabled */ +/** + * @} + */ + +/** @defgroup I2S_LL_EC_AUDIO_FREQ Audio Frequency + * @{ + */ + +#define LL_I2S_AUDIOFREQ_192K 192000U /*!< Audio Frequency configuration 192000 Hz */ +#define LL_I2S_AUDIOFREQ_96K 96000U /*!< Audio Frequency configuration 96000 Hz */ +#define LL_I2S_AUDIOFREQ_48K 48000U /*!< Audio Frequency configuration 48000 Hz */ +#define LL_I2S_AUDIOFREQ_44K 44100U /*!< Audio Frequency configuration 44100 Hz */ +#define LL_I2S_AUDIOFREQ_32K 32000U /*!< Audio Frequency configuration 32000 Hz */ +#define LL_I2S_AUDIOFREQ_22K 22050U /*!< Audio Frequency configuration 22050 Hz */ +#define LL_I2S_AUDIOFREQ_16K 16000U /*!< Audio Frequency configuration 16000 Hz */ +#define LL_I2S_AUDIOFREQ_11K 11025U /*!< Audio Frequency configuration 11025 Hz */ +#define LL_I2S_AUDIOFREQ_8K 8000U /*!< Audio Frequency configuration 8000 Hz */ +#define LL_I2S_AUDIOFREQ_DEFAULT 2U /*!< Audio Freq not specified. Register I2SDIV = 2 */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup I2S_LL_Exported_Macros I2S Exported Macros + * @{ + */ + +/** @defgroup I2S_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in I2S register + * @param __INSTANCE__ I2S Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_I2S_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in I2S register + * @param __INSTANCE__ I2S Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_I2S_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** + * @} + */ + + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup I2S_LL_Exported_Functions I2S Exported Functions + * @{ + */ + +/** @defgroup I2S_LL_EF_Configuration Configuration + * @{ + */ + +/** + * @brief Select I2S mode and Enable I2S peripheral + * @rmtoll I2SCFGR I2SMOD LL_I2S_Enable\n + * I2SCFGR I2SE LL_I2S_Enable + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_Enable(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE); +} + +/** + * @brief Disable I2S peripheral + * @rmtoll I2SCFGR I2SE LL_I2S_Disable + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_Disable(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE); +} + +/** + * @brief Check if I2S peripheral is enabled + * @rmtoll I2SCFGR I2SE LL_I2S_IsEnabled + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabled(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SE) == (SPI_I2SCFGR_I2SE)) ? 1UL : 0UL); +} + +/** + * @brief Set I2S data frame length + * @rmtoll I2SCFGR DATLEN LL_I2S_SetDataFormat\n + * I2SCFGR CHLEN LL_I2S_SetDataFormat + * @param SPIx SPI Instance + * @param DataFormat This parameter can be one of the following values: + * @arg @ref LL_I2S_DATAFORMAT_16B + * @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED + * @arg @ref LL_I2S_DATAFORMAT_24B + * @arg @ref LL_I2S_DATAFORMAT_32B + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetDataFormat(SPI_TypeDef *SPIx, uint32_t DataFormat) +{ + MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN, DataFormat); +} + +/** + * @brief Get I2S data frame length + * @rmtoll I2SCFGR DATLEN LL_I2S_GetDataFormat\n + * I2SCFGR CHLEN LL_I2S_GetDataFormat + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2S_DATAFORMAT_16B + * @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED + * @arg @ref LL_I2S_DATAFORMAT_24B + * @arg @ref LL_I2S_DATAFORMAT_32B + */ +__STATIC_INLINE uint32_t LL_I2S_GetDataFormat(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN)); +} + +/** + * @brief Set I2S clock polarity + * @rmtoll I2SCFGR CKPOL LL_I2S_SetClockPolarity + * @param SPIx SPI Instance + * @param ClockPolarity This parameter can be one of the following values: + * @arg @ref LL_I2S_POLARITY_LOW + * @arg @ref LL_I2S_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity) +{ + SET_BIT(SPIx->I2SCFGR, ClockPolarity); +} + +/** + * @brief Get I2S clock polarity + * @rmtoll I2SCFGR CKPOL LL_I2S_GetClockPolarity + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2S_POLARITY_LOW + * @arg @ref LL_I2S_POLARITY_HIGH + */ +__STATIC_INLINE uint32_t LL_I2S_GetClockPolarity(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_CKPOL)); +} + +/** + * @brief Set I2S standard protocol + * @rmtoll I2SCFGR I2SSTD LL_I2S_SetStandard\n + * I2SCFGR PCMSYNC LL_I2S_SetStandard + * @param SPIx SPI Instance + * @param Standard This parameter can be one of the following values: + * @arg @ref LL_I2S_STANDARD_PHILIPS + * @arg @ref LL_I2S_STANDARD_MSB + * @arg @ref LL_I2S_STANDARD_LSB + * @arg @ref LL_I2S_STANDARD_PCM_SHORT + * @arg @ref LL_I2S_STANDARD_PCM_LONG + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard) +{ + MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC, Standard); +} + +/** + * @brief Get I2S standard protocol + * @rmtoll I2SCFGR I2SSTD LL_I2S_GetStandard\n + * I2SCFGR PCMSYNC LL_I2S_GetStandard + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2S_STANDARD_PHILIPS + * @arg @ref LL_I2S_STANDARD_MSB + * @arg @ref LL_I2S_STANDARD_LSB + * @arg @ref LL_I2S_STANDARD_PCM_SHORT + * @arg @ref LL_I2S_STANDARD_PCM_LONG + */ +__STATIC_INLINE uint32_t LL_I2S_GetStandard(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC)); +} + +/** + * @brief Set I2S transfer mode + * @rmtoll I2SCFGR I2SCFG LL_I2S_SetTransferMode + * @param SPIx SPI Instance + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_I2S_MODE_SLAVE_TX + * @arg @ref LL_I2S_MODE_SLAVE_RX + * @arg @ref LL_I2S_MODE_MASTER_TX + * @arg @ref LL_I2S_MODE_MASTER_RX + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetTransferMode(SPI_TypeDef *SPIx, uint32_t Mode) +{ + MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG, Mode); +} + +/** + * @brief Get I2S transfer mode + * @rmtoll I2SCFGR I2SCFG LL_I2S_GetTransferMode + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2S_MODE_SLAVE_TX + * @arg @ref LL_I2S_MODE_SLAVE_RX + * @arg @ref LL_I2S_MODE_MASTER_TX + * @arg @ref LL_I2S_MODE_MASTER_RX + */ +__STATIC_INLINE uint32_t LL_I2S_GetTransferMode(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG)); +} + +/** + * @brief Set I2S linear prescaler + * @rmtoll I2SPR I2SDIV LL_I2S_SetPrescalerLinear + * @param SPIx SPI Instance + * @param PrescalerLinear Value between Min_Data=0x02 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetPrescalerLinear(SPI_TypeDef *SPIx, uint8_t PrescalerLinear) +{ + MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV, PrescalerLinear); +} + +/** + * @brief Get I2S linear prescaler + * @rmtoll I2SPR I2SDIV LL_I2S_GetPrescalerLinear + * @param SPIx SPI Instance + * @retval PrescalerLinear Value between Min_Data=0x02 and Max_Data=0xFF + */ +__STATIC_INLINE uint32_t LL_I2S_GetPrescalerLinear(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_I2SDIV)); +} + +/** + * @brief Set I2S parity prescaler + * @rmtoll I2SPR ODD LL_I2S_SetPrescalerParity + * @param SPIx SPI Instance + * @param PrescalerParity This parameter can be one of the following values: + * @arg @ref LL_I2S_PRESCALER_PARITY_EVEN + * @arg @ref LL_I2S_PRESCALER_PARITY_ODD + * @retval None + */ +__STATIC_INLINE void LL_I2S_SetPrescalerParity(SPI_TypeDef *SPIx, uint32_t PrescalerParity) +{ + MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_ODD, PrescalerParity << 8U); +} + +/** + * @brief Get I2S parity prescaler + * @rmtoll I2SPR ODD LL_I2S_GetPrescalerParity + * @param SPIx SPI Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2S_PRESCALER_PARITY_EVEN + * @arg @ref LL_I2S_PRESCALER_PARITY_ODD + */ +__STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity(SPI_TypeDef *SPIx) +{ + return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_ODD) >> 8U); +} + +/** + * @brief Enable the master clock ouput (Pin MCK) + * @rmtoll I2SPR MCKOE LL_I2S_EnableMasterClock + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableMasterClock(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE); +} + +/** + * @brief Disable the master clock ouput (Pin MCK) + * @rmtoll I2SPR MCKOE LL_I2S_DisableMasterClock + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableMasterClock(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE); +} + +/** + * @brief Check if the master clock ouput (Pin MCK) is enabled + * @rmtoll I2SPR MCKOE LL_I2S_IsEnabledMasterClock + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledMasterClock(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE) == (SPI_I2SPR_MCKOE)) ? 1UL : 0UL); +} + +#if defined(SPI_I2SCFGR_ASTRTEN) +/** + * @brief Enable asynchronous start + * @rmtoll I2SCFGR ASTRTEN LL_I2S_EnableAsyncStart + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableAsyncStart(SPI_TypeDef *SPIx) +{ + SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN); +} + +/** + * @brief Disable asynchronous start + * @rmtoll I2SCFGR ASTRTEN LL_I2S_DisableAsyncStart + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableAsyncStart(SPI_TypeDef *SPIx) +{ + CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN); +} + +/** + * @brief Check if asynchronous start is enabled + * @rmtoll I2SCFGR ASTRTEN LL_I2S_IsEnabledAsyncStart + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledAsyncStart(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN) == (SPI_I2SCFGR_ASTRTEN)) ? 1UL : 0UL); +} +#endif /* SPI_I2SCFGR_ASTRTEN */ + +/** + * @} + */ + +/** @defgroup I2S_LL_EF_FLAG FLAG Management + * @{ + */ + +/** + * @brief Check if Rx buffer is not empty + * @rmtoll SR RXNE LL_I2S_IsActiveFlag_RXNE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXNE(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsActiveFlag_RXNE(SPIx); +} + +/** + * @brief Check if Tx buffer is empty + * @rmtoll SR TXE LL_I2S_IsActiveFlag_TXE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_TXE(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsActiveFlag_TXE(SPIx); +} + +/** + * @brief Get busy flag + * @rmtoll SR BSY LL_I2S_IsActiveFlag_BSY + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_BSY(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsActiveFlag_BSY(SPIx); +} + +/** + * @brief Get overrun error flag + * @rmtoll SR OVR LL_I2S_IsActiveFlag_OVR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_OVR(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsActiveFlag_OVR(SPIx); +} + +/** + * @brief Get underrun error flag + * @rmtoll SR UDR LL_I2S_IsActiveFlag_UDR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_UDR) == (SPI_SR_UDR)) ? 1UL : 0UL); +} + +/** + * @brief Get frame format error flag + * @rmtoll SR FRE LL_I2S_IsActiveFlag_FRE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_FRE(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsActiveFlag_FRE(SPIx); +} + +/** + * @brief Get channel side flag. + * @note 0: Channel Left has to be transmitted or has been received\n + * 1: Channel Right has to be transmitted or has been received\n + * It has no significance in PCM mode. + * @rmtoll SR CHSIDE LL_I2S_IsActiveFlag_CHSIDE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_CHSIDE(SPI_TypeDef *SPIx) +{ + return ((READ_BIT(SPIx->SR, SPI_SR_CHSIDE) == (SPI_SR_CHSIDE)) ? 1UL : 0UL); +} + +/** + * @brief Clear overrun error flag + * @rmtoll SR OVR LL_I2S_ClearFlag_OVR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_ClearFlag_OVR(SPI_TypeDef *SPIx) +{ + LL_SPI_ClearFlag_OVR(SPIx); +} + +/** + * @brief Clear underrun error flag + * @rmtoll SR UDR LL_I2S_ClearFlag_UDR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_ClearFlag_UDR(SPI_TypeDef *SPIx) +{ + __IO uint32_t tmpreg; + tmpreg = SPIx->SR; + (void)tmpreg; +} + +/** + * @brief Clear frame format error flag + * @rmtoll SR FRE LL_I2S_ClearFlag_FRE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_ClearFlag_FRE(SPI_TypeDef *SPIx) +{ + LL_SPI_ClearFlag_FRE(SPIx); +} + +/** + * @} + */ + +/** @defgroup I2S_LL_EF_IT Interrupt Management + * @{ + */ + +/** + * @brief Enable error IT + * @note This bit controls the generation of an interrupt when an error condition occurs (OVR, UDR and FRE in I2S mode). + * @rmtoll CR2 ERRIE LL_I2S_EnableIT_ERR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableIT_ERR(SPI_TypeDef *SPIx) +{ + LL_SPI_EnableIT_ERR(SPIx); +} + +/** + * @brief Enable Rx buffer not empty IT + * @rmtoll CR2 RXNEIE LL_I2S_EnableIT_RXNE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableIT_RXNE(SPI_TypeDef *SPIx) +{ + LL_SPI_EnableIT_RXNE(SPIx); +} + +/** + * @brief Enable Tx buffer empty IT + * @rmtoll CR2 TXEIE LL_I2S_EnableIT_TXE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableIT_TXE(SPI_TypeDef *SPIx) +{ + LL_SPI_EnableIT_TXE(SPIx); +} + +/** + * @brief Disable error IT + * @note This bit controls the generation of an interrupt when an error condition occurs (OVR, UDR and FRE in I2S mode). + * @rmtoll CR2 ERRIE LL_I2S_DisableIT_ERR + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableIT_ERR(SPI_TypeDef *SPIx) +{ + LL_SPI_DisableIT_ERR(SPIx); +} + +/** + * @brief Disable Rx buffer not empty IT + * @rmtoll CR2 RXNEIE LL_I2S_DisableIT_RXNE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableIT_RXNE(SPI_TypeDef *SPIx) +{ + LL_SPI_DisableIT_RXNE(SPIx); +} + +/** + * @brief Disable Tx buffer empty IT + * @rmtoll CR2 TXEIE LL_I2S_DisableIT_TXE + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableIT_TXE(SPI_TypeDef *SPIx) +{ + LL_SPI_DisableIT_TXE(SPIx); +} + +/** + * @brief Check if ERR IT is enabled + * @rmtoll CR2 ERRIE LL_I2S_IsEnabledIT_ERR + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_ERR(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsEnabledIT_ERR(SPIx); +} + +/** + * @brief Check if RXNE IT is enabled + * @rmtoll CR2 RXNEIE LL_I2S_IsEnabledIT_RXNE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_RXNE(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsEnabledIT_RXNE(SPIx); +} + +/** + * @brief Check if TXE IT is enabled + * @rmtoll CR2 TXEIE LL_I2S_IsEnabledIT_TXE + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_TXE(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsEnabledIT_TXE(SPIx); +} + +/** + * @} + */ + +/** @defgroup I2S_LL_EF_DMA DMA Management + * @{ + */ + +/** + * @brief Enable DMA Rx + * @rmtoll CR2 RXDMAEN LL_I2S_EnableDMAReq_RX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableDMAReq_RX(SPI_TypeDef *SPIx) +{ + LL_SPI_EnableDMAReq_RX(SPIx); +} + +/** + * @brief Disable DMA Rx + * @rmtoll CR2 RXDMAEN LL_I2S_DisableDMAReq_RX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableDMAReq_RX(SPI_TypeDef *SPIx) +{ + LL_SPI_DisableDMAReq_RX(SPIx); +} + +/** + * @brief Check if DMA Rx is enabled + * @rmtoll CR2 RXDMAEN LL_I2S_IsEnabledDMAReq_RX + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_RX(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsEnabledDMAReq_RX(SPIx); +} + +/** + * @brief Enable DMA Tx + * @rmtoll CR2 TXDMAEN LL_I2S_EnableDMAReq_TX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_EnableDMAReq_TX(SPI_TypeDef *SPIx) +{ + LL_SPI_EnableDMAReq_TX(SPIx); +} + +/** + * @brief Disable DMA Tx + * @rmtoll CR2 TXDMAEN LL_I2S_DisableDMAReq_TX + * @param SPIx SPI Instance + * @retval None + */ +__STATIC_INLINE void LL_I2S_DisableDMAReq_TX(SPI_TypeDef *SPIx) +{ + LL_SPI_DisableDMAReq_TX(SPIx); +} + +/** + * @brief Check if DMA Tx is enabled + * @rmtoll CR2 TXDMAEN LL_I2S_IsEnabledDMAReq_TX + * @param SPIx SPI Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX(SPI_TypeDef *SPIx) +{ + return LL_SPI_IsEnabledDMAReq_TX(SPIx); +} + +/** + * @} + */ + +/** @defgroup I2S_LL_EF_DATA DATA Management + * @{ + */ + +/** + * @brief Read 16-Bits in data register + * @rmtoll DR DR LL_I2S_ReceiveData16 + * @param SPIx SPI Instance + * @retval RxData Value between Min_Data=0x0000 and Max_Data=0xFFFF + */ +__STATIC_INLINE uint16_t LL_I2S_ReceiveData16(SPI_TypeDef *SPIx) +{ + return LL_SPI_ReceiveData16(SPIx); +} + +/** + * @brief Write 16-Bits in data register + * @rmtoll DR DR LL_I2S_TransmitData16 + * @param SPIx SPI Instance + * @param TxData Value between Min_Data=0x0000 and Max_Data=0xFFFF + * @retval None + */ +__STATIC_INLINE void LL_I2S_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData) +{ + LL_SPI_TransmitData16(SPIx, TxData); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup I2S_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +ErrorStatus LL_I2S_DeInit(SPI_TypeDef *SPIx); +ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct); +void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct); +void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity); +#if defined (SPI_I2S_FULLDUPLEX_SUPPORT) +ErrorStatus LL_I2S_InitFullDuplex(SPI_TypeDef *I2Sxext, LL_I2S_InitTypeDef *I2S_InitStruct); +#endif /* SPI_I2S_FULLDUPLEX_SUPPORT */ + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F4xx_LL_SPI_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h new file mode 100644 index 0000000..cc7635e --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h @@ -0,0 +1,1710 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_system.h + * @author MCD Application Team + * @brief Header file of SYSTEM LL module. + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The LL SYSTEM driver contains a set of generic APIs that can be + used by user: + (+) Some of the FLASH features need to be handled in the SYSTEM file. + (+) Access to DBGCMU registers + (+) Access to SYSCFG registers + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_SYSTEM_H +#define __STM32F4xx_LL_SYSTEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (FLASH) || defined (SYSCFG) || defined (DBGMCU) + +/** @defgroup SYSTEM_LL SYSTEM + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Private_Constants SYSTEM Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Exported_Constants SYSTEM Exported Constants + * @{ + */ + +/** @defgroup SYSTEM_LL_EC_REMAP SYSCFG REMAP +* @{ +*/ +#define LL_SYSCFG_REMAP_FLASH (uint32_t)0x00000000 /*!< Main Flash memory mapped at 0x00000000 */ +#define LL_SYSCFG_REMAP_SYSTEMFLASH SYSCFG_MEMRMP_MEM_MODE_0 /*!< System Flash memory mapped at 0x00000000 */ +#if defined(FSMC_Bank1) +#define LL_SYSCFG_REMAP_FSMC SYSCFG_MEMRMP_MEM_MODE_1 /*!< FSMC(NOR/PSRAM 1 and 2) mapped at 0x00000000 */ +#endif /* FSMC_Bank1 */ +#if defined(FMC_Bank1) +#define LL_SYSCFG_REMAP_FMC SYSCFG_MEMRMP_MEM_MODE_1 /*!< FMC(NOR/PSRAM 1 and 2) mapped at 0x00000000 */ +#define LL_SYSCFG_REMAP_SDRAM SYSCFG_MEMRMP_MEM_MODE_2 /*!< FMC/SDRAM mapped at 0x00000000 */ +#endif /* FMC_Bank1 */ +#define LL_SYSCFG_REMAP_SRAM (SYSCFG_MEMRMP_MEM_MODE_1 | SYSCFG_MEMRMP_MEM_MODE_0) /*!< SRAM1 mapped at 0x00000000 */ + +/** + * @} + */ + +#if defined(SYSCFG_PMC_MII_RMII_SEL) + /** @defgroup SYSTEM_LL_EC_PMC SYSCFG PMC +* @{ +*/ +#define LL_SYSCFG_PMC_ETHMII (uint32_t)0x00000000 /*!< ETH Media MII interface */ +#define LL_SYSCFG_PMC_ETHRMII (uint32_t)SYSCFG_PMC_MII_RMII_SEL /*!< ETH Media RMII interface */ + +/** + * @} + */ +#endif /* SYSCFG_PMC_MII_RMII_SEL */ + + + +#if defined(SYSCFG_MEMRMP_UFB_MODE) +/** @defgroup SYSTEM_LL_EC_BANKMODE SYSCFG BANK MODE + * @{ + */ +#define LL_SYSCFG_BANKMODE_BANK1 (uint32_t)0x00000000 /*!< Flash Bank 1 base address mapped at 0x0800 0000 (AXI) and 0x0020 0000 (TCM) + and Flash Bank 2 base address mapped at 0x0810 0000 (AXI) and 0x0030 0000 (TCM)*/ +#define LL_SYSCFG_BANKMODE_BANK2 SYSCFG_MEMRMP_UFB_MODE /*!< Flash Bank 2 base address mapped at 0x0800 0000 (AXI) and 0x0020 0000(TCM) + and Flash Bank 1 base address mapped at 0x0810 0000 (AXI) and 0x0030 0000(TCM) */ +/** + * @} + */ +#endif /* SYSCFG_MEMRMP_UFB_MODE */ +/** @defgroup SYSTEM_LL_EC_I2C_FASTMODEPLUS SYSCFG I2C FASTMODEPLUS + * @{ + */ +#if defined(SYSCFG_CFGR_FMPI2C1_SCL) +#define LL_SYSCFG_I2C_FASTMODEPLUS_SCL SYSCFG_CFGR_FMPI2C1_SCL /*!< Enable Fast Mode Plus on FMPI2C_SCL pin */ +#define LL_SYSCFG_I2C_FASTMODEPLUS_SDA SYSCFG_CFGR_FMPI2C1_SDA /*!< Enable Fast Mode Plus on FMPI2C_SDA pin*/ +#endif /* SYSCFG_CFGR_FMPI2C1_SCL */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_EXTI_PORT SYSCFG EXTI PORT + * @{ + */ +#define LL_SYSCFG_EXTI_PORTA (uint32_t)0 /*!< EXTI PORT A */ +#define LL_SYSCFG_EXTI_PORTB (uint32_t)1 /*!< EXTI PORT B */ +#define LL_SYSCFG_EXTI_PORTC (uint32_t)2 /*!< EXTI PORT C */ +#define LL_SYSCFG_EXTI_PORTD (uint32_t)3 /*!< EXTI PORT D */ +#define LL_SYSCFG_EXTI_PORTE (uint32_t)4 /*!< EXTI PORT E */ +#if defined(GPIOF) +#define LL_SYSCFG_EXTI_PORTF (uint32_t)5 /*!< EXTI PORT F */ +#endif /* GPIOF */ +#if defined(GPIOG) +#define LL_SYSCFG_EXTI_PORTG (uint32_t)6 /*!< EXTI PORT G */ +#endif /* GPIOG */ +#define LL_SYSCFG_EXTI_PORTH (uint32_t)7 /*!< EXTI PORT H */ +#if defined(GPIOI) +#define LL_SYSCFG_EXTI_PORTI (uint32_t)8 /*!< EXTI PORT I */ +#endif /* GPIOI */ +#if defined(GPIOJ) +#define LL_SYSCFG_EXTI_PORTJ (uint32_t)9 /*!< EXTI PORT J */ +#endif /* GPIOJ */ +#if defined(GPIOK) +#define LL_SYSCFG_EXTI_PORTK (uint32_t)10 /*!< EXTI PORT k */ +#endif /* GPIOK */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_EXTI_LINE SYSCFG EXTI LINE + * @{ + */ +#define LL_SYSCFG_EXTI_LINE0 (uint32_t)(0x000FU << 16 | 0) /*!< EXTI_POSITION_0 | EXTICR[0] */ +#define LL_SYSCFG_EXTI_LINE1 (uint32_t)(0x00F0U << 16 | 0) /*!< EXTI_POSITION_4 | EXTICR[0] */ +#define LL_SYSCFG_EXTI_LINE2 (uint32_t)(0x0F00U << 16 | 0) /*!< EXTI_POSITION_8 | EXTICR[0] */ +#define LL_SYSCFG_EXTI_LINE3 (uint32_t)(0xF000U << 16 | 0) /*!< EXTI_POSITION_12 | EXTICR[0] */ +#define LL_SYSCFG_EXTI_LINE4 (uint32_t)(0x000FU << 16 | 1) /*!< EXTI_POSITION_0 | EXTICR[1] */ +#define LL_SYSCFG_EXTI_LINE5 (uint32_t)(0x00F0U << 16 | 1) /*!< EXTI_POSITION_4 | EXTICR[1] */ +#define LL_SYSCFG_EXTI_LINE6 (uint32_t)(0x0F00U << 16 | 1) /*!< EXTI_POSITION_8 | EXTICR[1] */ +#define LL_SYSCFG_EXTI_LINE7 (uint32_t)(0xF000U << 16 | 1) /*!< EXTI_POSITION_12 | EXTICR[1] */ +#define LL_SYSCFG_EXTI_LINE8 (uint32_t)(0x000FU << 16 | 2) /*!< EXTI_POSITION_0 | EXTICR[2] */ +#define LL_SYSCFG_EXTI_LINE9 (uint32_t)(0x00F0U << 16 | 2) /*!< EXTI_POSITION_4 | EXTICR[2] */ +#define LL_SYSCFG_EXTI_LINE10 (uint32_t)(0x0F00U << 16 | 2) /*!< EXTI_POSITION_8 | EXTICR[2] */ +#define LL_SYSCFG_EXTI_LINE11 (uint32_t)(0xF000U << 16 | 2) /*!< EXTI_POSITION_12 | EXTICR[2] */ +#define LL_SYSCFG_EXTI_LINE12 (uint32_t)(0x000FU << 16 | 3) /*!< EXTI_POSITION_0 | EXTICR[3] */ +#define LL_SYSCFG_EXTI_LINE13 (uint32_t)(0x00F0U << 16 | 3) /*!< EXTI_POSITION_4 | EXTICR[3] */ +#define LL_SYSCFG_EXTI_LINE14 (uint32_t)(0x0F00U << 16 | 3) /*!< EXTI_POSITION_8 | EXTICR[3] */ +#define LL_SYSCFG_EXTI_LINE15 (uint32_t)(0xF000U << 16 | 3) /*!< EXTI_POSITION_12 | EXTICR[3] */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_TIMBREAK SYSCFG TIMER BREAK + * @{ + */ +#if defined(SYSCFG_CFGR2_LOCKUP_LOCK) +#define LL_SYSCFG_TIMBREAK_LOCKUP SYSCFG_CFGR2_LOCKUP_LOCK /*!< Enables and locks the LOCKUP output of CortexM4 + with Break Input of TIM1/8 */ +#define LL_SYSCFG_TIMBREAK_PVD SYSCFG_CFGR2_PVD_LOCK /*!< Enables and locks the PVD connection with TIM1/8 Break Input + and also the PVDE and PLS bits of the Power Control Interface */ +#endif /* SYSCFG_CFGR2_CLL */ +/** + * @} + */ + +#if defined(SYSCFG_MCHDLYCR_BSCKSEL) +/** @defgroup SYSTEM_LL_DFSDM_BitStream_ClockSource SYSCFG MCHDLY BCKKSEL + * @{ + */ +#define LL_SYSCFG_BITSTREAM_CLOCK_TIM2OC1 (uint32_t)0x00000000 +#define LL_SYSCFG_BITSTREAM_CLOCK_DFSDM2 SYSCFG_MCHDLYCR_BSCKSEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM_MCHDLYEN SYSCFG MCHDLY MCHDLYEN + * @{ + */ +#define LL_SYSCFG_DFSDM1_MCHDLYEN SYSCFG_MCHDLYCR_MCHDLY1EN +#define LL_SYSCFG_DFSDM2_MCHDLYEN SYSCFG_MCHDLYCR_MCHDLY2EN +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM_DataIn0_Source SYSCFG MCHDLY DFSDMD0SEL + * @{ + */ +#define LL_SYSCFG_DFSDM1_DataIn0 SYSCFG_MCHDLYCR_DFSDM1D0SEL +#define LL_SYSCFG_DFSDM2_DataIn0 SYSCFG_MCHDLYCR_DFSDM2D0SEL + +#define LL_SYSCFG_DFSDM1_DataIn0_PAD (uint32_t)((SYSCFG_MCHDLYCR_DFSDM1D0SEL << 16) | 0x00000000) +#define LL_SYSCFG_DFSDM1_DataIn0_DM (uint32_t)((SYSCFG_MCHDLYCR_DFSDM1D0SEL << 16) | SYSCFG_MCHDLYCR_DFSDM1D0SEL) +#define LL_SYSCFG_DFSDM2_DataIn0_PAD (uint32_t)((SYSCFG_MCHDLYCR_DFSDM2D0SEL << 16) | 0x00000000) +#define LL_SYSCFG_DFSDM2_DataIn0_DM (uint32_t)((SYSCFG_MCHDLYCR_DFSDM2D0SEL << 16) | SYSCFG_MCHDLYCR_DFSDM2D0SEL) +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM_DataIn2_Source SYSCFG MCHDLY DFSDMD2SEL + * @{ + */ +#define LL_SYSCFG_DFSDM1_DataIn2 SYSCFG_MCHDLYCR_DFSDM1D2SEL +#define LL_SYSCFG_DFSDM2_DataIn2 SYSCFG_MCHDLYCR_DFSDM2D2SEL + +#define LL_SYSCFG_DFSDM1_DataIn2_PAD (uint32_t)((SYSCFG_MCHDLYCR_DFSDM1D2SEL << 16) | 0x00000000) +#define LL_SYSCFG_DFSDM1_DataIn2_DM (uint32_t)((SYSCFG_MCHDLYCR_DFSDM1D2SEL << 16) | SYSCFG_MCHDLYCR_DFSDM1D2SEL) +#define LL_SYSCFG_DFSDM2_DataIn2_PAD (uint32_t)((SYSCFG_MCHDLYCR_DFSDM2D2SEL << 16) | 0x00000000) +#define LL_SYSCFG_DFSDM2_DataIn2_DM (uint32_t)((SYSCFG_MCHDLYCR_DFSDM2D2SEL << 16) | SYSCFG_MCHDLYCR_DFSDM2D2SEL) +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM1_TIM4OC2_BitstreamDistribution SYSCFG MCHDLY DFSDM1CK02SEL + * @{ + */ +#define LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN0 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN2 SYSCFG_MCHDLYCR_DFSDM1CK02SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM1_TIM4OC1_BitstreamDistribution SYSCFG MCHDLY DFSDM1CK13SEL + * @{ + */ +#define LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN1 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN3 SYSCFG_MCHDLYCR_DFSDM1CK13SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM1_CLKIN_SourceSelection SYSCFG MCHDLY DFSDMCFG + * @{ + */ +#define LL_SYSCFG_DFSDM1_CKIN_PAD (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM1_CKIN_DM SYSCFG_MCHDLYCR_DFSDM1CFG +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM1_CLKOUT_SourceSelection SYSCFG MCHDLY DFSDM1CKOSEL + * @{ + */ +#define LL_SYSCFG_DFSDM1_CKOUT (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM1_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM1CKOSEL +/** + * @} + */ + +/** @defgroup SYSTEM_LL_DFSDM2_DataIn4_SourceSelection SYSCFG MCHDLY DFSDM2D4SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_DataIn4_PAD (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_DataIn4_DM SYSCFG_MCHDLYCR_DFSDM2D4SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_DataIn6_SourceSelection SYSCFG MCHDLY DFSDM2D6SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_DataIn6_PAD (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_DataIn6_DM SYSCFG_MCHDLYCR_DFSDM2D6SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_TIM3OC4_BitstreamDistribution SYSCFG MCHDLY DFSDM2CK04SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN0 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN4 SYSCFG_MCHDLYCR_DFSDM2CK04SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_TIM3OC3_BitstreamDistribution SYSCFG MCHDLY DFSDM2CK15SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN1 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN5 SYSCFG_MCHDLYCR_DFSDM2CK15SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_TIM3OC2_BitstreamDistribution SYSCFG MCHDLY DFSDM2CK26SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN2 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN6 SYSCFG_MCHDLYCR_DFSDM2CK26SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_TIM3OC1_BitstreamDistribution SYSCFG MCHDLY DFSDM2CK37SEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN3 (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN7 SYSCFG_MCHDLYCR_DFSDM2CK37SEL +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_CLKIN_SourceSelection SYSCFG MCHDLY DFSDM2CFG + * @{ + */ +#define LL_SYSCFG_DFSDM2_CKIN_PAD (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_CKIN_DM SYSCFG_MCHDLYCR_DFSDM2CFG +/** + * @} + */ +/** @defgroup SYSTEM_LL_DFSDM2_CLKOUT_SourceSelection SYSCFG MCHDLY DFSDM2CKOSEL + * @{ + */ +#define LL_SYSCFG_DFSDM2_CKOUT (uint32_t)0x00000000 +#define LL_SYSCFG_DFSDM2_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM2CKOSEL +/** + * @} + */ +#endif /* SYSCFG_MCHDLYCR_BSCKSEL */ + +/** @defgroup SYSTEM_LL_EC_TRACE DBGMCU TRACE Pin Assignment + * @{ + */ +#define LL_DBGMCU_TRACE_NONE 0x00000000U /*!< TRACE pins not assigned (default state) */ +#define LL_DBGMCU_TRACE_ASYNCH DBGMCU_CR_TRACE_IOEN /*!< TRACE pin assignment for Asynchronous Mode */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE1 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_0) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 1 */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE2 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_1) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 2 */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE4 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 4 */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_APB1_GRP1_STOP_IP DBGMCU APB1 GRP1 STOP IP + * @{ + */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM2_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM2_STOP DBGMCU_APB1_FZ_DBG_TIM2_STOP /*!< TIM2 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM2_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM3_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM3_STOP DBGMCU_APB1_FZ_DBG_TIM3_STOP /*!< TIM3 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM3_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM4_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM4_STOP DBGMCU_APB1_FZ_DBG_TIM4_STOP /*!< TIM4 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM4_STOP */ +#define LL_DBGMCU_APB1_GRP1_TIM5_STOP DBGMCU_APB1_FZ_DBG_TIM5_STOP /*!< TIM5 counter stopped when core is halted */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM6_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM6_STOP DBGMCU_APB1_FZ_DBG_TIM6_STOP /*!< TIM6 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM6_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM7_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM7_STOP DBGMCU_APB1_FZ_DBG_TIM7_STOP /*!< TIM7 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM7_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM12_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM12_STOP DBGMCU_APB1_FZ_DBG_TIM12_STOP /*!< TIM12 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM12_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM13_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM13_STOP DBGMCU_APB1_FZ_DBG_TIM13_STOP /*!< TIM13 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM13_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_TIM14_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM14_STOP DBGMCU_APB1_FZ_DBG_TIM14_STOP /*!< TIM14 counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_TIM14_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_LPTIM_STOP) +#define LL_DBGMCU_APB1_GRP1_LPTIM_STOP DBGMCU_APB1_FZ_DBG_LPTIM_STOP /*!< LPTIM counter stopped when core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_LPTIM_STOP */ +#define LL_DBGMCU_APB1_GRP1_RTC_STOP DBGMCU_APB1_FZ_DBG_RTC_STOP /*!< RTC counter stopped when core is halted */ +#define LL_DBGMCU_APB1_GRP1_WWDG_STOP DBGMCU_APB1_FZ_DBG_WWDG_STOP /*!< Debug Window Watchdog stopped when Core is halted */ +#define LL_DBGMCU_APB1_GRP1_IWDG_STOP DBGMCU_APB1_FZ_DBG_IWDG_STOP /*!< Debug Independent Watchdog stopped when Core is halted */ +#define LL_DBGMCU_APB1_GRP1_I2C1_STOP DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT /*!< I2C1 SMBUS timeout mode stopped when Core is halted */ +#define LL_DBGMCU_APB1_GRP1_I2C2_STOP DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT /*!< I2C2 SMBUS timeout mode stopped when Core is halted */ +#if defined(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT) +#define LL_DBGMCU_APB1_GRP1_I2C3_STOP DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT /*!< I2C3 SMBUS timeout mode stopped when Core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT */ +#if defined(DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT) +#define LL_DBGMCU_APB1_GRP1_I2C4_STOP DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT /*!< I2C4 SMBUS timeout mode stopped when Core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT */ +#if defined(DBGMCU_APB1_FZ_DBG_CAN1_STOP) +#define LL_DBGMCU_APB1_GRP1_CAN1_STOP DBGMCU_APB1_FZ_DBG_CAN1_STOP /*!< CAN1 debug stopped when Core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_CAN1_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_CAN2_STOP) +#define LL_DBGMCU_APB1_GRP1_CAN2_STOP DBGMCU_APB1_FZ_DBG_CAN2_STOP /*!< CAN2 debug stopped when Core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_CAN2_STOP */ +#if defined(DBGMCU_APB1_FZ_DBG_CAN3_STOP) +#define LL_DBGMCU_APB1_GRP1_CAN3_STOP DBGMCU_APB1_FZ_DBG_CAN3_STOP /*!< CAN3 debug stopped when Core is halted */ +#endif /* DBGMCU_APB1_FZ_DBG_CAN3_STOP */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_APB2_GRP1_STOP_IP DBGMCU APB2 GRP1 STOP IP + * @{ + */ +#define LL_DBGMCU_APB2_GRP1_TIM1_STOP DBGMCU_APB2_FZ_DBG_TIM1_STOP /*!< TIM1 counter stopped when core is halted */ +#if defined(DBGMCU_APB2_FZ_DBG_TIM8_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM8_STOP DBGMCU_APB2_FZ_DBG_TIM8_STOP /*!< TIM8 counter stopped when core is halted */ +#endif /* DBGMCU_APB2_FZ_DBG_TIM8_STOP */ +#define LL_DBGMCU_APB2_GRP1_TIM9_STOP DBGMCU_APB2_FZ_DBG_TIM9_STOP /*!< TIM9 counter stopped when core is halted */ +#if defined(DBGMCU_APB2_FZ_DBG_TIM10_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM10_STOP DBGMCU_APB2_FZ_DBG_TIM10_STOP /*!< TIM10 counter stopped when core is halted */ +#endif /* DBGMCU_APB2_FZ_DBG_TIM10_STOP */ +#define LL_DBGMCU_APB2_GRP1_TIM11_STOP DBGMCU_APB2_FZ_DBG_TIM11_STOP /*!< TIM11 counter stopped when core is halted */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_LATENCY FLASH LATENCY + * @{ + */ +#define LL_FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero wait state */ +#define LL_FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One wait state */ +#define LL_FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two wait states */ +#define LL_FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three wait states */ +#define LL_FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four wait states */ +#define LL_FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH five wait state */ +#define LL_FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH six wait state */ +#define LL_FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH seven wait states */ +#define LL_FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH eight wait states */ +#define LL_FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH nine wait states */ +#define LL_FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH ten wait states */ +#define LL_FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH eleven wait states */ +#define LL_FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH twelve wait states */ +#define LL_FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH thirteen wait states */ +#define LL_FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH fourteen wait states */ +#define LL_FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH fifteen wait states */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Exported_Functions SYSTEM Exported Functions + * @{ + */ + +/** @defgroup SYSTEM_LL_EF_SYSCFG SYSCFG + * @{ + */ +/** + * @brief Set memory mapping at address 0x00000000 + * @rmtoll SYSCFG_MEMRMP MEM_MODE LL_SYSCFG_SetRemapMemory + * @param Memory This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_REMAP_FLASH + * @arg @ref LL_SYSCFG_REMAP_SYSTEMFLASH + * @arg @ref LL_SYSCFG_REMAP_SRAM + * @arg @ref LL_SYSCFG_REMAP_FSMC (*) + * @arg @ref LL_SYSCFG_REMAP_FMC (*) + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_SetRemapMemory(uint32_t Memory) +{ + MODIFY_REG(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_MODE, Memory); +} + +/** + * @brief Get memory mapping at address 0x00000000 + * @rmtoll SYSCFG_MEMRMP MEM_MODE LL_SYSCFG_GetRemapMemory + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_REMAP_FLASH + * @arg @ref LL_SYSCFG_REMAP_SYSTEMFLASH + * @arg @ref LL_SYSCFG_REMAP_SRAM + * @arg @ref LL_SYSCFG_REMAP_FSMC (*) + * @arg @ref LL_SYSCFG_REMAP_FMC (*) + */ +__STATIC_INLINE uint32_t LL_SYSCFG_GetRemapMemory(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_MODE)); +} + +#if defined(SYSCFG_MEMRMP_SWP_FMC) +/** + * @brief Enables the FMC Memory Mapping Swapping + * @rmtoll SYSCFG_MEMRMP SWP_FMC LL_SYSCFG_EnableFMCMemorySwapping + * @note SDRAM is accessible at 0x60000000 and NOR/RAM + * is accessible at 0xC0000000 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_EnableFMCMemorySwapping(void) +{ + SET_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_SWP_FMC_0); +} + +/** + * @brief Disables the FMC Memory Mapping Swapping + * @rmtoll SYSCFG_MEMRMP SWP_FMC LL_SYSCFG_DisableFMCMemorySwapping + * @note SDRAM is accessible at 0xC0000000 (default mapping) + * and NOR/RAM is accessible at 0x60000000 (default mapping) + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DisableFMCMemorySwapping(void) +{ + CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_SWP_FMC); +} + +#endif /* SYSCFG_MEMRMP_SWP_FMC */ +/** + * @brief Enables the Compensation cell Power Down + * @rmtoll SYSCFG_CMPCR CMP_PD LL_SYSCFG_EnableCompensationCell + * @note The I/O compensation cell can be used only when the device supply + * voltage ranges from 2.4 to 3.6 V + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_EnableCompensationCell(void) +{ + SET_BIT(SYSCFG->CMPCR, SYSCFG_CMPCR_CMP_PD); +} + +/** + * @brief Disables the Compensation cell Power Down + * @rmtoll SYSCFG_CMPCR CMP_PD LL_SYSCFG_DisableCompensationCell + * @note The I/O compensation cell can be used only when the device supply + * voltage ranges from 2.4 to 3.6 V + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DisableCompensationCell(void) +{ + CLEAR_BIT(SYSCFG->CMPCR, SYSCFG_CMPCR_CMP_PD); +} + +/** + * @brief Get Compensation Cell ready Flag + * @rmtoll SYSCFG_CMPCR READY LL_SYSCFG_IsActiveFlag_CMPCR + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_SYSCFG_IsActiveFlag_CMPCR(void) +{ + return (READ_BIT(SYSCFG->CMPCR, SYSCFG_CMPCR_READY) == (SYSCFG_CMPCR_READY)); +} + +#if defined(SYSCFG_PMC_MII_RMII_SEL) +/** + * @brief Select Ethernet PHY interface + * @rmtoll SYSCFG_PMC MII_RMII_SEL LL_SYSCFG_SetPHYInterface + * @param Interface This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_PMC_ETHMII + * @arg @ref LL_SYSCFG_PMC_ETHRMII + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_SetPHYInterface(uint32_t Interface) +{ + MODIFY_REG(SYSCFG->PMC, SYSCFG_PMC_MII_RMII_SEL, Interface); +} + +/** + * @brief Get Ethernet PHY interface + * @rmtoll SYSCFG_PMC MII_RMII_SEL LL_SYSCFG_GetPHYInterface + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_PMC_ETHMII + * @arg @ref LL_SYSCFG_PMC_ETHRMII + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_GetPHYInterface(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->PMC, SYSCFG_PMC_MII_RMII_SEL)); +} +#endif /* SYSCFG_PMC_MII_RMII_SEL */ + + + +#if defined(SYSCFG_MEMRMP_UFB_MODE) +/** + * @brief Select Flash bank mode (Bank flashed at 0x08000000) + * @rmtoll SYSCFG_MEMRMP UFB_MODE LL_SYSCFG_SetFlashBankMode + * @param Bank This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_BANKMODE_BANK1 + * @arg @ref LL_SYSCFG_BANKMODE_BANK2 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_SetFlashBankMode(uint32_t Bank) +{ + MODIFY_REG(SYSCFG->MEMRMP, SYSCFG_MEMRMP_UFB_MODE, Bank); +} + +/** + * @brief Get Flash bank mode (Bank flashed at 0x08000000) + * @rmtoll SYSCFG_MEMRMP UFB_MODE LL_SYSCFG_GetFlashBankMode + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_BANKMODE_BANK1 + * @arg @ref LL_SYSCFG_BANKMODE_BANK2 + */ +__STATIC_INLINE uint32_t LL_SYSCFG_GetFlashBankMode(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_UFB_MODE)); +} +#endif /* SYSCFG_MEMRMP_UFB_MODE */ + +#if defined(SYSCFG_CFGR_FMPI2C1_SCL) +/** + * @brief Enable the I2C fast mode plus driving capability. + * @rmtoll SYSCFG_CFGR FMPI2C1_SCL LL_SYSCFG_EnableFastModePlus\n + * SYSCFG_CFGR FMPI2C1_SDA LL_SYSCFG_EnableFastModePlus + * @param ConfigFastModePlus This parameter can be a combination of the following values: + * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_SCL + * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_SDA + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_EnableFastModePlus(uint32_t ConfigFastModePlus) +{ + SET_BIT(SYSCFG->CFGR, ConfigFastModePlus); +} + +/** + * @brief Disable the I2C fast mode plus driving capability. + * @rmtoll SYSCFG_CFGR FMPI2C1_SCL LL_SYSCFG_DisableFastModePlus\n + * SYSCFG_CFGR FMPI2C1_SDA LL_SYSCFG_DisableFastModePlus\n + * @param ConfigFastModePlus This parameter can be a combination of the following values: + * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_SCL + * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_SDA + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DisableFastModePlus(uint32_t ConfigFastModePlus) +{ + CLEAR_BIT(SYSCFG->CFGR, ConfigFastModePlus); +} +#endif /* SYSCFG_CFGR_FMPI2C1_SCL */ + +/** + * @brief Configure source input for the EXTI external interrupt. + * @rmtoll SYSCFG_EXTICR1 EXTIx LL_SYSCFG_SetEXTISource\n + * SYSCFG_EXTICR2 EXTIx LL_SYSCFG_SetEXTISource\n + * SYSCFG_EXTICR3 EXTIx LL_SYSCFG_SetEXTISource\n + * SYSCFG_EXTICR4 EXTIx LL_SYSCFG_SetEXTISource + * @param Port This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_EXTI_PORTA + * @arg @ref LL_SYSCFG_EXTI_PORTB + * @arg @ref LL_SYSCFG_EXTI_PORTC + * @arg @ref LL_SYSCFG_EXTI_PORTD + * @arg @ref LL_SYSCFG_EXTI_PORTE + * @arg @ref LL_SYSCFG_EXTI_PORTF (*) + * @arg @ref LL_SYSCFG_EXTI_PORTG (*) + * @arg @ref LL_SYSCFG_EXTI_PORTH + * + * (*) value not defined in all devices + * @param Line This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_EXTI_LINE0 + * @arg @ref LL_SYSCFG_EXTI_LINE1 + * @arg @ref LL_SYSCFG_EXTI_LINE2 + * @arg @ref LL_SYSCFG_EXTI_LINE3 + * @arg @ref LL_SYSCFG_EXTI_LINE4 + * @arg @ref LL_SYSCFG_EXTI_LINE5 + * @arg @ref LL_SYSCFG_EXTI_LINE6 + * @arg @ref LL_SYSCFG_EXTI_LINE7 + * @arg @ref LL_SYSCFG_EXTI_LINE8 + * @arg @ref LL_SYSCFG_EXTI_LINE9 + * @arg @ref LL_SYSCFG_EXTI_LINE10 + * @arg @ref LL_SYSCFG_EXTI_LINE11 + * @arg @ref LL_SYSCFG_EXTI_LINE12 + * @arg @ref LL_SYSCFG_EXTI_LINE13 + * @arg @ref LL_SYSCFG_EXTI_LINE14 + * @arg @ref LL_SYSCFG_EXTI_LINE15 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_SetEXTISource(uint32_t Port, uint32_t Line) +{ + MODIFY_REG(SYSCFG->EXTICR[Line & 0xFF], (Line >> 16), Port << POSITION_VAL((Line >> 16))); +} + +/** + * @brief Get the configured defined for specific EXTI Line + * @rmtoll SYSCFG_EXTICR1 EXTIx LL_SYSCFG_GetEXTISource\n + * SYSCFG_EXTICR2 EXTIx LL_SYSCFG_GetEXTISource\n + * SYSCFG_EXTICR3 EXTIx LL_SYSCFG_GetEXTISource\n + * SYSCFG_EXTICR4 EXTIx LL_SYSCFG_GetEXTISource + * @param Line This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_EXTI_LINE0 + * @arg @ref LL_SYSCFG_EXTI_LINE1 + * @arg @ref LL_SYSCFG_EXTI_LINE2 + * @arg @ref LL_SYSCFG_EXTI_LINE3 + * @arg @ref LL_SYSCFG_EXTI_LINE4 + * @arg @ref LL_SYSCFG_EXTI_LINE5 + * @arg @ref LL_SYSCFG_EXTI_LINE6 + * @arg @ref LL_SYSCFG_EXTI_LINE7 + * @arg @ref LL_SYSCFG_EXTI_LINE8 + * @arg @ref LL_SYSCFG_EXTI_LINE9 + * @arg @ref LL_SYSCFG_EXTI_LINE10 + * @arg @ref LL_SYSCFG_EXTI_LINE11 + * @arg @ref LL_SYSCFG_EXTI_LINE12 + * @arg @ref LL_SYSCFG_EXTI_LINE13 + * @arg @ref LL_SYSCFG_EXTI_LINE14 + * @arg @ref LL_SYSCFG_EXTI_LINE15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_EXTI_PORTA + * @arg @ref LL_SYSCFG_EXTI_PORTB + * @arg @ref LL_SYSCFG_EXTI_PORTC + * @arg @ref LL_SYSCFG_EXTI_PORTD + * @arg @ref LL_SYSCFG_EXTI_PORTE + * @arg @ref LL_SYSCFG_EXTI_PORTF (*) + * @arg @ref LL_SYSCFG_EXTI_PORTG (*) + * @arg @ref LL_SYSCFG_EXTI_PORTH + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_SYSCFG_GetEXTISource(uint32_t Line) +{ + return (uint32_t)(READ_BIT(SYSCFG->EXTICR[Line & 0xFF], (Line >> 16)) >> POSITION_VAL(Line >> 16)); +} + +#if defined(SYSCFG_CFGR2_LOCKUP_LOCK) +/** + * @brief Set connections to TIM1/8 break inputs + * @rmtoll SYSCFG_CFGR2 LockUp Lock LL_SYSCFG_SetTIMBreakInputs \n + * SYSCFG_CFGR2 PVD Lock LL_SYSCFG_SetTIMBreakInputs + * @param Break This parameter can be a combination of the following values: + * @arg @ref LL_SYSCFG_TIMBREAK_LOCKUP + * @arg @ref LL_SYSCFG_TIMBREAK_PVD + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_SetTIMBreakInputs(uint32_t Break) +{ + MODIFY_REG(SYSCFG->CFGR2, SYSCFG_CFGR2_LOCKUP_LOCK | SYSCFG_CFGR2_PVD_LOCK, Break); +} + +/** + * @brief Get connections to TIM1/8 Break inputs + * @rmtoll SYSCFG_CFGR2 LockUp Lock LL_SYSCFG_SetTIMBreakInputs \n + * SYSCFG_CFGR2 PVD Lock LL_SYSCFG_SetTIMBreakInputs + * @retval Returned value can be can be a combination of the following values: + * @arg @ref LL_SYSCFG_TIMBREAK_LOCKUP + * @arg @ref LL_SYSCFG_TIMBREAK_PVD + */ +__STATIC_INLINE uint32_t LL_SYSCFG_GetTIMBreakInputs(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->CFGR2, SYSCFG_CFGR2_LOCKUP_LOCK | SYSCFG_CFGR2_PVD_LOCK)); +} +#endif /* SYSCFG_CFGR2_LOCKUP_LOCK */ +#if defined(SYSCFG_MCHDLYCR_BSCKSEL) +/** + * @brief Select the DFSDM2 or TIM2_OC1 as clock source for the bitstream clock. + * @rmtoll SYSCFG_MCHDLYCR BSCKSEL LL_SYSCFG_DFSDM_SetBitstreamClockSourceSelection + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_BITSTREAM_CLOCK_DFSDM2 + * @arg @ref LL_SYSCFG_BITSTREAM_CLOCK_TIM2OC1 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM_SetBitstreamClockSourceSelection(uint32_t ClockSource) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_BSCKSEL, ClockSource); +} +/** + * @brief Get the DFSDM2 or TIM2_OC1 as clock source for the bitstream clock. + * @rmtoll SYSCFG_MCHDLYCR BSCKSEL LL_SYSCFG_DFSDM_GetBitstreamClockSourceSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_BITSTREAM_CLOCK_DFSDM2 + * @arg @ref LL_SYSCFG_BITSTREAM_CLOCK_TIM2OC1 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM_GetBitstreamClockSourceSelection(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_BSCKSEL)); +} +/** + * @brief Enables the DFSDM1 or DFSDM2 Delay clock + * @rmtoll SYSCFG_MCHDLYCR MCHDLYEN LL_SYSCFG_DFSDM_EnableDelayClock + * @param MCHDLY This paramater can be one of the following values + * @arg @ref LL_SYSCFG_DFSDM1_MCHDLYEN + * @arg @ref LL_SYSCFG_DFSDM2_MCHDLYEN + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM_EnableDelayClock(uint32_t MCHDLY) +{ + SET_BIT(SYSCFG->MCHDLYCR, MCHDLY); +} + +/** + * @brief Disables the DFSDM1 or the DFSDM2 Delay clock + * @rmtoll SYSCFG_MCHDLYCR MCHDLY1EN LL_SYSCFG_DFSDM1_DisableDelayClock + * @param MCHDLY This paramater can be one of the following values + * @arg @ref LL_SYSCFG_DFSDM1_MCHDLYEN + * @arg @ref LL_SYSCFG_DFSDM2_MCHDLYEN + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM_DisableDelayClock(uint32_t MCHDLY) +{ + CLEAR_BIT(SYSCFG->MCHDLYCR, MCHDLY); +} + +/** + * @brief Select the source for DFSDM1 or DFSDM2 DatIn0 + * @rmtoll SYSCFG_MCHDLYCR DFSDMD0SEL LL_SYSCFG_DFSDM_SetDataIn0Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM1_DataIn0_DM + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM_SetDataIn0Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, (Source >> 16), (Source & 0x0000FFFF)); +} +/** + * @brief Get the source for DFSDM1 or DFSDM2 DatIn0. + * @rmtoll SYSCFG_MCHDLYCR DFSDMD0SEL LL_SYSCFG_DFSDM_GetDataIn0Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn0 + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0 + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM1_DataIn0_DM + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM_GetDataIn0Source(uint32_t Source) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, Source)); +} +/** + * @brief Select the source for DFSDM1 or DFSDM2 DatIn2 + * @rmtoll SYSCFG_MCHDLYCR DFSDMD2SEL LL_SYSCFG_DFSDM_SetDataIn2Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM1_DataIn2_DM + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM_SetDataIn2Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, (Source >> 16), (Source & 0x0000FFFF)); +} +/** + * @brief Get the source for DFSDM1 or DFSDM2 DatIn2. + * @rmtoll SYSCFG_MCHDLYCR DFSDMD2SEL LL_SYSCFG_DFSDM_GetDataIn2Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn2 + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2 + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM1_DataIn2_DM + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM_GetDataIn2Source(uint32_t Source) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, Source)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM4 OC2 + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CK02SEL LL_SYSCFG_DFSDM1_SetTIM4OC2BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN0 + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN2 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM1_SetTIM4OC2BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CK02SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM4 OC2 + * @rmtoll SYSCFG_MCHDLYCR DFSDM1D2SEL LL_SYSCFG_DFSDM1_GetTIM4OC2BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN0 + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC2_CLKIN2 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM1_GetTIM4OC2BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CK02SEL)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM4 OC1 + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CK13SEL LL_SYSCFG_DFSDM1_SetTIM4OC1BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN1 + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN3 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM1_SetTIM4OC1BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CK13SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM4 OC1 + * @rmtoll SYSCFG_MCHDLYCR DFSDM1D2SEL LL_SYSCFG_DFSDM1_GetTIM4OC1BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN1 + * @arg @ref LL_SYSCFG_DFSDM1_TIM4OC1_CLKIN3 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM1_GetTIM4OC1BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CK13SEL)); +} + +/** + * @brief Select the DFSDM1 Clock In + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CFG LL_SYSCFG_DFSDM1_SetClockInSourceSelection + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_CKIN_PAD + * @arg @ref LL_SYSCFG_DFSDM1_CKIN_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM1_SetClockInSourceSelection(uint32_t ClockSource) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CFG, ClockSource); +} +/** + * @brief GET the DFSDM1 Clock In + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CFG LL_SYSCFG_DFSDM1_GetClockInSourceSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_CKIN_PAD + * @arg @ref LL_SYSCFG_DFSDM1_CKIN_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM1_GetClockInSourceSelection(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CFG)); +} + +/** + * @brief Select the DFSDM1 Clock Out + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CKOSEL LL_SYSCFG_DFSDM1_SetClockOutSourceSelection + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_CKOUT + * @arg @ref LL_SYSCFG_DFSDM1_CKOUT_M27 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM1_SetClockOutSourceSelection(uint32_t ClockSource) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CKOSEL, ClockSource); +} +/** + * @brief GET the DFSDM1 Clock Out + * @rmtoll SYSCFG_MCHDLYCR DFSDM1CKOSEL LL_SYSCFG_DFSDM1_GetClockOutSourceSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM1_CKOUT + * @arg @ref LL_SYSCFG_DFSDM1_CKOUT_M27 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM1_GetClockOutSourceSelection(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM1CKOSEL)); +} + +/** + * @brief Enables the DFSDM2 Delay clock + * @rmtoll SYSCFG_MCHDLYCR MCHDLY2EN LL_SYSCFG_DFSDM2_EnableDelayClock + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_EnableDelayClock(void) +{ + SET_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_MCHDLY2EN); +} + +/** + * @brief Disables the DFSDM2 Delay clock + * @rmtoll SYSCFG_MCHDLYCR MCHDLY2EN LL_SYSCFG_DFSDM2_DisableDelayClock + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_DisableDelayClock(void) +{ + CLEAR_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_MCHDLY2EN); +} +/** + * @brief Select the source for DFSDM2 DatIn0 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D0SEL LL_SYSCFG_DFSDM2_SetDataIn0Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetDataIn0Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D0SEL, Source); +} +/** + * @brief Get the source for DFSDM2 DatIn0. + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D0SEL LL_SYSCFG_DFSDM2_GetDataIn0Source + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn0_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetDataIn0Source(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D0SEL)); +} + +/** + * @brief Select the source for DFSDM2 DatIn2 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D2SEL LL_SYSCFG_DFSDM2_SetDataIn2Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetDataIn2Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D2SEL, Source); +} +/** + * @brief Get the source for DFSDM2 DatIn2. + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D2SEL LL_SYSCFG_DFSDM2_GetDataIn2Source + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn2_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetDataIn2Source(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D2SEL)); +} + +/** + * @brief Select the source for DFSDM2 DatIn4 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D4SEL LL_SYSCFG_DFSDM2_SetDataIn4Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn4_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn4_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetDataIn4Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D4SEL, Source); +} +/** + * @brief Get the source for DFSDM2 DatIn4. + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D4SEL LL_SYSCFG_DFSDM2_GetDataIn4Source + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn4_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn4_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetDataIn4Source(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D4SEL)); +} + +/** + * @brief Select the source for DFSDM2 DatIn6 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D6SEL LL_SYSCFG_DFSDM2_SetDataIn6Source + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn6_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn6_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetDataIn6Source(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D6SEL, Source); +} +/** + * @brief Get the source for DFSDM2 DatIn6. + * @rmtoll SYSCFG_MCHDLYCR DFSDM2D6SEL LL_SYSCFG_DFSDM2_GetDataIn6Source + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_DataIn6_PAD + * @arg @ref LL_SYSCFG_DFSDM2_DataIn6_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetDataIn6Source(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2D6SEL)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM3 OC4 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK04SEL LL_SYSCFG_DFSDM2_SetTIM3OC4BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN0 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN4 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetTIM3OC4BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK04SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM3 OC4 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK04SEL LL_SYSCFG_DFSDM2_GetTIM3OC4BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN0 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC4_CLKIN4 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetTIM3OC4BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK04SEL)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM3 OC3 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK15SEL LL_SYSCFG_DFSDM2_SetTIM3OC3BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN1 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN5 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetTIM3OC3BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK15SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM3 OC4 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK04SEL LL_SYSCFG_DFSDM2_GetTIM3OC3BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN1 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC3_CLKIN5 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetTIM3OC3BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK15SEL)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM3 OC2 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK26SEL LL_SYSCFG_DFSDM2_SetTIM3OC2BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN2 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN6 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetTIM3OC2BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK26SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM3 OC2 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK04SEL LL_SYSCFG_DFSDM2_GetTIM3OC2BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN2 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC2_CLKIN6 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetTIM3OC2BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK26SEL)); +} + +/** + * @brief Select the distribution of the bitsream lock gated by TIM3 OC1 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK37SEL LL_SYSCFG_DFSDM2_SetTIM3OC1BitStreamDistribution + * @param Source This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN3 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN7 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetTIM3OC1BitStreamDistribution(uint32_t Source) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK37SEL, Source); +} +/** + * @brief Get the distribution of the bitsream lock gated by TIM3 OC1 + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CK37SEL LL_SYSCFG_DFSDM2_GetTIM3OC1BitStreamDistribution + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN3 + * @arg @ref LL_SYSCFG_DFSDM2_TIM3OC1_CLKIN7 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetTIM3OC1BitStreamDistribution(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CK37SEL)); +} + +/** + * @brief Select the DFSDM2 Clock In + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CFG LL_SYSCFG_DFSDM2_SetClockInSourceSelection + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_CKIN_PAD + * @arg @ref LL_SYSCFG_DFSDM2_CKIN_DM + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetClockInSourceSelection(uint32_t ClockSource) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CFG, ClockSource); +} +/** + * @brief GET the DFSDM2 Clock In + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CFG LL_SYSCFG_DFSDM2_GetClockInSourceSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_CKIN_PAD + * @arg @ref LL_SYSCFG_DFSDM2_CKIN_DM + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetClockInSourceSelection(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CFG)); +} + +/** + * @brief Select the DFSDM2 Clock Out + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CKOSEL LL_SYSCFG_DFSDM2_SetClockOutSourceSelection + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_CKOUT + * @arg @ref LL_SYSCFG_DFSDM2_CKOUT_M27 + * @retval None + */ +__STATIC_INLINE void LL_SYSCFG_DFSDM2_SetClockOutSourceSelection(uint32_t ClockSource) +{ + MODIFY_REG(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CKOSEL, ClockSource); +} +/** + * @brief GET the DFSDM2 Clock Out + * @rmtoll SYSCFG_MCHDLYCR DFSDM2CKOSEL LL_SYSCFG_DFSDM2_GetClockOutSourceSelection + * @retval Returned value can be one of the following values: + * @arg @ref LL_SYSCFG_DFSDM2_CKOUT + * @arg @ref LL_SYSCFG_DFSDM2_CKOUT_M27 + * @retval None + */ +__STATIC_INLINE uint32_t LL_SYSCFG_DFSDM2_GetClockOutSourceSelection(void) +{ + return (uint32_t)(READ_BIT(SYSCFG->MCHDLYCR, SYSCFG_MCHDLYCR_DFSDM2CKOSEL)); +} + +#endif /* SYSCFG_MCHDLYCR_BSCKSEL */ +/** + * @} + */ + + +/** @defgroup SYSTEM_LL_EF_DBGMCU DBGMCU + * @{ + */ + +/** + * @brief Return the device identifier + * @note For STM32F405/407xx and STM32F415/417xx devices, the device ID is 0x413 + * @note For STM32F42xxx and STM32F43xxx devices, the device ID is 0x419 + * @note For STM32F401xx devices, the device ID is 0x423 + * @note For STM32F401xx devices, the device ID is 0x433 + * @note For STM32F411xx devices, the device ID is 0x431 + * @note For STM32F410xx devices, the device ID is 0x458 + * @note For STM32F412xx devices, the device ID is 0x441 + * @note For STM32F413xx and STM32423xx devices, the device ID is 0x463 + * @note For STM32F446xx devices, the device ID is 0x421 + * @note For STM32F469xx and STM32F479xx devices, the device ID is 0x434 + * @rmtoll DBGMCU_IDCODE DEV_ID LL_DBGMCU_GetDeviceID + * @retval Values between Min_Data=0x00 and Max_Data=0xFFF + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetDeviceID(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_DEV_ID)); +} + +/** + * @brief Return the device revision identifier + * @note This field indicates the revision of the device. + For example, it is read as RevA -> 0x1000, Cat 2 revZ -> 0x1001, rev1 -> 0x1003, rev2 ->0x1007, revY -> 0x100F for STM32F405/407xx and STM32F415/417xx devices + For example, it is read as RevA -> 0x1000, Cat 2 revY -> 0x1003, rev1 -> 0x1007, rev3 ->0x2001 for STM32F42xxx and STM32F43xxx devices + For example, it is read as RevZ -> 0x1000, Cat 2 revA -> 0x1001 for STM32F401xB/C devices + For example, it is read as RevA -> 0x1000, Cat 2 revZ -> 0x1001 for STM32F401xD/E devices + For example, it is read as RevA -> 0x1000 for STM32F411xx,STM32F413/423xx,STM32F469/423xx, STM32F446xx and STM32F410xx devices + For example, it is read as RevZ -> 0x1001, Cat 2 revB -> 0x2000, revC -> 0x3000 for STM32F412xx devices + * @rmtoll DBGMCU_IDCODE REV_ID LL_DBGMCU_GetRevisionID + * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetRevisionID(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_REV_ID) >> DBGMCU_IDCODE_REV_ID_Pos); +} + +/** + * @brief Enable the Debug Module during SLEEP mode + * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_EnableDBGSleepMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGSleepMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Disable the Debug Module during SLEEP mode + * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_DisableDBGSleepMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGSleepMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Enable the Debug Module during STOP mode + * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_EnableDBGStopMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGStopMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Disable the Debug Module during STOP mode + * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_DisableDBGStopMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGStopMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Enable the Debug Module during STANDBY mode + * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_EnableDBGStandbyMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGStandbyMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Disable the Debug Module during STANDBY mode + * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_DisableDBGStandbyMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGStandbyMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Set Trace pin assignment control + * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_SetTracePinAssignment\n + * DBGMCU_CR TRACE_MODE LL_DBGMCU_SetTracePinAssignment + * @param PinAssignment This parameter can be one of the following values: + * @arg @ref LL_DBGMCU_TRACE_NONE + * @arg @ref LL_DBGMCU_TRACE_ASYNCH + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4 + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_SetTracePinAssignment(uint32_t PinAssignment) +{ + MODIFY_REG(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE, PinAssignment); +} + +/** + * @brief Get Trace pin assignment control + * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_GetTracePinAssignment\n + * DBGMCU_CR TRACE_MODE LL_DBGMCU_GetTracePinAssignment + * @retval Returned value can be one of the following values: + * @arg @ref LL_DBGMCU_TRACE_NONE + * @arg @ref LL_DBGMCU_TRACE_ASYNCH + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4 + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetTracePinAssignment(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE)); +} + +/** + * @brief Freeze APB1 peripherals (group1 peripherals) + * @rmtoll DBGMCU_APB1_FZ DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_LPTIM_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C3_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C4_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN3_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_LPTIM_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C3_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C4_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN3_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB1_GRP1_FreezePeriph(uint32_t Periphs) +{ + SET_BIT(DBGMCU->APB1FZ, Periphs); +} + +/** + * @brief Unfreeze APB1 peripherals (group1 peripherals) + * @rmtoll DBGMCU_APB1_FZ DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_LPTIM_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C3_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_I2C4_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_APB1_FZ DBG_CAN3_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_LPTIM_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C3_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C4_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN3_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB1_GRP1_UnFreezePeriph(uint32_t Periphs) +{ + CLEAR_BIT(DBGMCU->APB1FZ, Periphs); +} + +/** + * @brief Freeze APB2 peripherals + * @rmtoll DBGMCU_APB2_FZ DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB2_GRP1_FreezePeriph(uint32_t Periphs) +{ + SET_BIT(DBGMCU->APB2FZ, Periphs); +} + +/** + * @brief Unfreeze APB2 peripherals + * @rmtoll DBGMCU_APB2_FZ DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph\n + * DBGMCU_APB2_FZ DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB2_GRP1_UnFreezePeriph(uint32_t Periphs) +{ + CLEAR_BIT(DBGMCU->APB2FZ, Periphs); +} +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EF_FLASH FLASH + * @{ + */ + +/** + * @brief Set FLASH Latency + * @rmtoll FLASH_ACR LATENCY LL_FLASH_SetLatency + * @param Latency This parameter can be one of the following values: + * @arg @ref LL_FLASH_LATENCY_0 + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + * @arg @ref LL_FLASH_LATENCY_3 + * @arg @ref LL_FLASH_LATENCY_4 + * @arg @ref LL_FLASH_LATENCY_5 + * @arg @ref LL_FLASH_LATENCY_6 + * @arg @ref LL_FLASH_LATENCY_7 + * @arg @ref LL_FLASH_LATENCY_8 + * @arg @ref LL_FLASH_LATENCY_9 + * @arg @ref LL_FLASH_LATENCY_10 + * @arg @ref LL_FLASH_LATENCY_11 + * @arg @ref LL_FLASH_LATENCY_12 + * @arg @ref LL_FLASH_LATENCY_13 + * @arg @ref LL_FLASH_LATENCY_14 + * @arg @ref LL_FLASH_LATENCY_15 + * @retval None + */ +__STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency) +{ + MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency); +} + +/** + * @brief Get FLASH Latency + * @rmtoll FLASH_ACR LATENCY LL_FLASH_GetLatency + * @retval Returned value can be one of the following values: + * @arg @ref LL_FLASH_LATENCY_0 + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + * @arg @ref LL_FLASH_LATENCY_3 + * @arg @ref LL_FLASH_LATENCY_4 + * @arg @ref LL_FLASH_LATENCY_5 + * @arg @ref LL_FLASH_LATENCY_6 + * @arg @ref LL_FLASH_LATENCY_7 + * @arg @ref LL_FLASH_LATENCY_8 + * @arg @ref LL_FLASH_LATENCY_9 + * @arg @ref LL_FLASH_LATENCY_10 + * @arg @ref LL_FLASH_LATENCY_11 + * @arg @ref LL_FLASH_LATENCY_12 + * @arg @ref LL_FLASH_LATENCY_13 + * @arg @ref LL_FLASH_LATENCY_14 + * @arg @ref LL_FLASH_LATENCY_15 + */ +__STATIC_INLINE uint32_t LL_FLASH_GetLatency(void) +{ + return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY)); +} + +/** + * @brief Enable Prefetch + * @rmtoll FLASH_ACR PRFTEN LL_FLASH_EnablePrefetch + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnablePrefetch(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_PRFTEN); +} + +/** + * @brief Disable Prefetch + * @rmtoll FLASH_ACR PRFTEN LL_FLASH_DisablePrefetch + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisablePrefetch(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_PRFTEN); +} + +/** + * @brief Check if Prefetch buffer is enabled + * @rmtoll FLASH_ACR PRFTEN LL_FLASH_IsPrefetchEnabled + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_FLASH_IsPrefetchEnabled(void) +{ + return (READ_BIT(FLASH->ACR, FLASH_ACR_PRFTEN) == (FLASH_ACR_PRFTEN)); +} + +/** + * @brief Enable Instruction cache + * @rmtoll FLASH_ACR ICEN LL_FLASH_EnableInstCache + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnableInstCache(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_ICEN); +} + +/** + * @brief Disable Instruction cache + * @rmtoll FLASH_ACR ICEN LL_FLASH_DisableInstCache + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisableInstCache(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_ICEN); +} + +/** + * @brief Enable Data cache + * @rmtoll FLASH_ACR DCEN LL_FLASH_EnableDataCache + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnableDataCache(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_DCEN); +} + +/** + * @brief Disable Data cache + * @rmtoll FLASH_ACR DCEN LL_FLASH_DisableDataCache + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisableDataCache(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_DCEN); +} + +/** + * @brief Enable Instruction cache reset + * @note bit can be written only when the instruction cache is disabled + * @rmtoll FLASH_ACR ICRST LL_FLASH_EnableInstCacheReset + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnableInstCacheReset(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_ICRST); +} + +/** + * @brief Disable Instruction cache reset + * @rmtoll FLASH_ACR ICRST LL_FLASH_DisableInstCacheReset + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisableInstCacheReset(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_ICRST); +} + +/** + * @brief Enable Data cache reset + * @note bit can be written only when the data cache is disabled + * @rmtoll FLASH_ACR DCRST LL_FLASH_EnableDataCacheReset + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnableDataCacheReset(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_DCRST); +} + +/** + * @brief Disable Data cache reset + * @rmtoll FLASH_ACR DCRST LL_FLASH_DisableDataCacheReset + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisableDataCacheReset(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_DCRST); +} + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (FLASH) || defined (SYSCFG) || defined (DBGMCU) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_SYSTEM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h new file mode 100644 index 0000000..57d2ec7 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h @@ -0,0 +1,3971 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_tim.h + * @author MCD Application Team + * @brief Header file of TIM LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_TIM_H +#define __STM32F4xx_LL_TIM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) + +/** @defgroup TIM_LL TIM + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Variables TIM Private Variables + * @{ + */ +static const uint8_t OFFSET_TAB_CCMRx[] = +{ + 0x00U, /* 0: TIMx_CH1 */ + 0x00U, /* 1: TIMx_CH1N */ + 0x00U, /* 2: TIMx_CH2 */ + 0x00U, /* 3: TIMx_CH2N */ + 0x04U, /* 4: TIMx_CH3 */ + 0x04U, /* 5: TIMx_CH3N */ + 0x04U /* 6: TIMx_CH4 */ +}; + +static const uint8_t SHIFT_TAB_OCxx[] = +{ + 0U, /* 0: OC1M, OC1FE, OC1PE */ + 0U, /* 1: - NA */ + 8U, /* 2: OC2M, OC2FE, OC2PE */ + 0U, /* 3: - NA */ + 0U, /* 4: OC3M, OC3FE, OC3PE */ + 0U, /* 5: - NA */ + 8U /* 6: OC4M, OC4FE, OC4PE */ +}; + +static const uint8_t SHIFT_TAB_ICxx[] = +{ + 0U, /* 0: CC1S, IC1PSC, IC1F */ + 0U, /* 1: - NA */ + 8U, /* 2: CC2S, IC2PSC, IC2F */ + 0U, /* 3: - NA */ + 0U, /* 4: CC3S, IC3PSC, IC3F */ + 0U, /* 5: - NA */ + 8U /* 6: CC4S, IC4PSC, IC4F */ +}; + +static const uint8_t SHIFT_TAB_CCxP[] = +{ + 0U, /* 0: CC1P */ + 2U, /* 1: CC1NP */ + 4U, /* 2: CC2P */ + 6U, /* 3: CC2NP */ + 8U, /* 4: CC3P */ + 10U, /* 5: CC3NP */ + 12U /* 6: CC4P */ +}; + +static const uint8_t SHIFT_TAB_OISx[] = +{ + 0U, /* 0: OIS1 */ + 1U, /* 1: OIS1N */ + 2U, /* 2: OIS2 */ + 3U, /* 3: OIS2N */ + 4U, /* 4: OIS3 */ + 5U, /* 5: OIS3N */ + 6U /* 6: OIS4 */ +}; +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Constants TIM Private Constants + * @{ + */ + + +/* Remap mask definitions */ +#define TIMx_OR_RMP_SHIFT 16U +#define TIMx_OR_RMP_MASK 0x0000FFFFU +#define TIM2_OR_RMP_MASK (TIM_OR_ITR1_RMP << TIMx_OR_RMP_SHIFT) +#define TIM5_OR_RMP_MASK (TIM_OR_TI4_RMP << TIMx_OR_RMP_SHIFT) +#define TIM11_OR_RMP_MASK (TIM_OR_TI1_RMP << TIMx_OR_RMP_SHIFT) + +/* Mask used to set the TDG[x:0] of the DTG bits of the TIMx_BDTR register */ +#define DT_DELAY_1 ((uint8_t)0x7F) +#define DT_DELAY_2 ((uint8_t)0x3F) +#define DT_DELAY_3 ((uint8_t)0x1F) +#define DT_DELAY_4 ((uint8_t)0x1F) + +/* Mask used to set the DTG[7:5] bits of the DTG bits of the TIMx_BDTR register */ +#define DT_RANGE_1 ((uint8_t)0x00) +#define DT_RANGE_2 ((uint8_t)0x80) +#define DT_RANGE_3 ((uint8_t)0xC0) +#define DT_RANGE_4 ((uint8_t)0xE0) + + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Macros TIM Private Macros + * @{ + */ +/** @brief Convert channel id into channel index. + * @param __CHANNEL__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval none + */ +#define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \ + (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U) + +/** @brief Calculate the deadtime sampling period(in ps). + * @param __TIMCLK__ timer input clock frequency (in Hz). + * @param __CKD__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @retval none + */ +#define TIM_CALC_DTS(__TIMCLK__, __CKD__) \ + (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \ + ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \ + ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U))) +/** + * @} + */ + + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_ES_INIT TIM Exported Init structure + * @{ + */ + +/** + * @brief TIM Time Base configuration structure definition. + */ +typedef struct +{ + uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. + This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetPrescaler().*/ + + uint32_t CounterMode; /*!< Specifies the counter mode. + This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetCounterMode().*/ + + uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetAutoReload().*/ + + uint32_t ClockDivision; /*!< Specifies the clock division. + This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/ + + uint8_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter + reaches zero, an update event is generated and counting restarts + from the RCR value (N). + This means in PWM mode that (N+1) corresponds to: + - the number of PWM periods in edge-aligned mode + - the number of half PWM period in center-aligned mode + This parameter must be a number between 0x00 and 0xFF. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetRepetitionCounter().*/ +} LL_TIM_InitTypeDef; + +/** + * @brief TIM Output Compare configuration structure definition. + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the output mode. + This parameter can be a value of @ref TIM_LL_EC_OCMODE. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetMode().*/ + + uint32_t OCState; /*!< Specifies the TIM Output Compare state. + This parameter can be a value of @ref TIM_LL_EC_OCSTATE. + + This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ + + uint32_t OCNState; /*!< Specifies the TIM complementary Output Compare state. + This parameter can be a value of @ref TIM_LL_EC_OCSTATE. + + This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ + + uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register. + This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + + This feature can be modified afterwards using unitary function LL_TIM_OC_SetCompareCHx (x=1..6).*/ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/ + + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetIdleState().*/ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetIdleState().*/ +} LL_TIM_OC_InitTypeDef; + +/** + * @brief TIM Input Capture configuration structure definition. + */ + +typedef struct +{ + + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t ICActiveInput; /*!< Specifies the input. + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ +} LL_TIM_IC_InitTypeDef; + + +/** + * @brief TIM Encoder interface configuration structure definition. + */ +typedef struct +{ + uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4). + This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE. + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetEncoderMode().*/ + + uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC1Filter; /*!< Specifies the TI1 input filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ + + uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC2Filter; /*!< Specifies the TI2 input filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ + +} LL_TIM_ENCODER_InitTypeDef; + +/** + * @brief TIM Hall sensor interface configuration structure definition. + */ +typedef struct +{ + + uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. + Prescaler must be set to get a maximum counter period longer than the + time interval between 2 consecutive changes on the Hall inputs. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC1Filter; /*!< Specifies the TI1 input filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ + + uint32_t CommutationDelay; /*!< Specifies the compare value to be loaded into the Capture Compare Register. + A positive pulse (TRGO event) is generated with a programmable delay every time + a change occurs on the Hall inputs. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetCompareCH2().*/ +} LL_TIM_HALLSENSOR_InitTypeDef; + +/** + * @brief BDTR (Break and Dead Time) structure definition + */ +typedef struct +{ + uint32_t OSSRState; /*!< Specifies the Off-State selection used in Run mode. + This parameter can be a value of @ref TIM_LL_EC_OSSR + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetOffStates() + + @note This bit-field cannot be modified as long as LOCK level 2 has been programmed. */ + + uint32_t OSSIState; /*!< Specifies the Off-State used in Idle state. + This parameter can be a value of @ref TIM_LL_EC_OSSI + + This feature can be modified afterwards using unitary function @ref LL_TIM_SetOffStates() + + @note This bit-field cannot be modified as long as LOCK level 2 has been programmed. */ + + uint32_t LockLevel; /*!< Specifies the LOCK level parameters. + This parameter can be a value of @ref TIM_LL_EC_LOCKLEVEL + + @note The LOCK bits can be written only once after the reset. Once the TIMx_BDTR register + has been written, their content is frozen until the next reset.*/ + + uint8_t DeadTime; /*!< Specifies the delay time between the switching-off and the + switching-on of the outputs. + This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF. + + This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetDeadTime() + + @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been programmed. */ + + uint16_t BreakState; /*!< Specifies whether the TIM Break input is enabled or not. + This parameter can be a value of @ref TIM_LL_EC_BREAK_ENABLE + + This feature can be modified afterwards using unitary functions @ref LL_TIM_EnableBRK() or @ref LL_TIM_DisableBRK() + + @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */ + + uint32_t BreakPolarity; /*!< Specifies the TIM Break Input pin polarity. + This parameter can be a value of @ref TIM_LL_EC_BREAK_POLARITY + + This feature can be modified afterwards using unitary function @ref LL_TIM_ConfigBRK() + + @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */ + + uint32_t AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not. + This parameter can be a value of @ref TIM_LL_EC_AUTOMATICOUTPUT_ENABLE + + This feature can be modified afterwards using unitary functions @ref LL_TIM_EnableAutomaticOutput() or @ref LL_TIM_DisableAutomaticOutput() + + @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */ +} LL_TIM_BDTR_InitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIM_LL_Exported_Constants TIM Exported Constants + * @{ + */ + +/** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_TIM_ReadReg function. + * @{ + */ +#define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */ +#define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */ +#define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */ +#define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */ +#define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */ +#define LL_TIM_SR_COMIF TIM_SR_COMIF /*!< COM interrupt flag */ +#define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */ +#define LL_TIM_SR_BIF TIM_SR_BIF /*!< Break interrupt flag */ +#define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */ +#define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */ +#define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */ +#define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_EC_BREAK_ENABLE Break Enable + * @{ + */ +#define LL_TIM_BREAK_DISABLE 0x00000000U /*!< Break function disabled */ +#define LL_TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break function enabled */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_AUTOMATICOUTPUT_ENABLE Automatic output enable + * @{ + */ +#define LL_TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */ +#define LL_TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** @defgroup TIM_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions. + * @{ + */ +#define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */ +#define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */ +#define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */ +#define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */ +#define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */ +#define LL_TIM_DIER_COMIE TIM_DIER_COMIE /*!< COM interrupt enable */ +#define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */ +#define LL_TIM_DIER_BIE TIM_DIER_BIE /*!< Break interrupt enable */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_UPDATESOURCE Update Source + * @{ + */ +#define LL_TIM_UPDATESOURCE_REGULAR 0x00000000U /*!< Counter overflow/underflow, Setting the UG bit or Update generation through the slave mode controller generates an update request */ +#define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode + * @{ + */ +#define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter is not stopped at update event */ +#define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter stops counting at the next update event */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode + * @{ + */ +#define LL_TIM_COUNTERMODE_UP 0x00000000U /*!TIMx_CCRy else active.*/ +#define LL_TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!TIMx_CCRy else inactive*/ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity + * @{ + */ +#define LL_TIM_OCPOLARITY_HIGH 0x00000000U /*!< OCxactive high*/ +#define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_OCIDLESTATE Output Configuration Idle State + * @{ + */ +#define LL_TIM_OCIDLESTATE_LOW 0x00000000U /*!__REG__, (__VALUE__)) + +/** + * @brief Read a value in TIM register. + * @param __INSTANCE__ TIM Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__) +/** + * @} + */ + +/** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros + * @{ + */ + +/** + * @brief HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration. + * @note ex: @ref __LL_TIM_CALC_DEADTIME (80000000, @ref LL_TIM_GetClockDivision (), 120); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __CKD__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @param __DT__ deadtime duration (in ns) + * @retval DTG[0:7] + */ +#define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \ + ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \ + (((uint64_t)((__DT__)*1000U)) < ((64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\ + (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\ + (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\ + 0U) + +/** + * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. + * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __CNTCLK__ counter clock frequency (in Hz) + * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ + (((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)(((__TIMCLK__)/(__CNTCLK__)) - 1U) : 0U) + +/** + * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. + * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __FREQ__ output signal frequency (in Hz) + * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ + ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) + +/** + * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay. + * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __DELAY__ timer output compare active/inactive delay (in us) + * @retval Compare value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ + ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ + / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) + +/** + * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode). + * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __DELAY__ timer output compare active/inactive delay (in us) + * @param __PULSE__ pulse duration (in us) + * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ + ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \ + + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__)))) + +/** + * @brief HELPER macro retrieving the ratio of the input capture prescaler + * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ()); + * @param __ICPSC__ This parameter can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + * @retval Input capture prescaler ratio (1, 2, 4 or 8) + */ +#define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \ + ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos))) + + +/** + * @} + */ + + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup TIM_LL_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @defgroup TIM_LL_EF_Time_Base Time Base configuration + * @{ + */ +/** + * @brief Enable timer counter. + * @rmtoll CR1 CEN LL_TIM_EnableCounter + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_CEN); +} + +/** + * @brief Disable timer counter. + * @rmtoll CR1 CEN LL_TIM_DisableCounter + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN); +} + +/** + * @brief Indicates whether the timer counter is enabled. + * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL); +} + +/** + * @brief Enable update event generation. + * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS); +} + +/** + * @brief Disable update event generation. + * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_UDIS); +} + +/** + * @brief Indicates whether update event generation is enabled. + * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent + * @param TIMx Timer instance + * @retval Inverted state of bit (0 or 1). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (uint32_t)RESET) ? 1UL : 0UL); +} + +/** + * @brief Set update event source + * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events + * generate an update interrupt or DMA request if enabled: + * - Counter overflow/underflow + * - Setting the UG bit + * - Update generation through the slave mode controller + * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter + * overflow/underflow generates an update interrupt or DMA request if enabled. + * @rmtoll CR1 URS LL_TIM_SetUpdateSource + * @param TIMx Timer instance + * @param UpdateSource This parameter can be one of the following values: + * @arg @ref LL_TIM_UPDATESOURCE_REGULAR + * @arg @ref LL_TIM_UPDATESOURCE_COUNTER + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource); +} + +/** + * @brief Get actual event update source + * @rmtoll CR1 URS LL_TIM_GetUpdateSource + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_UPDATESOURCE_REGULAR + * @arg @ref LL_TIM_UPDATESOURCE_COUNTER + */ +__STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS)); +} + +/** + * @brief Set one pulse mode (one shot v.s. repetitive). + * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode + * @param TIMx Timer instance + * @param OnePulseMode This parameter can be one of the following values: + * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE + * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode); +} + +/** + * @brief Get actual one pulse mode. + * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE + * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE + */ +__STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM)); +} + +/** + * @brief Set the timer counter counting mode. + * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to + * check whether or not the counter mode selection feature is supported + * by a timer instance. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n + * CR1 CMS LL_TIM_SetCounterMode + * @param TIMx Timer instance + * @param CounterMode This parameter can be one of the following values: + * @arg @ref LL_TIM_COUNTERMODE_UP + * @arg @ref LL_TIM_COUNTERMODE_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP + * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode) +{ + MODIFY_REG(TIMx->CR1, (TIM_CR1_DIR | TIM_CR1_CMS), CounterMode); +} + +/** + * @brief Get actual counter mode. + * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to + * check whether or not the counter mode selection feature is supported + * by a timer instance. + * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n + * CR1 CMS LL_TIM_GetCounterMode + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_COUNTERMODE_UP + * @arg @ref LL_TIM_COUNTERMODE_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP + * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN + */ +__STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS)); +} + +/** + * @brief Enable auto-reload (ARR) preload. + * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_ARPE); +} + +/** + * @brief Disable auto-reload (ARR) preload. + * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE); +} + +/** + * @brief Indicates whether auto-reload (ARR) preload is enabled. + * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); +} + +/** + * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters. + * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check + * whether or not the clock division feature is supported by the timer + * instance. + * @rmtoll CR1 CKD LL_TIM_SetClockDivision + * @param TIMx Timer instance + * @param ClockDivision This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); +} + +/** + * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters. + * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check + * whether or not the clock division feature is supported by the timer + * instance. + * @rmtoll CR1 CKD LL_TIM_GetClockDivision + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + */ +__STATIC_INLINE uint32_t LL_TIM_GetClockDivision(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD)); +} + +/** + * @brief Set the counter value. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @rmtoll CNT CNT LL_TIM_SetCounter + * @param TIMx Timer instance + * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF or 0xFFFFFFFF) + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter) +{ + WRITE_REG(TIMx->CNT, Counter); +} + +/** + * @brief Get the counter value. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @rmtoll CNT CNT LL_TIM_GetCounter + * @param TIMx Timer instance + * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF or 0xFFFFFFFF) + */ +__STATIC_INLINE uint32_t LL_TIM_GetCounter(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CNT)); +} + +/** + * @brief Get the current direction of the counter + * @rmtoll CR1 DIR LL_TIM_GetDirection + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_COUNTERDIRECTION_UP + * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN + */ +__STATIC_INLINE uint32_t LL_TIM_GetDirection(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); +} + +/** + * @brief Set the prescaler value. + * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1). + * @note The prescaler can be changed on the fly as this control register is buffered. The new + * prescaler ratio is taken into account at the next update event. + * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter + * @rmtoll PSC PSC LL_TIM_SetPrescaler + * @param TIMx Timer instance + * @param Prescaler between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler) +{ + WRITE_REG(TIMx->PSC, Prescaler); +} + +/** + * @brief Get the prescaler value. + * @rmtoll PSC PSC LL_TIM_GetPrescaler + * @param TIMx Timer instance + * @retval Prescaler value between Min_Data=0 and Max_Data=65535 + */ +__STATIC_INLINE uint32_t LL_TIM_GetPrescaler(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->PSC)); +} + +/** + * @brief Set the auto-reload value. + * @note The counter is blocked while the auto-reload value is null. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter + * @rmtoll ARR ARR LL_TIM_SetAutoReload + * @param TIMx Timer instance + * @param AutoReload between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload) +{ + WRITE_REG(TIMx->ARR, AutoReload); +} + +/** + * @brief Get the auto-reload value. + * @rmtoll ARR ARR LL_TIM_GetAutoReload + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @param TIMx Timer instance + * @retval Auto-reload value + */ +__STATIC_INLINE uint32_t LL_TIM_GetAutoReload(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->ARR)); +} + +/** + * @brief Set the repetition counter value. + * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a repetition counter. + * @rmtoll RCR REP LL_TIM_SetRepetitionCounter + * @param TIMx Timer instance + * @param RepetitionCounter between Min_Data=0 and Max_Data=255 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter) +{ + WRITE_REG(TIMx->RCR, RepetitionCounter); +} + +/** + * @brief Get the repetition counter value. + * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a repetition counter. + * @rmtoll RCR REP LL_TIM_GetRepetitionCounter + * @param TIMx Timer instance + * @retval Repetition counter value + */ +__STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->RCR)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration + * @{ + */ +/** + * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. + * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written, + * they are updated only when a commutation event (COM) occurs. + * @note Only on channels that have a complementary output. + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_EnablePreload(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR2, TIM_CR2_CCPC); +} + +/** + * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_DisablePreload(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC); +} + +/** + * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM). + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate + * @param TIMx Timer instance + * @param CCUpdateSource This parameter can be one of the following values: + * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY + * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetUpdate(TIM_TypeDef *TIMx, uint32_t CCUpdateSource) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_CCUS, CCUpdateSource); +} + +/** + * @brief Set the trigger of the capture/compare DMA request. + * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger + * @param TIMx Timer instance + * @param DMAReqTrigger This parameter can be one of the following values: + * @arg @ref LL_TIM_CCDMAREQUEST_CC + * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger); +} + +/** + * @brief Get actual trigger of the capture/compare DMA request. + * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_CCDMAREQUEST_CC + * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE + */ +__STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS)); +} + +/** + * @brief Set the lock level to freeze the + * configuration of several capture/compare parameters. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * the lock mechanism is supported by a timer instance. + * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel + * @param TIMx Timer instance + * @param LockLevel This parameter can be one of the following values: + * @arg @ref LL_TIM_LOCKLEVEL_OFF + * @arg @ref LL_TIM_LOCKLEVEL_1 + * @arg @ref LL_TIM_LOCKLEVEL_2 + * @arg @ref LL_TIM_LOCKLEVEL_3 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetLockLevel(TIM_TypeDef *TIMx, uint32_t LockLevel) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_LOCK, LockLevel); +} + +/** + * @brief Enable capture/compare channels. + * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n + * CCER CC1NE LL_TIM_CC_EnableChannel\n + * CCER CC2E LL_TIM_CC_EnableChannel\n + * CCER CC2NE LL_TIM_CC_EnableChannel\n + * CCER CC3E LL_TIM_CC_EnableChannel\n + * CCER CC3NE LL_TIM_CC_EnableChannel\n + * CCER CC4E LL_TIM_CC_EnableChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + SET_BIT(TIMx->CCER, Channels); +} + +/** + * @brief Disable capture/compare channels. + * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n + * CCER CC1NE LL_TIM_CC_DisableChannel\n + * CCER CC2E LL_TIM_CC_DisableChannel\n + * CCER CC2NE LL_TIM_CC_DisableChannel\n + * CCER CC3E LL_TIM_CC_DisableChannel\n + * CCER CC3NE LL_TIM_CC_DisableChannel\n + * CCER CC4E LL_TIM_CC_DisableChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + CLEAR_BIT(TIMx->CCER, Channels); +} + +/** + * @brief Indicate whether channel(s) is(are) enabled. + * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n + * CCER CC1NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC2E LL_TIM_CC_IsEnabledChannel\n + * CCER CC2NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC3E LL_TIM_CC_IsEnabledChannel\n + * CCER CC3NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC4E LL_TIM_CC_IsEnabledChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + return ((READ_BIT(TIMx->CCER, Channels) == (Channels)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Output_Channel Output channel configuration + * @{ + */ +/** + * @brief Configure an output channel. + * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n + * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n + * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n + * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n + * CCER CC1P LL_TIM_OC_ConfigOutput\n + * CCER CC2P LL_TIM_OC_ConfigOutput\n + * CCER CC3P LL_TIM_OC_ConfigOutput\n + * CCER CC4P LL_TIM_OC_ConfigOutput\n + * CR2 OIS1 LL_TIM_OC_ConfigOutput\n + * CR2 OIS2 LL_TIM_OC_ConfigOutput\n + * CR2 OIS3 LL_TIM_OC_ConfigOutput\n + * CR2 OIS4 LL_TIM_OC_ConfigOutput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW + * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); + MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), + (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); + MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), + (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Define the behavior of the output reference signal OCxREF from which + * OCx and OCxN (when relevant) are derived. + * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n + * CCMR1 OC2M LL_TIM_OC_SetMode\n + * CCMR2 OC3M LL_TIM_OC_SetMode\n + * CCMR2 OC4M LL_TIM_OC_SetMode + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_TIM_OCMODE_FROZEN + * @arg @ref LL_TIM_OCMODE_ACTIVE + * @arg @ref LL_TIM_OCMODE_INACTIVE + * @arg @ref LL_TIM_OCMODE_TOGGLE + * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE + * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE + * @arg @ref LL_TIM_OCMODE_PWM1 + * @arg @ref LL_TIM_OCMODE_PWM2 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); +} + +/** + * @brief Get the output compare mode of an output channel. + * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n + * CCMR1 OC2M LL_TIM_OC_GetMode\n + * CCMR2 OC3M LL_TIM_OC_GetMode\n + * CCMR2 OC4M LL_TIM_OC_GetMode + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCMODE_FROZEN + * @arg @ref LL_TIM_OCMODE_ACTIVE + * @arg @ref LL_TIM_OCMODE_INACTIVE + * @arg @ref LL_TIM_OCMODE_TOGGLE + * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE + * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE + * @arg @ref LL_TIM_OCMODE_PWM1 + * @arg @ref LL_TIM_OCMODE_PWM2 + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); +} + +/** + * @brief Set the polarity of an output channel. + * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n + * CCER CC1NP LL_TIM_OC_SetPolarity\n + * CCER CC2P LL_TIM_OC_SetPolarity\n + * CCER CC2NP LL_TIM_OC_SetPolarity\n + * CCER CC3P LL_TIM_OC_SetPolarity\n + * CCER CC3NP LL_TIM_OC_SetPolarity\n + * CCER CC4P LL_TIM_OC_SetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Polarity This parameter can be one of the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH + * @arg @ref LL_TIM_OCPOLARITY_LOW + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Get the polarity of an output channel. + * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n + * CCER CC1NP LL_TIM_OC_GetPolarity\n + * CCER CC2P LL_TIM_OC_GetPolarity\n + * CCER CC2NP LL_TIM_OC_GetPolarity\n + * CCER CC3P LL_TIM_OC_GetPolarity\n + * CCER CC3NP LL_TIM_OC_GetPolarity\n + * CCER CC4P LL_TIM_OC_GetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH + * @arg @ref LL_TIM_OCPOLARITY_LOW + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Set the IDLE state of an output channel + * @note This function is significant only for the timer instances + * supporting the break feature. Macro IS_TIM_BREAK_INSTANCE(TIMx) + * can be used to check whether or not a timer instance provides + * a break input. + * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n + * CR2 OIS1N LL_TIM_OC_SetIdleState\n + * CR2 OIS2 LL_TIM_OC_SetIdleState\n + * CR2 OIS2N LL_TIM_OC_SetIdleState\n + * CR2 OIS3 LL_TIM_OC_SetIdleState\n + * CR2 OIS3N LL_TIM_OC_SetIdleState\n + * CR2 OIS4 LL_TIM_OC_SetIdleState + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param IdleState This parameter can be one of the following values: + * @arg @ref LL_TIM_OCIDLESTATE_LOW + * @arg @ref LL_TIM_OCIDLESTATE_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Get the IDLE state of an output channel + * @rmtoll CR2 OIS1 LL_TIM_OC_GetIdleState\n + * CR2 OIS1N LL_TIM_OC_GetIdleState\n + * CR2 OIS2 LL_TIM_OC_GetIdleState\n + * CR2 OIS2N LL_TIM_OC_GetIdleState\n + * CR2 OIS3 LL_TIM_OC_GetIdleState\n + * CR2 OIS3N LL_TIM_OC_GetIdleState\n + * CR2 OIS4 LL_TIM_OC_GetIdleState + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCIDLESTATE_LOW + * @arg @ref LL_TIM_OCIDLESTATE_HIGH + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Enable fast mode for the output channel. + * @note Acts only if the channel is configured in PWM1 or PWM2 mode. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n + * CCMR1 OC2FE LL_TIM_OC_EnableFast\n + * CCMR2 OC3FE LL_TIM_OC_EnableFast\n + * CCMR2 OC4FE LL_TIM_OC_EnableFast + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); + +} + +/** + * @brief Disable fast mode for the output channel. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n + * CCMR1 OC2FE LL_TIM_OC_DisableFast\n + * CCMR2 OC3FE LL_TIM_OC_DisableFast\n + * CCMR2 OC4FE LL_TIM_OC_DisableFast + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); + +} + +/** + * @brief Indicates whether fast mode is enabled for the output channel. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n + * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n + * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n + * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + register uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Enable compare register (TIMx_CCRx) preload for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n + * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n + * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n + * CCMR2 OC4PE LL_TIM_OC_EnablePreload + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Disable compare register (TIMx_CCRx) preload for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n + * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n + * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n + * CCMR2 OC4PE LL_TIM_OC_DisablePreload + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n + * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n + * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n + * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + register uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Enable clearing the output channel on an external event. + * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n + * CCMR1 OC2CE LL_TIM_OC_EnableClear\n + * CCMR2 OC3CE LL_TIM_OC_EnableClear\n + * CCMR2 OC4CE LL_TIM_OC_EnableClear + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Disable clearing the output channel on an external event. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n + * CCMR1 OC2CE LL_TIM_OC_DisableClear\n + * CCMR2 OC3CE LL_TIM_OC_DisableClear\n + * CCMR2 OC4CE LL_TIM_OC_DisableClear + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Indicates clearing the output channel on an external event is enabled for the output channel. + * @note This function enables clearing the output channel on an external event. + * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n + * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n + * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n + * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + register uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge of the Ocx and OCxN signals). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * dead-time insertion feature is supported by a timer instance. + * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter + * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime + * @param TIMx Timer instance + * @param DeadTime between Min_Data=0 and Max_Data=255 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime); +} + +/** + * @brief Set compare value for output channel 1 (TIMx_CCR1). + * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * output channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR1, CompareValue); +} + +/** + * @brief Set compare value for output channel 2 (TIMx_CCR2). + * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * output channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR2, CompareValue); +} + +/** + * @brief Set compare value for output channel 3 (TIMx_CCR3). + * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * output channel is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR3, CompareValue); +} + +/** + * @brief Set compare value for output channel 4 (TIMx_CCR4). + * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * output channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR4, CompareValue); +} + +/** + * @brief Get compare value (TIMx_CCR1) set for output channel 1. + * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * output channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR1)); +} + +/** + * @brief Get compare value (TIMx_CCR2) set for output channel 2. + * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * output channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR2)); +} + +/** + * @brief Get compare value (TIMx_CCR3) set for output channel 3. + * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * output channel 3 is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR3)); +} + +/** + * @brief Get compare value (TIMx_CCR4) set for output channel 4. + * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * output channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR4)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Input_Channel Input channel configuration + * @{ + */ +/** + * @brief Configure input channel. + * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n + * CCMR1 IC1PSC LL_TIM_IC_Config\n + * CCMR1 IC1F LL_TIM_IC_Config\n + * CCMR1 CC2S LL_TIM_IC_Config\n + * CCMR1 IC2PSC LL_TIM_IC_Config\n + * CCMR1 IC2F LL_TIM_IC_Config\n + * CCMR2 CC3S LL_TIM_IC_Config\n + * CCMR2 IC3PSC LL_TIM_IC_Config\n + * CCMR2 IC3F LL_TIM_IC_Config\n + * CCMR2 CC4S LL_TIM_IC_Config\n + * CCMR2 IC4PSC LL_TIM_IC_Config\n + * CCMR2 IC4F LL_TIM_IC_Config\n + * CCER CC1P LL_TIM_IC_Config\n + * CCER CC1NP LL_TIM_IC_Config\n + * CCER CC2P LL_TIM_IC_Config\n + * CCER CC2NP LL_TIM_IC_Config\n + * CCER CC3P LL_TIM_IC_Config\n + * CCER CC3NP LL_TIM_IC_Config\n + * CCER CC4P LL_TIM_IC_Config\n + * CCER CC4NP LL_TIM_IC_Config + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC + * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8 + * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8 + * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING or @ref LL_TIM_IC_POLARITY_BOTHEDGE + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), + ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]); + MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), + (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Set the active input. + * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n + * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n + * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n + * CCMR2 CC4S LL_TIM_IC_SetActiveInput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICActiveInput This parameter can be one of the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_TRC + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the current active input. + * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n + * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n + * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n + * CCMR2 CC4S LL_TIM_IC_GetActiveInput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_TRC + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the prescaler of input channel. + * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n + * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n + * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n + * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICPrescaler This parameter can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the current prescaler value acting on an input channel. + * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n + * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n + * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n + * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the input filter duration. + * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n + * CCMR1 IC2F LL_TIM_IC_SetFilter\n + * CCMR2 IC3F LL_TIM_IC_SetFilter\n + * CCMR2 IC4F LL_TIM_IC_SetFilter + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICFilter This parameter can be one of the following values: + * @arg @ref LL_TIM_IC_FILTER_FDIV1 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the input filter duration. + * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n + * CCMR1 IC2F LL_TIM_IC_GetFilter\n + * CCMR2 IC3F LL_TIM_IC_GetFilter\n + * CCMR2 IC4F LL_TIM_IC_GetFilter + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_IC_FILTER_FDIV1 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + register const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the input channel polarity. + * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n + * CCER CC1NP LL_TIM_IC_SetPolarity\n + * CCER CC2P LL_TIM_IC_SetPolarity\n + * CCER CC2NP LL_TIM_IC_SetPolarity\n + * CCER CC3P LL_TIM_IC_SetPolarity\n + * CCER CC3NP LL_TIM_IC_SetPolarity\n + * CCER CC4P LL_TIM_IC_SetPolarity\n + * CCER CC4NP LL_TIM_IC_SetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_IC_POLARITY_RISING + * @arg @ref LL_TIM_IC_POLARITY_FALLING + * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), + ICPolarity << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Get the current input channel polarity. + * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n + * CCER CC1NP LL_TIM_IC_GetPolarity\n + * CCER CC2P LL_TIM_IC_GetPolarity\n + * CCER CC2NP LL_TIM_IC_GetPolarity\n + * CCER CC3P LL_TIM_IC_GetPolarity\n + * CCER CC3NP LL_TIM_IC_GetPolarity\n + * CCER CC4P LL_TIM_IC_GetPolarity\n + * CCER CC4NP LL_TIM_IC_GetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_IC_POLARITY_RISING + * @arg @ref LL_TIM_IC_POLARITY_FALLING + * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) +{ + register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> + SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination). + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR2, TIM_CR2_TI1S); +} + +/** + * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input. + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S); +} + +/** + * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input. + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)) ? 1UL : 0UL); +} + +/** + * @brief Get captured value for input channel 1. + * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * input channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR1)); +} + +/** + * @brief Get captured value for input channel 2. + * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * input channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR2)); +} + +/** + * @brief Get captured value for input channel 3. + * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * input channel 3 is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR3)); +} + +/** + * @brief Get captured value for input channel 4. + * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF. + * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a 32 bits counter. + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * input channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR4)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection + * @{ + */ +/** + * @brief Enable external clock mode 2. + * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_EnableExternalClock + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->SMCR, TIM_SMCR_ECE); +} + +/** + * @brief Disable external clock mode 2. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_DisableExternalClock + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE); +} + +/** + * @brief Indicate whether external clock mode 2 is enabled. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)) ? 1UL : 0UL); +} + +/** + * @brief Set the clock source of the counter clock. + * @note when selected clock source is external clock mode 1, the timer input + * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput() + * function. This timer input must be configured by calling + * the @ref LL_TIM_IC_Config() function. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode1. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR SMS LL_TIM_SetClockSource\n + * SMCR ECE LL_TIM_SetClockSource + * @param TIMx Timer instance + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1 + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); +} + +/** + * @brief Set the encoder interface mode. + * @note Macro IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports the encoder mode. + * @rmtoll SMCR SMS LL_TIM_SetEncoderMode + * @param TIMx Timer instance + * @param EncoderMode This parameter can be one of the following values: + * @arg @ref LL_TIM_ENCODERMODE_X2_TI1 + * @arg @ref LL_TIM_ENCODERMODE_X2_TI2 + * @arg @ref LL_TIM_ENCODERMODE_X4_TI12 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration + * @{ + */ +/** + * @brief Set the trigger output (TRGO) used for timer synchronization . + * @note Macro IS_TIM_MASTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance can operate as a master timer. + * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput + * @param TIMx Timer instance + * @param TimerSynchronization This parameter can be one of the following values: + * @arg @ref LL_TIM_TRGO_RESET + * @arg @ref LL_TIM_TRGO_ENABLE + * @arg @ref LL_TIM_TRGO_UPDATE + * @arg @ref LL_TIM_TRGO_CC1IF + * @arg @ref LL_TIM_TRGO_OC1REF + * @arg @ref LL_TIM_TRGO_OC2REF + * @arg @ref LL_TIM_TRGO_OC3REF + * @arg @ref LL_TIM_TRGO_OC4REF + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); +} + +/** + * @brief Set the synchronization mode of a slave timer. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR SMS LL_TIM_SetSlaveMode + * @param TIMx Timer instance + * @param SlaveMode This parameter can be one of the following values: + * @arg @ref LL_TIM_SLAVEMODE_DISABLED + * @arg @ref LL_TIM_SLAVEMODE_RESET + * @arg @ref LL_TIM_SLAVEMODE_GATED + * @arg @ref LL_TIM_SLAVEMODE_TRIGGER + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode); +} + +/** + * @brief Set the selects the trigger input to be used to synchronize the counter. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR TS LL_TIM_SetTriggerInput + * @param TIMx Timer instance + * @param TriggerInput This parameter can be one of the following values: + * @arg @ref LL_TIM_TS_ITR0 + * @arg @ref LL_TIM_TS_ITR1 + * @arg @ref LL_TIM_TS_ITR2 + * @arg @ref LL_TIM_TS_ITR3 + * @arg @ref LL_TIM_TS_TI1F_ED + * @arg @ref LL_TIM_TS_TI1FP1 + * @arg @ref LL_TIM_TS_TI2FP2 + * @arg @ref LL_TIM_TS_ETRF + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput); +} + +/** + * @brief Enable the Master/Slave mode. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->SMCR, TIM_SMCR_MSM); +} + +/** + * @brief Disable the Master/Slave mode. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); +} + +/** + * @brief Indicates whether the Master/Slave mode is enabled. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)) ? 1UL : 0UL); +} + +/** + * @brief Configure the external trigger (ETR) input. + * @note Macro IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an external trigger input. + * @rmtoll SMCR ETP LL_TIM_ConfigETR\n + * SMCR ETPS LL_TIM_ConfigETR\n + * SMCR ETF LL_TIM_ConfigETR + * @param TIMx Timer instance + * @param ETRPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED + * @arg @ref LL_TIM_ETR_POLARITY_INVERTED + * @param ETRPrescaler This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_PRESCALER_DIV1 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV2 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV4 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV8 + * @param ETRFilter This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_FILTER_FDIV1 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler, + uint32_t ETRFilter) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Break_Function Break function configuration + * @{ + */ +/** + * @brief Enable the break function. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR BKE LL_TIM_EnableBRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx) +{ + __IO uint32_t tmpreg; + SET_BIT(TIMx->BDTR, TIM_BDTR_BKE); + /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Disable the break function. + * @rmtoll BDTR BKE LL_TIM_DisableBRK + * @param TIMx Timer instance + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx) +{ + __IO uint32_t tmpreg; + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE); + /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Configure the break input. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR BKP LL_TIM_ConfigBRK + * @param TIMx Timer instance + * @param BreakPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_BREAK_POLARITY_LOW + * @arg @ref LL_TIM_BREAK_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity) +{ + __IO uint32_t tmpreg; + MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity); + /* Note: Any write operation to BKP bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n + * BDTR OSSR LL_TIM_SetOffStates + * @param TIMx Timer instance + * @param OffStateIdle This parameter can be one of the following values: + * @arg @ref LL_TIM_OSSI_DISABLE + * @arg @ref LL_TIM_OSSI_ENABLE + * @param OffStateRun This parameter can be one of the following values: + * @arg @ref LL_TIM_OSSR_DISABLE + * @arg @ref LL_TIM_OSSR_ENABLE + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetOffStates(TIM_TypeDef *TIMx, uint32_t OffStateIdle, uint32_t OffStateRun) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun); +} + +/** + * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableAutomaticOutput(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->BDTR, TIM_BDTR_AOE); +} + +/** + * @brief Disable automatic output (MOE can be set only by software). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableAutomaticOutput(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE); +} + +/** + * @brief Indicate whether automatic output is enabled. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)) ? 1UL : 0UL); +} + +/** + * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register). + * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by + * software and is reset in case of break or break2 event + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableAllOutputs(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->BDTR, TIM_BDTR_MOE); +} + +/** + * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register). + * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by + * software and is reset in case of break or break2 event. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableAllOutputs(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE); +} + +/** + * @brief Indicates whether outputs are enabled. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration + * @{ + */ +/** + * @brief Configures the timer DMA burst feature. + * @note Macro IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or + * not a timer instance supports the DMA burst mode. + * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n + * DCR DBA LL_TIM_ConfigDMABurst + * @param TIMx Timer instance + * @param DMABurstBaseAddress This parameter can be one of the following values: + * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR + * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER + * @arg @ref LL_TIM_DMABURST_BASEADDR_SR + * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER + * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT + * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC + * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR + * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4 + * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR + * @param DMABurstLength This parameter can be one of the following values: + * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER + * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength) +{ + MODIFY_REG(TIMx->DCR, (TIM_DCR_DBL | TIM_DCR_DBA), (DMABurstBaseAddress | DMABurstLength)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Timer_Inputs_Remapping Timer input remapping + * @{ + */ +/** + * @brief Remap TIM inputs (input channel, internal/external triggers). + * @note Macro IS_TIM_REMAP_INSTANCE(TIMx) can be used to check whether or not + * a some timer inputs can be remapped. + * @rmtoll TIM2_OR ITR1_RMP LL_TIM_SetRemap\n + * TIM5_OR TI4_RMP LL_TIM_SetRemap\n + * TIM11_OR TI1_RMP LL_TIM_SetRemap + * @param TIMx Timer instance + * @param Remap Remap param depends on the TIMx. Description available only + * in CHM version of the User Manual (not in .pdf). + * Otherwise see Reference Manual description of OR registers. + * + * Below description summarizes "Timer Instance" and "Remap" param combinations: + * + * TIM2: one of the following values + * + * ITR1_RMP can be one of the following values + * @arg @ref LL_TIM_TIM2_ITR1_RMP_TIM8_TRGO + * @arg @ref LL_TIM_TIM2_ITR1_RMP_OTG_FS_SOF + * @arg @ref LL_TIM_TIM2_ITR1_RMP_OTG_HS_SOF + * + * TIM5: one of the following values + * + * @arg @ref LL_TIM_TIM5_TI4_RMP_GPIO + * @arg @ref LL_TIM_TIM5_TI4_RMP_LSI + * @arg @ref LL_TIM_TIM5_TI4_RMP_LSE + * @arg @ref LL_TIM_TIM5_TI4_RMP_RTC + * + * TIM11: one of the following values + * + * @arg @ref LL_TIM_TIM11_TI1_RMP_GPIO + * @arg @ref LL_TIM_TIM11_TI1_RMP_GPIO1 (*) + * @arg @ref LL_TIM_TIM11_TI1_RMP_HSE_RTC + * @arg @ref LL_TIM_TIM11_TI1_RMP_GPIO2 + * @arg @ref LL_TIM_TIM11_TI1_RMP_SPDIFRX (*) + * + * (*) Value not defined in all devices. \n + * + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetRemap(TIM_TypeDef *TIMx, uint32_t Remap) +{ + MODIFY_REG(TIMx->OR, (Remap >> TIMx_OR_RMP_SHIFT), (Remap & TIMx_OR_RMP_MASK)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management + * @{ + */ +/** + * @brief Clear the update interrupt flag (UIF). + * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_UIF)); +} + +/** + * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending). + * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 1 interrupt flag (CC1F). + * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF)); +} + +/** + * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending). + * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 2 interrupt flag (CC2F). + * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF)); +} + +/** + * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending). + * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 3 interrupt flag (CC3F). + * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF)); +} + +/** + * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending). + * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 4 interrupt flag (CC4F). + * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF)); +} + +/** + * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending). + * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the commutation interrupt flag (COMIF). + * @rmtoll SR COMIF LL_TIM_ClearFlag_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_COM(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_COMIF)); +} + +/** + * @brief Indicate whether commutation interrupt flag (COMIF) is set (commutation interrupt is pending). + * @rmtoll SR COMIF LL_TIM_IsActiveFlag_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the trigger interrupt flag (TIF). + * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_TIF)); +} + +/** + * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending). + * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the break interrupt flag (BIF). + * @rmtoll SR BIF LL_TIM_ClearFlag_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_BRK(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_BIF)); +} + +/** + * @brief Indicate whether break interrupt flag (BIF) is set (break interrupt is pending). + * @rmtoll SR BIF LL_TIM_IsActiveFlag_BRK + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF). + * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF)); +} + +/** + * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set (Capture/Compare 1 interrupt is pending). + * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF). + * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF)); +} + +/** + * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set (Capture/Compare 2 over-capture interrupt is pending). + * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF). + * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF)); +} + +/** + * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set (Capture/Compare 3 over-capture interrupt is pending). + * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF). + * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF)); +} + +/** + * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set (Capture/Compare 4 over-capture interrupt is pending). + * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_IT_Management IT-Management + * @{ + */ +/** + * @brief Enable update interrupt (UIE). + * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_UIE); +} + +/** + * @brief Disable update interrupt (UIE). + * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE); +} + +/** + * @brief Indicates whether the update interrupt (UIE) is enabled. + * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 1 interrupt (CC1IE). + * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC1IE); +} + +/** + * @brief Disable capture/compare 1 interrupt (CC1IE). + * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE); +} + +/** + * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled. + * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 2 interrupt (CC2IE). + * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC2IE); +} + +/** + * @brief Disable capture/compare 2 interrupt (CC2IE). + * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE); +} + +/** + * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled. + * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 3 interrupt (CC3IE). + * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC3IE); +} + +/** + * @brief Disable capture/compare 3 interrupt (CC3IE). + * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE); +} + +/** + * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled. + * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 4 interrupt (CC4IE). + * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC4IE); +} + +/** + * @brief Disable capture/compare 4 interrupt (CC4IE). + * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE); +} + +/** + * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled. + * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable commutation interrupt (COMIE). + * @rmtoll DIER COMIE LL_TIM_EnableIT_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_COMIE); +} + +/** + * @brief Disable commutation interrupt (COMIE). + * @rmtoll DIER COMIE LL_TIM_DisableIT_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_COM(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_COMIE); +} + +/** + * @brief Indicates whether the commutation interrupt (COMIE) is enabled. + * @rmtoll DIER COMIE LL_TIM_IsEnabledIT_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable trigger interrupt (TIE). + * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_TIE); +} + +/** + * @brief Disable trigger interrupt (TIE). + * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE); +} + +/** + * @brief Indicates whether the trigger interrupt (TIE) is enabled. + * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable break interrupt (BIE). + * @rmtoll DIER BIE LL_TIM_EnableIT_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_BRK(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_BIE); +} + +/** + * @brief Disable break interrupt (BIE). + * @rmtoll DIER BIE LL_TIM_DisableIT_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_BRK(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_BIE); +} + +/** + * @brief Indicates whether the break interrupt (BIE) is enabled. + * @rmtoll DIER BIE LL_TIM_IsEnabledIT_BRK + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_DMA_Management DMA-Management + * @{ + */ +/** + * @brief Enable update DMA request (UDE). + * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_UDE); +} + +/** + * @brief Disable update DMA request (UDE). + * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE); +} + +/** + * @brief Indicates whether the update DMA request (UDE) is enabled. + * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 1 DMA request (CC1DE). + * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC1DE); +} + +/** + * @brief Disable capture/compare 1 DMA request (CC1DE). + * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE); +} + +/** + * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled. + * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 2 DMA request (CC2DE). + * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC2DE); +} + +/** + * @brief Disable capture/compare 2 DMA request (CC2DE). + * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE); +} + +/** + * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled. + * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 3 DMA request (CC3DE). + * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC3DE); +} + +/** + * @brief Disable capture/compare 3 DMA request (CC3DE). + * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE); +} + +/** + * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled. + * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 4 DMA request (CC4DE). + * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC4DE); +} + +/** + * @brief Disable capture/compare 4 DMA request (CC4DE). + * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE); +} + +/** + * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled. + * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable commutation DMA request (COMDE). + * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_COMDE); +} + +/** + * @brief Disable commutation DMA request (COMDE). + * @rmtoll DIER COMDE LL_TIM_DisableDMAReq_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_COM(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_COMDE); +} + +/** + * @brief Indicates whether the commutation DMA request (COMDE) is enabled. + * @rmtoll DIER COMDE LL_TIM_IsEnabledDMAReq_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)) ? 1UL : 0UL); +} + +/** + * @brief Enable trigger interrupt (TDE). + * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_TDE); +} + +/** + * @brief Disable trigger interrupt (TDE). + * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE); +} + +/** + * @brief Indicates whether the trigger interrupt (TDE) is enabled. + * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management + * @{ + */ +/** + * @brief Generate an update event. + * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_UG); +} + +/** + * @brief Generate Capture/Compare 1 event. + * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC1G); +} + +/** + * @brief Generate Capture/Compare 2 event. + * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC2G); +} + +/** + * @brief Generate Capture/Compare 3 event. + * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC3G); +} + +/** + * @brief Generate Capture/Compare 4 event. + * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC4G); +} + +/** + * @brief Generate commutation event. + * @rmtoll EGR COMG LL_TIM_GenerateEvent_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_COMG); +} + +/** + * @brief Generate trigger event. + * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_TG); +} + +/** + * @brief Generate break event. + * @rmtoll EGR BG LL_TIM_GenerateEvent_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_BRK(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_BG); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions + * @{ + */ + +ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx); +void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct); +ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct); +void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); +ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); +void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct); +void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); +ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); +void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); +ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); +void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); +ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_TIM_H */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h new file mode 100644 index 0000000..eedcde8 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h @@ -0,0 +1,2521 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_usart.h + * @author MCD Application Team + * @brief Header file of USART LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_USART_H +#define __STM32F4xx_LL_USART_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (USART1) || defined (USART2) || defined (USART3) || defined (USART6) || defined (UART4) || defined (UART5) || defined (UART7) || defined (UART8) || defined (UART9) || defined (UART10) + +/** @defgroup USART_LL USART + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup USART_LL_Private_Constants USART Private Constants + * @{ + */ + +/* Defines used for the bit position in the register and perform offsets*/ +#define USART_POSITION_GTPR_GT USART_GTPR_GT_Pos +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_Private_Macros USART Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_ES_INIT USART Exported Init structures + * @{ + */ + +/** + * @brief LL USART Init Structure definition + */ +typedef struct +{ + uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/ + + uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. + This parameter can be a value of @ref USART_LL_EC_DATAWIDTH. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/ + + uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. + This parameter can be a value of @ref USART_LL_EC_STOPBITS. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/ + + uint32_t Parity; /*!< Specifies the parity mode. + This parameter can be a value of @ref USART_LL_EC_PARITY. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/ + + uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_DIRECTION. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/ + + uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_HWCONTROL. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/ + + uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8. + This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/ + +} LL_USART_InitTypeDef; + +/** + * @brief LL USART Clock Init Structure definition + */ +typedef struct +{ + uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_CLOCK. + + USART HW configuration can be modified afterwards using unitary functions + @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput(). + For more details, refer to description of this function. */ + + uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock. + This parameter can be a value of @ref USART_LL_EC_POLARITY. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity(). + For more details, refer to description of this function. */ + + uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made. + This parameter can be a value of @ref USART_LL_EC_PHASE. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase(). + For more details, refer to description of this function. */ + + uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted + data bit (MSB) has to be output on the SCLK pin in synchronous mode. + This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput(). + For more details, refer to description of this function. */ + +} LL_USART_ClockInitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup USART_LL_Exported_Constants USART Exported Constants + * @{ + */ + +/** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_USART_ReadReg function + * @{ + */ +#define LL_USART_SR_PE USART_SR_PE /*!< Parity error flag */ +#define LL_USART_SR_FE USART_SR_FE /*!< Framing error flag */ +#define LL_USART_SR_NE USART_SR_NE /*!< Noise detected flag */ +#define LL_USART_SR_ORE USART_SR_ORE /*!< Overrun error flag */ +#define LL_USART_SR_IDLE USART_SR_IDLE /*!< Idle line detected flag */ +#define LL_USART_SR_RXNE USART_SR_RXNE /*!< Read data register not empty flag */ +#define LL_USART_SR_TC USART_SR_TC /*!< Transmission complete flag */ +#define LL_USART_SR_TXE USART_SR_TXE /*!< Transmit data register empty flag */ +#define LL_USART_SR_LBD USART_SR_LBD /*!< LIN break detection flag */ +#define LL_USART_SR_CTS USART_SR_CTS /*!< CTS flag */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions + * @{ + */ +#define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */ +#define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */ +#define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */ +#define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */ +#define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */ +#define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */ +#define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */ +#define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_DIRECTION Communication Direction + * @{ + */ +#define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */ +#define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */ +#define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */ +#define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_PARITY Parity Control + * @{ + */ +#define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */ +#define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */ +#define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_WAKEUP Wakeup + * @{ + */ +#define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */ +#define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_DATAWIDTH Datawidth + * @{ + */ +#define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */ +#define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_OVERSAMPLING Oversampling + * @{ + */ +#define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */ +#define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_EC_CLOCK Clock Signal + * @{ + */ + +#define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */ +#define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse + * @{ + */ +#define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */ +#define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_PHASE Clock Phase + * @{ + */ +#define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */ +#define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_POLARITY Clock Polarity + * @{ + */ +#define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/ +#define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_STOPBITS Stop Bits + * @{ + */ +#define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */ +#define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */ +#define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */ +#define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_HWCONTROL Hardware Control + * @{ + */ +#define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */ +#define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */ +#define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */ +#define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_IRDA_POWER IrDA Power + * @{ + */ +#define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */ +#define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length + * @{ + */ +#define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */ +#define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup USART_LL_Exported_Macros USART Exported Macros + * @{ + */ + +/** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in USART register + * @param __INSTANCE__ USART Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in USART register + * @param __INSTANCE__ USART Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper + * @{ + */ + +/** + * @brief Compute USARTDIV value according to Peripheral Clock and + * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case + */ +#define __LL_USART_DIV_SAMPLING8_100(__PERIPHCLK__, __BAUDRATE__) ((uint32_t)((((uint64_t)(__PERIPHCLK__))*25)/(2*((uint64_t)(__BAUDRATE__))))) +#define __LL_USART_DIVMANT_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__))/100) +#define __LL_USART_DIVFRAQ_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) ((((__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 8) + 50) / 100) +/* UART BRR = mantissa + overflow + fraction + = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07) */ +#define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ + ((__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0xF8) << 1)) + \ + (__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0x07)) + +/** + * @brief Compute USARTDIV value according to Peripheral Clock and + * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case + */ +#define __LL_USART_DIV_SAMPLING16_100(__PERIPHCLK__, __BAUDRATE__) ((uint32_t)((((uint64_t)(__PERIPHCLK__))*25)/(4*((uint64_t)(__BAUDRATE__))))) +#define __LL_USART_DIVMANT_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__))/100) +#define __LL_USART_DIVFRAQ_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) ((((__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 16) + 50) / 100) +/* USART BRR = mantissa + overflow + fraction + = (USART DIVMANT << 4) + (USART DIVFRAQ & 0xF0) + (USART DIVFRAQ & 0x0F) */ +#define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ + (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0xF0)) + \ + (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0x0F)) + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup USART_LL_Exported_Functions USART Exported Functions + * @{ + */ + +/** @defgroup USART_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief USART Enable + * @rmtoll CR1 UE LL_USART_Enable + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_UE); +} + +/** + * @brief USART Disable (all USART prescalers and outputs are disabled) + * @note When USART is disabled, USART prescalers and outputs are stopped immediately, + * and current operations are discarded. The configuration of the USART is kept, but all the status + * flags, in the USARTx_SR are set to their default values. + * @rmtoll CR1 UE LL_USART_Disable + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_UE); +} + +/** + * @brief Indicate if USART is enabled + * @rmtoll CR1 UE LL_USART_IsEnabled + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)); +} + +/** + * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit) + * @rmtoll CR1 RE LL_USART_EnableDirectionRx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RE); +} + +/** + * @brief Receiver Disable + * @rmtoll CR1 RE LL_USART_DisableDirectionRx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RE); +} + +/** + * @brief Transmitter Enable + * @rmtoll CR1 TE LL_USART_EnableDirectionTx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TE); +} + +/** + * @brief Transmitter Disable + * @rmtoll CR1 TE LL_USART_DisableDirectionTx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TE); +} + +/** + * @brief Configure simultaneously enabled/disabled states + * of Transmitter and Receiver + * @rmtoll CR1 RE LL_USART_SetTransferDirection\n + * CR1 TE LL_USART_SetTransferDirection + * @param USARTx USART Instance + * @param TransferDirection This parameter can be one of the following values: + * @arg @ref LL_USART_DIRECTION_NONE + * @arg @ref LL_USART_DIRECTION_RX + * @arg @ref LL_USART_DIRECTION_TX + * @arg @ref LL_USART_DIRECTION_TX_RX + * @retval None + */ +__STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection); +} + +/** + * @brief Return enabled/disabled states of Transmitter and Receiver + * @rmtoll CR1 RE LL_USART_GetTransferDirection\n + * CR1 TE LL_USART_GetTransferDirection + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_DIRECTION_NONE + * @arg @ref LL_USART_DIRECTION_RX + * @arg @ref LL_USART_DIRECTION_TX + * @arg @ref LL_USART_DIRECTION_TX_RX + */ +__STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE)); +} + +/** + * @brief Configure Parity (enabled/disabled and parity mode if enabled). + * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. + * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position + * (9th or 8th bit depending on data width) and parity is checked on the received data. + * @rmtoll CR1 PS LL_USART_SetParity\n + * CR1 PCE LL_USART_SetParity + * @param USARTx USART Instance + * @param Parity This parameter can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + * @retval None + */ +__STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity); +} + +/** + * @brief Return Parity configuration (enabled/disabled and parity mode if enabled) + * @rmtoll CR1 PS LL_USART_GetParity\n + * CR1 PCE LL_USART_GetParity + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + */ +__STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE)); +} + +/** + * @brief Set Receiver Wake Up method from Mute mode. + * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod + * @param USARTx USART Instance + * @param Method This parameter can be one of the following values: + * @arg @ref LL_USART_WAKEUP_IDLELINE + * @arg @ref LL_USART_WAKEUP_ADDRESSMARK + * @retval None + */ +__STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method); +} + +/** + * @brief Return Receiver Wake Up method from Mute mode + * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_WAKEUP_IDLELINE + * @arg @ref LL_USART_WAKEUP_ADDRESSMARK + */ +__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE)); +} + +/** + * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits) + * @rmtoll CR1 M LL_USART_SetDataWidth + * @param USARTx USART Instance + * @param DataWidth This parameter can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + * @retval None + */ +__STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth); +} + +/** + * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits) + * @rmtoll CR1 M LL_USART_GetDataWidth + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + */ +__STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M)); +} + +/** + * @brief Set Oversampling to 8-bit or 16-bit mode + * @rmtoll CR1 OVER8 LL_USART_SetOverSampling + * @param USARTx USART Instance + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling); +} + +/** + * @brief Return Oversampling mode + * @rmtoll CR1 OVER8 LL_USART_GetOverSampling + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + */ +__STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8)); +} + +/** + * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput + * @param USARTx USART Instance + * @param LastBitClockPulse This parameter can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + * @retval None + */ +__STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse); +} + +/** + * @brief Retrieve Clock pulse of the last data bit output configuration + * (Last bit Clock pulse output to the SCLK pin or not) + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + */ +__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL)); +} + +/** + * @brief Select the phase of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPHA LL_USART_SetClockPhase + * @param USARTx USART Instance + * @param ClockPhase This parameter can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + * @retval None + */ +__STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase); +} + +/** + * @brief Return phase of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPHA LL_USART_GetClockPhase + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + */ +__STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA)); +} + +/** + * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPOL LL_USART_SetClockPolarity + * @param USARTx USART Instance + * @param ClockPolarity This parameter can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity); +} + +/** + * @brief Return polarity of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPOL LL_USART_GetClockPolarity + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + */ +__STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL)); +} + +/** + * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse) + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function + * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function + * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function + * @rmtoll CR2 CPHA LL_USART_ConfigClock\n + * CR2 CPOL LL_USART_ConfigClock\n + * CR2 LBCL LL_USART_ConfigClock + * @param USARTx USART Instance + * @param Phase This parameter can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + * @param Polarity This parameter can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + * @param LBCPOutput This parameter can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput); +} + +/** + * @brief Enable Clock output on SCLK pin + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Disable Clock output on SCLK pin + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Indicate if Clock output on SCLK pin is enabled + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)); +} + +/** + * @brief Set the length of the stop bits + * @rmtoll CR2 STOP LL_USART_SetStopBitsLength + * @param USARTx USART Instance + * @param StopBits This parameter can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); +} + +/** + * @brief Retrieve the length of the stop bits + * @rmtoll CR2 STOP LL_USART_GetStopBitsLength + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + */ +__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP)); +} + +/** + * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) + * @note Call of this function is equivalent to following function call sequence : + * - Data Width configuration using @ref LL_USART_SetDataWidth() function + * - Parity Control and mode configuration using @ref LL_USART_SetParity() function + * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function + * @rmtoll CR1 PS LL_USART_ConfigCharacter\n + * CR1 PCE LL_USART_ConfigCharacter\n + * CR1 M LL_USART_ConfigCharacter\n + * CR2 STOP LL_USART_ConfigCharacter + * @param USARTx USART Instance + * @param DataWidth This parameter can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + * @param Parity This parameter can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + * @param StopBits This parameter can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, + uint32_t StopBits) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth); + MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); +} + +/** + * @brief Set Address of the USART node. + * @note This is used in multiprocessor communication during Mute mode or Stop mode, + * for wake up with address mark detection. + * @rmtoll CR2 ADD LL_USART_SetNodeAddress + * @param USARTx USART Instance + * @param NodeAddress 4 bit Address of the USART node. + * @retval None + */ +__STATIC_INLINE void LL_USART_SetNodeAddress(USART_TypeDef *USARTx, uint32_t NodeAddress) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_ADD, (NodeAddress & USART_CR2_ADD)); +} + +/** + * @brief Return 4 bit Address of the USART node as set in ADD field of CR2. + * @note only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) + * @rmtoll CR2 ADD LL_USART_GetNodeAddress + * @param USARTx USART Instance + * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255) + */ +__STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD)); +} + +/** + * @brief Enable RTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_RTSE); +} + +/** + * @brief Disable RTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE); +} + +/** + * @brief Enable CTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_CTSE); +} + +/** + * @brief Disable CTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE); +} + +/** + * @brief Configure HW Flow Control mode (both CTS and RTS) + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n + * CR3 CTSE LL_USART_SetHWFlowCtrl + * @param USARTx USART Instance + * @param HardwareFlowControl This parameter can be one of the following values: + * @arg @ref LL_USART_HWCONTROL_NONE + * @arg @ref LL_USART_HWCONTROL_RTS + * @arg @ref LL_USART_HWCONTROL_CTS + * @arg @ref LL_USART_HWCONTROL_RTS_CTS + * @retval None + */ +__STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl) +{ + MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); +} + +/** + * @brief Return HW Flow Control configuration (both CTS and RTS) + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n + * CR3 CTSE LL_USART_GetHWFlowCtrl + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_HWCONTROL_NONE + * @arg @ref LL_USART_HWCONTROL_RTS + * @arg @ref LL_USART_HWCONTROL_CTS + * @arg @ref LL_USART_HWCONTROL_RTS_CTS + */ +__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE)); +} + +/** + * @brief Enable One bit sampling method + * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_ONEBIT); +} + +/** + * @brief Disable One bit sampling method + * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT); +} + +/** + * @brief Indicate if One bit sampling method is enabled + * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)); +} + +/** + * @brief Configure USART BRR register for achieving expected Baud Rate value. + * @note Compute and set USARTDIV value in BRR Register (full BRR content) + * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values + * @note Peripheral clock and Baud rate values provided as function parameters should be valid + * (Baud rate value != 0) + * @rmtoll BRR BRR LL_USART_SetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @param BaudRate Baud Rate + * @retval None + */ +__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling, + uint32_t BaudRate) +{ + if (OverSampling == LL_USART_OVERSAMPLING_8) + { + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate)); + } + else + { + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); + } +} + +/** + * @brief Return current Baud Rate value, according to USARTDIV present in BRR register + * (full BRR content), and to used Peripheral Clock and Oversampling mode values + * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. + * @rmtoll BRR BRR LL_USART_GetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @retval Baud Rate + */ +__STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling) +{ + register uint32_t usartdiv = 0x0U; + register uint32_t brrresult = 0x0U; + + usartdiv = USARTx->BRR; + + if (OverSampling == LL_USART_OVERSAMPLING_8) + { + if ((usartdiv & 0xFFF7U) != 0U) + { + usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ; + brrresult = (PeriphClk * 2U) / usartdiv; + } + } + else + { + if ((usartdiv & 0xFFFFU) != 0U) + { + brrresult = PeriphClk / usartdiv; + } + } + return (brrresult); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature + * @{ + */ + +/** + * @brief Enable IrDA mode + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_EnableIrda + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Disable IrDA mode + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_DisableIrda + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Indicate if IrDA mode is enabled + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_IsEnabledIrda + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN)); +} + +/** + * @brief Configure IrDA Power Mode (Normal or Low Power) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode + * @param USARTx USART Instance + * @param PowerMode This parameter can be one of the following values: + * @arg @ref LL_USART_IRDA_POWER_NORMAL + * @arg @ref LL_USART_IRDA_POWER_LOW + * @retval None + */ +__STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode) +{ + MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode); +} + +/** + * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_IRDA_POWER_NORMAL + * @arg @ref LL_USART_PHASE_2EDGE + */ +__STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP)); +} + +/** + * @brief Set Irda prescaler value, used for dividing the USART clock source + * to achieve the Irda Low Power frequency (8 bits value) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler + * @param USARTx USART Instance + * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); +} + +/** + * @brief Return Irda prescaler value, used for dividing the USART clock source + * to achieve the Irda Low Power frequency (8 bits value) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler + * @param USARTx USART Instance + * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF) + */ +__STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature + * @{ + */ + +/** + * @brief Enable Smartcard NACK transmission + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_NACK); +} + +/** + * @brief Disable Smartcard NACK transmission + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_NACK); +} + +/** + * @brief Indicate if Smartcard NACK transmission is enabled + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK)); +} + +/** + * @brief Enable Smartcard mode + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_EnableSmartcard + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Disable Smartcard mode + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_DisableSmartcard + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Indicate if Smartcard mode is enabled + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN)); +} + +/** + * @brief Set Smartcard prescaler value, used for dividing the USART clock + * source to provide the SMARTCARD Clock (5 bits value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler + * @param USARTx USART Instance + * @param PrescalerValue Value between Min_Data=0 and Max_Data=31 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); +} + +/** + * @brief Return Smartcard prescaler value, used for dividing the USART clock + * source to provide the SMARTCARD Clock (5 bits value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler + * @param USARTx USART Instance + * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31) + */ +__STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); +} + +/** + * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods + * (GT[7:0] bits : Guard time value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime + * @param USARTx USART Instance + * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_POSITION_GTPR_GT); +} + +/** + * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods + * (GT[7:0] bits : Guard time value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime + * @param USARTx USART Instance + * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF) + */ +__STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_POSITION_GTPR_GT); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature + * @{ + */ + +/** + * @brief Enable Single Wire Half-Duplex mode + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Disable Single Wire Half-Duplex mode + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Indicate if Single Wire Half-Duplex mode is enabled + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature + * @{ + */ + +/** + * @brief Set LIN Break Detection Length + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen + * @param USARTx USART Instance + * @param LINBDLength This parameter can be one of the following values: + * @arg @ref LL_USART_LINBREAK_DETECT_10B + * @arg @ref LL_USART_LINBREAK_DETECT_11B + * @retval None + */ +__STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength); +} + +/** + * @brief Return LIN Break Detection Length + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_LINBREAK_DETECT_10B + * @arg @ref LL_USART_LINBREAK_DETECT_11B + */ +__STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL)); +} + +/** + * @brief Enable LIN mode + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_EnableLIN + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Disable LIN mode + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_DisableLIN + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Indicate if LIN mode is enabled + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services + * @{ + */ + +/** + * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART) + * @note In UART mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * @note Other remaining configurations items related to Asynchronous Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n + * CR2 CLKEN LL_USART_ConfigAsyncMode\n + * CR3 SCEN LL_USART_ConfigAsyncMode\n + * CR3 IREN LL_USART_ConfigAsyncMode\n + * CR3 HDSEL LL_USART_ConfigAsyncMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx) +{ + /* In Asynchronous mode, the following bits must be kept cleared: + - LINEN, CLKEN bits in the USART_CR2 register, + - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Synchronous Mode + * @note In Synchronous mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also sets the USART in Synchronous mode. + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function + * @note Other remaining configurations items related to Synchronous Mode + * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n + * CR2 CLKEN LL_USART_ConfigSyncMode\n + * CR3 SCEN LL_USART_ConfigSyncMode\n + * CR3 IREN LL_USART_ConfigSyncMode\n + * CR3 HDSEL LL_USART_ConfigSyncMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx) +{ + /* In Synchronous mode, the following bits must be kept cleared: + - LINEN bit in the USART_CR2 register, + - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); + /* set the UART/USART in Synchronous mode */ + SET_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in LIN Mode + * @note In LIN mode, the following bits must be kept cleared: + * - STOP and CLKEN bits in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also set the UART/USART in LIN mode. + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function + * @note Other remaining configurations items related to LIN Mode + * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using + * dedicated functions + * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n + * CR2 STOP LL_USART_ConfigLINMode\n + * CR2 LINEN LL_USART_ConfigLINMode\n + * CR3 IREN LL_USART_ConfigLINMode\n + * CR3 SCEN LL_USART_ConfigLINMode\n + * CR3 HDSEL LL_USART_ConfigLINMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx) +{ + /* In LIN mode, the following bits must be kept cleared: + - STOP and CLKEN bits in the USART_CR2 register, + - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL)); + /* Set the UART/USART in LIN mode */ + SET_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode + * @note In Half Duplex mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * This function also sets the UART/USART in Half Duplex mode. + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function + * @note Other remaining configurations items related to Half Duplex Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n + * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n + * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n + * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n + * CR3 IREN LL_USART_ConfigHalfDuplexMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx) +{ + /* In Half Duplex mode, the following bits must be kept cleared: + - LINEN and CLKEN bits in the USART_CR2 register, + - SCEN and IREN bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN)); + /* set the UART/USART in Half Duplex mode */ + SET_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Smartcard Mode + * @note In Smartcard mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also configures Stop bits to 1.5 bits and + * sets the USART in Smartcard mode (SCEN bit). + * Clock Output is also enabled (CLKEN). + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function + * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function + * @note Other remaining configurations items related to Smartcard Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n + * CR2 STOP LL_USART_ConfigSmartcardMode\n + * CR2 CLKEN LL_USART_ConfigSmartcardMode\n + * CR3 HDSEL LL_USART_ConfigSmartcardMode\n + * CR3 SCEN LL_USART_ConfigSmartcardMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx) +{ + /* In Smartcard mode, the following bits must be kept cleared: + - LINEN bit in the USART_CR2 register, + - IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL)); + /* Configure Stop bits to 1.5 bits */ + /* Synchronous mode is activated by default */ + SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN)); + /* set the UART/USART in Smartcard mode */ + SET_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Irda Mode + * @note In IRDA mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - STOP and CLKEN bits in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also sets the UART/USART in IRDA mode (IREN bit). + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function + * @note Other remaining configurations items related to Irda Mode + * (as Baud Rate, Word length, Power mode, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n + * CR2 CLKEN LL_USART_ConfigIrdaMode\n + * CR2 STOP LL_USART_ConfigIrdaMode\n + * CR3 SCEN LL_USART_ConfigIrdaMode\n + * CR3 HDSEL LL_USART_ConfigIrdaMode\n + * CR3 IREN LL_USART_ConfigIrdaMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx) +{ + /* In IRDA mode, the following bits must be kept cleared: + - LINEN, STOP and CLKEN bits in the USART_CR2 register, + - SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL)); + /* set the UART/USART in IRDA mode */ + SET_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Multi processor Mode + * (several USARTs connected in a network, one of the USARTs can be the master, + * its TX output connected to the RX inputs of the other slaves USARTs). + * @note In MultiProcessor mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * @note Other remaining configurations items related to Multi processor Mode + * (as Baud Rate, Wake Up Method, Node address, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n + * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n + * CR3 SCEN LL_USART_ConfigMultiProcessMode\n + * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n + * CR3 IREN LL_USART_ConfigMultiProcessMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx) +{ + /* In Multi Processor mode, the following bits must be kept cleared: + - LINEN and CLKEN bits in the USART_CR2 register, + - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Check if the USART Parity Error Flag is set or not + * @rmtoll SR PE LL_USART_IsActiveFlag_PE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_PE) == (USART_SR_PE)); +} + +/** + * @brief Check if the USART Framing Error Flag is set or not + * @rmtoll SR FE LL_USART_IsActiveFlag_FE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_FE) == (USART_SR_FE)); +} + +/** + * @brief Check if the USART Noise error detected Flag is set or not + * @rmtoll SR NF LL_USART_IsActiveFlag_NE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_NE) == (USART_SR_NE)); +} + +/** + * @brief Check if the USART OverRun Error Flag is set or not + * @rmtoll SR ORE LL_USART_IsActiveFlag_ORE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_ORE) == (USART_SR_ORE)); +} + +/** + * @brief Check if the USART IDLE line detected Flag is set or not + * @rmtoll SR IDLE LL_USART_IsActiveFlag_IDLE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_IDLE) == (USART_SR_IDLE)); +} + +/** + * @brief Check if the USART Read Data Register Not Empty Flag is set or not + * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE)); +} + +/** + * @brief Check if the USART Transmission Complete Flag is set or not + * @rmtoll SR TC LL_USART_IsActiveFlag_TC + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC)); +} + +/** + * @brief Check if the USART Transmit Data Register Empty Flag is set or not + * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE)); +} + +/** + * @brief Check if the USART LIN Break Detection Flag is set or not + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll SR LBD LL_USART_IsActiveFlag_LBD + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_LBD) == (USART_SR_LBD)); +} + +/** + * @brief Check if the USART CTS Flag is set or not + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll SR CTS LL_USART_IsActiveFlag_nCTS + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_CTS) == (USART_SR_CTS)); +} + +/** + * @brief Check if the USART Send Break Flag is set or not + * @rmtoll CR1 SBK LL_USART_IsActiveFlag_SBK + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_SBK) == (USART_CR1_SBK)); +} + +/** + * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not + * @rmtoll CR1 RWU LL_USART_IsActiveFlag_RWU + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_RWU) == (USART_CR1_RWU)); +} + +/** + * @brief Clear Parity Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * NE, FE, ORE, IDLE would also be cleared. + * @rmtoll SR PE LL_USART_ClearFlag_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Framing Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, ORE, IDLE would also be cleared. + * @rmtoll SR FE LL_USART_ClearFlag_FE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Noise detected Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, FE, ORE, IDLE would also be cleared. + * @rmtoll SR NF LL_USART_ClearFlag_NE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear OverRun Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, FE, IDLE would also be cleared. + * @rmtoll SR ORE LL_USART_ClearFlag_ORE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear IDLE line detected Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, FE, ORE would also be cleared. + * @rmtoll SR IDLE LL_USART_ClearFlag_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Transmission Complete Flag + * @rmtoll SR TC LL_USART_ClearFlag_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_TC)); +} + +/** + * @brief Clear RX Not Empty Flag + * @rmtoll SR RXNE LL_USART_ClearFlag_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_RXNE(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_RXNE)); +} + +/** + * @brief Clear LIN Break Detection Flag + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll SR LBD LL_USART_ClearFlag_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_LBD)); +} + +/** + * @brief Clear CTS Interrupt Flag + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll SR CTS LL_USART_ClearFlag_nCTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_CTS)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable IDLE Interrupt + * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_IDLEIE); +} + +/** + * @brief Enable RX Not Empty Interrupt + * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RXNEIE); +} + +/** + * @brief Enable Transmission Complete Interrupt + * @rmtoll CR1 TCIE LL_USART_EnableIT_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TCIE); +} + +/** + * @brief Enable TX Empty Interrupt + * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TXEIE); +} + +/** + * @brief Enable Parity Error Interrupt + * @rmtoll CR1 PEIE LL_USART_EnableIT_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_PEIE); +} + +/** + * @brief Enable LIN Break Detection Interrupt + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_LBDIE); +} + +/** + * @brief Enable Error Interrupt + * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing + * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). + * 0: Interrupt is inhibited + * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. + * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_EIE); +} + +/** + * @brief Enable CTS Interrupt + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_CTSIE); +} + +/** + * @brief Disable IDLE Interrupt + * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE); +} + +/** + * @brief Disable RX Not Empty Interrupt + * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE); +} + +/** + * @brief Disable Transmission Complete Interrupt + * @rmtoll CR1 TCIE LL_USART_DisableIT_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE); +} + +/** + * @brief Disable TX Empty Interrupt + * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE); +} + +/** + * @brief Disable Parity Error Interrupt + * @rmtoll CR1 PEIE LL_USART_DisableIT_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE); +} + +/** + * @brief Disable LIN Break Detection Interrupt + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE); +} + +/** + * @brief Disable Error Interrupt + * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing + * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). + * 0: Interrupt is inhibited + * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. + * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_EIE); +} + +/** + * @brief Disable CTS Interrupt + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE); +} + +/** + * @brief Check if the USART IDLE Interrupt source is enabled or disabled. + * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)); +} + +/** + * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled. + * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)); +} + +/** + * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled. + * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)); +} + +/** + * @brief Check if the USART TX Empty Interrupt is enabled or disabled. + * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)); +} + +/** + * @brief Check if the USART Parity Error Interrupt is enabled or disabled. + * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)); +} + +/** + * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled. + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE)); +} + +/** + * @brief Check if the USART Error Interrupt is enabled or disabled. + * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)); +} + +/** + * @brief Check if the USART CTS Interrupt is enabled or disabled. + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Enable DMA Mode for reception + * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_DMAR); +} + +/** + * @brief Disable DMA Mode for reception + * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR); +} + +/** + * @brief Check if DMA Mode is enabled for reception + * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)); +} + +/** + * @brief Enable DMA Mode for transmission + * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_DMAT); +} + +/** + * @brief Disable DMA Mode for transmission + * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT); +} + +/** + * @brief Check if DMA Mode is enabled for transmission + * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)); +} + +/** + * @brief Get the data register address used for DMA transfer + * @rmtoll DR DR LL_USART_DMA_GetRegAddr + * @note Address of Data Register is valid for both Transmit and Receive transfers. + * @param USARTx USART Instance + * @retval Address of data register + */ +__STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx) +{ + /* return address of DR register */ + return ((uint32_t) & (USARTx->DR)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Read Receiver Data register (Receive Data value, 8 bits) + * @rmtoll DR DR LL_USART_ReceiveData8 + * @param USARTx USART Instance + * @retval Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx) +{ + return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR)); +} + +/** + * @brief Read Receiver Data register (Receive Data value, 9 bits) + * @rmtoll DR DR LL_USART_ReceiveData9 + * @param USARTx USART Instance + * @retval Value between Min_Data=0x00 and Max_Data=0x1FF + */ +__STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx) +{ + return (uint16_t)(READ_BIT(USARTx->DR, USART_DR_DR)); +} + +/** + * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) + * @rmtoll DR DR LL_USART_TransmitData8 + * @param USARTx USART Instance + * @param Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value) +{ + USARTx->DR = Value; +} + +/** + * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits) + * @rmtoll DR DR LL_USART_TransmitData9 + * @param USARTx USART Instance + * @param Value between Min_Data=0x00 and Max_Data=0x1FF + * @retval None + */ +__STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value) +{ + USARTx->DR = Value & 0x1FFU; +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Execution Execution + * @{ + */ + +/** + * @brief Request Break sending + * @rmtoll CR1 SBK LL_USART_RequestBreakSending + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_SBK); +} + +/** + * @brief Put USART in Mute mode + * @rmtoll CR1 RWU LL_USART_RequestEnterMuteMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RWU); +} + +/** + * @brief Put USART in Active mode + * @rmtoll CR1 RWU LL_USART_RequestExitMuteMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestExitMuteMode(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RWU); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_EF_Init Initialization and de-initialization functions + * @{ + */ +ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx); +ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct); +void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct); +ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct); +void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* USART1 || USART2 || USART3 || USART6 || UART4 || UART5 || UART7 || UART8 || UART9 || UART10 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_USART_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h new file mode 100644 index 0000000..60ea707 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h @@ -0,0 +1,309 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_utils.h + * @author MCD Application Team + * @brief Header file of UTILS LL module. + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The LL UTILS driver contains a set of generic APIs that can be + used by user: + (+) Device electronic signature + (+) Timing functions + (+) PLL configuration functions + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F4xx_LL_UTILS_H +#define __STM32F4xx_LL_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +/** @defgroup UTILS_LL UTILS + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Constants UTILS Private Constants + * @{ + */ + +/* Max delay can be used in LL_mDelay */ +#define LL_MAX_DELAY 0xFFFFFFFFU + +/** + * @brief Unique device ID register base address + */ +#define UID_BASE_ADDRESS UID_BASE + +/** + * @brief Flash size data register base address + */ +#define FLASHSIZE_BASE_ADDRESS FLASHSIZE_BASE + +/** + * @brief Package data register base address + */ +#define PACKAGE_BASE_ADDRESS PACKAGE_BASE + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Macros UTILS Private Macros + * @{ + */ +/** + * @} + */ +/* Exported types ------------------------------------------------------------*/ +/** @defgroup UTILS_LL_ES_INIT UTILS Exported structures + * @{ + */ +/** + * @brief UTILS PLL structure definition + */ +typedef struct +{ + uint32_t PLLM; /*!< Division factor for PLL VCO input clock. + This parameter can be a value of @ref RCC_LL_EC_PLLM_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_PLL_ConfigDomain_SYS(). */ + + uint32_t PLLN; /*!< Multiplication factor for PLL VCO output clock. + This parameter must be a number between Min_Data = @ref RCC_PLLN_MIN_VALUE + and Max_Data = @ref RCC_PLLN_MIN_VALUE + + This feature can be modified afterwards using unitary function + @ref LL_RCC_PLL_ConfigDomain_SYS(). */ + + uint32_t PLLP; /*!< Division for the main system clock. + This parameter can be a value of @ref RCC_LL_EC_PLLP_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_PLL_ConfigDomain_SYS(). */ +} LL_UTILS_PLLInitTypeDef; + +/** + * @brief UTILS System, AHB and APB buses clock configuration structure definition + */ +typedef struct +{ + uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). + This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAHBPrescaler(). */ + + uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_LL_EC_APB1_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAPB1Prescaler(). */ + + uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_LL_EC_APB2_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAPB2Prescaler(). */ + +} LL_UTILS_ClkInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants + * @{ + */ + +/** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation + * @{ + */ +#define LL_UTILS_HSEBYPASS_OFF 0x00000000U /*!< HSE Bypass is not enabled */ +#define LL_UTILS_HSEBYPASS_ON 0x00000001U /*!< HSE Bypass is enabled */ +/** + * @} + */ + +/** @defgroup UTILS_EC_PACKAGETYPE PACKAGE TYPE + * @{ + */ +#define LL_UTILS_PACKAGETYPE_WLCSP36_UFQFPN48_LQFP64 0x00000000U /*!< WLCSP36 or UFQFPN48 or LQFP64 package type */ +#define LL_UTILS_PACKAGETYPE_WLCSP168_FBGA169_LQFP100_LQFP64_UFQFPN48 0x00000100U /*!< WLCSP168 or FBGA169 or LQFP100 or LQFP64 or UFQFPN48 package type */ +#define LL_UTILS_PACKAGETYPE_WLCSP64_WLCSP81_LQFP176_UFBGA176 0x00000200U /*!< WLCSP64 or WLCSP81 or LQFP176 or UFBGA176 package type */ +#define LL_UTILS_PACKAGETYPE_LQFP144_UFBGA144_UFBGA144_UFBGA100 0x00000300U /*!< LQFP144 or UFBGA144 or UFBGA144 or UFBGA100 package type */ +#define LL_UTILS_PACKAGETYPE_LQFP100_LQFP208_TFBGA216 0x00000400U /*!< LQFP100 or LQFP208 or TFBGA216 package type */ +#define LL_UTILS_PACKAGETYPE_LQFP208_TFBGA216 0x00000500U /*!< LQFP208 or TFBGA216 package type */ +#define LL_UTILS_PACKAGETYPE_TQFP64_UFBGA144_LQFP144 0x00000700U /*!< TQFP64 or UFBGA144 or LQFP144 package type */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions + * @{ + */ + +/** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE + * @{ + */ + +/** + * @brief Get Word0 of the unique device identifier (UID based on 96 bits) + * @retval UID[31:0] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word0(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS))); +} + +/** + * @brief Get Word1 of the unique device identifier (UID based on 96 bits) + * @retval UID[63:32] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word1(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U)))); +} + +/** + * @brief Get Word2 of the unique device identifier (UID based on 96 bits) + * @retval UID[95:64] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word2(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U)))); +} + +/** + * @brief Get Flash memory size + * @note This bitfield indicates the size of the device Flash memory expressed in + * Kbytes. As an example, 0x040 corresponds to 64 Kbytes. + * @retval FLASH_SIZE[15:0]: Flash memory size + */ +__STATIC_INLINE uint32_t LL_GetFlashSize(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS)) & 0xFFFF); +} + +/** + * @brief Get Package type + * @retval Returned value can be one of the following values: + * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP36_UFQFPN48_LQFP64 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP168_FBGA169_LQFP100_LQFP64_UFQFPN48 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP64_WLCSP81_LQFP176_UFBGA176 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_LQFP144_UFBGA144_UFBGA144_UFBGA100 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_LQFP100_LQFP208_TFBGA216 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_LQFP208_TFBGA216 (*) + * @arg @ref LL_UTILS_PACKAGETYPE_TQFP64_UFBGA144_LQFP144 (*) + * + * (*) value not defined in all devices. + */ +__STATIC_INLINE uint32_t LL_GetPackageType(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)PACKAGE_BASE_ADDRESS)) & 0x0700U); +} + +/** + * @} + */ + +/** @defgroup UTILS_LL_EF_DELAY DELAY + * @{ + */ + +/** + * @brief This function configures the Cortex-M SysTick source of the time base. + * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) + * @note When a RTOS is used, it is recommended to avoid changing the SysTick + * configuration by calling this function, for a delay use rather osDelay RTOS service. + * @param Ticks Number of ticks + * @retval None + */ +__STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks) +{ + /* Configure the SysTick to have interrupt in 1ms time base */ + SysTick->LOAD = (uint32_t)((HCLKFrequency / Ticks) - 1UL); /* set reload register */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable the Systick Timer */ +} + +void LL_Init1msTick(uint32_t HCLKFrequency); +void LL_mDelay(uint32_t Delay); + +/** + * @} + */ + +/** @defgroup UTILS_EF_SYSTEM SYSTEM + * @{ + */ + +void LL_SetSystemCoreClock(uint32_t HCLKFrequency); +ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_LL_UTILS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c new file mode 100644 index 0000000..6a7910d --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c @@ -0,0 +1,615 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal.c + * @author MCD Application Team + * @brief HAL module driver. + * This is the common part of the HAL initialization + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The common HAL driver contains a set of generic and common APIs that can be + used by the PPP peripheral drivers and the user to start using the HAL. + [..] + The HAL contains two APIs' categories: + (+) Common HAL APIs + (+) Services HAL APIs + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup HAL HAL + * @brief HAL module driver. + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup HAL_Private_Constants + * @{ + */ +/** + * @brief STM32F4xx HAL Driver version number V1.7.10 + */ +#define __STM32F4xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ +#define __STM32F4xx_HAL_VERSION_SUB1 (0x07U) /*!< [23:16] sub1 version */ +#define __STM32F4xx_HAL_VERSION_SUB2 (0x0AU) /*!< [15:8] sub2 version */ +#define __STM32F4xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ +#define __STM32F4xx_HAL_VERSION ((__STM32F4xx_HAL_VERSION_MAIN << 24U)\ + |(__STM32F4xx_HAL_VERSION_SUB1 << 16U)\ + |(__STM32F4xx_HAL_VERSION_SUB2 << 8U )\ + |(__STM32F4xx_HAL_VERSION_RC)) + +#define IDCODE_DEVID_MASK 0x00000FFFU + +/* ------------ RCC registers bit address in the alias region ----------- */ +#define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE) +/* --- MEMRMP Register ---*/ +/* Alias word address of UFB_MODE bit */ +#define MEMRMP_OFFSET SYSCFG_OFFSET +#define UFB_MODE_BIT_NUMBER SYSCFG_MEMRMP_UFB_MODE_Pos +#define UFB_MODE_BB (uint32_t)(PERIPH_BB_BASE + (MEMRMP_OFFSET * 32U) + (UFB_MODE_BIT_NUMBER * 4U)) + +/* --- CMPCR Register ---*/ +/* Alias word address of CMP_PD bit */ +#define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20U) +#define CMP_PD_BIT_NUMBER SYSCFG_CMPCR_CMP_PD_Pos +#define CMPCR_CMP_PD_BB (uint32_t)(PERIPH_BB_BASE + (CMPCR_OFFSET * 32U) + (CMP_PD_BIT_NUMBER * 4U)) + +/* --- MCHDLYCR Register ---*/ +/* Alias word address of BSCKSEL bit */ +#define MCHDLYCR_OFFSET (SYSCFG_OFFSET + 0x30U) +#define BSCKSEL_BIT_NUMBER SYSCFG_MCHDLYCR_BSCKSEL_Pos +#define MCHDLYCR_BSCKSEL_BB (uint32_t)(PERIPH_BB_BASE + (MCHDLYCR_OFFSET * 32U) + (BSCKSEL_BIT_NUMBER * 4U)) +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @addtogroup HAL_Private_Variables + * @{ + */ +__IO uint32_t uwTick; +uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */ +HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */ +/** + * @} + */ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/** @defgroup HAL_Exported_Functions HAL Exported Functions + * @{ + */ + +/** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and Configuration functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Initializes the Flash interface the NVIC allocation and initial clock + configuration. It initializes the systick also when timeout is needed + and the backup domain when enabled. + (+) De-Initializes common part of the HAL. + (+) Configure the time base source to have 1ms time base with a dedicated + Tick interrupt priority. + (++) SysTick timer is used by default as source of time base, but user + can eventually implement his proper time base source (a general purpose + timer for example or other time source), keeping in mind that Time base + duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and + handled in milliseconds basis. + (++) Time base configuration function (HAL_InitTick ()) is called automatically + at the beginning of the program after reset by HAL_Init() or at any time + when clock is configured, by HAL_RCC_ClockConfig(). + (++) Source of time base is configured to generate interrupts at regular + time intervals. Care must be taken if HAL_Delay() is called from a + peripheral ISR process, the Tick interrupt line must have higher priority + (numerically lower) than the peripheral interrupt. Otherwise the caller + ISR process will be blocked. + (++) functions affecting time base configurations are declared as __weak + to make override possible in case of other implementations in user file. +@endverbatim + * @{ + */ + +/** + * @brief This function is used to initialize the HAL Library; it must be the first + * instruction to be executed in the main program (before to call any other + * HAL function), it performs the following: + * Configure the Flash prefetch, instruction and Data caches. + * Configures the SysTick to generate an interrupt each 1 millisecond, + * which is clocked by the HSI (at this stage, the clock is not yet + * configured and thus the system is running from the internal HSI at 16 MHz). + * Set NVIC Group Priority to 4. + * Calls the HAL_MspInit() callback function defined in user file + * "stm32f4xx_hal_msp.c" to do the global low level hardware initialization + * + * @note SysTick is used as time base for the HAL_Delay() function, the application + * need to ensure that the SysTick time base is always set to 1 millisecond + * to have correct HAL operation. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_Init(void) +{ + /* Configure Flash prefetch, Instruction cache, Data cache */ +#if (INSTRUCTION_CACHE_ENABLE != 0U) + __HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); +#endif /* INSTRUCTION_CACHE_ENABLE */ + +#if (DATA_CACHE_ENABLE != 0U) + __HAL_FLASH_DATA_CACHE_ENABLE(); +#endif /* DATA_CACHE_ENABLE */ + +#if (PREFETCH_ENABLE != 0U) + __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); +#endif /* PREFETCH_ENABLE */ + + /* Set Interrupt Group Priority */ + HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); + + /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */ + HAL_InitTick(TICK_INT_PRIORITY); + + /* Init the low level hardware */ + HAL_MspInit(); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief This function de-Initializes common part of the HAL and stops the systick. + * This function is optional. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DeInit(void) +{ + /* Reset of all peripherals */ + __HAL_RCC_APB1_FORCE_RESET(); + __HAL_RCC_APB1_RELEASE_RESET(); + + __HAL_RCC_APB2_FORCE_RESET(); + __HAL_RCC_APB2_RELEASE_RESET(); + + __HAL_RCC_AHB1_FORCE_RESET(); + __HAL_RCC_AHB1_RELEASE_RESET(); + + __HAL_RCC_AHB2_FORCE_RESET(); + __HAL_RCC_AHB2_RELEASE_RESET(); + + __HAL_RCC_AHB3_FORCE_RESET(); + __HAL_RCC_AHB3_RELEASE_RESET(); + + /* De-Init the low level hardware */ + HAL_MspDeInit(); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Initialize the MSP. + * @retval None + */ +__weak void HAL_MspInit(void) +{ + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes the MSP. + * @retval None + */ +__weak void HAL_MspDeInit(void) +{ + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief This function configures the source of the time base. + * The time source is configured to have 1ms time base with a dedicated + * Tick interrupt priority. + * @note This function is called automatically at the beginning of program after + * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig(). + * @note In the default implementation, SysTick timer is the source of time base. + * It is used to generate interrupts at regular time intervals. + * Care must be taken if HAL_Delay() is called from a peripheral ISR process, + * The SysTick interrupt must have higher priority (numerically lower) + * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. + * The function is declared as __weak to be overwritten in case of other + * implementation in user file. + * @param TickPriority Tick interrupt priority. + * @retval HAL status + */ +__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) +{ + /* Configure the SysTick to have interrupt in 1ms time basis*/ + if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U) + { + return HAL_ERROR; + } + + /* Configure the SysTick IRQ priority */ + if (TickPriority < (1UL << __NVIC_PRIO_BITS)) + { + HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U); + uwTickPrio = TickPriority; + } + else + { + return HAL_ERROR; + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup HAL_Exported_Functions_Group2 HAL Control functions + * @brief HAL Control functions + * +@verbatim + =============================================================================== + ##### HAL Control functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Provide a tick value in millisecond + (+) Provide a blocking delay in millisecond + (+) Suspend the time base source interrupt + (+) Resume the time base source interrupt + (+) Get the HAL API driver version + (+) Get the device identifier + (+) Get the device revision identifier + (+) Enable/Disable Debug module during SLEEP mode + (+) Enable/Disable Debug module during STOP mode + (+) Enable/Disable Debug module during STANDBY mode + +@endverbatim + * @{ + */ + +/** + * @brief This function is called to increment a global variable "uwTick" + * used as application time base. + * @note In the default implementation, this variable is incremented each 1ms + * in SysTick ISR. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_IncTick(void) +{ + uwTick += uwTickFreq; +} + +/** + * @brief Provides a tick value in millisecond. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval tick value + */ +__weak uint32_t HAL_GetTick(void) +{ + return uwTick; +} + +/** + * @brief This function returns a tick priority. + * @retval tick priority + */ +uint32_t HAL_GetTickPrio(void) +{ + return uwTickPrio; +} + +/** + * @brief Set new tick Freq. + * @retval Status + */ +HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_TickFreqTypeDef prevTickFreq; + + assert_param(IS_TICKFREQ(Freq)); + + if (uwTickFreq != Freq) + { + /* Back up uwTickFreq frequency */ + prevTickFreq = uwTickFreq; + + /* Update uwTickFreq global variable used by HAL_InitTick() */ + uwTickFreq = Freq; + + /* Apply the new tick Freq */ + status = HAL_InitTick(uwTickPrio); + + if (status != HAL_OK) + { + /* Restore previous tick frequency */ + uwTickFreq = prevTickFreq; + } + } + + return status; +} + +/** + * @brief Return tick frequency. + * @retval tick period in Hz + */ +HAL_TickFreqTypeDef HAL_GetTickFreq(void) +{ + return uwTickFreq; +} + +/** + * @brief This function provides minimum delay (in milliseconds) based + * on variable incremented. + * @note In the default implementation , SysTick timer is the source of time base. + * It is used to generate interrupts at regular time intervals where uwTick + * is incremented. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @param Delay specifies the delay time length, in milliseconds. + * @retval None + */ +__weak void HAL_Delay(uint32_t Delay) +{ + uint32_t tickstart = HAL_GetTick(); + uint32_t wait = Delay; + + /* Add a freq to guarantee minimum wait */ + if (wait < HAL_MAX_DELAY) + { + wait += (uint32_t)(uwTickFreq); + } + + while((HAL_GetTick() - tickstart) < wait) + { + } +} + +/** + * @brief Suspend Tick increment. + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once HAL_SuspendTick() + * is called, the SysTick interrupt will be disabled and so Tick increment + * is suspended. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_SuspendTick(void) +{ + /* Disable SysTick Interrupt */ + SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; +} + +/** + * @brief Resume Tick increment. + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once HAL_ResumeTick() + * is called, the SysTick interrupt will be enabled and so Tick increment + * is resumed. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_ResumeTick(void) +{ + /* Enable SysTick Interrupt */ + SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; +} + +/** + * @brief Returns the HAL revision + * @retval version : 0xXYZR (8bits for each decimal, R for RC) + */ +uint32_t HAL_GetHalVersion(void) +{ + return __STM32F4xx_HAL_VERSION; +} + +/** + * @brief Returns the device revision identifier. + * @retval Device revision identifier + */ +uint32_t HAL_GetREVID(void) +{ + return((DBGMCU->IDCODE) >> 16U); +} + +/** + * @brief Returns the device identifier. + * @retval Device identifier + */ +uint32_t HAL_GetDEVID(void) +{ + return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); +} + +/** + * @brief Enable the Debug Module during SLEEP mode + * @retval None + */ +void HAL_DBGMCU_EnableDBGSleepMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Disable the Debug Module during SLEEP mode + * @retval None + */ +void HAL_DBGMCU_DisableDBGSleepMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Enable the Debug Module during STOP mode + * @retval None + */ +void HAL_DBGMCU_EnableDBGStopMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Disable the Debug Module during STOP mode + * @retval None + */ +void HAL_DBGMCU_DisableDBGStopMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Enable the Debug Module during STANDBY mode + * @retval None + */ +void HAL_DBGMCU_EnableDBGStandbyMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Disable the Debug Module during STANDBY mode + * @retval None + */ +void HAL_DBGMCU_DisableDBGStandbyMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Enables the I/O Compensation Cell. + * @note The I/O compensation cell can be used only when the device supply + * voltage ranges from 2.4 to 3.6 V. + * @retval None + */ +void HAL_EnableCompensationCell(void) +{ + *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)ENABLE; +} + +/** + * @brief Power-down the I/O Compensation Cell. + * @note The I/O compensation cell can be used only when the device supply + * voltage ranges from 2.4 to 3.6 V. + * @retval None + */ +void HAL_DisableCompensationCell(void) +{ + *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)DISABLE; +} + +/** + * @brief Returns first word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw0(void) +{ + return (READ_REG(*((uint32_t *)UID_BASE))); +} + +/** + * @brief Returns second word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw1(void) +{ + return (READ_REG(*((uint32_t *)(UID_BASE + 4U)))); +} + +/** + * @brief Returns third word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw2(void) +{ + return (READ_REG(*((uint32_t *)(UID_BASE + 8U)))); +} + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Enables the Internal FLASH Bank Swapping. + * + * @note This function can be used only for STM32F42xxx/43xxx/469xx/479xx devices. + * + * @note Flash Bank2 mapped at 0x08000000 (and aliased @0x00000000) + * and Flash Bank1 mapped at 0x08100000 (and aliased at 0x00100000) + * + * @retval None + */ +void HAL_EnableMemorySwappingBank(void) +{ + *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Internal FLASH Bank Swapping. + * + * @note This function can be used only for STM32F42xxx/43xxx/469xx/479xx devices. + * + * @note The default state : Flash Bank1 mapped at 0x08000000 (and aliased @0x00000000) + * and Flash Bank2 mapped at 0x08100000 (and aliased at 0x00100000) + * + * @retval None + */ +void HAL_DisableMemorySwappingBank(void) +{ + *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)DISABLE; +} +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c new file mode 100644 index 0000000..0fbc723 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c @@ -0,0 +1,2464 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_can.c + * @author MCD Application Team + * @brief CAN HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Controller Area Network (CAN) peripheral: + * + Initialization and de-initialization functions + * + Configuration functions + * + Control functions + * + Interrupts management + * + Callbacks functions + * + Peripheral State and Error functions + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the CAN low level resources by implementing the + HAL_CAN_MspInit(): + (++) Enable the CAN interface clock using __HAL_RCC_CANx_CLK_ENABLE() + (++) Configure CAN pins + (+++) Enable the clock for the CAN GPIOs + (+++) Configure CAN pins as alternate function open-drain + (++) In case of using interrupts (e.g. HAL_CAN_ActivateNotification()) + (+++) Configure the CAN interrupt priority using + HAL_NVIC_SetPriority() + (+++) Enable the CAN IRQ handler using HAL_NVIC_EnableIRQ() + (+++) In CAN IRQ handler, call HAL_CAN_IRQHandler() + + (#) Initialize the CAN peripheral using HAL_CAN_Init() function. This + function resorts to HAL_CAN_MspInit() for low-level initialization. + + (#) Configure the reception filters using the following configuration + functions: + (++) HAL_CAN_ConfigFilter() + + (#) Start the CAN module using HAL_CAN_Start() function. At this level + the node is active on the bus: it receive messages, and can send + messages. + + (#) To manage messages transmission, the following Tx control functions + can be used: + (++) HAL_CAN_AddTxMessage() to request transmission of a new + message. + (++) HAL_CAN_AbortTxRequest() to abort transmission of a pending + message. + (++) HAL_CAN_GetTxMailboxesFreeLevel() to get the number of free Tx + mailboxes. + (++) HAL_CAN_IsTxMessagePending() to check if a message is pending + in a Tx mailbox. + (++) HAL_CAN_GetTxTimestamp() to get the timestamp of Tx message + sent, if time triggered communication mode is enabled. + + (#) When a message is received into the CAN Rx FIFOs, it can be retrieved + using the HAL_CAN_GetRxMessage() function. The function + HAL_CAN_GetRxFifoFillLevel() allows to know how many Rx message are + stored in the Rx Fifo. + + (#) Calling the HAL_CAN_Stop() function stops the CAN module. + + (#) The deinitialization is achieved with HAL_CAN_DeInit() function. + + + *** Polling mode operation *** + ============================== + [..] + (#) Reception: + (++) Monitor reception of message using HAL_CAN_GetRxFifoFillLevel() + until at least one message is received. + (++) Then get the message using HAL_CAN_GetRxMessage(). + + (#) Transmission: + (++) Monitor the Tx mailboxes availability until at least one Tx + mailbox is free, using HAL_CAN_GetTxMailboxesFreeLevel(). + (++) Then request transmission of a message using + HAL_CAN_AddTxMessage(). + + + *** Interrupt mode operation *** + ================================ + [..] + (#) Notifications are activated using HAL_CAN_ActivateNotification() + function. Then, the process can be controlled through the + available user callbacks: HAL_CAN_xxxCallback(), using same APIs + HAL_CAN_GetRxMessage() and HAL_CAN_AddTxMessage(). + + (#) Notifications can be deactivated using + HAL_CAN_DeactivateNotification() function. + + (#) Special care should be taken for CAN_IT_RX_FIFO0_MSG_PENDING and + CAN_IT_RX_FIFO1_MSG_PENDING notifications. These notifications trig + the callbacks HAL_CAN_RxFIFO0MsgPendingCallback() and + HAL_CAN_RxFIFO1MsgPendingCallback(). User has two possible options + here. + (++) Directly get the Rx message in the callback, using + HAL_CAN_GetRxMessage(). + (++) Or deactivate the notification in the callback without + getting the Rx message. The Rx message can then be got later + using HAL_CAN_GetRxMessage(). Once the Rx message have been + read, the notification can be activated again. + + + *** Sleep mode *** + ================== + [..] + (#) The CAN peripheral can be put in sleep mode (low power), using + HAL_CAN_RequestSleep(). The sleep mode will be entered as soon as the + current CAN activity (transmission or reception of a CAN frame) will + be completed. + + (#) A notification can be activated to be informed when the sleep mode + will be entered. + + (#) It can be checked if the sleep mode is entered using + HAL_CAN_IsSleepActive(). + Note that the CAN state (accessible from the API HAL_CAN_GetState()) + is HAL_CAN_STATE_SLEEP_PENDING as soon as the sleep mode request is + submitted (the sleep mode is not yet entered), and become + HAL_CAN_STATE_SLEEP_ACTIVE when the sleep mode is effective. + + (#) The wake-up from sleep mode can be trigged by two ways: + (++) Using HAL_CAN_WakeUp(). When returning from this function, + the sleep mode is exited (if return status is HAL_OK). + (++) When a start of Rx CAN frame is detected by the CAN peripheral, + if automatic wake up mode is enabled. + + *** Callback registration *** + ============================================= + + The compilation define USE_HAL_CAN_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + Use Function @ref HAL_CAN_RegisterCallback() to register an interrupt callback. + + Function @ref HAL_CAN_RegisterCallback() allows to register following callbacks: + (+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback. + (+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback. + (+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback. + (+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback. + (+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback. + (+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback. + (+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback. + (+) RxFifo0FullCallback : Rx Fifo 0 Full Callback. + (+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback. + (+) RxFifo1FullCallback : Rx Fifo 1 Full Callback. + (+) SleepCallback : Sleep Callback. + (+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback. + (+) ErrorCallback : Error Callback. + (+) MspInitCallback : CAN MspInit. + (+) MspDeInitCallback : CAN MspDeInit. + This function takes as parameters the HAL peripheral handle, the Callback ID + and a pointer to the user callback function. + + Use function @ref HAL_CAN_UnRegisterCallback() to reset a callback to the default + weak function. + @ref HAL_CAN_UnRegisterCallback takes as parameters the HAL peripheral handle, + and the Callback ID. + This function allows to reset following callbacks: + (+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback. + (+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback. + (+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback. + (+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback. + (+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback. + (+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback. + (+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback. + (+) RxFifo0FullCallback : Rx Fifo 0 Full Callback. + (+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback. + (+) RxFifo1FullCallback : Rx Fifo 1 Full Callback. + (+) SleepCallback : Sleep Callback. + (+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback. + (+) ErrorCallback : Error Callback. + (+) MspInitCallback : CAN MspInit. + (+) MspDeInitCallback : CAN MspDeInit. + + By default, after the @ref HAL_CAN_Init() and when the state is HAL_CAN_STATE_RESET, + all callbacks are set to the corresponding weak functions: + example @ref HAL_CAN_ErrorCallback(). + Exception done for MspInit and MspDeInit functions that are + reset to the legacy weak function in the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit() only when + these callbacks are null (not registered beforehand). + if not, MspInit or MspDeInit are not null, the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit() + keep and use the user MspInit/MspDeInit callbacks (registered beforehand) + + Callbacks can be registered/unregistered in HAL_CAN_STATE_READY state only. + Exception done MspInit/MspDeInit that can be registered/unregistered + in HAL_CAN_STATE_READY or HAL_CAN_STATE_RESET state, + thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_CAN_RegisterCallback() before calling @ref HAL_CAN_DeInit() + or @ref HAL_CAN_Init() function. + + When The compilation define USE_HAL_CAN_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registration feature is not available and all callbacks + are set to the corresponding weak functions. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +#if defined(CAN1) + +/** @defgroup CAN CAN + * @brief CAN driver modules + * @{ + */ + +#ifdef HAL_CAN_MODULE_ENABLED + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #error "The CAN driver cannot be used with its legacy, Please enable only one CAN module at once" +#endif + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup CAN_Private_Constants CAN Private Constants + * @{ + */ +#define CAN_TIMEOUT_VALUE 10U +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup CAN_Exported_Functions CAN Exported Functions + * @{ + */ + +/** @defgroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_Init : Initialize and configure the CAN. + (+) HAL_CAN_DeInit : De-initialize the CAN. + (+) HAL_CAN_MspInit : Initialize the CAN MSP. + (+) HAL_CAN_MspDeInit : DeInitialize the CAN MSP. + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the CAN peripheral according to the specified + * parameters in the CAN_InitStruct. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + /* Check CAN handle */ + if (hcan == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_CAN_ALL_INSTANCE(hcan->Instance)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.TimeTriggeredMode)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoBusOff)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoWakeUp)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoRetransmission)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.ReceiveFifoLocked)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.TransmitFifoPriority)); + assert_param(IS_CAN_MODE(hcan->Init.Mode)); + assert_param(IS_CAN_SJW(hcan->Init.SyncJumpWidth)); + assert_param(IS_CAN_BS1(hcan->Init.TimeSeg1)); + assert_param(IS_CAN_BS2(hcan->Init.TimeSeg2)); + assert_param(IS_CAN_PRESCALER(hcan->Init.Prescaler)); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + if (hcan->State == HAL_CAN_STATE_RESET) + { + /* Reset callbacks to legacy functions */ + hcan->RxFifo0MsgPendingCallback = HAL_CAN_RxFifo0MsgPendingCallback; /* Legacy weak RxFifo0MsgPendingCallback */ + hcan->RxFifo0FullCallback = HAL_CAN_RxFifo0FullCallback; /* Legacy weak RxFifo0FullCallback */ + hcan->RxFifo1MsgPendingCallback = HAL_CAN_RxFifo1MsgPendingCallback; /* Legacy weak RxFifo1MsgPendingCallback */ + hcan->RxFifo1FullCallback = HAL_CAN_RxFifo1FullCallback; /* Legacy weak RxFifo1FullCallback */ + hcan->TxMailbox0CompleteCallback = HAL_CAN_TxMailbox0CompleteCallback; /* Legacy weak TxMailbox0CompleteCallback */ + hcan->TxMailbox1CompleteCallback = HAL_CAN_TxMailbox1CompleteCallback; /* Legacy weak TxMailbox1CompleteCallback */ + hcan->TxMailbox2CompleteCallback = HAL_CAN_TxMailbox2CompleteCallback; /* Legacy weak TxMailbox2CompleteCallback */ + hcan->TxMailbox0AbortCallback = HAL_CAN_TxMailbox0AbortCallback; /* Legacy weak TxMailbox0AbortCallback */ + hcan->TxMailbox1AbortCallback = HAL_CAN_TxMailbox1AbortCallback; /* Legacy weak TxMailbox1AbortCallback */ + hcan->TxMailbox2AbortCallback = HAL_CAN_TxMailbox2AbortCallback; /* Legacy weak TxMailbox2AbortCallback */ + hcan->SleepCallback = HAL_CAN_SleepCallback; /* Legacy weak SleepCallback */ + hcan->WakeUpFromRxMsgCallback = HAL_CAN_WakeUpFromRxMsgCallback; /* Legacy weak WakeUpFromRxMsgCallback */ + hcan->ErrorCallback = HAL_CAN_ErrorCallback; /* Legacy weak ErrorCallback */ + + if (hcan->MspInitCallback == NULL) + { + hcan->MspInitCallback = HAL_CAN_MspInit; /* Legacy weak MspInit */ + } + + /* Init the low level hardware: CLOCK, NVIC */ + hcan->MspInitCallback(hcan); + } + +#else + if (hcan->State == HAL_CAN_STATE_RESET) + { + /* Init the low level hardware: CLOCK, NVIC */ + HAL_CAN_MspInit(hcan); + } +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ + + /* Exit from sleep mode */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Check Sleep mode leave acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Request initialisation */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait initialisation acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Set the time triggered communication mode */ + if (hcan->Init.TimeTriggeredMode == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + } + + /* Set the automatic bus-off management */ + if (hcan->Init.AutoBusOff == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + } + + /* Set the automatic wake-up mode */ + if (hcan->Init.AutoWakeUp == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + } + + /* Set the automatic retransmission */ + if (hcan->Init.AutoRetransmission == ENABLE) + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_NART); + } + else + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_NART); + } + + /* Set the receive FIFO locked mode */ + if (hcan->Init.ReceiveFifoLocked == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + } + + /* Set the transmit FIFO priority */ + if (hcan->Init.TransmitFifoPriority == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + } + + /* Set the bit timing register */ + WRITE_REG(hcan->Instance->BTR, (uint32_t)(hcan->Init.Mode | + hcan->Init.SyncJumpWidth | + hcan->Init.TimeSeg1 | + hcan->Init.TimeSeg2 | + (hcan->Init.Prescaler - 1U))); + + /* Initialize the error code */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Initialize the CAN state */ + hcan->State = HAL_CAN_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Deinitializes the CAN peripheral registers to their default + * reset values. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan) +{ + /* Check CAN handle */ + if (hcan == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_CAN_ALL_INSTANCE(hcan->Instance)); + + /* Stop the CAN module */ + (void)HAL_CAN_Stop(hcan); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + if (hcan->MspDeInitCallback == NULL) + { + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; /* Legacy weak MspDeInit */ + } + + /* DeInit the low level hardware: CLOCK, NVIC */ + hcan->MspDeInitCallback(hcan); + +#else + /* DeInit the low level hardware: CLOCK, NVIC */ + HAL_CAN_MspDeInit(hcan); +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ + + /* Reset the CAN peripheral */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_RESET); + + /* Reset the CAN ErrorCode */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_RESET; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Initializes the CAN MSP. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes the CAN MSP. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_MspDeInit could be implemented in the user file + */ +} + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/** + * @brief Register a CAN CallBack. + * To be used instead of the weak predefined callback + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for CAN module + * @param CallbackID ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID Tx Mailbox 0 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID Tx Mailbox 1 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID Tx Mailbox 2 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX0_ABORT_CB_ID Tx Mailbox 0 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_ABORT_CB_ID Tx Mailbox 1 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_ABORT_CB_ID Tx Mailbox 2 Abort callback ID + * @arg @ref HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID Rx Fifo 0 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO0_FULL_CB_ID Rx Fifo 0 full callback ID + * @arg @ref HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID Rx Fifo 1 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO1_FULL_CB_ID Rx Fifo 1 full callback ID + * @arg @ref HAL_CAN_SLEEP_CB_ID Sleep callback ID + * @arg @ref HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID Wake Up from Rx message callback ID + * @arg @ref HAL_CAN_ERROR_CB_ID Error callback ID + * @arg @ref HAL_CAN_MSPINIT_CB_ID MspInit callback ID + * @arg @ref HAL_CAN_MSPDEINIT_CB_ID MspDeInit callback ID + * @param pCallback pointer to the Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID, void (* pCallback)(CAN_HandleTypeDef *_hcan)) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + if (hcan->State == HAL_CAN_STATE_READY) + { + switch (CallbackID) + { + case HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID : + hcan->TxMailbox0CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID : + hcan->TxMailbox1CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID : + hcan->TxMailbox2CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX0_ABORT_CB_ID : + hcan->TxMailbox0AbortCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX1_ABORT_CB_ID : + hcan->TxMailbox1AbortCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX2_ABORT_CB_ID : + hcan->TxMailbox2AbortCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID : + hcan->RxFifo0MsgPendingCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO0_FULL_CB_ID : + hcan->RxFifo0FullCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID : + hcan->RxFifo1MsgPendingCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO1_FULL_CB_ID : + hcan->RxFifo1FullCallback = pCallback; + break; + + case HAL_CAN_SLEEP_CB_ID : + hcan->SleepCallback = pCallback; + break; + + case HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID : + hcan->WakeUpFromRxMsgCallback = pCallback; + break; + + case HAL_CAN_ERROR_CB_ID : + hcan->ErrorCallback = pCallback; + break; + + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = pCallback; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hcan->State == HAL_CAN_STATE_RESET) + { + switch (CallbackID) + { + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = pCallback; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + return status; +} + +/** + * @brief Unregister a CAN CallBack. + * CAN callabck is redirected to the weak predefined callback + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for CAN module + * @param CallbackID ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID Tx Mailbox 0 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID Tx Mailbox 1 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID Tx Mailbox 2 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX0_ABORT_CB_ID Tx Mailbox 0 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_ABORT_CB_ID Tx Mailbox 1 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_ABORT_CB_ID Tx Mailbox 2 Abort callback ID + * @arg @ref HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID Rx Fifo 0 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO0_FULL_CB_ID Rx Fifo 0 full callback ID + * @arg @ref HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID Rx Fifo 1 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO1_FULL_CB_ID Rx Fifo 1 full callback ID + * @arg @ref HAL_CAN_SLEEP_CB_ID Sleep callback ID + * @arg @ref HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID Wake Up from Rx message callback ID + * @arg @ref HAL_CAN_ERROR_CB_ID Error callback ID + * @arg @ref HAL_CAN_MSPINIT_CB_ID MspInit callback ID + * @arg @ref HAL_CAN_MSPDEINIT_CB_ID MspDeInit callback ID + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_UnRegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (hcan->State == HAL_CAN_STATE_READY) + { + switch (CallbackID) + { + case HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID : + hcan->TxMailbox0CompleteCallback = HAL_CAN_TxMailbox0CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID : + hcan->TxMailbox1CompleteCallback = HAL_CAN_TxMailbox1CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID : + hcan->TxMailbox2CompleteCallback = HAL_CAN_TxMailbox2CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX0_ABORT_CB_ID : + hcan->TxMailbox0AbortCallback = HAL_CAN_TxMailbox0AbortCallback; + break; + + case HAL_CAN_TX_MAILBOX1_ABORT_CB_ID : + hcan->TxMailbox1AbortCallback = HAL_CAN_TxMailbox1AbortCallback; + break; + + case HAL_CAN_TX_MAILBOX2_ABORT_CB_ID : + hcan->TxMailbox2AbortCallback = HAL_CAN_TxMailbox2AbortCallback; + break; + + case HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID : + hcan->RxFifo0MsgPendingCallback = HAL_CAN_RxFifo0MsgPendingCallback; + break; + + case HAL_CAN_RX_FIFO0_FULL_CB_ID : + hcan->RxFifo0FullCallback = HAL_CAN_RxFifo0FullCallback; + break; + + case HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID : + hcan->RxFifo1MsgPendingCallback = HAL_CAN_RxFifo1MsgPendingCallback; + break; + + case HAL_CAN_RX_FIFO1_FULL_CB_ID : + hcan->RxFifo1FullCallback = HAL_CAN_RxFifo1FullCallback; + break; + + case HAL_CAN_SLEEP_CB_ID : + hcan->SleepCallback = HAL_CAN_SleepCallback; + break; + + case HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID : + hcan->WakeUpFromRxMsgCallback = HAL_CAN_WakeUpFromRxMsgCallback; + break; + + case HAL_CAN_ERROR_CB_ID : + hcan->ErrorCallback = HAL_CAN_ErrorCallback; + break; + + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = HAL_CAN_MspInit; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hcan->State == HAL_CAN_STATE_RESET) + { + switch (CallbackID) + { + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = HAL_CAN_MspInit; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + return status; +} +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group2 Configuration functions + * @brief Configuration functions. + * +@verbatim + ============================================================================== + ##### Configuration functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_ConfigFilter : Configure the CAN reception filters + +@endverbatim + * @{ + */ + +/** + * @brief Configures the CAN reception filter according to the specified + * parameters in the CAN_FilterInitStruct. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param sFilterConfig pointer to a CAN_FilterTypeDef structure that + * contains the filter configuration information. + * @retval None + */ +HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig) +{ + uint32_t filternbrbitpos; + CAN_TypeDef *can_ip = hcan->Instance; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check the parameters */ + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterIdHigh)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterIdLow)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterMaskIdHigh)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterMaskIdLow)); + assert_param(IS_CAN_FILTER_MODE(sFilterConfig->FilterMode)); + assert_param(IS_CAN_FILTER_SCALE(sFilterConfig->FilterScale)); + assert_param(IS_CAN_FILTER_FIFO(sFilterConfig->FilterFIFOAssignment)); + assert_param(IS_CAN_FILTER_ACTIVATION(sFilterConfig->FilterActivation)); + +#if defined(CAN3) + /* Check the CAN instance */ + if (hcan->Instance == CAN3) + { + /* CAN3 is single instance with 14 dedicated filters banks */ + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_SINGLE(sFilterConfig->FilterBank)); + } + else + { + /* CAN1 and CAN2 are dual instances with 28 common filters banks */ + /* Select master instance to access the filter banks */ + can_ip = CAN1; + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->FilterBank)); + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->SlaveStartFilterBank)); + } +#elif defined(CAN2) + /* CAN1 and CAN2 are dual instances with 28 common filters banks */ + /* Select master instance to access the filter banks */ + can_ip = CAN1; + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->FilterBank)); + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->SlaveStartFilterBank)); +#else + /* CAN1 is single instance with 14 dedicated filters banks */ + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_SINGLE(sFilterConfig->FilterBank)); +#endif + + /* Initialisation mode for the filter */ + SET_BIT(can_ip->FMR, CAN_FMR_FINIT); + +#if defined(CAN3) + /* Check the CAN instance */ + if (can_ip == CAN1) + { + /* Select the start filter number of CAN2 slave instance */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_CAN2SB); + SET_BIT(can_ip->FMR, sFilterConfig->SlaveStartFilterBank << CAN_FMR_CAN2SB_Pos); + } + +#elif defined(CAN2) + /* Select the start filter number of CAN2 slave instance */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_CAN2SB); + SET_BIT(can_ip->FMR, sFilterConfig->SlaveStartFilterBank << CAN_FMR_CAN2SB_Pos); + +#endif + /* Convert filter number into bit position */ + filternbrbitpos = (uint32_t)1 << (sFilterConfig->FilterBank & 0x1FU); + + /* Filter Deactivation */ + CLEAR_BIT(can_ip->FA1R, filternbrbitpos); + + /* Filter Scale */ + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_16BIT) + { + /* 16-bit scale for the filter */ + CLEAR_BIT(can_ip->FS1R, filternbrbitpos); + + /* First 16-bit identifier and First 16-bit mask */ + /* Or First 16-bit identifier and Second 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + + /* Second 16-bit identifier and Second 16-bit mask */ + /* Or Third 16-bit identifier and Fourth 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh); + } + + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_32BIT) + { + /* 32-bit scale for the filter */ + SET_BIT(can_ip->FS1R, filternbrbitpos); + + /* 32-bit identifier or First 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + + /* 32-bit mask or Second 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow); + } + + /* Filter Mode */ + if (sFilterConfig->FilterMode == CAN_FILTERMODE_IDMASK) + { + /* Id/Mask mode for the filter*/ + CLEAR_BIT(can_ip->FM1R, filternbrbitpos); + } + else /* CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdList */ + { + /* Identifier list mode for the filter*/ + SET_BIT(can_ip->FM1R, filternbrbitpos); + } + + /* Filter FIFO assignment */ + if (sFilterConfig->FilterFIFOAssignment == CAN_FILTER_FIFO0) + { + /* FIFO 0 assignation for the filter */ + CLEAR_BIT(can_ip->FFA1R, filternbrbitpos); + } + else + { + /* FIFO 1 assignation for the filter */ + SET_BIT(can_ip->FFA1R, filternbrbitpos); + } + + /* Filter activation */ + if (sFilterConfig->FilterActivation == CAN_FILTER_ENABLE) + { + SET_BIT(can_ip->FA1R, filternbrbitpos); + } + + /* Leave the initialisation mode for the filter */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_FINIT); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group3 Control functions + * @brief Control functions + * +@verbatim + ============================================================================== + ##### Control functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_Start : Start the CAN module + (+) HAL_CAN_Stop : Stop the CAN module + (+) HAL_CAN_RequestSleep : Request sleep mode entry. + (+) HAL_CAN_WakeUp : Wake up from sleep mode. + (+) HAL_CAN_IsSleepActive : Check is sleep mode is active. + (+) HAL_CAN_AddTxMessage : Add a message to the Tx mailboxes + and activate the corresponding + transmission request + (+) HAL_CAN_AbortTxRequest : Abort transmission request + (+) HAL_CAN_GetTxMailboxesFreeLevel : Return Tx mailboxes free level + (+) HAL_CAN_IsTxMessagePending : Check if a transmission request is + pending on the selected Tx mailbox + (+) HAL_CAN_GetRxMessage : Get a CAN frame from the Rx FIFO + (+) HAL_CAN_GetRxFifoFillLevel : Return Rx FIFO fill level + +@endverbatim + * @{ + */ + +/** + * @brief Start the CAN module. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + if (hcan->State == HAL_CAN_STATE_READY) + { + /* Change CAN peripheral state */ + hcan->State = HAL_CAN_STATE_LISTENING; + + /* Request leave initialisation */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait the acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) != 0U) + { + /* Check for the Timeout */ + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Reset the CAN ErrorCode */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_READY; + + return HAL_ERROR; + } +} + +/** + * @brief Stop the CAN module and enable access to configuration registers. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + if (hcan->State == HAL_CAN_STATE_LISTENING) + { + /* Request initialisation */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait the acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + { + /* Check for the Timeout */ + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Exit from sleep mode */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Change CAN peripheral state */ + hcan->State = HAL_CAN_STATE_READY; + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_STARTED; + + return HAL_ERROR; + } +} + +/** + * @brief Request the sleep mode (low power) entry. + * When returning from this function, Sleep mode will be entered + * as soon as the current CAN activity (transmission or reception + * of a CAN frame) has been completed. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status. + */ +HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Request Sleep mode */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + /* Return function status */ + return HAL_ERROR; + } +} + +/** + * @brief Wake up from sleep mode. + * When returning with HAL_OK status from this function, Sleep mode + * is exited. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status. + */ +HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan) +{ + __IO uint32_t count = 0; + uint32_t timeout = 1000000U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Wake up request */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Wait sleep mode is exited */ + do + { + /* Increment counter */ + count++; + + /* Check if timeout is reached */ + if (count > timeout) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + return HAL_ERROR; + } + } + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Check is sleep mode is active. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval Status + * - 0 : Sleep mode is not active. + * - 1 : Sleep mode is active. + */ +uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan) +{ + uint32_t status = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Sleep mode */ + if ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + status = 1U; + } + } + + /* Return function status */ + return status; +} + +/** + * @brief Add a message to the first free Tx mailbox and activate the + * corresponding transmission request. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param pHeader pointer to a CAN_TxHeaderTypeDef structure. + * @param aData array containing the payload of the Tx frame. + * @param pTxMailbox pointer to a variable where the function will return + * the TxMailbox used to store the Tx message. + * This parameter can be a value of @arg CAN_Tx_Mailboxes. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox) +{ + uint32_t transmitmailbox; + HAL_CAN_StateTypeDef state = hcan->State; + uint32_t tsr = READ_REG(hcan->Instance->TSR); + + /* Check the parameters */ + assert_param(IS_CAN_IDTYPE(pHeader->IDE)); + assert_param(IS_CAN_RTR(pHeader->RTR)); + assert_param(IS_CAN_DLC(pHeader->DLC)); + if (pHeader->IDE == CAN_ID_STD) + { + assert_param(IS_CAN_STDID(pHeader->StdId)); + } + else + { + assert_param(IS_CAN_EXTID(pHeader->ExtId)); + } + assert_param(IS_FUNCTIONAL_STATE(pHeader->TransmitGlobalTime)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check that all the Tx mailboxes are not full */ + if (((tsr & CAN_TSR_TME0) != 0U) || + ((tsr & CAN_TSR_TME1) != 0U) || + ((tsr & CAN_TSR_TME2) != 0U)) + { + /* Select an empty transmit mailbox */ + transmitmailbox = (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos; + + /* Check transmit mailbox value */ + if (transmitmailbox > 2U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INTERNAL; + + return HAL_ERROR; + } + + /* Store the Tx mailbox */ + *pTxMailbox = (uint32_t)1 << transmitmailbox; + + /* Set up the Id */ + if (pHeader->IDE == CAN_ID_STD) + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->StdId << CAN_TI0R_STID_Pos) | + pHeader->RTR); + } + else + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + pHeader->IDE | + pHeader->RTR); + } + + /* Set up the DLC */ + hcan->Instance->sTxMailBox[transmitmailbox].TDTR = (pHeader->DLC); + + /* Set up the Transmit Global Time mode */ + if (pHeader->TransmitGlobalTime == ENABLE) + { + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TDTR, CAN_TDT0R_TGT); + } + + /* Set up the data field */ + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDHR, + ((uint32_t)aData[7] << CAN_TDH0R_DATA7_Pos) | + ((uint32_t)aData[6] << CAN_TDH0R_DATA6_Pos) | + ((uint32_t)aData[5] << CAN_TDH0R_DATA5_Pos) | + ((uint32_t)aData[4] << CAN_TDH0R_DATA4_Pos)); + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDLR, + ((uint32_t)aData[3] << CAN_TDL0R_DATA3_Pos) | + ((uint32_t)aData[2] << CAN_TDL0R_DATA2_Pos) | + ((uint32_t)aData[1] << CAN_TDL0R_DATA1_Pos) | + ((uint32_t)aData[0] << CAN_TDL0R_DATA0_Pos)); + + /* Request transmission */ + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TIR, CAN_TI0R_TXRQ); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Abort transmission requests + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailboxes List of the Tx Mailboxes to abort. + * This parameter can be any combination of @arg CAN_Tx_Mailboxes. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX_LIST(TxMailboxes)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Tx Mailbox 0 */ + if ((TxMailboxes & CAN_TX_MAILBOX0) != 0U) + { + /* Add cancellation request for Tx Mailbox 0 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ0); + } + + /* Check Tx Mailbox 1 */ + if ((TxMailboxes & CAN_TX_MAILBOX1) != 0U) + { + /* Add cancellation request for Tx Mailbox 1 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ1); + } + + /* Check Tx Mailbox 2 */ + if ((TxMailboxes & CAN_TX_MAILBOX2) != 0U) + { + /* Add cancellation request for Tx Mailbox 2 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ2); + } + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Return Tx Mailboxes free level: number of free Tx Mailboxes. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval Number of free Tx Mailboxes. + */ +uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan) +{ + uint32_t freelevel = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Tx Mailbox 0 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME0) != 0U) + { + freelevel++; + } + + /* Check Tx Mailbox 1 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME1) != 0U) + { + freelevel++; + } + + /* Check Tx Mailbox 2 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME2) != 0U) + { + freelevel++; + } + } + + /* Return Tx Mailboxes free level */ + return freelevel; +} + +/** + * @brief Check if a transmission request is pending on the selected Tx + * Mailboxes. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailboxes List of Tx Mailboxes to check. + * This parameter can be any combination of @arg CAN_Tx_Mailboxes. + * @retval Status + * - 0 : No pending transmission request on any selected Tx Mailboxes. + * - 1 : Pending transmission request on at least one of the selected + * Tx Mailbox. + */ +uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes) +{ + uint32_t status = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX_LIST(TxMailboxes)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check pending transmission request on the selected Tx Mailboxes */ + if ((hcan->Instance->TSR & (TxMailboxes << CAN_TSR_TME0_Pos)) != (TxMailboxes << CAN_TSR_TME0_Pos)) + { + status = 1U; + } + } + + /* Return status */ + return status; +} + +/** + * @brief Return timestamp of Tx message sent, if time triggered communication + mode is enabled. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailbox Tx Mailbox where the timestamp of message sent will be + * read. + * This parameter can be one value of @arg CAN_Tx_Mailboxes. + * @retval Timestamp of message sent from Tx Mailbox. + */ +uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox) +{ + uint32_t timestamp = 0U; + uint32_t transmitmailbox; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX(TxMailbox)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Select the Tx mailbox */ + transmitmailbox = POSITION_VAL(TxMailbox); + + /* Get timestamp */ + timestamp = (hcan->Instance->sTxMailBox[transmitmailbox].TDTR & CAN_TDT0R_TIME) >> CAN_TDT0R_TIME_Pos; + } + + /* Return the timestamp */ + return timestamp; +} + +/** + * @brief Get an CAN frame from the Rx FIFO zone into the message RAM. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param RxFifo Fifo number of the received message to be read. + * This parameter can be a value of @arg CAN_receive_FIFO_number. + * @param pHeader pointer to a CAN_RxHeaderTypeDef structure where the header + * of the Rx frame will be stored. + * @param aData array where the payload of the Rx frame will be stored. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check the Rx FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + { + /* Check that the Rx FIFO 0 is not empty */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) == 0U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Check that the Rx FIFO 1 is not empty */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) == 0U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + + /* Get the header */ + pHeader->IDE = CAN_RI0R_IDE & hcan->Instance->sFIFOMailBox[RxFifo].RIR; + if (pHeader->IDE == CAN_ID_STD) + { + pHeader->StdId = (CAN_RI0R_STID & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_TI0R_STID_Pos; + } + else + { + pHeader->ExtId = ((CAN_RI0R_EXID | CAN_RI0R_STID) & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_EXID_Pos; + } + pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR); + pHeader->DLC = (CAN_RDT0R_DLC & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_DLC_Pos; + pHeader->FilterMatchIndex = (CAN_RDT0R_FMI & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_FMI_Pos; + pHeader->Timestamp = (CAN_RDT0R_TIME & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_TIME_Pos; + + /* Get the data */ + aData[0] = (uint8_t)((CAN_RDL0R_DATA0 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA0_Pos); + aData[1] = (uint8_t)((CAN_RDL0R_DATA1 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA1_Pos); + aData[2] = (uint8_t)((CAN_RDL0R_DATA2 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA2_Pos); + aData[3] = (uint8_t)((CAN_RDL0R_DATA3 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA3_Pos); + aData[4] = (uint8_t)((CAN_RDH0R_DATA4 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA4_Pos); + aData[5] = (uint8_t)((CAN_RDH0R_DATA5 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA5_Pos); + aData[6] = (uint8_t)((CAN_RDH0R_DATA6 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA6_Pos); + aData[7] = (uint8_t)((CAN_RDH0R_DATA7 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA7_Pos); + + /* Release the FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + { + /* Release RX FIFO 0 */ + SET_BIT(hcan->Instance->RF0R, CAN_RF0R_RFOM0); + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Release RX FIFO 1 */ + SET_BIT(hcan->Instance->RF1R, CAN_RF1R_RFOM1); + } + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Return Rx FIFO fill level. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param RxFifo Rx FIFO. + * This parameter can be a value of @arg CAN_receive_FIFO_number. + * @retval Number of messages available in Rx FIFO. + */ +uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo) +{ + uint32_t filllevel = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + if (RxFifo == CAN_RX_FIFO0) + { + filllevel = hcan->Instance->RF0R & CAN_RF0R_FMP0; + } + else /* RxFifo == CAN_RX_FIFO1 */ + { + filllevel = hcan->Instance->RF1R & CAN_RF1R_FMP1; + } + } + + /* Return Rx FIFO fill level */ + return filllevel; +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group4 Interrupts management + * @brief Interrupts management + * +@verbatim + ============================================================================== + ##### Interrupts management ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_ActivateNotification : Enable interrupts + (+) HAL_CAN_DeactivateNotification : Disable interrupts + (+) HAL_CAN_IRQHandler : Handles CAN interrupt request + +@endverbatim + * @{ + */ + +/** + * @brief Enable interrupts. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param ActiveITs indicates which interrupts will be enabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_IT(ActiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Enable the selected interrupts */ + __HAL_CAN_ENABLE_IT(hcan, ActiveITs); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Disable interrupts. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param InactiveITs indicates which interrupts will be disabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_IT(InactiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Disable the selected interrupts */ + __HAL_CAN_DISABLE_IT(hcan, InactiveITs); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Handles CAN interrupt request + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan) +{ + uint32_t errorcode = HAL_CAN_ERROR_NONE; + uint32_t interrupts = READ_REG(hcan->Instance->IER); + uint32_t msrflags = READ_REG(hcan->Instance->MSR); + uint32_t tsrflags = READ_REG(hcan->Instance->TSR); + uint32_t rf0rflags = READ_REG(hcan->Instance->RF0R); + uint32_t rf1rflags = READ_REG(hcan->Instance->RF1R); + uint32_t esrflags = READ_REG(hcan->Instance->ESR); + + /* Transmit Mailbox empty interrupt management *****************************/ + if ((interrupts & CAN_IT_TX_MAILBOX_EMPTY) != 0U) + { + /* Transmit Mailbox 0 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP0) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK0,ALST0,TERR0 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP0); + + if ((tsrflags & CAN_TSR_TXOK0) != 0U) + { + /* Transmission Mailbox 0 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST0) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST0; + } + else if ((tsrflags & CAN_TSR_TERR0) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR0; + } + else + { + /* Transmission Mailbox 0 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + + /* Transmit Mailbox 1 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP1) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK1,ALST1,TERR1 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP1); + + if ((tsrflags & CAN_TSR_TXOK1) != 0U) + { + /* Transmission Mailbox 1 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST1) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST1; + } + else if ((tsrflags & CAN_TSR_TERR1) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR1; + } + else + { + /* Transmission Mailbox 1 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + + /* Transmit Mailbox 2 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP2) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK2,ALST2,TERR2 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP2); + + if ((tsrflags & CAN_TSR_TXOK2) != 0U) + { + /* Transmission Mailbox 2 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST2) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST2; + } + else if ((tsrflags & CAN_TSR_TERR2) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR2; + } + else + { + /* Transmission Mailbox 2 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + } + + /* Receive FIFO 0 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO0_OVERRUN) != 0U) + { + if ((rf0rflags & CAN_RF0R_FOVR0) != 0U) + { + /* Set CAN error code to Rx Fifo 0 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV0; + + /* Clear FIFO0 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV0); + } + } + + /* Receive FIFO 0 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO0_FULL) != 0U) + { + if ((rf0rflags & CAN_RF0R_FULL0) != 0U) + { + /* Clear FIFO 0 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF0); + + /* Receive FIFO 0 full Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0FullCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 0 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO0_MSG_PENDING) != 0U) + { + /* Check if message is still pending */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) != 0U) + { + /* Receive FIFO 0 mesage pending Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0MsgPendingCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO1_OVERRUN) != 0U) + { + if ((rf1rflags & CAN_RF1R_FOVR1) != 0U) + { + /* Set CAN error code to Rx Fifo 1 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV1; + + /* Clear FIFO1 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV1); + } + } + + /* Receive FIFO 1 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO1_FULL) != 0U) + { + if ((rf1rflags & CAN_RF1R_FULL1) != 0U) + { + /* Clear FIFO 1 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF1); + + /* Receive FIFO 1 full Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1FullCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO1_MSG_PENDING) != 0U) + { + /* Check if message is still pending */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) != 0U) + { + /* Receive FIFO 1 mesage pending Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1MsgPendingCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Sleep interrupt management *********************************************/ + if ((interrupts & CAN_IT_SLEEP_ACK) != 0U) + { + if ((msrflags & CAN_MSR_SLAKI) != 0U) + { + /* Clear Sleep interrupt Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_SLAKI); + + /* Sleep Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->SleepCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_SleepCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* WakeUp interrupt management *********************************************/ + if ((interrupts & CAN_IT_WAKEUP) != 0U) + { + if ((msrflags & CAN_MSR_WKUI) != 0U) + { + /* Clear WakeUp Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_WKU); + + /* WakeUp Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->WakeUpFromRxMsgCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_WakeUpFromRxMsgCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Error interrupts management *********************************************/ + if ((interrupts & CAN_IT_ERROR) != 0U) + { + if ((msrflags & CAN_MSR_ERRI) != 0U) + { + /* Check Error Warning Flag */ + if (((interrupts & CAN_IT_ERROR_WARNING) != 0U) && + ((esrflags & CAN_ESR_EWGF) != 0U)) + { + /* Set CAN error code to Error Warning */ + errorcode |= HAL_CAN_ERROR_EWG; + + /* No need for clear of Error Warning Flag as read-only */ + } + + /* Check Error Passive Flag */ + if (((interrupts & CAN_IT_ERROR_PASSIVE) != 0U) && + ((esrflags & CAN_ESR_EPVF) != 0U)) + { + /* Set CAN error code to Error Passive */ + errorcode |= HAL_CAN_ERROR_EPV; + + /* No need for clear of Error Passive Flag as read-only */ + } + + /* Check Bus-off Flag */ + if (((interrupts & CAN_IT_BUSOFF) != 0U) && + ((esrflags & CAN_ESR_BOFF) != 0U)) + { + /* Set CAN error code to Bus-Off */ + errorcode |= HAL_CAN_ERROR_BOF; + + /* No need for clear of Error Bus-Off as read-only */ + } + + /* Check Last Error Code Flag */ + if (((interrupts & CAN_IT_LAST_ERROR_CODE) != 0U) && + ((esrflags & CAN_ESR_LEC) != 0U)) + { + switch (esrflags & CAN_ESR_LEC) + { + case (CAN_ESR_LEC_0): + /* Set CAN error code to Stuff error */ + errorcode |= HAL_CAN_ERROR_STF; + break; + case (CAN_ESR_LEC_1): + /* Set CAN error code to Form error */ + errorcode |= HAL_CAN_ERROR_FOR; + break; + case (CAN_ESR_LEC_1 | CAN_ESR_LEC_0): + /* Set CAN error code to Acknowledgement error */ + errorcode |= HAL_CAN_ERROR_ACK; + break; + case (CAN_ESR_LEC_2): + /* Set CAN error code to Bit recessive error */ + errorcode |= HAL_CAN_ERROR_BR; + break; + case (CAN_ESR_LEC_2 | CAN_ESR_LEC_0): + /* Set CAN error code to Bit Dominant error */ + errorcode |= HAL_CAN_ERROR_BD; + break; + case (CAN_ESR_LEC_2 | CAN_ESR_LEC_1): + /* Set CAN error code to CRC error */ + errorcode |= HAL_CAN_ERROR_CRC; + break; + default: + break; + } + + /* Clear Last error code Flag */ + CLEAR_BIT(hcan->Instance->ESR, CAN_ESR_LEC); + } + } + + /* Clear ERRI Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_ERRI); + } + + /* Call the Error call Back in case of Errors */ + if (errorcode != HAL_CAN_ERROR_NONE) + { + /* Update error code in handle */ + hcan->ErrorCode |= errorcode; + + /* Call Error callback function */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->ErrorCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_ErrorCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group5 Callback functions + * @brief CAN Callback functions + * +@verbatim + ============================================================================== + ##### Callback functions ##### + ============================================================================== + [..] + This subsection provides the following callback functions: + (+) HAL_CAN_TxMailbox0CompleteCallback + (+) HAL_CAN_TxMailbox1CompleteCallback + (+) HAL_CAN_TxMailbox2CompleteCallback + (+) HAL_CAN_TxMailbox0AbortCallback + (+) HAL_CAN_TxMailbox1AbortCallback + (+) HAL_CAN_TxMailbox2AbortCallback + (+) HAL_CAN_RxFifo0MsgPendingCallback + (+) HAL_CAN_RxFifo0FullCallback + (+) HAL_CAN_RxFifo1MsgPendingCallback + (+) HAL_CAN_RxFifo1FullCallback + (+) HAL_CAN_SleepCallback + (+) HAL_CAN_WakeUpFromRxMsgCallback + (+) HAL_CAN_ErrorCallback + +@endverbatim + * @{ + */ + +/** + * @brief Transmission Mailbox 0 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox0CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 1 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox1CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 2 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox2CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 0 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox0AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 1 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox1AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 2 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox2AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 0 message pending callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo0MsgPendingCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 0 full callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo0FullCallback could be implemented in the user + file + */ +} + +/** + * @brief Rx FIFO 1 message pending callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1MsgPendingCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 1 full callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1FullCallback could be implemented in the user + file + */ +} + +/** + * @brief Sleep callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_SleepCallback could be implemented in the user file + */ +} + +/** + * @brief WakeUp from Rx message callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_WakeUpFromRxMsgCallback could be implemented in the + user file + */ +} + +/** + * @brief Error CAN callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_ErrorCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group6 Peripheral State and Error functions + * @brief CAN Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral State and Error functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) HAL_CAN_GetState() : Return the CAN state. + (+) HAL_CAN_GetError() : Return the CAN error codes if any. + (+) HAL_CAN_ResetError(): Reset the CAN error codes if any. + +@endverbatim + * @{ + */ + +/** + * @brief Return the CAN state. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL state + */ +HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check sleep mode acknowledge flag */ + if ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + /* Sleep mode is active */ + state = HAL_CAN_STATE_SLEEP_ACTIVE; + } + /* Check sleep mode request flag */ + else if ((hcan->Instance->MCR & CAN_MCR_SLEEP) != 0U) + { + /* Sleep mode request is pending */ + state = HAL_CAN_STATE_SLEEP_PENDING; + } + else + { + /* Neither sleep mode request nor sleep mode acknowledge */ + } + } + + /* Return CAN state */ + return state; +} + +/** + * @brief Return the CAN error code. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval CAN Error Code + */ +uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan) +{ + /* Return CAN error code */ + return hcan->ErrorCode; +} + +/** + * @brief Reset the CAN error code. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Reset CAN error code */ + hcan->ErrorCode = 0U; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + status = HAL_ERROR; + } + + /* Return the status */ + return status; +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_CAN_MODULE_ENABLED */ + +/** + * @} + */ + +#endif /* CAN1 */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c new file mode 100644 index 0000000..2efb986 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c @@ -0,0 +1,505 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_cortex.c + * @author MCD Application Team + * @brief CORTEX HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the CORTEX: + * + Initialization and de-initialization functions + * + Peripheral Control functions + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + + [..] + *** How to configure Interrupts using CORTEX HAL driver *** + =========================================================== + [..] + This section provides functions allowing to configure the NVIC interrupts (IRQ). + The Cortex-M4 exceptions are managed by CMSIS functions. + + (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() + function according to the following table. + (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority(). + (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ(). + (#) please refer to programming manual for details in how to configure priority. + + -@- When the NVIC_PRIORITYGROUP_0 is selected, IRQ preemption is no more possible. + The pending IRQ priority will be managed only by the sub priority. + + -@- IRQ priority order (sorted by highest to lowest priority): + (+@) Lowest preemption priority + (+@) Lowest sub priority + (+@) Lowest hardware priority (IRQ number) + + [..] + *** How to configure Systick using CORTEX HAL driver *** + ======================================================== + [..] + Setup SysTick Timer for time base. + + (+) The HAL_SYSTICK_Config() function calls the SysTick_Config() function which + is a CMSIS function that: + (++) Configures the SysTick Reload register with value passed as function parameter. + (++) Configures the SysTick IRQ priority to the lowest value 0x0F. + (++) Resets the SysTick Counter register. + (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK). + (++) Enables the SysTick Interrupt. + (++) Starts the SysTick Counter. + + (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro + __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the + HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined + inside the stm32f4xx_hal_cortex.h file. + + (+) You can change the SysTick IRQ priority by calling the + HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function + call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function. + + (+) To adjust the SysTick time base, use the following formula: + + Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s) + (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function + (++) Reload Value should not exceed 0xFFFFFF + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup CORTEX CORTEX + * @brief CORTEX HAL module driver + * @{ + */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup CORTEX_Exported_Functions CORTEX Exported Functions + * @{ + */ + + +/** @defgroup CORTEX_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] + This section provides the CORTEX HAL driver functions allowing to configure Interrupts + Systick functionalities + +@endverbatim + * @{ + */ + + +/** + * @brief Sets the priority grouping field (preemption priority and subpriority) + * using the required unlock sequence. + * @param PriorityGroup The priority grouping bits length. + * This parameter can be one of the following values: + * @arg NVIC_PRIORITYGROUP_0: 0 bits for preemption priority + * 4 bits for subpriority + * @arg NVIC_PRIORITYGROUP_1: 1 bits for preemption priority + * 3 bits for subpriority + * @arg NVIC_PRIORITYGROUP_2: 2 bits for preemption priority + * 2 bits for subpriority + * @arg NVIC_PRIORITYGROUP_3: 3 bits for preemption priority + * 1 bits for subpriority + * @arg NVIC_PRIORITYGROUP_4: 4 bits for preemption priority + * 0 bits for subpriority + * @note When the NVIC_PriorityGroup_0 is selected, IRQ preemption is no more possible. + * The pending IRQ priority will be managed only by the subpriority. + * @retval None + */ +void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + /* Check the parameters */ + assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup)); + + /* Set the PRIGROUP[10:8] bits according to the PriorityGroup parameter value */ + NVIC_SetPriorityGrouping(PriorityGroup); +} + +/** + * @brief Sets the priority of an interrupt. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @param PreemptPriority The preemption priority for the IRQn channel. + * This parameter can be a value between 0 and 15 + * A lower priority value indicates a higher priority + * @param SubPriority the subpriority level for the IRQ channel. + * This parameter can be a value between 0 and 15 + * A lower priority value indicates a higher priority. + * @retval None + */ +void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t prioritygroup = 0x00U; + + /* Check the parameters */ + assert_param(IS_NVIC_SUB_PRIORITY(SubPriority)); + assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority)); + + prioritygroup = NVIC_GetPriorityGrouping(); + + NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority)); +} + +/** + * @brief Enables a device specific interrupt in the NVIC interrupt controller. + * @note To configure interrupts priority correctly, the NVIC_PriorityGroupConfig() + * function should be called before. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval None + */ +void HAL_NVIC_EnableIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Enable interrupt */ + NVIC_EnableIRQ(IRQn); +} + +/** + * @brief Disables a device specific interrupt in the NVIC interrupt controller. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval None + */ +void HAL_NVIC_DisableIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Disable interrupt */ + NVIC_DisableIRQ(IRQn); +} + +/** + * @brief Initiates a system reset request to reset the MCU. + * @retval None + */ +void HAL_NVIC_SystemReset(void) +{ + /* System Reset */ + NVIC_SystemReset(); +} + +/** + * @brief Initializes the System Timer and its interrupt, and starts the System Tick Timer. + * Counter is in free running mode to generate periodic interrupts. + * @param TicksNumb Specifies the ticks Number of ticks between two interrupts. + * @retval status: - 0 Function succeeded. + * - 1 Function failed. + */ +uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb) +{ + return SysTick_Config(TicksNumb); +} +/** + * @} + */ + +/** @defgroup CORTEX_Exported_Functions_Group2 Peripheral Control functions + * @brief Cortex control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control the CORTEX + (NVIC, SYSTICK, MPU) functionalities. + + +@endverbatim + * @{ + */ + +#if (__MPU_PRESENT == 1U) +/** + * @brief Disables the MPU + * @retval None + */ +void HAL_MPU_Disable(void) +{ + /* Make sure outstanding transfers are done */ + __DMB(); + + /* Disable fault exceptions */ + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; + + /* Disable the MPU and clear the control register*/ + MPU->CTRL = 0U; +} + +/** + * @brief Enable 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 + */ +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; + + /* Ensure MPU setting take effects */ + __DSB(); + __ISB(); +} + +/** + * @brief Initializes and configures the Region and the memory to be protected. + * @param MPU_Init Pointer to a MPU_Region_InitTypeDef structure that contains + * the initialization and configuration information. + * @retval None + */ +void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init) +{ + /* Check the parameters */ + assert_param(IS_MPU_REGION_NUMBER(MPU_Init->Number)); + assert_param(IS_MPU_REGION_ENABLE(MPU_Init->Enable)); + + /* Set the Region number */ + MPU->RNR = MPU_Init->Number; + + if ((MPU_Init->Enable) != RESET) + { + /* Check the parameters */ + assert_param(IS_MPU_INSTRUCTION_ACCESS(MPU_Init->DisableExec)); + assert_param(IS_MPU_REGION_PERMISSION_ATTRIBUTE(MPU_Init->AccessPermission)); + assert_param(IS_MPU_TEX_LEVEL(MPU_Init->TypeExtField)); + assert_param(IS_MPU_ACCESS_SHAREABLE(MPU_Init->IsShareable)); + assert_param(IS_MPU_ACCESS_CACHEABLE(MPU_Init->IsCacheable)); + assert_param(IS_MPU_ACCESS_BUFFERABLE(MPU_Init->IsBufferable)); + assert_param(IS_MPU_SUB_REGION_DISABLE(MPU_Init->SubRegionDisable)); + assert_param(IS_MPU_REGION_SIZE(MPU_Init->Size)); + + MPU->RBAR = MPU_Init->BaseAddress; + MPU->RASR = ((uint32_t)MPU_Init->DisableExec << MPU_RASR_XN_Pos) | + ((uint32_t)MPU_Init->AccessPermission << MPU_RASR_AP_Pos) | + ((uint32_t)MPU_Init->TypeExtField << MPU_RASR_TEX_Pos) | + ((uint32_t)MPU_Init->IsShareable << MPU_RASR_S_Pos) | + ((uint32_t)MPU_Init->IsCacheable << MPU_RASR_C_Pos) | + ((uint32_t)MPU_Init->IsBufferable << MPU_RASR_B_Pos) | + ((uint32_t)MPU_Init->SubRegionDisable << MPU_RASR_SRD_Pos) | + ((uint32_t)MPU_Init->Size << MPU_RASR_SIZE_Pos) | + ((uint32_t)MPU_Init->Enable << MPU_RASR_ENABLE_Pos); + } + else + { + MPU->RBAR = 0x00U; + MPU->RASR = 0x00U; + } +} +#endif /* __MPU_PRESENT */ + +/** + * @brief Gets the priority grouping field from the NVIC Interrupt Controller. + * @retval Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field) + */ +uint32_t HAL_NVIC_GetPriorityGrouping(void) +{ + /* Get the PRIGROUP[10:8] field value */ + return NVIC_GetPriorityGrouping(); +} + +/** + * @brief Gets the priority of an interrupt. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @param PriorityGroup the priority grouping bits length. + * This parameter can be one of the following values: + * @arg NVIC_PRIORITYGROUP_0: 0 bits for preemption priority + * 4 bits for subpriority + * @arg NVIC_PRIORITYGROUP_1: 1 bits for preemption priority + * 3 bits for subpriority + * @arg NVIC_PRIORITYGROUP_2: 2 bits for preemption priority + * 2 bits for subpriority + * @arg NVIC_PRIORITYGROUP_3: 3 bits for preemption priority + * 1 bits for subpriority + * @arg NVIC_PRIORITYGROUP_4: 4 bits for preemption priority + * 0 bits for subpriority + * @param pPreemptPriority Pointer on the Preemptive priority value (starting from 0). + * @param pSubPriority Pointer on the Subpriority value (starting from 0). + * @retval None + */ +void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority) +{ + /* Check the parameters */ + assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup)); + /* Get priority for Cortex-M system or device specific interrupts */ + NVIC_DecodePriority(NVIC_GetPriority(IRQn), PriorityGroup, pPreemptPriority, pSubPriority); +} + +/** + * @brief Sets Pending bit of an external interrupt. + * @param IRQn External interrupt number + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval None + */ +void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Set interrupt pending */ + NVIC_SetPendingIRQ(IRQn); +} + +/** + * @brief Gets Pending Interrupt (reads the pending register in the NVIC + * and returns the pending bit for the specified interrupt). + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval status: - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + */ +uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Return 1 if pending else 0 */ + return NVIC_GetPendingIRQ(IRQn); +} + +/** + * @brief Clears the pending bit of an external interrupt. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval None + */ +void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Clear pending interrupt */ + NVIC_ClearPendingIRQ(IRQn); +} + +/** + * @brief Gets active interrupt ( reads the active register in NVIC and returns the active bit). + * @param IRQn External interrupt number + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h)) + * @retval status: - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + */ +uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Return 1 if active else 0 */ + return NVIC_GetActive(IRQn); +} + +/** + * @brief Configures the SysTick clock source. + * @param CLKSource specifies the SysTick clock source. + * This parameter can be one of the following values: + * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source. + * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source. + * @retval None + */ +void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource) +{ + /* Check the parameters */ + assert_param(IS_SYSTICK_CLK_SOURCE(CLKSource)); + if (CLKSource == SYSTICK_CLKSOURCE_HCLK) + { + SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; + } + else + { + SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; + } +} + +/** + * @brief This function handles SYSTICK interrupt request. + * @retval None + */ +void HAL_SYSTICK_IRQHandler(void) +{ + HAL_SYSTICK_Callback(); +} + +/** + * @brief SYSTICK callback. + * @retval None + */ +__weak void HAL_SYSTICK_Callback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SYSTICK_Callback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_CORTEX_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c new file mode 100644 index 0000000..69d848f --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c @@ -0,0 +1,1305 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_dma.c + * @author MCD Application Team + * @brief DMA HAL module driver. + * + * This file provides firmware functions to manage the following + * functionalities of the Direct Memory Access (DMA) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + Peripheral State and errors functions + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Enable and configure the peripheral to be connected to the DMA Stream + (except for internal SRAM/FLASH memories: no initialization is + necessary) please refer to Reference manual for connection between peripherals + and DMA requests. + + (#) For a given Stream, program the required configuration through the following parameters: + Transfer Direction, Source and Destination data formats, + Circular, Normal or peripheral flow control mode, Stream Priority level, + Source and Destination Increment mode, FIFO mode and its Threshold (if needed), + Burst mode for Source and/or Destination (if needed) using HAL_DMA_Init() function. + + -@- Prior to HAL_DMA_Init() the clock must be enabled for DMA through the following macros: + __HAL_RCC_DMA1_CLK_ENABLE() or __HAL_RCC_DMA2_CLK_ENABLE(). + + *** Polling mode IO operation *** + ================================= + [..] + (+) Use HAL_DMA_Start() to start DMA transfer after the configuration of Source + address and destination address and the Length of data to be transferred. + (+) Use HAL_DMA_PollForTransfer() to poll for the end of current transfer, in this + case a fixed Timeout can be configured by User depending from his application. + (+) Use HAL_DMA_Abort() function to abort the current transfer. + + *** Interrupt mode IO operation *** + =================================== + [..] + (+) Configure the DMA interrupt priority using HAL_NVIC_SetPriority() + (+) Enable the DMA IRQ handler using HAL_NVIC_EnableIRQ() + (+) Use HAL_DMA_Start_IT() to start DMA transfer after the configuration of + Source address and destination address and the Length of data to be transferred. In this + case the DMA interrupt is configured + (+) Use HAL_DMA_IRQHandler() called under DMA_IRQHandler() Interrupt subroutine + (+) At the end of data transfer HAL_DMA_IRQHandler() function is executed and user can + add his own function by customization of function pointer XferCpltCallback and + XferErrorCallback (i.e a member of DMA handle structure). + [..] + (#) Use HAL_DMA_GetState() function to return the DMA state and HAL_DMA_GetError() in case of error + detection. + + (#) Use HAL_DMA_Abort_IT() function to abort the current transfer + + -@- In Memory-to-Memory transfer mode, Circular mode is not allowed. + + -@- The FIFO is used mainly to reduce bus usage and to allow data packing/unpacking: it is + possible to set different Data Sizes for the Peripheral and the Memory (ie. you can set + Half-Word data size for the peripheral to access its data register and set Word data size + for the Memory to gain in access time. Each two half words will be packed and written in + a single access to a Word in the Memory). + + -@- When FIFO is disabled, it is not allowed to configure different Data Sizes for Source + and Destination. In this case the Peripheral Data Size will be applied to both Source + and Destination. + + *** DMA HAL driver macros list *** + ============================================= + [..] + Below the list of most used macros in DMA HAL driver. + + (+) __HAL_DMA_ENABLE: Enable the specified DMA Stream. + (+) __HAL_DMA_DISABLE: Disable the specified DMA Stream. + (+) __HAL_DMA_GET_IT_SOURCE: Check whether the specified DMA Stream interrupt has occurred or not. + + [..] + (@) You can refer to the DMA HAL driver header file for more useful macros + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup DMA DMA + * @brief DMA HAL module driver + * @{ + */ + +#ifdef HAL_DMA_MODULE_ENABLED + +/* Private types -------------------------------------------------------------*/ +typedef struct +{ + __IO uint32_t ISR; /*!< DMA interrupt status register */ + __IO uint32_t Reserved0; + __IO uint32_t IFCR; /*!< DMA interrupt flag clear register */ +} DMA_Base_Registers; + +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @addtogroup DMA_Private_Constants + * @{ + */ + #define HAL_TIMEOUT_DMA_ABORT 5U /* 5 ms */ +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @addtogroup DMA_Private_Functions + * @{ + */ +static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +static uint32_t DMA_CalcBaseAndBitshift(DMA_HandleTypeDef *hdma); +static HAL_StatusTypeDef DMA_CheckFifoParam(DMA_HandleTypeDef *hdma); + +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ +/** @addtogroup DMA_Exported_Functions + * @{ + */ + +/** @addtogroup DMA_Exported_Functions_Group1 + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to initialize the DMA Stream source + and destination addresses, incrementation and data sizes, transfer direction, + circular/normal mode selection, memory-to-memory mode selection and Stream priority value. + [..] + The HAL_DMA_Init() function follows the DMA configuration procedures as described in + reference manual. + +@endverbatim + * @{ + */ + +/** + * @brief Initialize the DMA according to the specified + * parameters in the DMA_InitTypeDef and create the associated handle. + * @param hdma Pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma) +{ + uint32_t tmp = 0U; + uint32_t tickstart = HAL_GetTick(); + DMA_Base_Registers *regs; + + /* Check the DMA peripheral state */ + if(hdma == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_DMA_STREAM_ALL_INSTANCE(hdma->Instance)); + assert_param(IS_DMA_CHANNEL(hdma->Init.Channel)); + assert_param(IS_DMA_DIRECTION(hdma->Init.Direction)); + assert_param(IS_DMA_PERIPHERAL_INC_STATE(hdma->Init.PeriphInc)); + assert_param(IS_DMA_MEMORY_INC_STATE(hdma->Init.MemInc)); + assert_param(IS_DMA_PERIPHERAL_DATA_SIZE(hdma->Init.PeriphDataAlignment)); + assert_param(IS_DMA_MEMORY_DATA_SIZE(hdma->Init.MemDataAlignment)); + assert_param(IS_DMA_MODE(hdma->Init.Mode)); + assert_param(IS_DMA_PRIORITY(hdma->Init.Priority)); + assert_param(IS_DMA_FIFO_MODE_STATE(hdma->Init.FIFOMode)); + /* Check the memory burst, peripheral burst and FIFO threshold parameters only + when FIFO mode is enabled */ + if(hdma->Init.FIFOMode != DMA_FIFOMODE_DISABLE) + { + assert_param(IS_DMA_FIFO_THRESHOLD(hdma->Init.FIFOThreshold)); + assert_param(IS_DMA_MEMORY_BURST(hdma->Init.MemBurst)); + assert_param(IS_DMA_PERIPHERAL_BURST(hdma->Init.PeriphBurst)); + } + + /* Allocate lock resource */ + __HAL_UNLOCK(hdma); + + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Disable the peripheral */ + __HAL_DMA_DISABLE(hdma); + + /* Check if the DMA Stream is effectively disabled */ + while((hdma->Instance->CR & DMA_SxCR_EN) != RESET) + { + /* Check for the Timeout */ + if((HAL_GetTick() - tickstart ) > HAL_TIMEOUT_DMA_ABORT) + { + /* Update error code */ + hdma->ErrorCode = HAL_DMA_ERROR_TIMEOUT; + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_TIMEOUT; + + return HAL_TIMEOUT; + } + } + + /* Get the CR register value */ + tmp = hdma->Instance->CR; + + /* Clear CHSEL, MBURST, PBURST, PL, MSIZE, PSIZE, MINC, PINC, CIRC, DIR, CT and DBM bits */ + tmp &= ((uint32_t)~(DMA_SxCR_CHSEL | DMA_SxCR_MBURST | DMA_SxCR_PBURST | \ + DMA_SxCR_PL | DMA_SxCR_MSIZE | DMA_SxCR_PSIZE | \ + DMA_SxCR_MINC | DMA_SxCR_PINC | DMA_SxCR_CIRC | \ + DMA_SxCR_DIR | DMA_SxCR_CT | DMA_SxCR_DBM)); + + /* Prepare the DMA Stream configuration */ + tmp |= hdma->Init.Channel | hdma->Init.Direction | + hdma->Init.PeriphInc | hdma->Init.MemInc | + hdma->Init.PeriphDataAlignment | hdma->Init.MemDataAlignment | + hdma->Init.Mode | hdma->Init.Priority; + + /* the Memory burst and peripheral burst are not used when the FIFO is disabled */ + if(hdma->Init.FIFOMode == DMA_FIFOMODE_ENABLE) + { + /* Get memory burst and peripheral burst */ + tmp |= hdma->Init.MemBurst | hdma->Init.PeriphBurst; + } + + /* Write to DMA Stream CR register */ + hdma->Instance->CR = tmp; + + /* Get the FCR register value */ + tmp = hdma->Instance->FCR; + + /* Clear Direct mode and FIFO threshold bits */ + tmp &= (uint32_t)~(DMA_SxFCR_DMDIS | DMA_SxFCR_FTH); + + /* Prepare the DMA Stream FIFO configuration */ + tmp |= hdma->Init.FIFOMode; + + /* The FIFO threshold is not used when the FIFO mode is disabled */ + if(hdma->Init.FIFOMode == DMA_FIFOMODE_ENABLE) + { + /* Get the FIFO threshold */ + tmp |= hdma->Init.FIFOThreshold; + + /* Check compatibility between FIFO threshold level and size of the memory burst */ + /* for INCR4, INCR8, INCR16 bursts */ + if (hdma->Init.MemBurst != DMA_MBURST_SINGLE) + { + if (DMA_CheckFifoParam(hdma) != HAL_OK) + { + /* Update error code */ + hdma->ErrorCode = HAL_DMA_ERROR_PARAM; + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + return HAL_ERROR; + } + } + } + + /* Write to DMA Stream FCR */ + hdma->Instance->FCR = tmp; + + /* Initialize StreamBaseAddress and StreamIndex parameters to be used to calculate + DMA steam Base Address needed by HAL_DMA_IRQHandler() and HAL_DMA_PollForTransfer() */ + regs = (DMA_Base_Registers *)DMA_CalcBaseAndBitshift(hdma); + + /* Clear all interrupt flags */ + regs->IFCR = 0x3FU << hdma->StreamIndex; + + /* Initialize the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Initialize the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the DMA peripheral + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma) +{ + DMA_Base_Registers *regs; + + /* Check the DMA peripheral state */ + if(hdma == NULL) + { + return HAL_ERROR; + } + + /* Check the DMA peripheral state */ + if(hdma->State == HAL_DMA_STATE_BUSY) + { + /* Return error status */ + return HAL_BUSY; + } + + /* Check the parameters */ + assert_param(IS_DMA_STREAM_ALL_INSTANCE(hdma->Instance)); + + /* Disable the selected DMA Streamx */ + __HAL_DMA_DISABLE(hdma); + + /* Reset DMA Streamx control register */ + hdma->Instance->CR = 0U; + + /* Reset DMA Streamx number of data to transfer register */ + hdma->Instance->NDTR = 0U; + + /* Reset DMA Streamx peripheral address register */ + hdma->Instance->PAR = 0U; + + /* Reset DMA Streamx memory 0 address register */ + hdma->Instance->M0AR = 0U; + + /* Reset DMA Streamx memory 1 address register */ + hdma->Instance->M1AR = 0U; + + /* Reset DMA Streamx FIFO control register */ + hdma->Instance->FCR = 0x00000021U; + + /* Get DMA steam Base Address */ + regs = (DMA_Base_Registers *)DMA_CalcBaseAndBitshift(hdma); + + /* Clean all callbacks */ + hdma->XferCpltCallback = NULL; + hdma->XferHalfCpltCallback = NULL; + hdma->XferM1CpltCallback = NULL; + hdma->XferM1HalfCpltCallback = NULL; + hdma->XferErrorCallback = NULL; + hdma->XferAbortCallback = NULL; + + /* Clear all interrupt flags at correct offset within the register */ + regs->IFCR = 0x3FU << hdma->StreamIndex; + + /* Reset the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Reset the DMA state */ + hdma->State = HAL_DMA_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return HAL_OK; +} + +/** + * @} + */ + +/** @addtogroup DMA_Exported_Functions_Group2 + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Configure the source, destination address and data length and Start DMA transfer + (+) Configure the source, destination address and data length and + Start DMA transfer with interrupt + (+) Abort DMA transfer + (+) Poll for transfer complete + (+) Handle DMA interrupt request + +@endverbatim + * @{ + */ + +/** + * @brief Starts the DMA Transfer. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Start(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Initialize the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Configure the source, destination address and the data length */ + DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Enable the Peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Process unlocked */ + __HAL_UNLOCK(hdma); + + /* Return error status */ + status = HAL_BUSY; + } + return status; +} + +/** + * @brief Start the DMA Transfer with interrupt enabled. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* calculate DMA base and stream number */ + DMA_Base_Registers *regs = (DMA_Base_Registers *)hdma->StreamBaseAddress; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Initialize the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Configure the source, destination address and the data length */ + DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Clear all interrupt flags at correct offset within the register */ + regs->IFCR = 0x3FU << hdma->StreamIndex; + + /* Enable Common interrupts*/ + hdma->Instance->CR |= DMA_IT_TC | DMA_IT_TE | DMA_IT_DME; + + if(hdma->XferHalfCpltCallback != NULL) + { + hdma->Instance->CR |= DMA_IT_HT; + } + + /* Enable the Peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Process unlocked */ + __HAL_UNLOCK(hdma); + + /* Return error status */ + status = HAL_BUSY; + } + + return status; +} + +/** + * @brief Aborts the DMA Transfer. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * + * @note After disabling a DMA Stream, a check for wait until the DMA Stream is + * effectively disabled is added. If a Stream is disabled + * while a data transfer is ongoing, the current data will be transferred + * and the Stream will be effectively disabled only after the transfer of + * this single data is finished. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma) +{ + /* calculate DMA base and stream number */ + DMA_Base_Registers *regs = (DMA_Base_Registers *)hdma->StreamBaseAddress; + + uint32_t tickstart = HAL_GetTick(); + + if(hdma->State != HAL_DMA_STATE_BUSY) + { + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + return HAL_ERROR; + } + else + { + /* Disable all the transfer interrupts */ + hdma->Instance->CR &= ~(DMA_IT_TC | DMA_IT_TE | DMA_IT_DME); + hdma->Instance->FCR &= ~(DMA_IT_FE); + + if((hdma->XferHalfCpltCallback != NULL) || (hdma->XferM1HalfCpltCallback != NULL)) + { + hdma->Instance->CR &= ~(DMA_IT_HT); + } + + /* Disable the stream */ + __HAL_DMA_DISABLE(hdma); + + /* Check if the DMA Stream is effectively disabled */ + while((hdma->Instance->CR & DMA_SxCR_EN) != RESET) + { + /* Check for the Timeout */ + if((HAL_GetTick() - tickstart ) > HAL_TIMEOUT_DMA_ABORT) + { + /* Update error code */ + hdma->ErrorCode = HAL_DMA_ERROR_TIMEOUT; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_TIMEOUT; + + return HAL_TIMEOUT; + } + } + + /* Clear all interrupt flags at correct offset within the register */ + regs->IFCR = 0x3FU << hdma->StreamIndex; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state*/ + hdma->State = HAL_DMA_STATE_READY; + } + return HAL_OK; +} + +/** + * @brief Aborts the DMA Transfer in Interrupt mode. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma) +{ + if(hdma->State != HAL_DMA_STATE_BUSY) + { + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + return HAL_ERROR; + } + else + { + /* Set Abort State */ + hdma->State = HAL_DMA_STATE_ABORT; + + /* Disable the stream */ + __HAL_DMA_DISABLE(hdma); + } + + return HAL_OK; +} + +/** + * @brief Polling for transfer complete. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param CompleteLevel Specifies the DMA level complete. + * @note The polling mode is kept in this version for legacy. it is recommanded to use the IT model instead. + * This model could be used for debug purpose. + * @note The HAL_DMA_PollForTransfer API cannot be used in circular and double buffering mode (automatic circular mode). + * @param Timeout Timeout duration. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout) +{ + HAL_StatusTypeDef status = HAL_OK; + uint32_t mask_cpltlevel; + uint32_t tickstart = HAL_GetTick(); + uint32_t tmpisr; + + /* calculate DMA base and stream number */ + DMA_Base_Registers *regs; + + if(HAL_DMA_STATE_BUSY != hdma->State) + { + /* No transfer ongoing */ + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + __HAL_UNLOCK(hdma); + return HAL_ERROR; + } + + /* Polling mode not supported in circular mode and double buffering mode */ + if ((hdma->Instance->CR & DMA_SxCR_CIRC) != RESET) + { + hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED; + return HAL_ERROR; + } + + /* Get the level transfer complete flag */ + if(CompleteLevel == HAL_DMA_FULL_TRANSFER) + { + /* Transfer Complete flag */ + mask_cpltlevel = DMA_FLAG_TCIF0_4 << hdma->StreamIndex; + } + else + { + /* Half Transfer Complete flag */ + mask_cpltlevel = DMA_FLAG_HTIF0_4 << hdma->StreamIndex; + } + + regs = (DMA_Base_Registers *)hdma->StreamBaseAddress; + tmpisr = regs->ISR; + + while(((tmpisr & mask_cpltlevel) == RESET) && ((hdma->ErrorCode & HAL_DMA_ERROR_TE) == RESET)) + { + /* Check for the Timeout (Not applicable in circular mode)*/ + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) + { + /* Update error code */ + hdma->ErrorCode = HAL_DMA_ERROR_TIMEOUT; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + return HAL_TIMEOUT; + } + } + + /* Get the ISR register value */ + tmpisr = regs->ISR; + + if((tmpisr & (DMA_FLAG_TEIF0_4 << hdma->StreamIndex)) != RESET) + { + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_TE; + + /* Clear the transfer error flag */ + regs->IFCR = DMA_FLAG_TEIF0_4 << hdma->StreamIndex; + } + + if((tmpisr & (DMA_FLAG_FEIF0_4 << hdma->StreamIndex)) != RESET) + { + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_FE; + + /* Clear the FIFO error flag */ + regs->IFCR = DMA_FLAG_FEIF0_4 << hdma->StreamIndex; + } + + if((tmpisr & (DMA_FLAG_DMEIF0_4 << hdma->StreamIndex)) != RESET) + { + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_DME; + + /* Clear the Direct Mode error flag */ + regs->IFCR = DMA_FLAG_DMEIF0_4 << hdma->StreamIndex; + } + } + + if(hdma->ErrorCode != HAL_DMA_ERROR_NONE) + { + if((hdma->ErrorCode & HAL_DMA_ERROR_TE) != RESET) + { + HAL_DMA_Abort(hdma); + + /* Clear the half transfer and transfer complete flags */ + regs->IFCR = (DMA_FLAG_HTIF0_4 | DMA_FLAG_TCIF0_4) << hdma->StreamIndex; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State= HAL_DMA_STATE_READY; + + return HAL_ERROR; + } + } + + /* Get the level transfer complete flag */ + if(CompleteLevel == HAL_DMA_FULL_TRANSFER) + { + /* Clear the half transfer and transfer complete flags */ + regs->IFCR = (DMA_FLAG_HTIF0_4 | DMA_FLAG_TCIF0_4) << hdma->StreamIndex; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + hdma->State = HAL_DMA_STATE_READY; + } + else + { + /* Clear the half transfer and transfer complete flags */ + regs->IFCR = (DMA_FLAG_HTIF0_4) << hdma->StreamIndex; + } + + return status; +} + +/** + * @brief Handles DMA interrupt request. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval None + */ +void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma) +{ + uint32_t tmpisr; + __IO uint32_t count = 0U; + uint32_t timeout = SystemCoreClock / 9600U; + + /* calculate DMA base and stream number */ + DMA_Base_Registers *regs = (DMA_Base_Registers *)hdma->StreamBaseAddress; + + tmpisr = regs->ISR; + + /* Transfer Error Interrupt management ***************************************/ + if ((tmpisr & (DMA_FLAG_TEIF0_4 << hdma->StreamIndex)) != RESET) + { + if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_TE) != RESET) + { + /* Disable the transfer error interrupt */ + hdma->Instance->CR &= ~(DMA_IT_TE); + + /* Clear the transfer error flag */ + regs->IFCR = DMA_FLAG_TEIF0_4 << hdma->StreamIndex; + + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_TE; + } + } + /* FIFO Error Interrupt management ******************************************/ + if ((tmpisr & (DMA_FLAG_FEIF0_4 << hdma->StreamIndex)) != RESET) + { + if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_FE) != RESET) + { + /* Clear the FIFO error flag */ + regs->IFCR = DMA_FLAG_FEIF0_4 << hdma->StreamIndex; + + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_FE; + } + } + /* Direct Mode Error Interrupt management ***********************************/ + if ((tmpisr & (DMA_FLAG_DMEIF0_4 << hdma->StreamIndex)) != RESET) + { + if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_DME) != RESET) + { + /* Clear the direct mode error flag */ + regs->IFCR = DMA_FLAG_DMEIF0_4 << hdma->StreamIndex; + + /* Update error code */ + hdma->ErrorCode |= HAL_DMA_ERROR_DME; + } + } + /* Half Transfer Complete Interrupt management ******************************/ + if ((tmpisr & (DMA_FLAG_HTIF0_4 << hdma->StreamIndex)) != RESET) + { + if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_HT) != RESET) + { + /* Clear the half transfer complete flag */ + regs->IFCR = DMA_FLAG_HTIF0_4 << hdma->StreamIndex; + + /* Multi_Buffering mode enabled */ + if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != RESET) + { + /* Current memory buffer used is Memory 0 */ + if((hdma->Instance->CR & DMA_SxCR_CT) == RESET) + { + if(hdma->XferHalfCpltCallback != NULL) + { + /* Half transfer callback */ + hdma->XferHalfCpltCallback(hdma); + } + } + /* Current memory buffer used is Memory 1 */ + else + { + if(hdma->XferM1HalfCpltCallback != NULL) + { + /* Half transfer callback */ + hdma->XferM1HalfCpltCallback(hdma); + } + } + } + else + { + /* Disable the half transfer interrupt if the DMA mode is not CIRCULAR */ + if((hdma->Instance->CR & DMA_SxCR_CIRC) == RESET) + { + /* Disable the half transfer interrupt */ + hdma->Instance->CR &= ~(DMA_IT_HT); + } + + if(hdma->XferHalfCpltCallback != NULL) + { + /* Half transfer callback */ + hdma->XferHalfCpltCallback(hdma); + } + } + } + } + /* Transfer Complete Interrupt management ***********************************/ + if ((tmpisr & (DMA_FLAG_TCIF0_4 << hdma->StreamIndex)) != RESET) + { + if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_TC) != RESET) + { + /* Clear the transfer complete flag */ + regs->IFCR = DMA_FLAG_TCIF0_4 << hdma->StreamIndex; + + if(HAL_DMA_STATE_ABORT == hdma->State) + { + /* Disable all the transfer interrupts */ + hdma->Instance->CR &= ~(DMA_IT_TC | DMA_IT_TE | DMA_IT_DME); + hdma->Instance->FCR &= ~(DMA_IT_FE); + + if((hdma->XferHalfCpltCallback != NULL) || (hdma->XferM1HalfCpltCallback != NULL)) + { + hdma->Instance->CR &= ~(DMA_IT_HT); + } + + /* Clear all interrupt flags at correct offset within the register */ + regs->IFCR = 0x3FU << hdma->StreamIndex; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + if(hdma->XferAbortCallback != NULL) + { + hdma->XferAbortCallback(hdma); + } + return; + } + + if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != RESET) + { + /* Current memory buffer used is Memory 0 */ + if((hdma->Instance->CR & DMA_SxCR_CT) == RESET) + { + if(hdma->XferM1CpltCallback != NULL) + { + /* Transfer complete Callback for memory1 */ + hdma->XferM1CpltCallback(hdma); + } + } + /* Current memory buffer used is Memory 1 */ + else + { + if(hdma->XferCpltCallback != NULL) + { + /* Transfer complete Callback for memory0 */ + hdma->XferCpltCallback(hdma); + } + } + } + /* Disable the transfer complete interrupt if the DMA mode is not CIRCULAR */ + else + { + if((hdma->Instance->CR & DMA_SxCR_CIRC) == RESET) + { + /* Disable the transfer complete interrupt */ + hdma->Instance->CR &= ~(DMA_IT_TC); + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + } + + if(hdma->XferCpltCallback != NULL) + { + /* Transfer complete callback */ + hdma->XferCpltCallback(hdma); + } + } + } + } + + /* manage error case */ + if(hdma->ErrorCode != HAL_DMA_ERROR_NONE) + { + if((hdma->ErrorCode & HAL_DMA_ERROR_TE) != RESET) + { + hdma->State = HAL_DMA_STATE_ABORT; + + /* Disable the stream */ + __HAL_DMA_DISABLE(hdma); + + do + { + if (++count > timeout) + { + break; + } + } + while((hdma->Instance->CR & DMA_SxCR_EN) != RESET); + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + } + + if(hdma->XferErrorCallback != NULL) + { + /* Transfer error callback */ + hdma->XferErrorCallback(hdma); + } + } +} + +/** + * @brief Register callbacks + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param CallbackID User Callback identifer + * a DMA_HandleTypeDef structure as parameter. + * @param pCallback pointer to private callbacsk function which has pointer to + * a DMA_HandleTypeDef structure as parameter. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)(DMA_HandleTypeDef *_hdma)) +{ + + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + switch (CallbackID) + { + case HAL_DMA_XFER_CPLT_CB_ID: + hdma->XferCpltCallback = pCallback; + break; + + case HAL_DMA_XFER_HALFCPLT_CB_ID: + hdma->XferHalfCpltCallback = pCallback; + break; + + case HAL_DMA_XFER_M1CPLT_CB_ID: + hdma->XferM1CpltCallback = pCallback; + break; + + case HAL_DMA_XFER_M1HALFCPLT_CB_ID: + hdma->XferM1HalfCpltCallback = pCallback; + break; + + case HAL_DMA_XFER_ERROR_CB_ID: + hdma->XferErrorCallback = pCallback; + break; + + case HAL_DMA_XFER_ABORT_CB_ID: + hdma->XferAbortCallback = pCallback; + break; + + default: + break; + } + } + else + { + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return status; +} + +/** + * @brief UnRegister callbacks + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param CallbackID User Callback identifer + * a HAL_DMA_CallbackIDTypeDef ENUM as parameter. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + switch (CallbackID) + { + case HAL_DMA_XFER_CPLT_CB_ID: + hdma->XferCpltCallback = NULL; + break; + + case HAL_DMA_XFER_HALFCPLT_CB_ID: + hdma->XferHalfCpltCallback = NULL; + break; + + case HAL_DMA_XFER_M1CPLT_CB_ID: + hdma->XferM1CpltCallback = NULL; + break; + + case HAL_DMA_XFER_M1HALFCPLT_CB_ID: + hdma->XferM1HalfCpltCallback = NULL; + break; + + case HAL_DMA_XFER_ERROR_CB_ID: + hdma->XferErrorCallback = NULL; + break; + + case HAL_DMA_XFER_ABORT_CB_ID: + hdma->XferAbortCallback = NULL; + break; + + case HAL_DMA_XFER_ALL_CB_ID: + hdma->XferCpltCallback = NULL; + hdma->XferHalfCpltCallback = NULL; + hdma->XferM1CpltCallback = NULL; + hdma->XferM1HalfCpltCallback = NULL; + hdma->XferErrorCallback = NULL; + hdma->XferAbortCallback = NULL; + break; + + default: + status = HAL_ERROR; + break; + } + } + else + { + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return status; +} + +/** + * @} + */ + +/** @addtogroup DMA_Exported_Functions_Group3 + * +@verbatim + =============================================================================== + ##### State and Errors functions ##### + =============================================================================== + [..] + This subsection provides functions allowing to + (+) Check the DMA state + (+) Get error code + +@endverbatim + * @{ + */ + +/** + * @brief Returns the DMA state. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval HAL state + */ +HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma) +{ + return hdma->State; +} + +/** + * @brief Return the DMA error code + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval DMA Error Code + */ +uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma) +{ + return hdma->ErrorCode; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup DMA_Private_Functions + * @{ + */ + +/** + * @brief Sets the DMA Transfer parameter. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + /* Clear DBM bit */ + hdma->Instance->CR &= (uint32_t)(~DMA_SxCR_DBM); + + /* Configure DMA Stream data length */ + hdma->Instance->NDTR = DataLength; + + /* Memory to Peripheral */ + if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH) + { + /* Configure DMA Stream destination address */ + hdma->Instance->PAR = DstAddress; + + /* Configure DMA Stream source address */ + hdma->Instance->M0AR = SrcAddress; + } + /* Peripheral to Memory */ + else + { + /* Configure DMA Stream source address */ + hdma->Instance->PAR = SrcAddress; + + /* Configure DMA Stream destination address */ + hdma->Instance->M0AR = DstAddress; + } +} + +/** + * @brief Returns the DMA Stream base address depending on stream number + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval Stream base address + */ +static uint32_t DMA_CalcBaseAndBitshift(DMA_HandleTypeDef *hdma) +{ + uint32_t stream_number = (((uint32_t)hdma->Instance & 0xFFU) - 16U) / 24U; + + /* lookup table for necessary bitshift of flags within status registers */ + static const uint8_t flagBitshiftOffset[8U] = {0U, 6U, 16U, 22U, 0U, 6U, 16U, 22U}; + hdma->StreamIndex = flagBitshiftOffset[stream_number]; + + if (stream_number > 3U) + { + /* return pointer to HISR and HIFCR */ + hdma->StreamBaseAddress = (((uint32_t)hdma->Instance & (uint32_t)(~0x3FFU)) + 4U); + } + else + { + /* return pointer to LISR and LIFCR */ + hdma->StreamBaseAddress = ((uint32_t)hdma->Instance & (uint32_t)(~0x3FFU)); + } + + return hdma->StreamBaseAddress; +} + +/** + * @brief Check compatibility between FIFO threshold level and size of the memory burst + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @retval HAL status + */ +static HAL_StatusTypeDef DMA_CheckFifoParam(DMA_HandleTypeDef *hdma) +{ + HAL_StatusTypeDef status = HAL_OK; + uint32_t tmp = hdma->Init.FIFOThreshold; + + /* Memory Data size equal to Byte */ + if(hdma->Init.MemDataAlignment == DMA_MDATAALIGN_BYTE) + { + switch (tmp) + { + case DMA_FIFO_THRESHOLD_1QUARTERFULL: + case DMA_FIFO_THRESHOLD_3QUARTERSFULL: + if ((hdma->Init.MemBurst & DMA_SxCR_MBURST_1) == DMA_SxCR_MBURST_1) + { + status = HAL_ERROR; + } + break; + case DMA_FIFO_THRESHOLD_HALFFULL: + if (hdma->Init.MemBurst == DMA_MBURST_INC16) + { + status = HAL_ERROR; + } + break; + case DMA_FIFO_THRESHOLD_FULL: + break; + default: + break; + } + } + + /* Memory Data size equal to Half-Word */ + else if (hdma->Init.MemDataAlignment == DMA_MDATAALIGN_HALFWORD) + { + switch (tmp) + { + case DMA_FIFO_THRESHOLD_1QUARTERFULL: + case DMA_FIFO_THRESHOLD_3QUARTERSFULL: + status = HAL_ERROR; + break; + case DMA_FIFO_THRESHOLD_HALFFULL: + if ((hdma->Init.MemBurst & DMA_SxCR_MBURST_1) == DMA_SxCR_MBURST_1) + { + status = HAL_ERROR; + } + break; + case DMA_FIFO_THRESHOLD_FULL: + if (hdma->Init.MemBurst == DMA_MBURST_INC16) + { + status = HAL_ERROR; + } + break; + default: + break; + } + } + + /* Memory Data size equal to Word */ + else + { + switch (tmp) + { + case DMA_FIFO_THRESHOLD_1QUARTERFULL: + case DMA_FIFO_THRESHOLD_HALFFULL: + case DMA_FIFO_THRESHOLD_3QUARTERSFULL: + status = HAL_ERROR; + break; + case DMA_FIFO_THRESHOLD_FULL: + if ((hdma->Init.MemBurst & DMA_SxCR_MBURST_1) == DMA_SxCR_MBURST_1) + { + status = HAL_ERROR; + } + break; + default: + break; + } + } + + return status; +} + +/** + * @} + */ + +#endif /* HAL_DMA_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c new file mode 100644 index 0000000..6e07376 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c @@ -0,0 +1,315 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_dma_ex.c + * @author MCD Application Team + * @brief DMA Extension HAL module driver + * This file provides firmware functions to manage the following + * functionalities of the DMA Extension peripheral: + * + Extended features functions + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The DMA Extension HAL driver can be used as follows: + (#) Start a multi buffer transfer using the HAL_DMA_MultiBufferStart() function + for polling mode or HAL_DMA_MultiBufferStart_IT() for interrupt mode. + + -@- In Memory-to-Memory transfer mode, Multi (Double) Buffer mode is not allowed. + -@- When Multi (Double) Buffer mode is enabled the, transfer is circular by default. + -@- In Multi (Double) buffer mode, it is possible to update the base address for + the AHB memory port on the fly (DMA_SxM0AR or DMA_SxM1AR) when the stream is enabled. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup DMAEx DMAEx + * @brief DMA Extended HAL module driver + * @{ + */ + +#ifdef HAL_DMA_MODULE_ENABLED + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private Constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @addtogroup DMAEx_Private_Functions + * @{ + */ +static void DMA_MultiBufferSetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ + +/** @addtogroup DMAEx_Exported_Functions + * @{ + */ + + +/** @addtogroup DMAEx_Exported_Functions_Group1 + * +@verbatim + =============================================================================== + ##### Extended features functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Configure the source, destination address and data length and + Start MultiBuffer DMA transfer + (+) Configure the source, destination address and data length and + Start MultiBuffer DMA transfer with interrupt + (+) Change on the fly the memory0 or memory1 address. + +@endverbatim + * @{ + */ + + +/** + * @brief Starts the multi_buffer DMA Transfer. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param SecondMemAddress The second memory Buffer address in case of multi buffer Transfer + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Memory-to-memory transfer not supported in double buffering mode */ + if (hdma->Init.Direction == DMA_MEMORY_TO_MEMORY) + { + hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED; + status = HAL_ERROR; + } + else + { + /* Process Locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Enable the double buffer mode */ + hdma->Instance->CR |= (uint32_t)DMA_SxCR_DBM; + + /* Configure DMA Stream destination address */ + hdma->Instance->M1AR = SecondMemAddress; + + /* Configure the source, destination address and the data length */ + DMA_MultiBufferSetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Enable the peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Return error status */ + status = HAL_BUSY; + } + } + return status; +} + +/** + * @brief Starts the multi_buffer DMA Transfer with interrupt enabled. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param SecondMemAddress The second memory Buffer address in case of multi buffer Transfer + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Memory-to-memory transfer not supported in double buffering mode */ + if (hdma->Init.Direction == DMA_MEMORY_TO_MEMORY) + { + hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED; + return HAL_ERROR; + } + + /* Check callback functions */ + if ((NULL == hdma->XferCpltCallback) || (NULL == hdma->XferM1CpltCallback) || (NULL == hdma->XferErrorCallback)) + { + hdma->ErrorCode = HAL_DMA_ERROR_PARAM; + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Initialize the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Enable the Double buffer mode */ + hdma->Instance->CR |= (uint32_t)DMA_SxCR_DBM; + + /* Configure DMA Stream destination address */ + hdma->Instance->M1AR = SecondMemAddress; + + /* Configure the source, destination address and the data length */ + DMA_MultiBufferSetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Clear all flags */ + __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma)); + __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma)); + __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma)); + __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma)); + __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma)); + + /* Enable Common interrupts*/ + hdma->Instance->CR |= DMA_IT_TC | DMA_IT_TE | DMA_IT_DME; + hdma->Instance->FCR |= DMA_IT_FE; + + if((hdma->XferHalfCpltCallback != NULL) || (hdma->XferM1HalfCpltCallback != NULL)) + { + hdma->Instance->CR |= DMA_IT_HT; + } + + /* Enable the peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Process unlocked */ + __HAL_UNLOCK(hdma); + + /* Return error status */ + status = HAL_BUSY; + } + return status; +} + +/** + * @brief Change the memory0 or memory1 address on the fly. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param Address The new address + * @param memory the memory to be changed, This parameter can be one of + * the following values: + * MEMORY0 / + * MEMORY1 + * @note The MEMORY0 address can be changed only when the current transfer use + * MEMORY1 and the MEMORY1 address can be changed only when the current + * transfer use MEMORY0. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory) +{ + if(memory == MEMORY0) + { + /* change the memory0 address */ + hdma->Instance->M0AR = Address; + } + else + { + /* change the memory1 address */ + hdma->Instance->M1AR = Address; + } + + return HAL_OK; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup DMAEx_Private_Functions + * @{ + */ + +/** + * @brief Set the DMA Transfer parameter. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Stream. + * @param SrcAddress The source memory Buffer address + * @param DstAddress The destination memory Buffer address + * @param DataLength The length of data to be transferred from source to destination + * @retval HAL status + */ +static void DMA_MultiBufferSetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + /* Configure DMA Stream data length */ + hdma->Instance->NDTR = DataLength; + + /* Peripheral to Memory */ + if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH) + { + /* Configure DMA Stream destination address */ + hdma->Instance->PAR = DstAddress; + + /* Configure DMA Stream source address */ + hdma->Instance->M0AR = SrcAddress; + } + /* Memory to Peripheral */ + else + { + /* Configure DMA Stream source address */ + hdma->Instance->PAR = SrcAddress; + + /* Configure DMA Stream destination address */ + hdma->Instance->M0AR = DstAddress; + } +} + +/** + * @} + */ + +#endif /* HAL_DMA_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c new file mode 100644 index 0000000..7cf3e09 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c @@ -0,0 +1,559 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_exti.c + * @author MCD Application Team + * @brief EXTI HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Extended Interrupts and events controller (EXTI) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + @verbatim + ============================================================================== + ##### EXTI Peripheral features ##### + ============================================================================== + [..] + (+) Each Exti line can be configured within this driver. + + (+) Exti line can be configured in 3 different modes + (++) Interrupt + (++) Event + (++) Both of them + + (+) Configurable Exti lines can be configured with 3 different triggers + (++) Rising + (++) Falling + (++) Both of them + + (+) When set in interrupt mode, configurable Exti lines have two different + interrupts pending registers which allow to distinguish which transition + occurs: + (++) Rising edge pending interrupt + (++) Falling + + (+) Exti lines 0 to 15 are linked to gpio pin number 0 to 15. Gpio port can + be selected through multiplexer. + + ##### How to use this driver ##### + ============================================================================== + [..] + + (#) Configure the EXTI line using HAL_EXTI_SetConfigLine(). + (++) Choose the interrupt line number by setting "Line" member from + EXTI_ConfigTypeDef structure. + (++) Configure the interrupt and/or event mode using "Mode" member from + EXTI_ConfigTypeDef structure. + (++) For configurable lines, configure rising and/or falling trigger + "Trigger" member from EXTI_ConfigTypeDef structure. + (++) For Exti lines linked to gpio, choose gpio port using "GPIOSel" + member from GPIO_InitTypeDef structure. + + (#) Get current Exti configuration of a dedicated line using + HAL_EXTI_GetConfigLine(). + (++) Provide exiting handle as parameter. + (++) Provide pointer on EXTI_ConfigTypeDef structure as second parameter. + + (#) Clear Exti configuration of a dedicated line using HAL_EXTI_GetConfigLine(). + (++) Provide exiting handle as parameter. + + (#) Register callback to treat Exti interrupts using HAL_EXTI_RegisterCallback(). + (++) Provide exiting handle as first parameter. + (++) Provide which callback will be registered using one value from + EXTI_CallbackIDTypeDef. + (++) Provide callback function pointer. + + (#) Get interrupt pending bit using HAL_EXTI_GetPending(). + + (#) Clear interrupt pending bit using HAL_EXTI_GetPending(). + + (#) Generate software interrupt using HAL_EXTI_GenerateSWI(). + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2018 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @addtogroup EXTI + * @{ + */ +/** MISRA C:2012 deviation rule has been granted for following rule: + * Rule-18.1_b - Medium: Array `EXTICR' 1st subscript interval [0,7] may be out + * of bounds [0,3] in following API : + * HAL_EXTI_SetConfigLine + * HAL_EXTI_GetConfigLine + * HAL_EXTI_ClearConfigLine + */ + +#ifdef HAL_EXTI_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private defines -----------------------------------------------------------*/ +/** @defgroup EXTI_Private_Constants EXTI Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup EXTI_Exported_Functions + * @{ + */ + +/** @addtogroup EXTI_Exported_Functions_Group1 + * @brief Configuration functions + * +@verbatim + =============================================================================== + ##### Configuration functions ##### + =============================================================================== + +@endverbatim + * @{ + */ + +/** + * @brief Set configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @param pExtiConfig Pointer on EXTI configuration to be set. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if ((hexti == NULL) || (pExtiConfig == NULL)) + { + return HAL_ERROR; + } + + /* Check parameters */ + assert_param(IS_EXTI_LINE(pExtiConfig->Line)); + assert_param(IS_EXTI_MODE(pExtiConfig->Mode)); + + /* Assign line number to handle */ + hexti->Line = pExtiConfig->Line; + + /* Compute line mask */ + linepos = (pExtiConfig->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* Configure triggers for configurable lines */ + if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u) + { + assert_param(IS_EXTI_TRIGGER(pExtiConfig->Trigger)); + + /* Configure rising trigger */ + /* Mask or set line */ + if ((pExtiConfig->Trigger & EXTI_TRIGGER_RISING) != 0x00u) + { + EXTI->RTSR |= maskline; + } + else + { + EXTI->RTSR &= ~maskline; + } + + /* Configure falling trigger */ + /* Mask or set line */ + if ((pExtiConfig->Trigger & EXTI_TRIGGER_FALLING) != 0x00u) + { + EXTI->FTSR |= maskline; + } + else + { + EXTI->FTSR &= ~maskline; + } + + + /* Configure gpio port selection in case of gpio exti line */ + if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PORT(pExtiConfig->GPIOSel)); + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = SYSCFG->EXTICR[linepos >> 2u]; + regval &= ~(SYSCFG_EXTICR1_EXTI0 << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + regval |= (pExtiConfig->GPIOSel << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + SYSCFG->EXTICR[linepos >> 2u] = regval; + } + } + + /* Configure interrupt mode : read current mode */ + /* Mask or set line */ + if ((pExtiConfig->Mode & EXTI_MODE_INTERRUPT) != 0x00u) + { + EXTI->IMR |= maskline; + } + else + { + EXTI->IMR &= ~maskline; + } + + /* Configure event mode : read current mode */ + /* Mask or set line */ + if ((pExtiConfig->Mode & EXTI_MODE_EVENT) != 0x00u) + { + EXTI->EMR |= maskline; + } + else + { + EXTI->EMR &= ~maskline; + } + + return HAL_OK; +} + +/** + * @brief Get configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @param pExtiConfig Pointer on structure to store Exti configuration. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if ((hexti == NULL) || (pExtiConfig == NULL)) + { + return HAL_ERROR; + } + + /* Check the parameter */ + assert_param(IS_EXTI_LINE(hexti->Line)); + + /* Store handle line number to configuration structure */ + pExtiConfig->Line = hexti->Line; + + /* Compute line mask */ + linepos = (pExtiConfig->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* 1] Get core mode : interrupt */ + + /* Check if selected line is enable */ + if ((EXTI->IMR & maskline) != 0x00u) + { + pExtiConfig->Mode = EXTI_MODE_INTERRUPT; + } + else + { + pExtiConfig->Mode = EXTI_MODE_NONE; + } + + /* Get event mode */ + /* Check if selected line is enable */ + if ((EXTI->EMR & maskline) != 0x00u) + { + pExtiConfig->Mode |= EXTI_MODE_EVENT; + } + + /* 2] Get trigger for configurable lines : rising */ + if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u) + { + /* Check if configuration of selected line is enable */ + if ((EXTI->RTSR & maskline) != 0x00u) + { + pExtiConfig->Trigger = EXTI_TRIGGER_RISING; + } + else + { + pExtiConfig->Trigger = EXTI_TRIGGER_NONE; + } + + /* Get falling configuration */ + /* Check if configuration of selected line is enable */ + if ((EXTI->FTSR & maskline) != 0x00u) + { + pExtiConfig->Trigger |= EXTI_TRIGGER_FALLING; + } + + /* Get Gpio port selection for gpio lines */ + if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = SYSCFG->EXTICR[linepos >> 2u]; + pExtiConfig->GPIOSel = ((regval << (SYSCFG_EXTICR1_EXTI1_Pos * (3uL - (linepos & 0x03u)))) >> 24); + } + else + { + pExtiConfig->GPIOSel = 0x00u; + } + } + else + { + /* No Trigger selected */ + pExtiConfig->Trigger = EXTI_TRIGGER_NONE; + pExtiConfig->GPIOSel = 0x00u; + } + + return HAL_OK; +} + +/** + * @brief Clear whole configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if (hexti == NULL) + { + return HAL_ERROR; + } + + /* Check the parameter */ + assert_param(IS_EXTI_LINE(hexti->Line)); + + /* compute line mask */ + linepos = (hexti->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* 1] Clear interrupt mode */ + EXTI->IMR = (EXTI->IMR & ~maskline); + + /* 2] Clear event mode */ + EXTI->EMR = (EXTI->EMR & ~maskline); + + /* 3] Clear triggers in case of configurable lines */ + if ((hexti->Line & EXTI_CONFIG) != 0x00u) + { + EXTI->RTSR = (EXTI->RTSR & ~maskline); + EXTI->FTSR = (EXTI->FTSR & ~maskline); + + /* Get Gpio port selection for gpio lines */ + if ((hexti->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = SYSCFG->EXTICR[linepos >> 2u]; + regval &= ~(SYSCFG_EXTICR1_EXTI0 << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + SYSCFG->EXTICR[linepos >> 2u] = regval; + } + } + + return HAL_OK; +} + +/** + * @brief Register callback for a dedicated Exti line. + * @param hexti Exti handle. + * @param CallbackID User callback identifier. + * This parameter can be one of @arg @ref EXTI_CallbackIDTypeDef values. + * @param pPendingCbfn function pointer to be stored as callback. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void)) +{ + HAL_StatusTypeDef status = HAL_OK; + + switch (CallbackID) + { + case HAL_EXTI_COMMON_CB_ID: + hexti->PendingCallback = pPendingCbfn; + break; + + default: + status = HAL_ERROR; + break; + } + + return status; +} + +/** + * @brief Store line number as handle private field. + * @param hexti Exti handle. + * @param ExtiLine Exti line number. + * This parameter can be from 0 to @ref EXTI_LINE_NB. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine) +{ + /* Check the parameters */ + assert_param(IS_EXTI_LINE(ExtiLine)); + + /* Check null pointer */ + if (hexti == NULL) + { + return HAL_ERROR; + } + else + { + /* Store line number as handle private field */ + hexti->Line = ExtiLine; + + return HAL_OK; + } +} + +/** + * @} + */ + +/** @addtogroup EXTI_Exported_Functions_Group2 + * @brief EXTI IO functions. + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + +@endverbatim + * @{ + */ + +/** + * @brief Handle EXTI interrupt request. + * @param hexti Exti handle. + * @retval none. + */ +void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti) +{ + uint32_t regval; + uint32_t maskline; + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Get pending bit */ + regval = (EXTI->PR & maskline); + if (regval != 0x00u) + { + /* Clear pending bit */ + EXTI->PR = maskline; + + /* Call callback */ + if (hexti->PendingCallback != NULL) + { + hexti->PendingCallback(); + } + } +} + +/** + * @brief Get interrupt pending bit of a dedicated line. + * @param hexti Exti handle. + * @param Edge Specify which pending edge as to be checked. + * This parameter can be one of the following values: + * @arg @ref EXTI_TRIGGER_RISING_FALLING + * This parameter is kept for compatibility with other series. + * @retval 1 if interrupt is pending else 0. + */ +uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + assert_param(IS_EXTI_PENDING_EDGE(Edge)); + + /* Compute line mask */ + linepos = (hexti->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* return 1 if bit is set else 0 */ + regval = ((EXTI->PR & maskline) >> linepos); + return regval; +} + +/** + * @brief Clear interrupt pending bit of a dedicated line. + * @param hexti Exti handle. + * @param Edge Specify which pending edge as to be clear. + * This parameter can be one of the following values: + * @arg @ref EXTI_TRIGGER_RISING_FALLING + * This parameter is kept for compatibility with other series. + * @retval None. + */ +void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge) +{ + uint32_t maskline; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + assert_param(IS_EXTI_PENDING_EDGE(Edge)); + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Clear Pending bit */ + EXTI->PR = maskline; +} + +/** + * @brief Generate a software interrupt for a dedicated line. + * @param hexti Exti handle. + * @retval None. + */ +void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti) +{ + uint32_t maskline; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Generate Software interrupt */ + EXTI->SWIER = maskline; +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_EXTI_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c new file mode 100644 index 0000000..69b47a6 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c @@ -0,0 +1,778 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash.c + * @author MCD Application Team + * @brief FLASH HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the internal FLASH memory: + * + Program operations functions + * + Memory Control functions + * + Peripheral Errors functions + * + @verbatim + ============================================================================== + ##### FLASH peripheral features ##### + ============================================================================== + + [..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses + to the Flash memory. It implements the erase and program Flash memory operations + and the read and write protection mechanisms. + + [..] The Flash memory interface accelerates code execution with a system of instruction + prefetch and cache lines. + + [..] The FLASH main features are: + (+) Flash memory read operations + (+) Flash memory program/erase operations + (+) Read / write protections + (+) Prefetch on I-Code + (+) 64 cache lines of 128 bits on I-Code + (+) 8 cache lines of 128 bits on D-Code + + + ##### How to use this driver ##### + ============================================================================== + [..] + This driver provides functions and macros to configure and program the FLASH + memory of all STM32F4xx devices. + + (#) FLASH Memory IO Programming functions: + (++) Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and + HAL_FLASH_Lock() functions + (++) Program functions: byte, half word, word and double word + (++) There Two modes of programming : + (+++) Polling mode using HAL_FLASH_Program() function + (+++) Interrupt mode using HAL_FLASH_Program_IT() function + + (#) Interrupts and flags management functions : + (++) Handle FLASH interrupts by calling HAL_FLASH_IRQHandler() + (++) Wait for last FLASH operation according to its status + (++) Get error flag status by calling HAL_SetErrorCode() + + [..] + In addition to these functions, this driver includes a set of macros allowing + to handle the following operations: + (+) Set the latency + (+) Enable/Disable the prefetch buffer + (+) Enable/Disable the Instruction cache and the Data cache + (+) Reset the Instruction cache and the Data cache + (+) Enable/Disable the FLASH interrupts + (+) Monitor the FLASH flags status + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup FLASH FLASH + * @brief FLASH HAL module driver + * @{ + */ + +#ifdef HAL_FLASH_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup FLASH_Private_Constants + * @{ + */ +#define FLASH_TIMEOUT_VALUE 50000U /* 50 s */ +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @addtogroup FLASH_Private_Variables + * @{ + */ +/* Variable used for Erase sectors under interruption */ +FLASH_ProcessTypeDef pFlash; +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/** @addtogroup FLASH_Private_Functions + * @{ + */ +/* Program operations */ +static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data); +static void FLASH_Program_Word(uint32_t Address, uint32_t Data); +static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data); +static void FLASH_Program_Byte(uint32_t Address, uint8_t Data); +static void FLASH_SetErrorCode(void); + +HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Functions FLASH Exported Functions + * @{ + */ + +/** @defgroup FLASH_Exported_Functions_Group1 Programming operation functions + * @brief Programming operation functions + * +@verbatim + =============================================================================== + ##### Programming operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the FLASH + program operations. + +@endverbatim + * @{ + */ + +/** + * @brief Program byte, halfword, word or double word at a specified address + * @param TypeProgram Indicate the way to program at a specified address. + * This parameter can be a value of @ref FLASH_Type_Program + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data) +{ + HAL_StatusTypeDef status = HAL_ERROR; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + if(TypeProgram == FLASH_TYPEPROGRAM_BYTE) + { + /*Program byte (8-bit) at a specified address.*/ + FLASH_Program_Byte(Address, (uint8_t) Data); + } + else if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD) + { + /*Program halfword (16-bit) at a specified address.*/ + FLASH_Program_HalfWord(Address, (uint16_t) Data); + } + else if(TypeProgram == FLASH_TYPEPROGRAM_WORD) + { + /*Program word (32-bit) at a specified address.*/ + FLASH_Program_Word(Address, (uint32_t) Data); + } + else + { + /*Program double word (64-bit) at a specified address.*/ + FLASH_Program_DoubleWord(Address, Data); + } + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the program operation is completed, disable the PG Bit */ + FLASH->CR &= (~FLASH_CR_PG); + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Program byte, halfword, word or double word at a specified address with interrupt enabled. + * @param TypeProgram Indicate the way to program at a specified address. + * This parameter can be a value of @ref FLASH_Type_Program + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); + + /* Enable End of FLASH Operation interrupt */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP); + + /* Enable Error source interrupt */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_ERR); + + pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAM; + pFlash.Address = Address; + + if(TypeProgram == FLASH_TYPEPROGRAM_BYTE) + { + /*Program byte (8-bit) at a specified address.*/ + FLASH_Program_Byte(Address, (uint8_t) Data); + } + else if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD) + { + /*Program halfword (16-bit) at a specified address.*/ + FLASH_Program_HalfWord(Address, (uint16_t) Data); + } + else if(TypeProgram == FLASH_TYPEPROGRAM_WORD) + { + /*Program word (32-bit) at a specified address.*/ + FLASH_Program_Word(Address, (uint32_t) Data); + } + else + { + /*Program double word (64-bit) at a specified address.*/ + FLASH_Program_DoubleWord(Address, Data); + } + + return status; +} + +/** + * @brief This function handles FLASH interrupt request. + * @retval None + */ +void HAL_FLASH_IRQHandler(void) +{ + uint32_t addresstmp = 0U; + + /* Check FLASH operation error flags */ +#if defined(FLASH_SR_RDERR) + if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \ + FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR)) != RESET) +#else + if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \ + FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR)) != RESET) +#endif /* FLASH_SR_RDERR */ + { + if(pFlash.ProcedureOnGoing == FLASH_PROC_SECTERASE) + { + /*return the faulty sector*/ + addresstmp = pFlash.Sector; + pFlash.Sector = 0xFFFFFFFFU; + } + else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE) + { + /*return the faulty bank*/ + addresstmp = pFlash.Bank; + } + else + { + /*return the faulty address*/ + addresstmp = pFlash.Address; + } + + /*Save the Error code*/ + FLASH_SetErrorCode(); + + /* FLASH error interrupt user callback */ + HAL_FLASH_OperationErrorCallback(addresstmp); + + /*Stop the procedure ongoing*/ + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + + /* Check FLASH End of Operation flag */ + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP) != RESET) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); + + if(pFlash.ProcedureOnGoing == FLASH_PROC_SECTERASE) + { + /*Nb of sector to erased can be decreased*/ + pFlash.NbSectorsToErase--; + + /* Check if there are still sectors to erase*/ + if(pFlash.NbSectorsToErase != 0U) + { + addresstmp = pFlash.Sector; + /*Indicate user which sector has been erased*/ + HAL_FLASH_EndOfOperationCallback(addresstmp); + + /*Increment sector number*/ + pFlash.Sector++; + addresstmp = pFlash.Sector; + FLASH_Erase_Sector(addresstmp, pFlash.VoltageForErase); + } + else + { + /*No more sectors to Erase, user callback can be called.*/ + /*Reset Sector and stop Erase sectors procedure*/ + pFlash.Sector = addresstmp = 0xFFFFFFFFU; + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + + /* Flush the caches to be sure of the data consistency */ + FLASH_FlushCaches() ; + + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(addresstmp); + } + } + else + { + if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE) + { + /* MassErase ended. Return the selected bank */ + /* Flush the caches to be sure of the data consistency */ + FLASH_FlushCaches() ; + + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(pFlash.Bank); + } + else + { + /*Program ended. Return the selected address*/ + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(pFlash.Address); + } + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + } + + if(pFlash.ProcedureOnGoing == FLASH_PROC_NONE) + { + /* Operation is completed, disable the PG, SER, SNB and MER Bits */ + CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_SER | FLASH_CR_SNB | FLASH_MER_BIT)); + + /* Disable End of FLASH Operation interrupt */ + __HAL_FLASH_DISABLE_IT(FLASH_IT_EOP); + + /* Disable Error source interrupt */ + __HAL_FLASH_DISABLE_IT(FLASH_IT_ERR); + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + } +} + +/** + * @brief FLASH end of operation interrupt callback + * @param ReturnValue The value saved in this parameter depends on the ongoing procedure + * Mass Erase: Bank number which has been requested to erase + * Sectors Erase: Sector which has been erased + * (if 0xFFFFFFFFU, it means that all the selected sectors have been erased) + * Program: Address which was selected for data program + * @retval None + */ +__weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(ReturnValue); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_FLASH_EndOfOperationCallback could be implemented in the user file + */ +} + +/** + * @brief FLASH operation error interrupt callback + * @param ReturnValue The value saved in this parameter depends on the ongoing procedure + * Mass Erase: Bank number which has been requested to erase + * Sectors Erase: Sector number which returned an error + * Program: Address which was selected for data program + * @retval None + */ +__weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(ReturnValue); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_FLASH_OperationErrorCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup FLASH_Exported_Functions_Group2 Peripheral Control functions + * @brief management functions + * +@verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the FLASH + memory operations. + +@endverbatim + * @{ + */ + +/** + * @brief Unlock the FLASH control register access + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Unlock(void) +{ + HAL_StatusTypeDef status = HAL_OK; + + if(READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET) + { + /* Authorize the FLASH Registers access */ + WRITE_REG(FLASH->KEYR, FLASH_KEY1); + WRITE_REG(FLASH->KEYR, FLASH_KEY2); + + /* Verify Flash is unlocked */ + if(READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET) + { + status = HAL_ERROR; + } + } + + return status; +} + +/** + * @brief Locks the FLASH control register access + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Lock(void) +{ + /* Set the LOCK Bit to lock the FLASH Registers access */ + FLASH->CR |= FLASH_CR_LOCK; + + return HAL_OK; +} + +/** + * @brief Unlock the FLASH Option Control Registers access. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void) +{ + if((FLASH->OPTCR & FLASH_OPTCR_OPTLOCK) != RESET) + { + /* Authorizes the Option Byte register programming */ + FLASH->OPTKEYR = FLASH_OPT_KEY1; + FLASH->OPTKEYR = FLASH_OPT_KEY2; + } + else + { + return HAL_ERROR; + } + + return HAL_OK; +} + +/** + * @brief Lock the FLASH Option Control Registers access. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_OB_Lock(void) +{ + /* Set the OPTLOCK Bit to lock the FLASH Option Byte Registers access */ + FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK; + + return HAL_OK; +} + +/** + * @brief Launch the option byte loading. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_OB_Launch(void) +{ + /* Set the OPTSTRT bit in OPTCR register */ + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= FLASH_OPTCR_OPTSTRT; + + /* Wait for last operation to be completed */ + return(FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE)); +} + +/** + * @} + */ + +/** @defgroup FLASH_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief Peripheral Errors functions + * +@verbatim + =============================================================================== + ##### Peripheral Errors functions ##### + =============================================================================== + [..] + This subsection permits to get in run-time Errors of the FLASH peripheral. + +@endverbatim + * @{ + */ + +/** + * @brief Get the specific FLASH error flag. + * @retval FLASH_ErrorCode: The returned value can be a combination of: + * @arg HAL_FLASH_ERROR_RD: FLASH Read Protection error flag (PCROP) + * @arg HAL_FLASH_ERROR_PGS: FLASH Programming Sequence error flag + * @arg HAL_FLASH_ERROR_PGP: FLASH Programming Parallelism error flag + * @arg HAL_FLASH_ERROR_PGA: FLASH Programming Alignment error flag + * @arg HAL_FLASH_ERROR_WRP: FLASH Write protected error flag + * @arg HAL_FLASH_ERROR_OPERATION: FLASH operation Error flag + */ +uint32_t HAL_FLASH_GetError(void) +{ + return pFlash.ErrorCode; +} + +/** + * @} + */ + +/** + * @brief Wait for a FLASH operation to complete. + * @param Timeout maximum flash operationtimeout + * @retval HAL Status + */ +HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) +{ + uint32_t tickstart = 0U; + + /* Clear Error Code */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset. + Even if the FLASH operation fails, the BUSY flag will be reset and an error + flag will be set */ + /* Get tick */ + tickstart = HAL_GetTick(); + + while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY) != RESET) + { + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + /* Check FLASH End of Operation flag */ + if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP) != RESET) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); + } +#if defined(FLASH_SR_RDERR) + if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \ + FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR)) != RESET) +#else + if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \ + FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR)) != RESET) +#endif /* FLASH_SR_RDERR */ + { + /*Save the error code*/ + FLASH_SetErrorCode(); + return HAL_ERROR; + } + + /* If there is no error flag set */ + return HAL_OK; + +} + +/** + * @brief Program a double word (64-bit) at a specified address. + * @note This function must be used when the device voltage range is from + * 2.7V to 3.6V and Vpp in the range 7V to 9V. + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed. + * @retval None + */ +static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data) +{ + /* Check the parameters */ + assert_param(IS_FLASH_ADDRESS(Address)); + + /* If the previous operation is completed, proceed to program the new data */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= FLASH_PSIZE_DOUBLE_WORD; + FLASH->CR |= FLASH_CR_PG; + + /* Program first word */ + *(__IO uint32_t*)Address = (uint32_t)Data; + + /* Barrier to ensure programming is performed in 2 steps, in right order + (independently of compiler optimization behavior) */ + __ISB(); + + /* Program second word */ + *(__IO uint32_t*)(Address+4) = (uint32_t)(Data >> 32); +} + + +/** + * @brief Program word (32-bit) at a specified address. + * @note This function must be used when the device voltage range is from + * 2.7V to 3.6V. + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed. + * @retval None + */ +static void FLASH_Program_Word(uint32_t Address, uint32_t Data) +{ + /* Check the parameters */ + assert_param(IS_FLASH_ADDRESS(Address)); + + /* If the previous operation is completed, proceed to program the new data */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= FLASH_PSIZE_WORD; + FLASH->CR |= FLASH_CR_PG; + + *(__IO uint32_t*)Address = Data; +} + +/** + * @brief Program a half-word (16-bit) at a specified address. + * @note This function must be used when the device voltage range is from + * 2.1V to 3.6V. + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed. + * @retval None + */ +static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data) +{ + /* Check the parameters */ + assert_param(IS_FLASH_ADDRESS(Address)); + + /* If the previous operation is completed, proceed to program the new data */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= FLASH_PSIZE_HALF_WORD; + FLASH->CR |= FLASH_CR_PG; + + *(__IO uint16_t*)Address = Data; +} + +/** + * @brief Program byte (8-bit) at a specified address. + * @note This function must be used when the device voltage range is from + * 1.8V to 3.6V. + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @param Address specifies the address to be programmed. + * @param Data specifies the data to be programmed. + * @retval None + */ +static void FLASH_Program_Byte(uint32_t Address, uint8_t Data) +{ + /* Check the parameters */ + assert_param(IS_FLASH_ADDRESS(Address)); + + /* If the previous operation is completed, proceed to program the new data */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= FLASH_PSIZE_BYTE; + FLASH->CR |= FLASH_CR_PG; + + *(__IO uint8_t*)Address = Data; +} + +/** + * @brief Set the specific FLASH error flag. + * @retval None + */ +static void FLASH_SetErrorCode(void) +{ + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP; + + /* Clear FLASH write protection error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR); + } + + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGAERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_PGA; + + /* Clear FLASH Programming alignment error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGAERR); + } + + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGPERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_PGP; + + /* Clear FLASH Programming parallelism error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGPERR); + } + + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGSERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_PGS; + + /* Clear FLASH Programming sequence error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR); + } +#if defined(FLASH_SR_RDERR) + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_RDERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_RD; + + /* Clear FLASH Proprietary readout protection error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_RDERR); + } +#endif /* FLASH_SR_RDERR */ + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_OPERR) != RESET) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_OPERATION; + + /* Clear FLASH Operation error pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR); + } +} + +/** + * @} + */ + +#endif /* HAL_FLASH_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c new file mode 100644 index 0000000..066aa50 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c @@ -0,0 +1,1350 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash_ex.c + * @author MCD Application Team + * @brief Extended FLASH HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the FLASH extension peripheral: + * + Extended programming operations functions + * + @verbatim + ============================================================================== + ##### Flash Extension features ##### + ============================================================================== + + [..] Comparing to other previous devices, the FLASH interface for STM32F427xx/437xx and + STM32F429xx/439xx devices contains the following additional features + + (+) Capacity up to 2 Mbyte with dual bank architecture supporting read-while-write + capability (RWW) + (+) Dual bank memory organization + (+) PCROP protection for all banks + + ##### How to use this driver ##### + ============================================================================== + [..] This driver provides functions to configure and program the FLASH memory + of all STM32F427xx/437xx, STM32F429xx/439xx, STM32F469xx/479xx and STM32F446xx + devices. It includes + (#) FLASH Memory Erase functions: + (++) Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and + HAL_FLASH_Lock() functions + (++) Erase function: Erase sector, erase all sectors + (++) There are two modes of erase : + (+++) Polling Mode using HAL_FLASHEx_Erase() + (+++) Interrupt Mode using HAL_FLASHEx_Erase_IT() + + (#) Option Bytes Programming functions: Use HAL_FLASHEx_OBProgram() to : + (++) Set/Reset the write protection + (++) Set the Read protection Level + (++) Set the BOR level + (++) Program the user Option Bytes + (#) Advanced Option Bytes Programming functions: Use HAL_FLASHEx_AdvOBProgram() to : + (++) Extended space (bank 2) erase function + (++) Full FLASH space (2 Mo) erase (bank 1 and bank 2) + (++) Dual Boot activation + (++) Write protection configuration for bank 2 + (++) PCROP protection configuration and control for both banks + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup FLASHEx FLASHEx + * @brief FLASH HAL Extension module driver + * @{ + */ + +#ifdef HAL_FLASH_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup FLASHEx_Private_Constants + * @{ + */ +#define FLASH_TIMEOUT_VALUE 50000U /* 50 s */ +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @addtogroup FLASHEx_Private_Variables + * @{ + */ +extern FLASH_ProcessTypeDef pFlash; +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/** @addtogroup FLASHEx_Private_Functions + * @{ + */ +/* Option bytes control */ +static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks); +static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks); +static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks); +static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t Level); +static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t Iwdg, uint8_t Stop, uint8_t Stdby); +static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig(uint8_t Level); +static uint8_t FLASH_OB_GetUser(void); +static uint16_t FLASH_OB_GetWRP(void); +static uint8_t FLASH_OB_GetRDP(void); +static uint8_t FLASH_OB_GetBOR(void); + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\ + defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t Sector); +static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t Sector); +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx + STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks); +static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks); +static HAL_StatusTypeDef FLASH_OB_BootConfig(uint8_t BootConfig); +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +extern HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup FLASHEx_Exported_Functions FLASHEx Exported Functions + * @{ + */ + +/** @defgroup FLASHEx_Exported_Functions_Group1 Extended IO operation functions + * @brief Extended IO operation functions + * +@verbatim + =============================================================================== + ##### Extended programming operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the Extension FLASH + programming operations. + +@endverbatim + * @{ + */ +/** + * @brief Perform a mass erase or erase the specified FLASH memory sectors + * @param[in] pEraseInit pointer to an FLASH_EraseInitTypeDef structure that + * contains the configuration information for the erasing. + * + * @param[out] SectorError pointer to variable that + * contains the configuration information on faulty sector in case of error + * (0xFFFFFFFFU means that all the sectors have been correctly erased) + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError) +{ + HAL_StatusTypeDef status = HAL_ERROR; + uint32_t index = 0U; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /*Initialization of SectorError variable*/ + *SectorError = 0xFFFFFFFFU; + + if(pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE) + { + /*Mass erase to be done*/ + FLASH_MassErase((uint8_t) pEraseInit->VoltageRange, pEraseInit->Banks); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* if the erase operation is completed, disable the MER Bit */ + FLASH->CR &= (~FLASH_MER_BIT); + } + else + { + /* Check the parameters */ + assert_param(IS_FLASH_NBSECTORS(pEraseInit->NbSectors + pEraseInit->Sector)); + + /* Erase by sector by sector to be done*/ + for(index = pEraseInit->Sector; index < (pEraseInit->NbSectors + pEraseInit->Sector); index++) + { + FLASH_Erase_Sector(index, (uint8_t) pEraseInit->VoltageRange); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the SER and SNB Bits */ + CLEAR_BIT(FLASH->CR, (FLASH_CR_SER | FLASH_CR_SNB)); + + if(status != HAL_OK) + { + /* In case of error, stop erase procedure and return the faulty sector*/ + *SectorError = index; + break; + } + } + } + /* Flush the caches to be sure of the data consistency */ + FLASH_FlushCaches(); + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Perform a mass erase or erase the specified FLASH memory sectors with interrupt enabled + * @param pEraseInit pointer to an FLASH_EraseInitTypeDef structure that + * contains the configuration information for the erasing. + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase)); + + /* Enable End of FLASH Operation interrupt */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP); + + /* Enable Error source interrupt */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_ERR); + + /* Clear pending flags (if any) */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |\ + FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR| FLASH_FLAG_PGSERR); + + if(pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE) + { + /*Mass erase to be done*/ + pFlash.ProcedureOnGoing = FLASH_PROC_MASSERASE; + pFlash.Bank = pEraseInit->Banks; + FLASH_MassErase((uint8_t) pEraseInit->VoltageRange, pEraseInit->Banks); + } + else + { + /* Erase by sector to be done*/ + + /* Check the parameters */ + assert_param(IS_FLASH_NBSECTORS(pEraseInit->NbSectors + pEraseInit->Sector)); + + pFlash.ProcedureOnGoing = FLASH_PROC_SECTERASE; + pFlash.NbSectorsToErase = pEraseInit->NbSectors; + pFlash.Sector = pEraseInit->Sector; + pFlash.VoltageForErase = (uint8_t)pEraseInit->VoltageRange; + + /*Erase 1st sector and wait for IT*/ + FLASH_Erase_Sector(pEraseInit->Sector, pEraseInit->VoltageRange); + } + + return status; +} + +/** + * @brief Program option bytes + * @param pOBInit pointer to an FLASH_OBInitStruct structure that + * contains the configuration information for the programming. + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit) +{ + HAL_StatusTypeDef status = HAL_ERROR; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_OPTIONBYTE(pOBInit->OptionType)); + + /*Write protection configuration*/ + if((pOBInit->OptionType & OPTIONBYTE_WRP) == OPTIONBYTE_WRP) + { + assert_param(IS_WRPSTATE(pOBInit->WRPState)); + if(pOBInit->WRPState == OB_WRPSTATE_ENABLE) + { + /*Enable of Write protection on the selected Sector*/ + status = FLASH_OB_EnableWRP(pOBInit->WRPSector, pOBInit->Banks); + } + else + { + /*Disable of Write protection on the selected Sector*/ + status = FLASH_OB_DisableWRP(pOBInit->WRPSector, pOBInit->Banks); + } + } + + /*Read protection configuration*/ + if((pOBInit->OptionType & OPTIONBYTE_RDP) == OPTIONBYTE_RDP) + { + status = FLASH_OB_RDP_LevelConfig(pOBInit->RDPLevel); + } + + /*USER configuration*/ + if((pOBInit->OptionType & OPTIONBYTE_USER) == OPTIONBYTE_USER) + { + status = FLASH_OB_UserConfig(pOBInit->USERConfig&OB_IWDG_SW, + pOBInit->USERConfig&OB_STOP_NO_RST, + pOBInit->USERConfig&OB_STDBY_NO_RST); + } + + /*BOR Level configuration*/ + if((pOBInit->OptionType & OPTIONBYTE_BOR) == OPTIONBYTE_BOR) + { + status = FLASH_OB_BOR_LevelConfig(pOBInit->BORLevel); + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Get the Option byte configuration + * @param pOBInit pointer to an FLASH_OBInitStruct structure that + * contains the configuration information for the programming. + * + * @retval None + */ +void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit) +{ + pOBInit->OptionType = OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_BOR; + + /*Get WRP*/ + pOBInit->WRPSector = (uint32_t)FLASH_OB_GetWRP(); + + /*Get RDP Level*/ + pOBInit->RDPLevel = (uint32_t)FLASH_OB_GetRDP(); + + /*Get USER*/ + pOBInit->USERConfig = (uint8_t)FLASH_OB_GetUser(); + + /*Get BOR Level*/ + pOBInit->BORLevel = (uint32_t)FLASH_OB_GetBOR(); +} + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Program option bytes + * @param pAdvOBInit pointer to an FLASH_AdvOBProgramInitTypeDef structure that + * contains the configuration information for the programming. + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit) +{ + HAL_StatusTypeDef status = HAL_ERROR; + + /* Check the parameters */ + assert_param(IS_OBEX(pAdvOBInit->OptionType)); + + /*Program PCROP option byte*/ + if(((pAdvOBInit->OptionType) & OPTIONBYTE_PCROP) == OPTIONBYTE_PCROP) + { + /* Check the parameters */ + assert_param(IS_PCROPSTATE(pAdvOBInit->PCROPState)); + if((pAdvOBInit->PCROPState) == OB_PCROP_STATE_ENABLE) + { + /*Enable of Write protection on the selected Sector*/ +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\ + defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) + status = FLASH_OB_EnablePCROP(pAdvOBInit->Sectors); +#else /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ + status = FLASH_OB_EnablePCROP(pAdvOBInit->SectorsBank1, pAdvOBInit->SectorsBank2, pAdvOBInit->Banks); +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || + STM32F413xx || STM32F423xx */ + } + else + { + /*Disable of Write protection on the selected Sector*/ +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\ + defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) + status = FLASH_OB_DisablePCROP(pAdvOBInit->Sectors); +#else /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ + status = FLASH_OB_DisablePCROP(pAdvOBInit->SectorsBank1, pAdvOBInit->SectorsBank2, pAdvOBInit->Banks); +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || + STM32F413xx || STM32F423xx */ + } + } + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + /*Program BOOT config option byte*/ + if(((pAdvOBInit->OptionType) & OPTIONBYTE_BOOTCONFIG) == OPTIONBYTE_BOOTCONFIG) + { + status = FLASH_OB_BootConfig(pAdvOBInit->BootConfig); + } +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + + return status; +} + +/** + * @brief Get the OBEX byte configuration + * @param pAdvOBInit pointer to an FLASH_AdvOBProgramInitTypeDef structure that + * contains the configuration information for the programming. + * + * @retval None + */ +void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit) +{ +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\ + defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) + /*Get Sector*/ + pAdvOBInit->Sectors = (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS)); +#else /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ + /*Get Sector for Bank1*/ + pAdvOBInit->SectorsBank1 = (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS)); + + /*Get Sector for Bank2*/ + pAdvOBInit->SectorsBank2 = (*(__IO uint16_t *)(OPTCR1_BYTE2_ADDRESS)); + + /*Get Boot config OB*/ + pAdvOBInit->BootConfig = *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS; +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || + STM32F413xx || STM32F423xx */ +} + +/** + * @brief Select the Protection Mode + * + * @note After PCROP activated Option Byte modification NOT POSSIBLE! excepted + * Global Read Out Protection modification (from level1 to level0) + * @note Once SPRMOD bit is active unprotection of a protected sector is not possible + * @note Read a protected sector will set RDERR Flag and write a protected sector will set WRPERR Flag + * @note This function can be used only for STM32F42xxx/STM32F43xxx/STM32F401xx/STM32F411xx/STM32F446xx/ + * STM32F469xx/STM32F479xx/STM32F412xx/STM32F413xx devices. + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void) +{ + uint8_t optiontmp = 0xFF; + + /* Mask SPRMOD bit */ + optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE3_ADDRESS) & (uint8_t)0x7F); + + /* Update Option Byte */ + *(__IO uint8_t *)OPTCR_BYTE3_ADDRESS = (uint8_t)(OB_PCROP_SELECTED | optiontmp); + + return HAL_OK; +} + +/** + * @brief Deselect the Protection Mode + * + * @note After PCROP activated Option Byte modification NOT POSSIBLE! excepted + * Global Read Out Protection modification (from level1 to level0) + * @note Once SPRMOD bit is active unprotection of a protected sector is not possible + * @note Read a protected sector will set RDERR Flag and write a protected sector will set WRPERR Flag + * @note This function can be used only for STM32F42xxx/STM32F43xxx/STM32F401xx/STM32F411xx/STM32F446xx/ + * STM32F469xx/STM32F479xx/STM32F412xx/STM32F413xx devices. + * + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void) +{ + uint8_t optiontmp = 0xFF; + + /* Mask SPRMOD bit */ + optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE3_ADDRESS) & (uint8_t)0x7F); + + /* Update Option Byte */ + *(__IO uint8_t *)OPTCR_BYTE3_ADDRESS = (uint8_t)(OB_PCROP_DESELECTED | optiontmp); + + return HAL_OK; +} +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx ||\ + STM32F411xE || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || + STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Returns the FLASH Write Protection Option Bytes value for Bank 2 + * @note This function can be used only for STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx devices. + * @retval The FLASH Write Protection Option Bytes value + */ +uint16_t HAL_FLASHEx_OB_GetBank2WRP(void) +{ + /* Return the FLASH write protection Register value */ + return (*(__IO uint16_t *)(OPTCR1_BYTE2_ADDRESS)); +} +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +/** + * @} + */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Full erase of FLASH memory sectors + * @param VoltageRange The device voltage range which defines the erase parallelism. + * This parameter can be one of the following values: + * @arg FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, + * the operation will be done by byte (8-bit) + * @arg FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, + * the operation will be done by half word (16-bit) + * @arg FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, + * the operation will be done by word (32-bit) + * @arg FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, + * the operation will be done by double word (64-bit) + * + * @param Banks Banks to be erased + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: Bank1 to be erased + * @arg FLASH_BANK_2: Bank2 to be erased + * @arg FLASH_BANK_BOTH: Bank1 and Bank2 to be erased + * + * @retval HAL Status + */ +static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks) +{ + /* Check the parameters */ + assert_param(IS_VOLTAGERANGE(VoltageRange)); + assert_param(IS_FLASH_BANK(Banks)); + + /* if the previous operation is completed, proceed to erase all sectors */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + + if(Banks == FLASH_BANK_BOTH) + { + /* bank1 & bank2 will be erased*/ + FLASH->CR |= FLASH_MER_BIT; + } + else if(Banks == FLASH_BANK_1) + { + /*Only bank1 will be erased*/ + FLASH->CR |= FLASH_CR_MER1; + } + else + { + /*Only bank2 will be erased*/ + FLASH->CR |= FLASH_CR_MER2; + } + FLASH->CR |= FLASH_CR_STRT | ((uint32_t)VoltageRange <<8U); +} + +/** + * @brief Erase the specified FLASH memory sector + * @param Sector FLASH sector to erase + * The value of this parameter depend on device used within the same series + * @param VoltageRange The device voltage range which defines the erase parallelism. + * This parameter can be one of the following values: + * @arg FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, + * the operation will be done by byte (8-bit) + * @arg FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, + * the operation will be done by half word (16-bit) + * @arg FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, + * the operation will be done by word (32-bit) + * @arg FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, + * the operation will be done by double word (64-bit) + * + * @retval None + */ +void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange) +{ + uint32_t tmp_psize = 0U; + + /* Check the parameters */ + assert_param(IS_FLASH_SECTOR(Sector)); + assert_param(IS_VOLTAGERANGE(VoltageRange)); + + if(VoltageRange == FLASH_VOLTAGE_RANGE_1) + { + tmp_psize = FLASH_PSIZE_BYTE; + } + else if(VoltageRange == FLASH_VOLTAGE_RANGE_2) + { + tmp_psize = FLASH_PSIZE_HALF_WORD; + } + else if(VoltageRange == FLASH_VOLTAGE_RANGE_3) + { + tmp_psize = FLASH_PSIZE_WORD; + } + else + { + tmp_psize = FLASH_PSIZE_DOUBLE_WORD; + } + + /* Need to add offset of 4 when sector higher than FLASH_SECTOR_11 */ + if(Sector > FLASH_SECTOR_11) + { + Sector += 4U; + } + /* If the previous operation is completed, proceed to erase the sector */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= tmp_psize; + CLEAR_BIT(FLASH->CR, FLASH_CR_SNB); + FLASH->CR |= FLASH_CR_SER | (Sector << FLASH_CR_SNB_Pos); + FLASH->CR |= FLASH_CR_STRT; +} + +/** + * @brief Enable the write protection of the desired bank1 or bank 2 sectors + * + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash sector i if CortexM4 + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * @note Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1). + * + * @param WRPSector specifies the sector(s) to be write protected. + * This parameter can be one of the following values: + * @arg WRPSector: A value between OB_WRP_SECTOR_0 and OB_WRP_SECTOR_23 + * @arg OB_WRP_SECTOR_All + * @note BANK2 starts from OB_WRP_SECTOR_12 + * + * @param Banks Enable write protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: WRP on all sectors of bank1 + * @arg FLASH_BANK_2: WRP on all sectors of bank2 + * @arg FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2 + * + * @retval HAL FLASH State + */ +static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_WRP_SECTOR(WRPSector)); + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + if(((WRPSector == OB_WRP_SECTOR_All) && ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))) || + (WRPSector < OB_WRP_SECTOR_12)) + { + if(WRPSector == OB_WRP_SECTOR_All) + { + /*Write protection on all sector of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~(WRPSector>>12)); + } + else + { + /*Write protection done on sectors of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~WRPSector); + } + } + else + { + /*Write protection done on sectors of BANK2*/ + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS &= (~(WRPSector>>12)); + } + + /*Write protection on all sector of BANK2*/ + if((WRPSector == OB_WRP_SECTOR_All) && (Banks == FLASH_BANK_BOTH)) + { + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS &= (~(WRPSector>>12)); + } + } + + } + return status; +} + +/** + * @brief Disable the write protection of the desired bank1 or bank 2 sectors + * + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash sector i if CortexM4 + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * @note Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1). + * + * @param WRPSector specifies the sector(s) to be write protected. + * This parameter can be one of the following values: + * @arg WRPSector: A value between OB_WRP_SECTOR_0 and OB_WRP_SECTOR_23 + * @arg OB_WRP_Sector_All + * @note BANK2 starts from OB_WRP_SECTOR_12 + * + * @param Banks Disable write protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: Bank1 to be erased + * @arg FLASH_BANK_2: Bank2 to be erased + * @arg FLASH_BANK_BOTH: Bank1 and Bank2 to be erased + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_WRP_SECTOR(WRPSector)); + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + if(((WRPSector == OB_WRP_SECTOR_All) && ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))) || + (WRPSector < OB_WRP_SECTOR_12)) + { + if(WRPSector == OB_WRP_SECTOR_All) + { + /*Write protection on all sector of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)(WRPSector>>12); + } + else + { + /*Write protection done on sectors of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)WRPSector; + } + } + else + { + /*Write protection done on sectors of BANK2*/ + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS |= (uint16_t)(WRPSector>>12); + } + + /*Write protection on all sector of BANK2*/ + if((WRPSector == OB_WRP_SECTOR_All) && (Banks == FLASH_BANK_BOTH)) + { + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS |= (uint16_t)(WRPSector>>12); + } + } + + } + + return status; +} + +/** + * @brief Configure the Dual Bank Boot. + * + * @note This function can be used only for STM32F42xxx/43xxx devices. + * + * @param BootConfig specifies the Dual Bank Boot Option byte. + * This parameter can be one of the following values: + * @arg OB_Dual_BootEnabled: Dual Bank Boot Enable + * @arg OB_Dual_BootDisabled: Dual Bank Boot Disabled + * @retval None + */ +static HAL_StatusTypeDef FLASH_OB_BootConfig(uint8_t BootConfig) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_BOOT(BootConfig)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Set Dual Bank Boot */ + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS &= (~FLASH_OPTCR_BFB2); + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= BootConfig; + } + + return status; +} + +/** + * @brief Enable the read/write protection (PCROP) of the desired + * sectors of Bank 1 and/or Bank 2. + * @note This function can be used only for STM32F42xxx/43xxx devices. + * @param SectorBank1 Specifies the sector(s) to be read/write protected or unprotected for bank1. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_SECTOR_0 and OB_PCROP_SECTOR_11 + * @arg OB_PCROP_SECTOR__All + * @param SectorBank2 Specifies the sector(s) to be read/write protected or unprotected for bank2. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_SECTOR_12 and OB_PCROP_SECTOR_23 + * @arg OB_PCROP_SECTOR__All + * @param Banks Enable PCROP protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: WRP on all sectors of bank1 + * @arg FLASH_BANK_2: WRP on all sectors of bank2 + * @arg FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2 + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + if((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH)) + { + assert_param(IS_OB_PCROP(SectorBank1)); + /*Write protection done on sectors of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)SectorBank1; + } + else + { + assert_param(IS_OB_PCROP(SectorBank2)); + /*Write protection done on sectors of BANK2*/ + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS |= (uint16_t)SectorBank2; + } + + /*Write protection on all sector of BANK2*/ + if(Banks == FLASH_BANK_BOTH) + { + assert_param(IS_OB_PCROP(SectorBank2)); + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /*Write protection done on sectors of BANK2*/ + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS |= (uint16_t)SectorBank2; + } + } + + } + + return status; +} + + +/** + * @brief Disable the read/write protection (PCROP) of the desired + * sectors of Bank 1 and/or Bank 2. + * @note This function can be used only for STM32F42xxx/43xxx devices. + * @param SectorBank1 specifies the sector(s) to be read/write protected or unprotected for bank1. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_SECTOR_0 and OB_PCROP_SECTOR_11 + * @arg OB_PCROP_SECTOR__All + * @param SectorBank2 Specifies the sector(s) to be read/write protected or unprotected for bank2. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_SECTOR_12 and OB_PCROP_SECTOR_23 + * @arg OB_PCROP_SECTOR__All + * @param Banks Disable PCROP protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: WRP on all sectors of bank1 + * @arg FLASH_BANK_2: WRP on all sectors of bank2 + * @arg FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2 + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + if((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH)) + { + assert_param(IS_OB_PCROP(SectorBank1)); + /*Write protection done on sectors of BANK1*/ + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~SectorBank1); + } + else + { + /*Write protection done on sectors of BANK2*/ + assert_param(IS_OB_PCROP(SectorBank2)); + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS &= (~SectorBank2); + } + + /*Write protection on all sector of BANK2*/ + if(Banks == FLASH_BANK_BOTH) + { + assert_param(IS_OB_PCROP(SectorBank2)); + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /*Write protection done on sectors of BANK2*/ + *(__IO uint16_t*)OPTCR1_BYTE2_ADDRESS &= (~SectorBank2); + } + } + + } + + return status; + +} + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ + defined(STM32F423xx) +/** + * @brief Mass erase of FLASH memory + * @param VoltageRange The device voltage range which defines the erase parallelism. + * This parameter can be one of the following values: + * @arg FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, + * the operation will be done by byte (8-bit) + * @arg FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, + * the operation will be done by half word (16-bit) + * @arg FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, + * the operation will be done by word (32-bit) + * @arg FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, + * the operation will be done by double word (64-bit) + * + * @param Banks Banks to be erased + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: Bank1 to be erased + * + * @retval None + */ +static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks) +{ + /* Check the parameters */ + assert_param(IS_VOLTAGERANGE(VoltageRange)); + assert_param(IS_FLASH_BANK(Banks)); + + /* If the previous operation is completed, proceed to erase all sectors */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= FLASH_CR_MER; + FLASH->CR |= FLASH_CR_STRT | ((uint32_t)VoltageRange <<8U); +} + +/** + * @brief Erase the specified FLASH memory sector + * @param Sector FLASH sector to erase + * The value of this parameter depend on device used within the same series + * @param VoltageRange The device voltage range which defines the erase parallelism. + * This parameter can be one of the following values: + * @arg FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, + * the operation will be done by byte (8-bit) + * @arg FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, + * the operation will be done by half word (16-bit) + * @arg FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, + * the operation will be done by word (32-bit) + * @arg FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, + * the operation will be done by double word (64-bit) + * + * @retval None + */ +void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange) +{ + uint32_t tmp_psize = 0U; + + /* Check the parameters */ + assert_param(IS_FLASH_SECTOR(Sector)); + assert_param(IS_VOLTAGERANGE(VoltageRange)); + + if(VoltageRange == FLASH_VOLTAGE_RANGE_1) + { + tmp_psize = FLASH_PSIZE_BYTE; + } + else if(VoltageRange == FLASH_VOLTAGE_RANGE_2) + { + tmp_psize = FLASH_PSIZE_HALF_WORD; + } + else if(VoltageRange == FLASH_VOLTAGE_RANGE_3) + { + tmp_psize = FLASH_PSIZE_WORD; + } + else + { + tmp_psize = FLASH_PSIZE_DOUBLE_WORD; + } + + /* If the previous operation is completed, proceed to erase the sector */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + FLASH->CR |= tmp_psize; + CLEAR_BIT(FLASH->CR, FLASH_CR_SNB); + FLASH->CR |= FLASH_CR_SER | (Sector << FLASH_CR_SNB_Pos); + FLASH->CR |= FLASH_CR_STRT; +} + +/** + * @brief Enable the write protection of the desired bank 1 sectors + * + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash sector i if CortexM4 + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * @note Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1). + * + * @param WRPSector specifies the sector(s) to be write protected. + * The value of this parameter depend on device used within the same series + * + * @param Banks Enable write protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: WRP on all sectors of bank1 + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_WRP_SECTOR(WRPSector)); + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~WRPSector); + } + + return status; +} + +/** + * @brief Disable the write protection of the desired bank 1 sectors + * + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash sector i if CortexM4 + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * @note Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1). + * + * @param WRPSector specifies the sector(s) to be write protected. + * The value of this parameter depend on device used within the same series + * + * @param Banks Enable write protection on all the sectors for the specific bank + * This parameter can be one of the following values: + * @arg FLASH_BANK_1: WRP on all sectors of bank1 + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_WRP_SECTOR(WRPSector)); + assert_param(IS_FLASH_BANK(Banks)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)WRPSector; + } + + return status; +} +#endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx + STM32F413xx || STM32F423xx */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\ + defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Enable the read/write protection (PCROP) of the desired sectors. + * @note This function can be used only for STM32F401xx devices. + * @param Sector specifies the sector(s) to be read/write protected or unprotected. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_Sector0 and OB_PCROP_Sector5 + * @arg OB_PCROP_Sector_All + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t Sector) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_PCROP(Sector)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)Sector; + } + + return status; +} + + +/** + * @brief Disable the read/write protection (PCROP) of the desired sectors. + * @note This function can be used only for STM32F401xx devices. + * @param Sector specifies the sector(s) to be read/write protected or unprotected. + * This parameter can be one of the following values: + * @arg OB_PCROP: A value between OB_PCROP_Sector0 and OB_PCROP_Sector5 + * @arg OB_PCROP_Sector_All + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t Sector) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_PCROP(Sector)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~Sector); + } + + return status; + +} +#endif /* STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx + STM32F413xx || STM32F423xx */ + +/** + * @brief Set the read protection level. + * @param Level specifies the read protection level. + * This parameter can be one of the following values: + * @arg OB_RDP_LEVEL_0: No protection + * @arg OB_RDP_LEVEL_1: Read protection of the memory + * @arg OB_RDP_LEVEL_2: Full chip protection + * + * @note WARNING: When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0 + * + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t Level) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_RDP_LEVEL(Level)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + *(__IO uint8_t*)OPTCR_BYTE1_ADDRESS = Level; + } + + return status; +} + +/** + * @brief Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. + * @param Iwdg Selects the IWDG mode + * This parameter can be one of the following values: + * @arg OB_IWDG_SW: Software IWDG selected + * @arg OB_IWDG_HW: Hardware IWDG selected + * @param Stop Reset event when entering STOP mode. + * This parameter can be one of the following values: + * @arg OB_STOP_NO_RST: No reset generated when entering in STOP + * @arg OB_STOP_RST: Reset generated when entering in STOP + * @param Stdby Reset event when entering Standby mode. + * This parameter can be one of the following values: + * @arg OB_STDBY_NO_RST: No reset generated when entering in STANDBY + * @arg OB_STDBY_RST: Reset generated when entering in STANDBY + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t Iwdg, uint8_t Stop, uint8_t Stdby) +{ + uint8_t optiontmp = 0xFF; + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_IWDG_SOURCE(Iwdg)); + assert_param(IS_OB_STOP_SOURCE(Stop)); + assert_param(IS_OB_STDBY_SOURCE(Stdby)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Mask OPTLOCK, OPTSTRT, BOR_LEV and BFB2 bits */ + optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE0_ADDRESS) & (uint8_t)0x1F); + + /* Update User Option Byte */ + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS = Iwdg | (uint8_t)(Stdby | (uint8_t)(Stop | ((uint8_t)optiontmp))); + } + + return status; +} + +/** + * @brief Set the BOR Level. + * @param Level specifies the Option Bytes BOR Reset Level. + * This parameter can be one of the following values: + * @arg OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V + * @arg OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V + * @arg OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V + * @arg OB_BOR_OFF: Supply voltage ranges from 1.62 to 2.1 V + * @retval HAL Status + */ +static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig(uint8_t Level) +{ + /* Check the parameters */ + assert_param(IS_OB_BOR_LEVEL(Level)); + + /* Set the BOR Level */ + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS &= (~FLASH_OPTCR_BOR_LEV); + *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= Level; + + return HAL_OK; + +} + +/** + * @brief Return the FLASH User Option Byte value. + * @retval uint8_t FLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1) + * and RST_STDBY(Bit2). + */ +static uint8_t FLASH_OB_GetUser(void) +{ + /* Return the User Option Byte */ + return ((uint8_t)(FLASH->OPTCR & 0xE0)); +} + +/** + * @brief Return the FLASH Write Protection Option Bytes value. + * @retval uint16_t FLASH Write Protection Option Bytes value + */ +static uint16_t FLASH_OB_GetWRP(void) +{ + /* Return the FLASH write protection Register value */ + return (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS)); +} + +/** + * @brief Returns the FLASH Read Protection level. + * @retval FLASH ReadOut Protection Status: + * This parameter can be one of the following values: + * @arg OB_RDP_LEVEL_0: No protection + * @arg OB_RDP_LEVEL_1: Read protection of the memory + * @arg OB_RDP_LEVEL_2: Full chip protection + */ +static uint8_t FLASH_OB_GetRDP(void) +{ + uint8_t readstatus = OB_RDP_LEVEL_0; + + if((*(__IO uint8_t*)(OPTCR_BYTE1_ADDRESS) == (uint8_t)OB_RDP_LEVEL_2)) + { + readstatus = OB_RDP_LEVEL_2; + } + else if((*(__IO uint8_t*)(OPTCR_BYTE1_ADDRESS) == (uint8_t)OB_RDP_LEVEL_0)) + { + readstatus = OB_RDP_LEVEL_0; + } + else + { + readstatus = OB_RDP_LEVEL_1; + } + + return readstatus; +} + +/** + * @brief Returns the FLASH BOR level. + * @retval uint8_t The FLASH BOR level: + * - OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V + * - OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V + * - OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V + * - OB_BOR_OFF : Supply voltage ranges from 1.62 to 2.1 V + */ +static uint8_t FLASH_OB_GetBOR(void) +{ + /* Return the FLASH BOR level */ + return (uint8_t)(*(__IO uint8_t *)(OPTCR_BYTE0_ADDRESS) & (uint8_t)0x0C); +} + +/** + * @brief Flush the instruction and data caches + * @retval None + */ +void FLASH_FlushCaches(void) +{ + /* Flush instruction cache */ + if(READ_BIT(FLASH->ACR, FLASH_ACR_ICEN)!= RESET) + { + /* Disable instruction cache */ + __HAL_FLASH_INSTRUCTION_CACHE_DISABLE(); + /* Reset instruction cache */ + __HAL_FLASH_INSTRUCTION_CACHE_RESET(); + /* Enable instruction cache */ + __HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); + } + + /* Flush data cache */ + if(READ_BIT(FLASH->ACR, FLASH_ACR_DCEN) != RESET) + { + /* Disable data cache */ + __HAL_FLASH_DATA_CACHE_DISABLE(); + /* Reset data cache */ + __HAL_FLASH_DATA_CACHE_RESET(); + /* Enable data cache */ + __HAL_FLASH_DATA_CACHE_ENABLE(); + } +} + +/** + * @} + */ + +#endif /* HAL_FLASH_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c new file mode 100644 index 0000000..12db458 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c @@ -0,0 +1,175 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_flash_ramfunc.c + * @author MCD Application Team + * @brief FLASH RAMFUNC module driver. + * This file provides a FLASH firmware functions which should be + * executed from internal SRAM + * + Stop/Start the flash interface while System Run + * + Enable/Disable the flash sleep while System Run + @verbatim + ============================================================================== + ##### APIs executed from Internal RAM ##### + ============================================================================== + [..] + *** ARM Compiler *** + -------------------- + [..] RAM functions are defined using the toolchain options. + Functions that are be executed in RAM should reside in a separate + source module. Using the 'Options for File' dialog you can simply change + the 'Code / Const' area of a module to a memory space in physical RAM. + Available memory areas are declared in the 'Target' tab of the + Options for Target' dialog. + + *** ICCARM Compiler *** + ----------------------- + [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". + + *** GNU Compiler *** + -------------------- + [..] RAM functions are defined using a specific toolchain attribute + "__attribute__((section(".RamFunc")))". + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup FLASH_RAMFUNC FLASH RAMFUNC + * @brief FLASH functions executed from RAM + * @{ + */ +#ifdef HAL_FLASH_MODULE_ENABLED +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ + defined(STM32F412Rx) || defined(STM32F412Cx) + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions + * @{ + */ + +/** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM + * @brief Peripheral Extended features functions + * +@verbatim + + =============================================================================== + ##### ramfunc functions ##### + =============================================================================== + [..] + This subsection provides a set of functions that should be executed from RAM + transfers. + +@endverbatim + * @{ + */ + +/** + * @brief Stop the flash interface while System Run + * @note This mode is only available for STM32F41xxx/STM32F446xx devices. + * @note This mode couldn't be set while executing with the flash itself. + * It should be done with specific routine executed from RAM. + * @retval HAL status + */ +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void) +{ + /* Enable Power ctrl clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + /* Stop the flash interface while System Run */ + SET_BIT(PWR->CR, PWR_CR_FISSR); + + return HAL_OK; +} + +/** + * @brief Start the flash interface while System Run + * @note This mode is only available for STM32F411xx/STM32F446xx devices. + * @note This mode couldn't be set while executing with the flash itself. + * It should be done with specific routine executed from RAM. + * @retval HAL status + */ +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void) +{ + /* Enable Power ctrl clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + /* Start the flash interface while System Run */ + CLEAR_BIT(PWR->CR, PWR_CR_FISSR); + + return HAL_OK; +} + +/** + * @brief Enable the flash sleep while System Run + * @note This mode is only available for STM32F41xxx/STM32F446xx devices. + * @note This mode could n't be set while executing with the flash itself. + * It should be done with specific routine executed from RAM. + * @retval HAL status + */ +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void) +{ + /* Enable Power ctrl clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + /* Enable the flash sleep while System Run */ + SET_BIT(PWR->CR, PWR_CR_FMSSR); + + return HAL_OK; +} + +/** + * @brief Disable the flash sleep while System Run + * @note This mode is only available for STM32F41xxx/STM32F446xx devices. + * @note This mode couldn't be set while executing with the flash itself. + * It should be done with specific routine executed from RAM. + * @retval HAL status + */ +__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void) +{ + /* Enable Power ctrl clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + /* Disable the flash sleep while System Run */ + CLEAR_BIT(PWR->CR, PWR_CR_FMSSR); + + return HAL_OK; +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ +#endif /* HAL_FLASH_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c new file mode 100644 index 0000000..89090d6 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c @@ -0,0 +1,537 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_gpio.c + * @author MCD Application Team + * @brief GPIO HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the General Purpose Input/Output (GPIO) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + @verbatim + ============================================================================== + ##### GPIO Peripheral features ##### + ============================================================================== + [..] + Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each + port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software + in several modes: + (+) Input mode + (+) Analog mode + (+) Output mode + (+) Alternate function mode + (+) External interrupt/event lines + + [..] + During and just after reset, the alternate functions and external interrupt + lines are not active and the I/O ports are configured in input floating mode. + + [..] + All GPIO pins have weak internal pull-up and pull-down resistors, which can be + activated or not. + + [..] + In Output or Alternate mode, each IO can be configured on open-drain or push-pull + type and the IO speed can be selected depending on the VDD value. + + [..] + All ports have external interrupt/event capability. To use external interrupt + lines, the port must be configured in input mode. All available GPIO pins are + connected to the 16 external interrupt/event lines from EXTI0 to EXTI15. + + [..] + The external interrupt/event controller consists of up to 23 edge detectors + (16 lines are connected to GPIO) for generating event/interrupt requests (each + input line can be independently configured to select the type (interrupt or event) + and the corresponding trigger event (rising or falling or both). Each line can + also be masked independently. + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Enable the GPIO AHB clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE(). + + (#) Configure the GPIO pin(s) using HAL_GPIO_Init(). + (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure + (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef + structure. + (++) In case of Output or alternate function mode selection: the speed is + configured through "Speed" member from GPIO_InitTypeDef structure. + (++) In alternate mode is selection, the alternate function connected to the IO + is configured through "Alternate" member from GPIO_InitTypeDef structure. + (++) Analog mode is required when a pin is to be used as ADC channel + or DAC output. + (++) In case of external interrupt/event selection the "Mode" member from + GPIO_InitTypeDef structure select the type (interrupt or event) and + the corresponding trigger event (rising or falling or both). + + (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority + mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using + HAL_NVIC_EnableIRQ(). + + (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin(). + + (#) To set/reset the level of a pin configured in output mode use + HAL_GPIO_WritePin()/HAL_GPIO_TogglePin(). + + (#) To lock pin configuration until next reset use HAL_GPIO_LockPin(). + + + (#) During and just after reset, the alternate functions are not + active and the GPIO pins are configured in input floating mode (except JTAG + pins). + + (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose + (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has + priority over the GPIO function. + + (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as + general purpose PH0 and PH1, respectively, when the HSE oscillator is off. + The HSE has priority over the GPIO function. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup GPIO GPIO + * @brief GPIO HAL module driver + * @{ + */ + +#ifdef HAL_GPIO_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup GPIO_Private_Constants GPIO Private Constants + * @{ + */ +#define GPIO_MODE 0x00000003U +#define EXTI_MODE 0x10000000U +#define GPIO_MODE_IT 0x00010000U +#define GPIO_MODE_EVT 0x00020000U +#define RISING_EDGE 0x00100000U +#define FALLING_EDGE 0x00200000U +#define GPIO_OUTPUT_TYPE 0x00000010U + +#define GPIO_NUMBER 16U +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Functions GPIO Exported Functions + * @{ + */ + +/** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to initialize and de-initialize the GPIOs + to be ready for use. + +@endverbatim + * @{ + */ + + +/** + * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init. + * @param GPIOx where x can be (A..K) to select the GPIO peripheral for STM32F429X device or + * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. + * @param GPIO_Init pointer to a GPIO_InitTypeDef structure that contains + * the configuration information for the specified GPIO peripheral. + * @retval None + */ +void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) +{ + uint32_t position; + uint32_t ioposition = 0x00U; + uint32_t iocurrent = 0x00U; + uint32_t temp = 0x00U; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_GPIO_PIN(GPIO_Init->Pin)); + assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); + assert_param(IS_GPIO_PULL(GPIO_Init->Pull)); + + /* Configure the port pins */ + for(position = 0U; position < GPIO_NUMBER; position++) + { + /* Get the IO position */ + ioposition = 0x01U << position; + /* Get the current IO position */ + iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition; + + if(iocurrent == ioposition) + { + /*--------------------- GPIO Mode Configuration ------------------------*/ + /* In case of Output or Alternate function mode selection */ + if((GPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_PP) || + (GPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) + { + /* Check the Speed parameter */ + assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + /* Configure the IO Speed */ + temp = GPIOx->OSPEEDR; + temp &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U)); + temp |= (GPIO_Init->Speed << (position * 2U)); + GPIOx->OSPEEDR = temp; + + /* Configure the IO Output Type */ + temp = GPIOx->OTYPER; + temp &= ~(GPIO_OTYPER_OT_0 << position) ; + temp |= (((GPIO_Init->Mode & GPIO_OUTPUT_TYPE) >> 4U) << position); + GPIOx->OTYPER = temp; + } + + /* Activate the Pull-up or Pull down resistor for the current IO */ + temp = GPIOx->PUPDR; + temp &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U)); + temp |= ((GPIO_Init->Pull) << (position * 2U)); + GPIOx->PUPDR = temp; + + /* In case of Alternate function mode selection */ + if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) + { + /* Check the Alternate function parameter */ + assert_param(IS_GPIO_AF(GPIO_Init->Alternate)); + /* Configure Alternate function mapped with the current IO */ + temp = GPIOx->AFR[position >> 3U]; + temp &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ; + temp |= ((uint32_t)(GPIO_Init->Alternate) << (((uint32_t)position & 0x07U) * 4U)); + GPIOx->AFR[position >> 3U] = temp; + } + + /* Configure IO Direction mode (Input, Output, Alternate or Analog) */ + temp = GPIOx->MODER; + temp &= ~(GPIO_MODER_MODER0 << (position * 2U)); + temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2U)); + GPIOx->MODER = temp; + + /*--------------------- EXTI Mode Configuration ------------------------*/ + /* Configure the External Interrupt or event for the current IO */ + if((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) + { + /* Enable SYSCFG Clock */ + __HAL_RCC_SYSCFG_CLK_ENABLE(); + + temp = SYSCFG->EXTICR[position >> 2U]; + temp &= ~(0x0FU << (4U * (position & 0x03U))); + temp |= ((uint32_t)(GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U))); + SYSCFG->EXTICR[position >> 2U] = temp; + + /* Clear EXTI line configuration */ + temp = EXTI->IMR; + temp &= ~((uint32_t)iocurrent); + if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) + { + temp |= iocurrent; + } + EXTI->IMR = temp; + + temp = EXTI->EMR; + temp &= ~((uint32_t)iocurrent); + if((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) + { + temp |= iocurrent; + } + EXTI->EMR = temp; + + /* Clear Rising Falling edge configuration */ + temp = EXTI->RTSR; + temp &= ~((uint32_t)iocurrent); + if((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) + { + temp |= iocurrent; + } + EXTI->RTSR = temp; + + temp = EXTI->FTSR; + temp &= ~((uint32_t)iocurrent); + if((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) + { + temp |= iocurrent; + } + EXTI->FTSR = temp; + } + } + } +} + +/** + * @brief De-initializes the GPIOx peripheral registers to their default reset values. + * @param GPIOx where x can be (A..K) to select the GPIO peripheral for STM32F429X device or + * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. + * @param GPIO_Pin specifies the port bit to be written. + * This parameter can be one of GPIO_PIN_x where x can be (0..15). + * @retval None + */ +void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin) +{ + uint32_t position; + uint32_t ioposition = 0x00U; + uint32_t iocurrent = 0x00U; + uint32_t tmp = 0x00U; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + + /* Configure the port pins */ + for(position = 0U; position < GPIO_NUMBER; position++) + { + /* Get the IO position */ + ioposition = 0x01U << position; + /* Get the current IO position */ + iocurrent = (GPIO_Pin) & ioposition; + + if(iocurrent == ioposition) + { + /*------------------------- EXTI Mode Configuration --------------------*/ + tmp = SYSCFG->EXTICR[position >> 2U]; + tmp &= (0x0FU << (4U * (position & 0x03U))); + if(tmp == ((uint32_t)(GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U)))) + { + /* Clear EXTI line configuration */ + EXTI->IMR &= ~((uint32_t)iocurrent); + EXTI->EMR &= ~((uint32_t)iocurrent); + + /* Clear Rising Falling edge configuration */ + EXTI->RTSR &= ~((uint32_t)iocurrent); + EXTI->FTSR &= ~((uint32_t)iocurrent); + + /* Configure the External Interrupt or event for the current IO */ + tmp = 0x0FU << (4U * (position & 0x03U)); + SYSCFG->EXTICR[position >> 2U] &= ~tmp; + } + + /*------------------------- GPIO Mode Configuration --------------------*/ + /* Configure IO Direction in Input Floating Mode */ + GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (position * 2U)); + + /* Configure the default Alternate Function in current IO */ + GPIOx->AFR[position >> 3U] &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ; + + /* Deactivate the Pull-up and Pull-down resistor for the current IO */ + GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U)); + + /* Configure the default value IO Output Type */ + GPIOx->OTYPER &= ~(GPIO_OTYPER_OT_0 << position) ; + + /* Configure the default value for IO Speed */ + GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U)); + } + } +} + +/** + * @} + */ + +/** @defgroup GPIO_Exported_Functions_Group2 IO operation functions + * @brief GPIO Read and Write + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + +@endverbatim + * @{ + */ + +/** + * @brief Reads the specified input port pin. + * @param GPIOx where x can be (A..K) to select the GPIO peripheral for STM32F429X device or + * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. + * @param GPIO_Pin specifies the port bit to read. + * This parameter can be GPIO_PIN_x where x can be (0..15). + * @retval The input port pin value. + */ +GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) +{ + GPIO_PinState bitstatus; + + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + if((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET) + { + bitstatus = GPIO_PIN_SET; + } + else + { + bitstatus = GPIO_PIN_RESET; + } + return bitstatus; +} + +/** + * @brief Sets or clears the selected data port bit. + * + * @note This function uses GPIOx_BSRR register to allow atomic read/modify + * accesses. In this way, there is no risk of an IRQ occurring between + * the read and the modify access. + * + * @param GPIOx where x can be (A..K) to select the GPIO peripheral for STM32F429X device or + * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. + * @param GPIO_Pin specifies the port bit to be written. + * This parameter can be one of GPIO_PIN_x where x can be (0..15). + * @param PinState specifies the value to be written to the selected bit. + * This parameter can be one of the GPIO_PinState enum values: + * @arg GPIO_PIN_RESET: to clear the port pin + * @arg GPIO_PIN_SET: to set the port pin + * @retval None + */ +void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState) +{ + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + assert_param(IS_GPIO_PIN_ACTION(PinState)); + + if(PinState != GPIO_PIN_RESET) + { + GPIOx->BSRR = GPIO_Pin; + } + else + { + GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U; + } +} + +/** + * @brief Toggles the specified GPIO pins. + * @param GPIOx Where x can be (A..K) to select the GPIO peripheral for STM32F429X device or + * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. + * @param GPIO_Pin Specifies the pins to be toggled. + * @retval None + */ +void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) +{ + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + if ((GPIOx->ODR & GPIO_Pin) == GPIO_Pin) + { + GPIOx->BSRR = (uint32_t)GPIO_Pin << GPIO_NUMBER; + } + else + { + GPIOx->BSRR = GPIO_Pin; + } +} + +/** + * @brief Locks GPIO Pins configuration registers. + * @note The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, + * GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH. + * @note The configuration of the locked GPIO pins can no longer be modified + * until the next reset. + * @param GPIOx where x can be (A..F) to select the GPIO peripheral for STM32F4 family + * @param GPIO_Pin specifies the port bit to be locked. + * This parameter can be any combination of GPIO_PIN_x where x can be (0..15). + * @retval None + */ +HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) +{ + __IO uint32_t tmp = GPIO_LCKR_LCKK; + + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + /* Apply lock key write sequence */ + tmp |= GPIO_Pin; + /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ + GPIOx->LCKR = tmp; + /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */ + GPIOx->LCKR = GPIO_Pin; + /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ + GPIOx->LCKR = tmp; + /* Read LCKR register. This read is mandatory to complete key lock sequence */ + tmp = GPIOx->LCKR; + + /* Read again in order to confirm lock is active */ + if((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET) + { + return HAL_OK; + } + else + { + return HAL_ERROR; + } +} + +/** + * @brief This function handles EXTI interrupt request. + * @param GPIO_Pin Specifies the pins connected EXTI line + * @retval None + */ +void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) +{ + /* EXTI line interrupt detected */ + if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET) + { + __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); + HAL_GPIO_EXTI_Callback(GPIO_Pin); + } +} + +/** + * @brief EXTI line detection callbacks. + * @param GPIO_Pin Specifies the pins connected EXTI line + * @retval None + */ +__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(GPIO_Pin); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_GPIO_EXTI_Callback could be implemented in the user file + */ +} + +/** + * @} + */ + + +/** + * @} + */ + +#endif /* HAL_GPIO_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c new file mode 100644 index 0000000..ba2ce59 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c @@ -0,0 +1,559 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_pwr.c + * @author MCD Application Team + * @brief PWR HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Power Controller (PWR) peripheral: + * + Initialization and de-initialization functions + * + Peripheral Control functions + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup PWR PWR + * @brief PWR HAL module driver + * @{ + */ + +#ifdef HAL_PWR_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup PWR_Private_Constants + * @{ + */ + +/** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask + * @{ + */ +#define PVD_MODE_IT 0x00010000U +#define PVD_MODE_EVT 0x00020000U +#define PVD_RISING_EDGE 0x00000001U +#define PVD_FALLING_EDGE 0x00000002U +/** + * @} + */ + +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/** @defgroup PWR_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @defgroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + After reset, the backup domain (RTC registers, RTC backup data + registers and backup SRAM) is protected against possible unwanted + write accesses. + To enable access to the RTC Domain and RTC registers, proceed as follows: + (+) Enable the Power Controller (PWR) APB1 interface clock using the + __HAL_RCC_PWR_CLK_ENABLE() macro. + (+) Enable access to RTC domain using the HAL_PWR_EnableBkUpAccess() function. + +@endverbatim + * @{ + */ + +/** + * @brief Deinitializes the HAL PWR peripheral registers to their default reset values. + * @retval None + */ +void HAL_PWR_DeInit(void) +{ + __HAL_RCC_PWR_FORCE_RESET(); + __HAL_RCC_PWR_RELEASE_RESET(); +} + +/** + * @brief Enables access to the backup domain (RTC registers, RTC + * backup data registers and backup SRAM). + * @note If the HSE divided by 2, 3, ..31 is used as the RTC clock, the + * Backup Domain Access should be kept enabled. + * @retval None + */ +void HAL_PWR_EnableBkUpAccess(void) +{ + *(__IO uint32_t *) CR_DBP_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables access to the backup domain (RTC registers, RTC + * backup data registers and backup SRAM). + * @note If the HSE divided by 2, 3, ..31 is used as the RTC clock, the + * Backup Domain Access should be kept enabled. + * @retval None + */ +void HAL_PWR_DisableBkUpAccess(void) +{ + *(__IO uint32_t *) CR_DBP_BB = (uint32_t)DISABLE; +} + +/** + * @} + */ + +/** @defgroup PWR_Exported_Functions_Group2 Peripheral Control functions + * @brief Low Power modes configuration functions + * +@verbatim + + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + + *** PVD configuration *** + ========================= + [..] + (+) The PVD is used to monitor the VDD power supply by comparing it to a + threshold selected by the PVD Level (PLS[2:0] bits in the PWR_CR). + (+) A PVDO flag is available to indicate if VDD/VDDA is higher or lower + than the PVD threshold. This event is internally connected to the EXTI + line16 and can generate an interrupt if enabled. This is done through + __HAL_PWR_PVD_EXTI_ENABLE_IT() macro. + (+) The PVD is stopped in Standby mode. + + *** Wake-up pin configuration *** + ================================ + [..] + (+) Wake-up pin is used to wake up the system from Standby mode. This pin is + forced in input pull-down configuration and is active on rising edges. + (+) There is one Wake-up pin: Wake-up Pin 1 on PA.00. + (++) For STM32F446xx there are two Wake-Up pins: Pin1 on PA.00 and Pin2 on PC.13 + (++) For STM32F410xx/STM32F412xx/STM32F413xx/STM32F423xx there are three Wake-Up pins: Pin1 on PA.00, Pin2 on PC.00 and Pin3 on PC.01 + + *** Low Power modes configuration *** + ===================================== + [..] + The devices feature 3 low-power modes: + (+) Sleep mode: Cortex-M4 core stopped, peripherals kept running. + (+) Stop mode: all clocks are stopped, regulator running, regulator + in low power mode + (+) Standby mode: 1.2V domain powered off. + + *** Sleep mode *** + ================== + [..] + (+) Entry: + The Sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI) + functions with + (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction + (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction + + -@@- The Regulator parameter is not used for the STM32F4 family + and is kept as parameter just to maintain compatibility with the + lower power families (STM32L). + (+) Exit: + Any peripheral interrupt acknowledged by the nested vectored interrupt + controller (NVIC) can wake up the device from Sleep mode. + + *** Stop mode *** + ================= + [..] + In Stop mode, all clocks in the 1.2V domain are stopped, the PLL, the HSI, + and the HSE RC oscillators are disabled. Internal SRAM and register contents + are preserved. + The voltage regulator can be configured either in normal or low-power mode. + To minimize the consumption In Stop mode, FLASH can be powered off before + entering the Stop mode using the HAL_PWREx_EnableFlashPowerDown() function. + It can be switched on again by software after exiting the Stop mode using + the HAL_PWREx_DisableFlashPowerDown() function. + + (+) Entry: + The Stop mode is entered using the HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON) + function with: + (++) Main regulator ON. + (++) Low Power regulator ON. + (+) Exit: + Any EXTI Line (Internal or External) configured in Interrupt/Event mode. + + *** Standby mode *** + ==================== + [..] + (+) + The Standby mode allows to achieve the lowest power consumption. It is based + on the Cortex-M4 deep sleep mode, with the voltage regulator disabled. + The 1.2V domain is consequently powered off. The PLL, the HSI oscillator and + the HSE oscillator are also switched off. SRAM and register contents are lost + except for the RTC registers, RTC backup registers, backup SRAM and Standby + circuitry. + + The voltage regulator is OFF. + + (++) Entry: + (+++) The Standby mode is entered using the HAL_PWR_EnterSTANDBYMode() function. + (++) Exit: + (+++) WKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wake-up, + tamper event, time-stamp event, external reset in NRST pin, IWDG reset. + + *** Auto-wake-up (AWU) from low-power mode *** + ============================================= + [..] + + (+) The MCU can be woken up from low-power mode by an RTC Alarm event, an RTC + Wake-up event, a tamper event or a time-stamp event, without depending on + an external interrupt (Auto-wake-up mode). + + (+) RTC auto-wake-up (AWU) from the Stop and Standby modes + + (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to + configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function. + + (++) To wake up from the Stop mode with an RTC Tamper or time stamp event, it + is necessary to configure the RTC to detect the tamper or time stamp event using the + HAL_RTCEx_SetTimeStamp_IT() or HAL_RTCEx_SetTamper_IT() functions. + + (++) To wake up from the Stop mode with an RTC Wake-up event, it is necessary to + configure the RTC to generate the RTC Wake-up event using the HAL_RTCEx_SetWakeUpTimer_IT() function. + +@endverbatim + * @{ + */ + +/** + * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD). + * @param sConfigPVD pointer to an PWR_PVDTypeDef structure that contains the configuration + * information for the PVD. + * @note Refer to the electrical characteristics of your device datasheet for + * more details about the voltage threshold corresponding to each + * detection level. + * @retval None + */ +void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD) +{ + /* Check the parameters */ + assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel)); + assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode)); + + /* Set PLS[7:5] bits according to PVDLevel value */ + MODIFY_REG(PWR->CR, PWR_CR_PLS, sConfigPVD->PVDLevel); + + /* Clear any previous config. Keep it clear if no event or IT mode is selected */ + __HAL_PWR_PVD_EXTI_DISABLE_EVENT(); + __HAL_PWR_PVD_EXTI_DISABLE_IT(); + __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); + __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); + + /* Configure interrupt mode */ + if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT) + { + __HAL_PWR_PVD_EXTI_ENABLE_IT(); + } + + /* Configure event mode */ + if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT) + { + __HAL_PWR_PVD_EXTI_ENABLE_EVENT(); + } + + /* Configure the edge */ + if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE) + { + __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); + } + + if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE) + { + __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); + } +} + +/** + * @brief Enables the Power Voltage Detector(PVD). + * @retval None + */ +void HAL_PWR_EnablePVD(void) +{ + *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Power Voltage Detector(PVD). + * @retval None + */ +void HAL_PWR_DisablePVD(void) +{ + *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)DISABLE; +} + +/** + * @brief Enables the Wake-up PINx functionality. + * @param WakeUpPinx Specifies the Power Wake-Up pin to enable. + * This parameter can be one of the following values: + * @arg PWR_WAKEUP_PIN1 + * @arg PWR_WAKEUP_PIN2 available only on STM32F410xx/STM32F446xx/STM32F412xx/STM32F413xx/STM32F423xx devices + * @arg PWR_WAKEUP_PIN3 available only on STM32F410xx/STM32F412xx/STM32F413xx/STM32F423xx devices + * @retval None + */ +void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx) +{ + /* Check the parameter */ + assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); + + /* Enable the wake up pin */ + SET_BIT(PWR->CSR, WakeUpPinx); +} + +/** + * @brief Disables the Wake-up PINx functionality. + * @param WakeUpPinx Specifies the Power Wake-Up pin to disable. + * This parameter can be one of the following values: + * @arg PWR_WAKEUP_PIN1 + * @arg PWR_WAKEUP_PIN2 available only on STM32F410xx/STM32F446xx/STM32F412xx/STM32F413xx/STM32F423xx devices + * @arg PWR_WAKEUP_PIN3 available only on STM32F410xx/STM32F412xx/STM32F413xx/STM32F423xx devices + * @retval None + */ +void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) +{ + /* Check the parameter */ + assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); + + /* Disable the wake up pin */ + CLEAR_BIT(PWR->CSR, WakeUpPinx); +} + +/** + * @brief Enters Sleep mode. + * + * @note In Sleep mode, all I/O pins keep the same state as in Run mode. + * + * @note In Sleep mode, the systick is stopped to avoid exit from this mode with + * systick interrupt when used as time base for Timeout + * + * @param Regulator Specifies the regulator state in SLEEP mode. + * This parameter can be one of the following values: + * @arg PWR_MAINREGULATOR_ON: SLEEP mode with regulator ON + * @arg PWR_LOWPOWERREGULATOR_ON: SLEEP mode with low power regulator ON + * @note This parameter is not used for the STM32F4 family and is kept as parameter + * just to maintain compatibility with the lower power families. + * @param SLEEPEntry Specifies if SLEEP mode in entered with WFI or WFE instruction. + * This parameter can be one of the following values: + * @arg PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction + * @arg PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction + * @retval None + */ +void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry) +{ + /* Check the parameters */ + assert_param(IS_PWR_REGULATOR(Regulator)); + assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry)); + + /* Clear SLEEPDEEP bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* Select SLEEP mode entry -------------------------------------------------*/ + if(SLEEPEntry == PWR_SLEEPENTRY_WFI) + { + /* Request Wait For Interrupt */ + __WFI(); + } + else + { + /* Request Wait For Event */ + __SEV(); + __WFE(); + __WFE(); + } +} + +/** + * @brief Enters Stop mode. + * @note In Stop mode, all I/O pins keep the same state as in Run mode. + * @note When exiting Stop mode by issuing an interrupt or a wake-up event, + * the HSI RC oscillator is selected as system clock. + * @note When the voltage regulator operates in low power mode, an additional + * startup delay is incurred when waking up from Stop mode. + * By keeping the internal regulator ON during Stop mode, the consumption + * is higher although the startup time is reduced. + * @param Regulator Specifies the regulator state in Stop mode. + * This parameter can be one of the following values: + * @arg PWR_MAINREGULATOR_ON: Stop mode with regulator ON + * @arg PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON + * @param STOPEntry Specifies if Stop mode in entered with WFI or WFE instruction. + * This parameter can be one of the following values: + * @arg PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction + * @arg PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction + * @retval None + */ +void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) +{ + /* Check the parameters */ + assert_param(IS_PWR_REGULATOR(Regulator)); + assert_param(IS_PWR_STOP_ENTRY(STOPEntry)); + + /* Select the regulator state in Stop mode: Set PDDS and LPDS bits according to PWR_Regulator value */ + MODIFY_REG(PWR->CR, (PWR_CR_PDDS | PWR_CR_LPDS), Regulator); + + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* Select Stop mode entry --------------------------------------------------*/ + if(STOPEntry == PWR_STOPENTRY_WFI) + { + /* Request Wait For Interrupt */ + __WFI(); + } + else + { + /* Request Wait For Event */ + __SEV(); + __WFE(); + __WFE(); + } + /* Reset SLEEPDEEP bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); +} + +/** + * @brief Enters Standby mode. + * @note In Standby mode, all I/O pins are high impedance except for: + * - Reset pad (still available) + * - RTC_AF1 pin (PC13) if configured for tamper, time-stamp, RTC + * Alarm out, or RTC clock calibration out. + * - RTC_AF2 pin (PI8) if configured for tamper or time-stamp. + * - WKUP pin 1 (PA0) if enabled. + * @retval None + */ +void HAL_PWR_EnterSTANDBYMode(void) +{ + /* Select Standby mode */ + SET_BIT(PWR->CR, PWR_CR_PDDS); + + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* This option is used to ensure that store operations are completed */ +#if defined ( __CC_ARM) + __force_stores(); +#endif + /* Request Wait For Interrupt */ + __WFI(); +} + +/** + * @brief This function handles the PWR PVD interrupt request. + * @note This API should be called under the PVD_IRQHandler(). + * @retval None + */ +void HAL_PWR_PVD_IRQHandler(void) +{ + /* Check PWR Exti flag */ + if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET) + { + /* PWR PVD interrupt user callback */ + HAL_PWR_PVDCallback(); + + /* Clear PWR Exti pending bit */ + __HAL_PWR_PVD_EXTI_CLEAR_FLAG(); + } +} + +/** + * @brief PWR PVD interrupt callback + * @retval None + */ +__weak void HAL_PWR_PVDCallback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_PWR_PVDCallback could be implemented in the user file + */ +} + +/** + * @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode. + * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor + * re-enters SLEEP mode when an interruption handling is over. + * Setting this bit is useful when the processor is expected to run only on + * interruptions handling. + * @retval None + */ +void HAL_PWR_EnableSleepOnExit(void) +{ + /* Set SLEEPONEXIT bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); +} + +/** + * @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode. + * @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor + * re-enters SLEEP mode when an interruption handling is over. + * @retval None + */ +void HAL_PWR_DisableSleepOnExit(void) +{ + /* Clear SLEEPONEXIT bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); +} + +/** + * @brief Enables CORTEX M4 SEVONPEND bit. + * @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes + * WFE to wake up when an interrupt moves from inactive to pended. + * @retval None + */ +void HAL_PWR_EnableSEVOnPend(void) +{ + /* Set SEVONPEND bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); +} + +/** + * @brief Disables CORTEX M4 SEVONPEND bit. + * @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes + * WFE to wake up when an interrupt moves from inactive to pended. + * @retval None + */ +void HAL_PWR_DisableSEVOnPend(void) +{ + /* Clear SEVONPEND bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_PWR_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c new file mode 100644 index 0000000..0d26083 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c @@ -0,0 +1,604 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_pwr_ex.c + * @author MCD Application Team + * @brief Extended PWR HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of PWR extension peripheral: + * + Peripheral Extended features functions + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup PWREx PWREx + * @brief PWR HAL module driver + * @{ + */ + +#ifdef HAL_PWR_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup PWREx_Private_Constants + * @{ + */ +#define PWR_OVERDRIVE_TIMEOUT_VALUE 1000U +#define PWR_UDERDRIVE_TIMEOUT_VALUE 1000U +#define PWR_BKPREG_TIMEOUT_VALUE 1000U +#define PWR_VOSRDY_TIMEOUT_VALUE 1000U +/** + * @} + */ + + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @defgroup PWREx_Exported_Functions PWREx Exported Functions + * @{ + */ + +/** @defgroup PWREx_Exported_Functions_Group1 Peripheral Extended features functions + * @brief Peripheral Extended features functions + * +@verbatim + + =============================================================================== + ##### Peripheral extended features functions ##### + =============================================================================== + + *** Main and Backup Regulators configuration *** + ================================================ + [..] + (+) The backup domain includes 4 Kbytes of backup SRAM accessible only from + the CPU, and address in 32-bit, 16-bit or 8-bit mode. Its content is + retained even in Standby or VBAT mode when the low power backup regulator + is enabled. It can be considered as an internal EEPROM when VBAT is + always present. You can use the HAL_PWREx_EnableBkUpReg() function to + enable the low power backup regulator. + + (+) When the backup domain is supplied by VDD (analog switch connected to VDD) + the backup SRAM is powered from VDD which replaces the VBAT power supply to + save battery life. + + (+) The backup SRAM is not mass erased by a tamper event. It is read + protected to prevent confidential data, such as cryptographic private + key, from being accessed. The backup SRAM can be erased only through + the Flash interface when a protection level change from level 1 to + level 0 is requested. + -@- Refer to the description of Read protection (RDP) in the Flash + programming manual. + + (+) The main internal regulator can be configured to have a tradeoff between + performance and power consumption when the device does not operate at + the maximum frequency. This is done through __HAL_PWR_MAINREGULATORMODE_CONFIG() + macro which configure VOS bit in PWR_CR register + + Refer to the product datasheets for more details. + + *** FLASH Power Down configuration **** + ======================================= + [..] + (+) By setting the FPDS bit in the PWR_CR register by using the + HAL_PWREx_EnableFlashPowerDown() function, the Flash memory also enters power + down mode when the device enters Stop mode. When the Flash memory + is in power down mode, an additional startup delay is incurred when + waking up from Stop mode. + + (+) For STM32F42xxx/43xxx/446xx/469xx/479xx Devices, the scale can be modified only when the PLL + is OFF and the HSI or HSE clock source is selected as system clock. + The new value programmed is active only when the PLL is ON. + When the PLL is OFF, the voltage scale 3 is automatically selected. + Refer to the datasheets for more details. + + *** Over-Drive and Under-Drive configuration **** + ================================================= + [..] + (+) For STM32F42xxx/43xxx/446xx/469xx/479xx Devices, in Run mode: the main regulator has + 2 operating modes available: + (++) Normal mode: The CPU and core logic operate at maximum frequency at a given + voltage scaling (scale 1, scale 2 or scale 3) + (++) Over-drive mode: This mode allows the CPU and the core logic to operate at a + higher frequency than the normal mode for a given voltage scaling (scale 1, + scale 2 or scale 3). This mode is enabled through HAL_PWREx_EnableOverDrive() function and + disabled by HAL_PWREx_DisableOverDrive() function, to enter or exit from Over-drive mode please follow + the sequence described in Reference manual. + + (+) For STM32F42xxx/43xxx/446xx/469xx/479xx Devices, in Stop mode: the main regulator or low power regulator + supplies a low power voltage to the 1.2V domain, thus preserving the content of registers + and internal SRAM. 2 operating modes are available: + (++) Normal mode: the 1.2V domain is preserved in nominal leakage mode. This mode is only + available when the main regulator or the low power regulator is used in Scale 3 or + low voltage mode. + (++) Under-drive mode: the 1.2V domain is preserved in reduced leakage mode. This mode is only + available when the main regulator or the low power regulator is in low voltage mode. + +@endverbatim + * @{ + */ + +/** + * @brief Enables the Backup Regulator. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void) +{ + uint32_t tickstart = 0U; + + *(__IO uint32_t *) CSR_BRE_BB = (uint32_t)ENABLE; + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till Backup regulator ready flag is set */ + while(__HAL_PWR_GET_FLAG(PWR_FLAG_BRR) == RESET) + { + if((HAL_GetTick() - tickstart ) > PWR_BKPREG_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + return HAL_OK; +} + +/** + * @brief Disables the Backup Regulator. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void) +{ + uint32_t tickstart = 0U; + + *(__IO uint32_t *) CSR_BRE_BB = (uint32_t)DISABLE; + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till Backup regulator ready flag is set */ + while(__HAL_PWR_GET_FLAG(PWR_FLAG_BRR) != RESET) + { + if((HAL_GetTick() - tickstart ) > PWR_BKPREG_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + return HAL_OK; +} + +/** + * @brief Enables the Flash Power Down in Stop mode. + * @retval None + */ +void HAL_PWREx_EnableFlashPowerDown(void) +{ + *(__IO uint32_t *) CR_FPDS_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Flash Power Down in Stop mode. + * @retval None + */ +void HAL_PWREx_DisableFlashPowerDown(void) +{ + *(__IO uint32_t *) CR_FPDS_BB = (uint32_t)DISABLE; +} + +/** + * @brief Return Voltage Scaling Range. + * @retval The configured scale for the regulator voltage(VOS bit field). + * The returned value can be one of the following: + * - @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 + */ +uint32_t HAL_PWREx_GetVoltageRange(void) +{ + return (PWR->CR & PWR_CR_VOS); +} + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) +/** + * @brief Configures the main internal regulator output voltage. + * @param VoltageScaling specifies the regulator output voltage to achieve + * a tradeoff between performance and power consumption. + * This parameter can be one of the following values: + * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output range 1 mode, + * the maximum value of fHCLK = 168 MHz. + * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output range 2 mode, + * the maximum value of fHCLK = 144 MHz. + * @note When moving from Range 1 to Range 2, the system frequency must be decreased to + * a value below 144 MHz before calling HAL_PWREx_ConfigVoltageScaling() API. + * When moving from Range 2 to Range 1, the system frequency can be increased to + * a value up to 168 MHz after calling HAL_PWREx_ConfigVoltageScaling() API. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling) +{ + uint32_t tickstart = 0U; + + assert_param(IS_PWR_VOLTAGE_SCALING_RANGE(VoltageScaling)); + + /* Enable PWR RCC Clock Peripheral */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Set Range */ + __HAL_PWR_VOLTAGESCALING_CONFIG(VoltageScaling); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + while((__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY) == RESET)) + { + if((HAL_GetTick() - tickstart ) > PWR_VOSRDY_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +#elif defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || \ + defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) || \ + defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || \ + defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Configures the main internal regulator output voltage. + * @param VoltageScaling specifies the regulator output voltage to achieve + * a tradeoff between performance and power consumption. + * This parameter can be one of the following values: + * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output range 1 mode, + * the maximum value of fHCLK is 168 MHz. It can be extended to + * 180 MHz by activating the over-drive mode. + * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output range 2 mode, + * the maximum value of fHCLK is 144 MHz. It can be extended to, + * 168 MHz by activating the over-drive mode. + * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output range 3 mode, + * the maximum value of fHCLK is 120 MHz. + * @note To update the system clock frequency(SYSCLK): + * - Set the HSI or HSE as system clock frequency using the HAL_RCC_ClockConfig(). + * - Call the HAL_RCC_OscConfig() to configure the PLL. + * - Call HAL_PWREx_ConfigVoltageScaling() API to adjust the voltage scale. + * - Set the new system clock frequency using the HAL_RCC_ClockConfig(). + * @note The scale can be modified only when the HSI or HSE clock source is selected + * as system clock source, otherwise the API returns HAL_ERROR. + * @note When the PLL is OFF, the voltage scale 3 is automatically selected and the VOS bits + * value in the PWR_CR1 register are not taken in account. + * @note This API forces the PLL state ON to allow the possibility to configure the voltage scale 1 or 2. + * @note The new voltage scale is active only when the PLL is ON. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling) +{ + uint32_t tickstart = 0U; + + assert_param(IS_PWR_VOLTAGE_SCALING_RANGE(VoltageScaling)); + + /* Enable PWR RCC Clock Peripheral */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Check if the PLL is used as system clock or not */ + if(__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) + { + /* Disable the main PLL */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + /* Wait till PLL is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Set Range */ + __HAL_PWR_VOLTAGESCALING_CONFIG(VoltageScaling); + + /* Enable the main PLL */ + __HAL_RCC_PLL_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + while((__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY) == RESET)) + { + if((HAL_GetTick() - tickstart ) > PWR_VOSRDY_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + return HAL_ERROR; + } + + return HAL_OK; +} +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\ + defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Enables Main Regulator low voltage mode. + * @note This mode is only available for STM32F401xx/STM32F410xx/STM32F411xx/STM32F412Zx/STM32F412Rx/STM32F412Vx/STM32F412Cx/ + * STM32F413xx/STM32F423xx devices. + * @retval None + */ +void HAL_PWREx_EnableMainRegulatorLowVoltage(void) +{ + *(__IO uint32_t *) CR_MRLVDS_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables Main Regulator low voltage mode. + * @note This mode is only available for STM32F401xx/STM32F410xx/STM32F411xx/STM32F412Zx/STM32F412Rx/STM32F412Vx/STM32F412Cx/ + * STM32F413xx/STM32F423xxdevices. + * @retval None + */ +void HAL_PWREx_DisableMainRegulatorLowVoltage(void) +{ + *(__IO uint32_t *) CR_MRLVDS_BB = (uint32_t)DISABLE; +} + +/** + * @brief Enables Low Power Regulator low voltage mode. + * @note This mode is only available for STM32F401xx/STM32F410xx/STM32F411xx/STM32F412Zx/STM32F412Rx/STM32F412Vx/STM32F412Cx/ + * STM32F413xx/STM32F423xx devices. + * @retval None + */ +void HAL_PWREx_EnableLowRegulatorLowVoltage(void) +{ + *(__IO uint32_t *) CR_LPLVDS_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables Low Power Regulator low voltage mode. + * @note This mode is only available for STM32F401xx/STM32F410xx/STM32F411xx/STM32F412Zx/STM32F412Rx/STM32F412Vx/STM32F412Cx/ + * STM32F413xx/STM32F423xx devices. + * @retval None + */ +void HAL_PWREx_DisableLowRegulatorLowVoltage(void) +{ + *(__IO uint32_t *) CR_LPLVDS_BB = (uint32_t)DISABLE; +} + +#endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx || + STM32F413xx || STM32F423xx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Activates the Over-Drive mode. + * @note This function can be used only for STM32F42xx/STM32F43xx/STM32F446xx/STM32F469xx/STM32F479xx devices. + * This mode allows the CPU and the core logic to operate at a higher frequency + * than the normal mode for a given voltage scaling (scale 1, scale 2 or scale 3). + * @note It is recommended to enter or exit Over-drive mode when the application is not running + * critical tasks and when the system clock source is either HSI or HSE. + * During the Over-drive switch activation, no peripheral clocks should be enabled. + * The peripheral clocks must be enabled once the Over-drive mode is activated. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void) +{ + uint32_t tickstart = 0U; + + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable the Over-drive to extend the clock frequency to 180 Mhz */ + __HAL_PWR_OVERDRIVE_ENABLE(); + + /* Get tick */ + tickstart = HAL_GetTick(); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_ODRDY)) + { + if((HAL_GetTick() - tickstart) > PWR_OVERDRIVE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Enable the Over-drive switch */ + __HAL_PWR_OVERDRIVESWITCHING_ENABLE(); + + /* Get tick */ + tickstart = HAL_GetTick(); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_ODSWRDY)) + { + if((HAL_GetTick() - tickstart ) > PWR_OVERDRIVE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + return HAL_OK; +} + +/** + * @brief Deactivates the Over-Drive mode. + * @note This function can be used only for STM32F42xx/STM32F43xx/STM32F446xx/STM32F469xx/STM32F479xx devices. + * This mode allows the CPU and the core logic to operate at a higher frequency + * than the normal mode for a given voltage scaling (scale 1, scale 2 or scale 3). + * @note It is recommended to enter or exit Over-drive mode when the application is not running + * critical tasks and when the system clock source is either HSI or HSE. + * During the Over-drive switch activation, no peripheral clocks should be enabled. + * The peripheral clocks must be enabled once the Over-drive mode is activated. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void) +{ + uint32_t tickstart = 0U; + + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Disable the Over-drive switch */ + __HAL_PWR_OVERDRIVESWITCHING_DISABLE(); + + /* Get tick */ + tickstart = HAL_GetTick(); + + while(__HAL_PWR_GET_FLAG(PWR_FLAG_ODSWRDY)) + { + if((HAL_GetTick() - tickstart) > PWR_OVERDRIVE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Disable the Over-drive */ + __HAL_PWR_OVERDRIVE_DISABLE(); + + /* Get tick */ + tickstart = HAL_GetTick(); + + while(__HAL_PWR_GET_FLAG(PWR_FLAG_ODRDY)) + { + if((HAL_GetTick() - tickstart) > PWR_OVERDRIVE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +/** + * @brief Enters in Under-Drive STOP mode. + * + * @note This mode is only available for STM32F42xxx/STM32F43xxx/STM32F446xx/STM32F469xx/STM32F479xx devices. + * + * @note This mode can be selected only when the Under-Drive is already active + * + * @note This mode is enabled only with STOP low power mode. + * In this mode, the 1.2V domain is preserved in reduced leakage mode. This + * mode is only available when the main regulator or the low power regulator + * is in low voltage mode + * + * @note If the Under-drive mode was enabled, it is automatically disabled after + * exiting Stop mode. + * When the voltage regulator operates in Under-drive mode, an additional + * startup delay is induced when waking up from Stop mode. + * + * @note In Stop mode, all I/O pins keep the same state as in Run mode. + * + * @note When exiting Stop mode by issuing an interrupt or a wake-up event, + * the HSI RC oscillator is selected as system clock. + * + * @note When the voltage regulator operates in low power mode, an additional + * startup delay is incurred when waking up from Stop mode. + * By keeping the internal regulator ON during Stop mode, the consumption + * is higher although the startup time is reduced. + * + * @param Regulator specifies the regulator state in STOP mode. + * This parameter can be one of the following values: + * @arg PWR_MAINREGULATOR_UNDERDRIVE_ON: Main Regulator in under-drive mode + * and Flash memory in power-down when the device is in Stop under-drive mode + * @arg PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON: Low Power Regulator in under-drive mode + * and Flash memory in power-down when the device is in Stop under-drive mode + * @param STOPEntry specifies if STOP mode in entered with WFI or WFE instruction. + * This parameter can be one of the following values: + * @arg PWR_SLEEPENTRY_WFI: enter STOP mode with WFI instruction + * @arg PWR_SLEEPENTRY_WFE: enter STOP mode with WFE instruction + * @retval None + */ +HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry) +{ + uint32_t tmpreg1 = 0U; + + /* Check the parameters */ + assert_param(IS_PWR_REGULATOR_UNDERDRIVE(Regulator)); + assert_param(IS_PWR_STOP_ENTRY(STOPEntry)); + + /* Enable Power ctrl clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + /* Enable the Under-drive Mode ---------------------------------------------*/ + /* Clear Under-drive flag */ + __HAL_PWR_CLEAR_ODRUDR_FLAG(); + + /* Enable the Under-drive */ + __HAL_PWR_UNDERDRIVE_ENABLE(); + + /* Select the regulator state in STOP mode ---------------------------------*/ + tmpreg1 = PWR->CR; + /* Clear PDDS, LPDS, MRLUDS and LPLUDS bits */ + tmpreg1 &= (uint32_t)~(PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_LPUDS | PWR_CR_MRUDS); + + /* Set LPDS, MRLUDS and LPLUDS bits according to PWR_Regulator value */ + tmpreg1 |= Regulator; + + /* Store the new value */ + PWR->CR = tmpreg1; + + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + + /* Select STOP mode entry --------------------------------------------------*/ + if(STOPEntry == PWR_SLEEPENTRY_WFI) + { + /* Request Wait For Interrupt */ + __WFI(); + } + else + { + /* Request Wait For Event */ + __WFE(); + } + /* Reset SLEEPDEEP bit of Cortex System Control Register */ + SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk); + + return HAL_OK; +} + +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_PWR_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c new file mode 100644 index 0000000..7640b65 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c @@ -0,0 +1,1114 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_rcc.c + * @author MCD Application Team + * @brief RCC HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Reset and Clock Control (RCC) peripheral: + * + Initialization and de-initialization functions + * + Peripheral Control functions + * + @verbatim + ============================================================================== + ##### RCC specific features ##### + ============================================================================== + [..] + After reset the device is running from Internal High Speed oscillator + (HSI 16MHz) with Flash 0 wait state, Flash prefetch buffer, D-Cache + and I-Cache are disabled, and all peripherals are off except internal + SRAM, Flash and JTAG. + (+) There is no prescaler on High speed (AHB) and Low speed (APB) busses; + all peripherals mapped on these busses are running at HSI speed. + (+) The clock for all peripherals is switched off, except the SRAM and FLASH. + (+) All GPIOs are in input floating state, except the JTAG pins which + are assigned to be used for debug purpose. + + [..] + Once the device started from reset, the user application has to: + (+) Configure the clock source to be used to drive the System clock + (if the application needs higher frequency/performance) + (+) Configure the System clock frequency and Flash settings + (+) Configure the AHB and APB busses prescalers + (+) Enable the clock for the peripheral(s) to be used + (+) Configure the clock source(s) for peripherals which clocks are not + derived from the System clock (I2S, RTC, ADC, USB OTG FS/SDIO/RNG) + + ##### RCC Limitations ##### + ============================================================================== + [..] + A delay between an RCC peripheral clock enable and the effective peripheral + enabling should be taken into account in order to manage the peripheral read/write + from/to registers. + (+) This delay depends on the peripheral mapping. + (+) If peripheral is mapped on AHB: the delay is 2 AHB clock cycle + after the clock enable bit is set on the hardware register + (+) If peripheral is mapped on APB: the delay is 2 APB clock cycle + after the clock enable bit is set on the hardware register + + [..] + Implemented Workaround: + (+) For AHB & APB peripherals, a dummy read to the peripheral register has been + inserted in each __HAL_RCC_PPP_CLK_ENABLE() macro. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup RCC RCC + * @brief RCC HAL module driver + * @{ + */ + +#ifdef HAL_RCC_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup RCC_Private_Constants + * @{ + */ + +/* Private macro -------------------------------------------------------------*/ +#define __MCO1_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() +#define MCO1_GPIO_PORT GPIOA +#define MCO1_PIN GPIO_PIN_8 + +#define __MCO2_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() +#define MCO2_GPIO_PORT GPIOC +#define MCO2_PIN GPIO_PIN_9 +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/** @defgroup RCC_Private_Variables RCC Private Variables + * @{ + */ +/** + * @} + */ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/** @defgroup RCC_Exported_Functions RCC Exported Functions + * @{ + */ + +/** @defgroup RCC_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to configure the internal/external oscillators + (HSE, HSI, LSE, LSI, PLL, CSS and MCO) and the System busses clocks (SYSCLK, AHB, APB1 + and APB2). + + [..] Internal/external clock and PLL configuration + (#) HSI (high-speed internal), 16 MHz factory-trimmed RC used directly or through + the PLL as System clock source. + + (#) LSI (low-speed internal), 32 KHz low consumption RC used as IWDG and/or RTC + clock source. + + (#) HSE (high-speed external), 4 to 26 MHz crystal oscillator used directly or + through the PLL as System clock source. Can be used also as RTC clock source. + + (#) LSE (low-speed external), 32 KHz oscillator used as RTC clock source. + + (#) PLL (clocked by HSI or HSE), featuring two different output clocks: + (++) The first output is used to generate the high speed system clock (up to 168 MHz) + (++) The second output is used to generate the clock for the USB OTG FS (48 MHz), + the random analog generator (<=48 MHz) and the SDIO (<= 48 MHz). + + (#) CSS (Clock security system), once enable using the macro __HAL_RCC_CSS_ENABLE() + and if a HSE clock failure occurs(HSE used directly or through PLL as System + clock source), the System clocks automatically switched to HSI and an interrupt + is generated if enabled. The interrupt is linked to the Cortex-M4 NMI + (Non-Maskable Interrupt) exception vector. + + (#) MCO1 (microcontroller clock output), used to output HSI, LSE, HSE or PLL + clock (through a configurable prescaler) on PA8 pin. + + (#) MCO2 (microcontroller clock output), used to output HSE, PLL, SYSCLK or PLLI2S + clock (through a configurable prescaler) on PC9 pin. + + [..] System, AHB and APB busses clocks configuration + (#) Several clock sources can be used to drive the System clock (SYSCLK): HSI, + HSE and PLL. + The AHB clock (HCLK) is derived from System clock through configurable + prescaler and used to clock the CPU, memory and peripherals mapped + on AHB bus (DMA, GPIO...). APB1 (PCLK1) and APB2 (PCLK2) clocks are derived + from AHB clock through configurable prescalers and used to clock + the peripherals mapped on these busses. You can use + "HAL_RCC_GetSysClockFreq()" function to retrieve the frequencies of these clocks. + + (#) For the STM32F405xx/07xx and STM32F415xx/17xx devices, the maximum + frequency of the SYSCLK and HCLK is 168 MHz, PCLK2 84 MHz and PCLK1 42 MHz. + Depending on the device voltage range, the maximum frequency should + be adapted accordingly (refer to the product datasheets for more details). + + (#) For the STM32F42xxx, STM32F43xxx, STM32F446xx, STM32F469xx and STM32F479xx devices, + the maximum frequency of the SYSCLK and HCLK is 180 MHz, PCLK2 90 MHz and PCLK1 45 MHz. + Depending on the device voltage range, the maximum frequency should + be adapted accordingly (refer to the product datasheets for more details). + + (#) For the STM32F401xx, the maximum frequency of the SYSCLK and HCLK is 84 MHz, + PCLK2 84 MHz and PCLK1 42 MHz. + Depending on the device voltage range, the maximum frequency should + be adapted accordingly (refer to the product datasheets for more details). + + (#) For the STM32F41xxx, the maximum frequency of the SYSCLK and HCLK is 100 MHz, + PCLK2 100 MHz and PCLK1 50 MHz. + Depending on the device voltage range, the maximum frequency should + be adapted accordingly (refer to the product datasheets for more details). + +@endverbatim + * @{ + */ + +/** + * @brief Resets the RCC clock configuration to the default reset state. + * @note The default reset state of the clock configuration is given below: + * - HSI ON and used as system clock source + * - HSE and PLL OFF + * - AHB, APB1 and APB2 prescaler set to 1. + * - CSS, MCO1 and MCO2 OFF + * - All interrupts disabled + * @note This function doesn't modify the configuration of the + * - Peripheral clocks + * - LSI, LSE and RTC clocks + * @retval HAL status + */ +__weak HAL_StatusTypeDef HAL_RCC_DeInit(void) +{ + return HAL_OK; +} + +/** + * @brief Initializes the RCC Oscillators according to the specified parameters in the + * RCC_OscInitTypeDef. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that + * contains the configuration information for the RCC Oscillators. + * @note The PLL is not disabled when used as system clock. + * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not + * supported by this API. User should request a transition to LSE Off + * first and then LSE On or LSE Bypass. + * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not + * supported by this API. User should request a transition to HSE Off + * first and then HSE On or HSE Bypass. + * @retval HAL status + */ +__weak HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + uint32_t tickstart, pll_config; + + /* Check Null pointer */ + if(RCC_OscInitStruct == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_RCC_OSCILLATORTYPE(RCC_OscInitStruct->OscillatorType)); + /*------------------------------- HSE Configuration ------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) + { + /* Check the parameters */ + assert_param(IS_RCC_HSE(RCC_OscInitStruct->HSEState)); + /* When the HSE is used as system clock or clock source for PLL in these cases HSE will not disabled */ + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSE) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSE))) + { + if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) && (RCC_OscInitStruct->HSEState == RCC_HSE_OFF)) + { + return HAL_ERROR; + } + } + else + { + /* Set the new HSE configuration ---------------------------------------*/ + __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState); + + /* Check the HSE State */ + if((RCC_OscInitStruct->HSEState) != RCC_HSE_OFF) + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSE is bypassed or disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*----------------------------- HSI Configuration --------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) + { + /* Check the parameters */ + assert_param(IS_RCC_HSI(RCC_OscInitStruct->HSIState)); + assert_param(IS_RCC_CALIBRATION_VALUE(RCC_OscInitStruct->HSICalibrationValue)); + + /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSI) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI))) + { + /* When HSI is used as system clock it will not disabled */ + if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON)) + { + return HAL_ERROR; + } + /* Otherwise, just the calibration is allowed */ + else + { + /* Adjusts the Internal High Speed oscillator (HSI) calibration value.*/ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + } + else + { + /* Check the HSI State */ + if((RCC_OscInitStruct->HSIState)!= RCC_HSI_OFF) + { + /* Enable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Adjusts the Internal High Speed oscillator (HSI) calibration value. */ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + else + { + /* Disable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*------------------------------ LSI Configuration -------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) + { + /* Check the parameters */ + assert_param(IS_RCC_LSI(RCC_OscInitStruct->LSIState)); + + /* Check the LSI State */ + if((RCC_OscInitStruct->LSIState)!= RCC_LSI_OFF) + { + /* Enable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Disable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + /*------------------------------ LSE Configuration -------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) + { + FlagStatus pwrclkchanged = RESET; + + /* Check the parameters */ + assert_param(IS_RCC_LSE(RCC_OscInitStruct->LSEState)); + + /* Update LSE configuration in Backup Domain control register */ + /* Requires to enable write access to Backup Domain of necessary */ + if(__HAL_RCC_PWR_IS_CLK_DISABLED()) + { + __HAL_RCC_PWR_CLK_ENABLE(); + pwrclkchanged = SET; + } + + if(HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + /* Enable write access to Backup domain */ + SET_BIT(PWR->CR, PWR_CR_DBP); + + /* Wait for Backup domain Write protection disable */ + tickstart = HAL_GetTick(); + + while(HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + if((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Set the new LSE configuration -----------------------------------------*/ + __HAL_RCC_LSE_CONFIG(RCC_OscInitStruct->LSEState); + /* Check the LSE State */ + if((RCC_OscInitStruct->LSEState) != RCC_LSE_OFF) + { + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Restore clock configuration if changed */ + if(pwrclkchanged == SET) + { + __HAL_RCC_PWR_CLK_DISABLE(); + } + } + /*-------------------------------- PLL Configuration -----------------------*/ + /* Check the parameters */ + assert_param(IS_RCC_PLL(RCC_OscInitStruct->PLL.PLLState)); + if ((RCC_OscInitStruct->PLL.PLLState) != RCC_PLL_NONE) + { + /* Check if the PLL is used as system clock or not */ + if(__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) + { + if((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_ON) + { + /* Check the parameters */ + assert_param(IS_RCC_PLLSOURCE(RCC_OscInitStruct->PLL.PLLSource)); + assert_param(IS_RCC_PLLM_VALUE(RCC_OscInitStruct->PLL.PLLM)); + assert_param(IS_RCC_PLLN_VALUE(RCC_OscInitStruct->PLL.PLLN)); + assert_param(IS_RCC_PLLP_VALUE(RCC_OscInitStruct->PLL.PLLP)); + assert_param(IS_RCC_PLLQ_VALUE(RCC_OscInitStruct->PLL.PLLQ)); + + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the main PLL clock source, multiplication and division factors. */ + WRITE_REG(RCC->PLLCFGR, (RCC_OscInitStruct->PLL.PLLSource | \ + RCC_OscInitStruct->PLL.PLLM | \ + (RCC_OscInitStruct->PLL.PLLN << RCC_PLLCFGR_PLLN_Pos) | \ + (((RCC_OscInitStruct->PLL.PLLP >> 1U) - 1U) << RCC_PLLCFGR_PLLP_Pos) | \ + (RCC_OscInitStruct->PLL.PLLQ << RCC_PLLCFGR_PLLQ_Pos))); + /* Enable the main PLL. */ + __HAL_RCC_PLL_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + else + { + /* Check if there is a request to disable the PLL used as System clock source */ + if((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_OFF) + { + return HAL_ERROR; + } + else + { + /* Do not return HAL_ERROR if request repeats the current configuration */ + pll_config = RCC->PLLCFGR; + if((READ_BIT(pll_config, RCC_PLLCFGR_PLLSRC) != RCC_OscInitStruct->PLL.PLLSource) || + (READ_BIT(pll_config, RCC_PLLCFGR_PLLM) != RCC_OscInitStruct->PLL.PLLM) || + (READ_BIT(pll_config, RCC_PLLCFGR_PLLN) != RCC_OscInitStruct->PLL.PLLN) || + (READ_BIT(pll_config, RCC_PLLCFGR_PLLP) != RCC_OscInitStruct->PLL.PLLP) || + (READ_BIT(pll_config, RCC_PLLCFGR_PLLQ) != RCC_OscInitStruct->PLL.PLLQ)) + { + return HAL_ERROR; + } + } + } + } + return HAL_OK; +} + +/** + * @brief Initializes the CPU, AHB and APB busses clocks according to the specified + * parameters in the RCC_ClkInitStruct. + * @param RCC_ClkInitStruct pointer to an RCC_OscInitTypeDef structure that + * contains the configuration information for the RCC peripheral. + * @param FLatency FLASH Latency, this parameter depend on device selected + * + * @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency + * and updated by HAL_RCC_GetHCLKFreq() function called within this function + * + * @note The HSI is used (enabled by hardware) as system clock source after + * startup from Reset, wake-up from STOP and STANDBY mode, or in case + * of failure of the HSE used directly or indirectly as system clock + * (if the Clock Security System CSS is enabled). + * + * @note A switch from one clock source to another occurs only if the target + * clock source is ready (clock stable after startup delay or PLL locked). + * If a clock source which is not yet ready is selected, the switch will + * occur when the clock source will be ready. + * + * @note Depending on the device voltage range, the software has to set correctly + * HPRE[3:0] bits to ensure that HCLK not exceed the maximum allowed frequency + * (for more details refer to section above "Initialization/de-initialization functions") + * @retval None + */ +HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency) +{ + uint32_t tickstart; + + /* Check Null pointer */ + if(RCC_ClkInitStruct == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_RCC_CLOCKTYPE(RCC_ClkInitStruct->ClockType)); + assert_param(IS_FLASH_LATENCY(FLatency)); + + /* To correctly read data from FLASH memory, the number of wait states (LATENCY) + must be correctly programmed according to the frequency of the CPU clock + (HCLK) and the supply voltage of the device. */ + + /* Increasing the number of wait states because of higher CPU frequency */ + if(FLatency > __HAL_FLASH_GET_LATENCY()) + { + /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ + __HAL_FLASH_SET_LATENCY(FLatency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + if(__HAL_FLASH_GET_LATENCY() != FLatency) + { + return HAL_ERROR; + } + } + + /*-------------------------- HCLK Configuration --------------------------*/ + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) + { + /* Set the highest APBx dividers in order to ensure that we do not go through + a non-spec phase whatever we decrease or increase HCLK. */ + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) + { + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, RCC_HCLK_DIV16); + } + + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2) + { + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, (RCC_HCLK_DIV16 << 3)); + } + + assert_param(IS_RCC_HCLK(RCC_ClkInitStruct->AHBCLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, RCC_ClkInitStruct->AHBCLKDivider); + } + + /*------------------------- SYSCLK Configuration ---------------------------*/ + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK) + { + assert_param(IS_RCC_SYSCLKSOURCE(RCC_ClkInitStruct->SYSCLKSource)); + + /* HSE is selected as System Clock Source */ + if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE) + { + /* Check the HSE ready flag */ + if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) + { + return HAL_ERROR; + } + } + /* PLL is selected as System Clock Source */ + else if((RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_PLLCLK) || + (RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_PLLRCLK)) + { + /* Check the PLL ready flag */ + if(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + return HAL_ERROR; + } + } + /* HSI is selected as System Clock Source */ + else + { + /* Check the HSI ready flag */ + if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) + { + return HAL_ERROR; + } + } + + __HAL_RCC_SYSCLK_CONFIG(RCC_ClkInitStruct->SYSCLKSource); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + while (__HAL_RCC_GET_SYSCLK_SOURCE() != (RCC_ClkInitStruct->SYSCLKSource << RCC_CFGR_SWS_Pos)) + { + if ((HAL_GetTick() - tickstart) > CLOCKSWITCH_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Decreasing the number of wait states because of lower CPU frequency */ + if(FLatency < __HAL_FLASH_GET_LATENCY()) + { + /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ + __HAL_FLASH_SET_LATENCY(FLatency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + if(__HAL_FLASH_GET_LATENCY() != FLatency) + { + return HAL_ERROR; + } + } + + /*-------------------------- PCLK1 Configuration ---------------------------*/ + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) + { + assert_param(IS_RCC_PCLK(RCC_ClkInitStruct->APB1CLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, RCC_ClkInitStruct->APB1CLKDivider); + } + + /*-------------------------- PCLK2 Configuration ---------------------------*/ + if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2) + { + assert_param(IS_RCC_PCLK(RCC_ClkInitStruct->APB2CLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, ((RCC_ClkInitStruct->APB2CLKDivider) << 3U)); + } + + /* Update the SystemCoreClock global variable */ + SystemCoreClock = HAL_RCC_GetSysClockFreq() >> AHBPrescTable[(RCC->CFGR & RCC_CFGR_HPRE)>> RCC_CFGR_HPRE_Pos]; + + /* Configure the source of time base considering new system clocks settings */ + HAL_InitTick (uwTickPrio); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup RCC_Exported_Functions_Group2 Peripheral Control functions + * @brief RCC clocks control functions + * +@verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the RCC Clocks + frequencies. + +@endverbatim + * @{ + */ + +/** + * @brief Selects the clock source to output on MCO1 pin(PA8) or on MCO2 pin(PC9). + * @note PA8/PC9 should be configured in alternate function mode. + * @param RCC_MCOx specifies the output direction for the clock source. + * This parameter can be one of the following values: + * @arg RCC_MCO1: Clock source to output on MCO1 pin(PA8). + * @arg RCC_MCO2: Clock source to output on MCO2 pin(PC9). + * @param RCC_MCOSource specifies the clock source to output. + * This parameter can be one of the following values: + * @arg RCC_MCO1SOURCE_HSI: HSI clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_LSE: LSE clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_HSE: HSE clock selected as MCO1 source + * @arg RCC_MCO1SOURCE_PLLCLK: main PLL clock selected as MCO1 source + * @arg RCC_MCO2SOURCE_SYSCLK: System clock (SYSCLK) selected as MCO2 source + * @arg RCC_MCO2SOURCE_PLLI2SCLK: PLLI2S clock selected as MCO2 source, available for all STM32F4 devices except STM32F410xx + * @arg RCC_MCO2SOURCE_I2SCLK: I2SCLK clock selected as MCO2 source, available only for STM32F410Rx devices + * @arg RCC_MCO2SOURCE_HSE: HSE clock selected as MCO2 source + * @arg RCC_MCO2SOURCE_PLLCLK: main PLL clock selected as MCO2 source + * @param RCC_MCODiv specifies the MCOx prescaler. + * This parameter can be one of the following values: + * @arg RCC_MCODIV_1: no division applied to MCOx clock + * @arg RCC_MCODIV_2: division by 2 applied to MCOx clock + * @arg RCC_MCODIV_3: division by 3 applied to MCOx clock + * @arg RCC_MCODIV_4: division by 4 applied to MCOx clock + * @arg RCC_MCODIV_5: division by 5 applied to MCOx clock + * @note For STM32F410Rx devices to output I2SCLK clock on MCO2 you should have + * at last one of the SPI clocks enabled (SPI1, SPI2 or SPI5). + * @retval None + */ +void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv) +{ + GPIO_InitTypeDef GPIO_InitStruct; + /* Check the parameters */ + assert_param(IS_RCC_MCO(RCC_MCOx)); + assert_param(IS_RCC_MCODIV(RCC_MCODiv)); + /* RCC_MCO1 */ + if(RCC_MCOx == RCC_MCO1) + { + assert_param(IS_RCC_MCO1SOURCE(RCC_MCOSource)); + + /* MCO1 Clock Enable */ + __MCO1_CLK_ENABLE(); + + /* Configure the MCO1 pin in alternate function mode */ + GPIO_InitStruct.Pin = MCO1_PIN; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Alternate = GPIO_AF0_MCO; + HAL_GPIO_Init(MCO1_GPIO_PORT, &GPIO_InitStruct); + + /* Mask MCO1 and MCO1PRE[2:0] bits then Select MCO1 clock source and prescaler */ + MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO1 | RCC_CFGR_MCO1PRE), (RCC_MCOSource | RCC_MCODiv)); + + /* This RCC MCO1 enable feature is available only on STM32F410xx devices */ +#if defined(RCC_CFGR_MCO1EN) + __HAL_RCC_MCO1_ENABLE(); +#endif /* RCC_CFGR_MCO1EN */ + } +#if defined(RCC_CFGR_MCO2) + else + { + assert_param(IS_RCC_MCO2SOURCE(RCC_MCOSource)); + + /* MCO2 Clock Enable */ + __MCO2_CLK_ENABLE(); + + /* Configure the MCO2 pin in alternate function mode */ + GPIO_InitStruct.Pin = MCO2_PIN; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Alternate = GPIO_AF0_MCO; + HAL_GPIO_Init(MCO2_GPIO_PORT, &GPIO_InitStruct); + + /* Mask MCO2 and MCO2PRE[2:0] bits then Select MCO2 clock source and prescaler */ + MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO2 | RCC_CFGR_MCO2PRE), (RCC_MCOSource | (RCC_MCODiv << 3U))); + + /* This RCC MCO2 enable feature is available only on STM32F410Rx devices */ +#if defined(RCC_CFGR_MCO2EN) + __HAL_RCC_MCO2_ENABLE(); +#endif /* RCC_CFGR_MCO2EN */ + } +#endif /* RCC_CFGR_MCO2 */ +} + +/** + * @brief Enables the Clock Security System. + * @note If a failure is detected on the HSE oscillator clock, this oscillator + * is automatically disabled and an interrupt is generated to inform the + * software about the failure (Clock Security System Interrupt, CSSI), + * allowing the MCU to perform rescue operations. The CSSI is linked to + * the Cortex-M4 NMI (Non-Maskable Interrupt) exception vector. + * @retval None + */ +void HAL_RCC_EnableCSS(void) +{ + *(__IO uint32_t *) RCC_CR_CSSON_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Clock Security System. + * @retval None + */ +void HAL_RCC_DisableCSS(void) +{ + *(__IO uint32_t *) RCC_CR_CSSON_BB = (uint32_t)DISABLE; +} + +/** + * @brief Returns the SYSCLK frequency + * + * @note The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(*) + * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(**) + * @note If SYSCLK source is PLL, function returns values based on HSE_VALUE(**) + * or HSI_VALUE(*) multiplied/divided by the PLL factors. + * @note (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * @note (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value + * 25 MHz), user has to ensure that HSE_VALUE is same as the real + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * + * @note The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @note This function can be used by the user application to compute the + * baudrate for the communication peripherals or configure other parameters. + * + * @note Each time SYSCLK changes, this function must be called to update the + * right SYSCLK value. Otherwise, any configuration based on this function will be incorrect. + * + * + * @retval SYSCLK frequency + */ +__weak uint32_t HAL_RCC_GetSysClockFreq(void) +{ + uint32_t pllm = 0U, pllvco = 0U, pllp = 0U; + uint32_t sysclockfreq = 0U; + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (RCC->CFGR & RCC_CFGR_SWS) + { + case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */ + { + sysclockfreq = HSI_VALUE; + break; + } + case RCC_CFGR_SWS_HSE: /* HSE used as system clock source */ + { + sysclockfreq = HSE_VALUE; + break; + } + case RCC_CFGR_SWS_PLL: /* PLL used as system clock source */ + { + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SYSCLK = PLL_VCO / PLLP */ + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + if(__HAL_RCC_GET_PLL_OSCSOURCE() != RCC_PLLSOURCE_HSI) + { + /* HSE used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSE_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSI_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + pllp = ((((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >> RCC_PLLCFGR_PLLP_Pos) + 1U) *2U); + + sysclockfreq = pllvco/pllp; + break; + } + default: + { + sysclockfreq = HSI_VALUE; + break; + } + } + return sysclockfreq; +} + +/** + * @brief Returns the HCLK frequency + * @note Each time HCLK changes, this function must be called to update the + * right HCLK value. Otherwise, any configuration based on this function will be incorrect. + * + * @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency + * and updated within this function + * @retval HCLK frequency + */ +uint32_t HAL_RCC_GetHCLKFreq(void) +{ + return SystemCoreClock; +} + +/** + * @brief Returns the PCLK1 frequency + * @note Each time PCLK1 changes, this function must be called to update the + * right PCLK1 value. Otherwise, any configuration based on this function will be incorrect. + * @retval PCLK1 frequency + */ +uint32_t HAL_RCC_GetPCLK1Freq(void) +{ + /* Get HCLK source and Compute PCLK1 frequency ---------------------------*/ + return (HAL_RCC_GetHCLKFreq() >> APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE1)>> RCC_CFGR_PPRE1_Pos]); +} + +/** + * @brief Returns the PCLK2 frequency + * @note Each time PCLK2 changes, this function must be called to update the + * right PCLK2 value. Otherwise, any configuration based on this function will be incorrect. + * @retval PCLK2 frequency + */ +uint32_t HAL_RCC_GetPCLK2Freq(void) +{ + /* Get HCLK source and Compute PCLK2 frequency ---------------------------*/ + return (HAL_RCC_GetHCLKFreq()>> APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE2)>> RCC_CFGR_PPRE2_Pos]); +} + +/** + * @brief Configures the RCC_OscInitStruct according to the internal + * RCC configuration registers. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that + * will be configured. + * @retval None + */ +__weak void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + /* Set all possible values for the Oscillator type parameter ---------------*/ + RCC_OscInitStruct->OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_LSI; + + /* Get the HSE configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_HSEBYP) == RCC_CR_HSEBYP) + { + RCC_OscInitStruct->HSEState = RCC_HSE_BYPASS; + } + else if((RCC->CR &RCC_CR_HSEON) == RCC_CR_HSEON) + { + RCC_OscInitStruct->HSEState = RCC_HSE_ON; + } + else + { + RCC_OscInitStruct->HSEState = RCC_HSE_OFF; + } + + /* Get the HSI configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_HSION) == RCC_CR_HSION) + { + RCC_OscInitStruct->HSIState = RCC_HSI_ON; + } + else + { + RCC_OscInitStruct->HSIState = RCC_HSI_OFF; + } + + RCC_OscInitStruct->HSICalibrationValue = (uint32_t)((RCC->CR &RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos); + + /* Get the LSE configuration -----------------------------------------------*/ + if((RCC->BDCR &RCC_BDCR_LSEBYP) == RCC_BDCR_LSEBYP) + { + RCC_OscInitStruct->LSEState = RCC_LSE_BYPASS; + } + else if((RCC->BDCR &RCC_BDCR_LSEON) == RCC_BDCR_LSEON) + { + RCC_OscInitStruct->LSEState = RCC_LSE_ON; + } + else + { + RCC_OscInitStruct->LSEState = RCC_LSE_OFF; + } + + /* Get the LSI configuration -----------------------------------------------*/ + if((RCC->CSR &RCC_CSR_LSION) == RCC_CSR_LSION) + { + RCC_OscInitStruct->LSIState = RCC_LSI_ON; + } + else + { + RCC_OscInitStruct->LSIState = RCC_LSI_OFF; + } + + /* Get the PLL configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_PLLON) == RCC_CR_PLLON) + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_ON; + } + else + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_OFF; + } + RCC_OscInitStruct->PLL.PLLSource = (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC); + RCC_OscInitStruct->PLL.PLLM = (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM); + RCC_OscInitStruct->PLL.PLLN = (uint32_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos); + RCC_OscInitStruct->PLL.PLLP = (uint32_t)((((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) + RCC_PLLCFGR_PLLP_0) << 1U) >> RCC_PLLCFGR_PLLP_Pos); + RCC_OscInitStruct->PLL.PLLQ = (uint32_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLQ) >> RCC_PLLCFGR_PLLQ_Pos); +} + +/** + * @brief Configures the RCC_ClkInitStruct according to the internal + * RCC configuration registers. + * @param RCC_ClkInitStruct pointer to an RCC_ClkInitTypeDef structure that + * will be configured. + * @param pFLatency Pointer on the Flash Latency. + * @retval None + */ +void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency) +{ + /* Set all possible values for the Clock type parameter --------------------*/ + RCC_ClkInitStruct->ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + + /* Get the SYSCLK configuration --------------------------------------------*/ + RCC_ClkInitStruct->SYSCLKSource = (uint32_t)(RCC->CFGR & RCC_CFGR_SW); + + /* Get the HCLK configuration ----------------------------------------------*/ + RCC_ClkInitStruct->AHBCLKDivider = (uint32_t)(RCC->CFGR & RCC_CFGR_HPRE); + + /* Get the APB1 configuration ----------------------------------------------*/ + RCC_ClkInitStruct->APB1CLKDivider = (uint32_t)(RCC->CFGR & RCC_CFGR_PPRE1); + + /* Get the APB2 configuration ----------------------------------------------*/ + RCC_ClkInitStruct->APB2CLKDivider = (uint32_t)((RCC->CFGR & RCC_CFGR_PPRE2) >> 3U); + + /* Get the Flash Wait State (Latency) configuration ------------------------*/ + *pFLatency = (uint32_t)(FLASH->ACR & FLASH_ACR_LATENCY); +} + +/** + * @brief This function handles the RCC CSS interrupt request. + * @note This API should be called under the NMI_Handler(). + * @retval None + */ +void HAL_RCC_NMI_IRQHandler(void) +{ + /* Check RCC CSSF flag */ + if(__HAL_RCC_GET_IT(RCC_IT_CSS)) + { + /* RCC Clock Security System interrupt user callback */ + HAL_RCC_CSSCallback(); + + /* Clear RCC CSS pending bit */ + __HAL_RCC_CLEAR_IT(RCC_IT_CSS); + } +} + +/** + * @brief RCC Clock Security System interrupt callback + * @retval None + */ +__weak void HAL_RCC_CSSCallback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_RCC_CSSCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_RCC_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c new file mode 100644 index 0000000..0d3aacc --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c @@ -0,0 +1,3754 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_rcc_ex.c + * @author MCD Application Team + * @brief Extension RCC HAL module driver. + * This file provides firmware functions to manage the following + * functionalities RCC extension peripheral: + * + Extended Peripheral Control functions + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup RCCEx RCCEx + * @brief RCCEx HAL module driver + * @{ + */ + +#ifdef HAL_RCC_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup RCCEx_Private_Constants + * @{ + */ +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @defgroup RCCEx_Exported_Functions RCCEx Exported Functions + * @{ + */ + +/** @defgroup RCCEx_Exported_Functions_Group1 Extended Peripheral Control functions + * @brief Extended Peripheral Control functions + * +@verbatim + =============================================================================== + ##### Extended Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the RCC Clocks + frequencies. + [..] + (@) Important note: Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to + select the RTC clock source; in this case the Backup domain will be reset in + order to modify the RTC Clock source, as consequence RTC registers (including + the backup registers) and RCC_BDCR register are set to their reset values. + +@endverbatim + * @{ + */ + +#if defined(STM32F446xx) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified + * parameters in the RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals + * clocks(I2S, SAI, LTDC RTC and TIM). + * + * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select + * the RTC clock source; in this case the Backup domain will be reset in + * order to modify the RTC Clock source, as consequence RTC registers (including + * the backup registers) and RCC_BDCR register are set to their reset values. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; + uint32_t plli2sp = 0U; + uint32_t plli2sq = 0U; + uint32_t plli2sr = 0U; + uint32_t pllsaip = 0U; + uint32_t pllsaiq = 0U; + uint32_t plli2sused = 0U; + uint32_t pllsaiused = 0U; + + /* Check the peripheral clock selection parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*------------------------ I2S APB1 configuration --------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB1) == (RCC_PERIPHCLK_I2S_APB1)) + { + /* Check the parameters */ + assert_param(IS_RCC_I2SAPB1CLKSOURCE(PeriphClkInit->I2sApb1ClockSelection)); + + /* Configure I2S Clock source */ + __HAL_RCC_I2S_APB1_CONFIG(PeriphClkInit->I2sApb1ClockSelection); + /* Enable the PLLI2S when it's used as clock source for I2S */ + if(PeriphClkInit->I2sApb1ClockSelection == RCC_I2SAPB1CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- I2S APB2 configuration ----------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB2) == (RCC_PERIPHCLK_I2S_APB2)) + { + /* Check the parameters */ + assert_param(IS_RCC_I2SAPB2CLKSOURCE(PeriphClkInit->I2sApb2ClockSelection)); + + /* Configure I2S Clock source */ + __HAL_RCC_I2S_APB2_CONFIG(PeriphClkInit->I2sApb2ClockSelection); + /* Enable the PLLI2S when it's used as clock source for I2S */ + if(PeriphClkInit->I2sApb2ClockSelection == RCC_I2SAPB2CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*--------------------------- SAI1 configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI1) == (RCC_PERIPHCLK_SAI1)) + { + /* Check the parameters */ + assert_param(IS_RCC_SAI1CLKSOURCE(PeriphClkInit->Sai1ClockSelection)); + + /* Configure SAI1 Clock source */ + __HAL_RCC_SAI1_CONFIG(PeriphClkInit->Sai1ClockSelection); + /* Enable the PLLI2S when it's used as clock source for SAI */ + if(PeriphClkInit->Sai1ClockSelection == RCC_SAI1CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + /* Enable the PLLSAI when it's used as clock source for SAI */ + if(PeriphClkInit->Sai1ClockSelection == RCC_SAI1CLKSOURCE_PLLSAI) + { + pllsaiused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*-------------------------- SAI2 configuration ----------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI2) == (RCC_PERIPHCLK_SAI2)) + { + /* Check the parameters */ + assert_param(IS_RCC_SAI2CLKSOURCE(PeriphClkInit->Sai2ClockSelection)); + + /* Configure SAI2 Clock source */ + __HAL_RCC_SAI2_CONFIG(PeriphClkInit->Sai2ClockSelection); + + /* Enable the PLLI2S when it's used as clock source for SAI */ + if(PeriphClkInit->Sai2ClockSelection == RCC_SAI2CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + /* Enable the PLLSAI when it's used as clock source for SAI */ + if(PeriphClkInit->Sai2ClockSelection == RCC_SAI2CLKSOURCE_PLLSAI) + { + pllsaiused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------------- RTC configuration --------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- TIM configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + /* Configure Timer Prescaler */ + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- FMPI2C1 Configuration -----------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_FMPI2C1) == RCC_PERIPHCLK_FMPI2C1) + { + /* Check the parameters */ + assert_param(IS_RCC_FMPI2C1CLKSOURCE(PeriphClkInit->Fmpi2c1ClockSelection)); + + /* Configure the FMPI2C1 clock source */ + __HAL_RCC_FMPI2C1_CONFIG(PeriphClkInit->Fmpi2c1ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------ CEC Configuration -------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) + { + /* Check the parameters */ + assert_param(IS_RCC_CECCLKSOURCE(PeriphClkInit->CecClockSelection)); + + /* Configure the CEC clock source */ + __HAL_RCC_CEC_CONFIG(PeriphClkInit->CecClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*----------------------------- CLK48 Configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) + { + /* Check the parameters */ + assert_param(IS_RCC_CLK48CLKSOURCE(PeriphClkInit->Clk48ClockSelection)); + + /* Configure the CLK48 clock source */ + __HAL_RCC_CLK48_CONFIG(PeriphClkInit->Clk48ClockSelection); + + /* Enable the PLLSAI when it's used as clock source for CLK48 */ + if(PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLSAIP) + { + pllsaiused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------------- SDIO Configuration -------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SDIO) == RCC_PERIPHCLK_SDIO) + { + /* Check the parameters */ + assert_param(IS_RCC_SDIOCLKSOURCE(PeriphClkInit->SdioClockSelection)); + + /* Configure the SDIO clock source */ + __HAL_RCC_SDIO_CONFIG(PeriphClkInit->SdioClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------ SPDIFRX Configuration ---------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) + { + /* Check the parameters */ + assert_param(IS_RCC_SPDIFRXCLKSOURCE(PeriphClkInit->SpdifClockSelection)); + + /* Configure the SPDIFRX clock source */ + __HAL_RCC_SPDIFRX_CONFIG(PeriphClkInit->SpdifClockSelection); + /* Enable the PLLI2S when it's used as clock source for SPDIFRX */ + if(PeriphClkInit->SpdifClockSelection == RCC_SPDIFRXCLKSOURCE_PLLI2SP) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- PLLI2S Configuration ------------------------*/ + /* PLLI2S is configured when a peripheral will use it as source clock : SAI1, SAI2, I2S on APB1, + I2S on APB2 or SPDIFRX */ + if((plli2sused == 1U) || (PeriphClkInit->PeriphClockSelection == RCC_PERIPHCLK_PLLI2S)) + { + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /* check for common PLLI2S Parameters */ + assert_param(IS_RCC_PLLI2SM_VALUE(PeriphClkInit->PLLI2S.PLLI2SM)); + assert_param(IS_RCC_PLLI2SN_VALUE(PeriphClkInit->PLLI2S.PLLI2SN)); + + /*------ In Case of PLLI2S is selected as source clock for I2S -----------*/ + if(((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB1) == RCC_PERIPHCLK_I2S_APB1) && (PeriphClkInit->I2sApb1ClockSelection == RCC_I2SAPB1CLKSOURCE_PLLI2S)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB2) == RCC_PERIPHCLK_I2S_APB2) && (PeriphClkInit->I2sApb2ClockSelection == RCC_I2SAPB2CLKSOURCE_PLLI2S))) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + + /* Read PLLI2SP/PLLI2SQ value from PLLI2SCFGR register (this value is not needed for I2S configuration) */ + plli2sp = ((((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SP) >> RCC_PLLI2SCFGR_PLLI2SP_Pos) + 1U) << 1U); + plli2sq = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , plli2sp, plli2sq, PeriphClkInit->PLLI2S.PLLI2SR); + } + + /*------- In Case of PLLI2S is selected as source clock for SAI ----------*/ + if(((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) && (PeriphClkInit->Sai1ClockSelection == RCC_SAI1CLKSOURCE_PLLI2S)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) && (PeriphClkInit->Sai2ClockSelection == RCC_SAI2CLKSOURCE_PLLI2S))) + { + /* Check for PLLI2S Parameters */ + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + /* Check for PLLI2S/DIVQ parameters */ + assert_param(IS_RCC_PLLI2S_DIVQ_VALUE(PeriphClkInit->PLLI2SDivQ)); + + /* Read PLLI2SP/PLLI2SR value from PLLI2SCFGR register (this value is not needed for SAI configuration) */ + plli2sp = ((((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SP) >> RCC_PLLI2SCFGR_PLLI2SP_Pos) + 1U) << 1U); + plli2sr = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + /* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , plli2sp, PeriphClkInit->PLLI2S.PLLI2SQ, plli2sr); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ */ + __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLI2SDivQ); + } + + /*------ In Case of PLLI2S is selected as source clock for SPDIFRX -------*/ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) && (PeriphClkInit->SpdifClockSelection == RCC_SPDIFRXCLKSOURCE_PLLI2SP)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SP_VALUE(PeriphClkInit->PLLI2S.PLLI2SP)); + /* Read PLLI2SR value from PLLI2SCFGR register (this value is not need for SAI configuration) */ + plli2sq = ((((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SP) >> RCC_PLLI2SCFGR_PLLI2SP_Pos) + 1U) << 1U); + plli2sr = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + /* SPDIFRXCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SP */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SP, plli2sq, plli2sr); + } + + /*----------------- In Case of PLLI2S is just selected -----------------*/ + if((PeriphClkInit->PeriphClockSelection & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S) + { + /* Check for Parameters */ + assert_param(IS_RCC_PLLI2SP_VALUE(PeriphClkInit->PLLI2S.PLLI2SP)); + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SP, PeriphClkInit->PLLI2S.PLLI2SQ, PeriphClkInit->PLLI2S.PLLI2SR); + } + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------------- PLLSAI Configuration -----------------------*/ + /* PLLSAI is configured when a peripheral will use it as source clock : SAI1, SAI2, CLK48 or SDIO */ + if(pllsaiused == 1U) + { + /* Disable PLLSAI Clock */ + __HAL_RCC_PLLSAI_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is disabled */ + while(__HAL_RCC_PLLSAI_GET_FLAG() != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /* Check the PLLSAI division factors */ + assert_param(IS_RCC_PLLSAIM_VALUE(PeriphClkInit->PLLSAI.PLLSAIM)); + assert_param(IS_RCC_PLLSAIN_VALUE(PeriphClkInit->PLLSAI.PLLSAIN)); + + /*------ In Case of PLLSAI is selected as source clock for SAI -----------*/ + if(((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) && (PeriphClkInit->Sai1ClockSelection == RCC_SAI1CLKSOURCE_PLLSAI)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) && (PeriphClkInit->Sai2ClockSelection == RCC_SAI2CLKSOURCE_PLLSAI))) + { + /* check for PLLSAIQ Parameter */ + assert_param(IS_RCC_PLLSAIQ_VALUE(PeriphClkInit->PLLSAI.PLLSAIQ)); + /* check for PLLSAI/DIVQ Parameter */ + assert_param(IS_RCC_PLLSAI_DIVQ_VALUE(PeriphClkInit->PLLSAIDivQ)); + + /* Read PLLSAIP value from PLLSAICFGR register (this value is not needed for SAI configuration) */ + pllsaip = ((((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIP) >> RCC_PLLSAICFGR_PLLSAIP_Pos) + 1U) << 1U); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* SAI_CLK(first level) = PLLSAI_VCO Output/PLLSAIQ */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIM, PeriphClkInit->PLLSAI.PLLSAIN , pllsaip, PeriphClkInit->PLLSAI.PLLSAIQ, 0U); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ */ + __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLSAIDivQ); + } + + /*------ In Case of PLLSAI is selected as source clock for CLK48 ---------*/ + /* In Case of PLLI2S is selected as source clock for CLK48 */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) && (PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLSAIP)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLSAIP_VALUE(PeriphClkInit->PLLSAI.PLLSAIP)); + /* Read PLLSAIQ value from PLLI2SCFGR register (this value is not need for SAI configuration) */ + pllsaiq = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* Configure the PLLSAI division factors */ + /* PLLSAI_VCO = f(VCO clock) = f(PLLSAI clock input) * (PLLI2SN/PLLSAIM) */ + /* 48CLK = f(PLLSAI clock output) = f(VCO clock) / PLLSAIP */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIM, PeriphClkInit->PLLSAI.PLLSAIN , PeriphClkInit->PLLSAI.PLLSAIP, pllsaiq, 0U); + } + + /* Enable PLLSAI Clock */ + __HAL_RCC_PLLSAI_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is ready */ + while(__HAL_RCC_PLLSAI_GET_FLAG() == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + return HAL_OK; +} + +/** + * @brief Get the RCC_PeriphCLKInitTypeDef according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S_APB1 | RCC_PERIPHCLK_I2S_APB2 |\ + RCC_PERIPHCLK_SAI1 | RCC_PERIPHCLK_SAI2 |\ + RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC |\ + RCC_PERIPHCLK_CEC | RCC_PERIPHCLK_FMPI2C1 |\ + RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO |\ + RCC_PERIPHCLK_SPDIFRX; + + /* Get the PLLI2S Clock configuration --------------------------------------*/ + PeriphClkInit->PLLI2S.PLLI2SM = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM) >> RCC_PLLI2SCFGR_PLLI2SM_Pos); + PeriphClkInit->PLLI2S.PLLI2SN = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); + PeriphClkInit->PLLI2S.PLLI2SP = (uint32_t)((((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SP) >> RCC_PLLI2SCFGR_PLLI2SP_Pos) + 1U) << 1U); + PeriphClkInit->PLLI2S.PLLI2SQ = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + PeriphClkInit->PLLI2S.PLLI2SR = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + /* Get the PLLSAI Clock configuration --------------------------------------*/ + PeriphClkInit->PLLSAI.PLLSAIM = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIM) >> RCC_PLLSAICFGR_PLLSAIM_Pos); + PeriphClkInit->PLLSAI.PLLSAIN = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIN) >> RCC_PLLSAICFGR_PLLSAIN_Pos); + PeriphClkInit->PLLSAI.PLLSAIP = (uint32_t)((((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIP) >> RCC_PLLSAICFGR_PLLSAIP_Pos) + 1U) << 1U); + PeriphClkInit->PLLSAI.PLLSAIQ = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* Get the PLLSAI/PLLI2S division factors ----------------------------------*/ + PeriphClkInit->PLLI2SDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVQ) >> RCC_DCKCFGR_PLLI2SDIVQ_Pos); + PeriphClkInit->PLLSAIDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVQ) >> RCC_DCKCFGR_PLLSAIDIVQ_Pos); + + /* Get the SAI1 clock configuration ----------------------------------------*/ + PeriphClkInit->Sai1ClockSelection = __HAL_RCC_GET_SAI1_SOURCE(); + + /* Get the SAI2 clock configuration ----------------------------------------*/ + PeriphClkInit->Sai2ClockSelection = __HAL_RCC_GET_SAI2_SOURCE(); + + /* Get the I2S APB1 clock configuration ------------------------------------*/ + PeriphClkInit->I2sApb1ClockSelection = __HAL_RCC_GET_I2S_APB1_SOURCE(); + + /* Get the I2S APB2 clock configuration ------------------------------------*/ + PeriphClkInit->I2sApb2ClockSelection = __HAL_RCC_GET_I2S_APB2_SOURCE(); + + /* Get the RTC Clock configuration -----------------------------------------*/ + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + + /* Get the CEC clock configuration -----------------------------------------*/ + PeriphClkInit->CecClockSelection = __HAL_RCC_GET_CEC_SOURCE(); + + /* Get the FMPI2C1 clock configuration -------------------------------------*/ + PeriphClkInit->Fmpi2c1ClockSelection = __HAL_RCC_GET_FMPI2C1_SOURCE(); + + /* Get the CLK48 clock configuration ----------------------------------------*/ + PeriphClkInit->Clk48ClockSelection = __HAL_RCC_GET_CLK48_SOURCE(); + + /* Get the SDIO clock configuration ----------------------------------------*/ + PeriphClkInit->SdioClockSelection = __HAL_RCC_GET_SDIO_SOURCE(); + + /* Get the SPDIFRX clock configuration -------------------------------------*/ + PeriphClkInit->SpdifClockSelection = __HAL_RCC_GET_SPDIFRX_SOURCE(); + + /* Get the TIM Prescaler configuration -------------------------------------*/ + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } +} + +/** + * @brief Return the peripheral clock frequency for a given peripheral(SAI..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_SAI1: SAI1 peripheral clock + * @arg RCC_PERIPHCLK_SAI2: SAI2 peripheral clock + * @arg RCC_PERIPHCLK_I2S_APB1: I2S APB1 peripheral clock + * @arg RCC_PERIPHCLK_I2S_APB2: I2S APB2 peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + uint32_t tmpreg1 = 0U; + /* This variable used to store the SAI clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + /* This variable used to store the SAI clock source */ + uint32_t saiclocksource = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_SAI1: + case RCC_PERIPHCLK_SAI2: + { + saiclocksource = RCC->DCKCFGR; + saiclocksource &= (RCC_DCKCFGR_SAI1SRC | RCC_DCKCFGR_SAI2SRC); + switch (saiclocksource) + { + case 0U: /* PLLSAI is the clock source for SAI*/ + { + /* Configure the PLLSAI division factor */ + /* PLLSAI_VCO Input = PLL_SOURCE/PLLSAIM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSI) + { + /* In Case the PLL Source is HSI (Internal Clock) */ + vcoinput = (HSI_VALUE / (uint32_t)(RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIM)); + } + else + { + /* In Case the PLL Source is HSE (External Clock) */ + vcoinput = ((HSE_VALUE / (uint32_t)(RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIM))); + } + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* SAI_CLK(first level) = PLLSAI_VCO Output/PLLSAIQ */ + tmpreg1 = (RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> 24U; + frequency = (vcoinput * ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIN) >> 6U))/(tmpreg1); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ */ + tmpreg1 = (((RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVQ) >> 8U) + 1U); + frequency = frequency/(tmpreg1); + break; + } + case RCC_DCKCFGR_SAI1SRC_0: /* PLLI2S is the clock source for SAI*/ + case RCC_DCKCFGR_SAI2SRC_0: /* PLLI2S is the clock source for SAI*/ + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSI) + { + /* In Case the PLL Source is HSI (Internal Clock) */ + vcoinput = (HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* In Case the PLL Source is HSE (External Clock) */ + vcoinput = ((HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM))); + } + + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + /* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */ + tmpreg1 = (RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> 24U; + frequency = (vcoinput * ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U))/(tmpreg1); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ */ + tmpreg1 = ((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVQ) + 1U); + frequency = frequency/(tmpreg1); + break; + } + case RCC_DCKCFGR_SAI1SRC_1: /* PLLR is the clock source for SAI*/ + case RCC_DCKCFGR_SAI2SRC_1: /* PLLR is the clock source for SAI*/ + { + /* Configure the PLLI2S division factor */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSI) + { + /* In Case the PLL Source is HSI (Internal Clock) */ + vcoinput = (HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* In Case the PLL Source is HSE (External Clock) */ + vcoinput = ((HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM))); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + /* SAI_CLK_x = PLL_VCO Output/PLLR */ + tmpreg1 = (RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U; + frequency = (vcoinput * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U))/(tmpreg1); + break; + } + case RCC_DCKCFGR_SAI1SRC: /* External clock is the clock source for SAI*/ + { + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + case RCC_DCKCFGR_SAI2SRC: /* PLLSRC(HSE or HSI) is the clock source for SAI*/ + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSI) + { + /* In Case the PLL Source is HSI (Internal Clock) */ + frequency = (uint32_t)(HSI_VALUE); + } + else + { + /* In Case the PLL Source is HSE (External Clock) */ + frequency = (uint32_t)(HSE_VALUE); + } + break; + } + default : + { + break; + } + } + break; + } + case RCC_PERIPHCLK_I2S_APB1: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_APB1_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_PLLI2S: + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Check if I2S clock selection is PLL VCO Output divided by PLLR used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_PLLR: + { + /* Configure the PLL division factor R */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U) & (RCC_PLLCFGR_PLLN >> 6U))); + /* I2S_CLK = PLL_VCO Output/PLLR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U) & (RCC_PLLCFGR_PLLR >> 28U))); + break; + } + /* Check if I2S clock selection is HSI or HSE depending from PLL source Clock */ + case RCC_I2SAPB1CLKSOURCE_PLLSRC: + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + frequency = HSE_VALUE; + } + else + { + frequency = HSI_VALUE; + } + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + case RCC_PERIPHCLK_I2S_APB2: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_APB2_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_PLLI2S: + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Check if I2S clock selection is PLL VCO Output divided by PLLR used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_PLLR: + { + /* Configure the PLL division factor R */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U) & (RCC_PLLCFGR_PLLN >> 6U))); + /* I2S_CLK = PLL_VCO Output/PLLR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U) & (RCC_PLLCFGR_PLLR >> 28U))); + break; + } + /* Check if I2S clock selection is HSI or HSE depending from PLL source Clock */ + case RCC_I2SAPB2CLKSOURCE_PLLSRC: + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + frequency = HSE_VALUE; + } + else + { + frequency = HSI_VALUE; + } + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F446xx */ + +#if defined(STM32F469xx) || defined(STM32F479xx) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified + * parameters in the RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals + * clocks(I2S, SAI, LTDC, RTC and TIM). + * + * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select + * the RTC clock source; in this case the Backup domain will be reset in + * order to modify the RTC Clock source, as consequence RTC registers (including + * the backup registers) and RCC_BDCR register are set to their reset values. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; + uint32_t pllsaip = 0U; + uint32_t pllsaiq = 0U; + uint32_t pllsair = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*--------------------------- CLK48 Configuration --------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) + { + /* Check the parameters */ + assert_param(IS_RCC_CLK48CLKSOURCE(PeriphClkInit->Clk48ClockSelection)); + + /* Configure the CLK48 clock source */ + __HAL_RCC_CLK48_CONFIG(PeriphClkInit->Clk48ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------ SDIO Configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SDIO) == RCC_PERIPHCLK_SDIO) + { + /* Check the parameters */ + assert_param(IS_RCC_SDIOCLKSOURCE(PeriphClkInit->SdioClockSelection)); + + /* Configure the SDIO clock source */ + __HAL_RCC_SDIO_CONFIG(PeriphClkInit->SdioClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*----------------------- SAI/I2S Configuration (PLLI2S) -------------------*/ + /*------------------- Common configuration SAI/I2S -------------------------*/ + /* In Case of SAI or I2S Clock Configuration through PLLI2S, PLLI2SN division + factor is common parameters for both peripherals */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLI2S) == RCC_PERIPHCLK_SAI_PLLI2S) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SN_VALUE(PeriphClkInit->PLLI2S.PLLI2SN)); + + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /*---------------------- I2S configuration -------------------------------*/ + /* In Case of I2S Clock Configuration through PLLI2S, PLLI2SR must be added + only for I2S configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == (RCC_PERIPHCLK_I2S)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) x (PLLI2SN/PLLM) */ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SR); + } + + /*---------------------------- SAI configuration -------------------------*/ + /* In Case of SAI Clock Configuration through PLLI2S, PLLI2SQ and PLLI2S_DIVQ must + be added only for SAI configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLI2S) == (RCC_PERIPHCLK_SAI_PLLI2S)) + { + /* Check the PLLI2S division factors */ + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + assert_param(IS_RCC_PLLI2S_DIVQ_VALUE(PeriphClkInit->PLLI2SDivQ)); + + /* Read PLLI2SR value from PLLI2SCFGR register (this value is not need for SAI configuration) */ + tmpreg1 = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLM */ + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + /* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */ + __HAL_RCC_PLLI2S_SAICLK_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SQ , tmpreg1); + /* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ */ + __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLI2SDivQ); + } + + /*----------------- In Case of PLLI2S is just selected -----------------*/ + if((PeriphClkInit->PeriphClockSelection & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S) + { + /* Check for Parameters */ + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + + /* Configure the PLLI2S multiplication and division factors */ + __HAL_RCC_PLLI2S_SAICLK_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN, PeriphClkInit->PLLI2S.PLLI2SQ, PeriphClkInit->PLLI2S.PLLI2SR); + } + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------- SAI/LTDC Configuration (PLLSAI) ------------------*/ + /*----------------------- Common configuration SAI/LTDC --------------------*/ + /* In Case of SAI, LTDC or CLK48 Clock Configuration through PLLSAI, PLLSAIN division + factor is common parameters for these peripherals */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLSAI) == RCC_PERIPHCLK_SAI_PLLSAI) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) && + (PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLSAIP))) + { + /* Check the PLLSAI division factors */ + assert_param(IS_RCC_PLLSAIN_VALUE(PeriphClkInit->PLLSAI.PLLSAIN)); + + /* Disable PLLSAI Clock */ + __HAL_RCC_PLLSAI_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is disabled */ + while(__HAL_RCC_PLLSAI_GET_FLAG() != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /*---------------------------- SAI configuration -------------------------*/ + /* In Case of SAI Clock Configuration through PLLSAI, PLLSAIQ and PLLSAI_DIVQ must + be added only for SAI configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLSAI) == (RCC_PERIPHCLK_SAI_PLLSAI)) + { + assert_param(IS_RCC_PLLSAIQ_VALUE(PeriphClkInit->PLLSAI.PLLSAIQ)); + assert_param(IS_RCC_PLLSAI_DIVQ_VALUE(PeriphClkInit->PLLSAIDivQ)); + + /* Read PLLSAIP value from PLLSAICFGR register (this value is not needed for SAI configuration) */ + pllsaip = ((((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIP) >> RCC_PLLSAICFGR_PLLSAIP_Pos) + 1U) << 1U); + /* Read PLLSAIR value from PLLSAICFGR register (this value is not need for SAI configuration) */ + pllsair = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIR) >> RCC_PLLSAICFGR_PLLSAIR_Pos); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* SAI_CLK(first level) = PLLSAI_VCO Output/PLLSAIQ */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIN, pllsaip, PeriphClkInit->PLLSAI.PLLSAIQ, pllsair); + /* SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ */ + __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLSAIDivQ); + } + + /*---------------------------- LTDC configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LTDC) == (RCC_PERIPHCLK_LTDC)) + { + assert_param(IS_RCC_PLLSAIR_VALUE(PeriphClkInit->PLLSAI.PLLSAIR)); + assert_param(IS_RCC_PLLSAI_DIVR_VALUE(PeriphClkInit->PLLSAIDivR)); + + /* Read PLLSAIP value from PLLSAICFGR register (this value is not needed for SAI configuration) */ + pllsaip = ((((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIP) >> RCC_PLLSAICFGR_PLLSAIP_Pos) + 1U) << 1U); + /* Read PLLSAIQ value from PLLSAICFGR register (this value is not need for SAI configuration) */ + pllsaiq = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* LTDC_CLK(first level) = PLLSAI_VCO Output/PLLSAIR */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIN, pllsaip, pllsaiq, PeriphClkInit->PLLSAI.PLLSAIR); + /* LTDC_CLK = LTDC_CLK(first level)/PLLSAIDIVR */ + __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(PeriphClkInit->PLLSAIDivR); + } + + /*---------------------------- CLK48 configuration ------------------------*/ + /* Configure the PLLSAI when it is used as clock source for CLK48 */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == (RCC_PERIPHCLK_CLK48)) && + (PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLSAIP)) + { + assert_param(IS_RCC_PLLSAIP_VALUE(PeriphClkInit->PLLSAI.PLLSAIP)); + + /* Read PLLSAIQ value from PLLSAICFGR register (this value is not need for SAI configuration) */ + pllsaiq = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* Read PLLSAIR value from PLLSAICFGR register (this value is not need for SAI configuration) */ + pllsair = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIR) >> RCC_PLLSAICFGR_PLLSAIR_Pos); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* CLK48_CLK(first level) = PLLSAI_VCO Output/PLLSAIP */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIN, PeriphClkInit->PLLSAI.PLLSAIP, pllsaiq, pllsair); + } + + /* Enable PLLSAI Clock */ + __HAL_RCC_PLLSAI_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is ready */ + while(__HAL_RCC_PLLSAI_GET_FLAG() == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + + /*--------------------------------------------------------------------------*/ + + /*---------------------------- RTC configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- TIM configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } + return HAL_OK; +} + +/** + * @brief Configures the RCC_PeriphCLKInitTypeDef according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S | RCC_PERIPHCLK_SAI_PLLSAI |\ + RCC_PERIPHCLK_SAI_PLLI2S | RCC_PERIPHCLK_LTDC |\ + RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC |\ + RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO; + + /* Get the PLLI2S Clock configuration --------------------------------------*/ + PeriphClkInit->PLLI2S.PLLI2SN = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); + PeriphClkInit->PLLI2S.PLLI2SR = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + PeriphClkInit->PLLI2S.PLLI2SQ = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + /* Get the PLLSAI Clock configuration --------------------------------------*/ + PeriphClkInit->PLLSAI.PLLSAIN = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIN) >> RCC_PLLSAICFGR_PLLSAIN_Pos); + PeriphClkInit->PLLSAI.PLLSAIR = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIR) >> RCC_PLLSAICFGR_PLLSAIR_Pos); + PeriphClkInit->PLLSAI.PLLSAIQ = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* Get the PLLSAI/PLLI2S division factors ----------------------------------*/ + PeriphClkInit->PLLI2SDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVQ) >> RCC_DCKCFGR_PLLI2SDIVQ_Pos); + PeriphClkInit->PLLSAIDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVQ) >> RCC_DCKCFGR_PLLSAIDIVQ_Pos); + PeriphClkInit->PLLSAIDivR = (uint32_t)(RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVR); + /* Get the RTC Clock configuration -----------------------------------------*/ + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + + /* Get the CLK48 clock configuration -------------------------------------*/ + PeriphClkInit->Clk48ClockSelection = __HAL_RCC_GET_CLK48_SOURCE(); + + /* Get the SDIO clock configuration ----------------------------------------*/ + PeriphClkInit->SdioClockSelection = __HAL_RCC_GET_SDIO_SOURCE(); + + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } +} + +/** + * @brief Return the peripheral clock frequency for a given peripheral(SAI..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_I2S: I2S peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + /* This variable used to store the I2S clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_I2S: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SCLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SCLKSOURCE_PLLI2S: + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F469xx || STM32F479xx */ + +#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified + * parameters in the RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals + * clocks(I2S, LTDC RTC and TIM). + * + * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select + * the RTC clock source; in this case the Backup domain will be reset in + * order to modify the RTC Clock source, as consequence RTC registers (including + * the backup registers) and RCC_BDCR register are set to their reset values. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; +#if defined(STM32F413xx) || defined(STM32F423xx) + uint32_t plli2sq = 0U; +#endif /* STM32F413xx || STM32F423xx */ + uint32_t plli2sused = 0U; + + /* Check the peripheral clock selection parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*----------------------------------- I2S APB1 configuration ---------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB1) == (RCC_PERIPHCLK_I2S_APB1)) + { + /* Check the parameters */ + assert_param(IS_RCC_I2SAPB1CLKSOURCE(PeriphClkInit->I2sApb1ClockSelection)); + + /* Configure I2S Clock source */ + __HAL_RCC_I2S_APB1_CONFIG(PeriphClkInit->I2sApb1ClockSelection); + /* Enable the PLLI2S when it's used as clock source for I2S */ + if(PeriphClkInit->I2sApb1ClockSelection == RCC_I2SAPB1CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------------------- I2S APB2 configuration ---------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB2) == (RCC_PERIPHCLK_I2S_APB2)) + { + /* Check the parameters */ + assert_param(IS_RCC_I2SAPB2CLKSOURCE(PeriphClkInit->I2sApb2ClockSelection)); + + /* Configure I2S Clock source */ + __HAL_RCC_I2S_APB2_CONFIG(PeriphClkInit->I2sApb2ClockSelection); + /* Enable the PLLI2S when it's used as clock source for I2S */ + if(PeriphClkInit->I2sApb2ClockSelection == RCC_I2SAPB2CLKSOURCE_PLLI2S) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + +#if defined(STM32F413xx) || defined(STM32F423xx) + /*----------------------- SAI1 Block A configuration -----------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAIA) == (RCC_PERIPHCLK_SAIA)) + { + /* Check the parameters */ + assert_param(IS_RCC_SAIACLKSOURCE(PeriphClkInit->SaiAClockSelection)); + + /* Configure SAI1 Clock source */ + __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(PeriphClkInit->SaiAClockSelection); + /* Enable the PLLI2S when it's used as clock source for SAI */ + if(PeriphClkInit->SaiAClockSelection == RCC_SAIACLKSOURCE_PLLI2SR) + { + plli2sused = 1U; + } + /* Enable the PLLSAI when it's used as clock source for SAI */ + if(PeriphClkInit->SaiAClockSelection == RCC_SAIACLKSOURCE_PLLR) + { + /* Check for PLL/DIVR parameters */ + assert_param(IS_RCC_PLL_DIVR_VALUE(PeriphClkInit->PLLDivR)); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLDIVR */ + __HAL_RCC_PLL_PLLSAICLKDIVR_CONFIG(PeriphClkInit->PLLDivR); + } + } + /*--------------------------------------------------------------------------*/ + + /*---------------------- SAI1 Block B configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAIB) == (RCC_PERIPHCLK_SAIB)) + { + /* Check the parameters */ + assert_param(IS_RCC_SAIBCLKSOURCE(PeriphClkInit->SaiBClockSelection)); + + /* Configure SAI1 Clock source */ + __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(PeriphClkInit->SaiBClockSelection); + /* Enable the PLLI2S when it's used as clock source for SAI */ + if(PeriphClkInit->SaiBClockSelection == RCC_SAIBCLKSOURCE_PLLI2SR) + { + plli2sused = 1U; + } + /* Enable the PLLSAI when it's used as clock source for SAI */ + if(PeriphClkInit->SaiBClockSelection == RCC_SAIBCLKSOURCE_PLLR) + { + /* Check for PLL/DIVR parameters */ + assert_param(IS_RCC_PLL_DIVR_VALUE(PeriphClkInit->PLLDivR)); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLDIVR */ + __HAL_RCC_PLL_PLLSAICLKDIVR_CONFIG(PeriphClkInit->PLLDivR); + } + } + /*--------------------------------------------------------------------------*/ +#endif /* STM32F413xx || STM32F423xx */ + + /*------------------------------------ RTC configuration -------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------------ TIM configuration -------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + /* Configure Timer Prescaler */ + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------------- FMPI2C1 Configuration --------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_FMPI2C1) == RCC_PERIPHCLK_FMPI2C1) + { + /* Check the parameters */ + assert_param(IS_RCC_FMPI2C1CLKSOURCE(PeriphClkInit->Fmpi2c1ClockSelection)); + + /* Configure the FMPI2C1 clock source */ + __HAL_RCC_FMPI2C1_CONFIG(PeriphClkInit->Fmpi2c1ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------------- CLK48 Configuration ----------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) + { + /* Check the parameters */ + assert_param(IS_RCC_CLK48CLKSOURCE(PeriphClkInit->Clk48ClockSelection)); + + /* Configure the SDIO clock source */ + __HAL_RCC_CLK48_CONFIG(PeriphClkInit->Clk48ClockSelection); + + /* Enable the PLLI2S when it's used as clock source for CLK48 */ + if(PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLI2SQ) + { + plli2sused = 1U; + } + } + /*--------------------------------------------------------------------------*/ + + /*------------------------------------- SDIO Configuration -----------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SDIO) == RCC_PERIPHCLK_SDIO) + { + /* Check the parameters */ + assert_param(IS_RCC_SDIOCLKSOURCE(PeriphClkInit->SdioClockSelection)); + + /* Configure the SDIO clock source */ + __HAL_RCC_SDIO_CONFIG(PeriphClkInit->SdioClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*-------------------------------------- PLLI2S Configuration --------------*/ + /* PLLI2S is configured when a peripheral will use it as source clock : I2S on APB1 or + I2S on APB2*/ + if((plli2sused == 1U) || (PeriphClkInit->PeriphClockSelection == RCC_PERIPHCLK_PLLI2S)) + { + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /* check for common PLLI2S Parameters */ + assert_param(IS_RCC_PLLI2SCLKSOURCE(PeriphClkInit->PLLI2SSelection)); + assert_param(IS_RCC_PLLI2SM_VALUE(PeriphClkInit->PLLI2S.PLLI2SM)); + assert_param(IS_RCC_PLLI2SN_VALUE(PeriphClkInit->PLLI2S.PLLI2SN)); + /*-------------------- Set the PLL I2S clock -----------------------------*/ + __HAL_RCC_PLL_I2S_CONFIG(PeriphClkInit->PLLI2SSelection); + + /*------- In Case of PLLI2S is selected as source clock for I2S ----------*/ + if(((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB1) == RCC_PERIPHCLK_I2S_APB1) && (PeriphClkInit->I2sApb1ClockSelection == RCC_I2SAPB1CLKSOURCE_PLLI2S)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S_APB2) == RCC_PERIPHCLK_I2S_APB2) && (PeriphClkInit->I2sApb2ClockSelection == RCC_I2SAPB2CLKSOURCE_PLLI2S)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) && (PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLI2SQ)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SDIO) == RCC_PERIPHCLK_SDIO) && (PeriphClkInit->SdioClockSelection == RCC_SDIOCLKSOURCE_CLK48) && (PeriphClkInit->Clk48ClockSelection == RCC_CLK48CLKSOURCE_PLLI2SQ))) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM)*/ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SQ, PeriphClkInit->PLLI2S.PLLI2SR); + } + +#if defined(STM32F413xx) || defined(STM32F423xx) + /*------- In Case of PLLI2S is selected as source clock for SAI ----------*/ + if(((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAIA) == RCC_PERIPHCLK_SAIA) && (PeriphClkInit->SaiAClockSelection == RCC_SAIACLKSOURCE_PLLI2SR)) || + ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAIB) == RCC_PERIPHCLK_SAIB) && (PeriphClkInit->SaiBClockSelection == RCC_SAIBCLKSOURCE_PLLI2SR))) + { + /* Check for PLLI2S Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + /* Check for PLLI2S/DIVR parameters */ + assert_param(IS_RCC_PLLI2S_DIVR_VALUE(PeriphClkInit->PLLI2SDivR)); + + /* Read PLLI2SQ value from PLLI2SCFGR register (this value is not needed for SAI configuration) */ + plli2sq = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + /* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN, plli2sq, PeriphClkInit->PLLI2S.PLLI2SR); + + /* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVR */ + __HAL_RCC_PLLI2S_PLLSAICLKDIVR_CONFIG(PeriphClkInit->PLLI2SDivR); + } +#endif /* STM32F413xx || STM32F423xx */ + + /*----------------- In Case of PLLI2S is just selected ------------------*/ + if((PeriphClkInit->PeriphClockSelection & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S) + { + /* Check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM)*/ + /* SPDIFRXCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SP */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SQ, PeriphClkInit->PLLI2S.PLLI2SR); + } + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + /*--------------------------------------------------------------------------*/ + + /*-------------------- DFSDM1 clock source configuration -------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) + { + /* Check the parameters */ + assert_param(IS_RCC_DFSDM1CLKSOURCE(PeriphClkInit->Dfsdm1ClockSelection)); + + /* Configure the DFSDM1 interface clock source */ + __HAL_RCC_DFSDM1_CONFIG(PeriphClkInit->Dfsdm1ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*-------------------- DFSDM1 Audio clock source configuration -------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_DFSDM1_AUDIO) == RCC_PERIPHCLK_DFSDM1_AUDIO) + { + /* Check the parameters */ + assert_param(IS_RCC_DFSDM1AUDIOCLKSOURCE(PeriphClkInit->Dfsdm1AudioClockSelection)); + + /* Configure the DFSDM1 Audio interface clock source */ + __HAL_RCC_DFSDM1AUDIO_CONFIG(PeriphClkInit->Dfsdm1AudioClockSelection); + } + /*--------------------------------------------------------------------------*/ + +#if defined(STM32F413xx) || defined(STM32F423xx) + /*-------------------- DFSDM2 clock source configuration -------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_DFSDM2) == RCC_PERIPHCLK_DFSDM2) + { + /* Check the parameters */ + assert_param(IS_RCC_DFSDM2CLKSOURCE(PeriphClkInit->Dfsdm2ClockSelection)); + + /* Configure the DFSDM1 interface clock source */ + __HAL_RCC_DFSDM2_CONFIG(PeriphClkInit->Dfsdm2ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*-------------------- DFSDM2 Audio clock source configuration -------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_DFSDM2_AUDIO) == RCC_PERIPHCLK_DFSDM2_AUDIO) + { + /* Check the parameters */ + assert_param(IS_RCC_DFSDM2AUDIOCLKSOURCE(PeriphClkInit->Dfsdm2AudioClockSelection)); + + /* Configure the DFSDM1 Audio interface clock source */ + __HAL_RCC_DFSDM2AUDIO_CONFIG(PeriphClkInit->Dfsdm2AudioClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- LPTIM1 Configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) + { + /* Check the parameters */ + assert_param(IS_RCC_LPTIM1CLKSOURCE(PeriphClkInit->Lptim1ClockSelection)); + + /* Configure the LPTIM1 clock source */ + __HAL_RCC_LPTIM1_CONFIG(PeriphClkInit->Lptim1ClockSelection); + } + /*--------------------------------------------------------------------------*/ +#endif /* STM32F413xx || STM32F423xx */ + + return HAL_OK; +} + +/** + * @brief Get the RCC_PeriphCLKInitTypeDef according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ +#if defined(STM32F413xx) || defined(STM32F423xx) + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S_APB1 | RCC_PERIPHCLK_I2S_APB2 |\ + RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC |\ + RCC_PERIPHCLK_FMPI2C1 | RCC_PERIPHCLK_CLK48 |\ + RCC_PERIPHCLK_SDIO | RCC_PERIPHCLK_DFSDM1 |\ + RCC_PERIPHCLK_DFSDM1_AUDIO | RCC_PERIPHCLK_DFSDM2 |\ + RCC_PERIPHCLK_DFSDM2_AUDIO | RCC_PERIPHCLK_LPTIM1 |\ + RCC_PERIPHCLK_SAIA | RCC_PERIPHCLK_SAIB; +#else /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S_APB1 | RCC_PERIPHCLK_I2S_APB2 |\ + RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC |\ + RCC_PERIPHCLK_FMPI2C1 | RCC_PERIPHCLK_CLK48 |\ + RCC_PERIPHCLK_SDIO | RCC_PERIPHCLK_DFSDM1 |\ + RCC_PERIPHCLK_DFSDM1_AUDIO; +#endif /* STM32F413xx || STM32F423xx */ + + + + /* Get the PLLI2S Clock configuration --------------------------------------*/ + PeriphClkInit->PLLI2S.PLLI2SM = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM) >> RCC_PLLI2SCFGR_PLLI2SM_Pos); + PeriphClkInit->PLLI2S.PLLI2SN = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); + PeriphClkInit->PLLI2S.PLLI2SQ = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + PeriphClkInit->PLLI2S.PLLI2SR = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); +#if defined(STM32F413xx) || defined(STM32F423xx) + /* Get the PLL/PLLI2S division factors -------------------------------------*/ + PeriphClkInit->PLLI2SDivR = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVR) >> RCC_DCKCFGR_PLLI2SDIVR_Pos); + PeriphClkInit->PLLDivR = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLDIVR) >> RCC_DCKCFGR_PLLDIVR_Pos); +#endif /* STM32F413xx || STM32F423xx */ + + /* Get the I2S APB1 clock configuration ------------------------------------*/ + PeriphClkInit->I2sApb1ClockSelection = __HAL_RCC_GET_I2S_APB1_SOURCE(); + + /* Get the I2S APB2 clock configuration ------------------------------------*/ + PeriphClkInit->I2sApb2ClockSelection = __HAL_RCC_GET_I2S_APB2_SOURCE(); + + /* Get the RTC Clock configuration -----------------------------------------*/ + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + + /* Get the FMPI2C1 clock configuration -------------------------------------*/ + PeriphClkInit->Fmpi2c1ClockSelection = __HAL_RCC_GET_FMPI2C1_SOURCE(); + + /* Get the CLK48 clock configuration ---------------------------------------*/ + PeriphClkInit->Clk48ClockSelection = __HAL_RCC_GET_CLK48_SOURCE(); + + /* Get the SDIO clock configuration ----------------------------------------*/ + PeriphClkInit->SdioClockSelection = __HAL_RCC_GET_SDIO_SOURCE(); + + /* Get the DFSDM1 clock configuration --------------------------------------*/ + PeriphClkInit->Dfsdm1ClockSelection = __HAL_RCC_GET_DFSDM1_SOURCE(); + + /* Get the DFSDM1 Audio clock configuration --------------------------------*/ + PeriphClkInit->Dfsdm1AudioClockSelection = __HAL_RCC_GET_DFSDM1AUDIO_SOURCE(); + +#if defined(STM32F413xx) || defined(STM32F423xx) + /* Get the DFSDM2 clock configuration --------------------------------------*/ + PeriphClkInit->Dfsdm2ClockSelection = __HAL_RCC_GET_DFSDM2_SOURCE(); + + /* Get the DFSDM2 Audio clock configuration --------------------------------*/ + PeriphClkInit->Dfsdm2AudioClockSelection = __HAL_RCC_GET_DFSDM2AUDIO_SOURCE(); + + /* Get the LPTIM1 clock configuration --------------------------------------*/ + PeriphClkInit->Lptim1ClockSelection = __HAL_RCC_GET_LPTIM1_SOURCE(); + + /* Get the SAI1 Block Aclock configuration ---------------------------------*/ + PeriphClkInit->SaiAClockSelection = __HAL_RCC_GET_SAI_BLOCKA_SOURCE(); + + /* Get the SAI1 Block B clock configuration --------------------------------*/ + PeriphClkInit->SaiBClockSelection = __HAL_RCC_GET_SAI_BLOCKB_SOURCE(); +#endif /* STM32F413xx || STM32F423xx */ + + /* Get the TIM Prescaler configuration -------------------------------------*/ + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } +} + +/** + * @brief Return the peripheral clock frequency for a given peripheral(I2S..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_I2S_APB1: I2S APB1 peripheral clock + * @arg RCC_PERIPHCLK_I2S_APB2: I2S APB2 peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + /* This variable used to store the I2S clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_I2S_APB1: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_APB1_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_PLLI2S: + { + if((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SSRC) == RCC_PLLI2SCFGR_PLLI2SSRC) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(EXTERNAL_CLOCK_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + } + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Check if I2S clock selection is PLL VCO Output divided by PLLR used as I2S clock */ + case RCC_I2SAPB1CLKSOURCE_PLLR: + { + /* Configure the PLL division factor R */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U) & (RCC_PLLCFGR_PLLN >> 6U))); + /* I2S_CLK = PLL_VCO Output/PLLR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U) & (RCC_PLLCFGR_PLLR >> 28U))); + break; + } + /* Check if I2S clock selection is HSI or HSE depending from PLL source Clock */ + case RCC_I2SAPB1CLKSOURCE_PLLSRC: + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + frequency = HSE_VALUE; + } + else + { + frequency = HSI_VALUE; + } + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + case RCC_PERIPHCLK_I2S_APB2: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_APB2_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_PLLI2S: + { + if((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SSRC) == RCC_PLLI2SCFGR_PLLI2SSRC) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(EXTERNAL_CLOCK_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + } + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Check if I2S clock selection is PLL VCO Output divided by PLLR used as I2S clock */ + case RCC_I2SAPB2CLKSOURCE_PLLR: + { + /* Configure the PLL division factor R */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U) & (RCC_PLLCFGR_PLLN >> 6U))); + /* I2S_CLK = PLL_VCO Output/PLLR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U) & (RCC_PLLCFGR_PLLR >> 28U))); + break; + } + /* Check if I2S clock selection is HSI or HSE depending from PLL source Clock */ + case RCC_I2SAPB2CLKSOURCE_PLLSRC: + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + frequency = HSE_VALUE; + } + else + { + frequency = HSI_VALUE; + } + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified parameters in the + * RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals clocks(I2S and RTC clocks). + * + * @note A caution to be taken when HAL_RCCEx_PeriphCLKConfig() is used to select RTC clock selection, in this case + * the Reset of Backup domain will be applied in order to modify the RTC Clock source as consequence all backup + * domain (RTC and RCC_BDCR register expect BKPSRAM) will be reset + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*---------------------------- RTC configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- TIM configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- FMPI2C1 Configuration -----------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_FMPI2C1) == RCC_PERIPHCLK_FMPI2C1) + { + /* Check the parameters */ + assert_param(IS_RCC_FMPI2C1CLKSOURCE(PeriphClkInit->Fmpi2c1ClockSelection)); + + /* Configure the FMPI2C1 clock source */ + __HAL_RCC_FMPI2C1_CONFIG(PeriphClkInit->Fmpi2c1ClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- LPTIM1 Configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) + { + /* Check the parameters */ + assert_param(IS_RCC_LPTIM1CLKSOURCE(PeriphClkInit->Lptim1ClockSelection)); + + /* Configure the LPTIM1 clock source */ + __HAL_RCC_LPTIM1_CONFIG(PeriphClkInit->Lptim1ClockSelection); + } + + /*---------------------------- I2S Configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) + { + /* Check the parameters */ + assert_param(IS_RCC_I2SAPBCLKSOURCE(PeriphClkInit->I2SClockSelection)); + + /* Configure the I2S clock source */ + __HAL_RCC_I2S_CONFIG(PeriphClkInit->I2SClockSelection); + } + + return HAL_OK; +} + +/** + * @brief Configures the RCC_OscInitStruct according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_FMPI2C1 | RCC_PERIPHCLK_LPTIM1 | RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC; + + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } + /* Get the FMPI2C1 clock configuration -------------------------------------*/ + PeriphClkInit->Fmpi2c1ClockSelection = __HAL_RCC_GET_FMPI2C1_SOURCE(); + + /* Get the I2S clock configuration -----------------------------------------*/ + PeriphClkInit->I2SClockSelection = __HAL_RCC_GET_I2S_SOURCE(); + + +} +/** + * @brief Return the peripheral clock frequency for a given peripheral(SAI..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_I2S: I2S peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + /* This variable used to store the I2S clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_I2S: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SAPBCLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLL VCO Output divided by PLLR used as I2S clock */ + case RCC_I2SAPBCLKSOURCE_PLLR: + { + /* Configure the PLL division factor R */ + /* PLL_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLL_VCO Output = PLL_VCO Input * PLLN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6U) & (RCC_PLLCFGR_PLLN >> 6U))); + /* I2S_CLK = PLL_VCO Output/PLLR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> 28U) & (RCC_PLLCFGR_PLLR >> 28U))); + break; + } + /* Check if I2S clock selection is HSI or HSE depending from PLL source Clock */ + case RCC_I2SAPBCLKSOURCE_PLLSRC: + { + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + frequency = HSE_VALUE; + } + else + { + frequency = HSI_VALUE; + } + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified + * parameters in the RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals + * clocks(I2S, SAI, LTDC RTC and TIM). + * + * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select + * the RTC clock source; in this case the Backup domain will be reset in + * order to modify the RTC Clock source, as consequence RTC registers (including + * the backup registers) and RCC_BDCR register are set to their reset values. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*----------------------- SAI/I2S Configuration (PLLI2S) -------------------*/ + /*----------------------- Common configuration SAI/I2S ---------------------*/ + /* In Case of SAI or I2S Clock Configuration through PLLI2S, PLLI2SN division + factor is common parameters for both peripherals */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLI2S) == RCC_PERIPHCLK_SAI_PLLI2S) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SN_VALUE(PeriphClkInit->PLLI2S.PLLI2SN)); + + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /*---------------------------- I2S configuration -------------------------*/ + /* In Case of I2S Clock Configuration through PLLI2S, PLLI2SR must be added + only for I2S configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == (RCC_PERIPHCLK_I2S)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLM) */ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SR); + } + + /*---------------------------- SAI configuration -------------------------*/ + /* In Case of SAI Clock Configuration through PLLI2S, PLLI2SQ and PLLI2S_DIVQ must + be added only for SAI configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLI2S) == (RCC_PERIPHCLK_SAI_PLLI2S)) + { + /* Check the PLLI2S division factors */ + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + assert_param(IS_RCC_PLLI2S_DIVQ_VALUE(PeriphClkInit->PLLI2SDivQ)); + + /* Read PLLI2SR value from PLLI2SCFGR register (this value is not need for SAI configuration) */ + tmpreg1 = ((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLM */ + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + /* SAI_CLK(first level) = PLLI2S_VCO Output/PLLI2SQ */ + __HAL_RCC_PLLI2S_SAICLK_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SQ , tmpreg1); + /* SAI_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ */ + __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLI2SDivQ); + } + + /*----------------- In Case of PLLI2S is just selected -----------------*/ + if((PeriphClkInit->PeriphClockSelection & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S) + { + /* Check for Parameters */ + assert_param(IS_RCC_PLLI2SQ_VALUE(PeriphClkInit->PLLI2S.PLLI2SQ)); + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + + /* Configure the PLLI2S multiplication and division factors */ + __HAL_RCC_PLLI2S_SAICLK_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN, PeriphClkInit->PLLI2S.PLLI2SQ, PeriphClkInit->PLLI2S.PLLI2SR); + } + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + /*--------------------------------------------------------------------------*/ + + /*----------------------- SAI/LTDC Configuration (PLLSAI) ------------------*/ + /*----------------------- Common configuration SAI/LTDC --------------------*/ + /* In Case of SAI or LTDC Clock Configuration through PLLSAI, PLLSAIN division + factor is common parameters for both peripherals */ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLSAI) == RCC_PERIPHCLK_SAI_PLLSAI) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC)) + { + /* Check the PLLSAI division factors */ + assert_param(IS_RCC_PLLSAIN_VALUE(PeriphClkInit->PLLSAI.PLLSAIN)); + + /* Disable PLLSAI Clock */ + __HAL_RCC_PLLSAI_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is disabled */ + while(__HAL_RCC_PLLSAI_GET_FLAG() != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /*---------------------------- SAI configuration -------------------------*/ + /* In Case of SAI Clock Configuration through PLLSAI, PLLSAIQ and PLLSAI_DIVQ must + be added only for SAI configuration */ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SAI_PLLSAI) == (RCC_PERIPHCLK_SAI_PLLSAI)) + { + assert_param(IS_RCC_PLLSAIQ_VALUE(PeriphClkInit->PLLSAI.PLLSAIQ)); + assert_param(IS_RCC_PLLSAI_DIVQ_VALUE(PeriphClkInit->PLLSAIDivQ)); + + /* Read PLLSAIR value from PLLSAICFGR register (this value is not need for SAI configuration) */ + tmpreg1 = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIR) >> RCC_PLLSAICFGR_PLLSAIR_Pos); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* SAI_CLK(first level) = PLLSAI_VCO Output/PLLSAIQ */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIN , PeriphClkInit->PLLSAI.PLLSAIQ, tmpreg1); + /* SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ */ + __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(PeriphClkInit->PLLSAIDivQ); + } + + /*---------------------------- LTDC configuration ------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_LTDC) == (RCC_PERIPHCLK_LTDC)) + { + assert_param(IS_RCC_PLLSAIR_VALUE(PeriphClkInit->PLLSAI.PLLSAIR)); + assert_param(IS_RCC_PLLSAI_DIVR_VALUE(PeriphClkInit->PLLSAIDivR)); + + /* Read PLLSAIR value from PLLSAICFGR register (this value is not need for SAI configuration) */ + tmpreg1 = ((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* PLLSAI_VCO Input = PLL_SOURCE/PLLM */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN */ + /* LTDC_CLK(first level) = PLLSAI_VCO Output/PLLSAIR */ + __HAL_RCC_PLLSAI_CONFIG(PeriphClkInit->PLLSAI.PLLSAIN , tmpreg1, PeriphClkInit->PLLSAI.PLLSAIR); + /* LTDC_CLK = LTDC_CLK(first level)/PLLSAIDIVR */ + __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(PeriphClkInit->PLLSAIDivR); + } + /* Enable PLLSAI Clock */ + __HAL_RCC_PLLSAI_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLSAI is ready */ + while(__HAL_RCC_PLLSAI_GET_FLAG() == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- RTC configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } + /*--------------------------------------------------------------------------*/ + + /*---------------------------- TIM configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } + return HAL_OK; +} + +/** + * @brief Configures the PeriphClkInit according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S | RCC_PERIPHCLK_SAI_PLLSAI | RCC_PERIPHCLK_SAI_PLLI2S | RCC_PERIPHCLK_LTDC | RCC_PERIPHCLK_TIM | RCC_PERIPHCLK_RTC; + + /* Get the PLLI2S Clock configuration -----------------------------------------------*/ + PeriphClkInit->PLLI2S.PLLI2SN = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); + PeriphClkInit->PLLI2S.PLLI2SR = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); + PeriphClkInit->PLLI2S.PLLI2SQ = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SQ) >> RCC_PLLI2SCFGR_PLLI2SQ_Pos); + /* Get the PLLSAI Clock configuration -----------------------------------------------*/ + PeriphClkInit->PLLSAI.PLLSAIN = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIN) >> RCC_PLLSAICFGR_PLLSAIN_Pos); + PeriphClkInit->PLLSAI.PLLSAIR = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIR) >> RCC_PLLSAICFGR_PLLSAIR_Pos); + PeriphClkInit->PLLSAI.PLLSAIQ = (uint32_t)((RCC->PLLSAICFGR & RCC_PLLSAICFGR_PLLSAIQ) >> RCC_PLLSAICFGR_PLLSAIQ_Pos); + /* Get the PLLSAI/PLLI2S division factors -----------------------------------------------*/ + PeriphClkInit->PLLI2SDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLI2SDIVQ) >> RCC_DCKCFGR_PLLI2SDIVQ_Pos); + PeriphClkInit->PLLSAIDivQ = (uint32_t)((RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVQ) >> RCC_DCKCFGR_PLLSAIDIVQ_Pos); + PeriphClkInit->PLLSAIDivR = (uint32_t)(RCC->DCKCFGR & RCC_DCKCFGR_PLLSAIDIVR); + /* Get the RTC Clock configuration -----------------------------------------------*/ + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } +} + +/** + * @brief Return the peripheral clock frequency for a given peripheral(SAI..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_I2S: I2S peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + /* This variable used to store the I2S clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_I2S: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SCLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SCLKSOURCE_PLLI2S: + { + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) ||\ + defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified parameters in the + * RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals clocks(I2S and RTC clocks). + * + * @note A caution to be taken when HAL_RCCEx_PeriphCLKConfig() is used to select RTC clock selection, in this case + * the Reset of Backup domain will be applied in order to modify the RTC Clock source as consequence all backup + * domain (RTC and RCC_BDCR register expect BKPSRAM) will be reset + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U; + uint32_t tmpreg1 = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*---------------------------- I2S configuration ---------------------------*/ + if((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || + (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S)) + { + /* check for Parameters */ + assert_param(IS_RCC_PLLI2SR_VALUE(PeriphClkInit->PLLI2S.PLLI2SR)); + assert_param(IS_RCC_PLLI2SN_VALUE(PeriphClkInit->PLLI2S.PLLI2SN)); +#if defined(STM32F411xE) + assert_param(IS_RCC_PLLI2SM_VALUE(PeriphClkInit->PLLI2S.PLLI2SM)); +#endif /* STM32F411xE */ + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + +#if defined(STM32F411xE) + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_I2SCLK_CONFIG(PeriphClkInit->PLLI2S.PLLI2SM, PeriphClkInit->PLLI2S.PLLI2SN, PeriphClkInit->PLLI2S.PLLI2SR); +#else + /* Configure the PLLI2S division factors */ + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLM) */ + /* I2SCLK = f(PLLI2S clock output) = f(VCO clock) / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SN , PeriphClkInit->PLLI2S.PLLI2SR); +#endif /* STM32F411xE */ + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + /* Get tick */ + tickstart = HAL_GetTick(); + /* Wait till PLLI2S is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + } + + /*---------------------------- RTC configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) + { + /* Check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* Enable Power Clock*/ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Enable write access to Backup domain */ + PWR->CR |= PWR_CR_DBP; + + /* Get tick */ + tickstart = HAL_GetTick(); + + while((PWR->CR & PWR_CR_DBP) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + tmpreg1 = (RCC->BDCR & RCC_BDCR_RTCSEL); + if((tmpreg1 != 0x00000000U) && ((tmpreg1) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + tmpreg1 = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = tmpreg1; + + /* Wait for LSE reactivation if LSE was enable prior to Backup Domain reset */ + if(HAL_IS_BIT_SET(RCC->BDCR, RCC_BDCR_LSEON)) + { + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + } +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) + /*---------------------------- TIM configuration ---------------------------*/ + if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM) == (RCC_PERIPHCLK_TIM)) + { + __HAL_RCC_TIMCLKPRESCALER(PeriphClkInit->TIMPresSelection); + } +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ + return HAL_OK; +} + +/** + * @brief Configures the RCC_OscInitStruct according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tempreg; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_I2S | RCC_PERIPHCLK_RTC; + + /* Get the PLLI2S Clock configuration --------------------------------------*/ + PeriphClkInit->PLLI2S.PLLI2SN = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> RCC_PLLI2SCFGR_PLLI2SN_Pos); + PeriphClkInit->PLLI2S.PLLI2SR = (uint32_t)((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> RCC_PLLI2SCFGR_PLLI2SR_Pos); +#if defined(STM32F411xE) + PeriphClkInit->PLLI2S.PLLI2SM = (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM); +#endif /* STM32F411xE */ + /* Get the RTC Clock configuration -----------------------------------------*/ + tempreg = (RCC->CFGR & RCC_CFGR_RTCPRE); + PeriphClkInit->RTCClockSelection = (uint32_t)((tempreg) | (RCC->BDCR & RCC_BDCR_RTCSEL)); + +#if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) + /* Get the TIM Prescaler configuration -------------------------------------*/ + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RESET) + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_DESACTIVATED; + } + else + { + PeriphClkInit->TIMPresSelection = RCC_TIMPRES_ACTIVATED; + } +#endif /* STM32F401xC || STM32F401xE || STM32F411xE */ +} + +/** + * @brief Return the peripheral clock frequency for a given peripheral(SAI..) + * @note Return 0 if peripheral clock identifier not managed by this API + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg RCC_PERIPHCLK_I2S: I2S peripheral clock + * @retval Frequency in KHz + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ + /* This variable used to store the I2S clock frequency (value in Hz) */ + uint32_t frequency = 0U; + /* This variable used to store the VCO Input (value in Hz) */ + uint32_t vcoinput = 0U; + uint32_t srcclk = 0U; + /* This variable used to store the VCO Output (value in Hz) */ + uint32_t vcooutput = 0U; + switch (PeriphClk) + { + case RCC_PERIPHCLK_I2S: + { + /* Get the current I2S source */ + srcclk = __HAL_RCC_GET_I2S_SOURCE(); + switch (srcclk) + { + /* Check if I2S clock selection is External clock mapped on the I2S_CKIN pin used as I2S clock */ + case RCC_I2SCLKSOURCE_EXT: + { + /* Set the I2S clock to the external clock value */ + frequency = EXTERNAL_CLOCK_VALUE; + break; + } + /* Check if I2S clock selection is PLLI2S VCO output clock divided by PLLI2SR used as I2S clock */ + case RCC_I2SCLKSOURCE_PLLI2S: + { +#if defined(STM32F411xE) + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLI2SM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SM)); + } +#else + /* Configure the PLLI2S division factor */ + /* PLLI2S_VCO Input = PLL_SOURCE/PLLM */ + if((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLSOURCE_HSE) + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSE_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } + else + { + /* Get the I2S source clock value */ + vcoinput = (uint32_t)(HSI_VALUE / (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM)); + } +#endif /* STM32F411xE */ + /* PLLI2S_VCO Output = PLLI2S_VCO Input * PLLI2SN */ + vcooutput = (uint32_t)(vcoinput * (((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SN) >> 6U) & (RCC_PLLI2SCFGR_PLLI2SN >> 6U))); + /* I2S_CLK = PLLI2S_VCO Output/PLLI2SR */ + frequency = (uint32_t)(vcooutput /(((RCC->PLLI2SCFGR & RCC_PLLI2SCFGR_PLLI2SR) >> 28U) & (RCC_PLLI2SCFGR_PLLI2SR >> 28U))); + break; + } + /* Clock not enabled for I2S*/ + default: + { + frequency = 0U; + break; + } + } + break; + } + } + return frequency; +} +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */ + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Select LSE mode + * + * @note This mode is only available for STM32F410xx/STM32F411xx/STM32F446xx/STM32F469xx/STM32F479xx/STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx devices. + * + * @param Mode specifies the LSE mode. + * This parameter can be one of the following values: + * @arg RCC_LSE_LOWPOWER_MODE: LSE oscillator in low power mode selection + * @arg RCC_LSE_HIGHDRIVE_MODE: LSE oscillator in High Drive mode selection + * @retval None + */ +void HAL_RCCEx_SelectLSEMode(uint8_t Mode) +{ + /* Check the parameters */ + assert_param(IS_RCC_LSE_MODE(Mode)); + if(Mode == RCC_LSE_HIGHDRIVE_MODE) + { + SET_BIT(RCC->BDCR, RCC_BDCR_LSEMOD); + } + else + { + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEMOD); + } +} + +#endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +/** @defgroup RCCEx_Exported_Functions_Group2 Extended Clock management functions + * @brief Extended Clock management functions + * +@verbatim + =============================================================================== + ##### Extended clock management functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the + activation or deactivation of PLLI2S, PLLSAI. +@endverbatim + * @{ + */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Enable PLLI2S. + * @param PLLI2SInit pointer to an RCC_PLLI2SInitTypeDef structure that + * contains the configuration information for the PLLI2S + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit) +{ + uint32_t tickstart; + + /* Check for parameters */ + assert_param(IS_RCC_PLLI2SN_VALUE(PLLI2SInit->PLLI2SN)); + assert_param(IS_RCC_PLLI2SR_VALUE(PLLI2SInit->PLLI2SR)); +#if defined(RCC_PLLI2SCFGR_PLLI2SM) + assert_param(IS_RCC_PLLI2SM_VALUE(PLLI2SInit->PLLI2SM)); +#endif /* RCC_PLLI2SCFGR_PLLI2SM */ +#if defined(RCC_PLLI2SCFGR_PLLI2SP) + assert_param(IS_RCC_PLLI2SP_VALUE(PLLI2SInit->PLLI2SP)); +#endif /* RCC_PLLI2SCFGR_PLLI2SP */ +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) + assert_param(IS_RCC_PLLI2SQ_VALUE(PLLI2SInit->PLLI2SQ)); +#endif /* RCC_PLLI2SCFGR_PLLI2SQ */ + + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + + /* Wait till PLLI2S is disabled */ + tickstart = HAL_GetTick(); + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /* Configure the PLLI2S division factors */ +#if defined(STM32F446xx) + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + /* I2SPCLK = PLLI2S_VCO / PLLI2SP */ + /* I2SQCLK = PLLI2S_VCO / PLLI2SQ */ + /* I2SRCLK = PLLI2S_VCO / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PLLI2SInit->PLLI2SM, PLLI2SInit->PLLI2SN, \ + PLLI2SInit->PLLI2SP, PLLI2SInit->PLLI2SQ, PLLI2SInit->PLLI2SR); +#elif defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ + defined(STM32F413xx) || defined(STM32F423xx) + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM)*/ + /* I2SQCLK = PLLI2S_VCO / PLLI2SQ */ + /* I2SRCLK = PLLI2S_VCO / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PLLI2SInit->PLLI2SM, PLLI2SInit->PLLI2SN, \ + PLLI2SInit->PLLI2SQ, PLLI2SInit->PLLI2SR); +#elif defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F469xx) || defined(STM32F479xx) + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * PLLI2SN */ + /* I2SQCLK = PLLI2S_VCO / PLLI2SQ */ + /* I2SRCLK = PLLI2S_VCO / PLLI2SR */ + __HAL_RCC_PLLI2S_SAICLK_CONFIG(PLLI2SInit->PLLI2SN, PLLI2SInit->PLLI2SQ, PLLI2SInit->PLLI2SR); +#elif defined(STM32F411xE) + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) * (PLLI2SN/PLLI2SM) */ + /* I2SRCLK = PLLI2S_VCO / PLLI2SR */ + __HAL_RCC_PLLI2S_I2SCLK_CONFIG(PLLI2SInit->PLLI2SM, PLLI2SInit->PLLI2SN, PLLI2SInit->PLLI2SR); +#else + /* PLLI2S_VCO = f(VCO clock) = f(PLLI2S clock input) x PLLI2SN */ + /* I2SRCLK = PLLI2S_VCO / PLLI2SR */ + __HAL_RCC_PLLI2S_CONFIG(PLLI2SInit->PLLI2SN, PLLI2SInit->PLLI2SR); +#endif /* STM32F446xx */ + + /* Enable the PLLI2S */ + __HAL_RCC_PLLI2S_ENABLE(); + + /* Wait till PLLI2S is ready */ + tickstart = HAL_GetTick(); + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +/** + * @brief Disable PLLI2S. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void) +{ + uint32_t tickstart; + + /* Disable the PLLI2S */ + __HAL_RCC_PLLI2S_DISABLE(); + + /* Wait till PLLI2S is disabled */ + tickstart = HAL_GetTick(); + while(READ_BIT(RCC->CR, RCC_CR_PLLI2SRDY) != RESET) + { + if((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Enable PLLSAI. + * @param PLLSAIInit pointer to an RCC_PLLSAIInitTypeDef structure that + * contains the configuration information for the PLLSAI + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit) +{ + uint32_t tickstart; + + /* Check for parameters */ + assert_param(IS_RCC_PLLSAIN_VALUE(PLLSAIInit->PLLSAIN)); + assert_param(IS_RCC_PLLSAIQ_VALUE(PLLSAIInit->PLLSAIQ)); +#if defined(RCC_PLLSAICFGR_PLLSAIM) + assert_param(IS_RCC_PLLSAIM_VALUE(PLLSAIInit->PLLSAIM)); +#endif /* RCC_PLLSAICFGR_PLLSAIM */ +#if defined(RCC_PLLSAICFGR_PLLSAIP) + assert_param(IS_RCC_PLLSAIP_VALUE(PLLSAIInit->PLLSAIP)); +#endif /* RCC_PLLSAICFGR_PLLSAIP */ +#if defined(RCC_PLLSAICFGR_PLLSAIR) + assert_param(IS_RCC_PLLSAIR_VALUE(PLLSAIInit->PLLSAIR)); +#endif /* RCC_PLLSAICFGR_PLLSAIR */ + + /* Disable the PLLSAI */ + __HAL_RCC_PLLSAI_DISABLE(); + + /* Wait till PLLSAI is disabled */ + tickstart = HAL_GetTick(); + while(__HAL_RCC_PLLSAI_GET_FLAG() != RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + /* Configure the PLLSAI division factors */ +#if defined(STM32F446xx) + /* PLLSAI_VCO = f(VCO clock) = f(PLLSAI clock input) * (PLLSAIN/PLLSAIM) */ + /* SAIPCLK = PLLSAI_VCO / PLLSAIP */ + /* SAIQCLK = PLLSAI_VCO / PLLSAIQ */ + /* SAIRCLK = PLLSAI_VCO / PLLSAIR */ + __HAL_RCC_PLLSAI_CONFIG(PLLSAIInit->PLLSAIM, PLLSAIInit->PLLSAIN, \ + PLLSAIInit->PLLSAIP, PLLSAIInit->PLLSAIQ, 0U); +#elif defined(STM32F469xx) || defined(STM32F479xx) + /* PLLSAI_VCO = f(VCO clock) = f(PLLSAI clock input) * PLLSAIN */ + /* SAIPCLK = PLLSAI_VCO / PLLSAIP */ + /* SAIQCLK = PLLSAI_VCO / PLLSAIQ */ + /* SAIRCLK = PLLSAI_VCO / PLLSAIR */ + __HAL_RCC_PLLSAI_CONFIG(PLLSAIInit->PLLSAIN, PLLSAIInit->PLLSAIP, \ + PLLSAIInit->PLLSAIQ, PLLSAIInit->PLLSAIR); +#else + /* PLLSAI_VCO = f(VCO clock) = f(PLLSAI clock input) x PLLSAIN */ + /* SAIQCLK = PLLSAI_VCO / PLLSAIQ */ + /* SAIRCLK = PLLSAI_VCO / PLLSAIR */ + __HAL_RCC_PLLSAI_CONFIG(PLLSAIInit->PLLSAIN, PLLSAIInit->PLLSAIQ, PLLSAIInit->PLLSAIR); +#endif /* STM32F446xx */ + + /* Enable the PLLSAI */ + __HAL_RCC_PLLSAI_ENABLE(); + + /* Wait till PLLSAI is ready */ + tickstart = HAL_GetTick(); + while(__HAL_RCC_PLLSAI_GET_FLAG() == RESET) + { + if((HAL_GetTick() - tickstart ) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +/** + * @brief Disable PLLSAI. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void) +{ + uint32_t tickstart; + + /* Disable the PLLSAI */ + __HAL_RCC_PLLSAI_DISABLE(); + + /* Wait till PLLSAI is disabled */ + tickstart = HAL_GetTick(); + while(__HAL_RCC_PLLSAI_GET_FLAG() != RESET) + { + if((HAL_GetTick() - tickstart) > PLLSAI_TIMEOUT_VALUE) + { + /* return in case of Timeout detected */ + return HAL_TIMEOUT; + } + } + + return HAL_OK; +} + +#endif /* RCC_PLLSAI_SUPPORT */ + +/** + * @} + */ + +#if defined(STM32F446xx) +/** + * @brief Returns the SYSCLK frequency + * + * @note This function implementation is valid only for STM32F446xx devices. + * @note This function add the PLL/PLLR System clock source + * + * @note The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(*) + * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(**) + * @note If SYSCLK source is PLL or PLLR, function returns values based on HSE_VALUE(**) + * or HSI_VALUE(*) multiplied/divided by the PLL factors. + * @note (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * @note (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value + * 25 MHz), user has to ensure that HSE_VALUE is same as the real + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * + * @note The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @note This function can be used by the user application to compute the + * baudrate for the communication peripherals or configure other parameters. + * + * @note Each time SYSCLK changes, this function must be called to update the + * right SYSCLK value. Otherwise, any configuration based on this function will be incorrect. + * + * + * @retval SYSCLK frequency + */ +uint32_t HAL_RCC_GetSysClockFreq(void) +{ + uint32_t pllm = 0U; + uint32_t pllvco = 0U; + uint32_t pllp = 0U; + uint32_t pllr = 0U; + uint32_t sysclockfreq = 0U; + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (RCC->CFGR & RCC_CFGR_SWS) + { + case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */ + { + sysclockfreq = HSI_VALUE; + break; + } + case RCC_CFGR_SWS_HSE: /* HSE used as system clock source */ + { + sysclockfreq = HSE_VALUE; + break; + } + case RCC_CFGR_SWS_PLL: /* PLL/PLLP used as system clock source */ + { + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SYSCLK = PLL_VCO / PLLP */ + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + if(__HAL_RCC_GET_PLL_OSCSOURCE() != RCC_PLLSOURCE_HSI) + { + /* HSE used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSE_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSI_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + pllp = ((((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >> RCC_PLLCFGR_PLLP_Pos) + 1U) *2U); + + sysclockfreq = pllvco/pllp; + break; + } + case RCC_CFGR_SWS_PLLR: /* PLL/PLLR used as system clock source */ + { + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SYSCLK = PLL_VCO / PLLR */ + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + if(__HAL_RCC_GET_PLL_OSCSOURCE() != RCC_PLLSOURCE_HSI) + { + /* HSE used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSE_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (uint32_t) ((((uint64_t) HSI_VALUE * ((uint64_t) ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm); + } + pllr = ((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> RCC_PLLCFGR_PLLR_Pos); + + sysclockfreq = pllvco/pllr; + break; + } + default: + { + sysclockfreq = HSI_VALUE; + break; + } + } + return sysclockfreq; +} +#endif /* STM32F446xx */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @brief Resets the RCC clock configuration to the default reset state. + * @note The default reset state of the clock configuration is given below: + * - HSI ON and used as system clock source + * - HSE, PLL, PLLI2S and PLLSAI OFF + * - AHB, APB1 and APB2 prescaler set to 1. + * - CSS, MCO1 and MCO2 OFF + * - All interrupts disabled + * @note This function doesn't modify the configuration of the + * - Peripheral clocks + * - LSI, LSE and RTC clocks + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCC_DeInit(void) +{ + uint32_t tickstart; + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Set HSION bit to the reset value */ + SET_BIT(RCC->CR, RCC_CR_HSION); + + /* Wait till HSI is ready */ + while (READ_BIT(RCC->CR, RCC_CR_HSIRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Set HSITRIM[4:0] bits to the reset value */ + SET_BIT(RCC->CR, RCC_CR_HSITRIM_4); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Reset CFGR register */ + CLEAR_REG(RCC->CFGR); + + /* Wait till clock switch is ready */ + while (READ_BIT(RCC->CFGR, RCC_CFGR_SWS) != RESET) + { + if ((HAL_GetTick() - tickstart) > CLOCKSWITCH_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Clear HSEON, HSEBYP and CSSON bits */ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON | RCC_CR_HSEBYP | RCC_CR_CSSON); + + /* Wait till HSE is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_HSERDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Clear PLLON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLLON); + + /* Wait till PLL is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + +#if defined(RCC_PLLI2S_SUPPORT) + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Reset PLLI2SON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLLI2SON); + + /* Wait till PLLI2S is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLLI2SRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Reset PLLSAI bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLLSAION); + + /* Wait till PLLSAI is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLLSAIRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLLSAI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } +#endif /* RCC_PLLSAI_SUPPORT */ + + /* Once PLL, PLLI2S and PLLSAI are OFF, reset PLLCFGR register to default value */ +#if defined(STM32F412Cx) || defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || \ + defined(STM32F423xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + RCC->PLLCFGR = RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLN_6 | RCC_PLLCFGR_PLLN_7 | RCC_PLLCFGR_PLLQ_2 | RCC_PLLCFGR_PLLR_1; +#elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) + RCC->PLLCFGR = RCC_PLLCFGR_PLLR_0 | RCC_PLLCFGR_PLLR_1 | RCC_PLLCFGR_PLLR_2 | RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLN_6 | RCC_PLLCFGR_PLLN_7 | RCC_PLLCFGR_PLLQ_0 | RCC_PLLCFGR_PLLQ_1 | RCC_PLLCFGR_PLLQ_2 | RCC_PLLCFGR_PLLQ_3; +#else + RCC->PLLCFGR = RCC_PLLCFGR_PLLM_4 | RCC_PLLCFGR_PLLN_6 | RCC_PLLCFGR_PLLN_7 | RCC_PLLCFGR_PLLQ_2; +#endif /* STM32F412Cx || STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx || STM32F446xx || STM32F469xx || STM32F479xx */ + + /* Reset PLLI2SCFGR register to default value */ +#if defined(STM32F412Cx) || defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || \ + defined(STM32F423xx) || defined(STM32F446xx) + RCC->PLLI2SCFGR = RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SN_6 | RCC_PLLI2SCFGR_PLLI2SN_7 | RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SR_1; +#elif defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) + RCC->PLLI2SCFGR = RCC_PLLI2SCFGR_PLLI2SN_6 | RCC_PLLI2SCFGR_PLLI2SN_7 | RCC_PLLI2SCFGR_PLLI2SR_1; +#elif defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + RCC->PLLI2SCFGR = RCC_PLLI2SCFGR_PLLI2SN_6 | RCC_PLLI2SCFGR_PLLI2SN_7 | RCC_PLLI2SCFGR_PLLI2SQ_2 | RCC_PLLI2SCFGR_PLLI2SR_1; +#elif defined(STM32F411xE) + RCC->PLLI2SCFGR = RCC_PLLI2SCFGR_PLLI2SM_4 | RCC_PLLI2SCFGR_PLLI2SN_6 | RCC_PLLI2SCFGR_PLLI2SN_7 | RCC_PLLI2SCFGR_PLLI2SR_1; +#endif /* STM32F412Cx || STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx || STM32F446xx */ + + /* Reset PLLSAICFGR register */ +#if defined(STM32F427xx) || defined(STM32F429xx) || defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) + RCC->PLLSAICFGR = RCC_PLLSAICFGR_PLLSAIN_6 | RCC_PLLSAICFGR_PLLSAIN_7 | RCC_PLLSAICFGR_PLLSAIQ_2 | RCC_PLLSAICFGR_PLLSAIR_1; +#elif defined(STM32F446xx) + RCC->PLLSAICFGR = RCC_PLLSAICFGR_PLLSAIM_4 | RCC_PLLSAICFGR_PLLSAIN_6 | RCC_PLLSAICFGR_PLLSAIN_7 | RCC_PLLSAICFGR_PLLSAIQ_2; +#endif /* STM32F427xx || STM32F429xx || STM32F437xx || STM32F439xx || STM32F469xx || STM32F479xx */ + + /* Disable all interrupts */ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE | RCC_CIR_LSERDYIE | RCC_CIR_HSIRDYIE | RCC_CIR_HSERDYIE | RCC_CIR_PLLRDYIE); + +#if defined(RCC_CIR_PLLI2SRDYIE) + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE); +#endif /* RCC_CIR_PLLI2SRDYIE */ + +#if defined(RCC_CIR_PLLSAIRDYIE) + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE); +#endif /* RCC_CIR_PLLSAIRDYIE */ + + /* Clear all interrupt flags */ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC | RCC_CIR_LSERDYC | RCC_CIR_HSIRDYC | RCC_CIR_HSERDYC | RCC_CIR_PLLRDYC | RCC_CIR_CSSC); + +#if defined(RCC_CIR_PLLI2SRDYC) + SET_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYC); +#endif /* RCC_CIR_PLLI2SRDYC */ + +#if defined(RCC_CIR_PLLSAIRDYC) + SET_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYC); +#endif /* RCC_CIR_PLLSAIRDYC */ + + /* Clear LSION bit */ + CLEAR_BIT(RCC->CSR, RCC_CSR_LSION); + + /* Reset all CSR flags */ + SET_BIT(RCC->CSR, RCC_CSR_RMVF); + + /* Update the SystemCoreClock global variable */ + SystemCoreClock = HSI_VALUE; + + /* Adapt Systick interrupt period */ + if(HAL_InitTick(uwTickPrio) != HAL_OK) + { + return HAL_ERROR; + } + else + { + return HAL_OK; + } +} + +#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) +/** + * @brief Initializes the RCC Oscillators according to the specified parameters in the + * RCC_OscInitTypeDef. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that + * contains the configuration information for the RCC Oscillators. + * @note The PLL is not disabled when used as system clock. + * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not + * supported by this API. User should request a transition to LSE Off + * first and then LSE On or LSE Bypass. + * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not + * supported by this API. User should request a transition to HSE Off + * first and then HSE On or HSE Bypass. + * @note This function add the PLL/PLLR factor management during PLL configuration this feature + * is only available in STM32F410xx/STM32F446xx/STM32F469xx/STM32F479xx/STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx devices + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + uint32_t tickstart = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_OSCILLATORTYPE(RCC_OscInitStruct->OscillatorType)); + /*------------------------------- HSE Configuration ------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) + { + /* Check the parameters */ + assert_param(IS_RCC_HSE(RCC_OscInitStruct->HSEState)); + /* When the HSE is used as system clock or clock source for PLL in these cases HSE will not disabled */ +#if defined(STM32F446xx) + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSE) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSE)) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLLR) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSE))) +#else + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSE) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSE))) +#endif /* STM32F446xx */ + { + if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) && (RCC_OscInitStruct->HSEState == RCC_HSE_OFF)) + { + return HAL_ERROR; + } + } + else + { + /* Set the new HSE configuration ---------------------------------------*/ + __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState); + + /* Check the HSE State */ + if((RCC_OscInitStruct->HSEState) != RCC_HSE_OFF) + { + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSE is bypassed or disabled */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*----------------------------- HSI Configuration --------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) + { + /* Check the parameters */ + assert_param(IS_RCC_HSI(RCC_OscInitStruct->HSIState)); + assert_param(IS_RCC_CALIBRATION_VALUE(RCC_OscInitStruct->HSICalibrationValue)); + + /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ +#if defined(STM32F446xx) + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSI) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI)) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLLR) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI))) +#else + if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSI) ||\ + ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI))) +#endif /* STM32F446xx */ + { + /* When HSI is used as system clock it will not disabled */ + if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON)) + { + return HAL_ERROR; + } + /* Otherwise, just the calibration is allowed */ + else + { + /* Adjusts the Internal High Speed oscillator (HSI) calibration value.*/ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + } + else + { + /* Check the HSI State */ + if((RCC_OscInitStruct->HSIState)!= RCC_HSI_OFF) + { + /* Enable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Adjusts the Internal High Speed oscillator (HSI) calibration value.*/ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + else + { + /* Disable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till HSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*------------------------------ LSI Configuration -------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) + { + /* Check the parameters */ + assert_param(IS_RCC_LSI(RCC_OscInitStruct->LSIState)); + + /* Check the LSI State */ + if((RCC_OscInitStruct->LSIState)!= RCC_LSI_OFF) + { + /* Enable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Disable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSI is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + /*------------------------------ LSE Configuration -------------------------*/ + if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) + { + FlagStatus pwrclkchanged = RESET; + + /* Check the parameters */ + assert_param(IS_RCC_LSE(RCC_OscInitStruct->LSEState)); + + /* Update LSE configuration in Backup Domain control register */ + /* Requires to enable write access to Backup Domain of necessary */ + if(__HAL_RCC_PWR_IS_CLK_DISABLED()) + { + __HAL_RCC_PWR_CLK_ENABLE(); + pwrclkchanged = SET; + } + + if(HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + /* Enable write access to Backup domain */ + SET_BIT(PWR->CR, PWR_CR_DBP); + + /* Wait for Backup domain Write protection disable */ + tickstart = HAL_GetTick(); + + while(HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + if((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Set the new LSE configuration -----------------------------------------*/ + __HAL_RCC_LSE_CONFIG(RCC_OscInitStruct->LSEState); + /* Check the LSE State */ + if((RCC_OscInitStruct->LSEState) != RCC_LSE_OFF) + { + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Restore clock configuration if changed */ + if(pwrclkchanged == SET) + { + __HAL_RCC_PWR_CLK_DISABLE(); + } + } + /*-------------------------------- PLL Configuration -----------------------*/ + /* Check the parameters */ + assert_param(IS_RCC_PLL(RCC_OscInitStruct->PLL.PLLState)); + if ((RCC_OscInitStruct->PLL.PLLState) != RCC_PLL_NONE) + { + /* Check if the PLL is used as system clock or not */ + if(__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) + { + if((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_ON) + { + /* Check the parameters */ + assert_param(IS_RCC_PLLSOURCE(RCC_OscInitStruct->PLL.PLLSource)); + assert_param(IS_RCC_PLLM_VALUE(RCC_OscInitStruct->PLL.PLLM)); + assert_param(IS_RCC_PLLN_VALUE(RCC_OscInitStruct->PLL.PLLN)); + assert_param(IS_RCC_PLLP_VALUE(RCC_OscInitStruct->PLL.PLLP)); + assert_param(IS_RCC_PLLQ_VALUE(RCC_OscInitStruct->PLL.PLLQ)); + assert_param(IS_RCC_PLLR_VALUE(RCC_OscInitStruct->PLL.PLLR)); + + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the main PLL clock source, multiplication and division factors. */ + __HAL_RCC_PLL_CONFIG(RCC_OscInitStruct->PLL.PLLSource, + RCC_OscInitStruct->PLL.PLLM, + RCC_OscInitStruct->PLL.PLLN, + RCC_OscInitStruct->PLL.PLLP, + RCC_OscInitStruct->PLL.PLLQ, + RCC_OscInitStruct->PLL.PLLR); + + /* Enable the main PLL. */ + __HAL_RCC_PLL_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if((HAL_GetTick() - tickstart ) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + else + { + return HAL_ERROR; + } + } + return HAL_OK; +} + +/** + * @brief Configures the RCC_OscInitStruct according to the internal + * RCC configuration registers. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that will be configured. + * + * @note This function is only available in case of STM32F410xx/STM32F446xx/STM32F469xx/STM32F479xx/STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx devices. + * @note This function add the PLL/PLLR factor management + * @retval None + */ +void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + /* Set all possible values for the Oscillator type parameter ---------------*/ + RCC_OscInitStruct->OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_LSI; + + /* Get the HSE configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_HSEBYP) == RCC_CR_HSEBYP) + { + RCC_OscInitStruct->HSEState = RCC_HSE_BYPASS; + } + else if((RCC->CR &RCC_CR_HSEON) == RCC_CR_HSEON) + { + RCC_OscInitStruct->HSEState = RCC_HSE_ON; + } + else + { + RCC_OscInitStruct->HSEState = RCC_HSE_OFF; + } + + /* Get the HSI configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_HSION) == RCC_CR_HSION) + { + RCC_OscInitStruct->HSIState = RCC_HSI_ON; + } + else + { + RCC_OscInitStruct->HSIState = RCC_HSI_OFF; + } + + RCC_OscInitStruct->HSICalibrationValue = (uint32_t)((RCC->CR &RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos); + + /* Get the LSE configuration -----------------------------------------------*/ + if((RCC->BDCR &RCC_BDCR_LSEBYP) == RCC_BDCR_LSEBYP) + { + RCC_OscInitStruct->LSEState = RCC_LSE_BYPASS; + } + else if((RCC->BDCR &RCC_BDCR_LSEON) == RCC_BDCR_LSEON) + { + RCC_OscInitStruct->LSEState = RCC_LSE_ON; + } + else + { + RCC_OscInitStruct->LSEState = RCC_LSE_OFF; + } + + /* Get the LSI configuration -----------------------------------------------*/ + if((RCC->CSR &RCC_CSR_LSION) == RCC_CSR_LSION) + { + RCC_OscInitStruct->LSIState = RCC_LSI_ON; + } + else + { + RCC_OscInitStruct->LSIState = RCC_LSI_OFF; + } + + /* Get the PLL configuration -----------------------------------------------*/ + if((RCC->CR &RCC_CR_PLLON) == RCC_CR_PLLON) + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_ON; + } + else + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_OFF; + } + RCC_OscInitStruct->PLL.PLLSource = (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC); + RCC_OscInitStruct->PLL.PLLM = (uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLM); + RCC_OscInitStruct->PLL.PLLN = (uint32_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos); + RCC_OscInitStruct->PLL.PLLP = (uint32_t)((((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) + RCC_PLLCFGR_PLLP_0) << 1U) >> RCC_PLLCFGR_PLLP_Pos); + RCC_OscInitStruct->PLL.PLLQ = (uint32_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLQ) >> RCC_PLLCFGR_PLLQ_Pos); + RCC_OscInitStruct->PLL.PLLR = (uint32_t)((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> RCC_PLLCFGR_PLLR_Pos); +} +#endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ + +#endif /* HAL_RCC_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c new file mode 100644 index 0000000..da34f47 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c @@ -0,0 +1,1102 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_sdram.c + * @author MCD Application Team + * @brief SDRAM HAL module driver. + * This file provides a generic firmware to drive SDRAM memories mounted + * as external device. + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + This driver is a generic layered driver which contains a set of APIs used to + control SDRAM memories. It uses the FMC layer functions to interface + with SDRAM devices. + The following sequence should be followed to configure the FMC to interface + with SDRAM memories: + + (#) Declare a SDRAM_HandleTypeDef handle structure, for example: + SDRAM_HandleTypeDef hdsram + + (++) Fill the SDRAM_HandleTypeDef handle "Init" field with the allowed + values of the structure member. + + (++) Fill the SDRAM_HandleTypeDef handle "Instance" field with a predefined + base register instance for NOR or SDRAM device + + (#) Declare a FMC_SDRAM_TimingTypeDef structure; for example: + FMC_SDRAM_TimingTypeDef Timing; + and fill its fields with the allowed values of the structure member. + + (#) Initialize the SDRAM Controller by calling the function HAL_SDRAM_Init(). This function + performs the following sequence: + + (##) MSP hardware layer configuration using the function HAL_SDRAM_MspInit() + (##) Control register configuration using the FMC SDRAM interface function + FMC_SDRAM_Init() + (##) Timing register configuration using the FMC SDRAM interface function + FMC_SDRAM_Timing_Init() + (##) Program the SDRAM external device by applying its initialization sequence + according to the device plugged in your hardware. This step is mandatory + for accessing the SDRAM device. + + (#) At this stage you can perform read/write accesses from/to the memory connected + to the SDRAM Bank. You can perform either polling or DMA transfer using the + following APIs: + (++) HAL_SDRAM_Read()/HAL_SDRAM_Write() for polling read/write access + (++) HAL_SDRAM_Read_DMA()/HAL_SDRAM_Write_DMA() for DMA read/write transfer + + (#) You can also control the SDRAM device by calling the control APIs HAL_SDRAM_WriteOperation_Enable()/ + HAL_SDRAM_WriteOperation_Disable() to respectively enable/disable the SDRAM write operation or + the function HAL_SDRAM_SendCommand() to send a specified command to the SDRAM + device. The command to be sent must be configured with the FMC_SDRAM_CommandTypeDef + structure. + + (#) You can continuously monitor the SDRAM device HAL state by calling the function + HAL_SDRAM_GetState() + + *** Callback registration *** + ============================================= + [..] + The compilation define USE_HAL_SDRAM_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + + Use Functions @ref HAL_SDRAM_RegisterCallback() to register a user callback, + it allows to register following callbacks: + (+) MspInitCallback : SDRAM MspInit. + (+) MspDeInitCallback : SDRAM MspDeInit. + This function takes as parameters the HAL peripheral handle, the Callback ID + and a pointer to the user callback function. + + Use function @ref HAL_SDRAM_UnRegisterCallback() to reset a callback to the default + weak (surcharged) function. It allows to reset following callbacks: + (+) MspInitCallback : SDRAM MspInit. + (+) MspDeInitCallback : SDRAM MspDeInit. + This function) takes as parameters the HAL peripheral handle and the Callback ID. + + By default, after the @ref HAL_SDRAM_Init and if the state is HAL_SDRAM_STATE_RESET + all callbacks are reset to the corresponding legacy weak (surcharged) functions. + Exception done for MspInit and MspDeInit callbacks that are respectively + reset to the legacy weak (surcharged) functions in the @ref HAL_SDRAM_Init + and @ref HAL_SDRAM_DeInit only when these callbacks are null (not registered beforehand). + If not, MspInit or MspDeInit are not null, the @ref HAL_SDRAM_Init and @ref HAL_SDRAM_DeInit + keep and use the user MspInit/MspDeInit callbacks (registered beforehand) + + Callbacks can be registered/unregistered in READY state only. + Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered + in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used + during the Init/DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_SDRAM_RegisterCallback before calling @ref HAL_SDRAM_DeInit + or @ref HAL_SDRAM_Init function. + + When The compilation define USE_HAL_SDRAM_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registering feature is not available + and weak (surcharged) callbacks are used. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup SDRAM SDRAM + * @brief SDRAM driver modules + * @{ + */ +#ifdef HAL_SDRAM_MODULE_ENABLED +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SDRAM_Exported_Functions SDRAM Exported Functions + * @{ + */ + +/** @defgroup SDRAM_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * + @verbatim + ============================================================================== + ##### SDRAM Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to initialize/de-initialize + the SDRAM memory + +@endverbatim + * @{ + */ + +/** + * @brief Performs the SDRAM device initialization sequence. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param Timing Pointer to SDRAM control timing structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Init(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_TimingTypeDef *Timing) +{ + /* Check the SDRAM handle parameter */ + if(hsdram == NULL) + { + return HAL_ERROR; + } + + if(hsdram->State == HAL_SDRAM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + hsdram->Lock = HAL_UNLOCKED; +#if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) + if(hsdram->MspInitCallback == NULL) + { + hsdram->MspInitCallback = HAL_SDRAM_MspInit; + } + hsdram->RefreshErrorCallback = HAL_SDRAM_RefreshErrorCallback; + hsdram->DmaXferCpltCallback = HAL_SDRAM_DMA_XferCpltCallback; + hsdram->DmaXferErrorCallback = HAL_SDRAM_DMA_XferErrorCallback; + + /* Init the low level hardware */ + hsdram->MspInitCallback(hsdram); +#else + /* Initialize the low level hardware (MSP) */ + HAL_SDRAM_MspInit(hsdram); +#endif + } + + /* Initialize the SDRAM controller state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Initialize SDRAM control Interface */ + FMC_SDRAM_Init(hsdram->Instance, &(hsdram->Init)); + + /* Initialize SDRAM timing Interface */ + FMC_SDRAM_Timing_Init(hsdram->Instance, Timing, hsdram->Init.SDBank); + + /* Update the SDRAM controller state */ + hsdram->State = HAL_SDRAM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief Perform the SDRAM device initialization sequence. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_DeInit(SDRAM_HandleTypeDef *hsdram) +{ +#if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) + if(hsdram->MspDeInitCallback == NULL) + { + hsdram->MspDeInitCallback = HAL_SDRAM_MspDeInit; + } + + /* DeInit the low level hardware */ + hsdram->MspDeInitCallback(hsdram); +#else + /* Initialize the low level hardware (MSP) */ + HAL_SDRAM_MspDeInit(hsdram); +#endif + + /* Configure the SDRAM registers with their reset values */ + FMC_SDRAM_DeInit(hsdram->Instance, hsdram->Init.SDBank); + + /* Reset the SDRAM controller state */ + hsdram->State = HAL_SDRAM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief SDRAM MSP Init. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval None + */ +__weak void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hsdram); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_SDRAM_MspInit could be implemented in the user file + */ +} + +/** + * @brief SDRAM MSP DeInit. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval None + */ +__weak void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hsdram); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_SDRAM_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief This function handles SDRAM refresh error interrupt request. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval HAL status +*/ +void HAL_SDRAM_IRQHandler(SDRAM_HandleTypeDef *hsdram) +{ + /* Check SDRAM interrupt Rising edge flag */ + if(__FMC_SDRAM_GET_FLAG(hsdram->Instance, FMC_SDRAM_FLAG_REFRESH_IT)) + { + /* SDRAM refresh error interrupt callback */ +#if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) + hsdram->RefreshErrorCallback(hsdram); +#else + HAL_SDRAM_RefreshErrorCallback(hsdram); +#endif + + /* Clear SDRAM refresh error interrupt pending bit */ + __FMC_SDRAM_CLEAR_FLAG(hsdram->Instance, FMC_SDRAM_FLAG_REFRESH_ERROR); + } +} + +/** + * @brief SDRAM Refresh error callback. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval None + */ +__weak void HAL_SDRAM_RefreshErrorCallback(SDRAM_HandleTypeDef *hsdram) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hsdram); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_SDRAM_RefreshErrorCallback could be implemented in the user file + */ +} + +/** + * @brief DMA transfer complete callback. + * @param hdma pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA module. + * @retval None + */ +__weak void HAL_SDRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hdma); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_SDRAM_DMA_XferCpltCallback could be implemented in the user file + */ +} + +/** + * @brief DMA transfer complete error callback. + * @param hdma DMA handle + * @retval None + */ +__weak void HAL_SDRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hdma); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_SDRAM_DMA_XferErrorCallback could be implemented in the user file + */ +} +/** + * @} + */ + +/** @defgroup SDRAM_Exported_Functions_Group2 Input and Output functions + * @brief Input Output and memory control functions + * + @verbatim + ============================================================================== + ##### SDRAM Input and Output functions ##### + ============================================================================== + [..] + This section provides functions allowing to use and control the SDRAM memory + +@endverbatim + * @{ + */ + +/** + * @brief Reads 8-bit data buffer from the SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Read_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize) +{ + __IO uint8_t *pSdramAddress = (uint8_t *)pAddress; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if(hsdram->State == HAL_SDRAM_STATE_PRECHARGED) + { + return HAL_ERROR; + } + + /* Read data from source */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint8_t *)pSdramAddress; + pDstBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Writes 8-bit data buffer to SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Write_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize) +{ + __IO uint8_t *pSdramAddress = (uint8_t *)pAddress; + uint32_t tmp = 0U; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + tmp = hsdram->State; + + if(tmp == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if((tmp == HAL_SDRAM_STATE_PRECHARGED) || (tmp == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + return HAL_ERROR; + } + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint8_t *)pSdramAddress = *pSrcBuffer; + pSrcBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Reads 16-bit data buffer from the SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize) +{ + __IO uint16_t *pSdramAddress = (uint16_t *)pAddress; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if(hsdram->State == HAL_SDRAM_STATE_PRECHARGED) + { + return HAL_ERROR; + } + + /* Read data from source */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint16_t *)pSdramAddress; + pDstBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Writes 16-bit data buffer to SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Write_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize) +{ + __IO uint16_t *pSdramAddress = (uint16_t *)pAddress; + uint32_t tmp = 0U; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + tmp = hsdram->State; + + if(tmp == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if((tmp == HAL_SDRAM_STATE_PRECHARGED) || (tmp == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + return HAL_ERROR; + } + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint16_t *)pSdramAddress = *pSrcBuffer; + pSrcBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Reads 32-bit data buffer from the SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Read_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize) +{ + __IO uint32_t *pSdramAddress = (uint32_t *)pAddress; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if(hsdram->State == HAL_SDRAM_STATE_PRECHARGED) + { + return HAL_ERROR; + } + + /* Read data from source */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint32_t *)pSdramAddress; + pDstBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Writes 32-bit data buffer to SDRAM memory. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Write_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize) +{ + __IO uint32_t *pSdramAddress = (uint32_t *)pAddress; + uint32_t tmp = 0U; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + tmp = hsdram->State; + + if(tmp == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if((tmp == HAL_SDRAM_STATE_PRECHARGED) || (tmp == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + return HAL_ERROR; + } + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint32_t *)pSdramAddress = *pSrcBuffer; + pSrcBuffer++; + pSdramAddress++; + } + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Reads a Words data from the SDRAM memory using DMA transfer. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Read_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize) +{ + uint32_t tmp = 0U; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + tmp = hsdram->State; + + if(tmp == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if(tmp == HAL_SDRAM_STATE_PRECHARGED) + { + return HAL_ERROR; + } + + /* Configure DMA user callbacks */ + hsdram->hdma->XferCpltCallback = HAL_SDRAM_DMA_XferCpltCallback; + hsdram->hdma->XferErrorCallback = HAL_SDRAM_DMA_XferErrorCallback; + + /* Enable the DMA Stream */ + HAL_DMA_Start_IT(hsdram->hdma, (uint32_t)pAddress, (uint32_t)pDstBuffer, (uint32_t)BufferSize); + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +/** + * @brief Writes a Words data buffer to SDRAM memory using DMA transfer. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_Write_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize) +{ + uint32_t tmp = 0U; + + /* Process Locked */ + __HAL_LOCK(hsdram); + + /* Check the SDRAM controller state */ + tmp = hsdram->State; + + if(tmp == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + else if((tmp == HAL_SDRAM_STATE_PRECHARGED) || (tmp == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + return HAL_ERROR; + } + + /* Configure DMA user callbacks */ + hsdram->hdma->XferCpltCallback = HAL_SDRAM_DMA_XferCpltCallback; + hsdram->hdma->XferErrorCallback = HAL_SDRAM_DMA_XferErrorCallback; + + /* Enable the DMA Stream */ + HAL_DMA_Start_IT(hsdram->hdma, (uint32_t)pSrcBuffer, (uint32_t)pAddress, (uint32_t)BufferSize); + + /* Process Unlocked */ + __HAL_UNLOCK(hsdram); + + return HAL_OK; +} + +#if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) +/** + * @brief Register a User SDRAM Callback + * To be used instead of the weak (surcharged) predefined callback + * @param hsdram : SDRAM handle + * @param CallbackId : ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_SDRAM_MSP_INIT_CB_ID SDRAM MspInit callback ID + * @arg @ref HAL_SDRAM_MSP_DEINIT_CB_ID SDRAM MspDeInit callback ID + * @arg @ref HAL_SDRAM_REFRESH_ERR_CB_ID SDRAM Refresh Error callback ID + * @param pCallback : pointer to the Callback function + * @retval status + */ +HAL_StatusTypeDef HAL_SDRAM_RegisterCallback (SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId, pSDRAM_CallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SDRAM_StateTypeDef state; + + if(pCallback == NULL) + { + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hsdram); + + state = hsdram->State; + if((state == HAL_SDRAM_STATE_READY) || (state == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SDRAM_MSP_INIT_CB_ID : + hsdram->MspInitCallback = pCallback; + break; + case HAL_SDRAM_MSP_DEINIT_CB_ID : + hsdram->MspDeInitCallback = pCallback; + break; + case HAL_SDRAM_REFRESH_ERR_CB_ID : + hsdram->RefreshErrorCallback = pCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else if(hsdram->State == HAL_SDRAM_STATE_RESET) + { + switch (CallbackId) + { + case HAL_SDRAM_MSP_INIT_CB_ID : + hsdram->MspInitCallback = pCallback; + break; + case HAL_SDRAM_MSP_DEINIT_CB_ID : + hsdram->MspDeInitCallback = pCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsdram); + return status; +} + +/** + * @brief Unregister a User SDRAM Callback + * SDRAM Callback is redirected to the weak (surcharged) predefined callback + * @param hsdram : SDRAM handle + * @param CallbackId : ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_SDRAM_MSP_INIT_CB_ID SDRAM MspInit callback ID + * @arg @ref HAL_SDRAM_MSP_DEINIT_CB_ID SDRAM MspDeInit callback ID + * @arg @ref HAL_SDRAM_REFRESH_ERR_CB_ID SDRAM Refresh Error callback ID + * @arg @ref HAL_SDRAM_DMA_XFER_CPLT_CB_ID SDRAM DMA Xfer Complete callback ID + * @arg @ref HAL_SDRAM_DMA_XFER_ERR_CB_ID SDRAM DMA Xfer Error callback ID + * @retval status + */ +HAL_StatusTypeDef HAL_SDRAM_UnRegisterCallback (SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SDRAM_StateTypeDef state; + + /* Process locked */ + __HAL_LOCK(hsdram); + + state = hsdram->State; + if((state == HAL_SDRAM_STATE_READY) || (state == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SDRAM_MSP_INIT_CB_ID : + hsdram->MspInitCallback = HAL_SDRAM_MspInit; + break; + case HAL_SDRAM_MSP_DEINIT_CB_ID : + hsdram->MspDeInitCallback = HAL_SDRAM_MspDeInit; + break; + case HAL_SDRAM_REFRESH_ERR_CB_ID : + hsdram->RefreshErrorCallback = HAL_SDRAM_RefreshErrorCallback; + break; + case HAL_SDRAM_DMA_XFER_CPLT_CB_ID : + hsdram->DmaXferCpltCallback = HAL_SDRAM_DMA_XferCpltCallback; + break; + case HAL_SDRAM_DMA_XFER_ERR_CB_ID : + hsdram->DmaXferErrorCallback = HAL_SDRAM_DMA_XferErrorCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else if(hsdram->State == HAL_SDRAM_STATE_RESET) + { + switch (CallbackId) + { + case HAL_SDRAM_MSP_INIT_CB_ID : + hsdram->MspInitCallback = HAL_SDRAM_MspInit; + break; + case HAL_SDRAM_MSP_DEINIT_CB_ID : + hsdram->MspDeInitCallback = HAL_SDRAM_MspDeInit; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsdram); + return status; +} + +/** + * @brief Register a User SDRAM Callback for DMA transfers + * To be used instead of the weak (surcharged) predefined callback + * @param hsdram : SDRAM handle + * @param CallbackId : ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_SDRAM_DMA_XFER_CPLT_CB_ID SDRAM DMA Xfer Complete callback ID + * @arg @ref HAL_SDRAM_DMA_XFER_ERR_CB_ID SDRAM DMA Xfer Error callback ID + * @param pCallback : pointer to the Callback function + * @retval status + */ +HAL_StatusTypeDef HAL_SDRAM_RegisterDmaCallback(SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId, pSDRAM_DmaCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SDRAM_StateTypeDef state; + + if(pCallback == NULL) + { + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hsdram); + + state = hsdram->State; + if((state == HAL_SDRAM_STATE_READY) || (state == HAL_SDRAM_STATE_WRITE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SDRAM_DMA_XFER_CPLT_CB_ID : + hsdram->DmaXferCpltCallback = pCallback; + break; + case HAL_SDRAM_DMA_XFER_ERR_CB_ID : + hsdram->DmaXferErrorCallback = pCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsdram); + return status; +} +#endif + +/** + * @} + */ + +/** @defgroup SDRAM_Exported_Functions_Group3 Control functions + * @brief management functions + * +@verbatim + ============================================================================== + ##### SDRAM Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the SDRAM interface. + +@endverbatim + * @{ + */ + +/** + * @brief Enables dynamically SDRAM write protection. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram) +{ + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Enable write protection */ + FMC_SDRAM_WriteProtection_Enable(hsdram->Instance, hsdram->Init.SDBank); + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_WRITE_PROTECTED; + + return HAL_OK; +} + +/** + * @brief Disables dynamically SDRAM write protection. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram) +{ + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Disable write protection */ + FMC_SDRAM_WriteProtection_Disable(hsdram->Instance, hsdram->Init.SDBank); + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief Sends Command to the SDRAM bank. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param Command SDRAM command structure + * @param Timeout Timeout duration + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout) +{ + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Send SDRAM command */ + FMC_SDRAM_SendCommand(hsdram->Instance, Command, Timeout); + + /* Update the SDRAM controller state */ + if(Command->CommandMode == FMC_SDRAM_CMD_PALL) + { + hsdram->State = HAL_SDRAM_STATE_PRECHARGED; + } + else + { + hsdram->State = HAL_SDRAM_STATE_READY; + } + + return HAL_OK; +} + +/** + * @brief Programs the SDRAM Memory Refresh rate. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param RefreshRate The SDRAM refresh rate value + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram, uint32_t RefreshRate) +{ + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Program the refresh rate */ + FMC_SDRAM_ProgramRefreshRate(hsdram->Instance ,RefreshRate); + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief Sets the Number of consecutive SDRAM Memory auto Refresh commands. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @param AutoRefreshNumber The SDRAM auto Refresh number + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram, uint32_t AutoRefreshNumber) +{ + /* Check the SDRAM controller state */ + if(hsdram->State == HAL_SDRAM_STATE_BUSY) + { + return HAL_BUSY; + } + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_BUSY; + + /* Set the Auto-Refresh number */ + FMC_SDRAM_SetAutoRefreshNumber(hsdram->Instance ,AutoRefreshNumber); + + /* Update the SDRAM state */ + hsdram->State = HAL_SDRAM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief Returns the SDRAM memory current mode. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval The SDRAM memory mode. + */ +uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram) +{ + /* Return the SDRAM memory current mode */ + return(FMC_SDRAM_GetModeStatus(hsdram->Instance, hsdram->Init.SDBank)); +} + +/** + * @} + */ + +/** @defgroup SDRAM_Exported_Functions_Group4 State functions + * @brief Peripheral State functions + * +@verbatim + ============================================================================== + ##### SDRAM State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the SDRAM controller + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Returns the SDRAM state. + * @param hsdram pointer to a SDRAM_HandleTypeDef structure that contains + * the configuration information for SDRAM module. + * @retval HAL state + */ +HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram) +{ + return hsdram->State; +} + +/** + * @} + */ + +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +#endif /* HAL_SDRAM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c new file mode 100644 index 0000000..7520569 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c @@ -0,0 +1,912 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_sram.c + * @author MCD Application Team + * @brief SRAM HAL module driver. + * This file provides a generic firmware to drive SRAM memories + * mounted as external device. + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + This driver is a generic layered driver which contains a set of APIs used to + control SRAM memories. It uses the FMC layer functions to interface + with SRAM devices. + The following sequence should be followed to configure the FMC/FSMC to interface + with SRAM/PSRAM memories: + + (#) Declare a SRAM_HandleTypeDef handle structure, for example: + SRAM_HandleTypeDef hsram; and: + + (++) Fill the SRAM_HandleTypeDef handle "Init" field with the allowed + values of the structure member. + + (++) Fill the SRAM_HandleTypeDef handle "Instance" field with a predefined + base register instance for NOR or SRAM device + + (++) Fill the SRAM_HandleTypeDef handle "Extended" field with a predefined + base register instance for NOR or SRAM extended mode + + (#) Declare two FMC_NORSRAM_TimingTypeDef structures, for both normal and extended + mode timings; for example: + FMC_NORSRAM_TimingTypeDef Timing and FMC_NORSRAM_TimingTypeDef ExTiming; + and fill its fields with the allowed values of the structure member. + + (#) Initialize the SRAM Controller by calling the function HAL_SRAM_Init(). This function + performs the following sequence: + + (##) MSP hardware layer configuration using the function HAL_SRAM_MspInit() + (##) Control register configuration using the FMC NORSRAM interface function + FMC_NORSRAM_Init() + (##) Timing register configuration using the FMC NORSRAM interface function + FMC_NORSRAM_Timing_Init() + (##) Extended mode Timing register configuration using the FMC NORSRAM interface function + FMC_NORSRAM_Extended_Timing_Init() + (##) Enable the SRAM device using the macro __FMC_NORSRAM_ENABLE() + + (#) At this stage you can perform read/write accesses from/to the memory connected + to the NOR/SRAM Bank. You can perform either polling or DMA transfer using the + following APIs: + (++) HAL_SRAM_Read()/HAL_SRAM_Write() for polling read/write access + (++) HAL_SRAM_Read_DMA()/HAL_SRAM_Write_DMA() for DMA read/write transfer + + (#) You can also control the SRAM device by calling the control APIs HAL_SRAM_WriteOperation_Enable()/ + HAL_SRAM_WriteOperation_Disable() to respectively enable/disable the SRAM write operation + + (#) You can continuously monitor the SRAM device HAL state by calling the function + HAL_SRAM_GetState() + + *** Callback registration *** + ============================================= + [..] + The compilation define USE_HAL_SRAM_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + + Use Functions @ref HAL_SRAM_RegisterCallback() to register a user callback, + it allows to register following callbacks: + (+) MspInitCallback : SRAM MspInit. + (+) MspDeInitCallback : SRAM MspDeInit. + This function takes as parameters the HAL peripheral handle, the Callback ID + and a pointer to the user callback function. + + Use function @ref HAL_SRAM_UnRegisterCallback() to reset a callback to the default + weak (surcharged) function. It allows to reset following callbacks: + (+) MspInitCallback : SRAM MspInit. + (+) MspDeInitCallback : SRAM MspDeInit. + This function) takes as parameters the HAL peripheral handle and the Callback ID. + + By default, after the @ref HAL_SRAM_Init and if the state is HAL_SRAM_STATE_RESET + all callbacks are reset to the corresponding legacy weak (surcharged) functions. + Exception done for MspInit and MspDeInit callbacks that are respectively + reset to the legacy weak (surcharged) functions in the @ref HAL_SRAM_Init + and @ref HAL_SRAM_DeInit only when these callbacks are null (not registered beforehand). + If not, MspInit or MspDeInit are not null, the @ref HAL_SRAM_Init and @ref HAL_SRAM_DeInit + keep and use the user MspInit/MspDeInit callbacks (registered beforehand) + + Callbacks can be registered/unregistered in READY state only. + Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered + in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used + during the Init/DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_SRAM_RegisterCallback before calling @ref HAL_SRAM_DeInit + or @ref HAL_SRAM_Init function. + + When The compilation define USE_HAL_SRAM_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registering feature is not available + and weak (surcharged) callbacks are used. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup SRAM SRAM + * @brief SRAM driver modules + * @{ + */ +#ifdef HAL_SRAM_MODULE_ENABLED + +#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ + defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ + defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ + defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SRAM_Exported_Functions SRAM Exported Functions + * @{ + */ +/** @defgroup SRAM_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * + @verbatim + ============================================================================== + ##### SRAM Initialization and de_initialization functions ##### + ============================================================================== + [..] This section provides functions allowing to initialize/de-initialize + the SRAM memory + +@endverbatim + * @{ + */ + +/** + * @brief Performs the SRAM device initialization sequence + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param Timing Pointer to SRAM control timing structure + * @param ExtTiming Pointer to SRAM extended mode timing structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming) +{ + /* Check the SRAM handle parameter */ + if(hsram == NULL) + { + return HAL_ERROR; + } + + if(hsram->State == HAL_SRAM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + hsram->Lock = HAL_UNLOCKED; + +#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) + if(hsram->MspInitCallback == NULL) + { + hsram->MspInitCallback = HAL_SRAM_MspInit; + } + hsram->DmaXferCpltCallback = HAL_SRAM_DMA_XferCpltCallback; + hsram->DmaXferErrorCallback = HAL_SRAM_DMA_XferErrorCallback; + + /* Init the low level hardware */ + hsram->MspInitCallback(hsram); +#else + /* Initialize the low level hardware (MSP) */ + HAL_SRAM_MspInit(hsram); +#endif + } + + /* Initialize SRAM control Interface */ + FMC_NORSRAM_Init(hsram->Instance, &(hsram->Init)); + + /* Initialize SRAM timing Interface */ + FMC_NORSRAM_Timing_Init(hsram->Instance, Timing, hsram->Init.NSBank); + + /* Initialize SRAM extended mode timing Interface */ + FMC_NORSRAM_Extended_Timing_Init(hsram->Extended, ExtTiming, hsram->Init.NSBank, hsram->Init.ExtendedMode); + + /* Enable the NORSRAM device */ + __FMC_NORSRAM_ENABLE(hsram->Instance, hsram->Init.NSBank); + + return HAL_OK; +} + +/** + * @brief Performs the SRAM device De-initialization sequence. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram) +{ +#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) + if(hsram->MspDeInitCallback == NULL) + { + hsram->MspDeInitCallback = HAL_SRAM_MspDeInit; + } + + /* DeInit the low level hardware */ + hsram->MspDeInitCallback(hsram); +#else + /* De-Initialize the low level hardware (MSP) */ + HAL_SRAM_MspDeInit(hsram); +#endif + + /* Configure the SRAM registers with their reset values */ + FMC_NORSRAM_DeInit(hsram->Instance, hsram->Extended, hsram->Init.NSBank); + + hsram->State = HAL_SRAM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief SRAM MSP Init. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval None + */ +__weak void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hsram); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SRAM_MspInit could be implemented in the user file + */ +} + +/** + * @brief SRAM MSP DeInit. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval None + */ +__weak void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hsram); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SRAM_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief DMA transfer complete callback. + * @param hdma pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval None + */ +__weak void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hdma); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SRAM_DMA_XferCpltCallback could be implemented in the user file + */ +} + +/** + * @brief DMA transfer complete error callback. + * @param hdma pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval None + */ +__weak void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hdma); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SRAM_DMA_XferErrorCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup SRAM_Exported_Functions_Group2 Input and Output functions + * @brief Input Output and memory control functions + * + @verbatim + ============================================================================== + ##### SRAM Input and Output functions ##### + ============================================================================== + [..] + This section provides functions allowing to use and control the SRAM memory + +@endverbatim + * @{ + */ + +/** + * @brief Reads 8-bit buffer from SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize) +{ + __IO uint8_t * pSramAddress = (uint8_t *)pAddress; + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Read data from memory */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint8_t *)pSramAddress; + pDstBuffer++; + pSramAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Writes 8-bit buffer to SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize) +{ + __IO uint8_t * pSramAddress = (uint8_t *)pAddress; + + /* Check the SRAM controller state */ + if(hsram->State == HAL_SRAM_STATE_PROTECTED) + { + return HAL_ERROR; + } + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint8_t *)pSramAddress = *pSrcBuffer; + pSrcBuffer++; + pSramAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Reads 16-bit buffer from SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize) +{ + __IO uint16_t * pSramAddress = (uint16_t *)pAddress; + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Read data from memory */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint16_t *)pSramAddress; + pDstBuffer++; + pSramAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Writes 16-bit buffer to SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize) +{ + __IO uint16_t * pSramAddress = (uint16_t *)pAddress; + + /* Check the SRAM controller state */ + if(hsram->State == HAL_SRAM_STATE_PROTECTED) + { + return HAL_ERROR; + } + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint16_t *)pSramAddress = *pSrcBuffer; + pSrcBuffer++; + pSramAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Reads 32-bit buffer from SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize) +{ + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Read data from memory */ + for(; BufferSize != 0U; BufferSize--) + { + *pDstBuffer = *(__IO uint32_t *)pAddress; + pDstBuffer++; + pAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Writes 32-bit buffer to SRAM memory. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize) +{ + /* Check the SRAM controller state */ + if(hsram->State == HAL_SRAM_STATE_PROTECTED) + { + return HAL_ERROR; + } + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Write data to memory */ + for(; BufferSize != 0U; BufferSize--) + { + *(__IO uint32_t *)pAddress = *pSrcBuffer; + pSrcBuffer++; + pAddress++; + } + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Reads a Words data from the SRAM memory using DMA transfer. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to read start address + * @param pDstBuffer Pointer to destination buffer + * @param BufferSize Size of the buffer to read from memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize) +{ + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Configure DMA user callbacks */ + hsram->hdma->XferCpltCallback = HAL_SRAM_DMA_XferCpltCallback; + hsram->hdma->XferErrorCallback = HAL_SRAM_DMA_XferErrorCallback; + + /* Enable the DMA Stream */ + HAL_DMA_Start_IT(hsram->hdma, (uint32_t)pAddress, (uint32_t)pDstBuffer, (uint32_t)BufferSize); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Writes a Words data buffer to SRAM memory using DMA transfer. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @param pAddress Pointer to write start address + * @param pSrcBuffer Pointer to source buffer to write + * @param BufferSize Size of the buffer to write to memory + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize) +{ + /* Check the SRAM controller state */ + if(hsram->State == HAL_SRAM_STATE_PROTECTED) + { + return HAL_ERROR; + } + + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Configure DMA user callbacks */ + hsram->hdma->XferCpltCallback = HAL_SRAM_DMA_XferCpltCallback; + hsram->hdma->XferErrorCallback = HAL_SRAM_DMA_XferErrorCallback; + + /* Enable the DMA Stream */ + HAL_DMA_Start_IT(hsram->hdma, (uint32_t)pSrcBuffer, (uint32_t)pAddress, (uint32_t)BufferSize); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) +/** + * @brief Register a User SRAM Callback + * To be used instead of the weak (surcharged) predefined callback + * @param hsram : SRAM handle + * @param CallbackId : ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_SRAM_MSP_INIT_CB_ID SRAM MspInit callback ID + * @arg @ref HAL_SRAM_MSP_DEINIT_CB_ID SRAM MspDeInit callback ID + * @param pCallback : pointer to the Callback function + * @retval status + */ +HAL_StatusTypeDef HAL_SRAM_RegisterCallback (SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_CallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SRAM_StateTypeDef state; + + if(pCallback == NULL) + { + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hsram); + + state = hsram->State; + if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_RESET) || (state == HAL_SRAM_STATE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SRAM_MSP_INIT_CB_ID : + hsram->MspInitCallback = pCallback; + break; + case HAL_SRAM_MSP_DEINIT_CB_ID : + hsram->MspDeInitCallback = pCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsram); + return status; +} + +/** + * @brief Unregister a User SRAM Callback + * SRAM Callback is redirected to the weak (surcharged) predefined callback + * @param hsram : SRAM handle + * @param CallbackId : ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_SRAM_MSP_INIT_CB_ID SRAM MspInit callback ID + * @arg @ref HAL_SRAM_MSP_DEINIT_CB_ID SRAM MspDeInit callback ID + * @arg @ref HAL_SRAM_DMA_XFER_CPLT_CB_ID SRAM DMA Xfer Complete callback ID + * @arg @ref HAL_SRAM_DMA_XFER_ERR_CB_ID SRAM DMA Xfer Error callback ID + * @retval status + */ +HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback (SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SRAM_StateTypeDef state; + + /* Process locked */ + __HAL_LOCK(hsram); + + state = hsram->State; + if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SRAM_MSP_INIT_CB_ID : + hsram->MspInitCallback = HAL_SRAM_MspInit; + break; + case HAL_SRAM_MSP_DEINIT_CB_ID : + hsram->MspDeInitCallback = HAL_SRAM_MspDeInit; + break; + case HAL_SRAM_DMA_XFER_CPLT_CB_ID : + hsram->DmaXferCpltCallback = HAL_SRAM_DMA_XferCpltCallback; + break; + case HAL_SRAM_DMA_XFER_ERR_CB_ID : + hsram->DmaXferErrorCallback = HAL_SRAM_DMA_XferErrorCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else if(state == HAL_SRAM_STATE_RESET) + { + switch (CallbackId) + { + case HAL_SRAM_MSP_INIT_CB_ID : + hsram->MspInitCallback = HAL_SRAM_MspInit; + break; + case HAL_SRAM_MSP_DEINIT_CB_ID : + hsram->MspDeInitCallback = HAL_SRAM_MspDeInit; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsram); + return status; +} + +/** + * @brief Register a User SRAM Callback for DMA transfers + * To be used instead of the weak (surcharged) predefined callback + * @param hsram : SRAM handle + * @param CallbackId : ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_SRAM_DMA_XFER_CPLT_CB_ID SRAM DMA Xfer Complete callback ID + * @arg @ref HAL_SRAM_DMA_XFER_ERR_CB_ID SRAM DMA Xfer Error callback ID + * @param pCallback : pointer to the Callback function + * @retval status + */ +HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_DmaCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_SRAM_StateTypeDef state; + + if(pCallback == NULL) + { + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hsram); + + state = hsram->State; + if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_PROTECTED)) + { + switch (CallbackId) + { + case HAL_SRAM_DMA_XFER_CPLT_CB_ID : + hsram->DmaXferCpltCallback = pCallback; + break; + case HAL_SRAM_DMA_XFER_ERR_CB_ID : + hsram->DmaXferErrorCallback = pCallback; + break; + default : + /* update return status */ + status = HAL_ERROR; + break; + } + } + else + { + /* update return status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hsram); + return status; +} +#endif +/** + * @} + */ + +/** @defgroup SRAM_Exported_Functions_Group3 Control functions + * @brief management functions + * +@verbatim + ============================================================================== + ##### SRAM Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the SRAM interface. + +@endverbatim + * @{ + */ + +/** + * @brief Enables dynamically SRAM write operation. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram) +{ + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Enable write operation */ + FMC_NORSRAM_WriteOperation_Enable(hsram->Instance, hsram->Init.NSBank); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_READY; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @brief Disables dynamically SRAM write operation. + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram) +{ + /* Process Locked */ + __HAL_LOCK(hsram); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_BUSY; + + /* Disable write operation */ + FMC_NORSRAM_WriteOperation_Disable(hsram->Instance, hsram->Init.NSBank); + + /* Update the SRAM controller state */ + hsram->State = HAL_SRAM_STATE_PROTECTED; + + /* Process unlocked */ + __HAL_UNLOCK(hsram); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup SRAM_Exported_Functions_Group4 State functions + * @brief Peripheral State functions + * +@verbatim + ============================================================================== + ##### SRAM State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the SRAM controller + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Returns the SRAM controller state + * @param hsram pointer to a SRAM_HandleTypeDef structure that contains + * the configuration information for SRAM module. + * @retval HAL state + */ +HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram) +{ + return hsram->State; +} +/** + * @} + */ + +/** + * @} + */ +#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ + STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ + STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ +#endif /* HAL_SRAM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c new file mode 100644 index 0000000..eb98d57 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c @@ -0,0 +1,6654 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_tim.c + * @author MCD Application Team + * @brief TIM HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Timer (TIM) peripheral: + * + TIM Time Base Initialization + * + TIM Time Base Start + * + TIM Time Base Start Interruption + * + TIM Time Base Start DMA + * + TIM Output Compare/PWM Initialization + * + TIM Output Compare/PWM Channel Configuration + * + TIM Output Compare/PWM Start + * + TIM Output Compare/PWM Start Interruption + * + TIM Output Compare/PWM Start DMA + * + TIM Input Capture Initialization + * + TIM Input Capture Channel Configuration + * + TIM Input Capture Start + * + TIM Input Capture Start Interruption + * + TIM Input Capture Start DMA + * + TIM One Pulse Initialization + * + TIM One Pulse Channel Configuration + * + TIM One Pulse Start + * + TIM Encoder Interface Initialization + * + TIM Encoder Interface Start + * + TIM Encoder Interface Start Interruption + * + TIM Encoder Interface Start DMA + * + Commutation Event configuration with Interruption and DMA + * + TIM OCRef clear configuration + * + TIM External Clock configuration + @verbatim + ============================================================================== + ##### TIMER Generic features ##### + ============================================================================== + [..] The Timer features include: + (#) 16-bit up, down, up/down auto-reload counter. + (#) 16-bit programmable prescaler allowing dividing (also on the fly) the + counter clock frequency either by any factor between 1 and 65536. + (#) Up to 4 independent channels for: + (++) Input Capture + (++) Output Compare + (++) PWM generation (Edge and Center-aligned Mode) + (++) One-pulse mode output + (#) Synchronization circuit to control the timer with external signals and to interconnect + several timers together. + (#) Supports incremental encoder for positioning purposes + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the TIM low level resources by implementing the following functions + depending on the selected feature: + (++) Time Base : HAL_TIM_Base_MspInit() + (++) Input Capture : HAL_TIM_IC_MspInit() + (++) Output Compare : HAL_TIM_OC_MspInit() + (++) PWM generation : HAL_TIM_PWM_MspInit() + (++) One-pulse mode output : HAL_TIM_OnePulse_MspInit() + (++) Encoder mode output : HAL_TIM_Encoder_MspInit() + + (#) Initialize the TIM low level resources : + (##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE(); + (##) TIM pins configuration + (+++) Enable the clock for the TIM GPIOs using the following function: + __HAL_RCC_GPIOx_CLK_ENABLE(); + (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init(); + + (#) The external Clock can be configured, if needed (the default clock is the + internal clock from the APBx), using the following function: + HAL_TIM_ConfigClockSource, the clock configuration should be done before + any start function. + + (#) Configure the TIM in the desired functioning mode using one of the + Initialization function of this driver: + (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base + (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an + Output Compare signal. + (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a + PWM signal. + (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an + external signal. + (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer + in One Pulse Mode. + (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface. + + (#) Activate the TIM peripheral using one of the start functions depending from the feature used: + (++) Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(), HAL_TIM_Base_Start_IT() + (++) Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(), HAL_TIM_IC_Start_IT() + (++) Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(), HAL_TIM_OC_Start_IT() + (++) PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(), HAL_TIM_PWM_Start_IT() + (++) One-pulse mode output : HAL_TIM_OnePulse_Start(), HAL_TIM_OnePulse_Start_IT() + (++) Encoder mode output : HAL_TIM_Encoder_Start(), HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT(). + + (#) The DMA Burst is managed with the two following functions: + HAL_TIM_DMABurst_WriteStart() + HAL_TIM_DMABurst_ReadStart() + + *** Callback registration *** + ============================================= + + [..] + The compilation define USE_HAL_TIM_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + + [..] + Use Function @ref HAL_TIM_RegisterCallback() to register a callback. + @ref HAL_TIM_RegisterCallback() takes as parameters the HAL peripheral handle, + the Callback ID and a pointer to the user callback function. + + [..] + Use function @ref HAL_TIM_UnRegisterCallback() to reset a callback to the default + weak function. + @ref HAL_TIM_UnRegisterCallback takes as parameters the HAL peripheral handle, + and the Callback ID. + + [..] + These functions allow to register/unregister following callbacks: + (+) Base_MspInitCallback : TIM Base Msp Init Callback. + (+) Base_MspDeInitCallback : TIM Base Msp DeInit Callback. + (+) IC_MspInitCallback : TIM IC Msp Init Callback. + (+) IC_MspDeInitCallback : TIM IC Msp DeInit Callback. + (+) OC_MspInitCallback : TIM OC Msp Init Callback. + (+) OC_MspDeInitCallback : TIM OC Msp DeInit Callback. + (+) PWM_MspInitCallback : TIM PWM Msp Init Callback. + (+) PWM_MspDeInitCallback : TIM PWM Msp DeInit Callback. + (+) OnePulse_MspInitCallback : TIM One Pulse Msp Init Callback. + (+) OnePulse_MspDeInitCallback : TIM One Pulse Msp DeInit Callback. + (+) Encoder_MspInitCallback : TIM Encoder Msp Init Callback. + (+) Encoder_MspDeInitCallback : TIM Encoder Msp DeInit Callback. + (+) HallSensor_MspInitCallback : TIM Hall Sensor Msp Init Callback. + (+) HallSensor_MspDeInitCallback : TIM Hall Sensor Msp DeInit Callback. + (+) PeriodElapsedCallback : TIM Period Elapsed Callback. + (+) PeriodElapsedHalfCpltCallback : TIM Period Elapsed half complete Callback. + (+) TriggerCallback : TIM Trigger Callback. + (+) TriggerHalfCpltCallback : TIM Trigger half complete Callback. + (+) IC_CaptureCallback : TIM Input Capture Callback. + (+) IC_CaptureHalfCpltCallback : TIM Input Capture half complete Callback. + (+) OC_DelayElapsedCallback : TIM Output Compare Delay Elapsed Callback. + (+) PWM_PulseFinishedCallback : TIM PWM Pulse Finished Callback. + (+) PWM_PulseFinishedHalfCpltCallback : TIM PWM Pulse Finished half complete Callback. + (+) ErrorCallback : TIM Error Callback. + (+) CommutationCallback : TIM Commutation Callback. + (+) CommutationHalfCpltCallback : TIM Commutation half complete Callback. + (+) BreakCallback : TIM Break Callback. + + [..] +By default, after the Init and when the state is HAL_TIM_STATE_RESET +all interrupt callbacks are set to the corresponding weak functions: + examples @ref HAL_TIM_TriggerCallback(), @ref HAL_TIM_ErrorCallback(). + + [..] + Exception done for MspInit and MspDeInit functions that are reset to the legacy weak + functionalities in the Init / DeInit only when these callbacks are null + (not registered beforehand). If not, MspInit or MspDeInit are not null, the Init / DeInit + keep and use the user MspInit / MspDeInit callbacks(registered beforehand) + + [..] + Callbacks can be registered / unregistered in HAL_TIM_STATE_READY state only. + Exception done MspInit / MspDeInit that can be registered / unregistered + in HAL_TIM_STATE_READY or HAL_TIM_STATE_RESET state, + thus registered(user) MspInit / DeInit callbacks can be used during the Init / DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_TIM_RegisterCallback() before calling DeInit or Init function. + + [..] + When The compilation define USE_HAL_TIM_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registration feature is not available and all callbacks + are set to the corresponding weak functions. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup TIM TIM + * @brief TIM HAL module driver + * @{ + */ + +#ifdef HAL_TIM_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/** @addtogroup TIM_Private_Functions + * @{ + */ +static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter); +static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter); +static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource); +static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma); +static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig); +/** + * @} + */ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup TIM_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @defgroup TIM_Exported_Functions_Group1 TIM Time Base functions + * @brief Time Base functions + * +@verbatim + ============================================================================== + ##### Time Base functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM base. + (+) De-initialize the TIM base. + (+) Start the Time Base. + (+) Stop the Time Base. + (+) Start the Time Base and enable interrupt. + (+) Stop the Time Base and disable interrupt. + (+) Start the Time Base and enable DMA transfer. + (+) Stop the Time Base and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Time base Unit according to the specified + * parameters in the TIM_HandleTypeDef and initialize the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_Base_DeInit() before HAL_TIM_Base_Init() + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->Base_MspInitCallback == NULL) + { + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->Base_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + HAL_TIM_Base_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Set the Time Base configuration */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM Base peripheral + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->Base_MspDeInitCallback == NULL) + { + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; + } + /* DeInit the low level hardware */ + htim->Base_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_Base_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Base MSP. + * @param htim TIM Base handle + * @retval None + */ +__weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Base_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Base MSP. + * @param htim TIM Base handle + * @retval None + */ +__weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Base_MspDeInit could be implemented in the user file + */ +} + + +/** + * @brief Starts the TIM Base generation. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Change the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Base generation in interrupt mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Enable the TIM Update interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation in interrupt mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + /* Disable the TIM Update interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_UPDATE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Base generation in DMA mode. + * @param htim TIM Base handle + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_DMA_INSTANCE(htim->Instance)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, Length) != HAL_OK) + { + return HAL_ERROR; + } + + /* Enable the TIM Update DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_UPDATE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation in DMA mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_INSTANCE(htim->Instance)); + + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_UPDATE); + + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group2 TIM Output Compare functions + * @brief TIM Output Compare functions + * +@verbatim + ============================================================================== + ##### TIM Output Compare functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Output Compare. + (+) De-initialize the TIM Output Compare. + (+) Start the TIM Output Compare. + (+) Stop the TIM Output Compare. + (+) Start the TIM Output Compare and enable interrupt. + (+) Stop the TIM Output Compare and disable interrupt. + (+) Start the TIM Output Compare and enable DMA transfer. + (+) Stop the TIM Output Compare and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Output Compare according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_OC_DeInit() before HAL_TIM_OC_Init() + * @param htim TIM Output Compare handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->OC_MspInitCallback == NULL) + { + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->OC_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OC_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the Output Compare */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM Output Compare handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->OC_MspDeInitCallback == NULL) + { + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; + } + /* DeInit the low level hardware */ + htim->OC_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OC_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Output Compare MSP. + * @param htim TIM Output Compare handle + * @retval None + */ +__weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Output Compare MSP. + * @param htim TIM Output Compare handle + * @retval None + */ +__weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Output Compare signal generation. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in interrupt mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in interrupt mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in DMA mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK) + { + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK) + { + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in DMA mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group3 TIM PWM functions + * @brief TIM PWM functions + * +@verbatim + ============================================================================== + ##### TIM PWM functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM PWM. + (+) De-initialize the TIM PWM. + (+) Start the TIM PWM. + (+) Stop the TIM PWM. + (+) Start the TIM PWM and enable interrupt. + (+) Stop the TIM PWM and disable interrupt. + (+) Start the TIM PWM and enable DMA transfer. + (+) Stop the TIM PWM and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM PWM Time Base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_PWM_DeInit() before HAL_TIM_PWM_Init() + * @param htim TIM PWM handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->PWM_MspInitCallback == NULL) + { + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->PWM_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_PWM_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the PWM */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM PWM handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->PWM_MspDeInitCallback == NULL) + { + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; + } + /* DeInit the low level hardware */ + htim->PWM_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_PWM_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM PWM MSP. + * @param htim TIM PWM handle + * @retval None + */ +__weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM PWM MSP. + * @param htim TIM PWM handle + * @retval None + */ +__weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the PWM signal generation. + * @param htim TIM handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the PWM signal generation in interrupt mode. + * @param htim TIM PWM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation in interrupt mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM PWM signal generation in DMA mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK) + { + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Output Capture/Compare 3 request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM PWM signal generation in DMA mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group4 TIM Input Capture functions + * @brief TIM Input Capture functions + * +@verbatim + ============================================================================== + ##### TIM Input Capture functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Input Capture. + (+) De-initialize the TIM Input Capture. + (+) Start the TIM Input Capture. + (+) Stop the TIM Input Capture. + (+) Start the TIM Input Capture and enable interrupt. + (+) Stop the TIM Input Capture and disable interrupt. + (+) Start the TIM Input Capture and enable DMA transfer. + (+) Stop the TIM Input Capture and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Input Capture Time base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_IC_DeInit() before HAL_TIM_IC_Init() + * @param htim TIM Input Capture handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->IC_MspInitCallback == NULL) + { + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->IC_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_IC_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the input capture */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM Input Capture handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->IC_MspDeInitCallback == NULL) + { + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; + } + /* DeInit the low level hardware */ + htim->IC_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_IC_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Input Capture MSP. + * @param htim TIM Input Capture handle + * @retval None + */ +__weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Input Capture MSP. + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Input Capture measurement. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Input Capture measurement in interrupt mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement in interrupt mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Input Capture measurement in DMA mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The destination Buffer address. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->CCR3, (uint32_t)pData, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->CCR4, (uint32_t)pData, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement in DMA mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group5 TIM One Pulse functions + * @brief TIM One Pulse functions + * +@verbatim + ============================================================================== + ##### TIM One Pulse functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM One Pulse. + (+) De-initialize the TIM One Pulse. + (+) Start the TIM One Pulse. + (+) Stop the TIM One Pulse. + (+) Start the TIM One Pulse and enable interrupt. + (+) Stop the TIM One Pulse and disable interrupt. + (+) Start the TIM One Pulse and enable DMA transfer. + (+) Stop the TIM One Pulse and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM One Pulse Time Base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_OnePulse_DeInit() before HAL_TIM_OnePulse_Init() + * @param htim TIM One Pulse handle + * @param OnePulseMode Select the One pulse mode. + * This parameter can be one of the following values: + * @arg TIM_OPMODE_SINGLE: Only one pulse will be generated. + * @arg TIM_OPMODE_REPETITIVE: Repetitive pulses will be generated. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_OPM_MODE(OnePulseMode)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->OnePulse_MspInitCallback == NULL) + { + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->OnePulse_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OnePulse_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Configure the Time base in the One Pulse Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Reset the OPM Bit */ + htim->Instance->CR1 &= ~TIM_CR1_OPM; + + /* Configure the OPM Mode */ + htim->Instance->CR1 |= OnePulseMode; + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM One Pulse + * @param htim TIM One Pulse handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->OnePulse_MspDeInitCallback == NULL) + { + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; + } + /* DeInit the low level hardware */ + htim->OnePulse_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_OnePulse_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM One Pulse MSP. + * @param htim TIM One Pulse handle + * @retval None + */ +__weak void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OnePulse_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM One Pulse MSP. + * @param htim TIM One Pulse handle + * @retval None + */ +__weak void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OnePulse_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM One Pulse signal generation. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Enable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together + + No need to enable the counter, it's enabled automatically by hardware + (the counter starts in response to a stimulus and generate a pulse */ + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channels to be disable + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Disable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */ + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM One Pulse signal generation in interrupt mode. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Enable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together + + No need to enable the counter, it's enabled automatically by hardware + (the counter starts in response to a stimulus and generate a pulse */ + + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation in interrupt mode. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + + /* Disable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group6 TIM Encoder functions + * @brief TIM Encoder functions + * +@verbatim + ============================================================================== + ##### TIM Encoder functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Encoder. + (+) De-initialize the TIM Encoder. + (+) Start the TIM Encoder. + (+) Stop the TIM Encoder. + (+) Start the TIM Encoder and enable interrupt. + (+) Stop the TIM Encoder and disable interrupt. + (+) Start the TIM Encoder and enable DMA transfer. + (+) Stop the TIM Encoder and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Encoder Interface and initialize the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_Encoder_DeInit() before HAL_TIM_Encoder_Init() + * @note Encoder mode and External clock mode 2 are not compatible and must not be selected together + * Ex: A call for @ref HAL_TIM_Encoder_Init will erase the settings of @ref HAL_TIM_ConfigClockSource + * using TIM_CLOCKSOURCE_ETRMODE2 and vice versa + * @param htim TIM Encoder Interface handle + * @param sConfig TIM Encoder Interface configuration structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig) +{ + uint32_t tmpsmcr; + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + assert_param(IS_TIM_ENCODER_MODE(sConfig->EncoderMode)); + assert_param(IS_TIM_IC_SELECTION(sConfig->IC1Selection)); + assert_param(IS_TIM_IC_SELECTION(sConfig->IC2Selection)); + assert_param(IS_TIM_ENCODERINPUT_POLARITY(sConfig->IC1Polarity)); + assert_param(IS_TIM_ENCODERINPUT_POLARITY(sConfig->IC2Polarity)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC1Prescaler)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC2Prescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC2Filter)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->Encoder_MspInitCallback == NULL) + { + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->Encoder_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_Encoder_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Reset the SMS and ECE bits */ + htim->Instance->SMCR &= ~(TIM_SMCR_SMS | TIM_SMCR_ECE); + + /* Configure the Time base in the Encoder Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = htim->Instance->CCMR1; + + /* Get the TIMx CCER register value */ + tmpccer = htim->Instance->CCER; + + /* Set the encoder Mode */ + tmpsmcr |= sConfig->EncoderMode; + + /* Select the Capture Compare 1 and the Capture Compare 2 as input */ + tmpccmr1 &= ~(TIM_CCMR1_CC1S | TIM_CCMR1_CC2S); + tmpccmr1 |= (sConfig->IC1Selection | (sConfig->IC2Selection << 8U)); + + /* Set the Capture Compare 1 and the Capture Compare 2 prescalers and filters */ + tmpccmr1 &= ~(TIM_CCMR1_IC1PSC | TIM_CCMR1_IC2PSC); + tmpccmr1 &= ~(TIM_CCMR1_IC1F | TIM_CCMR1_IC2F); + tmpccmr1 |= sConfig->IC1Prescaler | (sConfig->IC2Prescaler << 8U); + tmpccmr1 |= (sConfig->IC1Filter << 4U) | (sConfig->IC2Filter << 12U); + + /* Set the TI1 and the TI2 Polarities */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC2P); + tmpccer &= ~(TIM_CCER_CC1NP | TIM_CCER_CC2NP); + tmpccer |= sConfig->IC1Polarity | (sConfig->IC2Polarity << 4U); + + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + + /* Write to TIMx CCMR1 */ + htim->Instance->CCMR1 = tmpccmr1; + + /* Write to TIMx CCER */ + htim->Instance->CCER = tmpccer; + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + + +/** + * @brief DeInitializes the TIM Encoder interface + * @param htim TIM Encoder Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->Encoder_MspDeInitCallback == NULL) + { + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; + } + /* DeInit the low level hardware */ + htim->Encoder_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_Encoder_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Encoder Interface MSP. + * @param htim TIM Encoder Interface handle + * @retval None + */ +__weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Encoder_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Encoder Interface MSP. + * @param htim TIM Encoder Interface handle + * @retval None + */ +__weak void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Encoder_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Encoder Interface. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Enable the encoder interface channels */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + } + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + break; + } + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Encoder Interface in interrupt mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Enable the encoder interface channels */ + /* Enable the capture compare Interrupts 1 and/or 2 */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + } + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface in interrupt mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + if (Channel == TIM_CHANNEL_1) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 1 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + } + else if (Channel == TIM_CHANNEL_2) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 2 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + } + else + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 1 and 2 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Encoder Interface in DMA mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @param pData1 The destination Buffer address for IC1. + * @param pData2 The destination Buffer address for IC2. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, + uint32_t *pData2, uint16_t Length) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((((pData1 == NULL) || (pData2 == NULL))) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError; + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_ALL: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK) + { + return HAL_ERROR; + } + + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + default: + break; + } + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface in DMA mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + if (Channel == TIM_CHANNEL_1) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 1 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + } + else if (Channel == TIM_CHANNEL_2) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 2 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + } + else + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 1 and 2 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ +/** @defgroup TIM_Exported_Functions_Group7 TIM IRQ handler management + * @brief TIM IRQ handler management + * +@verbatim + ============================================================================== + ##### IRQ handler management ##### + ============================================================================== + [..] + This section provides Timer IRQ handler function. + +@endverbatim + * @{ + */ +/** + * @brief This function handles TIM interrupts requests. + * @param htim TIM handle + * @retval None + */ +void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) +{ + /* Capture compare 1 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC1) != RESET) + { + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC1); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + + /* Input capture event */ + if ((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + } + /* Capture compare 2 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC2) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC2); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + /* Input capture event */ + if ((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* Capture compare 3 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC3) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC3); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + /* Input capture event */ + if ((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* Capture compare 4 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC4) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC4); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + /* Input capture event */ + if ((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* TIM Update event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedCallback(htim); +#else + HAL_TIM_PeriodElapsedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM Break input event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_BREAK) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_BREAK); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->BreakCallback(htim); +#else + HAL_TIMEx_BreakCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM Trigger detection event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_TRIGGER) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_TRIGGER) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_TRIGGER); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerCallback(htim); +#else + HAL_TIM_TriggerCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM commutation event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_COM) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_FLAG_COM); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationCallback(htim); +#else + HAL_TIMEx_CommutCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group8 TIM Peripheral Control functions + * @brief TIM Peripheral Control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Configure The Input Output channels for OC, PWM, IC or One Pulse mode. + (+) Configure External Clock source. + (+) Configure Complementary channels, break features and dead time. + (+) Configure Master and the Slave synchronization. + (+) Configure the DMA Burst Mode. + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the TIM Output Compare Channels according to the specified + * parameters in the TIM_OC_InitTypeDef. + * @param htim TIM Output Compare handle + * @param sConfig TIM Output Compare configuration structure + * @param Channel TIM Channels to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, + TIM_OC_InitTypeDef *sConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CHANNELS(Channel)); + assert_param(IS_TIM_OC_MODE(sConfig->OCMode)); + assert_param(IS_TIM_OC_POLARITY(sConfig->OCPolarity)); + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 1 in Output Compare */ + TIM_OC1_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 2 in Output Compare */ + TIM_OC2_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 3 in Output Compare */ + TIM_OC3_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 4 in Output Compare */ + TIM_OC4_SetConfig(htim->Instance, sConfig); + break; + } + + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Input Capture Channels according to the specified + * parameters in the TIM_IC_InitTypeDef. + * @param htim TIM IC handle + * @param sConfig TIM Input Capture configuration structure + * @param Channel TIM Channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_IC_POLARITY(sConfig->ICPolarity)); + assert_param(IS_TIM_IC_SELECTION(sConfig->ICSelection)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->ICPrescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->ICFilter)); + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + if (Channel == TIM_CHANNEL_1) + { + /* TI1 Configuration */ + TIM_TI1_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + + /* Set the IC1PSC value */ + htim->Instance->CCMR1 |= sConfig->ICPrescaler; + } + else if (Channel == TIM_CHANNEL_2) + { + /* TI2 Configuration */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_TI2_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC2PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC; + + /* Set the IC2PSC value */ + htim->Instance->CCMR1 |= (sConfig->ICPrescaler << 8U); + } + else if (Channel == TIM_CHANNEL_3) + { + /* TI3 Configuration */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + TIM_TI3_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC3PSC Bits */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC; + + /* Set the IC3PSC value */ + htim->Instance->CCMR2 |= sConfig->ICPrescaler; + } + else + { + /* TI4 Configuration */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + TIM_TI4_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC4PSC Bits */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC; + + /* Set the IC4PSC value */ + htim->Instance->CCMR2 |= (sConfig->ICPrescaler << 8U); + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM PWM channels according to the specified + * parameters in the TIM_OC_InitTypeDef. + * @param htim TIM PWM handle + * @param sConfig TIM PWM configuration structure + * @param Channel TIM Channels to be configured + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, + TIM_OC_InitTypeDef *sConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CHANNELS(Channel)); + assert_param(IS_TIM_PWM_MODE(sConfig->OCMode)); + assert_param(IS_TIM_OC_POLARITY(sConfig->OCPolarity)); + assert_param(IS_TIM_FAST_STATE(sConfig->OCFastMode)); + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Configure the Channel 1 in PWM mode */ + TIM_OC1_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel1 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC1PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE; + htim->Instance->CCMR1 |= sConfig->OCFastMode; + break; + } + + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Configure the Channel 2 in PWM mode */ + TIM_OC2_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel2 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC2PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE; + htim->Instance->CCMR1 |= sConfig->OCFastMode << 8U; + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Configure the Channel 3 in PWM mode */ + TIM_OC3_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel3 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC3PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE; + htim->Instance->CCMR2 |= sConfig->OCFastMode; + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Configure the Channel 4 in PWM mode */ + TIM_OC4_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel4 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC4PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE; + htim->Instance->CCMR2 |= sConfig->OCFastMode << 8U; + break; + } + + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM One Pulse Channels according to the specified + * parameters in the TIM_OnePulse_InitTypeDef. + * @param htim TIM One Pulse handle + * @param sConfig TIM One Pulse configuration structure + * @param OutputChannel TIM output channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @param InputChannel TIM input Channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @note To output a waveform with a minimum delay user can enable the fast + * mode by calling the @ref __HAL_TIM_ENABLE_OCxFAST macro. Then CCx + * output is forced in response to the edge detection on TIx input, + * without taking in account the comparison. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, + uint32_t OutputChannel, uint32_t InputChannel) +{ + TIM_OC_InitTypeDef temp1; + + /* Check the parameters */ + assert_param(IS_TIM_OPM_CHANNELS(OutputChannel)); + assert_param(IS_TIM_OPM_CHANNELS(InputChannel)); + + if (OutputChannel != InputChannel) + { + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Extract the Output compare configuration from sConfig structure */ + temp1.OCMode = sConfig->OCMode; + temp1.Pulse = sConfig->Pulse; + temp1.OCPolarity = sConfig->OCPolarity; + temp1.OCNPolarity = sConfig->OCNPolarity; + temp1.OCIdleState = sConfig->OCIdleState; + temp1.OCNIdleState = sConfig->OCNIdleState; + + switch (OutputChannel) + { + case TIM_CHANNEL_1: + { + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + TIM_OC1_SetConfig(htim->Instance, &temp1); + break; + } + case TIM_CHANNEL_2: + { + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_OC2_SetConfig(htim->Instance, &temp1); + break; + } + default: + break; + } + + switch (InputChannel) + { + case TIM_CHANNEL_1: + { + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity, + sConfig->ICSelection, sConfig->ICFilter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + + /* Select the Trigger source */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI1FP1; + + /* Select the Slave Mode */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER; + break; + } + case TIM_CHANNEL_2: + { + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity, + sConfig->ICSelection, sConfig->ICFilter); + + /* Reset the IC2PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC; + + /* Select the Trigger source */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI2FP2; + + /* Select the Slave Mode */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER; + break; + } + + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; + } + else + { + return HAL_ERROR; + } +} + +/** + * @brief Configure the DMA Burst to transfer Data from the memory to the TIM peripheral + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data write + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @note This function should be used only when BurstLength is equal to DMA data transfer length. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, + uint32_t *BurstBuffer, uint32_t BurstLength) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance)); + assert_param(IS_TIM_DMA_BASE(BurstBaseAddress)); + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + assert_param(IS_TIM_DMA_LENGTH(BurstLength)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((BurstBuffer == NULL) && (BurstLength > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_COM: + { + /* Set the DMA commutation callbacks */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_TRIGGER: + { + /* Set the DMA trigger callbacks */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt; + htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + default: + break; + } + /* configure the DMA Burst Mode */ + htim->Instance->DCR = (BurstBaseAddress | BurstLength); + + /* Enable the TIM DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc); + + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM DMA Burst mode + * @param htim TIM handle + * @param BurstRequestSrc TIM DMA Request sources to disable + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc) +{ + HAL_StatusTypeDef status = HAL_OK; + /* Check the parameters */ + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + + /* Abort the DMA transfer (at least disable the DMA stream) */ + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + break; + } + case TIM_DMA_CC1: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + case TIM_DMA_CC2: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + case TIM_DMA_CC3: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + case TIM_DMA_CC4: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + case TIM_DMA_COM: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]); + break; + } + case TIM_DMA_TRIGGER: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]); + break; + } + default: + break; + } + + if (HAL_OK == status) + { + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc); + } + + /* Return function status */ + return status; +} + +/** + * @brief Configure the DMA Burst to transfer Data from the TIM peripheral to the memory + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data read + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @note This function should be used only when BurstLength is equal to DMA data transfer length. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance)); + assert_param(IS_TIM_DMA_BASE(BurstBaseAddress)); + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + assert_param(IS_TIM_DMA_LENGTH(BurstLength)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((BurstBuffer == NULL) && (BurstLength > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC2: + { + /* Set the DMA capture/compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC3: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC4: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_COM: + { + /* Set the DMA commutation callbacks */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + case TIM_DMA_TRIGGER: + { + /* Set the DMA trigger callbacks */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt; + htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK) + { + return HAL_ERROR; + } + break; + } + default: + break; + } + + /* configure the DMA Burst Mode */ + htim->Instance->DCR = (BurstBaseAddress | BurstLength); + + /* Enable the TIM DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc); + + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stop the DMA burst reading + * @param htim TIM handle + * @param BurstRequestSrc TIM DMA Request sources to disable. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc) +{ + HAL_StatusTypeDef status = HAL_OK; + /* Check the parameters */ + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + + /* Abort the DMA transfer (at least disable the DMA stream) */ + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + break; + } + case TIM_DMA_CC1: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + case TIM_DMA_CC2: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + case TIM_DMA_CC3: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + case TIM_DMA_CC4: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + case TIM_DMA_COM: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]); + break; + } + case TIM_DMA_TRIGGER: + { + status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]); + break; + } + default: + break; + } + + if (HAL_OK == status) + { + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc); + } + + /* Return function status */ + return status; +} + +/** + * @brief Generate a software event + * @param htim TIM handle + * @param EventSource specifies the event source. + * This parameter can be one of the following values: + * @arg TIM_EVENTSOURCE_UPDATE: Timer update Event source + * @arg TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source + * @arg TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source + * @arg TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source + * @arg TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source + * @arg TIM_EVENTSOURCE_COM: Timer COM event source + * @arg TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source + * @arg TIM_EVENTSOURCE_BREAK: Timer Break event source + * @note Basic timers can only generate an update event. + * @note TIM_EVENTSOURCE_COM is relevant only with advanced timer instances. + * @note TIM_EVENTSOURCE_BREAK are relevant only for timer instances + * supporting a break input. + * @retval HAL status + */ + +HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_EVENT_SOURCE(EventSource)); + + /* Process Locked */ + __HAL_LOCK(htim); + + /* Change the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Set the event sources */ + htim->Instance->EGR = EventSource; + + /* Change the TIM state */ + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Configures the OCRef clear feature + * @param htim TIM handle + * @param sClearInputConfig pointer to a TIM_ClearInputConfigTypeDef structure that + * contains the OCREF clear feature and parameters for the TIM peripheral. + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, + TIM_ClearInputConfigTypeDef *sClearInputConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_OCXREF_CLEAR_INSTANCE(htim->Instance)); + assert_param(IS_TIM_CLEARINPUT_SOURCE(sClearInputConfig->ClearInputSource)); + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + switch (sClearInputConfig->ClearInputSource) + { + case TIM_CLEARINPUTSOURCE_NONE: + { + /* Clear the OCREF clear selection bit and the the ETR Bits */ + CLEAR_BIT(htim->Instance->SMCR, (TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP)); + break; + } + + case TIM_CLEARINPUTSOURCE_ETR: + { + /* Check the parameters */ + assert_param(IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity)); + assert_param(IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler)); + assert_param(IS_TIM_CLEARINPUT_FILTER(sClearInputConfig->ClearInputFilter)); + + /* When OCRef clear feature is used with ETR source, ETR prescaler must be off */ + if (sClearInputConfig->ClearInputPrescaler != TIM_CLEARINPUTPRESCALER_DIV1) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + TIM_ETR_SetConfig(htim->Instance, + sClearInputConfig->ClearInputPrescaler, + sClearInputConfig->ClearInputPolarity, + sClearInputConfig->ClearInputFilter); + break; + } + + default: + break; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 1 */ + SET_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC1CE); + } + else + { + /* Disable the OCREF clear feature for Channel 1 */ + CLEAR_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC1CE); + } + break; + } + case TIM_CHANNEL_2: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 2 */ + SET_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC2CE); + } + else + { + /* Disable the OCREF clear feature for Channel 2 */ + CLEAR_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC2CE); + } + break; + } + case TIM_CHANNEL_3: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 3 */ + SET_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC3CE); + } + else + { + /* Disable the OCREF clear feature for Channel 3 */ + CLEAR_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC3CE); + } + break; + } + case TIM_CHANNEL_4: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 4 */ + SET_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC4CE); + } + else + { + /* Disable the OCREF clear feature for Channel 4 */ + CLEAR_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC4CE); + } + break; + } + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the clock source to be used + * @param htim TIM handle + * @param sClockSourceConfig pointer to a TIM_ClockConfigTypeDef structure that + * contains the clock source information for the TIM peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig) +{ + uint32_t tmpsmcr; + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Check the parameters */ + assert_param(IS_TIM_CLOCKSOURCE(sClockSourceConfig->ClockSource)); + + /* Reset the SMS, TS, ECE, ETPS and ETRF bits */ + tmpsmcr = htim->Instance->SMCR; + tmpsmcr &= ~(TIM_SMCR_SMS | TIM_SMCR_TS); + tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); + htim->Instance->SMCR = tmpsmcr; + + switch (sClockSourceConfig->ClockSource) + { + case TIM_CLOCKSOURCE_INTERNAL: + { + assert_param(IS_TIM_INSTANCE(htim->Instance)); + break; + } + + case TIM_CLOCKSOURCE_ETRMODE1: + { + /* Check whether or not the timer instance supports external trigger input mode 1 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance)); + + /* Check ETR input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler)); + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + /* Configure the ETR Clock source */ + TIM_ETR_SetConfig(htim->Instance, + sClockSourceConfig->ClockPrescaler, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + + /* Select the External clock mode1 and the ETRF trigger */ + tmpsmcr = htim->Instance->SMCR; + tmpsmcr |= (TIM_SLAVEMODE_EXTERNAL1 | TIM_CLOCKSOURCE_ETRMODE1); + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + break; + } + + case TIM_CLOCKSOURCE_ETRMODE2: + { + /* Check whether or not the timer instance supports external trigger input mode 2 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(htim->Instance)); + + /* Check ETR input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler)); + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + /* Configure the ETR Clock source */ + TIM_ETR_SetConfig(htim->Instance, + sClockSourceConfig->ClockPrescaler, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + /* Enable the External clock mode2 */ + htim->Instance->SMCR |= TIM_SMCR_ECE; + break; + } + + case TIM_CLOCKSOURCE_TI1: + { + /* Check whether or not the timer instance supports external clock mode 1 */ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI1 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI1_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1); + break; + } + + case TIM_CLOCKSOURCE_TI2: + { + /* Check whether or not the timer instance supports external clock mode 1 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI2 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI2_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI2); + break; + } + + case TIM_CLOCKSOURCE_TI1ED: + { + /* Check whether or not the timer instance supports external clock mode 1 */ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI1 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI1_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1ED); + break; + } + + case TIM_CLOCKSOURCE_ITR0: + case TIM_CLOCKSOURCE_ITR1: + case TIM_CLOCKSOURCE_ITR2: + case TIM_CLOCKSOURCE_ITR3: + { + /* Check whether or not the timer instance supports internal trigger input */ + assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance)); + + TIM_ITRx_SetConfig(htim->Instance, sClockSourceConfig->ClockSource); + break; + } + + default: + break; + } + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Selects the signal connected to the TI1 input: direct from CH1_input + * or a XOR combination between CH1_input, CH2_input & CH3_input + * @param htim TIM handle. + * @param TI1_Selection Indicate whether or not channel 1 is connected to the + * output of a XOR gate. + * This parameter can be one of the following values: + * @arg TIM_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1 input + * @arg TIM_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3 + * pins are connected to the TI1 input (XOR combination) + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection) +{ + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_XOR_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TI1SELECTION(TI1_Selection)); + + /* Get the TIMx CR2 register value */ + tmpcr2 = htim->Instance->CR2; + + /* Reset the TI1 selection */ + tmpcr2 &= ~TIM_CR2_TI1S; + + /* Set the TI1 selection */ + tmpcr2 |= TI1_Selection; + + /* Write to TIMxCR2 */ + htim->Instance->CR2 = tmpcr2; + + return HAL_OK; +} + +/** + * @brief Configures the TIM in Slave mode + * @param htim TIM handle. + * @param sSlaveConfig pointer to a TIM_SlaveConfigTypeDef structure that + * contains the selected trigger (internal trigger input, filtered + * timer input or external trigger input) and the Slave mode + * (Disable, Reset, Gated, Trigger, External clock mode 1). + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + /* Check the parameters */ + assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode)); + assert_param(IS_TIM_TRIGGER_SELECTION(sSlaveConfig->InputTrigger)); + + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + /* Disable Trigger Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_TRIGGER); + + /* Disable Trigger DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_TRIGGER); + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIM in Slave mode in interrupt mode + * @param htim TIM handle. + * @param sSlaveConfig pointer to a TIM_SlaveConfigTypeDef structure that + * contains the selected trigger (internal trigger input, filtered + * timer input or external trigger input) and the Slave mode + * (Disable, Reset, Gated, Trigger, External clock mode 1). + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + /* Check the parameters */ + assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode)); + assert_param(IS_TIM_TRIGGER_SELECTION(sSlaveConfig->InputTrigger)); + + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + /* Enable Trigger Interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_TRIGGER); + + /* Disable Trigger DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_TRIGGER); + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Read the captured value from Capture Compare unit + * @param htim TIM handle. + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval Captured value + */ +uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpreg = 0U; + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Return the capture 1 value */ + tmpreg = htim->Instance->CCR1; + + break; + } + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Return the capture 2 value */ + tmpreg = htim->Instance->CCR2; + + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Return the capture 3 value */ + tmpreg = htim->Instance->CCR3; + + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Return the capture 4 value */ + tmpreg = htim->Instance->CCR4; + + break; + } + + default: + break; + } + + return tmpreg; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group9 TIM Callbacks functions + * @brief TIM Callbacks functions + * +@verbatim + ============================================================================== + ##### TIM Callbacks functions ##### + ============================================================================== + [..] + This section provides TIM callback functions: + (+) TIM Period elapsed callback + (+) TIM Output Compare callback + (+) TIM Input capture callback + (+) TIM Trigger callback + (+) TIM Error callback + +@endverbatim + * @{ + */ + +/** + * @brief Period elapsed callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PeriodElapsedCallback could be implemented in the user file + */ +} + +/** + * @brief Period elapsed half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PeriodElapsedHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Output Compare callback in non-blocking mode + * @param htim TIM OC handle + * @retval None + */ +__weak void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_DelayElapsedCallback could be implemented in the user file + */ +} + +/** + * @brief Input Capture callback in non-blocking mode + * @param htim TIM IC handle + * @retval None + */ +__weak void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_CaptureCallback could be implemented in the user file + */ +} + +/** + * @brief Input Capture half complete callback in non-blocking mode + * @param htim TIM IC handle + * @retval None + */ +__weak void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_CaptureHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief PWM Pulse finished callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_PulseFinishedCallback could be implemented in the user file + */ +} + +/** + * @brief PWM Pulse finished half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_PulseFinishedHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Trigger detection callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_TriggerCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Trigger detection half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_TriggerHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Timer error callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_ErrorCallback could be implemented in the user file + */ +} + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief Register a User TIM callback to be used instead of the weak predefined callback + * @param htim tim handle + * @param CallbackID ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_TIM_BASE_MSPINIT_CB_ID Base MspInit Callback ID + * @arg @ref HAL_TIM_BASE_MSPDEINIT_CB_ID Base MspDeInit Callback ID + * @arg @ref HAL_TIM_IC_MSPINIT_CB_ID IC MspInit Callback ID + * @arg @ref HAL_TIM_IC_MSPDEINIT_CB_ID IC MspDeInit Callback ID + * @arg @ref HAL_TIM_OC_MSPINIT_CB_ID OC MspInit Callback ID + * @arg @ref HAL_TIM_OC_MSPDEINIT_CB_ID OC MspDeInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPINIT_CB_ID PWM MspInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPDEINIT_CB_ID PWM MspDeInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPINIT_CB_ID One Pulse MspInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID One Pulse MspDeInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPINIT_CB_ID Encoder MspInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPDEINIT_CB_ID Encoder MspDeInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID Hall Sensor MspInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID Hall Sensor MspDeInit Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_CB_ID Period Elapsed Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID Period Elapsed half complete Callback ID + * @arg @ref HAL_TIM_TRIGGER_CB_ID Trigger Callback ID + * @arg @ref HAL_TIM_TRIGGER_HALF_CB_ID Trigger half complete Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_CB_ID Input Capture Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_HALF_CB_ID Input Capture half complete Callback ID + * @arg @ref HAL_TIM_OC_DELAY_ELAPSED_CB_ID Output Compare Delay Elapsed Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_CB_ID PWM Pulse Finished Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID PWM Pulse Finished half complete Callback ID + * @arg @ref HAL_TIM_ERROR_CB_ID Error Callback ID + * @arg @ref HAL_TIM_COMMUTATION_CB_ID Commutation Callback ID + * @arg @ref HAL_TIM_COMMUTATION_HALF_CB_ID Commutation half complete Callback ID + * @arg @ref HAL_TIM_BREAK_CB_ID Break Callback ID + * @param pCallback pointer to the callback function + * @retval status + */ +HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, + pTIM_CallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + return HAL_ERROR; + } + /* Process locked */ + __HAL_LOCK(htim); + + if (htim->State == HAL_TIM_STATE_READY) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = pCallback; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PERIOD_ELAPSED_CB_ID : + htim->PeriodElapsedCallback = pCallback; + break; + + case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID : + htim->PeriodElapsedHalfCpltCallback = pCallback; + break; + + case HAL_TIM_TRIGGER_CB_ID : + htim->TriggerCallback = pCallback; + break; + + case HAL_TIM_TRIGGER_HALF_CB_ID : + htim->TriggerHalfCpltCallback = pCallback; + break; + + case HAL_TIM_IC_CAPTURE_CB_ID : + htim->IC_CaptureCallback = pCallback; + break; + + case HAL_TIM_IC_CAPTURE_HALF_CB_ID : + htim->IC_CaptureHalfCpltCallback = pCallback; + break; + + case HAL_TIM_OC_DELAY_ELAPSED_CB_ID : + htim->OC_DelayElapsedCallback = pCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_CB_ID : + htim->PWM_PulseFinishedCallback = pCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID : + htim->PWM_PulseFinishedHalfCpltCallback = pCallback; + break; + + case HAL_TIM_ERROR_CB_ID : + htim->ErrorCallback = pCallback; + break; + + case HAL_TIM_COMMUTATION_CB_ID : + htim->CommutationCallback = pCallback; + break; + + case HAL_TIM_COMMUTATION_HALF_CB_ID : + htim->CommutationHalfCpltCallback = pCallback; + break; + + case HAL_TIM_BREAK_CB_ID : + htim->BreakCallback = pCallback; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (htim->State == HAL_TIM_STATE_RESET) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = pCallback; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = pCallback; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return status; +} + +/** + * @brief Unregister a TIM callback + * TIM callback is redirected to the weak predefined callback + * @param htim tim handle + * @param CallbackID ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_TIM_BASE_MSPINIT_CB_ID Base MspInit Callback ID + * @arg @ref HAL_TIM_BASE_MSPDEINIT_CB_ID Base MspDeInit Callback ID + * @arg @ref HAL_TIM_IC_MSPINIT_CB_ID IC MspInit Callback ID + * @arg @ref HAL_TIM_IC_MSPDEINIT_CB_ID IC MspDeInit Callback ID + * @arg @ref HAL_TIM_OC_MSPINIT_CB_ID OC MspInit Callback ID + * @arg @ref HAL_TIM_OC_MSPDEINIT_CB_ID OC MspDeInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPINIT_CB_ID PWM MspInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPDEINIT_CB_ID PWM MspDeInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPINIT_CB_ID One Pulse MspInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID One Pulse MspDeInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPINIT_CB_ID Encoder MspInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPDEINIT_CB_ID Encoder MspDeInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID Hall Sensor MspInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID Hall Sensor MspDeInit Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_CB_ID Period Elapsed Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID Period Elapsed half complete Callback ID + * @arg @ref HAL_TIM_TRIGGER_CB_ID Trigger Callback ID + * @arg @ref HAL_TIM_TRIGGER_HALF_CB_ID Trigger half complete Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_CB_ID Input Capture Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_HALF_CB_ID Input Capture half complete Callback ID + * @arg @ref HAL_TIM_OC_DELAY_ELAPSED_CB_ID Output Compare Delay Elapsed Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_CB_ID PWM Pulse Finished Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID PWM Pulse Finished half complete Callback ID + * @arg @ref HAL_TIM_ERROR_CB_ID Error Callback ID + * @arg @ref HAL_TIM_COMMUTATION_CB_ID Commutation Callback ID + * @arg @ref HAL_TIM_COMMUTATION_HALF_CB_ID Commutation half complete Callback ID + * @arg @ref HAL_TIM_BREAK_CB_ID Break Callback ID + * @retval status + */ +HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(htim); + + if (htim->State == HAL_TIM_STATE_READY) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */ + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */ + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */ + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */ + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */ + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */ + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */ + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */ + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */ + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */ + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */ + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */ + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */ + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */ + break; + + case HAL_TIM_PERIOD_ELAPSED_CB_ID : + htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak Period Elapsed Callback */ + break; + + case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID : + htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak Period Elapsed half complete Callback */ + break; + + case HAL_TIM_TRIGGER_CB_ID : + htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak Trigger Callback */ + break; + + case HAL_TIM_TRIGGER_HALF_CB_ID : + htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak Trigger half complete Callback */ + break; + + case HAL_TIM_IC_CAPTURE_CB_ID : + htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC Capture Callback */ + break; + + case HAL_TIM_IC_CAPTURE_HALF_CB_ID : + htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC Capture half complete Callback */ + break; + + case HAL_TIM_OC_DELAY_ELAPSED_CB_ID : + htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC Delay Elapsed Callback */ + break; + + case HAL_TIM_PWM_PULSE_FINISHED_CB_ID : + htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM Pulse Finished Callback */ + break; + + case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID : + htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM Pulse Finished half complete Callback */ + break; + + case HAL_TIM_ERROR_CB_ID : + htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak Error Callback */ + break; + + case HAL_TIM_COMMUTATION_CB_ID : + htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak Commutation Callback */ + break; + + case HAL_TIM_COMMUTATION_HALF_CB_ID : + htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak Commutation half complete Callback */ + break; + + case HAL_TIM_BREAK_CB_ID : + htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak Break Callback */ + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (htim->State == HAL_TIM_STATE_RESET) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */ + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */ + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */ + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */ + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */ + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */ + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */ + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */ + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */ + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */ + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */ + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */ + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */ + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */ + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return status; +} +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group10 TIM Peripheral State functions + * @brief TIM Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Return the TIM Base handle state. + * @param htim TIM Base handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM OC handle state. + * @param htim TIM Output Compare handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM PWM handle state. + * @param htim TIM handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM Input Capture handle state. + * @param htim TIM IC handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM One Pulse Mode handle state. + * @param htim TIM OPM handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM Encoder Mode handle state. + * @param htim TIM Encoder Interface handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup TIM_Private_Functions TIM Private Functions + * @{ + */ + +/** + * @brief TIM DMA error callback + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMAError(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->ErrorCallback(htim); +#else + HAL_TIM_ErrorCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Delay Pulse complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Delay Pulse half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PWM_PulseFinishedHalfCpltCallback(htim); +#else + HAL_TIM_PWM_PulseFinishedHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Capture complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Capture half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureHalfCpltCallback(htim); +#else + HAL_TIM_IC_CaptureHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Period Elapse complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedCallback(htim); +#else + HAL_TIM_PeriodElapsedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Period Elapse half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedHalfCpltCallback(htim); +#else + HAL_TIM_PeriodElapsedHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Trigger callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerCallback(htim); +#else + HAL_TIM_TriggerCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Trigger half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerHalfCpltCallback(htim); +#else + HAL_TIM_TriggerHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief Time Base configuration + * @param TIMx TIM peripheral + * @param Structure TIM Base configuration structure + * @retval None + */ +void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure) +{ + uint32_t tmpcr1; + tmpcr1 = TIMx->CR1; + + /* Set TIM Time Base Unit parameters ---------------------------------------*/ + if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) + { + /* Select the Counter Mode */ + tmpcr1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS); + tmpcr1 |= Structure->CounterMode; + } + + if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) + { + /* Set the clock division */ + tmpcr1 &= ~TIM_CR1_CKD; + tmpcr1 |= (uint32_t)Structure->ClockDivision; + } + + /* Set the auto-reload preload */ + MODIFY_REG(tmpcr1, TIM_CR1_ARPE, Structure->AutoReloadPreload); + + TIMx->CR1 = tmpcr1; + + /* Set the Autoreload value */ + TIMx->ARR = (uint32_t)Structure->Period ; + + /* Set the Prescaler value */ + TIMx->PSC = Structure->Prescaler; + + if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) + { + /* Set the Repetition Counter value */ + TIMx->RCR = Structure->RepetitionCounter; + } + + /* Generate an update event to reload the Prescaler + and the repetition counter (only for advanced timer) value immediately */ + TIMx->EGR = TIM_EGR_UG; +} + +/** + * @brief Timer Output Compare 1 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The ouput configuration structure + * @retval None + */ +static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= ~TIM_CCER_CC1E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR1 register value */ + tmpccmrx = TIMx->CCMR1; + + /* Reset the Output Compare Mode Bits */ + tmpccmrx &= ~TIM_CCMR1_OC1M; + tmpccmrx &= ~TIM_CCMR1_CC1S; + /* Select the Output Compare Mode */ + tmpccmrx |= OC_Config->OCMode; + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC1P; + /* Set the Output Compare Polarity */ + tmpccer |= OC_Config->OCPolarity; + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_1)) + { + /* Check parameters */ + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC1NP; + /* Set the Output N Polarity */ + tmpccer |= OC_Config->OCNPolarity; + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC1NE; + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS1; + tmpcr2 &= ~TIM_CR2_OIS1N; + /* Set the Output Idle state */ + tmpcr2 |= OC_Config->OCIdleState; + /* Set the Output N Idle state */ + tmpcr2 |= OC_Config->OCNIdleState; + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR1 */ + TIMx->CCMR1 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR1 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 2 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The ouput configuration structure + * @retval None + */ +void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR1 register value */ + tmpccmrx = TIMx->CCMR1; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR1_OC2M; + tmpccmrx &= ~TIM_CCMR1_CC2S; + + /* Select the Output Compare Mode */ + tmpccmrx |= (OC_Config->OCMode << 8U); + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC2P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 4U); + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_2)) + { + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC2NP; + /* Set the Output N Polarity */ + tmpccer |= (OC_Config->OCNPolarity << 4U); + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC2NE; + + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS2; + tmpcr2 &= ~TIM_CR2_OIS2N; + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 2U); + /* Set the Output N Idle state */ + tmpcr2 |= (OC_Config->OCNIdleState << 2U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR1 */ + TIMx->CCMR1 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR2 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 3 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The ouput configuration structure + * @retval None + */ +static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 3: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC3E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR2 register value */ + tmpccmrx = TIMx->CCMR2; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR2_OC3M; + tmpccmrx &= ~TIM_CCMR2_CC3S; + /* Select the Output Compare Mode */ + tmpccmrx |= OC_Config->OCMode; + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC3P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 8U); + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_3)) + { + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC3NP; + /* Set the Output N Polarity */ + tmpccer |= (OC_Config->OCNPolarity << 8U); + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC3NE; + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS3; + tmpcr2 &= ~TIM_CR2_OIS3N; + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 4U); + /* Set the Output N Idle state */ + tmpcr2 |= (OC_Config->OCNIdleState << 4U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR2 */ + TIMx->CCMR2 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR3 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 4 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The ouput configuration structure + * @retval None + */ +static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= ~TIM_CCER_CC4E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR2 register value */ + tmpccmrx = TIMx->CCMR2; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR2_OC4M; + tmpccmrx &= ~TIM_CCMR2_CC4S; + + /* Select the Output Compare Mode */ + tmpccmrx |= (OC_Config->OCMode << 8U); + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC4P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 12U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS4; + + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 6U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR2 */ + TIMx->CCMR2 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR4 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Slave Timer configuration function + * @param htim TIM handle + * @param sSlaveConfig Slave timer configuration + * @retval None + */ +static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + uint32_t tmpsmcr; + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Reset the Trigger Selection Bits */ + tmpsmcr &= ~TIM_SMCR_TS; + /* Set the Input Trigger source */ + tmpsmcr |= sSlaveConfig->InputTrigger; + + /* Reset the slave mode Bits */ + tmpsmcr &= ~TIM_SMCR_SMS; + /* Set the slave mode */ + tmpsmcr |= sSlaveConfig->SlaveMode; + + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + + /* Configure the trigger prescaler, filter, and polarity */ + switch (sSlaveConfig->InputTrigger) + { + case TIM_TS_ETRF: + { + /* Check the parameters */ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPRESCALER(sSlaveConfig->TriggerPrescaler)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + /* Configure the ETR Trigger source */ + TIM_ETR_SetConfig(htim->Instance, + sSlaveConfig->TriggerPrescaler, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_TI1F_ED: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + if(sSlaveConfig->SlaveMode == TIM_SLAVEMODE_GATED) + { + return HAL_ERROR; + } + + /* Disable the Channel 1: Reset the CC1E Bit */ + tmpccer = htim->Instance->CCER; + htim->Instance->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = htim->Instance->CCMR1; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= ((sSlaveConfig->TriggerFilter) << 4U); + + /* Write to TIMx CCMR1 and CCER registers */ + htim->Instance->CCMR1 = tmpccmr1; + htim->Instance->CCER = tmpccer; + break; + } + + case TIM_TS_TI1FP1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + /* Configure TI1 Filter and Polarity */ + TIM_TI1_ConfigInputStage(htim->Instance, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_TI2FP2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + /* Configure TI2 Filter and Polarity */ + TIM_TI2_ConfigInputStage(htim->Instance, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_ITR0: + case TIM_TS_ITR1: + case TIM_TS_ITR2: + case TIM_TS_ITR3: + { + /* Check the parameter */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + break; + } + + default: + break; + } + return HAL_OK; +} + +/** + * @brief Configure the TI1 as Input. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 1 is selected to be connected to IC1. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 1 is selected to be connected to IC2. + * @arg TIM_ICSELECTION_TRC: TIM Input 1 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI2FP1 + * (on channel2 path) is used as the input signal. Therefore CCMR1 must be + * protected against un-initialized filter and polarity values. + */ +void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Select the Input */ + if (IS_TIM_CC2_INSTANCE(TIMx) != RESET) + { + tmpccmr1 &= ~TIM_CCMR1_CC1S; + tmpccmr1 |= TIM_ICSelection; + } + else + { + tmpccmr1 |= TIM_CCMR1_CC1S_0; + } + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= ((TIM_ICFilter << 4U) & TIM_CCMR1_IC1F); + + /* Select the Polarity and set the CC1E Bit */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP); + tmpccer |= (TIM_ICPolarity & (TIM_CCER_CC1P | TIM_CCER_CC1NP)); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the Polarity and Filter for TI1. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + */ +static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 1: Reset the CC1E Bit */ + tmpccer = TIMx->CCER; + TIMx->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = TIMx->CCMR1; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= (TIM_ICFilter << 4U); + + /* Select the Polarity and set the CC1E Bit */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP); + tmpccer |= TIM_ICPolarity; + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI2 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 2 is selected to be connected to IC2. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 2 is selected to be connected to IC1. + * @arg TIM_ICSELECTION_TRC: TIM Input 2 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI1FP2 + * (on channel1 path) is used as the input signal. Therefore CCMR1 must be + * protected against un-initialized filter and polarity values. + */ +static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr1 &= ~TIM_CCMR1_CC2S; + tmpccmr1 |= (TIM_ICSelection << 8U); + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC2F; + tmpccmr1 |= ((TIM_ICFilter << 12U) & TIM_CCMR1_IC2F); + + /* Select the Polarity and set the CC2E Bit */ + tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= ((TIM_ICPolarity << 4U) & (TIM_CCER_CC2P | TIM_CCER_CC2NP)); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1 ; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the Polarity and Filter for TI2. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + */ +static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC2F; + tmpccmr1 |= (TIM_ICFilter << 12U); + + /* Select the Polarity and set the CC2E Bit */ + tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (TIM_ICPolarity << 4U); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1 ; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI3 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 3 is selected to be connected to IC3. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 3 is selected to be connected to IC4. + * @arg TIM_ICSELECTION_TRC: TIM Input 3 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI3FP4 + * (on channel1 path) is used as the input signal. Therefore CCMR2 must be + * protected against un-initialized filter and polarity values. + */ +static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + + /* Disable the Channel 3: Reset the CC3E Bit */ + TIMx->CCER &= ~TIM_CCER_CC3E; + tmpccmr2 = TIMx->CCMR2; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr2 &= ~TIM_CCMR2_CC3S; + tmpccmr2 |= TIM_ICSelection; + + /* Set the filter */ + tmpccmr2 &= ~TIM_CCMR2_IC3F; + tmpccmr2 |= ((TIM_ICFilter << 4U) & TIM_CCMR2_IC3F); + + /* Select the Polarity and set the CC3E Bit */ + tmpccer &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP); + tmpccer |= ((TIM_ICPolarity << 8U) & (TIM_CCER_CC3P | TIM_CCER_CC3NP)); + + /* Write to TIMx CCMR2 and CCER registers */ + TIMx->CCMR2 = tmpccmr2; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI4 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 4 is selected to be connected to IC4. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 4 is selected to be connected to IC3. + * @arg TIM_ICSELECTION_TRC: TIM Input 4 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI4FP3 + * (on channel1 path) is used as the input signal. Therefore CCMR2 must be + * protected against un-initialized filter and polarity values. + * @retval None + */ +static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= ~TIM_CCER_CC4E; + tmpccmr2 = TIMx->CCMR2; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr2 &= ~TIM_CCMR2_CC4S; + tmpccmr2 |= (TIM_ICSelection << 8U); + + /* Set the filter */ + tmpccmr2 &= ~TIM_CCMR2_IC4F; + tmpccmr2 |= ((TIM_ICFilter << 12U) & TIM_CCMR2_IC4F); + + /* Select the Polarity and set the CC4E Bit */ + tmpccer &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP); + tmpccer |= ((TIM_ICPolarity << 12U) & (TIM_CCER_CC4P | TIM_CCER_CC4NP)); + + /* Write to TIMx CCMR2 and CCER registers */ + TIMx->CCMR2 = tmpccmr2; + TIMx->CCER = tmpccer ; +} + +/** + * @brief Selects the Input Trigger source + * @param TIMx to select the TIM peripheral + * @param InputTriggerSource The Input Trigger source. + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal Trigger 0 + * @arg TIM_TS_ITR1: Internal Trigger 1 + * @arg TIM_TS_ITR2: Internal Trigger 2 + * @arg TIM_TS_ITR3: Internal Trigger 3 + * @arg TIM_TS_TI1F_ED: TI1 Edge Detector + * @arg TIM_TS_TI1FP1: Filtered Timer Input 1 + * @arg TIM_TS_TI2FP2: Filtered Timer Input 2 + * @arg TIM_TS_ETRF: External Trigger input + * @retval None + */ +static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource) +{ + uint32_t tmpsmcr; + + /* Get the TIMx SMCR register value */ + tmpsmcr = TIMx->SMCR; + /* Reset the TS Bits */ + tmpsmcr &= ~TIM_SMCR_TS; + /* Set the Input Trigger source and the slave mode*/ + tmpsmcr |= (InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1); + /* Write to TIMx SMCR */ + TIMx->SMCR = tmpsmcr; +} +/** + * @brief Configures the TIMx External Trigger (ETR). + * @param TIMx to select the TIM peripheral + * @param TIM_ExtTRGPrescaler The external Trigger Prescaler. + * This parameter can be one of the following values: + * @arg TIM_ETRPRESCALER_DIV1: ETRP Prescaler OFF. + * @arg TIM_ETRPRESCALER_DIV2: ETRP frequency divided by 2. + * @arg TIM_ETRPRESCALER_DIV4: ETRP frequency divided by 4. + * @arg TIM_ETRPRESCALER_DIV8: ETRP frequency divided by 8. + * @param TIM_ExtTRGPolarity The external Trigger Polarity. + * This parameter can be one of the following values: + * @arg TIM_ETRPOLARITY_INVERTED: active low or falling edge active. + * @arg TIM_ETRPOLARITY_NONINVERTED: active high or rising edge active. + * @param ExtTRGFilter External Trigger Filter. + * This parameter must be a value between 0x00 and 0x0F + * @retval None + */ +void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, + uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter) +{ + uint32_t tmpsmcr; + + tmpsmcr = TIMx->SMCR; + + /* Reset the ETR Bits */ + tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); + + /* Set the Prescaler, the Filter value and the Polarity */ + tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler | (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U))); + + /* Write to TIMx SMCR */ + TIMx->SMCR = tmpsmcr; +} + +/** + * @brief Enables or disables the TIM Capture Compare Channel x. + * @param TIMx to select the TIM peripheral + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @param ChannelState specifies the TIM Channel CCxE bit new state. + * This parameter can be: TIM_CCx_ENABLE or TIM_CCx_DISABLE. + * @retval None + */ +void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState) +{ + uint32_t tmp; + + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_TIM_CHANNELS(Channel)); + + tmp = TIM_CCER_CC1E << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */ + + /* Reset the CCxE Bit */ + TIMx->CCER &= ~tmp; + + /* Set or reset the CCxE Bit */ + TIMx->CCER |= (uint32_t)(ChannelState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */ +} + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief Reset interrupt callbacks to the legacy weak callbacks. + * @param htim pointer to a TIM_HandleTypeDef structure that contains + * the configuration information for TIM module. + * @retval None + */ +void TIM_ResetCallback(TIM_HandleTypeDef *htim) +{ + /* Reset the TIM callback to the legacy weak callbacks */ + htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak PeriodElapsedCallback */ + htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak PeriodElapsedHalfCpltCallback */ + htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak TriggerCallback */ + htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak TriggerHalfCpltCallback */ + htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC_CaptureCallback */ + htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC_CaptureHalfCpltCallback */ + htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC_DelayElapsedCallback */ + htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM_PulseFinishedCallback */ + htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM_PulseFinishedHalfCpltCallback */ + htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak ErrorCallback */ + htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak CommutationCallback */ + htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak CommutationHalfCpltCallback */ + htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak BreakCallback */ +} +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +#endif /* HAL_TIM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c new file mode 100644 index 0000000..99a13c0 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c @@ -0,0 +1,1978 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_tim_ex.c + * @author MCD Application Team + * @brief TIM HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Timer Extended peripheral: + * + Time Hall Sensor Interface Initialization + * + Time Hall Sensor Interface Start + * + Time Complementary signal break and dead time configuration + * + Time Master and Slave synchronization configuration + * + Timer remapping capabilities configuration + @verbatim + ============================================================================== + ##### TIMER Extended features ##### + ============================================================================== + [..] + The Timer Extended features include: + (#) Complementary outputs with programmable dead-time for : + (++) Output Compare + (++) PWM generation (Edge and Center-aligned Mode) + (++) One-pulse mode output + (#) Synchronization circuit to control the timer with external signals and to + interconnect several timers together. + (#) Break input to put the timer output signals in reset state or in a known state. + (#) Supports incremental (quadrature) encoder and hall-sensor circuitry for + positioning purposes + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the TIM low level resources by implementing the following functions + depending on the selected feature: + (++) Hall Sensor output : HAL_TIMEx_HallSensor_MspInit() + + (#) Initialize the TIM low level resources : + (##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE(); + (##) TIM pins configuration + (+++) Enable the clock for the TIM GPIOs using the following function: + __HAL_RCC_GPIOx_CLK_ENABLE(); + (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init(); + + (#) The external Clock can be configured, if needed (the default clock is the + internal clock from the APBx), using the following function: + HAL_TIM_ConfigClockSource, the clock configuration should be done before + any start function. + + (#) Configure the TIM in the desired functioning mode using one of the + initialization function of this driver: + (++) HAL_TIMEx_HallSensor_Init() and HAL_TIMEx_ConfigCommutEvent(): to use the + Timer Hall Sensor Interface and the commutation event with the corresponding + Interrupt and DMA request if needed (Note that One Timer is used to interface + with the Hall sensor Interface and another Timer should be used to use + the commutation event). + + (#) Activate the TIM peripheral using one of the start functions: + (++) Complementary Output Compare : HAL_TIMEx_OCN_Start(), HAL_TIMEx_OCN_Start_DMA(), HAL_TIMEx_OC_Start_IT() + (++) Complementary PWM generation : HAL_TIMEx_PWMN_Start(), HAL_TIMEx_PWMN_Start_DMA(), HAL_TIMEx_PWMN_Start_IT() + (++) Complementary One-pulse mode output : HAL_TIMEx_OnePulseN_Start(), HAL_TIMEx_OnePulseN_Start_IT() + (++) Hall Sensor output : HAL_TIMEx_HallSensor_Start(), HAL_TIMEx_HallSensor_Start_DMA(), HAL_TIMEx_HallSensor_Start_IT(). + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup TIMEx TIMEx + * @brief TIM Extended HAL module driver + * @{ + */ + +#ifdef HAL_TIM_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState); + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Functions TIM Extended Exported Functions + * @{ + */ + +/** @defgroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions + * @brief Timer Hall Sensor functions + * +@verbatim + ============================================================================== + ##### Timer Hall Sensor functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure TIM HAL Sensor. + (+) De-initialize TIM HAL Sensor. + (+) Start the Hall Sensor Interface. + (+) Stop the Hall Sensor Interface. + (+) Start the Hall Sensor Interface and enable interrupts. + (+) Stop the Hall Sensor Interface and disable interrupts. + (+) Start the Hall Sensor Interface and enable DMA transfers. + (+) Stop the Hall Sensor Interface and disable DMA transfers. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Hall Sensor Interface and initialize the associated handle. + * @param htim TIM Hall Sensor Interface handle + * @param sConfig TIM Hall Sensor configuration structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig) +{ + TIM_OC_InitTypeDef OC_Config; + + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + assert_param(IS_TIM_IC_POLARITY(sConfig->IC1Polarity)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC1Prescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy week callbacks */ + TIM_ResetCallback(htim); + + if (htim->HallSensor_MspInitCallback == NULL) + { + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->HallSensor_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIMEx_HallSensor_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Configure the Time base in the Encoder Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Configure the Channel 1 as Input Channel to interface with the three Outputs of the Hall sensor */ + TIM_TI1_SetConfig(htim->Instance, sConfig->IC1Polarity, TIM_ICSELECTION_TRC, sConfig->IC1Filter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + /* Set the IC1PSC value */ + htim->Instance->CCMR1 |= sConfig->IC1Prescaler; + + /* Enable the Hall sensor interface (XOR function of the three inputs) */ + htim->Instance->CR2 |= TIM_CR2_TI1S; + + /* Select the TIM_TS_TI1F_ED signal as Input trigger for the TIM */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI1F_ED; + + /* Use the TIM_TS_TI1F_ED signal to reset the TIM counter each edge detection */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_RESET; + + /* Program channel 2 in PWM 2 mode with the desired Commutation_Delay*/ + OC_Config.OCFastMode = TIM_OCFAST_DISABLE; + OC_Config.OCIdleState = TIM_OCIDLESTATE_RESET; + OC_Config.OCMode = TIM_OCMODE_PWM2; + OC_Config.OCNIdleState = TIM_OCNIDLESTATE_RESET; + OC_Config.OCNPolarity = TIM_OCNPOLARITY_HIGH; + OC_Config.OCPolarity = TIM_OCPOLARITY_HIGH; + OC_Config.Pulse = sConfig->Commutation_Delay; + + TIM_OC2_SetConfig(htim->Instance, &OC_Config); + + /* Select OC2REF as trigger output on TRGO: write the MMS bits in the TIMx_CR2 + register to 101 */ + htim->Instance->CR2 &= ~TIM_CR2_MMS; + htim->Instance->CR2 |= TIM_TRGO_OC2REF; + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM Hall Sensor interface + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->HallSensor_MspDeInitCallback == NULL) + { + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; + } + /* DeInit the low level hardware */ + htim->HallSensor_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIMEx_HallSensor_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Hall Sensor MSP. + * @param htim TIM Hall Sensor Interface handle + * @retval None + */ +__weak void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_HallSensor_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Hall Sensor MSP. + * @param htim TIM Hall Sensor Interface handle + * @retval None + */ +__weak void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_HallSensor_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Hall Sensor Interface. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall sensor Interface. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1, 2 and 3 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Hall Sensor Interface in interrupt mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Enable the capture compare Interrupts 1 event */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall Sensor Interface in interrupt mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts event */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Hall Sensor Interface in DMA mode. + * @param htim TIM Hall Sensor Interface handle + * @param pData The destination Buffer address. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if (((uint32_t)pData == 0U) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Set the DMA Input Capture 1 Callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream for Capture 1*/ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the capture compare 1 Interrupt */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall Sensor Interface in DMA mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + + /* Disable the capture compare Interrupts 1 event */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions + * @brief Timer Complementary Output Compare functions + * +@verbatim + ============================================================================== + ##### Timer Complementary Output Compare functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary Output Compare/PWM. + (+) Stop the Complementary Output Compare/PWM. + (+) Start the Complementary Output Compare/PWM and enable interrupts. + (+) Stop the Complementary Output Compare/PWM and disable interrupts. + (+) Start the Complementary Output Compare/PWM and enable DMA transfers. + (+) Stop the Complementary Output Compare/PWM and disable DMA transfers. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the TIM Output Compare signal generation on the complementary + * output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation on the complementary + * output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in interrupt mode + * on the complementary output. + * @param htim TIM OC handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + + default: + break; + } + + /* Enable the TIM Break interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK); + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in interrupt mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpccer; + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the TIM Break interrupt (only if no more channel is active) */ + tmpccer = htim->Instance->CCER; + if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET) + { + __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK); + } + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in DMA mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if (((uint32_t)pData == 0U) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in DMA mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions + * @brief Timer Complementary PWM functions + * +@verbatim + ============================================================================== + ##### Timer Complementary PWM functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary PWM. + (+) Stop the Complementary PWM. + (+) Start the Complementary PWM and enable interrupts. + (+) Stop the Complementary PWM and disable interrupts. + (+) Start the Complementary PWM and enable DMA transfers. + (+) Stop the Complementary PWM and disable DMA transfers. + (+) Start the Complementary Input Capture measurement. + (+) Stop the Complementary Input Capture. + (+) Start the Complementary Input Capture and enable interrupts. + (+) Stop the Complementary Input Capture and disable interrupts. + (+) Start the Complementary Input Capture and enable DMA transfers. + (+) Stop the Complementary Input Capture and disable DMA transfers. + (+) Start the Complementary One Pulse generation. + (+) Stop the Complementary One Pulse. + (+) Start the Complementary One Pulse and enable interrupts. + (+) Stop the Complementary One Pulse and disable interrupts. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the PWM signal generation on the complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation on the complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the PWM signal generation in interrupt mode on the + * complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Enable the TIM Break interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK); + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation in interrupt mode on the + * complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpccer; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the TIM Break interrupt (only if no more channel is active) */ + tmpccer = htim->Instance->CCER; + if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET) + { + __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK); + } + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM PWM signal generation in DMA mode on the + * complementary output + * @param htim TIM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if (((uint32_t)pData == 0U) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA stream */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK) + { + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + default: + break; + } + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM PWM signal generation in DMA mode on the complementary + * output + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + default: + break; + } + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions + * @brief Timer Complementary One Pulse functions + * +@verbatim + ============================================================================== + ##### Timer Complementary One Pulse functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary One Pulse generation. + (+) Stop the Complementary One Pulse. + (+) Start the Complementary One Pulse and enable interrupts. + (+) Stop the Complementary One Pulse and disable interrupts. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the TIM One Pulse signal generation on the complementary + * output. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Enable the complementary One Pulse output */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation on the complementary + * output. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Disable the complementary One Pulse output */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM One Pulse signal generation in interrupt mode on the + * complementary channel. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + + /* Enable the complementary One Pulse output */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation in interrupt mode on the + * complementary channel. + * @param htim TIM One Pulse handle + * @param OutputChannel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + + /* Disable the complementary One Pulse output */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions + * @brief Peripheral Control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Configure the commutation event in case of use of the Hall sensor interface. + (+) Configure Output channels for OC and PWM mode. + + (+) Configure Complementary channels, break features and dead time. + (+) Configure Master synchronization. + (+) Configure timer remapping capabilities. + +@endverbatim + * @{ + */ + +/** + * @brief Configure the TIM commutation event sequence. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Disable Commutation Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM); + + /* Disable Commutation DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configure the TIM commutation event sequence with interrupt. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Disable Commutation DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM); + + /* Enable the Commutation Interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configure the TIM commutation event sequence with DMA. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @note The user should configure the DMA in his own software, in This function only the COMDE bit is set + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Enable the Commutation DMA Request */ + /* Set the DMA Commutation Callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError; + + /* Disable Commutation Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM); + + /* Enable the Commutation DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIM in master mode. + * @param htim TIM handle. + * @param sMasterConfig pointer to a TIM_MasterConfigTypeDef structure that + * contains the selected trigger output (TRGO) and the Master/Slave + * mode. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, + TIM_MasterConfigTypeDef *sMasterConfig) +{ + uint32_t tmpcr2; + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_MASTER_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRGO_SOURCE(sMasterConfig->MasterOutputTrigger)); + assert_param(IS_TIM_MSM_STATE(sMasterConfig->MasterSlaveMode)); + + /* Check input state */ + __HAL_LOCK(htim); + + /* Change the handler state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Get the TIMx CR2 register value */ + tmpcr2 = htim->Instance->CR2; + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Reset the MMS Bits */ + tmpcr2 &= ~TIM_CR2_MMS; + /* Select the TRGO source */ + tmpcr2 |= sMasterConfig->MasterOutputTrigger; + + /* Update TIMx CR2 */ + htim->Instance->CR2 = tmpcr2; + + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + /* Reset the MSM Bit */ + tmpsmcr &= ~TIM_SMCR_MSM; + /* Set master mode */ + tmpsmcr |= sMasterConfig->MasterSlaveMode; + + /* Update TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + } + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the Break feature, dead time, Lock level, OSSI/OSSR State + * and the AOE(automatic output enable). + * @param htim TIM handle + * @param sBreakDeadTimeConfig pointer to a TIM_ConfigBreakDeadConfigTypeDef structure that + * contains the BDTR Register configuration information for the TIM peripheral. + * @note Interrupts can be generated when an active level is detected on the + * break input, the break 2 input or the system break input. Break + * interrupt can be enabled by calling the @ref __HAL_TIM_ENABLE_IT macro. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, + TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig) +{ + /* Keep this variable initialized to 0 as it is used to configure BDTR register */ + uint32_t tmpbdtr = 0U; + + /* Check the parameters */ + assert_param(IS_TIM_BREAK_INSTANCE(htim->Instance)); + assert_param(IS_TIM_OSSR_STATE(sBreakDeadTimeConfig->OffStateRunMode)); + assert_param(IS_TIM_OSSI_STATE(sBreakDeadTimeConfig->OffStateIDLEMode)); + assert_param(IS_TIM_LOCK_LEVEL(sBreakDeadTimeConfig->LockLevel)); + assert_param(IS_TIM_DEADTIME(sBreakDeadTimeConfig->DeadTime)); + assert_param(IS_TIM_BREAK_STATE(sBreakDeadTimeConfig->BreakState)); + assert_param(IS_TIM_BREAK_POLARITY(sBreakDeadTimeConfig->BreakPolarity)); + assert_param(IS_TIM_AUTOMATIC_OUTPUT_STATE(sBreakDeadTimeConfig->AutomaticOutput)); + + /* Check input state */ + __HAL_LOCK(htim); + + /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State, + the OSSI State, the dead time value and the Automatic Output Enable Bit */ + + /* Set the BDTR bits */ + MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, sBreakDeadTimeConfig->DeadTime); + MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, sBreakDeadTimeConfig->LockLevel); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, sBreakDeadTimeConfig->OffStateIDLEMode); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, sBreakDeadTimeConfig->OffStateRunMode); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, sBreakDeadTimeConfig->BreakState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, sBreakDeadTimeConfig->BreakPolarity); + MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, sBreakDeadTimeConfig->AutomaticOutput); + + + /* Set TIMx_BDTR */ + htim->Instance->BDTR = tmpbdtr; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIMx Remapping input capabilities. + * @param htim TIM handle. + * @param Remap specifies the TIM remapping source. + * For TIM1, the parameter can have the following values: (**) + * @arg TIM_TIM1_TIM3_TRGO: TIM1 ITR2 is connected to TIM3 TRGO + * @arg TIM_TIM1_LPTIM: TIM1 ITR2 is connected to LPTIM1 output + * + * For TIM2, the parameter can have the following values: (**) + * @arg TIM_TIM2_TIM8_TRGO: TIM2 ITR1 is connected to TIM8 TRGO (*) + * @arg TIM_TIM2_ETH_PTP: TIM2 ITR1 is connected to PTP trigger output (*) + * @arg TIM_TIM2_USBFS_SOF: TIM2 ITR1 is connected to OTG FS SOF + * @arg TIM_TIM2_USBHS_SOF: TIM2 ITR1 is connected to OTG FS SOF + * + * For TIM5, the parameter can have the following values: + * @arg TIM_TIM5_GPIO: TIM5 TI4 is connected to GPIO + * @arg TIM_TIM5_LSI: TIM5 TI4 is connected to LSI + * @arg TIM_TIM5_LSE: TIM5 TI4 is connected to LSE + * @arg TIM_TIM5_RTC: TIM5 TI4 is connected to the RTC wakeup interrupt + * @arg TIM_TIM5_TIM3_TRGO: TIM5 ITR1 is connected to TIM3 TRGO (*) + * @arg TIM_TIM5_LPTIM: TIM5 ITR1 is connected to LPTIM1 output (*) + * + * For TIM9, the parameter can have the following values: (**) + * @arg TIM_TIM9_TIM3_TRGO: TIM9 ITR1 is connected to TIM3 TRGO + * @arg TIM_TIM9_LPTIM: TIM9 ITR1 is connected to LPTIM1 output + * + * For TIM11, the parameter can have the following values: + * @arg TIM_TIM11_GPIO: TIM11 TI1 is connected to GPIO + * @arg TIM_TIM11_HSE: TIM11 TI1 is connected to HSE_RTC clock + * @arg TIM_TIM11_SPDIFRX: TIM11 TI1 is connected to SPDIFRX_FRAME_SYNC (*) + * + * (*) Value not defined in all devices. \n + * (**) Register not available in all devices. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap) +{ + __HAL_LOCK(htim); + + /* Check parameters */ + assert_param(IS_TIM_REMAP(htim->Instance, Remap)); + +#if defined(LPTIM_OR_TIM1_ITR2_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) && defined(LPTIM_OR_TIM5_ITR1_RMP) + if ((Remap & LPTIM_REMAP_MASK) == LPTIM_REMAP_MASK) + { + /* Connect TIMx internal trigger to LPTIM1 output */ + __HAL_RCC_LPTIM1_CLK_ENABLE(); + MODIFY_REG(LPTIM1->OR, + (LPTIM_OR_TIM1_ITR2_RMP | LPTIM_OR_TIM5_ITR1_RMP | LPTIM_OR_TIM9_ITR1_RMP), + Remap & ~(LPTIM_REMAP_MASK)); + } + else + { + /* Set the Timer remapping configuration */ + WRITE_REG(htim->Instance->OR, Remap); + } +#else + /* Set the Timer remapping configuration */ + WRITE_REG(htim->Instance->OR, Remap); +#endif /* LPTIM_OR_TIM1_ITR2_RMP && LPTIM_OR_TIM5_ITR1_RMP && LPTIM_OR_TIM5_ITR1_RMP */ + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions + * @brief Extended Callbacks functions + * +@verbatim + ============================================================================== + ##### Extended Callbacks functions ##### + ============================================================================== + [..] + This section provides Extended TIM callback functions: + (+) Timer Commutation callback + (+) Timer Break callback + +@endverbatim + * @{ + */ + +/** + * @brief Hall commutation changed callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_CommutCallback could be implemented in the user file + */ +} +/** + * @brief Hall commutation changed half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_CommutHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Break detection callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_BreakCallback could be implemented in the user file + */ +} +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions + * @brief Extended Peripheral State functions + * +@verbatim + ============================================================================== + ##### Extended Peripheral State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Return the TIM Hall Sensor interface handle state. + * @param htim TIM Hall Sensor handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup TIMEx_Private_Functions TIMEx Private Functions + * @{ + */ + +/** + * @brief TIM DMA Commutation callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationCallback(htim); +#else + HAL_TIMEx_CommutCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Commutation half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationHalfCpltCallback(htim); +#else + HAL_TIMEx_CommutHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + + +/** + * @brief Enables or disables the TIM Capture Compare Channel xN. + * @param TIMx to select the TIM peripheral + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @param ChannelNState specifies the TIM Channel CCxNE bit new state. + * This parameter can be: TIM_CCxN_ENABLE or TIM_CCxN_Disable. + * @retval None + */ +static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState) +{ + uint32_t tmp; + + tmp = TIM_CCER_CC1NE << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */ + + /* Reset the CCxNE Bit */ + TIMx->CCER &= ~tmp; + + /* Set or reset the CCxNE Bit */ + TIMx->CCER |= (uint32_t)(ChannelNState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */ +} +/** + * @} + */ + +#endif /* HAL_TIM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c new file mode 100644 index 0000000..e4cbae4 --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c @@ -0,0 +1,425 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_dma.c + * @author MCD Application Team + * @brief DMA LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_dma.h" +#include "stm32f4xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (DMA1) || defined (DMA2) + +/** @defgroup DMA_LL DMA + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup DMA_LL_Private_Macros + * @{ + */ +#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \ + ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \ + ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY)) + +#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \ + ((__VALUE__) == LL_DMA_MODE_CIRCULAR) || \ + ((__VALUE__) == LL_DMA_MODE_PFCTRL)) + +#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \ + ((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT)) + +#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \ + ((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT)) + +#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \ + ((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \ + ((__VALUE__) == LL_DMA_PDATAALIGN_WORD)) + +#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \ + ((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \ + ((__VALUE__) == LL_DMA_MDATAALIGN_WORD)) + +#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU) + +#define IS_LL_DMA_CHANNEL(__VALUE__) (((__VALUE__) == LL_DMA_CHANNEL_0) || \ + ((__VALUE__) == LL_DMA_CHANNEL_1) || \ + ((__VALUE__) == LL_DMA_CHANNEL_2) || \ + ((__VALUE__) == LL_DMA_CHANNEL_3) || \ + ((__VALUE__) == LL_DMA_CHANNEL_4) || \ + ((__VALUE__) == LL_DMA_CHANNEL_5) || \ + ((__VALUE__) == LL_DMA_CHANNEL_6) || \ + ((__VALUE__) == LL_DMA_CHANNEL_7)) + +#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \ + ((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \ + ((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \ + ((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH)) + +#define IS_LL_DMA_ALL_STREAM_INSTANCE(INSTANCE, STREAM) ((((INSTANCE) == DMA1) && \ + (((STREAM) == LL_DMA_STREAM_0) || \ + ((STREAM) == LL_DMA_STREAM_1) || \ + ((STREAM) == LL_DMA_STREAM_2) || \ + ((STREAM) == LL_DMA_STREAM_3) || \ + ((STREAM) == LL_DMA_STREAM_4) || \ + ((STREAM) == LL_DMA_STREAM_5) || \ + ((STREAM) == LL_DMA_STREAM_6) || \ + ((STREAM) == LL_DMA_STREAM_7) || \ + ((STREAM) == LL_DMA_STREAM_ALL))) ||\ + (((INSTANCE) == DMA2) && \ + (((STREAM) == LL_DMA_STREAM_0) || \ + ((STREAM) == LL_DMA_STREAM_1) || \ + ((STREAM) == LL_DMA_STREAM_2) || \ + ((STREAM) == LL_DMA_STREAM_3) || \ + ((STREAM) == LL_DMA_STREAM_4) || \ + ((STREAM) == LL_DMA_STREAM_5) || \ + ((STREAM) == LL_DMA_STREAM_6) || \ + ((STREAM) == LL_DMA_STREAM_7) || \ + ((STREAM) == LL_DMA_STREAM_ALL)))) + +#define IS_LL_DMA_FIFO_MODE_STATE(STATE) (((STATE) == LL_DMA_FIFOMODE_DISABLE ) || \ + ((STATE) == LL_DMA_FIFOMODE_ENABLE)) + +#define IS_LL_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_4) || \ + ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_2) || \ + ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_3_4) || \ + ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_FULL)) + +#define IS_LL_DMA_MEMORY_BURST(BURST) (((BURST) == LL_DMA_MBURST_SINGLE) || \ + ((BURST) == LL_DMA_MBURST_INC4) || \ + ((BURST) == LL_DMA_MBURST_INC8) || \ + ((BURST) == LL_DMA_MBURST_INC16)) + +#define IS_LL_DMA_PERIPHERAL_BURST(BURST) (((BURST) == LL_DMA_PBURST_SINGLE) || \ + ((BURST) == LL_DMA_PBURST_INC4) || \ + ((BURST) == LL_DMA_PBURST_INC8) || \ + ((BURST) == LL_DMA_PBURST_INC16)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup DMA_LL_Exported_Functions + * @{ + */ + +/** @addtogroup DMA_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the DMA registers to their default reset values. + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @arg @ref LL_DMA_STREAM_ALL + * @retval An ErrorStatus enumeration value: + * - SUCCESS: DMA registers are de-initialized + * - ERROR: DMA registers are not de-initialized + */ +uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Stream) +{ + DMA_Stream_TypeDef *tmp = (DMA_Stream_TypeDef *)DMA1_Stream0; + ErrorStatus status = SUCCESS; + + /* Check the DMA Instance DMAx and Stream parameters*/ + assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream)); + + if (Stream == LL_DMA_STREAM_ALL) + { + if (DMAx == DMA1) + { + /* Force reset of DMA clock */ + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1); + + /* Release reset of DMA clock */ + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1); + } + else if (DMAx == DMA2) + { + /* Force reset of DMA clock */ + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2); + + /* Release reset of DMA clock */ + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2); + } + else + { + status = ERROR; + } + } + else + { + /* Disable the selected Stream */ + LL_DMA_DisableStream(DMAx,Stream); + + /* Get the DMA Stream Instance */ + tmp = (DMA_Stream_TypeDef *)(__LL_DMA_GET_STREAM_INSTANCE(DMAx, Stream)); + + /* Reset DMAx_Streamy configuration register */ + LL_DMA_WriteReg(tmp, CR, 0U); + + /* Reset DMAx_Streamy remaining bytes register */ + LL_DMA_WriteReg(tmp, NDTR, 0U); + + /* Reset DMAx_Streamy peripheral address register */ + LL_DMA_WriteReg(tmp, PAR, 0U); + + /* Reset DMAx_Streamy memory address register */ + LL_DMA_WriteReg(tmp, M0AR, 0U); + + /* Reset DMAx_Streamy memory address register */ + LL_DMA_WriteReg(tmp, M1AR, 0U); + + /* Reset DMAx_Streamy FIFO control register */ + LL_DMA_WriteReg(tmp, FCR, 0x00000021U); + + /* Reset Channel register field for DMAx Stream*/ + LL_DMA_SetChannelSelection(DMAx, Stream, LL_DMA_CHANNEL_0); + + if(Stream == LL_DMA_STREAM_0) + { + /* Reset the Stream0 pending flags */ + DMAx->LIFCR = 0x0000003FU; + } + else if(Stream == LL_DMA_STREAM_1) + { + /* Reset the Stream1 pending flags */ + DMAx->LIFCR = 0x00000F40U; + } + else if(Stream == LL_DMA_STREAM_2) + { + /* Reset the Stream2 pending flags */ + DMAx->LIFCR = 0x003F0000U; + } + else if(Stream == LL_DMA_STREAM_3) + { + /* Reset the Stream3 pending flags */ + DMAx->LIFCR = 0x0F400000U; + } + else if(Stream == LL_DMA_STREAM_4) + { + /* Reset the Stream4 pending flags */ + DMAx->HIFCR = 0x0000003FU; + } + else if(Stream == LL_DMA_STREAM_5) + { + /* Reset the Stream5 pending flags */ + DMAx->HIFCR = 0x00000F40U; + } + else if(Stream == LL_DMA_STREAM_6) + { + /* Reset the Stream6 pending flags */ + DMAx->HIFCR = 0x003F0000U; + } + else if(Stream == LL_DMA_STREAM_7) + { + /* Reset the Stream7 pending flags */ + DMAx->HIFCR = 0x0F400000U; + } + else + { + status = ERROR; + } + } + + return status; +} + +/** + * @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct. + * @note To convert DMAx_Streamy Instance to DMAx Instance and Streamy, use helper macros : + * @arg @ref __LL_DMA_GET_INSTANCE + * @arg @ref __LL_DMA_GET_STREAM + * @param DMAx DMAx Instance + * @param Stream This parameter can be one of the following values: + * @arg @ref LL_DMA_STREAM_0 + * @arg @ref LL_DMA_STREAM_1 + * @arg @ref LL_DMA_STREAM_2 + * @arg @ref LL_DMA_STREAM_3 + * @arg @ref LL_DMA_STREAM_4 + * @arg @ref LL_DMA_STREAM_5 + * @arg @ref LL_DMA_STREAM_6 + * @arg @ref LL_DMA_STREAM_7 + * @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: DMA registers are initialized + * - ERROR: Not applicable + */ +uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Stream, LL_DMA_InitTypeDef *DMA_InitStruct) +{ + /* Check the DMA Instance DMAx and Stream parameters*/ + assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream)); + + /* Check the DMA parameters from DMA_InitStruct */ + assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction)); + assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode)); + assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode)); + assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode)); + assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize)); + assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize)); + assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData)); + assert_param(IS_LL_DMA_CHANNEL(DMA_InitStruct->Channel)); + assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority)); + assert_param(IS_LL_DMA_FIFO_MODE_STATE(DMA_InitStruct->FIFOMode)); + /* Check the memory burst, peripheral burst and FIFO threshold parameters only + when FIFO mode is enabled */ + if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE) + { + assert_param(IS_LL_DMA_FIFO_THRESHOLD(DMA_InitStruct->FIFOThreshold)); + assert_param(IS_LL_DMA_MEMORY_BURST(DMA_InitStruct->MemBurst)); + assert_param(IS_LL_DMA_PERIPHERAL_BURST(DMA_InitStruct->PeriphBurst)); + } + + /*---------------------------- DMAx SxCR Configuration ------------------------ + * Configure DMAx_Streamy: data transfer direction, data transfer mode, + * peripheral and memory increment mode, + * data size alignment and priority level with parameters : + * - Direction: DMA_SxCR_DIR[1:0] bits + * - Mode: DMA_SxCR_CIRC bit + * - PeriphOrM2MSrcIncMode: DMA_SxCR_PINC bit + * - MemoryOrM2MDstIncMode: DMA_SxCR_MINC bit + * - PeriphOrM2MSrcDataSize: DMA_SxCR_PSIZE[1:0] bits + * - MemoryOrM2MDstDataSize: DMA_SxCR_MSIZE[1:0] bits + * - Priority: DMA_SxCR_PL[1:0] bits + */ + LL_DMA_ConfigTransfer(DMAx, Stream, DMA_InitStruct->Direction | \ + DMA_InitStruct->Mode | \ + DMA_InitStruct->PeriphOrM2MSrcIncMode | \ + DMA_InitStruct->MemoryOrM2MDstIncMode | \ + DMA_InitStruct->PeriphOrM2MSrcDataSize | \ + DMA_InitStruct->MemoryOrM2MDstDataSize | \ + DMA_InitStruct->Priority + ); + + if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE) + { + /*---------------------------- DMAx SxFCR Configuration ------------------------ + * Configure DMAx_Streamy: fifo mode and fifo threshold with parameters : + * - FIFOMode: DMA_SxFCR_DMDIS bit + * - FIFOThreshold: DMA_SxFCR_FTH[1:0] bits + */ + LL_DMA_ConfigFifo(DMAx, Stream, DMA_InitStruct->FIFOMode, DMA_InitStruct->FIFOThreshold); + + /*---------------------------- DMAx SxCR Configuration -------------------------- + * Configure DMAx_Streamy: memory burst transfer with parameters : + * - MemBurst: DMA_SxCR_MBURST[1:0] bits + */ + LL_DMA_SetMemoryBurstxfer(DMAx,Stream,DMA_InitStruct->MemBurst); + + /*---------------------------- DMAx SxCR Configuration -------------------------- + * Configure DMAx_Streamy: peripheral burst transfer with parameters : + * - PeriphBurst: DMA_SxCR_PBURST[1:0] bits + */ + LL_DMA_SetPeriphBurstxfer(DMAx,Stream,DMA_InitStruct->PeriphBurst); + } + + /*-------------------------- DMAx SxM0AR Configuration -------------------------- + * Configure the memory or destination base address with parameter : + * - MemoryOrM2MDstAddress: DMA_SxM0AR_M0A[31:0] bits + */ + LL_DMA_SetMemoryAddress(DMAx, Stream, DMA_InitStruct->MemoryOrM2MDstAddress); + + /*-------------------------- DMAx SxPAR Configuration --------------------------- + * Configure the peripheral or source base address with parameter : + * - PeriphOrM2MSrcAddress: DMA_SxPAR_PA[31:0] bits + */ + LL_DMA_SetPeriphAddress(DMAx, Stream, DMA_InitStruct->PeriphOrM2MSrcAddress); + + /*--------------------------- DMAx SxNDTR Configuration ------------------------- + * Configure the peripheral base address with parameter : + * - NbData: DMA_SxNDT[15:0] bits + */ + LL_DMA_SetDataLength(DMAx, Stream, DMA_InitStruct->NbData); + + /*--------------------------- DMA SxCR_CHSEL Configuration ---------------------- + * Configure the peripheral base address with parameter : + * - PeriphRequest: DMA_SxCR_CHSEL[2:0] bits + */ + LL_DMA_SetChannelSelection(DMAx, Stream, DMA_InitStruct->Channel); + + return SUCCESS; +} + +/** + * @brief Set each @ref LL_DMA_InitTypeDef field to default value. + * @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure. + * @retval None + */ +void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct) +{ + /* Set DMA_InitStruct fields to default values */ + DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U; + DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U; + DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY; + DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL; + DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT; + DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT; + DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE; + DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE; + DMA_InitStruct->NbData = 0x00000000U; + DMA_InitStruct->Channel = LL_DMA_CHANNEL_0; + DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW; + DMA_InitStruct->FIFOMode = LL_DMA_FIFOMODE_DISABLE; + DMA_InitStruct->FIFOThreshold = LL_DMA_FIFOTHRESHOLD_1_4; + DMA_InitStruct->MemBurst = LL_DMA_MBURST_SINGLE; + DMA_InitStruct->PeriphBurst = LL_DMA_PBURST_SINGLE; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* DMA1 || DMA2 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c new file mode 100644 index 0000000..31d70ac --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c @@ -0,0 +1,214 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_exti.c + * @author MCD Application Team + * @brief EXTI LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_exti.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (EXTI) + +/** @defgroup EXTI_LL EXTI + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup EXTI_LL_Private_Macros + * @{ + */ + +#define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U) + +#define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \ + || ((__VALUE__) == LL_EXTI_MODE_EVENT) \ + || ((__VALUE__) == LL_EXTI_MODE_IT_EVENT)) + + +#define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup EXTI_LL_Exported_Functions + * @{ + */ + +/** @addtogroup EXTI_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the EXTI registers to their default reset values. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: EXTI registers are de-initialized + * - ERROR: not applicable + */ +uint32_t LL_EXTI_DeInit(void) +{ + /* Interrupt mask register set to default reset values */ + LL_EXTI_WriteReg(IMR, 0x00000000U); + /* Event mask register set to default reset values */ + LL_EXTI_WriteReg(EMR, 0x00000000U); + /* Rising Trigger selection register set to default reset values */ + LL_EXTI_WriteReg(RTSR, 0x00000000U); + /* Falling Trigger selection register set to default reset values */ + LL_EXTI_WriteReg(FTSR, 0x00000000U); + /* Software interrupt event register set to default reset values */ + LL_EXTI_WriteReg(SWIER, 0x00000000U); + /* Pending register set to default reset values */ + LL_EXTI_WriteReg(PR, 0x00FFFFFFU); + + return SUCCESS; +} + +/** + * @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct. + * @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: EXTI registers are initialized + * - ERROR: not applicable + */ +uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct) +{ + ErrorStatus status = SUCCESS; + /* Check the parameters */ + assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31)); + assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand)); + assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode)); + + /* ENABLE LineCommand */ + if (EXTI_InitStruct->LineCommand != DISABLE) + { + assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger)); + + /* Configure EXTI Lines in range from 0 to 31 */ + if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE) + { + switch (EXTI_InitStruct->Mode) + { + case LL_EXTI_MODE_IT: + /* First Disable Event on provided Lines */ + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable IT on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_MODE_EVENT: + /* First Disable IT on provided Lines */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Event on provided Lines */ + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_MODE_IT_EVENT: + /* Directly Enable IT & Event on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + break; + default: + status = ERROR; + break; + } + if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE) + { + switch (EXTI_InitStruct->Trigger) + { + case LL_EXTI_TRIGGER_RISING: + /* First Disable Falling Trigger on provided Lines */ + LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Rising Trigger on provided Lines */ + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_TRIGGER_FALLING: + /* First Disable Rising Trigger on provided Lines */ + LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Falling Trigger on provided Lines */ + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_TRIGGER_RISING_FALLING: + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + default: + status = ERROR; + break; + } + } + } + } + /* DISABLE LineCommand */ + else + { + /* De-configure EXTI Lines in range from 0 to 31 */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + } + return status; +} + +/** + * @brief Set each @ref LL_EXTI_InitTypeDef field to default value. + * @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure. + * @retval None + */ +void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct) +{ + EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE; + EXTI_InitStruct->LineCommand = DISABLE; + EXTI_InitStruct->Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (EXTI) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c new file mode 100644 index 0000000..2e4dadb --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c @@ -0,0 +1,1692 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_fmc.c + * @author MCD Application Team + * @brief FMC Low Layer HAL module driver. + * + * This file provides firmware functions to manage the following + * functionalities of the Flexible Memory Controller (FMC) peripheral memories: + * + Initialization/de-initialization functions + * + Peripheral Control functions + * + Peripheral State functions + * + @verbatim + ============================================================================== + ##### FMC peripheral features ##### + ============================================================================== + [..] The Flexible memory controller (FMC) includes three memory controllers: + (+) The NOR/PSRAM memory controller + (+) The NAND/PC Card memory controller + (+) The Synchronous DRAM (SDRAM) controller + + [..] The FMC functional block makes the interface with synchronous and asynchronous static + memories, SDRAM memories, and 16-bit PC memory cards. Its main purposes are: + (+) to translate AHB transactions into the appropriate external device protocol + (+) to meet the access time requirements of the external memory devices + + [..] All external memories share the addresses, data and control signals with the controller. + Each external device is accessed by means of a unique Chip Select. The FMC performs + only one access at a time to an external device. + The main features of the FMC controller are the following: + (+) Interface with static-memory mapped devices including: + (++) Static random access memory (SRAM) + (++) Read-only memory (ROM) + (++) NOR Flash memory/OneNAND Flash memory + (++) PSRAM (4 memory banks) + (++) 16-bit PC Card compatible devices + (++) Two banks of NAND Flash memory with ECC hardware to check up to 8 Kbytes of + data + (+) Interface with synchronous DRAM (SDRAM) memories + (+) Independent Chip Select control for each memory bank + (+) Independent configuration for each memory bank + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_hal.h" + +/** @addtogroup STM32F4xx_HAL_Driver + * @{ + */ + +/** @defgroup FMC_LL FMC Low Layer + * @brief FMC driver modules + * @{ + */ + +#if defined (HAL_SRAM_MODULE_ENABLED) || defined(HAL_NOR_MODULE_ENABLED) || defined(HAL_NAND_MODULE_ENABLED) || defined(HAL_PCCARD_MODULE_ENABLED) || defined(HAL_SDRAM_MODULE_ENABLED) + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @addtogroup FMC_LL_Private_Functions + * @{ + */ + +/** @addtogroup FMC_LL_NORSRAM + * @brief NORSRAM Controller functions + * + @verbatim + ============================================================================== + ##### How to use NORSRAM device driver ##### + ============================================================================== + + [..] + This driver contains a set of APIs to interface with the FMC NORSRAM banks in order + to run the NORSRAM external devices. + + (+) FMC NORSRAM bank reset using the function FMC_NORSRAM_DeInit() + (+) FMC NORSRAM bank control configuration using the function FMC_NORSRAM_Init() + (+) FMC NORSRAM bank timing configuration using the function FMC_NORSRAM_Timing_Init() + (+) FMC NORSRAM bank extended timing configuration using the function + FMC_NORSRAM_Extended_Timing_Init() + (+) FMC NORSRAM bank enable/disable write operation using the functions + FMC_NORSRAM_WriteOperation_Enable()/FMC_NORSRAM_WriteOperation_Disable() + + +@endverbatim + * @{ + */ + +/** @addtogroup FMC_LL_NORSRAM_Private_Functions_Group1 + * @brief Initialization and Configuration functions + * + @verbatim + ============================================================================== + ##### Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the FMC NORSRAM interface + (+) De-initialize the FMC NORSRAM interface + (+) Configure the FMC clock and associated GPIOs + +@endverbatim + * @{ + */ + +/** + * @brief Initialize the FMC_NORSRAM device according to the specified + * control parameters in the FMC_NORSRAM_InitTypeDef + * @param Device Pointer to NORSRAM device instance + * @param Init Pointer to NORSRAM Initialization structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef* Init) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_DEVICE(Device)); + assert_param(IS_FMC_NORSRAM_BANK(Init->NSBank)); + assert_param(IS_FMC_MUX(Init->DataAddressMux)); + assert_param(IS_FMC_MEMORY(Init->MemoryType)); + assert_param(IS_FMC_NORSRAM_MEMORY_WIDTH(Init->MemoryDataWidth)); + assert_param(IS_FMC_BURSTMODE(Init->BurstAccessMode)); + assert_param(IS_FMC_WAIT_POLARITY(Init->WaitSignalPolarity)); +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) + assert_param(IS_FMC_WRAP_MODE(Init->WrapMode)); +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + assert_param(IS_FMC_WAIT_SIGNAL_ACTIVE(Init->WaitSignalActive)); + assert_param(IS_FMC_WRITE_OPERATION(Init->WriteOperation)); + assert_param(IS_FMC_WAITE_SIGNAL(Init->WaitSignal)); + assert_param(IS_FMC_EXTENDED_MODE(Init->ExtendedMode)); + assert_param(IS_FMC_ASYNWAIT(Init->AsynchronousWait)); + assert_param(IS_FMC_WRITE_BURST(Init->WriteBurst)); + assert_param(IS_FMC_CONTINOUS_CLOCK(Init->ContinuousClock)); + assert_param(IS_FMC_PAGESIZE(Init->PageSize)); +#if defined (STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + assert_param(IS_FMC_WRITE_FIFO(Init->WriteFifo)); +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ + + /* Get the BTCR register value */ + tmpr = Device->BTCR[Init->NSBank]; + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) + /* Clear MBKEN, MUXEN, MTYP, MWID, FACCEN, BURSTEN, WAITPOL, WRAPMOD, WAITCFG, WREN, + WAITEN, EXTMOD, ASYNCWAIT, CPSIZE, CBURSTRW and CCLKEN bits */ + tmpr &= ((uint32_t)~(FMC_BCR1_MBKEN | FMC_BCR1_MUXEN | FMC_BCR1_MTYP | \ + FMC_BCR1_MWID | FMC_BCR1_FACCEN | FMC_BCR1_BURSTEN | \ + FMC_BCR1_WAITPOL | FMC_BCR1_WRAPMOD | FMC_BCR1_WAITCFG | \ + FMC_BCR1_WREN | FMC_BCR1_WAITEN | FMC_BCR1_EXTMOD | \ + FMC_BCR1_ASYNCWAIT | FMC_BCR1_CPSIZE | FMC_BCR1_CBURSTRW | \ + FMC_BCR1_CCLKEN)); + + /* Set NORSRAM device control parameters */ + tmpr |= (uint32_t)(Init->DataAddressMux |\ + Init->MemoryType |\ + Init->MemoryDataWidth |\ + Init->BurstAccessMode |\ + Init->WaitSignalPolarity |\ + Init->WrapMode |\ + Init->WaitSignalActive |\ + Init->WriteOperation |\ + Init->WaitSignal |\ + Init->ExtendedMode |\ + Init->AsynchronousWait |\ + Init->PageSize |\ + Init->WriteBurst |\ + Init->ContinuousClock); +#else /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) */ + /* Clear MBKEN, MUXEN, MTYP, MWID, FACCEN, BURSTEN, WAITPOL, CPSIZE, WAITCFG, WREN, + WAITEN, EXTMOD, ASYNCWAIT, CBURSTRW, CCLKEN and WFDIS bits */ + tmpr &= ((uint32_t)~(FMC_BCR1_MBKEN | FMC_BCR1_MUXEN | FMC_BCR1_MTYP | \ + FMC_BCR1_MWID | FMC_BCR1_FACCEN | FMC_BCR1_BURSTEN | \ + FMC_BCR1_WAITPOL | FMC_BCR1_WAITCFG | FMC_BCR1_CPSIZE | \ + FMC_BCR1_WREN | FMC_BCR1_WAITEN | FMC_BCR1_EXTMOD | \ + FMC_BCR1_ASYNCWAIT | FMC_BCR1_CBURSTRW | FMC_BCR1_CCLKEN | \ + FMC_BCR1_WFDIS)); + + /* Set NORSRAM device control parameters */ + tmpr |= (uint32_t)(Init->DataAddressMux |\ + Init->MemoryType |\ + Init->MemoryDataWidth |\ + Init->BurstAccessMode |\ + Init->WaitSignalPolarity |\ + Init->WaitSignalActive |\ + Init->WriteOperation |\ + Init->WaitSignal |\ + Init->ExtendedMode |\ + Init->AsynchronousWait |\ + Init->WriteBurst |\ + Init->ContinuousClock |\ + Init->PageSize |\ + Init->WriteFifo); +#endif /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ + + if(Init->MemoryType == FMC_MEMORY_TYPE_NOR) + { + tmpr |= (uint32_t)FMC_NORSRAM_FLASH_ACCESS_ENABLE; + } + + Device->BTCR[Init->NSBank] = tmpr; + + /* Configure synchronous mode when Continuous clock is enabled for bank2..4 */ + if((Init->ContinuousClock == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC) && (Init->NSBank != FMC_NORSRAM_BANK1)) + { + Device->BTCR[FMC_NORSRAM_BANK1] |= (uint32_t)(Init->ContinuousClock); + } + +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) + if(Init->NSBank != FMC_NORSRAM_BANK1) + { + Device->BTCR[FMC_NORSRAM_BANK1] |= (uint32_t)(Init->WriteFifo); + } +#endif /* STM32F446xx || STM32F469xx || STM32F479xx */ + + return HAL_OK; +} + +/** + * @brief DeInitialize the FMC_NORSRAM peripheral + * @param Device Pointer to NORSRAM device instance + * @param ExDevice Pointer to NORSRAM extended mode device instance + * @param Bank NORSRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_DeInit(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_DEVICE(Device)); + assert_param(IS_FMC_NORSRAM_EXTENDED_DEVICE(ExDevice)); + assert_param(IS_FMC_NORSRAM_BANK(Bank)); + + /* Disable the FMC_NORSRAM device */ + __FMC_NORSRAM_DISABLE(Device, Bank); + + /* De-initialize the FMC_NORSRAM device */ + /* FMC_NORSRAM_BANK1 */ + if(Bank == FMC_NORSRAM_BANK1) + { + Device->BTCR[Bank] = 0x000030DBU; + } + /* FMC_NORSRAM_BANK2, FMC_NORSRAM_BANK3 or FMC_NORSRAM_BANK4 */ + else + { + Device->BTCR[Bank] = 0x000030D2U; + } + + Device->BTCR[Bank + 1U] = 0x0FFFFFFFU; + ExDevice->BWTR[Bank] = 0x0FFFFFFFU; + + return HAL_OK; +} + +/** + * @brief Initialize the FMC_NORSRAM Timing according to the specified + * parameters in the FMC_NORSRAM_TimingTypeDef + * @param Device Pointer to NORSRAM device instance + * @param Timing Pointer to NORSRAM Timing structure + * @param Bank NORSRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_Timing_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_DEVICE(Device)); + assert_param(IS_FMC_ADDRESS_SETUP_TIME(Timing->AddressSetupTime)); + assert_param(IS_FMC_ADDRESS_HOLD_TIME(Timing->AddressHoldTime)); + assert_param(IS_FMC_DATASETUP_TIME(Timing->DataSetupTime)); + assert_param(IS_FMC_TURNAROUND_TIME(Timing->BusTurnAroundDuration)); + assert_param(IS_FMC_CLK_DIV(Timing->CLKDivision)); + assert_param(IS_FMC_DATA_LATENCY(Timing->DataLatency)); + assert_param(IS_FMC_ACCESS_MODE(Timing->AccessMode)); + assert_param(IS_FMC_NORSRAM_BANK(Bank)); + + /* Get the BTCR register value */ + tmpr = Device->BTCR[Bank + 1U]; + + /* Clear ADDSET, ADDHLD, DATAST, BUSTURN, CLKDIV, DATLAT and ACCMOD bits */ + tmpr &= ((uint32_t)~(FMC_BTR1_ADDSET | FMC_BTR1_ADDHLD | FMC_BTR1_DATAST | \ + FMC_BTR1_BUSTURN | FMC_BTR1_CLKDIV | FMC_BTR1_DATLAT | \ + FMC_BTR1_ACCMOD)); + + /* Set FMC_NORSRAM device timing parameters */ + tmpr |= (uint32_t)(Timing->AddressSetupTime |\ + ((Timing->AddressHoldTime) << 4U) |\ + ((Timing->DataSetupTime) << 8U) |\ + ((Timing->BusTurnAroundDuration) << 16U) |\ + (((Timing->CLKDivision) - 1U) << 20U) |\ + (((Timing->DataLatency) - 2U) << 24U) |\ + (Timing->AccessMode)); + + Device->BTCR[Bank + 1U] = tmpr; + + /* Configure Clock division value (in NORSRAM bank 1) when continuous clock is enabled */ + if(HAL_IS_BIT_SET(Device->BTCR[FMC_NORSRAM_BANK1], FMC_BCR1_CCLKEN)) + { + tmpr = (uint32_t)(Device->BTCR[FMC_NORSRAM_BANK1 + 1U] & ~(0x0FU << 20U)); + tmpr |= (uint32_t)(((Timing->CLKDivision) - 1U) << 20U); + Device->BTCR[FMC_NORSRAM_BANK1 + 1U] = tmpr; + } + + return HAL_OK; +} + +/** + * @brief Initialize the FMC_NORSRAM Extended mode Timing according to the specified + * parameters in the FMC_NORSRAM_TimingTypeDef + * @param Device Pointer to NORSRAM device instance + * @param Timing Pointer to NORSRAM Timing structure + * @param Bank NORSRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_Extended_Timing_Init(FMC_NORSRAM_EXTENDED_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_EXTENDED_MODE(ExtendedMode)); + + /* Set NORSRAM device timing register for write configuration, if extended mode is used */ + if(ExtendedMode == FMC_EXTENDED_MODE_ENABLE) + { + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_EXTENDED_DEVICE(Device)); + assert_param(IS_FMC_ADDRESS_SETUP_TIME(Timing->AddressSetupTime)); + assert_param(IS_FMC_ADDRESS_HOLD_TIME(Timing->AddressHoldTime)); + assert_param(IS_FMC_DATASETUP_TIME(Timing->DataSetupTime)); + assert_param(IS_FMC_TURNAROUND_TIME(Timing->BusTurnAroundDuration)); + assert_param(IS_FMC_ACCESS_MODE(Timing->AccessMode)); + assert_param(IS_FMC_NORSRAM_BANK(Bank)); + + /* Get the BWTR register value */ + tmpr = Device->BWTR[Bank]; + + /* Clear ADDSET, ADDHLD, DATAST, BUSTURN and ACCMOD bits */ + tmpr &= ((uint32_t)~(FMC_BWTR1_ADDSET | FMC_BWTR1_ADDHLD | FMC_BWTR1_DATAST | \ + FMC_BWTR1_BUSTURN | FMC_BWTR1_ACCMOD)); + + tmpr |= (uint32_t)(Timing->AddressSetupTime |\ + ((Timing->AddressHoldTime) << 4U) |\ + ((Timing->DataSetupTime) << 8U) |\ + ((Timing->BusTurnAroundDuration) << 16U) |\ + (Timing->AccessMode)); + + Device->BWTR[Bank] = tmpr; + } + else + { + Device->BWTR[Bank] = 0x0FFFFFFFU; + } + + return HAL_OK; +} +/** + * @} + */ + +/** @addtogroup FMC_LL_NORSRAM_Private_Functions_Group2 + * @brief management functions + * +@verbatim + ============================================================================== + ##### FMC_NORSRAM Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the FMC NORSRAM interface. + +@endverbatim + * @{ + */ +/** + * @brief Enables dynamically FMC_NORSRAM write operation. + * @param Device Pointer to NORSRAM device instance + * @param Bank NORSRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Enable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_DEVICE(Device)); + assert_param(IS_FMC_NORSRAM_BANK(Bank)); + + /* Enable write operation */ + Device->BTCR[Bank] |= FMC_WRITE_OPERATION_ENABLE; + + return HAL_OK; +} + +/** + * @brief Disables dynamically FMC_NORSRAM write operation. + * @param Device Pointer to NORSRAM device instance + * @param Bank NORSRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Disable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NORSRAM_DEVICE(Device)); + assert_param(IS_FMC_NORSRAM_BANK(Bank)); + + /* Disable write operation */ + Device->BTCR[Bank] &= ~FMC_WRITE_OPERATION_ENABLE; + + return HAL_OK; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup FMC_LL_NAND + * @brief NAND Controller functions + * + @verbatim + ============================================================================== + ##### How to use NAND device driver ##### + ============================================================================== + [..] + This driver contains a set of APIs to interface with the FMC NAND banks in order + to run the NAND external devices. + + (+) FMC NAND bank reset using the function FMC_NAND_DeInit() + (+) FMC NAND bank control configuration using the function FMC_NAND_Init() + (+) FMC NAND bank common space timing configuration using the function + FMC_NAND_CommonSpace_Timing_Init() + (+) FMC NAND bank attribute space timing configuration using the function + FMC_NAND_AttributeSpace_Timing_Init() + (+) FMC NAND bank enable/disable ECC correction feature using the functions + FMC_NAND_ECC_Enable()/FMC_NAND_ECC_Disable() + (+) FMC NAND bank get ECC correction code using the function FMC_NAND_GetECC() + +@endverbatim + * @{ + */ + +#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) +/** @defgroup HAL_FMC_NAND_Group1 Initialization/de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the FMC NAND interface + (+) De-initialize the FMC NAND interface + (+) Configure the FMC clock and associated GPIOs + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the FMC_NAND device according to the specified + * control parameters in the FMC_NAND_HandleTypeDef + * @param Device Pointer to NAND device instance + * @param Init Pointer to NAND Initialization structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_Init(FMC_NAND_TypeDef *Device, FMC_NAND_InitTypeDef *Init) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Init->NandBank)); + assert_param(IS_FMC_WAIT_FEATURE(Init->Waitfeature)); + assert_param(IS_FMC_NAND_MEMORY_WIDTH(Init->MemoryDataWidth)); + assert_param(IS_FMC_ECC_STATE(Init->EccComputation)); + assert_param(IS_FMC_ECCPAGE_SIZE(Init->ECCPageSize)); + assert_param(IS_FMC_TCLR_TIME(Init->TCLRSetupTime)); + assert_param(IS_FMC_TAR_TIME(Init->TARSetupTime)); + + /* Get the NAND bank register value */ + tmpr = Device->PCR; + + /* Clear PWAITEN, PBKEN, PTYP, PWID, ECCEN, TCLR, TAR and ECCPS bits */ + tmpr &= ((uint32_t)~(FMC_PCR_PWAITEN | FMC_PCR_PBKEN | FMC_PCR_PTYP | \ + FMC_PCR_PWID | FMC_PCR_ECCEN | FMC_PCR_TCLR | \ + FMC_PCR_TAR | FMC_PCR_ECCPS)); + + /* Set NAND device control parameters */ + tmpr |= (uint32_t)(Init->Waitfeature |\ + FMC_PCR_MEMORY_TYPE_NAND |\ + Init->MemoryDataWidth |\ + Init->EccComputation |\ + Init->ECCPageSize |\ + ((Init->TCLRSetupTime) << 9U) |\ + ((Init->TARSetupTime) << 13U)); + + /* NAND bank registers configuration */ + Device->PCR = tmpr; + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_NAND Common space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to NAND device instance + * @param Timing Pointer to NAND timing structure + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_CommonSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Get the NAND bank 2 register value */ + tmpr = Device->PMEM; + + + /* Clear MEMSETx, MEMWAITx, MEMHOLDx and MEMHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PMEM_MEMSET2 | FMC_PMEM_MEMWAIT2 | FMC_PMEM_MEMHOLD2 | \ + FMC_PMEM_MEMHIZ2)); + + /* Set FMC_NAND device timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U) + ); + + /* NAND bank registers configuration */ + Device->PMEM = tmpr; + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_NAND Attribute space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to NAND device instance + * @param Timing Pointer to NAND timing structure + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_AttributeSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Get the NAND bank register value */ + tmpr = Device->PATT; + + /* Clear ATTSETx, ATTWAITx, ATTHOLDx and ATTHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PATT_ATTSET2 | FMC_PATT_ATTWAIT2 | FMC_PATT_ATTHOLD2 | \ + FMC_PATT_ATTHIZ2)); + + /* Set FMC_NAND device timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U)); + + /* NAND bank registers configuration */ + Device->PATT = tmpr; + + return HAL_OK; +} + + +/** + * @brief DeInitializes the FMC_NAND device + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_DeInit(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Disable the NAND Bank */ + __FMC_NAND_DISABLE(Device, Bank); + + /* De-initialize the NAND Bank */ + /* Set the FMC_NAND_BANK registers to their reset values */ + Device->PCR = 0x00000018U; + Device->SR = 0x00000040U; + Device->PMEM = 0xFCFCFCFCU; + Device->PATT = 0xFCFCFCFCU; + + return HAL_OK; +} + +/** + * @} + */ + + +/** @defgroup HAL_FMC_NAND_Group2 Control functions + * @brief management functions + * +@verbatim + ============================================================================== + ##### FMC_NAND Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the FMC NAND interface. + +@endverbatim + * @{ + */ + + +/** + * @brief Enables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_ECC_Enable(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Enable ECC feature */ + Device->PCR |= FMC_PCR_ECCEN; + + return HAL_OK; +} + + +/** + * @brief Disables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_ECC_Disable(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Disable ECC feature */ + Device->PCR &= ~FMC_PCR_ECCEN; + + return HAL_OK; +} + +/** + * @brief Disables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param ECCval Pointer to ECC value + * @param Bank NAND bank number + * @param Timeout Timeout wait value + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_GetECC(FMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout) +{ + uint32_t tickstart = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait until FIFO is empty */ + while(__FMC_NAND_GET_FLAG(Device, Bank, FMC_FLAG_FEMPT) == RESET) + { + /* Check for the Timeout */ + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + /* Get the ECCR register value */ + *ECCval = (uint32_t)Device->ECCR; + + return HAL_OK; +} + +/** + * @} + */ + +#else /* defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) */ +/** @defgroup HAL_FMC_NAND_Group1 Initialization/de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the FMC NAND interface + (+) De-initialize the FMC NAND interface + (+) Configure the FMC clock and associated GPIOs + +@endverbatim + * @{ + */ +/** + * @brief Initializes the FMC_NAND device according to the specified + * control parameters in the FMC_NAND_HandleTypeDef + * @param Device Pointer to NAND device instance + * @param Init Pointer to NAND Initialization structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_Init(FMC_NAND_TypeDef *Device, FMC_NAND_InitTypeDef *Init) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Init->NandBank)); + assert_param(IS_FMC_WAIT_FEATURE(Init->Waitfeature)); + assert_param(IS_FMC_NAND_MEMORY_WIDTH(Init->MemoryDataWidth)); + assert_param(IS_FMC_ECC_STATE(Init->EccComputation)); + assert_param(IS_FMC_ECCPAGE_SIZE(Init->ECCPageSize)); + assert_param(IS_FMC_TCLR_TIME(Init->TCLRSetupTime)); + assert_param(IS_FMC_TAR_TIME(Init->TARSetupTime)); + + if(Init->NandBank == FMC_NAND_BANK2) + { + /* Get the NAND bank 2 register value */ + tmpr = Device->PCR2; + } + else + { + /* Get the NAND bank 3 register value */ + tmpr = Device->PCR3; + } + + /* Clear PWAITEN, PBKEN, PTYP, PWID, ECCEN, TCLR, TAR and ECCPS bits */ + tmpr &= ((uint32_t)~(FMC_PCR2_PWAITEN | FMC_PCR2_PBKEN | FMC_PCR2_PTYP | \ + FMC_PCR2_PWID | FMC_PCR2_ECCEN | FMC_PCR2_TCLR | \ + FMC_PCR2_TAR | FMC_PCR2_ECCPS)); + + /* Set NAND device control parameters */ + tmpr |= (uint32_t)(Init->Waitfeature |\ + FMC_PCR_MEMORY_TYPE_NAND |\ + Init->MemoryDataWidth |\ + Init->EccComputation |\ + Init->ECCPageSize |\ + ((Init->TCLRSetupTime) << 9U) |\ + ((Init->TARSetupTime) << 13U)); + + if(Init->NandBank == FMC_NAND_BANK2) + { + /* NAND bank 2 registers configuration */ + Device->PCR2 = tmpr; + } + else + { + /* NAND bank 3 registers configuration */ + Device->PCR3 = tmpr; + } + + return HAL_OK; + +} + +/** + * @brief Initializes the FMC_NAND Common space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to NAND device instance + * @param Timing Pointer to NAND timing structure + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_CommonSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + if(Bank == FMC_NAND_BANK2) + { + /* Get the NAND bank 2 register value */ + tmpr = Device->PMEM2; + } + else + { + /* Get the NAND bank 3 register value */ + tmpr = Device->PMEM3; + } + + /* Clear MEMSETx, MEMWAITx, MEMHOLDx and MEMHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PMEM2_MEMSET2 | FMC_PMEM2_MEMWAIT2 | FMC_PMEM2_MEMHOLD2 | \ + FMC_PMEM2_MEMHIZ2)); + + /* Set FMC_NAND device timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U) + ); + + if(Bank == FMC_NAND_BANK2) + { + /* NAND bank 2 registers configuration */ + Device->PMEM2 = tmpr; + } + else + { + /* NAND bank 3 registers configuration */ + Device->PMEM3 = tmpr; + } + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_NAND Attribute space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to NAND device instance + * @param Timing Pointer to NAND timing structure + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_AttributeSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + if(Bank == FMC_NAND_BANK2) + { + /* Get the NAND bank 2 register value */ + tmpr = Device->PATT2; + } + else + { + /* Get the NAND bank 3 register value */ + tmpr = Device->PATT3; + } + + /* Clear ATTSETx, ATTWAITx, ATTHOLDx and ATTHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PATT2_ATTSET2 | FMC_PATT2_ATTWAIT2 | FMC_PATT2_ATTHOLD2 | \ + FMC_PATT2_ATTHIZ2)); + + /* Set FMC_NAND device timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U)); + + if(Bank == FMC_NAND_BANK2) + { + /* NAND bank 2 registers configuration */ + Device->PATT2 = tmpr; + } + else + { + /* NAND bank 3 registers configuration */ + Device->PATT3 = tmpr; + } + + return HAL_OK; +} + +/** + * @brief DeInitializes the FMC_NAND device + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_DeInit(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Disable the NAND Bank */ + __FMC_NAND_DISABLE(Device, Bank); + + /* De-initialize the NAND Bank */ + if(Bank == FMC_NAND_BANK2) + { + /* Set the FMC_NAND_BANK2 registers to their reset values */ + Device->PCR2 = 0x00000018U; + Device->SR2 = 0x00000040U; + Device->PMEM2 = 0xFCFCFCFCU; + Device->PATT2 = 0xFCFCFCFCU; + } + /* FMC_Bank3_NAND */ + else + { + /* Set the FMC_NAND_BANK3 registers to their reset values */ + Device->PCR3 = 0x00000018U; + Device->SR3 = 0x00000040U; + Device->PMEM3 = 0xFCFCFCFCU; + Device->PATT3 = 0xFCFCFCFCU; + } + + return HAL_OK; +} + +/** + * @} + */ + +/** @addtogroup FMC_LL_NAND_Private_Functions_Group2 + * @brief management functions + * +@verbatim + ============================================================================== + ##### FMC_NAND Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the FMC NAND interface. + +@endverbatim + * @{ + */ +/** + * @brief Enables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_ECC_Enable(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Enable ECC feature */ + if(Bank == FMC_NAND_BANK2) + { + Device->PCR2 |= FMC_PCR2_ECCEN; + } + else + { + Device->PCR3 |= FMC_PCR3_ECCEN; + } + + return HAL_OK; +} + +/** + * @brief Disables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param Bank NAND bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_ECC_Disable(FMC_NAND_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Disable ECC feature */ + if(Bank == FMC_NAND_BANK2) + { + Device->PCR2 &= ~FMC_PCR2_ECCEN; + } + else + { + Device->PCR3 &= ~FMC_PCR3_ECCEN; + } + + return HAL_OK; +} + +/** + * @brief Disables dynamically FMC_NAND ECC feature. + * @param Device Pointer to NAND device instance + * @param ECCval Pointer to ECC value + * @param Bank NAND bank number + * @param Timeout Timeout wait value + * @retval HAL status + */ +HAL_StatusTypeDef FMC_NAND_GetECC(FMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout) +{ + uint32_t tickstart = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_NAND_DEVICE(Device)); + assert_param(IS_FMC_NAND_BANK(Bank)); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait until FIFO is empty */ + while(__FMC_NAND_GET_FLAG(Device, Bank, FMC_FLAG_FEMPT) == RESET) + { + /* Check for the Timeout */ + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + if(Bank == FMC_NAND_BANK2) + { + /* Get the ECCR2 register value */ + *ECCval = (uint32_t)Device->ECCR2; + } + else + { + /* Get the ECCR3 register value */ + *ECCval = (uint32_t)Device->ECCR3; + } + + return HAL_OK; +} + +/** + * @} + */ + +#endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) */ +/** + * @} + */ + +#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) +/** @addtogroup FMC_LL_PCCARD + * @brief PCCARD Controller functions + * + @verbatim + ============================================================================== + ##### How to use PCCARD device driver ##### + ============================================================================== + [..] + This driver contains a set of APIs to interface with the FMC PCCARD bank in order + to run the PCCARD/compact flash external devices. + + (+) FMC PCCARD bank reset using the function FMC_PCCARD_DeInit() + (+) FMC PCCARD bank control configuration using the function FMC_PCCARD_Init() + (+) FMC PCCARD bank common space timing configuration using the function + FMC_PCCARD_CommonSpace_Timing_Init() + (+) FMC PCCARD bank attribute space timing configuration using the function + FMC_PCCARD_AttributeSpace_Timing_Init() + (+) FMC PCCARD bank IO space timing configuration using the function + FMC_PCCARD_IOSpace_Timing_Init() +@endverbatim + * @{ + */ + +/** @addtogroup FMC_LL_PCCARD_Private_Functions_Group1 + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the FMC PCCARD interface + (+) De-initialize the FMC PCCARD interface + (+) Configure the FMC clock and associated GPIOs + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the FMC_PCCARD device according to the specified + * control parameters in the FMC_PCCARD_HandleTypeDef + * @param Device Pointer to PCCARD device instance + * @param Init Pointer to PCCARD Initialization structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_PCCARD_Init(FMC_PCCARD_TypeDef *Device, FMC_PCCARD_InitTypeDef *Init) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_PCCARD_DEVICE(Device)); + assert_param(IS_FMC_WAIT_FEATURE(Init->Waitfeature)); + assert_param(IS_FMC_TCLR_TIME(Init->TCLRSetupTime)); + assert_param(IS_FMC_TAR_TIME(Init->TARSetupTime)); + + /* Get PCCARD control register value */ + tmpr = Device->PCR4; + + /* Clear TAR, TCLR, PWAITEN and PWID bits */ + tmpr &= ((uint32_t)~(FMC_PCR4_TAR | FMC_PCR4_TCLR | FMC_PCR4_PWAITEN | \ + FMC_PCR4_PWID | FMC_PCR4_PTYP)); + + /* Set FMC_PCCARD device control parameters */ + tmpr |= (uint32_t)(Init->Waitfeature |\ + FMC_NAND_PCC_MEM_BUS_WIDTH_16 |\ + (Init->TCLRSetupTime << 9U) |\ + (Init->TARSetupTime << 13U)); + + Device->PCR4 = tmpr; + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_PCCARD Common space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to PCCARD device instance + * @param Timing Pointer to PCCARD timing structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_PCCARD_CommonSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_PCCARD_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + + /* Get PCCARD common space timing register value */ + tmpr = Device->PMEM4; + + /* Clear MEMSETx, MEMWAITx, MEMHOLDx and MEMHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PMEM4_MEMSET4 | FMC_PMEM4_MEMWAIT4 | FMC_PMEM4_MEMHOLD4 | \ + FMC_PMEM4_MEMHIZ4)); + /* Set PCCARD timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U)); + + Device->PMEM4 = tmpr; + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_PCCARD Attribute space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to PCCARD device instance + * @param Timing Pointer to PCCARD timing structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_PCCARD_AttributeSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing) +{ + uint32_t tmpr = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_PCCARD_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + + /* Get PCCARD timing parameters */ + tmpr = Device->PATT4; + + /* Clear ATTSETx, ATTWAITx, ATTHOLDx and ATTHIZx bits */ + tmpr &= ((uint32_t)~(FMC_PATT4_ATTSET4 | FMC_PATT4_ATTWAIT4 | FMC_PATT4_ATTHOLD4 | \ + FMC_PATT4_ATTHIZ4)); + + /* Set PCCARD timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U)); + Device->PATT4 = tmpr; + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_PCCARD IO space Timing according to the specified + * parameters in the FMC_NAND_PCC_TimingTypeDef + * @param Device Pointer to PCCARD device instance + * @param Timing Pointer to PCCARD timing structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_PCCARD_IOSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing) +{ + uint32_t tmpr = 0; + + /* Check the parameters */ + assert_param(IS_FMC_PCCARD_DEVICE(Device)); + assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime)); + assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime)); + assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime)); + assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime)); + + /* Get FMC_PCCARD device timing parameters */ + tmpr = Device->PIO4; + + /* Clear IOSET4, IOWAIT4, IOHOLD4 and IOHIZ4 bits */ + tmpr &= ((uint32_t)~(FMC_PIO4_IOSET4 | FMC_PIO4_IOWAIT4 | FMC_PIO4_IOHOLD4 | \ + FMC_PIO4_IOHIZ4)); + + /* Set FMC_PCCARD device timing parameters */ + tmpr |= (uint32_t)(Timing->SetupTime |\ + ((Timing->WaitSetupTime) << 8U) |\ + ((Timing->HoldSetupTime) << 16U) |\ + ((Timing->HiZSetupTime) << 24U)); + + Device->PIO4 = tmpr; + + return HAL_OK; +} + +/** + * @brief DeInitializes the FMC_PCCARD device + * @param Device Pointer to PCCARD device instance + * @retval HAL status + */ +HAL_StatusTypeDef FMC_PCCARD_DeInit(FMC_PCCARD_TypeDef *Device) +{ + /* Check the parameters */ + assert_param(IS_FMC_PCCARD_DEVICE(Device)); + + /* Disable the FMC_PCCARD device */ + __FMC_PCCARD_DISABLE(Device); + + /* De-initialize the FMC_PCCARD device */ + Device->PCR4 = 0x00000018U; + Device->SR4 = 0x00000000U; + Device->PMEM4 = 0xFCFCFCFCU; + Device->PATT4 = 0xFCFCFCFCU; + Device->PIO4 = 0xFCFCFCFCU; + + return HAL_OK; +} + +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ + + +/** @addtogroup FMC_LL_SDRAM + * @brief SDRAM Controller functions + * + @verbatim + ============================================================================== + ##### How to use SDRAM device driver ##### + ============================================================================== + [..] + This driver contains a set of APIs to interface with the FMC SDRAM banks in order + to run the SDRAM external devices. + + (+) FMC SDRAM bank reset using the function FMC_SDRAM_DeInit() + (+) FMC SDRAM bank control configuration using the function FMC_SDRAM_Init() + (+) FMC SDRAM bank timing configuration using the function FMC_SDRAM_Timing_Init() + (+) FMC SDRAM bank enable/disable write operation using the functions + FMC_SDRAM_WriteOperation_Enable()/FMC_SDRAM_WriteOperation_Disable() + (+) FMC SDRAM bank send command using the function FMC_SDRAM_SendCommand() + +@endverbatim + * @{ + */ + +/** @addtogroup FMC_LL_SDRAM_Private_Functions_Group1 + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de_initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the FMC SDRAM interface + (+) De-initialize the FMC SDRAM interface + (+) Configure the FMC clock and associated GPIOs + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the FMC_SDRAM device according to the specified + * control parameters in the FMC_SDRAM_InitTypeDef + * @param Device Pointer to SDRAM device instance + * @param Init Pointer to SDRAM Initialization structure + * @retval HAL status + */ +HAL_StatusTypeDef FMC_SDRAM_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_InitTypeDef *Init) +{ + uint32_t tmpr1 = 0U; + uint32_t tmpr2 = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_SDRAM_BANK(Init->SDBank)); + assert_param(IS_FMC_COLUMNBITS_NUMBER(Init->ColumnBitsNumber)); + assert_param(IS_FMC_ROWBITS_NUMBER(Init->RowBitsNumber)); + assert_param(IS_FMC_SDMEMORY_WIDTH(Init->MemoryDataWidth)); + assert_param(IS_FMC_INTERNALBANK_NUMBER(Init->InternalBankNumber)); + assert_param(IS_FMC_CAS_LATENCY(Init->CASLatency)); + assert_param(IS_FMC_WRITE_PROTECTION(Init->WriteProtection)); + assert_param(IS_FMC_SDCLOCK_PERIOD(Init->SDClockPeriod)); + assert_param(IS_FMC_READ_BURST(Init->ReadBurst)); + assert_param(IS_FMC_READPIPE_DELAY(Init->ReadPipeDelay)); + + /* Set SDRAM bank configuration parameters */ + if (Init->SDBank != FMC_SDRAM_BANK2) + { + tmpr1 = Device->SDCR[FMC_SDRAM_BANK1]; + + /* Clear NC, NR, MWID, NB, CAS, WP, SDCLK, RBURST, and RPIPE bits */ + tmpr1 &= ((uint32_t)~(FMC_SDCR1_NC | FMC_SDCR1_NR | FMC_SDCR1_MWID | \ + FMC_SDCR1_NB | FMC_SDCR1_CAS | FMC_SDCR1_WP | \ + FMC_SDCR1_SDCLK | FMC_SDCR1_RBURST | FMC_SDCR1_RPIPE)); + + + tmpr1 |= (uint32_t)(Init->ColumnBitsNumber |\ + Init->RowBitsNumber |\ + Init->MemoryDataWidth |\ + Init->InternalBankNumber |\ + Init->CASLatency |\ + Init->WriteProtection |\ + Init->SDClockPeriod |\ + Init->ReadBurst |\ + Init->ReadPipeDelay + ); + Device->SDCR[FMC_SDRAM_BANK1] = tmpr1; + } + else /* FMC_Bank2_SDRAM */ + { + tmpr1 = Device->SDCR[FMC_SDRAM_BANK1]; + + /* Clear NC, NR, MWID, NB, CAS, WP, SDCLK, RBURST, and RPIPE bits */ + tmpr1 &= ((uint32_t)~(FMC_SDCR1_SDCLK | FMC_SDCR1_RBURST | FMC_SDCR1_RPIPE)); + + tmpr1 |= (uint32_t)(Init->SDClockPeriod |\ + Init->ReadBurst |\ + Init->ReadPipeDelay); + + tmpr2 = Device->SDCR[FMC_SDRAM_BANK2]; + + /* Clear NC, NR, MWID, NB, CAS, WP, SDCLK, RBURST, and RPIPE bits */ + tmpr2 &= ((uint32_t)~(FMC_SDCR1_NC | FMC_SDCR1_NR | FMC_SDCR1_MWID | \ + FMC_SDCR1_NB | FMC_SDCR1_CAS | FMC_SDCR1_WP | \ + FMC_SDCR1_SDCLK | FMC_SDCR1_RBURST | FMC_SDCR1_RPIPE)); + + tmpr2 |= (uint32_t)(Init->ColumnBitsNumber |\ + Init->RowBitsNumber |\ + Init->MemoryDataWidth |\ + Init->InternalBankNumber |\ + Init->CASLatency |\ + Init->WriteProtection); + + Device->SDCR[FMC_SDRAM_BANK1] = tmpr1; + Device->SDCR[FMC_SDRAM_BANK2] = tmpr2; + } + + return HAL_OK; +} + +/** + * @brief Initializes the FMC_SDRAM device timing according to the specified + * parameters in the FMC_SDRAM_TimingTypeDef + * @param Device Pointer to SDRAM device instance + * @param Timing Pointer to SDRAM Timing structure + * @param Bank SDRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_SDRAM_Timing_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_TimingTypeDef *Timing, uint32_t Bank) +{ + uint32_t tmpr1 = 0U; + uint32_t tmpr2 = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_LOADTOACTIVE_DELAY(Timing->LoadToActiveDelay)); + assert_param(IS_FMC_EXITSELFREFRESH_DELAY(Timing->ExitSelfRefreshDelay)); + assert_param(IS_FMC_SELFREFRESH_TIME(Timing->SelfRefreshTime)); + assert_param(IS_FMC_ROWCYCLE_DELAY(Timing->RowCycleDelay)); + assert_param(IS_FMC_WRITE_RECOVERY_TIME(Timing->WriteRecoveryTime)); + assert_param(IS_FMC_RP_DELAY(Timing->RPDelay)); + assert_param(IS_FMC_RCD_DELAY(Timing->RCDDelay)); + assert_param(IS_FMC_SDRAM_BANK(Bank)); + + /* Set SDRAM device timing parameters */ + if (Bank != FMC_SDRAM_BANK2) + { + tmpr1 = Device->SDTR[FMC_SDRAM_BANK1]; + + /* Clear TMRD, TXSR, TRAS, TRC, TWR, TRP and TRCD bits */ + tmpr1 &= ((uint32_t)~(FMC_SDTR1_TMRD | FMC_SDTR1_TXSR | FMC_SDTR1_TRAS | \ + FMC_SDTR1_TRC | FMC_SDTR1_TWR | FMC_SDTR1_TRP | \ + FMC_SDTR1_TRCD)); + + tmpr1 |= (uint32_t)(((Timing->LoadToActiveDelay)-1U) |\ + (((Timing->ExitSelfRefreshDelay)-1U) << 4U) |\ + (((Timing->SelfRefreshTime)-1U) << 8U) |\ + (((Timing->RowCycleDelay)-1U) << 12U) |\ + (((Timing->WriteRecoveryTime)-1U) <<16U) |\ + (((Timing->RPDelay)-1U) << 20U) |\ + (((Timing->RCDDelay)-1U) << 24U)); + Device->SDTR[FMC_SDRAM_BANK1] = tmpr1; + } + else /* FMC_Bank2_SDRAM */ + { + tmpr1 = Device->SDTR[FMC_SDRAM_BANK1]; + + /* Clear TRC and TRP bits */ + tmpr1 &= ((uint32_t)~(FMC_SDTR1_TRC | FMC_SDTR1_TRP)); + + tmpr1 |= (uint32_t)((((Timing->RowCycleDelay)-1U) << 12U) |\ + (((Timing->RPDelay)-1U) << 20U)); + + tmpr2 = Device->SDTR[FMC_SDRAM_BANK2]; + + /* Clear TMRD, TXSR, TRAS, TRC, TWR, TRP and TRCD bits */ + tmpr2 &= ((uint32_t)~(FMC_SDTR1_TMRD | FMC_SDTR1_TXSR | FMC_SDTR1_TRAS | \ + FMC_SDTR1_TRC | FMC_SDTR1_TWR | FMC_SDTR1_TRP | \ + FMC_SDTR1_TRCD)); + + tmpr2 |= (uint32_t)((((Timing->LoadToActiveDelay)-1U) |\ + (((Timing->ExitSelfRefreshDelay)-1U) << 4U) |\ + (((Timing->SelfRefreshTime)-1U) << 8U) |\ + (((Timing->WriteRecoveryTime)-1U) <<16U) |\ + (((Timing->RCDDelay)-1U) << 24U))); + + Device->SDTR[FMC_SDRAM_BANK1] = tmpr1; + Device->SDTR[FMC_SDRAM_BANK2] = tmpr2; + } + return HAL_OK; +} + +/** + * @brief DeInitializes the FMC_SDRAM peripheral + * @param Device Pointer to SDRAM device instance + * @retval HAL status + */ +HAL_StatusTypeDef FMC_SDRAM_DeInit(FMC_SDRAM_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_SDRAM_BANK(Bank)); + + /* De-initialize the SDRAM device */ + Device->SDCR[Bank] = 0x000002D0U; + Device->SDTR[Bank] = 0x0FFFFFFFU; + Device->SDCMR = 0x00000000U; + Device->SDRTR = 0x00000000U; + Device->SDSR = 0x00000000U; + + return HAL_OK; +} + +/** + * @} + */ + +/** @addtogroup FMC_LL_SDRAMPrivate_Functions_Group2 + * @brief management functions + * +@verbatim + ============================================================================== + ##### FMC_SDRAM Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control dynamically + the FMC SDRAM interface. + +@endverbatim + * @{ + */ +/** + * @brief Enables dynamically FMC_SDRAM write protection. + * @param Device Pointer to SDRAM device instance + * @param Bank SDRAM bank number + * @retval HAL status + */ +HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Enable(FMC_SDRAM_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_SDRAM_BANK(Bank)); + + /* Enable write protection */ + Device->SDCR[Bank] |= FMC_SDRAM_WRITE_PROTECTION_ENABLE; + + return HAL_OK; +} + +/** + * @brief Disables dynamically FMC_SDRAM write protection. + * @param hsdram FMC_SDRAM handle + * @retval HAL status + */ +HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Disable(FMC_SDRAM_TypeDef *Device, uint32_t Bank) +{ + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_SDRAM_BANK(Bank)); + + /* Disable write protection */ + Device->SDCR[Bank] &= ~FMC_SDRAM_WRITE_PROTECTION_ENABLE; + + return HAL_OK; +} + +/** + * @brief Send Command to the FMC SDRAM bank + * @param Device Pointer to SDRAM device instance + * @param Command Pointer to SDRAM command structure + * @param Timing Pointer to SDRAM Timing structure + * @param Timeout Timeout wait value + * @retval HAL state + */ +HAL_StatusTypeDef FMC_SDRAM_SendCommand(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout) +{ + __IO uint32_t tmpr = 0U; + uint32_t tickstart = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_COMMAND_MODE(Command->CommandMode)); + assert_param(IS_FMC_COMMAND_TARGET(Command->CommandTarget)); + assert_param(IS_FMC_AUTOREFRESH_NUMBER(Command->AutoRefreshNumber)); + assert_param(IS_FMC_MODE_REGISTER(Command->ModeRegisterDefinition)); + + /* Set command register */ + tmpr = (uint32_t)((Command->CommandMode) |\ + (Command->CommandTarget) |\ + (((Command->AutoRefreshNumber)-1U) << 5U) |\ + ((Command->ModeRegisterDefinition) << 9U) + ); + + Device->SDCMR = tmpr; + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait until command is send */ + while(HAL_IS_BIT_SET(Device->SDSR, FMC_SDSR_BUSY)) + { + /* Check for the Timeout */ + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + return HAL_OK; +} + +/** + * @brief Program the SDRAM Memory Refresh rate. + * @param Device Pointer to SDRAM device instance + * @param RefreshRate The SDRAM refresh rate value. + * @retval HAL state + */ +HAL_StatusTypeDef FMC_SDRAM_ProgramRefreshRate(FMC_SDRAM_TypeDef *Device, uint32_t RefreshRate) +{ + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_REFRESH_RATE(RefreshRate)); + + /* Set the refresh rate in command register */ + Device->SDRTR |= (RefreshRate<<1U); + + return HAL_OK; +} + +/** + * @brief Set the Number of consecutive SDRAM Memory auto Refresh commands. + * @param Device Pointer to SDRAM device instance + * @param AutoRefreshNumber Specifies the auto Refresh number. + * @retval None + */ +HAL_StatusTypeDef FMC_SDRAM_SetAutoRefreshNumber(FMC_SDRAM_TypeDef *Device, uint32_t AutoRefreshNumber) +{ + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_AUTOREFRESH_NUMBER(AutoRefreshNumber)); + + /* Set the Auto-refresh number in command register */ + Device->SDCMR |= (AutoRefreshNumber << 5U); + + return HAL_OK; +} + +/** + * @brief Returns the indicated FMC SDRAM bank mode status. + * @param Device Pointer to SDRAM device instance + * @param Bank Defines the FMC SDRAM bank. This parameter can be + * FMC_Bank1_SDRAM or FMC_Bank2_SDRAM. + * @retval The FMC SDRAM bank mode status, could be on of the following values: + * FMC_SDRAM_NORMAL_MODE, FMC_SDRAM_SELF_REFRESH_MODE or + * FMC_SDRAM_POWER_DOWN_MODE. + */ +uint32_t FMC_SDRAM_GetModeStatus(FMC_SDRAM_TypeDef *Device, uint32_t Bank) +{ + uint32_t tmpreg = 0U; + + /* Check the parameters */ + assert_param(IS_FMC_SDRAM_DEVICE(Device)); + assert_param(IS_FMC_SDRAM_BANK(Bank)); + + /* Get the corresponding bank mode */ + if(Bank == FMC_SDRAM_BANK1) + { + tmpreg = (uint32_t)(Device->SDSR & FMC_SDSR_MODES1); + } + else + { + tmpreg = ((uint32_t)(Device->SDSR & FMC_SDSR_MODES2) >> 2U); + } + + /* Return the mode status */ + return tmpreg; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ +#endif /* HAL_SRAM_MODULE_ENABLED || HAL_NOR_MODULE_ENABLED || HAL_NAND_MODULE_ENABLED || HAL_PCCARD_MODULE_ENABLED || HAL_SDRAM_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c new file mode 100644 index 0000000..bfdcb1e --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c @@ -0,0 +1,305 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_gpio.c + * @author MCD Application Team + * @brief GPIO LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_gpio.h" +#include "stm32f4xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) + +/** @addtogroup GPIO_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup GPIO_LL_Private_Macros + * @{ + */ +#define IS_LL_GPIO_PIN(__VALUE__) (((0x00000000U) < (__VALUE__)) && ((__VALUE__) <= (LL_GPIO_PIN_ALL))) + +#define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_INPUT) ||\ + ((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\ + ((__VALUE__) == LL_GPIO_MODE_ALTERNATE) ||\ + ((__VALUE__) == LL_GPIO_MODE_ANALOG)) + +#define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\ + ((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN)) + +#define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\ + ((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\ + ((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH) ||\ + ((__VALUE__) == LL_GPIO_SPEED_FREQ_VERY_HIGH)) + +#define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_NO) ||\ + ((__VALUE__) == LL_GPIO_PULL_UP) ||\ + ((__VALUE__) == LL_GPIO_PULL_DOWN)) + +#define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\ + ((__VALUE__) == LL_GPIO_AF_1 ) ||\ + ((__VALUE__) == LL_GPIO_AF_2 ) ||\ + ((__VALUE__) == LL_GPIO_AF_3 ) ||\ + ((__VALUE__) == LL_GPIO_AF_4 ) ||\ + ((__VALUE__) == LL_GPIO_AF_5 ) ||\ + ((__VALUE__) == LL_GPIO_AF_6 ) ||\ + ((__VALUE__) == LL_GPIO_AF_7 ) ||\ + ((__VALUE__) == LL_GPIO_AF_8 ) ||\ + ((__VALUE__) == LL_GPIO_AF_9 ) ||\ + ((__VALUE__) == LL_GPIO_AF_10 ) ||\ + ((__VALUE__) == LL_GPIO_AF_11 ) ||\ + ((__VALUE__) == LL_GPIO_AF_12 ) ||\ + ((__VALUE__) == LL_GPIO_AF_13 ) ||\ + ((__VALUE__) == LL_GPIO_AF_14 ) ||\ + ((__VALUE__) == LL_GPIO_AF_15 )) +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup GPIO_LL_Exported_Functions + * @{ + */ + +/** @addtogroup GPIO_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize GPIO registers (Registers restored to their default values). + * @param GPIOx GPIO Port + * @retval An ErrorStatus enumeration value: + * - SUCCESS: GPIO registers are de-initialized + * - ERROR: Wrong GPIO Port + */ +ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx) +{ + ErrorStatus status = SUCCESS; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + + /* Force and Release reset on clock of GPIOx Port */ + if (GPIOx == GPIOA) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOA); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOA); + } + else if (GPIOx == GPIOB) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOB); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOB); + } + else if (GPIOx == GPIOC) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOC); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOC); + } +#if defined(GPIOD) + else if (GPIOx == GPIOD) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOD); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOD); + } +#endif /* GPIOD */ +#if defined(GPIOE) + else if (GPIOx == GPIOE) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOE); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOE); + } +#endif /* GPIOE */ +#if defined(GPIOF) + else if (GPIOx == GPIOF) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOF); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOF); + } +#endif /* GPIOF */ +#if defined(GPIOG) + else if (GPIOx == GPIOG) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOG); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOG); + } +#endif /* GPIOG */ +#if defined(GPIOH) + else if (GPIOx == GPIOH) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOH); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOH); + } +#endif /* GPIOH */ +#if defined(GPIOI) + else if (GPIOx == GPIOI) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOI); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOI); + } +#endif /* GPIOI */ +#if defined(GPIOJ) + else if (GPIOx == GPIOJ) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOJ); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOJ); + } +#endif /* GPIOJ */ +#if defined(GPIOK) + else if (GPIOx == GPIOK) + { + LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOK); + LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOK); + } +#endif /* GPIOK */ + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct. + * @param GPIOx GPIO Port + * @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure + * that contains the configuration information for the specified GPIO peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content + * - ERROR: Not applicable + */ +ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) +{ + uint32_t pinpos = 0x00000000U; + uint32_t currentpin = 0x00000000U; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); + assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); + assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); + + /* ------------------------- Configure the port pins ---------------- */ + /* Initialize pinpos on first pin set */ + pinpos = POSITION_VAL(GPIO_InitStruct->Pin); + + /* Configure the port pins */ + while (((GPIO_InitStruct->Pin) >> pinpos) != 0x00000000U) + { + /* Get current io position */ + currentpin = (GPIO_InitStruct->Pin) & (0x00000001U << pinpos); + + if (currentpin) + { + + if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) + { + /* Check Speed mode parameters */ + assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); + + /* Speed mode configuration */ + LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); + + /* Check Output mode parameters */ + assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); + + /* Output mode configuration*/ + LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType); + } + + /* Pull-up Pull down resistor configuration*/ + LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); + + if (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE) + { + /* Check Alternate parameter */ + assert_param(IS_LL_GPIO_ALTERNATE(GPIO_InitStruct->Alternate)); + + /* Speed mode configuration */ + if (POSITION_VAL(currentpin) < 0x00000008U) + { + LL_GPIO_SetAFPin_0_7(GPIOx, currentpin, GPIO_InitStruct->Alternate); + } + else + { + LL_GPIO_SetAFPin_8_15(GPIOx, currentpin, GPIO_InitStruct->Alternate); + } + } + + /* Pin Mode configuration */ + LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); + } + pinpos++; + } + + return (SUCCESS); +} + +/** + * @brief Set each @ref LL_GPIO_InitTypeDef field to default value. + * @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ + +void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct) +{ + /* Reset GPIO init structure parameters values */ + GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL; + GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG; + GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct->Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct->Alternate = LL_GPIO_AF_0; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c new file mode 100644 index 0000000..ea18adc --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c @@ -0,0 +1,1663 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_rcc.c + * @author MCD Application Team + * @brief RCC LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_rcc.h" +#ifdef USE_FULL_ASSERT + #include "stm32_assert.h" +#else + #define assert_param(expr) ((void)0U) +#endif +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @addtogroup RCC_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup RCC_LL_Private_Macros + * @{ + */ +#if defined(FMPI2C1) +#define IS_LL_RCC_FMPI2C_CLKSOURCE(__VALUE__) ((__VALUE__) == LL_RCC_FMPI2C1_CLKSOURCE) +#endif /* FMPI2C1 */ + +#if defined(LPTIM1) +#define IS_LL_RCC_LPTIM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_LPTIM1_CLKSOURCE)) +#endif /* LPTIM1 */ + +#if defined(SAI1) +#if defined(RCC_DCKCFGR_SAI1SRC) +#define IS_LL_RCC_SAI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SAI1_CLKSOURCE) \ + || ((__VALUE__) == LL_RCC_SAI2_CLKSOURCE)) +#elif defined(RCC_DCKCFGR_SAI1ASRC) +#define IS_LL_RCC_SAI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SAI1_A_CLKSOURCE) \ + || ((__VALUE__) == LL_RCC_SAI1_B_CLKSOURCE)) +#endif /* RCC_DCKCFGR_SAI1SRC */ +#endif /* SAI1 */ + +#if defined(SDIO) +#define IS_LL_RCC_SDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SDIO_CLKSOURCE)) +#endif /* SDIO */ + +#if defined(RNG) +#define IS_LL_RCC_RNG_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_RNG_CLKSOURCE)) +#endif /* RNG */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +#define IS_LL_RCC_USB_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_USB_CLKSOURCE)) +#endif /* USB_OTG_FS || USB_OTG_HS */ + +#if defined(DFSDM2_Channel0) +#define IS_LL_RCC_DFSDM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_CLKSOURCE)) + +#define IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_AUDIO_CLKSOURCE) \ + || ((__VALUE__) == LL_RCC_DFSDM2_AUDIO_CLKSOURCE)) +#elif defined(DFSDM1_Channel0) +#define IS_LL_RCC_DFSDM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_CLKSOURCE)) + +#define IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_AUDIO_CLKSOURCE)) +#endif /* DFSDM2_Channel0 */ + +#if defined(RCC_DCKCFGR_I2S2SRC) +#define IS_LL_RCC_I2S_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_I2S1_CLKSOURCE) \ + || ((__VALUE__) == LL_RCC_I2S2_CLKSOURCE)) +#else +#define IS_LL_RCC_I2S_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_I2S1_CLKSOURCE)) +#endif /* RCC_DCKCFGR_I2S2SRC */ + +#if defined(CEC) +#define IS_LL_RCC_CEC_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_CEC_CLKSOURCE)) +#endif /* CEC */ + +#if defined(DSI) +#define IS_LL_RCC_DSI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DSI_CLKSOURCE)) +#endif /* DSI */ + +#if defined(LTDC) +#define IS_LL_RCC_LTDC_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_LTDC_CLKSOURCE)) +#endif /* LTDC */ + +#if defined(SPDIFRX) +#define IS_LL_RCC_SPDIFRX_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SPDIFRX1_CLKSOURCE)) +#endif /* SPDIFRX */ +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup RCC_LL_Private_Functions RCC Private functions + * @{ + */ +uint32_t RCC_GetSystemClockFreq(void); +uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency); +uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency); +uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency); +uint32_t RCC_PLL_GetFreqDomain_SYS(uint32_t SYSCLK_Source); +uint32_t RCC_PLL_GetFreqDomain_48M(void); +#if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC) +uint32_t RCC_PLL_GetFreqDomain_I2S(void); +#endif /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ +#if defined(SPDIFRX) +uint32_t RCC_PLL_GetFreqDomain_SPDIFRX(void); +#endif /* SPDIFRX */ +#if defined(RCC_PLLCFGR_PLLR) +#if defined(SAI1) +uint32_t RCC_PLL_GetFreqDomain_SAI(void); +#endif /* SAI1 */ +#endif /* RCC_PLLCFGR_PLLR */ +#if defined(DSI) +uint32_t RCC_PLL_GetFreqDomain_DSI(void); +#endif /* DSI */ +#if defined(RCC_PLLSAI_SUPPORT) +uint32_t RCC_PLLSAI_GetFreqDomain_SAI(void); +#if defined(RCC_PLLSAICFGR_PLLSAIP) +uint32_t RCC_PLLSAI_GetFreqDomain_48M(void); +#endif /* RCC_PLLSAICFGR_PLLSAIP */ +#if defined(LTDC) +uint32_t RCC_PLLSAI_GetFreqDomain_LTDC(void); +#endif /* LTDC */ +#endif /* RCC_PLLSAI_SUPPORT */ +#if defined(RCC_PLLI2S_SUPPORT) +uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void); +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +uint32_t RCC_PLLI2S_GetFreqDomain_48M(void); +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +#if defined(SAI1) +uint32_t RCC_PLLI2S_GetFreqDomain_SAI(void); +#endif /* SAI1 */ +#if defined(SPDIFRX) +uint32_t RCC_PLLI2S_GetFreqDomain_SPDIFRX(void); +#endif /* SPDIFRX */ +#endif /* RCC_PLLI2S_SUPPORT */ +/** + * @} + */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup RCC_LL_Exported_Functions + * @{ + */ + +/** @addtogroup RCC_LL_EF_Init + * @{ + */ + +/** + * @brief Reset the RCC clock configuration to the default reset state. + * @note The default reset state of the clock configuration is given below: + * - HSI ON and used as system clock source + * - HSE and PLL OFF + * - AHB, APB1 and APB2 prescaler set to 1. + * - CSS, MCO OFF + * - All interrupts disabled + * @note This function doesn't modify the configuration of the + * - Peripheral clocks + * - LSI, LSE and RTC clocks + * @retval An ErrorStatus enumeration value: + * - SUCCESS: RCC registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_RCC_DeInit(void) +{ + __IO uint32_t vl_mask; + + /* Set HSION bit */ + LL_RCC_HSI_Enable(); + + /* Wait for HSI READY bit */ + while(LL_RCC_HSI_IsReady() != 1U) + {} + + /* Reset CFGR register */ + LL_RCC_WriteReg(CFGR, 0x00000000U); + + /* Read CR register */ + vl_mask = LL_RCC_ReadReg(CR); + + /* Reset HSEON, HSEBYP, PLLON, CSSON bits */ + CLEAR_BIT(vl_mask, + (RCC_CR_HSEON | RCC_CR_HSEBYP | RCC_CR_PLLON | RCC_CR_CSSON)); + +#if defined(RCC_PLLSAI_SUPPORT) + /* Reset PLLSAION bit */ + CLEAR_BIT(vl_mask, RCC_CR_PLLSAION); +#endif /* RCC_PLLSAI_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) + /* Reset PLLI2SON bit */ + CLEAR_BIT(vl_mask, RCC_CR_PLLI2SON); +#endif /* RCC_PLLI2S_SUPPORT */ + + /* Write new value in CR register */ + LL_RCC_WriteReg(CR, vl_mask); + + /* Set HSITRIM bits to the reset value*/ + LL_RCC_HSI_SetCalibTrimming(0x10U); + + /* Wait for PLL READY bit to be reset */ + while(LL_RCC_PLL_IsReady() != 0U) + {} + + /* Reset PLLCFGR register */ + LL_RCC_WriteReg(PLLCFGR, RCC_PLLCFGR_RST_VALUE); + +#if defined(RCC_PLLI2S_SUPPORT) + /* Reset PLLI2SCFGR register */ + LL_RCC_WriteReg(PLLI2SCFGR, RCC_PLLI2SCFGR_RST_VALUE); +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLLSAI_SUPPORT) + /* Reset PLLSAICFGR register */ + LL_RCC_WriteReg(PLLSAICFGR, RCC_PLLSAICFGR_RST_VALUE); +#endif /* RCC_PLLSAI_SUPPORT */ + + /* Disable all interrupts */ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE | RCC_CIR_LSERDYIE | RCC_CIR_HSIRDYIE | RCC_CIR_HSERDYIE | RCC_CIR_PLLRDYIE); + +#if defined(RCC_CIR_PLLI2SRDYIE) + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE); +#endif /* RCC_CIR_PLLI2SRDYIE */ + +#if defined(RCC_CIR_PLLSAIRDYIE) + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE); +#endif /* RCC_CIR_PLLSAIRDYIE */ + + /* Clear all interrupt flags */ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC | RCC_CIR_LSERDYC | RCC_CIR_HSIRDYC | RCC_CIR_HSERDYC | RCC_CIR_PLLRDYC | RCC_CIR_CSSC); + +#if defined(RCC_CIR_PLLI2SRDYC) + SET_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYC); +#endif /* RCC_CIR_PLLI2SRDYC */ + +#if defined(RCC_CIR_PLLSAIRDYC) + SET_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYC); +#endif /* RCC_CIR_PLLSAIRDYC */ + + /* Clear LSION bit */ + CLEAR_BIT(RCC->CSR, RCC_CSR_LSION); + + /* Reset all CSR flags */ + SET_BIT(RCC->CSR, RCC_CSR_RMVF); + + return SUCCESS; +} + +/** + * @} + */ + +/** @addtogroup RCC_LL_EF_Get_Freq + * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks + * and different peripheral clocks available on the device. + * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(**) + * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(***) + * @note If SYSCLK source is PLL, function returns values based on HSE_VALUE(***) + * or HSI_VALUE(**) multiplied/divided by the PLL factors. + * @note (**) HSI_VALUE is a constant defined in this file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * @note (***) HSE_VALUE is a constant defined in this file (default value + * 25 MHz), user has to ensure that HSE_VALUE is same as the real + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * @note The result of this function could be incorrect when using fractional + * value for HSE crystal. + * @note This function can be used by the user application to compute the + * baud-rate for the communication peripherals or configure other parameters. + * @{ + */ + +/** + * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks + * @note Each time SYSCLK, HCLK, PCLK1 and/or PCLK2 clock changes, this function + * must be called to update structure fields. Otherwise, any + * configuration based on this function will be incorrect. + * @param RCC_Clocks pointer to a @ref LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies + * @retval None + */ +void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks) +{ + /* Get SYSCLK frequency */ + RCC_Clocks->SYSCLK_Frequency = RCC_GetSystemClockFreq(); + + /* HCLK clock frequency */ + RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency); + + /* PCLK1 clock frequency */ + RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency); + + /* PCLK2 clock frequency */ + RCC_Clocks->PCLK2_Frequency = RCC_GetPCLK2ClockFreq(RCC_Clocks->HCLK_Frequency); +} + +#if defined(FMPI2C1) +/** + * @brief Return FMPI2Cx clock frequency + * @param FMPI2CxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE + * @retval FMPI2C clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that HSI oscillator is not ready + */ +uint32_t LL_RCC_GetFMPI2CClockFreq(uint32_t FMPI2CxSource) +{ + uint32_t FMPI2C_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_FMPI2C_CLKSOURCE(FMPI2CxSource)); + + if (FMPI2CxSource == LL_RCC_FMPI2C1_CLKSOURCE) + { + /* FMPI2C1 CLK clock frequency */ + switch (LL_RCC_GetFMPI2CClockSource(FMPI2CxSource)) + { + case LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK: /* FMPI2C1 Clock is System Clock */ + FMPI2C_frequency = RCC_GetSystemClockFreq(); + break; + + case LL_RCC_FMPI2C1_CLKSOURCE_HSI: /* FMPI2C1 Clock is HSI Osc. */ + if (LL_RCC_HSI_IsReady()) + { + FMPI2C_frequency = HSI_VALUE; + } + break; + + case LL_RCC_FMPI2C1_CLKSOURCE_PCLK1: /* FMPI2C1 Clock is PCLK1 */ + default: + FMPI2C_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); + break; + } + } + + return FMPI2C_frequency; +} +#endif /* FMPI2C1 */ + +/** + * @brief Return I2Sx clock frequency + * @param I2SxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S1_CLKSOURCE + * @arg @ref LL_RCC_I2S2_CLKSOURCE (*) + * + * (*) value not defined in all devices. + * @retval I2S clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource) +{ + uint32_t i2s_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_I2S_CLKSOURCE(I2SxSource)); + + if (I2SxSource == LL_RCC_I2S1_CLKSOURCE) + { + /* I2S1 CLK clock frequency */ + switch (LL_RCC_GetI2SClockSource(I2SxSource)) + { +#if defined(RCC_PLLI2S_SUPPORT) + case LL_RCC_I2S1_CLKSOURCE_PLLI2S: /* I2S1 Clock is PLLI2S */ + if (LL_RCC_PLLI2S_IsReady()) + { + i2s_frequency = RCC_PLLI2S_GetFreqDomain_I2S(); + } + break; +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC) + case LL_RCC_I2S1_CLKSOURCE_PLL: /* I2S1 Clock is PLL */ + if (LL_RCC_PLL_IsReady()) + { + i2s_frequency = RCC_PLL_GetFreqDomain_I2S(); + } + break; + + case LL_RCC_I2S1_CLKSOURCE_PLLSRC: /* I2S1 Clock is PLL Main source */ + switch (LL_RCC_PLL_GetMainSource()) + { + case LL_RCC_PLLSOURCE_HSE: /* I2S1 Clock is HSE Osc. */ + if (LL_RCC_HSE_IsReady()) + { + i2s_frequency = HSE_VALUE; + } + break; + + case LL_RCC_PLLSOURCE_HSI: /* I2S1 Clock is HSI Osc. */ + default: + if (LL_RCC_HSI_IsReady()) + { + i2s_frequency = HSI_VALUE; + } + break; + } + break; +#endif /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ + + case LL_RCC_I2S1_CLKSOURCE_PIN: /* I2S1 Clock is External clock */ + default: + i2s_frequency = EXTERNAL_CLOCK_VALUE; + break; + } + } +#if defined(RCC_DCKCFGR_I2S2SRC) + else + { + /* I2S2 CLK clock frequency */ + switch (LL_RCC_GetI2SClockSource(I2SxSource)) + { + case LL_RCC_I2S2_CLKSOURCE_PLLI2S: /* I2S2 Clock is PLLI2S */ + if (LL_RCC_PLLI2S_IsReady()) + { + i2s_frequency = RCC_PLLI2S_GetFreqDomain_I2S(); + } + break; + + case LL_RCC_I2S2_CLKSOURCE_PLL: /* I2S2 Clock is PLL */ + if (LL_RCC_PLL_IsReady()) + { + i2s_frequency = RCC_PLL_GetFreqDomain_I2S(); + } + break; + + case LL_RCC_I2S2_CLKSOURCE_PLLSRC: /* I2S2 Clock is PLL Main source */ + switch (LL_RCC_PLL_GetMainSource()) + { + case LL_RCC_PLLSOURCE_HSE: /* I2S2 Clock is HSE Osc. */ + if (LL_RCC_HSE_IsReady()) + { + i2s_frequency = HSE_VALUE; + } + break; + + case LL_RCC_PLLSOURCE_HSI: /* I2S2 Clock is HSI Osc. */ + default: + if (LL_RCC_HSI_IsReady()) + { + i2s_frequency = HSI_VALUE; + } + break; + } + break; + + case LL_RCC_I2S2_CLKSOURCE_PIN: /* I2S2 Clock is External clock */ + default: + i2s_frequency = EXTERNAL_CLOCK_VALUE; + break; + } + } +#endif /* RCC_DCKCFGR_I2S2SRC */ + + return i2s_frequency; +} + +#if defined(LPTIM1) +/** + * @brief Return LPTIMx clock frequency + * @param LPTIMxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_LPTIM1_CLKSOURCE + * @retval LPTIM clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI, LSI or LSE) is not ready + */ +uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource) +{ + uint32_t lptim_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_LPTIM_CLKSOURCE(LPTIMxSource)); + + if (LPTIMxSource == LL_RCC_LPTIM1_CLKSOURCE) + { + /* LPTIM1CLK clock frequency */ + switch (LL_RCC_GetLPTIMClockSource(LPTIMxSource)) + { + case LL_RCC_LPTIM1_CLKSOURCE_LSI: /* LPTIM1 Clock is LSI Osc. */ + if (LL_RCC_LSI_IsReady()) + { + lptim_frequency = LSI_VALUE; + } + break; + + case LL_RCC_LPTIM1_CLKSOURCE_HSI: /* LPTIM1 Clock is HSI Osc. */ + if (LL_RCC_HSI_IsReady()) + { + lptim_frequency = HSI_VALUE; + } + break; + + case LL_RCC_LPTIM1_CLKSOURCE_LSE: /* LPTIM1 Clock is LSE Osc. */ + if (LL_RCC_LSE_IsReady()) + { + lptim_frequency = LSE_VALUE; + } + break; + + case LL_RCC_LPTIM1_CLKSOURCE_PCLK1: /* LPTIM1 Clock is PCLK1 */ + default: + lptim_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); + break; + } + } + + return lptim_frequency; +} +#endif /* LPTIM1 */ + +#if defined(SAI1) +/** + * @brief Return SAIx clock frequency + * @param SAIxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SAI1_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI2_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI1_A_CLKSOURCE (*) + * @arg @ref LL_RCC_SAI1_B_CLKSOURCE (*) + * + * (*) value not defined in all devices. + * @retval SAI clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource) +{ + uint32_t sai_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_SAI_CLKSOURCE(SAIxSource)); + +#if defined(RCC_DCKCFGR_SAI1SRC) + if ((SAIxSource == LL_RCC_SAI1_CLKSOURCE) || (SAIxSource == LL_RCC_SAI2_CLKSOURCE)) + { + /* SAI1CLK clock frequency */ + switch (LL_RCC_GetSAIClockSource(SAIxSource)) + { + case LL_RCC_SAI1_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 clock source */ + case LL_RCC_SAI2_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI2 clock source */ + if (LL_RCC_PLLSAI_IsReady()) + { + sai_frequency = RCC_PLLSAI_GetFreqDomain_SAI(); + } + break; + + case LL_RCC_SAI1_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 clock source */ + case LL_RCC_SAI2_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI2 clock source */ + if (LL_RCC_PLLI2S_IsReady()) + { + sai_frequency = RCC_PLLI2S_GetFreqDomain_SAI(); + } + break; + + case LL_RCC_SAI1_CLKSOURCE_PLL: /* PLL clock used as SAI1 clock source */ + case LL_RCC_SAI2_CLKSOURCE_PLL: /* PLL clock used as SAI2 clock source */ + if (LL_RCC_PLL_IsReady()) + { + sai_frequency = RCC_PLL_GetFreqDomain_SAI(); + } + break; + + case LL_RCC_SAI2_CLKSOURCE_PLLSRC: + switch (LL_RCC_PLL_GetMainSource()) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE clock used as SAI2 clock source */ + if (LL_RCC_HSE_IsReady()) + { + sai_frequency = HSE_VALUE; + } + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI clock used as SAI2 clock source */ + default: + if (LL_RCC_HSI_IsReady()) + { + sai_frequency = HSI_VALUE; + } + break; + } + break; + + case LL_RCC_SAI1_CLKSOURCE_PIN: /* External input clock used as SAI1 clock source */ + default: + sai_frequency = EXTERNAL_CLOCK_VALUE; + break; + } + } +#endif /* RCC_DCKCFGR_SAI1SRC */ +#if defined(RCC_DCKCFGR_SAI1ASRC) + if ((SAIxSource == LL_RCC_SAI1_A_CLKSOURCE) || (SAIxSource == LL_RCC_SAI1_B_CLKSOURCE)) + { + /* SAI1CLK clock frequency */ + switch (LL_RCC_GetSAIClockSource(SAIxSource)) + { +#if defined(RCC_PLLSAI_SUPPORT) + case LL_RCC_SAI1_A_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 Block A clock source */ + case LL_RCC_SAI1_B_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 Block B clock source */ + if (LL_RCC_PLLSAI_IsReady()) + { + sai_frequency = RCC_PLLSAI_GetFreqDomain_SAI(); + } + break; +#endif /* RCC_PLLSAI_SUPPORT */ + + case LL_RCC_SAI1_A_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 Block A clock source */ + case LL_RCC_SAI1_B_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 Block B clock source */ + if (LL_RCC_PLLI2S_IsReady()) + { + sai_frequency = RCC_PLLI2S_GetFreqDomain_SAI(); + } + break; + +#if defined(RCC_SAI1A_PLLSOURCE_SUPPORT) + case LL_RCC_SAI1_A_CLKSOURCE_PLL: /* PLL clock used as SAI1 Block A clock source */ + case LL_RCC_SAI1_B_CLKSOURCE_PLL: /* PLL clock used as SAI1 Block B clock source */ + if (LL_RCC_PLL_IsReady()) + { + sai_frequency = RCC_PLL_GetFreqDomain_SAI(); + } + break; + + case LL_RCC_SAI1_A_CLKSOURCE_PLLSRC: + case LL_RCC_SAI1_B_CLKSOURCE_PLLSRC: + switch (LL_RCC_PLL_GetMainSource()) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE clock used as SAI1 Block A or B clock source */ + if (LL_RCC_HSE_IsReady()) + { + sai_frequency = HSE_VALUE; + } + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI clock used as SAI1 Block A or B clock source */ + default: + if (LL_RCC_HSI_IsReady()) + { + sai_frequency = HSI_VALUE; + } + break; + } + break; +#endif /* RCC_SAI1A_PLLSOURCE_SUPPORT */ + + case LL_RCC_SAI1_A_CLKSOURCE_PIN: /* External input clock used as SAI1 Block A clock source */ + case LL_RCC_SAI1_B_CLKSOURCE_PIN: /* External input clock used as SAI1 Block B clock source */ + default: + sai_frequency = EXTERNAL_CLOCK_VALUE; + break; + } + } +#endif /* RCC_DCKCFGR_SAI1ASRC */ + + return sai_frequency; +} +#endif /* SAI1 */ + +#if defined(SDIO) +/** + * @brief Return SDIOx clock frequency + * @param SDIOxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SDIO_CLKSOURCE + * @retval SDIO clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetSDIOClockFreq(uint32_t SDIOxSource) +{ + uint32_t SDIO_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_SDIO_CLKSOURCE(SDIOxSource)); + + if (SDIOxSource == LL_RCC_SDIO_CLKSOURCE) + { +#if defined(RCC_DCKCFGR_SDIOSEL) || defined(RCC_DCKCFGR2_SDIOSEL) + /* SDIOCLK clock frequency */ + switch (LL_RCC_GetSDIOClockSource(SDIOxSource)) + { + case LL_RCC_SDIO_CLKSOURCE_PLL48CLK: /* PLL48M clock used as SDIO clock source */ + switch (LL_RCC_GetCK48MClockSource(LL_RCC_CK48M_CLKSOURCE)) + { + case LL_RCC_CK48M_CLKSOURCE_PLL: /* PLL clock used as 48Mhz domain clock */ + if (LL_RCC_PLL_IsReady()) + { + SDIO_frequency = RCC_PLL_GetFreqDomain_48M(); + } + break; + +#if defined(RCC_PLLSAI_SUPPORT) + case LL_RCC_CK48M_CLKSOURCE_PLLSAI: /* PLLSAI clock used as 48Mhz domain clock */ + default: + if (LL_RCC_PLLSAI_IsReady()) + { + SDIO_frequency = RCC_PLLSAI_GetFreqDomain_48M(); + } + break; +#endif /* RCC_PLLSAI_SUPPORT */ + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) + case LL_RCC_CK48M_CLKSOURCE_PLLI2S: /* PLLI2S clock used as 48Mhz domain clock */ + default: + if (LL_RCC_PLLI2S_IsReady()) + { + SDIO_frequency = RCC_PLLI2S_GetFreqDomain_48M(); + } + break; +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ + } + break; + + case LL_RCC_SDIO_CLKSOURCE_SYSCLK: /* PLL clock used as SDIO clock source */ + default: + SDIO_frequency = RCC_GetSystemClockFreq(); + break; + } +#else + /* PLL clock used as 48Mhz domain clock */ + if (LL_RCC_PLL_IsReady()) + { + SDIO_frequency = RCC_PLL_GetFreqDomain_48M(); + } +#endif /* RCC_DCKCFGR_SDIOSEL || RCC_DCKCFGR2_SDIOSEL */ + } + + return SDIO_frequency; +} +#endif /* SDIO */ + +#if defined(RNG) +/** + * @brief Return RNGx clock frequency + * @param RNGxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_RNG_CLKSOURCE + * @retval RNG clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource) +{ + uint32_t rng_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_RNG_CLKSOURCE(RNGxSource)); + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) + /* RNGCLK clock frequency */ + switch (LL_RCC_GetRNGClockSource(RNGxSource)) + { +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) + case LL_RCC_RNG_CLKSOURCE_PLLI2S: /* PLLI2S clock used as RNG clock source */ + if (LL_RCC_PLLI2S_IsReady()) + { + rng_frequency = RCC_PLLI2S_GetFreqDomain_48M(); + } + break; +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ + +#if defined(RCC_PLLSAI_SUPPORT) + case LL_RCC_RNG_CLKSOURCE_PLLSAI: /* PLLSAI clock used as RNG clock source */ + if (LL_RCC_PLLSAI_IsReady()) + { + rng_frequency = RCC_PLLSAI_GetFreqDomain_48M(); + } + break; +#endif /* RCC_PLLSAI_SUPPORT */ + + case LL_RCC_RNG_CLKSOURCE_PLL: /* PLL clock used as RNG clock source */ + default: + if (LL_RCC_PLL_IsReady()) + { + rng_frequency = RCC_PLL_GetFreqDomain_48M(); + } + break; + } +#else + /* PLL clock used as RNG clock source */ + if (LL_RCC_PLL_IsReady()) + { + rng_frequency = RCC_PLL_GetFreqDomain_48M(); + } +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + + return rng_frequency; +} +#endif /* RNG */ + +#if defined(CEC) +/** + * @brief Return CEC clock frequency + * @param CECxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_CEC_CLKSOURCE + * @retval CEC clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI or LSE) is not ready + */ +uint32_t LL_RCC_GetCECClockFreq(uint32_t CECxSource) +{ + uint32_t cec_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_CEC_CLKSOURCE(CECxSource)); + + /* CECCLK clock frequency */ + switch (LL_RCC_GetCECClockSource(CECxSource)) + { + case LL_RCC_CEC_CLKSOURCE_LSE: /* CEC Clock is LSE Osc. */ + if (LL_RCC_LSE_IsReady()) + { + cec_frequency = LSE_VALUE; + } + break; + + case LL_RCC_CEC_CLKSOURCE_HSI_DIV488: /* CEC Clock is HSI Osc. */ + default: + if (LL_RCC_HSI_IsReady()) + { + cec_frequency = HSI_VALUE/488U; + } + break; + } + + return cec_frequency; +} +#endif /* CEC */ + +#if defined(USB_OTG_FS) || defined(USB_OTG_HS) +/** + * @brief Return USBx clock frequency + * @param USBxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE + * @retval USB clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource) +{ + uint32_t usb_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_USB_CLKSOURCE(USBxSource)); + +#if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) + /* USBCLK clock frequency */ + switch (LL_RCC_GetUSBClockSource(USBxSource)) + { +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) + case LL_RCC_USB_CLKSOURCE_PLLI2S: /* PLLI2S clock used as USB clock source */ + if (LL_RCC_PLLI2S_IsReady()) + { + usb_frequency = RCC_PLLI2S_GetFreqDomain_48M(); + } + break; + +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ + +#if defined(RCC_PLLSAI_SUPPORT) + case LL_RCC_USB_CLKSOURCE_PLLSAI: /* PLLSAI clock used as USB clock source */ + if (LL_RCC_PLLSAI_IsReady()) + { + usb_frequency = RCC_PLLSAI_GetFreqDomain_48M(); + } + break; +#endif /* RCC_PLLSAI_SUPPORT */ + + case LL_RCC_USB_CLKSOURCE_PLL: /* PLL clock used as USB clock source */ + default: + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = RCC_PLL_GetFreqDomain_48M(); + } + break; + } +#else + /* PLL clock used as USB clock source */ + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = RCC_PLL_GetFreqDomain_48M(); + } +#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ + + return usb_frequency; +} +#endif /* USB_OTG_FS || USB_OTG_HS */ + +#if defined(DFSDM1_Channel0) +/** + * @brief Return DFSDMx clock frequency + * @param DFSDMxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_CLKSOURCE + * @arg @ref LL_RCC_DFSDM2_CLKSOURCE (*) + * + * (*) value not defined in all devices. + * @retval DFSDM clock frequency (in Hz) + */ +uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource) +{ + uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_DFSDM_CLKSOURCE(DFSDMxSource)); + + if (DFSDMxSource == LL_RCC_DFSDM1_CLKSOURCE) + { + /* DFSDM1CLK clock frequency */ + switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) + { + case LL_RCC_DFSDM1_CLKSOURCE_SYSCLK: /* DFSDM1 Clock is SYSCLK */ + dfsdm_frequency = RCC_GetSystemClockFreq(); + break; + + case LL_RCC_DFSDM1_CLKSOURCE_PCLK2: /* DFSDM1 Clock is PCLK2 */ + default: + dfsdm_frequency = RCC_GetPCLK2ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); + break; + } + } +#if defined(DFSDM2_Channel0) + else + { + /* DFSDM2CLK clock frequency */ + switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) + { + case LL_RCC_DFSDM2_CLKSOURCE_SYSCLK: /* DFSDM2 Clock is SYSCLK */ + dfsdm_frequency = RCC_GetSystemClockFreq(); + break; + + case LL_RCC_DFSDM2_CLKSOURCE_PCLK2: /* DFSDM2 Clock is PCLK2 */ + default: + dfsdm_frequency = RCC_GetPCLK2ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); + break; + } + } +#endif /* DFSDM2_Channel0 */ + + return dfsdm_frequency; +} + +/** + * @brief Return DFSDMx Audio clock frequency + * @param DFSDMxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE + * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE (*) + * + * (*) value not defined in all devices. + * @retval DFSDM clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetDFSDMAudioClockFreq(uint32_t DFSDMxSource) +{ + uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(DFSDMxSource)); + + if (DFSDMxSource == LL_RCC_DFSDM1_AUDIO_CLKSOURCE) + { + /* DFSDM1CLK clock frequency */ + switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) + { + case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1: /* I2S1 clock used as DFSDM1 clock */ + dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE); + break; + + case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S2: /* I2S2 clock used as DFSDM1 clock */ + default: + dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S2_CLKSOURCE); + break; + } + } +#if defined(DFSDM2_Channel0) + else + { + /* DFSDM2CLK clock frequency */ + switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) + { + case LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1: /* I2S1 clock used as DFSDM2 clock */ + dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE); + break; + + case LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S2: /* I2S2 clock used as DFSDM2 clock */ + default: + dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S2_CLKSOURCE); + break; + } + } +#endif /* DFSDM2_Channel0 */ + + return dfsdm_frequency; +} +#endif /* DFSDM1_Channel0 */ + +#if defined(DSI) +/** + * @brief Return DSI clock frequency + * @param DSIxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_DSI_CLKSOURCE + * @retval DSI clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + * - @ref LL_RCC_PERIPH_FREQUENCY_NA indicates that external clock is used + */ +uint32_t LL_RCC_GetDSIClockFreq(uint32_t DSIxSource) +{ + uint32_t dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_DSI_CLKSOURCE(DSIxSource)); + + /* DSICLK clock frequency */ + switch (LL_RCC_GetDSIClockSource(DSIxSource)) + { + case LL_RCC_DSI_CLKSOURCE_PLL: /* DSI Clock is PLL Osc. */ + if (LL_RCC_PLL_IsReady()) + { + dsi_frequency = RCC_PLL_GetFreqDomain_DSI(); + } + break; + + case LL_RCC_DSI_CLKSOURCE_PHY: /* DSI Clock is DSI physical clock. */ + default: + dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NA; + break; + } + + return dsi_frequency; +} +#endif /* DSI */ + +#if defined(LTDC) +/** + * @brief Return LTDC clock frequency + * @param LTDCxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_LTDC_CLKSOURCE + * @retval LTDC clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator PLLSAI is not ready + */ +uint32_t LL_RCC_GetLTDCClockFreq(uint32_t LTDCxSource) +{ + uint32_t ltdc_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_LTDC_CLKSOURCE(LTDCxSource)); + + if (LL_RCC_PLLSAI_IsReady()) + { + ltdc_frequency = RCC_PLLSAI_GetFreqDomain_LTDC(); + } + + return ltdc_frequency; +} +#endif /* LTDC */ + +#if defined(SPDIFRX) +/** + * @brief Return SPDIFRX clock frequency + * @param SPDIFRXxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE + * @retval SPDIFRX clock frequency (in Hz) + * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready + */ +uint32_t LL_RCC_GetSPDIFRXClockFreq(uint32_t SPDIFRXxSource) +{ + uint32_t spdifrx_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_SPDIFRX_CLKSOURCE(SPDIFRXxSource)); + + /* SPDIFRX1CLK clock frequency */ + switch (LL_RCC_GetSPDIFRXClockSource(SPDIFRXxSource)) + { + case LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S: /* SPDIFRX Clock is PLLI2S Osc. */ + if (LL_RCC_PLLI2S_IsReady()) + { + spdifrx_frequency = RCC_PLLI2S_GetFreqDomain_SPDIFRX(); + } + break; + + case LL_RCC_SPDIFRX1_CLKSOURCE_PLL: /* SPDIFRX Clock is PLL Osc. */ + default: + if (LL_RCC_PLL_IsReady()) + { + spdifrx_frequency = RCC_PLL_GetFreqDomain_SPDIFRX(); + } + break; + } + + return spdifrx_frequency; +} +#endif /* SPDIFRX */ + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup RCC_LL_Private_Functions + * @{ + */ + +/** + * @brief Return SYSTEM clock frequency + * @retval SYSTEM clock frequency (in Hz) + */ +uint32_t RCC_GetSystemClockFreq(void) +{ + uint32_t frequency = 0U; + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (LL_RCC_GetSysClkSource()) + { + case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: /* HSI used as system clock source */ + frequency = HSI_VALUE; + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: /* HSE used as system clock source */ + frequency = HSE_VALUE; + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: /* PLL used as system clock source */ + frequency = RCC_PLL_GetFreqDomain_SYS(LL_RCC_SYS_CLKSOURCE_STATUS_PLL); + break; + +#if defined(RCC_PLLR_SYSCLK_SUPPORT) + case LL_RCC_SYS_CLKSOURCE_STATUS_PLLR: /* PLLR used as system clock source */ + frequency = RCC_PLL_GetFreqDomain_SYS(LL_RCC_SYS_CLKSOURCE_STATUS_PLLR); + break; +#endif /* RCC_PLLR_SYSCLK_SUPPORT */ + + default: + frequency = HSI_VALUE; + break; + } + + return frequency; +} + +/** + * @brief Return HCLK clock frequency + * @param SYSCLK_Frequency SYSCLK clock frequency + * @retval HCLK clock frequency (in Hz) + */ +uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency) +{ + /* HCLK clock frequency */ + return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler()); +} + +/** + * @brief Return PCLK1 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK1 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency) +{ + /* PCLK1 clock frequency */ + return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler()); +} + +/** + * @brief Return PCLK2 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK2 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency) +{ + /* PCLK2 clock frequency */ + return __LL_RCC_CALC_PCLK2_FREQ(HCLK_Frequency, LL_RCC_GetAPB2Prescaler()); +} + +/** + * @brief Return PLL clock frequency used for system domain + * @param SYSCLK_Source System clock source + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_SYS(uint32_t SYSCLK_Source) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U, plloutputfreq = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SYSCLK = PLL_VCO / (PLLP or PLLR) + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + pllinputfreq = HSI_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + default: + pllinputfreq = HSI_VALUE; + break; + } + + if (SYSCLK_Source == LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + { + plloutputfreq = __LL_RCC_CALC_PLLCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetP()); + } +#if defined(RCC_PLLR_SYSCLK_SUPPORT) + else + { + plloutputfreq = __LL_RCC_CALC_PLLRCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); + } +#endif /* RCC_PLLR_SYSCLK_SUPPORT */ + + return plloutputfreq; +} + +/** + * @brief Return PLL clock frequency used for 48 MHz domain + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_48M(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM ) * PLLN + 48M Domain clock = PLL_VCO / PLLQ + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + pllinputfreq = HSI_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLCLK_48M_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetQ()); +} + +#if defined(DSI) +/** + * @brief Return PLL clock frequency used for DSI clock + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_DSI(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + DSICLK = PLL_VCO / PLLR + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLCLK_DSI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); +} +#endif /* DSI */ + +#if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC) +/** + * @brief Return PLL clock frequency used for I2S clock + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_I2S(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + I2SCLK = PLL_VCO / PLLR + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLCLK_I2S_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); +} +#endif /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ + +#if defined(SPDIFRX) +/** + * @brief Return PLL clock frequency used for SPDIFRX clock + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_SPDIFRX(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SPDIFRXCLK = PLL_VCO / PLLR + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLCLK_SPDIFRX_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); +} +#endif /* SPDIFRX */ + +#if defined(RCC_PLLCFGR_PLLR) +#if defined(SAI1) +/** + * @brief Return PLL clock frequency used for SAI clock + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_SAI(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U, plloutputfreq = 0U; + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN + SAICLK = (PLL_VCO / PLLR) / PLLDIVR + or + SAICLK = PLL_VCO / PLLR + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ + default: + pllinputfreq = HSI_VALUE; + break; + } + +#if defined(RCC_DCKCFGR_PLLDIVR) + plloutputfreq = __LL_RCC_CALC_PLLCLK_SAI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR(), LL_RCC_PLL_GetDIVR()); +#else + plloutputfreq = __LL_RCC_CALC_PLLCLK_SAI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), + LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); +#endif /* RCC_DCKCFGR_PLLDIVR */ + + return plloutputfreq; +} +#endif /* SAI1 */ +#endif /* RCC_PLLCFGR_PLLR */ + +#if defined(RCC_PLLSAI_SUPPORT) +/** + * @brief Return PLLSAI clock frequency used for SAI domain + * @retval PLLSAI clock frequency (in Hz) + */ +uint32_t RCC_PLLSAI_GetFreqDomain_SAI(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN + SAI domain clock = (PLLSAI_VCO / PLLSAIQ) / PLLSAIDIVQ + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ + pllinputfreq = HSI_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ + pllinputfreq = HSE_VALUE; + break; + + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLSAI_SAI_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), + LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetQ(), LL_RCC_PLLSAI_GetDIVQ()); +} + +#if defined(RCC_PLLSAICFGR_PLLSAIP) +/** + * @brief Return PLLSAI clock frequency used for 48Mhz domain + * @retval PLLSAI clock frequency (in Hz) + */ +uint32_t RCC_PLLSAI_GetFreqDomain_48M(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN + 48M Domain clock = PLLSAI_VCO / PLLSAIP + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ + pllinputfreq = HSI_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ + pllinputfreq = HSE_VALUE; + break; + + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLSAI_48M_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), + LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetP()); +} +#endif /* RCC_PLLSAICFGR_PLLSAIP */ + +#if defined(LTDC) +/** + * @brief Return PLLSAI clock frequency used for LTDC domain + * @retval PLLSAI clock frequency (in Hz) + */ +uint32_t RCC_PLLSAI_GetFreqDomain_LTDC(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN + LTDC Domain clock = (PLLSAI_VCO / PLLSAIR) / PLLSAIDIVR + */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ + pllinputfreq = HSI_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ + pllinputfreq = HSE_VALUE; + break; + + default: + pllinputfreq = HSI_VALUE; + break; + } + return __LL_RCC_CALC_PLLSAI_LTDC_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), + LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetR(), LL_RCC_PLLSAI_GetDIVR()); +} +#endif /* LTDC */ +#endif /* RCC_PLLSAI_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) +#if defined(SAI1) +/** + * @brief Return PLLI2S clock frequency used for SAI domains + * @retval PLLI2S clock frequency (in Hz) + */ +uint32_t RCC_PLLI2S_GetFreqDomain_SAI(void) +{ + uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; + + /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN + SAI domain clock = (PLLI2S_VCO / PLLI2SQ) / PLLI2SDIVQ + or + SAI domain clock = (PLLI2S_VCO / PLLI2SR) / PLLI2SDIVR + */ + plli2ssource = LL_RCC_PLLI2S_GetMainSource(); + + switch (plli2ssource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ + plli2sinputfreq = HSE_VALUE; + break; + +#if defined(RCC_PLLI2SCFGR_PLLI2SSRC) + case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ + plli2sinputfreq = EXTERNAL_CLOCK_VALUE; + break; +#endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ + default: + plli2sinputfreq = HSI_VALUE; + break; + } + +#if defined(RCC_DCKCFGR_PLLI2SDIVQ) + plli2soutputfreq = __LL_RCC_CALC_PLLI2S_SAI_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), + LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetQ(), LL_RCC_PLLI2S_GetDIVQ()); +#else + plli2soutputfreq = __LL_RCC_CALC_PLLI2S_SAI_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), + LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetR(), LL_RCC_PLLI2S_GetDIVR()); +#endif /* RCC_DCKCFGR_PLLI2SDIVQ */ + + return plli2soutputfreq; +} +#endif /* SAI1 */ + +#if defined(SPDIFRX) +/** + * @brief Return PLLI2S clock frequency used for SPDIFRX domain + * @retval PLLI2S clock frequency (in Hz) + */ +uint32_t RCC_PLLI2S_GetFreqDomain_SPDIFRX(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN + SPDIFRX Domain clock = PLLI2S_VCO / PLLI2SP + */ + pllsource = LL_RCC_PLLI2S_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ + pllinputfreq = HSE_VALUE; + break; + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ + default: + pllinputfreq = HSI_VALUE; + break; + } + + return __LL_RCC_CALC_PLLI2S_SPDIFRX_FREQ(pllinputfreq, LL_RCC_PLLI2S_GetDivider(), + LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetP()); +} +#endif /* SPDIFRX */ + +/** + * @brief Return PLLI2S clock frequency used for I2S domain + * @retval PLLI2S clock frequency (in Hz) + */ +uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void) +{ + uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; + + /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN + I2S Domain clock = PLLI2S_VCO / PLLI2SR + */ + plli2ssource = LL_RCC_PLLI2S_GetMainSource(); + + switch (plli2ssource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ + plli2sinputfreq = HSE_VALUE; + break; + +#if defined(RCC_PLLI2SCFGR_PLLI2SSRC) + case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ + plli2sinputfreq = EXTERNAL_CLOCK_VALUE; + break; +#endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ + default: + plli2sinputfreq = HSI_VALUE; + break; + } + + plli2soutputfreq = __LL_RCC_CALC_PLLI2S_I2S_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), + LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetR()); + + return plli2soutputfreq; +} + +#if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) +/** + * @brief Return PLLI2S clock frequency used for 48Mhz domain + * @retval PLLI2S clock frequency (in Hz) + */ +uint32_t RCC_PLLI2S_GetFreqDomain_48M(void) +{ + uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; + + /* PLL48M_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN + 48M Domain clock = PLLI2S_VCO / PLLI2SQ + */ + plli2ssource = LL_RCC_PLLI2S_GetMainSource(); + + switch (plli2ssource) + { + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ + plli2sinputfreq = HSE_VALUE; + break; + +#if defined(RCC_PLLI2SCFGR_PLLI2SSRC) + case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ + plli2sinputfreq = EXTERNAL_CLOCK_VALUE; + break; +#endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ + + case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ + default: + plli2sinputfreq = HSI_VALUE; + break; + } + + plli2soutputfreq = __LL_RCC_CALC_PLLI2S_48M_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), + LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetQ()); + + return plli2soutputfreq; +} +#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ +#endif /* RCC_PLLI2S_SUPPORT */ +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(RCC) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c new file mode 100644 index 0000000..dfbdabe --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_spi.c @@ -0,0 +1,626 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_spi.c + * @author MCD Application Team + * @brief SPI LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_spi.h" +#include "stm32f4xx_ll_bus.h" +#include "stm32f4xx_ll_rcc.h" + +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) + +/** @addtogroup SPI_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup SPI_LL_Private_Constants SPI Private Constants + * @{ + */ +/* SPI registers Masks */ +#define SPI_CR1_CLEAR_MASK (SPI_CR1_CPHA | SPI_CR1_CPOL | SPI_CR1_MSTR | \ + SPI_CR1_BR | SPI_CR1_LSBFIRST | SPI_CR1_SSI | \ + SPI_CR1_SSM | SPI_CR1_RXONLY | SPI_CR1_DFF | \ + SPI_CR1_CRCNEXT | SPI_CR1_CRCEN | SPI_CR1_BIDIOE | \ + SPI_CR1_BIDIMODE) +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup SPI_LL_Private_Macros SPI Private Macros + * @{ + */ +#define IS_LL_SPI_TRANSFER_DIRECTION(__VALUE__) (((__VALUE__) == LL_SPI_FULL_DUPLEX) \ + || ((__VALUE__) == LL_SPI_SIMPLEX_RX) \ + || ((__VALUE__) == LL_SPI_HALF_DUPLEX_RX) \ + || ((__VALUE__) == LL_SPI_HALF_DUPLEX_TX)) + +#define IS_LL_SPI_MODE(__VALUE__) (((__VALUE__) == LL_SPI_MODE_MASTER) \ + || ((__VALUE__) == LL_SPI_MODE_SLAVE)) + +#define IS_LL_SPI_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_SPI_DATAWIDTH_8BIT) \ + || ((__VALUE__) == LL_SPI_DATAWIDTH_16BIT)) + +#define IS_LL_SPI_POLARITY(__VALUE__) (((__VALUE__) == LL_SPI_POLARITY_LOW) \ + || ((__VALUE__) == LL_SPI_POLARITY_HIGH)) + +#define IS_LL_SPI_PHASE(__VALUE__) (((__VALUE__) == LL_SPI_PHASE_1EDGE) \ + || ((__VALUE__) == LL_SPI_PHASE_2EDGE)) + +#define IS_LL_SPI_NSS(__VALUE__) (((__VALUE__) == LL_SPI_NSS_SOFT) \ + || ((__VALUE__) == LL_SPI_NSS_HARD_INPUT) \ + || ((__VALUE__) == LL_SPI_NSS_HARD_OUTPUT)) + +#define IS_LL_SPI_BAUDRATE(__VALUE__) (((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV2) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV4) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV8) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV16) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV32) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV64) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV128) \ + || ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV256)) + +#define IS_LL_SPI_BITORDER(__VALUE__) (((__VALUE__) == LL_SPI_LSB_FIRST) \ + || ((__VALUE__) == LL_SPI_MSB_FIRST)) + +#define IS_LL_SPI_CRCCALCULATION(__VALUE__) (((__VALUE__) == LL_SPI_CRCCALCULATION_ENABLE) \ + || ((__VALUE__) == LL_SPI_CRCCALCULATION_DISABLE)) + +#define IS_LL_SPI_CRC_POLYNOMIAL(__VALUE__) ((__VALUE__) >= 0x1U) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup SPI_LL_Exported_Functions + * @{ + */ + +/** @addtogroup SPI_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the SPI registers to their default reset values. + * @param SPIx SPI Instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: SPI registers are de-initialized + * - ERROR: SPI registers are not de-initialized + */ +ErrorStatus LL_SPI_DeInit(SPI_TypeDef *SPIx) +{ + ErrorStatus status = ERROR; + + /* Check the parameters */ + assert_param(IS_SPI_ALL_INSTANCE(SPIx)); + +#if defined(SPI1) + if (SPIx == SPI1) + { + /* Force reset of SPI clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI1); + + /* Release reset of SPI clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI1); + + status = SUCCESS; + } +#endif /* SPI1 */ +#if defined(SPI2) + if (SPIx == SPI2) + { + /* Force reset of SPI clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_SPI2); + + /* Release reset of SPI clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_SPI2); + + status = SUCCESS; + } +#endif /* SPI2 */ +#if defined(SPI3) + if (SPIx == SPI3) + { + /* Force reset of SPI clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_SPI3); + + /* Release reset of SPI clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_SPI3); + + status = SUCCESS; + } +#endif /* SPI3 */ +#if defined(SPI4) + if (SPIx == SPI4) + { + /* Force reset of SPI clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI4); + + /* Release reset of SPI clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI4); + + status = SUCCESS; + } +#endif /* SPI4 */ +#if defined(SPI5) + if (SPIx == SPI5) + { + /* Force reset of SPI clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI5); + + /* Release reset of SPI clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI5); + + status = SUCCESS; + } +#endif /* SPI5 */ +#if defined(SPI6) + if (SPIx == SPI6) + { + /* Force reset of SPI clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI6); + + /* Release reset of SPI clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI6); + + status = SUCCESS; + } +#endif /* SPI6 */ + + return status; +} + +/** + * @brief Initialize the SPI registers according to the specified parameters in SPI_InitStruct. + * @note As some bits in SPI configuration registers can only be written when the SPI is disabled (SPI_CR1_SPE bit =0), + * SPI peripheral should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @param SPIx SPI Instance + * @param SPI_InitStruct pointer to a @ref LL_SPI_InitTypeDef structure + * @retval An ErrorStatus enumeration value. (Return always SUCCESS) + */ +ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct) +{ + ErrorStatus status = ERROR; + + /* Check the SPI Instance SPIx*/ + assert_param(IS_SPI_ALL_INSTANCE(SPIx)); + + /* Check the SPI parameters from SPI_InitStruct*/ + assert_param(IS_LL_SPI_TRANSFER_DIRECTION(SPI_InitStruct->TransferDirection)); + assert_param(IS_LL_SPI_MODE(SPI_InitStruct->Mode)); + assert_param(IS_LL_SPI_DATAWIDTH(SPI_InitStruct->DataWidth)); + assert_param(IS_LL_SPI_POLARITY(SPI_InitStruct->ClockPolarity)); + assert_param(IS_LL_SPI_PHASE(SPI_InitStruct->ClockPhase)); + assert_param(IS_LL_SPI_NSS(SPI_InitStruct->NSS)); + assert_param(IS_LL_SPI_BAUDRATE(SPI_InitStruct->BaudRate)); + assert_param(IS_LL_SPI_BITORDER(SPI_InitStruct->BitOrder)); + assert_param(IS_LL_SPI_CRCCALCULATION(SPI_InitStruct->CRCCalculation)); + + if (LL_SPI_IsEnabled(SPIx) == 0x00000000U) + { + /*---------------------------- SPIx CR1 Configuration ------------------------ + * Configure SPIx CR1 with parameters: + * - TransferDirection: SPI_CR1_BIDIMODE, SPI_CR1_BIDIOE and SPI_CR1_RXONLY bits + * - Master/Slave Mode: SPI_CR1_MSTR bit + * - DataWidth: SPI_CR1_DFF bit + * - ClockPolarity: SPI_CR1_CPOL bit + * - ClockPhase: SPI_CR1_CPHA bit + * - NSS management: SPI_CR1_SSM bit + * - BaudRate prescaler: SPI_CR1_BR[2:0] bits + * - BitOrder: SPI_CR1_LSBFIRST bit + * - CRCCalculation: SPI_CR1_CRCEN bit + */ + MODIFY_REG(SPIx->CR1, + SPI_CR1_CLEAR_MASK, + SPI_InitStruct->TransferDirection | SPI_InitStruct->Mode | SPI_InitStruct->DataWidth | + SPI_InitStruct->ClockPolarity | SPI_InitStruct->ClockPhase | + SPI_InitStruct->NSS | SPI_InitStruct->BaudRate | + SPI_InitStruct->BitOrder | SPI_InitStruct->CRCCalculation); + + /*---------------------------- SPIx CR2 Configuration ------------------------ + * Configure SPIx CR2 with parameters: + * - NSS management: SSOE bit + */ + MODIFY_REG(SPIx->CR2, SPI_CR2_SSOE, (SPI_InitStruct->NSS >> 16U)); + + /*---------------------------- SPIx CRCPR Configuration ---------------------- + * Configure SPIx CRCPR with parameters: + * - CRCPoly: CRCPOLY[15:0] bits + */ + if (SPI_InitStruct->CRCCalculation == LL_SPI_CRCCALCULATION_ENABLE) + { + assert_param(IS_LL_SPI_CRC_POLYNOMIAL(SPI_InitStruct->CRCPoly)); + LL_SPI_SetCRCPolynomial(SPIx, SPI_InitStruct->CRCPoly); + } + status = SUCCESS; + } + + /* Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) */ + CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD); + return status; +} + +/** + * @brief Set each @ref LL_SPI_InitTypeDef field to default value. + * @param SPI_InitStruct pointer to a @ref LL_SPI_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ +void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct) +{ + /* Set SPI_InitStruct fields to default values */ + SPI_InitStruct->TransferDirection = LL_SPI_FULL_DUPLEX; + SPI_InitStruct->Mode = LL_SPI_MODE_SLAVE; + SPI_InitStruct->DataWidth = LL_SPI_DATAWIDTH_8BIT; + SPI_InitStruct->ClockPolarity = LL_SPI_POLARITY_LOW; + SPI_InitStruct->ClockPhase = LL_SPI_PHASE_1EDGE; + SPI_InitStruct->NSS = LL_SPI_NSS_HARD_INPUT; + SPI_InitStruct->BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; + SPI_InitStruct->BitOrder = LL_SPI_MSB_FIRST; + SPI_InitStruct->CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; + SPI_InitStruct->CRCPoly = 7U; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup I2S_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup I2S_LL_Private_Constants I2S Private Constants + * @{ + */ +/* I2S registers Masks */ +#define I2S_I2SCFGR_CLEAR_MASK (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN | \ + SPI_I2SCFGR_CKPOL | SPI_I2SCFGR_I2SSTD | \ + SPI_I2SCFGR_I2SCFG | SPI_I2SCFGR_I2SMOD ) + +#define I2S_I2SPR_CLEAR_MASK 0x0002U +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup I2S_LL_Private_Macros I2S Private Macros + * @{ + */ + +#define IS_LL_I2S_DATAFORMAT(__VALUE__) (((__VALUE__) == LL_I2S_DATAFORMAT_16B) \ + || ((__VALUE__) == LL_I2S_DATAFORMAT_16B_EXTENDED) \ + || ((__VALUE__) == LL_I2S_DATAFORMAT_24B) \ + || ((__VALUE__) == LL_I2S_DATAFORMAT_32B)) + +#define IS_LL_I2S_CPOL(__VALUE__) (((__VALUE__) == LL_I2S_POLARITY_LOW) \ + || ((__VALUE__) == LL_I2S_POLARITY_HIGH)) + +#define IS_LL_I2S_STANDARD(__VALUE__) (((__VALUE__) == LL_I2S_STANDARD_PHILIPS) \ + || ((__VALUE__) == LL_I2S_STANDARD_MSB) \ + || ((__VALUE__) == LL_I2S_STANDARD_LSB) \ + || ((__VALUE__) == LL_I2S_STANDARD_PCM_SHORT) \ + || ((__VALUE__) == LL_I2S_STANDARD_PCM_LONG)) + +#define IS_LL_I2S_MODE(__VALUE__) (((__VALUE__) == LL_I2S_MODE_SLAVE_TX) \ + || ((__VALUE__) == LL_I2S_MODE_SLAVE_RX) \ + || ((__VALUE__) == LL_I2S_MODE_MASTER_TX) \ + || ((__VALUE__) == LL_I2S_MODE_MASTER_RX)) + +#define IS_LL_I2S_MCLK_OUTPUT(__VALUE__) (((__VALUE__) == LL_I2S_MCLK_OUTPUT_ENABLE) \ + || ((__VALUE__) == LL_I2S_MCLK_OUTPUT_DISABLE)) + +#define IS_LL_I2S_AUDIO_FREQ(__VALUE__) ((((__VALUE__) >= LL_I2S_AUDIOFREQ_8K) \ + && ((__VALUE__) <= LL_I2S_AUDIOFREQ_192K)) \ + || ((__VALUE__) == LL_I2S_AUDIOFREQ_DEFAULT)) + +#define IS_LL_I2S_PRESCALER_LINEAR(__VALUE__) ((__VALUE__) >= 0x2U) + +#define IS_LL_I2S_PRESCALER_PARITY(__VALUE__) (((__VALUE__) == LL_I2S_PRESCALER_PARITY_EVEN) \ + || ((__VALUE__) == LL_I2S_PRESCALER_PARITY_ODD)) +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup I2S_LL_Exported_Functions + * @{ + */ + +/** @addtogroup I2S_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the SPI/I2S registers to their default reset values. + * @param SPIx SPI Instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: SPI registers are de-initialized + * - ERROR: SPI registers are not de-initialized + */ +ErrorStatus LL_I2S_DeInit(SPI_TypeDef *SPIx) +{ + return LL_SPI_DeInit(SPIx); +} + +/** + * @brief Initializes the SPI/I2S registers according to the specified parameters in I2S_InitStruct. + * @note As some bits in SPI configuration registers can only be written when the SPI is disabled (SPI_CR1_SPE bit =0), + * SPI peripheral should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @param SPIx SPI Instance + * @param I2S_InitStruct pointer to a @ref LL_I2S_InitTypeDef structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: SPI registers are Initialized + * - ERROR: SPI registers are not Initialized + */ +ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct) +{ + uint32_t i2sdiv = 2U; + uint32_t i2sodd = 0U; + uint32_t packetlength = 1U; + uint32_t tmp; + uint32_t sourceclock; + ErrorStatus status = ERROR; + + /* Check the I2S parameters */ + assert_param(IS_I2S_ALL_INSTANCE(SPIx)); + assert_param(IS_LL_I2S_MODE(I2S_InitStruct->Mode)); + assert_param(IS_LL_I2S_STANDARD(I2S_InitStruct->Standard)); + assert_param(IS_LL_I2S_DATAFORMAT(I2S_InitStruct->DataFormat)); + assert_param(IS_LL_I2S_MCLK_OUTPUT(I2S_InitStruct->MCLKOutput)); + assert_param(IS_LL_I2S_AUDIO_FREQ(I2S_InitStruct->AudioFreq)); + assert_param(IS_LL_I2S_CPOL(I2S_InitStruct->ClockPolarity)); + + if (LL_I2S_IsEnabled(SPIx) == 0x00000000U) + { + /*---------------------------- SPIx I2SCFGR Configuration -------------------- + * Configure SPIx I2SCFGR with parameters: + * - Mode: SPI_I2SCFGR_I2SCFG[1:0] bit + * - Standard: SPI_I2SCFGR_I2SSTD[1:0] and SPI_I2SCFGR_PCMSYNC bits + * - DataFormat: SPI_I2SCFGR_CHLEN and SPI_I2SCFGR_DATLEN bits + * - ClockPolarity: SPI_I2SCFGR_CKPOL bit + */ + + /* Write to SPIx I2SCFGR */ + MODIFY_REG(SPIx->I2SCFGR, + I2S_I2SCFGR_CLEAR_MASK, + I2S_InitStruct->Mode | I2S_InitStruct->Standard | + I2S_InitStruct->DataFormat | I2S_InitStruct->ClockPolarity | + SPI_I2SCFGR_I2SMOD); + + /*---------------------------- SPIx I2SPR Configuration ---------------------- + * Configure SPIx I2SPR with parameters: + * - MCLKOutput: SPI_I2SPR_MCKOE bit + * - AudioFreq: SPI_I2SPR_I2SDIV[7:0] and SPI_I2SPR_ODD bits + */ + + /* If the requested audio frequency is not the default, compute the prescaler (i2sodd, i2sdiv) + * else, default values are used: i2sodd = 0U, i2sdiv = 2U. + */ + if (I2S_InitStruct->AudioFreq != LL_I2S_AUDIOFREQ_DEFAULT) + { + /* Check the frame length (For the Prescaler computing) + * Default value: LL_I2S_DATAFORMAT_16B (packetlength = 1U). + */ + if (I2S_InitStruct->DataFormat != LL_I2S_DATAFORMAT_16B) + { + /* Packet length is 32 bits */ + packetlength = 2U; + } + + /* If an external I2S clock has to be used, the specific define should be set + in the project configuration or in the stm32f4xx_ll_rcc.h file */ + /* Get the I2S source clock value */ + sourceclock = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE); + + /* Compute the Real divider depending on the MCLK output state with a floating point */ + if (I2S_InitStruct->MCLKOutput == LL_I2S_MCLK_OUTPUT_ENABLE) + { + /* MCLK output is enabled */ + tmp = (((((sourceclock / 256U) * 10U) / I2S_InitStruct->AudioFreq)) + 5U); + } + else + { + /* MCLK output is disabled */ + tmp = (((((sourceclock / (32U * packetlength)) * 10U) / I2S_InitStruct->AudioFreq)) + 5U); + } + + /* Remove the floating point */ + tmp = tmp / 10U; + + /* Check the parity of the divider */ + i2sodd = (tmp & (uint16_t)0x0001U); + + /* Compute the i2sdiv prescaler */ + i2sdiv = ((tmp - i2sodd) / 2U); + + /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */ + i2sodd = (i2sodd << 8U); + } + + /* Test if the divider is 1 or 0 or greater than 0xFF */ + if ((i2sdiv < 2U) || (i2sdiv > 0xFFU)) + { + /* Set the default values */ + i2sdiv = 2U; + i2sodd = 0U; + } + + /* Write to SPIx I2SPR register the computed value */ + WRITE_REG(SPIx->I2SPR, i2sdiv | i2sodd | I2S_InitStruct->MCLKOutput); + + status = SUCCESS; + } + return status; +} + +/** + * @brief Set each @ref LL_I2S_InitTypeDef field to default value. + * @param I2S_InitStruct pointer to a @ref LL_I2S_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ +void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct) +{ + /*--------------- Reset I2S init structure parameters values -----------------*/ + I2S_InitStruct->Mode = LL_I2S_MODE_SLAVE_TX; + I2S_InitStruct->Standard = LL_I2S_STANDARD_PHILIPS; + I2S_InitStruct->DataFormat = LL_I2S_DATAFORMAT_16B; + I2S_InitStruct->MCLKOutput = LL_I2S_MCLK_OUTPUT_DISABLE; + I2S_InitStruct->AudioFreq = LL_I2S_AUDIOFREQ_DEFAULT; + I2S_InitStruct->ClockPolarity = LL_I2S_POLARITY_LOW; +} + +/** + * @brief Set linear and parity prescaler. + * @note To calculate value of PrescalerLinear(I2SDIV[7:0] bits) and PrescalerParity(ODD bit)\n + * Check Audio frequency table and formulas inside Reference Manual (SPI/I2S). + * @param SPIx SPI Instance + * @param PrescalerLinear value Min_Data=0x02 and Max_Data=0xFF. + * @param PrescalerParity This parameter can be one of the following values: + * @arg @ref LL_I2S_PRESCALER_PARITY_EVEN + * @arg @ref LL_I2S_PRESCALER_PARITY_ODD + * @retval None + */ +void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity) +{ + /* Check the I2S parameters */ + assert_param(IS_I2S_ALL_INSTANCE(SPIx)); + assert_param(IS_LL_I2S_PRESCALER_LINEAR(PrescalerLinear)); + assert_param(IS_LL_I2S_PRESCALER_PARITY(PrescalerParity)); + + /* Write to SPIx I2SPR */ + MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV | SPI_I2SPR_ODD, PrescalerLinear | (PrescalerParity << 8U)); +} + +#if defined (SPI_I2S_FULLDUPLEX_SUPPORT) +/** + * @brief Configures the full duplex mode for the I2Sx peripheral using its extension + * I2Sxext according to the specified parameters in the I2S_InitStruct. + * @note The structure pointed by I2S_InitStruct parameter should be the same + * used for the master I2S peripheral. In this case, if the master is + * configured as transmitter, the slave will be receiver and vice versa. + * Or you can force a different mode by modifying the field I2S_Mode to the + * value I2S_SlaveRx or I2S_SlaveTx independently of the master configuration. + * @param I2Sxext SPI Instance + * @param I2S_InitStruct pointer to a @ref LL_I2S_InitTypeDef structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: I2Sxext registers are Initialized + * - ERROR: I2Sxext registers are not Initialized + */ +ErrorStatus LL_I2S_InitFullDuplex(SPI_TypeDef *I2Sxext, LL_I2S_InitTypeDef *I2S_InitStruct) +{ + uint32_t mode = 0U; + ErrorStatus status = ERROR; + + /* Check the I2S parameters */ + assert_param(IS_I2S_EXT_ALL_INSTANCE(I2Sxext)); + assert_param(IS_LL_I2S_MODE(I2S_InitStruct->Mode)); + assert_param(IS_LL_I2S_STANDARD(I2S_InitStruct->Standard)); + assert_param(IS_LL_I2S_DATAFORMAT(I2S_InitStruct->DataFormat)); + assert_param(IS_LL_I2S_CPOL(I2S_InitStruct->ClockPolarity)); + + if (LL_I2S_IsEnabled(I2Sxext) == 0x00000000U) + { + /*---------------------------- SPIx I2SCFGR Configuration -------------------- + * Configure SPIx I2SCFGR with parameters: + * - Mode: SPI_I2SCFGR_I2SCFG[1:0] bit + * - Standard: SPI_I2SCFGR_I2SSTD[1:0] and SPI_I2SCFGR_PCMSYNC bits + * - DataFormat: SPI_I2SCFGR_CHLEN and SPI_I2SCFGR_DATLEN bits + * - ClockPolarity: SPI_I2SCFGR_CKPOL bit + */ + + /* Reset I2SPR registers */ + WRITE_REG(I2Sxext->I2SPR, I2S_I2SPR_CLEAR_MASK); + + /* Get the mode to be configured for the extended I2S */ + if ((I2S_InitStruct->Mode == LL_I2S_MODE_MASTER_TX) || (I2S_InitStruct->Mode == LL_I2S_MODE_SLAVE_TX)) + { + mode = LL_I2S_MODE_SLAVE_RX; + } + else + { + if ((I2S_InitStruct->Mode == LL_I2S_MODE_MASTER_RX) || (I2S_InitStruct->Mode == LL_I2S_MODE_SLAVE_RX)) + { + mode = LL_I2S_MODE_SLAVE_TX; + } + } + + /* Write to SPIx I2SCFGR */ + MODIFY_REG(I2Sxext->I2SCFGR, + I2S_I2SCFGR_CLEAR_MASK, + I2S_InitStruct->Standard | + I2S_InitStruct->DataFormat | I2S_InitStruct->ClockPolarity | + SPI_I2SCFGR_I2SMOD | mode); + + status = SUCCESS; + } + return status; +} +#endif /* SPI_I2S_FULLDUPLEX_SUPPORT */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c new file mode 100644 index 0000000..bee919b --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_tim.c @@ -0,0 +1,1180 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_tim.c + * @author MCD Application Team + * @brief TIM LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_tim.h" +#include "stm32f4xx_ll_bus.h" + +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) + +/** @addtogroup TIM_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup TIM_LL_Private_Macros + * @{ + */ +#define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN)) + +#define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \ + || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \ + || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4)) + +#define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \ + || ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \ + || ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_PWM1) \ + || ((__VALUE__) == LL_TIM_OCMODE_PWM2)) + +#define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \ + || ((__VALUE__) == LL_TIM_OCSTATE_ENABLE)) + +#define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \ + || ((__VALUE__) == LL_TIM_OCPOLARITY_LOW)) + +#define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \ + || ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH)) + +#define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \ + || ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \ + || ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC)) + +#define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV2) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV4) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV8)) + +#define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8)) + +#define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ + || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING) \ + || ((__VALUE__) == LL_TIM_IC_POLARITY_BOTHEDGE)) + +#define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \ + || ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \ + || ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12)) + +#define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ + || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) + +#define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \ + || ((__VALUE__) == LL_TIM_OSSR_ENABLE)) + +#define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \ + || ((__VALUE__) == LL_TIM_OSSI_ENABLE)) + +#define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_3)) + +#define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \ + || ((__VALUE__) == LL_TIM_BREAK_ENABLE)) + +#define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \ + || ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH)) + +#define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \ + || ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE)) +/** + * @} + */ + + +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup TIM_LL_Private_Functions TIM Private Functions + * @{ + */ +static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIM_LL_Exported_Functions + * @{ + */ + +/** @addtogroup TIM_LL_EF_Init + * @{ + */ + +/** + * @brief Set TIMx registers to their reset values. + * @param TIMx Timer instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: invalid TIMx instance + */ +ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx) +{ + ErrorStatus result = SUCCESS; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(TIMx)); + + if (TIMx == TIM1) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1); + } +#if defined(TIM2) + else if (TIMx == TIM2) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2); + } +#endif +#if defined(TIM3) + else if (TIMx == TIM3) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM3); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM3); + } +#endif +#if defined(TIM4) + else if (TIMx == TIM4) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM4); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM4); + } +#endif +#if defined(TIM5) + else if (TIMx == TIM5) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM5); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM5); + } +#endif +#if defined(TIM6) + else if (TIMx == TIM6) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM6); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM6); + } +#endif +#if defined (TIM7) + else if (TIMx == TIM7) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM7); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM7); + } +#endif +#if defined(TIM8) + else if (TIMx == TIM8) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM8); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM8); + } +#endif +#if defined(TIM9) + else if (TIMx == TIM9) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM9); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM9); + } +#endif +#if defined(TIM10) + else if (TIMx == TIM10) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM10); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM10); + } +#endif +#if defined(TIM11) + else if (TIMx == TIM11) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM11); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM11); + } +#endif +#if defined(TIM12) + else if (TIMx == TIM12) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM12); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM12); + } +#endif +#if defined(TIM13) + else if (TIMx == TIM13) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM13); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM13); + } +#endif +#if defined(TIM14) + else if (TIMx == TIM14) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM14); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM14); + } +#endif + else + { + result = ERROR; + } + + return result; +} + +/** + * @brief Set the fields of the time base unit configuration data structure + * to their default values. + * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (time base unit configuration data structure) + * @retval None + */ +void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct) +{ + /* Set the default configuration */ + TIM_InitStruct->Prescaler = (uint16_t)0x0000; + TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct->Autoreload = 0xFFFFFFFFU; + TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + TIM_InitStruct->RepetitionCounter = (uint8_t)0x00; +} + +/** + * @brief Configure the TIMx time base unit. + * @param TIMx Timer Instance + * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (TIMx time base unit configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct) +{ + uint32_t tmpcr1; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode)); + assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision)); + + tmpcr1 = LL_TIM_ReadReg(TIMx, CR1); + + if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) + { + /* Select the Counter Mode */ + MODIFY_REG(tmpcr1, (TIM_CR1_DIR | TIM_CR1_CMS), TIM_InitStruct->CounterMode); + } + + if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) + { + /* Set the clock division */ + MODIFY_REG(tmpcr1, TIM_CR1_CKD, TIM_InitStruct->ClockDivision); + } + + /* Write to TIMx CR1 */ + LL_TIM_WriteReg(TIMx, CR1, tmpcr1); + + /* Set the Autoreload value */ + LL_TIM_SetAutoReload(TIMx, TIM_InitStruct->Autoreload); + + /* Set the Prescaler value */ + LL_TIM_SetPrescaler(TIMx, TIM_InitStruct->Prescaler); + + if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) + { + /* Set the Repetition Counter value */ + LL_TIM_SetRepetitionCounter(TIMx, TIM_InitStruct->RepetitionCounter); + } + + /* Generate an update event to reload the Prescaler + and the repetition counter value (if applicable) immediately */ + LL_TIM_GenerateEvent_UPDATE(TIMx); + + return SUCCESS; +} + +/** + * @brief Set the fields of the TIMx output channel configuration data + * structure to their default values. + * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (the output channel configuration data structure) + * @retval None + */ +void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct) +{ + /* Set the default configuration */ + TIM_OC_InitStruct->OCMode = LL_TIM_OCMODE_FROZEN; + TIM_OC_InitStruct->OCState = LL_TIM_OCSTATE_DISABLE; + TIM_OC_InitStruct->OCNState = LL_TIM_OCSTATE_DISABLE; + TIM_OC_InitStruct->CompareValue = 0x00000000U; + TIM_OC_InitStruct->OCPolarity = LL_TIM_OCPOLARITY_HIGH; + TIM_OC_InitStruct->OCNPolarity = LL_TIM_OCPOLARITY_HIGH; + TIM_OC_InitStruct->OCIdleState = LL_TIM_OCIDLESTATE_LOW; + TIM_OC_InitStruct->OCNIdleState = LL_TIM_OCIDLESTATE_LOW; +} + +/** + * @brief Configure the TIMx output channel. + * @param TIMx Timer Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx output channel is initialized + * - ERROR: TIMx output channel is not initialized + */ +ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct) +{ + ErrorStatus result = ERROR; + + switch (Channel) + { + case LL_TIM_CHANNEL_CH1: + result = OC1Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH2: + result = OC2Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH3: + result = OC3Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH4: + result = OC4Config(TIMx, TIM_OC_InitStruct); + break; + default: + break; + } + + return result; +} + +/** + * @brief Set the fields of the TIMx input channel configuration data + * structure to their default values. + * @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration data structure) + * @retval None + */ +void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Set the default configuration */ + TIM_ICInitStruct->ICPolarity = LL_TIM_IC_POLARITY_RISING; + TIM_ICInitStruct->ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_ICInitStruct->ICPrescaler = LL_TIM_ICPSC_DIV1; + TIM_ICInitStruct->ICFilter = LL_TIM_IC_FILTER_FDIV1; +} + +/** + * @brief Configure the TIMx input channel. + * @param TIMx Timer Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx output channel is initialized + * - ERROR: TIMx output channel is not initialized + */ +ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct) +{ + ErrorStatus result = ERROR; + + switch (Channel) + { + case LL_TIM_CHANNEL_CH1: + result = IC1Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH2: + result = IC2Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH3: + result = IC3Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH4: + result = IC4Config(TIMx, TIM_IC_InitStruct); + break; + default: + break; + } + + return result; +} + +/** + * @brief Fills each TIM_EncoderInitStruct field with its default value + * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface configuration data structure) + * @retval None + */ +void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) +{ + /* Set the default configuration */ + TIM_EncoderInitStruct->EncoderMode = LL_TIM_ENCODERMODE_X2_TI1; + TIM_EncoderInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_EncoderInitStruct->IC1ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_EncoderInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1; + TIM_EncoderInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1; + TIM_EncoderInitStruct->IC2Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_EncoderInitStruct->IC2ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_EncoderInitStruct->IC2Prescaler = LL_TIM_ICPSC_DIV1; + TIM_EncoderInitStruct->IC2Filter = LL_TIM_IC_FILTER_FDIV1; +} + +/** + * @brief Configure the encoder interface of the timer instance. + * @param TIMx Timer Instance + * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC1ActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC1Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC1Filter)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC2Polarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC2ActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC2Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC2Filter)); + + /* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */ + TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Configure TI1 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1ActiveInput >> 16U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Filter >> 16U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Prescaler >> 16U); + + /* Configure TI2 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2ActiveInput >> 8U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Filter >> 8U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Prescaler >> 8U); + + /* Set TI1 and TI2 polarity and enable TI1 and TI2 */ + tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC1Polarity); + tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC2Polarity << 4U); + tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Set encoder mode */ + LL_TIM_SetEncoderMode(TIMx, TIM_EncoderInitStruct->EncoderMode); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Set the fields of the TIMx Hall sensor interface configuration data + * structure to their default values. + * @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (HALL sensor interface configuration data structure) + * @retval None + */ +void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) +{ + /* Set the default configuration */ + TIM_HallSensorInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_HallSensorInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1; + TIM_HallSensorInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1; + TIM_HallSensorInitStruct->CommutationDelay = 0U; +} + +/** + * @brief Configure the Hall sensor interface of the timer instance. + * @note TIMx CH1, CH2 and CH3 inputs connected through a XOR + * to the TI1 input channel + * @note TIMx slave mode controller is configured in reset mode. + Selected internal trigger is TI1F_ED. + * @note Channel 1 is configured as input, IC1 is mapped on TRC. + * @note Captured value stored in TIMx_CCR1 correspond to the time elapsed + * between 2 changes on the inputs. It gives information about motor speed. + * @note Channel 2 is configured in output PWM 2 mode. + * @note Compare value stored in TIMx_CCR2 corresponds to the commutation delay. + * @note OC2REF is selected as trigger output on TRGO. + * @note LL_TIM_IC_POLARITY_BOTHEDGE must not be used for TI1 when it is used + * when TIMx operates in Hall sensor interface mode. + * @param TIMx Timer Instance + * @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (TIMx HALL sensor interface configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) +{ + uint32_t tmpcr2; + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity)); + assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_HallSensorInitStruct->IC1Filter)); + + /* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */ + TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx SMCR register value */ + tmpsmcr = LL_TIM_ReadReg(TIMx, SMCR); + + /* Connect TIMx_CH1, CH2 and CH3 pins to the TI1 input */ + tmpcr2 |= TIM_CR2_TI1S; + + /* OC2REF signal is used as trigger output (TRGO) */ + tmpcr2 |= LL_TIM_TRGO_OC2REF; + + /* Configure the slave mode controller */ + tmpsmcr &= (uint32_t)~(TIM_SMCR_TS | TIM_SMCR_SMS); + tmpsmcr |= LL_TIM_TS_TI1F_ED; + tmpsmcr |= LL_TIM_SLAVEMODE_RESET; + + /* Configure input channel 1 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC); + tmpccmr1 |= (uint32_t)(LL_TIM_ACTIVEINPUT_TRC >> 16U); + tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Filter >> 16U); + tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Prescaler >> 16U); + + /* Configure input channel 2 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_OC2M | TIM_CCMR1_OC2FE | TIM_CCMR1_OC2PE | TIM_CCMR1_OC2CE); + tmpccmr1 |= (uint32_t)(LL_TIM_OCMODE_PWM2 << 8U); + + /* Set Channel 1 polarity and enable Channel 1 and Channel2 */ + tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (uint32_t)(TIM_HallSensorInitStruct->IC1Polarity); + tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx SMCR */ + LL_TIM_WriteReg(TIMx, SMCR, tmpsmcr); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + /* Write to TIMx CCR2 */ + LL_TIM_OC_SetCompareCH2(TIMx, TIM_HallSensorInitStruct->CommutationDelay); + + return SUCCESS; +} + +/** + * @brief Set the fields of the Break and Dead Time configuration data structure + * to their default values. + * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure) + * @retval None + */ +void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) +{ + /* Set the default configuration */ + TIM_BDTRInitStruct->OSSRState = LL_TIM_OSSR_DISABLE; + TIM_BDTRInitStruct->OSSIState = LL_TIM_OSSI_DISABLE; + TIM_BDTRInitStruct->LockLevel = LL_TIM_LOCKLEVEL_OFF; + TIM_BDTRInitStruct->DeadTime = (uint8_t)0x00; + TIM_BDTRInitStruct->BreakState = LL_TIM_BREAK_DISABLE; + TIM_BDTRInitStruct->BreakPolarity = LL_TIM_BREAK_POLARITY_LOW; + TIM_BDTRInitStruct->AutomaticOutput = LL_TIM_AUTOMATICOUTPUT_DISABLE; +} + +/** + * @brief Configure the Break and Dead Time feature of the timer instance. + * @note As the bits AOE, BKP, BKE, OSSR, OSSI and DTG[7:0] can be write-locked + * depending on the LOCK configuration, it can be necessary to configure all of + * them during the first write access to the TIMx_BDTR register. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @param TIMx Timer Instance + * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Break and Dead Time is initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) +{ + uint32_t tmpbdtr = 0; + + /* Check the parameters */ + assert_param(IS_TIM_BREAK_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OSSR_STATE(TIM_BDTRInitStruct->OSSRState)); + assert_param(IS_LL_TIM_OSSI_STATE(TIM_BDTRInitStruct->OSSIState)); + assert_param(IS_LL_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->LockLevel)); + assert_param(IS_LL_TIM_BREAK_STATE(TIM_BDTRInitStruct->BreakState)); + assert_param(IS_LL_TIM_BREAK_POLARITY(TIM_BDTRInitStruct->BreakPolarity)); + assert_param(IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(TIM_BDTRInitStruct->AutomaticOutput)); + + /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State, + the OSSI State, the dead time value and the Automatic Output Enable Bit */ + + /* Set the BDTR bits */ + MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, TIM_BDTRInitStruct->DeadTime); + MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, TIM_BDTRInitStruct->LockLevel); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, TIM_BDTRInitStruct->OSSIState); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, TIM_BDTRInitStruct->OSSRState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, TIM_BDTRInitStruct->BreakState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, TIM_BDTRInitStruct->BreakPolarity); + MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, TIM_BDTRInitStruct->AutomaticOutput); + MODIFY_REG(tmpbdtr, TIM_BDTR_MOE, TIM_BDTRInitStruct->AutomaticOutput); + + /* Set TIMx_BDTR */ + LL_TIM_WriteReg(TIMx, BDTR, tmpbdtr); + + return SUCCESS; +} +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup TIM_LL_Private_Functions TIM Private Functions + * @brief Private functions + * @{ + */ +/** + * @brief Configure the TIMx output channel 1. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 1 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 1: Reset the CC1E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC1E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC1S); + + /* Set the Output Compare Mode */ + MODIFY_REG(tmpccmr1, TIM_CCMR1_OC1M, TIM_OCInitStruct->OCMode); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC1P, TIM_OCInitStruct->OCPolarity); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC1E, TIM_OCInitStruct->OCState); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC1NP, TIM_OCInitStruct->OCNPolarity << 2U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC1NE, TIM_OCInitStruct->OCNState << 2U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS1, TIM_OCInitStruct->OCIdleState); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS1N, TIM_OCInitStruct->OCNIdleState << 1U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH1(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 2. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 2 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 2: Reset the CC2E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC2E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC2S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr1, TIM_CCMR1_OC2M, TIM_OCInitStruct->OCMode << 8U); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC2P, TIM_OCInitStruct->OCPolarity << 4U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC2E, TIM_OCInitStruct->OCState << 4U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC2NP, TIM_OCInitStruct->OCNPolarity << 6U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC2NE, TIM_OCInitStruct->OCNState << 6U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS2, TIM_OCInitStruct->OCIdleState << 2U); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS2N, TIM_OCInitStruct->OCNIdleState << 3U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH2(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 3. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 3 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 3: Reset the CC3E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC3E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR2 register value */ + tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC3S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr2, TIM_CCMR2_OC3M, TIM_OCInitStruct->OCMode); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC3P, TIM_OCInitStruct->OCPolarity << 8U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC3E, TIM_OCInitStruct->OCState << 8U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC3NP, TIM_OCInitStruct->OCNPolarity << 10U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC3NE, TIM_OCInitStruct->OCNState << 10U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS3, TIM_OCInitStruct->OCIdleState << 4U); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS3N, TIM_OCInitStruct->OCNIdleState << 5U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR2 */ + LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH3(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 4. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 4 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + + /* Disable the Channel 4: Reset the CC4E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC4E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR2 register value */ + tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC4S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr2, TIM_CCMR2_OC4M, TIM_OCInitStruct->OCMode << 8U); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC4P, TIM_OCInitStruct->OCPolarity << 12U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC4E, TIM_OCInitStruct->OCState << 12U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS4, TIM_OCInitStruct->OCIdleState << 6U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR2 */ + LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH4(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + + +/** + * @brief Configure the TIMx input channel 1. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 1 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR1, + (TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U); + + /* Select the Polarity and set the CC1E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC1P | TIM_CCER_CC1NP), + (TIM_ICInitStruct->ICPolarity | TIM_CCER_CC1E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 2. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 2 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC2E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR1, + (TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U); + + /* Select the Polarity and set the CC2E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC2P | TIM_CCER_CC2NP), + ((TIM_ICInitStruct->ICPolarity << 4U) | TIM_CCER_CC2E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 3. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 3 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 3: Reset the CC3E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC3E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR2, + (TIM_CCMR2_CC3S | TIM_CCMR2_IC3F | TIM_CCMR2_IC3PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U); + + /* Select the Polarity and set the CC3E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC3P | TIM_CCER_CC3NP), + ((TIM_ICInitStruct->ICPolarity << 8U) | TIM_CCER_CC3E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 4. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 4 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC4E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR2, + (TIM_CCMR2_CC4S | TIM_CCMR2_IC4F | TIM_CCMR2_IC4PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U); + + /* Select the Polarity and set the CC2E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC4P | TIM_CCER_CC4NP), + ((TIM_ICInitStruct->ICPolarity << 12U) | TIM_CCER_CC4E)); + + return SUCCESS; +} + + +/** + * @} + */ + +/** + * @} + */ + +#endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c new file mode 100644 index 0000000..1c3dd0c --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c @@ -0,0 +1,508 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_usart.c + * @author MCD Application Team + * @brief USART LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_usart.h" +#include "stm32f4xx_ll_rcc.h" +#include "stm32f4xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +#if defined (USART1) || defined (USART2) || defined (USART3) || defined (USART6) || defined (UART4) || defined (UART5) || defined (UART7) || defined (UART8) || defined (UART9) || defined (UART10) + +/** @addtogroup USART_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @addtogroup USART_LL_Private_Constants + * @{ + */ + +/** + * @} + */ + + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup USART_LL_Private_Macros + * @{ + */ + +/* __BAUDRATE__ The maximum Baud Rate is derived from the maximum clock available + * divided by the smallest oversampling used on the USART (i.e. 8) */ +#define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 12500000U) + +/* __VALUE__ In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d. */ +#define IS_LL_USART_BRR_MIN(__VALUE__) ((__VALUE__) >= 16U) + +/* __VALUE__ BRR content must be lower than or equal to 0xFFFF. */ +#define IS_LL_USART_BRR_MAX(__VALUE__) ((__VALUE__) <= 0x0000FFFFU) + +#define IS_LL_USART_DIRECTION(__VALUE__) (((__VALUE__) == LL_USART_DIRECTION_NONE) \ + || ((__VALUE__) == LL_USART_DIRECTION_RX) \ + || ((__VALUE__) == LL_USART_DIRECTION_TX) \ + || ((__VALUE__) == LL_USART_DIRECTION_TX_RX)) + +#define IS_LL_USART_PARITY(__VALUE__) (((__VALUE__) == LL_USART_PARITY_NONE) \ + || ((__VALUE__) == LL_USART_PARITY_EVEN) \ + || ((__VALUE__) == LL_USART_PARITY_ODD)) + +#define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_8B) \ + || ((__VALUE__) == LL_USART_DATAWIDTH_9B)) + +#define IS_LL_USART_OVERSAMPLING(__VALUE__) (((__VALUE__) == LL_USART_OVERSAMPLING_16) \ + || ((__VALUE__) == LL_USART_OVERSAMPLING_8)) + +#define IS_LL_USART_LASTBITCLKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_LASTCLKPULSE_NO_OUTPUT) \ + || ((__VALUE__) == LL_USART_LASTCLKPULSE_OUTPUT)) + +#define IS_LL_USART_CLOCKPHASE(__VALUE__) (((__VALUE__) == LL_USART_PHASE_1EDGE) \ + || ((__VALUE__) == LL_USART_PHASE_2EDGE)) + +#define IS_LL_USART_CLOCKPOLARITY(__VALUE__) (((__VALUE__) == LL_USART_POLARITY_LOW) \ + || ((__VALUE__) == LL_USART_POLARITY_HIGH)) + +#define IS_LL_USART_CLOCKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_CLOCK_DISABLE) \ + || ((__VALUE__) == LL_USART_CLOCK_ENABLE)) + +#define IS_LL_USART_STOPBITS(__VALUE__) (((__VALUE__) == LL_USART_STOPBITS_0_5) \ + || ((__VALUE__) == LL_USART_STOPBITS_1) \ + || ((__VALUE__) == LL_USART_STOPBITS_1_5) \ + || ((__VALUE__) == LL_USART_STOPBITS_2)) + +#define IS_LL_USART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_USART_HWCONTROL_NONE) \ + || ((__VALUE__) == LL_USART_HWCONTROL_RTS) \ + || ((__VALUE__) == LL_USART_HWCONTROL_CTS) \ + || ((__VALUE__) == LL_USART_HWCONTROL_RTS_CTS)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup USART_LL_Exported_Functions + * @{ + */ + +/** @addtogroup USART_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize USART registers (Registers restored to their default values). + * @param USARTx USART Instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers are de-initialized + * - ERROR: USART registers are not de-initialized + */ +ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx) +{ + ErrorStatus status = SUCCESS; + + /* Check the parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + + if (USARTx == USART1) + { + /* Force reset of USART clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1); + + /* Release reset of USART clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1); + } + else if (USARTx == USART2) + { + /* Force reset of USART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART2); + + /* Release reset of USART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART2); + } +#if defined(USART3) + else if (USARTx == USART3) + { + /* Force reset of USART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART3); + + /* Release reset of USART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART3); + } +#endif /* USART3 */ +#if defined(USART6) + else if (USARTx == USART6) + { + /* Force reset of USART clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART6); + + /* Release reset of USART clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART6); + } +#endif /* USART6 */ +#if defined(UART4) + else if (USARTx == UART4) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART4); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART4); + } +#endif /* UART4 */ +#if defined(UART5) + else if (USARTx == UART5) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART5); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART5); + } +#endif /* UART5 */ +#if defined(UART7) + else if (USARTx == UART7) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART7); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART7); + } +#endif /* UART7 */ +#if defined(UART8) + else if (USARTx == UART8) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART8); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART8); + } +#endif /* UART8 */ +#if defined(UART9) + else if (USARTx == UART9) + { + /* Force reset of UART clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_UART9); + + /* Release reset of UART clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_UART9); + } +#endif /* UART9 */ +#if defined(UART10) + else if (USARTx == UART10) + { + /* Force reset of UART clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_UART10); + + /* Release reset of UART clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_UART10); + } +#endif /* UART10 */ + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Initialize USART registers according to the specified + * parameters in USART_InitStruct. + * @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), + * USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @note Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0). + * @param USARTx USART Instance + * @param USART_InitStruct pointer to a LL_USART_InitTypeDef structure + * that contains the configuration information for the specified USART peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers are initialized according to USART_InitStruct content + * - ERROR: Problem occurred during USART Registers initialization + */ +ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct) +{ + ErrorStatus status = ERROR; + uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO; + LL_RCC_ClocksTypeDef rcc_clocks; + + /* Check the parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate)); + assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth)); + assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits)); + assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity)); + assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection)); + assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl)); + assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling)); + + /* USART needs to be in disabled state, in order to be able to configure some bits in + CRx registers */ + if (LL_USART_IsEnabled(USARTx) == 0U) + { + /*---------------------------- USART CR1 Configuration ----------------------- + * Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters: + * - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value + * - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value + * - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value + * - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value. + */ + MODIFY_REG(USARTx->CR1, + (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | + USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8), + (USART_InitStruct->DataWidth | USART_InitStruct->Parity | + USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling)); + + /*---------------------------- USART CR2 Configuration ----------------------- + * Configure USARTx CR2 (Stop bits) with parameters: + * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value. + * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit(). + */ + LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits); + + /*---------------------------- USART CR3 Configuration ----------------------- + * Configure USARTx CR3 (Hardware Flow Control) with parameters: + * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to USART_InitStruct->HardwareFlowControl value. + */ + LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl); + + /*---------------------------- USART BRR Configuration ----------------------- + * Retrieve Clock frequency used for USART Peripheral + */ + LL_RCC_GetSystemClocksFreq(&rcc_clocks); + if (USARTx == USART1) + { + periphclk = rcc_clocks.PCLK2_Frequency; + } + else if (USARTx == USART2) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#if defined(USART3) + else if (USARTx == USART3) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* USART3 */ +#if defined(USART6) + else if (USARTx == USART6) + { + periphclk = rcc_clocks.PCLK2_Frequency; + } +#endif /* USART6 */ +#if defined(UART4) + else if (USARTx == UART4) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART4 */ +#if defined(UART5) + else if (USARTx == UART5) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART5 */ +#if defined(UART7) + else if (USARTx == UART7) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART7 */ +#if defined(UART8) + else if (USARTx == UART8) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART8 */ +#if defined(UART9) + else if (USARTx == UART9) + { + periphclk = rcc_clocks.PCLK2_Frequency; + } +#endif /* UART9 */ +#if defined(UART10) + else if (USARTx == UART10) + { + periphclk = rcc_clocks.PCLK2_Frequency; + } +#endif /* UART10 */ + else + { + /* Nothing to do, as error code is already assigned to ERROR value */ + } + + /* Configure the USART Baud Rate : + - valid baud rate value (different from 0) is required + - Peripheral clock as returned by RCC service, should be valid (different from 0). + */ + if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO) + && (USART_InitStruct->BaudRate != 0U)) + { + status = SUCCESS; + LL_USART_SetBaudRate(USARTx, + periphclk, + USART_InitStruct->OverSampling, + USART_InitStruct->BaudRate); + + /* Check BRR is greater than or equal to 16d */ + assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR)); + + /* Check BRR is greater than or equal to 16d */ + assert_param(IS_LL_USART_BRR_MAX(USARTx->BRR)); + } + } + /* Endif (=> USART not in Disabled state => return ERROR) */ + + return (status); +} + +/** + * @brief Set each @ref LL_USART_InitTypeDef field to default value. + * @param USART_InitStruct Pointer to a @ref LL_USART_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ + +void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct) +{ + /* Set USART_InitStruct fields to default values */ + USART_InitStruct->BaudRate = 9600U; + USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct->StopBits = LL_USART_STOPBITS_1; + USART_InitStruct->Parity = LL_USART_PARITY_NONE ; + USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16; +} + +/** + * @brief Initialize USART Clock related settings according to the + * specified parameters in the USART_ClockInitStruct. + * @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), + * USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @param USARTx USART Instance + * @param USART_ClockInitStruct Pointer to a @ref LL_USART_ClockInitTypeDef structure + * that contains the Clock configuration information for the specified USART peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers related to Clock settings are initialized according to USART_ClockInitStruct content + * - ERROR: Problem occurred during USART Registers initialization + */ +ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct) +{ + ErrorStatus status = SUCCESS; + + /* Check USART Instance and Clock signal output parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput)); + + /* USART needs to be in disabled state, in order to be able to configure some bits in + CRx registers */ + if (LL_USART_IsEnabled(USARTx) == 0U) + { + /*---------------------------- USART CR2 Configuration -----------------------*/ + /* If Clock signal has to be output */ + if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE) + { + /* Deactivate Clock signal delivery : + * - Disable Clock Output: USART_CR2_CLKEN cleared + */ + LL_USART_DisableSCLKOutput(USARTx); + } + else + { + /* Ensure USART instance is USART capable */ + assert_param(IS_USART_INSTANCE(USARTx)); + + /* Check clock related parameters */ + assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity)); + assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase)); + assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse)); + + /*---------------------------- USART CR2 Configuration ----------------------- + * Configure USARTx CR2 (Clock signal related bits) with parameters: + * - Enable Clock Output: USART_CR2_CLKEN set + * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value + * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value + * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value. + */ + MODIFY_REG(USARTx->CR2, + USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, + USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity | + USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse); + } + } + /* Else (USART not in Disabled state => return ERROR */ + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Set each field of a @ref LL_USART_ClockInitTypeDef type structure to default value. + * @param USART_ClockInitStruct Pointer to a @ref LL_USART_ClockInitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ +void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct) +{ + /* Set LL_USART_ClockInitStruct fields with default values */ + USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE; + USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ + USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ + USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* USART1 || USART2 || USART3 || USART6 || UART4 || UART5 || UART7 || UART8 || UART9 || UART10 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c new file mode 100644 index 0000000..ef05cfd --- /dev/null +++ b/EMBOS/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c @@ -0,0 +1,740 @@ +/** + ****************************************************************************** + * @file stm32f4xx_ll_utils.c + * @author MCD Application Team + * @brief UTILS LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx_ll_utils.h" +#include "stm32f4xx_ll_rcc.h" +#include "stm32f4xx_ll_system.h" +#include "stm32f4xx_ll_pwr.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +/** @addtogroup STM32F4xx_LL_Driver + * @{ + */ + +/** @addtogroup UTILS_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Private_Constants + * @{ + */ +#if defined(RCC_MAX_FREQUENCY_SCALE1) +#define UTILS_MAX_FREQUENCY_SCALE1 RCC_MAX_FREQUENCY /*!< Maximum frequency for system clock at power scale1, in Hz */ +#endif /*RCC_MAX_FREQUENCY_SCALE1 */ +#define UTILS_MAX_FREQUENCY_SCALE2 RCC_MAX_FREQUENCY_SCALE2 /*!< Maximum frequency for system clock at power scale2, in Hz */ +#if defined(RCC_MAX_FREQUENCY_SCALE3) +#define UTILS_MAX_FREQUENCY_SCALE3 RCC_MAX_FREQUENCY_SCALE3 /*!< Maximum frequency for system clock at power scale3, in Hz */ +#endif /* MAX_FREQUENCY_SCALE3 */ + +/* Defines used for PLL range */ +#define UTILS_PLLVCO_INPUT_MIN RCC_PLLVCO_INPUT_MIN /*!< Frequency min for PLLVCO input, in Hz */ +#define UTILS_PLLVCO_INPUT_MAX RCC_PLLVCO_INPUT_MAX /*!< Frequency max for PLLVCO input, in Hz */ +#define UTILS_PLLVCO_OUTPUT_MIN RCC_PLLVCO_OUTPUT_MIN /*!< Frequency min for PLLVCO output, in Hz */ +#define UTILS_PLLVCO_OUTPUT_MAX RCC_PLLVCO_OUTPUT_MAX /*!< Frequency max for PLLVCO output, in Hz */ + +/* Defines used for HSE range */ +#define UTILS_HSE_FREQUENCY_MIN 4000000U /*!< Frequency min for HSE frequency, in Hz */ +#define UTILS_HSE_FREQUENCY_MAX 26000000U /*!< Frequency max for HSE frequency, in Hz */ + +/* Defines used for FLASH latency according to HCLK Frequency */ +#if defined(FLASH_SCALE1_LATENCY1_FREQ) +#define UTILS_SCALE1_LATENCY1_FREQ FLASH_SCALE1_LATENCY1_FREQ /*!< HCLK frequency to set FLASH latency 1 in power scale 1 */ +#endif +#if defined(FLASH_SCALE1_LATENCY2_FREQ) +#define UTILS_SCALE1_LATENCY2_FREQ FLASH_SCALE1_LATENCY2_FREQ /*!< HCLK frequency to set FLASH latency 2 in power scale 1 */ +#endif +#if defined(FLASH_SCALE1_LATENCY3_FREQ) +#define UTILS_SCALE1_LATENCY3_FREQ FLASH_SCALE1_LATENCY3_FREQ /*!< HCLK frequency to set FLASH latency 3 in power scale 1 */ +#endif +#if defined(FLASH_SCALE1_LATENCY4_FREQ) +#define UTILS_SCALE1_LATENCY4_FREQ FLASH_SCALE1_LATENCY4_FREQ /*!< HCLK frequency to set FLASH latency 4 in power scale 1 */ +#endif +#if defined(FLASH_SCALE1_LATENCY5_FREQ) +#define UTILS_SCALE1_LATENCY5_FREQ FLASH_SCALE1_LATENCY5_FREQ /*!< HCLK frequency to set FLASH latency 5 in power scale 1 */ +#endif +#define UTILS_SCALE2_LATENCY1_FREQ FLASH_SCALE2_LATENCY1_FREQ /*!< HCLK frequency to set FLASH latency 1 in power scale 2 */ +#define UTILS_SCALE2_LATENCY2_FREQ FLASH_SCALE2_LATENCY2_FREQ /*!< HCLK frequency to set FLASH latency 2 in power scale 2 */ +#if defined(FLASH_SCALE2_LATENCY3_FREQ) +#define UTILS_SCALE2_LATENCY3_FREQ FLASH_SCALE2_LATENCY3_FREQ /*!< HCLK frequency to set FLASH latency 2 in power scale 2 */ +#endif +#if defined(FLASH_SCALE2_LATENCY4_FREQ) +#define UTILS_SCALE2_LATENCY4_FREQ FLASH_SCALE2_LATENCY4_FREQ /*!< HCLK frequency to set FLASH latency 4 in power scale 2 */ +#endif +#if defined(FLASH_SCALE2_LATENCY5_FREQ) +#define UTILS_SCALE2_LATENCY5_FREQ FLASH_SCALE2_LATENCY5_FREQ /*!< HCLK frequency to set FLASH latency 5 in power scale 2 */ +#endif +#if defined(FLASH_SCALE3_LATENCY1_FREQ) +#define UTILS_SCALE3_LATENCY1_FREQ FLASH_SCALE3_LATENCY1_FREQ /*!< HCLK frequency to set FLASH latency 1 in power scale 3 */ +#endif +#if defined(FLASH_SCALE3_LATENCY2_FREQ) +#define UTILS_SCALE3_LATENCY2_FREQ FLASH_SCALE3_LATENCY2_FREQ /*!< HCLK frequency to set FLASH latency 2 in power scale 3 */ +#endif +#if defined(FLASH_SCALE3_LATENCY3_FREQ) +#define UTILS_SCALE3_LATENCY3_FREQ FLASH_SCALE3_LATENCY3_FREQ /*!< HCLK frequency to set FLASH latency 3 in power scale 3 */ +#endif +#if defined(FLASH_SCALE3_LATENCY4_FREQ) +#define UTILS_SCALE3_LATENCY4_FREQ FLASH_SCALE3_LATENCY4_FREQ /*!< HCLK frequency to set FLASH latency 4 in power scale 3 */ +#endif +#if defined(FLASH_SCALE3_LATENCY5_FREQ) +#define UTILS_SCALE3_LATENCY5_FREQ FLASH_SCALE3_LATENCY5_FREQ /*!< HCLK frequency to set FLASH latency 5 in power scale 3 */ +#endif +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Private_Macros + * @{ + */ +#define IS_LL_UTILS_SYSCLK_DIV(__VALUE__) (((__VALUE__) == LL_RCC_SYSCLK_DIV_1) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_2) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_4) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_8) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_16) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_64) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_128) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_256) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_512)) + +#define IS_LL_UTILS_APB1_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB1_DIV_1) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_2) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_4) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_8) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_16)) + +#define IS_LL_UTILS_APB2_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB2_DIV_1) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_2) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_4) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_8) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_16)) + +#define IS_LL_UTILS_PLLM_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLLM_DIV_2) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_3) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_4) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_5) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_6) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_7) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_8) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_9) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_10) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_11) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_12) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_13) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_14) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_15) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_16) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_17) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_18) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_19) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_20) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_21) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_22) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_23) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_24) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_25) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_26) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_27) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_28) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_29) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_30) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_31) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_32) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_33) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_34) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_35) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_36) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_37) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_38) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_39) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_40) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_41) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_42) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_43) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_44) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_45) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_46) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_47) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_48) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_49) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_50) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_51) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_52) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_53) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_54) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_55) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_56) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_57) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_58) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_59) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_60) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_61) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_62) \ + || ((__VALUE__) == LL_RCC_PLLM_DIV_63)) + +#define IS_LL_UTILS_PLLN_VALUE(__VALUE__) ((RCC_PLLN_MIN_VALUE <= (__VALUE__)) && ((__VALUE__) <= RCC_PLLN_MAX_VALUE)) + +#define IS_LL_UTILS_PLLP_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLLP_DIV_2) \ + || ((__VALUE__) == LL_RCC_PLLP_DIV_4) \ + || ((__VALUE__) == LL_RCC_PLLP_DIV_6) \ + || ((__VALUE__) == LL_RCC_PLLP_DIV_8)) + +#define IS_LL_UTILS_PLLVCO_INPUT(__VALUE__) ((UTILS_PLLVCO_INPUT_MIN <= (__VALUE__)) && ((__VALUE__) <= UTILS_PLLVCO_INPUT_MAX)) + +#define IS_LL_UTILS_PLLVCO_OUTPUT(__VALUE__) ((UTILS_PLLVCO_OUTPUT_MIN <= (__VALUE__)) && ((__VALUE__) <= UTILS_PLLVCO_OUTPUT_MAX)) + +#if !defined(RCC_MAX_FREQUENCY_SCALE1) +#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE2) : \ + ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE3)) + +#elif defined(RCC_MAX_FREQUENCY_SCALE3) +#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE1) : \ + (LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE2) : \ + ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE3)) + +#else +#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE1) : \ + ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE2)) + +#endif /* RCC_MAX_FREQUENCY_SCALE1*/ +#define IS_LL_UTILS_HSE_BYPASS(__STATE__) (((__STATE__) == LL_UTILS_HSEBYPASS_ON) \ + || ((__STATE__) == LL_UTILS_HSEBYPASS_OFF)) + +#define IS_LL_UTILS_HSE_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) >= UTILS_HSE_FREQUENCY_MIN) && ((__FREQUENCY__) <= UTILS_HSE_FREQUENCY_MAX)) +/** + * @} + */ +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Functions UTILS Private functions + * @{ + */ +static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct); +static ErrorStatus UTILS_SetFlashLatency(uint32_t HCLK_Frequency); +static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +static ErrorStatus UTILS_PLL_IsBusy(void); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Exported_Functions + * @{ + */ + +/** @addtogroup UTILS_LL_EF_DELAY + * @{ + */ + +/** + * @brief This function configures the Cortex-M SysTick source to have 1ms time base. + * @note When a RTOS is used, it is recommended to avoid changing the Systick + * configuration by calling this function, for a delay use rather osDelay RTOS service. + * @param HCLKFrequency HCLK frequency in Hz + * @note HCLK frequency can be calculated thanks to RCC helper macro or function @ref LL_RCC_GetSystemClocksFreq + * @retval None + */ +void LL_Init1msTick(uint32_t HCLKFrequency) +{ + /* Use frequency provided in argument */ + LL_InitTick(HCLKFrequency, 1000U); +} + +/** + * @brief This function provides accurate delay (in milliseconds) based + * on SysTick counter flag + * @note When a RTOS is used, it is recommended to avoid using blocking delay + * and use rather osDelay service. + * @note To respect 1ms timebase, user should call @ref LL_Init1msTick function which + * will configure Systick to 1ms + * @param Delay specifies the delay time length, in milliseconds. + * @retval None + */ +void LL_mDelay(uint32_t Delay) +{ + __IO uint32_t tmp = SysTick->CTRL; /* Clear the COUNTFLAG first */ + /* Add this code to indicate that local variable is not used */ + ((void)tmp); + + /* Add a period to guaranty minimum wait */ + if(Delay < LL_MAX_DELAY) + { + Delay++; + } + + while (Delay) + { + if((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) + { + Delay--; + } + } +} + +/** + * @} + */ + +/** @addtogroup UTILS_EF_SYSTEM + * @brief System Configuration functions + * + @verbatim + =============================================================================== + ##### System Configuration functions ##### + =============================================================================== + [..] + System, AHB and APB buses clocks configuration + + (+) The maximum frequency of the SYSCLK, HCLK, PCLK1 and PCLK2 is 180000000 Hz. + @endverbatim + @internal + Depending on the device voltage range, the maximum frequency should be + adapted accordingly to the Refenece manual. + @endinternal + * @{ + */ + +/** + * @brief This function sets directly SystemCoreClock CMSIS variable. + * @note Variable can be calculated also through SystemCoreClockUpdate function. + * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) + * @retval None + */ +void LL_SetSystemCoreClock(uint32_t HCLKFrequency) +{ + /* HCLK clock frequency */ + SystemCoreClock = HCLKFrequency; +} + +/** + * @brief This function configures system clock at maximum frequency with HSI as clock source of the PLL + * @note The application need to ensure that PLL is disabled. + * @note Function is based on the following formula: + * - PLL output frequency = (((HSI frequency / PLLM) * PLLN) / PLLP) + * - PLLM: ensure that the VCO input frequency ranges from @ref RCC_PLLVCO_INPUT_MIN to @ref RCC_PLLVCO_INPUT_MAX (PLLVCO_input = HSI frequency / PLLM) + * - PLLN: ensure that the VCO output frequency is between @ref RCC_PLLVCO_OUTPUT_MIN and @ref RCC_PLLVCO_OUTPUT_MAX (PLLVCO_output = PLLVCO_input * PLLN) + * - PLLP: ensure that max frequency at 180000000 Hz is reach (PLLVCO_output / PLLP) + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Max frequency configuration done + * - ERROR: Max frequency configuration not done + */ +ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t pllfreq = 0U; + + /* Check if one of the PLL is enabled */ + if(UTILS_PLL_IsBusy() == SUCCESS) + { + /* Calculate the new PLL output frequency */ + pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct); + + /* Enable HSI if not enabled */ + if(LL_RCC_HSI_IsReady() != 1U) + { + LL_RCC_HSI_Enable(); + while (LL_RCC_HSI_IsReady() != 1U) + { + /* Wait for HSI ready */ + } + } + + /* Configure PLL */ + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN, + UTILS_PLLInitStruct->PLLP); + + /* Enable PLL and switch system clock to PLL */ + status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); + } + else + { + /* Current PLL configuration cannot be modified */ + status = ERROR; + } + + return status; +} + +/** + * @brief This function configures system clock with HSE as clock source of the PLL + * @note The application need to ensure that PLL is disabled. + * - PLL output frequency = (((HSI frequency / PLLM) * PLLN) / PLLP) + * - PLLM: ensure that the VCO input frequency ranges from @ref RCC_PLLVCO_INPUT_MIN to @ref RCC_PLLVCO_INPUT_MAX (PLLVCO_input = HSI frequency / PLLM) + * - PLLN: ensure that the VCO output frequency is between @ref RCC_PLLVCO_OUTPUT_MIN and @ref RCC_PLLVCO_OUTPUT_MAX (PLLVCO_output = PLLVCO_input * PLLN) + * - PLLP: ensure that max frequency at 180000000 Hz is reach (PLLVCO_output / PLLP) + * @param HSEFrequency Value between Min_Data = 4000000 and Max_Data = 26000000 + * @param HSEBypass This parameter can be one of the following values: + * @arg @ref LL_UTILS_HSEBYPASS_ON + * @arg @ref LL_UTILS_HSEBYPASS_OFF + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Max frequency configuration done + * - ERROR: Max frequency configuration not done + */ +ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t pllfreq = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_HSE_FREQUENCY(HSEFrequency)); + assert_param(IS_LL_UTILS_HSE_BYPASS(HSEBypass)); + + /* Check if one of the PLL is enabled */ + if(UTILS_PLL_IsBusy() == SUCCESS) + { + /* Calculate the new PLL output frequency */ + pllfreq = UTILS_GetPLLOutputFrequency(HSEFrequency, UTILS_PLLInitStruct); + + /* Enable HSE if not enabled */ + if(LL_RCC_HSE_IsReady() != 1U) + { + /* Check if need to enable HSE bypass feature or not */ + if(HSEBypass == LL_UTILS_HSEBYPASS_ON) + { + LL_RCC_HSE_EnableBypass(); + } + else + { + LL_RCC_HSE_DisableBypass(); + } + + /* Enable HSE */ + LL_RCC_HSE_Enable(); + while (LL_RCC_HSE_IsReady() != 1U) + { + /* Wait for HSE ready */ + } + } + + /* Configure PLL */ + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN, + UTILS_PLLInitStruct->PLLP); + + /* Enable PLL and switch system clock to PLL */ + status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); + } + else + { + /* Current PLL configuration cannot be modified */ + status = ERROR; + } + + return status; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup UTILS_LL_Private_Functions + * @{ + */ +/** + * @brief Update number of Flash wait states in line with new frequency and current + voltage range. + * @note This Function support ONLY devices with supply voltage (voltage range) between 2.7V and 3.6V + * @param HCLK_Frequency HCLK frequency + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Latency has been modified + * - ERROR: Latency cannot be modified + */ +static ErrorStatus UTILS_SetFlashLatency(uint32_t HCLK_Frequency) +{ + ErrorStatus status = SUCCESS; + + uint32_t latency = LL_FLASH_LATENCY_0; /* default value 0WS */ + + /* Frequency cannot be equal to 0 */ + if(HCLK_Frequency == 0U) + { + status = ERROR; + } + else + { + if(LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1) + { +#if defined (UTILS_SCALE1_LATENCY5_FREQ) + if((HCLK_Frequency > UTILS_SCALE1_LATENCY5_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_5; + } +#endif /*UTILS_SCALE1_LATENCY5_FREQ */ +#if defined (UTILS_SCALE1_LATENCY4_FREQ) + if((HCLK_Frequency > UTILS_SCALE1_LATENCY4_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_4; + } +#endif /* UTILS_SCALE1_LATENCY4_FREQ */ +#if defined (UTILS_SCALE1_LATENCY3_FREQ) + if((HCLK_Frequency > UTILS_SCALE1_LATENCY3_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_3; + } +#endif /* UTILS_SCALE1_LATENCY3_FREQ */ +#if defined (UTILS_SCALE1_LATENCY2_FREQ) + if((HCLK_Frequency > UTILS_SCALE1_LATENCY2_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_2; + } + else + { + if((HCLK_Frequency > UTILS_SCALE1_LATENCY1_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_1; + } + } +#endif /* UTILS_SCALE1_LATENCY2_FREQ */ + } + if(LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2) + { +#if defined (UTILS_SCALE2_LATENCY5_FREQ) + if((HCLK_Frequency > UTILS_SCALE2_LATENCY5_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_5; + } +#endif /*UTILS_SCALE1_LATENCY5_FREQ */ +#if defined (UTILS_SCALE2_LATENCY4_FREQ) + if((HCLK_Frequency > UTILS_SCALE2_LATENCY4_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_4; + } +#endif /*UTILS_SCALE1_LATENCY4_FREQ */ +#if defined (UTILS_SCALE2_LATENCY3_FREQ) + if((HCLK_Frequency > UTILS_SCALE2_LATENCY3_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_3; + } +#endif /*UTILS_SCALE1_LATENCY3_FREQ */ + if((HCLK_Frequency > UTILS_SCALE2_LATENCY2_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_2; + } + else + { + if((HCLK_Frequency > UTILS_SCALE2_LATENCY1_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_1; + } + } + } +#if defined (LL_PWR_REGU_VOLTAGE_SCALE3) + if(LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE3) + { +#if defined (UTILS_SCALE3_LATENCY3_FREQ) + if((HCLK_Frequency > UTILS_SCALE3_LATENCY3_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_3; + } +#endif /*UTILS_SCALE1_LATENCY3_FREQ */ +#if defined (UTILS_SCALE3_LATENCY2_FREQ) + if((HCLK_Frequency > UTILS_SCALE3_LATENCY2_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_2; + } + else + { + if((HCLK_Frequency > UTILS_SCALE3_LATENCY1_FREQ)&&(latency == LL_FLASH_LATENCY_0)) + { + latency = LL_FLASH_LATENCY_1; + } + } + } +#endif /*UTILS_SCALE1_LATENCY2_FREQ */ +#endif /* LL_PWR_REGU_VOLTAGE_SCALE3 */ + + LL_FLASH_SetLatency(latency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + if(LL_FLASH_GetLatency() != latency) + { + status = ERROR; + } + } + return status; +} + +/** + * @brief Function to check that PLL can be modified + * @param PLL_InputFrequency PLL input frequency (in Hz) + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @retval PLL output frequency (in Hz) + */ +static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct) +{ + uint32_t pllfreq = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_PLLM_VALUE(UTILS_PLLInitStruct->PLLM)); + assert_param(IS_LL_UTILS_PLLN_VALUE(UTILS_PLLInitStruct->PLLN)); + assert_param(IS_LL_UTILS_PLLP_VALUE(UTILS_PLLInitStruct->PLLP)); + + /* Check different PLL parameters according to RM */ + /* - PLLM: ensure that the VCO input frequency ranges from @ref UTILS_PLLVCO_INPUT_MIN to @ref UTILS_PLLVCO_INPUT_MAX MHz. */ + pllfreq = PLL_InputFrequency / (UTILS_PLLInitStruct->PLLM & (RCC_PLLCFGR_PLLM >> RCC_PLLCFGR_PLLM_Pos)); + assert_param(IS_LL_UTILS_PLLVCO_INPUT(pllfreq)); + + /* - PLLN: ensure that the VCO output frequency is between @ref UTILS_PLLVCO_OUTPUT_MIN and @ref UTILS_PLLVCO_OUTPUT_MAX .*/ + pllfreq = pllfreq * (UTILS_PLLInitStruct->PLLN & (RCC_PLLCFGR_PLLN >> RCC_PLLCFGR_PLLN_Pos)); + assert_param(IS_LL_UTILS_PLLVCO_OUTPUT(pllfreq)); + + /* - PLLP: ensure that max frequency at @ref RCC_MAX_FREQUENCY Hz is reached */ + pllfreq = pllfreq / (((UTILS_PLLInitStruct->PLLP >> RCC_PLLCFGR_PLLP_Pos) + 1) * 2); + assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq)); + + return pllfreq; +} + +/** + * @brief Function to check that PLL can be modified + * @retval An ErrorStatus enumeration value: + * - SUCCESS: PLL modification can be done + * - ERROR: PLL is busy + */ +static ErrorStatus UTILS_PLL_IsBusy(void) +{ + ErrorStatus status = SUCCESS; + + /* Check if PLL is busy*/ + if(LL_RCC_PLL_IsReady() != 0U) + { + /* PLL configuration cannot be modified */ + status = ERROR; + } + +#if defined(RCC_PLLSAI_SUPPORT) + /* Check if PLLSAI is busy*/ + if(LL_RCC_PLLSAI_IsReady() != 0U) + { + /* PLLSAI1 configuration cannot be modified */ + status = ERROR; + } +#endif /*RCC_PLLSAI_SUPPORT*/ +#if defined(RCC_PLLI2S_SUPPORT) + /* Check if PLLI2S is busy*/ + if(LL_RCC_PLLI2S_IsReady() != 0U) + { + /* PLLI2S configuration cannot be modified */ + status = ERROR; + } +#endif /*RCC_PLLI2S_SUPPORT*/ + return status; +} + +/** + * @brief Function to enable PLL and switch system clock to PLL + * @param SYSCLK_Frequency SYSCLK frequency + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: No problem to switch system to PLL + * - ERROR: Problem to switch system to PLL + */ +static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t hclk_frequency = 0U; + + assert_param(IS_LL_UTILS_SYSCLK_DIV(UTILS_ClkInitStruct->AHBCLKDivider)); + assert_param(IS_LL_UTILS_APB1_DIV(UTILS_ClkInitStruct->APB1CLKDivider)); + assert_param(IS_LL_UTILS_APB2_DIV(UTILS_ClkInitStruct->APB2CLKDivider)); + + /* Calculate HCLK frequency */ + hclk_frequency = __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, UTILS_ClkInitStruct->AHBCLKDivider); + + /* Increasing the number of wait states because of higher CPU frequency */ + if(SystemCoreClock < hclk_frequency) + { + /* Set FLASH latency to highest latency */ + status = UTILS_SetFlashLatency(hclk_frequency); + } + + /* Update system clock configuration */ + if(status == SUCCESS) + { + /* Enable PLL */ + LL_RCC_PLL_Enable(); + while (LL_RCC_PLL_IsReady() != 1U) + { + /* Wait for PLL ready */ + } + + /* Sysclk activation on the main PLL */ + LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider); + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + { + /* Wait for system clock switch to PLL */ + } + + /* Set APB1 & APB2 prescaler*/ + LL_RCC_SetAPB1Prescaler(UTILS_ClkInitStruct->APB1CLKDivider); + LL_RCC_SetAPB2Prescaler(UTILS_ClkInitStruct->APB2CLKDivider); + } + + /* Decreasing the number of wait states because of lower CPU frequency */ + if(SystemCoreClock > hclk_frequency) + { + /* Set FLASH latency to lowest latency */ + status = UTILS_SetFlashLatency(hclk_frequency); + } + + /* Update SystemCoreClock variable */ + if(status == SUCCESS) + { + LL_SetSystemCoreClock(hclk_frequency); + } + + return status; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/EMBOS/EMBOS.ioc b/EMBOS/EMBOS.ioc new file mode 100644 index 0000000..7eb2a72 --- /dev/null +++ b/EMBOS/EMBOS.ioc @@ -0,0 +1,607 @@ +#MicroXplorer Configuration settings - do not modify +CAN1.ABOM=ENABLE +CAN1.BS1=CAN_BS1_14TQ +CAN1.BS2=CAN_BS2_3TQ +CAN1.CalculateBaudRate=500000 +CAN1.CalculateTimeBit=1999.99 +CAN1.CalculateTimeQuantum=111.11111111111111 +CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,ABOM,NART,Prescaler,BS1,BS2,SJW +CAN1.NART=ENABLE +CAN1.Prescaler=5 +CAN1.SJW=CAN_SJW_2TQ +FMC.AddressSetupTime1=3 +FMC.BusTurnAroundDuration1=1 +FMC.CASLatency1=FMC_SDRAM_CAS_LATENCY_3 +FMC.CASLatency2=FMC_SDRAM_CAS_LATENCY_3 +FMC.ColumnBitsNumber1=FMC_SDRAM_COLUMN_BITS_NUM_9 +FMC.ColumnBitsNumber2=FMC_SDRAM_COLUMN_BITS_NUM_9 +FMC.DataSetupTime1=3 +FMC.ExitSelfRefreshDelay1=8 +FMC.ExitSelfRefreshDelay2=8 +FMC.IPParameters=WriteOperation1,AddressSetupTime1,DataSetupTime1,BusTurnAroundDuration1,ColumnBitsNumber1,CASLatency1,SDClockPeriod1,SDClockPeriod2,ReadBurst1,ReadBurst2,ReadPipeDelay1,ReadPipeDelay2,LoadToActiveDelay1,ExitSelfRefreshDelay1,SelfRefreshTime1,RowCycleDelay1,RowCycleDelay2,WriteRecoveryTime1,RPDelay1,RPDelay2,RCDDelay1,WriteRecoveryTime2,ExitSelfRefreshDelay2,ColumnBitsNumber2,CASLatency2,LoadToActiveDelay2,SelfRefreshTime2,RCDDelay2 +FMC.LoadToActiveDelay1=2 +FMC.LoadToActiveDelay2=2 +FMC.RCDDelay1=2 +FMC.RCDDelay2=2 +FMC.RPDelay1=2 +FMC.RPDelay2=2 +FMC.ReadBurst1=FMC_SDRAM_RBURST_ENABLE +FMC.ReadBurst2=FMC_SDRAM_RBURST_ENABLE +FMC.ReadPipeDelay1=FMC_SDRAM_RPIPE_DELAY_1 +FMC.ReadPipeDelay2=FMC_SDRAM_RPIPE_DELAY_1 +FMC.RowCycleDelay1=6 +FMC.RowCycleDelay2=6 +FMC.SDClockPeriod1=FMC_SDRAM_CLOCK_PERIOD_2 +FMC.SDClockPeriod2=FMC_SDRAM_CLOCK_PERIOD_2 +FMC.SelfRefreshTime1=6 +FMC.SelfRefreshTime2=6 +FMC.WriteOperation1=FMC_WRITE_OPERATION_ENABLE +FMC.WriteRecoveryTime1=4 +FMC.WriteRecoveryTime2=4 +File.Version=6 +GPIO.groupedBy=Group By Peripherals +KeepUserPlacement=false +Mcu.Family=STM32F4 +Mcu.IP0=CAN1 +Mcu.IP1=FMC +Mcu.IP10=TIM10 +Mcu.IP11=TIM11 +Mcu.IP12=TIM12 +Mcu.IP13=TIM13 +Mcu.IP14=TIM14 +Mcu.IP15=USART1 +Mcu.IP16=USART6 +Mcu.IP2=NVIC +Mcu.IP3=RCC +Mcu.IP4=SPI1 +Mcu.IP5=SPI2 +Mcu.IP6=SPI3 +Mcu.IP7=SYS +Mcu.IP8=TIM8 +Mcu.IP9=TIM9 +Mcu.IPNb=17 +Mcu.Name=STM32F446Z(C-E)Tx +Mcu.Package=LQFP144 +Mcu.Pin0=PC13 +Mcu.Pin1=PC14-OSC32_IN +Mcu.Pin10=PH1-OSC_OUT +Mcu.Pin11=PC0 +Mcu.Pin12=PC3 +Mcu.Pin13=PA4 +Mcu.Pin14=PA6 +Mcu.Pin15=PA7 +Mcu.Pin16=PC4 +Mcu.Pin17=PF11 +Mcu.Pin18=PF12 +Mcu.Pin19=PF13 +Mcu.Pin2=PC15-OSC32_OUT +Mcu.Pin20=PF14 +Mcu.Pin21=PF15 +Mcu.Pin22=PG0 +Mcu.Pin23=PG1 +Mcu.Pin24=PE7 +Mcu.Pin25=PE8 +Mcu.Pin26=PE9 +Mcu.Pin27=PE10 +Mcu.Pin28=PE11 +Mcu.Pin29=PE12 +Mcu.Pin3=PF0 +Mcu.Pin30=PE13 +Mcu.Pin31=PE14 +Mcu.Pin32=PE15 +Mcu.Pin33=PB12 +Mcu.Pin34=PB13 +Mcu.Pin35=PB14 +Mcu.Pin36=PB15 +Mcu.Pin37=PD8 +Mcu.Pin38=PD9 +Mcu.Pin39=PD10 +Mcu.Pin4=PF1 +Mcu.Pin40=PD14 +Mcu.Pin41=PD15 +Mcu.Pin42=PG2 +Mcu.Pin43=PG4 +Mcu.Pin44=PG5 +Mcu.Pin45=PG8 +Mcu.Pin46=PC6 +Mcu.Pin47=PC7 +Mcu.Pin48=PC8 +Mcu.Pin49=PA9 +Mcu.Pin5=PF2 +Mcu.Pin50=PA10 +Mcu.Pin51=PA13 +Mcu.Pin52=PA14 +Mcu.Pin53=PA15 +Mcu.Pin54=PC10 +Mcu.Pin55=PC12 +Mcu.Pin56=PD0 +Mcu.Pin57=PD1 +Mcu.Pin58=PD4 +Mcu.Pin59=PD5 +Mcu.Pin6=PF3 +Mcu.Pin60=PD6 +Mcu.Pin61=PD7 +Mcu.Pin62=PG15 +Mcu.Pin63=PB3 +Mcu.Pin64=PB4 +Mcu.Pin65=PB5 +Mcu.Pin66=PB6 +Mcu.Pin67=PB8 +Mcu.Pin68=PB9 +Mcu.Pin69=PE0 +Mcu.Pin7=PF4 +Mcu.Pin70=PE1 +Mcu.Pin71=VP_SYS_VS_Systick +Mcu.Pin72=VP_TIM8_VS_ClockSourceINT +Mcu.Pin73=VP_TIM9_VS_ClockSourceINT +Mcu.Pin74=VP_TIM10_VS_ClockSourceINT +Mcu.Pin75=VP_TIM11_VS_ClockSourceINT +Mcu.Pin76=VP_TIM12_VS_ClockSourceINT +Mcu.Pin77=VP_TIM13_VS_ClockSourceINT +Mcu.Pin78=VP_TIM14_VS_ClockSourceINT +Mcu.Pin8=PF5 +Mcu.Pin9=PH0-OSC_IN +Mcu.PinsNb=79 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32F446ZETx +MxCube.Version=6.1.0 +MxDb.Version=DB.6.0.10 +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.CAN1_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.CAN1_TX_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.EXTI15_10_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.ForceEnableDMAVector=true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true +NVIC.TIM1_BRK_TIM9_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.TIM1_TRG_COM_TIM11_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.TIM1_UP_TIM10_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.TIM8_BRK_TIM12_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.TIM8_TRG_COM_TIM14_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.TIM8_UP_TIM13_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART6_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +PA10.Mode=Asynchronous +PA10.Signal=USART1_RX +PA13.Mode=Serial_Wire +PA13.Signal=SYS_JTMS-SWDIO +PA14.Mode=Serial_Wire +PA14.Signal=SYS_JTCK-SWCLK +PA15.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PA15.GPIO_Label=SPI3_NSS +PA15.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PA15.GPIO_PuPd=GPIO_PULLUP +PA15.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA15.Locked=true +PA15.PinState=GPIO_PIN_SET +PA15.Signal=GPIO_Output +PA4.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PA4.GPIO_Label=SPI1_NSS +PA4.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PA4.GPIO_PuPd=GPIO_PULLUP +PA4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA4.Locked=true +PA4.PinState=GPIO_PIN_SET +PA4.Signal=GPIO_Output +PA6.Locked=true +PA6.Mode=Full_Duplex_Master +PA6.Signal=SPI1_MISO +PA7.Locked=true +PA7.Mode=Full_Duplex_Master +PA7.Signal=SPI1_MOSI +PA9.Mode=Asynchronous +PA9.Signal=USART1_TX +PB12.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PB12.GPIO_Label=SPI2_NSS +PB12.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PB12.GPIO_PuPd=GPIO_PULLUP +PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB12.Locked=true +PB12.PinState=GPIO_PIN_SET +PB12.Signal=GPIO_Output +PB13.Locked=true +PB13.Mode=Full_Duplex_Master +PB13.Signal=SPI2_SCK +PB14.Locked=true +PB14.Mode=Full_Duplex_Master +PB14.Signal=SPI2_MISO +PB15.Locked=true +PB15.Mode=Full_Duplex_Master +PB15.Signal=SPI2_MOSI +PB3.Locked=true +PB3.Mode=Full_Duplex_Master +PB3.Signal=SPI1_SCK +PB4.Locked=true +PB4.Mode=Full_Duplex_Master +PB4.Signal=SPI3_MISO +PB5.Locked=true +PB5.Mode=SdramChipSelect2_2 +PB5.Signal=FMC_SDCKE1 +PB6.Locked=true +PB6.Mode=SdramChipSelect2_2 +PB6.Signal=FMC_SDNE1 +PB8.Locked=true +PB8.Mode=CAN_Activate +PB8.Signal=CAN1_RX +PB9.Locked=true +PB9.Mode=CAN_Activate +PB9.Signal=CAN1_TX +PC0.Signal=FMC_SDNWE +PC10.Locked=true +PC10.Mode=Full_Duplex_Master +PC10.Signal=SPI3_SCK +PC12.Locked=true +PC12.Mode=Full_Duplex_Master +PC12.Signal=SPI3_MOSI +PC13.GPIOParameters=PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PC13.GPIO_Label=LED +PC13.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PC13.GPIO_PuPd=GPIO_PULLUP +PC13.Locked=true +PC13.PinState=GPIO_PIN_SET +PC13.Signal=GPIO_Output +PC14-OSC32_IN.GPIOParameters=PinState,GPIO_PuPd,GPIO_Label +PC14-OSC32_IN.GPIO_Label=W5500_RST +PC14-OSC32_IN.GPIO_PuPd=GPIO_PULLUP +PC14-OSC32_IN.Locked=true +PC14-OSC32_IN.PinState=GPIO_PIN_SET +PC14-OSC32_IN.Signal=GPIO_Output +PC15-OSC32_OUT.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PC15-OSC32_OUT.GPIO_Label=W5500_INT +PC15-OSC32_OUT.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING +PC15-OSC32_OUT.GPIO_PuPd=GPIO_PULLUP +PC15-OSC32_OUT.Locked=true +PC15-OSC32_OUT.Signal=GPXTI15 +PC3.Mode=SdramChipSelect1_1 +PC3.Signal=FMC_SDCKE0 +PC4.Locked=true +PC4.Mode=SdramChipSelect1_1 +PC4.Signal=FMC_SDNE0 +PC6.Mode=Asynchronous +PC6.Signal=USART6_TX +PC7.Mode=Asynchronous +PC7.Signal=USART6_RX +PC8.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PC8.GPIO_Label=USART6_EN +PC8.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP +PC8.GPIO_PuPd=GPIO_PULLDOWN +PC8.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC8.Locked=true +PC8.PinState=GPIO_PIN_RESET +PC8.Signal=GPIO_Output +PD0.Signal=FMC_D2_DA2 +PD1.Signal=FMC_D3_DA3 +PD10.Signal=FMC_D15_DA15 +PD14.Signal=FMC_D0_DA0 +PD15.Signal=FMC_D1_DA1 +PD4.Signal=FMC_NOE +PD5.Signal=FMC_NWE +PD6.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PD6.GPIO_Label=FPGA_12K_INT +PD6.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING +PD6.GPIO_PuPd=GPIO_PULLUP +PD6.Locked=true +PD6.Signal=GPXTI6 +PD7.Mode=NorPsramChipSelect1_1 +PD7.Signal=FMC_NE1 +PD8.Signal=FMC_D13_DA13 +PD9.Signal=FMC_D14_DA14 +PE0.Signal=FMC_NBL0 +PE1.Signal=FMC_NBL1 +PE10.Signal=FMC_D7_DA7 +PE11.Signal=FMC_D8_DA8 +PE12.Signal=FMC_D9_DA9 +PE13.Signal=FMC_D10_DA10 +PE14.Signal=FMC_D11_DA11 +PE15.Signal=FMC_D12_DA12 +PE7.Signal=FMC_D4_DA4 +PE8.Signal=FMC_D5_DA5 +PE9.Signal=FMC_D6_DA6 +PF0.Signal=FMC_A0 +PF1.Signal=FMC_A1 +PF11.Signal=FMC_SDNRAS +PF12.Signal=FMC_A6 +PF13.Signal=FMC_A7 +PF14.Signal=FMC_A8 +PF15.Signal=FMC_A9 +PF2.Signal=FMC_A2 +PF3.Signal=FMC_A3 +PF4.Signal=FMC_A4 +PF5.Signal=FMC_A5 +PG0.Signal=FMC_A10 +PG1.Signal=FMC_A11 +PG15.Signal=FMC_SDNCAS +PG2.Signal=FMC_A12 +PG4.Signal=FMC_A14_BA0 +PG5.Signal=FMC_A15_BA1 +PG8.Signal=FMC_SDCLK +PH0-OSC_IN.Mode=HSE-External-Clock-Source +PH0-OSC_IN.Signal=RCC_OSC_IN +PH1-OSC_OUT.Mode=HSE-External-Clock-Source +PH1-OSC_OUT.Signal=RCC_OSC_OUT +PinOutPanel.RotationAngle=270 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=6 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=true +ProjectManager.DeviceId=STM32F446ZETx +ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.25.2 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=false +ProjectManager.HeapSize=0x200 +ProjectManager.KeepUserCode=true +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=1 +ProjectManager.MainLocation=Core/Src +ProjectManager.NoMain=false +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=EMBOS.ioc +ProjectManager.ProjectName=EMBOS +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0x400 +ProjectManager.TargetToolchain=STM32CubeIDE +ProjectManager.ToolChainLocation= +ProjectManager.UnderRoot=true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-LL-true,2-SystemClock_Config-RCC-false-LL-false,3-MX_USART1_UART_Init-USART1-false-LL-true,4-MX_USART6_UART_Init-USART6-false-LL-true,5-MX_FMC_Init-FMC-false-HAL-true,6-MX_SPI1_Init-SPI1-false-LL-true,7-MX_CAN1_Init-CAN1-false-HAL-true,8-MX_SPI2_Init-SPI2-false-LL-true,9-MX_SPI3_Init-SPI3-false-LL-true,10-MX_TIM8_Init-TIM8-false-LL-true,11-MX_TIM9_Init-TIM9-false-LL-true,12-MX_TIM10_Init-TIM10-false-LL-true,13-MX_TIM11_Init-TIM11-false-LL-true,14-MX_TIM12_Init-TIM12-false-LL-true,15-MX_TIM13_Init-TIM13-false-LL-true,16-MX_TIM14_Init-TIM14-false-LL-true +RCC.AHBFreq_Value=180000000 +RCC.APB1CLKDivider=RCC_HCLK_DIV4 +RCC.APB1Freq_Value=45000000 +RCC.APB1TimFreq_Value=90000000 +RCC.APB2CLKDivider=RCC_HCLK_DIV2 +RCC.APB2Freq_Value=90000000 +RCC.APB2TimFreq_Value=180000000 +RCC.CECFreq_Value=32786.88524590164 +RCC.CortexFreq_Value=180000000 +RCC.FCLKCortexFreq_Value=180000000 +RCC.FMPI2C1Freq_Value=45000000 +RCC.FamilyName=M +RCC.HCLKFreq_Value=180000000 +RCC.HSE_VALUE=12000000 +RCC.I2S1Freq_Value=96000000 +RCC.I2S2Freq_Value=96000000 +RCC.IPParameters=AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CECFreq_Value,CortexFreq_Value,FCLKCortexFreq_Value,FMPI2C1Freq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,I2S1Freq_Value,I2S2Freq_Value,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SM,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SoutputFreq_Value,PLLM,PLLN,PLLQCLKFreq_Value,PLLRCLKFreq_Value,PLLSAIM,PLLSAIPCLKFreq_Value,PLLSAIQCLKFreq_Value,PLLSAIoutputFreq_Value,PLLSourceVirtual,PWRFreq_Value,PWR_Regulator_Voltage_Scale,SAIAFreq_Value,SAIBFreq_Value,SDIOFreq_Value,SPDIFRXFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,USBFreq_Value,VCOI2SInputFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAIInputFreq_Value,VCOSAIOutputFreq_Value +RCC.MCO2PinFreq_Value=180000000 +RCC.PLLCLKFreq_Value=180000000 +RCC.PLLI2SM=12 +RCC.PLLI2SPCLKFreq_Value=96000000 +RCC.PLLI2SQCLKFreq_Value=96000000 +RCC.PLLI2SRCLKFreq_Value=96000000 +RCC.PLLI2SoutputFreq_Value=96000000 +RCC.PLLM=12 +RCC.PLLN=360 +RCC.PLLQCLKFreq_Value=180000000 +RCC.PLLRCLKFreq_Value=180000000 +RCC.PLLSAIM=12 +RCC.PLLSAIPCLKFreq_Value=96000000 +RCC.PLLSAIQCLKFreq_Value=96000000 +RCC.PLLSAIoutputFreq_Value=96000000 +RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.PWRFreq_Value=180000000 +RCC.PWR_Regulator_Voltage_Scale=PWR_REGULATOR_VOLTAGE_SCALE1 +RCC.SAIAFreq_Value=96000000 +RCC.SAIBFreq_Value=96000000 +RCC.SDIOFreq_Value=180000000 +RCC.SPDIFRXFreq_Value=180000000 +RCC.SYSCLKFreq_VALUE=180000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLRCLK +RCC.USBFreq_Value=180000000 +RCC.VCOI2SInputFreq_Value=1000000 +RCC.VCOI2SOutputFreq_Value=192000000 +RCC.VCOInputFreq_Value=1000000 +RCC.VCOOutputFreq_Value=360000000 +RCC.VCOSAIInputFreq_Value=1000000 +RCC.VCOSAIOutputFreq_Value=192000000 +SH.FMC_A0.0=FMC_A0,13b-a1 +SH.FMC_A0.1=FMC_A0,13b-sda1 +SH.FMC_A0.2=FMC_A0,13b-sda2 +SH.FMC_A0.ConfNb=3 +SH.FMC_A1.0=FMC_A1,13b-a1 +SH.FMC_A1.1=FMC_A1,13b-sda1 +SH.FMC_A1.2=FMC_A1,13b-sda2 +SH.FMC_A1.ConfNb=3 +SH.FMC_A10.0=FMC_A10,13b-a1 +SH.FMC_A10.1=FMC_A10,13b-sda1 +SH.FMC_A10.2=FMC_A10,13b-sda2 +SH.FMC_A10.ConfNb=3 +SH.FMC_A11.0=FMC_A11,13b-a1 +SH.FMC_A11.1=FMC_A11,13b-sda1 +SH.FMC_A11.2=FMC_A11,13b-sda2 +SH.FMC_A11.ConfNb=3 +SH.FMC_A12.0=FMC_A12,13b-a1 +SH.FMC_A12.1=FMC_A12,13b-sda1 +SH.FMC_A12.2=FMC_A12,13b-sda2 +SH.FMC_A12.ConfNb=3 +SH.FMC_A14_BA0.0=FMC_BA0,FourSdramBanks1 +SH.FMC_A14_BA0.1=FMC_BA0,FourSdramBanks2 +SH.FMC_A14_BA0.ConfNb=2 +SH.FMC_A15_BA1.0=FMC_BA1,FourSdramBanks1 +SH.FMC_A15_BA1.1=FMC_BA1,FourSdramBanks2 +SH.FMC_A15_BA1.ConfNb=2 +SH.FMC_A2.0=FMC_A2,13b-a1 +SH.FMC_A2.1=FMC_A2,13b-sda1 +SH.FMC_A2.2=FMC_A2,13b-sda2 +SH.FMC_A2.ConfNb=3 +SH.FMC_A3.0=FMC_A3,13b-a1 +SH.FMC_A3.1=FMC_A3,13b-sda1 +SH.FMC_A3.2=FMC_A3,13b-sda2 +SH.FMC_A3.ConfNb=3 +SH.FMC_A4.0=FMC_A4,13b-a1 +SH.FMC_A4.1=FMC_A4,13b-sda1 +SH.FMC_A4.2=FMC_A4,13b-sda2 +SH.FMC_A4.ConfNb=3 +SH.FMC_A5.0=FMC_A5,13b-a1 +SH.FMC_A5.1=FMC_A5,13b-sda1 +SH.FMC_A5.2=FMC_A5,13b-sda2 +SH.FMC_A5.ConfNb=3 +SH.FMC_A6.0=FMC_A6,13b-a1 +SH.FMC_A6.1=FMC_A6,13b-sda1 +SH.FMC_A6.2=FMC_A6,13b-sda2 +SH.FMC_A6.ConfNb=3 +SH.FMC_A7.0=FMC_A7,13b-a1 +SH.FMC_A7.1=FMC_A7,13b-sda1 +SH.FMC_A7.2=FMC_A7,13b-sda2 +SH.FMC_A7.ConfNb=3 +SH.FMC_A8.0=FMC_A8,13b-a1 +SH.FMC_A8.1=FMC_A8,13b-sda1 +SH.FMC_A8.2=FMC_A8,13b-sda2 +SH.FMC_A8.ConfNb=3 +SH.FMC_A9.0=FMC_A9,13b-a1 +SH.FMC_A9.1=FMC_A9,13b-sda1 +SH.FMC_A9.2=FMC_A9,13b-sda2 +SH.FMC_A9.ConfNb=3 +SH.FMC_D0_DA0.0=FMC_D0,16b-d1 +SH.FMC_D0_DA0.1=FMC_D0,sd-16b-d1 +SH.FMC_D0_DA0.2=FMC_D0,sd-16b-d2 +SH.FMC_D0_DA0.ConfNb=3 +SH.FMC_D10_DA10.0=FMC_D10,16b-d1 +SH.FMC_D10_DA10.1=FMC_D10,sd-16b-d1 +SH.FMC_D10_DA10.2=FMC_D10,sd-16b-d2 +SH.FMC_D10_DA10.ConfNb=3 +SH.FMC_D11_DA11.0=FMC_D11,16b-d1 +SH.FMC_D11_DA11.1=FMC_D11,sd-16b-d1 +SH.FMC_D11_DA11.2=FMC_D11,sd-16b-d2 +SH.FMC_D11_DA11.ConfNb=3 +SH.FMC_D12_DA12.0=FMC_D12,16b-d1 +SH.FMC_D12_DA12.1=FMC_D12,sd-16b-d1 +SH.FMC_D12_DA12.2=FMC_D12,sd-16b-d2 +SH.FMC_D12_DA12.ConfNb=3 +SH.FMC_D13_DA13.0=FMC_D13,16b-d1 +SH.FMC_D13_DA13.1=FMC_D13,sd-16b-d1 +SH.FMC_D13_DA13.2=FMC_D13,sd-16b-d2 +SH.FMC_D13_DA13.ConfNb=3 +SH.FMC_D14_DA14.0=FMC_D14,16b-d1 +SH.FMC_D14_DA14.1=FMC_D14,sd-16b-d1 +SH.FMC_D14_DA14.2=FMC_D14,sd-16b-d2 +SH.FMC_D14_DA14.ConfNb=3 +SH.FMC_D15_DA15.0=FMC_D15,16b-d1 +SH.FMC_D15_DA15.1=FMC_D15,sd-16b-d1 +SH.FMC_D15_DA15.2=FMC_D15,sd-16b-d2 +SH.FMC_D15_DA15.ConfNb=3 +SH.FMC_D1_DA1.0=FMC_D1,16b-d1 +SH.FMC_D1_DA1.1=FMC_D1,sd-16b-d1 +SH.FMC_D1_DA1.2=FMC_D1,sd-16b-d2 +SH.FMC_D1_DA1.ConfNb=3 +SH.FMC_D2_DA2.0=FMC_D2,16b-d1 +SH.FMC_D2_DA2.1=FMC_D2,sd-16b-d1 +SH.FMC_D2_DA2.2=FMC_D2,sd-16b-d2 +SH.FMC_D2_DA2.ConfNb=3 +SH.FMC_D3_DA3.0=FMC_D3,16b-d1 +SH.FMC_D3_DA3.1=FMC_D3,sd-16b-d1 +SH.FMC_D3_DA3.2=FMC_D3,sd-16b-d2 +SH.FMC_D3_DA3.ConfNb=3 +SH.FMC_D4_DA4.0=FMC_D4,16b-d1 +SH.FMC_D4_DA4.1=FMC_D4,sd-16b-d1 +SH.FMC_D4_DA4.2=FMC_D4,sd-16b-d2 +SH.FMC_D4_DA4.ConfNb=3 +SH.FMC_D5_DA5.0=FMC_D5,16b-d1 +SH.FMC_D5_DA5.1=FMC_D5,sd-16b-d1 +SH.FMC_D5_DA5.2=FMC_D5,sd-16b-d2 +SH.FMC_D5_DA5.ConfNb=3 +SH.FMC_D6_DA6.0=FMC_D6,16b-d1 +SH.FMC_D6_DA6.1=FMC_D6,sd-16b-d1 +SH.FMC_D6_DA6.2=FMC_D6,sd-16b-d2 +SH.FMC_D6_DA6.ConfNb=3 +SH.FMC_D7_DA7.0=FMC_D7,16b-d1 +SH.FMC_D7_DA7.1=FMC_D7,sd-16b-d1 +SH.FMC_D7_DA7.2=FMC_D7,sd-16b-d2 +SH.FMC_D7_DA7.ConfNb=3 +SH.FMC_D8_DA8.0=FMC_D8,16b-d1 +SH.FMC_D8_DA8.1=FMC_D8,sd-16b-d1 +SH.FMC_D8_DA8.2=FMC_D8,sd-16b-d2 +SH.FMC_D8_DA8.ConfNb=3 +SH.FMC_D9_DA9.0=FMC_D9,16b-d1 +SH.FMC_D9_DA9.1=FMC_D9,sd-16b-d1 +SH.FMC_D9_DA9.2=FMC_D9,sd-16b-d2 +SH.FMC_D9_DA9.ConfNb=3 +SH.FMC_NBL0.0=FMC_NBL0,Sd2ByteEnable1 +SH.FMC_NBL0.1=FMC_NBL0,Sd2ByteEnable2 +SH.FMC_NBL0.ConfNb=2 +SH.FMC_NBL1.0=FMC_NBL1,Sd2ByteEnable1 +SH.FMC_NBL1.1=FMC_NBL1,Sd2ByteEnable2 +SH.FMC_NBL1.ConfNb=2 +SH.FMC_NOE.0=FMC_NOE,Sram1 +SH.FMC_NOE.ConfNb=1 +SH.FMC_NWE.0=FMC_NWE,Sram1 +SH.FMC_NWE.ConfNb=1 +SH.FMC_SDCLK.0=FMC_SDCLK,13b-sda1 +SH.FMC_SDCLK.1=FMC_SDCLK,13b-sda2 +SH.FMC_SDCLK.ConfNb=2 +SH.FMC_SDNCAS.0=FMC_SDNCAS,13b-sda1 +SH.FMC_SDNCAS.1=FMC_SDNCAS,13b-sda2 +SH.FMC_SDNCAS.ConfNb=2 +SH.FMC_SDNRAS.0=FMC_SDNRAS,13b-sda1 +SH.FMC_SDNRAS.1=FMC_SDNRAS,13b-sda2 +SH.FMC_SDNRAS.ConfNb=2 +SH.FMC_SDNWE.0=FMC_SDNWE,13b-sda1 +SH.FMC_SDNWE.1=FMC_SDNWE,13b-sda2 +SH.FMC_SDNWE.ConfNb=2 +SH.GPXTI15.0=GPIO_EXTI15 +SH.GPXTI15.ConfNb=1 +SH.GPXTI6.0=GPIO_EXTI6 +SH.GPXTI6.ConfNb=1 +SPI1.CalculateBaudRate=45.0 MBits/s +SPI1.Direction=SPI_DIRECTION_2LINES +SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate +SPI1.Mode=SPI_MODE_MASTER +SPI1.VirtualType=VM_MASTER +SPI2.CalculateBaudRate=22.5 MBits/s +SPI2.Direction=SPI_DIRECTION_2LINES +SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate +SPI2.Mode=SPI_MODE_MASTER +SPI2.VirtualType=VM_MASTER +SPI3.CalculateBaudRate=22.5 MBits/s +SPI3.Direction=SPI_DIRECTION_2LINES +SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate +SPI3.Mode=SPI_MODE_MASTER +SPI3.VirtualType=VM_MASTER +TIM10.IPParameters=Prescaler +TIM10.Prescaler=299 +TIM11.IPParameters=Prescaler +TIM11.Prescaler=299 +TIM12.IPParameters=Prescaler +TIM12.Prescaler=299 +TIM13.IPParameters=Prescaler +TIM13.Prescaler=299 +TIM14.IPParameters=Prescaler +TIM14.Prescaler=299 +TIM8.IPParameters=Prescaler,Period +TIM8.Period=99 +TIM8.Prescaler=179 +TIM9.IPParameters=Prescaler +TIM9.Prescaler=299 +USART1.IPParameters=VirtualMode +USART1.VirtualMode=VM_ASYNC +USART6.IPParameters=VirtualMode +USART6.VirtualMode=VM_ASYNC +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM10_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM10_VS_ClockSourceINT.Signal=TIM10_VS_ClockSourceINT +VP_TIM11_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM11_VS_ClockSourceINT.Signal=TIM11_VS_ClockSourceINT +VP_TIM12_VS_ClockSourceINT.Mode=Internal +VP_TIM12_VS_ClockSourceINT.Signal=TIM12_VS_ClockSourceINT +VP_TIM13_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM13_VS_ClockSourceINT.Signal=TIM13_VS_ClockSourceINT +VP_TIM14_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM14_VS_ClockSourceINT.Signal=TIM14_VS_ClockSourceINT +VP_TIM8_VS_ClockSourceINT.Mode=Internal +VP_TIM8_VS_ClockSourceINT.Signal=TIM8_VS_ClockSourceINT +VP_TIM9_VS_ClockSourceINT.Mode=Internal +VP_TIM9_VS_ClockSourceINT.Signal=TIM9_VS_ClockSourceINT +board=custom +isbadioc=false diff --git a/EMBOS/EMBOS.launch b/EMBOS/EMBOS.launch new file mode 100644 index 0000000..027360d --- /dev/null +++ b/EMBOS/EMBOS.launch @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EMBOS/README.md b/EMBOS/README.md new file mode 100644 index 0000000..645bfb9 --- /dev/null +++ b/EMBOS/README.md @@ -0,0 +1 @@ +EMBOS diff --git a/EMBOS/STM32F446ZETX_FLASH.ld b/EMBOS/STM32F446ZETX_FLASH.ld new file mode 100644 index 0000000..36e1e6e --- /dev/null +++ b/EMBOS/STM32F446ZETX_FLASH.ld @@ -0,0 +1,178 @@ +/** + ****************************************************************************** + * @file LinkerScript.ld + * @author Auto-generated by STM32CubeIDE + * @brief Linker script for STM32F446ZETx Device from STM32F4 series + * 512Kbytes FLASH + * 128Kbytes RAM + * + * Set heap size, stack size and stack location according + * to application requirements. + * + * Set memory bank area and size if external memory is used + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ + +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Memories definition */ +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH_B (rx) : ORIGIN = 0x8000000, LENGTH = 64K + FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 448K +} + +/* Sections */ +SECTIONS +{ + /* The startup code into "FLASH" Rom type memory */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data into "FLASH" Rom type memory */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data into "FLASH" Rom type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >FLASH + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >FLASH + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >FLASH + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >FLASH + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >FLASH + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections into "RAM" Ram type memory */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + + } >RAM AT> FLASH + + /* Uninitialized data section into "RAM" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/EMBOS/STM32F446ZETX_RAM.ld b/EMBOS/STM32F446ZETX_RAM.ld new file mode 100644 index 0000000..a986fed --- /dev/null +++ b/EMBOS/STM32F446ZETX_RAM.ld @@ -0,0 +1,177 @@ +/** + ****************************************************************************** + * @file LinkerScript.ld + * @author Auto-generated by STM32CubeIDE + * @brief Linker script for STM32F446ZETx Device from STM32F4 series + * 512Kbytes FLASH + * 128Kbytes RAM + * + * Set heap size, stack size and stack location according + * to application requirements. + * + * Set memory bank area and size if external memory is used + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ + +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Memories definition */ +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K +} + +/* Sections */ +SECTIONS +{ + /* The startup code into "RAM" Ram type memory */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >RAM + + /* The program code and other data into "RAM" Ram type memory */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >RAM + + /* Constant data into "RAM" Ram type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >RAM + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >RAM + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >RAM + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >RAM + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >RAM + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >RAM + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections into "RAM" Ram type memory */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + + } >RAM + + /* Uninitialized data section into "RAM" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/EMBOS/Users/App/apptasks.c b/EMBOS/Users/App/apptasks.c new file mode 100644 index 0000000..c0e08ba --- /dev/null +++ b/EMBOS/Users/App/apptasks.c @@ -0,0 +1,147 @@ + +#include "apptasks.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + +#include "inout.h" +#include "trigger.h" +#include "shell.h" +#include "fram.h" +#include "buttons.h" +#include "embfpga.h" +#include "extendboards.h" +#include "operator.h" +#include "paras.h" +#include "corefmc.h" +#include "workctrl.h" +#include "error.h" +#include "encrypt.h" + +void TaskPreMainLoop(void); + +void AppMainTask(void) +{ + SetDefaultOut(); + + InitTrigger(); // ʼʱ + + InitShell(); // ʼShell + + InitFram(); + + InitButtonCtrl(); // ʼť + + InitEmbFpga(); + + InitDatFiles(); // ʼļ + + InitMotos(); // ʼ + + InitExtendBoards(); // ʼCANչ߼CANϵİ忨 + + InitOperator(); // ʼ + + InitParas(); // ʼ + + printf("\r\n================== Application ==================\r\n"); + + InitCoreFmc(); + + InitWorkCtrl(); // ʼ + + TaskPreMainLoop(); // һ + + do + { + TriggerTask(); // + + ShellTask(); // + + ExtendBoardTask(); + + ButtonsTask(); + + WorkCtrlTask(); + + OperatorTask(); + +#if (0) // ѭٶ + static u32 timer = 0; + static u32 temp; + static int runcount = 0; + + runcount++; + + temp = GetMsSoftTimer(); + if (temp - timer >= 1000) + { + timer = temp; + printf("run circle = %d/s\r\n", runcount); + runcount = 0; + } +#endif + + }while(1); + +} + +void TaskPreMainLoop(void) +{ + int err; + u16 ver; + + AddTriggerToList(500, SetLedToggle, NULL); // 500ms + + SetNewParasFlag(PARA_VALID); + RefreshParas(PARA_VALID); + + RegDelayFun(DelayRef); + + CheckEncrypt(); // ..... + + do + { + TriggerTask(); + + ShellTask(); + + ExtendBoardTask(); + + OperatorTask(); + + WorkCtrlTask(); + + }while(0); + + ver = GetFpgaHardVersion(); // ȡӲ汾Ϣ + + if (((ver&0xff00)>>8) != FPGA_EMB_VER) + { + err = ERR_FPGA_HARD_ERR; + ReportError(err); + printf("fpga hard ver error\r\n"); + } + + ver = GetFpgaSoftVersion(); // ȡ汾Ϣ + + if (ver == 0) + { + err = ERR_FPGA_ERR; + ReportError(err); + printf("fpga soft ver error\r\n"); + } + + if (WaitAllButtonUp() != 0) // ȴа̧ + { + err = ERR_BUTTON_NOUP; // ȴţ̌ʱ + ReportError(err); + } + + CleanButtonTask(); // + + CheckSensorAndPos(); // ⴫λ + + printf("PreMainLoop over\r\n"); +} + +#endif diff --git a/EMBOS/Users/App/apptasks.h b/EMBOS/Users/App/apptasks.h new file mode 100644 index 0000000..eb4ba6f --- /dev/null +++ b/EMBOS/Users/App/apptasks.h @@ -0,0 +1,14 @@ + +#ifndef __APPTASKS_H__ +#define __APPTASKS_H__ + +#include "config.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + +void AppMainTask(void); + +#endif + +#endif + diff --git a/EMBOS/Users/App/user/optical/.vs/ProjectSettings.json b/EMBOS/Users/App/user/optical/.vs/ProjectSettings.json new file mode 100644 index 0000000..c6370fb --- /dev/null +++ b/EMBOS/Users/App/user/optical/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "\u65E0\u914D\u7F6E" +} \ No newline at end of file diff --git a/EMBOS/Users/App/user/optical/.vs/VSWorkspaceState.json b/EMBOS/Users/App/user/optical/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..59348ce --- /dev/null +++ b/EMBOS/Users/App/user/optical/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\optical.c", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/EMBOS/Users/App/user/optical/.vs/optical/FileContentIndex/5bbd0a1e-ffd6-4cb8-97fe-c62d673f02b6.vsidx b/EMBOS/Users/App/user/optical/.vs/optical/FileContentIndex/5bbd0a1e-ffd6-4cb8-97fe-c62d673f02b6.vsidx new file mode 100644 index 0000000..ce08e5a Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/FileContentIndex/5bbd0a1e-ffd6-4cb8-97fe-c62d673f02b6.vsidx differ diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v15/.suo b/EMBOS/Users/App/user/optical/.vs/optical/v15/.suo new file mode 100644 index 0000000..397e5d6 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/v15/.suo differ diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v15/Browse.VC.db b/EMBOS/Users/App/user/optical/.vs/optical/v15/Browse.VC.db new file mode 100644 index 0000000..137f199 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/v15/Browse.VC.db differ diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v17/.wsuo b/EMBOS/Users/App/user/optical/.vs/optical/v17/.wsuo new file mode 100644 index 0000000..bdfa3d7 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/v17/.wsuo differ diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v17/Browse.VC.db b/EMBOS/Users/App/user/optical/.vs/optical/v17/Browse.VC.db new file mode 100644 index 0000000..d2387d6 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/v17/Browse.VC.db differ diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v17/DocumentLayout.json b/EMBOS/Users/App/user/optical/.vs/optical/v17/DocumentLayout.json new file mode 100644 index 0000000..9c8830a --- /dev/null +++ b/EMBOS/Users/App/user/optical/.vs/optical/v17/DocumentLayout.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "D:\\Program\\optical\\GOAQUI(20250317)\\EMBOS\\Users\\App\\user\\optical\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Program\\optical\\GOAQUI(20250317)\\EMBOS\\Users\\App\\user\\optical\\optical.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:optical.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "optical.c", + "DocumentMoniker": "D:\\Program\\optical\\GOAQUI(20250317)\\EMBOS\\Users\\App\\user\\optical\\optical.c", + "RelativeDocumentMoniker": "optical.c", + "ToolTip": "D:\\Program\\optical\\GOAQUI(20250317)\\EMBOS\\Users\\App\\user\\optical\\optical.c", + "RelativeToolTip": "optical.c", + "ViewState": "AQIAANIhAAAAAAAAAAAqwOAhAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", + "WhenOpened": "2025-07-07T07:23:32.665Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/EMBOS/Users/App/user/optical/.vs/optical/v17/ipch/AutoPCH/23d9bb942632cbe4/OPTICAL.ipch b/EMBOS/Users/App/user/optical/.vs/optical/v17/ipch/AutoPCH/23d9bb942632cbe4/OPTICAL.ipch new file mode 100644 index 0000000..03b6604 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/optical/v17/ipch/AutoPCH/23d9bb942632cbe4/OPTICAL.ipch differ diff --git a/EMBOS/Users/App/user/optical/.vs/slnx.sqlite b/EMBOS/Users/App/user/optical/.vs/slnx.sqlite new file mode 100644 index 0000000..a897c98 Binary files /dev/null and b/EMBOS/Users/App/user/optical/.vs/slnx.sqlite differ diff --git a/EMBOS/Users/App/user/optical/optical.c b/EMBOS/Users/App/user/optical/optical.c new file mode 100644 index 0000000..53d7ac2 --- /dev/null +++ b/EMBOS/Users/App/user/optical/optical.c @@ -0,0 +1,9546 @@ +#define _IN_OPTICAL_C +#include "optical.h" + +#if (CUR_MACHINE == MACH_OPTICAL) +#include "opticalpara.h" +#include "console.h" +#include "crc16.h" +#include "modbus_m.h" + +//----------------------------------------------------------------------------------- +//ʼ +void OpticalTask(void); // +void OpticalAsyncTask(void); // 첽ִ +void OpticalTimerTask(void); // ʱִ +int StartButtonTask(void); // ʼť +int SendOpticalTask(void); // 첽ִ-Զ͹ +int sendOpticalTaskWhenRun(void); // ߹͹ + +void RefreshStatus(void); + +// +int OpticalGotoOffsetPos(void);//ȥijλ +int OpticalGotoFinishPos(void); + +int isEmptyMaterialSta(u16 len);//ϼ + +int IsSignalTimeout(u8 (* func)(void), int timeoutMs, int err); // ״źǷʱ +#define CYLINDER_TIMEOUT 5000 // ʱȴʱ +#define SIGNAL_TIMEOUT_ENABLE 1 // ȴźųʱʹ + +int toActSpinLen(int theorySpin);//˿ + +void getOptBorderWhenWork(void); + +//--------------------------------------------------------------------------------------------- + +void InitOpticalMotos(u32 delay); // ʼ +void SetOpticalZeroPosValue(s32 * list); // *listΪλֵ +void GetMvBHSpdFromLevel(MotoSpd * pSpd, int spdLev); // ֶƶٶȵȼȡֶƶٶ + + +//---------------X---------------------------- +#define XYAxisMMToPulse(mm) MM_TO_PULSE(mm) +#define XYAxisMMPSToPPS(mmps) MMPS_TO_PPS(mmps) +#define XYAxisMMPSSToPPSG(mmpss) MMPSS_TO_PPSG(mmpss) + +#define FXZ_MVMT (2000) // 2000 mm +#define FXZ_FXMV (20) // 20 mm + +#define MVXBH_MVMT (2000) // 2000 mm + +u8 MoveXLimitPosi(void); // Xλ(Ӳλλ) +u8 MoveXLimitNega(void); // Xλ(Ӳλλ) +u8 MoveXBHLimitPosi(u32 para); // Xƶλ +u8 MoveXBHLimitNega(u32 para); // Xƶλ +int MoveXBHPrec(u32 para); // Ⱦ +int MoveXBHStop(u32 para); // ֹͣ +int MoveXBHSlow(u32 para); // +int XMoveConditions(void); // Xƶж +int MoveXByHand(int dir, int spdLev); // Xֶƶ +int MoveXAsOffset(s32 ofstx, MotoSpd * pSpd); // Xƶƫ +int FindXZero(void); // X + +//---------------Y--------------- +int MoveYByHand(int dir, int spdLev); +int FindYZero(int fzdir); +u8 MoveYBHLimitPosi(u32 para); +u8 MoveYBHLimitNega(u32 para); + +//---------------XY-------------------- +int MoveXYEmcScan(u32 para1, u32 para2); +int MoveXYQStopScan(u32 para1, u32 para2); +int MoveXYNStopScan(u32 para1, u32 para2); + +//------------------------------ +int MoveU1ByHand(int dir, int mmps); +int MoveU1AsOffset(s32 ofstu1, MotoSpd * pSpd); +int MoveU1ToPos(s32 posu1, MotoSpd * pSpd); +int FindU1Zero(int fzdir); +void U1HighTest(void); +int MoveUToUpper(void); +int MoveZU1ToUpper(void); +#define MoveHeadToUpper MoveUToUpper + +//---------------ת--------------- +s16 Rot001ToPitk(s32 ang001); +int MoveR1ByHand(int dir, int dps); +int MoveR1AsOffset(s32 ofstr1, MotoSpd * pSpd); +int MoveR1ToPos(s32 posr, MotoSpd * pSpd); +int FindR1Zero(void); + +//---------------ϵ--------------- +int MoveSToPos(s32 poss, MotoSpd * pSpd); +#define MTS1_IsSpin1PulseToS1Pulse(Pulse) Pulse*10//˿ʱļ1 pulse/mmתɵ嵱10pulse/mm +#define MTS1_IsWire001PulseToS1Pulse(Pulse) Pulse/10//ʱļ100 pulse/mmתɵ嵱10pulse/mm +//---------------ϵ--------------- +int MoveMTP1AsOffset(u8 mode, int offset, int block); +#define MTP_PULSE_MM 8.488 // ÿ +#define MTP_MMS_TO_PPS(mms) (mms)*MT_PULSE_MM +#define MTP_MMSS_TO_MMSG(mmss,puls) (((((mmss)*MT_PULSE_MM)/puls) != 0)?(((mmss)*MT_PULSE_MM)/puls):1) + +int MTP_1PulseToP1Pulse(s32 Pulse);//ļ1 pulse/mmתɲ嵱 + +//---------------XYUR--------------- +void XYMotoRunTo(char * para1, char * para2); +int MoveXYToPos(s32 posx, s32 posy, MotoSpd * pSpd); +int ReadXYPos(s32 posx, s32 posy); +int MoveXYAsOffset(s32 ofstx, s32 ofsty, MotoSpd * pSpd); +int MoveXYU1R1ToPos(s32 posx, s32 posy, s32 posu1, s32 posr1, MotoSpd * pSpd); +int MoveU1AndXYToPos(s32 posu, MotoSpd * pSpd); +int MoveU1S1AsOffset(s32 ofstu, MotoSpd * pSpd); +int MoveP1S1AsOffset(s32 ofstu, MotoSpd * pSpd); +int MoveXYRS1P1ToWorkPos(DataItem * pCurDat, MotoSpd *pSpd, int rToSpinPosFlag,int s1MotoRunFlag); + +//------------------------------------------------------------ +void ProcessNewFile(void);// ļ +void XYCompenCalcuAfterTurning(DataItem datItem);//xy + +//------------------------------------------------------------ +void TestMotoRun(char * para1, char * para2); +void TestWorkRun(char * para1, char * para2); +void XMotoRunTo(char * para1, char * para2); +void YMotoRunTo(char * para1, char * para2); +void U1MotoRunTo(char * para1, char * para2); +void R1MotoRunTo(char * para1, char * para2); +void S1MotoRunTo(char * para1, char * para2); +void P1MoveAsOffset(char * para1, char * para2); + +void ShowMotoInfo(char * para1, char * para2); +void ShowFileInfo(char * para1, char * para2); +void TestPara(char * para1, char * para2); +void Simulation(char * para1, char * para2); + +void TestFile(char * para1, char * para2); +void OpttFile(char * para1, char * para2); +void Reset(char * para1, char * para2); + +//------------------------------------------------------------------------------------------------------------------------ + +s32 g_ofstr = 0; //Ƕ +s16 SP = 0; // + +//ʼ +void InitAppCallback(void) +{ + //Ʋʼ + + memset(&g_optWorkCtrl, 0, sizeof(OptWorkCtrl)); + + InitOpticalPara(); + + SetInputNameString((void*)g_opticalInputName); + SetOutputNameString((void*)g_opticalOutputName); + + g_workCtrl.WorkRunTask = OpticalTask; + g_workCtrl.AsynchronousTask = OpticalAsyncTask; + + AddTriggerToList(60, NULL, OpticalTimerTask);// 600ms + + AddButtonToList(IsStartButton, SENSOR_ON, NULL, NULL, StartButtonTask, NULL);// ť + + AddShellCmd("TESTMO", "test the moto ctrl", TestMotoRun); + AddShellCmd("RUN", "test the moto ctrl", TestWorkRun); + AddShellCmd("RMOVTO", "move r to pos", R1MotoRunTo); + AddShellCmd("MOTOINFO", "show the info", ShowMotoInfo); + AddShellCmd("RESET", "reset", Reset); + AddShellCmd("XYMOVETO", "move xy to pos", XYMotoRunTo); + AddShellCmd("FILEINFO", "ShowFileInfo", ShowFileInfo); + AddShellCmd("DEBUG", "debug", TestPara); + AddShellCmd("SIMU", "Simulation work", Simulation); + + printf("outCounter = %d \r\n",g_workCtrl.cursta.outCounter); + +#if (OPTICAL_MC_TYPE == OPTICAL_MC_WIRE) + g_workCtrl.cursta.runSteps = 0; +#endif +} + +// ⴫λ,Զ +void CheckSensorAndPos(void) +{ + InitOpticalMotos(200); + getOptBorderWhenWork(); +} + +void InitOpticalMotos(u32 delay) +{ + MotosConfig config; + + memset(&config, 0, sizeof(MotosConfig)); // + +// õ +#if(MODULE_X != 0) + config.axisConfig[MTX_IDX].axisConfig = MTX_CFG; // ʵ + config.axisConfig[MTX_IDX].poutType = MTX_OTP; // ģʽ 巽ʽ + config.axisConfig[MTX_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTX_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if(MODULE_Y != 0) + config.axisConfig[MTY_IDX].axisConfig = MTY_CFG; // ʵ + config.axisConfig[MTY_IDX].poutType = MTY_OTP; // ģʽ 巽ʽ + config.axisConfig[MTY_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTY_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if(LIFT_U1 != 0) + config.axisConfig[MTU1_IDX].axisConfig = MTU1_CFG; // ʵ + config.axisConfig[MTU1_IDX].poutType = MTU1_OTP; // ģʽ 巽ʽ + config.axisConfig[MTU1_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTU1_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if(TURN_R1 != 0) + config.axisConfig[MTR1_IDX].axisConfig = MTR1_CFG; // ʵ + config.axisConfig[MTR1_IDX].poutType = MTR1_OTP; // ģʽ 巽ʽ + config.axisConfig[MTR1_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTR1_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if(MODULE_SEND != 0) //ϵģ + config.axisConfig[MTS1_IDX].axisConfig = MTS1_CFG; // ʵ + config.axisConfig[MTS1_IDX].poutType = MTS1_OTP; // ģʽ 巽ʽ + config.axisConfig[MTS1_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTS1_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if(MODULE_PULL != 0) //ϵģ + config.axisConfig[MTP1_IDX].axisConfig = MTP1_CFG; // ʵ + config.axisConfig[MTP1_IDX].poutType = MTP1_OTP; // ģʽ 巽ʽ + config.axisConfig[MTP1_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTP1_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + + config.newConfig = 1; + + SetMotosConfig(&config); + + DelayMs(delay); +} + + +void OpticalTask(void) +{ + ProcessNewFile();// ļ +} + +void ProcessNewFile(void) +{ + if (IsNewDatFile(0) == TRUE) // ļ + { + printf("get a new file\r\n"); + + SetNewDatFlag(0, FALSE); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_EN_SCAN); // ֹɨ + printf("Reset work sta en scan4\r\n"); + + // жļǷͬһļ + if (g_datFile.pFileHead->fileHead.dataChecksum != g_workCtrl.savedpara.fileCheck || + ((g_datFile.pFileHead->fileHead.checkCrc + GetFileParaCheckCrc()) & 0xffff) != HIWORD(g_workCtrl.savedpara.fileID) || + 0 ) + { + g_workCtrl.savedpara.fileID &= 0x0000ffff; + g_workCtrl.savedpara.fileID |= ((u32)(g_datFile.pFileHead->fileHead.checkCrc + GetFileParaCheckCrc()) << 16); + + g_workCtrl.savedpara.fileCheck = g_datFile.pFileHead->fileHead.dataChecksum; + SaveWorkNvPara(); + + printf("not the same file, set idx to 0\r\n"); + SetDatIdxToStart(); + } + GetWorkPosFromIndex(); + // printf("------ProcessNewFile, fileIdx=%d\r\n", g_workCtrl.cursta.fileIdx); + + SendStatus(1); // ״̬ + } +} +void OpticalAsyncTask(void) +{ + int rslt; + rslt = ERR_NONE; + +#if (MODULE_LOOSE == 1) // ϵװ + if (((g_workCtrl.cursta.workStatus & WORK_STA_SIMULATE) == 0) && + 1 ) // ;ģ״̬ + { + rslt = SendOpticalTask(); // Զ͹ + + if(rslt != ERR_NONE) + { + ReportError(rslt); + } + + } +#endif +} + +int SendOpticalTask(void) // Զ͹ +{ + int err; + err = ERR_NONE; + + + //˴ϵλ1ֹͣ + //˴ϵλ2ʼ + if(err == ERR_NONE) + { + if ((IsOptStoringLow2() == SENSOR_ON) || + 0) + { + LooseMotorRevOn(); //ϵ ת + + //printf("LooseMotor run %d\r\n"); + //DelayRef(300); + } + else + { + if((IsOptStoringLow1() == SENSOR_ON) || + 0) + { + LooseMotorRevOff(); // ϵ ֹͣ + } + + } + } + //У˴ϵλ1ûϵתʱϵ + + + return err; +} + +// ʱִ +void OpticalTimerTask(void) +{ + SendStatus(1); // ״̬ + OperatorTaskWhenRun(0); +} + +int OpticalCloseAll(void) +{ + PreMatCylinderOff(); + IsBlowingCylinderOff(); // ջ + IsPullingCylinderOff(); // ջ + DownClipMatClipCylinderOff(); // ¼Ϲ + TrimmingCylinderOff(); // ߹ + //Fan1MotoOff(); // ֹͣ + UpClipMatClipCylinderOff(); // ϼϹ + //FixMatCylinderOff(); // ׹ + + int rslt = ERR_NONE; + + return rslt; +} +int sendOpticalTaskWhenRun(void) // ߹͹ +{ + //˴ϵλ1ֹͣ + //˴ϵλ1/2ʼ + + int err = ERR_NONE; + + if ((IsOptStoringLow2() == SENSOR_ON) || + (IsOptStoringLow1() != SENSOR_ON) || + 0) + { + LooseMotorRevOn(); //ϵ ת + + //printf("LooseMotor run %d\r\n"); + //DelayRef(300); + } + else + { + if((IsOptStoringLow1() == SENSOR_ON) || + 0) + { + LooseMotorRevOff(); // ϵ ֹͣ + } + + } + //У˴ϵλ1ûϵתʱϵ + + return err; +} +#if(MATERIAL_SCAN == 1) + +int isEmptyMaterialSta(u16 len)//ϼ +{ + if(g_pOpticalMcPara->materialFreeSwitch == 1) + { + if(g_optWorkCtrl.IsNoMaterialEn == 1) + { + // //1 + // if(IsEmptyMaterial() == SENSOR_ON) + // { + // g_optWorkCtrl.IsNoMaterialScanLen = TBDSCAN_NUM;//߼ɨλ + // g_optWorkCtrl.IsNoMaterialFlag = 2; + // } + + //2 + if((IsEmptyMaterial() == SENSOR_ON) ) + { + g_optWorkCtrl.runSteps2 = 10; + g_optWorkCtrl.IsNoMaterialScanLen -= len; + } + else if((IsEmptyMaterial() != SENSOR_ON) && (g_optWorkCtrl.runSteps2 == 10)) + { + g_optWorkCtrl.runSteps2 = 0; + g_optWorkCtrl.IsNoMaterialScanLen = g_pOpticalMcPara->materialFreeScanNum;//߼ɨλ + g_optWorkCtrl.IsNoMaterialFlag = 2; + } + + //3 + if((IsEmptyMaterial() != SENSOR_ON)) + { + g_optWorkCtrl.runSteps3 = 10; + g_optWorkCtrl.IsNoMaterialScanLen -= len; + } + else if((IsEmptyMaterial() == SENSOR_ON) && (g_optWorkCtrl.runSteps3 == 10)) + { + g_optWorkCtrl.runSteps3 = 0; + g_optWorkCtrl.IsNoMaterialScanLen = g_pOpticalMcPara->materialFreeScanNum;//߼ɨλ + g_optWorkCtrl.IsNoMaterialFlag = 2; + } + + if(g_optWorkCtrl.IsNoMaterialScanLen <= 0) + { + g_optWorkCtrl.IsNoMaterialFlag = 0; + //g_optWorkCtrl.IsNoMaterialEn = 0; + } + + if(g_optWorkCtrl.IsNoMaterialFlag <= 0) + { + ReportError(ERR_NO_MATERIAL_ERROR); + g_optWorkCtrl.opticalSta = 1;//߼ⱨ + //g_optWorkCtrl.IsNoMaterialEn = 0; + g_optWorkCtrl.IsNoMaterialFlag = 2; + return STA_NORMAL_STOP; + } + } + } + return 0; +} +#endif + +int StartButtonTask(void) +{ + printf("start button task start\r\n"); + OpticalStartWork(); + return 0; +} + +void RefreshParas(int flag) +{ + s32 zeropos[AXIS_NUM]; + + if ((flag & PARA_MC_VALID) == PARA_MC_VALID) + { + printf("\r\n\t RefreshOpticalMcParas:\r\n"); + printf("zero pos\r\n\t"); + + memset(zeropos, 0, sizeof(s32)*AXIS_NUM); + +#if(MODULE_X != 0) + zeropos[MTX_IDX] = g_pOpticalMcPara->xSensorPos; +#endif + +#if(MODULE_Y != 0) + zeropos[MTY_IDX] = g_pOpticalMcPara->ySensorPos; +#endif + +#if(LIFT_U1 != 0) + zeropos[MTU1_IDX] = g_pOpticalMcPara->u1SensorPos; +#endif +#if(TURN_R1 != 0) + zeropos[MTR1_IDX] = ROT_001DEG_TO_PULSE(g_pOpticalMcPara->r1SensorAng); +#endif +#if(MODULE_PULL != 0) + zeropos[MTS1_IDX] = g_pOpticalMcPara->xSensorPos; +#endif +#if(MODULE_SEND != 0) + zeropos[MTP1_IDX] = g_pOpticalMcPara->xSensorPos; +#endif + + SetOpticalZeroPosValue(zeropos); + + // ò + if (g_pOpticalMcPara->expectedOutput != g_workCtrl.expectedOutput) + { + g_workCtrl.expectedOutput = g_pOpticalMcPara->expectedOutput; + } + } + + if ((flag & PARA_WK_VALID) == PARA_WK_VALID) + { + printf("\r\n\t RefreshOpticalWkParas:\r\n"); + + } +} + +void SetOpticalZeroPosValue(s32 * list) +{ + int i; + s32 temp; + + if (list == NULL) + { + printf("set zero to valid\r\n"); + memset(g_workCtrl.zeroPosList, 0, sizeof(s32)*AXIS_NUM); + g_workCtrl.posEnFlag = 0; + g_workCtrl.zeroEnFlag = 0; + } + + ReadAndFreshMotosPos(); + + printf("\r\n\tset Optical zero para\r\n"); + + printf("before set, motos pos is:\r\n"); + for (i = 0; i < AXIS_NUM; i++) + { + printf("\t pos[%d]=%d\r\n", i+1, g_motosPara.motosPos[i]); + } + +#if(1) +#if(MODULE_X != 0) + SET_MOTO_ZERO(MTX); +#endif + +#if(MODULE_Y != 0) + SET_MOTO_ZERO(MTY); +#endif + +#if(LIFT_U1 != 0) + SET_MOTO_ZERO(MTU1); +#endif + +#if(TURN_R1 != 0) + SET_MOTO_ZERO(MTR1); +#endif + +#if(MODULE_PULL != 0) + SET_MOTO_ZERO(MTP1); +#endif + +#if(MODULE_SEND != 0) + SET_MOTO_ZERO(MTS1); +#endif + +#else + temp = 0x00; + if (temp == 0x00) + { + + } +#endif + + if (list != NULL) + { + memcpy(g_workCtrl.zeroPosList, list, sizeof(s32)*AXIS_NUM); + g_workCtrl.zeroEnFlag = DATA_VALID; + } + + printf("after set, motos pos is:\r\n"); + for (i = 0; i < AXIS_NUM; i++) + { + printf("\t pos[%d]=%d\r\n", i+1, g_motosPara.motosPos[i]); + } +} + +void RefreshStatus(void) +{ + memcpy((void*)(&(g_workCtrl.cursta.tempdat[0])), (void*)(&(g_motosPara.motosPos[0])), sizeof(s32)*AXIS_NUM); +} + +void DelayWhenRun (s32 tim) +{ + if ((g_workCtrl.cursta.workStatus & WORK_STA_WORKING) == WORK_STA_WORKING) + { + int dl = 0; + if (tim != 0) + { + dl = 1; + } + else + { + tim = 1; + } + + do + { + DelayRef(dl); + OperatorTaskWhenRun(0); + if (tim <= 0) + { + break; + } + tim--; + }while(1); + } + else + { + DelayRef(tim); + } +} + +#if (XY_GAP_CONVERT == 1) +// ϶ת +s32 XGapConvert(s32 offst) +{ + static int xgdir = 0; // ʷз + s32 sft = offst; + if (xgdir == 0) + { + if (offst > 0) + { + xgdir = 1; + sft = offst + g_pOpticalMcPara->xGapCorrect/2; + } + else if (offst < 0) + { + xgdir = -1; + sft = offst - g_pOpticalMcPara->xGapCorrect/2; + } + else if (offst == 0) + { + xgdir = 0; + sft = offst; + } + } + else if (xgdir > 0) + { + if (offst > 0) + { + xgdir = 1; + sft = offst; + } + else if (offst < 0) + { + xgdir = -1; + sft = offst - g_pOpticalMcPara->xGapCorrect; + } + else if (offst == 0) + { + xgdir = 0; + sft = offst - g_pOpticalMcPara->xGapCorrect/2; + } + } + else if (xgdir < 0) + { + if (offst > 0) + { + xgdir = 1; + sft = offst + g_pOpticalMcPara->xGapCorrect; + } + else if (offst < 0) + { + xgdir = -1; + sft = offst; + } + else if (offst == 0) + { + xgdir = 0; + sft = offst + g_pOpticalMcPara->xGapCorrect/2; + } + } + // printf ("xsft = %d",sft); + if(g_optWorkCtrl.disosft == 1) + { + sft = offst; + } + return sft; +} +// ϶ת +s32 YGapConvert(s32 offst) +{ + static int ygdir = 0; // ʷз + s32 sft = offst; + //printf ("dir = %d, offst = %d ",dir,offst); + + if (ygdir == 0) + { + if (offst > 0) + { + ygdir = 1; + sft = offst + g_pOpticalMcPara->yGapCorrect/2; + } + else if (offst < 0) + { + ygdir = -1; + sft = offst - g_pOpticalMcPara->yGapCorrect/2; + } + else if (offst == 0) + { + ygdir = 0; + sft = offst; + } + } + else if (ygdir > 0) + { + if (offst > 0) + { + ygdir = 1; + sft = offst; + } + else if (offst < 0) + { + ygdir = -1; + sft = offst - g_pOpticalMcPara->yGapCorrect; + } + else if (offst == 0) + { + ygdir = 0; + sft = offst - g_pOpticalMcPara->yGapCorrect/2; + } + } + else if (ygdir < 0) + { + if (offst > 0) + { + ygdir = 1; + sft = offst + g_pOpticalMcPara->yGapCorrect; + } + else if (offst < 0) + { + ygdir = -1; + sft = offst; + } + else if (offst == 0) + { + ygdir = 0; + sft = offst + g_pOpticalMcPara->yGapCorrect/2; + } + } +// printf (",ysft = %d \r\n",sft); + + return sft; +} +// XYƿ϶ +int MoveXYGap(s32 ofstx, s32 ofsty, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 xIdx; + u16 yIdx; + MotoSpd spd; + s16 dirx, diry; + + ofstx = XGapConvert(ofstx); // ϶ת + ofsty = YGapConvert(ofsty); // ϶ת + + xIdx = MTX_IDX; + ofstx = 0; + + yIdx = MTY_IDX; + ofsty = 0; + + if (ofstx == 0 && ofsty == 0) + { + return ERR_NONE; + } + + printf("MoveXYGap, x=%d,y=%d\r\n", ofstx, ofsty); + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + pSpd = &spd; + } + + if (ofstx < 0) + { + dirx = -1; + } + else if (ofstx > 0) + { + dirx = 1; + } + else + { + dirx = 0; + } + + if (ofsty < 0) + { + diry = -1; + } + else if (ofsty > 0) + { + diry = 1; + } + else + { + diry = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 1; // Ҫµ + + lmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + lmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[xIdx] = ofstx; // ˶0˶˶ȣλp + + lmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + lmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[yIdx] = ofsty; // ˶0˶˶ȣλp + + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstx) > abs(ofsty) ? abs(ofstx) : abs(ofsty); // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXYEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ(轵) + lmctrl.GetQuickStop = MoveXYQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣ(ɲٶ) + lmctrl.GetNormalStop = MoveXYNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣ(ټٶ) + lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = (((u32)diry & 0xffff) << 16 | ((u32)dirx & 0xffff)); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} +#endif +//---------------------------------------------------X-------------------------------------------- +void getOptBorderWhenWork(void) +{ + g_optBorder.xNegaBorder = g_pOpticalMcPara->xMovNegaBorder; + g_optBorder.yNegaBorder = g_pOpticalMcPara->yMovNegaBorder; + g_optBorder.xPosiBorder = g_pOpticalMcPara->xMovPosiBorder; + g_optBorder.yPosiBorder = g_pOpticalMcPara->yMovPosiBorder; + +// if(g_pOpticalMcPara->offsetX > 0) +// { +// g_optBorder.xNegaBorder -= g_pOpticalMcPara->offsetX; +// } +// else +// { +// g_optBorder.xPosiBorder -= g_pOpticalMcPara->offsetX; +// } +// +// if(g_pOpticalMcPara->offsetY > 0) +// { +// g_optBorder.yNegaBorder -= g_pOpticalMcPara->offsetY; +// } +// else +// { +// g_optBorder.yPosiBorder -= g_pOpticalMcPara->offsetY; +// } + + return; +} + +// λ +u8 MoveXLimitPosi(void) +{ + if (//(IsXLimitPosi() == SENSOR_ON) || // Ӳλ + ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD) && // X Чҹɹ + (g_motosPara.motosPos[MTX_IDX] > /*g_pOpticalMcPara->xMovPosiBorder*/g_optBorder.xPosiBorder) && // ߽ + 1 ) || // ꣬λ + 0 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// λ +u8 MoveXLimitNega(void) +{ + if (//(IsXLimitNega() == SENSOR_ON) || // Ӳλ + ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD) && // X Чҹɹ + (g_motosPara.motosPos[MTX_IDX] < /*g_pOpticalMcPara->xMovNegaBorder*/g_optBorder.xNegaBorder) && // Сڸ߽ + 1 ) || // ꣬λ + 0 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +int MoveXBHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + else + { + } + + return rslt; +} +// +int MoveXBHSlow(u32 para) +{ + int rslt; + int dir; + + dir = (int)(para); + + rslt = ERR_NONE; + if (dir != 0) + { + u32 curpps; + s32 decCount; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD) && // XλЧ + 1 ) + { + curpps = GetVAxisPPS(VAXIS_ID1); // ǰٶ + decCount = CalcDisplacement(curpps, XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd), XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd)*TOSLOWMUTI); // ԵǰٶȼٵֹͣٶҪλ + + decCount += 200*PULSE_PER_MM/100; // ֵ + + if (dir > 0) // + { + if (g_motosPara.motosPos[MTX_IDX] + decCount > g_pOpticalMcPara->xMovPosiBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + else if (dir < 0) // + { + if (g_motosPara.motosPos[MTX_IDX] - decCount < g_pOpticalMcPara->xMovNegaBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + } + } + + return rslt; +} +int MoveXByHand(int dir, int spdLev) +{ + int err; + int stspd, rspd; + MVByHandCtrl mbhc; + + assert_param(dir == 1|| dir == -1); + + err = ERR_NONE; + + err = MoveZU1ToUpper(); + + if (err != ERR_NONE) + { + ReportError(err); + return err; + } + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + mbhc.axisIdx = MTX_IDX; // ˶ + mbhc.axisCfg = MTX_CFG; // + mbhc.poutType = MTX_OTP; + mbhc.newCfg = 1; + + mbhc.movement = (s32)XYAxisMMToPulse(MVXBH_MVMT)*dir; // ƶλ +#if (XY_GAP_CONVERT == 1) + mbhc.movement = XGapConvert(mbhc.movement); // ϶ת +#endif + mbhc.ppSegment = PULSE_PER_SEGMENT; + + stspd = g_pOpticalMcPara->xymvstspSpd; + + if (spdLev <= 1) + { + rspd = g_pOpticalMcPara->xymvhSpd1; // ֶƶٶȵȼ1 + } + else if (spdLev == 2) + { + rspd = g_pOpticalMcPara->xymvhSpd2; // ֶƶٶȵȼ2 + } + else if (spdLev >= 3) + { + rspd = g_pOpticalMcPara->xymvhSpd3; // ֶƶٶȵȼ3 + } + + if (stspd > rspd) + { + stspd = rspd; + } + + mbhc.hspd.stspSpd = XYAxisMMPSToPPS(stspd); // ͣٶ + mbhc.hspd.runSpd = XYAxisMMPSToPPS(rspd); + mbhc.hspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + mbhc.hspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + + mbhc.limitpsensor = MoveXBHLimitPosi; // λ + mbhc.limitnsensor = MoveXBHLimitNega; // λ + + mbhc.precondition = NULL; // Ⱦ + mbhc.stopscan = MoveXBHStop; // ֹͣ + //mbhc.slowscan = MoveXBHSlow; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} +int MoveXBHPrec(u32 para) // Ⱦ +{ + int err; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD) && // X Чҹɹ + 1 ) + { + err = ERR_NONE; + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} +// ͣ +int MoveXEmcScan(u32 para1, u32 para2) +{ + int rslt; + s16 dirx; + + dirx = (s16)para1; + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } + + // Xλ + if (dirx > 0) + { + if (MoveXLimitPosi() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_POSI; // + } + } + else if (dirx < 0) + { + if (MoveXLimitNega() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_NEGA; // + } + } + else // if (dirx == 0) + { + rslt = ERR_NONE; + } + + return rslt; +} + +// ֹͣ +int MoveXQStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + + +// ֹͨͣ +int MoveXNStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + + ReadMotosPos(); + + if (IsConsoleCancel() != 0) //˳ + { + rslt = STA_NORMAL_STOP; + } + + return rslt; +} + +u8 MoveXBHLimitPosi(u32 para) +{ + return MoveXLimitPosi(); +} + +u8 MoveXBHLimitNega(u32 para) +{ + return MoveXLimitNega(); +} + +// xƫֵ +int MoveXAsOffset(s32 ofstx, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 xIdx; + MotoSpd spd; + s16 dirx; + +#if (XY_GAP_CONVERT == 1) + ofstx = XGapConvert(ofstx); // ϶ת +#endif + + xIdx = MTX_IDX; + + if (ofstx == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + pSpd = &spd; + } + + // + if (ofstx < 0) + { + dirx = -1; + } + else if (ofstx > 0) + { + dirx = 1; + } + else + { + dirx = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + lmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[xIdx] = ofstx; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstx); // 岹λ // GetSyntheticLength(ofstx, ofsty); // 岹λƣĺϳɳ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ +// lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = ((u32)dirx & 0xffff); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + return err; +} + +// ƶxλ +int MoveXToPos(s32 posx, MotoSpd * pSpd) +{ + int err; + s32 ofstx; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + err = ERR_NONE; + ReportError(err); + + ReadAndFreshMotosPos(); + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD) && + 1 ) + { + // Ŀλ + if (posx < g_pOpticalMcPara->xMovNegaBorder || // X߽磬λ0.01mm + posx > g_pOpticalMcPara->xMovPosiBorder || // X߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, x=%d\r\n", posx); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofstx = posx - g_motosPara.motosPos[MTX_IDX]; + +// printf("\r\n before move\r\n"); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + +// printf("\r\n move ofstx = %d, ofsty = %d\r\n", ofstx, ofsty); + + err = MoveXAsOffset(ofstx, pSpd); + +// printf("\r\n after move\r\n"); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +// X + +u8 IsXAtZero(void) +{ + u8 slow; + + slow = SENSOR_ON; + + if (IsXZeroPos() == SENSOR_ON && + slow == SENSOR_ON && + 1 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// +int XMotoMoveCheck(void) +{ + int err = ERR_NONE; + + return err; +} + +// +int FindXZero(void) +{ + int err; + MTSCtrl mtsc; + int fzdir = X_FINDZERO_DIR; + + err = ERR_NONE; + // ־ʧЧ + g_workCtrl.posEnFlag &= (~MTX_MOD); + + ReadAndFreshMotosPos(); + + memset(&mtsc, 0, sizeof(MTSCtrl)); + + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTX_IDX; // ˶ + mtsc.axisCfg = MTX_CFG; // + mtsc.poutType = MTX_OTP; + + mtsc.newCfg = 1; + + mtsc.movement = (s32)XYAxisMMToPulse(FXZ_MVMT)*fzdir; // ƶλ + + mtsc.mvposi = (s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1); // ƶλ + mtsc.lspd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); // ͣٶ + mtsc.lspd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvzSpd); // ٶ + mtsc.lspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + mtsc.lspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + + mtsc.zerosensor = IsXAtZero; // λ⴫ + mtsc.limitpsensor = MoveXLimitPosi; // λ + mtsc.limitnsensor = MoveXLimitNega; // λ + + +//#if (PLOTTER_MC_TYPE == PLOTTER_MC_SINGLE) + mtsc.emcstopscan = NULL; // ֹͣ +//#endif + mtsc.moveasoffset = MoveXAsOffset; // ƶ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = LineRunToSensorCtrl(&mtsc); + + + DelayRef(100); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + if (err == STA_MTZ_SUCCESS && IsXAtZero() == SENSOR_ON) + { + MotoSpd MoSpd; + MoSpd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); // ͣٶ + MoSpd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvzSpd); // ٶ + MoSpd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + MoSpd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + MoveXAsOffset(((s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1)), &MoSpd); + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTX_IDX; // ˶ + mtsc.axisCfg = MTX_CFG; // + mtsc.poutType = MTX_OTP; + + mtsc.newCfg = 1; + + mtsc.movement = (s32)XYAxisMMToPulse(FXZ_FXMV*2)*fzdir; // ƶλ + + mtsc.mvposi = (s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1); // ƶλ + mtsc.lspd.stspSpd = XYAxisMMPSToPPS(1); // ͣٶ + mtsc.lspd.runSpd = XYAxisMMPSToPPS(10); // ٶ + mtsc.lspd.spdAdd = XYAxisMMPSSToPPSG(10); // ߼ٶ + mtsc.lspd.brkAdd = XYAxisMMPSSToPPSG(100); // ɲٶ + + mtsc.zerosensor = IsXAtZero; // λ⴫ + mtsc.limitpsensor = MoveXLimitPosi; // λ + mtsc.limitnsensor = MoveXLimitNega; // λ + + + //#if (PLOTTER_MC_TYPE == PLOTTER_MC_SINGLE) + mtsc.emcstopscan = NULL; // ֹͣ + //#endif + mtsc.moveasoffset = MoveXAsOffset; // ƶ + err = LineRunToSensorCtrl(&mtsc); + DelayRef(100); + if (err == STA_MTZ_SUCCESS && IsXAtZero() == SENSOR_ON) + { + g_workCtrl.posEnFlag |= MTX_MOD; + printf("FindXZero success\r\n"); + err = STA_MTZ_SUCCESS; + } + else + { + g_workCtrl.posEnFlag &= (~MTX_MOD); + printf("FindXZero error, code=%d\r\n", err); + // err = ERR_MTZ_ERROR; // + } + } + else + { + g_workCtrl.posEnFlag &= (~MTX_MOD); + printf("FindXZero error, code=%d\r\n", err); +// err = ERR_MTZ_ERROR; // + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + printf("before set, MTX pos=%d, set to %d\r\n", g_motosPara.motosPos[MTX_IDX], g_workCtrl.zeroPosList[MTX_IDX]); + + g_workCtrl.zeroPosList[MTX_IDX] = g_pOpticalMcPara->xSensorPos; + SetMotoCounter(MTX_IDX, g_workCtrl.zeroPosList[MTX_IDX]); // ֵ + + ReadAndFreshMotosPos(); + + printf("after set, MTX pos=%d\r\n", g_motosPara.motosPos[MTX_IDX]); + + ReportError(err); + return err; +} + +//------------------------------------------------------------------------------------------- + + + + +//---------------------------------------------------Y-------------------------------------------- + +// ֶƶY +#define MVYBH_MVMT (3000) // 3000 mm + +// λ +u8 MoveYLimitPosi(void) +{ + if (//(IsYLimitPosi() == SENSOR_ON) || // Ӳλ + ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTY_MOD)) == (MTY_MOD) && // X Чҹɹ + (g_motosPara.motosPos[MTY_IDX] > /*g_pOpticalMcPara->yMovPosiBorder*/g_optBorder.yPosiBorder) && // ߽ + 1 ) || // ꣬λ + 0 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// λ +u8 MoveYLimitNega(void) +{ + if (//(IsYLimitNega() == SENSOR_ON) || // Ӳλ + ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTY_MOD)) == (MTY_MOD) && // Y Чҹɹ + (g_motosPara.motosPos[MTY_IDX] < /*g_pOpticalMcPara->yMovNegaBorder*/g_optBorder.yNegaBorder) && // Сڸ߽ + 1 ) || // ꣬λ + 0 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + + +u8 MoveYBHLimitPosi(u32 para) +{ + return MoveYLimitPosi(); +} + +u8 MoveYBHLimitNega(u32 para) +{ + return MoveYLimitNega(); +} + +int MoveYBHPrec(u32 para) // Ⱦ +{ + int err; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTY_MOD)) == (MTY_MOD) && // X Чҹɹ + 1 ) + { + err = ERR_NONE; + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} + +int MoveYBHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + else + { + } + + if (rslt == ERR_NONE) + { + + } + return rslt; +} +// +//int MoveYBHSlow(u32 para) // +//{ +// int rslt; +// int dir; +// +// dir = (int)(para); +// +// rslt = ERR_NONE; +// if (dir != 0) +// { +// u32 curpps; +// s32 decCount; +// +// if ((g_motosPara.enFlag == DATA_VALID) && +// (g_workCtrl.posEnFlag & (MTY_MOD)) == (MTY_MOD) && // X Чҹɹ +// 1 ) +// { +// curpps = GetVAxisPPS(VAXIS_ID1); // ǰٶ +// decCount = CalcDisplacement(curpps, XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd), XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd)*TOSLOWMUTI); // ԵǰٶȼٵֹͣٶҪλ +// +// decCount += 200; // ֵ +// +// if (dir > 0) // +// { +// if (g_motosPara.motosPos[MTY_IDX] + decCount > g_pOpticalMcPara->yMovPosiBorder) +// { +// rslt = STA_NORMAL_STOP; // ״̬ +// } +// } +// else if (dir < 0) // +// { +// if (g_motosPara.motosPos[MTY_IDX] - decCount < g_pOpticalMcPara->yMovNegaBorder) +// { +// rslt = STA_NORMAL_STOP; // ״̬ +// } +// } +// } +// } +// +// return rslt; +//} + +int MoveYByHand(int dir, int spdLev) +{ + int err; + MVByHandCtrl mbhc; + int stspd, rspd; + + assert_param(dir == 1|| dir == -1); + + err = ERR_NONE; + + err = MoveZU1ToUpper(); + + if (err != ERR_NONE) + { + ReportError(err); + return err; + } + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + mbhc.axisIdx = MTY_IDX; // ˶ + mbhc.axisCfg = MTY_CFG; // + mbhc.poutType = MTY_OTP; + mbhc.newCfg = 1; + + mbhc.movement = (s32)XYAxisMMToPulse(MVXBH_MVMT)*dir; // ƶλ +#if (XY_GAP_CONVERT == 1) + mbhc.movement = YGapConvert(mbhc.movement); // ϶ת +#endif + mbhc.ppSegment = PULSE_PER_SEGMENT; + + stspd = g_pOpticalMcPara->xymvstspSpd; + + if (spdLev <= 1) + { + rspd = g_pOpticalMcPara->xymvhSpd1; // ֶƶٶȵȼ1 + } + else if (spdLev == 2) + { + rspd = g_pOpticalMcPara->xymvhSpd2; // ֶƶٶȵȼ2 + } + else if (spdLev >= 3) + { + rspd = g_pOpticalMcPara->xymvhSpd3; // ֶƶٶȵȼ3 + } + + if (stspd > rspd) + { + stspd = rspd; + } + + mbhc.hspd.stspSpd = XYAxisMMPSToPPS(stspd); // ͣٶ + mbhc.hspd.runSpd = XYAxisMMPSToPPS(rspd); + mbhc.hspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + mbhc.hspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + + mbhc.limitpsensor = MoveYBHLimitPosi; // λ + mbhc.limitnsensor = MoveYBHLimitNega; // λ + + mbhc.precondition = MoveYBHPrec; // Ⱦ + mbhc.stopscan = MoveYBHStop; // ֹͣ + //mbhc.slowscan = MoveYBHSlow; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + ReportError(err); + return err; +} + +//------------------------------------------------------------------------------- + +// ͣ +int MoveYEmcScan(u32 para1, u32 para2) +{ + int rslt; + s16 diry; + + diry = (s16)para1; + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } + + // Yλ + if (diry > 0) + { + if (MoveYLimitPosi() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_POSI; // Yλ + } + } + else if (diry < 0) + { + if (MoveYLimitNega() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_NEGA; // Yλ + } + } + else // if (diry == 0) + { + rslt = ERR_NONE; + } + + if (rslt == ERR_NONE) + { + + } + + if (rslt != ERR_NONE) + { + return rslt; + } + return rslt; +} + +// ֹͣ +int MoveYQStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + +// ֹͨͣ +int MoveYNStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + + return rslt; +} + +// Yƫƶ +int MoveYAsOffset(s32 ofsty, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 yIdx; + MotoSpd spd; + s16 diry; +#if (XY_GAP_CONVERT == 1) + ofsty = YGapConvert(ofsty); // ϶ת +#endif + yIdx = MTY_IDX; + + if (ofsty == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + pSpd = &spd; + } + + // + if (ofsty < 0) + { + diry = -1; + } + else if (ofsty > 0) + { + diry = 1; + } + else + { + diry = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + lmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[yIdx] = ofsty; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofsty); // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveYEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveYQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveYNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ +// lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = ((u32)diry & 0xffff); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + +// printf("after move, motospos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); + + err = GetMoveResultError(rslt, lmctrl.errInfo); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + return err; +} + + +// ƶYλ +int MoveYToPos(s32 posy, MotoSpd * pSpd) +{ + int err; + s32 ofsty; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + err = ERR_NONE; + ReportError(err); + + ReadAndFreshMotosPos(); + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTY_MOD)) == (MTY_MOD) && + 1 ) + { + // Ŀλ + if (posy < g_pOpticalMcPara->yMovNegaBorder || // X߽磬λ0.01mm + posy > g_pOpticalMcPara->yMovPosiBorder || // X߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, y=%d\r\n", posy); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofsty = posy - g_motosPara.motosPos[MTY_IDX]; + +// printf("\r\n before move\r\n"); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + +// printf("\r\n move ofstx = %d, ofsty = %d\r\n", ofstx, ofsty); + + err = MoveYAsOffset(ofsty, pSpd); + +// printf("\r\n after move\r\n"); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} +//------------------------------------------------------------------------------- +// Y +u8 IsYAtZero(void) +{ + u8 slow; + + slow = SENSOR_ON; + + if (IsYZeroPos() == SENSOR_ON && + slow == SENSOR_ON && + 1 ) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// y +int YMotoMoveCheck(void) +{ + int err = ERR_NONE; + + return err; +} + +// y +int YMotoToZero() +{ + int err; + int motorun; + int fzdir = -1; + MTSCtrl mtsc; + + err = ERR_NONE; + motorun = 0; + + if (IsYZeroPos() != SENSOR_ON) + { + motorun = 1; + } + + err = YMotoMoveCheck(); //˶ǰж + + if (err == ERR_NONE) + { + if (IsYZeroPos() == SENSOR_ON) + { + err = MoveYAsOffset(1000,NULL); + motorun = 1; + } + else + { + motorun = 1; + } + } + + if (err == ERR_NONE && motorun != 0) + { + memset(&mtsc, 0, sizeof(MTSCtrl)); + + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTY_IDX; // ˶ + mtsc.axisCfg = MTY_CFG; // + mtsc.poutType = MTY_OTP; // + mtsc.newCfg = 1; // ñ־ + + mtsc.movement = (s32)XYAxisMMToPulse(FXZ_MVMT)*fzdir; // ƶλ + mtsc.lspd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); // ͣٶ + mtsc.lspd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvzSpd); // תת + if (mtsc.lspd.stspSpd > mtsc.lspd.runSpd) + { + mtsc.lspd.stspSpd = mtsc.lspd.runSpd; + } + + if (g_pOpticalMcPara->xymvSAdd == 0) + { + g_pOpticalMcPara->xymvSAdd = 1; + } + mtsc.lspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ٶ + if (mtsc.lspd.spdAdd == 0) + { + mtsc.lspd.spdAdd = 1; + } + + if (g_pOpticalMcPara->xymvbrkAdd == 0) + { + g_pOpticalMcPara->xymvbrkAdd = 1; + } + mtsc.lspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + if (mtsc.lspd.brkAdd == 0) + { + mtsc.lspd.brkAdd = 1; + } + + mtsc.zerosensor = IsYZeroPos; // λ⴫ + + mtsc.moveasoffset = MoveYAsOffset; // ƶ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = LineRunToSensorCtrl(&mtsc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + DelayRef(100); + } + + if (err == STA_MTZ_SUCCESS && IsYZeroPos() == SENSOR_ON) + { + g_workCtrl.posEnFlag |= MTY_MOD; + printf("MTY To Zero success\r\n"); + err = STA_MTZ_SUCCESS; + } + else + { + g_workCtrl.posEnFlag &= (~MTY_MOD); + printf("MTY To Zero error, code=0x%x\r\n", err); + err = ERR_MTZ_ERROR; // + } + + printf("before set, MTY pos=%d, set to %d\r\n", g_motosPara.motosPos[MTY_IDX],0); + + g_workCtrl.zeroPosList[MTY_IDX] = 0; + SetMotoCounter(MTY_IDX, g_workCtrl.zeroPosList[MTY_IDX]); // ֵ + + ReadAndFreshMotosPos(); + + printf("after set, MTY pos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); + + //ReportError(err); + return err; +} + +int FindYZero(int fzdir) +{ + int err; + MTSCtrl mtsc; + + err = ERR_NONE; + + // ־ʧЧ + g_workCtrl.posEnFlag &= (~MTY_MOD); + + ReadAndFreshMotosPos(); + + memset(&mtsc, 0, sizeof(MTSCtrl)); + + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTY_IDX; // ˶ + mtsc.axisCfg = MTY_CFG; // + mtsc.poutType = MTY_OTP; + + mtsc.newCfg = 1; + + mtsc.movement = (s32)XYAxisMMToPulse(FXZ_MVMT)*fzdir; // ƶλ + + mtsc.mvposi = (s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1); // ƶλ + mtsc.lspd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); // ͣٶ + mtsc.lspd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvzSpd); // ٶ + mtsc.lspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + mtsc.lspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + + + mtsc.zerosensor = IsYAtZero; // λ⴫ + mtsc.limitpsensor = MoveYLimitPosi; // λ + mtsc.limitnsensor = MoveYLimitNega; // λ + + mtsc.emcstopscan = NULL; // ֹͣ + mtsc.moveasoffset = MoveYAsOffset; // ƶ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = LineRunToSensorCtrl(&mtsc); + + DelayRef(100); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + + if (err == STA_MTZ_SUCCESS && IsYAtZero() == SENSOR_ON) + { + MotoSpd MoSpd; + MoSpd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); // ͣٶ + MoSpd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvzSpd); // ٶ + MoSpd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); // ߼ٶ + MoSpd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ɲٶ + MoveYAsOffset(((s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1)), &MoSpd); + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTY_IDX; // ˶ + mtsc.axisCfg = MTY_CFG; // + mtsc.poutType = MTY_OTP; + + mtsc.newCfg = 1; + + mtsc.movement = (s32)XYAxisMMToPulse(FXZ_FXMV*2)*fzdir; // ƶλ + + mtsc.mvposi = (s32)XYAxisMMToPulse(FXZ_FXMV)*fzdir*(-1); // ƶλ + mtsc.lspd.stspSpd = XYAxisMMPSToPPS(1); // ͣٶ + mtsc.lspd.runSpd = XYAxisMMPSToPPS(10); // ٶ + mtsc.lspd.spdAdd = XYAxisMMPSSToPPSG(10); // ߼ٶ + mtsc.lspd.brkAdd = XYAxisMMPSSToPPSG(100); // ɲٶ + + mtsc.zerosensor = IsYAtZero; // λ⴫ + mtsc.limitpsensor = MoveYLimitPosi; // λ + mtsc.limitnsensor = MoveYLimitNega; // λ + + mtsc.emcstopscan = NULL; // ֹͣ + mtsc.moveasoffset = MoveYAsOffset; // ƶ + + err = LineRunToSensorCtrl(&mtsc); + DelayRef(100); + if (err == STA_MTZ_SUCCESS && IsYAtZero() == SENSOR_ON) + { + g_workCtrl.posEnFlag |= MTY_MOD; + printf("FindYZero success\r\n"); + err = STA_MTZ_SUCCESS; + } + else + { + g_workCtrl.posEnFlag &= (~MTY_MOD); + printf("FindYZero error, code=%d\r\n", err); + // err = ERR_MTZ_ERROR; // + } + } + else + { + g_workCtrl.posEnFlag &= (~MTY_MOD); + printf("FindYZero error, code=%d\r\n", err); +// err = ERR_MTZ_ERROR; // + } + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + printf("before set, MTYpos=%d, set to %d\r\n", g_motosPara.motosPos[MTY_IDX], g_workCtrl.zeroPosList[MTY_IDX]); + + g_workCtrl.zeroPosList[MTY_IDX] = g_pOpticalMcPara->ySensorPos; + SetMotoCounter(MTY_IDX, g_workCtrl.zeroPosList[MTY_IDX]); // ֵ + + ReadAndFreshMotosPos(); + + printf("after set, MTY pos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + ReportError(err); + return err; +} + + +void ConfigToYMoto(void) +{ + MotosConfig config; + + memset(&config, 0, sizeof(MotosConfig)); + config.newConfig = 1; + config.axisConfig[MTY_IDX].axisConfig = MTY_CFG; // ʵ + config.axisConfig[MTY_IDX].poutType = MTY_OTP; // ģʽ 巽ʽ + config.axisConfig[MTY_IDX].spdSource = MAKE_POUT_CMD(VAXIS_ID1); // ʵٶȿģʽ(123) + config.axisConfig[MTY_IDX].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + + SetMotosConfig(&config); + + DelayRef(100); +} + + + +//------------------------------------------------------------------------------- + +// XY ͬ +#if (MODULE_X != 0 && MODULE_Y != 0) + +// õϳ᳤ +u32 GetSyntheticLength(s32 x, s32 y) +{ + double t1, t2; + + t1 = x; + t1 *= x; + + t2 = y; + t2 *= y; + + return (u32)(sqrt(t1+t2)+0.5); +} + +// ͣ +int MoveXYEmcScan(u32 para1, u32 para2) +{ + int rslt; + s16 dirx, diry; + + dirx = (s16)para1; + diry = (s16)(para1>>16); + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } + + // Xλ + if (dirx > 0) + { + if (MoveXLimitPosi() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_POSI; + } + } + else if (dirx < 0) + { + if (MoveXLimitNega() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_NEGA; + } + } + else // if (dirx == 0) + { + rslt = ERR_NONE; + } + + if (rslt != ERR_NONE) + { + return rslt; + } + + // Yλ + if (diry > 0) + { + if (MoveYLimitPosi() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_POSI; // Yλ + } + } + else if (diry < 0) + { + if (MoveYLimitNega() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_NEGA; // Yλ + } + } + else // if (diry == 0) + { + rslt = ERR_NONE; + } + + return rslt; + } + +// ֹͣ +int MoveXYQStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + + +// ֹͨͣ +int MoveXYNStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + +// rslt = IsStopConditionWhenCutting(); + return rslt; +} + +//------------------------------------------------------------------------------- +// XY ƶƫֵ +int MoveXYAsOffset(s32 ofstx, s32 ofsty, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 xIdx, yIdx; + MotoSpd spd; + s16 dirx, diry; +#if (XY_GAP_CONVERT == 1) + ofstx = XGapConvert(ofstx); // ϶ת + ofsty = YGapConvert(ofsty); // ϶ת +#endif + + xIdx = MTX_IDX; + yIdx = MTY_IDX; + + if (ofstx == 0 && ofsty == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + pSpd = &spd; + } + + if (ofstx < 0) + { + dirx = -1; + } + else if (ofstx > 0) + { + dirx = 1; + } + else + { + dirx = 0; + } + + if (ofsty < 0) + { + diry = -1; + } + else if (ofsty > 0) + { + diry = 1; + } + else + { + diry = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + lmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[xIdx] = ofstx; // ˶0˶˶ȣλp + + lmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + lmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[yIdx] = ofsty; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstx) > abs(ofsty) ? abs(ofstx) : abs(ofsty); // 岹λ // GetSyntheticLength(ofstx, ofsty); // 岹λƣĺϳɳ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXYEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXYQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXYNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + //lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = (((u32)diry & 0xffff) << 16 | ((u32)dirx & 0xffff)); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + return err; +} + +// ƶxyλ +int MoveXYToPos(s32 posx, s32 posy, MotoSpd * pSpd) +{ + int err; + s32 ofstx, ofsty; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + err = ERR_NONE; + ReportError(err); + + ReadAndFreshMotosPos(); + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTX_MOD|MTY_MOD)) == (MTX_MOD|MTY_MOD) && + 1 ) + { + // Ŀλ + if (posx < g_pOpticalMcPara->xMovNegaBorder || // X߽磬λ0.01mm + posx > g_pOpticalMcPara->xMovPosiBorder || // X߽磬λ0.01mm + posy < g_pOpticalMcPara->yMovNegaBorder || // Y߽磬λ0.01mm + posy > g_pOpticalMcPara->yMovPosiBorder || // Y߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, x=%d, y=%d\r\n", posx, posy); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofstx = posx - g_motosPara.motosPos[MTX_IDX]; + ofsty = posy - g_motosPara.motosPos[MTY_IDX]; + + printf("\r\n before move\r\n"); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + +// printf("\r\n move ofstx = %d, ofsty = %d\r\n", ofstx, ofsty); +#if (MODULE_X != 0) + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTX_IDX]); +#endif + +#if (MODULE_Y != 0) + printf("\typos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); +#endif + + +#if(LIFT_U1 != 0) + printf("\tu1pos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); +#endif + + err = MoveXYAsOffset(ofstx, ofsty, pSpd); + + printf("\r\n after move\r\n"); +#if (MODULE_X != 0) + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTX_IDX]); +#endif + +#if (MODULE_Y != 0) + printf("\typos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); +#endif + + +#if(LIFT_U1 != 0) + printf("\tu1pos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); +#endif + +#if (TURN_R1 != 0) + printf("\trpos=%d\r\n", g_motosPara.motosPos[MTR1_IDX]); +#endif + +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +int FindXYZero(void) +{ + int err; +#if (1) + // xy ֱ + err = FindXZero(); + if ((err == STA_MTZ_SUCCESS) && + (IsXAtZero() == SENSOR_ON) && + (g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTX_MOD)) == (MTX_MOD)) && + 1 ) + { + err = FindYZero(-1); + } +#else + +#endif + return err; +} + +//------------------------------------------------------------------------------------------- + +//---------------------------------------------------U1-------------------------------------------- +#define UAxisMMToPulse(mm) MM_TO_PULSE(mm) +#define UAxisMMPSToPPS(mmps) MMPS_TO_PPS(mmps) +#define UAxisMMPSSToPPSG(mmpss) MMPSS_TO_PPSG(mmpss) + +// ֶƶ U1 + +#define MVU1BH_MVMT (300) // 300 mm + +// λ +u8 MoveU1BHLimitPosi(u32 para) +{ + // ꣬λ + if (g_motosPara.motosPos[MTU1_IDX] > g_pOpticalMcPara->rkLiftUper) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// λ +u8 MoveU1BHLimitNega(u32 para) +{ + // ꣬λ + if (g_motosPara.motosPos[MTU1_IDX] < g_pOpticalMcPara->rkLiftLower) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +int MoveU1BHPrec(u32 para) // Ⱦ +{ + int err; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD) && // U1 Чҹɹ + 1 ) + { + err = ERR_NONE; + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} + +int MoveU1BHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + + return rslt; +} + +int MoveU1ByHand(int dir, int mmps) +{ + int err; + MVByHandCtrl mbhc; + int stspd; + + assert_param(dir == 1|| dir == -1); + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + mbhc.axisIdx = MTU1_IDX; // ˶ + mbhc.axisCfg = MTU1_CFG; // + mbhc.poutType = MTU1_OTP; + mbhc.newCfg = 0; + + mbhc.movement = (s32)UAxisMMToPulse(MVU1BH_MVMT)*dir; // ƶλ + mbhc.ppSegment = PULSE_PER_SEGMENT; + + stspd = g_pOpticalMcPara->ustspSpd; + if (stspd > mmps) + { + stspd = mmps; + } + mbhc.hspd.stspSpd = UAxisMMPSToPPS(stspd); // ͣٶ + mbhc.hspd.runSpd = UAxisMMPSToPPS(mmps); // ֶƶٶ + mbhc.hspd.spdAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); // ߼ٶ + mbhc.hspd.brkAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); // ɲٶ + + mbhc.limitpsensor = MoveU1BHLimitPosi; // λ + mbhc.limitnsensor = MoveU1BHLimitNega; // λ + + mbhc.precondition = MoveU1BHPrec; // Ⱦ + mbhc.stopscan = MoveU1BHStop; // ֹͣ +// mbhc.slowscan = NULL; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +//------------------------------------------------------------------------------- + +// ͣ +int MoveU1EmcScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } + + return rslt; +} + + +// ֹͣ +int MoveU1QStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} +// ֹͨͣ +int MoveU1NStopScan(u32 para1, u32 para2) +{ + int rslt; + + if ( IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + rslt = STA_NORMAL_STOP; + return rslt; + } + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + + return rslt; +} +// ֹͨͣ +int MoveS1P1NStopScan(u32 para1, u32 para2) +{ + int rslt; + + if ( IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + rslt = STA_NORMAL_STOP; + return rslt; + } + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif +#if(MATERIAL_SCAN == 1) + rslt = isEmptyMaterialSta(g_pOpticalMcPara->xymvlSpd/10);//ɨڰ10ms +// rslt = IsStopConditionWhenCutting(); +#endif + return rslt; +} + +// U1ƫƶ +int MoveU1AsOffset(s32 ofstu, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 pIdx; + MotoSpd spd; + + pIdx = MTU1_IDX; + + if (ofstu == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); + spd.runSpd = UAxisMMPSToPPS(g_pOpticalMcPara->umoveSpd); + spd.spdAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); + spd.brkAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); + pSpd = &spd; + } + +// printf("MoveU1AsOffset, ofstu=%d, spd=%d\r\n", ofstu, pSpd->runSpd); +// printf("before move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[pIdx].axisConfig = MTU1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[pIdx].poutType = MTU1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[pIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[pIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[pIdx] = ofstu; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstu); // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetEmergencyStop = MoveU1EmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveU1QStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveU1NStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ +// lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = 0; + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + +// printf("after move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} + +//------------------------------------------------------------------------------- +// U1 + +#define FU1Z_MVMT (100) // 100 mm +#define FU1Z_FXMV (10) // 10 mm + +u8 IsU1AtZeroPos(void) +{// U1˲ + static s32 count = 0; + + if ((g_workCtrl.cursta.workStatus & WORK_STA_BUSY) == 0) + { + count = 0; + } + if (IsU1ZeroPos() == SENSOR_ON) + { + if (count < 50) + { + count++; + } + } + else + { + if (count > -50) + { + count--; + } + } + + if (count > 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +int FindU1Zero(int fzdir) +{ + int err; + MTSCtrl mtsc; + + // ־ʧЧ + g_workCtrl.posEnFlag &= (~MTU1_MOD); + + ReadAndFreshMotosPos(); + + memset(&mtsc, 0, sizeof(MTSCtrl)); + + mtsc.vAxisId = VAXIS_ID1; // + mtsc.axisIdx = MTU1_IDX; // ˶ + mtsc.axisCfg = MTU1_CFG; // + mtsc.poutType = MTU1_OTP; + + mtsc.newCfg = 0; + + mtsc.movement = (s32)UAxisMMToPulse(FU1Z_MVMT)*fzdir; // ƶλ + mtsc.mvposi = (s32)UAxisMMToPulse(FU1Z_FXMV)*fzdir*(-1); // ƶλ + + mtsc.lspd.stspSpd = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); // ͣٶ + mtsc.lspd.runSpd = UAxisMMPSToPPS(g_pOpticalMcPara->umvtzSpd); // ٶ + mtsc.lspd.spdAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); // ߼ٶ + mtsc.lspd.brkAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); // ɲٶ + + mtsc.slowsensor = NULL; // ټ⴫ + mtsc.zerosensor = IsU1ZeroPos; // λ⴫ + + mtsc.limitpsensor = NULL; // λ + mtsc.limitnsensor = NULL; // λ + + mtsc.emcstopscan = NULL; // ֹͣ + mtsc.moveasoffset = MoveU1AsOffset; // ƶ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = LineRunToSensorCtrl(&mtsc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + DelayRef(100); + + if (err == STA_MTZ_SUCCESS && IsU1ZeroPos() == SENSOR_ON) + { + g_workCtrl.posEnFlag |= MTU1_MOD; + printf("FindU1Zero success\r\n"); + err = STA_MTZ_SUCCESS; + } + else + { + g_workCtrl.posEnFlag &= (~MTU1_MOD); + printf("FindU1Zero error, code=%d\r\n", err); + err = ERR_MTZ_ERROR; // + } + + printf("FindU1Zero, before set, MTU1 pos=%d, set to %d\r\n", g_motosPara.motosPos[MTU1_IDX], g_workCtrl.zeroPosList[MTU1_IDX]); + + g_workCtrl.zeroPosList[MTU1_IDX] = g_pOpticalMcPara->u1SensorPos; + SetMotoCounter(MTU1_IDX, g_workCtrl.zeroPosList[MTU1_IDX]); // ֵ + ReadAndFreshMotosPos(); + + printf("FindU1Zero, after set, MTU1 pos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + ReportError(err); + + return err; +} + +//------------------------------------------------------------------------------- + +// ƶU1λ +int MoveU1ToPos(s32 posu, MotoSpd * pSpd) +{ + int err; + s32 ofstu; + + err = ERR_NONE; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD) && + 1 ) + { + // Ŀλ + if (0 || + posu < g_pOpticalMcPara->rkLiftLower || // ͷ±߽磬λ0.01mm + posu > g_pOpticalMcPara->rkLiftUper || // ͷϱ߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, u1=%d, posu1=%d\r\n", g_motosPara.motosPos[MTU1_IDX], posu); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofstu = posu - g_motosPara.motosPos[MTU1_IDX]; + + // printf("\r\n before move\r\n"); + // printf("actpos: x=%d, p=%d\r\n", g_motosPara.motosPos[MTU1_IDX], g_motosPara.motosPos[MTU1_IDX]); + + // printf("\r\n move ofstx = %d, ofsty = %d\r\n", 0, ofstu); + + if (ofstu != 0) + { + err = MoveU1AsOffset(ofstu, pSpd); + } + + // printf("\r\n after move\r\n"); + // printf("actpos: x=%d, p=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTP_IDX]); + + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + ReportError(err); + return err; +} +// ƶU1λ(̧,̧ʱϼɿ) +int MoveTU1ToPos(s32 posu, MotoSpd * pSpd) +{ + int err; + s32 ofstu; + + err = ERR_NONE; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + UpClipMatClipCylinderOff(); // ϼϹ + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD) && + 1 ) + { + // Ŀλ + if (0 || + posu < g_pOpticalMcPara->rkLiftLower || // ͷ±߽磬λ0.01mm + posu > g_pOpticalMcPara->rkLiftUper || // ͷϱ߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, u1=%d, posu1=%d\r\n", g_motosPara.motosPos[MTU1_IDX], posu); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofstu = posu - g_motosPara.motosPos[MTU1_IDX]; + + // printf("\r\n before move\r\n"); + // printf("actpos: x=%d, p=%d\r\n", g_motosPara.motosPos[MTU1_IDX], g_motosPara.motosPos[MTU1_IDX]); + + // printf("\r\n move ofstx = %d, ofsty = %d\r\n", 0, ofstu); + + if (ofstu != 0) + { + err = MoveU1AsOffset(ofstu, pSpd); + } + + // printf("\r\n after move\r\n"); + // printf("actpos: x=%d, p=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTP_IDX]); + + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + UpClipMatClipCylinderOn(); // ϼϼн + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + ReportError(err); + return err; +} + +// U1 +int MoveU1ToLower(void) +{ + int rslt; + rslt = ERR_NONE; + if (!(1 && + (g_workCtrl.paraEnFlag == PARA_VALID) && + (g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 )) + { + rslt = FindU1Zero(1); + } + + if ((rslt == STA_MTZ_SUCCESS || rslt == ERR_NONE) && + (g_workCtrl.paraEnFlag == PARA_VALID) && + (g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 ) + { + rslt = MoveU1ToPos(g_pOpticalMcPara->rkLowPos, NULL); // ҵλ߶ + } + else + { + rslt = ERR_HEAD_NOT_LOW; + } + + return rslt; +} + +// ̧U1 +int MoveU1ToUpper(s32 adj) +{ + int rslt; + rslt = ERR_NONE; + + if (!(1 && + (g_workCtrl.paraEnFlag == PARA_VALID) && + (g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 )) + { + rslt = FindU1Zero(1); + } + + if ((rslt == STA_MTZ_SUCCESS || rslt == ERR_NONE)) + { + if (g_workCtrl.paraEnFlag == PARA_VALID) + { + if((g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 ) + { + rslt = MoveTU1ToPos(g_pOpticalMcPara->rkHighPos+adj, NULL); // ҵλ߶ + + } + else + { + rslt = ERR_HEAD_NOT_HIGH; // ͷڸλ + } + } + else + { + rslt = ERR_MC_PARA; // + } + } + return rslt; +} + +// ̧U1(ʱϼϲɿ) +int MoveZU1ToUpper(void) +{ + int rslt; + rslt = ERR_NONE; + + if (!(1 && + (g_workCtrl.paraEnFlag == PARA_VALID) && + (g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 )) + { + rslt = FindU1Zero(1); + } + + if ((rslt == STA_MTZ_SUCCESS || rslt == ERR_NONE)) + { + if (g_workCtrl.paraEnFlag == PARA_VALID) + { + if((g_motosPara.enFlag == DATA_VALID) && + ((g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD)) && + 1 ) + { + rslt = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL); // ҵλ߶ + + } + else + { + rslt = ERR_HEAD_NOT_HIGH; // ͷڸλ + } + } + else + { + rslt = ERR_MC_PARA; // + } + } + return rslt; +} + +// +int MoveUToUpper(void) +{ + int err; + + err = ERR_NONE; +#if (LIFT_U1 != 0) + if (err == ERR_NONE) + { + err = MoveU1ToUpper(0); // ̧ҵ + } +#endif + return err; +} +//------------------------------------------------------------------------------------------- + + + + +//---------------------------------------------------R1-------------------------------------------- +#define RAxisMMToPulse(mm) MM_TO_PULSE(mm) +#define RAxisMMPSToPPS(mmps) MMPS_TO_PPS(mmps) +#define RAxisMMPSSToPPSG(mmpss) MMPSS_TO_PPSG(mmpss) + +// ٶ +#define MIN_R1_DPS 1 +#define MAX_R1_DPS (10*ROT_PULSE_PER_CIRCLE) // ٶ, 10 Ȧ/ + +#define MVR1BH_MVMT 10000 // λ 10000 Ȧ + +u8 IsR1AtZeroPos(void) +{// R1˲ + static s32 count = 0; + + if ((g_workCtrl.cursta.workStatus & WORK_STA_BUSY) == 0) + { + count = -1000; + } + + if (IsR1ZeroPos() == SENSOR_ON) + { + if (count < 1000) + { + count++; + } + } + else + { + if (count > -1000) + { + count--; + } + } + + if (count > 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +u8 GetR1ZeroPosRst(void) +{// R1˲ +// return IsR1AtZeroPos(1); + + static s32 count = 0; + + if (IsR1ZeroPos() == SENSOR_ON) + { + if (count < 5000) + { + count++; + } + } + else + { + if (count > -5000) + { + count--; + } + } + + if (count > 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +// ת +int FindR1Zero(void) +{ + int err; + RSenserCheck rpck; + + // ־ʧЧ + g_workCtrl.posEnFlag &= (~MTR1_MOD); + err = ERR_NONE; + +#if(LIFT_U1 != 0) + err = MoveZU1ToUpper(); // ̧ҵ +#endif + if (err != ERR_NONE) + { + ReportError(err); + return err; + } + + ReadAndFreshMotosPos(); + + memset(&rpck, 0, sizeof(RSenserCheck)); + + rpck.vAxisId = VAXIS_ID1; // + rpck.axisIdx = MTR1_IDX; // ˶ + rpck.axisCfg = MTR1_CFG; // + rpck.axisOtp = MTR1_OTP; // + rpck.newCfg = 1; // ñ־ + + rpck.circleNum = ROT_PULSE_PER_CIRCLE; // Ȧ + rpck.rspd.stspSpd = DPS_TO_PPS(g_pOpticalMcPara->rotstspDps); + rpck.rspd.runSpd = DPS_TO_PPS(g_pOpticalMcPara->rottzDps); + rpck.rspd.spdAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotAddDpss); + rpck.rspd.brkAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotBrkDpss); + + rpck.zeroflag = 0; // Ѿλñ־ + rpck.cansflag = 0; // ־ + rpck.canscount = 0; // λ + + rpck.sensorscan = IsR1ZeroPos; // תλ + rpck.val = SENSOR_ON; + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = RoundRunToSensor(&rpck); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + DelayRef(100); + + if (err == STA_NORMAL_STOP && rpck.sensorscan() == rpck.val) + { + g_workCtrl.posEnFlag |= MTR1_MOD; + + printf("FindR1Zero success\r\n"); + err = STA_MTZ_SUCCESS; + } + else + { + g_workCtrl.posEnFlag &= (~MTR1_MOD); + + printf("FindR1Zero error, code=%d\r\n", err); +// err = ERR_MTZ_ERROR; // + } + + if ((err == STA_MTZ_SUCCESS) && + ((g_workCtrl.posEnFlag & (MTR1_MOD)) == (MTR1_MOD)) && + (IsR1ZeroPos() == SENSOR_ON) && + 1 ) + { + printf("before set, MTR1 pos=%d, set to %d\r\n", g_motosPara.motosPos[MTR1_IDX], g_workCtrl.zeroPosList[MTR1_IDX]); + + g_workCtrl.zeroPosList[MTR1_IDX] = ROT_001DEG_TO_PULSE(g_pOpticalMcPara->r1SensorAng); + SetMotoCounter(MTR1_IDX, g_workCtrl.zeroPosList[MTR1_IDX]); // ֵ + ReadAndFreshMotosPos(); + + printf("after set, MTR1 pos=%d\r\n", g_motosPara.motosPos[MTR1_IDX]); + + MoveR1ToPos(2500, NULL);//ת90 + } + else + { + g_workCtrl.posEnFlag &= (~MTR1_MOD); + } + + ReportError(err); + return err; +} + +//-------------------------------- + +int MoveR1BHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + + return rslt; +} + +//-------------------------------- + +// dir == 1 +// dir == -1, + +// dps ٶȣλ / + +int MoveR1ByHand(int dir, int dps) +{ + int err; + int stdps; + MVByHandCtrl mbhc; + + assert_param(dir == 1|| dir == -1); + + if (dps < MIN_R1_DPS) + { + dps = MIN_R1_DPS; + } + else if (dps > MAX_R1_DPS) + { + dps = MAX_R1_DPS; + } + + err = ERR_NONE; + +#if (1) + +#if(LIFT_U1 != 0) + err = MoveU1ToUpper(0); // ̧ҵ +#endif + + if (err != ERR_NONE) + { + ReportError(err); + return err; + } +#endif + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + + mbhc.axisIdx = MTR1_IDX; // ˶ + mbhc.axisCfg = MTR1_CFG; // + mbhc.poutType = MTR1_OTP; // + mbhc.newCfg = 1; + + mbhc.movement = MVR1BH_MVMT * ROT_PULSE_PER_CIRCLE; // ƶλ + mbhc.movement *= dir; + mbhc.ppSegment = ROT_PULSE_PER_CIRCLE; + + stdps = g_pOpticalMcPara->rotstspDps; + if (stdps > dps) + { + stdps = dps; + } + + mbhc.hspd.stspSpd = DPS_TO_PPS(stdps); // ͣٶ + mbhc.hspd.runSpd = DPS_TO_PPS(dps); // תٶ + mbhc.hspd.spdAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotAddDpss); // ߼ٶ + mbhc.hspd.brkAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotBrkDpss); // ɲٶ + + mbhc.limitpsensor = NULL; // λ + mbhc.limitnsensor = NULL; // λ + + mbhc.precondition = NULL; // Ⱦ + mbhc.stopscan = MoveR1BHStop; // ֹͣ + //mbhc.slowscan = NULL; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +// ƶ +int MoveR1AsOffset(s32 ofstr, MotoSpd * pSpd) +{ + int err, i; + RMotoRun rmr; + MotoSpd rspd; // ٶ + + if (ofstr == 0) + { + return ERR_NONE; + } + + err = ERR_NONE; + + memset(&rmr, 0, sizeof(RMotoRun)); + + rmr.vAxisId = VAXIS_ID1; // + rmr.mrepeat = 0; // ظ + rmr.interLong = abs(ofstr); // λ + rmr.stopmode = 0; // ֹͣģʽ + + rmr.newCfg = 0; // Ҫ + + rmr.config[0].axisIdx = MTR1_IDX; // + rmr.config[0].axisCfg = MTR1_CFG; // + rmr.config[0].movement = ofstr; // ˶ + rmr.escStop = 0; + rmr.segmentNum = ROT_PULSE_PER_CIRCLE; + + for (i = 1; i < AXIS_NUM; i++) + { + rmr.config[i].axisIdx = -1; + } + + if (pSpd == NULL) + { + rspd.stspSpd = DPS_TO_PPS(g_pOpticalMcPara->rotstspDps); // ͣٶ + rspd.runSpd = DPS_TO_PPS(g_pOpticalMcPara->rotrunDps); // תת + rspd.spdAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotAddDpss); // ٶ + rspd.brkAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotBrkDpss); // ɲٶ + + memcpy(&rmr.rspd, &rspd, sizeof(MotoSpd)); // ٶ + } + else + { + memcpy(&rmr.rspd, pSpd, sizeof(MotoSpd)); // ٶ + } + + err = RoundRunAsOffset(&rmr); + return err; +} + +int MoveR1ToPos(s32 posr, MotoSpd * pSpd) +{ + int err; + s32 ofstr, abposr; + + g_workCtrl.sendStaWhenRun = 0; + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + err = ERR_NONE; + ReportError(err); + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTR1_MOD)) == (MTR1_MOD) && + 1 ) + { + // õһȦڵλ + ReadAndFreshMotosPos(); + // תΪ -180--180֮ + + + abposr = g_motosPara.motosPos[MTR1_IDX]; + ofstr = posr - abposr; + ChangeRotToNP180(&ofstr); + err = MoveR1AsOffset(ofstr, NULL); + +#if (0) // þλ + abposr = g_motosPara.motosPos[MTR1_IDX]; + + ChangeRotToNP360(&abposr); + + if (abposr != g_motosPara.motosPos[MTR1_IDX]) // ü + { + SetMotoCounter(MTR1_IDX, abposr); // ֵ + ReadAndFreshMotosPos(); + } +#endif + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + ReportError(err); + return err; +} +//------------------------------------------------------------------------------------------- +//---------------------------------------------------S1-------------------------------------------- + +// ֶƶL + +#define MVSBH_MVMT (3000) // 3000 mm + + +int MoveSBHPrec(u32 para) // Ⱦ +{ + int err; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTS1_IDX)) == (MTS1_IDX) && //L Чҹɹ + 1 ) + { + err = ERR_NONE; + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} + +int MoveSBHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + else + { + } + + if (rslt == ERR_NONE) + { + } + return rslt; +} + +int MoveSBHSlow(u32 para) // +{ + int rslt; + int dir; + + dir = (int)(para); + + rslt = ERR_NONE; + if (dir != 0) + { + u32 curpps; + s32 decCount; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTS1_IDX)) == (MTS1_IDX) && //L Чҹɹ + 1 ) + { + curpps = GetVAxisPPS(VAXIS_ID1); // ǰٶ + decCount = CalcDisplacement(curpps, XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd), XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd)*TOSLOWMUTI); // ԵǰٶȼٵֹͣٶҪλ + + decCount += 200; // ֵ + + if (dir > 0) // + { + if (g_motosPara.motosPos[MTS1_IDX] + decCount >g_pOpticalMcPara->xMovPosiBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + else if (dir < 0) // + { + if (g_motosPara.motosPos[MTS1_IDX] - decCount xMovNegaBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + } + } + + return rslt; +} + +int MoveSByHand(int dir, int spdLev) +{ + int err; + int stspd, rspd; + MVByHandCtrl mbhc; + + assert_param(dir == 1|| dir == -1); + + err = ERR_NONE; + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + mbhc.axisIdx = MTS1_IDX; // ˶ + mbhc.axisCfg = MTS1_CFG; // + mbhc.poutType = MTS1_OTP; + mbhc.newCfg = 1; + + mbhc.movement = (s32)XYAxisMMToPulse(MVSBH_MVMT)*dir; // ƶλ + mbhc.ppSegment = PULSE_PER_SEGMENT; + + stspd =g_pOpticalMcPara->lmvstspSpd; + + if (spdLev <= 1) + { + rspd =g_pOpticalMcPara->lmvhSpd1; // ֶƶٶȵȼ1 + } + else if (spdLev == 2) + { + rspd =g_pOpticalMcPara->lmvhSpd2; // ֶƶٶȵȼ2 + } + else if (spdLev >= 3) + { + rspd =g_pOpticalMcPara->lmvhSpd3; // ֶƶٶȵȼ3 + } + + if (stspd > rspd) + { + stspd = rspd; + } + + mbhc.hspd.stspSpd = XYAxisMMPSToPPS(stspd); // ͣٶ + mbhc.hspd.runSpd = XYAxisMMPSToPPS(rspd); + mbhc.hspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvSAdd); // ߼ٶ + mbhc.hspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvbrkAdd); // ɲٶ + + mbhc.precondition = NULL;// MoveSBHPrec; // Ⱦ + mbhc.stopscan = MoveSBHStop; // ֹͣ + //mbhc.slowscan = MoveSBHSlow; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +////------------------------------------------------------------------------------- +// L ƶƫֵ +int MoveSAsOffset(s32 ofstl, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 lIdx; + MotoSpd spd; + s16 dirl; + + lIdx = MTS1_IDX; + + if (ofstl == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvbrkAdd); + pSpd = &spd; + } + + if (ofstl < 0) + { + dirl = -1; + } + else if (ofstl > 0) + { + dirl = 1; + } + else + { + dirl = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[lIdx].axisConfig = MTS1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[lIdx].poutType = MTS1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[lIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[lIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[lIdx] = ofstl; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstl); // 岹λ // GetSyntheticLength(ofstx, ofsty); // 岹λƣĺϳɳ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + +// // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + //lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = ((u32)dirl & 0xffff); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} + +// ƶsλ +int MoveSToPos(s32 poss, MotoSpd * pSpd) +{ + int err; + s32 ofsts; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + //ReportError(err); + + ReadAndFreshMotosPos(); + + if (1) + { + ReadAndFreshMotosPos(); + + ofsts = poss - g_motosPara.motosPos[MTS1_IDX]; + + printf("\r\n before move\r\n"); + +// printf("\r\n move ofstx = %d, ofsty = %d\r\n", ofstx, ofsty); + + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTS1_IDX]); + + + err = MoveSAsOffset(ofsts, pSpd); + + printf("\r\n after move\r\n"); + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTS1_IDX]); + +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +#endif + +//------------------------------------------------------------------------------- +//\ϵ첽 + +// 1ƣϵ +int MTS1MotoCanMoveTest_a(void) +{ + int err = ERR_NONE; + + return err; +} + +// 1ֹͣ +int MoveMTS1QuickStop_a(u32 para1,u32 para2) +{ + return 0; +} + + +// ֶƶ +int MoveMTS1BHStop_a(u32 para1,u32 para2) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + else if (IsConsoleCancel() != 0) // նֹͣ + { + rslt = STA_NORMAL_STOP; + } + else + { + } + + return rslt; +} + +//------------------------------------------------------------------------------------------- + + + +//---------------------------------------------P---------------------------------------------- +#define MVPBH_MVMT (3000) // 3000 mm + +int MTP_1PulseToP1Pulse(s32 Pulse) +{ + Pulse *= 8.488;// 8.488p/mm + return Pulse; +} + +int MovePBHPrec(u32 para) // Ⱦ +{ + int err; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTP1_IDX)) == (MTP1_IDX) && //L Чҹɹ + 1 ) + { + err = ERR_NONE; + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} + +int MovePBHStop(u32 para) // ֹͣ +{ + int rslt; + + rslt = ERR_NONE; + + if (IsNewOperCmd() == TRUE) // ȡ + { + rslt = STA_NORMAL_STOP; + } + else + { + } + + if (rslt == ERR_NONE) + { + } + return rslt; +} + +int MovePBHSlow(u32 para) // +{ + int rslt; + int dir; + + dir = (int)(para); + + rslt = ERR_NONE; + if (dir != 0) + { + u32 curpps; + s32 decCount; + + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTP1_IDX)) == (MTP1_IDX) && //L Чҹɹ + 1 ) + { + curpps = GetVAxisPPS(VAXIS_ID1); // ǰٶ + decCount = CalcDisplacement(curpps, XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd), XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd)*TOSLOWMUTI); // ԵǰٶȼٵֹͣٶҪλ + + decCount += 200; // ֵ + + if (dir > 0) // + { + if (g_motosPara.motosPos[MTP1_IDX] + decCount >g_pOpticalMcPara->xMovPosiBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + else if (dir < 0) // + { + if (g_motosPara.motosPos[MTP1_IDX] - decCount xMovNegaBorder) + { + rslt = STA_NORMAL_STOP; // ״̬ + } + } + } + } + + return rslt; +} + +int MovePByHand(int dir, int spdLev) +{ + int err; + int stspd, rspd; + MVByHandCtrl mbhc; + + assert_param(dir == 1|| dir == -1); + + err = ERR_NONE; + + memset(&mbhc, 0, sizeof(MVByHandCtrl)); + + mbhc.vAxisId = VAXIS_ID1; // + mbhc.axisIdx = MTP1_IDX; // ˶ + mbhc.axisCfg = MTP1_CFG; // + mbhc.poutType = MTP1_OTP; + mbhc.newCfg = 1; + + mbhc.movement = (s32)XYAxisMMToPulse(MVPBH_MVMT)*dir; // ƶλ + mbhc.ppSegment = PULSE_PER_SEGMENT; + + stspd =g_pOpticalMcPara->lmvstspSpd; + + if (spdLev <= 1) + { + rspd =g_pOpticalMcPara->lmvhSpd1; // ֶƶٶȵȼ1 + } + else if (spdLev == 2) + { + rspd =g_pOpticalMcPara->lmvhSpd2; // ֶƶٶȵȼ2 + } + else if (spdLev >= 3) + { rspd =g_pOpticalMcPara->lmvhSpd3; // ֶƶٶȵȼ3 + } + + if (stspd > rspd) + { + stspd = rspd; + } + + mbhc.hspd.stspSpd = XYAxisMMPSToPPS(stspd); // ͣٶ + mbhc.hspd.runSpd = XYAxisMMPSToPPS(rspd); + mbhc.hspd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvSAdd); // ߼ٶ + mbhc.hspd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvbrkAdd); // ɲٶ + + mbhc.precondition = NULL;// MovePBHPrec; // Ⱦ + mbhc.stopscan = MovePBHStop; // ֹͣ + //mbhc.slowscan = MovePBHSlow; // + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + err = MoveByHandCtrl(&mbhc); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +////------------------------------------------------------------------------------- +// L ƶƫֵ +int MovePAsOffset(s32 ofstl, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 lIdx; + MotoSpd spd; + s16 dirl; + + lIdx = MTP1_IDX; + + if (ofstl == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvbrkAdd); + pSpd = &spd; + } + + if (ofstl < 0) + { + dirl = -1; + } + else if (ofstl > 0) + { + dirl = 1; + } + else + { + dirl = 0; + } + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[lIdx].axisConfig = MTP1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[lIdx].poutType = MTP1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[lIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[lIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[lIdx] = ofstl; // ˶0˶˶ȣλp + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstl); // 岹λ // GetSyntheticLength(ofstx, ofsty); // 岹λƣĺϳɳ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + +// // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + //lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = ((u32)dirl & 0xffff); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} +// ƶPλ +int MovePToPos(s32 poss, MotoSpd * pSpd) +{ + int err; + s32 ofsts; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + //ReportError(err); + + ReadAndFreshMotosPos(); + + if (1) + { + ReadAndFreshMotosPos(); + + ofsts = poss - g_motosPara.motosPos[MTP1_IDX]; + + printf("\r\n before move\r\n"); + +// printf("\r\n move ofstP1 = %d, ofsty = %d\r\n", ofstP1, ofsty); + + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTP1_IDX]); + + + err = MovePAsOffset(ofsts, pSpd); + + printf("\r\n after move\r\n"); + printf("\txpos=%d\r\n", g_motosPara.motosPos[MTP1_IDX]); + +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} +//------------------------------------------------------------------------------- + + + + +//---------------------------------------------S---------------------------------------------- + + + +//------------------------------------------------------------------------------- + +// xyrsp ͬƶ +#if (1) + +// ͣ + +#if ((MODULE_X != 0) && (MODULE_Y != 0) && (TURN_R1 != 0)) +int MoveXYREmcScan(u32 para1, u32 para2) +{ + int rslt; + s8 dirx, diry, dirr1; + + dirx = (s8)para1; + diry = (s8)(para1>>8); + dirr1 = (s8)(para1>>16); + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_X != 0) + // Xλ + if (dirx > 0) + { + if (MoveXLimitPosi() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_POSI; // + printf("x=%d\r\n",g_motosPara.motosPos[MTX_IDX]); + } + } + else if (dirx < 0) + { + if (MoveXLimitNega() == SENSOR_ON) // Xλ + { + rslt = ERR_X_LIT_NEGA; // + printf("x=%d\r\n",g_motosPara.motosPos[MTX_IDX]); + } + } + else // if (dirx == 0) + { + rslt = ERR_NONE; + } + + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + +#if (MODULE_Y != 0) + // Yλ + if (diry > 0) + { + if (MoveYLimitPosi() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_POSI; // Yλ + printf("y=%d\r\n",g_motosPara.motosPos[MTY_IDX]); + } + } + else if (diry < 0) + { + if (MoveYLimitNega() == SENSOR_ON) // Yλ + { + rslt = ERR_Y_LIT_NEGA; // Yλ + printf("y=%d\r\n",g_motosPara.motosPos[MTY_IDX]); + } + } + else // if (diry == 0) + { + rslt = ERR_NONE; + } + + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + + if (dirr1 > 0) + { + + } + else if (dirr1 < 0) + { + + } + else // if (dirr1 == 0) + { + rslt = ERR_NONE; + } + + return rslt; +} + + +// ֹͣ +int MoveXYRQStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + +// ֹͨͣ +int MoveXYRNStopScan(u32 para1, u32 para2) +{ + int rslt; + + if (IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + rslt = STA_NORMAL_STOP; + return rslt; + } + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + + + return rslt; +} + + +int MoveXYR1S1P1AsOffset( s32 ofstx, s32 ofsty, s32 ofstr1,s32 ofsts1,s32 ofstp1, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 xIdx, yIdx, r1Idx, s1Idx, p1Idx; + MotoSpd spd; + s8 dirx, diry, dirr1,dirs1,dirp1; + u32 interlong; + +#if (XY_GAP_CONVERT == 1) + ofstx = XGapConvert(ofstx); // ϶ת + ofsty = YGapConvert(ofsty); // ϶ת +#endif + + xIdx = MTX_IDX; + yIdx = MTY_IDX; + r1Idx = MTR1_IDX; + s1Idx = MTS1_IDX; + p1Idx = MTP1_IDX; + + if (ofstx == 0 && ofsty == 0 && ofstr1 == 0 && ofsts1 == 0 && ofstp1 == 0) + { + return ERR_NONE; + } + + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + pSpd = &spd; + } + + + + if (ofstx < 0) + { + dirx = -1; + } + else if (ofstx > 0) + { + dirx = 1; + } + else + { + dirx = 0; + } + + if (ofsty < 0) + { + diry = -1; + } + else if (ofsty > 0) + { + diry = 1; + } + else + { + diry = 0; + } + + if (ofstr1 < 0) + { + dirr1 = -1; + } + else if (ofstr1 > 0) + { + dirr1 = 1; + } + else + { + dirr1 = 0; + } + + if (ofsts1 < 0) + { + dirs1 = -1; + } + else if (ofsts1 > 0) + { + dirs1 = 1; + } + else + { + dirs1 = 0; + } + + if (ofstp1 < 0) + { + dirp1 = -1; + } + else if (ofstp1 > 0) + { + dirp1 = 1; + } + else + { + dirp1 = 0; + } + + interlong = GetSyntheticLength(ofstx, ofsty); + interlong = abs(ofstr1) > interlong ? abs(ofstr1) : interlong; + interlong = abs(MTS1_IsWire001PulseToS1Pulse(ofsts1)) > interlong ? abs(MTS1_IsWire001PulseToS1Pulse(ofsts1)) : interlong; + + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + lmctrl.motosConfig.newConfig = 0; + +#if (MODULE_X != 0) + lmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + lmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[xIdx] = ofstx; // ˶0˶˶ȣλp +#endif + +#if (MODULE_Y != 0) + lmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + lmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[yIdx] = ofsty; // ˶0˶˶ȣλp +#endif + +#if (TURN_R1 != 0) + lmctrl.motosConfig.axisConfig[r1Idx].axisConfig = MTR1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[r1Idx].poutType = MTR1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[r1Idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[r1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[r1Idx] = ofstr1; // ˶0˶˶ȣλp +#endif + +#if (MODULE_SEND != 0) + lmctrl.motosConfig.axisConfig[s1Idx].axisConfig = MTS1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[s1Idx].poutType = MTS1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[s1Idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[s1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[s1Idx] = MTS1_IsWire001PulseToS1Pulse(ofsts1); // ˶0˶˶ȣλp +#endif + +#if (MODULE_PULL != 0) + lmctrl.motosConfig.axisConfig[p1Idx].axisConfig = MTP1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[p1Idx].poutType = MTP1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[p1Idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[p1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[p1Idx] = 0; // ˶0˶˶ȣλp +#endif + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = interlong; + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽٶȵͼֹͣ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXYREmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXYRQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXYRNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + //lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = (((u32)dirp1 & 0xff) |((u32)dirs1 & 0xff) | (((u32)dirr1 & 0xff) << 16) | (((u32)diry & 0xff) << 8) | ((u32)dirx & 0xff)); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + + return err; +} +// U1S1ƫƶ +int MoveU1S1AsOffset(s32 ofstu, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 u1idx,s1idx; + u1idx = MTU1_IDX; + s1idx = MTS1_IDX; + MotoSpd spd; + + if (pSpd == NULL) + { + + spd.stspSpd = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); + spd.runSpd = UAxisMMPSToPPS(g_pOpticalMcPara->umoveSpd); + spd.spdAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); + spd.brkAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); + pSpd = &spd; + } +// printf("MoveU1AsOffset, ofstu=%d, spd=%d\r\n", ofstu, pSpd->runSpd); +// printf("before move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[u1idx].axisConfig = MTU1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[u1idx].poutType = MTU1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[u1idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[u1idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[u1idx] = ofstu; // ˶0˶˶ȣλp + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[s1idx].axisConfig = MTS1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[s1idx].poutType = MTS1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[s1idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[s1idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[s1idx] = ofstu*1.2; + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(ofstu*1.2); // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ +// if(pSpd == NULL) +// { + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ +// } +// else +// { +// lmctrl.spdPara.startPPS = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); // ٶ +// lmctrl.spdPara.stopPPS = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); // ֹͣٶ +// lmctrl.spdPara.runPPS = UAxisMMPSToPPS(g_pOpticalMcPara->umoveSpd); // ٶ +// lmctrl.spdPara.slowPPS = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); // ٶ +// lmctrl.spdPara.addPPSG = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); // ټٶ +// lmctrl.spdPara.decPPSG = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); // ټٶ +// lmctrl.spdPara.brkPPSG = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); // ɲٶ +// +// } + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetEmergencyStop = MoveU1EmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveU1QStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveU1NStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ +// lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = 0; + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + +// printf("after move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} +// p1S1ƫƶ +int MoveP1S1AsOffset(s32 ofstu, MotoSpd * pSpd) +{ + + int rslt, err; + InterMoveCtrl lmctrl; + u16 p1idx,s1idx; + p1idx = MTP1_IDX; + s1idx = MTS1_IDX; + MotoSpd spd; + s32 ofsp1,ofss1; + if (ofstu == 0) + { + return ERR_NONE; + } + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->lmvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->lmvbrkAdd); + pSpd = &spd; + } +// printf("MoveU1AsOffset, ofstu=%d, spd=%d\r\n", ofstu, pSpd->runSpd); +// printf("before move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + + ofsp1 = toActSpinLen(abs(MTP_1PulseToP1Pulse(ofstu))); + ofss1 = toActSpinLen(abs(MTS1_IsSpin1PulseToS1Pulse(ofstu))*g_pOpticalMcPara->LevelOfAccAndDec/100); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[p1idx].axisConfig = MTP1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[p1idx].poutType = MTP1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[p1idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[p1idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[p1idx] = ofsp1; // ˶0˶˶ȣλp + + lmctrl.motosConfig.newConfig = 0; // Ҫµ + lmctrl.motosConfig.axisConfig[s1idx].axisConfig = MTS1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[s1idx].poutType = MTS1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[s1idx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[s1idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[s1idx] = ofss1; + + lmctrl.mvmtPara.interLong = ofss1 > ofsp1 ? ofss1 : ofsp1; + lmctrl.mvmtPara.extraRepeat = 0; // ظ + //lmctrl.mvmtPara.interLong = abs(ofstu*11.781); // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetEmergencyStop = MoveU1EmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveU1QStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveS1P1NStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ +// lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = 0; + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + +// printf("after move, motospos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} +int MoveXYR1S1P1ToPos(s32 posx, s32 posy, s32 posr1,s32 poss1,s32 posp1,MotoSpd * pSpd, int s1MotoRunFlag) +{ + int err; + s32 ofstx, ofsty, ofstr1, ofsts1, ofstp1, xNegaBorder, yNegaBorder, xPosiBorder, yPosiBorder; + s32 abposr1; + + g_workCtrl.sendStaWhenRun = 0; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + err = ERR_NONE; + ReportError(err); + + xNegaBorder = g_pOpticalMcPara->xMovNegaBorder; + yNegaBorder = g_pOpticalMcPara->yMovNegaBorder; + xPosiBorder = g_pOpticalMcPara->xMovPosiBorder; + yPosiBorder = g_pOpticalMcPara->yMovPosiBorder; + +// if(g_pOpticalMcPara->offsetX > 0) +// { +// xNegaBorder -= g_pOpticalMcPara->offsetX; +// } +// else +// { +// xPosiBorder -= g_pOpticalMcPara->offsetX; +// } +// +// if(g_pOpticalMcPara->offsetY > 0) +// { +// yNegaBorder -= g_pOpticalMcPara->offsetY; +// } +// else +// { +// yPosiBorder -= g_pOpticalMcPara->offsetY; +// } + + if (g_motosPara.enFlag == DATA_VALID && + (g_workCtrl.posEnFlag & (MTX_MOD|MTY_MOD)) == (MTX_MOD|MTY_MOD) && + (g_workCtrl.posEnFlag & MTR1_MOD) == MTR1_MOD && + 1 ) + { + // Ŀλ + if (posx < xNegaBorder ||//g_pOpticalMcPara->xMovNegaBorder || // X߽磬λ0.01mm + posx > xPosiBorder ||//g_pOpticalMcPara->xMovPosiBorder || // X߽磬λ0.01mm + posy < yNegaBorder ||//g_pOpticalMcPara->yMovNegaBorder || // Y߽磬λ0.01mm + posy > yPosiBorder ||//g_pOpticalMcPara->yMovPosiBorder || // Y߽磬λ0.01mm + 0 ) + { + printf("\r\ntarget position out of range, x=%d, y=%d\r\n", posx, posy); + err = ERR_OUT_RANGE; // ĿλԽ + } + else + { + ReadAndFreshMotosPos(); + + ofstx = posx - g_motosPara.motosPos[MTX_IDX]; + ofsty = posy - g_motosPara.motosPos[MTY_IDX]; + + if(s1MotoRunFlag == 1) + { + + ofsts1 = sqrt((ofstx/10)*(ofstx/10) + (ofsty/10)*(ofsty/10))*g_pOpticalMcPara->LevelOfAccAndDec/100; + ofsts1 *= 10; + } + else + { + ofsts1 = 0; + ofstp1 = 0;//posp1 - g_motosPara.motosPos[MTP1_IDX]; + } + + + // õһȦڵλ + abposr1 = g_motosPara.motosPos[MTR1_IDX]; + ofstr1 = posr1 - abposr1; + + // תΪ -180--180֮ + ChangeRotToNP180(&ofstr1); + + + if (ofstx != 0 || ofsty != 0 || ofstr1 != 0) + { +/* + printf("\r\n before xyr1r2 move\r\n"); + printf("actpos: x=%d, y=%d, r1=%d, r1=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX], g_motosPara.motosPos[MTR1_IDX], g_motosPara.motosPos[MTR2_IDX]); + printf("\r\n move ofstx = %d, ofsty = %d, ofstr1 = %d, ofstr2 = %d\r\n", ofstx, ofsty, ofstr1, ofstr2); +*/ + err = MoveXYR1S1P1AsOffset(ofstx, ofsty, ofstr1, ofsts1, ofstp1, pSpd); +/* + printf("\r\n after xyr1move\r\n"); + printf("actpos: x=%d, y=%d, r1=%d, r1=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX], g_motosPara.motosPos[MTR1_IDX], g_motosPara.motosPos[MTR2_IDX]); +*/ + } + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + g_workCtrl.sendStaWhenRun = 1; + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + ReportError(err); + return err; +} +#endif + +s32 PitkToRpp(s32 dr) +{ + double tdr; + tdr = dr; + return PITK_TO_RPP(tdr); +} + +int MoveXYRS1P1ToWorkPos(DataItem * pCurDat, MotoSpd *pSpd, int rToSpinPosFlag,int s1MotoRunFlag) +{ + int err; + int posx, posy, posr1, poss1, posp1; + err = ERR_NONE; + printf("XYRS1P1MoveToPos\r\n"); + printf("idx = %d,go to x= %d, go to y = %d, \r\n",g_workCtrl.cursta.dataIdx,g_workCtrl.workPos[MTX_IDX],g_workCtrl.workPos[MTY_IDX]); + + if (err == ERR_NONE) + { + g_optWorkCtrl.IsNoMaterialEn = 0; + + ReadAndFreshMotosPos(); + + posx = g_workCtrl.workPos[MTX_IDX]; + posy = g_workCtrl.workPos[MTY_IDX]; + if(rToSpinPosFlag == 1) + { + posr1 = 2500;//90 + } + else + { + posr1 = PitkToRpp(g_workCtrl.workPos[MTR1_IDX]); + } + poss1 = g_workCtrl.workPos[MTS1_IDX]; + posp1 = g_workCtrl.workPos[MTP1_IDX]; + + if(g_optWorkCtrl.offsetToOpit == 1) + { + s1MotoRunFlag =1; + } + +// if (uh != 0) +// { +// if (posx != g_motosPara.motosPos[MTX_IDX] || +// posy != g_motosPara.motosPos[MTY_IDX] || +// posr1 != g_motosPara.motosPos[MTR1_IDX] || // λ +// poss1 != g_motosPara.motosPos[MTS1_IDX] || // λ +// posp1 != g_motosPara.motosPos[MTP1_IDX] || // λ +// 0 ) +// { +// // ͷ() +// } +// } + + + + MotoSpd spd; + if (pSpd == NULL) + { + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + } + else + { + memcpy(&spd, pSpd, sizeof(MotoSpd)); // ٶ + } + + err = MoveXYR1S1P1ToPos(posx, posy, posr1, poss1, posp1, &spd, s1MotoRunFlag); + + g_optWorkCtrl.IsNoMaterialEn = 1; + } + return err; +} + +#endif + +int MoveXYRS1P1SToWorkPos(DataItem * pCurDat, int uh) //еȷλ,ϼ޼н(ӽѹʱϼӼϻַн¶) +{ + int err; + int posx, posy, posr1, poss1, posp1; + err = ERR_NONE; + + if (err == ERR_NONE) + { + ReadAndFreshMotosPos(); + + posx = g_workCtrl.workPos[MTX_IDX]; + posy = g_workCtrl.workPos[MTY_IDX]; + posr1 = PitkToRpp(g_workCtrl.workPos[MTR1_IDX]); + poss1 = g_workCtrl.workPos[MTS1_IDX]; + posp1 = g_workCtrl.workPos[MTP1_IDX]; + + g_optWorkCtrl.IsNoMaterialEn = 0; + + if (uh != 0) + { + if (posx != g_motosPara.motosPos[MTX_IDX] || + posy != g_motosPara.motosPos[MTY_IDX] || + posr1 != g_motosPara.motosPos[MTR1_IDX] || // λ + poss1 != g_motosPara.motosPos[MTS1_IDX] || // λ + posp1 != g_motosPara.motosPos[MTP1_IDX] || // λ + 0 ) + { + //// ͷ() + + } + } + + if (err == ERR_NONE) + { + + // UpClipMatClipCylinderOn(); // ϼ :ϼڼǰӦ,ס˷ֹ. + err = MoveXYR1S1P1ToPos(posx, posy, posr1, poss1, posp1, NULL, 0); + } + + g_optWorkCtrl.IsNoMaterialEn = 1; + } + return err; +} + +//------------------------------------------------------------- +//------------------------------------------------------------------------------- +// ͣ +int MoveXYU1R1EmcScan(u32 para1, u32 para2) +{ + int rslt; + s8 dirx, diry,diru, dirr; + + dirr = (s8)(para1); + diru = (s8)(para1>>8); + diry = (s8)(para1>>16); + dirx = (s8)(para1>>24); + + dirr = dirr; + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_X != 0) + // Xλ + if (dirx > 0) + { + if (MoveXLimitPosi() == SENSOR_ON) // X λ + { + rslt = ERR_X_LIT_POSI; // + } + } + else if (dirx < 0) + { + if (MoveXLimitNega() == SENSOR_ON) // X λ + { + rslt = ERR_X_LIT_NEGA; // + } + } + else // if (dirx == 0) + { + rslt = ERR_NONE; + } + + if (rslt == ERR_NONE) + { + } + + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + +#if (MODULE_Y != 0) + // Yλ + if (diry > 0) + { + if (MoveYLimitPosi() == SENSOR_ON) // Y λ + { + rslt = ERR_Y_LIT_POSI; // Y λ + } + } + else if (diry < 0) + { + if (MoveYLimitNega() == SENSOR_ON) // Y λ + { + rslt = ERR_Y_LIT_NEGA; // Y λ + } + } + else // if (diry == 0) + { + rslt = ERR_NONE; + } + + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + + +#if(LIFT_U1 != 0) + // U1λ + if (diru > 0) + { + if (MoveU1BHLimitPosi(0) == SENSOR_ON) // U1 λ + { + rslt = ERR_LMT_POSITIVE; // λ + } + } + else if (diru < 0) + { + if (MoveU1BHLimitNega(0) == SENSOR_ON) // U1 λ + { + rslt = ERR_LMT_NEGATIVE; // λ + } + } + else // if (diru == 0) + { + rslt = ERR_NONE; + } + + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + return rslt; +} + + +// ֹͣ +int MoveXYU1R1QStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + + +// ֹͨͣ +int MoveXYU1R1NStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } +#if (MODULE_LOOSE == 1) // װ + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } +#endif + return rslt; +} + +// X Y U1 R1 ƶƫֵ + +int MoveXYU1R1AsOffset(s32 ofstx, s32 ofsty, s32 ofstu1, s32 ofstr1, MotoSpd * pSpd) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 xIdx, yIdx, uIdx, rIdx; + s16 dirx, diry, diru, dirr; + MotoSpd spd, spdx, spdu, spdr; + u32 interlong; + +#if (XY_GAP_CONVERT == 1) + ofstx = XGapConvert(ofstx); // ϶ת + ofsty = YGapConvert(ofsty); // ϶ת +#endif + +#if (MODULE_X != 0) + if (ofstx == 0 && ofsty == 0 && ofstu1 == 0 && ofstr1 == 0) + { + return ERR_NONE; + } + + interlong = abs(ofstx); +#endif + +#if (MODULE_Y != 0) + if (interlong < abs(ofsty)) + { + interlong = abs(ofsty); + } +#endif + +#if(LIFT_U1 != 0) + if (interlong < abs(ofstu1)) + { + interlong = abs(ofstu1); + } +#endif + +#if(TURN_R1 != 0) + if (interlong < abs(ofstr1)) + { + interlong = abs(ofstr1); + } +#endif + + // ٶ + if (pSpd == NULL) + { + spd.stspSpd = 0xffffffff; + spd.runSpd = 0xffffffff; + spd.spdAdd = 0xffffffff; + spd.brkAdd = 0xffffffff; + + spdx.stspSpd = 0xffffffff; + spdx.runSpd = 0xffffffff; + spdx.spdAdd = 0xffffffff; + spdx.brkAdd = 0xffffffff; + + spdu.stspSpd = 0xffffffff; + spdu.runSpd = 0xffffffff; + spdu.spdAdd = 0xffffffff; + spdu.brkAdd = 0xffffffff; + + spdr.stspSpd = 0xffffffff; + spdr.runSpd = 0xffffffff; + spdr.spdAdd = 0xffffffff; + spdr.brkAdd = 0xffffffff; + +#if ((MODULE_X != 0) || (MODULE_Y != 0)) + if ((ofstx != 0) || (ofsty != 0)) + { + spdx.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spdx.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvlSpd); + spdx.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spdx.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + } +#endif + +#if(LIFT_U1 != 0) + if (ofstu1 != 0) + { + spdu.stspSpd = UAxisMMPSToPPS(g_pOpticalMcPara->ustspSpd); + spdu.runSpd = UAxisMMPSToPPS(g_pOpticalMcPara->umoveSpd); + spdu.spdAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uliftAdd); + spdu.brkAdd = UAxisMMPSSToPPSG(g_pOpticalMcPara->uBrkAdd); + } +#endif + +#if(TURN_R1 != 0) + if (ofstr1 != 0) + { + spdr.stspSpd = DPS_TO_PPS(g_pOpticalMcPara->rotstspDps); // ͣٶ + spdr.runSpd = DPS_TO_PPS(g_pOpticalMcPara->rotrunDps); // תת + spdr.spdAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotAddDpss); // ٶ + spdr.brkAdd = DPSS_TO_PPSG(g_pOpticalMcPara->rotBrkDpss); // ɲٶ + } +#endif + + if (spd.stspSpd > spdx.stspSpd) + { + spd.stspSpd = spdx.stspSpd; + } + if (spd.stspSpd > spdu.stspSpd) + { + spd.stspSpd = spdu.stspSpd; + } + if (spd.stspSpd > spdr.stspSpd) + { + spd.stspSpd = spdr.stspSpd; + } + + if (spd.runSpd > spdx.runSpd) + { + spd.runSpd = spdx.runSpd; + } + if (spd.runSpd > spdu.runSpd) + { + spd.runSpd = spdu.runSpd; + } + if (spd.runSpd > spdr.runSpd) + { + spd.runSpd = spdr.runSpd; + } + + if (spd.spdAdd > spdx.spdAdd) + { + spd.spdAdd = spdx.spdAdd; + } + if (spd.spdAdd > spdu.spdAdd) + { + spd.spdAdd = spdu.spdAdd; + } + if (spd.spdAdd > spdr.spdAdd) + { + spd.spdAdd = spdr.spdAdd; + } + + if (spd.brkAdd > spdx.brkAdd) + { + spd.brkAdd = spdx.brkAdd; + } + if (spd.brkAdd > spdu.brkAdd) + { + spd.brkAdd = spdu.brkAdd; + } + if (spd.brkAdd > spdr.brkAdd) + { + spd.brkAdd = spdr.brkAdd; + } + + pSpd = &spd; + } + //printf("MoveXYU1R1AsOffset, ofstx=%d, ofsty=%d, ofstu1=%d, ofstr1=%d, runspd\r\n",ofstx, ofsty, ofstu1, ofstr1, pSpd->runSpd); + +#if (MODULE_X != 0) + // + if (ofstx < 0) + { + dirx = -1; + } + else if (ofstx > 0) + { + dirx = 1; + } + else + { + dirx = 0; + } +#endif + +#if (MODULE_Y != 0) + if (ofsty < 0) + { + diry = -1; + } + else if (ofsty > 0) + { + diry = 1; + } + else + { + diry = 0; + } +#endif + +#if(LIFT_U1 != 0) + if (ofstu1 < 0) + { + diru = -1; + } + else if (ofstu1 > 0) + { + diru = 1; + } + else + { + diru = 0; + } +#endif + +#if(TURN_R1 != 0) + if (ofstr1 < 0) + { + dirr = -1; + } + else if (ofstr1 > 0) + { + dirr = 1; + } + else + { + dirr = 0; + } +#endif + +#if (MODULE_X != 0) + xIdx = MTX_IDX; +#endif + +#if (MODULE_Y != 0) + yIdx = MTY_IDX; +#endif + +#if(LIFT_U1 != 0) + uIdx = MTU1_IDX; +#endif + +#if(TURN_R1 != 0) + rIdx = MTR1_IDX; +#endif + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = VAXIS_ID1; // ʹ1 + +#if (MODULE_X != 0) + lmctrl.motosConfig.newConfig = 1; // Ҫµ + lmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + lmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[xIdx] = ofstx; // ˶0˶˶ȣλp +#endif + +#if (MODULE_Y != 0) + lmctrl.motosConfig.newConfig = 1; + lmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + lmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[yIdx] = ofsty; // ˶0˶˶ȣλp +#endif + +#if(LIFT_U1 != 0) + lmctrl.motosConfig.axisConfig[uIdx].axisConfig = MTU1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[uIdx].poutType = MTU1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[uIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[uIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[uIdx] = ofstu1; // ˶0˶˶ȣλp +#endif + +#if(TURN_R1 != 0) + lmctrl.motosConfig.axisConfig[rIdx].axisConfig = MTR1_CFG; // ʵ + lmctrl.motosConfig.axisConfig[rIdx].poutType = MTR1_OTP; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[rIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[rIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[rIdx] = ofstr1; // ˶0˶˶ȣλp + #endif + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = interlong; // 岹λ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pSpd->stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pSpd->runSpd; // ٶ + lmctrl.spdPara.slowPPS = pSpd->stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pSpd->spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pSpd->spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pSpd->brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = lmctrl.vAxisId; // + lmctrl.GetEmergencyStop = MoveXYU1R1EmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.GetQuickStop = MoveXYU1R1QStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetNormalStop = MoveXYU1R1NStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + //lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.condPara1 = (((u32)dirx & 0xff) << 24 | ((u32)diry & 0xff) << 16 | ((u32)diru & 0xff) << 8 | ((u32)dirr & 0xff)); + lmctrl.condPara2 = lmctrl.vAxisId; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + + return err; +} + +int MoveXYU1R1ToPos(s32 posx, s32 posy, s32 posu1, s32 posr1, MotoSpd * pSpd) +{ + int err; + s32 ofstx, ofsty, ofstu, ofstr; + + err = ERR_NONE; + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + + if (err == ERR_NONE) + { + ReadAndFreshMotosPos(); + } + + if (err == ERR_NONE) + { + if ((g_motosPara.enFlag == DATA_VALID) && + (g_workCtrl.posEnFlag & (MTX_MOD|MTY_MOD)) == (MTX_MOD|MTY_MOD) && + (g_workCtrl.posEnFlag & (MTU1_MOD)) == (MTU1_MOD) && + (g_workCtrl.posEnFlag & (MTR1_MOD)) == (MTR1_MOD) && + 1 ) + { + ReadAndFreshMotosPos(); + +#if (MODULE_X != 0) + ofstx = posx - g_motosPara.motosPos[MTX_IDX]; +#endif + +#if (MODULE_Y != 0) + ofsty = posy - g_motosPara.motosPos[MTY_IDX]; +#endif + +#if(LIFT_U1 != 0) + ofstu = posu1 - g_motosPara.motosPos[MTU1_IDX]; +#endif + +#if(TURN_R1 != 0) + ofstr = posr1 - g_motosPara.motosPos[MTR1_IDX]; +#endif + + if (ofstx != 0 || ofsty != 0 || ofstu != 0 || ofstr != 0) + { + if (err == ERR_NONE) + { + err = MoveXYU1R1AsOffset(ofstx, ofsty, ofstu, ofstr, pSpd); + } + } + } + else + { + err = ERR_COOR_SYSTM; // ϵͳ + } + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + ReportError(err); + return err; +} + + +// +void FanMotosOn(void) +{ + Fan1MotoOn(); // 1 + + if (g_optWorkCtrl.fanStatus == 0) + { + g_optWorkCtrl.fanCloseCounter = g_pOpticalMcPara->fanCloseDelay; // ü + printf("3. set FanMotosOn fanCloseCounter = %d\r\n",g_optWorkCtrl.fanCloseCounter); + } + g_optWorkCtrl.fanStatus = 1; // +} + +void FanMotosOff(void) +{ +// printf("fans off\r\n"); + Fan1MotoOff(); // 1ֹͣ +} + +// ж +int IsAutoMoveEnable(void) +{ + int err; + + err = ERR_NONE; + // Ƿ(ʱ, ״̬) + /*if (err == ERR_NONE && + (g_workCtrl.cursta.workStatus & WORK_STA_ENTIME) == 0) // ʱ + { + err = ERR_EXPIRATION; // ʹʱѵ + }*/ + + if (err == ERR_NONE && + (g_workCtrl.cursta.workStatus & WORK_STA_ENSTATE) == 0) // ״̬ + { + err = ERR_NOT_ALLOWED; // ״̬ + } + + // + if (err == ERR_NONE) + { + + } + + // ǷЧ + if (err == ERR_NONE && g_workCtrl.paraEnFlag != PARA_VALID) // Ч + { + err = ERR_MC_PARA; // + } + + // ϵͳǷЧ + if (err == ERR_NONE && + ( (g_motosPara.enFlag != DATA_VALID) || // ϵͳЧ + ((g_workCtrl.posEnFlag & MTX_MOD) != MTX_MOD) || // XϵͳЧ + ((g_workCtrl.posEnFlag & MTY_MOD) != MTY_MOD) || // YϵͳЧ + ((g_workCtrl.posEnFlag & MTU1_MOD) != MTU1_MOD) || // U1ϵͳЧ + ((g_workCtrl.posEnFlag & MTR1_MOD) != MTR1_MOD) || // R1ϵͳЧ + 0 ) && + 1 ) + { + err = ERR_COOR_SYSTM; // ϵͳ + } + + return err; +} + +//------------------------------------------------ļִ------------------------------------------------ +#define EXDIR_POSI 1 // ִ +#define EXDIR_NEGA -1 // ִ + +// ͨ뼣õ +int GetWorkPosFromIndex(void) +{ + int rslt; + u32 idx; + DataItem sewStep; + + g_workCtrl.workAvaible = 0; // Ч־ + + g_workCtrl.workPos[MTX_IDX] = 0; + g_workCtrl.workPos[MTY_IDX] = 0; + g_workCtrl.workPos[MTR1_IDX] = 0; + g_workCtrl.workPos[MTS1_IDX] = 0; + g_workCtrl.workPos[MTP1_IDX] = 0; + + if (IsDatFileAvailable() == TRUE) + { + g_workCtrl.workPos[MTX_IDX] = g_datFile.pFileHead->fileHead.beginX - g_pOpticalMcPara->offsetX; // ǰ + g_workCtrl.workPos[MTY_IDX] = g_datFile.pFileHead->fileHead.beginY - g_pOpticalMcPara->offsetY; // ǰ + g_workCtrl.workPos[MTR1_IDX] = g_datFile.pFileHead->fileHead.beginR; // ǰ + + } + else + { + return -1; + } + + if (IsDatIndexAvailable(g_workCtrl.cursta.dataIdx) != TRUE) + { + g_workCtrl.cursta.dataIdx = 0; + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + } + + for (idx = 0; idx < g_workCtrl.cursta.dataIdx; idx++) + { + rslt = GetADataItem(0, idx, &sewStep); + if (rslt != 0) + { + break; // + } + ChangeWorkPos(&sewStep, 1); + } + g_workCtrl.workAvaible = DATA_VALID; // Ч־ + + return 0; +} + + +void ChangeWorkPos(DataItem * pDatItem, int dir) +{ + if (pDatItem == NULL || (dir != 1 && dir != -1)) + { + return; + } + + if (0 || + pDatItem->ctrl == DATA_OFFSET || + pDatItem->ctrl == DATA_MILLING || + pDatItem->ctrl == DATA_DRAWING || +// pDatItem->ctrl == DATA_PRESSURE || + pDatItem->ctrl == DATA_RKNIFE || + 0 ) + { + g_workCtrl.workPos[MTX_IDX] += pDatItem->dx*dir; + g_workCtrl.workPos[MTY_IDX] += pDatItem->dy*dir; + + g_workCtrl.workPos[MTR1_IDX] += pDatItem->dr*dir; + + g_workCtrl.workPos[MTS1_IDX] += pDatItem->dx*dir; + g_workCtrl.workPos[MTP1_IDX] += pDatItem->dy*dir; + + } + else + { + + } +} + +int CheckFileRange(void) +{ + int err = ERR_NONE; + + // ļǷЧ + if (err == ERR_NONE && + IsDatFileAvailable() != TRUE) // ļЧ + { + err = ERR_NO_DATA; // ļ + } + + // Ƿȷ + if (err == ERR_NONE) + { + if ( + g_datFile.pFileHead->fileHead.maxX < g_datFile.pFileHead->fileHead.minX || + g_datFile.pFileHead->fileHead.maxY < g_datFile.pFileHead->fileHead.minY || // ȷ + g_datFile.pFileHead->fileHead.beginX < g_datFile.pFileHead->fileHead.minX || + g_datFile.pFileHead->fileHead.beginY < g_datFile.pFileHead->fileHead.minY || + g_datFile.pFileHead->fileHead.beginX > g_datFile.pFileHead->fileHead.maxX || + g_datFile.pFileHead->fileHead.beginY > g_datFile.pFileHead->fileHead.maxY || // 㲻Χ + // ÿݵǷΧ + 0 ) + { + err = ERR_DATA_ERROR; // ݴ + } + } + + // ͼǷ֧Խ + if (err == ERR_NONE) + { + if (g_datFile.pFileHead->fileHead.minX < g_pOpticalMcPara->xOptNegaBorder || // ߽ + g_datFile.pFileHead->fileHead.maxX > g_pOpticalMcPara->xOptPosiBorder || + g_datFile.pFileHead->fileHead.minY < g_pOpticalMcPara->yOptNegaBorder || + g_datFile.pFileHead->fileHead.maxY > g_pOpticalMcPara->yOptPosiBorder || + 0 ) + { + printf("graph range, left=%d, right=%d, top=%d, bottom=%d\r\n", + g_datFile.pFileHead->fileHead.minX, g_datFile.pFileHead->fileHead.maxX, g_datFile.pFileHead->fileHead.maxY, g_datFile.pFileHead->fileHead.minY); + printf("para set range, left=%d, right=%d, top=%d, bottom=%d\r\n", + g_pOpticalMcPara->xOptNegaBorder, g_pOpticalMcPara->xOptPosiBorder, g_pOpticalMcPara->yOptPosiBorder, g_pOpticalMcPara->yOptNegaBorder); + err = ERR_GRAPH_OUT_RANGE; // ͼγΧ + } + } + + return err; +} + +void AddNewFileOffset(void) +{ + if (IsNewDatFile(0) == TRUE) // ļ + { + DataFileHead newpara; + memcpy(newpara.headparts.fileparas, g_datFile.pFileHead->headparts.fileparas, sizeof(newpara.headparts.fileparas)); + + printf("AddNewFileOffset\r\n"); + printf("before add, file info:\r\n"); + OutFileInfo(); +// newpara.fileHead.anchorX += g_pOpticalMcPara->datbegOffsetX; +// newpara.fileHead.anchorY += g_pOpticalMcPara->datbegOffsetY; +// newpara.fileHead.beginX += g_pOpticalMcPara->datbegOffsetX; +// newpara.fileHead.beginY += g_pOpticalMcPara->datbegOffsetY; +// newpara.fileHead.minX += g_pOpticalMcPara->datbegOffsetX; +// newpara.fileHead.minY += g_pOpticalMcPara->datbegOffsetY; +// newpara.fileHead.maxX += g_pOpticalMcPara->datbegOffsetX; +// newpara.fileHead.maxY += g_pOpticalMcPara->datbegOffsetY; + + ReSetFilePara(&newpara); + + + SetNewDatFlag(0, FALSE); + SetDatIdxToStart(); + + printf("after add, file info:\r\n"); + OutFileInfo(); + } +} +//-------------------------------------------------------------------------------------------------------------- +typedef struct +{ + u32 dtype; // + int exdir; // ִз + int simulation; // ģ⹤־ + + //---------------- + s32 rworkPos; // תλ + s32 liftofst; // ᵶԤλ + //---------------- + // ٶȿƲ + u32 minpps, maxpps, addppsg; + u32 minadd, addadd; + + u32 minchgpps; //Сٶȱ仯 + //---------------- + u32 slowAngle; // ٽǶ + u32 liftAngle; // ᵶǶ + + int runIdx; // м + int runnum; // Ҫеĸ + + int drawstidx; // ݵʼIDX +}OpticalFillCtrl; + +#define EXDIR_POSI 1 // ִ +#define EXDIR_NEGA -1 // ִ + +//------------------------------------------------------------------------------- +// ͣ +int OpticalEmcScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonEms(); + if (MoveXLimitPosi() == SENSOR_ON) + { + printf("x=%d\r\n",g_motosPara.motosPos[MTX_IDX]); + rslt = ERR_X_LIT_POSI; // + + } + + if (MoveXLimitNega() == SENSOR_ON) + { + printf("x=%d\r\n",g_motosPara.motosPos[MTX_IDX]); + rslt = ERR_X_LIT_NEGA; // + } + + if (MoveYLimitPosi() == SENSOR_ON) + { + rslt = ERR_Y_LIT_POSI; // + } + + if (MoveYLimitNega() == SENSOR_ON) + { + rslt = ERR_Y_LIT_NEGA; // + } + + + return rslt; +} + + +// ײ +int OpticalLightCheck(void) +{ + int rslt = ERR_NONE; + + if (rslt == ERR_NONE && + (MoveXLimitPosi() == SENSOR_ON)) // ײź1 + { + // printf("OpticalLightCheckײ 1\r\n"); + rslt = ERR_X_LIT_POSI; // + } + + if (rslt == ERR_NONE && + (MoveXLimitNega() == SENSOR_ON)) // ײź2 + { + // printf("Impact Valid 2\r\n"); + rslt = ERR_X_LIT_NEGA; // + } + + return rslt; +} + + +// ֹͣ +int OpticalQStopScan(u32 para1, u32 para2) +{ + int rslt; + rslt = GetCommonQStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + if (IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + rslt = STA_NORMAL_STOP; + } + if (rslt == ERR_NONE) + { + + } + + return rslt; +} + +// ֹͨͣ +int OpticalNStopScan(u32 para1, u32 para2) +{ + int rslt; + + if (IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + rslt = STA_NORMAL_STOP; + } + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + rslt = SendOpticalTask(); // Զ͹ + if (rslt != ERR_NONE) + { + return rslt; + } + + + return rslt; +} + + + +//------------------------------------------------------------------------------- +// +#define OPTICALVX_MUTI 5 // и屶 +#define VAxisMMPSToPPS(mmps) (MMPS_TO_PPS(mmps) * OPTICALVX_MUTI) // ٶȼӿ +#define VAxisMMPSSToPPSG(mmpss) (MMPSS_TO_PPSG(mmpss) / OPTICALVX_MUTI) // ٶ + +// ˢ +int OpticalRefreshDat(u32 para1, u32 para2) +{ + int rslt; + OpticalFillCtrl * pFlCtrl; + MoveSwapData * pMvdat; + DataItem datItem, tempItem; + int dirx, diry, dirr; + int dirp, dirs; + u32 stidx; + int vlen, vsource; + u16 mvmtx, mvmty, mvmtr; + u16 mvmtp, mvmts; + u32 tabstpps; + s32 dgap; + + pFlCtrl = (OpticalFillCtrl *)(para1); + pMvdat = (MoveSwapData *)(para2); // + + if (pMvdat == NULL || pFlCtrl == NULL) + { + return -1; + } + + // ݴ + if ( pMvdat->mvmtStatus == 0 && // Ϊգ + pMvdat->bufsta != 3 && // buffΪ + 1 ) + { + pMvdat->waitNoData = 0; // ݲͣ־ + + if (0 || + pFlCtrl->dtype == DATA_DRAWING || // + pFlCtrl->dtype == DATA_PRESSURE || // ѹ + pFlCtrl->dtype == DATA_OPTI || // ˿ + 0 ) + { + + // ִбʱٶȣҲǽҪʼʱٶȣ + if (pMvdat->lastEndPPS == 0) // һ + { + tabstpps = 0; + // printf("first begin spd calc\r\n"); + } + else + { + dgap = pMvdat->calcGap; + if (pMvdat->lastEndPPS > pMvdat->runPPS) // ϶νٶȴڱεĿٶȣôִеĶڼ٣жǷΪ٣ + { + dgap *= -1; + } + // һոִģĽٶȣִбʼٶȣִбļٶȣִбĽٶȡδٶȱ仯أ + tabstpps = CalcEndSpd(pMvdat->mvmtdat.interLong, pMvdat->lastEndPPS, dgap); // ʼٶ + if (dgap > 0) + { + if (tabstpps > pMvdat->runPPS) + { + tabstpps = pMvdat->runPPS; + } + } + else + { + if (tabstpps < pMvdat->runPPS) + { + tabstpps = pMvdat->runPPS; + } + } + + if (pMvdat->execCount == 0) // δִһα + { + pMvdat->lastEndPPS = tabstpps; + // printf("set endpps=%d\r\n", pMvdat->lastEndPPS); + } + } + + //----------- + stidx = GetDatIndex(); // ¼ʼ + + memset(&(pMvdat->mvmtdat), 0, sizeof(MovementDat)); + + vlen = 0; // + vsource = 0; + + if (GetDatIndex() < GetFileItemNums()) // + { +// printf("Fill data idx=%d\r\n", GetDatIndex()); + + do + { + rslt = GetADataItem(0, GetDatIndex(), &datItem); + + if (rslt == 0) + { +// if(pFlCtrl->dtype == DATA_OPTI) // ˿ +// { +// printf("DATA_OPTI:dx=%d, dy=%d\r\n", datItem.dx, datItem.dy); +// } +// if(pFlCtrl->dtype == DATA_PRESSURE) // ѹ +// { +// printf("DATA_PRESSURE:dx=%d, dy=%d\r\n", datItem.dx, datItem.dy); +// } + + if (datItem.ctrl == (u8)(pFlCtrl->dtype) && // ͬݵǰ + 1 ) + { + // ٶȿƼ򻯴 + if (pMvdat->fillCount != 0 && (abs(datItem.dr) > pFlCtrl->slowAngle)) // datItem.dx < 0 ǵһ䣬ҽǶȲڽٽǶȣݣʹ˶ͣһ£ + { + rslt = 1; + break; + } + +#if (1) // תᵶǶ + if ( pFlCtrl->dtype == DATA_DRAWING || // + 0 ) + { + + if (pMvdat->fillCount != 0 && (abs(datItem.dr) > pFlCtrl->liftAngle)) // ǵһ䣬ҽǶȲתᵶǶȣݣʹ˶ͣһ£ + { + // printf("1. dr=%d, is more than lift angle\r\n", datItem.dr); + rslt = 1; + break; + } + datItem.dr -= pFlCtrl->liftofst; // + } + +#endif + + if (datItem.dx != 0 || datItem.dy != 0 || datItem.dr != 0) // ǿ + { + if(pFlCtrl->dtype == DATA_OPTI) // ˿ + { + dirx = 0; + diry = 0; + dirr = 0; + dirp = 0;//MTP_1PulseToP1Pulse(datItem.len)*COMPENSATE_SPIN; + dirs = 0;//MTS1_IsSpin1PulseToS1Pulse(datItem.len); + } + else if(pFlCtrl->dtype == DATA_PRESSURE) + { + dirx = 0; + diry = 0; + dirr = 0; + dirp = 0; + dirs = 0; + } + else + { + dirx = datItem.dx; + diry = datItem.dy; + dirr = datItem.dr; + dirp = 0; + dirs = MTS1_IsWire001PulseToS1Pulse(datItem.len)*g_pOpticalMcPara->LevelOfAccAndDec/100; + + + rslt = sendOpticalTaskWhenRun();//Զ͹ +#if(AFTERTURN_COMPEN == 1) + XYCompenCalcuAfterTurning(datItem);//ת󲹳 +#endif + +#if(MATERIAL_SCAN == 1) +// if (dirs != 0) +// { +// g_optWorkCtrl.IsNoMaterialEn = 1; +// } +// else +// { +// g_optWorkCtrl.IsNoMaterialEn = 0; +// } + + rslt = isEmptyMaterialSta(datItem.len); // ߼ + +#endif + + if(g_optWorkCtrl.compenFlag1 == 1)//תв + { + dirx += g_optWorkCtrl.xCompenAfterTurn; + diry += g_optWorkCtrl.yCompenAfterTurn; + g_optWorkCtrl.compenFlag1 = 0; + + g_optWorkCtrl.oldXCompenAfterTurn = g_optWorkCtrl.xCompenAfterTurn; + g_optWorkCtrl.oldYCompenAfterTurn = g_optWorkCtrl.yCompenAfterTurn; + } + +// printf("rPos = %d, xPos = %d, yPos = %d,\r\n",g_motosPara.motosPos[MTR1_IDX],g_motosPara.motosPos[MTX_IDX],g_motosPara.motosPos[MTY_IDX]); + + //printf("idx = %d, dx = %d, dy = %d\r\n",g_workCtrl.cursta.dataIdx,datItem.dx,datItem.dy); + //printf("idx = %d, dr = %d,\r\n",g_workCtrl.cursta.dataIdx,datItem.dr); + } + + if (pFlCtrl->exdir == EXDIR_NEGA) // + { + dirx *= (-1); + diry *= (-1); + dirr *= (-1); + } +#if (XY_GAP_CONVERT == 1) + { +// g_optWorkCtrl.disosft = 1; + dirx = XGapConvert(dirx); // ϶ת + diry = YGapConvert(diry); +// g_optWorkCtrl.disosft = 0; + } +#endif + // 㵥λݵλ֮һ, λ10000p/c + if (dirr != 0) + { + dirr = PitkToRpp(dirr); + } + + mvmtx = abs(dirx) & 0x7fff; + mvmty = abs(diry) & 0x7fff; + mvmtr = abs(dirr) & 0x7fff; + mvmtp = abs(dirp) & 0x7fff; + mvmts = abs(dirs) & 0x7fff; + + if (dirx < 0) + { + mvmtx |= 0x8000; + } + + if (diry < 0) + { + mvmty |= 0x8000; + } + + if (dirr < 0) + { + mvmtr |= 0x8000; + } + + if (dirp < 0) + { + mvmtp |= 0x8000; + } + + if (dirs < 0) + { + mvmts |= 0x8000; + } + + vlen = datItem.len; + vlen *= OPTICALVX_MUTI; + + if (vlen < (abs(dirr) & 0x7fff)) + { + vlen = abs(dirr) & 0x7fff; + vsource = 1; + } + + vsource = vsource; + + memset(&(pMvdat->mvmtdat), 0, sizeof(MovementDat)); + + pMvdat->mvmtdat.movement[MTX_IDX][0] = mvmtx; + pMvdat->mvmtdat.movement[MTY_IDX][0] = mvmty; + pMvdat->mvmtdat.movement[MTR1_IDX][0] = mvmtr; + + if( pFlCtrl->dtype == DATA_DRAWING) // + { + //ٶƥ + if(IsOptStoringHigh2() == SENSOR_ON ) + { + pMvdat->mvmtdat.movement[MTS1_IDX][0] = mvmts/g_pOpticalMcPara->LevelOfAccAndDec; + } +// else if(IsOptStoringHigh1() == SENSOR_ON) +// { +// pMvdat->mvmtdat.movement[MTS1_IDX][0] = mvmts*g_pOpticalMcPara->LevelOfAccAndDec; +// } + else + { + pMvdat->mvmtdat.movement[MTS1_IDX][0] =mvmts; + } + //ϵת + pMvdat->mvmtdat.movement[MTP1_IDX][0] = 0; + } + else if(pFlCtrl->dtype == DATA_OPTI) // ˿ + { +// //ٶƥ +// if(IsOptStoringHigh2() == SENSOR_ON ) +// { +// pMvdat->mvmtdat.movement[MTS1_IDX][0] = mvmts/g_pOpticalMcPara->LevelOfAccAndDec; +// } +// else if(IsOptStoringHigh1() == SENSOR_ON) +// { +// pMvdat->mvmtdat.movement[MTS1_IDX][0] = mvmts*g_pOpticalMcPara->LevelOfAccAndDec; +// } +// else +// { +// pMvdat->mvmtdat.movement[MTS1_IDX][0] = mvmts; +// } +// //ϵת +// pMvdat->mvmtdat.movement[MTP1_IDX][0] = mvmtp; +// pFlCtrl->maxpps /= 7; +// +// vlen = vlen > abs(dirs) ? vlen : abs(dirs); +// vlen = vlen > abs(dirp) ? vlen : abs(dirp); +// vlen *= OPTICALVX_MUTI; + } + + pMvdat->mvmtdat.interLong = vlen; + + pMvdat->mvmtdat.segmnetNum[MTX_IDX] = 1; // + pMvdat->mvmtdat.vppSegment[MTX_IDX] = vlen; + + pMvdat->mvmtdat.segmnetNum[MTY_IDX] = 1; // + pMvdat->mvmtdat.vppSegment[MTY_IDX] = vlen; + + pMvdat->mvmtdat.segmnetNum[MTS1_IDX] = 1; // + pMvdat->mvmtdat.vppSegment[MTS1_IDX] = vlen; + + pMvdat->mvmtdat.segmnetNum[MTP1_IDX] = 1; // + pMvdat->mvmtdat.vppSegment[MTP1_IDX] = vlen; + + pMvdat->mvmtdat.segmnetNum[MTR1_IDX] = 1; // + pMvdat->mvmtdat.vppSegment[MTR1_IDX] = vlen; + + + // ٶȿ + if (pMvdat->runstat == CRST_NORMAL) + { + if (rslt == 0) + { + u32 decCount, mintpps, temp; + u32 idx; // СĿٶȺλ + DataItem oldItem; + + if (pMvdat->lastEndPPS == 0) // һ + { + mintpps = pFlCtrl->maxpps; + pMvdat->lastEndPPS = pFlCtrl->minpps; + // printf("first begin spd calc\r\n"); + } + else + { +#define DRLVBO_NUM 10 // ѭ + s32 dracc = 0; // ۼƽǶȱ仯 + int queueidx = 0; + s16 drqueue[DRLVBO_NUM]; + memset(drqueue, 0, sizeof(s16)*DRLVBO_NUM); + // printf("other spd calc\r\n"); + + decCount = CalcDisplacement(tabstpps, pFlCtrl->minpps, pFlCtrl->addppsg); // ӱʼٶȽٵҪλ + // printf("decCount = %d\r\n", decCount); + + // ɨݣҵٵ + mintpps = pFlCtrl->maxpps; // СٶȳֵΪиٶ + idx = stidx; + memset(&tempItem, 0, sizeof(DataItem)); + + while (decCount > 0) + { + idx++; + memcpy(&oldItem, &tempItem, sizeof(DataItem)); + rslt = GetADataItem(0, idx, &tempItem); // һ + if (rslt == 0) + { + // õǰҪٶ + if (tempItem.ctrl == (u8)(pFlCtrl->dtype)) // ͬ + { + dracc -= drqueue[queueidx]; // ȥǰ + drqueue[queueidx] = abs(tempItem.dr); + dracc += drqueue[queueidx]; // µ + queueidx++; + if (queueidx >= DRLVBO_NUM) + { + queueidx = 0; + } + if (dracc > pFlCtrl->slowAngle || + dracc > pFlCtrl->liftAngle ) + { + // printf("dracc=%d, more than slow or lift angle idx=%d\r\n", dracc, idx); + temp = pFlCtrl->minpps; // 򻯴ֱӽٵ + } + else + { + if (((oldItem.dx * tempItem.dx) < 0) || + ((oldItem.dy * tempItem.dy) < 0) || // ı + 0 ) + { + if (abs(tempItem.dr) > pFlCtrl->slowAngle) // ǶȲڽٽǶȣҪ + { + // ٶȿƼ򻯴 + // printf("2. dr=%d, is more than slow angle\r\n", tempItem.dr); + // ɨ費ܶ룬Ҫٵĵ㣬Ϊǵٶ0ԵǰٶΪٵijʼٶȣҵ⵽ٵ㣬ôΪڵλõٵľ붼ǽ + temp = pFlCtrl->minpps; // 򻯴ֱӽٵ + } + else if (abs(tempItem.dr) > pFlCtrl->liftAngle) + { + // printf("2. dr=%d, is more than lift angle\r\n", tempItem.dr); + temp = pFlCtrl->minpps; // 򻯴ֱӽٵ + } + else + { + temp = mintpps; + } + } + else + { + temp = mintpps; + } + } + } + else + { + // ֱͬͣӽٵ + // printf("other type, use minpps\r\n"); + temp = pFlCtrl->minpps; // Ŀٶ + } + + if (mintpps > temp) // Сٶȴڵǰٶ + { + // printf("begin slow\r\n"); + mintpps = temp; // ʼ + break; + } + + if (decCount > tempItem.len*OPTICALVX_MUTI) + { + decCount -= tempItem.len*OPTICALVX_MUTI; + } + else + { + decCount = 0; + } + } + else + { + printf("data end, use minpps\r\n"); + mintpps = pFlCtrl->minpps; // Ŀٶ + break; + } + } + } + + pMvdat->lowPPS = pFlCtrl->minpps; + pMvdat->runPPS = mintpps; + pMvdat->calcGap = pFlCtrl->addppsg; + + // printf("curpps=%d, idx=%d, lowPPS=%d, runPPS=%d, calcGap=%d\r\n", curpps, pMvdat->fillCount, pMvdat->lowPPS, pMvdat->runPPS, pMvdat->calcGap); + // printf("curpps=%d, idx=%d, runPPS=%d\r\n", curpps, pMvdat->fillCount, pMvdat->runPPS); + } + } + + pMvdat->waitNoData = 1; // ݲͣ־ + pMvdat->mvmtStatus = 1; // Ч־ + } + + pFlCtrl->liftofst = 0; + if (pFlCtrl->exdir == EXDIR_NEGA) // + { + DatIndexDec(); + ChangeWorkPos(&datItem, -1); + } + else + { + DatIndexInc(); + rslt = GetADataItem(0, GetDatIndex(), &datItem); + ChangeWorkPos(&datItem, 1);//ı + } + + if (datItem.dx == 0 && datItem.dy == 0 && datItem.dr == 0) // ǿ + { + //continue; + } + } + else + { + rslt = 1; +// printf("fill type not equ, enter stop phase\r\n"); + break; + } + } + else + { + printf("GetADataItem rslt = %d\r\n", rslt); + } + + break; + }while(1); + } + else + { + // printf("Fill err idx=%d, stitches=%d\r\n", GetDatIndex(), GetFileItemNums()); + } + } + else + { + // ݣʱ֧ + } + } + + if (pMvdat->runstat == CRST_NSTOP || // ֹͨͣ׼ֹͣɲ״̬ + pMvdat->runstat == CRST_QSTOP || // ֹͣ׼ֹͣɲ״̬ + 0 ) + { + pMvdat->lowPPS = pFlCtrl->minpps; + pMvdat->runPPS = pFlCtrl->minpps; // ٶ + pMvdat->calcGap = pFlCtrl->addppsg; // ټٶ + + printf("in stop status, xy move\r\n"); + pMvdat->runstat = CRST_BREAK; // ɲ״̬ + } + + if (pMvdat->runstat == CRST_BREAK && + pMvdat->fillLimit == 0 && + pMvdat->waitNoData != 0 && + 1 ) + { + pMvdat->waitNoData = 0; // ֹͣ + } + return 0; +} + +#if(AFTERTURN_COMPEN == 1) +void XYCompenCalcuAfterTurning(DataItem datItem) +{ + if(((datItem.dx != 0) || (datItem.dy != 0)) && (datItem.attr != DATA_PRESSURE)) + { + if((datItem.dr == 0) && (g_optWorkCtrl.runSteps1 == 0))//ֱ + { + g_optWorkCtrl.runSteps1 = 10; + } + else if((datItem.dr != 0) && (g_optWorkCtrl.runSteps1 == 10))// + { + g_optWorkCtrl.begainRBeforeWiring = g_workCtrl.workPos[MTR1_IDX];//㲹 + g_optWorkCtrl.runSteps1 = 20; + } + else if((datItem.dr == 0) && (g_optWorkCtrl.runSteps1 == 20))//֮ + { + g_optWorkCtrl.xCompenAfterTurn = g_pOpticalMcPara->rkMatThickness/100*cos(g_optWorkCtrl.begainRBeforeWiring/10000) - g_optWorkCtrl.oldXCompenAfterTurn; + g_optWorkCtrl.yCompenAfterTurn = g_pOpticalMcPara->rkMatThickness/100*sin(g_optWorkCtrl.begainRBeforeWiring/10000) - g_optWorkCtrl.oldYCompenAfterTurn; + g_optWorkCtrl.compenFlag1 = 1; + g_optWorkCtrl.runSteps1 = 0; + } + } +} +#endif +//------------------------------------------------------------------------------- +int IsSignalTimeout(u8 (* func)(void), int timeoutMs, int err) +{ + if(SIGNAL_TIMEOUT_ENABLE == 0) + { + return 0; + } + do + { + DelayRef(1); + timeoutMs--; + if(timeoutMs < 0) + { + return err; + } + if(func() == SENSOR_ON) + { + return 0; + } + }while(1); + +} +//------------------------------------------------------------------------------- +s16 Rot001ToPitk(s32 ang001) +{ + double temp = ang001; + temp = ROT_001DEG_TO_PITK(temp); + return (s16)temp; +} + +int toActSpinLen(int theorySpin) +{ + theorySpin = theorySpin * g_pOpticalMcPara->SpinCompenCalBase / g_pOpticalMcPara->SpinCompenCalActLen; + return theorySpin; +} +//------------------------------------------------------------------------------- +// иƹ +// ֧ ƫ, Ǻţʣ⵶𵶣Բ + +//#define CUTTER_CUTTING 0x00000020 // bit5, и־ , = 1 и +//#define CUTTER_CUT_OVER 0x00000040 // bit6, иɱ־ , = 1 и +//#define CUTTER_RUNNING 0x00000100 // bit8, б־ , = 1 + +int OpticalWork(int mode) +{ + + int err, rslt, ret; + ContinuousInterMoveCtrl cmctrl; + OpticalFillCtrl fillctrl; + DataItem curDat, oldDat, tmpDat; + + u8 oldDataForOffset = 0; + int xIdx; + int yIdx; + int p1Idx, r1Idx, s1Idx; + + int spinLen = 0; + + int spinLenForOffset = 0; + + int idx, idxbuf, count, begIdx; + + idxbuf = 0; + err = IsAutoMoveEnable(); // иǰж + + // жݺϷ + AddNewFileOffset(); + + getOptBorderWhenWork(); + + if (err == ERR_NONE) + { + err = CheckFileRange(); + } + + if (err != ERR_NONE) + { + ReportError(err); + return err; + } + + //ʼĴ + { + g_optWorkCtrl.isEndOfSpinFlag = 0; + g_optWorkCtrl.runSteps1 = 0; + g_optWorkCtrl.compenFlag1 = 0; + g_optWorkCtrl.IsNoMaterialFlag = 2; + g_optWorkCtrl.IsNoMaterialScanLen = g_pOpticalMcPara->materialFreeScanNum; + g_optWorkCtrl.IsNoMaterialEn = 1; + err = OpticalCloseAll(); + // + FanMotosOn(); // 翪 + if (err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + } + } + + + if (err == ERR_NONE) + { + // Ч + if (IsDatIndexAvailable(g_workCtrl.cursta.dataIdx) != TRUE) + + { + SetDatIdxToStart(); + } + + if (g_workCtrl.cursta.dataIdx != 0) + {// ǰҵ˿ + DataItem chackDat; + + do + { + GetADataItem(0, g_workCtrl.cursta.dataIdx, &chackDat); + + if(chackDat.ctrl == DATA_OPTI)//жǷ˿ƫ + { + break; + } + else + { + g_workCtrl.cursta.dataIdx--; + if (g_workCtrl.cursta.dataIdx == 0) + { + break; + } + } + }while(1); + printf("find near opti data to file idx=%d\r\n", g_workCtrl.cursta.dataIdx); + } + + { + GetWorkPosFromIndex(); + } + } + + if (err == ERR_NONE) + { + // XYRߵȷĹλ + rslt = GetADataItem(0, GetDatIndex(), &curDat); + if (rslt != 0) + { + err = STA_WORK_OVER; // + } + else + { + FixMatCylinderOn(); + DelayRef(10); + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + + ReadMotosPos(); + if(g_workCtrl.workPos[MTX_IDX] <= g_motosPara.motosPos[MTX_IDX]) + { + g_workCtrl.workPos[MTX_IDX] -= g_pOpticalMcPara->startPosoffx; + g_optWorkCtrl.usecomx = 1; + } + if(g_workCtrl.workPos[MTY_IDX] <= g_motosPara.motosPos[MTY_IDX]) + { + g_workCtrl.workPos[MTY_IDX] -= g_pOpticalMcPara->startPosoffy; + g_optWorkCtrl.usecomy = 1; + } +/* if (err == ERR_NONE) + { + err = MoveXYToPos(-1100, -6000, NULL); + }*/ + if (err == ERR_NONE) + { + err = MoveXYRS1P1ToWorkPos(&curDat, NULL, 1, 0); + } + + if(g_optWorkCtrl.usecomx == 1 || + g_optWorkCtrl.usecomy == 1) + { + if(g_optWorkCtrl.usecomx == 1) + { + g_workCtrl.workPos[MTX_IDX] += g_pOpticalMcPara->startPosoffx; + g_optWorkCtrl.usecomx = 0; + } + if(g_optWorkCtrl.usecomy == 1) + { + g_workCtrl.workPos[MTY_IDX] += g_pOpticalMcPara->startPosoffy; + g_optWorkCtrl.usecomy = 0; + } + if (err == ERR_NONE) + { + err = MoveXYRS1P1ToWorkPos(&curDat, NULL, 1, 0); + } + } + } + } + + // ʼݿ + memset(&fillctrl, 0, sizeof(OpticalFillCtrl)); // + memset(&oldDat, 0, sizeof(DataItem)); + if (g_workCtrl.cursta.dataIdx != 0) + { + GetADataItem(0, (g_workCtrl.cursta.dataIdx - 1), &oldDat); + } + if (err == ERR_NONE) + { + if (mode == WKMD_BACKWORD) + { + fillctrl.exdir = EXDIR_NEGA; // Ϊ + rslt = DatIndexDec(); + if (rslt < 0) + { + err = STA_WORK_OVER; // + } + } + else + { + fillctrl.exdir = EXDIR_POSI; // Ϊ + } + + if (mode == WKMD_SIMULATION) + { + fillctrl.simulation = 1; // ģִ + } + } + + if (err != ERR_NONE) + { + return err; + } + + g_workCtrl.cursta.workStatus |= (WORK_STA_BUSY|WORK_STA_WORKING); // æ־ + + // ʼƽṹ + xIdx = MTX_IDX; + yIdx = MTY_IDX; + p1Idx = MTP1_IDX; + r1Idx = MTR1_IDX; + s1Idx = MTS1_IDX; + + + memset(&cmctrl, 0, sizeof(ContinuousInterMoveCtrl)); // + cmctrl.vAxisId = VAXIS_ID1; // ʹ1 + cmctrl.motosConfig.newConfig = 0; // Ҫ + +#if (MODULE_X != 0) + cmctrl.motosConfig.axisConfig[xIdx].axisConfig = MTX_CFG; // ʵ + cmctrl.motosConfig.axisConfig[xIdx].poutType = MTX_OTP; // ģʽ(CW/CCWPULSE/DIR) + cmctrl.motosConfig.axisConfig[xIdx].spdSource = MAKE_POUT_CMD(cmctrl.vAxisId); // ʵٶȿģʽ(123) + cmctrl.motosConfig.axisConfig[xIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if (MODULE_Y != 0) + cmctrl.motosConfig.axisConfig[yIdx].axisConfig = MTY_CFG; // ʵ + cmctrl.motosConfig.axisConfig[yIdx].poutType = MTY_OTP; // ģʽ(CW/CCWPULSE/DIR) + cmctrl.motosConfig.axisConfig[yIdx].spdSource = MAKE_POUT_CMD(cmctrl.vAxisId); // ʵٶȿģʽ(123) + cmctrl.motosConfig.axisConfig[yIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) // ˶0˶˶ȣλp +#endif + +#if (TURN_R1 != 0) + cmctrl.motosConfig.axisConfig[r1Idx].axisConfig = MTR1_CFG; // ʵ + cmctrl.motosConfig.axisConfig[r1Idx].poutType = MTR1_OTP; // ģʽ(CW/CCWPULSE/DIR) + cmctrl.motosConfig.axisConfig[r1Idx].spdSource = MAKE_POUT_CMD(cmctrl.vAxisId); // ʵٶȿģʽ(123) + cmctrl.motosConfig.axisConfig[r1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if (MODULE_SEND != 0) + cmctrl.motosConfig.axisConfig[s1Idx].axisConfig = MTS1_CFG; // ʵ + cmctrl.motosConfig.axisConfig[s1Idx].poutType = MTS1_OTP; // ģʽ(CW/CCWPULSE/DIR) + cmctrl.motosConfig.axisConfig[s1Idx].spdSource = MAKE_POUT_CMD(cmctrl.vAxisId); // ʵٶȿģʽ(123) + cmctrl.motosConfig.axisConfig[s1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + +#if (MODULE_PULL != 0) + cmctrl.motosConfig.axisConfig[p1Idx].axisConfig = MTP1_CFG; // ʵ + cmctrl.motosConfig.axisConfig[p1Idx].poutType = MTP1_OTP; // ģʽ(CW/CCWPULSE/DIR) + cmctrl.motosConfig.axisConfig[p1Idx].spdSource = MAKE_POUT_CMD(cmctrl.vAxisId); // ʵٶȿģʽ(123) + cmctrl.motosConfig.axisConfig[p1Idx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) +#endif + + cmctrl.Delay = DelayRef; // ʱص + cmctrl.RefreshData = OpticalRefreshDat; // ˢº + cmctrl.refDatPara = (u32)(&fillctrl); // ˢ² + cmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص // + cmctrl.refPosPara = 0; // ˢ² + + cmctrl.WorkBeforeRun = NULL; + cmctrl.WorkAfterRun = NULL; + cmctrl.workPara1 = (u32)(&fillctrl); + cmctrl.workPara2 = 0; + + + cmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + cmctrl.GetNormalStop = OpticalNStopScan; // һֹͣ Ϊʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + cmctrl.GetQuickStop = OpticalQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + cmctrl.GetEmergencyStop = OpticalEmcScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + cmctrl.condPara1 = (u32)(&fillctrl); + cmctrl.condPara2 = 0; // + +// ִѭ + do + { + // ȡһ + err = ERR_NONE; + rslt = GetADataItem(0, GetDatIndex(), &curDat); + + if(curDat.ctrl == DATA_OPTI) + { + curDat.ctrl = DATA_DRAWING; + } + + if (GetDatIndex() < GetFileItemNums()) + { + rslt = GetADataItem(0, GetDatIndex(), &curDat); + if (rslt != 0) + { + err = STA_WORK_OVER; // + } + } + else + { + err = STA_WORK_FINISH; // + } + + //printf("Get a data item [idx=%d], ctrl=0x%x, dr=%d\r\n", GetDatIndex(), curDat.ctrl, curDat.dr); + + if (err != ERR_NONE) + { + if (mode == WKMD_BACKWORD) // + { + rslt = DatIndexInc(); + } + printf("err at get step data\r\n"); + break; + } + + if ((oldDat.ctrl != curDat.ctrl) && + !(oldDat.ctrl == DATA_DRAWING && curDat.ctrl == DATA_PRESSURE) && + !(curDat.ctrl == DATA_DRAWING && oldDat.ctrl == DATA_PRESSURE) + ) + { + oldDataForOffset = oldDat.ctrl; + //߽Ķ + if((oldDat.ctrl == DATA_DRAWING || oldDat.ctrl == DATA_PRESSURE) && g_optWorkCtrl.motopreFlag == 1) + { + FixMatCylinderOff();//ɿ + DelayRef(300); + UpClipMatClipCylinderOff();//ϼɿ + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOff, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼϻλ + + PreMatCylinderOn();//ѹ + DelayRef(200); + + if(err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + } + if(err == ERR_NONE) + { + //FixMatCylinderOn();//϶ + PreMatCylinderOff();//ѹɿ + } + //err = IsSignalTimeout(IsOptPreLiftUp, CYLINDER_TIMEOUT, 0x0E00);//ѹϻλ + g_optWorkCtrl.motopreFlag = 0; + + if (err != ERR_NONE) + { + ReportError(err); + break; + } + + g_optWorkCtrl.xCompenAfterTurn = 0; + g_optWorkCtrl.yCompenAfterTurn = 0; + g_optWorkCtrl.silkRetreat = 1; + } + + if(oldDat.ctrl == DATA_OPTI && g_optWorkCtrl.motoRunFlag == 1) + {//˿Ķ + + if(g_optWorkCtrl.cutingFlag == 1) + {// + err = IsSignalTimeout(IsOptPreLiftUp, CYLINDER_TIMEOUT, 0x002F);//ѹ׻λ + if(err == ERR_NONE) + { + DelayRef(200); + TrimmingCylinderOn(); //׿ + DelayRef(200); + TrimmingCylinderOff(); //׹ + DelayRef(100); + } + } + + if(err == ERR_NONE) + { + if(g_optWorkCtrl.cutingFlag == 1) + { + err = MoveP1S1AsOffset(g_pOpticalMcPara->beforeSpinLen,NULL);//Ԥ˿ + g_optWorkCtrl.cutingFlag = 0; + g_optWorkCtrl.lowingFlag = 0; + } + + if(err == ERR_NONE) + { + FixMatCylinderOn();//϶ + DelayRef(200); + DownClipMatClipCylinderOff();//¼ɿ + UpClipMatClipCylinderOff();//ϼɿ + DelayRef(200); + IsBlowingCylinderOff();//ջ + DelayRef(500); + if(g_optWorkCtrl.silkRetreat == 1) + { + g_optWorkCtrl.silkRetreat = 0; + //ص˿λ + err = MoveXYToPos(g_optWorkCtrl.opitPosx, g_optWorkCtrl.opitPosy, NULL); + if (err != ERR_NONE) + { + ReportError(err); + break; + } + DelayRef(100); + } + if(g_optWorkCtrl.lowingFlag == 1) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkLowPos, NULL);//ͷ½ + } + } + } + + if (err != ERR_NONE) + { + ReportError(err); + break; + } + } + + // ˿ݶ + if (curDat.ctrl == DATA_OPTI) + { + g_optWorkCtrl.motoRunFlag = 1; + err = MoveR1ToPos(2500, NULL);//ת˿λ:90 + + if(err == ERR_NONE) + { + PreMatCylinderOff();//ѹɿ + err = IsSignalTimeout(IsOptPreLiftUp, CYLINDER_TIMEOUT, 0x002F);//ѹ׻λ + } + + if(err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//ͷ̧ + + if(err == ERR_NONE) + { + TrimmingCylinderOn(); //׿ + DelayRef(300); + IsBlowingCylinderOn();// + DelayRef(700); + DownClipMatClipCylinderOn();//¼ϼ + DelayRef(700); + err = IsSignalTimeout(DownClipMatClipCylinderPlaceOn, CYLINDER_TIMEOUT, ERR_DOWNCLIP_ERROR);//¼ϳλ + TrimmingCylinderOff(); //׹ + } + DelayRef(300); + UpClipMatClipCylinderOn();//ϼϼ + } + + if(err == ERR_NONE) + { + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOn, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼ-λ + FixMatCylinderOff(); + DelayRef(300); + } + + if(g_optWorkCtrl.isEndOfSpinFlag == 1) + { + if(curDat.len > (spinLenForOffset/100)) + { + spinLen = curDat.len - (spinLenForOffset/100); + } + else + { + spinLen = 0; + } + g_optWorkCtrl.isEndOfSpinFlag = 0; + } + else + { + spinLen = curDat.len; + } + + if(err == ERR_NONE) + { + printf("spin actpos=(%d,%d)\r\n", g_motosPara.motosPos[MTX_IDX],g_motosPara.motosPos[MTY_IDX]); + g_optWorkCtrl.IsNoMaterialEn = 1; + err = MoveP1S1AsOffset(spinLen,NULL);//˿ + } + if (err != ERR_NONE) + { + ReportError(err); + break; + } + } + + // ݶ + if (curDat.ctrl == DATA_DRAWING )//|| curDat.ctrl == DATA_PRESSURE) + { + g_optWorkCtrl.IsNoMaterialScanLen = g_pOpticalMcPara->materialFreeScanNum; + + g_optWorkCtrl.oldXCompenAfterTurn = 0; + g_optWorkCtrl.oldYCompenAfterTurn = 0; + + if(err == ERR_NONE) + { + g_optWorkCtrl.motopreFlag = 1; + err = MoveR1ToPos(PitkToRpp(g_workCtrl.workPos[MTR1_IDX]),NULL); + if (err == ERR_NONE) + { + err = MoveXYRS1P1SToWorkPos(&curDat, 0); // ߵȷλ + } + + + if(err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkLowPos, NULL);//ͷ½ + PreMatCylinderOn();//ѹ + DelayRef(200); + PreMatCylinderOff();//ѹɿ + DelayRef(300); + UpClipMatClipCylinderOn();//ϼϼ + } + if(err == ERR_NONE) + { + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOn, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼϳλ + } + + FixMatCylinderOff();//ɿ + } + + if (err != ERR_NONE) + { + ReportError(err); + break; + } + } + } + + // ѹݶ + if(curDat.ctrl == DATA_PRESSURE) + { + PreMatCylinderOn();//϶ + DelayRef(200); + PreMatCylinderOff();//ɿ + DelayRef(300); + } + + memcpy(&oldDat, &curDat, sizeof(DataItem)); + + // ɨݣȷͬݵĸ + begIdx = GetDatIndex(); + idx = begIdx; + count = 0; // ֵ + do + { + + count++; + if (fillctrl.exdir == EXDIR_POSI) // ִ + { + idx++; + } + else if (fillctrl.exdir == EXDIR_NEGA) // ִ + { + if (idx != 0) + { + idx--; + } + } + + if (idx < GetFileItemNums()) + { + rslt = GetADataItem(0, idx, &tmpDat); + if (rslt != 0) + { + break; + } + } + else + { + break; + } + + if (curDat.ctrl != tmpDat.ctrl) + { + break; + } + + if (0) + { + if (idxbuf < idx) + { + idxbuf = idx; + //printf("[idx=%d], ctrl=0x%x, dr=%d\r\n", idx, curDat.ctrl, curDat.dr); + if ((idx % 20) == 0) + { + DelayRef(10); + } + } + } + + }while(1); + + // printf("Get data, ctrl = 0x%x, begidx=%d, num=%d\r\n", curDat.ctrl, begIdx, count); + + cmctrl.motosConfig.newConfig = 0; // Ҫ + + fillctrl.dtype = curDat.ctrl; // ˶ = ֽ + fillctrl.runIdx = 0; // м + fillctrl.runnum = count; // е߶ + + + // гȣȷٶ + memset(&(cmctrl.mvData), 0, sizeof(MoveSwapData)); + + if (curDat.ctrl == DATA_DRAWING || curDat.ctrl == DATA_OPTI) + { + fillctrl.minpps = VAxisMMPSToPPS(g_pOpticalMcPara->minRkOptSpd); // Сٶ + fillctrl.maxpps = VAxisMMPSToPPS(g_pOpticalMcPara->maxRkOptSpd); // ٶ + fillctrl.addppsg = VAxisMMPSSToPPSG(g_pOpticalMcPara->rkOptAdd); + fillctrl.minadd = VAxisMMPSSToPPSG(g_pOpticalMcPara->rkOptAdd); + + if (fillctrl.minadd < MIN_GAP) + { + fillctrl.minadd = MIN_GAP; + } + else if (fillctrl.minadd > MAX_GAP) + { + fillctrl.minadd = MAX_GAP; + } + fillctrl.addadd = MAX_GAP; + + // ٽǶ + fillctrl.slowAngle = Rot001ToPitk(g_pOpticalMcPara->rkOptSlowAngle); + fillctrl.liftAngle = Rot001ToPitk(g_pOpticalMcPara->rkLiftAng); + + cmctrl.stopPPS = VAxisMMPSToPPS(g_pOpticalMcPara->minRkOptSpd); // ͣٶ + cmctrl.nstopPPSG = VAxisMMPSSToPPSG(g_pOpticalMcPara->rkOptAdd); // ֹͨͣٶ + cmctrl.qstopPPSG = VAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); // ֹͣٶ + } + + // ٶ + fillctrl.minchgpps = VAxisMMPSToPPS(g_pOpticalMcPara->optMinSpd*1.0); +// printf("calc slowAngle = %d, liftAngle=%d, minchgpps=%d\r\n", fillctrl.slowAngle, fillctrl.liftAngle, fillctrl.minchgpps); + +// printf("\r\nbefore ContinuousInterpolation, dataidx=%d\r\n", g_workCtrl.cursta.dataIdx); +// printf("workpos: x=%d, y=%d\r\n", g_workCtrl.workPos[MTX_IDX], g_workCtrl.workPos[MTY_IDX]); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + + rslt = ContinuousInterpolation(&cmctrl); // 岹˶ + +// printf("after ContinuousInterpolation, dataidx=%d, rslt=%d\r\n", g_workCtrl.cursta.dataIdx, rslt); +// printf("workpos: x=%d, y=%d\r\n", g_workCtrl.workPos[MTX_IDX], g_workCtrl.workPos[MTY_IDX]); +// printf("actpos: x=%d, y=%d\r\n", g_motosPara.motosPos[MTX_IDX], g_motosPara.motosPos[MTY_IDX]); + + +#if(MATERIAL_SCAN == 1) +// g_optWorkCtrl.IsNoMaterialEn = 0; +// g_optWorkCtrl.IsNoMaterialScanLen = TBDSCAN_NUM; +#endif + + // 쳣ֹͣ£ЩûִУ + idx = GetDatIndex(); // ǰָ + if (idx < begIdx) + { + count = begIdx-idx; + } + else + { + count = idx - begIdx; + } +// printf("datcount=%d, fillCount=%d, execCount=%d\r\n", count, cmctrl.mvData.fillCount, cmctrl.mvData.execCount); +#if (0) + idx = cmctrl.mvData.fillCount; // +#else + idx = count; // ƶָ +#endif + if(idx > cmctrl.mvData.execCount) // ݴִ + { + //printf("fill data are not be execed, idx=%d\r\n", idx); + if (fillctrl.exdir == EXDIR_POSI) + { + ret = GetADataItem(0, g_workCtrl.cursta.dataIdx, &tmpDat); + ChangeWorkPos(&tmpDat, -1); + ret = DatIndexDec(); + if (ret < 0) + { + err = STA_WORK_OVER; // + } + } + else if (fillctrl.exdir == EXDIR_NEGA) + { + ret = GetADataItem(0, g_workCtrl.cursta.dataIdx, &tmpDat); + ChangeWorkPos(&tmpDat, 1); + ret = DatIndexInc(); + if (ret < 0) + { + err = STA_WORK_FINISH; // + } + } + idx--; + } + + if (err == ERR_NONE) + { + err = GetMoveResultError(rslt, cmctrl.mvData.errInfo); + } + + if (curDat.ctrl == DATA_OFFSET) // ƫ + { + g_optWorkCtrl.IsNoMaterialEn = 0; + + UpClipMatClipCylinderOff();//ϼɿ + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOff, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼϻλ + if(err != ERR_NONE) + { + ReportError(err); + break; + } + DataItem * pDat = NULL; + + //˿ȥÿβƫƲ + int datx1,daty1,datx2,daty2; + + datx1 = g_motosPara.motosPos[MTX_IDX]; + daty1 = g_motosPara.motosPos[MTY_IDX]; + + int tempx, tempy, temp; + // ɨݣõƫ + do + { + if(err != ERR_NONE) + { + break; + } + if (GetDatIndex() < GetFileItemNums()) + { + rslt = GetADataItem(0, GetDatIndex(), &tmpDat); + if (rslt != 0) + { + break; + } + pDat = &tmpDat; + + if (curDat.ctrl != tmpDat.ctrl) + { + break; + } + + memcpy(&oldDat, &curDat, sizeof(DataItem)); + + if (fillctrl.exdir == EXDIR_POSI) // ִ + { + DatIndexInc(); + } + else if (fillctrl.exdir == EXDIR_NEGA) // ִ + { + DatIndexDec(); + } + } + else + { + + break; + } + }while(1); + + GetWorkPosFromIndex(); + + datx2 = g_workCtrl.workPos[MTX_IDX]; + daty2 = g_workCtrl.workPos[MTY_IDX]; + + //߽ƫƵ˿λãжƫǰDzݣ˿ݣ + if((oldDataForOffset == DATA_DRAWING || oldDataForOffset == DATA_PRESSURE) && tmpDat.ctrl == DATA_OPTI) + { + if(g_optWorkCtrl.useGapCorx == 1) + { + g_workCtrl.workPos[MTX_IDX] -= g_pOpticalMcPara->xGapCorrect; + g_optWorkCtrl.useGapCorx = 0; + } + if(g_optWorkCtrl.useGapCory == 1) + { + g_workCtrl.workPos[MTY_IDX] -= g_pOpticalMcPara->yGapCorrect; + g_optWorkCtrl.useGapCory = 0; + } + spinLenForOffset = GetSyntheticLength(datx2 - datx1,daty2 - daty1); + g_optWorkCtrl.isEndOfSpinFlag = 1; + g_optWorkCtrl.cutingFlag = 1; + oldDataForOffset = 0; + g_optWorkCtrl.offsetToOpit = 1; + UpClipMatClipCylinderOn();//ϼϼ + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOn, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼ-λ + if(err == ERR_NONE) + { + FixMatCylinderOff();//ɿ + DelayRef(200); + + ReadMotosPos(); + if(g_workCtrl.workPos[MTX_IDX] < g_motosPara.motosPos[MTX_IDX]) + { + g_optWorkCtrl.opitPosDirx = -1; + } + else if(g_workCtrl.workPos[MTX_IDX] > g_motosPara.motosPos[MTX_IDX]) + { + g_optWorkCtrl.opitPosDirx = 1; + } + else + { + g_optWorkCtrl.opitPosDirx = 0; + } + if(g_workCtrl.workPos[MTY_IDX] < g_motosPara.motosPos[MTY_IDX]) + { + g_optWorkCtrl.opitPosDiry = -1; + } + else if(g_workCtrl.workPos[MTY_IDX] > g_motosPara.motosPos[MTY_IDX]) + { + g_optWorkCtrl.opitPosDiry = 1; + } + else + { + g_optWorkCtrl.opitPosDiry = 0; + } + + MotoSpd spd; + spd.stspSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->xymvstspSpd); + spd.runSpd = XYAxisMMPSToPPS(g_pOpticalMcPara->maxRkOptSpd); + spd.spdAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvSAdd); + spd.brkAdd = XYAxisMMPSSToPPSG(g_pOpticalMcPara->xymvbrkAdd); + + err = MoveXYRS1P1ToWorkPos(pDat, &spd, 0, 1); + + if(err != ERR_NONE) + { + ReportError(err); + break; + } + + DelayRef(50); + ReadMotosPos(); + if(g_optWorkCtrl.opitPosDirx == 1) + { + g_optWorkCtrl.opitPosx = g_motosPara.motosPos[MTX_IDX] + g_pOpticalMcPara->opitEndPosOffset; + } + else + { + g_optWorkCtrl.opitPosx = g_motosPara.motosPos[MTX_IDX]; + } + if(g_optWorkCtrl.opitPosDiry == 1) + { + g_optWorkCtrl.opitPosy = g_motosPara.motosPos[MTY_IDX] + g_pOpticalMcPara->opitEndPosOffset; + } + else if(g_optWorkCtrl.opitPosDiry == -1) + { + g_optWorkCtrl.opitPosy = g_motosPara.motosPos[MTY_IDX] - g_pOpticalMcPara->opitEndPosOffset; + } + else + { + g_optWorkCtrl.opitPosy = g_motosPara.motosPos[MTY_IDX]; + } + + g_optWorkCtrl.offsetToOpit = 0; + + //һ£һ + if(curDat.dx == 0) + { + tempx = 0; + } + else + { + tempx = -1; + } + + if(curDat.dy == 0) + { + tempy = 0; + } + else + { + tempy = -1; + } + temp = GetSyntheticLength(curDat.dx, curDat.dy); + tempx = tempx * curDat.dx * ((float)(g_pOpticalMcPara->offsetToSpinBack) / (float)(temp)); + tempy = tempy * curDat.dy * ((float)(g_pOpticalMcPara->offsetToSpinBack) / (float)(temp)); + + FixMatCylinderOn();//ϼס + DelayRef(200); + + err = MoveXYAsOffset(tempx, tempy, NULL); + + if(err != ERR_NONE) + { + ReportError(err); + break; + } + + DelayRef(200); + UpClipMatClipCylinderOff();//ϼɿ + } + + if (err != ERR_NONE) + { + ReportError(err); + break; + } + } + //ǰһ߽Ƶһʼжƫǰ˿ݣ˿ݣ + else if(oldDataForOffset == DATA_OPTI && tmpDat.ctrl == DATA_OPTI) + { + +// MoveXYToPos(-1100, -6000, NULL); + +/* if(g_workCtrl.workPos[MTX_IDX] > 65000 || + g_workCtrl.workPos[MTY_IDX] > 44000) + { + MoveXYToPos(70700, 64000, NULL); + } + else + { + MoveXYToPos(-1100, -6000, NULL); + }*/ + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + ReadMotosPos(); + if(g_workCtrl.workPos[MTX_IDX] <= g_motosPara.motosPos[MTX_IDX]) + { + g_workCtrl.workPos[MTX_IDX] -= g_pOpticalMcPara->startPosoffx; + g_optWorkCtrl.usecomx = 1; + } + if(g_workCtrl.workPos[MTY_IDX] <= g_motosPara.motosPos[MTY_IDX]) + { + g_workCtrl.workPos[MTY_IDX] -= g_pOpticalMcPara->startPosoffy; + g_optWorkCtrl.usecomy = 1; + } + if (err == ERR_NONE) + { + err = MoveXYRS1P1ToWorkPos(pDat, NULL, 1, 0); + } + + if(g_optWorkCtrl.usecomx == 1 || + g_optWorkCtrl.usecomy == 1) + { + if(g_optWorkCtrl.usecomx == 1) + { + g_workCtrl.workPos[MTX_IDX] += g_pOpticalMcPara->startPosoffx; + g_optWorkCtrl.usecomx = 0; + } + if(g_optWorkCtrl.usecomy == 1) + { + g_workCtrl.workPos[MTY_IDX] += g_pOpticalMcPara->startPosoffy; + g_optWorkCtrl.usecomy = 0; + } + if (err == ERR_NONE) + { + err = MoveXYRS1P1ToWorkPos(pDat, NULL, 1, 0); + } + } +// err = MoveXYRS1P1ToWorkPos(pDat, NULL, 1, 0); + printf("spin star actpos=(%d,%d)\r\n", g_motosPara.motosPos[MTX_IDX],g_motosPara.motosPos[MTY_IDX]); + if(err != ERR_NONE) + { + ReportError(err); + break; + } + } + //˿ƫƵλ + else + { + FixMatCylinderOn();//϶ + DelayRef(200); + ReadMotosPos(); //ʼ㵽ƫƵλúƶʼ㷴Ӽ϶ + + if(g_workCtrl.workPos[MTX_IDX] < g_motosPara.motosPos[MTX_IDX]) + { + g_workCtrl.workPos[MTX_IDX] += g_pOpticalMcPara->xGapCorrect; + g_optWorkCtrl.useGapCorx = 1; + } + if(g_workCtrl.workPos[MTY_IDX] < g_motosPara.motosPos[MTY_IDX]) + { + g_workCtrl.workPos[MTY_IDX] += g_pOpticalMcPara->yGapCorrect; + g_optWorkCtrl.useGapCory = 1; + } + err = MoveR1ToPos(PitkToRpp(g_workCtrl.workPos[MTR1_IDX]),NULL); + + if (err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkLowPos, NULL);//ͷ½ + } + + if (err == ERR_NONE) + { + err = MoveXYRS1P1ToWorkPos(pDat, NULL, 0, 0); + } + g_optWorkCtrl.lowingFlag = 1; + + if (err != ERR_NONE) + { + ReportError(err); + break; + } + } + + g_optWorkCtrl.IsNoMaterialEn = 1; + } + + else if (curDat.ctrl == DATA_NULL || curDat.ctrl == DATA_END) + { + rslt = OpticalCloseAll(); + + if (rslt == ERR_NONE && mode == WKMD_NORMAL && g_optWorkCtrl.motopreFlag == 1) //һ¼ + { + //߽Ķ + DelayRef(300); + UpClipMatClipCylinderOff();//ϼɿ + err = IsSignalTimeout(UpClipMatClipCylinderPlaceOff, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼϻλ + + if(err == ERR_NONE) + { + FixMatCylinderOn();//϶ + PreMatCylinderOff();//ѹɿ + DelayRef(100); + } + + if(err == ERR_NONE) + { + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + } + + err = IsSignalTimeout(IsOptPreLiftUp, CYLINDER_TIMEOUT, ERR_UPCLIP_ERROR);//ϼϻλ + g_optWorkCtrl.motopreFlag = 0; + + //ؽ + rslt = OpticalGotoFinishPos(); + if (rslt == ERR_NONE) + { + err = STA_WORK_FINISH; // + SetDatIdxToStart(); + SP = 0; + } + else + { + err = rslt; + } + } + else + { + //ؽ + rslt = OpticalGotoFinishPos(); + if (rslt == ERR_NONE) + { + err = STA_WORK_FINISH; // + SetDatIdxToStart(); + SP = 0; + } + else + { + err = rslt; + } + + err = rslt; + if (rslt == ERR_NONE) + { + err = STA_WORK_FINISH; // + SetDatIdxToStart(); + SP = 0; + } + } + + break; + } + else + { + // + memcpy(&oldDat, &curDat, sizeof(DataItem)); + +// if (mode == WKMD_BACKWORD) // +// { +// rslt = DatIndexDec();11 +// } +// else +// { +// rslt = DatIndexInc(); +// } + } + + // ɣͣ + if (err != ERR_NONE) + { + OpticalCloseAll(); + UpClipMatClipCylinderOn(); // ϼϼ + + if(g_optWorkCtrl.opticalSta == 1)//߼ⱨ + { + err = ERR_NO_MATERIAL_ERROR; + g_optWorkCtrl.opticalSta = 0; + } + + ReportError(err); + printf("err ok or pause\r\n"); + +// //ͣ +// if(err == STA_NORMAL_STOP) +// { +// printf("err ok or pause1\r\n"); +// int rslt; +// rslt = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ +// if (rslt == ERR_NONE) +// { +// printf("err ok or pause2\r\n"); +// rslt = MoveR1ToPos(2500, NULL);//ת90 +// } +// +// if(rslt != ERR_NONE) +// { +// ReportError(rslt); +// } +// } + + break; + } + }while(1); + + + + if (err != ERR_NONE) // ɣͣ + { + if(g_optWorkCtrl.opticalSta == 1)//߼ⱨ + { + err = ERR_NO_MATERIAL_ERROR; + g_optWorkCtrl.opticalSta = 0; + } + + OpticalCloseAll(); + UpClipMatClipCylinderOn(); // ϼϿ + + ReportError(err); +// printf("err ok or pause\r\n"); +// if(err == STA_NORMAL_STOP) +// { +// int rslt; +// rslt = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ +// if (rslt == ERR_NONE) +// { +// printf("err ok or pause3\r\n"); +// rslt = MoveR1ToPos(2500, NULL);//ת90 +// } +// +// if(rslt != ERR_NONE) +// { +// ReportError(rslt); +// } +// } + } + else + { + OpticalCloseAll(); + } + + + if (err == ERR_NONE || // + err == STA_WORK_OVER || // + err == STA_WORK_FINISH || // + err == STA_WORK_DONE || // ɲ + 0 ) + { + int idx,item; + OpticalCloseAll(); + idx = GetDatIndex(); + item = GetFileItemNums(); + + printf("idx = %d,item = %d err=%x\r\n", idx, item, err); + + if (idx > (item - 3)) + { + g_workCtrl.cursta.outCounter++; // + g_workCtrl.savedpara.outCounter = g_workCtrl.cursta.outCounter; + SaveWorkNvPara(); + + printf("outCounter = %d \r\n",g_workCtrl.cursta.outCounter); + } + } +#if (XY_GAP_CONVERT == 1) + MoveXYGap(0,0,NULL); // ͣ +#endif + if (err == STA_WORK_OVER || // + err == STA_WORK_FINISH || // + err == STA_WORK_DONE || // ɲ + 0 ) + { + OpticalCloseAll(); + SetDatIdxToStart(); + err = OpticalGotoFinishPos(); + } + + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY|WORK_STA_WORKING); // æ־ + + ReportError(err); + return err; +} +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- +void AllToZero(void) +{ + int rslt; + + rslt = ERR_NONE; + + g_optWorkCtrl.onceflag = 0; // һִб + g_optWorkCtrl.motoRunFlag = 0; // ˿־ + g_optWorkCtrl.cutingFlag = 0; // Ѿ߱־ + g_optWorkCtrl.motopreFlag = 0; // Ѿѹϱ־ +// g_optWorkCtrl.lowingFlag = 1; // Ҫ½ͷ־ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + ReportError(0); + DelayRef(10); + FixMatCylinderOn();//ϼס + PreMatCylinderOff(); + +#if (1) + enum Motosta + { + U1MotoSta= 1, + R1MotoSta, + XMotoSta, + YMotoSta, + EndSta + }motosta; + + motosta = 1; + + while(1) + { + switch(motosta) + { +#if(LIFT_U1 != 0) + case U1MotoSta: + { + rslt = FindU1Zero(1); + break; + } +#endif + +#if(TURN_R1 != 0) + case R1MotoSta: + { + rslt = FindR1Zero(); + break; + } +#endif + +#if (MODULE_X != 0) + case XMotoSta: + { + rslt = FindXZero(); + break; + } +#endif + +#if ((MODULE_X != 0) && (MODULE_Y != 0)) + case YMotoSta: + { + rslt = FindYZero(-1); + break; + } +#endif + + default: + { + break; + } + } + + if (rslt == STA_MTZ_SUCCESS) + { + motosta++; + DelayRef(100); + if (motosta == EndSta) + { + break; + } + } + else + { + break; + } + } +#endif + rslt = IsSignalTimeout(IsOptPreLiftUp, CYLINDER_TIMEOUT, 0x002F);//ѹ׻λ + ReportError(rslt); +} + + +// ̸λ +void AllToReset(void) +{ + int err = ERR_NONE; + + g_workCtrl.cursta.runSteps = 0; + g_workCtrl.cursta.dataIdx = 0; + + g_workCtrl.savedpara.runSteps = g_workCtrl.cursta.runSteps; + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + + g_optWorkCtrl.onceflag = 0; // һִб + g_optWorkCtrl.motoRunFlag = 0; // ˿־ + g_optWorkCtrl.cutingFlag = 0; // Ѿ߱־ + g_optWorkCtrl.motopreFlag = 0; // Ѿѹϱ־ +// g_optWorkCtrl.lowingFlag = 1; // Ҫ½ͷ־ + + err = MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + + if (err == ERR_NONE) + { + err = MoveR1ToPos(2500, NULL);//ת90 + if (err == ERR_NONE) + { + err = OpticalGotoFinishPos(); // ؽ + } + } + + if(err != ERR_NONE) + { + ReportError(err); + return; + } + + if (err == ERR_NONE) + { + err = STA_PROCESS_FINISH; // ִ + ReportError(err); + } +} + +// +void OpticalCheckSensorAndPos(void) +{ + if (g_pOpticalMcPara->autoFindZero != 0) // Զ : 0, ʹ 1, ʹ + { + g_workCtrl.posEnFlag = 0; + //OpticalAllToReset(); + } +} + +int IsInManualModel(void) +{ + return 0; +} + +void SetLightStaByCode(int errCode) +{ + if ((g_workCtrl.cursta.workStatus & (WORK_STA_BUSY|WORK_STA_WORKING)) != 0) + { + g_workCtrl.almSta = 0; + } + +} + +void SetLightSta(void) +{ + +// FLASH_LIGHT(g_workCtrl.almflashRed, g_workCtrl.almredSta, AlarmRedLightOn, AlarmRedLightOff); // ɫƺ +// FLASH_LIGHT(g_workCtrl.almflashGreen, g_workCtrl.almgreenSta, AlarmGreenLightOn, AlarmGreenLightOff); // ɫ̵ +// FLASH_LIGHT(g_workCtrl.almflashYello, g_workCtrl.almyelloSta, AlarmYelloLightOn, AlarmYelloLightOff); // ɫƻƵ +// FLASH_LIGHT(g_workCtrl.almflashBee, g_workCtrl.almbeeSta, AlarmBeeOn, AlarmBeeOff); // + +} + +// +int GotoStartPos(void) +{ + int err; + err = ERR_NONE; +#if (OPTICAL_MC_TYPE == OPTICAL_MC_SINGLE || OPTICAL_MC_TYPE == OPTICAL_MC_ONE || OPTICAL_MC_TYPE == OPTICAL_MC_TWO || OPTICAL_MC_TYPE == OPTICAL_MC_WIRE) + + err = IsAutoMoveEnable(); // ǰж + + // ļǷЧ + if (err == ERR_NONE && + IsDatFileAvailable() != TRUE) // ļЧ + { + err = ERR_NO_DATA; // ļ + ReportError(err); + return err; + } + + SetDatIdxToStart(); // ݻ + + if (err == ERR_NONE) + { + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + ReportError(0); + DelayRef(10); + +#if ((MODULE_X != 0) && (MODULE_Y != 0) && (TURN_R1 != 0)) + err = MoveXYRS1P1ToWorkPos(NULL, NULL, 0, 0); +#endif + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + +#endif + ReportError(err); + return err; +} + +// ȥλ +int GotoAnchorPos(void) +{ + int err; + + err = ERR_NONE; + +#if (OPTICAL_MC_TYPE == OPTICAL_MC_WIRE ) + { +#if (MODULE_X != 0) + int posx; +#endif + +#if ((MODULE_X != 0) && (MODULE_Y != 0)) + int posy; +#endif + +#if ((MODULE_X != 0) && (MODULE_Y != 0)) + int posr; +#endif + int poss1; + int posp1; + + err = IsAutoMoveEnable(); // ضλǰж + + // ļǷЧ + if (err == ERR_NONE && + IsDatFileAvailable() != TRUE) // ļЧ + { + err = ERR_NO_DATA; // ļ + ReportError(err); + return err; + } + if (err == ERR_NONE) + { + err = MoveU1ToUpper(0); // ̧ͷ + } + if (err == ERR_NONE) + { + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + ReportError(0); + DelayRef(10); + +#if (MODULE_X != 0) + posx = g_datFile.pFileHead->fileHead.anchorX - g_pOpticalMcPara->offsetX; + printf("g_datFile.pFileHead->fileHead.anchorX =%d\r\n",g_datFile.pFileHead->fileHead.anchorX); +#endif + +#if ((MODULE_X != 0) && (MODULE_Y != 0)) + posy = g_datFile.pFileHead->fileHead.anchorY - g_pOpticalMcPara->offsetY; // λ; + printf("g_datFile.pFileHead->fileHead.anchorY =%d\r\n",g_datFile.pFileHead->fileHead.anchorY); +#endif + + +#if ((MODULE_X != 0) && (MODULE_Y != 0) && (TURN_R1 != 0)) + posr = 0; +#endif + poss1 = 0; + posp1 = 0; + err = OpticalCloseAll(); + if (err == ERR_NONE) + { +#if ((MODULE_X != 0) && (MODULE_Y != 0) && (TURN_R1 != 0)) + err = MoveXYR1S1P1ToPos(posx, posy, posr, poss1, posp1, NULL, 0); +#endif + } + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + } + +#endif + ReportError(err); + return err; +} + +// ȥ +int GotoWorkPos(void) +{ + int err; + err = ERR_NONE; + +#if (OPTICAL_MC_TYPE == OPTICAL_MC_SINGLE || OPTICAL_MC_TYPE == OPTICAL_MC_ONE || OPTICAL_MC_TYPE == OPTICAL_MC_TWO || OPTICAL_MC_TYPE == OPTICAL_MC_WIRE) + { + int rslt; + DataItem curDat; + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + //g_workCtrl.opticalStatus |= CUTTER_RUNNING; // б־ + + ReportError(0); + DelayRef(10); + + ReadAndFreshMotosPos(); + err = IsAutoMoveEnable(); // عǰж + + if (err == ERR_NONE) + { + rslt = GetADataItem(0, GetDatIndex(), &curDat); + if (rslt != 0) + { + memset(&curDat, 0, sizeof(DataItem)); + } + + err = MoveXYRS1P1ToWorkPos(&curDat, NULL, 0, 0); + } + + //g_workCtrl.opticalStatus &= (~CUTTER_RUNNING); // б־ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + } + +#endif + ReportError(err); + return err; +} + +// ƫƵ +int GotoOffsetPos(void) +{ + int err; + err = ERR_NONE; + FixMatCylinderOn(); //ֹ˻ + + +#if (OPTICAL_MC_TYPE == OPTICAL_MC_WIRE) + { + int posx, posy, posr1, poss1, posp1; + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + //g_workCtrl.opticalStatus |= CUTTER_RUNNING; // б־ + + ReportError(0); + DelayRef(10); + + ReadAndFreshMotosPos(); + err = IsAutoMoveEnable(); // ƫƵǰж + + if (err == ERR_NONE) + { + if ((g_pOpticalMcPara->offsetEn & POS_EN_X) != 0) + { + posx = g_pOpticalMcPara->offsetX; // ƫƵX + } + else + { + posx = g_motosPara.motosPos[MTX_IDX]; + } + + if ((g_pOpticalMcPara->offsetEn & POS_EN_Y) != 0) + { + posy = g_pOpticalMcPara->offsetY; // ƫƵY + } + else + { + posy = g_motosPara.motosPos[MTY_IDX]; + } + + err = OpticalCloseAll(); + + posr1 = 0; // ROT_001DEG_TO_PULSE(g_pOpticalMcPara->rSensorAng); + poss1 = 0; + posp1 = 0; + + if (err == ERR_NONE) + { + err = MoveXYR1S1P1ToPos(posx, posy, posr1, poss1, posp1, NULL, 0); + } + } + + //g_workCtrl.opticalStatus &= (~CUTTER_RUNNING); // б־ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + if (err == ERR_NONE) + { + printf("send cutprossflag = 0\r\n"); + } + } +#endif + ReportError(err); + + return err; +} +int GotoFinishPos(void) +{ + int err; + err = OpticalGotoFinishPos(); + return err; +} +// ȥ +int OpticalGotoFinishPos(void) +{ + + if (g_pOpticalMcPara->finishStopSel == 1) // + { + return GotoStartPos(); + } + else if (g_pOpticalMcPara->finishStopSel == 2) // λ + { + return GotoAnchorPos(); + } + else if (g_pOpticalMcPara->finishStopSel == 3) // ϵ + { + //return OpticalGotoPullBegPos(); + } + else if (g_pOpticalMcPara->finishStopSel == 4) // ƫƵ + { + printf("goto offset when finish\r\n"); + return GotoOffsetPos(); + } + else if (g_pOpticalMcPara->finishStopSel == 5) // + { + return MoveXYToPos(g_pOpticalMcPara->xSensorPos, g_pOpticalMcPara->ySensorPos, NULL); + printf("goto AllToZero when finish\r\n"); + + } + return ERR_NONE; +} + +// ǰ(뼣) +int FastJump(u32 idx) +{ + int err; + err = ERR_NONE; + g_optWorkCtrl.cutingFlag = 0; // Ѿ߱־ + + err = MoveU1ToUpper(0); // ̧ͷ + + g_workCtrl.cursta.workStatus |= WORK_STA_BUSY; // æ־ + ReportError(err); + DelayRef(10); + + printf("jump to file idx=%d, stitches=%d\r\n", idx, GetFileItemNums()); + if (IsDatFileAvailable() != TRUE) // ļЧ + { + printf("no file\r\n"); + err = ERR_NO_DATA; // ļ + } + else + { + int rslt; + if (GetFileItemNums() > 0) + { + if (idx > GetFileItemNums()) + { + idx = GetFileItemNums() - 1; + } + } + else + { + idx = 0; + } + + g_workCtrl.cursta.dataIdx = idx; + printf("act jump to file idx=%d\r\n", idx); + + if (g_workCtrl.cursta.dataIdx != 0) + {// ǰҵ˿ + DataItem chackDat; + do + { + GetADataItem(0, g_workCtrl.cursta.dataIdx, &chackDat); + + if(chackDat.ctrl == DATA_OPTI) //жǷ˿ƫ + { + break; + } + else + { + g_workCtrl.cursta.dataIdx--; + if (g_workCtrl.cursta.dataIdx == 0) + { + break; + } + } + }while(1); + printf("find near opti data to file idx=%d\r\n", g_workCtrl.cursta.dataIdx); + } + + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + + rslt = GetWorkPosFromIndex(); + if (rslt == 0) + { + DataItem curDat; + + printf("before move to work\r\n"); + + rslt = GetADataItem(0, GetDatIndex(), &curDat); + if (rslt != 0) + { + err = STA_WORK_OVER; // + } + else + { + err = MoveXYRS1P1ToWorkPos(&curDat, NULL, 0, 0); + } + printf("after move to work\r\n"); + } + } + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY); // æ־ + + ReportError(err); + return err; +} + +int StopAndLightCheck(int sdflag) +{ + int rslt = ERR_NONE; + + if (rslt == ERR_NONE) + { + if (IsStopButton() == SENSOR_ON) + { + //printf("stop button\r\n"); + rslt = STA_NORMAL_STOP; + } + } + + if (rslt == ERR_NONE) + { + rslt = OpticalLightCheck(); + } + + if (sdflag != 0) + { + if (rslt == ERR_NONE) + { + Cutter1StopOff(); + Cutter2StopOff(); + } + else + { + Cutter1StopOn(); + Cutter2StopOn(); + } + } + return rslt; +} + + + +// +int OpticalStartWork(void) +{ + int err; + + err = ERR_NONE; + + g_workCtrl.cursta.workStatus |= (WORK_STA_BUSY|WORK_STA_WORKING); // æ־ + ReportError(err); + DelayRef(10); + + g_workCtrl.cursta.runSteps = 0; + g_optWorkCtrl.onceflag = 0; // һִб + g_optWorkCtrl.motoRunFlag = 0; // ˿־ +// g_optWorkCtrl.cutingFlag = 0; // Ѿ߱־ + g_optWorkCtrl.motopreFlag = 0; // Ѿѹϱ־ +// g_optWorkCtrl.lowingFlag = 1; // Ҫ½ͷ־ + + err = OpticalWork(WKMD_NORMAL); // һô滭иҪȷN2 + + g_workCtrl.cursta.workStatus &= ~(WORK_STA_BUSY|WORK_STA_WORKING); // æ־ + + + ReportError(err); + ReportError(ERR_NONE); + return err; +} + + +//-------------------------------------------------------------------- + +// λͨѶ + +// +void MotoToZero(u16 obj) +{ + {// ֶڵĻ,ִж + int err; + err = OpticalLightCheck(); + if (err != ERR_NONE) + { + ReportError(err); + return; + } + } + + switch(obj) + { + +#if (OPTICAL_MC_TYPE == OPTICAL_MC_WIRE) + case MT_LX: // Xƶ + { + FindXZero(); + break; + } + case MT_LY: // yƶ + { + FindYZero(-1); + break; + } + case MT_LU2: // + { + FindU1Zero(1); + break; + } + case MT_LR2: // ٵ + { + FindR1Zero(); + break; + } +#endif + default: + break; + } +} + +// ֶƶ +void MoveMotoByHand(u16 obj, u16 dir, u16 spd) +{ + FixMatCylinderOn();//ϼסֹ + switch(obj) + { + case MT_LX: // Xƶ + { + if (dir == MT_MOVE_DIR_NEGA) // + { + MoveXByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_POSI) + { + MoveXByHand(-1, spd); + } + else + { + } + break; + } + + case MT_LY: // Yƶ + { + if (dir == MT_MOVE_DIR_NEGA) // + { + MoveYByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_POSI) + { + MoveYByHand(-1, spd); + } + else + { + } + break; + } + + case MT_LU2: // + { + if (dir == MT_MOVE_DIR_POSI) // + { + MoveU1ByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_NEGA) + { + MoveU1ByHand(-1, spd); + } + else + { + } + break; + } + + case MT_LR2: // ٵ + { + if (dir == MT_MOVE_DIR_POSI) // + { + MoveR1ByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_NEGA) + { + MoveR1ByHand(-1, spd); + } + else + { + } + break; + } + + case MT_LBF: // ϵ + { + if (dir == MT_MOVE_DIR_POSI) // + { + MoveSByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_NEGA) + { + MoveSByHand(-1, spd); + } + else + { + } + break; + } + + case MT_PBF: // ϵ + { + if (dir == MT_MOVE_DIR_POSI) // + { + MovePByHand(1, spd); + } + else if (dir == MT_MOVE_DIR_NEGA) + { + // UpClipMatClipCylinderOff(); + MovePByHand(-1, spd); + } + else + { + } + //UpClipMatClipCylinderOn(); + break; + } + case MT_MBF: // ϵ + { + if (dir == MT_MOVE_DIR_POSI) // + { + LooseMotorRevOn(); //ϵ ת + // printf("LooseMotor run %d\r\n"); + + } + else if (dir == MT_MOVE_DIR_NEGA) + { + LooseMotorRevOff(); // ϵ ֹͣ + } + else + { + } + break; + } + + default: + break; + } + FixMatCylinderOff(); +} + +// +void OutputByHand(u16 obj, u16 act, u16 para) +{ +// ֶڵĻ,ִж + int err; + err = OpticalLightCheck(); // + if (err != ERR_NONE) + { + ReportError(err); + return; + } + + err = ERR_NONE; + + switch(obj) + { + case OT_FAN1_CTRL: // + { + if (act == UP_OPEN_ON) + { + Fan1MotoOn(); // ѹ翪 + } + else // if (act == DOWN_CLOSE_OFF) // ر + { + Fan1MotoOff(); // ѹ + } + break; + } + case OT_LOOSE: // ϵת + { + if (act == UP_OPEN_ON) + { + LooseMotorRevOn(); // ϵת + // printf("LooseMotor run %d\r\n"); + } + else // ر + { + LooseMotorRevOff(); // ϵת + } + break; + } + + case OT_TRIMMING: // ߿ƿ + { + if (act == UP_OPEN_ON) + { + UpClipMatClipCylinderOn(); // ϼϿ + DelayRef(100); + TrimmingCylinderOn(); // ׿ + } + else // ر + { + TrimmingCylinderOff(); // ׹ + } + break; + } + case OT_OWNCLIP: // ¼ + { + if (act == UP_OPEN_ON) + { + DownClipMatClipCylinderOn(); // ¼׿ + } + else // ر + { + DownClipMatClipCylinderOff(); // ¼׹ + } + break; + } + case OT_PULLINGCYLINDER: // + { + if (act == UP_OPEN_ON) + { + IsPullingCylinderOn(); // ׿ + } + else // ر + { + IsPullingCylinderOff(); // ׹ + } + break; + } + case OT_PRESS_M_POLE: // ѹ + { + if (act == UP_OPEN_ON) + { + PreMatCylinderOff(); // ѹ + } + else // ر + { + PreMatCylinderOn(); // ѹ½ + } + break; + } + case OT_UPCLIP: // ϼ + { + if (act == UP_OPEN_ON) + { + UpClipMatClipCylinderOn(); // ϼ׼н + } + else // ر + { + UpClipMatClipCylinderOff(); // ϼ׹ + } + break; + } + case OT_BLOWING: // + { + if (act == UP_OPEN_ON) + { + IsBlowingCylinderOn(); // ׿ + } + else // ر + { + IsBlowingCylinderOff(); // ׹ + } + break; + } + case OT_POINT: // ȥλ + { + if (act == UP_OPEN_ON) + { + // Point1(WKMD_NORMAL); // ȥλ1 + } + else + { + // Point2(WKMD_NORMAL); // ȥλ2 + } + break; + + } + case OT_FEED: // ϵת + { + if (act == UP_OPEN_ON) + { + MoveSAsOffset(10000, NULL); // ת + } + else + { + MoveSAsOffset(-10000, NULL); // ת + } + break; + } + case OT_PULL: // ϵת + { + if (act == UP_OPEN_ON) + { + MovePAsOffset(10000, NULL); // ת + } + else + { + MovePAsOffset(-10000, NULL); // ת + } + break; + } + case OT_HEAD_UPDOWN: // ͷ + { + + if (act == UP_OPEN_ON) + { + MoveU1ToPos(g_pOpticalMcPara->rkHighPos, NULL);//̧ͷ + //MoveU1AsOffset(200, NULL); // ͷ + } + else // if (act == DOWN_CLOSE_OFF) // ر + { + MoveU1ToPos(g_pOpticalMcPara->rkLowPos, NULL);//̧ͷ + //MoveU1AsOffset(-200, NULL); // ͷ½ + } + break; + + } + case OT_HEAD_SPIN: // ͷת + { + + if (act == UP_OPEN_ON) + { + MoveR1AsOffset(200, NULL); // ͷת + } + else // if (act == DOWN_CLOSE_OFF) // ر + { + MoveR1AsOffset(-200, NULL); // ͷת + } + break; + + } + default: + break; + } +} + +void MotosServoCtrl(u16 obj, u16 onoff) +{ + switch(obj) + { + case MT_LX: // Xƶ + { + if (onoff == MT_SERVO_ON) // ON + { + MotoServoCtrl(MTX_IDX, SERVO_ON); + } + else if (onoff == MT_SERVO_OFF) // OFF + { + MotoServoCtrl(MTX_IDX, SERVO_OFF); + } + break; + } + case MT_LY: // yƶ + { + if (onoff == MT_SERVO_ON) // ON + { + MotoServoCtrl(MTY_IDX, SERVO_ON); + } + else if (onoff == MT_SERVO_OFF) // OFF + { + MotoServoCtrl(MTY_IDX, SERVO_OFF); + } + break; + } + case MT_LU1: // + { + if (onoff == MT_SERVO_ON) // ON + { + MotoServoCtrl(MTY_IDX, SERVO_ON); + } + else if (onoff == MT_SERVO_OFF) // OFF + { + MotoServoCtrl(MTY_IDX, SERVO_OFF); + } + break; + } + + case MT_LR1: // ת + { + if (onoff == MT_SERVO_ON) // ON + { + MotoServoCtrl(MTY_IDX, SERVO_ON); + } + else if (onoff == MT_SERVO_OFF) // OFF + { + MotoServoCtrl(MTY_IDX, SERVO_OFF); + } + break; + } + + default: + break; + } +} + +// ֶ +void OpticalManualAction(u16 obj, u16 para) +{ + + + switch(obj) + { + + + default: + break; + } + +} + + +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- +// Բ + +#if (1) + +void TestWorkRun(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + if (p1 == 0) + {// + OpticalStartWork(); // + } + else if (p1 == 1) + { + OpticalWork(WKMD_NORMAL); // + } + else if (p1 == 2) //ȥ + { + OpticalGotoFinishPos(); + } + else if (p1 == 3) + { + } + + else + { + + } +} + +void TestMotoRun(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + if (p1 == 0) + {// + if (p2 == 0) + {//ȫ + AllToZero(); + } + else if (p2 == 1) + {// X + FindXZero(); + } + else if (p2 == 2) + {// Y + FindYZero(-1); + } + + else if (p2 == 5) + { + FindU1Zero(1); + } + else if (p2 == 6) + { + FindR1Zero(); + } + else if (p2 == 7) + { + } + else if (p2 == 8) + { + + } + else if (p2 == 9) + { + } + } + else if (p1 == 101) + {// Xƫ + MoveXAsOffset(p2,NULL); + } + else if (p1 == 102) + {// Yƫ + MoveYAsOffset(p2,NULL); + } + else if (p1 == 103) + {// ƫ + MoveU1AsOffset(p2, NULL); + } + else if (p1 ==104) + {//ٵƫ + MoveR1AsOffset(p2, NULL); + } + else if (p1 ==105) + {//ϵƫ + MoveSAsOffset(p2, NULL); + } + else if (p1 ==106) + {//ϵƫ + MovePAsOffset(p2, NULL); + } + else if (p1 ==107) + {//ϵƫ + MoveU1S1AsOffset(p2, NULL); + } + else if (p1 ==108) + {//ϼϵƫ + MoveP1S1AsOffset(p2, NULL); + } + + + + else if (p1 == 201) + {//ȥֵλ + MoveU1ToPos(p2, NULL); + } + else if (p1 == 202) + {//ȥֵλ + MoveP1S1AsOffset(p2, NULL); + } + + else if (p1 == 1) + { + if (p2 == 0) + { + MoveMotoByHand(MT_LX, MT_MOVE_DIR_POSI, 1); + } + else + { + MoveMotoByHand(MT_LX, MT_MOVE_DIR_NEGA, 1); + } + } + else if (p1 == 2) + { + if (p2 == 0) + { + MoveMotoByHand(MT_LY, MT_MOVE_DIR_POSI, 1); + } + else + { + MoveMotoByHand(MT_LY, MT_MOVE_DIR_NEGA, 1); + } + } + else if (p1 == 3) + { + if (p2 == 0) + { + } + else if (p2 == 1) + { + + } + else if (p2 == 2) + {// ҵ߶Ȳ + + } + } + + else + { + + } +} + +void XMotoRunTo(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + + int err = OpticalCloseAll(); + if (err == ERR_NONE) + { + err = MoveXToPos(p1,NULL); + } + +} + +void YMotoRunTo(char * para1, char * para2) +{ + int p1; + + if (para1 == NULL) + { + return; + } + + printf("para1=%s\r\n", para1); + + if (strcmp(para1, "") == 0) + { + return; + } + p1 = atoi(para1); + + //-------------------------------- + MoveYToPos(p1, NULL); +} + +//------------------------------------------------------- +void XYMotoRunTo(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + { + int err = OpticalCloseAll(); + if (err == ERR_NONE) + { + err = MoveXYToPos(p1, p2, NULL); + } + } +} + +void U1MotoRunTo(char * para1, char * para2) +{ + int p1; + + if (para1 == NULL) + { + return; + } + + printf("para1=%s\r\n", para1); + + if (strcmp(para1, "") == 0) + { + return; + } + p1 = atoi(para1); + + //-------------------------------- + MoveU1ToPos(p1, NULL); +} + +void R1MotoRunTo(char * para1, char * para2) +{ + int p1; + + if (para1 == NULL) + { + return; + } + + printf("para1=%s\r\n", para1); + + if (strcmp(para1, "") == 0) + { + return; + } + p1 = atoi(para1); + + //-------------------------------- + MoveR1ToPos(p1, NULL); +} +void S1MotoRunTo(char * para1, char * para2) +{ + int p1; + + if (para1 == NULL) + { + return; + } + + printf("para1=%s\r\n", para1); + + if (strcmp(para1, "") == 0) + { + return; + } + p1 = atoi(para1); + + //-------------------------------- + MoveSToPos(p1, NULL); +} +void P1MoveAsOffset(char * para1, char * para2) +{ + int p1; + + if (para1 == NULL) + { + return; + } + + printf("para1=%s\r\n", para1); + + if (strcmp(para1, "") == 0) + { + return; + } + p1 = atoi(para1); + + //-------------------------------- + MovePAsOffset(p1, NULL); +} + + +void ShowMotoInfo(char * para1, char * para2) +{ + printf("motos info:\r\n"); + printf("\tXpos=%d\r\n", g_motosPara.motosPos[MTX_IDX]); + printf("\tYpos=%d\r\n", g_motosPara.motosPos[MTY_IDX]); + printf("\tRpos=%d\r\n", g_motosPara.motosPos[MTR1_IDX]); + printf("\tUpos=%d\r\n", g_motosPara.motosPos[MTU1_IDX]); + printf("\tPpos=%d\r\n", g_motosPara.motosPos[MTP1_IDX]); + printf("\tSpos=%d\r\n", g_motosPara.motosPos[MTS1_IDX]); +} + + + +//---------------------------------------- +//ˢ´ź +// mode = 0 : ˢ´״̬ +// mode = 1 : õЧλͼ + +#define CASE_COREIP(cs) \ +{\ + case cs:\ + {\ + if (((GetInput##cs##Status() == SENSOR_ON) || (mode != 0)) && (CORE_INPUT##cs##_IDX != DSS_DEF_IDX))\ + {\ + buf[CORE_INPUT##cs##_IDX] |= CORE_INPUT##cs##_BIT;\ + }\ + break;\ + }\ +} + +#define CASE_EXIP(cs) \ +{\ + case cs:\ + {\ + if (((GetExInput(cs) == SENSOR_ON) || (mode != 0)) && (EX_INPUT##cs##_IDX != DSS_DEF_IDX))\ + {\ + buf[EX_INPUT##cs##_IDX] |= EX_INPUT##cs##_BIT;\ + }\ + break;\ + }\ +} + +typedef char InStr[INPUT_STR_LEN]; + + +// mode 1:λͼ +// 0:ź +void SensorsStatus(int mode, u8 * buf) +{ + int i; + + if (buf == NULL) + { + return; + } + + memset(buf, 0, MAX_EXDP_LEN); + + for (i=1;i<=16;i++) + { + switch(i) + { + CASE_COREIP(1); + CASE_COREIP(2); + CASE_COREIP(3); + CASE_COREIP(4); + CASE_COREIP(5); + CASE_COREIP(6); + CASE_COREIP(7); + CASE_COREIP(8); + CASE_COREIP(9); + CASE_COREIP(10); + CASE_COREIP(11); + CASE_COREIP(12); + CASE_COREIP(13); + CASE_COREIP(14); + CASE_COREIP(15); + CASE_COREIP(16); + default: + break; + } + } + +#if (USE_IOEX != 0) + { +#if (USE_IOEX >= 1) + for (i=1;i<=16;i++) + { + switch(i) + {// N7 (1) + CASE_EXIP(1); + CASE_EXIP(2); + CASE_EXIP(3); + CASE_EXIP(4); + CASE_EXIP(5); + CASE_EXIP(6); + CASE_EXIP(7); + CASE_EXIP(8); + CASE_EXIP(9); + CASE_EXIP(10); + CASE_EXIP(11); + CASE_EXIP(12); + CASE_EXIP(13); + CASE_EXIP(14); + CASE_EXIP(15); + CASE_EXIP(16); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 2) + for (i=17;i<=32;i++) + { + switch(i) + {// N7 (2) + CASE_EXIP(17); + CASE_EXIP(18); + CASE_EXIP(19); + CASE_EXIP(20); + CASE_EXIP(21); + CASE_EXIP(22); + CASE_EXIP(23); + CASE_EXIP(24); + CASE_EXIP(25); + CASE_EXIP(26); + CASE_EXIP(27); + CASE_EXIP(28); + CASE_EXIP(29); + CASE_EXIP(30); + CASE_EXIP(31); + CASE_EXIP(32); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 3) + for (i=33;i<=48;i++) + { + switch(i) + {// N7 (3) + CASE_EXIP(33); + CASE_EXIP(34); + CASE_EXIP(35); + CASE_EXIP(36); + CASE_EXIP(37); + CASE_EXIP(38); + CASE_EXIP(39); + CASE_EXIP(40); + CASE_EXIP(41); + CASE_EXIP(42); + CASE_EXIP(43); + CASE_EXIP(44); + CASE_EXIP(45); + CASE_EXIP(46); + CASE_EXIP(47); + CASE_EXIP(48); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 4) + for (i=49;i<=64;i++) + { + switch(i) + {// N7 (4) + CASE_EXIP(49); + CASE_EXIP(50); + CASE_EXIP(51); + CASE_EXIP(52); + CASE_EXIP(53); + CASE_EXIP(54); + CASE_EXIP(55); + CASE_EXIP(56); + CASE_EXIP(57); + CASE_EXIP(58); + CASE_EXIP(59); + CASE_EXIP(60); + CASE_EXIP(61); + CASE_EXIP(62); + CASE_EXIP(63); + CASE_EXIP(64); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 5) + for (i=65;i<=80;i++) + { + switch(i) + {// N7 (5) + CASE_EXIP(65); + CASE_EXIP(66); + CASE_EXIP(67); + CASE_EXIP(68); + CASE_EXIP(69); + CASE_EXIP(70); + CASE_EXIP(71); + CASE_EXIP(72); + CASE_EXIP(73); + CASE_EXIP(74); + CASE_EXIP(75); + CASE_EXIP(76); + CASE_EXIP(77); + CASE_EXIP(78); + CASE_EXIP(79); + CASE_EXIP(80); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 6) + for (i=81;i<=96;i++) + { + switch(i) + {// N7 (6) + CASE_EXIP(81); + CASE_EXIP(82); + CASE_EXIP(83); + CASE_EXIP(84); + CASE_EXIP(85); + CASE_EXIP(86); + CASE_EXIP(87); + CASE_EXIP(88); + CASE_EXIP(89); + CASE_EXIP(90); + CASE_EXIP(91); + CASE_EXIP(92); + CASE_EXIP(93); + CASE_EXIP(94); + CASE_EXIP(95); + CASE_EXIP(96); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 7) + for (i=97;i<=112;i++) + { + switch(i) + {// N7 (7) + CASE_EXIP(97); + CASE_EXIP(98); + CASE_EXIP(99); + CASE_EXIP(100); + CASE_EXIP(101); + CASE_EXIP(102); + CASE_EXIP(103); + CASE_EXIP(104); + CASE_EXIP(105); + CASE_EXIP(106); + CASE_EXIP(107); + CASE_EXIP(108); + CASE_EXIP(109); + CASE_EXIP(110); + CASE_EXIP(111); + CASE_EXIP(112); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 8) + for (i=113;i<=128;i++) + { + switch(i) + {// N7 (8) + CASE_EXIP(113); + CASE_EXIP(114); + CASE_EXIP(115); + CASE_EXIP(116); + CASE_EXIP(117); + CASE_EXIP(118); + CASE_EXIP(119); + CASE_EXIP(120); + CASE_EXIP(121); + CASE_EXIP(122); + CASE_EXIP(123); + CASE_EXIP(124); + CASE_EXIP(125); + CASE_EXIP(126); + CASE_EXIP(127); + CASE_EXIP(128); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 9) + for (i=129;i<=144;i++) + { + switch(i) + {// N7 (9) + CASE_EXIP(129); + CASE_EXIP(130); + CASE_EXIP(131); + CASE_EXIP(132); + CASE_EXIP(133); + CASE_EXIP(134); + CASE_EXIP(135); + CASE_EXIP(136); + CASE_EXIP(137); + CASE_EXIP(138); + CASE_EXIP(139); + CASE_EXIP(140); + CASE_EXIP(141); + CASE_EXIP(142); + CASE_EXIP(143); + CASE_EXIP(144); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 10) + for (i=145;i<=160;i++) + { + switch(i) + {// N7 (10) + CASE_EXIP(145); + CASE_EXIP(146); + CASE_EXIP(147); + CASE_EXIP(148); + CASE_EXIP(149); + CASE_EXIP(150); + CASE_EXIP(151); + CASE_EXIP(152); + CASE_EXIP(153); + CASE_EXIP(154); + CASE_EXIP(155); + CASE_EXIP(156); + CASE_EXIP(157); + CASE_EXIP(158); + CASE_EXIP(159); + CASE_EXIP(160); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 11) + for (i=161;i<=176;i++) + { + switch(i) + {// N7 (11) + CASE_EXIP(161); + CASE_EXIP(162); + CASE_EXIP(163); + CASE_EXIP(164); + CASE_EXIP(165); + CASE_EXIP(166); + CASE_EXIP(167); + CASE_EXIP(168); + CASE_EXIP(169); + CASE_EXIP(170); + CASE_EXIP(171); + CASE_EXIP(172); + CASE_EXIP(173); + CASE_EXIP(174); + CASE_EXIP(175); + CASE_EXIP(176); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 12) + for (i=177;i<=192;i++) + { + switch(i) + {// N7 (12) + CASE_EXIP(177); + CASE_EXIP(178); + CASE_EXIP(179); + CASE_EXIP(180); + CASE_EXIP(181); + CASE_EXIP(182); + CASE_EXIP(183); + CASE_EXIP(184); + CASE_EXIP(185); + CASE_EXIP(186); + CASE_EXIP(187); + CASE_EXIP(188); + CASE_EXIP(189); + CASE_EXIP(190); + CASE_EXIP(191); + CASE_EXIP(192); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 13) + for (i=193;i<=208;i++) + { + switch(i) + {// N7 (13) + CASE_EXIP(193); + CASE_EXIP(194); + CASE_EXIP(195); + CASE_EXIP(196); + CASE_EXIP(197); + CASE_EXIP(198); + CASE_EXIP(199); + CASE_EXIP(200); + CASE_EXIP(201); + CASE_EXIP(202); + CASE_EXIP(203); + CASE_EXIP(204); + CASE_EXIP(205); + CASE_EXIP(206); + CASE_EXIP(207); + CASE_EXIP(208); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 14) + for (i=209;i<=224;i++) + { + switch(i) + {// N7 (14) + CASE_EXIP(209); + CASE_EXIP(210); + CASE_EXIP(211); + CASE_EXIP(212); + CASE_EXIP(213); + CASE_EXIP(214); + CASE_EXIP(215); + CASE_EXIP(216); + CASE_EXIP(217); + CASE_EXIP(218); + CASE_EXIP(219); + CASE_EXIP(220); + CASE_EXIP(221); + CASE_EXIP(222); + CASE_EXIP(223); + CASE_EXIP(224); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 15) + for (i=225;i<=240;i++) + { + switch(i) + {// N7 (15) + CASE_EXIP(225); + CASE_EXIP(226); + CASE_EXIP(227); + CASE_EXIP(228); + CASE_EXIP(229); + CASE_EXIP(230); + CASE_EXIP(231); + CASE_EXIP(232); + CASE_EXIP(233); + CASE_EXIP(234); + CASE_EXIP(235); + CASE_EXIP(236); + CASE_EXIP(237); + CASE_EXIP(238); + CASE_EXIP(239); + CASE_EXIP(240); + default: + break; + } + } +#endif + +#if (USE_IOEX >= 16) + for (i=241;i<=256;i++) + { + switch(i) + {// N7 (16) + CASE_EXIP(241); + CASE_EXIP(242); + CASE_EXIP(243); + CASE_EXIP(244); + CASE_EXIP(245); + CASE_EXIP(246); + CASE_EXIP(247); + CASE_EXIP(248); + CASE_EXIP(249); + CASE_EXIP(250); + CASE_EXIP(251); + CASE_EXIP(252); + CASE_EXIP(253); + CASE_EXIP(254); + CASE_EXIP(255); + CASE_EXIP(256); + default: + break; + } + } +#endif + } +#endif // N7 +} +//------------------------------------------------------- + +void ShowFileInfo(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + + if (p1 == p2) + { + } + + if (p1 == 0) + { + OutFileInfo(); + } + if (p1 == 10) + { + if (p2 >= 0) + { + int idx = p2; + int rslt; + DataItem ditem; + + printf("GetADataItem(%d):", idx); + rslt = GetADataItem(0, idx, &ditem); + if (rslt == 0) + { + printf("ctrl=0x%x, attr=0x%x, dx=%d,dy=%d,dr=%d,len=%d,action=0x%x\r\n", ditem.ctrl, ditem.attr, ditem.dx, ditem.dy,ditem.dr,ditem.len,ditem.action); + } + else + { + printf("err idx\r\n"); + } + } + } +} + +//------------------------------------------------------- + +#define DEF_BEGX 25000 +#define DEF_BEGY 50000 + + +#define DEF_SIZEX 100000 +#define DEF_SIZEY 100000 + +#define DEF_DEX 2000 +#define DEF_DEY 2000 + + +int g_testBegx = DEF_BEGX; +int g_testBegy = DEF_BEGY; + +int g_testSizex = DEF_SIZEX; +int g_testSizey = DEF_SIZEY; + +int g_testDex = DEF_DEX; +int g_testDey = DEF_DEY; + +void TestPara(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + + } + else + { + PreMatCylinderOff(); + return; + } + + + switch (p1) + { + case 0: + { + g_testBegx = DEF_BEGX; + g_testBegy = DEF_BEGY; + g_testSizex = DEF_SIZEX; + g_testSizey = DEF_SIZEY; + break; + } + case 1: + { + g_testBegx = p2; + break; + } + case 2: + { + g_testBegy = p2; + break; + } + case 3: + { + g_testSizex = p2; + break; + } + case 4: + { + g_testSizey = p2; + break; + } + case 5: + { + g_testDex = p2; + break; + } + case 6: + { + g_testDey = p2; + break; + } + case 7: + { + GetWorkPosFromIndex(); + printf("workpos r1 = %d, dataidx=%d\r\n", g_workCtrl.workPos[MTR1_IDX], g_workCtrl.cursta.dataIdx); + break; + } + case 8: + { + g_workCtrl.cursta.dataIdx = p2; + } + default: + break; + + } +} +void Simulation(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if(p1 == 0)// + { + if(p2 == 0) + { + // λЧ + g_workCtrl.posEnFlag = ALL_MOTO_MOD; + // λֵֵ + g_workCtrl.zeroPosList[MTX_IDX] = g_pOpticalMcPara->xSensorPos; + g_workCtrl.zeroPosList[MTY_IDX] = g_pOpticalMcPara->ySensorPos; + g_workCtrl.zeroPosList[MTR1_IDX] = g_pOpticalMcPara->r1SensorAng; + g_workCtrl.zeroPosList[MTU1_IDX] = g_pOpticalMcPara->u1SensorPos; + SetOpticalZeroPosValue(g_workCtrl.zeroPosList); + + } + } +} + +void Reset(char * para1, char * para2) +{ + AllToReset(); +} +#endif + +#endif// (CUR_MACHINE == MACH_OPTICAL) diff --git a/EMBOS/Users/App/user/optical/optical.h b/EMBOS/Users/App/user/optical/optical.h new file mode 100644 index 0000000..2dbe95c --- /dev/null +++ b/EMBOS/Users/App/user/optical/optical.h @@ -0,0 +1,532 @@ +#ifndef _OPTICAL_H_ +#define _OPTICAL_H_ + +#include "config.h" + +#if (CUR_MACHINE == MACH_OPTICAL) + +#include "movectrl.h" +#include "operator.h" +#include "debug.h" +#include "inout.h" +#include "buttons.h" +#include "datadef.h" +#include "delay.h" +#include "controlbus.h" +#include "extendboards.h" +#include "error.h" +#include "trigger.h" +#include "shell.h" +#include "opticalpara.h" +#include "workctrl.h" +//----------------------------------------Ʋ------------------------------------ + +typedef struct +{ + u32 fanStatus; // Ŀ״̬ 0: 1: 2: + s32 sendLength; // ܳ + u32 sendCount; // Ͳϼ + + int cutter1filesta; + int cutter2filesta; + //--------- + u32 fanCloseCounter; // رռ + //---------- + //˿ + u32 onceflag; //һִб + u32 motoRunFlag; //˿־ + u32 motopreFlag; //̹˱־ + int offsetToOpit; //ƫȥ˿־ + int isEndOfSpinFlag; //β˿־ + u32 cutingFlag; // Լ߱־ =0:ܼ =1:Լ + u32 lowingFlag; // Ҫ½ͷ־ + u32 tsIdx; // ˿(ʱʹ) + //----------------------- + + // + u8 runSteps1; // + s16 oldXCompenAfterTurn; // oldX֮IJ + s16 oldYCompenAfterTurn; // oldY֮IJ + s16 xCompenAfterTurn; // x֮IJ + s16 yCompenAfterTurn; // y֮IJ + s32 begainRBeforeWiring; // ʼǶ + u8 compenFlag1; // Բ־ + + //----------------------- + // + u8 runSteps2; + u8 runSteps3; + s32 IsNoMaterialScanLen; // ߼ɨ賤 + u8 IsNoMaterialFlag; // ߱־ =0 + u8 IsNoMaterialEn; // ߼ɨ + //----------------------- + s32 encoder1Vale; // 1ֵ + s32 encoder2Vale; // 2ֵ + + u32 opticalSta; // ״̬ + + u8 silkRetreat; // ߺ˿ + s32 opitPosx; // ˿λx + s32 opitPosy; // ˿λy + s8 opitPosDirx; // ˿ + s8 opitPosDiry; // ˿ + + u8 usecomx; // ʹ÷в + u8 usecomy; // ʹ÷в + u8 useGapCorx; // ʹ÷ԽӼ϶ + u8 useGapCory; // ʹ÷ԽӼ϶ + int spinLenOffset; // ƫƳ + +}OptWorkCtrl; + +OptWorkCtrl g_optWorkCtrl; + +//u32 opticalSta; // ״̬ +//#define + +typedef struct +{ + s32 xNegaBorder; // xλλ + s32 xPosiBorder; // xλλ + s32 yNegaBorder; // yλλ + s32 yPosiBorder; // yλλ + +}OptBorder; + +OptBorder g_optBorder; +//---------------------------------------------------------------------------- + + + +//-------------------------------ģ------------------------------------------ + +#if (1) + +#define MATERIAL_SCAN 1 // ϼ⣨߼⣩ + +#define AFTERTURN_COMPEN 0 // սDz + +#define XY_GAP_CONVERT 0 // ϶ + +#define MODULE_X 1 // Xģ +#define X_FINDZERO_DIR 1 // = -1, X򸺷λ; = 1, Xλ; + + +#define MODULE_Y 1 // Yģ + +#define MODULE_FEED_LL 0 // ģ + +#define MOTO_LIFT 1 // +#define LIFT_U1 1 // 1ģ +#define LIFT_U2 0 // 2ģ +#define LIFT_U3 0 // 3ģ + +#define AIR_LIFT 0 // + +#define MOTO_TURN 1 // ת +#define TURN_R1 1 // ת1ģ +#define TURN_R2 0 // ת2ģ +#define TURN_R3 0 // ת3ģ + +#define MODULE_SEND 1 //ϵģ +#define MODULE_PULL 1 //ϵģ +#define MODULE_LOOSE 1 //ϵģ + + +#define POS_EN_NONE 0x0000 +#define POS_EN_X 0x0001 +#define POS_EN_Y 0x0002 +#define POS_EN_XY 0x0003 + +#endif +//--------------------------------------------------------------------------------------------------- + + + +//-------------------------------------------ź--------------------------------------------- +//ź + // J1 +#define IsXZeroPos GetInput1Status // Xλ +#define CORE_INPUT1_IDX DSS2_F1_ZERO_POS +#define CORE_INPUT1_BIT DSS2_F1_X + // J2 +#define IsYZeroPos GetInput2Status // Yλ +#define CORE_INPUT2_IDX DSS2_F1_ZERO_POS +#define CORE_INPUT2_BIT DSS2_F1_Y + // J3 +#define IsU1ZeroPos GetInput3Status // Uλ +#define CORE_INPUT3_IDX DSS2_UD_SP1U1_POS +#define CORE_INPUT3_BIT DSS_HEAD_01 + // J4 +#define IsR1ZeroPos GetInput4Status // Rλ +#define CORE_INPUT4_IDX DSS_DEF_IDX +#define CORE_INPUT4_BIT DSS_DEF_BIT + // J5 +#define IsStartButton GetInput5Status // ť +#define CORE_INPUT5_IDX DSS1_B_START_BT +#define CORE_INPUT5_BIT DSS_BIT1 + // J6 +#define IsStopButton GetInput6Status // ͣť +#define CORE_INPUT6_IDX DSS1_B_PAUSE_BT +#define CORE_INPUT6_BIT DSS_BIT1 + // J7 +#define UpClipMatClipCylinderPlaceOn GetInput7Status // ϼ-λ +#define CORE_INPUT7_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT7_BIT DSS_BIT1 + // J8 +#define UpClipMatClipCylinderPlaceOff GetInput8Status // ϼ-λ +#define CORE_INPUT8_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT8_BIT DSS_BIT2 + // J9 +#define DownClipMatClipCylinderPlaceOn GetInput9Status // ¼-λ +#define CORE_INPUT9_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT9_BIT DSS_BIT3 + // J10 +#define DownClipMatClipCylinderPlaceOff GetInput10Status // ¼-λ +#define CORE_INPUT10_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT10_BIT DSS_BIT4 + // J11 +#define IsOptStoringLow1 GetInput11Status // ˴ϵλ1 +#define CORE_INPUT11_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT11_BIT DSS_BIT5 + // J12 +#define IsOptStoringLow2 GetInput12Status // ˴ϵλ2 +#define CORE_INPUT12_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT12_BIT DSS_BIT6 + // J13 +#define IsEmptyMaterial GetInput13Status // ϼ +#define CORE_INPUT13_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT13_BIT DSS_BIT7 + // J14 +#define IsOptStoringHigh2 GetInput14Status // ɾ +#define CORE_INPUT14_IDX DSS2_UD_SP2D1_POS +#define CORE_INPUT14_BIT DSS_BIT8 + // J15 +#define IsOptPreLiftUp GetInput15Status // ѹ̧λ +#define CORE_INPUT15_IDX DSS2_UD_SP2D2_POS +#define CORE_INPUT15_BIT DSS_BIT1 + // J16 +#define GetInputNull GetInput16Status +#define CORE_INPUT16_IDX DSS_DEF_IDX +#define CORE_INPUT16_BIT DSS_DEF_BIT + +// J16 +#define IsBlowingCylinderPlaceOn() GetExInput(1) +#define CORE_INPUT17_IDX DSS_DEF_IDX +#define CORE_INPUT17_BIT DSS_DEF_BIT + +//ź + // H1 +#define UpClipMatClipCylinderOn Output1On // ϼ׿ƿ +#define UpClipMatClipCylinderOff Output1Off // ϼ׿ƹ + // H2 +#define DownClipMatClipCylinderOn Output2On // ¼׿ƿ +#define DownClipMatClipCylinderOff Output2Off // ¼׿ƹ + // H3 +#define PreMatCylinderOn() do{Output3On();}while(0) // ѹ׿ƿ +#define PreMatCylinderOff() do{Output3Off();}while(0) // ѹ׿ƹ + // H4 +#define IsBlowingCylinderOn() if(IsOptPreLiftUp() == SENSOR_ON){Output4On();} // +#define IsBlowingCylinderOff Output4Off // ջ + // H5 +#define TrimmingCylinderOn() do{Output5On();}while(0) // ׿ƿ +#define TrimmingCylinderOff() Output5Off() // ׿ƹ + // H6 +#define LooseMotorRevOn Output6On // ϵת +#define LooseMotorRevOff Output6Off // ϵת + // H7 +#define Fan1MotoOn Output7On // ת +#define Fan1MotoOff Output7Off // ת + +#define FixMatCylinderOn() do{SetExOutput(1,0);}while(0)//׿ +#define FixMatCylinderOff() do{SetExOutput(1,1);}while(0)//׹ +//ź +static const char g_opticalInputName[INPUT_NUM][INPUT_STR_LEN] = +{ + "Xλ", + "Yλ", + "Uλ", + "Rλ", + "ť", + "ֹͣť", + "ϼ-λ", + "ϼ-λ", + "¼-λ", + "¼-λ", + "˴ϵλ1", + "˴ϵλ2", + "˴ϸλ1", + "˴ϸλ2", + "ѹ̧λ", + "", +}; +static const char g_opticalOutputName[OUTPUT_NUM][OUTPUT_STR_LEN] = +{ + "ϼ׿", + "¼׿", + "ѹ׿", + "׿", + "׿", + "ϵ", + "ת", + "", +}; +//#if (1) +//// ֹ򱨴 +//// +#ifndef IsAutoManualSelSwitch +#define IsAutoManualSelSwitch GetInputNullOn // Զť +#endif + +#ifndef IsAirPressureOk +#define IsAirPressureOk GetInputNullOn // ѹ +#endif + +#ifndef IsPullingCylinderOff +#define IsPullingCylinderOff GetInputNullOn // ѹ +#endif + +#ifndef IsPullingCylinderOn +#define IsPullingCylinderOn GetInputNullOn // ѹ +#endif + +#ifndef IsBlowingCylinderPlaceOff +#define IsBlowingCylinderPlaceOff GetInputNullOn // ѹ +#endif + + +// +#ifndef OilOff +#define OilOff SetOutputNull // +#endif + +#ifndef AlarmRedLightOn +#define AlarmRedLightOn SetOutputNull // ɫ- +#endif + +#ifndef AlarmRedLightOff +#define AlarmRedLightOff SetOutputNull // ɫ- +#endif + +#ifndef AlarmGreenLightOn +#define AlarmGreenLightOn SetOutputNull // ɫ- +#endif + +#ifndef AlarmGreenLightOff +#define AlarmGreenLightOff SetOutputNull // ɫ- +#endif + +#ifndef AlarmYelloLightOn +#define AlarmYelloLightOn SetOutputNull // ɫ- +#endif + +#ifndef AlarmYelloLightOff +#define AlarmYelloLightOff SetOutputNull // ɫ- +#endif + +#ifndef AlarmBeeOn +#define AlarmBeeOn SetOutputNull // ɫ- +#endif + +#ifndef AlarmBeeOff +#define AlarmBeeOff SetOutputNull // ɫ- +#endif +// +//#endif // ֹ򱨴 +// +//#if (1) +#ifndef PanDownOn +#define PanDownOn OutputNull // ʷ +#endif +#ifndef PanDownOff +#define PanDownOff OutputNull // ̧ +#endif + +#ifndef Cutter1StartOn +#define Cutter1StartOn OutputNull // 1 +#endif +#ifndef Cutter1StartOff +#define Cutter1StartOff OutputNull // 1 +#endif + +#ifndef Cutter1StopOn +#define Cutter1StopOn OutputNull // 1ֹͣ +#endif +#ifndef Cutter1StopOff +#define Cutter1StopOff OutputNull // 1ֹͣ +#endif + +#ifndef Cutter2StartOn +#define Cutter2StartOn OutputNull // 2 +#endif +#ifndef Cutter2StartOff +#define Cutter2StartOff OutputNull // 2 +#endif + +#ifndef Cutter2StopOn +#define Cutter2StopOn OutputNull // 2ֹͣ +#endif +#ifndef Cutter2StopOff +#define Cutter2StopOff OutputNull // 2ֹͣ +#endif +//------------------------------------------------------------------------------------------------------------ + + + + +//-------------------------------------------------------------------------------------------------- + +// X : +#define MTX_IDX 0 // X +#define MTX_CFG MOTOEN_CFG +#define MTX_OTP POUT_CWCCW +#define MTX_MOD 0x01 +// Y : +#define MTY_IDX 1 // Y +#define MTY_CFG MOTOEN_CFG +#define MTY_OTP POUT_CWCCW +#define MTY_MOD 0x02 +// U1 : +#define MTU1_IDX 2 // U1 ҵ +#define MTU1_CFG MOTOEN_CFG +#define MTU1_OTP POUT_CWCCW +#define MTU1_MOD 0x04 +// R1 : +#define MTR1_IDX 3 // ٵ +#define MTR1_CFG MOTOEN_CFG +#define MTR1_OTP POUT_CWCCW +#define MTR1_MOD 0x08 +// ϵ: +#define MTS1_IDX 4 // ϵ +#define MTS1_CFG MOTOEN_CFG +#define MTS1_OTP POUT_CWCCW +#define MTS1_MOD 0x10 +// ϵ: +#define MTP1_IDX 5 // ϵ,δߣ +#define MTP1_CFG (CONFIG_EN|POUT_EN) +#define MTP1_OTP POUT_PLSDIR +#define MTP1_MOD 0x20 + + +// ÿ +#define OPTICAL_PULSE_PER_SEGMENT 1000 + +// ֶַ֧ +#define OPTICAL_SUPPORT_SEGMENT 1 + +// ϵ +#define MTS1_PULSE_CIRCLE 100 // ÿȦ +#define MVS1BH_MVMT (MTS1_PULSE_CIRCLE * 10000) // ֶƶ +//---------------------------------------------------------------------------------------------------- + + + + +//-------------------------------------------ͨѶ------------------------------------------- + +// ֶƶ͵ʹܵ Ʋ1 +#define MT_LX 0x0001 // Xƶ +#define MT_LY 0x0002 // Yƶ + +#define MT_LU1 0x0003 // 1 +#define MT_LU2 0x0004 // 2 + +#define MT_LR1 0x0005 // 1ٵ +#define MT_LR2 0x0006 // 2ٵ + + +#define MT_LBF 0x0014 // ʹ(ϵ) +#define MT_PBF 0x0015 // ϵ +#define MT_MBF 0x0016 // ϵ + + +// Ƶ Ʋ1 +#define OT_POINT 0x0105 // ȥλ +#define OT_PULLINGCYLINDER 0x0106 // ׿ / +#define OT_BLOWING 0x0108 // ׿ / +#define OT_FEED 0x010A // ϵ / +#define OT_LOOSE 0x010B // ϵ / +#define OT_PULL 0x010C // ϵ / +#define OT_FAN1_CTRL 0x000D // / +#define OT_PRESS_M_POLE 0x010E // ѹ׿ / +#define OT_TRIMMING 0x010F // ߿ / +#define OT_OWNCLIP 0x0110 // ¼׿ / +#define OT_UPCLIP 0x0111 // ϼ׿ / +#define OT_HEAD_SPIN 0x0112 // ͷת + +#define OT_RESERVE1 0x0113 // Ԥ1 +#define OT_RESERVE2 0x0114 // Ԥ2 + +#define OT_HEAD_UPDOWN 0x0119 // ͷ + +//:߲ +#define OT_HEAD_DOWN 0x011A // ͷ½λ +#define OT_GO_PRESS 0x011B // ѹ +#define OT_REACH_TRIM 0x011C // (߼λ) +#define OT_REACH_FEED 0x011D // ϵ +#define OT_PULL_FEED 0x011E // ϵ +#define OT_RETURN_TRIM 0x011F // ׻λ +#define OT_RETURN_UP_CLAMP 0x0120 // ϼ׻λ +#define OT_RETURN_LOEER_CLAMP 0x0121 // ¼׻λ +#define OT_RETURN_BLOW 0x0122 // ׻λ + +#define OT_RETURN_PULL 0x0123 // ׻λ +#define OT_OUTROLL_DOWN 0x0024 // ѹ / + +#define OT_ALLHEAD_DOWN 0x0125 // ͷ / +#define OT_PULLFRM_DOWN 0x0026 // ѹϿ / + +#define OT_OUTROLL_DOWN1 0x0027 // +#define OT_LEFT_ALIGN_ON1 0x0028 // +#define OT_LEFT_ALIGN_ON 0x0029 // Ա / +#define OT_RIGHT_ALIGN_ON 0x002A // ҶԱ / + +// 2 +#define UP_OPEN_ON 0x0001 // 򿪡硢 +#define DOWN_CLOSE_OFF 0x0002 // ½ر +//-------------------------------------------------------------------------------------------------------- + + + +//---------------------------------------ܺص-------------------------------------------------- +//ʼ +void InitAppCallback(void); // ʼ +void CheckSensorAndPos(void); // ⴫λ,Զ +void RefreshParas(int flag); // ˢ,ϵòʱˢ² +void RefreshStatus(void); // ״̬ˢ +void SensorsStatus(int mode, u8 * buf); // ź + +// +int GetWorkPosFromIndex(void); + + +//ֶ +void MotoToZero(u16 obj); // +void MoveMotoByHand(u16 obj, u16 dir, u16 spd); // ֶƶ +void OutputByHand(u16 obj, u16 act, u16 para); // +void MotosServoCtrl(u16 obj, u16 onoff); // ŷؿ +void ManualActionCtrl(u16 obj, u16 para2, u16 para3); // ֶ + + +// +int OpticalStartWork(void); // +void AllToReset(void); // ̸λ +void AllToZero(void); // ȫ +int GotoStartPos(void); // +int GotoAnchorPos(void); // ضλ +int GotoOffsetPos(void); // ƫƵ +void SetOffsetPos(void); // ƫƵ +int CheckFrame(void); // ߿ +int FastJump(u32 idx); // ǰ +int GotoWorkPos(void); // ع +int GotoFinishPos(void); // ؽ +int GotoFrameZeroPos(void); // λ(ԭ) +void ChangeRpm(int rpm); // תٸı +void WorkRpmToPara(void); // תٲı +int GotoFeedPos(void); // ϵ +void SetFeedPos(void); // ϵ + +//---------------------------------------------------------------------------------------------------- + +#endif// (CUR_MACHINE == MACH_OPTICAL) +#endif /*_OPTICAL_H_ */ diff --git a/EMBOS/Users/App/user/optical/opticalpara.c b/EMBOS/Users/App/user/optical/opticalpara.c new file mode 100644 index 0000000..0611e13 --- /dev/null +++ b/EMBOS/Users/App/user/optical/opticalpara.c @@ -0,0 +1,19 @@ +#define _IN_OPTICALPARA_C +#include "opticalpara.h" +#if (CUR_MACHINE == MACH_OPTICAL) + +void InitOpticalPara(void) +{ + // ע + SetMcParaNameString((void*)(&g_opticalMcParastrlist)); + SetWkParaNameString((void*)(&g_opticalWkParastrlist)); + + // עб + SetMcParaList((void*)(&g_defOpticalMcParaList)); + SetWkParaList((void*)(&g_defOpticalWkParaList)); + + // Χ + CheckMcParaRange(); + CheckWkParaRange(); +} +#endif// (CUR_MACHINE == MACH_OPTICAL) diff --git a/EMBOS/Users/App/user/optical/opticalpara.h b/EMBOS/Users/App/user/optical/opticalpara.h new file mode 100644 index 0000000..0801761 --- /dev/null +++ b/EMBOS/Users/App/user/optical/opticalpara.h @@ -0,0 +1,1453 @@ +#ifndef _OPTICALPARA_H_ +#define _OPTICALPARA_H_ +#include "paras.h" +#if (CUR_MACHINE == MACH_OPTICAL) + +//----------------------------------------------- + +// ò MC PARA +typedef struct +{//0 + u32 rev1[10]; +// 10 + u32 rev2[5]; +// 15 + u32 rev3[5]; +// 20 + u32 rev4[50-20]; +//50 + s32 xSensorPos; // X򴫸꣬Χ -2147483648--2147483647λ 0.01mm + s32 ySensorPos; // Y򴫸꣬Χ -2147483648--2147483647λ 0.01mm + s32 u1SensorPos; // ߶, Χ -100--10000λ0.01mm + u32 rev54; + s32 r1SensorAng; // תǶ, Χ -36000--36000λ0.01 +//55 + u32 rev5[70-55]; +//70 + s32 xOptNegaBorder; // xɲ򸺱߽(X-), Χ -2147483648--2147483647λ0.01mm + s32 xOptPosiBorder; // xɲ߽(X+), Χ -2147483648--2147483647λ0.01mm + s32 yOptNegaBorder; // yɲ򸺱߽(Y-), Χ -2147483648--2147483647λ0.01mm + s32 yOptPosiBorder; // yɲ߽(Y+), Χ -2147483648--2147483647λ0.01mm + s32 xMovNegaBorder; // xƶ򸺱߽(X-), Χ -2147483648--2147483647λ0.01mm +//75 + s32 xMovPosiBorder; // xƶ߽(X+), Χ -2147483648--2147483647λ0.01mm + s32 yMovNegaBorder; // yƶ򸺱߽(Y-), Χ -2147483648--2147483647λ0.01mm + s32 yMovPosiBorder; // yƶ߽(Y+), Χ -2147483648--2147483647λ0.01mm + s32 rev79; + s32 rev80; +//80 + s32 rev81; + s32 rev82; + s32 rkLiftLower; // ƶ, Χ -100--10000λ0.01mm + s32 rkLiftUper; // ƶ, Χ -100--10000λ0.01mm + s32 rev85; +// 85 + s32 rev86; + s32 liftMiddle; // мλã߽ĶΧ -100--10000λ0.01mm + s32 rev88; + s32 rev89; + s32 rev90; +//90 + u32 rev6[100-90]; +//100 +// ٶȲ + u32 xymvstspSpd; // xyֹͣٶ, Χ 1--100λmm/sĬ 10 + u32 xymvzSpd; // xyٶ, Χ 1--100λmm/sĬ 100 + u32 xymvlSpd; // xyٶ, Χ 1--1000λmm/sĬ 300 + u32 xymvSAdd; // xy߼ٶ, Χ 1--10000λmm/s2Ĭ 1000 + u32 xymvbrkAdd; // xyɲٶ, Χ 1--10000λmm/s2Ĭ 10000 +//105 + u32 xymvhSpd1; // xyֶƶٶ1, Χ 1--1000λmm/sĬ 10 + u32 xymvhSpd2; // xyֶƶٶ2, Χ 1--1000λmm/sĬ 200 + u32 xymvhSpd3; // xyֶƶٶ3, Χ 1--1000λmm/sĬ 500 + u32 xymaxSpd; // xyƶٶ, Χ 1--1000λmm/sĬ 1600 + u32 lmvstspSpd; // ֹͣٶ, Χ 1--100λmm/sĬ 10 +//110 + u32 lmvhSpd1; // ֶƶٶ1, Χ 1--1000λmm/sĬ 10 + u32 lmvhSpd2; // ֶƶٶ2, Χ 1--1000λmm/sĬ 200 + u32 lmvhSpd3; // ֶƶٶ3, Χ 1--1000λmm/sĬ 500 + u32 lmaxSpd; // ƶٶ, Χ 1--1000λmm/sĬ 1600 + u32 lmvSAdd; // ߼ٶ, Χ 1--10000λmm/s2Ĭ 1000 +//115 + u32 lmvbrkAdd; // ɲٶ, Χ 1--10000λmm/s2Ĭ 10000 + u32 lmvlSpd; // Ͽٶ, Χ 1--1000λmm/sĬ 300 + u32 minRkOptSpd; // Сٶ, Χ 1--100λmm/sĬ 10 + u32 maxRkOptSpd; // ٶ, Χ 1--1200λmm/sĬ 1000 + u32 rkOptAdd; // ߼ٶ, Χ 1--4000λmm/s2Ĭ 500 +//120 + u32 rkOptSlowAngle; // ߽СƫǶȣΧ 0--18000λ 0.01ȣĬ 3000 + u32 ustspSpd; // ͣٶ, Χ 1--500, λmm/sĬ 10 + u32 umvtzSpd; // ٶ, Χ 1--500λmm/sĬ 50 + u32 umoveSpd; // ٶ, Χ 1--500, λmm/sĬ 200 + u32 ustepSpd; // ٶ, Χ 1--500λmm/sĬ 50 +//125 + u32 utestSpd; // ѹٶ, Χ 1--500λmm/sĬ 10 + u32 uliftAdd; // ٶ, Χ 1--10000λmm/s2Ĭ 500 + u32 uBrkAdd; // ɲٶ, 1--10000λmm/s2Ĭ 1000 + u32 rotstspDps; // תͣٶ, Χ 1--3600, λ deg/s(/)Ĭ 10 + u32 rottzDps; // תٶ, 1--3600, λ deg/s(/)Ĭ 360 +//130 + u32 rotrunDps; // תתٶ, Χ 1--3600, λ deg/s(/)Ĭ 720 + u32 rotAddDpss; // ת˶ٶ, Χ 1--10000, λ deg/s(/뷽)Ĭ 500 + u32 rotBrkDpss; // תɲٶ, Χ 1--10000, λ deg/s(/뷽)Ĭ 5000 + u32 rev134; + u32 rev135; +//135 + u32 rev136; + u32 turnXYCompen; // սǺxy, Χ 0-10000λ0.01mm + u32 optMinSpd; // Сٶ + u32 rev139; + u32 rev140; + + u32 rev141; + u32 rev142; + u32 rev143; + u32 rev144; + u32 rev145; +//145 + u32 rev7[150-145]; +//150 + s32 rkMatThickness; // ӹϺ, Χ -100--10000λ0.01mm + s32 rkHighPos; // ӹ̧߶, Χ -100--10000λ0.01mm + s32 rkLowPos; // ӹ䵶߶ȣΧ -100--10000λ0.01mm + u32 rkLiftAng; // ӹ̧ǶȣΧ 0--18000λ0.01 + s32 opitEndPosOffset; // ˿λƫƣ Χ0--2000λ0.01mm +//155 + u32 rev156; + u32 rev157; + u32 rev158; + u32 rev159; + s32 rev160; +//160 + u32 rev161; + u32 rev162; + u32 rev163; + u32 fanCloseDelay; // رʱ, Χ 0--100λ + u32 finishStopSel; // ɺͣλѡ, 0, ǰλ; 1㣬2λ㣬3ϵ; 4ƫƵ; 5, +//165 + u32 offsetEn; // ƫƵЧ־; 0, Ч; 1, xЧ; 2, yЧ; 3, xyͬʱЧ + s32 offsetX; // ƫƵX(ʮֹͷƫֵ) + s32 offsetY; // ƫƵY(ʮֹͷƫֵ) + u32 rev169; + u32 rev170; +//170 + u32 rev171; + u32 rev172; + u32 rev173; + u32 gapDelay; // ݼʱ + u32 rev175; +//175 + u32 rev8[195-175]; +//195 + u32 autoFindZero; // Զ : 0, ʹ 1, ʹ + u32 rev9[199-196]; + s32 sendLengthBuc; // ϳȲ Χ -3000--3000λ0.01mmĬ 0 +//200 + u32 expectedOutput; // Ԥ + u32 LevelOfAccAndDec; // ٶƥϵ0.01 Χ 10-1000 +//202 + u32 SpinCompenCalBase; // ˿ Χ 10-5000, λ mmĬ1000 + u32 SpinCompenCalActLen; // ˿ʵʳ Χ 10-5000, λ mmĬ1000 + u32 rev205; + u32 offsetToSpinBack; //ƫȥ˿λú˾룬Χ 0-5000, λ 0.01mmĬ4000 + u32 beforeSpinLen; //˿ǰԤ˿ȷΧ 0-1000, λ1mmĬ40 +//207 + u32 JiaYaPointLength;//ѹ㳤0-5000λ0.01mmĬ200 + u32 LevelOfAccAndDec2; // ٶƥϵ2 Χ 1-10 + u32 materialFreeSwitch; // ϼ⿪ + u32 materialFreeScanNum;// ϼɨ Ĭ10000 + s32 xGapCorrect; // X϶,Χ-100--100 λ 0.01mmĬ 0 + s32 yGapCorrect; // Y϶,Χ-100--100 λ 0.01mmĬ 0 + u32 startPosoffx; // ʼλƫƣΪͬеļ϶Χ 0--10000λ0.01mm + u32 startPosoffy; // ʼλƫƣΧ 0--10000λ0.01mm +//215 + u32 rev11[255-215]; +} __attribute__ ((packed)) OpticalMcPara; +//---------------------------------------------- + + + +#ifdef _IN_OPTICALPARA_C +//----------------------------------------------- +//----------------------------------------------- +// Ʊ +static const char * g_opticalMcParastrlist[PARA_NUM] = +{ +// 0 + "", + "", + "", + "", + "", +// 5 + "", + "", + "", + "", + "", +// 10 + "", + "", + "", + "", + "", +// 15 + "", + "", + "", + "", + "", +// 20 + "", + "", + "", + "", + "", +// 25 + "", + "", + "", + "", + "", +// 30 + "", + "", + "", + "", + "", +// 35 + "", + "", + "", + "", + "", +// 40 + "", + "", + "", + "", + "", +// 45 + "", + "", + "", + "", + "", +// 50 + "X", + "Y", + "߶", + "", + "תǶ", +// 55 + "", + "", + "", + "", + "", +// 60 + "", + "", + "", + "", + "", +// 65 + "", + "", + "", + "", + "", +// 70 + "ɲϱ߽(X-)", + "ɲ±߽(X+)", + "ɲ߽(Y-)", + "ɲұ߽(Y+)", + "ƶϱ߽(X-)", +// 75 + "ƶ±߽(X+)", + "ƶ߽(Y-)", + "ƶұ߽(Y+)", + "λX", + "λY", +// 80 + "", + "", + "ƶ", + "ƶ", + "", +// 85 + "", + "", + "", + "", + "", +// 90 + "", + "", + "", + "", + "", +// 95 + "", + "", + "", + "", + "", +// 100 + "xyֹͣٶ", + "xyٶ", + "xyٶ", + "xy߼ٶ", + "xyɲٶ", +// 105 + "xyֶƶٶ1", + "xyֶƶٶ2", + "xyֶƶٶ3", + "xyƶٶ", + "ֹͣٶ", +// 110 + "ֶƶٶ1", + "ֶƶٶ2", + "ֶƶٶ3", + "ƶٶ", + "߼ٶ", +// 115 + "ɲٶ", + "Ͽٶ", + "Сٶ", + "ٶ", + "߼ٶ", +// 120 + "߽СƫǶ", + "ͣٶ", + "ٶ", + "ٶ", + "ٶ", +// 125 + "ѹٶ", + "ٶ", + "ɲٶ", + "תͣٶ", + "תٶ", +// 130 + "תתٶ", + "ת˶ٶ", + "תɲٶ", + "", + "", +// 135 + "", + "սǺxy", + "Сٶ", + "", + "", +// 140 + "", + "", + "", + "", + "", +// 145 + "", + "", + "", + "", + "", +// 150 + "ӹϺ", + "ӹ̧߶", + "ӹ䵶߶", + "ӹ̧Ƕ", + "˿λƫ", +// 155 + "", + "", + "", + "", + "", +// 160 + "", + "", + "", + "رʱ", + "ɺͣλѡ", +// 165 + "ƫƵЧ־", + "ƫƵX", + "ƫƵY", + "", + "", +// 170 + "", + "", + "", + "ݼʱ", + "", +// 175 + "", + "", + "", + "", + "", +// 180 + "", + "", + "", + "", + "", +// 185 + "", + "", + "", + "", + "", +// 190 + "", + "", + "", + "", + "", +// 195 + "Զ", + "44", + "33", + "22", + "ϳȲ", +// 200 + "Ԥ", + "ٶƥϵ", + "˿", + "˿ʵʳ", + "11", +// 205 + "ƫȥ˿λú˾", + "˿ǰԤ˿", + "ѹ㳤", + "", + "ϼ⿪", +// 210 + "ϼɨ", + "X϶", + "Y϶", + "Xʼλƫ", + "Yʼλƫ", +// 215 + "", + "", + "", + "", + "", +// 220 + "", + "", + "", + "", + "", +// 225 + "", + "", + "", + "", + "", +// 230 + "", + "", + "", + "", + "", +// 235 + "", + "", + "", + "", + "", +// 240 + "", + "", + "", + "", + "", +// 245 + "", + "", + "", + "", + "", +// 250 + "", + "", + "", + "", + "", +// 255 + "һ", +}; +//----------------------------------------------- + +// Ĭϲ + +static const u32 g_defOpticalMcParaList[PARA_NUM][4] = +{ +// 0 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 5 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 10 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 15 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 20 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 25 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 30 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 35 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 40 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 45 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 50 + {PTYPE_S, -2147483648, 2147483647, 80500}, //xSensorPos; // X򴫸꣬Χ -2147483648--2147483647λ 0.01mm + {PTYPE_S, -2147483648, 2147483647, -9100}, //ySensorPos; // Y򴫸꣬Χ -2147483648--2147483647λ 0.01mm + {PTYPE_S, -2147483648, 2147483647, 5000}, //u1SensorPos; // , Χ 0--10000λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 0}, //u2SensorPos; // 󵶴, Χ 0--10000λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 9000}, //r1SensorAng; // ת, Χ 0--36000λ0.01 +// 55 + {PTYPE_S, -2147483648, 2147483647, 0}, //r2SensorAng; // 󵶴, Χ 0--36000λ0.01 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 60 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 65 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 70 + {PTYPE_S, -2147483648, 2147483647, -2000}, //xPlotNegaBorder; // xɲ򸺱߽(X-), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 68000}, //xPlotPosiBorder; // xɲ߽(X+), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, -2000},//yPlotNegaBorder; yɲ򸺱߽(Y-), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 47000},//yPlotPosiBorder; yɲ߽(Y+), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, -12000},//xMovNegaBorder; xƶ򸺱߽(X-), Χ -2147483648--2147483647λ0.01mm +// 75 + {PTYPE_S, -2147483648, 2147483647, 80500}, //s32 xMovPosiBorder; // xƶ߽(X+), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, -9100}, //yMovNegaBorder; // yƶ򸺱߽(Y-), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 62900}, //yMovPosiBorder; // yƶ߽(Y+), Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -10000, 10000, 0}, //rkOffsetX; // ҵλX, Χ -10000--10000λ0.01mm + {PTYPE_S, -10000, 10000, -6100}, //rkOffsetY; // ҵλY, Χ -10000--10000λ0.01mm +// 80 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_S, -100, 10000, -200}, //s32 rkLiftLower; // ƶ, Χ -100--10000 + {PTYPE_S, -100, 10000, 5150}, //s32 rkLiftUper; // ƶ, Χ -100--10000 + {PTYPE_S, -100, 10000, -200}, //s32 skLiftLower; // ƶ, Χ -100--10000λ0.01mm +// 85 + {PTYPE_S, -100, 10000, 67000}, //s32 skLiftUper; // ƶ, Χ -100--10000λ0.01mm + {PTYPE_S, -100, 10000, 60000}, // s32 liftMiddle; // мλã߽ĶΧ -100--10000λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 0}, // s32 datbegOffsetX; // ʼƫX, Χ -2147483648--2147483647λ0.01mm + {PTYPE_S, -2147483648, 2147483647, 0}, // s32 datbegOffsetY; // ʼƫY, Χ -2147483648--2147483647λ0.01mm + {PTYPE_U, 0, 0, 0}, // +// 90 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_S, -10000, 10000, 0}, // s32 anchorPointX; // Xλƫֵ(ʮֹͷƫֵ), Χ -10000--10000λ0.01mm + {PTYPE_S, -10000, 10000, 0}, // s32 anchorPointY; // Yλƫֵ(ʮֹͷƫֵ), Χ -10000--10000λ0.01mm + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 95 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 100 + {PTYPE_U, 1, 100, 10}, // u32 xymvstspSpd; // xyֹͣٶ, Χ 1--100λmm/sĬ 10 + {PTYPE_U, 1, 100, 100}, // u32 xymvzSpd; // xyٶ, Χ 1--100λmm/sĬ 100 + {PTYPE_U, 1, 1000, 300}, // u32 xymvlSpd; // xyٶ, Χ 1--1000λmm/sĬ 300 + {PTYPE_U, 1, 10000, 1000}, // u32 xymvSAdd; // xy߼ٶ, Χ 1--10000λmm/s2Ĭ 1000 + {PTYPE_U, 1, 10000, 10000}, // u32 xymvbrkAdd; // xyɲٶ, Χ 1--10000λmm/s2Ĭ 10000 +// 105 + {PTYPE_U, 1, 1000, 10}, // u32 xymvhSpd1; // xyֶƶٶ1, Χ 1--1000λmm/sĬ 10 + {PTYPE_U, 1, 1000, 200}, // u32 xymvhSpd2; // xyֶƶٶ2, Χ 1--1000λmm/sĬ 200 + {PTYPE_U, 1, 1000, 500}, // u32 xymvhSpd3; // xyֶƶٶ3, Χ 1--1000λmm/sĬ 500 + {PTYPE_U, 1, 1000, 600}, // u32 xymaxSpd; // xyƶٶ, Χ 1--1000λmm/sĬ 1600 + {PTYPE_U, 1, 100, 10}, // u32 lmvstspSpd; // ֹͣٶ, Χ 1--100λmm/sĬ 10 +// 110 + {PTYPE_U, 1, 1000, 10}, // u32 lmvhSpd1; // ֶƶٶ1, Χ 1--1000λmm/sĬ 10 + {PTYPE_U, 1, 1000, 200}, // u32 lmvhSpd2; // ֶƶٶ2, Χ 1--1000λmm/sĬ 200 + {PTYPE_U, 1, 1000, 500}, // u32 lmvhSpd3; // ֶƶٶ3, Χ 1--1000λmm/sĬ 500 + {PTYPE_U, 1, 1000, 600}, // u32 lmaxSpd; // ƶٶ, Χ 1--1000λmm/sĬ 1600 + {PTYPE_U, 1, 1000, 1000}, // lmvSAdd; // ߼ٶ, Χ 1--10000λmm/s2Ĭ 1000 +// 115 + {PTYPE_U, 1, 10000, 10000}, // u32 lmvbrkAdd; // ɲٶ, Χ 1--10000λmm/s2Ĭ 10000 + {PTYPE_U, 1, 1000, 300}, // u32 lmvlSpd; // Ͽٶ, Χ 1--1000λmm/sĬ 300 + {PTYPE_U, 1, 100, 10}, // u32 minRkOptSpd; // Сٶ, Χ 1--100λmm/sĬ 10 + {PTYPE_U, 1, 1200, 1000}, // u32 maxRkOptSpd; // ٶ, Χ 1--1200λmm/sĬ 1000 + {PTYPE_U, 1, 4000, 500}, // u32 rkOptAdd; // ߼ٶ, Χ 1--4000λmm/s2Ĭ 500 +// 120 + {PTYPE_U, 1, 18000, 3000}, // u32 rkOptSlowAngle; // ߽СƫǶȣΧ 0--18000λ 0.01ȣĬ 3000 + {PTYPE_U, 1, 500, 10}, // u32 ustspSpd; // ͣٶ, Χ 1--500, λmm/sĬ 10 + {PTYPE_U, 1, 500, 20}, // u32 umvtzSpd; // ٶ, Χ 1--500λmm/sĬ 50 + {PTYPE_U, 1, 500, 50}, // u32 umoveSpd; // ٶ, Χ 1--500, λmm/sĬ 200 + {PTYPE_U, 1, 500, 30}, // u32 ustepSpd; // ٶ, Χ 1--500λmm/sĬ 50 +// 125 + {PTYPE_U, 1, 500, 10}, // u32 utestSpd; // ѹٶ, Χ 1--500λmm/sĬ 10 + {PTYPE_U, 1, 10000, 500}, // u32 uliftAdd; // ٶ, Χ 1--10000λmm/s2Ĭ 500 + {PTYPE_U, 1, 10000, 1000}, // u32 uBrkAdd; // ɲٶ, 1--10000λmm/s2Ĭ 1000 + {PTYPE_U, 1, 3600, 5}, // u32 rotstspDps; // תͣٶ, Χ 1--3600, λ deg/s(/)Ĭ 10 + {PTYPE_U, 1, 3600, 100}, // u32 rottzDps; // תٶ, 1--3600, λ deg/s(/)Ĭ 360 +// 130 + {PTYPE_U, 1, 3600, 5}, // u32 rotrunDps; // תתٶ, Χ 1--3600, λ deg/s(/)Ĭ 720 + {PTYPE_U, 1, 10000, 500}, // u32 rotAddDpss; // ת˶ٶ, Χ 1--10000, λ deg/s(/뷽)Ĭ 500 + {PTYPE_U, 1, 10000, 5000}, // u32 rotBrkDpss; // תɲٶ, Χ 1--10000, λ deg/s(/뷽)Ĭ 5000 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 135 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 10000, 13}, //u32 turnXYCompen; // սǺxy, Χ 0-10000λ0.01mm + {PTYPE_U, 1, 1000, 10}, // u32 optMinSpd; // Сٶ + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 140 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 145 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 150 + {PTYPE_S, -100, 2147483647, 0}, // s32 rkMatThickness; // ӹϺ, Χ -100--10000λ0.01mm + {PTYPE_S, -100, 10000, 5000}, // s32 rkHighPos; // ӹ̧߶, Χ -100--10000λ0.01mm + {PTYPE_S, -100, 10000, 0}, // s32 rkLowPos; // ӹ䵶߶ȣΧ -100--10000λ0.01mm + {PTYPE_U, 0, 18000, 0}, // u32 rkLiftAng; // ӹ̧ǶȣΧ 0--18000λ0.01 + {PTYPE_S, 0, 2000,1000}, // s32 opitEndPosOffset; // ˿λƫƣ Χ0--2000λ0.01mm +// 155 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 160 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 100, 0}, // u32 fanCloseDelay; // رʱ, Χ 0--100λ + {PTYPE_U, 0, 100, 0}, // u32 finishStopSel; // ɺͣλѡ, 0, ǰλ; 1㣬2λ㣬3ϵ; 4ƫƵ; 5, +// 165 + {PTYPE_U, 0, 100, 0}, // u32 offsetEn; // ƫƵЧ־; 0, Ч; 1, xЧ; 2, yЧ; 3, xyͬʱЧ + {PTYPE_S, -2147483648, 2147483647, 0}, // s32 offsetX; // ƫƵX + {PTYPE_S, -2147483648, 2147483647, 0}, // s32 offsetY; // ƫƵY + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 170 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 2147483647, 0}, // u32 gapDelay; // ݼʱ + {PTYPE_U, 0, 0, 0}, // +// 175 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 180 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 185 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 190 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 195 + {PTYPE_U, 0, 100, 0}, // u32 autoFindZero; // Զ : 0, ʹ 1, ʹ + {PTYPE_U, 0, 4, 0}, // + {PTYPE_U, 0, 4, 0}, // + {PTYPE_U, 0, 4, 0}, // + {PTYPE_S, -3000, 3000, 0}, // s32 sendLengthBuc; // ϳȲ Χ -3000--3000λ0.01mmĬ 0 +// 200 + {PTYPE_U, 0, 4294967295, 0}, // u32 expectedOutput; // Ԥ + {PTYPE_U, 1, 1000, 1}, // LevelOfAccAndDec; // ٶƥϵ Χ 1-10 + {PTYPE_U, 10, 5000, 1000}, //u32 SpinCompenCalBase; // ˿ Χ 10-5000, λ mmĬ1000 + {PTYPE_U, 10, 5000, 1000}, //u32 SpinCompenCalActLen; // ˿ʵʳ Χ 10-5000, λ mmĬ1000 + {PTYPE_U, 0, 4, 0}, // +// 205 + {PTYPE_U, 0, 10000, 4000}, // u32 offsetToSpinBack; //ƫȥ˿λú˾룬Χ 0-10000, λ 0.01mmĬ4000 + {PTYPE_U, 0, 1000, 40}, // u32 beforeSpinLen; //˿ǰԤ˿ȣΧ 0-1000, λ mmĬ40 + {PTYPE_U, 0, 5000, 200}, // u32 JiaYaPointLength;//ѹ㳤0-5000λ0.01mmĬ200 + {PTYPE_U, 1, 1000, 1}, // LevelOfAccAndDec2; // ٶƥϵ2 Χ 1-10 + {PTYPE_U, 0, 1, 1}, //u32 materialFreeSwitch; // ϼ⿪ +// 210 + {PTYPE_U, 0, 100000, 10000}, // u32 materialFreeScanNum;// ϼɨ Ĭ10000 + {PTYPE_S, -1000, 1000, 0}, // s32 xGapCorrect; // X϶,Χ-100--100 λ 0.01mmĬ 0 + {PTYPE_S, -1000, 1000, 0}, // s32 yGapCorrect; // Y϶,Χ-100--100 λ 0.01mmĬ 0 + {PTYPE_U, 0, 10000, 1000}, // u32 startPosoffx; // ʼλƫƣΧ 0--10000λ0.01mm + {PTYPE_U, 0, 10000, 1000}, // u32 startPosoffy; // ʼλƫƣΧ 0--10000λ0.01mm +// 215 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 220 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 225 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 230 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 235 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 240 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 245 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 250 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 255 + {PTYPE_U, 0, 0, 0}, // +}; +#endif// _IN_OPTICALPARA_C + +// WK PARA +typedef struct +{ + s32 arr[256]; +} __attribute__ ((packed)) OpticalWkPara; + +#ifdef _IN_OPTICALPARA_C +//----------------------------------------------- +// Ʊ +static const char * g_opticalWkParastrlist[PARA_NUM] = +{ +// 0 + "", + "", + "", + "", + "", +// 5 + "", + "", + "", + "", + "", +// 10 + "", + "", + "", + "", + "", +// 15 + "", + "", + "", + "", + "", +// 20 + "", + "", + "", + "", + "", +// 25 + "", + "", + "", + "", + "", +// 30 + "", + "", + "", + "", + "", +// 35 + "", + "", + "", + "", + "", +// 40 + "", + "", + "", + "", + "", +// 45 + "", + "", + "", + "", + "", +// 50 + "", + "", + "", + "", + "", +// 55 + "", + "", + "", + "", + "", +// 60 + "", + "", + "", + "", + "", +// 65 + "", + "", + "", + "", + "", +// 70 + "", + "", + "", + "", + "", +// 75 + "", + "", + "", + "", + "", +// 80 + "", + "", + "", + "", + "", +// 85 + "", + "", + "", + "", + "", +// 90 + "", + "", + "", + "", + "", +// 95 + "", + "", + "", + "", + "", +// 100 + "", + "", + "", + "", + "", +// 105 + "", + "", + "", + "", + "", +// 110 + "", + "", + "", + "", + "", +// 115 + "", + "", + "", + "", + "", +// 120 + "", + "", + "", + "", + "", +// 125 + "", + "", + "", + "", + "", +// 130 + "", + "", + "", + "", + "", +// 135 + "", + "", + "", + "", + "", +// 140 + "", + "", + "", + "", + "", +// 145 + "", + "", + "", + "", + "", +// 150 + "", + "", + "", + "", + "", +// 155 + "", + "", + "", + "", + "", +// 160 + "", + "", + "", + "", + "", +// 165 + "", + "", + "", + "", + "", +// 170 + "", + "", + "", + "", + "", +// 175 + "", + "", + "", + "", + "", +// 180 + "", + "", + "", + "", + "", +// 185 + "", + "", + "", + "", + "", +// 190 + "", + "", + "", + "", + "", +// 195 + "", + "", + "", + "", + "", +// 200 + "", + "", + "", + "", + "", +// 205 + "", + "", + "", + "", + "", +// 210 + "", + "", + "", + "", + "", +// 215 + "", + "", + "", + "", + "", +// 220 + "", + "", + "", + "", + "", +// 225 + "", + "", + "", + "", + "", +// 230 + "", + "", + "", + "", + "", +// 235 + "", + "", + "", + "", + "", +// 240 + "", + "", + "", + "", + "", +// 245 + "", + "", + "", + "", + "", +// 250 + "", + "", + "", + "", + "", +// 255 + "һ", +}; +//----------------------------------------------- + +// Ĭϲ + +static const u32 g_defOpticalWkParaList[PARA_NUM][4] = +{ +// 0 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 5 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 10 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 15 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 20 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 25 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 30 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 35 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 40 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 45 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 50 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 55 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 60 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 65 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 70 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 75 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 80 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 85 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 90 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 95 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 100 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 105 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 110 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 115 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 120 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 125 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 130 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 135 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 140 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 145 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 150 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 155 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 160 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 165 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 170 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 175 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 180 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 185 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 190 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 195 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 200 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 205 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 210 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 215 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 220 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 225 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 230 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 235 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 240 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 245 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 250 + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // + {PTYPE_U, 0, 0, 0}, // +// 255 + {PTYPE_U, 0, 0, 0}, // +}; +#endif // _IN_OPTICALPARA_C + +#ifdef _IN_OPTICALPARA_C + +OpticalMcPara * g_pOpticalMcPara = ((OpticalMcPara *)(&g_mcPara)); +OpticalWkPara * g_pOpticalWkPara = ((OpticalWkPara *)(&g_wkPara)); + + +#else + +extern OpticalMcPara * g_pOpticalMcPara; +extern OpticalWkPara * g_pOpticalWkPara; +#endif // _IN_OPTICALPARA_C +//----------------------------------------------- +void InitOpticalPara(void); +#endif// (CUR_MACHINE == MACH_OPTICAL) +#endif /* _OPTICALPARA_H_ */ diff --git a/EMBOS/Users/App/workctrl/debug.c b/EMBOS/Users/App/workctrl/debug.c new file mode 100644 index 0000000..b394130 --- /dev/null +++ b/EMBOS/Users/App/workctrl/debug.c @@ -0,0 +1,1000 @@ + +#define _IN_DEBUG_C + +#include "debug.h" +#include "shell.h" +#include "inout.h" +#include "delay.h" +#include "trigger.h" +#include "operator.h" +#include "workctrl.h" + +//-------------------------------------------------------------------- +void TestInputs(char * para1, char * para2); +void TestOutputs(char * para1, char * para2); +void TestExInputs(char * para1, char * para2); +void TestExOutput(char * para1, char * para2); +//-------------------------------------------------------------------- + +void InitDebug(void) +{ +#if (INPUT_NUM > 0) + AddShellCmd("INPUT", "input detect", TestInputs); +#endif + +#if (OUTPUT_NUM > 0) + AddShellCmd("OUTPUT", "output control", TestOutputs); +#endif + +#if (USE_IOEX > 0) + AddShellCmd("EXINPUT", "ex input detect", TestExInputs); + AddShellCmd("EXOUTPUT", "ex output control", TestExOutput); +#endif +} + +//------------------------------------------------------------------------------------------------------------------------------------------------------------ +typedef char NameStr[INPUT_STR_LEN]; + +// Թ +#if (INPUT_NUM > 0) + +NameStr * g_inputName = NULL; + +#define INPUT_CASE_OP(cs) \ +{\ + case cs:\ + {\ + char*str="";\ + if (g_inputName != NULL)\ + {\ + str = g_inputName[cs-1];\ + }\ + if ((temp&mod) != 0)\ + {\ + printf("%d. Input%d is off (%s) \r\n", inidx++, cs, str);\ + }\ + else\ + {\ + printf("%d. Input%d is on (%s) \r\n", inidx++, cs, str);\ + }\ + break;\ + }\ +} + +#define ALM_CASE_OP(cs) \ +{\ + case (cs):\ + {\ + if ((temp&mod) != 0)\ + {\ + printf("%d. M%d alarm is off \r\n", inidx++, cs);\ + }\ + else\ + {\ + printf("%d. M%d alarm is on \r\n", inidx++, cs);\ + }\ + break;\ + }\ +} + +void TestInputs(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + + //-------------------------------- + { + int inidx = 0; + u16 inputsta; + u16 almsta; + u8 zp1sta, zp2sta; + s32 ecd1, ecd2, ecdtemp; + u16 temp, mod; + int delay = 0; // ʱʱ + int i; + + inputsta = GetInputStatus(); + inputsta = ~inputsta; + + almsta = GetAlarmValue(); + almsta = ~almsta; + + zp1sta = GetZP1Status(); + zp1sta = ~zp1sta; + + zp2sta = GetZP2Status(); + zp2sta = ~zp2sta; + + ecd1 = GetEcdCounter(ECD_SEL1); + ecd1 = ~ecd1; + ecd2 = GetEcdCounter(ECD_SEL2); + ecd2 = ~ecd2; + + do + { + temp = GetInputStatus(); + if (temp != inputsta) + { + mod = 0x01; + for (i = 1; i <= 16; i++) + { + if ((inputsta&mod) != (temp&mod)) + { + switch (i) + { + INPUT_CASE_OP(1); + INPUT_CASE_OP(2); + INPUT_CASE_OP(3); + INPUT_CASE_OP(4); + INPUT_CASE_OP(5); + INPUT_CASE_OP(6); + INPUT_CASE_OP(7); + INPUT_CASE_OP(8); + INPUT_CASE_OP(9); + INPUT_CASE_OP(10); + INPUT_CASE_OP(11); + INPUT_CASE_OP(12); + INPUT_CASE_OP(13); + INPUT_CASE_OP(14); + INPUT_CASE_OP(15); + INPUT_CASE_OP(16); + default: + break; + } + } + mod = mod << 1; + DelayMs(1); + delay++; + } + inputsta = temp; + } + + temp = GetAlarmValue(); + if (temp != almsta) + { + mod = 0x01; + for (i = 1; i <= 6; i++) + { + if ((almsta&mod) != (temp&mod)) + { + switch (i) + { + ALM_CASE_OP(1); + ALM_CASE_OP(2); + ALM_CASE_OP(3); + ALM_CASE_OP(4); + ALM_CASE_OP(5); + ALM_CASE_OP(6); + default: + break; + } + } + + mod = mod << 1; + DelayMs(1); + delay++; + } + almsta = temp; + } + + temp = GetZP1Status(); + if (temp != zp1sta) + { + if (temp == SENSOR_ON) + { + printf("%d. ZP1 is on \r\n", inidx++); + } + else + { + printf("%d. ZP1 is off \r\n", inidx++); + } + DelayMs(1); + delay++; + zp1sta = temp; + } + + temp = GetZP2Status(); + if (temp != zp2sta) + { + if (temp == SENSOR_ON) + { + printf("%d. ZP2 is on \r\n", inidx++); + } + else + { + printf("%d. ZP2 is off \r\n", inidx++); + } + DelayMs(1); + delay++; + zp2sta = temp; + } + + ecdtemp = GetEcdCounter(ECD_SEL1); + if (ecdtemp != ecd1) + { + ecd1 = ecdtemp; + + printf("%d. Ecd1 = %d \r\n", inidx++, ecd1); + + DelayMs(1); + delay++; + } + + ecdtemp = GetEcdCounter(ECD_SEL2); + if (ecdtemp != ecd2) + { + ecd2 = ecdtemp; + + printf("%d. Ecd2 = %d \r\n", inidx++, ecd2); + + DelayMs(1); + delay++; + } + + DelayMs(10); + delay += 10; + + if (delay >= 500) + { + delay = 0; + ReportError(0); + } + + TriggerTask(); + OperatorTaskWhenRun(0); + + if (IsConsoleCancel() != 0) // նֹͣ + { + break; + } + + }while(p1 != 0); + } +} + +void SetInputNameString(void* pDat) +{ + g_inputName = pDat; +} + +#endif + +//---------------------------------------------------------------- + +#if (OUTPUT_NUM > 0) + +NameStr * g_outputName = NULL; + +#define OUT_CASE_OP(cs) \ +{\ + case cs: \ + {\ + char*str="";\ + if (g_outputName != NULL)\ + {\ + str = g_outputName[cs-1];\ + }\ + if (p2 == 0)\ + {\ + Output##cs##Off();\ + printf("Output%d is off (%s) \r\n", cs, str);\ + }\ + else if (p2 == 1)\ + {\ + Output##cs##On();\ + printf("Output%d is on (%s) \r\n", cs, str);\ + }\ + break; \ + }\ +} + +#define MOTO_CASE_DIR(cs) \ +{\ + case cs: \ + {\ + if (p2 == 0)\ + {\ + SetMoto##cs##SignOff();\ + printf("moto%d dir is off \r\n", cs);\ + }\ + else if (p2 == 1)\ + {\ + SetMoto##cs##SignOn();\ + printf("moto%d dir is on \r\n", cs);\ + }\ + break; \ + }\ +} + +#define MOTO_CASE_PULSE(cs) \ +{\ + case cs: \ + {\ + if (p2 == 0)\ + {\ + SetMoto##cs##PulseOff();\ + printf("moto%d pulse is off \r\n", cs);\ + }\ + else if (p2 == 1)\ + {\ + SetMoto##cs##PulseOn();\ + printf("moto%d pulse is on \r\n", cs);\ + }\ + break; \ + }\ +} + +#define MOTO_CASE_SEL1(cs) \ +{\ + case cs: \ + {\ + if (p2 == 0)\ + {\ + SetMoto##cs##SelAOff();\ + printf("moto%d sel1 is off \r\n", cs);\ + }\ + else if (p2 == 1)\ + {\ + SetMoto##cs##SelAOn();\ + printf("moto%d sel1 is on \r\n", cs);\ + }\ + break; \ + }\ +} + +#define MOTO_CASE_SEL2(cs) \ +{\ + case cs: \ + {\ + if (p2 == 0)\ + {\ + SetMoto##cs##SelBOff();\ + printf("moto%d sel2 is off \r\n", cs);\ + }\ + else if (p2 == 1)\ + {\ + SetMoto##cs##SelBOn();\ + printf("moto%d sel2 is on \r\n", cs);\ + }\ + break; \ + }\ +} + +#define MOTO_CASE_SERVO(cs) \ +{\ + case cs: \ + {\ + if (p2 == 0)\ + {\ + MotoServoCtrl(cs-1, SERVO_OFF);\ + printf("moto%d servo is off \r\n", cs);\ + }\ + else if (p2 == 1)\ + {\ + MotoServoCtrl(cs-1, SERVO_ON);\ + printf("moto%d servo is on \r\n", cs);\ + }\ + break; \ + }\ +} + +void TestOutputs(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + + //-------------------------------- + if (p1 == 0) + { + int p2, count, timeout; + p2 = 1; + count = 1; + timeout = 0; + do + { + if (timeout == 0) + { + Output1Off(); + Output2Off(); + Output3Off(); + Output4Off(); + Output5Off(); + Output6Off(); + Output7Off(); + Output8Off(); + switch (count) + { + OUT_CASE_OP(1); + OUT_CASE_OP(2); + OUT_CASE_OP(3); + OUT_CASE_OP(4); + OUT_CASE_OP(5); + OUT_CASE_OP(6); + OUT_CASE_OP(7); + OUT_CASE_OP(8); + default: + break; + } + count++; + if (count > 8) + { + count = 1; + } + } + + DelayRef(1); + timeout++; + if (timeout > 1000) + { + timeout = 0; + } + + if (IsConsoleCancel() != 0) // նֹͣ + { + Output1Off(); + Output2Off(); + Output3Off(); + Output4Off(); + Output5Off(); + Output6Off(); + Output7Off(); + Output8Off(); + break; + } + + }while(1); + } + else if (p1 >= 1 && p1 <= 8) + { + switch (p1) + { + OUT_CASE_OP(1); + OUT_CASE_OP(2); + OUT_CASE_OP(3); + OUT_CASE_OP(4); + OUT_CASE_OP(5); + OUT_CASE_OP(6); + OUT_CASE_OP(7); + OUT_CASE_OP(8); + default: + break; + } + } + else if (p1 == 10) + { + if (p2 == 0) + { + SerIdOutOff(); + printf("SerIdOutOff\r\n"); + } + else if (p2 == 1) + { + SerIdOutOn(); + printf("SerIdOutOn\r\n"); + } + } + else if (p1 == 20) + { + if (p2 == 0) + { + SetMpOutOff(); + printf("SetMpOutOff\r\n"); + } + else if (p2 == 1) + { + SetMpOutOn(); + printf("SetMpOutOn\r\n"); + } + } + else if (p1 == 21) + { + for (int i = 0; i < p2; i++) + { + SetMpOutOn(); + DelayUs(100); + SetMpOutOff(); + DelayUs(100); + } + printf("mp signal end\r\n"); + } + else if (p1 == 30) + { + if (p2 == 0) + { + SetEn485OutOff(); + printf("SetEn485OutOff\r\n"); + } + else + { + SetEn485OutOn(); + printf("SetEn485OutOn\r\n"); + } + } + else if (p1 >= 41 && p1 <= 46) + {// Ե + p1 -= 40; + switch (p1) + { + MOTO_CASE_DIR(1); + MOTO_CASE_DIR(2); + MOTO_CASE_DIR(3); + MOTO_CASE_DIR(4); + MOTO_CASE_DIR(5); + MOTO_CASE_DIR(6); + default: + break; + } + } + else if (p1 >= 51 && p1 <= 56) + {// Ե + p1 -= 50; + switch (p1) + { + MOTO_CASE_PULSE(1); + MOTO_CASE_PULSE(2); + MOTO_CASE_PULSE(3); + MOTO_CASE_PULSE(4); + MOTO_CASE_PULSE(5); + MOTO_CASE_PULSE(6); + default: + break; + } + } + else if (p1 >= 61 && p1 <= 66) + {// Եָֹ1 + p1 -= 60; + switch (p1) + { + MOTO_CASE_SEL1(1); + MOTO_CASE_SEL1(2); + MOTO_CASE_SEL1(3); + MOTO_CASE_SEL1(4); + MOTO_CASE_SEL1(5); + MOTO_CASE_SEL1(6); + default: + break; + } + } + else if (p1 >= 71 && p1 <= 76) + {// Եָֹ2 + p1 -= 70; + switch (p1) + { + MOTO_CASE_SEL2(1); + MOTO_CASE_SEL2(2); + MOTO_CASE_SEL2(3); + MOTO_CASE_SEL2(4); + MOTO_CASE_SEL2(5); + MOTO_CASE_SEL2(6); + default: + break; + } + } + else if (p1 >= 81 && p1 <= 86) + {// Եʹ + p1 -= 80; + switch (p1) + { + MOTO_CASE_SERVO(1); + MOTO_CASE_SERVO(2); + MOTO_CASE_SERVO(3); + MOTO_CASE_SERVO(4); + MOTO_CASE_SERVO(5); + MOTO_CASE_SERVO(6); + default: + break; + } + } +} + + +void SetOutputNameString(void* pDat) +{ + g_outputName = pDat; +} + +#endif + +#if (USE_IOEX > 0) +NameStr * g_exInputName = NULL; +NameStr * g_exOutputName = NULL; +int g_exInputNum = 0; +int g_exOutputNum = 0; +NameStr * g_exidName = NULL; + +void SetExInputNameString(void * pDat, int inum) +{ + g_exInputName = pDat; + g_exInputNum = inum; +} +void SetExOutputNameString(void * pDat, int onum) +{ + g_exOutputName = pDat; + g_exOutputNum = onum; +} + +#define EXID_CASE_OP(cs) \ +{\ + case (cs+1+20):\ + {\ + char*str="";\ + if (g_exidName != NULL)\ + {\ + str = g_exidName[cs];\ + }\ + if ((temp&mod) != 0)\ + {\ + printf("%d. Exid%d is off (%s) \r\n", inidx++, cs, str);\ + }\ + else\ + {\ + printf("%d. Exid%d is on (%s) \r\n", inidx++, cs, str);\ + }\ + }\ + break;\ +} + +void TestExInputs(char * para1, char * para2) +{ + int p1, p2; + int inidx = 0; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + } + + if (p1 == p2) + { + } + + //-------------------------------- + { + u16 exinbuf[EXIO_PORT_NUM], oldexinbuf[EXIO_PORT_NUM]; + u16 temp, old, mod, i, j; + int addr; + int num; + int init; + int sdct = 0; + + num = (g_exInputNum + EXIO_PER_PORT-1) / EXIO_PER_PORT; + if (num > EXIO_PORT_NUM) + { + num = EXIO_PORT_NUM; + } + GetExInputs(exinbuf); + for (i = 0; i < num; i++) + { + temp = exinbuf[i]; + temp = ~temp; + oldexinbuf[i] = temp; + } + + do + { + for (i = 0; i < num; i++) + { + temp = exinbuf[i]; + old = oldexinbuf[i]; + mod = 0x01; + for (j = 0; j < EXIO_PER_PORT; j++) + { + if ((temp&mod) != (old&mod)) + { + char*str=""; + addr = i*EXIO_PER_PORT+j; + if (g_exInputName != NULL) + { + str = g_exInputName[addr]; + } + + if ((temp&mod) != 0) + { + printf("%d. addr=%d, N7(%d) Input%d is off (%s) \r\n", inidx++, addr+1, i+1, j+1, str); + } + else + { + printf("%d. addr=%d, N7(%d) Input%d is on (%s) \r\n", inidx++, addr+1, i+1, j+1, str); + } + } + mod *= 2; + DelayMs(2); + sdct += 2; + } + + if (init == 0) + {// ӷָ + printf("--------------------- \r\n"); + DelayMs(50); + sdct += 50; + } + } + memcpy(oldexinbuf, exinbuf, EXIO_PORT_NUM*sizeof(u16)); + + DelayMs(1); + + sdct += 1; + if (sdct > 500) + { + sdct = 0; + ReportError(0); + } + TriggerTask(); // ʱִУTCP ӣ + OperatorTaskWhenRun(0); + + if (IsConsoleCancel() != 0) // նֹͣ + { + break; + } + + init = 1; + GetExInputs(exinbuf); + + }while(p1 != 0); + } +} + +void OutByAddrOn(int idx, int addr) +{ + char*str="";\ + if (g_exOutputName != NULL) + { + str = g_exOutputName[addr-1]; + } + + SetExOutput(addr, Bit_RESET); + printf("%d. addr=%d, N7(%d) Output%d is on (%s) \r\n", idx++, addr, (addr-1)/EXIO_PORT_NUM+1, addr%EXIO_PORT_NUM, str); + DelayMs(4); +} + +void OutByAddrOff(int idx, int addr) +{ + char*str="";\ + if (g_exOutputName != NULL) + { + str = g_exOutputName[addr-1]; + } + + SetExOutput(addr, Bit_SET); + printf("%d. addr=%d, N7(%d) Output%d is off (%s) \r\n", idx++, addr, (addr-1)/EXIO_PORT_NUM+1, addr%EXIO_PORT_NUM, str); + DelayMs(4); +} + +void TestExOutput(char * para1, char * para2) +{ + int p1, p2; + int count, delay; + int inidx = 0; + int dl; + int num; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + + num = g_exOutputNum; + if (num > MAX_EXIO_ADDR) + { + num = MAX_EXIO_ADDR; + } + + if (p1 == 0) + { + if (p2 == 0 || p2 == 1) + { + int i; + if (p2 == 0) + { + for (i = 1; i <= num; i++) + { + OutByAddrOff(inidx, i); + } + inidx++; + } + else if (p2 == 1) + { + for (i = 1; i <= num; i++) + { + OutByAddrOn(inidx, i); + } + inidx++; + } + } + else + { + int rep, i; + if (p2 == 2) + { + rep = 1; + } + else + { + rep = S32_MAX; + } + do + { + for (i = 1; i <= num; i++) + { + OutByAddrOn(inidx, i); + } + + for (i = 1; i <= num; i++) + { + OutByAddrOn(inidx, i); + } + + if (IsConsoleCancel() != 0) + { + break; + } + + TriggerTask(); // ʱִУTCP ӣ + OperatorTaskWhenRun(0); + + DelayMs(100); + rep--; + }while(rep != 0); + } + } + else if (p1 <= num) + { + dl = 1000; + + if (p2 == 0) + { + OutByAddrOff(inidx, p1); + inidx++; + } + else if (p2 == 1) + { + OutByAddrOn(inidx, p1); + inidx++; + } + else if (p2 == 2) + { + OutByAddrOn(inidx, p1); + inidx++; + DelayMs(dl); + if (dl != 0) + { + OutByAddrOff(inidx, p1); + inidx++; + } + } + else if (p2 > 0) + { + count = S32_MAX; + while(count > 0) + { + count--; + OutByAddrOn(inidx, p1); + inidx++; + delay = (p2+9)/10; + do + { + TriggerTask(); // ʱִУTCP ӣ + OperatorTaskWhenRun(0); + + DelayMs(10); + if (IsConsoleCancel() != 0) + { + break; + } + delay--; + }while(delay != 0); + + if (delay != 0) + { + break; + } + if (dl == 1) + { + break; + } + OutByAddrOff(inidx, p1); + inidx++; + + delay = (p2+9)/10; + delay *= 4; + do + { + TriggerTask(); // ʱִУTCP ӣ + OperatorTaskWhenRun(0); + + DelayMs(10); + if (IsConsoleCancel() != 0) + { + break; + } + delay--; + }while(delay != 0); + if (delay != 0) + { + break; + } + if (dl == 0) + { + break; + } + } + + { + OutByAddrOff(inidx, p1); + inidx++; + } + } + } +} +#endif + +//------------------------------------------------------------------------------------------------------------------------------------------------------------ + diff --git a/EMBOS/Users/App/workctrl/debug.h b/EMBOS/Users/App/workctrl/debug.h new file mode 100644 index 0000000..f67c3d7 --- /dev/null +++ b/EMBOS/Users/App/workctrl/debug.h @@ -0,0 +1,35 @@ + +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +#include "config.h" + +//------------------------------------------------------------------------------- + +void InitDebug(void); + +//------------------------------------------------------------------------------- +// 16 6 2ZP +#define INPUT_NUM 16 + +#define INPUT_STR_LEN 20 + +// 8 MPZP +#define OUTPUT_NUM 8 + +#define OUTPUT_STR_LEN 20 + +#define EX_INPUT_NUM 16 +#define EX_OUTPUT_NUM 16 +//------------------------------------------------------------------------------- + +void SetInputNameString(void * pStr); +void SetOutputNameString(void * pStr); + +void SetExInputNameString(void * pDat, int inum); +void SetExOutputNameString(void * pDat, int onum); +//------------------------------------------------------------------------------- + +#endif + + diff --git a/EMBOS/Users/App/workctrl/error.c b/EMBOS/Users/App/workctrl/error.c new file mode 100644 index 0000000..8e2fa6a --- /dev/null +++ b/EMBOS/Users/App/workctrl/error.c @@ -0,0 +1,81 @@ + +#include "error.h" + +#include "console.h" + + +#ifdef USE_FULL_ASSERT + +/* + +printf("/033[1;40;32m%s/033[0m", Hello,world!/n); +/033 תеĿʼȻ [ ʼɫ 1 ˸ʾַȻDZɫ40ʾɫǰɫ32ʾɫ /033[0m رתУ /033[0m նĬɫ + ͨĽܣ֪ɫַˡ + +ǶڲɫַɫһЩ壺 + ǰ ɫ + --------------------------------------- + 30 40 ɫ + 31 41 tɫ + 32 42 Gɫ + 33 43 Sɫ + 34 44 {ɫ + 35 45 ϼtɫ + 36 46 {ɫ + 37 47 ɫ + + + ------------------------- + 0 նĬ + 1 ʾ + 4 ʹ» + 5 ˸ + 7 ʾ + 8 ɼ + + + + +*/ + +void assert_failed(u8* file, u32 line) +{ +#define ERR_OUT_DL (5000*1000) // ȴ1 + + int count; + int flag, exit; + + flag = 0; + exit = 0; + printf("\r\n"); + + while(1) + { + count = ERR_OUT_DL; + while(count != 0) + { + count--; + } + + if (flag == 0) + { + printf("\033[1;41;32m"); // سóն˱ΪɫַΪɫ + flag = 1; + } + else + { + printf("\033[1;42;31m"); // óն˱ΪɫַΪɫ + flag = 0; + } + + printf(" Wrong parameters value: file %s on line %d\r", file, line); + if (exit != 0) + { + break; + } + } +} + + +#endif + diff --git a/EMBOS/Users/App/workctrl/error.h b/EMBOS/Users/App/workctrl/error.h new file mode 100644 index 0000000..0c5de90 --- /dev/null +++ b/EMBOS/Users/App/workctrl/error.h @@ -0,0 +1,361 @@ + +#ifndef __ERROR_H__ +#define __ERROR_H__ + +#include "config.h" + +#define ERR_NONE 0x0000 // ûд +#define ERR_NO_POWER 0x0001 // ûϵ +#define ERR_NO_AIR 0x0002 // ѹ +#define ERR_NOT_SAFE 0x0003 // ȫ +#define ERR_EXPIRATION 0x0004 // ʹʱѵ +#define ERR_DRIVER 0x0005 // +#define ERR_FILL_DATA 0x0006 // ݴ +#define ERR_NOT_ALLOWED 0x0007 // ״̬ +#define ERR_CTRL_ERR 0x0008 // ƴ +#define ERR_FPGA_ERR 0x0009 // FPGA汾 +#define ERR_BUTTON_NOUP 0x000A // ȴţ̌ʱ +#define ERR_FPGA_RESET 0x000B // FPGAλ +#define ERR_NO_READY 0x000C // δ +#define ERR_NO_SEND_ERR 0x000D // ݴ +#define ERR_EDTION_ERR 0x000E // 汾 +#define ERR_WORK_DONE 0x000F // ɲ + +#define ERR_LMT_POSITIVE 0x0010 // λ +#define ERR_LMT_NEGATIVE 0x0011 // λ +#define ERR_RUN_ALM 0x0012 // ˶ +#define ERR_RUN_LIMIT 0x0013 // ˶λ +#define ERR_RUN_EMS 0x0014 // ˶ͣ +#define ERR_MV_PARA 0x0015 // ˶ +#define ERR_MC_PARA 0x0016 // +#define ERR_IN_PARA 0x0017 // +#define ERR_FPGA_HARD_ERR 0x0018 // FPGAӲ汾 + +#define ERR_NOT_WORKSTA 0x001A // ܹ״̬ +#define ERR_NOT_MOVESTA 0x001B // ֹƿ״̬ + + +#define ERR_NOFAM_ZERO 0x001C // ǰҪжģ +#define ERR_NO_ADDAIR 0x001D // ûм +#define ERR_MOUD_READY 0x001E // ģλóɹ +#define ERR_MTZ_RIGHT 0x001F // ɹ +#define ERR_MTZ_ERROR 0x0020 // +#define ERR_COOR_SYSTM 0x0021 // ϵͳ +#define ERR_OUT_RANGE 0x0022 // ĿλԽ +#define ERR_X_LIT_POSI 0x0023 // Xλ +#define ERR_X_LIT_NEGA 0x0024 // Xλ +#define ERR_Y_LIT_POSI 0x0025 // Yλ +#define ERR_Y_LIT_NEGA 0x0026 // Yλ + +#define ERR_FEED_MANUAL 0x0027 // ϴֶ״̬ +#define ERR_MC_MANUAL 0x0028 // ֶ״̬ +#define ERR_KEY_SW_OFF 0x0029 // Կ׿عر +#define ERR_ALM_WATERTANK 0x002A // ˮ䱨 +#define ERR_ALM_COVEROPEN 0x002B // DZ +#define ERR_LIGHTCURTAINS1 0x002C // Ļ1 +#define ERR_LIGHTCURTAINS2 0x002D // Ļ2 +#define ERR_AIR_POWER 0x002E // ѹ +#define ERR_PRESS_SENSOR 0x002F // ѹϴ +#define ERR_CLIP_SENSOR 0x0030 // в +#define ERR_NO_MATERIEL 0x0031 // ȱϱ +#define ERR_CUTFRAME 0x0032 // ߿и +#define ERR_MC_AUTO 0x0033 // Զ״̬ +#define ERR_DOOR_TIMEOUT 0x0034 // ųʱ +#define ERR_NOT_AT_OFFSET 0x0035 // ƫƵ +#define ERR_NO_PHOTO_FILE 0x0036 // ûļ +#define ERR_FEED_AUTO 0x0037 // ϴԶ״̬ +#define ERR_GANTRY_NOT_POS 0x0038 // Ųλ +#define ERR_GUARDRAIL_OPEN 0x0039 // ȫδر + +#define ERR_LIGHTCURTAINS3 0x003A // Ļ3 +#define ERR_LIGHTCURTAINS4 0x003B // Ļ4 +#define ERR_PRINT_ERROR 0x003C // ī쳣 +#define ERR_PRINT_NOT_AT_BAK 0x003D // īֹͣλ + +#define ERR_LOAD_EMPTY 0x003E // ϴϿ +#define ERR_RECV_FULL 0x003F // ϴ + +#define ERR_NO_DATA 0x0040 // +#define ERR_DATA_ERROR 0x0041 // ݴ +#define ERR_GRAPH_OUT_RANGE 0x0042 // ͼγΧ +#define ERR_CUTTER2_ERROR 0x0043 // и2 +#define ERR_PHOTO_ERROR 0x0044 // ʶ +#define ERR_CUT_RANGE_OVERFLOW 0x0045 // иΧص +#define ERR_CUTTER1_ERROR 0x0046 // и1 +#define ERR_CUTTER1_CLEERR 0x0047 // и1 ʧЧ +#define ERR_CUTTER2_CLEERR 0x0048 // и2 ʧЧ +#define ERR_CUTTER_WASTE 0x0049 // и +#define ERR_INPUT_EDGE 0x004A // ƫ +#define ERR_INPUT_TIMEOUT 0x004B // ϳʱ +#define ERR_LEDGE_TBREAK 0x004C // ߷ +#define ERR_REDGE_TBREAK 0x004D // ұ߷ +#define ERR_EDGE_TBREAK 0x004E // ߷ͷ +#define ERR_CHANGE_MAR 0x004F // + +#define ERR_MS_NOT_ZERO 0x0050 // ᲻λ +#define ERR_HK_NOT_ZERO 0x0051 // λ +#define ERR_MS_NOT_SYNC 0x0052 // ͬ +#define ERR_RO_NOT_SYNC 0x0053 // תͬ +#define ERR_CUTTER_NOT_POS 0x0054 // ڻλ(ע:ñǷҼ) +#define ERR_HEAD_NOT_HIGH 0x0055 // ͷڸλ +#define ERR_HEAD_NOT_LOW 0x0056 // ͷڵλ +#define ERR_LIGHTCURTAINS 0x0057 // Ļ +#define ERR_UPER_TBREAK 0x0058 // ߶ +#define ERR_BOBBIN_TBREAK 0x0059 // ߶ +#define ERR_NEEDLE_NOT_HIGH 0x005A // 벻ڸλ +#define ERR_SEND_N1CMD_TIMOUT 0x005B // ʱ +#define ERR_SEND_N1CMD_FAIL 0x005C // ʧ +#define ERR_TRANS_TIMEOUT 0x005D // ִʱ +#define ERR_NOT_AT_POS 0x005E // ģ治λ +#define ERR_LIFT_TIMEOUT 0x005F // ͷʱ + +#define ERR_HEAD_NOT_SAFE 0x0060 // ͷڰȫ +#define ERR_HD1_ND_NOT_ZERO 0x0061 // ͷ1벻λ +#define ERR_HD2_ND_NOT_ZERO 0x0062 // ͷ2벻λ +#define ERR_HD3_ND_NOT_ZERO 0x0063 // ͷ3벻λ +#define ERR_HD4_ND_NOT_ZERO 0x0064 // ͷ4벻λ +#define ERR_HD5_ND_NOT_ZERO 0x0065 // ͷ5벻λ +#define ERR_HD6_ND_NOT_ZERO 0x0066 // ͷ6벻λ +#define ERR_HD7_ND_NOT_ZERO 0x0067 // ͷ7벻λ +#define ERR_HD8_ND_NOT_ZERO 0x0068 // ͷ8벻λ +#define ERR_HD9_ND_NOT_ZERO 0x0069 // ͷ9벻λ + +#define ERR_HD1_CUTTER_NOT_POS 0x0071 // ͷ1ڻλ +#define ERR_HD2_CUTTER_NOT_POS 0x0072 // ͷ2ڻλ +#define ERR_HD3_CUTTER_NOT_POS 0x0073 // ͷ3ڻλ +#define ERR_HD4_CUTTER_NOT_POS 0x0074 // ͷ4ڻλ +#define ERR_HD5_CUTTER_NOT_POS 0x0075 // ͷ5ڻλ +#define ERR_HD6_CUTTER_NOT_POS 0x0076 // ͷ6ڻλ +#define ERR_HD7_CUTTER_NOT_POS 0x0077 // ͷ7ڻλ +#define ERR_HD8_CUTTER_NOT_POS 0x0078 // ͷ8ڻλ +#define ERR_HD9_CUTTER_NOT_POS 0x0079 // ͷ9ڻλ + +#define ERR_THREAD_NOT_RST 0x007E // λťδλ +#define ERR_FRM_LID_NOT_POS 0x007F // ҿǰ岻λ +#define ERR_PUNCH_NOT_ZERO 0x0080 // ᲻λ + +#define ERR_R_LIT_POSI 0x0081 // תλ +#define ERR_R_LIT_NEGA 0x0082 // תλ + +#define ERR_PUNCH2_NOT_ZERO 0x0083 // 2᲻λ +#define ERR_CUTTER_NOT_ZERO 0x0084 // õ᲻λ +#define ERR_XY_NOT_WP 0x0085 // XYڹλ +#define ERR_HEAD_NOT_POS 0x0086 // ͷλ + +#define ERR_X2_LIT_POSI 0x0087 // X2λ +#define ERR_X2_LIT_NEGA 0x0088 // X2λ +#define ERR_Y2_LIT_POSI 0x0089 // Y2λ +#define ERR_Y2_LIT_NEGA 0x008A // Y2λ +#define ERR_PRESS_NOT_POS 0x008B // ѹŲλ +#define ERR_PRESS_LIFT_TIMOUT 0x008C // ѹʱ +#define ERR_PRESS_LIFT_NOT_POS 0x008D // ѹλ +#define ERR_TO_ZERO_TIMOUT 0x008E // ȴ˶ʱ +#define ERR_MOVE_POS_ERR 0x008F // ƶλô + +#define ERR_CLUTH_TIMOUT 0x0090 // ȴϳʱ +#define ERR_CLUTH1_NOT_POS 0x0091 // ͷ1ϲλ +#define ERR_CLUTH2_NOT_POS 0x0092 // ͷ2ϲλ + +#define ERR_FOOT_POS 0x0093 // ѹλô +#define ERR_FOOT_OUT_RANGE 0x0094 // ѹŵλԽ +#define ERR_LIFT_OUT_RANGE 0x0095 // ͷλԽ +#define ERR_ROT_OUT_RANGE 0x0096 // תλԽ +#define ERR_ROT_ECD_ERROR 0x0097 // ת +#define ERR_LIFT_ULIMIT 0x0098 // ͷλ +#define ERR_LIFT_DLIMIT 0x0099 // ͷλ +#define ERR_LIFT_SYNC_ERR 0x009A // ͷͬ +#define ERR_IN_NO_MAT 0x009B // +#define ERR_IN_MAT_ERR 0x009C // ϼ쳣 +#define ERR_OUT_MAT_ERR 0x009D // ϼ쳣 +#define ERR_NOTIN_SAFE_AREA 0x009E // ͷڰȫ +#define ERR_EMB_NOT_ZERO 0x009F // 廨᲻λ +#define ERR_EMB_SWND_TIMOUT 0x00A0 // ƽ廻ɫʱ +#define ERR_PUNCH_SWND_TIMOUT 0x00A1 // ׻ɫʱ +#define ERR_HD1W_LIT_POSI 0x00A2 // ͷ1λ +#define ERR_HD1W_LIT_NEGA 0x00A3 // ͷ1뷴λ +#define ERR_HD2W_LIT_POSI 0x00A4 // ͷ2λ +#define ERR_HD2W_LIT_NEGA 0x00A5 // ͷ2뷴λ +#define ERR_EMB_ND_ERR 0x00A6 // ƽλ +#define ERR_PUNCH_ND_ERR 0x00A7 // λ + +/* EMB 0x00AC~0x00EF */ +#define ERR_NODE_ERR 0x00AC // ڵ +#define ERR_BUS_ERR 0x00AD // ߴ +#define ERR_CHECK_FRAME 0x00AE // δ߿ +#define ERR_CAN_TIMEOUT 0x00AF // CANͨѶʱ +#define ERR_EMB_HOOK_NOT_ZERO 0x00B0 // ƽ年δλ +#define ERR_EMB_CUT_NOT_ZERO 0x00B1 // ƽδλ +#define ERR_EMB_SPINDLE_RATIO 0x00B2 // ƽֱȴ +#define ERR_TOWEL_NOT_ZERO 0x00B3 // ë᲻λ +#define ERR_CHENM_NOT_ZERO 0x00B4 // ëM᲻λ +#define ERR_CHENR_NOT_ZERO 0x00B5 // ë᲻λ +#define ERR_CHEN_ND_ERR 0x00B6 // ëλ +#define ERR_CHEN_ELA_TIMEOUT 0x00B7 // ɽߵ˶ʱ +#define ERR_CHEN_ELA_POS 0x00B8 // ɽߵλô +#define ERR_CHEN_SWND_TIMOUT 0x00B9 // ëɫʱ +#define ERR_CHEN_CUT_NOT_ZERO 0x00BA // ëδλ +#define ERR_CHEN_CUT_TIMEOUT 0x00BB // ë˶ʱ +#define ERR_CHEN_HOIST_TIMOUT 0x00BC // ˶ʱ +#define ERR_CHEN_HOIST_POS 0x00BD // ëλô +#define ERR_CHEN_SPINDLE_RATIO 0x00BE // ëֱȴ +#define ERR_COIL_NOT_ZERO 0x00BF // ᲻λ +#define ERR_COIL_M_NOT_ZERO 0x00C0 // M᲻λ +#define ERR_AUTO_SET_START 0x00C1 // Զʧ +#define ERR_X_DRIVER 0x00C2 // X +#define ERR_Y_DRIVER 0x00C3 // Y +#define ERR_RING_COOR_SYSTM 0x00C4 // ëϵͳ +#define ERR_M_DRIVER 0x00C5 // M +#define ERR_DOWN_CUT_TIMEOUT 0x00C6 // ¼˶ʱ +#define ERR_UP_CUT_TIMEOUT 0x00C7 // ϼ˶ʱ +#define ERR_TEMP_ALARM 0x00C8 // ¶ȱ +#define ERR_WIRE_ALARM 0x00C9 // ߱ +#define ERR_FEED_ALARM 0x00CA // +#define ERR_ROT_COOR_SYSTM 0x00CB // תϵͳ +#define ERR_LIFT_COOR_SYSTM 0x00CC // ϵͳ +#define ERR_UP_CUT_NOT_POS 0x00CD // ϼڻλ +#define ERR_HK_NOT_HK 0x00CE // ڹλ +#define ERR_MS_COOR_SYSTM 0x00CF // ϵͳ +#define ERR_WIRE_LIFT_TIMEOUT 0x00D0 // ߻ͷʱ +#define ERR_SCBE_ALM 0x00D1 // ɢ鱨 +#define ERR_ROPE_ALM 0x00D2 // 屨 +#define ERR_HEAD_NUM 0x00D3 // ͷ +#define ERR_READ_HEAD_PARA 0x00D4 // ȡͷ +#define ERR_READ_COLOR_PARA 0x00D5 // ȡɫ +#define ERR_WORK_HEAD 0x00D6 // ͷ +#define ERR_CHANGE_SHUT 0x00D7 // 쳣 +#define ERR_CCMS_COOR_SYSTM 0x00D8 // ëϵͳ +#define ERR_CTMS_COOR_SYSTM 0x00DA // ϵͳ +#define ERR_ZP_SIGNAL 0x00DB // ZPź쳣 +#define ERR_MP_SIGNAL 0x00DC // MPź쳣 +#define ERR_FEED_TIMEOUT 0x00DD // ߳ʱ +#define ERR_FEED_NULL 0x00DE // δ +#define ERR_ADJUST_FRAME_NOT_HIGH 0x00DF // Զڸλ +#define ERR_ADJUST_FRAME_NOT_LOW 0x00E0 // Զڵλ +#define ERR_LASER_ALARM 0x00E1 // ⱨ +#define ERR_HOLE_LIFT_NOT_HIGH 0x00E2 // ڸλ +#define ERR_HOLE_LIFT_NOT_LOW 0x00E3 // ڵλ +/* EMB 0x00AC~0x00EF */ + +#define ERR_CHANGE_BOBBIN 0x00F0 // о +#define ERR_CHANGE_BOBBIN_A 0x00F1 // оA +#define ERR_CHANGE_BOBBIN_B 0x00F2 // оB +#define ERR_CHANGE_BOBBIN_STA 0x00F3 // ڸо״̬ +#define ERR_CHANGE_PNHPIN1 0x00F4 // ͷ1 +#define ERR_CHANGE_PNHPIN2 0x00F5 // ͷ2 +#define ERR_CHANGE_PNHPIN3 0x00F6 // ͷ3 +#define ERR_CHANGE_PNHPIN4 0x00F7 // ͷ4 +#define ERR_CHANGE_PNHPIN5 0x00F8 // ͷ5 +#define ERR_CHANGE_PNHPIN6 0x00F9 // ͷ6 +#define ERR_BREAK 0x00FA // ѭ + +#define ERR_FEED_ROLLER 0x0200 // ѹ 쳣 +#define ERR_DIS_ROLLER 0x0201 // ѹ 쳣 +#define ERR_DIS_MATERIAL 0x0202 // ѹ 쳣 +#define ERR_TENS_DEVICE 0x0203 // Žװ 쳣 +#define ERR_CLOTH_DEVICE 0x0204 // вװ 쳣 +#define ERR_EDGE_MOTOR 0x0205 // е +#define ERR_CROSS_MOTOR 0x0206 // е 쳣 +#define ERR_FCLAMP_LIFT 0x0207 // ǰ 쳣 +#define ERR_FCLAMP_OPCL 0x0208 // ǰп 쳣 +#define ERR_PULL_CLAMP 0x0209 // еϼ 쳣 +#define ERR_PULL_CLIP 0x020A // е¼ 쳣 +#define ERR_YZR_NOT_SYNC 0x020B // ҿͬ +#define ERR_CHIP_ERROR 0x020C // װλ 쳣 +#define ERR_FIXTURE1_ERROR 0x020D // װ1 +#define ERR_FIXTURE2_ERROR 0x020E // װ2 +#define ERR_CLASH_ERROR 0x020F // װײδ + + +#define ERR_NW_NOT_POS 0x0210 // ѹλ +#define ERR_FW_NOT_POS 0x0211 // Զѹλ +#define ERR_SENDGIVE_NOT_POS 0x0212 // ͱײλ +#define ERR_FPHD_NOT_POS 0x0213 // ͷλ +#define ERR_INPRESS_ERR 0x0214 // ѹ 쳣 +#define ERR_OUTPRESS_ERR 0x0215 // ѹ 쳣 + + +#define ERR_TENS_AND_CLOTH 0x0216 // ǰвŽλòƶͷ +#define ERR_RETURN_LIFT 0x0217 // װ 쳣 +#define ERR_CLOTH_EMPTY 0x0218 // ͱװȱ +#define ERR_CHB_SWAY 0x0219 // ڶװ 쳣 +#define ERR_CHB_PUSH 0x021A // ƶװ 쳣 +#define ERR_CHB_ROTATE 0x021B // תװ 쳣 +#define ERR_CHB_SHUT 0x021C // Ǽ 쳣 +#define ERR_XP_LIT_POSI 0x021D // XPλ +#define ERR_XP_LIT_NEGA 0x021E // XPλ +#define ERR_YP_LIT_POSI 0x021F // YPλ +#define ERR_YP_LIT_NEGA 0x0220 // YPλ +#define ERR_1UP_SEND_C 0x0221 // ѹ1 쳣 +#define ERR_1UP_PUSH_S 0x0222 // ѹ1 쳣 +#define ERR_1UP_SEND_P 0x0223 // ѹ1 쳣 +#define ERR_1UP_PUSH_C 0x0224 // ѹ1 쳣 +#define ERR_1UP_IN_PUSH_C 0x0225 // ѹ1 쳣 +#define ERR_1DW_SEND_C 0x0226 // ѹ1 쳣 +#define ERR_1DW_PUSH_S 0x0227 // ѹ1 쳣 +#define ERR_1DW_SEND_P 0x0228 // ѹ1 쳣 +#define ERR_1DW_PUSH_C 0x0229 // ѹ1 쳣 +#define ERR_1DW_IN_PUSH_C 0x022A // ѹ1 쳣 +#define ERR_TENS1_ERR 0x022B // 1ͨѶ 쳣 +#define ERR_TENS2_ERR 0x022C // 2ͨѶ 쳣 +#define ERR_FEED_LIMT 0x022D // ϼܶԱλ +#define ERR_IN_WAIT_AREA 0x022E // ȴ +#define ERR_HOT_LINE 0x022F // δλ + +#define ERR_CHB_SPIN 0x0230 // תװ 쳣 +#define ERR_CHB_DPUSH 0x0231 // װ 쳣 + +#define ERR_PUNCH3_NOT_ZERO 0x0232 // 3᲻λ +#define ERR_PUNCH4_NOT_ZERO 0x0233 // 4᲻λ + +#define ERR_CUT_PRESS 0x0250 // Ĥѹװ 쳣 +#define ERR_LAMIN_FILM1 0x0251 // ĤĤװ1 쳣 +#define ERR_LAMIN_FILM2 0x0252 // ĤĤװ2 쳣 +#define ERR_FEED_EMP 0x0253 // ĤϿλ 쳣 + + +//------------------------------------------------------ + + +#define ERR_INSTALLMENT_OK 0x0300 // óɹ +#define ERR_INSTALLMENT_FAIL 0x0301 // ʧ + +//------------------------------------------------------ +#define ERR_CLR_BLK 0x0801 // +#define ERR_CLR_FULL 0x0802 // +#define ERR_OIL_AIR 0x0803 // ͱѹ쳣 + +//------------------------------------------------------ +#define STA_NORMAL_STOP 0x0100 // ֹͣ +#define STA_MTZ_SUCCESS 0x0101 // ɹ +#define STA_WORK_PAUSE 0x0102 // ͣ +#define STA_WORK_OVER 0x0103 // +#define STA_WORK_FINISH 0x0104 // +#define STA_WORK_DONE 0x0105 // ɲ +#define STA_EXEC_SUCCESS 0x0106 // ִгɹ +#define STA_EXEC_FAILED 0x0107 // ִʧ +#define STA_WAIT_FILE 0x0108 // ȴļ +#define STA_CHANGE_BOBBIN 0x0109 // о + +#define STA_PROCESS_FINISH 0x010A // ִ +#define STA_PROCESS_RUNNING 0x010B // ִй +#define STA_EMB_CHNGCL_STOP 0x0111 // ɫֹͣ +#define STA_ADJ_THREAD_STOP 0x0112 // ߼ֹͣ + +#define STA_MEND_FINISH 0x0113 // + +// 廨 +#define STA_EMB_PATCH_STOP 0x0150 // ֹͣ +#define STA_EMB_FRAME_FINISH 0x0151 // ߿ +#define STA_LINE_TBREAK 0x0152 // ֹͣ +#define STA_AUTO_SOFTLIMIT 0x0153 // Զλ +#define STA_EMB_SPINDLERATIO 0x0154 // ƽֱ +#define STA_CHEN_SPINDLERATIO 0x0155 // ëֱ + +//˲߻ +#define ERR_UPCLIP_ERROR 0x0300 // ϼϴ +#define ERR_DOWNCLIP_ERROR 0x0301 // ¼ϴ +#define ERR_FEED_ERROR 0x0302 // ϴ +#define STA_PRESS_STOP 0x0303 // ֹ̨߽ͣ +#define ERR_NO_MATERIAL_ERROR 0x0304 // ϱ + +#endif diff --git a/EMBOS/Users/App/workctrl/workctrl.c b/EMBOS/Users/App/workctrl/workctrl.c new file mode 100644 index 0000000..233661f --- /dev/null +++ b/EMBOS/Users/App/workctrl/workctrl.c @@ -0,0 +1,1364 @@ + +#define _IN_WORKCTRL_C + +#include "workctrl.h" + +#include "movectrl.h" +#include "error.h" +#include "buttons.h" +#include "inout.h" +#include "shell.h" +#include "debug.h" +#include "trigger.h" +#include "delay.h" +#include "canctrl.h" +#include "extendboards.h" +#include "ethernet.h" +#include "filetrans.h" +#include "installment.h" + +//------------------------------------------------------------------------------- + +void OneMinTimerTask(void); + +//------------------------------------------------------------------------------- + + +#if (AUTO_ELEC_CLIP == 1) +// Ӽȼ. + // 0~239 120ȼ + // żindexдŵʼ,Ϊֹ. + // ʼеlevelż.ֹеlevelʼΪ. + + // 240,241 Ž,ĬΪ0 + + // 254,255Ĭϵȼͼ + +DataClip g_dataClipLvBuf[256]; +#endif + +//------------------------------------------------------------------------------- + +#define EXEC_WORK_FUNC(func) \ +do \ +{ \ + if (func != NULL) \ + { \ + func(); \ + } \ +}while(0) + + +//------------------------------------------------------------------------------- + +void InitWorkCtrl(void) +{ + memset(&g_workCtrl, 0, sizeof(WorkCtrl)); + + g_workCtrl.embMendEndIdx = -1; // 20220303Ӵ˳ʼ + +#if (1) // ʱ...... + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; + g_workCtrl.cursta.workStatus |= WORK_STA_ENSTATE; +#endif + + // װر +#if (1) + printf("sizeof(SavedPara)=%d\r\n", sizeof(SavedPara)); + ReadNVPara((NVPara*)(&g_workCtrl.savedpara), 1); // װر + + if (g_workCtrl.savedpara.mcType != MC_TYPE) + { + g_workCtrl.savedpara.enFlag = 0; + } + + if (g_workCtrl.savedpara.enFlag != NVPARA_EN) + { + memset(&g_workCtrl.savedpara, 0, sizeof(g_workCtrl.savedpara)); + + g_workCtrl.savedpara.mcType = MC_TYPE; + g_workCtrl.savedpara.enFlag = NVPARA_EN; + SaveWorkNvPara(); + + printf("2. load save data failed\r\n"); + g_workCtrl.posEnFlag = 0; // λʧЧ + } + else + { + u32 address; + address = (u32)(&(g_workCtrl.savedpara.motospos[0])); + SetMotosCounter((s32 *)(address)); // õλ + ReadAndFreshMotosPos(); + g_workCtrl.posEnFlag = ALL_MOTO_MOD; // λЧ + + g_workCtrl.cursta.dataIdx = g_workCtrl.savedpara.dataIdx; // װ + printf("load fileID=0x%x, dataIdx=%d\r\n", g_workCtrl.savedpara.fileID, g_workCtrl.cursta.dataIdx); + + g_workCtrl.cursta.runSteps = g_workCtrl.savedpara.runSteps; // װв + g_workCtrl.cursta.outCounter = g_workCtrl.savedpara.outCounter; // װز + g_workCtrl.cursta.embNeedleNum = g_workCtrl.savedpara.embNeedleNum; // װش + g_workCtrl.cursta.btrdPics = g_workCtrl.savedpara.btrdPics; // װصƬ + g_workCtrl.cursta.btrdLength = g_workCtrl.savedpara.btrdLength; // װص߳ȼ + g_workCtrl.cursta.fileIdx = g_workCtrl.savedpara.fileIdx; // װļ + g_datFile.fileIdx = g_workCtrl.cursta.fileIdx; // װļ + g_datFile.fileIdxMap = g_workCtrl.savedpara.fileIdxMap; // װļλͼ + + printf("2. load save data success\r\n"); + } +#endif + + InitAppCallback(); + + InitDebug(); + + { + int rslt; + rslt = InitInstallment(); // ʼ + if (rslt != 0) // Ѿȥ˹ػʱ + { + g_workCtrl.cansetelapsed = 1; // òٽλػʱ + } + RefreshWorkTimeEn(); + + AddTriggerToList(60000, NULL, OneMinTimerTask); // 1Ӷʱ񣬹ʱ + } +} + +__WEAK void InitAppCallback(void) +{ +} + +void WorkCtrlTask(void) +{ + EXEC_WORK_FUNC(g_workCtrl.WorkRunTask); + EXEC_WORK_FUNC(g_workCtrl.AsynchronousTask); +} + +void TasksWhenDelay(void) +{ + EXEC_WORK_FUNC(g_workCtrl.AsynchronousTask); + TriggerTask(); // ʱִ + ExtendBoardTask(); // ִ +} + +void DelayRef(u32 ms) +{ + do + { + TasksWhenDelay(); + + if (ms <= 0) + { + break; + } + DelayMs(1); + ms--; + }while(1); +} + +void DelayRefFt(u32 ms) +{ + u32 us = 0; + do + { + TasksWhenDelay(); + if (ms <= 0) + { + break; + } + DelayUs(100); + us++; + if(us >= 10) + { + us = 0; + ms--; + } + }while(1); +} + +// ʱͬʱִ첽 +void DelayAndAsyncExe(u32 ms) +{ + u32 timb = GetMsSoftTimer(); + do + { + TasksWhenDelay(); + + u32 tim = GetMsSoftTimer(); + if (tim - timb >= ms) + { + break; + } + + }while(1); +} + +//------------------------------------------------------------------------------- + +// 1Ӷʱ +void OneMinTimerTask(void) +{ + RefWorkableTimer(-1); // ÿӣʱ + + RefreshWorkTimeEn(); // ־ +} + +void RefreshWorkTimeEn(void) +{ +#if (USE_PASSWORD == 1) // ǿʹ÷ڸ + if (GetWorkableTime() <= 0) + { + g_workCtrl.cursta.workStatus &= ~(WORK_STA_ENTIME); // ֹ(ʱ) + } + else + { + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; // (ʱ) + } +#elif (USE_PASSWORD == 2) // ùڸ,ִ,Ϊû + u8 paswd[24]; + int i; + + GetLastpswd(paswd); + for (i=0;i<24;i++) + { + if (paswd[i] != 0) + { + break; + } + } + + if (i != 24) + {// ù + if (GetWorkableTime() <= 0) + { + g_workCtrl.cursta.workStatus &= ~(WORK_STA_ENTIME); // ֹ(ʱ) + } + else + { + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; // (ʱ) + } + } + else + {// ûù + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; // (ʱ) + } + +#elif (USE_PASSWORD == 0) // ʹ + { + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; // (ʱ) + } +#endif +} + +//------------------------------------------------------------------------------- + +void SaveWorkNvPara(void) +{ + SaveNVPara((NVPara*)(&g_workCtrl.savedpara), 1); +} + +__WEAK void RefreshStatus(void) +{ +} + +__WEAK void RefreshParas(int flag) +{ +} + +// òЧ־ +void SetNewParasFlag(int flag) +{ + g_workCtrl.paraEnFlag |= flag; + + // ձ־ + printf("set para ok flag\r\n"); + g_workCtrl.cursta.workStatus |= WORK_STA_PARAOK; // ձ־ +} + +//------------------------------------------------------------------------------- + +void RequestBoardVer(void) +{ +#if (MAX_SUPPORT_COLOR > 0) + RequestColorsVersion(); + DelayRef(0); +#endif + +#if (MAX_SUPPORT_HEAD > 0) + RequestHeadsVersion(); + DelayRef(0); +#endif + +#if (MAX_SUPPORT_EXTIO > 0) + RequestExtIOsVersion(); + DelayRef(0); +#endif + +} + +int CreateBoardVer(OperPacket * pPkt, u8 protocol, u8 nodeId, u8 nodeType, BoardRegVal * pRegVal) +{ + if (pPkt == NULL) + { + return -1; + } + + int rslt; + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->sendBoardVer.cmdCode = DCMD_SEND_BOARDVER; + pPkt->sendBoardVer.protocolType = protocol; + pPkt->sendBoardVer.nodeType = nodeType; + + if (protocol == BN_PROTOCOL_HEAD) + { + pPkt->sendBoardVer.nodeId = nodeId - HEAD_NODEID_BASE + 1; // 1ʼ,λҪ֪ڵID + } + else if (protocol == BN_PROTOCOL_COLOR) + { + pPkt->sendBoardVer.nodeId = nodeId - COLOR_NODEID_BASE + 1; // 1ʼ,λҪ֪ڵID + } + + memcpy(&pPkt->sendBoardVer.ver, &pRegVal->exbVer, BOARD_VER_LEN*sizeof(u32)); + + printf("board version: protocol=%d, nodeid=%d, nodeType=%d\r\n", pPkt->sendBoardVer.protocolType, pPkt->sendBoardVer.nodeId, pPkt->sendBoardVer.nodeType); + char ver[EX_VER_LEN+1]; + memset(&ver, 0, EX_VER_LEN+1); + memcpy(&ver, &pPkt->sendBoardVer.ver, BOARD_VER_LEN*sizeof(u32)); + printf("version=%s\r\n", ver); // 汾 + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(pPkt->sendBoardVer.ver)), BOARD_VER_LEN*sizeof(u32)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateBoardVer\r\n"); + } + + return rslt; +} + +int CreateHeadBoardPara(OperPacket * pPkt, u8 nodeId, u8 nodeType, u8* pData) +{ + if (pPkt == NULL || pData == NULL) + { + return -1; + } + + int rslt; + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->boardPara.cmdCode = DCMD_SEND_HEADPARA; + + pPkt->boardPara.nodeId = nodeId; // headListӦ,λҪ֪ڵID,ֻ洢Ӧ + pPkt->boardPara.nodeType = nodeType; // Ӧڵ(ƽ,ë,) + + memcpy(&pPkt->boardPara.exData, pData, BOARD_PARA_SIZE); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(pPkt->boardPara.exData)), BOARD_PARA_SIZE); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateHeadBoardPara\r\n"); + } + + return rslt; +} + +int CreateColorBoardPara(OperPacket * pPkt, u8 nodeId, u8* pData) +{ + if (pPkt == NULL || pData == NULL) + { + return -1; + } + + int rslt; + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->boardPara.cmdCode = DCMD_SEND_COLORPARA; + + pPkt->boardPara.nodeId = nodeId; // Ӧ,λҪ֪ڵID,ֻ洢Ӧ + + memcpy(&pPkt->boardPara.exData, pData, BOARD_PARA_SIZE); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(pPkt->boardPara.exData)), BOARD_PARA_SIZE); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateHeadBoardPara\r\n"); + } + + return rslt; +} + +int RequestHeadNvParas(int nodetype, int nodeid, int paraid, u32 * pBuf) +{ +#if (CUR_MACHINE == MACH_EMB) + return RequestEmbCoilParasProc(nodeid, pBuf); +#elif (CUR_MACHINE == MACH_WIRE) + return RequestWireHeadAParaProc(nodeid, 1, paraid, pBuf); +#else + return 0; +#endif +} + +void SetHeadNvPara(int nodetype, int nodeid, int paraid, u32 * pBuf) +{ +#if (CUR_MACHINE == MACH_EMB) + SetEmbCoilParasProc(nodeid, pBuf); +#elif (CUR_MACHINE == MACH_WIRE) + SetWireHeadAPara(nodeid, paraid, pBuf); +#endif +} + +int CreateHeadNvParas(OperPacket * pPkt, u8 nodetype, u8 nodeId, u8 paraid, u8* pData) +{ + if (pPkt == NULL || pData == NULL) + { + return -1; + } + + int rslt; + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->boardPara.cmdCode = DCMD_SEND_HEAD_NVPARAS; + + pPkt->boardPara.nodeId = nodeId; // λҪ֪ڵID,ֻ洢Ӧ + pPkt->boardPara.nodeType = nodetype; + pPkt->boardPara.paraid = paraid; + + memcpy(&pPkt->boardPara.exData, pData, 128); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(pPkt->boardPara.exData)), 128); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateHeadNvParas\r\n"); + } + + return rslt; +} + +int CreateMcInfo(OperPacket * pPkt, int toggle) +{ + int rslt; + MCInfo info; + u16 ver; + + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + memset(&info, 0, sizeof(MCInfo)); + + pPkt->sendMcInfo.cmdCode = DCMD_SEND_MC_INFO; + pPkt->sendMcInfo.toggle = (u16)toggle; + + ver = GetFpgaHardVersion(); // ȡӲ汾Ϣ + sprintf(info.fpgaHardVerStr, "FPGA Hard: %x.%x", (ver&0xff00)>>8,(ver&0x00ff)); + + ver = GetFpgaSoftVersion(); // ȡ汾Ϣ + sprintf(info.fpgaSoftVerStr, "FPGA Soft: %x.%x", (ver&0xff00)>>8,(ver&0x00ff)); + + GetVersionStr(info.softwareVerStr); // 汾Ϣ + + GetBuildStr(info.buildInfoStr); // ʱϢ + + GetBoardIdInfo(info.boardId); // 忨IDϢ + + GetLastInstallment(info.installment); // ַ + + printf("create system info len=%d, as follow:\r\n", sizeof(MCInfo)); + + printf("%s\r\n", info.fpgaHardVerStr); // FPGAӲ汾 + printf("%s\r\n", info.fpgaSoftVerStr); // FPGA汾 + printf("%s\r\n", info.softwareVerStr); // 汾 + printf("%s\r\n", info.buildInfoStr); // Ϣ + printf("%s\r\n", info.boardId); // 忨ID + printf("%s\r\n", info.installment); // һεķַ + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(info)), sizeof(MCInfo)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcInfo\r\n"); + } + + return rslt; +} + +// ״̬ +int CreateMcStatus(OperPacket * pPkt, int toggle) +{ + int rslt; + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->sendMcStatus.cmdCode = DCMD_SEND_MC_STATUS; + pPkt->sendMcStatus.toggle = (u16)toggle; + +// printf("create mc status len=%d\r\n", sizeof(MCStatus)); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(g_workCtrl.cursta)), sizeof(MCStatus)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcStatus\r\n"); + } + + return rslt; +} + +// ļλͼ +int CreateFileList(OperPacket * pPkt, int toggle) +{ + int rslt; + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->setFilesList.cmdCode= DCMD_SEND_FILE_LIST; + pPkt->setFilesList.fileIdxMap = (u16)toggle; + +// printf("create mc status len=%d\r\n", sizeof(MCStatus)); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(g_workCtrl.cursta)), sizeof(MCStatus)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcStatus\r\n"); + } + + return rslt; +} + +__WEAK void SensorsStatus(int mode, u8 * buf) +{ +} + +// ź +int CreateSensorsStatus(OperPacket * pPkt) +{ + int rslt; + u8 insta[MAX_EXDP_LEN]; + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + memset(&insta, 0, MAX_EXDP_LEN); + + pPkt->sendSensors.cmdCode = DCMD_SEND_SENSORS; + + SensorsStatus(0, &insta[0]); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(insta)), MAX_EXDP_LEN); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcStatus\r\n"); + } + + return rslt; +} + + +// źλͼ +int CreateSensorsBmp(OperPacket * pPkt) +{ + int rslt; + u8 insta[MAX_EXDP_LEN]; + + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->sendSensors.cmdCode = DCMD_SEND_SENSORS_BMP; + + SensorsStatus(1, &insta[0]); + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(insta)),MAX_EXDP_LEN); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateSensorsBmp\r\n"); + } + + return rslt; +} + +//------------------------------------------------------------------------------- + +// +void TraverseTask(u8 protocol, u8 nodeId, u8 nodeType, int traNum) +{ +#if (CUR_MACHINE == MACH_EMB) // 廨 + EmbTraverseTask(nodeId, nodeType, traNum); +#elif (CUR_MACHINE == MACH_WIRE) + WireTraverseTask(nodeId, traNum); +#else +#endif +} + +void ResetCHB(u32 hdsel) +{ + g_workCtrl.cursta.errorCode = ERR_NONE; + g_workCtrl.almflashGreen = ALM_LIT_FLASH; + g_workCtrl.almflashRed = ALM_LIT_OFF; + g_workCtrl.almflashYello = ALM_LIT_OFF; + g_workCtrl.almflashBee = ALM_LIT_OFF; + + g_workCtrl.cursta.btrdLength = g_workCtrl.chBobbinLength; + g_workCtrl.savedpara.btrdLength = g_workCtrl.cursta.btrdLength; + g_workCtrl.cursta.btrdPics = g_workCtrl.chBobbinPics; + g_workCtrl.savedpara.btrdPics = g_workCtrl.cursta.btrdPics; + + SaveWorkNvPara(); + + printf("get cmd MC_CLEAN_BOBBIN\r\n"); + + ReportError(0); +} + +// ù״̬ +void SetMcStatus(u32 sta, u32 para) +{ + switch(sta) + { + case MC_STA_CLENA_ERR: // + CleanError(); + break; + case MC_STA_EN_WORK: // (״̬) + printf("set en work sta\r\n"); + g_workCtrl.cursta.workStatus |= WORK_STA_ENSTATE; + break; + case MC_STA_DIS_WORK: // ֹ(״̬) + printf("set dis work sta\r\n"); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_ENSTATE); + break; + case MC_STA_EN_TIME: // (ʱ) + g_workCtrl.cursta.workStatus |= WORK_STA_ENTIME; + break; + case MC_STA_DIS_TIME: // ֹ(ʱ) + g_workCtrl.cursta.workStatus &= ~(WORK_STA_ENTIME); + break; + case MC_CLEAN_COUNT: // + { + if (para == 0) + { + g_workCtrl.cursta.outCounter = 0; + g_workCtrl.cursta.embNeedleNum = 0; // 20211027,ղͬʱմ + } + else + { + int decinc = (s16)para; + decinc += g_workCtrl.cursta.outCounter; + if (decinc < 0) + { + decinc = 0; + } + g_workCtrl.cursta.outCounter = decinc; + } + g_workCtrl.savedpara.outCounter = g_workCtrl.cursta.outCounter; + g_workCtrl.savedpara.embNeedleNum = g_workCtrl.cursta.embNeedleNum; + + SaveWorkNvPara(); + ReportError(0); + break; + } + case MC_STA_MANUAL: // ֶ״̬ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_WKAUTO); + break; + case MC_STA_AUTO: // Զ״̬ + g_workCtrl.cursta.workStatus |= WORK_STA_WKAUTO; + break; + case MC_FILE_SWITCH: // ļл + g_workCtrl.cursta.fileIdx = para; + break; + case MC_INVALID_FILE: // ļʧЧ + InvalidDatFile(para); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_EN_SCAN); // ֹɨ + printf("get InvalidDatFile cmd, Reset work sta en scan1\r\n"); + break; + case MC_CLEAN_PARA_REF: // ˢ²־ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_NEW_PARA); + break; + case MC_SET_TO_NORMAL: // Ϊ״̬ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_SIMULATE); + break; + case MC_SET_TO_SIMULATE: // Ϊģ⹤״̬ + g_workCtrl.cursta.workStatus |= WORK_STA_SIMULATE; + break; + case MC_CLEAN_FIDX: + SetDatIdxToStart(); + /* + g_workCtrl.cursta.dataIdx = 0; // ļλ + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + GetWorkPosFromIndex();*/ + break; + case MC_CLEAN_BOBBIN: // ߼λ + ResetCHB(para); + break; + case MC_SET_ENTER_SCAN_SENSOR: // Ϊ ɨ贫״̬ + g_workCtrl.cursta.workStatus |= WORK_STA_SENSOR; + printf("get MC_SET_ENTER_SCAN_SENSOR cmd\r\n"); + break; + case MC_SET_EXIT_SCAN_SENSOR: // Ϊ ˳ ɨ贫״̬ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_SENSOR); + CleanButtonTask(); + printf("get MC_SET_EXIT_SCAN_SENSOR cmd\r\n"); + break; + case MC_SET_ENTER_TEST_OUTPUT: // Ϊ ״̬ + g_workCtrl.cursta.workStatus |= WORK_STA_OUTPUT; + printf("get MC_SET_ENTER_TEST_OUTPUT cmd\r\n"); + break; + case MC_SET_EXIT_TEST_OUTPUT: // Ϊ ˳ ״̬ + g_workCtrl.cursta.workStatus &= ~(WORK_STA_OUTPUT); + CleanButtonTask(); + printf("get MC_SET_EXIT_TEST_OUTPUT cmd\r\n"); + break; + + case MC_STA_EXIT_TRA: // ˳״̬ + { + g_workCtrl.cursta.workStatus |= WORK_STA_TRAVERSE; + break; + } + + case MC_STA_EXIT_THREADBK: // ˳߼״̬ + { + g_workCtrl.cursta.workStatus &= ~(WORK_STA_DETBK); + break; + } + + case MC_INVALID_FILEBLOCK: // ļݿʧЧ(ʵʱ仨ļ) + { + InvalidDatBlock(); + break; + } + default: + break; + } +} + +// ֶ +int ControlByHand(OperPacket * pPkt) +{ + int err; + printf("receive ctrl by hand, actcode=0x%x, para1=0x%x, para2=0x%x, para3=0x%x\r\n", + pPkt->actByhand.actCode, pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + + err = ERR_NONE; + + if (err != ERR_NONE) + { + ReportError(err); + return err; + } + + switch (pPkt->actByhand.actCode) + { + case MOTO_TO_ZERO: // + MotoToZero(pPkt->actByhand.para1); + break; + case MOVE_BY_HAND: // ֶƶ +// printf("para1=%d, para2=%d, para3=%d\r\n", pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + MoveMotoByHand(pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + break; + case OUTPUT_CTRL: // + OutputByHand(pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + break; + case MOTO_EN_CTRL: // ŷ򿪹ر + MotosServoCtrl(pPkt->actByhand.para1, pPkt->actByhand.para2); + break; + case MANUAL_ACTION: // ֶƹ + ManualActionCtrl(pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + break; + case TEST_THREADBK: // Զ߼ + TestThreadBreak(pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + break; + case SHAKE_FRAME_TEST: // + ShakeFrameTest(pPkt->actByhand.para1, pPkt->actByhand.para2, pPkt->actByhand.para3); + break; + + default: + break; + } + + return 0; +} + +__WEAK void MotoToZero(u16 obj) +{ +} + +__WEAK void MoveMotoByHand(u16 obj, u16 dir, u16 spd) +{ +} + +__WEAK void OutputByHand(u16 obj, u16 act, u16 para) +{ +} + +__WEAK void MotosServoCtrl(u16 obj, u16 onoff) +{ +} + +__WEAK void ManualActionCtrl(u16 obj, u16 para2, u16 para3) +{ +} + +__WEAK void TestThreadBreak(int type, int needle, int head) +{ +} + +void ShakeFrameTest(u16 ofstx, u16 ofsty, u16 runspd) +{ +#if (CUR_MACHINE == MACH_WIRE) + WireShakeFrameTest(ofstx, ofsty, runspd); +#endif +} + +int ControlWork(OperPacket * pPkt) +{ + printf("work cmd, code=0x%x\r\n", pPkt->mcWork.workCode); + switch(pPkt->mcWork.workCode) + { + case WORK_START: // + { + break; + } + case WORK_PAUSE: // ͣ + { + break; + } + case WORK_FINISH: // ̸λ + { + AllToReset(); + break; + } + case WORK_FIND_ZERO: // Զ + { + AllToZero(); + break; + } + case WORK_GOTO_START: // + { + GotoStartPos(); + break; + } + case WORK_GOTO_ANCHOR: // ضλ + { + GotoAnchorPos(); + break; + } + case WORK_GOTO_OFFSET: // ƫƵ + { + GotoOffsetPos(); + break; + } + case WORK_SET_OFFSET: // ƫƵ + { + SetOffsetPos(); + break; + } + case WORK_CHECK_FRAME: // ߿ + { + CheckFrame(); + break; + } + + case WORK_SIMULATION_FRAME: // ߱߿ + { + SimulationFrame(); + break; + } + + case WORK_FAST_JUMP: // ٽ + { + FastJump(pPkt->mcWork.para1); + break; + } + + case WORK_GOTO_WKPOS: // ع + { + GotoWorkPos(); + break; + } + + case WORK_GOTO_FINISH: // ؽ + { + GotoFinishPos(); + break; + } + case WORK_GOTO_ZERO: // λ + { + GotoFrameZeroPos(); + break; + } + + case WORK_RPM_CHG: // ٶȸı + { + ChangeRpm((int)(pPkt->mcWork.para1)); + break; + } + + case WORK_FILE_IDX_CHG: // ļŸı + { + g_workCtrl.cursta.fileIdx = (pPkt->mcWork.para1); + break; + } + + case WORK_GOTO_FEED: // ϵ + { + GotoFeedPos(); + break; + } + case WORK_SET_FEED: // ϵ + { + SetFeedPos(); + break; + } + case WORK_ACT_OIL: // ֶ + { + OilingInWorking(pPkt->mcWork.para1); + break; + } + + default: + break; + } + + return 0; +} + +int ControlWorkWhenWorking(OperPacket * pPkt) +{ + if (pPkt == NULL) + { + return -1; + } + printf("work cmd when work, code=0x%x\r\n", pPkt->mcWork.workCode); + switch(pPkt->mcWork.workCode) + { + case WORK_PAUSE: // ͣ + { + g_workCtrl.stopFlag = 1; + break; + } + case WORK_RPM_CHG: // ٶȸı + { + ChangeRpm((int)(pPkt->mcWork.para1)); + break; + } + case WORK_ACT_OIL: // ֶ + { + OilingInWorking(pPkt->mcWork.para1); + break; + } + default: + break; + } + + return 0; +} + +__WEAK void ChangeRpm(int rpmchg) +{ +} + +// ̸λ +__WEAK void AllToReset(void) +{ +} + +__WEAK void AllToZero(void) +{ +} + +__WEAK int GotoStartPos(void) +{ + return 0; +} + +__WEAK int GotoAnchorPos(void) +{ + return 0; +} + +__WEAK int GotoOffsetPos(void) +{ + return 0; +} + +__WEAK void SetOffsetPos(void) +{ +} + +__WEAK int GotoWorkPos(void) +{ + return 0; +} + +__WEAK int GotoFinishPos(void) +{ + return 0; +} + +__WEAK int GotoFeedPos(void) +{ + return 0; +} + +__WEAK void SetFeedPos(void) +{ +} + +__WEAK int GotoFrameZeroPos(void) +{ + return 0; +} + +__WEAK int CheckFrame(void) +{ + return 0; +} + +// ߱߿ +void SimulationFrame(void) +{ +#if (CUR_MACHINE == MACH_EMB) + EmbSimulationFrame(); +#endif +} + +__WEAK int FastJump(u32 idx) +{ + return 0; +} + +__WEAK void OilingInWorking(u32 para1) +{ +} + +__WEAK int MoveFrameToPos(s32 posx, s32 posy) +{ + return 0; +} + +// ƿ +__WEAK int FixMoveFrame(s32 xmvmnt, s32 yxmvmnt) +{ + return 0; +} + +void MoveFrameTo(OperPacket * pPkt) +{ + s32 posx, posy; + + posx = pPkt->moveFrameTo.posx; + posy = pPkt->moveFrameTo.posy; + + printf("move to cmd, posx=%d, posy=%d\r\n", posx, posy); + + MoveFrameToPos(posx, posy); + +} + +void MoveFrameAsOfst(OperPacket * pPkt) +{ + s32 ofstx, ofsty; + + ofstx = pPkt->moveFrameTo.posx; + ofsty = pPkt->moveFrameTo.posy; + + printf("move as ofst cmd, ofstx=%d, ofsty=%d\r\n", ofstx, ofsty); + + FixMoveFrame(ofstx, ofsty); +} + +//------------------------------------------------------------------------------- + +int ReportError(int errCode) +{ + if (errCode != g_workCtrl.cursta.errorCode) + { + printf("Error: code=0x%x\r\n", errCode); + //printf("cursta work status 0x%x\r\n",g_workCtrl.cursta.workStatus); + } + + g_workCtrl.cursta.errorCode = errCode; + + SendStatus(1); + return 0; +} + +void CleanError(void) +{ + ReportError(ERR_NONE); +} + +__WEAK void SetLightStaByCode(int errCode) +{ + if (errCode == 0 || (errCode >= 0x100 && errCode < 0x200)) // ״̬ + { + if (((g_workCtrl.cursta.workStatus & WORK_STA_WORKING) == WORK_STA_WORKING) || + ((g_workCtrl.cursta.workStatus & WORK_STA_SIMULATE) == WORK_STA_SIMULATE) || + ((g_workCtrl.cursta.workStatus & WORK_STA_BUSY) == WORK_STA_BUSY) || + 0 ) + { + g_workCtrl.almflashRed = ALM_LIT_OFF; // غ + g_workCtrl.almflashGreen = ALM_LIT_FLASH; // ̵ + g_workCtrl.almflashYello = ALM_LIT_OFF; // ػƵ + g_workCtrl.almflashBee = ALM_LIT_OFF; // + } + else + { + g_workCtrl.almflashRed = ALM_LIT_OFF; // غ + g_workCtrl.almflashGreen = ALM_LIT_OFF; // ̵ + g_workCtrl.almflashYello = ALM_LIT_ON; // Ƶ + g_workCtrl.almflashBee = ALM_LIT_OFF; // ط + } + } + else // + { + g_workCtrl.almflashRed = ALM_LIT_FLASH; // + g_workCtrl.almflashGreen = ALM_LIT_OFF; // ̵ + g_workCtrl.almflashYello = ALM_LIT_OFF; // ػƵ + g_workCtrl.almflashBee = ALM_LIT_FLASH; // + } +} + +// ״̬ıж +int IsStatusChanged(void) +{ + int rslt; + + RefreshStatus(); + + g_workCtrl.cursta.workableTimer = GetWorkableTime(); // ¼ֵ + + // Ƚϣͬ + rslt = memcmp(&(g_workCtrl.oldsta), &(g_workCtrl.cursta), sizeof(MCStatus)); + if (rslt != 0) + { + memcpy(&(g_workCtrl.oldsta), &(g_workCtrl.cursta), sizeof(MCStatus)); + } + return rslt; +} + +void SendStatus(int force) +{ + SendMcStatus(force); +} + +__WEAK void CheckSensorAndPos(void) +{ +} + +//------------------------------------------------------------------------------- + +// ѯǰִнȣλ +void CheckAndRequestData(void) +{ + static int olddatblockIdx = -1; // ¼һݿID + static u32 requesttimer = 0; // ʱ¼ + if (IsDatFileAvailable() == TRUE && // 20231017 + g_datFile.storage == STORAGE_NETWORK && // 20240204 + g_workCtrl.requestFlag == 0 && // 20240606 + 1) + { + u32 timer = GetMsSoftTimer(); + + int datblockIdx = GetBlockIdxNeedtoLoad(GetDatIndex()); + if (datblockIdx >= 0) + { + if (olddatblockIdx != datblockIdx || + ((timer - requesttimer) > REQUEST_GAP) || + 0) + { + olddatblockIdx = datblockIdx; + requesttimer = timer; + RequestADataBlock(datblockIdx); + } + } + } +} + +void SetFileOkFlag(int flag) +{ + if (flag == 0) + { + printf("clean file ok flag\r\n"); + g_workCtrl.cursta.workStatus &= ~(WORK_STA_FILEOK); // ļձ־ + } + else + { + printf("set file ok flag\r\n"); + g_workCtrl.cursta.workStatus |= WORK_STA_FILEOK; // ļձ־ + } + + SendStatus(0); +} + +void SaveFileIdxFromDatafile(void) +{ + g_workCtrl.cursta.fileIdx = g_datFile.fileIdx; + g_workCtrl.savedpara.fileIdxMap = g_datFile.fileIdxMap; + g_workCtrl.savedpara.fileIdx = g_workCtrl.cursta.fileIdx; + SaveWorkNvPara(); +} + +int GetDatIndex(void) +{ + return g_workCtrl.cursta.dataIdx; +} + +int DatIndexInc(void) +{ + int rslt; + rslt = g_workCtrl.cursta.dataIdx + 1; + + if (IsDatIndexAvailable(rslt) == TRUE) + { + g_workCtrl.cursta.dataIdx = rslt; + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + } + else + { + rslt = -1; + } + + return rslt; +} + +int DatIndexDec(void) +{ + if (g_workCtrl.cursta.dataIdx != 0) + { + g_workCtrl.cursta.dataIdx--; + + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + return g_workCtrl.cursta.dataIdx; + } + else + { + return -1; + } +} + +__WEAK int GetWorkPosFromIndex(void) +{ + return 0; +} + +int SetExecProgress(OperPacket * pPkt) +{ + int rslt; + FileExecPara execPara; + + if (pPkt == NULL) + { + return -1; + } + + if (pPkt->setExecProgress.exLen != sizeof(execPara)) + { + printf("receive len not equ, receivelen=%d, FileExecPara = %d", pPkt->setExecProgress.exLen, sizeof(execPara)); + rslt = -2; + } + else + { + memcpy((u8*)(&execPara), pPkt->setExecProgress.exData, sizeof(execPara)); + rslt = 0; + } + + if (rslt == 0) + { +#if (CUR_MACHINE == MACH_EMB) + rslt = EmbSetProgress(&execPara); +#elif (CUR_MACHINE == MACH_PES) + rslt = PESSetProgress(&execPara); +#endif + if (rslt == 0) // 20231017 + { + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + } + } + + return rslt; +} + +// ݴͷʼ +void SetDatIdxToStart(void) +{ + g_workCtrl.cursta.dataIdx = 0; // ǰ뼣 + + g_workCtrl.cursta.colorIdx = 0; // 20220708 ݴͷʼ,ɫҲӦôͷʼ + + g_workCtrl.savedpara.dataIdx = g_workCtrl.cursta.dataIdx; + SaveWorkNvPara(); + + // ͷ + g_workCtrl.embMendEndIdx = -1; + g_workCtrl.embMendTrdFlag = 0; + g_workCtrl.mendEndPatternIdx = 0; + + GetWorkPosFromIndex(); + +#if (CUR_MACHINE == MACH_EMB) + EmbSetDatIdxToStart(); +#endif + +} + +//------------------------------------------------------------------------------- + +void SaveToNvArea(s32 * posilist) +{ + if (posilist != NULL) + { + memcpy((s32 *)(&(g_workCtrl.savedpara.motospos[0])), posilist, sizeof(s32)*AXIS_NUM); + SaveWorkNvPara(); + } +} + +void ReadAndFreshMotosPos(void) +{ + s32 pos[AXIS_NUM]; + + if (GetMotosCounter(pos) == 0) + { + RefreshMotosPos(pos); + SaveToNvArea(pos); // 浽籣 + } +} + +void ReadMotosPos(void) +{// ֻˢ, + s32 pos[AXIS_NUM]; + + if (GetMotosCounter(pos) == 0) + { + RefreshMotosPos(pos); + //SaveToNvArea(pos); // 浽籣 + } +} + +void NormalRefPosition(u32 para, s32 * posilist) +{ + SaveToNvArea(posilist); +} + +//------------------------------------------------------------------------------- + + diff --git a/EMBOS/Users/App/workctrl/workctrl.h b/EMBOS/Users/App/workctrl/workctrl.h new file mode 100644 index 0000000..b39a778 --- /dev/null +++ b/EMBOS/Users/App/workctrl/workctrl.h @@ -0,0 +1,434 @@ + +#ifndef __WORKCTRL_H__ +#define __WORKCTRL_H__ + +#include "config.h" + +#include "datafile.h" +#include "operator.h" +#include "motos.h" +#include "nvpara.h" +#include "controlbus.h" + +#include "ocom.h" + +#if (CUR_MACHINE == MACH_EMB) +#include "embroidery.h" +#endif + +#if (CUR_MACHINE == MACH_WIRE) +#include "wire.h" +#endif + +#if (CUR_MACHINE == MACH_BEDSKIRT) +#include "bedSkirt.h" +#endif + +#if (CUR_MACHINE == MACH_PES) +#include "pes.h" +#endif +//------------------------------------------------------------------------------- + +// ״̬ + +typedef struct +{ + // 0 + u32 workStatus; // ״̬λͼ + // .0 ʱޡ=0ʹʱѵλ=1λ + // .1 ״̬=0ǯƣλ=1λ + // .2 ״̬=0ֶ״̬; =1Զ״̬ + // .3 Կ״̬=0ر״̬; =1״̬ + // .4 ļձ־= 0ʼ״̬= 1յļ + // .5 ձ־= 0ʼ״̬= 1յ˲ + // .6 æ־= 0УԽļͲ= 1УļͲ + // .7 ״̬=0ֶ״̬; =1Զ״̬ + // .8 ±־ =1λ˲ + // .9 ģ⹤־=1, ģ⹤״̬ + // .10 ɨ״̬=1, + // .11 ״̬=1, + // .12 ڹ־ + // .13 źɨб־ + // .14 У׼ģʽб־ + // .15 б־. = 0ʼ״̬= 1λڲź,Ӧ + // .16 ȴ־. = 0ʼ״̬= 1ȴ + // .17 ־0ʼ״̬1 + // .18 ܱ־. =1, + // .19 ȡģ״̬ + // .20 ģ״̬ + // .21 ƥ, 0:˳ƥ, 1:ƥ,,ƿ + // .22 ߼⣬ 0˳߼״̬ 1߼״̬ + // .23 īļЧ־, 0:Ч, 1:Ч + // .25 ɾļ־, 0:Ч, 1:Ч + // .26 طļ, 0:Ч, 1:Ч + + // 1 + u32 errorCode; // + s32 fileIdx; // ļ + u32 dataIdx; // + u32 runSpeed; // ˶ٶ + u32 runAction; // ִж * + u32 runSteps; // ǰִв * + u32 outCounter; // + + // 8 + u32 tempdat[12]; // Զ״̬ + + // 20 + s32 btrdPics; // Ƭ + s32 btrdLength; // ߳ȼ + + // 22 + u32 colorIdx; // ɫ + s32 curEncPos; // ǰλ + + // 24 + u32 msAnlge; + u32 potVal; + s32 needleIdx; // λ + + // 27 + s32 workableTimer; // ɹʱӣ + + // 28 + u32 embNeedleNum; // + + // 29 + u32 workTimeRecord; // Ƭʱ + u32 clipLv; + u32 tempdat3; + +// // 20230517չ +// // 32 +// u32 tempdat4[8]; +// +// // 40 +// u32 tempdat5[8]; +// +// // 48 +// u32 tempdat6[8]; +// +// // 56 +// u32 tempdat7[64-56]; + +} __attribute__ ((packed)) MCStatus; + +//------------------------------------------------------------------------------- + +#define WORK_STA_ENTIME 0x00000001 // ʱ +#define WORK_STA_ENSTATE 0x00000002 // ״̬ +#define WORK_STA_WKAUTO 0x00000004 // ״̬ +#define WORK_STA_KEYEN 0x00000008 // Կ״̬ +#define WORK_STA_FILEOK 0x00000010 // ļձ־= 0ʼ״̬= 1յļ +#define WORK_STA_PARAOK 0x00000020 // ձ־= 0ʼ״̬= 1յ˲ +#define WORK_STA_BUSY 0x00000040 // æ־= 0УԽļͲ= 1УļͲ + +#define WORK_STA_NEW_PARA 0x00000100 // ±־ =1λ˲λҪȡλIJļ +#define WORK_STA_SIMULATE 0x00000200 // ģ⹤־ =1ģ⹤ +#define WORK_STA_EN_SCAN 0x00000400 // ɨ =1ɨ״̬ +#define WORK_STA_WORKING 0x00001000 // ־= 1 +#define WORK_STA_SENSOR 0x00002000 // źɨб־. = 0ʼ״̬= 1λڼ⴫ź,аťӦ +#define WORK_STA_OUTPUT 0x00008000 // б־. = 0ʼ״̬= 1λڲź,Ӧ +#define WORK_STA_WAIT 0x00010000 // ȴ־. = 0ʼ״̬= 1ȴ + +#define WORK_STA_CHG_HOOK 0x00020000 // ־0ʼ״̬1 +#define WORK_STA_TRAVERSE 0x00040000 // ܱ־. 0,ʼ״̬. 1, + +#define WORK_STA_CLOTH 0x00200000 // ƥ, 0:˳ƥ, 1:ƥ,,ƿ +#define WORK_STA_DETBK 0x00400000 // ߼ 0˳߼״̬ 1߼״̬ + +#define WORK_STA_FRM_CHK 0x02000000 // ģ嵽λ־0δλ1λ +#define WORK_STA_RFID_SCAN 0x04000000 // RFIDʶ־01 + +#define WORK_STA_ALL_STOP (WORK_STA_SENSOR|WORK_STA_OUTPUT|WORK_STA_GET_FLM|WORK_STA_PUT_FLM) // ֹӦκζ״̬ + +//------------------------------------------------------------------------------- + +typedef struct +{ + u16 id; + u16 cfg; + u16 mod; +}AxisItem; + +//------------------------------------------------------------------------------- + +typedef struct +{ + // 0 + s32 motospos[AXIS_NUM]; // λ + // 6 + u32 fileID; // ļʶ + u32 dataIdx; // + u32 runSteps; // ǰִв + u32 outCounter; // + u32 btrdPics; // Ƭ () + u32 btrdLength; // ߳ȼ () + u32 fileCheck; // ļУ + u32 mcType; // + s32 fileIdx; // ļ + u32 fileIdxMap; // ļλͼ + u32 hookPlateCount; // Զ̼ + s32 sendCount; // + + u32 embNeedleNum; // + + // 18 + u8 rev[MAX_SAVE_SIZE-(AXIS_NUM+13)*sizeof(u32)]; + u16 enFlag; // Ч־ +} __attribute__ ((packed)) SavedPara; + +//---------------------------- + +typedef struct +{ + MCStatus cursta; + MCStatus oldsta; + + SavedPara savedpara; // + + //----------------------- + u32 paraEnFlag; // Ч־ + //----------------------- + u32 boardId; // 忨ID + + //----------------------- + + // λ + u32 posEnFlag; // Ч־ + int zeroEnFlag; // λЧ־ + s32 zeroPosList[AXIS_NUM*10]; // λֵ + + // + int workAvaible; // ꣨꣩Ч־ + s32 workPos[AXIS_NUM*10]; // ,*10ΪԤ + + //----------------------- + + int curmsrpm; // ǰת + int chrpmflag; // תٸı־ + u32 expectedOutput; // ԤƲ + + //----------------------- + int stopFlag; // ֹͣ־ + int sendStaWhenRun; // ʱ״̬־ + + //----------------------- + int chBobbinPics; // Ƭ + int chBobbinLength; // ܳȣλ0.01mm + //----------------------- + // ɫƷ + int almflashRed; // ˸־ + int almredSta; // ״̬ + int almflashGreen; // ̵˸־ + int almgreenSta; // ̵״̬ + int almflashYello; // Ƶ˸־ + int almyelloSta; // Ƶ״̬ + int almflashBee; // ˸־ + int almbeeSta; // ״̬ + int almSta; // ״̬ + + //----------------- + + int cansetelapsed; + + //----------------- + int stopShiftFlag; + //----------------- + + int embMendTrdFlag; // ־ + int embMendEndIdx; // + int mendEndPatternIdx; // 20230601 ɻ,ڻѭ򷴸ʱɿ绨 + + //----------------- + + int requestFlag; // ̬־, =0, =1,ֹ + + //----------------- + int workStopFlag; + int olderr; + int fileScanFlag; + int fileScanSaveId; + int fileScanOldId; + int fileScanId; + //----------------- + u32 stopShiftEn; + int stopShiftDx; + int stopShiftDy; + + int stopBtnFlag; + + void (*WorkRunTask)(void); + void (*AsynchronousTask)(void); + +}WorkCtrl; + +//---------------------------- + +#ifdef _IN_WORKCTRL_C +WorkCtrl g_workCtrl; +#else +extern WorkCtrl g_workCtrl; +#endif + +//---------------------------- + +void InitWorkCtrl(void); +void InitAppCallback(void); +void WorkCtrlTask(void); +void TasksWhenDelay(void); +void DelayRef(u32 ms); +void DelayAndAsyncExe(u32 ms); +void DelayRefFt(u32 ms); + +//---------------------------- +void RefreshWorkTimeEn(void); + +void SaveWorkNvPara(void); + +void RefreshStatus(void); +void RefreshParas(int flag); +void SetNewParasFlag(int flag); + +//------------------------------------------------------------------------------- + +void RequestBoardVer(void); // Χ汾 +int CreateBoardVer(OperPacket * pPkt, u8 protocol, u8 nodeId, u8 nodeType, BoardRegVal * pRegVal); +int CreateHeadBoardPara(OperPacket * pPkt, u8 nodeId, u8 nodeType, u8* pData); +int CreateColorBoardPara(OperPacket * pPkt, u8 nodeId, u8* pData); + +int RequestHeadNvParas(int nodetype, int nodeid, int paraid, u32 * pBuf); +void SetHeadNvPara(int nodetype, int nodeid, int paraid, u32 * pBuf); +int CreateHeadNvParas(OperPacket * pPkt, u8 nodetype, u8 nodeId, u8 paraid, u8* pData); + +int CreateMcInfo(OperPacket * pPkt, int toggle); +int CreateMcStatus(OperPacket * pPkt, int toggle); + +int CreateFileList(OperPacket * pPkt, int toggle); + +void SensorsStatus(int mode, u8 * buf); +int CreateSensorsStatus(OperPacket * pPkt); +int CreateSensorsBmp(OperPacket * pPkt); + +//------------------------------------------------------------------------------- + +void TraverseTask(u8 protocol, u8 nodeId, u8 nodeType, int traNum); // + +void SetMcStatus(u32 sta, u32 para); + +int ControlByHand(OperPacket * pPkt); + +void MotoToZero(u16 obj); +void MoveMotoByHand(u16 obj, u16 dir, u16 spd); +void OutputByHand(u16 obj, u16 act, u16 para); +void MotosServoCtrl(u16 obj, u16 onoff); +void ManualActionCtrl(u16 obj, u16 para2, u16 para3); +void TestThreadBreak(int type, int needle, int head); +void ShakeFrameTest(u16 ofstx, u16 ofsty, u16 runspd); + + +int ControlWork(OperPacket * pPkt); +int ControlWorkWhenWorking(OperPacket * pPkt); + +void ChangeRpm(int rpmchg); +void AllToReset(void); +void AllToZero(void); +int GotoStartPos(void); +int GotoAnchorPos(void); +int GotoOffsetPos(void); +void SetOffsetPos(void); +int GotoWorkPos(void); +int GotoFinishPos(void); +int GotoFeedPos(void); +void SetFeedPos(void); +int GotoFrameZeroPos(void); +int CheckFrame(void); +void SimulationFrame(void); +int FastJump(u32 idx); +void OilingInWorking(u32 para1); +int MoveFrameToPos(s32 posx, s32 posy); +int FixMoveFrame(s32 xmvmnt, s32 yxmvmnt); + +void MoveFrameTo(OperPacket * pPkt); +void MoveFrameAsOfst(OperPacket * pPkt); + +//------------------------------------------------------------------------------- + +int ReportError(int errCode); +void CleanError(void); + +void SetLightStaByCode(int errCode); + +int IsStatusChanged(void); +void SendStatus(int force); + +void CheckSensorAndPos(void); + +//------------------------------------------------------------------------------- + +void CheckAndRequestData(void); + +void SetFileOkFlag(int flag); + +void SaveFileIdxFromDatafile(void); + +int GetDatIndex(void); +int DatIndexInc(void); +int DatIndexDec(void); + +void ChangeWorkPos(DataItem * pDatItem, int dir); +int GetWorkPosFromIndex(void); + +int SetExecProgress(OperPacket * pPkt); + +void SetDatIdxToStart(void); + +//------------------------------------------------------------------------------- + +// ȡˢµλ +void ReadMotosPos(void); +void ReadAndFreshMotosPos(void); +void NormalRefPosition(u32 para, s32 * posilist); + +//------------------------------------------------------------------------------- + +#define SET_MOTO_ZERO(mt) do\ +{\ + if (g_workCtrl.zeroEnFlag == DATA_VALID && (g_workCtrl.posEnFlag & mt##_MOD) == (mt##_MOD))\ + {\ + printf("\r\nset %s zero = %d \r\n", #mt, list[mt##_IDX]);\ + printf("before set, zero is %d\r\n", g_workCtrl.zeroPosList[mt##_IDX]);\ + temp = list[mt##_IDX] - g_workCtrl.zeroPosList[mt##_IDX]; /* ǰλԭλIJ */\ + temp += g_motosPara.motosPos[mt##_IDX]; /* õǰ */\ + printf("set new pos to %d\r\n", temp);\ + printf("old pos=%d, new pos=%d\r\n", g_motosPara.motosPos[mt##_IDX], temp);\ + SetMotoCounter(mt##_IDX, temp); /* ֵ */\ + ReadAndFreshMotosPos();\ + }\ +}while(0); + +#define SET_EX_MOTO_ZERO(mt) do\ +{\ + if (g_workCtrl.zeroEnFlag == DATA_VALID && (g_workCtrl.posEnFlag & mt##_MOD) == (mt##_MOD))\ + {\ + printf("\r\nset %s zero = %d \r\n", #mt, list[EX##mt##_IDX]);\ + printf("before set, zero is %d\r\n", g_workCtrl.zeroPosList[EX##mt##_IDX]);\ + temp = list[EX##mt##_IDX] - g_workCtrl.zeroPosList[EX##mt##_IDX]; /* ǰλԭλIJ */\ + temp += g_motosPara.motosPos[mt##_IDX]; /* õǰ */\ + printf("set new pos to %d\r\n", temp);\ + printf("old pos=%d, new pos=%d\r\n", g_motosPara.motosPos[mt##_IDX], temp);\ + SetMotoCounter(mt##_IDX, temp); /* ֵ */\ + ReadAndFreshMotosPos();\ + }\ +}while(0); +//------------------------------------------------------------------------------- +#if (AUTO_ELEC_CLIP == 1) +typedef struct +{ + u32 index; + u8 level; +}__attribute__ ((packed)) DataClip; + +extern DataClip g_dataClipLvBuf[256]; +#endif +#endif diff --git a/EMBOS/Users/Boot/boottasks.c b/EMBOS/Users/Boot/boottasks.c new file mode 100644 index 0000000..259af49 --- /dev/null +++ b/EMBOS/Users/Boot/boottasks.c @@ -0,0 +1,363 @@ +//------------------------------------------------------------------------------- +// File Name: boottasks.c +// Brief: +// Version: 1.1.0 +// Create Date: 2020/07/31 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2019, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2020/07/31 +//------------------------------------------------------------------------------- + +#include "boottasks.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + +#include "trigger.h" +#include "shell.h" +#include "delay.h" +#include "xmodem.h" +#include "serial.h" +#include "inout.h" +#include "norflash.h" +#include "stiap.h" +#include "stapp.h" +#include "smec98sp.h" +#include "operator.h" + +void InitBootloader(void); +int WaitForInput(void); + +void BootMainTask(void) +{ + int rslt; + + InitTrigger(); // ʼʱ + + InitShell(); // ʼShell + + printf("\r\n================== Bootloader ==================\r\n"); + + do + {// ϵ2,оƬǷ +#if (USE_SMEC != 0) + rslt = SMEC_Detection(); +#else + rslt = 0; +#endif + if (rslt == 0) + { + break; + } + else + {// оƬ,ָʾ13 + printf("Err: Encryption chip access failed!\r\n"); + + SetLedOn(); + DelayMs(2000); + SetLedOff(); + + DelayMs(300); + + SetLedOn(); + DelayMs(200); + SetLedOff(); + + DelayMs(300); + + SetLedOn(); + DelayMs(200); + SetLedOff(); + + DelayMs(300); + + SetLedOn(); + DelayMs(200); + SetLedOff(); + + DelayMs(2000); + } + }while(1); + + InitBootloader(); + + printf("Bootloader init ok\r\n"); + + rslt = WaitForInput(); + + if (rslt == 0) // û + { + UpdateApp(); // ļ + JumpToApp(); // APP + } + else + { + DelayMs(100); + printf("Get input, enter update\r\n"); + } + + //---------------------------- + + InitOperator(); // ʼ + + do + { + TriggerTask(); // + + ShellTask(); + + OperatorTaskWhenBoot(); + +#if (0) // ѭٶ + static u32 timer = 0; + static u32 temp; + static int runcount = 0; + + runcount++; + temp = GetMsSoftTimer(); + if (temp - timer >= 1000) + { + timer = temp; + printf("run circle = %d/s\r\n", runcount); + runcount = 0; + } +#endif + }while(1); + +} + + +//-------------------------------------------------- + +int WaitForInput(void) +{ + int rslt; + int timer, tptimer; + int steps; + + printf("Press ENTER into bootloader\r\n"); + + DelayMs(100); + + rslt = 0; + steps = 0; + timer = GetMsSoftTimer(); + + do + { + TriggerTask(); // + if (ShellTask() >= 0) // ôִӦ + { +#if (0) + if (GetHistoryNum() > 0) + { + char input[20]; + int tmprst = GetHistoryCmd(0, &input[0]); + if (tmprst == 0 && strcmp(input, "ver") == 0) + { + rslt = 1; + break; + } + } +#else + rslt = 1; + break; +#endif + } + + tptimer = GetMsSoftTimer(); + if (tptimer - timer > steps) + { + PutChar('.'); + steps += 100; + } + + if (tptimer - timer > 1000) // 1û + { + rslt = 0; + break; + } + }while(1); + printf("\r\n"); + return rslt; +} + +//-------------------------------------------------- + +void LoadApp(char * para1, char * para2); +void JpToApp(char * para1, char * para2); + +//--------------------------------------------------- + +void InitBootloader(void) +{ + printf("Begin bootloader task\r\n"); + + InitNorSpi(); // ʼ nor flash SPI + SNFlashInit(SetNorSpiNssOn, SetNorSpiNssOff, NorSpiReadByte, NorSpiWriteByte); // ʼnor flash עд + + AddShellCmd("LOADAPP", "load the app", LoadApp); + AddShellCmd("JUMPTOAPP", "jump to app", JpToApp); + + AddTriggerToList(100, SetLedToggle, NULL); // 100ms +} + + +#if (CONSOLE_PORT == COMM_USART1) + +#define CLEAN_RS_BUFF Usart1CleanRsBuf +#define IS_SDBUF_EMPTY IsUsart1SendBufEmpty +#define GET_DATA Usart1GetData +#define SEND_DATA Usart1SendData +#define GET_RS_LEN Usart1GetRsLen + +#endif + + + +// Ӵڣ洢 APP +void LoadApp(char * para1, char * para2) +{ + int rsv = 'x'; + int com = 1; + int rslt = 0; + +// IAPCleanUpdateArea(); // nand APP 洢 + + if (para1 != NULL) + { + if (strcmp(para1, "") == 0 || + strcmp(para1, "x") == 0 || + strcmp(para1, "X") == 0 || + 0 ) + { + rsv = 'x'; // xmodem + if (para2 != NULL) + { + com = atoi(para2); + if (com <= 0 || com > 2) + { + com = 1; + } + } + } + else if (strcmp(para1, "t") == 0 || + strcmp(para1, "T") == 0 || + 0 ) + { + rsv = 't'; // + } + else if (strcmp(para1, "s") == 0 || + strcmp(para1, "S") == 0 || + 0 ) + { + rsv = 's'; // + } + else + { + + } + } + + if (rsv == 'x') + { + int timer; + XmodemCtrl xctrl; + printf("receive by xmodem start\r\n"); + + if (com == 1) + { + SetPauseStatus(1); // رն + CLEAN_RS_BUFF(); // սbuff + + // ȵbuffΪ + timer = GetMsSoftTimer(); // ¼ʱ + do + { + if (IS_SDBUF_EMPTY() == TRUE) + { + break; + } + + if (GetMsSoftTimer() - timer > 2000) // жǷʱ + { + SetPauseStatus(0); // ն + } + }while(1); + + // עắ + xctrl.XmodemInBuff = GET_DATA; + xctrl.XmodemOutBuff = SEND_DATA; + xctrl.XmodemGetInBuffLen = GET_RS_LEN; + xctrl.XmodemCleanBuff = CLEAN_RS_BUFF; + xctrl.InitSave = InitSaveApp; + xctrl.SaveData = SaveAppData; + xctrl.savedsize = 0; + + rslt = XmodemReceive(&xctrl); + + // ȵbuffΪ + timer = GetMsSoftTimer(); // ¼ʱ + do + { + if (IS_SDBUF_EMPTY() == TRUE) + { + break; + } + + if (GetMsSoftTimer() - timer > 2000) // жǷʱ + { + SetPauseStatus(0); // ն + } + }while(1); + + CLEAN_RS_BUFF(); // սbuff + SetPauseStatus(0); // ն + + OutDebugBufInfo(); + } + else + { + // ʱ֧ + printf("1. not support com port=%d\r\n", com); + } + + printf("\r\nreceive by xmodem end\r\n"); + + if (rslt == 1) + { + printf("receive done, check is save data correct\r\n"); + + rslt = IsAppReceiveDone(); // жǷɣȡ + + if (rslt == xctrl.savedsize) + { + StartAppUpdate(0); // ֤Ƿ񱣴ɹ + } + else + { + printf("receive size not equ, xctrl.savedsize=%d, received=%d\r\n", xctrl.savedsize, rslt); + } + } + else + { + printf("receive not finish\r\n"); + } + } + else + { + // ʱ֧ + printf("2. not support comm type=%c\r\n", rsv); + } +} + +void JpToApp(char * para1, char * para2) +{ + JumpToApp(); // APP +} + +#endif + diff --git a/EMBOS/Users/Boot/boottasks.h b/EMBOS/Users/Boot/boottasks.h new file mode 100644 index 0000000..b3b46af --- /dev/null +++ b/EMBOS/Users/Boot/boottasks.h @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------- +// File Name: boottasks.h +// Brief: +// Version: 1.1.0 +// Create Date: 2020/07/31 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2019, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2020/07/31 +//------------------------------------------------------------------------------- + +#ifndef __BOOTTASKS_H__ +#define __BOOTTASKS_H__ + +#include "config.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + +void BootMainTask(void); + +#endif + + + +#endif + diff --git a/EMBOS/Users/Config/config.c b/EMBOS/Users/Config/config.c new file mode 100644 index 0000000..9dc1859 --- /dev/null +++ b/EMBOS/Users/Config/config.c @@ -0,0 +1,105 @@ + +#define _IN_CONFIG_C + +#include "config.h" + +static const char VERSION_INFO[VERSION_LEN] = +{ +#if (CUR_UPFL == GAUF_PMB1) + 'P','0','-','0','1', +#elif (CUR_UPFL == GAUF_EMB1) + 'E','0','-','0','1', +#else + '0','0','0','0','0', +#endif + '-', + VER_TYPE, + '-', + VER_PROD, + ' ', + 'V', + VER_CODE_M, + '.', + VER_CODE_S, + '.', + VER_CODE_D, + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +}; + +void GetCompileDateTime(char * datetime) +{ + u8 i; + int month, year, day; + int hour, min, second; + + const char *pMonth[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + const char Date[12] = __DATE__; // ȡ + const char time[12] = __TIME__; // ȡʱ + + month = 1; + for (i = 0; i < 12; i++) + { + if (memcmp(Date, pMonth[i], 3) == 0) + { + month = i + 1; + break; + } + } + year = (uint8_t)atoi(Date + 9); // Date[9]ΪλݣDate[7]Ϊ + day = (uint8_t)atoi(Date + 4); + + hour = (uint8_t)atoi(time + 0); + min = (uint8_t)atoi(time + 3); + second = (uint8_t)atoi(time + 6); + + if (datetime != NULL) + { + sprintf(datetime, "%02d%02d%02d%02d%02d%02d", year, month, day, hour, min, second); + } +} + +void GetVersionStr(char * str) +{ + if (str != NULL) + { + memcpy(str, VERSION_INFO, VERSION_LEN); + str[VERSION_LEN-1] = 0; + if (str[0] == 0xff) + { + str[0] = 0; + } + else + { + if ( + str[VERSION_LEN-12] == 0xff && + str[VERSION_LEN-11] == 0xff && + str[VERSION_LEN-10] == 0xff && + str[VERSION_LEN-9] == 0xff && + str[VERSION_LEN-8] == 0xff && + str[VERSION_LEN-7] == 0xff && + str[VERSION_LEN-6] == 0xff && + str[VERSION_LEN-5] == 0xff && + str[VERSION_LEN-4] == 0xff && + str[VERSION_LEN-3] == 0xff && + str[VERSION_LEN-2] == 0xff && + // str[VERSION_LEN-1] == 0xff && + 1 ) // дij + { + u32 wrAddr; + char * vbuf = &(str[VERSION_LEN-12]); + GetCompileDateTime(vbuf); + wrAddr = (u32)VERSION_INFO; + wrAddr += VERSION_LEN-23; + + // STMFlashWrite(wrAddr, (u16*)vbuf, 12/2, 3); // дflash + } + } + } +} + +void GetBuildStr(char * str) +{ + sprintf(str, "Build: %s %s\r\n", __DATE__, __TIME__); +} + diff --git a/EMBOS/Users/Config/config.h b/EMBOS/Users/Config/config.h new file mode 100644 index 0000000..17f47db --- /dev/null +++ b/EMBOS/Users/Config/config.h @@ -0,0 +1,455 @@ + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include "afxdef.h" +//--------------------------------------------------------------- + + #define VER_CODE_M '1','0' + #define VER_CODE_S '0','1' + #define VER_CODE_D '0','1' + + +#define GAUF_PMB1 0x100 // ͼ +#define GAUF_EMB1 0x101 // 廨/ +#define GAUF_EHA1 0x501 // ƽͷ +#define GAUF_EHB1 0x502 // ߻ͷ + +#define CUR_UPFL GAUF_EMB1 + +//--------------------------------------------------------------- + +// ͻ + +// ͻ +#define CLIENT_NONE 0 // ĬϿͻ +#define CLIENT_GOA 3 // ٵ + +#define CUR_CLINET CLIENT_GOA + +//--------------------------------------------------------------- + +#define CORE_BOARD_BOOT 0 // +#define CORE_BOARD_APP 1 // Ӧô + +#define CUR_CORE_BOARD CORE_BOARD_APP + +//--------------------------------------------------------------- + +#define VERSION_DEBUG 0 // ԰汾 +#define VERSION_RELEASE 1 // 汾 + +#define CUR_VERSION VERSION_DEBUG + +//--------------------------------------------------------------- +// +#define MACH_NONE 0 // δ֪ + +// 001~099  +#define MACH_EMB 1 // 廨 +#define MACH_WIRE 2 // ߻ + + +// 100~149  + + +// 150~199 +#define MACH_SCANNER 150 // ɨ +#define MACH_PLATECUT 151 // ƽи + +// 200~255 +#define MACH_MILLING 201 // ϳл +#define MACH_BEDSKIRT 202 // ȹ߻ +#define MACH_OPTICAL 203 // ˲߻ + +#define MACH_PES 210 // + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + #define CUR_MACHINE MACH_OPTICAL +#else + #define CUR_MACHINE MACH_NONE +#endif + +//--------------------------------------------------------------- + +#define USE_PASSWORD 0 // ʹ÷ڸ + +//--------------------------------------------------------------- + +#define USE_IWDOG 0 // ʹÿŹ + +//--------------------------------------------------------------- + + +//--------------------------------------------------------------- + +#ifndef SYSCLK +#define SYSCLK 180000000L // 180M +#endif + +//--------------------------------------------------------------- + +// bootloader С +#define STM32_BOOT_SIZE (64*1024) + +#define VERSION_LEN 48 +#define EX_VER_LEN 32 + +#define NO_BUFF_WHEN_WT 1 // st flash ޻д + +#define APP_SAVE_TO APP_SAVE_NORFLASH // APP +//#define APP_SAVE_TO APP_SAVE_EXRAM // APP + +//--------------------------------------------------------------- + +// ͨѶ˿ѡ +#if (1) + +#define COMM_NONE 0 // ʹãЧ + +#define COMM_USART1 1 // 1, 232 + +#define COMM_USART6 6 // 6, 485 + +#define COMM_ETHERNET 10 // ̫ +#define COMM_CAN 11 // CAN + +#define CONSOLE_PORT COMM_USART1 // ̨ͨѶ + +#define USART6_485OutEn SetEn485OutOff +#define USART6_485OutDis SetEn485OutOn + +#define MAX_STBUF1_SIZE (1024+512) +#define MAX_SRBUF1_SIZE (512) // ̨ͨѶ1շС + +#define CONTROL_BUS COMM_CAN // չͨѶ + +#define HCAN hcan1 + +#define OPERATOR_PORT COMM_ETHERNET // ͨѶ + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) +#define MODBUS_M +#endif + +#endif // ͨѶ˿ѡ + +//--------------------------------------------------------------- + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) +#define STM32_MOTOS_NUM 6 // + +#define SPEED_TIM TIM8 + +#define MOTO1_TIM TIM9 + +#define MOTO2_TIM TIM10 + +#define MOTO3_TIM TIM11 + +#define MOTO4_TIM TIM12 + +#define MOTO5_TIM TIM13 + +#define MOTO6_TIM TIM14 + +#define MOOT_TIM_PSC 300 + +#endif + +//--------------------------------------------------------------- + +// SPI ˿ʹö +#define SRW_SPI1 // w5500 +#define SRW_SPI2 // FLASH(norflash) +#define SRW_SPI3 // FRAM + +#define SERVER_NUM 1 // TCP + +//--------------------------------------------------------------- + +#define SERNORFLASHTYPE W25Q256 // norflashͺѡ + +//--------------------------------------------------------------- +// оƬ +#define SMEC_CHIP + +#define USE_SMEC 0 + +//--------------------------------------------------------------- + +#define TRANS_APP_FILE 1 +#define TRANS_DATA_FILE 1 + +//--------------------------------------------------------------- + +#if (CUR_MACHINE == MACH_EMB) + + #define EMB_MC_FLAT 10 // ƽ + #define EMB_MC_NSTC 11 // ׼͵ͷñ(͹ֻɫ) normal single Tubular/Cap + #define EMB_MC_FLOCK 12 // ֲ + #define EMB_MC_FLTIF 13 // ƽ,ѹ + + #define EMB_MC_FECC 50 // ƽ+ë + #define EMB_MC_CC 51 // ë + #define EMB_MC_FECT 52 // ƽ+ + #define EMB_MC_FECCC 53 // ƽ+ë+ + + #define EMB_MC_QUISN 100 // ,ͷ1,޹ۻ + #define EMB_MC_QUIDN 101 // ,ͷ2,йۻ,D86 + #define EMB_MC_QUIMN 102 // ,ͷڵ4,йۻ,D86 + +//----------------- + #define EMB_MC_TYPE EMB_MC_FLAT // ǰѡ + + #define MC_TYPE EMB_MC_TYPE + + #define ROT_PULSE_PER_CIRCLE (1000) // תÿȦ + + #define TRANS_PKT_LIST_NUM 128 + #define RESV_PKT_LIST_NUM 128 // CANշС + + #define COLOR_NODEID_BASE 2 + #define HEAD_NODEID_BASE 11 + + #define RD_HEAD_PARA_NUM 4 // (ƽͷ+ëͷ+ƻͷ+ëɫ) + +//----------------- + +#if (EMB_MC_TYPE == EMB_MC_NSTC) + #define MAX_SUPPORT_HEAD 1 +#elif (EMB_MC_TYPE == EMB_MC_FECC) + #define MAX_SUPPORT_COLOR 2 + #define MAX_SUPPORT_HEAD 60 +#elif (EMB_MC_TYPE == EMB_MC_CC) + #define MAX_SUPPORT_COLOR 2 + #define MAX_SUPPORT_HEAD 40 +#elif (EMB_MC_TYPE == EMB_MC_FECT) + #define MAX_SUPPORT_COLOR 1 + #define MAX_SUPPORT_HEAD 48 +#elif (EMB_MC_TYPE == EMB_MC_FECCC) + #define MAX_SUPPORT_COLOR 2 + #define MAX_SUPPORT_HEAD 40 +#elif (EMB_MC_TYPE == EMB_MC_QUISN) + #define MAX_SUPPORT_HEAD 132 +#elif (EMB_MC_TYPE == EMB_MC_QUIDN || EMB_MC_TYPE == EMB_MC_QUIMN) + #define MAX_SUPPORT_HEAD 48 +#else + #define MAX_SUPPORT_COLOR 1 + #define MAX_SUPPORT_HEAD 32 +#endif + +//----------------- + #define TEMP_DATA1_SIZE (4*1024) // ͷ,4K,1024ɫ + + #define TEMP_DATA2_SIZE (2*1024) // (ɫ)ݴС,2K,1024ɫ + + #define TEMP_DATA3_SIZE (1024) // չɫС,1K(չ512ɫ) + + #define TEMP_DATA4_SIZE (1024) // ë߶ݴС,1k,1024ɫ + + #define DATA_FILE_SIZE3 (48*1024) // ߿ļռС,48K + #define DATA3_BASE_ADDR (EXRAM1_BASE_ADDR+TEMP_DATA1_SIZE+TEMP_DATA2_SIZE+TEMP_DATA3_SIZE+TEMP_DATA4_SIZE) + + #define EMB_MAX_SIZE (TEMP_DATA1_SIZE+TEMP_DATA2_SIZE+TEMP_DATA3_SIZE+TEMP_DATA4_SIZE+DATA_FILE_SIZE3) // 廨ʹݿռС + #define EXRAM1_DATA_ADDR_BEG (EXRAM1_BASE_ADDR+EMB_MAX_SIZE) + #define MAX_DATA_EXRAM1_SIZE (EXRAM1_BYTE_SIZE-EMB_MAX_SIZE) + +#elif (CUR_MACHINE == MACH_WIRE) + + #define WIRE_MC_WIRE 1 // ߻ + + + #define WIRE_MC_TYPE WIRE_MC_WIRE + + + #define ROT_PULSE_PER_CIRCLE (1000) // תÿȦ + + #define MC_TYPE WIRE_MC_TYPE + + #define MAX_SUPPORT_HEAD 20 + #define MAX_SUPPORT_EXTIO 1 + + #define TRANS_PKT_LIST_NUM 128 + #define RESV_PKT_LIST_NUM 128 // CANշС + + #define RD_HEAD_PARA_NUM 4 + +#elif (CUR_MACHINE == MACH_MILLING) + + #define DEF_MILL 1 // ϳл + #define MILL_MC_TYPE DEF_MILL + + #define MC_TYPE MILL_MC_TYPE + +#elif (CUR_MACHINE == MACH_BEDSKIRT) + #define DEF_BEDSKIRT 1 // ȹ߻ + #define BED_MC_TYPE DEF_BEDSKIRT + + #define MC_TYPE BED_MC_TYPE +#elif (CUR_MACHINE == MACH_PES) + #define PES_MC_RHNR 1 // תһ + + #define PES_MC_DHP 20 // ˫ͷ׻ + #define PES_MC_DRHP 21 // ˫ͷת׻ + + #define PES_MC_NPES 50 // ͨ + #define PES_MC_APERS 51 // ת + #define PES_MC_DPENS 52 // ת + #define PES_MC_HPS 53 // + + + #define PES_MC_TYPE PES_MC_APERS +#elif(CUR_MACHINE == MACH_SCANNER) + #define RUANYI 1 + #define LEISAI 2 + #define BUSCTRL_MOTO LEISAI // +#endif + +//--------------------------------------------------------------- + +#if (CUR_MACHINE == MACH_PES) + #if (PES_MC_TYPE == PES_MC_RHNR) + #define MAX_SUPPORT_SEWHD 1 + #define AUTO_ELEC_CLIP 1 + #elif (PES_MC_TYPE == PES_MC_NPES) + #define MAX_SUPPORT_SEWHD 1 + #define USE_IOEX 1 // ʹIOչ + #define MAX_SUPPORT_HEAD 2 + #elif (PES_MC_TYPE == PES_MC_APERS) + #define MAX_SUPPORT_HEAD 1 + #define MAX_SUPPORT_SEWHD 1 + #define USE_IOEX 1 // ʹIOչ + #define AUTO_ELEC_CLIP 1 + #elif (PES_MC_TYPE == PES_MC_DHP) + #define USE_IOEX 2 // ʹIOչ + #endif + + +#endif + +//--------------------------------------------------------------- + +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + + #define VER_TYPE 'G','O','A' + + #define VER_PROD 'B','O','O','T',' ' + + #define VER_CODE_M '1','0' // 汾 + #define VER_CODE_S '0','1' // Ӱ汾 + #define VER_CODE_D '0','1' // 汾 + +#else +#if (CUR_MACHINE == MACH_EMB) + + #define VER_TYPE 'E','M','B' + + #if (EMB_MC_TYPE == EMB_MC_FLAT) + #define VER_PROD 'F','L','A','T',' ' + #elif (EMB_MC_TYPE == EMB_MC_NSTC) + #define VER_PROD 'N','S','T','C',' ' + #elif (EMB_MC_TYPE == EMB_MC_FLOCK) + #define VER_PROD 'F','L','O','C','K' + #elif (EMB_MC_TYPE == EMB_MC_FLTIF) + #define VER_PROD 'F','L','T','I','F' + #elif (EMB_MC_TYPE == EMB_MC_FECC) + #define VER_PROD 'F','E','+','C','C' + #elif (EMB_MC_TYPE == EMB_MC_CC) + #define VER_PROD 'C','C',' ',' ',' ' + #elif (EMB_MC_TYPE == EMB_MC_FECT) + #define VER_PROD 'F','E','+','C','T' + #elif (EMB_MC_TYPE == EMB_MC_FECCC) + #define VER_PROD 'F','E','C','C','C' + #elif (EMB_MC_TYPE == EMB_MC_QUISN) + #define VER_PROD 'Q','U','I','S','N' + #elif (EMB_MC_TYPE == EMB_MC_QUIDN) + #define VER_PROD 'Q','U','I','D','N' + #elif (EMB_MC_TYPE == EMB_MC_QUIMN) + #define VER_PROD 'Q','U','I','M','N' + #else + #define VER_PROD ' ',' ',' ',' ',' ' + #endif + + +#elif (CUR_MACHINE == MACH_WIRE) + #define VER_TYPE 'A','S','W' + #define VER_PROD 'W','I','R','E',' ' + + +#elif (CUR_MACHINE == MACH_MILLING) + #define VER_TYPE 'G','O','A' + #define VER_PROD 'M','I','L','L',' ' + +#elif (CUR_MACHINE == MACH_BEDSKIRT) + #define VER_TYPE 'B','E','D' + #define VER_PROD 'S','K','I','R','T' + + +#elif (CUR_MACHINE == MACH_PES) + #if (EMB_MC_TYPE == PES_MC_RHNR) + #define VER_TYPE 'S','E','W' + #define VER_PROD 'R','H','N','R',' ' + #elif (EMB_MC_TYPE == EMB_MC_NPES) + #define VER_PROD 'N','P','E','S',' ' + #elif (EMB_MC_TYPE == EMB_MC_DHP) + #define VER_PROD 'D','H','P',' ',' ' + #endif +#elif (CUR_MACHINE == MACH_SCANNER) + #define VER_TYPE 'G','O','A' + #define VER_PROD 'S','C','A','N',' ' + +#elif (CUR_MACHINE == MACH_OPTICAL) + #define VER_TYPE 'G','O','A' + #define VER_PROD 'O','P','T','I','C' + +#else + + #define VER_TYPE 'G','O','A' + #define VER_PROD 'C','O','R','E','A' + +#endif /* CUR_MACHINE */ +#endif /* CUR_CORE_BOARD */ + +//--------------------------------------------------------------- + +#ifndef EXRAM1_DATA_ADDR_BEG + #define EXRAM1_DATA_ADDR_BEG (EXRAM1_BASE_ADDR) // ļʹÿռ1 +#endif + +#ifndef MAX_DATA_EXRAM1_SIZE + #define MAX_DATA_EXRAM1_SIZE (EXRAM1_BYTE_SIZE) // ļʹÿռ1 +#endif + +#ifndef EXRAM2_DATA_ADDR_BEG + #define EXRAM2_DATA_ADDR_BEG (EXRAM2_BASE_ADDR) // ļʹÿռ2 +#endif + +#ifndef MAX_DATA_EXRAM2_SIZE + #define MAX_DATA_EXRAM2_SIZE (EXRAM2_BYTE_SIZE) // ļʹÿռ2 +#endif + +//--------------------------------------------------------------- + +void GetVersionStr(char * str); +void GetBuildStr(char * str); + +//--------------------------------------------------------------- + +// +#ifndef MC_TYPE +#define MC_TYPE 0 +#endif + +#ifndef VER_TYPE + #define VER_TYPE 'X','X','X' +#endif +#ifndef VER_PROD + #define VER_PROD 'X','X','X','X','X' +#endif + +//--------------------------------------------------------------- + +#include "main.h" + +#endif diff --git a/EMBOS/Users/EmbBase/embfpga.c b/EMBOS/Users/EmbBase/embfpga.c new file mode 100644 index 0000000..2d5f12a --- /dev/null +++ b/EMBOS/Users/EmbBase/embfpga.c @@ -0,0 +1,1416 @@ + +#define _IN_EMBFPGA_C +#include "embfpga.h" + +//---------------------------------------------------------------------------- + +#include "corefmc.h" +#include "inout.h" +#include "shell.h" + +//---------------------------------------------------------------------------- + +void TestFPGA(char * para1, char * para2); + +//---------------------------------------------------------------------------- + +// ʼFPGA +void InitEmbFpga(void) +{ + int hardver = GetFpgaHardVersion(); + printf("\r\nFPGA Hard Version = Ver %x.%x \r\n", (hardver&0xff00)>>8,(hardver&0x00ff)); + + int softver = GetFpgaSoftVersion(); + printf("\r\nFPGA Soft Version = Ver %x.%x \r\n", (softver&0xff00)>>8,(softver&0x00ff)); + + SetExoutEnOn(); // + + //AddShellCmd("FPGA", "test rw fpga", TestFPGA); + +} + +//---------------------------------------------------------------------------- +// ˿ + +// ȡӲ汾 +u16 GetFpgaHardVersion(void) +{ + static u16 hardver = 0; + if ((hardver == 0) || (hardver == 0xffff)) + {// ϵֻFPGAжһ + hardver = FmcReadReg(FPGA_HARD_VERSION); + } + return hardver; +} + +// ȡ汾 +u16 GetFpgaSoftVersion(void) +{ + static u16 softver = 0; + if ((softver == 0) || (softver == 0xffff)) + {// ϵֻFPGAжһ + softver = FmcReadReg(FPGA_SOFT_VERSION); + } + return softver; +} + +// õ״̬ +u16 GetRunStatus(void) +{ + SetVAxisConfig(VCTR_LOCK); // + return FmcReadReg(VAXIS_STATUS); +} + +// õ״̬ +u16 GetRunStatus1(void) +{ + return FmcReadReg(VAXIS_STATUS1); +} + +// õ˿жϢ +u16 GetInputIntFlags(void) +{ + return (FmcReadReg(INPUT_INT_FLAGS) & INPUT_INT_MASK); +} + +// õжϢ +u16 GetEcdIntFlags(void) +{ + return (FmcReadReg(ECD_INT_FLAGS) & ECD_INT_MASK); +} + +// ȡ1Ƶ +u32 GetVAxis1PPS(void) +{ + u32 freq; + SetVAxisConfig(VCTR_LOCK); // + freq = FmcReadReg(CUR_VAXIS1_PPS_H); // + freq <<= 16; + freq += FmcReadReg(CUR_VAXIS1_PPS_L); // + return freq; +} + +// ȡƵ +// vaxisId: VAXIS_ID1 +u32 GetVAxisPPS(u16 vaxisId) +{ + assert_param(IS_VAXIS_ID(vaxisId)); + + switch (vaxisId) + { + case VAXIS_ID1: + return GetVAxis1PPS(); + default: + return 0; + } +} + +// ȡһʱƵ +u32 GetLastVAxisFrequency(u16 vaxisId) +{ + u32 freq; + assert_param(vaxisId == VAXIS_ID1); + + if (vaxisId == VAXIS_ID1) + { + freq = FmcReadReg(VAXIS1_END_FREQUENCY_H); // + freq <<= 16; + freq += FmcReadReg(VAXIS1_END_FREQUENCY_L); // + } + else + { + freq = 0; + } + + return freq; +} + +// ȡ1ļֵ +u32 GetVAxis1Counter(void) +{ + u32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_VAXIS1_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_VAXIS1_COUNTER_L); // + return Counter; +} + +// ȡļֵ +// vaxisId: VAXIS_ID1 +u32 GetVAxisCounter(u16 vaxisId) +{ + assert_param(IS_VAXIS_ID(vaxisId)); + + switch (vaxisId) + { + case VAXIS_ID1: + return GetVAxis1Counter(); + default: + return 0; + } +} + +// ȡʵ1ֵ +s32 GetAxis1Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS1_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS1_COUNTER_L); // + return Counter; +} + +// ȡʵ2ֵ +s32 GetAxis2Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS2_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS2_COUNTER_L); // + return Counter; +} + +// ȡʵ3ֵ +s32 GetAxis3Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS3_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS3_COUNTER_L); // + return Counter; +} + +// ȡʵ4ֵ +s32 GetAxis4Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS4_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS4_COUNTER_L); // + return Counter; +} + +// ȡʵ5ֵ +s32 GetAxis5Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS5_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS5_COUNTER_L); // + return Counter; +} + +// ȡʵ6ֵ +s32 GetAxis6Counter(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_AXIS6_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_AXIS6_COUNTER_L); // + return Counter; +} + +// ȡʵֵ +// axisId: AXIS_ID1 ~ AXIS_ID6 +s32 GetAxisCounter(u16 axisId) +{ + assert_param(IS_AXIS_ID(axisId)); + + switch (axisId) + { + case AXIS_ID1: + return GetAxis1Counter(); + case AXIS_ID2: + return GetAxis2Counter(); + case AXIS_ID3: + return GetAxis3Counter(); + case AXIS_ID4: + return GetAxis4Counter(); + case AXIS_ID5: + return GetAxis5Counter(); + case AXIS_ID6: + return GetAxis6Counter(); + default: + return -1; + } +} + +// õ1ֵ +s32 GetEcd1Value(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_ECD1_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_ECD1_COUNTER_L); // + return Counter; +} + +// õ2ֵ +s32 GetEcd2Value(void) +{ + s32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_ECD2_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_ECD2_COUNTER_L); // + return Counter; +} + +// õֵ +// ecdId: ECD_SEL1 ~ ECD_SEL2 +s32 GetEcdCounter(u16 ecdId) +{ + assert_param(IS_ECD_SEL(ecdId)); + + switch (ecdId) + { + case ECD_SEL1: + return GetEcd1Value(); + case ECD_SEL2: + return GetEcd2Value(); + default: + return -1; + } +} + +// ȡOPֵ +u32 GetOPCounter(void) +{ + u32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_OP_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_OP_COUNTER_L); // + return Counter; +} + +// ȡZPֵ +u32 GetZPCounter(void) +{ + u32 Counter; + SetVAxisConfig(VCTR_LOCK); // + Counter = FmcReadReg(CUR_ZP_COUNTER_H); // + Counter <<= 16; + Counter += FmcReadReg(CUR_ZP_COUNTER_L); // + return Counter; +} + +// õʵᱨϢ +u16 GetAlarmValue(void) +{ + return (FmcReadReg(AXIS_ALM_STATUS) & AXIS_ALM_MASK); +} + +// õź״̬ +u16 GetEcdStatus(void) +{ + return (FmcReadReg(ECD_SIGNAL_STATUS) & ECD_STA_MASK); +} + +// õź״̬ +u16 GetInputStatus(void) +{ + return (FmcReadReg(INPUT_STATUS)); +} + +//---------------------------------------------------------------------------- +// д˿ +// +void SetVAxisConfig(u16 cfg) +{ + assert_param(IS_VAXIS_CMD(cfg)); + + FmcWriteReg(VAXIS_CONTROL, cfg); +} + +// : FPGAж +void CleanAllIntFlag(void) +{ + SetVAxisConfig(VCTR_INPUT_ALM_INT); // inputжϱ־ + SetVAxisConfig(VCTR_ZP1_INT); // 1:ZP1жϱ־ + SetVAxisConfig(VCTR_ZP2_INT); // 2:ZP1жϱ־ + + SetVAxisConfig(VCTR_VAXIS1_CLEAN_OV1); // 11жϱ־ + SetVAxisConfig(VCTR_VAXIS1_CLEAN_OV2); // 12жϱ־ +} + +// ˶ +int StartVAxisRun(VAxisCmdStr * pCmd) +{ + u32 addr; + + if (pCmd == NULL) + { + return -1; + } + + assert_param(IS_VAXIS_ID(pCmd->vaxisId)); + assert_param(IS_BUF_SEL(pCmd->bufSel)); + + if (pCmd->vaxisId == VAXIS_ID1) // 1 + { + if (pCmd->bufSel == BUF_SEL1) + { + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF1); + addr = VAXIS1_BUF1_PARA; + } + else if (pCmd->bufSel == BUF_SEL2) + { + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF2); + addr = VAXIS1_BUF2_PARA; + } + else if (pCmd->bufSel == BUF_SEL3) + { + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF3); + addr = VAXIS1_BUF3_PARA; + } + else + { + return -1; + } + } + else + { + return -1; + } + + if ((pCmd->vaxisId == VAXIS_ID1) || // 1 + 0 ) + { + if (pCmd->calcGap > MAX_GAP) + { +// printf("calcGap=%d > MAX_GAP\r\n", pCmd->calcGap); + pCmd->calcGap = MAX_GAP; + } + else if (pCmd->calcGap < MIN_GAP) + { +// printf("calcGap=%d < MIN_GAP\r\n", pCmd->calcGap); + pCmd->calcGap = MIN_GAP; + } + + if (pCmd->startPPS > MAX_PPS) + { + printf("startPPS=%d > MAX_PPS\r\n", pCmd->startPPS); + pCmd->startPPS = MAX_PPS; + } + else if (pCmd->startPPS < MIN_PPS) + { + printf("startPPS=%d < MIN_PPS\r\n", pCmd->startPPS); + pCmd->startPPS = MIN_PPS; + return -1; // ޸ķֹ˶̫Ϊ + } + + if (pCmd->runPPS > MAX_PPS) + { + printf("runPPS=%d > MAX_PPS\r\n", pCmd->runPPS); + pCmd->runPPS = MAX_PPS; + } + else if (pCmd->runPPS < MIN_PPS) + { + printf("runPPS=%d < MIN_PPS\r\n", pCmd->runPPS); + pCmd->runPPS = MIN_PPS; + return -1; // ޸ķֹ˶̫Ϊ + } + + FmcWriteReg(addr, LOWORD(pCmd->calcGap)); + FmcWriteReg(addr, HIWORD(pCmd->calcGap)); // ʱ1/72 us Ϊλ + FmcWriteReg(addr, LOWORD(pCmd->startPPS)); + FmcWriteReg(addr, HIWORD(pCmd->startPPS)); // Ƶʣλpps + FmcWriteReg(addr, LOWORD(pCmd->runPPS)); + FmcWriteReg(addr, HIWORD(pCmd->runPPS)); // ĿƵʣλpps + + if (pCmd->bufSel != BUF_SEL3) + { + assert_param(pCmd->outNum <= MAX_OUTNUM); + assert_param(pCmd->outNum >= MIN_OUTNUM); + assert_param(pCmd->jumpNum <= MAX_OUTNUM); + + FmcWriteReg(addr, LOWORD(pCmd->outNum)); + FmcWriteReg(addr, HIWORD(pCmd->outNum)); // λ + FmcWriteReg(addr, LOWORD(pCmd->jumpNum)); + FmcWriteReg(addr, HIWORD(pCmd->jumpNum)); // + FmcWriteReg(addr, VOK_FLAG); // OK + } + else + { + FmcWriteReg(addr, VOK_FLAG); + } + + // + if (pCmd->vaxisId == VAXIS_ID1) + { +// printf("vaxis 1 run cmd\r\n"); + SetVAxisConfig(VCTR_VAXIS1_RUN); + } + else + { + } + } + else + { + return -1; + } + + return 0; +} + + +// :ֹͣǰ˶ +int StopVAxisRun(u16 vaxisId) +{ + assert_param(IS_VAXIS_ID(vaxisId)); + + //ֹͣ + if (vaxisId == VAXIS_ID1 || vaxisId == VAXIS_ID_ALL) + { + SetVAxisConfig(VCTR_VAXIS1_STOP); + SetVAxisConfig(VCTR_VAXIS1_CLEAN_OV1); + SetVAxisConfig(VCTR_VAXIS1_CLEAN_OV2); + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF1); + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF2); + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF3); + } + + return 0; +} + +// :ٶȽٶʱ +void StopSpdCtrl(u16 vaxisId) +{ + assert_param(IS_VAXIS_ID(vaxisId)); + + if (vaxisId == VAXIS_ID1 || vaxisId == VAXIS_ID_ALL) + { + SetVAxisConfig(VCTR_VAXIS1_DIS_BUF3); + } +} + +// ֵ +// ecdId: ECD_SEL1 ~ ECD_SEL2 +void ClearEcdCounter(u16 ecdId) +{ + assert_param(IS_ECD_SEL(ecdId)); + + switch (ecdId) + { + case ECD_SEL1: + SetVAxisConfig(VCTR_ECD1_CLEAR); + break; + case ECD_SEL2: + SetVAxisConfig(VCTR_ECD2_CLEAR); + break; + default: + break; + } +} + +void ReetEcdABZLevel(u16 ecdId) +{ + switch (ecdId) + { + case ECD_SEL1: + SetVAxisConfig(VCTR_ECD1_LEVEL_RST); + break; + case ECD_SEL2: + SetVAxisConfig(VCTR_ECD1_LEVEL_RST); + break; + default: + break; + } +} + +void SetEcdAPLevelNegative(u16 ecdId) +{ + switch (ecdId) + { + case ECD_SEL1: + SetVAxisConfig(VCTR_AP1_LEVEL_NEG); + break; + case ECD_SEL2: + SetVAxisConfig(VCTR_AP2_LEVEL_NEG); + break; + default: + break; + } +} + +void SetEcdAZLevelNegative(u16 ecdId) +{ + switch (ecdId) + { + case ECD_SEL1: + SetVAxisConfig(VCTR_AZ1_LEVEL_NEG); + break; + case ECD_SEL2: + SetVAxisConfig(VCTR_AZ2_LEVEL_NEG); + break; + default: + break; + } +} + +void SetEcdZPLevelNegative(u16 ecdId) +{ + switch (ecdId) + { + case ECD_SEL1: + SetVAxisConfig(VCTR_ZP1_LEVEL_NEG); + break; + case ECD_SEL2: + SetVAxisConfig(VCTR_ZP2_LEVEL_NEG); + break; + default: + break; + } +} + +// OP +void SetOpOutOn(void) +{ + SetVAxisConfig(VCTR_OPOS_ON); +} + +void SetOpOutOff(void) +{ + SetVAxisConfig(VCTR_OPOS_NONE); +} + +void SetZpOutOn(void) +{ + SetVAxisConfig(VCTR_ZPOS_ON); +} + +void SetZpOutOff(void) +{ + SetVAxisConfig(VCTR_ZPOS_NONE); +} + +// ñ +void SetAxisAlarmConfig(u16 axisId, u16 alm) +{ + assert_param(IS_AXIS_ID(axisId)); + + SetVAxisConfig(MAKE_VCTR_AXIS_ALM_CMD(axisId,alm)); +} + +//-------------------------------------------------------------------------------------------------------------- + +// OPķƵϵ +void SetOpDivision(u16 div) +{ + if (div != OP_OUT_DIRECT) + { + div &= 0xFFFE; + } + FmcWriteReg(OP_OUT_DIVISION, div); +} + +// OPֵ +void SetOpCounter(s32 cnt) +{ + FmcWriteReg(OP_COUNTER_SET_L, LOWORD(cnt)); + FmcWriteReg(OP_COUNTER_SET_H, HIWORD(cnt)); +} + +// ZPֵ +void SetZpCounter(s32 cnt) +{ + FmcWriteReg(ZP_COUNTER_SET_L, LOWORD(cnt)); + FmcWriteReg(ZP_COUNTER_SET_H, HIWORD(cnt)); +} + +void SetEcd1Counter(s32 cnt) +{ + FmcWriteReg(ECD1_COUNTER_SET_L, LOWORD(cnt)); + FmcWriteReg(ECD1_COUNTER_SET_H, HIWORD(cnt)); +} + +void SetEcd2Counter(s32 cnt) +{ + FmcWriteReg(ECD2_COUNTER_SET_L, LOWORD(cnt)); + FmcWriteReg(ECD2_COUNTER_SET_H, HIWORD(cnt)); +} + +// ñֵ +void SetEcdCounter(u16 ecdId, s32 cnt) +{ + assert_param(IS_ECD_SEL(ecdId)); + + switch(ecdId) + { + case ECD_SEL1: + { + SetEcd1Counter(cnt); + break; + } + case ECD_SEL2: + { + SetEcd2Counter(cnt); + break; + } + default: + break; + } +} + +// ˿ж +void SetInputInt(u16 cfg) +{ + FmcWriteReg(INPUT_INT_SET, cfg); +} + +#define MAX_OUTPUT_NUM 8 + +u16 g_outputValue = 0; + +void Output1On(void) +{ + g_outputValue |= OUTPUT1_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output1Off(void) +{ + g_outputValue &= (~OUTPUT1_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output2On(void) +{ + g_outputValue |= OUTPUT2_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output2Off(void) +{ + g_outputValue &= (~OUTPUT2_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output3On(void) +{ + g_outputValue |= OUTPUT3_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output3Off(void) +{ + g_outputValue &= (~OUTPUT3_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output4On(void) +{ + g_outputValue |= OUTPUT4_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output4Off(void) +{ + g_outputValue &= (~OUTPUT4_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output5On(void) +{ + g_outputValue |= OUTPUT5_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output5Off(void) +{ + g_outputValue &= (~OUTPUT5_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output6On(void) +{ + g_outputValue |= OUTPUT6_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output6Off(void) +{ + g_outputValue &= (~OUTPUT6_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output7On(void) +{ + g_outputValue |= OUTPUT7_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output7Off(void) +{ + g_outputValue &= (~OUTPUT7_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output8On(void) +{ + g_outputValue |= OUTPUT8_BIT; + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +void Output8Off(void) +{ + g_outputValue &= (~OUTPUT8_BIT); + FmcWriteReg(OUTPUT_SET, g_outputValue); +} + +// õij״̬ +u8 GetOutputVal(int num) +{ + if (num > 0 && num <= MAX_OUTPUT_NUM) + { + u16 mod = 0x01; + mod <<= (num-1); + if ((g_outputValue & mod) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } + } + + return SENSOR_OFF; +} + +//------------------------------------------------------------- + +// ʵ +void SetAxisConfig(u16 axisId, u16 cfg) +{ + assert_param(IS_AXIS_ID(axisId)); + assert_param(IS_AXIS_CMD(cfg)); + + FmcWriteReg(AXIS_CONFIG(AXIS(axisId)), cfg); +} + +u32 GetSineNums(u16 sineout, u16* pBuffer, u32 num) +{ + u32 sinenum, temp; + sinenum = 0; + + if (sineout != 0) + { + while(num != 0) + { + temp = (*pBuffer) & 0x7fff; + sinenum += temp; + + //temp = (u32)(temp * SINE_MUTI + 0.5); + temp = (u32)(temp * SINE_MUTI + 0.999f); // 20220407 ljs ˧ ޸,޸ʱ + if (temp > 0x7fff) + { + printf("sine calc error\r\n"); + sinenum += 0x100000; // ش 0xfffff Աڵúб + } + + *pBuffer &= 0x8000; + *pBuffer |= (temp & 0x7fff); + + num--; + pBuffer++; + } + } + + return sinenum; +} + +// д岹 +// ֵ: 0: +// -1 +// -2,ʹ +// -3fpga д +// -4FPGA 汾 +int WriteInterData(InterData * pCmd) +{ + u32 sineNum; + + if (pCmd == NULL) + { + printf("para is empty in WriteInterData\r\n"); + return -1; + } + + assert_param(IS_VAXIS_ID(pCmd->vaxisId)); + assert_param(IS_AXIS_ID(pCmd->axisId)); + assert_param(IS_BUF_SEL(pCmd->bufSel)); + + assert_param(pCmd->datBufLen < MAX_SEGMENT_PER_BUF); + assert_param(pCmd->datBufLen > 0); + assert_param(pCmd->startEscNum <= MAX_OUTNUM); + assert_param(pCmd->partVxNum <= MAX_OUTNUM); + assert_param(pCmd->partVxNum >= MIN_OUTNUM); + + // ѡ + switch (pCmd->vaxisId) + { + case VAXIS_ID1: + SetAxisConfig((pCmd->axisId), POUT_ENABLE_VAXIS1); // :ʱΪ1 + break; + case VAXIS_ECD: + SetAxisConfig((pCmd->axisId), POUT_ENABLE_ECD); // :Ϊӿ + break; + default: + SetAxisConfig((pCmd->axisId), POUT_DISABLE); // ֹ + break; + } + + sineNum = GetSineNums(pCmd->sineOut, pCmd->datBuff, pCmd->datBufLen); + + // ʵ + if (pCmd->bufSel == BUF_SEL1) + { +// printf("\r\nwrite buff 1\r\n"); + SetAxisConfig((pCmd->axisId), DIS_INTER_BUF1); // ձ + + // ģʽ + FmcWriteReg(AXIS_BUF1_SINE_OUT(AXIS(pCmd->axisId)), (u16)(sineNum & 0xffff)); // дݵλ + FmcWriteReg(AXIS_BUF1_SINE_OUT_H(AXIS(pCmd->axisId)), (u16)(sineNum>>16)); // дݸλ + + FmcWriteConstBuf(INTER_BUF1_DATA(AXIS(pCmd->axisId)), pCmd->datBuff, pCmd->datBufLen); // д + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->startEscNum)); // ʼʵ + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->startEscNum)); + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->partVxNum)); // ÿζӦ + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->partVxNum)); + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->dirAttr)); // ʵ + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->dirAttr)); + FmcWriteReg(INTER_BUF1_PARA(AXIS(pCmd->axisId)), VOK_FLAG); + } + else if (pCmd->bufSel == BUF_SEL2) + { +// printf("\r\nwrite buff 2\r\n"); + SetAxisConfig((pCmd->axisId), DIS_INTER_BUF2); // ձ + + // ģʽ + FmcWriteReg(AXIS_BUF2_SINE_OUT(AXIS(pCmd->axisId)), (u16)(sineNum & 0xffff)); // дݵλ + FmcWriteReg(AXIS_BUF2_SINE_OUT_H(AXIS(pCmd->axisId)), (u16)(sineNum>>16)); // дݸλ + + FmcWriteConstBuf(INTER_BUF2_DATA(AXIS(pCmd->axisId)), pCmd->datBuff, pCmd->datBufLen); // д + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->startEscNum)); // ʼ + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->startEscNum)); + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->partVxNum)); // ÿ + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->partVxNum)); + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), LOWORD(pCmd->dirAttr)); // + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), HIWORD(pCmd->dirAttr)); + FmcWriteReg(INTER_BUF2_PARA(AXIS(pCmd->axisId)), VOK_FLAG); + } + else + { + printf("bufSel = %d, error\r\n", pCmd->bufSel); + return -1; + } + + return 0; +} + +void CleanAxisBuff(u16 axisId, u16 bufSel) +{ + assert_param(IS_AXIS_ID(axisId)); + assert_param(IS_BUF_SEL(bufSel)); + + if (bufSel == BUF_SEL1) + { +// printf("clean axis %d buff 1\r\n", axisId); + SetAxisConfig(axisId, DIS_INTER_BUF1); // ձ + FmcWriteConstBuf(INTER_BUF1_DATA(AXIS(axisId)), NULL, 0); // д + } + else if (bufSel == BUF_SEL2) + { +// printf("clean axis %d buff 2\r\n", axisId); + SetAxisConfig(axisId, DIS_INTER_BUF2); // ձ + FmcWriteConstBuf(INTER_BUF2_DATA(AXIS(axisId)), NULL, 0); // д + } +} + +// ʵֵ +void SetAxisCounter(u16 axisId, s32 cnt) +{ + assert_param(IS_AXIS_ID(axisId)); + + FmcWriteReg(AXIS_COUNTER_L(AXIS(axisId)), LOWORD(cnt)); + FmcWriteReg(AXIS_COUNTER_H(AXIS(axisId)), HIWORD(cnt)); +} + +// PWMƵϵ +void SetAxisPwmFreq(u16 axisId, u16 freq) +{ + assert_param(IS_AXIS_PWM_ID(axisId)); + assert_param(IS_AXIS_PWM_FREQ(freq)); + + FmcWriteReg(AXIS_PWM_FREQ(AXIS(axisId)), freq); +} + +// PULSEPWMֵ +void SetAxisPulsePwm(u16 axisId, u16 val) +{ + if (val > FPGA_PWM_MAX_VAL) + { + val = FPGA_PWM_MAX_VAL; + } + assert_param(IS_AXIS_PWM_ID(axisId)); + assert_param(IS_AXIS_PWM_VAL(val)); + + FmcWriteReg(AXIS_PULSE_PWM(AXIS(axisId)), val); +} + +// SIGNPWMֵ +void SetAxisSignPwm(u16 axisId, u16 val) +{ + if (val > FPGA_PWM_MAX_VAL) + { + val = FPGA_PWM_MAX_VAL; + } + assert_param(IS_AXIS_PWM_ID(axisId)); + assert_param(IS_AXIS_PWM_VAL(val)); + + FmcWriteReg(AXIS_SIGN_PWM(AXIS(axisId)), val); +} + +//-------------------------------------------------------------------- + +typedef void (*InputIntProc)(void); + +InputIntProc g_inputIntProcAry[16] = {NULL}; + +void RegInputIntProc(u16 intcfg, void(*inputProc)(void)) +{ + static u16 intconfig = 0; + if (intcfg == INPUT1_INT_EN) + { + g_inputIntProcAry[0] = inputProc; + } + else if (intcfg == INPUT2_INT_EN) + { + g_inputIntProcAry[1] = inputProc; + } + else if (intcfg == INPUT3_INT_EN) + { + g_inputIntProcAry[2] = inputProc; + } + else if (intcfg == INPUT4_INT_EN) + { + g_inputIntProcAry[3] = inputProc; + } + else if (intcfg == INPUT5_INT_EN) + { + g_inputIntProcAry[4] = inputProc; + } + else if (intcfg == INPUT6_INT_EN) + { + g_inputIntProcAry[5] = inputProc; + } + else if (intcfg == INPUT7_INT_EN) + { + g_inputIntProcAry[6] = inputProc; + } + else if (intcfg == INPUT8_INT_EN) + { + g_inputIntProcAry[7] = inputProc; + } + else if (intcfg == INPUT9_INT_EN) + { + g_inputIntProcAry[8] = inputProc; + } + else if (intcfg == INPUT10_INT_EN) + { + g_inputIntProcAry[9] = inputProc; + } + else if (intcfg == INPUT11_INT_EN) + { + g_inputIntProcAry[10] = inputProc; + } + else if (intcfg == INPUT12_INT_EN) + { + g_inputIntProcAry[11] = inputProc; + } + else if (intcfg == INPUT13_INT_EN) + { + g_inputIntProcAry[12] = inputProc; + } + else if (intcfg == INPUT14_INT_EN) + { + g_inputIntProcAry[13] = inputProc; + } + else if (intcfg == INPUT15_INT_EN) + { + g_inputIntProcAry[14] = inputProc; + } + else if (intcfg == INPUT16_INT_EN) + { + g_inputIntProcAry[15] = inputProc; + } + + intconfig |= intcfg; + SetInputInt(intconfig); +} + +InputIntProc g_ecdIntProcAry[2] = {NULL}; + +void RegEcdInputProc(u16 ecdId, void(*ecdProc)(void)) +{ + assert_param(IS_ECD_SEL(ecdId)); + + if (ecdId == ECD_SEL1) + { + g_ecdIntProcAry[0] = ecdProc; + } + else if (ecdId == ECD_SEL2) + { + g_ecdIntProcAry[1] = ecdProc; + } +} + +// ⲿжӦ +void FpgaIntProc(void) +{ + u16 tmp16; + { + tmp16 = GetRunStatus(); // ״̬ + + if ((tmp16 & INPUT_ALARM_FLAG) != 0) // ź½ж + { + //printf("Get input int, GetRunStatus=0x%x, ", tmp16); + tmp16 = GetInputIntFlags(); + //printf("GetInputIntFlags=0x%x\r\n", tmp16); + + SetVAxisConfig(VCTR_INPUT_ALM_INT); // жϱ־ + + if ((tmp16 & INPUT01_INT_FLAG) != 0) + { + if (g_inputIntProcAry[0] != NULL) + { + g_inputIntProcAry[0](); + } + } + if ((tmp16 & INPUT02_INT_FLAG) != 0) + { + if (g_inputIntProcAry[1] != NULL) + { + g_inputIntProcAry[1](); + } + } + if ((tmp16 & INPUT03_INT_FLAG) != 0) + { + if (g_inputIntProcAry[2] != NULL) + { + g_inputIntProcAry[2](); + } + } + if ((tmp16 & INPUT04_INT_FLAG) != 0) + { + if (g_inputIntProcAry[3] != NULL) + { + g_inputIntProcAry[3](); + } + } + if ((tmp16 & INPUT05_INT_FLAG) != 0) + { + if (g_inputIntProcAry[4] != NULL) + { + g_inputIntProcAry[4](); + } + } + if ((tmp16 & INPUT06_INT_FLAG) != 0) + { + if (g_inputIntProcAry[5] != NULL) + { + g_inputIntProcAry[5](); + } + } + if ((tmp16 & INPUT07_INT_FLAG) != 0) + { + if (g_inputIntProcAry[6] != NULL) + { + g_inputIntProcAry[6](); + } + } + if ((tmp16 & INPUT08_INT_FLAG) != 0) + { + if (g_inputIntProcAry[7] != NULL) + { + g_inputIntProcAry[7](); + } + } + if ((tmp16 & INPUT09_INT_FLAG) != 0) + { + if (g_inputIntProcAry[8] != NULL) + { + g_inputIntProcAry[8](); + } + } + if ((tmp16 & INPUT10_INT_FLAG) != 0) + { + if (g_inputIntProcAry[9] != NULL) + { + g_inputIntProcAry[9](); + } + } + if ((tmp16 & INPUT11_INT_FLAG) != 0) + { + if (g_inputIntProcAry[10] != NULL) + { + g_inputIntProcAry[10](); + } + } + if ((tmp16 & INPUT12_INT_FLAG) != 0) + { + if (g_inputIntProcAry[11] != NULL) + { + g_inputIntProcAry[11](); + } + } + if ((tmp16 & INPUT13_INT_FLAG) != 0) + { + if (g_inputIntProcAry[12] != NULL) + { + g_inputIntProcAry[12](); + } + } + if ((tmp16 & INPUT14_INT_FLAG) != 0) + { + if (g_inputIntProcAry[13] != NULL) + { + g_inputIntProcAry[13](); + } + } + if ((tmp16 & INPUT15_INT_FLAG) != 0) + { + if (g_inputIntProcAry[14] != NULL) + { + g_inputIntProcAry[14](); + } + } + if ((tmp16 & INPUT16_INT_FLAG) != 0) + { + if (g_inputIntProcAry[15] != NULL) + { + g_inputIntProcAry[15](); + } + } + } + + if ((tmp16 & ENCODER_ALARM_FLAG) != 0) // ZPźж + { + //printf("Get zp int, GetRunStatus=0x%x, ", tmp16); + tmp16 = GetEcdIntFlags(); + //printf("GetInputIntFlags=0x%x\r\n", tmp16); + + if ((tmp16 & ECD1ZP_INT_FLAG) != 0) + { + SetVAxisConfig(VCTR_ZP1_INT); // 1 ZP жϱ־ + + if (g_ecdIntProcAry[0] != NULL) + { + g_ecdIntProcAry[0](); + } + } + + if ((tmp16 & ECD2ZP_INT_FLAG) != 0) + { + SetVAxisConfig(VCTR_ZP2_INT); // 2 ZP жϱ־ + + if (g_ecdIntProcAry[1] != NULL) + { + g_ecdIntProcAry[1](); + } + } + } + } +} + +//-------------------------------------------------------------------- +u16 g_exOutBuf[EXIO_PORT_NUM] = {0xffff}; + +void SetExoutEnOn(void) +{ + SetVAxisConfig(EXOUT_EN_ON); +} +void SetExoutEnOff(void) +{ + SetVAxisConfig(EXOUT_EN_OFF); +} + +// ֵ +void SetExOutValue(u16 addr, u8 value) +{ + if (addr == 0 || addr > MAX_EXIO_ADDR) + { + return; + } + + if (value == Bit_SET) + { + g_exOutBuf[(addr-1)/EXIO_PER_PORT] |= EXIO_ADDR_MOD(addr-1); + } + else + { + g_exOutBuf[(addr-1)/EXIO_PER_PORT] &= ~(EXIO_ADDR_MOD(addr-1)); + } +} + +u8 GetExOutValue(u16 addr) +{ + if (addr == 0 || addr > MAX_EXIO_ADDR) + { + return 0xff; + } + + if ((g_exOutBuf[(addr-1)/EXIO_PER_PORT] & EXIO_ADDR_MOD(addr-1)) != 0) + { + return Bit_SET; + } + return Bit_RESET; +} + +void FlushExOutputs(void) +{ + u16 addr; + for (addr = 0; addr < MAX_EXIO_ADDR; addr += EXIO_PER_PORT) + { + FmcWriteReg(EXIO_PORT_ADDR(addr), g_exOutBuf[(addr)/EXIO_PER_PORT]); + } +} + + +// ֵ +void SetExOutput(u16 addr, u8 value) +{ + SetExOutValue(addr, value); + +#if (0) + // ֻˢ˿ + FsmcWriteReg(EXIO_PORT_ADDR(addr-1), g_exOutBuf[(addr-1)/EXIO_PER_PORT]); +#else + // ˢ˿ + FlushExOutputs(); +#endif +} + +// ȡֵ +u8 GetExInput(u16 addr) +{ + if (addr == 0 || addr > MAX_EXIO_ADDR) + { + return Bit_SET; + } + + return (((FmcReadReg(EXIO_PORT_ADDR(addr-1)) & EXIO_ADDR_MOD(addr-1)) != 0) ? Bit_SET : Bit_RESET); +} + +void GetExInputs(u16 * pBuf) +{ + int i; + + if (pBuf == NULL) + { + return; + } + + for (i = 0; i < EXIO_PORT_NUM; i++) + { + pBuf[i] = FmcReadReg(EXIO_PORT_ADDR(i*EXIO_PER_PORT)); + } +} + +void TestFPGA(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + + if (p1 == p2) + { + } + + if (p1 == -1) + { + u16 val = FmcReadReg(VAXIS+p2); + printf("read addr 0x%x, val=0x%x\r\n", p2, val); + } + else if (p1 >= 0) + { + FmcWriteReg(VAXIS+p1, p2); + printf("write addr 0x%x, val=0x%x\r\n", p1, p2); + } + else if (p1 == -2) + { + int hardver = GetFpgaHardVersion(); + printf("\r\nFPGA Hard Version = Ver %x.%x \r\n", (hardver&0xff00)>>8,(hardver&0x00ff)); + + int softver = GetFpgaSoftVersion(); + printf("\r\nFPGA Soft Version = Ver %x.%x \r\n", (softver&0xff00)>>8,(softver&0x00ff)); + } + else if (p1 == -3) + { + printf("op counter=%d\r\n", GetOPCounter()); + } + else if (p1 == -4) + { + printf("zp counter=%d\r\n", GetZPCounter()); + } + else if (p1 == -5) + { + if (p2 == 1) + { + ClearEcdCounter(ECD_SEL1); + printf("ClearEcd1Counter\r\n"); + } + else if (p2 == 2) + { + ClearEcdCounter(ECD_SEL2); + printf("ClearEcd2Counter\r\n"); + } + } + else if (p1 == -6) + { + SetOpCounter(p2); + printf("SetOpCounter %d\r\n", p2); + } + else if (p1 == -7) + { + SetZpCounter(p2); + printf("SetZpCounter %d\r\n", p2); + } + else if (p1 == -8) + { + SetEcdCounter(ECD_SEL1, p2); + printf("SetEcd1Counter %d\r\n", p2); + } + else if (p1 == -9) + { + SetEcdCounter(ECD_SEL2, p2); + printf("SetEcd2Counter %d\r\n", p2); + } +} + + diff --git a/EMBOS/Users/EmbBase/embfpga.h b/EMBOS/Users/EmbBase/embfpga.h new file mode 100644 index 0000000..9982114 --- /dev/null +++ b/EMBOS/Users/EmbBase/embfpga.h @@ -0,0 +1,1016 @@ + +#ifndef __EMBFPGA_H__ +#define __EMBFPGA_H__ + +#include "config.h" + +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ + +// FPGA +// Կ6·ź +// ÿ·źŰ2·ٲźţ3źź1ź +// FPGA16·ͨźţΪ½ⲿж +// FPGA8·ź,ΪPWM +// FPGAһ·λźţλźſ12·ʵ壬·4źŻѡ1,Ҳֱӿ + + +//------------------------------------------------------------------------------------------------ + +#define FPGA_VER_101 0x0101 // FPGA汾v1.0.1 + +#define FPGA_VER_ERR 0xFFFF // FPGAߴ +//------------------------------------------------------------------------------------------------ + +#define FPGA_CLK 72000000L + +//------------------------------------------------------------------------------------------------ + +#define VAXIS (CORE_FPGA_ADDR_BEG+0x0000) // +#define AXIS(i) (CORE_FPGA_ADDR_BEG+((i)<<7)) // ʵ + +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ + +// ΪλĬ״̬ + +// +// д˿ڵַ + +//--------------------------------------------------------------- +// ƶ˿ +#define VAXIS_CONTROL (VAXIS+0x00) + // ƶ˿дʵӦĹܣ£ + #define VCTR_LOCK 0x0000 // ǰƵ/ + + #define VCTR_INPUT_ALM_INT 0x0001 // Inputӿ½жϱ־ + + #define VCTR_AXIS_ALM_INT 0x0002 // ־ + + #define VCTR_ZP1_INT 0x0003 // 1:ZP1жϱ־ + #define VCTR_ZP2_INT 0x0004 // 2:ZP2жϱ־ + + #define EXOUT_EN_ON 0x0010 // ⲿʹ:(չIO) + #define EXOUT_EN_OFF 0x0011 // ⲿʹ:ء + + #define VCTR_VAXIS1_STOP 0x0100 // 1:ֹͣ + #define VCTR_VAXIS1_RUN 0x0101 // 1: + #define VCTR_VAXIS1_DIS_BUF1 0x0110 // 1:˶1ʧЧ + #define VCTR_VAXIS1_DIS_BUF2 0x0111 // 1:˶2ʧЧ + #define VCTR_VAXIS1_DIS_BUF3 0x0112 // 1:˶3ʧЧ + #define VCTR_VAXIS1_CLEAN_OV1 0x0120 // 1:1ɱ־ + #define VCTR_VAXIS1_CLEAN_OV2 0x0121 // 1:2ɱ־ + + #define VCTR_VAXIS1_DIS_OV1INT 0x0130 // 1:жϹرա + #define VCTR_VAXIS1_EN_OV1INT 0x0131 // 1:жϴ(δʹ) + + #define VCTR_ECD1_CLEAR 0x0200 // 1: + #define VCTR_ZP1_DIS_INT 0x0210 // 1:رZP1жϡ + #define VCTR_ZP1_EN_INT 0x0211 // 1:ZP1ж + #define VCTR_ECD1_LEVEL_RST 0x0220 // 1:ABZPƽźŸλ + #define VCTR_AP1_LEVEL_NEG 0x0221 // 1:APƽźȡ + #define VCTR_AZ1_LEVEL_NEG 0x0222 // 1:APZPƽźȡ + #define VCTR_ZP1_LEVEL_NEG 0x0223 // 1:ZPƽźȡ + #define VCTR_ZP1_FM_ECDZP 0x0230 // 1:ZPжͨѡ:ZP1 + #define VCTR_ZP1_FM_NONE 0x023F // 1:ZPжͨѡ: ZP() + + #define VCTR_ZP1_FM_INPUT1 0x0240 // 1:ZPжͨѡ:INPUT1 + #define VCTR_ZP1_FM_INPUT2 0x0241 // 1:ZPжͨѡ:INPUT2 + #define VCTR_ZP1_FM_INPUT3 0x0242 // 1:ZPжͨѡ:INPUT3 + #define VCTR_ZP1_FM_INPUT4 0x0243 // 1:ZPжͨѡ:INPUT4 + #define VCTR_ZP1_FM_INPUT5 0x0244 // 1:ZPжͨѡ:INPUT5 + #define VCTR_ZP1_FM_INPUT6 0x0245 // 1:ZPжͨѡ:INPUT6 + #define VCTR_ZP1_FM_INPUT7 0x0246 // 1:ZPжͨѡ:INPUT7 + #define VCTR_ZP1_FM_INPUT8 0x0247 // 1:ZPжͨѡ:INPUT8 + #define VCTR_ZP1_FM_INPUT9 0x0248 // 1:ZPжͨѡ:INPUT9 + #define VCTR_ZP1_FM_INPUT10 0x0249 // 1:ZPжͨѡ:INPUT10 + #define VCTR_ZP1_FM_INPUT11 0x024A // 1:ZPжͨѡ:INPUT11 + #define VCTR_ZP1_FM_INPUT12 0x024B // 1:ZPжͨѡ:INPUT12 + #define VCTR_ZP1_FM_INPUT13 0x024C // 1:ZPжͨѡ:INPUT13 + #define VCTR_ZP1_FM_INPUT14 0x024D // 1:ZPжͨѡ:INPUT14 + #define VCTR_ZP1_FM_INPUT15 0x024E // 1:ZPжͨѡ:INPUT15 + #define VCTR_ZP1_FM_INPUT16 0x024F // 1:ZPжͨѡ:INPUT16 + + #define VCTR_ECD2_CLEAR 0x0300 // 2: + #define VCTR_ZP2_DIS_INT 0x0310 // 2:رZP2жϡ + #define VCTR_ZP2_EN_INT 0x0311 // 2:ZP2ж + #define VCTR_ECD2_LEVEL_RST 0x0320 // 2:ABZPƽźŸλ + #define VCTR_AP2_LEVEL_NEG 0x0321 // 2:APƽźȡ + #define VCTR_AZ2_LEVEL_NEG 0x0322 // 2:APZPƽźȡ + #define VCTR_ZP2_LEVEL_NEG 0x0323 // 2:ZPƽźȡ + #define VCTR_ZP2_FM_ECDZP 0x0330 // 2:ZPжͨѡ:ZP2 + #define VCTR_ZP2_FM_NONE 0x033F // 2:ZPжͨѡ: ZP() + + #define VCTR_ZP2_FM_INPUT1 0x0340 // 2:ZPжͨѡ:INPUT1 + #define VCTR_ZP2_FM_INPUT2 0x0341 // 2:ZPжͨѡ:INPUT2 + #define VCTR_ZP2_FM_INPUT3 0x0342 // 2:ZPжͨѡ:INPUT3 + #define VCTR_ZP2_FM_INPUT4 0x0343 // 2:ZPжͨѡ:INPUT4 + #define VCTR_ZP2_FM_INPUT5 0x0344 // 2:ZPжͨѡ:INPUT5 + #define VCTR_ZP2_FM_INPUT6 0x0345 // 2:ZPжͨѡ:INPUT6 + #define VCTR_ZP2_FM_INPUT7 0x0346 // 2:ZPжͨѡ:INPUT7 + #define VCTR_ZP2_FM_INPUT8 0x0347 // 2:ZPжͨѡ:INPUT8 + #define VCTR_ZP2_FM_INPUT9 0x0348 // 2:ZPжͨѡ:INPUT9 + #define VCTR_ZP2_FM_INPUT10 0x0349 // 2:ZPжͨѡ:INPUT10 + #define VCTR_ZP2_FM_INPUT11 0x034A // 2:ZPжͨѡ:INPUT11 + #define VCTR_ZP2_FM_INPUT12 0x034B // 2:ZPжͨѡ:INPUT12 + #define VCTR_ZP2_FM_INPUT13 0x034C // 2:ZPжͨѡ:INPUT13 + #define VCTR_ZP2_FM_INPUT14 0x034D // 2:ZPжͨѡ:INPUT14 + #define VCTR_ZP2_FM_INPUT15 0x034E // 2:ZPжͨѡ:INPUT15 + #define VCTR_ZP2_FM_INPUT16 0x034F // 2:ZPжͨѡ:INPUT16 + + #define VCTR_OPOS_NONE 0x0400 // OP:ء + #define VCTR_OPOS_ON 0x0401 // OP: + + #define VCTR_OPOS_VAXIS1 0x0402 // OP:1 + + #define VCTR_OPOS_AXIS1_P 0x0411 // OP:ʵ1 pulseź + #define VCTR_OPOS_AXIS1_S 0x0412 // OP:ʵ1 signź + #define VCTR_OPOS_AXIS2_P 0x0421 // OP:ʵ2 pulseź + #define VCTR_OPOS_AXIS2_S 0x0422 // OP:ʵ2 signź + #define VCTR_OPOS_AXIS3_P 0x0431 // OP:ʵ3 pulseź + #define VCTR_OPOS_AXIS3_S 0x0432 // OP:ʵ3 signź + #define VCTR_OPOS_AXIS4_P 0x0441 // OP:ʵ4 pulseź + #define VCTR_OPOS_AXIS4_S 0x0442 // OP:ʵ4 signź + #define VCTR_OPOS_AXIS5_P 0x0451 // OP:ʵ5 pulseź + #define VCTR_OPOS_AXIS5_S 0x0452 // OP:ʵ5 signź + #define VCTR_OPOS_AXIS6_P 0x0461 // OP:ʵ6 pulseź + #define VCTR_OPOS_AXIS6_S 0x0462 // OP:ʵ6 signź + #define VCTR_OPOS_AP1 0x0471 // OP:AP1 + #define VCTR_OPOS_BP1 0x0472 // OP:BP1 + #define VCTR_OPOS_ZP1 0x0473 // OP:ZP1 + #define VCTR_OPOS_AP2 0x0481 // OP:AP2 + #define VCTR_OPOS_BP2 0x0482 // OP:BP2 + #define VCTR_OPOS_ZP2 0x0483 // OP:ZP2 + + #define VCTR_ZPOS_NONE 0x0500 // ZP:ء + #define VCTR_ZPOS_ON 0x0501 // ZP: + #define VCTR_ZPOS_INPUT1 0x0510 // ZP:input1 + #define VCTR_ZPOS_INPUT2 0x0511 // ZP:input2 + #define VCTR_ZPOS_INPUT3 0x0512 // ZP:input3 + #define VCTR_ZPOS_INPUT4 0x0513 // ZP:input4 + #define VCTR_ZPOS_INPUT5 0x0514 // ZP:input5 + #define VCTR_ZPOS_INPUT6 0x0515 // ZP:input6 + #define VCTR_ZPOS_INPUT7 0x0516 // ZP:input7 + #define VCTR_ZPOS_INPUT8 0x0517 // ZP:input8 + #define VCTR_ZPOS_INPUT9 0x0518 // ZP:input9 + #define VCTR_ZPOS_INPUT10 0x0519 // ZP:input10 + #define VCTR_ZPOS_INPUT11 0x051A // ZP:input11 + #define VCTR_ZPOS_INPUT12 0x051B // ZP:input12 + #define VCTR_ZPOS_INPUT13 0x051C // ZP:input13 + #define VCTR_ZPOS_INPUT14 0x051D // ZP:input14 + #define VCTR_ZPOS_INPUT15 0x051E // ZP:input15 + #define VCTR_ZPOS_INPUT16 0x051F // ZP:input16 + #define VCTR_ZPOS_ECD1 0x0520 // ZP:1 + #define VCTR_ZPOS_ECD2 0x0521 // ZP:2 + + #define VCTR_AXIS1_ALM_STOP_DIS 0x0610 // ʵ1ͣ + #define VCTR_AXIS1_ALM_STOP_EN 0x0611 // ʵ1ͣ + #define VCTR_AXIS1_ALM_LEV_LOW 0x0612 // ʵ1ƽΪ͡ + #define VCTR_AXIS1_ALM_LEV_HIGH 0x0613 // ʵ1ƽΪ + #define VCTR_AXIS2_ALM_STOP_DIS 0x0620 // ʵ2ͣ + #define VCTR_AXIS2_ALM_STOP_EN 0x0621 // ʵ2ͣ + #define VCTR_AXIS2_ALM_LEV_LOW 0x0622 // ʵ2ƽΪ͡ + #define VCTR_AXIS2_ALM_LEV_HIGH 0x0623 // ʵ2ƽΪ + #define VCTR_AXIS3_ALM_STOP_DIS 0x0630 // ʵ3ͣ + #define VCTR_AXIS3_ALM_STOP_EN 0x0631 // ʵ3ͣ + #define VCTR_AXIS3_ALM_LEV_LOW 0x0632 // ʵ3ƽΪ͡ + #define VCTR_AXIS3_ALM_LEV_HIGH 0x0633 // ʵ3ƽΪ + #define VCTR_AXIS4_ALM_STOP_DIS 0x0640 // ʵ4ͣ + #define VCTR_AXIS4_ALM_STOP_EN 0x0641 // ʵ4ͣ + #define VCTR_AXIS4_ALM_LEV_LOW 0x0642 // ʵ4ƽΪ͡ + #define VCTR_AXIS4_ALM_LEV_HIGH 0x0643 // ʵ4ƽΪ + #define VCTR_AXIS5_ALM_STOP_DIS 0x0650 // ʵ5ͣ + #define VCTR_AXIS5_ALM_STOP_EN 0x0651 // ʵ5ͣ + #define VCTR_AXIS5_ALM_LEV_LOW 0x0652 // ʵ5ƽΪ͡ + #define VCTR_AXIS5_ALM_LEV_HIGH 0x0653 // ʵ5ƽΪ + #define VCTR_AXIS6_ALM_STOP_DIS 0x0660 // ʵ6ͣ + #define VCTR_AXIS6_ALM_STOP_EN 0x0661 // ʵ6ͣ + #define VCTR_AXIS6_ALM_LEV_LOW 0x0662 // ʵ6ƽΪ͡ + #define VCTR_AXIS6_ALM_LEV_HIGH 0x0663 // ʵ6ƽΪ + + #define ALM_CONFIG_BASE 0x0600 + #define ALM_STOP_DIS 0x0000 + #define ALM_STOP_EN 0x0001 + #define ALM_LEV_LOW 0x0002 + #define ALM_LEV_HIGH 0x0003 + + #define MAKE_VCTR_AXIS_ALM_CMD(id, alm) (ALM_CONFIG_BASE|((id<<4)&0xF0)|((alm)&0x0F)) + +#define IS_VAXIS_CMD(cmd) ( ((cmd) == VCTR_LOCK ) ||\ + ((cmd) == VCTR_INPUT_ALM_INT ) ||\ + ((cmd) == VCTR_AXIS_ALM_INT ) ||\ + ((cmd) == VCTR_ZP1_INT ) ||\ + ((cmd) == VCTR_ZP2_INT ) ||\ + ((cmd) == EXOUT_EN_ON ) ||\ + ((cmd) == EXOUT_EN_OFF ) ||\ + ((cmd) == VCTR_VAXIS1_STOP ) ||\ + ((cmd) == VCTR_VAXIS1_RUN ) ||\ + ((cmd) == VCTR_VAXIS1_DIS_BUF1 ) ||\ + ((cmd) == VCTR_VAXIS1_DIS_BUF2 ) ||\ + ((cmd) == VCTR_VAXIS1_DIS_BUF3 ) ||\ + ((cmd) == VCTR_VAXIS1_CLEAN_OV1 ) ||\ + ((cmd) == VCTR_VAXIS1_CLEAN_OV2 ) ||\ + ((cmd) == VCTR_ECD1_CLEAR ) ||\ + ((cmd) == VCTR_ZP1_DIS_INT ) ||\ + ((cmd) == VCTR_ZP1_EN_INT ) ||\ + ((cmd) == VCTR_ECD1_LEVEL_RST ) ||\ + ((cmd) == VCTR_AP1_LEVEL_NEG ) ||\ + ((cmd) == VCTR_AZ1_LEVEL_NEG ) ||\ + ((cmd) == VCTR_ZP1_LEVEL_NEG ) ||\ + ((cmd) == VCTR_ZP1_FM_ECDZP ) ||\ + ((cmd) == VCTR_ZP1_FM_NONE ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT1 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT2 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT3 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT4 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT5 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT6 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT7 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT8 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT9 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT10 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT11 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT12 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT13 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT14 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT15 ) ||\ + ((cmd) == VCTR_ZP1_FM_INPUT16 ) ||\ + ((cmd) == VCTR_ECD2_CLEAR ) ||\ + ((cmd) == VCTR_ZP2_DIS_INT ) ||\ + ((cmd) == VCTR_ZP2_EN_INT ) ||\ + ((cmd) == VCTR_ECD2_LEVEL_RST ) ||\ + ((cmd) == VCTR_AP2_LEVEL_NEG ) ||\ + ((cmd) == VCTR_AZ2_LEVEL_NEG ) ||\ + ((cmd) == VCTR_ZP2_LEVEL_NEG ) ||\ + ((cmd) == VCTR_ZP2_FM_ECDZP ) ||\ + ((cmd) == VCTR_ZP2_FM_NONE ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT1 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT2 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT3 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT4 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT5 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT6 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT7 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT8 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT9 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT10 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT11 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT12 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT13 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT14 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT15 ) ||\ + ((cmd) == VCTR_ZP2_FM_INPUT16 ) ||\ + ((cmd) == VCTR_OPOS_NONE ) ||\ + ((cmd) == VCTR_OPOS_ON ) ||\ + ((cmd) == VCTR_OPOS_VAXIS1 ) ||\ + ((cmd) == VCTR_OPOS_AXIS1_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS1_S ) ||\ + ((cmd) == VCTR_OPOS_AXIS2_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS2_S ) ||\ + ((cmd) == VCTR_OPOS_AXIS3_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS3_S ) ||\ + ((cmd) == VCTR_OPOS_AXIS4_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS4_S ) ||\ + ((cmd) == VCTR_OPOS_AXIS5_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS5_S ) ||\ + ((cmd) == VCTR_OPOS_AXIS6_P ) ||\ + ((cmd) == VCTR_OPOS_AXIS6_S ) ||\ + ((cmd) == VCTR_OPOS_AP1 ) ||\ + ((cmd) == VCTR_OPOS_BP1 ) ||\ + ((cmd) == VCTR_OPOS_ZP1 ) ||\ + ((cmd) == VCTR_OPOS_AP2 ) ||\ + ((cmd) == VCTR_OPOS_BP2 ) ||\ + ((cmd) == VCTR_OPOS_ZP2 ) ||\ + ((cmd) == VCTR_ZPOS_NONE ) ||\ + ((cmd) == VCTR_ZPOS_ON ) ||\ + ((cmd) == VCTR_ZPOS_INPUT1 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT2 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT3 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT4 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT5 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT6 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT7 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT8 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT9 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT10 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT11 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT12 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT13 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT14 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT15 ) ||\ + ((cmd) == VCTR_ZPOS_INPUT16 ) ||\ + ((cmd) == VCTR_ZPOS_ECD1 ) ||\ + ((cmd) == VCTR_ZPOS_ECD2 ) ||\ + ((cmd) == VCTR_AXIS1_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS1_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS1_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS1_ALM_LEV_HIGH ) ||\ + ((cmd) == VCTR_AXIS2_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS2_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS2_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS2_ALM_LEV_HIGH ) ||\ + ((cmd) == VCTR_AXIS3_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS3_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS3_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS3_ALM_LEV_HIGH ) ||\ + ((cmd) == VCTR_AXIS4_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS4_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS4_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS4_ALM_LEV_HIGH ) ||\ + ((cmd) == VCTR_AXIS5_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS5_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS5_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS5_ALM_LEV_HIGH ) ||\ + ((cmd) == VCTR_AXIS6_ALM_STOP_DIS ) ||\ + ((cmd) == VCTR_AXIS6_ALM_STOP_EN ) ||\ + ((cmd) == VCTR_AXIS6_ALM_LEV_LOW ) ||\ + ((cmd) == VCTR_AXIS6_ALM_LEV_HIGH ) ||\ + 0) + +//--------------------------------------------------------------- +// + +#define VAXIS1_BUF1_PARA (VAXIS+0x02) // 1:1д˿ +#define VAXIS1_BUF2_PARA (VAXIS+0x04) // 1:2д˿ +#define VAXIS1_BUF3_PARA (VAXIS+0x06) // 1:3 + + + // һд˶ƶ˿дʼ塣 + // 1ִйУ򻺳2дһ˶һִɺԶлһ + + // ṹ + typedef struct + { + u16 vaxisId; // ѡ (VAXIS_ID1 ~ VAXIS_ECD) + u16 bufSel; // buf ѡ (BUF_SEL1 ~ BUF_SEL3) + + u32 calcGap; // ʱ (MIN_GAP ~ MAX_GAP) + u32 startPPS; // Ƶ (MIN_PPS ~ MAX_PPS) + u32 runPPS; // ĿƵ (MIN_PPS ~ MAX_PPS) + u32 outNum; // (MIN_OUTNUM ~ MAX_OUTNUM) + u32 jumpNum; // (0 ~ MAX_OUTNUM) + // Ч + } VAxisCmdStr; + + // ע⣺ + // 1. ƵʷΧ 1Hz ~ 4Mhz + // 2. ֵΪ޷ + // 3. СƵʱڼٶƵ + // 4.3ȼڱ1ͱ23ЧʱٶԱ3Ϊ׼ + + // ṹõĺ궨 + + // ѡ + #define VAXIS_ID1 0x0001 + + #define VAXIS_ECD 0x0004 + #define VAXIS_ID_ALL 0x0005 + + + #define IS_VAXIS_ID(VAXIS) (((VAXIS) == VAXIS_ID1) || \ + ((VAXIS) == VAXIS_ECD) || \ + ((VAXIS) == VAXIS_ID_ALL)) + + // ѡ + #define BUF_SEL1 0x0001 + #define BUF_SEL2 0x0002 + #define BUF_SEL3 0x0003 + + #define IS_BUF_SEL(BUFF) (((BUFF) == BUF_SEL1) || \ + ((BUFF) == BUF_SEL2) || \ + ((BUFF) == BUF_SEL3)) + + + #define MIN_GAP 36 + #define MAX_GAP 72000 + + #define MIN_PPS 1 + #define MAX_PPS 4000000 // 4MHz + + #define MIN_OUTNUM 1 + #define MAX_OUTNUM 67108863 // 2^26-1 + + #define VOK_FLAG 0x4F4B // OK + +#define OP_OUT_DIVISION (VAXIS+0x08) // OPƵö˿ + #define OP_OUT_DIRECT 0x0001 // ֱ + // ִֵ֧ 0x0002--0xFFFE ֮ż + +#define OP_COUNTER_SET_L (VAXIS+0x0A) // OPֵ +#define OP_COUNTER_SET_H (VAXIS+0x0C) + +#define ZP_COUNTER_SET_L (VAXIS+0x0E) // ZPֵ +#define ZP_COUNTER_SET_H (VAXIS+0x10) + +#define ECD1_COUNTER_SET_L (VAXIS+0x12) // ñ1ֵ +#define ECD1_COUNTER_SET_H (VAXIS+0x14) + +#define ECD2_COUNTER_SET_L (VAXIS+0x16) // ñ2ֵ +#define ECD2_COUNTER_SET_H (VAXIS+0x18) + +#define INPUT_INT_SET (VAXIS+0x20) // ˿½ж + + #define INPUT_ALL_FINT_DIS 0x0000 // жȫá + + #define INPUT1_INT_EN 0x0001 // 1жʹ + #define INPUT2_INT_EN 0x0002 // 2жʹ + #define INPUT3_INT_EN 0x0004 // 3жʹ + #define INPUT4_INT_EN 0x0008 // 4жʹ + #define INPUT5_INT_EN 0x0010 // 5жʹ + #define INPUT6_INT_EN 0x0020 // 6жʹ + #define INPUT7_INT_EN 0x0040 // 7жʹ + #define INPUT8_INT_EN 0x0080 // 8жʹ + #define INPUT9_INT_EN 0x0100 // 9жʹ + #define INPUT10_INT_EN 0x0200 // 10жʹ + #define INPUT11_INT_EN 0x0400 // 11жʹ + #define INPUT12_INT_EN 0x0800 // 12жʹ + #define INPUT13_INT_EN 0x1000 // 13жʹ + #define INPUT14_INT_EN 0x2000 // 14жʹ + #define INPUT15_INT_EN 0x4000 // 15жʹ + #define INPUT16_INT_EN 0x8000 // 16жʹ + +// ˿ڿ +#define OUTPUT_SET (VAXIS+0x22) + + #define OUTPUT1_BIT 0x0001 // 1 + #define OUTPUT2_BIT 0x0002 // 2 + #define OUTPUT3_BIT 0x0004 // 3 + #define OUTPUT4_BIT 0x0008 // 4 + #define OUTPUT5_BIT 0x0010 // 5 + #define OUTPUT6_BIT 0x0020 // 6 + #define OUTPUT7_BIT 0x0040 // 7 + #define OUTPUT8_BIT 0x0080 // 8 + +// ⲿIOˢƵ +#define EXIO_REFRE_FREQ (VAXIS+0x24) // ⲿIOˢƵ + + #define REF_FREQ_35K 0x0001 + #define REF_FREQ_22K 0x0002 + #define REF_FREQ_16K 0x0003 + #define REF_FREQ_14K 0x0004 + #define REF_FREQ_12K 0x0005 + #define REF_FREQ_10K 0x0006 // + #define REF_FREQ_9K 0x0007 + #define REF_FREQ_8K 0x0008 + #define REF_FREQ_7K 0x0009 + #define REF_FREQ_6K 0x000A + #define REF_FREQ_5K 0x000B + #define REF_FREQ_4K 0x000C + #define REF_FREQ_3K 0x000D + #define REF_FREQ_2K 0x000E + #define REF_FREQ_1K 0x000F + #define REF_FREQ_500 0x001F + + +// IOչ忨д +#define EXIO_PORT_BASE (VAXIS+0x60) // IOչ忨ַ +#define EXIO_PORT_ADDR(addr) (EXIO_PORT_BASE+((addr)>>4)*2) +#define EXIO_ADDR_MOD(addr) (0x0001 << ((addr)&0x0F)) + +#define MAX_EXIO_ADDR 256 +#define EXIO_PER_PORT 16 +#define EXIO_PORT_NUM (MAX_EXIO_ADDR/EXIO_PER_PORT) + +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ + +// ʵƫƵַ + +//------------------------------------------------------ + +// д˿ڵַ +// ʵö˿ +#define AXIS_CONFIG(axisAddr) (axisAddr+0x00) + + #define POUT_CWCCW 0x0000 // ˫巽ʽ + #define POUT_PLSDIR 0x0001 // +ʽ + #define POUT_NORMAL 0x0002 // źģʽ + #define POUT_XCHANGE 0x0003 // źŶԵģʽ + + #define POUT_DISABLE 0x0100 // ֹ + #define POUT_ENABLE_VAXIS1 0x0101 // :ʱΪ1 + + #define POUT_ENABLE_ECD 0x0102 // :Ϊӿ + #define POUT_ENABLE_PWM 0x0102 // :ΪPWMģʽ + #define POUT_ENABLE_BUSIO 0x0102 // :Ϊڲֱӿģʽ + + #define MAKE_POUT_CMD(vaxis) (POUT_DISABLE|((vaxis)&0x0F)) + + #define DATI_INTERPOLATION 0x0200 // Ӳֱ()岹 + #define DATI_ECD1_FLOW 0x0201 // 1涯ʽ(CW/CCWP/Sź) + #define DATI_ECD2_FLOW 0x0202 // 2涯ʽ(CW/CCWP/Sź) + #define DATI_ECD1_MAPPING 0x0203 // 1źӳ(źֱ, źŻCW/CCWP/Sź) + #define DATI_ECD2_MAPPING 0x0204 // 2źӳ(źֱ, źŻCW/CCWP/Sź) + #define DATI_PWM 0x0205 // PWMģʽ + #define DATI_BUS_IO 0x0206 // ڲֱӿģʽ + + #define MOUT_EN_LOW 0x0300 // ENź + #define MOUT_EN_HIGH 0x0301 // ENźߡ + #define MOUT_SON_LOW 0x0310 // SONź + #define MOUT_SON_HIGH 0x0311 // SONźߡ + #define MOUT_SEL_LOW 0x0320 // SELź + #define MOUT_SEL_HIGH 0x0321 // SELźߡ + + #define COUNTER_DIR_POS 0x0400 // Ϊ + #define COUNTER_DIR_NEG 0x0401 // Ϊ + + #define DIS_INTER_BUF1 0x0500 // 1ʧЧ,1,ָ + #define DIS_INTER_BUF2 0x0501 // 2ʧЧ,2,ָ + + #define MOUT_PLUS_OFF 0x0600 // ڲź:ޡ + #define MOUT_PLUS_ON 0x0601 // ڲź: + #define MOUT_SIGN_CW 0x0610 // ڲź:ת + #define MOUT_SIGN_CCW 0x0611 // ڲź:ת + +#define IS_AXIS_CMD(cmd) ( ((cmd) == POUT_CWCCW ) ||\ + ((cmd) == POUT_PLSDIR ) ||\ + ((cmd) == POUT_NORMAL ) ||\ + ((cmd) == POUT_XCHANGE ) ||\ + ((cmd) == POUT_DISABLE ) ||\ + ((cmd) == POUT_ENABLE_VAXIS1 ) ||\ + ((cmd) == POUT_ENABLE_ECD ) ||\ + ((cmd) == POUT_ENABLE_PWM ) ||\ + ((cmd) == POUT_ENABLE_BUSIO ) ||\ + ((cmd) == DATI_INTERPOLATION ) ||\ + ((cmd) == DATI_ECD1_FLOW ) ||\ + ((cmd) == DATI_ECD2_FLOW ) ||\ + ((cmd) == DATI_ECD1_MAPPING ) ||\ + ((cmd) == DATI_ECD2_MAPPING ) ||\ + ((cmd) == DATI_PWM ) ||\ + ((cmd) == DATI_BUS_IO ) ||\ + ((cmd) == MOUT_EN_LOW ) ||\ + ((cmd) == MOUT_EN_HIGH ) ||\ + ((cmd) == MOUT_SON_LOW ) ||\ + ((cmd) == MOUT_SON_HIGH ) ||\ + ((cmd) == MOUT_SEL_LOW ) ||\ + ((cmd) == MOUT_SEL_HIGH ) ||\ + ((cmd) == COUNTER_DIR_POS ) ||\ + ((cmd) == COUNTER_DIR_NEG ) ||\ + ((cmd) == DIS_INTER_BUF1 ) ||\ + ((cmd) == DIS_INTER_BUF2 ) ||\ + ((cmd) == MOUT_PLUS_OFF ) ||\ + ((cmd) == MOUT_PLUS_ON ) ||\ + ((cmd) == MOUT_SIGN_CW ) ||\ + ((cmd) == MOUT_SIGN_CCW ) ||\ + 0 ) +// 岹1 +#define INTER_BUF1_PARA(axisAddr) (axisAddr+0x02) + +// 岹2 +#define INTER_BUF2_PARA(axisAddr) (axisAddr+0x04) + +// 岹ݻ1 +#define INTER_BUF1_DATA(axisAddr) (axisAddr+0x06) + +// 岹ݻ2 +#define INTER_BUF2_DATA(axisAddr) (axisAddr+0x08) + + #define MAX_SEGMENT_PER_BUF 16 // ÿ + + #define MAX_PULSE_PER_SEGMENT 32767 // ÿ + + + // + // 0x00000000(Ĭֵ): һֱת + // R.31 R.30 00(|)01(|)10(|)11(|) + // R.25--R.0: 仯λͼַλַ + // Ϊ0xffffffff ʱ,ֶڷʶִ + #define DIR_POSPOS 0x00000000 + #define DIR_POSNEG 0x40000000 + #define DIR_NEGPOS 0x80000000 + #define DIR_NEGNEG 0xC0000000 + #define AXIS_DIR_CHG_VAL(n) ((n)&0x3FFFFFFF) + #define AXIS_DIR_USEBUF 0xFFFFFFFF // ʹÿڷ־ + + // ÿη& + // R.15 0()1() + // R.14--R.0: 0--32767 + #define DATA_DIR_POS 0x0000 + #define DATA_DIR_NEG 0x8000 + #define DATA_DIR_CHG_VAL(n) ((n)&0x7FFF) + + typedef struct + { + u16 axisId; // ʵѡ (AXIS_ID1 ~ AXIS_ID6) + u16 vaxisId; // ѡ (VAXIS_ID1 ~ VAXIS_ECD) + u16 bufSel; // ѡ (BUF_SEL1 ~ BUF_SEL3) + u32 startEscNum; // ʼ (0 ~ MAX_OUTNUM) + u32 partVxNum; // ÿζӦ (MIN_OUTNUM ~ MAX_OUTNUM) + u32 dirAttr; // ʵͷ仯 + u16 datBufLen; // Чݸ (1 ~ MAX_PULSE_PER_SEGMENT) + u16 datBuff[MAX_SEGMENT_PER_BUF]; // (15.ִз; .14~0) + u16 sineOut; // ־. 0, , 1, + } InterData; + +#define SINE_MUTI (1.42f) // 任ϵ + + // ʵѡ + #define AXIS_ID1 0x0001 + #define AXIS_ID2 0x0002 + #define AXIS_ID3 0x0003 + #define AXIS_ID4 0x0004 + #define AXIS_ID5 0x0005 + #define AXIS_ID6 0x0006 + + #define IS_AXIS_ID(AXIS) (((AXIS) == AXIS_ID1) || \ + ((AXIS) == AXIS_ID2) || \ + ((AXIS) == AXIS_ID3) || \ + ((AXIS) == AXIS_ID4) || \ + ((AXIS) == AXIS_ID5) || \ + ((AXIS) == AXIS_ID6)) + +// ü(L) +#define AXIS_COUNTER_L(axisAddr) (axisAddr+0x0A) +// ü(H) +#define AXIS_COUNTER_H(axisAddr) (axisAddr+0x0C) + + +#define FPGA_PWM_MAX_VAL (0x3FF) + + + #define IS_AXIS_PWM_ID(AXIS) (((AXIS) == AXIS_ID3) || \ + ((AXIS) == AXIS_ID4)) + + #define IS_AXIS_PWM_FREQ(FREQ) (((FREQ) >= 0x01) && \ + ((FREQ) <= 0xFF)) + + #define IS_AXIS_PWM_VAL(VAL) (((VAL) >= 0x0000)&& \ + ((VAL) <= 0x03FF)) + +#define AXIS_PWM_FREQ(axisAddr) (axisAddr+0x0E) // PWMƵϵ62.5KƵ(0x01~0xFF) +#define AXIS_PULSE_PWM(axisAddr) (axisAddr+0x10) // pulse PWM ֵ 10bit(0~0x3FF) +#define AXIS_SIGN_PWM(axisAddr) (axisAddr+0x12) // sign PWM ֵ 10bit(0~0x3FF) + + +/* ģʽ +0,Ϊ0ʱʾ˹ܲ +1,ʹøģʽ,ֱ߲岹 +2,ʵֱ߲岹費С ֵ x 2 +*/ + + #define IS_AXIS_SINE_ID(AXIS) (((AXIS) == AXIS_ID1) || \ + ((AXIS) == AXIS_ID2) || \ + ((AXIS) == AXIS_ID3) || \ + ((AXIS) == AXIS_ID4) || \ + ((AXIS) == AXIS_ID5) || \ + ((AXIS) == AXIS_ID6)) + +#define AXIS_BUF1_SINE_OUT(axisAddr) (axisAddr+0x14) // BUF1 +#define AXIS_BUF2_SINE_OUT(axisAddr) (axisAddr+0x16) // BUF2 + +#define AXIS_BUF1_SINE_OUT_H(axisAddr) (axisAddr+0x1A) +#define AXIS_BUF2_SINE_OUT_H(axisAddr) (axisAddr+0x1C) + + +// ѡ +#define ECD_SEL1 0x0001 +#define ECD_SEL2 0x0002 + +#define IS_ECD_SEL(ECD) (((ECD) == ECD_SEL1) || \ + ((ECD) == ECD_SEL2)) + + + + + +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ + +// ˿ڵַ +// FPGAӲ汾(Ϊ8λ,8λ汾) +#define FPGA_HARD_VERSION (VAXIS+0x00) + + #define FPGA_PLOTTER_VER 0x01 // īͼ + #define FPGA_EMB_VER 0x02 // 廨/߻ + +// FPGA汾(Ϊ8λ,8λ) +#define FPGA_SOFT_VERSION (VAXIS+0x02) + +// ״̬˿ +// ״̬˿жȡݣͨλжӦ״̬״̬λ .15 .14 .13 .12 .11 .10 .7 .6 .3 .2 Ϊ1ʱжϣҪ +// *жԴ +#define VAXIS_STATUS (VAXIS+0x04) + #define VAXIS1_BUF1_RUNNING 0x0001 // 11ִб־ + #define VAXIS1_BUF2_RUNNING 0x0002 // 12ִб־ + #define VAXIS1_BUF1_FINISH 0x0004 // 11ɱ־* + #define VAXIS1_BUF2_FINISH 0x0008 // 12ɱ־* + + #define AXIS_ALARM_FLAG 0x2000 // ʵͣ־* (AXIS_ALM_STATUS) + #define ENCODER_ALARM_FLAG 0x4000 // жϱ־* (ECD_INT_FLAGS) + #define INPUT_ALARM_FLAG 0x8000 // Input½жϱ־* (INPUT_INT_FLAGS) + +// ״̬ +#define VAXIS_STATUS1 (VAXIS+0x0006) + + #define VAXIS1_BUF1_ENABLE 0x0001 // 11Ч־ + #define VAXIS1_BUF2_ENABLE 0x0002 // 12Ч־ + #define VAXIS1_BUF3_ENABLE 0x0004 // 13Ч־ + +// жϱ־ +#define ECD_INT_FLAGS (VAXIS+0x0008) + #define ECD1ZP_INT_FLAG 0x0001 // 1 ZPж + #define ECD2ZP_INT_FLAG 0x0002 // 2 ZPж + + #define ECD_INT_MASK 0x0003 + +// źжϱ־ +#define INPUT_INT_FLAGS (VAXIS+0x0A) + #define INPUT01_INT_FLAG 0x0001 // 1½ж + #define INPUT02_INT_FLAG 0x0002 // 2½ж + #define INPUT03_INT_FLAG 0x0004 // 3½ж + #define INPUT04_INT_FLAG 0x0008 // 4½ж + #define INPUT05_INT_FLAG 0x0010 // 5½ж + #define INPUT06_INT_FLAG 0x0020 // 6½ж + #define INPUT07_INT_FLAG 0x0040 // 7½ж + #define INPUT08_INT_FLAG 0x0080 // 8½ж + #define INPUT09_INT_FLAG 0x0100 // 9½ж + #define INPUT10_INT_FLAG 0x0200 // 10½ж + #define INPUT11_INT_FLAG 0x0400 // 11½ж + #define INPUT12_INT_FLAG 0x0800 // 12½ж + #define INPUT13_INT_FLAG 0x1000 // 13½ж + #define INPUT14_INT_FLAG 0x2000 // 14½ж + #define INPUT15_INT_FLAG 0x4000 // 15½ж + #define INPUT16_INT_FLAG 0x8000 // 16½ж + + #define INPUT_INT_MASK 0xFFFF + +// 1ǰƵʣλPPSȡ (04M) +#define CUR_VAXIS1_PPS_L (VAXIS+0x0C) +#define CUR_VAXIS1_PPS_H (VAXIS+0x0E) + +// һʱƵ +#define VAXIS1_END_FREQUENCY_L (VAXIS+0x10) +#define VAXIS1_END_FREQUENCY_H (VAXIS+0x12) + +// 1ǰλ:ȡ (0 2^26-1) +#define CUR_VAXIS1_COUNTER_L (VAXIS+0x14) +#define CUR_VAXIS1_COUNTER_H (VAXIS+0x16) + +// ʵ1ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS1_COUNTER_L (VAXIS+0x20) +#define CUR_AXIS1_COUNTER_H (VAXIS+0x22) + +// ʵ2ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS2_COUNTER_L (VAXIS+0x24) +#define CUR_AXIS2_COUNTER_H (VAXIS+0x26) + +// ʵ3ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS3_COUNTER_L (VAXIS+0x28) +#define CUR_AXIS3_COUNTER_H (VAXIS+0x2A) + +// ʵ4ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS4_COUNTER_L (VAXIS+0x2C) +#define CUR_AXIS4_COUNTER_H (VAXIS+0x2E) + +// ʵ5ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS5_COUNTER_L (VAXIS+0x30) +#define CUR_AXIS5_COUNTER_H (VAXIS+0x32) + +// ʵ6ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_AXIS6_COUNTER_L (VAXIS+0x34) +#define CUR_AXIS6_COUNTER_H (VAXIS+0x36) + +// 1ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_ECD1_COUNTER_L (VAXIS+0x40) +#define CUR_ECD1_COUNTER_H (VAXIS+0x42) + +// 2ֵзλ:ȡ (-2^31-1 2^31-1) +#define CUR_ECD2_COUNTER_L (VAXIS+0x44) +#define CUR_ECD2_COUNTER_H (VAXIS+0x46) + +// OPֵλ:ȡ (0 2^32-1) +#define CUR_OP_COUNTER_L (VAXIS+0x48) +#define CUR_OP_COUNTER_H (VAXIS+0x4A) + +// ZPֵλ:ȡ (0 2^32-1) +#define CUR_ZP_COUNTER_L (VAXIS+0x4C) +#define CUR_ZP_COUNTER_H (VAXIS+0x4E) + +// ʵᱨ״̬˿ +#define AXIS_ALM_STATUS (VAXIS+0x50) + #define AXIS1_ALM 0x0001 // 1 + #define AXIS2_ALM 0x0002 // 2 + #define AXIS3_ALM 0x0004 // 3 + #define AXIS4_ALM 0x0008 // 4 + #define AXIS5_ALM 0x0010 // 5 + #define AXIS6_ALM 0x0020 // 6 + + #define AXIS_ALM_MASK 0x003F + +// ״̬˿ +#define ECD_SIGNAL_STATUS (VAXIS+0x52) + #define BP1_STA 0x0001 // 1BP + #define AP1_STA 0x0802 // 1AP + #define ZP1_STA 0x0004 // 1ZP + #define BP2_STA 0x0008 // 2BP + #define AP2_STA 0x0010 // 2AP + #define ZP2_STA 0x0020 // 2ZP + + #define ECD_STA_MASK 0x003F + +// ׼״̬˿ +#define INPUT_STATUS (VAXIS+0x54) + #define INPUT1_STA 0x0001 // 1 + #define INPUT2_STA 0x0002 // 2 + #define INPUT3_STA 0x0004 // 3 + #define INPUT4_STA 0x0008 // 4 + #define INPUT5_STA 0x0010 // 5 + #define INPUT6_STA 0x0020 // 6 + #define INPUT7_STA 0x0040 // 7 + #define INPUT8_STA 0x0080 // 8 + #define INPUT9_STA 0x0100 // 9 + #define INPUT10_STA 0x0200 // 10 + #define INPUT11_STA 0x0400 // 11 + #define INPUT12_STA 0x0800 // 12 + #define INPUT13_STA 0x1000 // 13 + #define INPUT14_STA 0x2000 // 14 + #define INPUT15_STA 0x4000 // 15 + #define INPUT16_STA 0x8000 // 16 + +//-------------------------------------------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------------------------------------------- + +// ʼFPGA +void InitEmbFpga(void); + +//-------------------------------------------------------------------------------------------------------------- +// ˿ +// ȡ汾 +u16 GetFpgaHardVersion(void); +u16 GetFpgaSoftVersion(void); + +// õ״̬ +u16 GetRunStatus(void); + +// ȡ״̬ +u16 GetRunStatus1(void); + +// õ˿жϢ +u16 GetInputIntFlags(void); + +// õжϢ +u16 GetEcdIntFlags(void); + +// õƵ +u32 GetVAxisPPS(u16 vaxisId); + +// ȡһʱٶ +u32 GetLastVAxisFrequency(u16 vaxisId); + +// õļֵ +u32 GetVAxisCounter(u16 vaxisId); + +// ȡʵֵ +s32 GetAxisCounter(u16 axisId); + +// õֵ +s32 GetEcdCounter(u16 ecdId); + +// ȡOPֵ +u32 GetOPCounter(void); + +// ȡZPֵ +u32 GetZPCounter(void); + +// õʵᱨϢ +u16 GetAlarmValue(void); + +// õź״̬ +u16 GetEcdStatus(void); + +// õź״̬ +u16 GetInputStatus(void); + +//-------------------------------------------------------------------------------------------------------------- +// д˿ +// +void SetVAxisConfig(u16 cfg); + +// ȫжϱ־ +void CleanAllIntFlag(void); + +// ˶ +int StartVAxisRun(VAxisCmdStr * pCmd); + +// ֹͣǰ˶ +int StopVAxisRun(u16 vaxisId); + +// ٶȽٶʱ +void StopSpdCtrl(u16 vaxisId); + +// ֵ +void ClearEcdCounter(u16 ecdId); + +void ReetEcdABZLevel(u16 ecdId); // ABZƽźŸλ + +void SetEcdAPLevelNegative(u16 ecdId); // APȡ + +void SetEcdAZLevelNegative(u16 ecdId); // AP ZP ȡ + +void SetEcdZPLevelNegative(u16 ecdId); // ZPȡ + +void SetOpOutOn(void); // OP +void SetOpOutOff(void); + +void SetZpOutOn(void); // ZP +void SetZpOutOff(void); + +// ñ +void SetAxisAlarmConfig(u16 axisId, u16 alm); + +//-------------------------------------------------------------------------------------------------------------- + +// OPķƵϵ +void SetOpDivision(u16 div); + +// OPֵ +void SetOpCounter(s32 cnt); + +// ZPֵ +void SetZpCounter(s32 cnt); + +// ñֵ +void SetEcdCounter(u16 ecdId, s32 cnt); + +// ˿ж +void SetInputInt(u16 cfg); + +// źſ +void Output1On(void); +void Output1Off(void); +void Output2On(void); +void Output2Off(void); +void Output3On(void); +void Output3Off(void); +void Output4On(void); +void Output4Off(void); +void Output5On(void); +void Output5Off(void); +void Output6On(void); +void Output6Off(void); +void Output7On(void); +void Output7Off(void); +void Output8On(void); +void Output8Off(void); + +u8 GetOutputVal(int num); + +//-------------------------------------------------------------------------------------------------------------- +// ʵ +void SetAxisConfig(u16 axisId, u16 cfg); + +// д岹 +int WriteInterData(InterData * pCmd); + +// ձ +void CleanAxisBuff(u16 axisId, u16 bufSel); + +// ʵֵ +void SetAxisCounter(u16 axisId, s32 cnt); + +// PWMƵϵ +void SetAxisPwmFreq(u16 axisId, u16 freq); + +// PULSEPWMֵ +void SetAxisPulsePwm(u16 axisId, u16 val); + +// SIGNPWMֵ +void SetAxisSignPwm(u16 axisId, u16 val); + +//-------------------------------------------------------------------------------------------------------------- + +void RegInputIntProc(u16 intcfg, void(*inputProc)(void)); +void RegEcdInputProc(u16 ecdId, void(*ecdProc)(void)); + +// ⲿжӦ +void FpgaIntProc(void); + +//-------------------------------------------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------------------------------------------- +void SetExoutEnOn(void); +void SetExoutEnOff(void); +void SetExOutValue(u16 addr, u8 value); +u8 GetExOutValue(u16 addr); +void FlushExOutputs(void); + +// չIO״̬ +// addr: 1--MAX_EXIO_ADDR +// value: SENSOR_ONBit_RESET SENSOR_OFFBit_SET +void SetExOutput(u16 addr, u8 value); + +// ȡIOչ״̬ +// addr: 1--MAX_EXIO_ADDR +// : SENSOR_ONBit_RESET SENSOR_OFFBit_SET +u8 GetExInput(u16 addr); +void GetExInputs(u16 * pBuf); +//-------------------------------------------------------------------------------------------------------------- + + +#endif diff --git a/EMBOS/Users/EmbBase/exram.c b/EMBOS/Users/EmbBase/exram.c new file mode 100644 index 0000000..ead6be2 --- /dev/null +++ b/EMBOS/Users/EmbBase/exram.c @@ -0,0 +1,178 @@ + +#include "exram.h" + +#include "shell.h" +#include "delay.h" +#include "encrypt.h" +//---------------------------------------------------------- + +void TestExram(char * para1, char * para2); + +//---------------------------------------------------------- + +void InitExramCtrl(void) +{ + const static u16 encrypt = 0xffff; + AddToEncrypt(&encrypt); +#if (0) + AddShellCmd("EXRAM", "test sdram", TestExram); +#endif + +} + + + + +//---------------------------------------------------------- + +u32 GetExRamAddr(u32 vaddr) +{ + if (vaddr < EXRAM1_BYTE_SIZE) + { + return EXRAM1_BASE_ADDR + vaddr; + } + else if (vaddr < (EXRAM1_BYTE_SIZE+EXRAM2_BYTE_SIZE)) + { + return EXRAM2_BASE_ADDR + vaddr - EXRAM1_BYTE_SIZE; + } + else + { + return EXRAM2_BASE_ADDR + EXRAM2_BYTE_SIZE; + } +} + +void TestExram(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (para1 != NULL && strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (para2 != NULL && strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + //-------------------------------- +#define TDT u32 + + if (p1 >= 0) // Ե洢 + { + volatile TDT * paddr = NULL; + TDT dat; + if ((p1 <= (EXRAM1_BYTE_SIZE-sizeof(TDT))) || + ((p1 > EXRAM1_BYTE_SIZE) && p1 < (EXRAM1_BYTE_SIZE+EXRAM2_BYTE_SIZE-sizeof(TDT))) ) + { + paddr = (TDT*)GetExRamAddr(p1); + } + else + { + printf("addr out of range\r\n"); + return; + } + dat = *paddr; + *paddr = p2; + printf("before set, addr=0x%lx, dat=0x%lx, set to %d\r\n", (u32)paddr, dat, p2); + dat = *paddr; + if (dat == p2) + { + printf("success, "); + } + else + { + printf("failed, "); + } + printf("after set, addr=0x%lx, dat=0x%lx\r\n", (u32)paddr, dat); + } + else if (p1 < 0 && p2 < 0) + { + volatile TDT * paddr = NULL; + TDT dat; + int i, count; + int n; + p1 *= -1; + p1 -= 1; + if (p1 > EXRAM_BYTE_SIZE) + { + p1 = EXRAM_BYTE_SIZE; + } + + p2 *= -1; + // p2 -= 1; + if (p2 > EXRAM_BYTE_SIZE) + { + p2 = EXRAM_BYTE_SIZE; + } + + n = p1 + p2; + + p1 /= sizeof(TDT); + p2 /= sizeof(TDT); + + count = 0; + do + { + printf("\r\nat %d time, test sdram\r\n", count++); + // дϢ + printf("write dat to sdram, addr (0x%lx, 0x%lx)\r\n", GetExRamAddr(p1*sizeof(TDT)), GetExRamAddr(p2*sizeof(TDT))); + for (i = p1; i < p2; i++) + { + dat = (TDT)(i+n+count); + #if (0) + + if ((i&0xffff) == 0) + { + printf("write dat to sdram, addr=0x%lx\r\n", (u32)paddr); + DelayMs(10); + } + #endif + paddr = (TDT*)(GetExRamAddr(i*sizeof(TDT))); + *paddr = dat; + } + + // УϢ + printf("check dat from sdram, addr (0x%lx, 0x%lx)\r\n", GetExRamAddr(p1*sizeof(TDT)), GetExRamAddr(p2*sizeof(TDT))); + for (i = p1; i < p2; i++) + { + dat = (TDT)(i+n+count); + #if (0) + if ((i&0xffff) == 0) + { + printf("check dat from sdram, addr=0x%lx\r\n", (u32)paddr); + DelayMs(10); + } + #endif + paddr = (TDT*)(GetExRamAddr(i*sizeof(TDT))); + if (*paddr != dat) + { + printf("addr=0x%lx check error\r\n", (u32)paddr); + break; + } + } + if (i == p2) + { + printf("sdram check ok\r\n"); + } + else + { + + } + + DelayMs(100); + n *= count; + + if (IsConsoleCancel() != 0) // նֹͣ + { + break; + } + + }while(1); + } + +} + + diff --git a/EMBOS/Users/EmbBase/exram.h b/EMBOS/Users/EmbBase/exram.h new file mode 100644 index 0000000..1f5bcdd --- /dev/null +++ b/EMBOS/Users/EmbBase/exram.h @@ -0,0 +1,25 @@ + +#include "config.h" +#include "corefmc.h" + + + +//---------------------------------------------------------- + +#define EXRAM1_BASE_ADDR CORE_SDRAM1_ADDR_BEG // ʼַ +#define EXRAM1_BYTE_SIZE CORE_SDRAM1_SIZE // ֽ + +#define EXRAM2_BASE_ADDR CORE_SDRAM2_ADDR_BEG // ʼַ +#define EXRAM2_BYTE_SIZE CORE_SDRAM2_SIZE // ֽ + +#define EXRAM_BYTE_SIZE (EXRAM1_BYTE_SIZE+EXRAM2_BYTE_SIZE) // ֽ + +//---------------------------------------------------------- + +void InitExramCtrl(void); + + + +//---------------------------------------------------------- + + diff --git a/EMBOS/Users/EmbBase/inout.c b/EMBOS/Users/EmbBase/inout.c new file mode 100644 index 0000000..4c222ac --- /dev/null +++ b/EMBOS/Users/EmbBase/inout.c @@ -0,0 +1,406 @@ + +#include "inout.h" +#include "funcs.h" + + +//-------------ST Ե------------------------- + +OUTPUT_FUNCS(Led, LED); + +//----------------------------------------- + +OUTPUT_FUNCS(Spi1Nss, SPI1_NSS); +OUTPUT_FUNCS(Spi2Nss, SPI2_NSS); +OUTPUT_FUNCS(Spi3Nss, SPI3_NSS); + +//----------------------------------------- + +OUTPUT_FUNCS(WNetRst, W5500_RST); + +OUTPUT_FUNCS(En485Out, USART6_EN); + +//----------------------------------------- + +#define GETOUTVAL(num) \ +u8 Output##num##Sta(void)\ +{\ + return GetOutputVal(num);\ +} + +GETOUTVAL(1); +GETOUTVAL(2); +GETOUTVAL(3); +GETOUTVAL(4); +GETOUTVAL(5); +GETOUTVAL(6); +GETOUTVAL(7); +GETOUTVAL(8); + +#define GETECDSIGNALVAL(Name, LABEL) \ +u8 Get##Name##Status(void) \ +{\ + return (((GetEcdStatus() & LABEL##_STA) != 0) ? Bit_SET : Bit_RESET);\ +} + +GETECDSIGNALVAL(AP1, AP1); +GETECDSIGNALVAL(BP1, BP1); +GETECDSIGNALVAL(ZP1, ZP1); +GETECDSIGNALVAL(AP2, AP2); +GETECDSIGNALVAL(BP2, BP2); +GETECDSIGNALVAL(ZP2, ZP2); + +#define GETINPUTVAL(Name, LABEL) \ +u8 Get##Name##Status(void) \ +{\ + return (((GetInputStatus() & LABEL##_STA) != 0) ? Bit_SET : Bit_RESET);\ +} + +GETINPUTVAL(Input1, INPUT1); +GETINPUTVAL(Input2, INPUT2); +GETINPUTVAL(Input3, INPUT3); +GETINPUTVAL(Input4, INPUT4); +GETINPUTVAL(Input5, INPUT5); +GETINPUTVAL(Input6, INPUT6); +GETINPUTVAL(Input7, INPUT7); +GETINPUTVAL(Input8, INPUT8); +GETINPUTVAL(Input9, INPUT9); +GETINPUTVAL(Input10, INPUT10); +GETINPUTVAL(Input11, INPUT11); +GETINPUTVAL(Input12, INPUT12); +GETINPUTVAL(Input13, INPUT13); +GETINPUTVAL(Input14, INPUT14); +GETINPUTVAL(Input15, INPUT15); +GETINPUTVAL(Input16, INPUT16); + +//-------------1------------------------- +void SetMoto1SignOn(void) // 1 +{ + SetAxisConfig(AXIS_ID1, MOUT_SIGN_CCW); +} +void SetMoto1SignOff(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_SIGN_CW); +} + +void SetMoto1PulseOn(void) // 1 +{ + SetAxisConfig(AXIS_ID1, MOUT_PLUS_ON); +} +void SetMoto1PulseOff(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_PLUS_OFF); +} + +void SetMoto1SelAOn(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_SEL_HIGH); +} + +void SetMoto1SelAOff(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_SEL_LOW); +} + +void SetMoto1SelBOn(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_EN_HIGH); +} + +void SetMoto1SelBOff(void) +{ + SetAxisConfig(AXIS_ID1, MOUT_EN_LOW); +} + +u8 GetM1AlmStatus(void) // 1 +{ + if ((GetAlarmValue() & AXIS1_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//-------------2------------------------- +void SetMoto2SignOn(void) // 2 +{ + SetAxisConfig(AXIS_ID2, MOUT_SIGN_CCW); +} +void SetMoto2SignOff(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_SIGN_CW); +} + +void SetMoto2PulseOn(void) // 2 +{ + SetAxisConfig(AXIS_ID2, MOUT_PLUS_ON); +} +void SetMoto2PulseOff(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_PLUS_OFF); +} + +void SetMoto2SelAOn(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_SEL_HIGH); +} + +void SetMoto2SelAOff(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_SEL_LOW); +} + +void SetMoto2SelBOn(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_EN_HIGH); +} + +void SetMoto2SelBOff(void) +{ + SetAxisConfig(AXIS_ID2, MOUT_EN_LOW); +} + +u8 GetM2AlmStatus(void) // 2 +{ + if ((GetAlarmValue() & AXIS2_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//-------------3------------------------- +void SetMoto3SignOn(void) // 3 +{ + SetAxisConfig(AXIS_ID3, MOUT_SIGN_CCW); +} +void SetMoto3SignOff(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_SIGN_CW); +} + +void SetMoto3PulseOn(void) // 3 +{ + SetAxisConfig(AXIS_ID3, MOUT_PLUS_ON); +} +void SetMoto3PulseOff(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_PLUS_OFF); +} + +void SetMoto3SelAOn(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_SEL_HIGH); +} + +void SetMoto3SelAOff(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_SEL_LOW); +} + +void SetMoto3SelBOn(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_EN_HIGH); +} + +void SetMoto3SelBOff(void) +{ + SetAxisConfig(AXIS_ID3, MOUT_EN_LOW); +} + +u8 GetM3AlmStatus(void) // 3 +{ + if ((GetAlarmValue() & AXIS3_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//-------------4------------------------- +void SetMoto4SignOn(void) // 4 +{ + SetAxisConfig(AXIS_ID4, MOUT_SIGN_CCW); +} +void SetMoto4SignOff(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_SIGN_CW); +} + +void SetMoto4PulseOn(void) // 4 +{ + SetAxisConfig(AXIS_ID4, MOUT_PLUS_ON); +} +void SetMoto4PulseOff(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_PLUS_OFF); +} + +void SetMoto4SelAOn(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_SEL_HIGH); +} + +void SetMoto4SelAOff(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_SEL_LOW); +} + +void SetMoto4SelBOn(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_EN_HIGH); +} + +void SetMoto4SelBOff(void) +{ + SetAxisConfig(AXIS_ID4, MOUT_EN_LOW); +} + +u8 GetM4AlmStatus(void) // 4 +{ + if ((GetAlarmValue() & AXIS4_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//-------------5------------------------- +void SetMoto5SignOn(void) // 5 +{ + SetAxisConfig(AXIS_ID5, MOUT_SIGN_CCW); +} +void SetMoto5SignOff(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_SIGN_CW); +} + +void SetMoto5PulseOn(void) // 5 +{ + SetAxisConfig(AXIS_ID5, MOUT_PLUS_ON); +} +void SetMoto5PulseOff(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_PLUS_OFF); +} + +void SetMoto5SelAOn(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_SEL_HIGH); +} + +void SetMoto5SelAOff(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_SEL_LOW); +} + +void SetMoto5SelBOn(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_EN_HIGH); +} + +void SetMoto5SelBOff(void) +{ + SetAxisConfig(AXIS_ID5, MOUT_EN_LOW); +} + +u8 GetM5AlmStatus(void) // 5 +{ + if ((GetAlarmValue() & AXIS5_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//-------------6------------------------- +void SetMoto6SignOn(void) // 6 +{ + SetAxisConfig(AXIS_ID6, MOUT_SIGN_CCW); +} +void SetMoto6SignOff(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_SIGN_CW); +} + +void SetMoto6PulseOn(void) // 6 +{ + SetAxisConfig(AXIS_ID6, MOUT_PLUS_ON); +} +void SetMoto6PulseOff(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_PLUS_OFF); +} + +void SetMoto6SelAOn(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_SEL_HIGH); +} + +void SetMoto6SelAOff(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_SEL_LOW); +} + +void SetMoto6SelBOn(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_EN_HIGH); +} + +void SetMoto6SelBOff(void) +{ + SetAxisConfig(AXIS_ID6, MOUT_EN_LOW); +} + +u8 GetM6AlmStatus(void) // 6 +{ + if ((GetAlarmValue() & AXIS6_ALM) != 0) + { + return SENSOR_ON; + } + else + { + return SENSOR_OFF; + } +} + +//----------------------------------------- + +u8 GetInputNullOn(void) +{ + //ղ + return Bit_RESET; +} + +u8 GetInputNullOff(void) +{ + //ղ + return Bit_SET; +} + +void SetOutputNull(void) +{ + //ղ +} + +//----------------------------------------- + +void SetDefaultOut(void) +{ + USART6_485OutDis(); +} + diff --git a/EMBOS/Users/EmbBase/inout.h b/EMBOS/Users/EmbBase/inout.h new file mode 100644 index 0000000..07e3b42 --- /dev/null +++ b/EMBOS/Users/EmbBase/inout.h @@ -0,0 +1,231 @@ + +#ifndef __IN_OUT_H__ +#define __IN_OUT_H__ + +#include "config.h" +#include "embfpga.h" +#include "spirw.h" + +//-------------ST Ե------------------------- + +void SetLedOn(void); +void SetLedOff(void); +void SetLedToggle(void); +u8 GetLedStatus(void); + +//-------------ST ------------------------- + +#define SetDebugOn SetOutputNull +#define SetDebugOff SetOutputNull + +//---------------- SPI1 ------------------------ + +// SPI1 NSS +void SetSpi1NssOn(void); +void SetSpi1NssOff(void); +void SetSpi1NssToggle(void); +u8 GetSpi1NssStatus(void); + +//---------------- SPI2 ------------------------ + +// SPI2 NSS +void SetSpi2NssOn(void); +void SetSpi2NssOff(void); +void SetSpi2NssToggle(void); +u8 GetSpi2NssStatus(void); + +//---------------- SPI3 ------------------------ + +// SPI3 NSS +void SetSpi3NssOn(void); +void SetSpi3NssOff(void); +void SetSpi3NssToggle(void); +u8 GetSpi3NssStatus(void); + +//----------------- w5500 ------------------ + +#define InitWNetSpi InitSpi1 +#define WNetNceOn SetSpi1NssOn +#define WNetNceOff SetSpi1NssOff +#define WNetSpiReadByte Spi1ReadByte +#define WNetSpiWriteByte Spi1WriteByte + + +void SetWNetRstOn(void); +void SeWNetRstOff(void); +void SetWNetRstToggle(void); +u8 GetWNetRstStatus(void); + +//----------------- norflash ------------------ + +#define InitNorSpi InitSpi2 +#define SetNorSpiNssOn SetSpi2NssOn +#define SetNorSpiNssOff SetSpi2NssOff +#define NorSpiReadByte Spi2ReadByte +#define NorSpiWriteByte Spi2WriteByte + +//----------------- fram ------------------ + +// Ƭѡ + +#define InitFramSpi InitSpi3 + +#define FramNceOn SetSpi3NssOn +#define FramNceOff SetSpi3NssOff +#define FramReadByte Spi3ReadByte +#define FramWriteByte Spi3WriteByte + +//----------------------------------- +// 485,6 +void SetEn485OutOn(void); +void SetEn485OutOff(void); +void SetEn485OutToggle(void); +u8 GetEn485OutStatus(void); + +//----------------------------------- + +#define OutputNull SetOutputNull + +#define SerIdOutOn SetZpOutOff +#define SerIdOutOff SetZpOutOn + +#define SetMpOutOn SetOpOutOff +#define SetMpOutOff SetOpOutOn + +u8 Output1Sta(void); +u8 Output2Sta(void); +u8 Output3Sta(void); +u8 Output4Sta(void); +u8 Output5Sta(void); +u8 Output6Sta(void); +u8 Output7Sta(void); +u8 Output8Sta(void); + +u8 GetAP1Status(void); +u8 GetBP1Status(void); +u8 GetZP1Status(void); +u8 GetAP2Status(void); +u8 GetBP2Status(void); +u8 GetZP2Status(void); + +u8 GetInput1Status(void); +u8 GetInput2Status(void); +u8 GetInput3Status(void); +u8 GetInput4Status(void); +u8 GetInput5Status(void); +u8 GetInput6Status(void); +u8 GetInput7Status(void); +u8 GetInput8Status(void); +u8 GetInput9Status(void); +u8 GetInput10Status(void); +u8 GetInput11Status(void); +u8 GetInput12Status(void); +u8 GetInput13Status(void); +u8 GetInput14Status(void); +u8 GetInput15Status(void); +u8 GetInput16Status(void); + +//-------------1------------------------- +void SetMoto1SignOn(void); // 1 +void SetMoto1SignOff(void); + +void SetMoto1PulseOn(void); // 1 +void SetMoto1PulseOff(void); + +void SetMoto1SelAOn(void); +void SetMoto1SelAOff(void); + +void SetMoto1SelBOn(void); +void SetMoto1SelBOff(void); + +u8 GetM1AlmStatus(void); // 1 + +//-------------2------------------------- +void SetMoto2SignOn(void); // 2 +void SetMoto2SignOff(void); + +void SetMoto2PulseOn(void); // 2 +void SetMoto2PulseOff(void); + +void SetMoto2SelAOn(void); +void SetMoto2SelAOff(void); + +void SetMoto2SelBOn(void); +void SetMoto2SelBOff(void); + +u8 GetM2AlmStatus(void); // 2 + +//-------------3------------------------- +void SetMoto3SignOn(void); // 3 +void SetMoto3SignOff(void); + +void SetMoto3PulseOn(void); // 3 +void SetMoto3PulseOff(void); + +void SetMoto3SelAOn(void); +void SetMoto3SelAOff(void); + +void SetMoto3SelBOn(void); +void SetMoto3SelBOff(void); + +u8 GetM3AlmStatus(void); // 3 + +//-------------4------------------------- +void SetMoto4SignOn(void); // 4 +void SetMoto4SignOff(void); + +void SetMoto4PulseOn(void); // 4 +void SetMoto4PulseOff(void); + +void SetMoto4SelAOn(void); +void SetMoto4SelAOff(void); + +void SetMoto4SelBOn(void); +void SetMoto4SelBOff(void); + +u8 GetM4AlmStatus(void); // 4 + +//-------------5------------------------- +void SetMoto5SignOn(void); // 5 +void SetMoto5SignOff(void); + +void SetMoto5PulseOn(void); // 5 +void SetMoto5PulseOff(void); + +void SetMoto5SelAOn(void); +void SetMoto5SelAOff(void); + +void SetMoto5SelBOn(void); +void SetMoto5SelBOff(void); + +u8 GetM5AlmStatus(void); // 5 + +//-------------6------------------------- +void SetMoto6SignOn(void); // 6 +void SetMoto6SignOff(void); + +void SetMoto6PulseOn(void); // 6 +void SetMoto6PulseOff(void); + +void SetMoto6SelAOn(void); +void SetMoto6SelAOff(void); + +void SetMoto6SelBOn(void); +void SetMoto6SelBOff(void); + +u8 GetM6AlmStatus(void); // 6 + +//----------------------------------- + +u8 GetInputNullOn(void); +u8 GetInputNullOff(void); +void SetOutputNull(void); + +//----------------------------------- + +void SetDefaultOut(void); + +//----------------------------------- + +#endif + diff --git a/EMBOS/Users/EmbBase/motos.c b/EMBOS/Users/EmbBase/motos.c new file mode 100644 index 0000000..68ebdd3 --- /dev/null +++ b/EMBOS/Users/EmbBase/motos.c @@ -0,0 +1,1819 @@ + +#define _IN_MOTOS_C + +//------------------------------------------------------------------------------- + +#include "motos.h" +#include "stm32motos.h" +#include "inout.h" + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + +const u16 g_axisIDList[AXIS_NUM] = +{ + AXIS_ID1, + AXIS_ID2, + AXIS_ID3, + AXIS_ID4, + AXIS_ID5, + AXIS_ID6, +}; + +//------------------------------------------------------------------------------- + +// ʼ +void InitMotos(void) +{ + InitSTM32Motos(); + +#if (STM32_MOTOS_NUM >= 1) + InitStm32Moto1OutFunc(SetMoto1PulseOn, SetMoto1PulseOff, SetMoto1SignOn, SetMoto1SignOff); +#endif + +#if (STM32_MOTOS_NUM >= 2) + InitStm32Moto2OutFunc(SetMoto2PulseOn, SetMoto2PulseOff, SetMoto2SignOn, SetMoto2SignOff); +#endif + +#if (STM32_MOTOS_NUM >= 3) + InitStm32Moto3OutFunc(SetMoto3PulseOn, SetMoto3PulseOff, SetMoto3SignOn, SetMoto3SignOff); +#endif + +#if (STM32_MOTOS_NUM >= 4) + InitStm32Moto4OutFunc(SetMoto4PulseOn, SetMoto4PulseOff, SetMoto4SignOn, SetMoto4SignOff); +#endif + +#if (STM32_MOTOS_NUM >= 5) + InitStm32Moto5OutFunc(SetMoto5PulseOn, SetMoto5PulseOff, SetMoto5SignOn, SetMoto5SignOff); +#endif + +#if (STM32_MOTOS_NUM >= 6) + InitStm32Moto6OutFunc(SetMoto6PulseOn, SetMoto6PulseOff, SetMoto6SignOn, SetMoto6SignOff); +#endif + + memset(&g_motosPara, 0, sizeof(MotosPara)); // õ +} + +// ȡλ +int GetMotosCounter(s32 * position) +{ + int i; + + if (position != NULL) + { + for (i = 0; i < AXIS_NUM; i++) + { + position[i] = GetAxisCounter(g_axisIDList[i]); + } + } + + return 0; +} + +// õλ +void SetMotosCounter(s32 * position) +{ + int i; + for (i = 0; i < AXIS_NUM; i++) + { + if (position != NULL) + { + SetAxisCounter(g_axisIDList[i], position[i]); + } + else + { + SetAxisCounter(g_axisIDList[i], 0); + } + } +} + +// ˢ +void RefreshMotosPos(s32 * poslist) +{ + // ȫˢ + int i; + + for (i = 0; i < AXIS_NUM; i++) + { + g_motosPara.motosPos[i] = poslist[i]; + } + g_motosPara.enFlag = DATA_VALID; +} + +//------------------------------------------------------------------------------- + +s32 GetMotoCounter(int axisIdx) +{ + assert_param(axisIdx < AXIS_NUM); + return GetAxisCounter(g_axisIDList[axisIdx]); +} + +void SetMotoCounter(int axisIdx, s32 pos) +{ + assert_param(axisIdx < AXIS_NUM); + SetAxisCounter(g_axisIDList[axisIdx], pos); +} + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- +void MotoServoCtrl(int axisIdx, int onoff) +{ + assert_param(onoff == SERVO_ON || onoff == SERVO_OFF); + + if (axisIdx < AXIS_NUM) + { + SetAxisConfig(g_axisIDList[axisIdx], onoff); + } +} + +// õ +void SetMotosConfig(MotosConfig * pConfig) +{ + int i; + u16 axisID; + if (pConfig == NULL) + { + return; + } + + if (pConfig->newConfig == 0) + { + return; + } + + // ֹͣ + StopVAxisRun(VAXIS_ID_ALL); + + for (i = 0; i < AXIS_NUM; i++) + { + axisID = g_axisIDList[i]; + + if ((pConfig->axisConfig[i].axisConfig & CONFIG_EN) != 0) // + { + if ((pConfig->axisConfig[i].axisConfig & POA_EN) != 0) // A + { + SetAxisConfig(axisID, POUTA_EN); + } + else + { + SetAxisConfig(axisID, POUTA_DIS); + } + + if ((pConfig->axisConfig[i].axisConfig & POB_EN) != 0) // B + { + SetAxisConfig(axisID, POUTB_EN); + } + else + { + SetAxisConfig(axisID, POUTB_DIS); + } + + if ((pConfig->axisConfig[i].axisConfig & SON_EN) != 0) // ŷON + { + SetAxisConfig(axisID, SERVO_ON); + } + else + { + SetAxisConfig(axisID, SERVO_OFF); + } + + if ((pConfig->axisConfig[i].axisConfig & ALM_LEVH) != 0) // ƽΪ + { + SetAxisAlarmConfig(axisID, ALM_LEV_HIGH); + } + else + { + SetAxisAlarmConfig(axisID, ALM_LEV_LOW); + } + + if ((pConfig->axisConfig[i].axisConfig & ALM_EN) != 0) // ͣ + { + SetAxisAlarmConfig(axisID, ALM_STOP_EN); + } + else + { + SetAxisAlarmConfig(axisID, ALM_STOP_DIS); + } + + if ((pConfig->axisConfig[i].axisConfig & POUT_EN) != 0) // + { + SetAxisConfig(axisID, pConfig->axisConfig[i].poutType); // ģʽ 巽ʽ + SetAxisConfig(axisID, pConfig->axisConfig[i].spdSource); // ʵٶȿģʽ(123) + SetAxisConfig(axisID, pConfig->axisConfig[i].datSource); // ʵݻȡģʽ(Ӳ岹涯ӳ) + } + else + { + SetAxisConfig(axisID, POUT_DISABLE); // ֹ + } + } + } + + SetVAxisConfig(VCTR_AXIS_ALM_INT); // ״̬ +} + +//------------------------------------------------------------------------------- + +// ӼҪλ +// : pps1 ٶ1 +// pps2 ٶ2 +// calcTime ٶȱ仯ʱ䣬λΪ1/72us +// : +// λֵ +// ٶȱ仯̶Ϊ1ppg +u32 CalcDisplacement(u32 pps1, u32 pps2, u32 calcTime) +{ + // ٶȱ仯̶Ϊ1ppg + // ʽ: d=(v2+v1)*(v2-v1)/(2a) + // v1 = pps1 + // v2 = pps2 + // a = 1ppg/(calcTime/FPGA_CLK) + // d=(v2+v1)*(v2-v1)*calcTime/(2*FPGA_CLK) + double temp; + if (pps1 < pps2) + { + temp = (pps2-pps1); + } + else + { + temp = (pps1-pps2); + } + temp *= (pps1+pps2); + temp *= calcTime; + temp /= (2*FPGA_CLK); + return (u32)(temp+0.5); +} + + +// ܣijλٶȱ仯ҪʱλΪ1/72us +// +// disp λ +// pps1 ٶ1 +// pps2 ٶ2 +// +// : +// λֵ +// ٶȱ仯̶Ϊ1ppg + +u32 CalcGapTime(u32 disp, u32 pps1, u32 pps2) +{ + double temp; + // ٶȱ仯̶Ϊ1ppg + // ʽ: a=(v2+v1)*(v2-v1)/(2*d) + // v1 = pps1 + // v2 = pps2 + // d = disp + // a = 1ppg/(calcTime/FPGA_CLK) + // calcTime= (2*FPGA_CLK)*d/((v2+v1)*(v2-v1)) + + if (disp == 0 || pps1 == pps2) + { + return 0; + } + if (pps1 < pps2) + { + temp = (pps2-pps1); + } + else + { + temp = (pps1-pps2); + } + temp *= (pps1+pps2); + temp = (2.0*FPGA_CLK)/temp; + temp *= disp; + return (u32)(temp+0.5); +} + +// ijλƺijٶ£յٶֵ +// +// disp λ +// pps1 ٶ1 +// addgap ʱ +// +// : +// λֵ +// ٶȱ仯̶Ϊ1ppg + +u32 CalcEndSpd(u32 disp, u32 pps1, s32 addgap) +{ + double temp; + // ٶȱ仯̶Ϊ1ppg + // ʽ: a=(v2+v1)*(v2-v1)/(2*d) + // v1 = pps1 + // d = disp + // a = 1ppg/(addgap/FPGA_CLK) + // pps2 = sqrt(2*FPGA_CLK*disp/addgap + pps1*pps1) + + temp = 2.0*FPGA_CLK*disp/addgap; + temp += 1.0*pps1*pps1; + if (temp > 0) + { + temp = sqrt(temp); + } + else + { + temp = 0; + } + + return (u32)(temp+0.5); +} + +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- +// ܣֱ߲岹˶(Ӳʵ)֧6ֱ߲岹֧12 +// 岹ƽṹָ +// : 0˶ִɡ +// -1 +// -2ִйݲʱ˳ +// -3 fpga д +// -4 FPGA 汾 +// =1, ͣ +// =2, ֹͣͣ +// =3, ֹͣͣ +// =4, ͨͣͣ + +#if (1) + +int InterpolationMotion(InterMoveCtrl * pCtrl) +{ + int i, rslt; + u32 totalnum, circlenum, circlesize, lastsize; // ˶ѭܴлһijȣһij + u32 runcircle, execcircle, runrepeat, exerepeat; // ˶ִж˶ظִظ + u32 runcount; + u32 pulsePerSegment; + u16 vAxisId; + u16 vAxisCleanOv1, vAxisCleanOv2; + u16 vAxisBuf1Finish, vAxisBuf2Finish; + u16 vAxisBuf1Running, vAxisBuf2Running; +// u16 vAxisBuf1En, vAxisBuf2En; + u16 vAxisDisBuf1, vAxisDisBuf2; + + u32 movement[AXIS_NUM], count[AXIS_NUM]; + s32 val32, position[AXIS_NUM]; + int dir[AXIS_NUM]; // ˶ + int runsta, bufsta, bufsel; + int slowSta; + int brksta, inbrk; // ɲ״̬ɲ־ + int nstpsta, innstp; // ɲ״̬ɲ־ + int stopfill; // ֹͣݱ־ + u16 tmp16, vrsta, err; + double calc, len; + u16 outNum; + + u32 startpps, runpps, slowpps, stoppps; // ٶ + u32 addppsg, decppsg, brkppsg, tslppsg; // ٶ + u32 num, addnum, decnum, jumpnum; // ӼҪ + u32 curtab1num, curtab2num; + + VAxisCmdStr vAxisCmd; + InterData idata; + + num = 0; + + // ------------------------------------------------------------------------ + // Ϸж + if (pCtrl == NULL) + { + printf("para error in MotosRun\r\n"); + rslt = -1; // + return rslt; + } + + if (pCtrl->vAxisId != VAXIS_ID1) + { + printf("para vAxisId error in MotosRun\r\n"); + rslt = -1; // + return rslt; + } + + for (i = 0; i < AXIS_NUM; i++) // ͳһʵٶԴ + { + pCtrl->motosConfig.axisConfig[i].spdSource = MAKE_POUT_CMD(pCtrl->vAxisId); + } + + // ѡ + SetMotosConfig(&(pCtrl->motosConfig)); + + // ȴִ + if (pCtrl->Delay != NULL && pCtrl->motosConfig.newConfig != 0) + { + pCtrl->Delay(100); + } + + // ------------------------------------------------------------------------ + + if (pCtrl->GetEmergencyStop != NULL) // ֹͣ + { + err = pCtrl->GetEmergencyStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; + printf("emergency stop 1 in InterpolationMotion, err=0x%x\r\n", err); + rslt = 2; // ֹֹͣͣͣ巢 + return rslt; + } + } + + if (pCtrl->GetQuickStop != NULL) // ֹͣ + { + err = pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; + printf("quick stop 1 in InterpolationMotion, err=0x%x\r\n", err); + rslt = 3; // ֹͣͣ + return rslt; + } + } + + if (pCtrl->GetNormalStop != NULL) // һֹͣ + { + err = pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; + printf("normal stop 1 in InterpolationMotion, err=0x%x\r\n", err); + rslt = 4; // ͨͣͣ + return rslt; + } + } + + // ٶȿƲ + startpps = pCtrl->spdPara.startPPS; + runpps = pCtrl->spdPara.runPPS; + slowpps = pCtrl->spdPara.slowPPS; + stoppps = pCtrl->spdPara.stopPPS; + addppsg = pCtrl->spdPara.addPPSG; + decppsg = pCtrl->spdPara.decPPSG; + brkppsg = pCtrl->spdPara.brkPPSG; + tslppsg = pCtrl->spdPara.brkPPSG*TOSLOWMUTI; + + if (startpps == 0 || runpps == 0 || slowpps == 0 || stoppps == 0 || addppsg == 0 || decppsg == 0 || brkppsg == 0 || tslppsg == 0) + { + printf("one of speed para is zero \r\n"); + printf("startpps = %d, runpps = %d, slowpps = %d, stoppps = %d, addppsg = %d, decppsg = %d, brkppsg = %d\r\n", startpps, runpps, slowpps, stoppps, addppsg, decppsg, brkppsg); + + rslt = -1; + return rslt; + } + + vAxisId = pCtrl->vAxisId; + + if (vAxisId == VAXIS_ID1) + { + vAxisCleanOv1 = VCTR_VAXIS1_CLEAN_OV1; + vAxisCleanOv2 = VCTR_VAXIS1_CLEAN_OV2; + + vAxisBuf1Finish = VAXIS1_BUF1_FINISH; + vAxisBuf2Finish = VAXIS1_BUF2_FINISH; + + vAxisBuf1Running = VAXIS1_BUF1_RUNNING; + vAxisBuf2Running = VAXIS1_BUF2_RUNNING; + +// vAxisBuf1En = VAXIS1_BUF1_ENABLE; +// vAxisBuf2En = VAXIS1_BUF2_ENABLE; + + vAxisDisBuf1 = VCTR_VAXIS1_DIS_BUF1; + vAxisDisBuf2 = VCTR_VAXIS1_DIS_BUF2; + } + else + { + printf("not support vaxis\r\n"); + } + // λ + totalnum = 0; // + circlenum = 0; // + circlesize = 0; // ÿѭڵ + lastsize = 0; // һڵ + + runrepeat = pCtrl->mvmtPara.extraRepeat; + exerepeat = pCtrl->mvmtPara.extraRepeat; + + // õʵλƣΪ + for (i = 0; i < AXIS_NUM; i++) + { + if (pCtrl->mvmtPara.movement[i] >= 0) + { + movement[i] = (u32)(pCtrl->mvmtPara.movement[i]); + dir[i] = 1; + } + else + { + movement[i] = (u32)(-(pCtrl->mvmtPara.movement[i])); + dir[i] = -1; + } + +// printf("axis %d movement = %d.\r\n", i+1, movement[i]); + + if (totalnum < movement[i]) + { + totalnum = movement[i]; + } +/* + if (pCtrl->interLongSel == LAS_COMPOSITE) // ĺϳɳ + { + calc = movement[i]; + calc *= calc; + len += calc; + } + else + { + + } +*/ + count[i] = 0; + } + + totalnum = pCtrl->mvmtPara.interLong; + pulsePerSegment = pCtrl->mvmtPara.pulsePerSegment; +/* + if (pCtrl->interLong == LAS_COMPOSITE) // ĺϳɳ + { + len = sqrt(len); + totalnum = (u32)(len+0.5); + } +*/ + if (totalnum == 0) + { + printf("move count = 0. run over\r\n"); + return -1; + } + else if (totalnum < 2) + { + circlenum = 1; + circlesize = totalnum; + lastsize = totalnum; + } + else if (totalnum < pulsePerSegment*2) // С2λͼ, Ϊȵ + { + circlenum = 2; + circlesize = (totalnum)/2; + lastsize = totalnum-circlesize; + } + else + { + circlenum = (totalnum + pulsePerSegment-1)/pulsePerSegment; + circlesize = pulsePerSegment; + lastsize = totalnum-circlesize*(circlenum-1); + } + + +#if (0) + if (pCtrl->stopMode == STOP_MODE_TAB) // ֹͣģʽ£ݴһʱΪ + { + if (lastsize != circlesize && totalnum > ) + { + printf("totalnum is not equal to circle nun\r\n"); + return 0; + } + } +#endif + +// printf("calc para. circlenum=%d, circlesize=%d, lastsize=%d\r\n", circlenum, circlesize, lastsize); + + if (circlenum == 0 || circlesize == 0 || lastsize == 0) + { + printf("calc error. circlenum=%d, circlesize=%d, lastsize=%d\r\n", circlenum, circlesize, lastsize); + return -1; + } + + // ٶȿƲ + addnum = CalcDisplacement(startpps, runpps, addppsg); // + decnum = CalcDisplacement(stoppps, runpps, decppsg); // + +// printf("before run, start=%d, stop=%d, runing=%d, \r\n\taddppsg=%d, addnum=%d, decppsg=%d, decnum=%d\r\n",startpps, stoppps, runpps, addppsg, addnum, decppsg, decnum); + + if ((totalnum < addnum + decnum) || + ((totalnum < (addnum + decnum + pulsePerSegment)) && (addnum%pulsePerSegment) != 0) || + 0 ) + { + // ¼ ٶȣͼ + calc = addnum; + calc /= (addnum + decnum); + calc *= totalnum; // ձĸ + calc /= pulsePerSegment; // Ȧ + addnum = (u32)calc; + if (addnum != 0) + { + addnum *= pulsePerSegment; // ȡ + } + else + { + addnum = totalnum / 2; + } + + len = addnum*2; + len *= FPGA_CLK; + len /= addppsg; + len -= startpps; + calc = startpps; + calc *= startpps; + len += calc; + calc = sqrt(len); // + runpps = (u32)(calc+0.5); + decnum = CalcDisplacement(stoppps, runpps, decppsg); // ¼ + +// printf("recalc addnum=%d, runpps=%d, decnum=%d\r\n", addnum, runpps, decnum); + } + + // ѭ + runsta = 0; + bufsel = 0; + bufsta = 0; + slowSta = 0; + brksta = 0; + inbrk = 0; + nstpsta = 0; + innstp = 0; + stopfill = 0; // ֹͣݱ־ + + runcircle = circlenum; // + execcircle = circlenum; // ִм + runcount = 0; + jumpnum = 0; + pCtrl->errInfo = 0; + curtab1num = 0; + curtab2num = 0; + rslt = 0; + + if (pCtrl->WorkBeforeRun != NULL) + { + pCtrl->WorkBeforeRun(pCtrl->workPara1, pCtrl->workPara2); + } + + SetVAxisConfig(VCTR_AXIS_ALM_INT); // ״̬ + + memset(&idata, 0, sizeof(InterData)); + + while(execcircle > 0 || exerepeat > 0) // ִδ + { + if ( stopfill == 0 && // + (bufsta & 0x03) != 0x03 && // buff + (runcircle != 0 || runrepeat != 0) && // δ + 1 ) + { + if (runcircle == 1) // һȦ + { + num = lastsize; + if (runrepeat == 0) + { + runsta = 1; // һȦ + } + } + else + { + num = circlesize; + if (runrepeat == 0 && (runsta == 0 && decnum > lastsize)) // ҪһȦλ + { + if ((runcircle-1) <= (decnum-lastsize+circlesize-1)/circlesize) + { + runsta = 1; // ٱ־ + } + } + } + runcount += num; + + if (runsta == 1) // ٵ + { + if (decnum > lastsize) + { + jumpnum = num - (decnum - lastsize) % num; + } + else + { + jumpnum = lastsize - decnum; + } + if (jumpnum >= num) + { + jumpnum = 0; + } + if (decnum != 0) + { + decnum = decnum - (num - jumpnum); + } +// printf("jumpnum=%d, decnum=%d\r\n", jumpnum, decnum); + } + + for (i = 0; i < AXIS_NUM; i++) // дIJ岹 + { + if (movement[i] != 0) + { + if (bufsel == 0) + { + idata.bufSel = BUF_SEL1; + } + else + { + idata.bufSel = BUF_SEL2; + } + + // öβ岹Ҫʵ + //-------------------------- + idata.vaxisId = vAxisId; // ʹ1 + if (dir[i] >= 0) // + { + idata.dirAttr = DIR_POSPOS; // + } + else + { + idata.dirAttr = DIR_NEGNEG; // + } + idata.datBufLen = 1+1; // Чθ: 1 + + idata.axisId = g_axisIDList[i]; + idata.startEscNum = 0; + idata.partVxNum = num; + calc = movement[i]; + calc *= runcount; + calc /= totalnum; + calc -= count[i]; + outNum = (u16)(calc+0.5); + count[i] += outNum; + idata.datBuff[0] = outNum; // һ + idata.datBuff[1] = 0; // д0 + idata.sineOut = 0; + + //printf("%d.datBuff[0]=%d\r\n", i+1, idata.datBuff[0]); + rslt = WriteInterData(&idata); + if (rslt < 0) + { + return rslt; + } + +// printf("axis %d wt, c=%d, ac=%d\r\n", i+1, outNum, count[i]); + + if (runcount >= totalnum) + { + count[i] = 0; + } + } + else + { + if (bufsel == 0) + { + CleanAxisBuff(g_axisIDList[i], BUF_SEL1); + } + else + { + CleanAxisBuff(g_axisIDList[i], BUF_SEL2); + } + } + } + if (runcount >= totalnum) + { + runcount = 0; + } + + // ˶, + vAxisCmd.vaxisId = vAxisId; // ʹ + if (bufsel == 0) + { + bufsta |= 0x01; + vAxisCmd.bufSel = BUF_SEL1; + curtab1num = num; +// printf("write buff1\r\n"); + } + else + { + bufsta |= 0x02; + vAxisCmd.bufSel = BUF_SEL2; + curtab2num = num; +// printf("write buff2\r\n"); + } + + if (runsta == 0) + { +// printf("write add vtable\r\n"); + + vAxisCmd.startPPS = startpps; // ٶ + vAxisCmd.runPPS = runpps; // ٶ + vAxisCmd.jumpNum = 0; // + vAxisCmd.calcGap = addppsg; // ʱ + } + else + { +// printf("write dec vtable, jump=%d\r\n", jumpnum); + + vAxisCmd.startPPS = stoppps; // ٶ + vAxisCmd.runPPS = stoppps; // ٶ + vAxisCmd.jumpNum = jumpnum; // + vAxisCmd.calcGap = decppsg; // ʱ + } + + vAxisCmd.outNum = num; // + + StartVAxisRun(&vAxisCmd); // д + + // õ״̬ +// printf("At%d, StartVAxisRun, vrsta=0x%x, vrsta1=0x%x\r\n", Get100UsSoftTimer(), GetRunStatus(), GetRunStatus1()); + runcircle--; // С + if (runcircle == 0) + { + if (runrepeat != 0) + { + runrepeat--; + runcircle = circlenum; + } + } + bufsel = ~bufsel; // лbuf + } + + // ȴ˶ + rslt = 0; + do + { + err = 0; + //---------- + if (slowSta != 0 && slowpps != pCtrl->spdPara.slowPPS) + { + printf("reset slowsta when speed change\r\n"); + slowSta = 0; + } + slowpps = pCtrl->spdPara.slowPPS; // ½ٶ + //---------- + + { + int count = 100; + do + { + // õ״̬ + tmp16 = GetRunStatus(); + vrsta = GetRunStatus(); + +// printf("1. run sta =0x%x\r\n", vrsta); + + while(tmp16 != vrsta) // ȶֵ + { +// printf("1. run sta not same, old=0x%x, new=0x%x\r\n", tmp16, vrsta); + tmp16 = vrsta; + vrsta = GetRunStatus(); + } + + if ( (vrsta & (vAxisBuf1Finish|vAxisBuf1Running)) != (vAxisBuf1Finish|vAxisBuf1Running) && + (vrsta & (vAxisBuf2Finish|vAxisBuf2Running)) != (vAxisBuf2Finish|vAxisBuf2Running) ) // ɱ־б־ͬʱЧʱпǶȡ + { + break; + } + + printf("1. rd sta err, sta=0x%x, count=%d\r\n", vrsta, 100-count); + + }while(count--); + + if (count == 0) + { + printf("rd fpga data timout\r\n"); + StopVAxisRun(vAxisId); + rslt = -3; // fpga д + break; + } + + + if ((vrsta & vAxisBuf1Finish) != 0) // Ỻ1ִɱ־ + { + SetVAxisConfig(vAxisCleanOv1); // 1ɱ־ + bufsta &= 0xFE; // ͷbuf1 + execcircle--; + if (execcircle == 0) + { + if (exerepeat != 0) + { + exerepeat--; + execcircle = circlenum; + } + } + curtab1num = 0; + // printf("At%d, table 1 ok, vrsta=0x%x, vsta=0x%x, vrsta1=0x%x\r\n", GetUsSoftTimer(), vrsta, GetRunStatus(), GetRunStatus1()); + } + if ((vrsta & vAxisBuf2Finish) != 0) // Ỻ2ִɱ־ + { + SetVAxisConfig(vAxisCleanOv2); // 2ɱ־ + bufsta &= 0xFD; // ͷbuf2 + execcircle--; + if (execcircle == 0) + { + if (exerepeat != 0) + { + exerepeat--; + execcircle = circlenum; + } + } + curtab2num = 0; + + // printf("At%d, table 2 ok, vrsta=0x%x, vsta=0x%x, vrsta1=0x%x\r\n", GetUsSoftTimer(), vrsta, GetRunStatus(), GetRunStatus1()); + } + + if ((vrsta & AXIS_ALARM_FLAG) != 0) // ʵᱨ־ + { + err = GetAlarmValue(); // õᱨϢ + SetVAxisConfig(VCTR_AXIS_ALM_INT); // ״̬ + StopVAxisRun(vAxisId); + if (err != 0) + { + printf("1. axis alarm value=0x%x\r\n", err); + } + rslt = 1; // ͣ + break; + } + else if ((vrsta & (vAxisBuf1Running | vAxisBuf2Running)) == 0) // ݶִɣûЧ + { +#if (0) + temp16 = GetRunStatus1(); + if ((temp16 & (vAxisBuf1En|vAxisBuf2En)) == 0) +#endif + { + // printf("At%d, no more data in two buff in InterpolationMotion\r\n", GetUsSoftTimer()); + StopVAxisRun(vAxisId); + if (pCtrl->stopMode == STOP_MODE_TAB) + { +// printf("stop at tab end\r\n"); + + if (brksta == 1) + { + rslt = 3; // ִֹͣͣһ + } + else // if (nstpsta == 1) + { + rslt = 4; // ִͨͣͣһ + } + } + else + { +// printf("stop when spd low, execcircle=%d,exerepeat=%d\r\n", execcircle, exerepeat); + if (execcircle == 0 && exerepeat == 0) + { + /* + * 20221124 + * ִɵȼ + * ֹͣ,ɺǡִ,Ϊͣ,ֹͣͣ + */ + rslt = 0; + } + else + { + rslt = -2; // Чݣ˳ + } + } + break; + } + } + } + + // ֹͣж + if (pCtrl->GetEmergencyStop != NULL) // ͣ + { + err = pCtrl->GetEmergencyStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; + StopVAxisRun(vAxisId); + printf("1. emergency stop 3, err=0x%x\r\n", err); + rslt = 2; // ֹֹͣͣͣ巢 + break; + } + } + + if (inbrk != 0 || (brksta != 1 && pCtrl->GetQuickStop != NULL)) // ͣ + { + if (inbrk == 0) + { + err = pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; +// printf("quick stop in InterpolationMotion, err=0x%x\r\n", err); + } + } + + if (err != 0 || inbrk != 0) + { + // ӵǰٶȽٵֹͣҪλ + if (pCtrl->stopMode == STOP_MODE_TAB) + { + u32 curpps, curmvmt, decCount, resdcount; + curpps = GetVAxisPPS(vAxisId); // ǰٶ + decCount = CalcDisplacement(curpps, stoppps, brkppsg); // ԵǰٶȼٵֹͣٶҪλ + curmvmt = GetVAxisCounter(vAxisId); // ǰн + + // ״̬ + tmp16 = GetRunStatus(); + vrsta = GetRunStatus(); + while(tmp16 != vrsta) + { +// printf("3. run sta not same, old=0x%x, new=0x%x\r\n", tmp16, vrsta); + tmp16 = vrsta; + vrsta = GetRunStatus(); + } + +// printf("cur vaxis counter=%d, vrsta=0x%x\r\n", curmvmt, vrsta); + resdcount = 0; + if (decCount > (curtab1num+curtab2num-curmvmt)) // Ҫ + { + inbrk = 1; // ý뽵״̬Ҫݺͼٵ + } + else + { + // жϵǰеıǸ + if ((vrsta & vAxisBuf1Running) != 0) // 1ִ + { + if (decCount < (curtab1num-curmvmt)) + { + resdcount = (curtab1num-curmvmt); + SetVAxisConfig(vAxisDisBuf2); // ȡ2 + } + } + else if ((vrsta & vAxisBuf2Running) != 0) // 2ִ + { + if (decCount < (curtab2num-curmvmt)) + { + resdcount = (curtab2num-curmvmt); + SetVAxisConfig(vAxisDisBuf1); // ȡ1 + } + } + + if (resdcount == 0) + { + resdcount = (curtab1num+curtab2num-curmvmt); + } + + brkppsg = CalcGapTime(decCount*num, curpps, stoppps); // λƣ¼ɲٶ + + inbrk = 0; // ٽ + stopfill = 1; // + } + } + + // + brksta = 1; // ɲ״̬ + + vAxisCmd.vaxisId = vAxisId; + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = brkppsg; + vAxisCmd.runPPS = stoppps; + vAxisCmd.startPPS = stoppps; // ٽ٣ֹͣ + StartVAxisRun(&vAxisCmd); + } + } + + if (innstp != 0 || nstpsta != 1) // һֹͣ + { + if (innstp == 0 && nstpsta != 1) + { + if (pCtrl->GetNormalStop != NULL) + { + err = pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->errInfo = err; +// printf("normal stop 2 in InterpolationMotion, err=0x%x\r\n", err); + } + } + } + + if (err != 0 || innstp != 0) + { + // ӵǰٶȽٵֹͣҪλ + if (pCtrl->stopMode == STOP_MODE_TAB) + { + u32 curpps, curmvmt, decCount, resdcount; + curpps = GetVAxisPPS(vAxisId); // ǰٶ + decCount = CalcDisplacement(curpps, stoppps, decppsg); // ԵǰٶȼٵֹͣٶҪλ + curmvmt = GetVAxisCounter(vAxisId); // ǰн + // ״̬ + + tmp16 = GetRunStatus(); + vrsta = GetRunStatus(); + while(tmp16 != vrsta) + { +// printf("4. run sta not same, old=0x%x, new=0x%x\r\n", tmp16, vrsta); + tmp16 = vrsta; + vrsta = GetRunStatus(); + } +// printf("cur vaxis counter=%d, vrsta=0x%x\r\n", curmvmt, vrsta); + resdcount = 0; + if (decCount > (curtab1num+curtab2num-curmvmt)) // Ҫ + { + innstp = 1; // ý뽵״̬Ҫݺͼٵ + } + else + { + // жϵǰеıǸ + if ((vrsta & vAxisBuf1Running) != 0) // 1ִ + { + if (decCount < (curtab1num-curmvmt)) + { + resdcount = (curtab1num-curmvmt); + SetVAxisConfig(vAxisDisBuf2); // ȡ2 + } + } + else if ((vrsta & vAxisBuf2Running) != 0) // 2ִ + { + if (decCount < (curtab2num-curmvmt)) + { + resdcount = (curtab2num-curmvmt); + SetVAxisConfig(vAxisDisBuf1); // ȡ1 + } + } + + if (resdcount == 0) + { + resdcount = (curtab1num+curtab2num-curmvmt); + } + + decppsg = CalcGapTime(decCount*num, curpps, stoppps); // λƣ¼ɲٶ + + innstp = 0; // ٽ + stopfill = 1; // + } + } + + // + nstpsta = 1; // ͣ״̬ + + vAxisCmd.vaxisId = vAxisId; + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = decppsg; + vAxisCmd.runPPS = stoppps; + vAxisCmd.startPPS = stoppps; // ٽ٣ֹͣ + StartVAxisRun(&vAxisCmd); + } + } + + if (pCtrl->GetSlowDown != NULL) // + { + tmp16 = pCtrl->GetSlowDown(pCtrl->condPara1, pCtrl->condPara2); + if (tmp16 != 0) + { + if (slowSta == 0) // ǽ״̬ + { + slowSta = 1; // Ϊ״̬ +// printf("in slow down sta, slowpps=%d, tslppsg=%d\r\n", slowpps, tslppsg); + vAxisCmd.vaxisId = vAxisId; //ʹ + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = tslppsg; + vAxisCmd.runPPS = slowpps; + vAxisCmd.startPPS = slowpps; + StartVAxisRun(&vAxisCmd); // + } + } + else + { + if (slowSta == 1) // ڽ״̬ + { + slowSta = 0; + // printf("out slow down sta\r\n"); + StopSpdCtrl(vAxisId); // ָٶ + } + } + } + + // ɲ + if ((brksta == 1 || nstpsta == 1) && pCtrl->stopMode == STOP_MODE_SPD) // ֹͣɲ״̬ٶȵֹͣƵͣģʽ + { + val32 = GetVAxisPPS(vAxisId); // ȡǰƵ + if (val32 <= stoppps) // ƵСֹͣƵʣֹͣ + { + if (brksta == 1) + { + rslt = 3; // ֹͣͣٶȵͣٶ + } + else // if (nstpsta == 1) + { + rslt = 4; // ͨͣͣٶȵͣٶ + } + break; + } + else + { +// printf(">stoppps\r\n"); + } + } + + // + if (GetMotosCounter(position) == 0) + { + RefreshMotosPos(position); // ¸λ + if (pCtrl->RefreshPosition != NULL) + { + pCtrl->RefreshPosition(pCtrl->refPosPara, position); + } + } + else + { + rslt = 5; + } + + }while(0); // exerepeat == 0 && execcircle == 1); + + if (rslt != 0) + { + break; + } + } + + StopVAxisRun(vAxisId); + + if (pCtrl->WorkAfterRun != NULL) + { + pCtrl->WorkAfterRun(pCtrl->workPara1, pCtrl->workPara2); + } + + if (pCtrl->Delay != NULL) + { + // pCtrl->Delay(100); + } + + // + if (GetMotosCounter(position) == 0) + { + RefreshMotosPos(position); // ¸λ + + if (pCtrl->RefreshPosition != NULL) + { + pCtrl->RefreshPosition(pCtrl->refPosPara, position); + } + } + else + { + rslt = 5; + } + + if (rslt == 0) + { + pCtrl->errInfo = 0; + } + + return rslt; +} + +#endif + +//------------------------------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------------------------------ + +// ܣֱ߲岹˶ƣ֧6˶ ֧12 +// 岹ƽṹָ +// : 0˶ִɡ +// -1 +// -2ִйݲʱ˳ +// -3 FPGA д +// -4 FPGA 汾 +// =1, ͣ +// =2, ֹͣͣ +// =3, ֹͣͣ +// =4, ͨͣͣ +// =5,ȡ + +#if (1) + +int ContinuousInterpolation(ContinuousInterMoveCtrl * pCtrl) +{ + int i, j, rslt, err; + int bufsta, bufsel; // ״̬,ѡ + u16 vrsta, tmp16; // ״̬ + u16 vAxisId; + u32 decPPSG, decCount; + + u16 vAxisCleanOv1, vAxisCleanOv2; + u16 vAxisBuf1Finish, vAxisBuf2Finish; // Ỻ1ɱ־,Ỻ2ɱ־ + u16 vAxisBuf1Running, vAxisBuf2Running; // Ỻ1ִб־,Ỻ2ִб־ +// u16 vAxisDisBuf1, vAxisDisBuf2; + + s32 position[AXIS_NUM]; + + VAxisCmdStr vAxisCmd; + InterData idata; + + // ------------------------------------------------------------------------ + // Ϸж + if (pCtrl == NULL) + { + printf("para error in ContinuousInterpolation\r\n"); + rslt = -1; // + return rslt; + } + + if (pCtrl->vAxisId != VAXIS_ID1) + { + printf("para vAxisId error in ContinuousInterpolation\r\n"); + rslt = -1; // + return rslt; + } + + for (i = 0; i < AXIS_NUM; i++) // ͳһʵٶԴ + { + pCtrl->motosConfig.axisConfig[i].spdSource = MAKE_POUT_CMD(pCtrl->vAxisId); + } + + // ------------------------------------------------------------------------ + + if (pCtrl->GetEmergencyStop != NULL) // ֹͣ + { + err = pCtrl->GetEmergencyStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->mvData.errInfo = err; + printf("emergency stop 1 in ContinuousInterpolation, err=0x%x\r\n", err); + rslt = 2; // ֹֹͣͣͣ巢 + return rslt; + } + } + + if (pCtrl->GetQuickStop != NULL) // ֹͣ + { + err = pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->mvData.errInfo = err; + printf("quick stop 1 in ContinuousInterpolation, err=0x%x\r\n", err); + rslt = 3; // ֹͣͣ + return rslt; + } + } + + if (pCtrl->GetNormalStop != NULL) // һֹͣ + { + err = pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->mvData.errInfo = err; + printf("normal stop 1 in ContinuousInterpolation, err=0x%x\r\n", err); + rslt = 4; // ͨͣͣ + return rslt; + } + } + + // ѡ + SetMotosConfig(&(pCtrl->motosConfig)); + + // ȴִ + if (pCtrl->Delay != NULL && pCtrl->motosConfig.newConfig != 0) + { + pCtrl->Delay(100); + } + + bufsta = 0; + bufsel = 0; + decCount = 0; + pCtrl->mvData.fillLimit = 0; + + decPPSG = MIN_GAP; + + pCtrl->mvData.errInfo = 0; + + vAxisId = pCtrl->vAxisId; + + if (vAxisId == VAXIS_ID1) + { + vAxisCleanOv1 = VCTR_VAXIS1_CLEAN_OV1; + vAxisCleanOv2 = VCTR_VAXIS1_CLEAN_OV2; + + vAxisBuf1Finish = VAXIS1_BUF1_FINISH; + vAxisBuf2Finish = VAXIS1_BUF2_FINISH; + + vAxisBuf1Running = VAXIS1_BUF1_RUNNING; + vAxisBuf2Running = VAXIS1_BUF2_RUNNING; + +// vAxisDisBuf1 = VCTR_VAXIS1_DIS_BUF1; +// vAxisDisBuf2 = VCTR_VAXIS1_DIS_BUF2; + } + else + { + printf("not support vaxis\r\n"); + } + + if (pCtrl->WorkBeforeRun != NULL) + { + pCtrl->WorkBeforeRun(pCtrl->workPara1, pCtrl->workPara2); + } + + SetVAxisConfig(VCTR_AXIS_ALM_INT); // ״̬ + memset(&idata, 0, sizeof(InterData)); + + do + { + pCtrl->mvData.bufsta = bufsta; + // ˢ + if (pCtrl->RefreshData != NULL) + { + rslt = pCtrl->RefreshData(pCtrl->refDatPara, (u32)(&(pCtrl->mvData))); + } + + // + if (GetMotosCounter(position) == 0) + { + RefreshMotosPos(position); // ¸λ + if (pCtrl->RefreshPosition != NULL) + { + pCtrl->RefreshPosition(pCtrl->refPosPara, position); + } + } + else + { + rslt = 5; + break; + } + + // + if ((bufsta & 0x03) != 0x03 && pCtrl->mvData.mvmtStatus != 0) // BuffпУһʱ + { + if (pCtrl->mvData.runstat != CRST_BREAK || pCtrl->mvData.fillLimit > 0) // ɲ ɲ + { + if (pCtrl->mvData.fillLimit > 0) + { + pCtrl->mvData.fillLimit--; + } + + // дIJ岹 + for (i = 0; i < AXIS_NUM; i++) + { + if (pCtrl->mvData.mvmtdat.segmnetNum[i] != 0) // Ч + { + idata.datBufLen = pCtrl->mvData.mvmtdat.segmnetNum[i]; // Чθ + // öβ岹Ҫʵ + //-------------------------- + idata.axisId = g_axisIDList[i]; // ʵѡ + idata.vaxisId = vAxisId; // ʹ + if (bufsel == 0) // ѡ + { + idata.bufSel = BUF_SEL1; // 1 + } + else + { + idata.bufSel = BUF_SEL2; // 2 + } + idata.startEscNum = pCtrl->mvData.mvmtdat.startEsc[i]; // ʼ + idata.partVxNum = pCtrl->mvData.mvmtdat.vppSegment[i]; // ÿζӦ + //---------------- 20220531 ޸ÿ + if ((idata.partVxNum * SUPPORT_SEGMENT) < pCtrl->mvData.mvmtdat.interLong) + { + idata.partVxNum = (pCtrl->mvData.mvmtdat.interLong+SUPPORT_SEGMENT-1) / SUPPORT_SEGMENT; + } + //----------------- 20220531 ޸ÿ + idata.dirAttr = AXIS_DIR_USEBUF; // ʹöڷ + + // + for (j = 0; j < pCtrl->mvData.mvmtdat.segmnetNum[i]; j++) + { + idata.datBuff[j] = pCtrl->mvData.mvmtdat.movement[i][j]; // ݶ + } + + idata.datBuff[j] = 0; + idata.datBufLen += 1; + + idata.sineOut = pCtrl->mvData.mvmtdat.sineOut[i]; // ģʽ + + //printf("HEX:%d.datBuff[0]=0x%x\r\n", i+1, idata.datBuff[0]); + //printf("DEC:%d.datBuff[0]=%d\r\n", i+1, idata.datBuff[0]); + + rslt = WriteInterData(&idata); + if (rslt < 0) + { + return rslt; + } + //printf("axis %d wt, c=%d\r\n", i+1, idata.datBuff[0]); + } + else + { + if (bufsel == 0) + { + CleanAxisBuff(g_axisIDList[i], BUF_SEL1); + } + else + { + CleanAxisBuff(g_axisIDList[i], BUF_SEL2); + } + } + } + + // ˶, + vAxisCmd.vaxisId = vAxisId; // ʹ + if (bufsel == 0) + { + bufsta |= 0x01; + vAxisCmd.bufSel = BUF_SEL1; +// curtab1num = pCtrl->mvData.interLong; +// printf("write buff1\r\n"); + } + else + { + bufsta |= 0x02; + vAxisCmd.bufSel = BUF_SEL2; +// curtab2num = pCtrl->mvData.interLong; +// printf("write buff2\r\n"); + } + + // printf("write add vtable\r\n"); + vAxisCmd.startPPS = pCtrl->mvData.lowPPS; // ٶ + vAxisCmd.runPPS = pCtrl->mvData.runPPS; // ٶ + vAxisCmd.jumpNum = 0; // + vAxisCmd.calcGap = pCtrl->mvData.calcGap; // ʱ + vAxisCmd.outNum = pCtrl->mvData.mvmtdat.interLong; // 岹 + rslt = StartVAxisRun(&vAxisCmd); // д + if (rslt < 0) + { + break; + } + bufsel = ~bufsel; // лbuf + pCtrl->mvData.fillCount++; // ݼ +// pCtrl->mvData.runIdx++; // м + pCtrl->mvData.mvmtStatus = 0; // ִб־ + } + } + + // ȴ˶ + rslt = 0; + err = 0; + + { + // õ״̬ + // Ϊ˵õһȷ״̬ + tmp16 = GetRunStatus(); + vrsta = GetRunStatus(); + while(tmp16 != vrsta) + { +// printf("5. run sta not same, old=0x%x, new=0x%x\r\n", tmp16, vrsta); + tmp16 = vrsta; + vrsta = GetRunStatus(); + } + tmp16 = GetRunStatus(); + vrsta = GetRunStatus(); + while(tmp16 != vrsta) + { +// printf("6. run sta not same, old=0x%x, new=0x%x\r\n", tmp16, vrsta); + tmp16 = vrsta; + vrsta = GetRunStatus(); + } + + if ((vrsta & (vAxisBuf1Finish|vAxisBuf2Finish)) != 0) // Ỻ12 + { + if (pCtrl->mvData.runstat != CRST_NORMAL) // ڽֹͣ״̬ɲ״̬ʱִһ¼ٶ + { + s32 inmvmt; + // ٶ + u32 curpps = GetVAxisPPS(vAxisId); // ǰٶ + + inmvmt = decCount; + // inmvmt -= 1; + if (inmvmt > 0) + { + inmvmt *= pCtrl->mvData.mvmtdat.interLong; + + // ¼ٶ + decPPSG = CalcGapTime(inmvmt, curpps, pCtrl->mvData.lowPPS); + + // printf("pCtrl->mvData.runstat=%d, curpps=%d, mvmt=%d, lopps=%d, recalc decPPSG=%d\r\n", pCtrl->mvData.runstat, curpps, inmvmt, pCtrl->mvData.lowPPS, decPPSG); + + vAxisCmd.vaxisId = vAxisId; // ʹ + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = decPPSG; + vAxisCmd.runPPS = pCtrl->mvData.lowPPS; + vAxisCmd.startPPS = pCtrl->mvData.lowPPS; + rslt = StartVAxisRun(&vAxisCmd); // + if (rslt < 0) + { + break; + } + } + } + + if ((vrsta & vAxisBuf1Finish) != 0) // Ỻ1ɱ־ + { + SetVAxisConfig(vAxisCleanOv1); // 1ɱ־ + bufsta &= 0xFE; // ͷbuf1 + pCtrl->mvData.execCount++; // ִ + pCtrl->mvData.lastEndPPS = GetLastVAxisFrequency(vAxisId); + + pCtrl->mvData.exeingIdx = pCtrl->dataBegIndex+pCtrl->mvData.emptyCount+pCtrl->mvData.execCount; // ִݵһݣ = ʼ++Ѿִ + // printf("table 1 ok, datidx=%d, endpps=%d\r\n", iddx, pCtrl->mvData.lastEndPPS); + // printf("table 1 ok, exeingidx=%d, endpps=%d\r\n", pCtrl->mvData.exeingIdx, pCtrl->mvData.lastEndPPS); + + if (pCtrl->mvData.runstat == CRST_BREAK) // ٺ󣬵һлʼ + { + if (decCount != 0) + { + decCount--; // ִȦ + } + // printf("in break, table 1 ok, exeingIdx=%d, decCount=%d, endpps=%d\r\n", pCtrl->mvData.exeingIdx, decCount, pCtrl->mvData.lastEndPPS); + } + } + + if ((vrsta & vAxisBuf2Finish) != 0) // Ỻ2ɱ־ + { + SetVAxisConfig(vAxisCleanOv2); // 2ɱ־ + bufsta &= 0xFD; // ͷbuf2 + pCtrl->mvData.execCount++; // ִ + pCtrl->mvData.lastEndPPS = GetLastVAxisFrequency(vAxisId); + + pCtrl->mvData.exeingIdx = pCtrl->dataBegIndex+pCtrl->mvData.emptyCount+pCtrl->mvData.execCount; // ִݵһݣ = ʼ++Ѿִ + // printf("table 2 ok, datidx=%d, endpps=%d\r\n", iddx, pCtrl->mvData.lastEndPPS); + // printf("table 2 ok, exeingidx=%d, endpps=%d\r\n", pCtrl->mvData.exeingIdx, pCtrl->mvData.lastEndPPS); + + if (pCtrl->mvData.runstat == CRST_BREAK) // ٺ󣬵һлʼ + { + if (decCount != 0) + { + decCount--; // ִȦ + } + // printf("in break, table 2 ok, exeingIdx=%d, decCount=%d, endpps=%d\r\n", pCtrl->mvData.exeingIdx, decCount, pCtrl->mvData.lastEndPPS); + } + } + } + + if ((vrsta & AXIS_ALARM_FLAG) != 0) // ʵᱨ־ + { + err = GetAlarmValue(); // õᱨϢ + SetVAxisConfig(VCTR_AXIS_ALM_INT); // ״̬ + if (err != 0) + { + printf("2. axis alarm value=0x%x\r\n", err); + } + rslt = 1; // ͣ + break; + } + else if ((vrsta & (vAxisBuf1Running | vAxisBuf2Running)) == 0) // ݶִɣûЧ + { + if (pCtrl->mvData.waitNoData == 0) + { + rslt = 0; // Чݣ +// printf("no more data in two buff in ContinuousInterpolation, err=0x%x\r\n", pCtrl->mvData.errInfo); + break; + } + else + { +// printf("wait when no data\r\n"); + } + } + } + + if (pCtrl->GetEmergencyStop != NULL) // ͣ + { + err = pCtrl->GetEmergencyStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + pCtrl->mvData.errInfo = err; + printf("2. emergency stop 3, err=0x%x\r\n", err); + rslt = 2; // ֹֹͣͣͣ巢 + break; + } + } + + if (pCtrl->mvData.runstat == CRST_NORMAL && pCtrl->GetQuickStop != NULL) // ֹͣ + { + err = pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2); + if (err != 0) + { + // printf("quick stop, enter break status, rslt=0x%x\r\n", err); + pCtrl->mvData.errInfo = err; + + // õǰٶΪٶȣٶȲ + decPPSG = pCtrl->qstopPPSG; + + vAxisCmd.vaxisId = vAxisId; // ʹ + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = decPPSG; + vAxisCmd.runPPS = GetVAxisPPS(vAxisId); + vAxisCmd.startPPS = pCtrl->mvData.lowPPS; + rslt = StartVAxisRun(&vAxisCmd); + if (rslt < 0) + { + break; + } + // ԵǰٶȼٵֹͣٶҪλ + decCount = CalcDisplacement(vAxisCmd.runPPS, vAxisCmd.startPPS, decPPSG); + if (pCtrl->mvData.mvmtdat.interLong != 0) + { + decCount += pCtrl->mvData.mvmtdat.interLong-1; + decCount /= pCtrl->mvData.mvmtdat.interLong; // õҪȦ + } + else + { + printf("1. Err: interLong==0\r\n"); + } + + //printf("1. runpps=%d, lowPPS=%d, calcGap=%d, decCount=%d\r\n", vAxisCmd.runPPS, vAxisCmd.startPPS, vAxisCmd.calcGap, decCount); + + pCtrl->mvData.fillLimit = decCount+pCtrl->mvData.execCount-pCtrl->mvData.fillCount; // Ҫݼ + + /* 20220406 ljs +1 + * ȦdecCount,ֵȷ + * pCtrl->mvData.execCountִɼֵ + * pCtrl->mvData.fillCountֵ + * ִе˴ʱ,һһִ,һѾ + * ִеıDzܽٵ,ֻδִеıǿԽٵ + * Ƽóֵһ + * ,ʱִе113,Ѿ˵114,ô113벻ǽ,ӵ114뿪ʼ + * ֵΪ65,ʱִɼֵΪ63(Ϊ113δִ,ʲֵΪ2) + * Ҫ4Ȧ,ô114,115,116,117Ҫ,ҿԽٵĿٶ + * 㷽ʽֵΪ2,ɼִе115,116,117Ȼ, + * ΪʱֵΪ0,Ȼ,ִ + * ʵֻ3ڽ + * ΪʲôٲĿٶȵԭ + */ + pCtrl->mvData.fillLimit += 1; + + //printf("1. fill limit=%d, decCount=%d,fillCount=%d,exeCount=%d\r\n", pCtrl->mvData.fillLimit, decCount,pCtrl->mvData.fillCount,pCtrl->mvData.execCount); + if (pCtrl->mvData.fillLimit < 0) + { + // printf("1. no need to fill data\r\n"); + pCtrl->mvData.fillLimit = 0; + } + pCtrl->mvData.runstat = CRST_QSTOP; // ͣ״̬ + } + } + + if (pCtrl->mvData.runstat == CRST_NORMAL && pCtrl->GetNormalStop != NULL) // һֹͣ + { + err = pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2); + + if (err != 0) + { + // printf("normal stop, enter break status, rslt=0x%x\r\n", err); + pCtrl->mvData.errInfo = err; + + // õǰٶΪٶȣٶȲ + decPPSG = pCtrl->nstopPPSG; + + vAxisCmd.vaxisId = vAxisId; // ʹ + vAxisCmd.bufSel = BUF_SEL3; + vAxisCmd.calcGap = decPPSG; + vAxisCmd.runPPS = GetVAxisPPS(vAxisId); + vAxisCmd.startPPS = pCtrl->mvData.lowPPS; + rslt = StartVAxisRun(&vAxisCmd); + if (rslt < 0) + { + break; + } + // ԵǰٶȼٵֹͣٶҪλ + decCount = CalcDisplacement(vAxisCmd.runPPS, vAxisCmd.startPPS, decPPSG); + + if (pCtrl->mvData.mvmtdat.interLong != 0) + { + decCount += pCtrl->mvData.mvmtdat.interLong-1; + decCount /= pCtrl->mvData.mvmtdat.interLong; // õҪȦ + } + else + { + printf("2. Err: interLong==0\r\n"); + } + //printf("2. runpps=%d, lowPPS=%d, calcGap=%d, decCount=%d\r\n", vAxisCmd.runPPS, vAxisCmd.startPPS, vAxisCmd.calcGap, decCount); + + pCtrl->mvData.fillLimit = decCount+pCtrl->mvData.execCount-pCtrl->mvData.fillCount; // Ҫݼ + + // 20220406 ljs +1 + pCtrl->mvData.fillLimit += 1; + + //printf("2. fill limit=%d, decCount=%d,fillCount=%d,exeCount=%d\r\n", pCtrl->mvData.fillLimit, decCount,pCtrl->mvData.fillCount,pCtrl->mvData.execCount); + if (pCtrl->mvData.fillLimit < 0) + { + // printf("1. no need to fill data\r\n"); + pCtrl->mvData.fillLimit = 0; + } + pCtrl->mvData.runstat = CRST_NSTOP; // ͣ״̬ + } + } + + }while(1); + + StopVAxisRun(vAxisId); + + if (pCtrl->WorkAfterRun != NULL) + { + pCtrl->WorkAfterRun(pCtrl->workPara1, pCtrl->workPara2); + } + + + // + if (GetMotosCounter(position) == 0) + { + RefreshMotosPos(position); // ¸λ + if (pCtrl->RefreshPosition != NULL) + { + pCtrl->RefreshPosition(pCtrl->refPosPara, position); + } + } + else + { + rslt = 5; + } + + return rslt; +} + +#endif + + + + + + + + + + + + + + + diff --git a/EMBOS/Users/EmbBase/motos.h b/EMBOS/Users/EmbBase/motos.h new file mode 100644 index 0000000..732943b --- /dev/null +++ b/EMBOS/Users/EmbBase/motos.h @@ -0,0 +1,327 @@ + +#ifndef __MOTOS_H__ +#define __MOTOS_H__ + +//------------------------------------------------------------------------------- + +#include "embfpga.h" + +//------------------------------------------------------------------------------- + +#define AXIS_NUM 6 // ĸ + +//------------------------------------------------------------------------------- +// ýṹ +typedef struct +{ + u16 axisConfig; // ʵ + u16 poutType; // ģʽ(CW/CCWPULSE/DIR) + u16 spdSource; // ʵٶȿ(123) + u16 datSource; // ʵݻȡ(Ӳ岹涯ӳ) +}AxisConfig; + + +#ifdef _IN_MOTOS_C + + + +#endif +//------------------------------------------------------------------------------- +//--------------------------------------------------------------- + + +typedef struct +{ + int enFlag; + s32 motosPos[AXIS_NUM]; + +}MotosPara; + +#ifdef _IN_MOVECTRL_C + +MotosPara g_motosPara; + +#else + +extern MotosPara g_motosPara; + +#endif + +//--------------------------------------------------------------- +// ʵ +/* + --------------------------------------------------------------------------------------------------------------------------------- + | b0 | b1 | b2 | b3 | b4 | b5 | b6 | b7 | + --------------------------------------------------------------------------------------------------------------------------------- + | | A | B | ŷON | ͣ | ƽѡ | | | + --------------------------------------------------------------------------------------------------------------------------------- + --------------------------------------------------------------------------------------------------------------------------------- + | b8 | b9 | b10 | b11 | b12 | b13 | b14 | b15 | + --------------------------------------------------------------------------------------------------------------------------------- + | | | | | | | | | + --------------------------------------------------------------------------------------------------------------------------------- + + // ijλΪ1Ӧź +*/ + +#define POUT_EN 0x0001 // +#define POA_EN 0x0002 // A +#define POB_EN 0x0004 // B +#define SON_EN 0x0008 // ŷON + +#define ALM_EN 0x0010 // ͣ +#define ALM_LEVH 0x0020 // ƽΪ + +#define CONFIG_EN 0x8000 // + +#define DEFAULT_CFG (CONFIG_EN|SON_EN|ALM_LEVH) // Ĭ + +#define IO_CTRL_CFG (CONFIG_EN|ALM_EN|ALM_LEVH) // IOƵ + +// ޱ +#define MOTOEN_CFG_NALM (CONFIG_EN|POUT_EN|SON_EN|ALM_LEVH) // ͨõ +#define MOTOENA_CFG_NALM (CONFIG_EN|POUT_EN|POA_EN|SON_EN|ALM_LEVH) // ͨõ +#define MOTOENB_CFG_NALM (CONFIG_EN|POUT_EN|POB_EN|SON_EN|ALM_LEVH) // ͨõ +#define MOTOENAB_CFG_NALM (CONFIG_EN|POUT_EN|POA_EN|POB_EN|SON_EN|ALM_LEVH) // ͨõ + +// б +#define MOTOEN_CFG (CONFIG_EN|POUT_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTOENA_CFG (CONFIG_EN|POUT_EN|POA_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTOENB_CFG (CONFIG_EN|POUT_EN|POB_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTOENAB_CFG (CONFIG_EN|POUT_EN|POA_EN|POB_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ + +// б(͵ƽ) +#define MOTOEN_CFG_LALM (CONFIG_EN|POUT_EN|SON_EN|ALM_EN) // ͨõ +#define MOTOENA_CFG_LALM (CONFIG_EN|POUT_EN|POA_EN|SON_EN|ALM_EN) // ͨõ +#define MOTOENB_CFG_LALM (CONFIG_EN|POUT_EN|POB_EN|SON_EN|ALM_EN) // ͨõ +#define MOTOENAB_CFG_LALM (CONFIG_EN|POUT_EN|POA_EN|POB_EN|SON_EN|ALM_EN) // ͨõ + +// ޱ +#define MOTO3EN_CFG_NALM (CONFIG_EN|POUT_EN|ALM_LEVH) // ͨõ +#define MOTO3ENA_CFG_NALM (CONFIG_EN|POUT_EN|POB_EN|ALM_LEVH) // ͨõ +#define MOTO3ENB_CFG_NALM (CONFIG_EN|POUT_EN|POA_EN|ALM_LEVH) // ͨõ +#define MOTO3ENC_CFG_NALM (CONFIG_EN|POUT_EN|POA_EN|POB_EN|SON_EN|ALM_LEVH) // ͨõ +#define MOTO3ENABC_CFG_NALM (CONFIG_EN|POUT_EN|SON_EN|ALM_LEVH) // ͨõ + +// б +#define MOTO3EN_CFG (CONFIG_EN|POUT_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTO3ENA_CFG (CONFIG_EN|POUT_EN|POB_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTO3ENB_CFG (CONFIG_EN|POUT_EN|POA_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTO3ENC_CFG (CONFIG_EN|POUT_EN|POA_EN|POB_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ +#define MOTO3ENABC_CFG (CONFIG_EN|POUT_EN|SON_EN|ALM_EN|ALM_LEVH) // ͨõ + + +//--------------------------------------------------------------- + +#define POUTA_EN MOUT_SEL_HIGH // AΪߵƽ +#define POUTA_DIS MOUT_SEL_LOW // AֹΪ͵ƽ +#define POUTB_EN MOUT_EN_HIGH // BΪߵƽ +#define POUTB_DIS MOUT_EN_LOW // BֹΪ͵ƽ +#define SERVO_OFF MOUT_SON_HIGH // ŷOFFΪߵƽ +#define SERVO_ON MOUT_SON_LOW // ŷONΪ͵ƽ + +//--------------------------------------------------------------- + +// ýṹ +typedef struct +{ + int newConfig; // ñ־= 0Ҫдãʹ; != 0µãҪд룬ͬʱˢ¼¼ + + // + AxisConfig axisConfig[AXIS_NUM]; + +}MotosConfig; + +// λýṹ +typedef struct +{ + s32 movement[AXIS_NUM]; // ˶0˶˶ȣλp + u32 extraRepeat; // ظ0ظظmovement˶ֱ죩 + u32 interLong; // 岹λƣڻmovementеֵ + u32 pulsePerSegment; // ÿ + +}MovementCtrl; + + +// ٶȽṹ +typedef struct +{ + u32 startPPS; // ٶ + u32 stopPPS; // ֹͣٶ + u32 runPPS; // ˶ٶ + u32 slowPPS; // ٶ + u32 addPPSG; // ټٶ + u32 decPPSG; // ټٶ + u32 brkPPSG; // ɲٶ +}SpeedCtrl; + +//--------------------------------------------------------------- +// ֱ߲岹˶ƽṹ +typedef struct +{ + u32 vAxisId; // ʹID + + MotosConfig motosConfig; // + + MovementCtrl mvmtPara; // λƿƲ + + SpeedCtrl spdPara; // ٶȿƲ + + int stopMode; // ֹͣ˶ʽ + // 0ٵֹͣٶֹͣ + // 1٣лʱֹͣ + + int errInfo; // Ϣ + + // ص + void (*Delay)(u32); // ʱص + + void (*RefreshPosition)(u32, s32*); // ˢ»ص + u32 refPosPara; // ˢ² + + int (*WorkBeforeRun)(u32, u32); // ǰ׼ص + int (*WorkAfterRun)(u32, u32); // к׼ص + u32 workPara1, workPara2; // + + int (*GetSlowDown)(u32,u32); // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + int (*GetEmergencyStop)(u32,u32); // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + u32 condPara1, condPara2; // + +}InterMoveCtrl; + +// ֲ֧岹 +#define MAX_INTER_SIZE S32_MAX + +#define STOP_MODE_SPD 0 // ٶȵٶֹͣ +#define STOP_MODE_TAB 1 // ڱɺֹͣ + + + +#define TOSLOWMUTI 5 +//------------------------------------------------------------------------------------------------ + +#define SUPPORT_SEGMENT 15 // ֧1, ֧16 + +typedef struct +{ + u32 interLong; // 岹λƣڻmovementеֵ + + u16 sineOut[AXIS_NUM]; // ־. 0, , 1, + u16 segmnetNum[AXIS_NUM]; // Ч֧0--100 + u32 startEsc[AXIS_NUM]; // ʼ + u32 vppSegment[AXIS_NUM]; // Ӧÿ + u16 movement[AXIS_NUM][SUPPORT_SEGMENT+1]; // ˶ + +}MovementDat; + +// ݽṹ +typedef struct +{ + // λƿƲ + s32 fillCount; // дFPGAеݼ + s32 execCount; // ִмѾִɵݼҲΪִеidx + s32 fillLimit; // ,ɲݸ + int bufsta; // ״̬ + + u32 lastEndPPS; // ϶νʱٶȣҲDZΣִжΣʼٶȣÿαʱã + u32 lastrunPPS; // ϶εٶ + + int runstat; // ״̬= 0״̬ = 1ֹͣ״̬ = 2ɲ״̬ + int errInfo; // Ϣ + int waitNoData; // ʱȴ־, = 0ȴ= 1ȴ + int emptyCount; + int dataBegIndex; // ʼ + int exeingIdx; // ִݵ + //------------ + u32 mvmtStatus; // ˶״̬0Ч1Ч + + MovementDat mvmtdat; // λ + + // ٶȿƲ + u32 lowPPS; // ٶ + u32 runPPS; // Ŀٶ + u32 calcGap; // μٶ + +}MoveSwapData; + +#define CRST_NORMAL 0 // ״̬ +#define CRST_NSTOP 1 // ֹͣ״̬ +#define CRST_QSTOP 2 // ֹͣ״̬ +#define CRST_BREAK 3 // ɲ״̬ + + +// ֱ߲岹˶ƽṹ +typedef struct +{ + u32 vAxisId; // ʹID + + MotosConfig motosConfig; // + MoveSwapData mvData; // λƺٶˢ½ṹ + + s32 dataBegIndex; + + // ͣٶȿƲ + u32 stopPPS; // ͣٶ + u32 nstopPPSG; // ֹͨͣٶ + u32 qstopPPSG; // ֹͣٶ + + // ص + void (*Delay)(u32); // ʱص + + // 亯 + int (*RefreshData)(u32, u32); // ˢº + u32 refDatPara; + + void (*RefreshPosition)(u32, s32*); // ˢ»ص + u32 refPosPara; // ˢ² + + int (*WorkBeforeRun)(u32, u32); // ǰ׼ص + int (*WorkAfterRun)(u32, u32); // ǰ׼ص + u32 workPara1, workPara2; // + + int (*GetSlowDown)(u32,u32); // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + int (*GetEmergencyStop)(u32,u32); // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + u32 condPara1, condPara2; // + +}ContinuousInterMoveCtrl; + +//------------------------------------------------------------------------------------------------ + + +// ʼ +void InitMotos(void); + +// ȡλ +int GetMotosCounter(s32 * position); + +// õλ +void SetMotosCounter(s32 * position); + +// ˢµλ +void RefreshMotosPos(s32 * poslist); + +// ȡ +s32 GetMotoCounter(int axisIdx); +void SetMotoCounter(int axisIdx, s32 pos); + +void MotoServoCtrl(int axisIdx, int onoff); + +void SetMotosConfig(MotosConfig * pConfig); // õ + + +// 岹˶֧6ͬ +int InterpolationMotion(InterMoveCtrl * pCtrl); + +// ֱ߲岹˶֧6ͬ +int ContinuousInterpolation(ContinuousInterMoveCtrl * pCtrl); + +u32 CalcDisplacement(u32 pps1, u32 pps2, u32 calcTime); // ӼҪλ +u32 CalcGapTime(u32 disp, u32 pps1, u32 pps2); // ijλٶȱ仯Ҫʱ +u32 CalcEndSpd(u32 disp, u32 pps1, s32 addgap); + + +#endif diff --git a/EMBOS/Users/EmbBase/nvpara.c b/EMBOS/Users/EmbBase/nvpara.c new file mode 100644 index 0000000..01f4029 --- /dev/null +++ b/EMBOS/Users/EmbBase/nvpara.c @@ -0,0 +1,37 @@ + +#include "nvpara.h" +#include "fram.h" +#include "paras.h" + +//------------------------------------------------ + + +//------------------------------------------------ + +int ReadNVPara(NVPara * pPara, int loc) +{ + if (loc == 1) + { + return ReadFramData(NVPARA_ADDR, (u8*)pPara, NVPARA_SIZE); + } + else + { + printf("not support loc\r\n"); + } + return -1; +} + +void SaveNVPara(NVPara * pPara, int loc) +{ + if (loc == 1) + { + WriteFramData(NVPARA_ADDR, (u8*)pPara, NVPARA_SIZE);; + } + else + { + printf("not support loc\r\n"); + } + return ; +} + + diff --git a/EMBOS/Users/EmbBase/nvpara.h b/EMBOS/Users/EmbBase/nvpara.h new file mode 100644 index 0000000..7308916 --- /dev/null +++ b/EMBOS/Users/EmbBase/nvpara.h @@ -0,0 +1,34 @@ + +#ifndef __NVPARA_H__ +#define __NVPARA_H__ + +#include "config.h" + +// ʧԴ洢Ƶı䣬ҿͻȻϵҪʱ̱ +// Non-volatile +//--------------------------- + +//--------------------------- + +#define MAX_SAVE_SIZE (256-2) // 256ֽ + +typedef struct +{ + u8 nvBuff[MAX_SAVE_SIZE]; + u16 enFlag; // Ч־ +} __attribute__ ((packed)) NVPara; + +#define NVPARA_EN DATA_VALID + +#define NVPARA_SIZE sizeof(NVPara) + + +//--------------------------- + +int ReadNVPara(NVPara * pPara, int loc); +void SaveNVPara(NVPara * pPara, int loc); + +//--------------------------- + +#endif + diff --git a/EMBOS/Users/EmbBase/paras.c b/EMBOS/Users/EmbBase/paras.c new file mode 100644 index 0000000..6682db9 --- /dev/null +++ b/EMBOS/Users/EmbBase/paras.c @@ -0,0 +1,772 @@ + +#define _IN_PARAS_C + +#include "paras.h" + +#include "shell.h" +#include "delay.h" +#include "fram.h" +#include "smec98sp.h" + +//---------------------------------------------------------- + +u32 * g_pMcParaList = NULL; // б(,СֵĬֵ) +u32 * g_pWkParaList = NULL; +u32 * g_pdefAngParaList = NULL; // ǶĬϲ + +char* * g_pMcParasName = NULL; +char* * g_pWkParasName = NULL; + +void LoadMcPara(void); +void LoadWkPara(void); +void LoadAngPara(void); + +void ShowMcPara(char * para1, char * para2); +void ShowWkPara(char * para1, char * para2); + +void SetMcPara(char * para1, char * para2); +void SetWkPara(char * para1, char * para2); + +void ShowAngPara(char * para1, char * para2); +void SetAngPara(char * para1, char * para2); + +//---------------------------------------------------------- + +void InitParas(void) +{ + LoadMcPara(); + LoadWkPara(); + + LoadAngPara(); + + AddShellCmd("SHOWMCPARA", "show the mc para", ShowMcPara); + AddShellCmd("SHOWWKPARA", "show the wk para", ShowWkPara); + AddShellCmd("SETMCPARA", "set the mc para", SetMcPara); + AddShellCmd("SETWKPARA", "set the wk para", SetWkPara); + + AddShellCmd("SHOWANG", "show the ang para", ShowAngPara); + AddShellCmd("SETANG", "set the ang para", SetAngPara); +} + +//------------------------------------------- +void LoadPara(u16 addr, u8 * pBuf, u16 len) +{ + if (len == 0 || pBuf == NULL) + { + return; + } + + ReadFramData(addr, pBuf, len); + + if (USE_SMEC == 1) // 1:ʹüоƬ (ʹüоƬÿζд30ms) + { + int i,j,k; + u8 dat[128] = {0}; + u8 rst = 0; + int jump = len / 120 +1; + + for (i=0,j=0;i *(g_pMcParaList+maxOffset)) + { + printf("mc para id=%d, val=%d more than max=%d, set to max\r\n", i+1, g_mcPara.buf[i], *(g_pMcParaList+maxOffset)); + g_mcPara.buf[i] = *(g_pMcParaList+maxOffset); + } + } + else if (*(g_pMcParaList+paratype) == PTYPE_S) + { + if ((s32)g_mcPara.buf[i] < (s32)*(g_pMcParaList+minOffset)) + { + printf("mc para id=%d, val=%d less than min=%d, set to min\r\n", i+1, (s32)g_mcPara.buf[i], (s32)*(g_pMcParaList+minOffset)); + g_mcPara.buf[i] = *(g_pMcParaList+minOffset); + } + else if ((s32)g_mcPara.buf[i] > (s32)*(g_pMcParaList+maxOffset)) + { + printf("mc para id=%d, val=%d more than max=%d, set to max\r\n", i+1, (s32)g_mcPara.buf[i], (s32)*(g_pMcParaList+maxOffset)); + g_mcPara.buf[i] = *(g_pMcParaList+maxOffset); + } + } + } +} + +void CheckAMcParaRange(int id) +{ + if (g_pMcParaList == NULL || id <= 0 || id > PARA_NUM) + { + return; + } + int paratype, minOffset, maxOffset; // ,Сֵָƫ + int idx = id - 1; + paratype = (idx * 4); + minOffset = (idx * 4 + 1); + maxOffset = (idx * 4 + 2); + if (*(g_pMcParaList+paratype) == PTYPE_U) + { + if (g_mcPara.buf[idx] < *(g_pMcParaList+minOffset)) + { + printf("mc para id=%d, val=%d less than min=%d, set to min\r\n", id, g_mcPara.buf[idx], *(g_pMcParaList+minOffset)); + g_mcPara.buf[idx] = *(g_pMcParaList+minOffset); + } + else if (g_mcPara.buf[idx] > *(g_pMcParaList+maxOffset)) + { + printf("mc para id=%d, val=%d more than max=%d, set to max\r\n", id, g_mcPara.buf[idx], *(g_pMcParaList+maxOffset)); + g_mcPara.buf[idx] = *(g_pMcParaList+maxOffset); + } + } + else if (*(g_pMcParaList+paratype) == PTYPE_S) + { + if ((s32)g_mcPara.buf[idx] < (s32)*(g_pMcParaList+minOffset)) + { + printf("mc para id=%d, val=%d less than min=%d, set to min\r\n", id, (s32)g_mcPara.buf[idx], (s32)*(g_pMcParaList+minOffset)); + g_mcPara.buf[idx] = *(g_pMcParaList+minOffset); + } + else if ((s32)g_mcPara.buf[idx] > (s32)*(g_pMcParaList+maxOffset)) + { + printf("mc para id=%d, val=%d more than max=%d, set to max\r\n", id, (s32)g_mcPara.buf[idx], (s32)*(g_pMcParaList+maxOffset)); + g_mcPara.buf[idx] = *(g_pMcParaList+maxOffset); + } + } +} + +void CheckWkParaRange(void) +{ + if (g_pWkParaList == NULL) + { + return; + } + int paratype, minOffset, maxOffset; // ,Сֵָƫ + for (int i = 0; i < PARA_NUM; i++) + { + paratype = (i * 4); + minOffset = (i * 4 + 1); + maxOffset = (i * 4 + 2); + if (*(g_pWkParaList+paratype) == PTYPE_U) + { + if (g_wkPara.buf[i] < *(g_pWkParaList+minOffset)) + { + printf("wk para id=%d, val=%d less than min=%d, set to min\r\n", i+1, g_wkPara.buf[i], *(g_pWkParaList+minOffset)); + g_wkPara.buf[i] = *(g_pWkParaList+minOffset); + } + else if (g_wkPara.buf[i] > *(g_pWkParaList+maxOffset)) + { + printf("wk para id=%d, val=%d more than max=%d, set to max\r\n", i+1, g_wkPara.buf[i], *(g_pWkParaList+maxOffset)); + g_wkPara.buf[i] = *(g_pWkParaList+maxOffset); + } + } + else if (*(g_pWkParaList+paratype) == PTYPE_S) + { + if ((s32)g_wkPara.buf[i] < (s32)*(g_pWkParaList+minOffset)) + { + printf("wk para id=%d, val=%d less than min=%d, set to min\r\n", i+1, (s32)g_wkPara.buf[i], (s32)*(g_pWkParaList+minOffset)); + g_wkPara.buf[i] = *(g_pWkParaList+minOffset); + } + else if ((s32)g_wkPara.buf[i] > (s32)*(g_pWkParaList+maxOffset)) + { + printf("wk para id=%d, val=%d more than max=%d, set to max\r\n", i+1, (s32)g_wkPara.buf[i], (s32)*(g_pWkParaList+maxOffset)); + g_wkPara.buf[i] = *(g_pWkParaList+maxOffset); + } + } + } +} + +void CheckAWkParaRange(int id) +{ + if (g_pWkParaList == NULL || id <= 0 || id > PARA_NUM) + { + return; + } + int paratype, minOffset, maxOffset; // ,Сֵָƫ + int idx = id - 1; + paratype = (idx * 4); + minOffset = (idx * 4 + 1); + maxOffset = (idx * 4 + 2); + if (*(g_pWkParaList+paratype) == PTYPE_U) + { + if (g_wkPara.buf[idx] < *(g_pWkParaList+minOffset)) + { + printf("wk para id=%d, val=%d less than min=%d, set to min\r\n", id, g_wkPara.buf[idx], *(g_pWkParaList+minOffset)); + g_wkPara.buf[idx] = *(g_pWkParaList+minOffset); + } + else if (g_wkPara.buf[idx] > *(g_pWkParaList+maxOffset)) + { + printf("wk para id=%d, val=%d more than max=%d, set to max\r\n", id, g_wkPara.buf[idx], *(g_pWkParaList+maxOffset)); + g_wkPara.buf[idx] = *(g_pWkParaList+maxOffset); + } + } + else if (*(g_pWkParaList+paratype) == PTYPE_S) + { + if ((s32)g_wkPara.buf[idx] < (s32)*(g_pWkParaList+minOffset)) + { + printf("wk para id=%d, val=%d less than min=%d, set to min\r\n", id, (s32)g_wkPara.buf[idx], (s32)*(g_pWkParaList+minOffset)); + g_wkPara.buf[idx] = *(g_pWkParaList+minOffset); + } + else if ((s32)g_wkPara.buf[idx] > (s32)*(g_pWkParaList+maxOffset)) + { + printf("wk para id=%d, val=%d more than max=%d, set to max\r\n", id, (s32)g_wkPara.buf[idx], (s32)*(g_pWkParaList+maxOffset)); + g_wkPara.buf[idx] = *(g_pWkParaList+maxOffset); + } + } +} + +void SetMcParaNameString(void* pDat) +{ + g_pMcParasName = pDat; +} + +void SetWkParaNameString(void* pDat) +{ + g_pWkParasName = pDat; +} + +void SetMcParaList(void * pDat) +{ + g_pMcParaList = pDat; +} + +void SetWkParaList(void * pDat) +{ + g_pWkParaList = pDat; +} + +void SetDefAngParaList(void * pDat) +{ + g_pdefAngParaList = pDat; +} + +u32 GetAMcPara(int id) +{ + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM) + { + return g_mcPara.buf[idx]; + } + return 0; +} + +void SetAMcPara(int id, u32 val) +{ + u32 * pItem; + char * pInfo = NULL; + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM) + { + pItem = &g_mcPara.buf[idx]; + pInfo = g_pMcParasName[idx]; + printf("set mc para "); + + if (*(g_pMcParaList + idx * 4) == PTYPE_S) + { + s32 old = (s32)(*pItem); + *pItem = val; + if (pInfo != NULL) + { + printf("%d. %s = %d, oldvalue=%d\r\n", id, pInfo, (s32)*pItem, old); + } + else + { + printf("%d. = %d, oldvalue=%d\r\n", id, (s32)*pItem, old); + } + } + else + { + u32 old = *pItem; + *pItem = val; + if (pInfo != NULL) + { + printf("%d. %s = %d, oldvalue=%d\r\n", id, pInfo, *pItem, old); + } + else + { + printf("%d. = %d, oldvalue=%d\r\n", id, *pItem, old); + } + } + CheckAMcParaRange(id); + } +} + +u32 GetAWkPara(int id) +{ + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM) + { + return g_wkPara.buf[idx]; + } + return 0; +} + +void SetAWkPara(int id, u32 val) +{ + u32 * pItem; + char * pInfo = NULL; + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM) + { + pItem = &g_wkPara.buf[idx]; + pInfo = g_pWkParasName[idx]; + printf("set wk para "); + + if (*(g_pWkParaList + idx * 4) == PTYPE_S) + { + s32 old = (s32)(*pItem); + *pItem = val; + if (pInfo != NULL) + { + printf("%d. %s = %d, oldvalue=%d\r\n", id, pInfo, (s32)*pItem, old); + } + else + { + printf("%d. = %d, oldvalue=%d\r\n", id, (s32)*pItem, old); + } + } + else + { + u32 old = *pItem; + *pItem = val; + if (pInfo != NULL) + { + printf("%d. %s = %d, oldvalue=%d\r\n", id, pInfo, *pItem, old); + } + else + { + printf("%d. = %d, oldvalue=%d\r\n", id, *pItem, old); + } + } + CheckAWkParaRange(id); + } +} + +void SetAAnglePara(int id, u16 val) +{ + int old; + u16 * pItem; + int idx = id - 1; + + if ( idx >= 0 && idx < (PARA_NUM*2) ) + { + pItem = ((u16*)(&g_angPara)+idx); + printf("set move start angle "); + + old = *pItem; + *pItem = val; + printf("%d. = %d, oldvalue=%d\r\n", id, *pItem, old); + } +} + +void ShowMcPara(char * para1, char * para2) +{ + printf("mc para:\r\n"); + + for (int i = 0; i < PARA_NUM; i++) + { + if (g_pMcParasName[i] != NULL) + { + if (strlen(g_pMcParasName[i]) != 0) + { + if (*(g_pMcParaList + i * 4) == PTYPE_U) + { + printf("%d. %s = %d\r\n", i+1, g_pMcParasName[i], g_mcPara.buf[i]); + } + else if (*(g_pMcParaList + i * 4) == PTYPE_S) + { + printf("%d. %s = %d\r\n", i+1, g_pMcParasName[i], (s32)g_mcPara.buf[i]); + } + else + { + printf("%d. %s = 0x%x\r\n", i+1, g_pMcParasName[i], g_mcPara.buf[i]); + } + DelayMs(2); + } + } + } +} + +void ShowWkPara(char * para1, char * para2) +{ + printf("wk para:\r\n"); + + for (int i = 0; i < PARA_NUM; i++) + { + if (g_pWkParasName[i] != NULL) + { + if (strlen(g_pWkParasName[i]) != 0) + { + if (*(g_pWkParaList + i * 4) == PTYPE_U) + { + printf("%d. %s = %d\r\n", i+1, g_pWkParasName[i], g_wkPara.buf[i]); + } + else if (*(g_pWkParaList + i * 4) == PTYPE_S) + { + printf("%d. %s = %d\r\n", i+1, g_pWkParasName[i], (s32)g_wkPara.buf[i]); + } + else + { + printf("%d. %s = 0x%x\r\n", i+1, g_pWkParasName[i], g_wkPara.buf[i]); + } + DelayMs(2); + } + } + } +} + +void SetMcPara(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + if (p1 == 0 && p2 == 0) + { + WriteDefMcPara(); // дĬϲ + } + else if (p1 <= PARA_NUM && p1 >= 1) + { + SetAMcPara(p1, p2); + } + else if (p1 == 1000) + { + printf("save mc para\r\n"); + SaveMcPara(); + } + else + { + } +} + +void SetWkPara(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + if (p1 == 0 && p2 == 0) + { + WriteDefWkPara(); // дĬϲ + } + else if (p1 <= PARA_NUM && p1 >= 1) + { + SetAWkPara(p1, p2); + } + else if (p1 == 1000) + { + printf("save wk para\r\n"); + SaveWkPara(); + } + else + { + } +} + +void ShowAngPara(char * para1, char * para2) +{ + int p1 = 1; + + if (para1 != NULL) + { + p1 = atoi(para1); + } + + { + int gid = p1; + ParaStruct * pPara = NULL; + int ofst, val, ofst2; + ofst = val = 0; + + printf("ang para %d:\r\n", gid); + + if (gid == 1 || gid == 2) + { + pPara = (&g_angPara); + } + + if (gid == 1) + { + ofst2 = 0; + } + else if (gid == 2) + { + ofst2 = MAX_HOR * MAX_VER; + } + + if (pPara != NULL) + { + printf("\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\r\n"); + for (int i = 0; i < MAX_VER; i++) + { + printf("%d:\t", i+1); + for (int j = 0; j < MAX_HOR; j++) + { + ofst = (i * MAX_HOR + j + ofst2); + val = *((u16*)(pPara) + ofst); + printf("%d\t", val); + DelayMs(1); + } + printf("\r\n"); + } + } + } +} + +void SetAngPara(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + if (p1 == 0) + { + WriteDefMvAngPara(); + } + else if (p1 == 1000) + { + SaveAngPara(); + printf("save angle para\r\n"); + } + else + { + int gid, subscript1, subscript2; // ±1,±2 + int id; + + gid = p1 / 10000; + p1 %= 10000; + subscript1 = p1 / 100; + subscript2 = p1 % 100; + if (subscript1 < 1 || subscript2 < 1 || subscript1 > MAX_VER || subscript2 > MAX_HOR) + { + printf("idx err\r\n"); + return; + } + + id = (subscript1-1) * MAX_HOR + (subscript2-1) + 1; + if (id < 1 || id > PARA_NUM) + { + printf("idx err\r\n"); + return; + } + printf("set ang table %d, at (%d, %d), value=%d\r\n", gid, subscript1, subscript2, p2); + + if (gid == 2) + { + id += MAX_HOR * MAX_VER; + } + + SetAAnglePara(id, p2); + } +} + + diff --git a/EMBOS/Users/EmbBase/paras.h b/EMBOS/Users/EmbBase/paras.h new file mode 100644 index 0000000..2286243 --- /dev/null +++ b/EMBOS/Users/EmbBase/paras.h @@ -0,0 +1,147 @@ + +#ifndef __PARAS_H__ +#define __PARAS_H__ + +#include "config.h" + +#ifndef USE_SMEC +#define USE_SMEC 0 // 0:ʹüоƬ + // 1:ʹüоƬ(ʹüоƬÿζд30ms) +#endif + +//--------------------------------- +// FRAMַ + +// 8Kֽ + +// 256ֽ ڸ洢 +// 256ֽ nvpara +// 512ֽ Ԥ + +// 1Kֽ +// 1Kֽ + +// 1Kֽ Ƕ + +#define ENC_ADDR 0x0000 // 256ֽ +#define NVPARA_ADDR 0x0100 // 256ֽ +#define REV_ADDR 0x0200 // 512ֽ + +#define MCPARA_ADDR 0x0400 // ,1K +#define WKPARA_ADDR 0x0800 // ,1K + +#define ANGPARA_ADDR 0x0C00 // ʼǶ + +//--------------------------------- + +// +#define PTYPE_U 0 // ޷ +#define PTYPE_S 1 // з +#define PTYPE_B 2 // λͼ + +#define PARA_NUM 256 +#define PARA_STR_LEN 30 + +#define PARA_MC_VALID 0x00005500 +#define PARA_WK_VALID 0x000000AA + +#define PARA_VALID (PARA_MC_VALID|PARA_WK_VALID) + +//--------------------------------- +// +#define MAX_HOR 12 // ,±2ֵ,벽 +#define MAX_VER 21 // ,±1ֵ,ת + +typedef struct +{ + u32 buf[PARA_NUM]; +} __attribute__ ((packed)) ParaStruct; + +//-------------------------------------------------------------- +// () +typedef struct +{ + u32 dataidx; // + u16 mvmnt; // ƶλ +} __attribute__ ((packed)) Patch; + +#define PATCH_DATA_NUM 10 // ֧趨ĸ + +typedef struct +{ + Patch patch[PATCH_DATA_NUM]; +} __attribute__ ((packed)) PatchData; + +//--------------------------------- + +#ifdef _IN_PARAS_C + +ParaStruct g_mcPara; +ParaStruct g_wkPara; + +ParaStruct g_angPara; + +PatchData g_patchData; + +#else + +extern ParaStruct g_mcPara; // +extern ParaStruct g_wkPara; // + +extern ParaStruct g_angPara; // ʼǶȲ + +extern PatchData g_patchData; // , + +#endif + +//--------------------------------- + +void InitParas(void); + +//--------------------------------- + +void SaveMcPara(void); +void SaveWkPara(void); + +void SaveAngPara(void); + +//--------------------------------- + +void CheckMcParaRange(void); +void CheckAMcParaRange(int id); + +void CheckWkParaRange(void); +void CheckAWkParaRange(int id); + +//--------------------------------- + +void WriteDefMcPara(void); +void WriteDefWkPara(void); + +void WriteDefMvAngPara(void); + +//--------------------------------- + +void SetMcParaNameString(void* pDat); +void SetWkParaNameString(void* pDat); + +void SetMcParaList(void * pDat); +void SetWkParaList(void * pDat); +void SetDefAngParaList(void * pDat); + +//--------------------------------- + +u32 GetAMcPara(int id); +void SetAMcPara(int id, u32 val); + +u32 GetAWkPara(int id); +void SetAWkPara(int id, u32 val); + +void SetAAnglePara(int id, u16 val); + +//--------------------------------- + + +#endif + + diff --git a/EMBOS/Users/EmbFunc/busmotos/busmotos.c b/EMBOS/Users/EmbFunc/busmotos/busmotos.c new file mode 100644 index 0000000..b61dde0 --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/busmotos.c @@ -0,0 +1,311 @@ + + +#include "busmotos.h" +#include "modbus_m.h" +#if (BUSCTRL_MOTO == RUANYI) +#include "ruanyictrl.h" +#define RYDEVIDX_Y 11 //Y豸ַ +#define RYDEVIDX_X 12 //X豸ַ + +#elif(BUSCTRL_MOTO == LEISAI) + +#include "leisaictrl.h" +#define LSDEVIDX_Y 11 //Y豸ַ +#define LSDEVIDX_X 12 //X豸ַ + +#define MOTOP_JOGPOS (1000000) //ֶλ +#define MOTON_JOGPOS (-1000000) //ֶλ + +#endif + + +void InitBusCtrlMotos(void) +{ + InitModbus_m(0, COMM_USART6, B115200, '8', 'N', '1', 'R'); +#if (BUSCTRL_MOTO == RUANYI) + InitRuanyiCom(); +#elif (BUSCTRL_MOTO == LEISAI) +// InitLeisaiMoto(LSDEVIDX_Y); +#endif +} + +int BusCtrlMotoYtoAbspos(u32 pos, u32 spd) +{ + int rst = 0; +#if (BUSCTRL_MOTO == RUANYI) + rst = MoveRyiToAbsolutePos(RYDEVIDX_Y, pos, spd); +#elif (BUSCTRL_MOTO == LEISAI) + rst = MoveLeisaiToAbsolutePos(LSDEVIDX_Y, pos, spd); +#endif + return rst; +} +int BusCtrlMotoXtoAbspos(s32 pos, u32 spd) +{ + int rst = 0; +#if (BUSCTRL_MOTO == RUANYI) + rst = MoveRyiToAbsolutePos(RYDEVIDX_X, pos, spd); +#elif (BUSCTRL_MOTO == LEISAI) + rst = MoveLeisaiToAbsolutePos(LSDEVIDX_X, pos, spd); +#endif + return rst; +} +int BusCtrlMotoXtoRevpos(s32 pos, u32 spd) +{ + int rst = 0; +#if (BUSCTRL_MOTO == RUANYI) + rst = MoveRyiToRelativePos(RYDEVIDX_X, pos, spd); +#elif(BUSCTRL_MOTO == LEISAI) + rst = MoveLeisaiToRelativePos(LSDEVIDX_X, pos, spd); +#endif + return rst; +} + + +//ȡ״̬ +int GetMotoXSta(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + GetCurStatus(RYDEVIDX_X, &rslt); + if(rslt < 0) + { + rslt = MOTO_WARNING; + } +#elif(BUSCTRL_MOTO == LEISAI) + GetLeisaiCurStatus(LSDEVIDX_X, &rslt); +#endif + return rslt; +} +int GetMotoYSta(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + GetCurStatus(RYDEVIDX_Y, &rslt); + if(rslt < 0) + { + rslt = MOTO_WARNING; + } +#elif(BUSCTRL_MOTO == LEISAI) + GetLeisaiCurStatus(LSDEVIDX_Y, &rslt); +#endif + return rslt; +} +int GetMotoYpusPos(s32 * pos) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + s16 curMotoPos; + rslt = GetCurPusPos(RYDEVIDX_Y, &curMotoPos); + if(rslt < 0) + { + *pos = 0; + rslt = MOTO_WARNING; + } + else + { + *pos = (s32)curMotoPos; + } +#elif(BUSCTRL_MOTO == LEISAI) + rslt = GetLeisaiCurPusPos(LSDEVIDX_Y, pos); + if(rslt < 0) + { + *pos = 0; + rslt = MOTO_WARNING; + } +#endif + return rslt; +} +int GetMotoXpusPos(s32 * pos) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + s16 curMotoPos; + rslt = GetCurPusPos(RYDEVIDX_X, &curMotoPos); + if(rslt < 0) + { + *pos = 0; + rslt = MOTO_WARNING; + } + else + { + *pos = (s32)curMotoPos; + } +#elif(BUSCTRL_MOTO == LEISAI) + rslt = GetLeisaiCurPusPos(LSDEVIDX_X, pos); + if(rslt < 0) + { + *pos = 0; + rslt = MOTO_WARNING; + } +#endif + return rslt; +} +/* +int GetMotoXpusPos(s16 * pos) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + rslt = GetCurPusPos(RYDEVIDX_X, pos); + if(rslt < 0) + { + rslt = MOTO_WARNING; + } +#endif + return rslt; +}*/ + +int MoveXbyJOG(int dir) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + if(dir) + { + rslt= MoveRyiJOGP(RYDEVIDX_X, 0); + } + else + { + rslt = MoveRyiJOGN(RYDEVIDX_X, 0); + } +#elif(BUSCTRL_MOTO == LEISAI) + if(dir) + { + rslt= MoveLeisaiToRelativePos(LSDEVIDX_X, MOTOP_JOGPOS, MOTOX_JOGSPD); + } + else + { + rslt = MoveLeisaiToRelativePos(LSDEVIDX_X, MOTON_JOGPOS, MOTOX_JOGSPD); + } +#endif + return rslt; +} + +int MoveYbyJOG(int dir) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + if(dir) + { + rslt = MoveRyiJOGP(RYDEVIDX_Y, 0); + } + else + { + rslt = MoveRyiJOGN(RYDEVIDX_Y, 0); + } +#elif(BUSCTRL_MOTO == LEISAI) + if(dir) + { + rslt = MoveLeisaiToRelativePos(LSDEVIDX_Y, MOTOP_JOGPOS, MOTOX_JOGSPD); + } + else + { + rslt = MoveLeisaiToRelativePos(LSDEVIDX_Y, MOTON_JOGPOS, MOTOX_JOGSPD); + } +#endif + return rslt; +} + +int MotoXstopEmc(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + rslt = RyiMotoStop(RYDEVIDX_X); +#elif(BUSCTRL_MOTO == LEISAI) + rslt = LeisaiMotoStop(LSDEVIDX_X); +#endif + return rslt; +} + +void MotoYstopEmc(void) +{ +#if (BUSCTRL_MOTO == RUANYI) + RyiMotoStop(RYDEVIDX_Y); +#elif(BUSCTRL_MOTO == LEISAI) + LeisaiMotoStop(LSDEVIDX_Y); +#endif +} +/* +int SetMotoYCurPos(int pos) +{ + int rslt; +#if (BUSCTRL_MOTO == RUANYI) + rslt = SetRyiCurPos(RYDEVIDX_Y, (s16)pos); +#elif(BUSCTRL_MOTO == LEISAI) + +#endif + return rslt; +}*/ +int SetMotoYPosZero(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + rslt = RyiMotoSetCurPosZero(RYDEVIDX_Y); +#elif(BUSCTRL_MOTO == LEISAI) + rslt = LeisaiMotoSetCurPosZero(LSDEVIDX_Y); +#endif + return rslt; +} + +int SetMotoXPosZero(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + rslt = RyiMotoSetCurPosZero(RYDEVIDX_X); +#elif(BUSCTRL_MOTO == LEISAI) + rslt = LeisaiMotoSetCurPosZero(LSDEVIDX_X); +#endif + return rslt; +} + +int SetMotoXRetrunPos(void) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + rslt = RyiMotoToPos(RYDEVIDX_X, BITTOPOS0); +#elif(BUSCTRL_MOTO == LEISAI) + rslt = MoveLeisaiToAbsolutePos(LSDEVIDX_X, 0, 300); +#endif + return rslt; +} + +int SetMotoYmoveLimt(s32 posp, s32 posn) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + +#elif(BUSCTRL_MOTO == LEISAI) + rslt = LeisaiMotoSetLim(LSDEVIDX_Y, posp, posn); +#endif + return rslt; +} +int SetMotoXmoveLimt(s32 posp, s32 posn) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + +#elif(BUSCTRL_MOTO == LEISAI) + rslt = LeisaiMotoSetLim(LSDEVIDX_X, posp, posn); +#endif + return rslt; +} + +int GetLeisaMotoXErrcode(u16 * errcode) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + +#elif(BUSCTRL_MOTO == LEISAI) + rslt = GetLeisaiCurErrcode(LSDEVIDX_X, errcode); +#endif + return rslt; +} + +int GetLeisaMotoYErrcode(u16 * errcode) +{ + int rslt = 0; +#if (BUSCTRL_MOTO == RUANYI) + +#elif(BUSCTRL_MOTO == LEISAI) + rslt = GetLeisaiCurErrcode(LSDEVIDX_Y, errcode); +#endif + return rslt; +} diff --git a/EMBOS/Users/EmbFunc/busmotos/busmotos.h b/EMBOS/Users/EmbFunc/busmotos/busmotos.h new file mode 100644 index 0000000..a01247c --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/busmotos.h @@ -0,0 +1,48 @@ + +#ifndef __BUSMOTOSS_H__ +#define __BUSMOTOSS_H__ + +#include "config.h" + +#ifndef MOTO_RUNNINT +#define MOTO_RUNNINT 0 // +#endif +#ifndef MOTO_RUN_FINSH +#define MOTO_RUN_FINSH 1 // +#endif +#ifndef MOTO_WARNING +#define MOTO_WARNING -1 // +#endif + +#define MOTOX_JOGSPD 100 //Xֶٶ(λrpm) +#define MOTOY_JOGSPD 60 //Yֶٶ(λmm/s) + +void InitBusCtrlMotos(void); + +int BusCtrlMotoYtoAbspos(u32 pos, u32 spd); +int BusCtrlMotoXtoRevpos(s32 pos, u32 spd); +int BusCtrlMotoXtoAbspos(s32 pos, u32 spd); + +int GetMotoXSta(void); +int GetMotoYSta(void); + +int MoveXbyJOG(int dir); +int MoveYbyJOG(int dir); + +int MotoXstopEmc(void); +void MotoYstopEmc(void); + +//int SetMotoYCurPos(int pos); +int SetMotoYPosZero(void); +int GetMotoYpusPos(s32 * pos); +int GetMotoXpusPos(s32 * pos); + +int SetMotoXPosZero(void); +int SetMotoXRetrunPos(void); +int SetMotoYmoveLimt(s32 posp, s32 posn); +int SetMotoXmoveLimt(s32 posp, s32 posn); + +int GetLeisaMotoXErrcode(u16 * errcode); +int GetLeisaMotoYErrcode(u16 * errcode); +#endif + diff --git a/EMBOS/Users/EmbFunc/busmotos/leisaictrl.c b/EMBOS/Users/EmbFunc/busmotos/leisaictrl.c new file mode 100644 index 0000000..eef65d5 --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/leisaictrl.c @@ -0,0 +1,226 @@ + +#include "leisaictrl.h" + +#if (BUSCTRL_MOTO == LEISAI) + +#include "modbus_m.h" +#include "delay.h" + +typedef struct +{ + u16 motoreturndat; //ذ + s16 motocurpuspos; + +}LSDriverCtrl; + +LSDriverCtrl g_lsdriverctrl; + + + + +int InitLeisaiMoto(u8 devIdx) //ʼ +{ + int err; + memset(&g_lsdriverctrl, 0, sizeof(LSDriverCtrl)); + err = ModbusComm16(0, devIdx, MODBUS_WR, 0X6000, 0, &g_lsdriverctrl.motoreturndat); + DelayMs(20); + return err; +} + +/*ƶijλ (λ) + * decIdx:豸ַ1-127 + * pos:Ŀλã + * spd:ٶ rpm + * */ + +int MoveLeisaiToAbsolutePos(u8 devIdx, s32 pos, u16 spd) +{ + int err = 0; + u32 uPos; + uPos = (u32)pos; + u16 dataBuffWr[8]; + dataBuffWr[0] = 0x0001; //˶ģʽ + dataBuffWr[1] = HIWORD(uPos);//λøλ + dataBuffWr[2] = LOWORD(uPos);//λõλ + dataBuffWr[3] = spd; //ٶ +// dataBuffWr[4] = 120; //ʱ +// dataBuffWr[5] = 120; //ʱ + dataBuffWr[4] = 200; //ʱ + dataBuffWr[5] = 200; //ʱ + dataBuffWr[6] = 0; //ӳʱ + dataBuffWr[7] = 0x0010; // + + err = ModbusCommMulti(0, devIdx, MODBUS_WR_MULTI, 0x6200, &(dataBuffWr[0]), 8, NULL, 8); + + return err; +} + +/*ƶijλãλã + * decIdx:豸ַ1-127 + * pos:Ŀλã + * spd:ٶ + * */ + +int MoveLeisaiToRelativePos(u8 devIdx, s32 pos, u16 spd) +{ + int err = 0; + u32 uPos; + uPos = (u32)pos; + u16 dataBuffWr[8]; + dataBuffWr[0] = 0x0041; //˶ģʽ λ + dataBuffWr[1] = HIWORD(uPos);//λøλ + dataBuffWr[2] = LOWORD(uPos);//λõλ + dataBuffWr[3] = spd; //ٶ + dataBuffWr[4] = 1000; //ʱ + dataBuffWr[5] = 1000; //ʱ + dataBuffWr[6] = 0; //ӳʱ + dataBuffWr[7] = 0x0010; // + + err = ModbusCommMulti(0, devIdx, MODBUS_WR_MULTI, 0x6200, &(dataBuffWr[0]), 8, NULL, 8); + + return err; +} + +//ȡ״̬ ǰָǷ0δɣ1ɣȡָλ +int GetLeisaiCurStatus(u8 devIdx, int * statuflg) +{ + int err = 0; + u16 sta = 0; + err = ModbusComm16(0, devIdx, MODBUS_RD, 0x1003, 0, &sta); + if(err < 0) + { + return err; + } + else + { + if((sta & 0x10) == 0x10) + { + *statuflg = 1; + } + else + { + *statuflg = 0; + } + } + return err; +} + +//ȡλ λ +int GetLeisaiCurPusPos(u8 devIdx, s32 * puspos) +{ + int err = 0; + u32 upuspos = 0; + u16 upusPosH,upusPosL; + err = ModbusComm32(0, devIdx, MODBUS_RD, 0x602C, 0, &upuspos); + upusPosH = HIWORD(upuspos); + upusPosL = LOWORD(upuspos); + upuspos = ((DWORD)((WORD)(upusPosH)) | (((DWORD)((WORD)(upusPosL))) << 16)); + *puspos = (s32)upuspos; + return err; +} + +int MoveLeisaiJOGP(u8 devIdx, u16 spd) +{ + int err = 0; + if(spd != 0) + { + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x01E1, spd, &g_lsdriverctrl.motoreturndat); //㶯ٶ + } + if(err >= 0) + { + err = ModbusComm16(0, devIdx, MODBUS_WR, 0X1801, 0X4001, &g_lsdriverctrl.motoreturndat); + } + return err; +} + +int MoveLeisaiJOGN(u8 devIdx, u16 spd) +{ + int err = 0; + if(spd != 0) + { + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x01E1, spd, &g_lsdriverctrl.motoreturndat); //㶯ٶ + } + if(err >= 0) + { + err = ModbusComm16(0, devIdx, MODBUS_WR, 0X1801, 0X4002, &g_lsdriverctrl.motoreturndat); + } + return err; +} + +//ֹͣ +int LeisaiMotoStop(u8 devIdx) +{ + int err = 0; + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6002, 0x0040, &g_lsdriverctrl.motoreturndat); + return err; +} + +//ǰλֶ +int LeisaiMotoSetCurPosZero(u8 devIdx) +{ + int err = 0; + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6002, 0x0021, &g_lsdriverctrl.motoreturndat); + if(g_lsdriverctrl.motoreturndat != 0x21) + { + err = -3; + } + return err; +} + +// +int LeisaiMotoToPosZero(u8 devIdx) +{ + int err = 0; + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6002, 0x0020, &g_lsdriverctrl.motoreturndat); + return err; +} + +int LeisaiMotoSetLim(u8 devIdx, s32 posp, s32 posn) +{ + int err = 0; + u32 uPosp, uPosn; + u16 uPospH, uPospL, uPosnH, uPosnL; + + uPosp = (u32)posp; + uPosn = (u32)posn; + + uPospH = HIWORD(uPosp); + uPospL = LOWORD(uPosp); + uPosnH = HIWORD(uPosn); + uPosnL = LOWORD(uPosn); + + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6006, uPospH, &g_lsdriverctrl.motoreturndat); + if(err < 0) + { + return err; + } + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6007, uPospL, &g_lsdriverctrl.motoreturndat); + if(err < 0) + { + return err; + } + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6008, uPosnH, &g_lsdriverctrl.motoreturndat); + if(err < 0) + { + return err; + } + err = ModbusComm16(0, devIdx, MODBUS_WR, 0x6009, uPosnL, &g_lsdriverctrl.motoreturndat); + if(err < 0) + { + return err; + } + DelayMs(20); + + err = ModbusComm16(0, devIdx, MODBUS_WR, 0X6000, 2, &g_lsdriverctrl.motoreturndat); + return err; +} +//ȡϴ +int GetLeisaiCurErrcode(u8 devIdx, u16 * errcode) +{ + int err = 0; + err = ModbusComm16(0, devIdx, MODBUS_RD, 0x2203, 0, errcode); + return err; +} + +#endif + diff --git a/EMBOS/Users/EmbFunc/busmotos/leisaictrl.h b/EMBOS/Users/EmbFunc/busmotos/leisaictrl.h new file mode 100644 index 0000000..10874bd --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/leisaictrl.h @@ -0,0 +1,21 @@ + +#ifndef INKJETFUNC_BUSMOTOS_LEISAICTRL_H_ +#define INKJETFUNC_BUSMOTOS_LEISAICTRL_H_ + +#include "config.h" +#if (BUSCTRL_MOTO == LEISAI) +int InitLeisaiMoto(u8 devIdx); //ʼ +int MoveLeisaiToAbsolutePos(u8 devIdx, s32 pos, u16 spd); +int MoveLeisaiToRelativePos(u8 devIdx, s32 pos, u16 spd); +int GetLeisaiCurStatus(u8 devIdx, int * statuflg); +int GetLeisaiCurPusPos(u8 devIdx, s32 * puspos); +int MoveLeisaiJOGP(u8 devIdx, u16 spd); +int MoveLeisaiJOGN(u8 devIdx, u16 spd); +int LeisaiMotoStop(u8 devIdx); +int LeisaiMotoSetCurPosZero(u8 devIdx); +int LeisaiMotoToPosZero(u8 devIdx); +int LeisaiMotoSetLim(u8 devIdx, s32 posp, s32 posn); +int GetLeisaiCurErrcode(u8 devIdx, u16 * errcode); +#endif + +#endif /* INKJETFUNC_BUSMOTOS_LEISAICTRL_H_ */ diff --git a/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.c b/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.c new file mode 100644 index 0000000..d7c20f0 --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.c @@ -0,0 +1,194 @@ + +#include "ruanyictrl.h" + +#if (BUSCTRL_MOTO == RUANYI) + +#include "modbus_m.h" +#include "workctrl.h" + +typedef struct +{ + u16 motoreturndat; //ذ + u16 motoparaval; //ֵ + u16 zerocodeval; //λֵ + int curtozeroval; //ǰλλֵ + u32 curtozeroabs; + + u8 zeroflag; + s16 motocurpuspos; +}RYDriverCtrl; + +RYDriverCtrl g_rydriverctrl; + +void InitRuanyiCom(void) //ʼ +{ + memset(&g_rydriverctrl, 0, sizeof(RYDriverCtrl)); + +} + + +/*ƶijλ (λ) + * decIdx:豸ַ1-127 + * pos:Ŀλã + * spd:ٶ 0ıٶ + * */ + +int MoveRyiToAbsolutePos(u8 devIdx, s16 pos, u16 spd) +{ + int err = 0; + static u16 oldRyspd = 500; + if(spd != oldRyspd) + { + oldRyspd = spd; + err = ModbusComm16(0,devIdx, MODBUS_WR, 8256, (u16)spd, &g_rydriverctrl.motoreturndat); //ٶ + DelayRef(300); + } + if(err >= 0 && + pos != 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, 9473, (u16)pos, &g_rydriverctrl.motoreturndat); + if(g_rydriverctrl.motoreturndat != (u16)pos) + { + err = -10; + } + } + + return err; +} + + + +/*ƶijλãλã + * decIdx:豸ַ1-127 + * pos:Ŀλã + * spd:ٶ 0ıٶ + * */ + +int MoveRyiToRelativePos(u8 devIdx, s16 pos, u16 spd) +{ + int err = 0; + static u16 oldRyspd = 1500; + if(spd != oldRyspd) + { + oldRyspd = spd; + err = ModbusComm16(0,devIdx, MODBUS_WR, 8256, (u16)spd, &g_rydriverctrl.motoreturndat); //ٶ + DelayRef(300); + } + if(err >= 0 && + pos != 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, 9475, (u16)pos, &g_rydriverctrl.motoreturndat); + if(g_rydriverctrl.motoreturndat != (u16)pos) + { + err = -10; + } + } + + return err; +} + +/*JOG+ + * decIdx:豸ַ1-127 + * spd:ٶ 0ıٶ + * */ + +int MoveRyiJOGP(u8 devIdx, u16 spd) +{ + int err = 0; + if(spd != 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, 8241, (u16)spd, &g_rydriverctrl.motoreturndat); //㶯ٶ + } + if(err >= 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, BITMOVEADDR, BITJOGPCMD, &g_rydriverctrl.motoreturndat); + } + return err; +} + +int MoveRyiJOGN(u8 devIdx, u16 spd) +{ + int err = 0; + if(spd != 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, 8241, (u16)spd, &g_rydriverctrl.motoreturndat); //㶯ٶ + } + if(err >= 0) + { + err = ModbusComm16(0,devIdx, MODBUS_WR, BITMOVEADDR, BITJOGNCMD, &g_rydriverctrl.motoreturndat); + } + return err; +} + +//ֹͣ +int RyiMotoStop(u8 devIdx) +{ + int err = 0; + err = ModbusComm16(0,devIdx, MODBUS_WR, BITMOVEADDR, BITSTOPCMD, &g_rydriverctrl.motoreturndat); + return err; +} + +//ǰλø +int SetRyiCurPos(u8 devIdx, s16 pos) +{ + int err = 0; + err = ModbusComm16(0,devIdx, MODBUS_WR, 9472, pos, &g_rydriverctrl.motoreturndat); + return err; +} + +//ǰλ +int RyiMotoSetCurPosZero(u8 devIdx) +{ + int err = 0; + err = ModbusComm16(0,devIdx, MODBUS_WR, BITMOVEADDR, BITSETCPOSZEROCMD, &g_rydriverctrl.motoreturndat); + return err; +} + +//Ӧλ +int RyiMotoToPos(u8 devIdx, u16 pos) +{ + int err = 0; + err = ModbusComm16(0,devIdx, MODBUS_WR, BITTOPOSADDR, pos, &g_rydriverctrl.motoreturndat); + return err; +} + + +//ȡλ λ +int GetCurPusPos(u8 devIdx, s16 * puspos) +{ + int err = 0; + u16 upuspos = 0; + err = ModbusComm16(0,devIdx, MODBUS_RD, 9729, 0, &upuspos); + *puspos = (s16)upuspos; + return err; +} + +//ȡ״̬ ǰָǷ0δɣ1 2ת 3 +int GetCurStatus(u8 devIdx, int * statuflg) +{ + int err = 0; + u16 sta = 0; + err = ModbusComm16(0,devIdx, MODBUS_RD, 9728, 0, &sta); + if(err < 0) + { + return err; + } + else + { + if(sta == 1) + { + *statuflg = 1; + } + else if(sta == 0) + { + *statuflg = 0; + } + else + { + *statuflg = -1; + } + } + return err; +} + +#endif diff --git a/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.h b/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.h new file mode 100644 index 0000000..0e0f64e --- /dev/null +++ b/EMBOS/Users/EmbFunc/busmotos/ruanyictrl.h @@ -0,0 +1,38 @@ + +#ifndef INKJETBASE_RUANYICTRL_H_ +#define INKJETBASE_RUANYICTRL_H_ + +#include "config.h" +#if (BUSCTRL_MOTO == RUANYI) + +#define BITMOVEADDR 9216 //ַ +#define BITTOPOSADDR 9218 //λ1Ӧλ + +#define BITSTOPCMD 0x0000 +#define BITTOZEROCMD 0x0001 +#define BITJOGPCMD 0x0002 +#define BITJOGNCMD 0x0004 +#define BITSETCPOSZEROCMD 0x0040 +#define BITSETZEROCMD 0x0100 + +#define BITTOPOS0 0x0001 //Ӧλ0 +#define BITTOPOS1 0x0002 //Ӧλ1 +#define BITTOPOS2 0x0004 //Ӧλ2 +#define BITTOPOS3 0x0008 //Ӧλ3 + +void InitRuanyiCom(void); + +int MoveRyiToRelativePos(u8 devIdx, s16 pos, u16 spd); +int MoveRyiToAbsolutePos(u8 devIdx, s16 pos, u16 spd); +int MoveRyiJOGP(u8 devIdx, u16 spd); +int MoveRyiJOGN(u8 devIdx, u16 spd); +int RyiMotoStop(u8 devIdx); +int SetRyiCurPos(u8 devIdx, s16 pos); +int RyiMotoSetCurPosZero(u8 devIdx); +int GetCurPusPos(u8 devIdx, s16 * puspos); +int GetCurStatus(u8 devIdx, int * statuflg); +int RyiMotoToPos(u8 devIdx, u16 pos); +#endif + + +#endif /* INKJETBASE_RUANYICTRL_H_ */ diff --git a/EMBOS/Users/EmbFunc/extendboards/extendboards.c b/EMBOS/Users/EmbFunc/extendboards/extendboards.c new file mode 100644 index 0000000..e40e256 --- /dev/null +++ b/EMBOS/Users/EmbFunc/extendboards/extendboards.c @@ -0,0 +1,2247 @@ + +#include "extendboards.h" +#include "delay.h" +#include "crc16.h" +#include "filetrans.h" + + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + + +#if (MAX_SUPPORT_CORE > 0) + +CoreControl g_extendCtrlList[MAX_SUPPORT_CORE]; + +#define EXID_CORE_STA1 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_1, 0, BN_CMD_REGVAL) // һ״̬仯 ID +#define EXID_CORE_STA2 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_2, 0, BN_CMD_REGVAL) // ڶ״̬仯 ID +#define EXID_CORE_STA3 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_3, 0, BN_CMD_REGVAL) // ״̬仯 ID + +#define CUR_BOARD_INSTA_EXID MAKE_EXID(BN_PROTOCOL_MVCTRL, CUR_COREBOARD_ID, 0, BN_CMD_REGVAL) + +#define EXID_CORE_CTRL1 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_1, 0, BN_CMD_WTREG) // һĿ ID +#define EXID_CORE_CTRL2 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_2, 0, BN_CMD_WTREG) // ڶĿ ID +#define EXID_CORE_CTRL3 MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_CORE_3, 0, BN_CMD_WTREG) // Ŀ ID + +#define CUR_BOARD_OUTCTRL_EXID MAKE_EXID(BN_PROTOCOL_MVCTRL, CUR_COREBOARD_ID, 0, BN_CMD_WTREG) + + +const u32 g_coreInExid[MAX_SUPPORT_CORE] = +{ + EXID_CORE_STA1, +#if (MAX_SUPPORT_CORE > 1) + EXID_CORE_STA2, +#endif +#if (MAX_SUPPORT_CORE > 2) + EXID_CORE_STA3, +#endif +}; + +const u32 g_coreOutExid[MAX_SUPPORT_CORE] = +{ + EXID_CORE_CTRL1, +#if (MAX_SUPPORT_CORE > 1) + EXID_CORE_CTRL2, +#endif +#if (MAX_SUPPORT_CORE > 2) + EXID_CORE_CTRL3, +#endif +}; + +#endif + + +//------------------------------------------------------------------------- + +int g_curBoardIdx = -1; // ǰ忨бе½DZ +int g_curBoardID = -1; // ǰ忨ĽڵID +int g_curBoardInstaExid = -1; +int g_curBoardOutCtrlExid = -1; + +int g_wrcmdtoogle = 0; +int g_rdcmdtoogle = 0; +u32 g_rdcmdbitmap = 0; + +int g_wrstatoogle = 0; +int g_rdstatoogle = 0; +u32 g_rdstabitmap = 0; + +#if (RD_HEAD_PARA_NUM > 0) +u8 g_exbNvPara[RD_HEAD_PARA_NUM][BOARD_PARA_SIZE]; // ΧʧԲ +u8 g_receiveEn[RD_HEAD_PARA_NUM] = {0}; // +u8 g_receivenum[RD_HEAD_PARA_NUM] = {0}; // ռ +u8 g_framenum[RD_HEAD_PARA_NUM] = {0}; // ݰ֡ +u16 g_datacrc[RD_HEAD_PARA_NUM] = {0}; // crcУֵ +#endif + +s32 headparaval = 0; + +#define TOOGLE_ADD 0x00010000 + +#define PORT_ADDR_MOD 0x0000FFFF +#define PORT_TOOG_MOD 0xFFFF0000 + +#define CMDSTA_BMP_FULL 0x000000FF + +//------------------------------------------------------------------------- + +static const u32 IDX_TO_BIT[32] = +{ + 0x00000001, + 0x00000002, + 0x00000004, + 0x00000008, + 0x00000010, + 0x00000020, + 0x00000040, + 0x00000080, + 0x00000100, + 0x00000200, + 0x00000400, + 0x00000800, + 0x00001000, + 0x00002000, + 0x00004000, + 0x00008000, + 0x00010000, + 0x00020000, + 0x00040000, + 0x00080000, + 0x00100000, + 0x00200000, + 0x00400000, + 0x00800000, + 0x01000000, + 0x02000000, + 0x04000000, + 0x08000000, + 0x10000000, + 0x20000000, + 0x40000000, + 0x80000000, +}; + +#if (MAX_SUPPORT_HEAD > 0) + +HeadControl g_headList[MAX_SUPPORT_HEAD+1]; + +#endif + +#if (MAX_SUPPORT_COLOR > 0) + +ColorControl g_colorList[MAX_SUPPORT_COLOR+1]; + +#endif + +#if (MAX_SUPPORT_EXTIO > 0) + +ExtIOControl g_extioList[MAX_SUPPORT_EXTIO+1]; + +#endif + +#if (MAX_SUPPORT_SEWHD > 0) + +SewHeadControl g_sewHeadList[MAX_SUPPORT_SEWHD+1]; + +#endif +//------------------------------------------------------------------------- + +void InitBoardsList(void) +{ + int i; + int id; + +// + g_curBoardIdx = CUR_CORE_IDX; + g_curBoardID = -1; + g_curBoardInstaExid = -1; + g_curBoardOutCtrlExid = -1; + +#if (MAX_SUPPORT_CORE > 0) + for (i = 0; i < MAX_SUPPORT_CORE; i++) + { + InitCoreControl(&(g_extendCtrlList[i])); + id = i+1; + g_extendCtrlList[i].staexid = MAKE_EXID(BN_PROTOCOL_MVCTRL, id, 0, BN_CMD_REGVAL); + g_extendCtrlList[i].cmdexid = MAKE_EXID(BN_PROTOCOL_MVCTRL, id, 0, BN_CMD_WTREG); + + if (g_curBoardIdx == i) + { + g_curBoardID = id; + g_curBoardInstaExid = g_extendCtrlList[i].staexid; + g_curBoardOutCtrlExid = g_extendCtrlList[i].cmdexid; + } + + } +#endif + + if (g_curBoardIdx >= 0) + { + printf("cur board idx = %d\r\n", g_curBoardIdx); + } + else + { + printf("init extendCtrlList error\r\n"); + } + +//------------------------------------------------------------------------- + +// ͷ +#if (MAX_SUPPORT_HEAD > 0) + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) // 0Ϊ㲥 MAX_SUPPORT_HEAD+1 + { + InitHeadControl(&(g_headList[i])); + + if (i == 0) + { + g_headList[i].nodeId = BN_ID_BROADCAST; + } + else + { + id = i + HEAD_NODEID_BASE - 1; + g_headList[i].nodeId = id; + } + } +#endif // (MAX_SUPPORT_HEAD > 0) + +//------------------------------------------------------------------------- + +// ɫ +#if (MAX_SUPPORT_COLOR > 0) + for (i = 0; i < MAX_SUPPORT_COLOR+1; i++) + { + InitColorControl(&(g_colorList[i])); + if (i == 0) + { + g_colorList[i].nodeId = BN_ID_BROADCAST; + } + else + { + id = i + COLOR_NODEID_BASE - 1; + g_colorList[i].nodeId = id; + } + } +#endif + +//------------------------------------------------------------------------- + +// IOչ +#if (MAX_SUPPORT_EXTIO > 0) + for (i = 0; i < MAX_SUPPORT_EXTIO+1; i++) + { + InitExtIOControl(&(g_extioList[i])); + if (i == 0) + { + g_extioList[i].nodeId = BN_ID_BROADCAST; + } + else + { + id = i + EXTIO_NODEID_BASE - 1; + g_extioList[i].nodeId = id; + } + } +#endif +//------------------------------------------------------------------------- + +// һͷ +#if (MAX_SUPPORT_SEWHD > 0) + for (i = 0; i < MAX_SUPPORT_SEWHD+1; i++) + { + InitSewHeadControl(&(g_sewHeadList[i])); + if (i == 0) + { + g_sewHeadList[i].nodeId = BN_ID_BROADCAST; + } + else + { + id = i + SEWHD_NODEID_BASE - 1; + g_sewHeadList[i].nodeId = id; + } + } +#endif +} + +//--------------------------------------------------- +// ù +void CoreCanFilter(u8 fifo) +{ + int filteridx = 0; + CAN_FilterTypeDef hFilterConfig; + + if (1) + {// ֹ + filteridx = filteridx; + hFilterConfig.FilterBank = 1; + hFilterConfig.FilterBank = hFilterConfig.FilterBank; + } + + +#if (MAX_SUPPORT_CORE > 1) + // 󱾽ڵ仯Զ֡ͿƱڵ֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDLIST; // Ϊʶбģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ32λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(g_curBoardInstaExid, CAN_RTR_REMOTE)); // 趨һ16λ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(g_curBoardInstaExid, CAN_RTR_REMOTE)); // 趨һ16λ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(g_curBoardOutCtrlExid, CAN_RTR_DATA)); // 趨ڶ16λ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(g_curBoardOutCtrlExid, CAN_RTR_DATA)); // 趨ڶ16λ + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // Ա豸IDĹ㲥Զ֡֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // N1ļĴ仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, 0, 0, BN_CMD_WTREG), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, 0, 0, BN_CMD_WTREG), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_REMOTE)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_REMOTE)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); + filteridx++; + + // N1ļĴ仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_MVCTRL, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_REMOTE)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_REMOTE)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; +#endif + +#if (MAX_SUPPORT_HEAD > 0) + // Իͷ״̬仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // Իͷ״̬֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_BUSSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_BUSSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // ԻͷĶȡĴ֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // ԻͷĶд֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_HEAD, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + +#endif + +#if (MAX_SUPPORT_COLOR > 0) + // Իɫ״̬仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + + // ԻɫĶȡĴ֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // ԻɫĶд֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_COLOR, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; +#endif + +#if (MAX_SUPPORT_EXTIO > 0) + // IOչ״̬仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_EXTIO, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_EXTIO, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // IOչĶȡĴ֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_EXTIO, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_EXTIO, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; +#endif + +#if (MAX_SUPPORT_SEWHD > 0) + // Էһͷ״̬仯֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // Էһͷ״̬֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_BUSSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_BUSSTA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // ԷһͷĶȡĴ֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_REGVAL), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; + + // ԷһͷĶд֡ + hFilterConfig.FilterBank = filteridx; // ù飬ΧΪ0~13 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // Ϊʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(BN_PROTOCOL_SEWHD, 0, 0, BN_CMD_NVPARA), CAN_RTR_DATA)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_CMD, CAN_RTR_DATA)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO0 + hFilterConfig.SlaveStartFilterBank = 14; + hFilterConfig.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); // д + filteridx++; +#endif + +} + +void InitExtendBoards() +{ + InitBoardsList(); + + RegistFilter(CoreCanFilter); + + InitCanCtrl(); +} + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- + +void InputsTask() +{ + int rslt; + CanRxMsg rxMsg; + u32 tid, sid, cmd, dev, toogle; + int i, count, idx; + CtrlBusPacket pkt; + + count = 0; + // CAN + do + { + rslt = GetACanDataPacket(&rxMsg); + if (rslt == 0) + { + dev = GET_PRT_FROM_EXID(rxMsg.canRxhead.ExtId); + tid = GET_TID_FROM_EXID(rxMsg.canRxhead.ExtId); + sid = GET_SID_FROM_EXID(rxMsg.canRxhead.ExtId); + cmd = GET_CMD_FROM_EXID(rxMsg.canRxhead.ExtId); + sid = sid; + if (rxMsg.canRxhead.RTR == CAN_RTR_REMOTE) // Զ֡ + { + if ((dev == BN_PROTOCOL_ALL || dev == BN_PROTOCOL_MVCTRL) && // ȫ豸N1 + (tid == BN_ID_BROADCAST || tid == g_curBoardID) ) // ȫID򱾰 + { + if (cmd == BN_CMD_REGVAL) // 󱾽ڵ㷢ͼĴ + { +// printf("receive sta request packet\r\n"); + if (g_curBoardIdx >= 0) + { + g_extendCtrlList[g_curBoardIdx].refreshflag = 1; // ñ״̬ˢ±־· + } + else + { + printf("error: g_curBoardIdx not init\r\n"); + } + } + else + { + printf("other Remote cmd, cmd=0x%x\r\n", cmd); + } + } + else + { + printf("other Remote packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } + else if (rxMsg.canRxhead.RTR == CAN_RTR_DATA && rxMsg.canRxhead.DLC == CAN_DATA_LEN) // ֡ݳΪ8 + { +#if (MAX_SUPPORT_CORE > 0) + if (dev == BN_PROTOCOL_MVCTRL) + { + if (tid == BN_ID_BROADCAST || tid == g_curBoardID) // ȫID򱾰 + { + if (cmd == BN_CMD_WTREG) // д + { + // дڵ + if (g_curBoardIdx >= 0) + { + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + + toogle = pkt.cancomm.data.wrport.portaddr & PORT_TOOG_MOD; + idx = pkt.cancomm.data.wrport.portaddr & PORT_ADDR_MOD; + + // printf("refresh this cmd, toogle=0x%x, idx=%d, cmd=0x%x\r\n", toogle, idx, pkt.cancomm.data.wrport.wrdata); + if (toogle != g_rdcmdtoogle) // + { + // ״̬buff + g_rdcmdtoogle = toogle; + g_rdcmdbitmap = 0; + g_extendCtrlList[g_curBoardIdx].newcmdflag = 0; + memset(g_extendCtrlList[g_curBoardIdx].cmdbuff, 0, sizeof(CORE_CHG_BUF_LEN)); + // printf("get new cmd begin\r\n"); + } + if (idx < CORE_CHG_BUF_LEN) + { + g_extendCtrlList[g_curBoardIdx].cmdbuff[idx] = pkt.cancomm.data.wrport.wrdata; + + g_rdcmdbitmap |= IDX_TO_BIT[idx]; + if (g_rdcmdbitmap == CMDSTA_BMP_FULL) + { + g_extendCtrlList[g_curBoardIdx].newcmdflag = 1; // յ״̬ + // printf("get new cmd end\r\n"); + } + } + // printf("refresh this cmd, toogle=0x%x, idx=%d, cmd=0x%x\r\n", toogle, idx, pkt.cancomm.data.wrport.wrdata); + } + else + { + printf("error: g_curBoardIdx not init\r\n"); + } + } + else + { + //printf("get other core data for this, cmd=%d, sid=%d\r\n", cmd, sid); + } + } + else // ڵID + { + if (cmd == BN_CMD_REGVAL) // Ĵ仯 + { + for (i = 0; i < MAX_SUPPORT_CORE ; i++) + { + if (g_extendCtrlList[i].staexid == rxMsg.canRxhead.ExtId) // ҵڵIDĻ + { + // ˢ״̬ + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + + toogle = pkt.cancomm.data.wrport.portaddr & PORT_TOOG_MOD; + idx = pkt.cancomm.data.wrport.portaddr & PORT_ADDR_MOD; + + if (toogle != g_rdstatoogle) // ״̬ + { + // ״̬buff + memset(g_extendCtrlList[i].stabuff, 0, sizeof(CORE_CHG_BUF_LEN)); + g_rdstatoogle = toogle; + g_rdstabitmap = 0; + g_extendCtrlList[i].stachangeflag = 0; + // printf("get new status begin, toogle=0x%x, idx=%d\r\n", toogle, idx); + } + + if (idx < CORE_CHG_BUF_LEN) + { + g_extendCtrlList[i].stabuff[idx] = pkt.cancomm.data.wrport.wrdata; + + g_rdstabitmap |= IDX_TO_BIT[idx]; + if (g_rdstabitmap == CMDSTA_BMP_FULL) + { + g_extendCtrlList[i].stachangeflag = 1; // յ״̬ + // printf("get new status ok\r\n"); + } + } + // printf("refresh core %d status, toogle=0x%x, idx=%d, val=0x%x\r\n", i+1, toogle, idx, pkt.cancomm.data.wrport.wrdata); + break; + } + } + } + else + { + //printf("get other core data, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } + } +#endif + +#if (MAX_SUPPORT_HEAD > 0) + else if (dev == BN_PROTOCOL_HEAD) // ͷ + { + if (cmd == BN_CMD_EXSTA) + { + //printf("get head sta packet, sid=%d\r\n", sid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) + { + if (sid == g_headList[i].nodeId) + { + g_headList[i].exbSta.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_headList[i].exbSta.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + g_headList[i].staFlag = 1; + break; + } + } + } + } + else if (cmd == BN_CMD_BUSSTA) // ״̬ + { + printf("get head bus sta packet, sid=%d\r\n", sid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) + { + if (sid == g_headList[i].nodeId) + { + g_headList[i].busSta.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_headList[i].busSta.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + g_headList[i].busFlag = 1; + break; + } + } + } + } + else if (cmd == BN_CMD_REGVAL) // ȡĴ + { + //printf("get head reg val packet, sid=%d, tid=%d\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) + { + if (sid == g_headList[i].nodeId) + { + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + u32 highaddr, lowaddr; + highaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_HIGH; + lowaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_LOW; + if (highaddr == BOARD_VERSION) + { + if (g_headList[i].regVal.rdnewbverflag == 1) // ³汾 + { + g_headList[i].regVal.rdbverbitmap = 0; + g_headList[i].regVal.rdnewbverflag = 0; // + g_headList[i].verFlag = 0; + memset(g_headList[i].regVal.exbVer, 0, BOARD_VER_LEN*sizeof(u32)); + } + if (lowaddr < BOARD_VER_LEN) + { + g_headList[i].regVal.exbVer[lowaddr] = pkt.cancomm.data.rdport.status; + g_headList[i].regVal.rdbverbitmap |= IDX_TO_BIT[lowaddr]; + if (g_headList[i].regVal.rdbverbitmap == CMDSTA_BMP_FULL) + { + g_headList[i].verFlag = 1; + } + } + } + else if (highaddr == GET_NV_PARA) // ȡ + { + g_headList[i].headParaFlag = 1; + headparaval = pkt.cancomm.data.rdport.status; + } + break; + } + } + } + } +#if (RD_HEAD_PARA_NUM > 0) + else if (cmd == BN_CMD_NVPARA) // ȡʧԲ + { + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) + { + if (sid == g_headList[i].nodeId) + { + int id = 0; + if (g_headList[i].nodeTye == FLAT_EMB_HEAD) + { + id = 1; + } + else if (g_headList[i].nodeTye == CHENILLE_HEAD) + { + id = 2; + } + else if (g_headList[i].nodeTye == COIL_HEAD) + { + id = 3; + } + int rslt = ReceiveBoardNvParaProc(rxMsg, id, g_headList[i].nodeTye); + if (rslt == 0) + { + g_headList[i].nvParaFlag = 1; + } + break; + } + } + } + } +#endif + else + { + printf("get other head data packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } +#endif +#if (MAX_SUPPORT_COLOR > 0) + else if (dev == BN_PROTOCOL_COLOR) + { + if (cmd == BN_CMD_EXSTA) + { + //printf("get color sta packet, sid=0x%x, tid=0x%x\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_COLOR+1; i++) + { + if (sid == g_colorList[i].nodeId) + { + g_colorList[i].exbSta.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_colorList[i].exbSta.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + g_colorList[i].staFlag = 1; + break; + } + } + } + } + else if (cmd == BN_CMD_REGVAL) // ȡĴ + { + //printf("get color reg val packet, sid=%d, tid=%d\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_COLOR+1; i++) + { + if (sid == g_colorList[i].nodeId) + { + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + u32 highaddr, lowaddr; + highaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_HIGH; + lowaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_LOW; + if (highaddr == BOARD_VERSION) + { + if (g_colorList[i].regVal.rdnewbverflag == 1) // ³汾 + { + g_colorList[i].regVal.rdbverbitmap = 0; + g_colorList[i].regVal.rdnewbverflag = 0; // + g_colorList[i].verFlag = 0; + memset(g_colorList[i].regVal.exbVer, 0, BOARD_VER_LEN*sizeof(u32)); + } + if (lowaddr < BOARD_VER_LEN) + { + g_colorList[i].regVal.exbVer[lowaddr] = pkt.cancomm.data.rdport.status; + g_colorList[i].regVal.rdbverbitmap |= IDX_TO_BIT[lowaddr]; + if (g_colorList[i].regVal.rdbverbitmap == CMDSTA_BMP_FULL) + { + g_colorList[i].verFlag = 1; + } + } + } + break; + } + } + } + } +#if (RD_HEAD_PARA_NUM > 0) + else if (cmd == BN_CMD_NVPARA) // ȡʧԲ + { + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_COLOR+1; i++) + { + if (sid == g_colorList[i].nodeId) + { + int id = 0; + if (i == 2) // ëɫ + { + id = 4; + } + int rslt = ReceiveBoardNvParaProc(rxMsg, id, 0); + if (rslt == 0) + { + g_colorList[i].nvParaFlag = 1; + } + break; + } + } + } + } +#endif + else + { + printf("get other color data packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } +#endif // (MAX_SUPPORT_COLOR > 0) + +#if (MAX_SUPPORT_EXTIO > 0) + else if (dev == BN_PROTOCOL_EXTIO) + { + if (cmd == BN_CMD_EXSTA) + { + //printf("get extio sta packet, sid=0x%x, tid=0x%x\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_EXTIO+1; i++) + { + if (sid == g_extioList[i].nodeId) + { + g_extioList[i].exbSta.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_extioList[i].exbSta.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + g_extioList[i].staFlag = 1; + break; + } + } + } + } + else if (cmd == BN_CMD_REGVAL) // ȡĴ + { + //printf("get extio reg val packet, sid=%d, tid=%d\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_EXTIO+1; i++) + { + if (sid == g_extioList[i].nodeId) + { + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + u32 highaddr, lowaddr; + highaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_HIGH; + lowaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_LOW; + if (highaddr == BOARD_VERSION) + { + if (g_extioList[i].regVal.rdnewbverflag == 1) // ³汾 + { + g_extioList[i].regVal.rdbverbitmap = 0; + g_extioList[i].regVal.rdnewbverflag = 0; // + g_extioList[i].verFlag = 0; + memset(g_extioList[i].regVal.exbVer, 0, BOARD_VER_LEN*sizeof(u32)); + } + if (lowaddr < BOARD_VER_LEN) + { + g_extioList[i].regVal.exbVer[lowaddr] = pkt.cancomm.data.rdport.status; + g_extioList[i].regVal.rdbverbitmap |= IDX_TO_BIT[lowaddr]; + if (g_extioList[i].regVal.rdbverbitmap == CMDSTA_BMP_FULL) + { + g_extioList[i].verFlag = 1; + } + } + } + break; + } + } + } + } + else + { + printf("get other extio data packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } +#endif // (MAX_SUPPORT_EXTIO > 0) + +#if (MAX_SUPPORT_SEWHD > 0) + else if (dev == BN_PROTOCOL_SEWHD) + { + if (cmd == BN_CMD_EXSTA) + { + //printf("get color sta packet, sid=0x%x, tid=0x%x\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_SEWHD+1; i++) + { + if (sid == g_sewHeadList[i].nodeId) + { + g_sewHeadList[i].exbSta.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_sewHeadList[i].exbSta.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + g_sewHeadList[i].staFlag = 1; + break; + } + } + } + } + else if (cmd == BN_CMD_REGVAL) // ȡĴ + { + //printf("get color reg val packet, sid=%d, tid=%d\r\n", sid, tid); + if (tid == g_curBoardID) + { + for (i = 0; i < MAX_SUPPORT_SEWHD+1; i++) + { + if (sid == g_sewHeadList[i].nodeId) + { + memcpy(pkt.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); + u32 highaddr, lowaddr; + highaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_HIGH; + lowaddr = pkt.cancomm.data.rdport.portaddr & PORT_ADDR_LOW; + if (highaddr == BOARD_VERSION) + { + if (g_sewHeadList[i].regVal.rdnewbverflag == 1) // ³汾 + { + g_sewHeadList[i].regVal.rdbverbitmap = 0; + g_sewHeadList[i].regVal.rdnewbverflag = 0; // + g_sewHeadList[i].verFlag = 0; + memset(g_sewHeadList[i].regVal.exbVer, 0, BOARD_VER_LEN*sizeof(u32)); + } + if (lowaddr < BOARD_VER_LEN) + { + g_sewHeadList[i].regVal.exbVer[lowaddr] = pkt.cancomm.data.rdport.status; + g_sewHeadList[i].regVal.rdbverbitmap |= IDX_TO_BIT[lowaddr]; + if (g_sewHeadList[i].regVal.rdbverbitmap == CMDSTA_BMP_FULL) + { + g_sewHeadList[i].verFlag = 1; + } + } + } + break; + } + } + } + } + else + { + printf("get other sew head data packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } +#endif // (MAX_SUPPORT_SEWHD > 0) + + else + { + printf("get other data packet, exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + } + } + else + { + printf("other packet,RTR=%d,ID=%x,DLC=%d\r\n", rxMsg.canRxhead.RTR, rxMsg.canRxhead.ExtId, rxMsg.canRxhead.DLC); + } + } + else + { +// printf("no data"); + break; + } + count++; + if (count > 10) + { + break; + } + }while(1); +} + +void OutputsTask() +{ + CanTxMsg txMsg; + int i, j; + CtrlBusPacket pkt; + +//------------------------------------------------------------------------- + +#if (MAX_SUPPORT_CORE > 0) + // Ŀͱڵ״̬ + for (i = 0; i < MAX_SUPPORT_CORE; i++) + { + if (g_curBoardIdx == i) // ڵ״̬ + { + if (g_extendCtrlList[i].refreshflag != 0) + { + if (g_extendCtrlList[i].ReSendStatus != NULL) + { + g_extendCtrlList[i].ReSendStatus(1); + } + + g_extendCtrlList[i].refreshflag = 0; + g_extendCtrlList[i].stachangeflag = 1; + } + if (g_extendCtrlList[i].stachangeflag != 0) + { + txMsg.canTxhead.ExtId = g_extendCtrlList[i].staexid; + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + + for (j = 0; j < CORE_CHG_BUF_LEN; j++) + { + pkt.cancomm.data.wrport.portaddr = j | g_wrstatoogle; // ַ + pkt.cancomm.data.wrport.wrdata = g_extendCtrlList[i].stabuff[j]; // + memcpy(txMsg.data, pkt.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); +// printf("send sta change, toogle=0x%x, idx=%d, sta=0x%x\r\n", g_wrstatoogle, j, pkt.cancomm.data.wrport.wrdata); + } + + g_extendCtrlList[i].stachangeflag = 0; + g_wrstatoogle += TOOGLE_ADD; + } + } + else // ڵ + { + if (g_extendCtrlList[i].newcmdflag != 0) + { + txMsg.canTxhead.ExtId = g_extendCtrlList[i].cmdexid; + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + + for (j = 0; j < CORE_CHG_BUF_LEN; j++) + { + pkt.cancomm.data.wrport.portaddr = j | g_wrcmdtoogle; // ַ + pkt.cancomm.data.wrport.wrdata = g_extendCtrlList[i].cmdbuff[j]; // + memcpy(txMsg.data, pkt.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); +// printf("send cmd, toogle=0x%x, idx=%d, sta=0x%x\r\n", g_wrcmdtoogle, j, pkt.cancomm.data.wrport.wrdata); + } + + g_extendCtrlList[i].newcmdflag = 0; + g_wrcmdtoogle += TOOGLE_ADD; + } + } + } +#endif + +#if (MAX_SUPPORT_HEAD > 0) + for (i = 0; i < MAX_SUPPORT_HEAD+1; i++) + { + if (g_headList[i].cmdFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_EXCTRL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_headList[i].ctrlCmd.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + g_headList[i].cmdFlag = 0; + } + + if (g_headList[i].refSta != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_EXSTA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_headList[i].refSta = 0; + } + + if (g_headList[i].refVer != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memset(&g_headList[i].rdReg.cancomm.data.buff, 0, CAN_DATA_LEN); + g_headList[i].rdReg.cancomm.data.rdport.portaddr = BOARD_VERSION; + memcpy(txMsg.data, g_headList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // + g_headList[i].refVer = 0; + } + + if (g_headList[i].traFlag != 0) // + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_TRAVERSE); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_headList[i].traCmd.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + g_headList[i].traFlag = 0; + } + + if (g_headList[i].transFlag != 0) // ݴ + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_TRANS_DATA); + ExboardDataTrans(txMsg.canTxhead.ExtId); + g_headList[i].transFlag = 0; + } + + if (g_headList[i].exbupdateFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_headList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_headList[i].exbupdateFlag = 0; + } + + if (g_headList[i].refNvPara != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_NVPARA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_headList[i].refNvPara = 0; + } + + if (g_headList[i].refHeadPara != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_HEAD, g_headList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_headList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_headList[i].refHeadPara = 0; + } + + } +#endif + +#if (MAX_SUPPORT_COLOR > 0) + for (i = 0; i < MAX_SUPPORT_COLOR+1; i++) + { + if (g_colorList[i].cmdFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_EXCTRL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_colorList[i].ctrlCmd.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + g_colorList[i].cmdFlag = 0; + } + + if (g_colorList[i].refSta != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_EXSTA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_colorList[i].refSta = 0; + } + + if (g_colorList[i].refVer != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memset(&g_colorList[i].rdReg.cancomm.data.buff, 0, CAN_DATA_LEN); + g_colorList[i].rdReg.cancomm.data.rdport.portaddr = BOARD_VERSION; + memcpy(txMsg.data, g_colorList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // + g_colorList[i].refVer = 0; + } + + if (g_colorList[i].transFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_TRANS_DATA); + ExboardDataTrans(txMsg.canTxhead.ExtId); + g_colorList[i].transFlag = 0; + } + + if (g_colorList[i].exbupdateFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_colorList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_colorList[i].exbupdateFlag = 0; + } + + if (g_colorList[i].refNvPara != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_COLOR, g_colorList[i].nodeId, g_curBoardID, BN_CMD_NVPARA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_colorList[i].refNvPara = 0; + } + } +#endif + +#if (MAX_SUPPORT_EXTIO > 0) + for (i = 0; i < MAX_SUPPORT_EXTIO+1; i++) + { + if (g_extioList[i].cmdFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_EXTIO, g_extioList[i].nodeId, g_curBoardID, BN_CMD_EXCTRL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_extioList[i].ctrlCmd.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + g_extioList[i].cmdFlag = 0; + } + + if (g_extioList[i].refSta != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_EXTIO, g_extioList[i].nodeId, g_curBoardID, BN_CMD_EXSTA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_extioList[i].refSta = 0; + } + + if (g_extioList[i].refVer != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_EXTIO, g_extioList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memset(&g_extioList[i].rdReg.cancomm.data.buff, 0, CAN_DATA_LEN); + g_extioList[i].rdReg.cancomm.data.rdport.portaddr = BOARD_VERSION; + memcpy(txMsg.data, g_extioList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // + g_extioList[i].refVer = 0; + } + + if (g_extioList[i].transFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_EXTIO, g_extioList[i].nodeId, g_curBoardID, BN_CMD_TRANS_DATA); + ExboardDataTrans(txMsg.canTxhead.ExtId); + g_extioList[i].transFlag = 0; + } + + if (g_extioList[i].exbupdateFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_EXTIO, g_extioList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_extioList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_extioList[i].exbupdateFlag = 0; + } + } +#endif + +#if (MAX_SUPPORT_SEWHD > 0) + for (i = 0; i < MAX_SUPPORT_SEWHD+1; i++) + { + if (g_sewHeadList[i].cmdFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_EXCTRL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_sewHeadList[i].ctrlCmd.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + g_sewHeadList[i].cmdFlag = 0; + } + + if (g_sewHeadList[i].refSta != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_EXSTA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_sewHeadList[i].refSta = 0; + } + + if (g_sewHeadList[i].refVer != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memset(&g_sewHeadList[i].rdReg.cancomm.data.buff, 0, CAN_DATA_LEN); + g_sewHeadList[i].rdReg.cancomm.data.rdport.portaddr = BOARD_VERSION; + memcpy(txMsg.data, g_sewHeadList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // + g_sewHeadList[i].refVer = 0; + } + + if (g_sewHeadList[i].transFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_TRANS_DATA); + ExboardDataTrans(txMsg.canTxhead.ExtId); + g_sewHeadList[i].transFlag = 0; + } + + if (g_sewHeadList[i].exbupdateFlag != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_REGVAL); + txMsg.canTxhead.RTR = CAN_RTR_DATA; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_sewHeadList[i].rdReg.cancomm.data.buff, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_sewHeadList[i].exbupdateFlag = 0; + } + + if (g_sewHeadList[i].refNvPara != 0) + { + txMsg.canTxhead.ExtId = MAKE_EXID(BN_PROTOCOL_SEWHD, g_sewHeadList[i].nodeId, g_curBoardID, BN_CMD_NVPARA); + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + g_sewHeadList[i].refNvPara = 0; + } + } +#endif + +} + +void ExtendBoardTask(void) +{ + InputsTask(); + OutputsTask(); +} + +//------------------------------------------------------------------------- + +CoreControl * GetCoreFromList(u8 id) +{ +#if (MAX_SUPPORT_CORE > 0) + if (id > 0 && id <= MAX_SUPPORT_CORE) + { + return &(g_extendCtrlList[id-1]); + } + else +#endif + { + return NULL; + } +} + +HeadControl * GetHeadFromList(u8 id) +{ +#if (MAX_SUPPORT_HEAD > 0) + if (id > 0 && id <= MAX_SUPPORT_HEAD+1) + { + return &(g_headList[id-1]); + } + else +#endif + { + return NULL; + } +} + +ColorControl * GetColorFromList(u8 id) +{ +#if (MAX_SUPPORT_COLOR > 0) + if (id > 0 && id <= MAX_SUPPORT_COLOR+1) + { + return &(g_colorList[id-1]); + } + else +#endif + { + return NULL; + } +} + +ExtIOControl * GetExtIOFromList(u8 id) +{ +#if (MAX_SUPPORT_EXTIO > 0) + if (id > 0 && id <= MAX_SUPPORT_EXTIO+1) + { + return &(g_extioList[id-1]); + } + else +#endif + { + return NULL; + } +} + +int GetCurBoardID(void) +{ + return g_curBoardID; +} + +//------------------------------------------------------------------------ +#if (MAX_SUPPORT_CORE > 0) + +int IsNewControlCommand(void) +{ + if (g_extendCtrlList[g_curBoardIdx].newcmdflag != 0) + { + printf("can data inter\r\n"); + return TRUE; + } + return FALSE; +} + +// ӷ״̬ +void RequestExStatus(void) +{ + CanTxMsg txMsg; + int i; + for (i = 0; i < MAX_SUPPORT_CORE; i++) + { + if (g_curBoardIdx != i) // ״̬ + { + txMsg.canTxhead.ExtId = g_extendCtrlList[i].staexid; + txMsg.canTxhead.RTR = CAN_RTR_REMOTE; // Զ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = 0; // ݳ + memset(txMsg.data, 0, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); // Զ֡ + } + } +} +#endif + +//------------------------------------------------------------------------- +// ͷЭ,λҪ֪ӦĽڵID,ֻ֪ڵͺͻͷż +// ɫЭ ֪ڼ忨 +// IOչЭ ֪ڼ忨 +void StartBoardUpdate(u8 protocol, u8 nodetype, u8 nodeid) +{ +#if (MAX_SUPPORT_HEAD > 0) + if (protocol == BN_PROTOCOL_HEAD) + { + HeadControl * head = GetHeadFromList(1); // ĬϹ㲥 + HeadControl * temp = NULL; // ʱ洢 + if (nodeid != 0) + { + for(int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + temp = GetHeadFromList(i+1); + if (temp->nodeTye == nodetype) + { + if (nodeid <= 1) + { + head = temp; + break; + } + else + { + nodeid--; + } + } + } + } + head->rdReg.cancomm.data.rdport.portaddr = EXBOARD_UPDATE; + head->rdReg.cancomm.data.rdport.status = nodetype; + head->exbupdateFlag = 1; + } + else +#endif +#if (MAX_SUPPORT_COLOR > 0) + if (protocol == BN_PROTOCOL_COLOR) + { + ColorControl * color = GetColorFromList(nodeid+1); + color->exbupdateFlag = 1; + } + else +#endif +#if (MAX_SUPPORT_EXTIO > 0) + if (protocol == BN_PROTOCOL_EXTIO) + { + ExtIOControl * extio = GetExtIOFromList(nodeid+1); + extio->exbupdateFlag = 1; + } + else +#endif + { + } +} + +// ΧʧԲ +void SetBoardNvPara(int protocolType, int nodetype, int nodeId, u8 parablockID, u8 paraID, s32 paraVal) +{ +#if (MAX_SUPPORT_HEAD > 0) + if (protocolType == BN_PROTOCOL_HEAD) + { + SetHeadNvParaCmd(nodetype, nodeId, parablockID, paraID, paraVal); + } + else +#endif +#if (MAX_SUPPORT_COLOR > 0) + if (protocolType == BN_PROTOCOL_COLOR) + { + if (nodeId != 0) // 20220628 ֹ֧㲥,Ϊҷ + { + SetColorNvParaCmd(nodeId, parablockID, paraID, paraVal); + } + } + else +#endif + { + } +} + +//------------------------------------------------------------------------- +#if (MAX_SUPPORT_HEAD > 0) + +// ״̬ +void EnterTraverse(void) +{ + memset(&g_headList[0].traCmd.cancomm.data, 0, CAN_DATA_LEN); + + g_headList[0].traCmd.cancomm.data.traverse.tracmd = TRA_CMD_ENTER_TRA; + + g_headList[0].traFlag = 1; + + OutputsTask(); +} + +/* function:߱ + * return: 0: + * -1: +*/ +int TraverseSingleNode(u8 traNodeType, u8 traNodeId) +{ + printf("traverse nodeid=%d, nodetype=%d\r\n", traNodeId, traNodeType); + + memset(&g_headList[0].traCmd.cancomm.data, 0, CAN_DATA_LEN); + + g_headList[0].traCmd.cancomm.data.traverse.tracmd = TRA_CMD_NODE_TRA_BEG; + g_headList[0].traCmd.cancomm.data.traverse.nodetype = traNodeType; + g_headList[0].traCmd.cancomm.data.traverse.nodeid = traNodeId; + + g_headList[0].traFlag = 1; + + OutputsTask(); + + return 0; +} + +/* function:ǰڵѱ,ȷݰ + * return: 0: +*/ +int CurNodeTraverseAlready(u32 nodeid) +{ + printf("nodeid %d already set\r\n", nodeid); + + for(int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + if(g_headList[i].nodeId == nodeid) + { + memset(&g_headList[i].traCmd.cancomm.data, 0, CAN_DATA_LEN); + g_headList[i].traCmd.cancomm.data.traverse.tracmd = TRA_CMD_NODE_TRA_END; + g_headList[i].traCmd.cancomm.data.traverse.nodeid = nodeid; + g_headList[i].traFlag = 1; + break; + } + } + OutputsTask(); + return 0; +} + + +void ExitTravers() // ˳ +{ + memset(&g_headList[0].traCmd.cancomm.data, 0, CAN_DATA_LEN); + + g_headList[0].traCmd.cancomm.data.traverse.tracmd = TRA_CMD_EXIT_TRA; + g_headList[0].traFlag = 1; + + OutputsTask(); + + printf("exit traverse\r\n"); +} + +//--------------------------------------------------- +// ״̬ +void InquireBusSta(int idx) +{ + memset(&g_headList[idx].traCmd.cancomm.data, 0, CAN_DATA_LEN); + + g_headList[idx].traCmd.cancomm.data.traverse.tracmd = TRA_CMD_ASK_TRA_STA; + + g_headList[idx].traFlag = 1; + + OutputsTask(); + + printf("inquire bus sta, idx=%d\r\n", idx); +} + +u32 GetHeadStatus(int idx) +{ + u32 sta; + + HeadCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_HEAD) + { + pSta = (HeadCommand *)( &(g_headList[idx].exbSta.cancomm.data.buff)); + sta = pSta->headSta.staBits; + } + else + { + sta = 0; + } + return sta; +} + +void CleanHeadStatus(int idx) +{ + HeadCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_HEAD) + { + pSta = (HeadCommand *)( &(g_headList[idx].exbSta.cancomm.data.buff)); + pSta->headSta.staBits = 0; + } +} + +void RequestHeadsStatus(void) +{ + RequestHeadStatus(&(g_headList[0])); // ͹㲥 + OutputsTask(); +} + +void RequestHeadsVersion(void) +{ + RequestHeadVersion(&(g_headList[0])); // 㲥ѯ + + for(int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + g_headList[i].regVal.rdnewbverflag = 1; + } +} + +void RequestAHeadNvPara(int idx) +{ + if (idx <= 0) + { + return; + } + RequestHeadNvPara(&(g_headList[idx])); +} + +// Ƕ +void SendHeadAngCmd(int idx, u8 para1, u16 para2, u8 para3) +{ + HeadCommand ncmd; + memset(&ncmd, 0, sizeof(HeadCommand)); + ncmd.setmsang.cmd = CTRL_CMD_HEAD_MSANG; + ncmd.setmsang.validFlag = para1; + ncmd.setmsang.msang = para2; + ncmd.setmsang.nodetype = para3; + SendHeadCommand(&g_headList[idx], &ncmd); // ڵ + + OutputsTask(); // ˢ +} + +// ûͷʧԲ +void SetHeadNvParaCmd(int nodetype, int idx, u8 parablockid, u8 paraid, s32 paraval) +{ + if (idx < 0 || idx > MAX_SUPPORT_HEAD) + { + return; + } + HeadCommand ncmd; + + memset(&ncmd, 0, sizeof(HeadCommand)); + if (nodetype == FLAT_EMB_HEAD) + { + ncmd.headNvPara.cmd = CTRL_CMD_HEAD_NVPARA; + } + else if (nodetype == CHENILLE_HEAD) + { + ncmd.headNvPara.cmd = CTRL_CMD_CHENILLE_NVPARA; + } + else if (nodetype == COIL_HEAD) + { + ncmd.headNvPara.cmd = CTRL_CMD_COIL_NVPARA; + } + ncmd.headNvPara.parablockID = parablockid; + ncmd.headNvPara.paraID = paraid; + ncmd.headNvPara.paraval = paraval; + + SendHeadCommand(&g_headList[idx], &ncmd); // ڵ + + OutputsTask(); // ˢ +} + +u16 GetHeadPotValue(int idx) +{ + u32 sta; + + HeadCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_HEAD) + { + pSta = (HeadCommand *)( &(g_headList[idx].exbSta.cancomm.data.buff)); + sta = pSta->headSta.potValue; + } + else + { + sta = 0; + } + return sta; +} + +int GetHeadCurrentNeele(int idx) +{ + u32 sta; + + HeadCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_HEAD) + { + pSta = (HeadCommand *)( &(g_headList[idx].exbSta.cancomm.data.buff)); + sta = pSta->headSta.setedNP; + } + else + { + sta = 0; + } + return sta; +} +#endif +//------------------------------------------------------------------------- + +#if (MAX_SUPPORT_COLOR > 0) + +void RequestColorsVersion(void) +{ + RequestColorVersion(&(g_colorList[0])); + for(int i = 1; i < MAX_SUPPORT_COLOR+1; i++) + { + g_colorList[i].regVal.rdnewbverflag = 1; + } +} + +void RequestAColorNvPara(int idx) +{ + if (idx <= 0) + { + return; + } + + RequestColorNvPara(&(g_colorList[idx])); +} + +void SendColorCtrlCmd(int idx, u8 subcmd, u8 para1, u8 para2) +{ + ColorCommand ncmd; + + memset(&ncmd, 0, sizeof(ColorCommand)); + ncmd.colorCtrl.cmd = CTRL_CMD_COLOR_CTRL; + ncmd.colorCtrl.subcmd = subcmd; + ncmd.colorCtrl.para[0] = para1; + ncmd.colorCtrl.para[1] = para2; + + SendColorCommand(&g_colorList[idx], &ncmd); // ڵ + OutputsTask(); // ˢ +} + +// ûɫʧԲ +void SetColorNvParaCmd(int idx, u8 parablockid, u8 paraid, s32 paraval) +{ + if (idx < 0 || idx > MAX_SUPPORT_COLOR) + { + return; + } + + ColorCommand ncmd; + + memset(&ncmd, 0, sizeof(ColorCommand)); + ncmd.colorNvPara.cmd = CTRL_CMD_COLOR_NVPARA; + ncmd.colorNvPara.parablockID = parablockid; + ncmd.colorNvPara.paraID = paraid; + ncmd.colorNvPara.paraval = paraval; + + SendColorCommand(&g_colorList[idx], &ncmd); // ڵ + OutputsTask(); // ˢ +} + +void SendColorParaCmd(int idx, u8 para1) +{ + ColorCommand ncmd; + memset(&ncmd, 0, sizeof(ColorCommand)); + ncmd.colorPara.cmd = CTRL_CMD_COLOR_PARA; + ncmd.colorPara.needleNums = para1; + SendColorCommand(&g_colorList[idx], &ncmd); // ڵ + OutputsTask(); // ˢ +} + +void CleanColorSta(int idx) +{ + memset(&(g_colorList[idx].exbSta.cancomm.data.buff), 0, CAN_DATA_LEN); +} + +u16 GetColorStatus(int idx) +{ + u16 sta; + ColorCommand * pSta; + pSta = (ColorCommand *)( &(g_colorList[idx].exbSta.cancomm.data.buff)); + sta = pSta->colorSta.staBits; + + return sta; +} + +u16 GetColorPotValue(int idx) +{ + u16 sta; + ColorCommand * pSta; + pSta = (ColorCommand *)( &(g_colorList[idx].exbSta.cancomm.data.buff)); + sta = pSta->colorSta.potValue; + + return sta; +} + +int GetColorCurrentNeele(int idx) +{ + int sta; + ColorCommand * pSta; + pSta = (ColorCommand *)( &(g_colorList[idx].exbSta.cancomm.data.buff)); + sta = (int)pSta->colorSta.curNeedle; + + return sta; +} + +void RequestColorsStatus(void) +{ + RequestColorStatus(&(g_colorList[0])); // ͹㲥 + OutputsTask(); +} + +#endif + +#if (MAX_SUPPORT_EXTIO > 0) + +u16 GetExtIOStatus(int idx) +{ + u16 sta; + ExtIOCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_EXTIO) + { + pSta = (ExtIOCommand *)( &(g_extioList[idx].exbSta.cancomm.data.buff)); + sta = pSta->extIOSta.inputSta; + } + else + { + sta = 0; + } + return sta; +} + +void CleanExtIOStatus(int idx) +{ + ExtIOCommand * pSta; + if (idx > 0 && idx <= MAX_SUPPORT_EXTIO) + { + pSta = (ExtIOCommand *)( &(g_extioList[idx].exbSta.cancomm.data.buff)); + pSta->extIOSta.inputSta = 0; + } +} + +void RequestExtIOsStatus(void) +{ + RequestExtIOStatus(&(g_extioList[0])); // ͹㲥 + OutputsTask(); +} + +void RequestExtIOsVersion(void) +{ + RequestExtIOVersion(&(g_extioList[0])); // 㲥ѯ + + for(int i = 1; i < MAX_SUPPORT_EXTIO+1; i++) + { + g_extioList[i].regVal.rdnewbverflag = 1; + } +} + +void SetExtOutputOn(int idx, u16 bit) +{ + ExtIOCommand ncmd; + memset(&ncmd, 0, sizeof(ExtIOCommand)); + ncmd.extIOCtrl.cmd = CTRL_CMD_EXTIO_CTRL; + ncmd.extIOCtrl.subcmd = CTRL_SUBCMD_OUT_ON; + ncmd.extIOCtrl.outctrl = bit; + + SendExtIOCommand(&g_extioList[idx], &ncmd); + OutputsTask(); // ˢ +} + +void SetExtOutputOff(int idx, u16 bit) +{ + ExtIOCommand ncmd; + memset(&ncmd, 0, sizeof(ExtIOCommand)); + ncmd.extIOCtrl.cmd = CTRL_CMD_EXTIO_CTRL; + ncmd.extIOCtrl.subcmd = CTRL_SUBCMD_OUT_OFF; + ncmd.extIOCtrl.outctrl = bit; + + SendExtIOCommand(&g_extioList[idx], &ncmd); + OutputsTask(); // ˢ +} + +#endif + +#if (MAX_SUPPORT_SEWHD > 0) +void RequestSewHeadsStatus(void) +{ + RequestSewHeadStatus(&(g_sewHeadList[0])); // ͹㲥 + OutputsTask(); +} + +void RequestSewHeadsVersion(void) +{ + RequestSewHeadVersion(&(g_sewHeadList[0])); + for(int i = 1; i < MAX_SUPPORT_SEWHD+1; i++) + { + g_sewHeadList[i].regVal.rdnewbverflag = 1; + } +} + +void CleanSewHeadSta(int idx) +{ + memset(&(g_sewHeadList[idx].exbSta.cancomm.data.buff), 0, CAN_DATA_LEN); +} + +u16 GetSewHeadStatus(int idx) +{ + u16 sta; + SewHeadCommand * pSta; + pSta = (SewHeadCommand *)( &(g_sewHeadList[idx].exbSta.cancomm.data.buff)); + sta = pSta->headSta.staBits; + + return sta; +} + +void SendSewHeadCtrlCmd(int idx, u8 subcmd, u8 para1, u8 para2) +{ + SewHeadCommand ncmd; + + memset(&ncmd, 0, sizeof(SewHeadCommand)); + ncmd.headCtrl.cmd = CTRL_CMD_SEW_HEAD_CTRL; + ncmd.headCtrl.subcmd = subcmd; + ncmd.headCtrl.para[0] = para1; + ncmd.headCtrl.para[1] = para2; + + SendSewHeadCommand(&g_sewHeadList[idx], &ncmd); // ڵ + OutputsTask(); // ˢ +} +#endif + +#if (RD_HEAD_PARA_NUM > 0) +/* + * 0:ȷ + * -1:δ + * -2:CRCУ + * -3: + */ +int ReceiveBoardNvParaProc(CanRxMsg rxMsg, int id, u8 nodetype) +{ + if (id < 1 || id > RD_HEAD_PARA_NUM) + { + return -3; + } + + BoardFileCanCtrl * rxbuf = (BoardFileCanCtrl*)(&rxMsg.data); + int rslt = -1; + if ( rxbuf->head.sync[0] == CDP_SYNC[0] && + rxbuf->head.sync[1] == CDP_SYNC[1] && + rxbuf->head.sync[2] == CDP_SYNC[2] && + 1 ) // жǷΪݰͷ + { + if ((nodetype == FLAT_EMB_HEAD && rxbuf->head.pktId == 0) || // ƽͷ + (nodetype == CHENILLE_HEAD && rxbuf->head.pktId == 1) || // ëͷ + (nodetype == COIL_HEAD && rxbuf->head.pktId == 2) || // ƻͷ + (nodetype == 0 && rxbuf->head.pktId == 3) || // ëɫ + 0) + { + g_receiveEn[id-1] = 0x5A; + g_receivenum[id-1] = 0; + g_framenum[id-1] = rxbuf->head.fnum; + g_datacrc[id-1] = rxbuf->head.crc; + memset(&g_exbNvPara[id-1][0], 0, BOARD_PARA_SIZE); + } + } + else + { + if (g_receiveEn[id-1] == 0x5A) + { + // + memcpy(&g_exbNvPara[id-1][g_receivenum[id-1]*8], &rxbuf->data, CAN_DATA_LEN); + g_receivenum[id-1]++; + + if (g_receivenum[id-1] == g_framenum[id-1]) // + { + g_receiveEn[id-1] = 0; + u16 crc = CalcCrc16((u8*)(&g_exbNvPara[id-1][0]), BOARD_PARA_SIZE); + if (crc != g_datacrc[id-1]) + { + rslt = -2; + } + else + { + rslt = 0; + } + } + } + } + + return rslt; +} + +u8* GetBoardNvPara(int id) +{ + if (id < 1) + { + return NULL; + } + return (u8*)(&g_exbNvPara[id-1][0]); +} +#endif + +void ParaDataFromOperToCan(u8 protocol, OperPacket * pPkt, BoardFilePacketCtrl * pBoard) +{ + u32 exid = 0; +#if (MAX_SUPPORT_HEAD > 0 || MAX_SUPPORT_COLOR > 0) + int i = 0; + u8 nodeId = 0; // 0Ϊ㲥 +#endif + + memset(pBoard, 0, sizeof(BoardFilePacketCtrl)); + +#if (MAX_SUPPORT_HEAD > 0) + if (protocol == BN_PROTOCOL_HEAD) + { // ͷЭ,ֻ֪ڵͺӦĻͷż,ľĽڵID + if (pPkt->boardPara.nodeId != 0) + { + int hdnm = pPkt->boardPara.nodeId; // Ӧͷ + for (i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + if (g_headList[i].nodeTye == pPkt->boardPara.nodeType) + { + if (hdnm <= 1) + { + nodeId = g_headList[i].nodeId; + break; + } + else + { + hdnm--; + } + } + } + } + + if (pPkt->boardPara.nodeType == FLAT_EMB_HEAD) + { + pBoard->pktHead.head.pktId = 0; // ƽͷ + } + else if (pPkt->boardPara.nodeType == CHENILLE_HEAD) + { + pBoard->pktHead.head.pktId = 1; // ëͷ + } + else if (pPkt->boardPara.nodeType == COIL_HEAD) + { + pBoard->pktHead.head.pktId = 2; // ƻͷ + } + else + { + printf("set head para, nodeType unknown\r\n"); // 20230807,ֹڵͷʹ + return; + } + } + else +#endif +#if (MAX_SUPPORT_COLOR > 0) + if (protocol == BN_PROTOCOL_COLOR) + { + u8 boardnum = pPkt->boardPara.nodeId; + if (boardnum == 0 || boardnum > MAX_SUPPORT_COLOR) + { + return; // 20220628 ֹ֧㲥,ֹҷ + } + nodeId = g_colorList[boardnum].nodeId; + if (boardnum == 2) + { + pBoard->pktHead.head.pktId = 3; // ëɫ + } + } + else +#endif + { + printf("not support protocol\r\n"); + return; + } + + memcpy(pBoard->pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + + pBoard->pktHead.head.fnum = BOARD_PARA_SIZE/CAN_DATA_LEN; + + for (int j = 0; j < pBoard->pktHead.head.fnum; j++) + { + memcpy(&pBoard->pktData[j].data, &pPkt->boardPara.exData[j*CAN_DATA_LEN], CAN_DATA_LEN); + } + + pBoard->pktHead.head.crc = CalcCrc16((u8*)pBoard->pktData, BOARD_PARA_SIZE); + +#if (MAX_SUPPORT_HEAD > 0) + if (protocol == BN_PROTOCOL_HEAD) + { + if (i <= MAX_SUPPORT_HEAD) // ҵӦĽڵ㲥 + { + exid = MAKE_EXID(BN_PROTOCOL_HEAD, nodeId, g_curBoardID, BN_CMD_NVPARA); + } + } + else +#endif +#if (MAX_SUPPORT_COLOR > 0) + if (protocol == BN_PROTOCOL_COLOR) + { + exid = MAKE_EXID(BN_PROTOCOL_COLOR, nodeId, g_curBoardID, BN_CMD_NVPARA); + } + else +#endif + { + } + + if (exid != 0) + { + SendPacketDataWithCanFrame(exid, pBoard); + } +} + +// CAN֡ĸʽݰ +void SendPacketDataWithCanFrame(u32 exid, BoardFilePacketCtrl * pBoard) +{ + CanTxMsg txMsg; + txMsg.canTxhead.ExtId = exid; + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + + for (int idx = 0; idx < pBoard->pktHead.head.fnum+1; idx++) + { + memcpy(&txMsg.data, ((u8*)&pBoard->pktHead)+idx*CAN_DATA_LEN, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + DelayMs(1); + } +} + +s32 GetHeadPara(void) +{ + return headparaval; +} + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- diff --git a/EMBOS/Users/EmbFunc/extendboards/extendboards.h b/EMBOS/Users/EmbFunc/extendboards/extendboards.h new file mode 100644 index 0000000..16e862f --- /dev/null +++ b/EMBOS/Users/EmbFunc/extendboards/extendboards.h @@ -0,0 +1,184 @@ + +#ifndef __EXTENDBOARDS_H__ +#define __EXTENDBOARDS_H__ + +//------------------------------------------------------------------------------------ + +// ͨ߿ƵΧ忨 + +//------------------------------------------------------------------------------------ + +#include "corecontrol.h" +#include "headcontrol.h" +#include "colorcontrol.h" +#include "extiocontrol.h" +#include "sewhdcontrol.h" +#include "transdata.h" +#include "operator.h" + +//------------------------------------------------------------------------------------ + +#define BN_ID_CORE_1 0x01 +#define BN_ID_CORE_2 0x02 +#define BN_ID_CORE_3 0x03 + +//------------------------------------------------------------------------------------ + +#ifndef MAX_SUPPORT_CORE +#define MAX_SUPPORT_CORE 1 +#endif + +#ifndef CUR_COREBOARD_ID +#define CUR_COREBOARD_ID BN_ID_CORE_1 +#endif + +#ifndef CUR_CORE_IDX +#define CUR_CORE_IDX 0 +#endif + +//------------------------------------------------------------------------------------ + +#ifndef RD_HEAD_PARA_NUM +#define RD_HEAD_PARA_NUM 0 +#endif + +#ifndef MAX_SUPPORT_HEAD +#define MAX_SUPPORT_HEAD 0 +#endif + +//------------------------------------------------ + +#ifndef MAX_SUPPORT_SEWHD +#define MAX_SUPPORT_SEWHD 0 +#endif + +#ifndef MAX_SUPPORT_COLOR +#define MAX_SUPPORT_COLOR 0 +#endif + +#ifndef MAX_SUPPORT_EXTIO +#define MAX_SUPPORT_EXTIO 0 +#endif + +#ifndef HEAD_NODEID_BASE +#define HEAD_NODEID_BASE 21 // ͷʼID +#endif + +#ifndef COLOR_NODEID_BASE +#define COLOR_NODEID_BASE 18 // ɫʼID +#endif + +#ifndef EXTIO_NODEID_BASE +#define EXTIO_NODEID_BASE 2 // IOչʼID +#endif + +#ifndef SEWHD_NODEID_BASE +#define SEWHD_NODEID_BASE 21 // ͷʼID +#endif +//------------------------------------------------------------------------------------ +#define BOARD_PARA_SIZE 256 // ݶ256ֽ(һĴС) + +//------------------------------------------------------------------------------------ +void InitBoardsList(void); +void InitExtendBoards(void); +void InputsTask(void); +void OutputsTask(void); +void ExtendBoardTask(void); + +//------------------------------------------------------------------------------------ + +CoreControl * GetCoreFromList(u8 id); +HeadControl * GetHeadFromList(u8 id); +ColorControl * GetColorFromList(u8 id); +ExtIOControl * GetExtIOFromList(u8 id); + +int GetCurBoardID(void); + +//------------------------------------------------------------------------------------ +#if (MAX_SUPPORT_CORE > 0) + +int IsNewControlCommand(void); +void RequestExStatus(void); + +#endif + +//------------------------------------------------------------------------------------ + +void StartBoardUpdate(u8 protocol, u8 nodetype, u8 nodeid); +void SetBoardNvPara(int protocolType, int nodetype, int nodeId, u8 parablockID, u8 paraID, s32 paraVal); + +//------------------------------------------------------------------------------------ +#if (MAX_SUPPORT_HEAD > 0) +// +void EnterTraverse(void); +int TraverseSingleNode(u8 traNodeType, u8 traNodeId); // ߱ +int CurNodeTraverseAlready(u32 nodeid); +void ExitTravers(void); // ˳ +void InquireBusSta(int idx); + +u32 GetHeadStatus(int idx); +void CleanHeadStatus(int idx); +void RequestHeadsStatus(void); + +void RequestHeadsVersion(void); +void RequestAHeadNvPara(int idx); + +void SendHeadAngCmd(int idx, u8 para1, u16 para2, u8 para3); +void SetHeadNvParaCmd(int nodetype, int idx, u8 parablockid, u8 paraid, s32 paraval); + +u16 GetHeadPotValue(int idx); +int GetHeadCurrentNeele(int idx); +#endif + +#if (MAX_SUPPORT_COLOR > 0) + +void RequestColorsVersion(void); +void RequestAColorNvPara(int idx); + +void SendColorCtrlCmd(int idx, u8 subcmd, u8 para1, u8 para2); // ɫ +void SetColorNvParaCmd(int idx, u8 parablockid, u8 paraid, s32 paraval); +void SendColorParaCmd(int idx, u8 para1); + +void CleanColorSta(int idx); +u16 GetColorStatus(int idx); +u16 GetColorPotValue(int idx); +int GetColorCurrentNeele(int idx); +void RequestColorsStatus(void); + +#endif + +#if (MAX_SUPPORT_EXTIO > 0) +u16 GetExtIOStatus(int idx); +void CleanExtIOStatus(int idx); +void RequestExtIOsStatus(void); + +void RequestExtIOsVersion(void); + +void SetExtOutputOn(int idx, u16 bit); +void SetExtOutputOff(int idx, u16 bit); + +#endif + +#if (MAX_SUPPORT_SEWHD > 0) +void RequestSewHeadsStatus(void); +void RequestSewHeadsVersion(void); +u16 GetSewHeadStatus(int idx); +void SendSewHeadCtrlCmd(int idx, u8 subcmd, u8 para1, u8 para2); +void CleanSewHeadSta(int idx); +#endif + +#if (RD_HEAD_PARA_NUM > 0) + +int ReceiveBoardNvParaProc(CanRxMsg rxMsg, int id, u8 nodetype); +u8* GetBoardNvPara(int id); + +#endif + +void ParaDataFromOperToCan(u8 protocol, OperPacket * pPkt, BoardFilePacketCtrl * pBoard); +void SendPacketDataWithCanFrame(u32 exid, BoardFilePacketCtrl * pBoard); + +s32 GetHeadPara(void); + +//------------------------------------------------------------------------------------ + +#endif /* __EXTENDBOARDS_H__ */ diff --git a/EMBOS/Users/EmbFunc/movectrl/movectrl.c b/EMBOS/Users/EmbFunc/movectrl/movectrl.c new file mode 100644 index 0000000..0597a2a --- /dev/null +++ b/EMBOS/Users/EmbFunc/movectrl/movectrl.c @@ -0,0 +1,1883 @@ + +#define _IN_MOVECTRL_C + +#include "movectrl.h" + +//---------------------------------------------------------------------------------------------------- + +#include "delay.h" +#include "trigger.h" +#include "inout.h" +#include "shell.h" +#include "error.h" +#include "workctrl.h" + +#ifndef IsStopButton +#define IsStopButton GetInputNullOff +#endif + + +//---------------------------------------------------------------------------------------------------- + +__weak void NormalRefPosition(u32 para, s32 * posilist) +{ +} + +//---------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------- + +// ֹͣ +int GetCommonEms(void) +{ + int err = ERR_NONE; + + TasksWhenDelay(); + + return err; +} + +// ֹͣ +int GetCommonQStop(void) +{ + int err = ERR_NONE; + + return err; +} + +// ֹͨͣ +int GetCommonNStop(void) +{ + int err = ERR_NONE; + +#if (0) + if (err == ERR_NONE && + IsConsoleCancel() != 0 && // նֹͣ + 1 ) + { + printf("get console cancel\r\n"); + err = STA_NORMAL_STOP; + } +#endif + +#if (1) + if (err == ERR_NONE && + IsStopButton() == SENSOR_ON && // ͣť + 1 ) + { + printf("get stop button down\r\n"); + err = STA_NORMAL_STOP; + } +#endif + + return err; +} + + +//---------------------------------------------------------------------------------------------------- + +// ˶λ⣨㣩 +#if (1) + +#define ADJ_RUN_MVMT(cm) ((cm)*3) +#define ADJ_FAN_MVMT(cm) ((cm)*36/360) +#define CANC_MVMT(cm) ((cm)*288/360) + +#define ADJ_WAVE_MVMT(cm) ((cm)*10/360) +#define ADJ_WVC_MVMT(cm) ((cm)*1/360) + + +// ͣ +int RSensorEmsScan(u32 para1, u32 para2) +{ + int rslt = GetCommonEms(); + + return rslt; +} + +// ֹͣ +int RSensorQStopScan(u32 para1, u32 para2) +{ + int rslt; + RSenserCheck * pchk; + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + pchk = (RSenserCheck *)para1; + if (pchk == NULL) + { + return STA_NORMAL_STOP; + } + + if (pchk->zeroflag == 0) // ûоλ + { + pchk->cansflag = 0; + if (pchk->sensorscan != NULL) + { + if (pchk->sensorscan() == pchk->val) // ⵽λ + { +// printf("1. first in sensor area when run\r\n"); + pchk->zeroflag = 1; // þ־ + pchk->canscount = g_motosPara.motosPos[pchk->axisIdx]; + } + } + } + else + { + if (pchk->cansflag == 0) // ûλ + { + if (pchk->sensorscan != NULL) + { + if (pchk->sensorscan() != pchk->val) // Ǵλ + { + if (abs(g_motosPara.motosPos[pchk->axisIdx] - pchk->canscount) > pchk->cansmvmt) + { +// printf("1. first out zero area when run\r\n"); + pchk->cansflag = 1; + } + } + } + } + else + { + if (pchk->sensorscan != NULL) + { + if (pchk->sensorscan() == pchk->val) // ⴫λ + { +// printf("1. in sensor area when run\r\n"); + rslt = STA_NORMAL_STOP; + } + } + } + } + + return rslt; +} + +// ֹͨͣ +int RSensorNStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + return rslt; +} + +//------------------------------------------------------------------ + +// ,˶ +int RoundRunToSensor(RSenserCheck * pck) +{ + return RoundRunToSensorBase(pck, 0); +} + +// ˶Ե +int RoundRunToSensorEdge(RSenserCheck * pck) +{ + return RoundRunToSensorBase(pck, 1); +} + +// ˶ +int RoundRunToSensorCenter(RSenserCheck * pck) +{ + return RoundRunToSensorBase(pck, 2); +} + +// +// flag,ɹתĸλ 0,޶ 1,תԵλ 2,תλ +int RoundRunToSensorBase(RSenserCheck * pck, int flag) +{ + int rslt, err, i; + InterMoveCtrl lmctrl; + u16 axisIdx; + u32 interLong; + + if (pck == NULL) + { + return -1; + } + + axisIdx = pck->axisIdx; + assert_param(axisIdx < AXIS_NUM); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = pck->vAxisId; // ʹ + lmctrl.motosConfig.newConfig = pck->newCfg; // Ҫµ + pck->cansmvmt = CANC_MVMT(pck->circleNum); + + if (1 && + pck->newCfg == 0 && + pck->syncflag != 0 && + 1 ) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pck->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = ADJ_RUN_MVMT(pck->circleNum); + } + } + } + else + { + lmctrl.motosConfig.axisConfig[axisIdx].axisConfig = pck->axisCfg; // ʵ + lmctrl.motosConfig.axisConfig[axisIdx].poutType = pck->axisOtp; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[axisIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[axisIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + + lmctrl.mvmtPara.movement[axisIdx] = ADJ_RUN_MVMT(pck->circleNum); // ˶0˶˶ȣλp + } + + interLong = abs(ADJ_RUN_MVMT(pck->circleNum)); + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = interLong; // 岹λƣڻmovementеֵ + lmctrl.mvmtPara.pulsePerSegment = abs(pck->circleNum); // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pck->rspd.stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pck->rspd.stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pck->rspd.runSpd; // ٶ + lmctrl.spdPara.slowPPS = pck->rspd.runSpd; // ٶ + lmctrl.spdPara.addPPSG = pck->rspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pck->rspd.spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pck->rspd.brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.GetNormalStop = RSensorNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = RSensorQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetEmergencyStop = RSensorEmsScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.condPara1 = (u32)(pck);; + lmctrl.condPara2 = 0; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + if (rslt == 3) // ͣ + { + DelayRef(100); // ȴеȶ + + // ¼鴫λ + if (pck->sensorscan != NULL) + { + if (pck->sensorscan() != pck->val) // λãôתλ + { + printf("not at sensor\r\n"); + if ( + pck->newCfg == 0 && + pck->syncflag != 0 ) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pck->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = ADJ_FAN_MVMT(pck->circleNum)*(-1); + } + } + } + else + { + lmctrl.mvmtPara.movement[axisIdx] = ADJ_FAN_MVMT(pck->circleNum)*(-1); + } + + lmctrl.motosConfig.newConfig = 0; + + rslt = InterpolationMotion(&lmctrl); // ˶ + } + } + } + + err = GetMoveResultError(rslt, lmctrl.errInfo); + +#if (1) + if (flag != 0) + { + // ڶҵλ + if ((err == STA_NORMAL_STOP || err == ERR_NONE) && + pck->sensorscan() == pck->val && // ڴλ + 1 ) + { +// printf("move to edge\r\n"); + int gapcount, pcount; + + // ȡ + if (pck->val == SENSOR_ON) + { + pck->val = SENSOR_OFF; + } + else + { + pck->val = SENSOR_ON; + } + + // ٶȿƲ,ʹٶ + lmctrl.spdPara.startPPS = pck->rspd.stspSpd/2; // ٶ + lmctrl.spdPara.stopPPS = pck->rspd.stspSpd/2; // ֹͣٶ + lmctrl.spdPara.runPPS = pck->rspd.runSpd/2; // ٶ + lmctrl.spdPara.slowPPS = pck->rspd.runSpd/2; // ٶ + lmctrl.spdPara.addPPSG = pck->rspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pck->rspd.spdAdd; // ټٶ + lmctrl.spdPara.brkPPSG = pck->rspd.brkAdd; // ɲٶ + + if ( + pck->newCfg == 0 && + pck->syncflag != 0 ) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pck->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = ADJ_FAN_MVMT(pck->circleNum)*(-1); + } + } + } + else + { + lmctrl.mvmtPara.movement[axisIdx] = ADJ_FAN_MVMT(pck->circleNum)*(-1); + } + + pck->cansflag = 0; + pck->cansmvmt = ADJ_WVC_MVMT(pck->circleNum); + + lmctrl.motosConfig.newConfig = 0; + + rslt = InterpolationMotion(&lmctrl); // ˶, ˶Ե + err = GetMoveResultError(rslt, lmctrl.errInfo); + +#if (1) + if (flag == 2) + { + if ((err == STA_NORMAL_STOP || err == ERR_NONE) && + pck->sensorscan() == pck->val && + 1 ) + { + pcount = GetMotoCounter(axisIdx); // ȡλ + + // + if ( + pck->newCfg == 0 && + pck->syncflag != 0) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pck->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = ADJ_FAN_MVMT(pck->circleNum); + } + } + } + else + { + lmctrl.mvmtPara.movement[axisIdx] = ADJ_FAN_MVMT(pck->circleNum); + } + + pck->cansflag = 0; + pck->cansmvmt = ADJ_WVC_MVMT(pck->circleNum); + + rslt = InterpolationMotion(&lmctrl); // ˶, ˶ıԵ + err = GetMoveResultError(rslt, lmctrl.errInfo); + + if ((err == STA_NORMAL_STOP || err == ERR_NONE) && + pck->sensorscan() == pck->val && + 1 ) + { + gapcount = abs(GetMotoCounter(axisIdx) - pcount); // ȡλ + gapcount /= 2; + + if (gapcount != 0) + { + if ( + pck->newCfg == 0 && + pck->syncflag != 0 ) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pck->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = gapcount*(-1); + } + } + } + else + { + lmctrl.mvmtPara.movement[axisIdx] = gapcount*(-1); + } + + lmctrl.GetNormalStop = NULL; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = NULL; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.stopMode = STOP_MODE_TAB; // ֹͣ˶ʽ + + lmctrl.spdPara.startPPS = pck->rspd.runSpd; // ٶ + lmctrl.spdPara.stopPPS = pck->rspd.runSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pck->rspd.runSpd; // ٶ + + rslt = InterpolationMotion(&lmctrl); // ˶ + err = GetMoveResultError(rslt, lmctrl.errInfo); + } + } + } + } +#endif + } + } +#endif + + return err; +} + +//------------------------------------------------------------------ + +// ͣ +int RMotoRunEmsScan(u32 para1, u32 para2) +{ + RMotoRun * pmr; + int rslt = GetCommonEms(); + pmr = (RMotoRun *)para1; + + if (pmr->RRunProc != NULL) + { + pmr->RRunProc(); + } + + return rslt; +} + +// ֹͣ +int RMotoRunQStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + return rslt; +} + +// ֹͨͣ +int RMotoRunNStopScan(u32 para1, u32 para2) +{ + int rslt; + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE) + { + return rslt; + } + + return rslt; +} + +// ƫ˶ +int RoundRunAsOffset(RMotoRun * pmr) +{ + int rslt, err, i; + InterMoveCtrl lmctrl; + int axisIdx; + int movmt; + + if (pmr == NULL) + { + return ERR_MV_PARA; + } + + movmt = 0; + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = pmr->vAxisId; // ʹ + lmctrl.motosConfig.newConfig = pmr->newCfg; // Ҫµ + for (i = 0; i < AXIS_NUM; i++) + { + axisIdx = pmr->config[i].axisIdx; + if (axisIdx >= 0) + { + assert_param(axisIdx < AXIS_NUM); + + lmctrl.motosConfig.axisConfig[axisIdx].axisConfig = pmr->config[i].axisCfg; // ʵ + lmctrl.motosConfig.axisConfig[axisIdx].poutType = pmr->config[i].poutType; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[axisIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[axisIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[axisIdx] = pmr->config[i].movement; // ˶0˶˶ȣλp + if (pmr->config[i].movement != 0) + { + movmt = pmr->config[i].movement; + } + } + } + +// printf("round run as offset, movmt=%d\r\n", movmt); + + if (movmt == 0) // ˶ + { + return ERR_NONE; + } + + lmctrl.mvmtPara.extraRepeat = pmr->mrepeat; // ظ + lmctrl.mvmtPara.interLong = pmr->interLong; // 岹λƣڻmovementеֵ + lmctrl.mvmtPara.pulsePerSegment = pmr->segmentNum; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pmr->rspd.stspSpd; + lmctrl.spdPara.stopPPS = pmr->rspd.stspSpd; + lmctrl.spdPara.slowPPS = pmr->rspd.stspSpd; + lmctrl.spdPara.runPPS = pmr->rspd.runSpd; + lmctrl.spdPara.addPPSG = pmr->rspd.spdAdd; + lmctrl.spdPara.decPPSG = pmr->rspd.spdAdd; + lmctrl.spdPara.brkPPSG = pmr->rspd.brkAdd; // ֹͣٶ + + lmctrl.stopMode = STOP_MODE_TAB; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + + if (pmr->escStop != 0) + { +// printf("stop condition is null\r\n"); + lmctrl.GetNormalStop = NULL; + lmctrl.GetQuickStop = NULL; + } + else + { +// printf("stop condition is r move stop\r\n"); + lmctrl.GetNormalStop = RMotoRunNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = RMotoRunQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + } + + lmctrl.GetEmergencyStop = RMotoRunEmsScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.condPara1 = (u32)(pmr);; + lmctrl.condPara2 = 0; // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} + +#endif + +//---------------------------------------------------------------------------------------------------- + +#if (1) + +// ͣ +int MoveToSensorEmsScan(u32 para1, u32 para2) +{ + int rslt; + MTSCtrl * pmts; + + pmts = (MTSCtrl*)(para1); + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + if (pmts->emcstopscan != NULL) + { + rslt = pmts->emcstopscan(); + } + + if (rslt != ERR_NONE) + { + return rslt; + } + + if (pmts->movement > 0) + { + if (pmts->limitpsensor != NULL) // λ + { + if (pmts->limitpsensor() == SENSOR_ON) + { + rslt = ERR_LMT_POSITIVE; // λ + } + } + } + else if (pmts->movement < 0) + { + if (pmts->limitnsensor != NULL) // ⷴλ + { + if (pmts->limitnsensor() == SENSOR_ON) + { + rslt = ERR_LMT_NEGATIVE; // λ + } + } + } + else + { + rslt = ERR_MTZ_ERROR; // + } + + return rslt; +} + +// ֹͨͣ +int MoveToSensorNStopScan(u32 para1, u32 para2) +{ + int rslt; + MTSCtrl * pmts; + + pmts = (MTSCtrl*)(para1); + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + return rslt; +} + +// ֹͣ +int MoveToSensorQStopScan(u32 para1, u32 para2) +{ + int rslt; + MTSCtrl * pmts; + + pmts = (MTSCtrl*)(para1); + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + if (rslt == ERR_NONE) + { + if (pmts->zerosensor != NULL) // λ + { + if (pmts->zerosensor() == pmts->zeroval) + { + rslt = STA_MTZ_SUCCESS; // ɹ + } + } + } + + return rslt; +} + +// ټ +int MoveToSensorSlowScan(u32 para1, u32 para2) +{ + int rslt; + MTSCtrl * pmts; + + pmts = (MTSCtrl*)(para1); + rslt = 0; + + if (pmts != NULL) + { + if (pmts->slowsensor != NULL) // ⽵ + { + if (pmts->slowsensor() == SENSOR_ON) + { + pmts->slowsta = 1; + } + } + } + + rslt = pmts->slowsta; // ״̬ + return rslt; +} + +//------------------------------------------------ +// ֱ˶ +int LineRunToSensorCtrl(MTSCtrl * pmtsc) +{ + int rslt, err, poismv; + InterMoveCtrl lmctrl; + u16 axisIdx; + int i; + + if (pmtsc == NULL) + { + return -1; + } + + axisIdx = pmtsc->axisIdx; + assert_param(axisIdx < AXIS_NUM); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = pmtsc->vAxisId; // ʹ + lmctrl.motosConfig.newConfig = pmtsc->newCfg; // Ҫµ + + if ( + pmtsc->newCfg == 0 && + pmtsc->syncflag != 0) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pmtsc->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = pmtsc->movement; // ˶0˶˶ȣλp + } + } + } + else + { + lmctrl.motosConfig.axisConfig[axisIdx].axisConfig = pmtsc->axisCfg; // ʵ + lmctrl.motosConfig.axisConfig[axisIdx].poutType = pmtsc->poutType; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[axisIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[axisIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + + lmctrl.mvmtPara.movement[axisIdx] = pmtsc->movement; // ˶0˶˶ȣλp + } + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(pmtsc->movement); // 岹λƣڻmovementеֵ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pmtsc->lspd.stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pmtsc->lspd.stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pmtsc->lspd.runSpd; // ٶ + lmctrl.spdPara.slowPPS = pmtsc->lspd.stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pmtsc->lspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pmtsc->lspd.spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pmtsc->lspd.brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // йص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetSlowDown = MoveToSensorSlowScan; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.GetNormalStop = MoveToSensorNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = MoveToSensorQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetEmergencyStop = MoveToSensorEmsScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.condPara1 = (u32)(pmtsc); + lmctrl.condPara2 = 0; // + + // + err = ERR_NONE; + poismv = 0; + +#if (1) + if (pmtsc->syncflag == 0) + { + err = MoveToSensorEmsScan(lmctrl.condPara1, lmctrl.condPara2); // ⼱ͣ + if ((pmtsc->movement < 0 && err == ERR_LMT_NEGATIVE) || + (pmtsc->movement > 0 && err == ERR_LMT_POSITIVE) ) // λ + { + poismv = pmtsc->mvposi; // ˶ + } + + err = MoveToSensorQStopScan(lmctrl.condPara1, lmctrl.condPara2); // ֹͣ + if (err == STA_MTZ_SUCCESS) // λλ + { + poismv = pmtsc->mvposi; // ˶ + } + else if (err == ERR_NONE) + { + rslt = MoveToSensorSlowScan(lmctrl.condPara1, lmctrl.condPara2); // ڽ + if (rslt != ERR_NONE) + { + poismv = pmtsc->mvposi; // ˶ + } + } + else + { + } + } +#endif + + do + { + // ˶ + if (poismv != 0) + { + if (pmtsc->moveasoffset != NULL) + { + err = pmtsc->moveasoffset(poismv, &(pmtsc->lspd)); // ˶һξ + } + + if (err == ERR_NONE) + { + // ¼ + err = MoveToSensorEmsScan(lmctrl.condPara1, lmctrl.condPara2); // ⼱ͣ + if (err == ERR_NONE) + { + err = MoveToSensorQStopScan(lmctrl.condPara1, lmctrl.condPara2); // ֹͣ + if (err == ERR_NONE) + { + pmtsc->slowsta = 0; + } + } + } + } + + if (err == ERR_NONE) + { + s32 temp, val; + temp = GetMotoCounter(axisIdx); // λ + + rslt = InterpolationMotion(&lmctrl); // ˶ + + if (poismv == 0 && (rslt == 3 || rslt == 2)) + { + if (rslt == 3) + { + err = MoveToSensorQStopScan(lmctrl.condPara1, lmctrl.condPara2); // ֹͣ + if (err == STA_MTZ_SUCCESS && pmtsc->mvposi != 0) + { + val = GetMotoCounter(axisIdx); + if (abs(val-temp) < abs(pmtsc->mvposi/2)) // λ̫С + { + poismv = pmtsc->mvposi; // ˶ + continue; // ִһι + } + } + } + else if (rslt == 2) + { + err = MoveToSensorEmsScan(lmctrl.condPara1, lmctrl.condPara2); // ⼱ͣ + if ((pmtsc->movement < 0 && err == ERR_LMT_NEGATIVE) || + (pmtsc->movement > 0 && err == ERR_LMT_POSITIVE) ) // λ + { + poismv = pmtsc->mvposi; // ˶ + continue; // ִһι + } + } + } + + err = GetMoveResultError(rslt, lmctrl.errInfo); + } + + break; + }while(1); + + return err; +} + +//------------------------------------------------ + +#endif + +//---------------------------------------------------------------------------------------------------- + +#if (1) + +// ͣ +int MoveBHEmsScan(u32 para1, u32 para2) +{ + int rslt; + MVByHandCtrl * pmbhc; + + pmbhc = (MVByHandCtrl*)(para1); + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE || pmbhc == NULL) + { + return rslt; + } + + if (pmbhc->movement > 0) + { + if (pmbhc->limitpsensor != NULL) // λ + { + if (pmbhc->limitpsensor(pmbhc->para) == SENSOR_ON) + { + rslt = ERR_LMT_POSITIVE; // λ + } + } + } + else if (pmbhc->movement < 0) + { + if (pmbhc->limitnsensor != NULL) // ⷴλ + { + if (pmbhc->limitnsensor(pmbhc->para) == SENSOR_ON) + { + rslt = ERR_LMT_NEGATIVE; // λ + } + } + } + else + { + rslt = ERR_MTZ_ERROR; // + } + + return rslt; +} + +// ֹͨͣ +int MoveBHNStopScan(u32 para1, u32 para2) +{ + int rslt; + MVByHandCtrl * pmbhc; + + pmbhc = (MVByHandCtrl*)(para1); + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE || pmbhc == NULL) + { + return rslt; + } + if (rslt == ERR_NONE && pmbhc->stopscan != NULL) + { + rslt = pmbhc->stopscan(pmbhc->para); + } + + return rslt; +} + +// ټ +int MoveBHNSlowScan(u32 para1, u32 para2) +{ + int rslt; + MVByHandCtrl * pmbhc; + + pmbhc = (MVByHandCtrl*)(para1); + + rslt = ERR_NONE; + + if (pmbhc->slowscan != NULL) + { + rslt = pmbhc->slowscan(para2); + } + + return rslt; +} + +// ֹͣ +int MoveBHQStopScan(u32 para1, u32 para2) +{ + int rslt; + MVByHandCtrl * pmbhc; + + pmbhc = (MVByHandCtrl*)(para1); + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE || pmbhc == NULL) + { + return rslt; + } + + return rslt; +} + +// ֶƶ +int MoveByHandCtrl(MVByHandCtrl * pmbhc) +{ + int rslt, err, i; + u16 axisIdx; + InterMoveCtrl lmctrl; + + if (pmbhc == NULL) + { + return ERR_NONE; + } + + if (pmbhc->movement == 0) + { + return ERR_NONE; + } + + // Ⱦ׼ + if (pmbhc->precondition != NULL) + { + err = pmbhc->precondition(pmbhc->para); + if (err != ERR_NONE) + { + return err; + } + } + + axisIdx = pmbhc->axisIdx; + assert_param(axisIdx < AXIS_NUM); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = pmbhc->vAxisId; // ʹ + + lmctrl.motosConfig.newConfig = pmbhc->newCfg; // Ҫµ + + if ( + pmbhc->newCfg == 0 && + pmbhc->syncflag != 0) + { + for (i = 0; i < AXIS_NUM; i++) + { + if (pmbhc->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = pmbhc->movement; // ˶0˶˶ȣλp + } + } + } + else + { + lmctrl.motosConfig.axisConfig[axisIdx].axisConfig = pmbhc->axisCfg; // ʵ + lmctrl.motosConfig.axisConfig[axisIdx].poutType = pmbhc->poutType; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[axisIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[axisIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + lmctrl.mvmtPara.movement[axisIdx] = pmbhc->movement; // ˶0˶˶ȣλp + } + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(pmbhc->movement); // 岹λƣڻmovementеֵ + lmctrl.mvmtPara.pulsePerSegment = pmbhc->ppSegment; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pmbhc->hspd.stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pmbhc->hspd.stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pmbhc->hspd.runSpd; // ٶ + lmctrl.spdPara.slowPPS = pmbhc->hspd.stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pmbhc->hspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pmbhc->hspd.spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pmbhc->hspd.brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // ǰص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetSlowDown = MoveBHNSlowScan; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.GetNormalStop = MoveBHNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = MoveBHQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetEmergencyStop = MoveBHEmsScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.condPara1 = (u32)(pmbhc);; + lmctrl.condPara2 = (u32)(pmbhc->movement<0?-1:1); // + + rslt = InterpolationMotion(&lmctrl); // ˶ + + err = GetMoveResultError(rslt, lmctrl.errInfo); + + return err; +} + +#endif + +//------------------------------------------------ + +//------------------------------------------------------------------------------- +// 첽˶ +// ʹSTM32ٶ& +int SeparateExerStart(SepMoveCtrl * pCtrl) // 첽˶ +{ + int rslt; + MotoCtrl lmctrl; + u16 axisIdx; + u16 axisID; + int i; + + if (pCtrl == NULL) + { + return -1; + } + + axisIdx = pCtrl->axisIdx; + assert_param(axisIdx < AXIS_NUM); + + memset(&lmctrl, 0, sizeof(MotoCtrl)); + + lmctrl.movement = pCtrl->movement; // λ + + lmctrl.startPPS = pCtrl->startPPS; // ٶ + lmctrl.runPPS = pCtrl->runPPS; // ˶ٶ + lmctrl.addPPSG = pCtrl->addPPSG; // ͣٶ + lmctrl.brkPPSG = pCtrl->brkPPSG; // ɲٶ + + lmctrl.funTestTime = pCtrl->funTestTime; // йⲿʱ + for (i = 0; i < 6; i++) + { + lmctrl.syncList[i] = pCtrl->syncList[i]; // ͬƶѡ + } + + lmctrl.GetNormalStop = pCtrl->GetNormalStop; // һֹͣ + lmctrl.GetQuickStop = pCtrl->GetQuickStop; // ֹͣ + lmctrl.condPara1 = pCtrl->condPara1; // + lmctrl.condPara2 = pCtrl->condPara2; // + + lmctrl.blockRunflag = pCtrl->blockRunflag; // б־ + lmctrl.ExecWhenRun = pCtrl->ExecWhenRun; // йִеĺ + lmctrl.ExecWhenStart = pCtrl->ExecWhenStart; // ǰִеĺ + lmctrl.ExecWhenStop = pCtrl->ExecWhenStop; // ִֹͣеĺ + + axisID = axisIdx + 1; + if (pCtrl->newCfg != 0) + {// + if ((pCtrl->axisCfg & CONFIG_EN) != 0) // + { + if ((pCtrl->axisCfg & POA_EN) != 0) // A + { + SetAxisConfig(axisID, POUTA_EN); + } + else + { + SetAxisConfig(axisID, POUTA_DIS); + } + + if ((pCtrl->axisCfg & POB_EN) != 0) // B + { + SetAxisConfig(axisID, POUTB_EN); + } + else + { + SetAxisConfig(axisID, POUTB_DIS); + } + + if ((pCtrl->axisCfg & SON_EN) != 0) // ŷON + { + SetAxisConfig(axisID, SERVO_ON); + } + else + { + SetAxisConfig(axisID, SERVO_OFF); + } + + if ((pCtrl->axisCfg & ALM_LEVH) != 0) // ƽΪ + { + SetAxisAlarmConfig(axisID, ALM_LEV_HIGH); + } + else + { + SetAxisAlarmConfig(axisID, ALM_LEV_LOW); + } + + if ((pCtrl->axisCfg & ALM_EN) != 0) // ͣ + { + SetAxisAlarmConfig(axisID, ALM_STOP_EN); + } + else + { + SetAxisAlarmConfig(axisID, ALM_STOP_DIS); + } + + if ((pCtrl->axisCfg & POUT_EN) != 0) // + { + SetAxisConfig(axisID, pCtrl->poutType); // ģʽ 巽ʽ + } + else + { + SetAxisConfig(axisID, POUT_DISABLE); // ֹ + } + } + } +#if (STM32_MOTOS_NUM >= 1) + if (((axisID == 1) || (lmctrl.syncList[1-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(1, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(1, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto1Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif +#if (STM32_MOTOS_NUM >= 2) + if (((axisID == 2) || (lmctrl.syncList[2-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(2, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(2, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto2Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif +#if (STM32_MOTOS_NUM >= 3) + if (((axisID == 3) || (lmctrl.syncList[3-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(3, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(3, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto3Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif +#if (STM32_MOTOS_NUM >= 4) + if (((axisID == 4) || (lmctrl.syncList[4-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(4, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(4, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto4Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif +#if (STM32_MOTOS_NUM >= 5) + if (((axisID == 5) || (lmctrl.syncList[5-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(5, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(5, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto5Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif +#if (STM32_MOTOS_NUM >= 6) + if (((axisID == 6) || (lmctrl.syncList[6-1] == 1)) && (pCtrl->useOutPort == 0)) + { + SetAxisConfig(6, POUT_ENABLE_BUSIO); // :Ϊڲֱӿģʽ + SetAxisConfig(6, DATI_BUS_IO); // ڲֱӿģʽ + SetSTM32Moto6Mode(MODE_STEPDIR); // ģʽΪ/ʽ + } +#endif + + switch (axisIdx) + { +#if (STM32_MOTOS_NUM >= 1) + case 0: + rslt = STM32Moto1Start(&lmctrl); + break; +#endif +#if (STM32_MOTOS_NUM >= 2) + case 1: + rslt = STM32Moto2Start(&lmctrl); + break; +#endif +#if (STM32_MOTOS_NUM >= 3) + case 2: + rslt = STM32Moto3Start(&lmctrl); + break; +#endif +#if (STM32_MOTOS_NUM >= 4) + case 3: + rslt = STM32Moto4Start(&lmctrl); + break; +#endif +#if (STM32_MOTOS_NUM >= 5) + case 4: + rslt = STM32Moto5Start(&lmctrl); + break; +#endif +#if (STM32_MOTOS_NUM >= 6) + case 5: + rslt = STM32Moto6Start(&lmctrl); + break; +#endif + default: + rslt = ERR_MV_PARA; // + break; + } + + return rslt; +} + +//------------------------------------------------ +// 첽˶ ֹͣ +int SeparateExerStop(u16 axisIdx) +{ + int rslt; + + assert_param(axisIdx < AXIS_NUM); + + rslt = ERR_NONE; + + switch (axisIdx) + { + case 0: +#if (STM32_MOTOS_NUM >= 1) + STM32Moto1Stop(); + break; +#endif +#if (STM32_MOTOS_NUM >= 2) + case 1: + STM32Moto2Stop(); + break; +#endif +#if (STM32_MOTOS_NUM >= 3) + case 2: + STM32Moto3Stop(); + break; +#endif +#if (STM32_MOTOS_NUM >= 4) + case 3: + STM32Moto4Stop(); + break; +#endif +#if (STM32_MOTOS_NUM >= 5) + case 4: + STM32Moto5Stop(); + break; +#endif +#if (STM32_MOTOS_NUM >= 6) + case 5: + STM32Moto6Stop(); + break; +#endif + default: + rslt = ERR_MV_PARA; // + break; + } + + return rslt; +} + +//------------------------------------------------ +int GetSeparateExerState(u16 axisIdx) // 첽˶ õǰ״̬ +{ + int rslt,err; + + assert_param(axisIdx < AXIS_NUM); + + rslt = ERR_NONE; + + switch (axisIdx) + { +#if (STM32_MOTOS_NUM >= 1) + case 0: + rslt = GetSTM32Moto1State(); + break; +#endif +#if (STM32_MOTOS_NUM >= 2) + case 1: + rslt = GetSTM32Moto2State(); + break; +#endif +#if (STM32_MOTOS_NUM >= 3) + case 2: + rslt = GetSTM32Moto3State(); + break; +#endif +#if (STM32_MOTOS_NUM >= 4) + case 3: + rslt = GetSTM32Moto4State(); + break; +#endif +#if (STM32_MOTOS_NUM >= 5) + case 4: + rslt = GetSTM32Moto5State(); + break; +#endif +#if (STM32_MOTOS_NUM >= 6) + case 5: + rslt = GetSTM32Moto6State(); + break; +#endif + default: + rslt = ERR_MV_PARA; // + break; + } + + if (rslt == STM32MOTO_STOP) + { + err = STA_PROCESS_FINISH; // ִ + } + else + { + //err = STA_PROCESS_RUNNING; // ִй + err = rslt; // ״̬ + } + + return err; +} + +//------------------------------------------------ + +//------------------------------------------------------------------------------- +// תΪ -180--180֮ +void ChangeRotToNP180(s32 * pval) +{ + while (*pval > (ROT_PULSE_PER_CIRCLE/2)) + { + *pval -= (s32)(ROT_PULSE_PER_CIRCLE); + } + + while (*pval < ((s32)(ROT_PULSE_PER_CIRCLE/2) * -1)) + { + *pval += (s32)(ROT_PULSE_PER_CIRCLE); + } +} + +// תΪ -360--360֮ +void ChangeRotToNP360(s32 * pval) +{ + while (*pval < ((s32)(ROT_PULSE_PER_CIRCLE) * -1)) + { + *pval += (s32)(ROT_PULSE_PER_CIRCLE); + } + + while(*pval > ((s32)(ROT_PULSE_PER_CIRCLE))) + { + *pval -= (s32)(ROT_PULSE_PER_CIRCLE); + } +} + +// תΪ 0--360֮ +void ChangeRotTo0To360(s32 * pval) +{ + while (*pval < 0) + { + *pval += (s32)(ROT_PULSE_PER_CIRCLE); + } + + while(*pval > ((s32)(ROT_PULSE_PER_CIRCLE))) + { + *pval -= (s32)(ROT_PULSE_PER_CIRCLE); + } +} + +// תΪ -360--0֮ +void ChangeRotToN360To0(s32 * pval) +{ + while (*pval > 0) + { + *pval -= (s32)(ROT_PULSE_PER_CIRCLE); + } + + while (*pval < ((s32)(ROT_PULSE_PER_CIRCLE) * -1)) + { + *pval += (s32)(ROT_PULSE_PER_CIRCLE); + } +} +// +int GetMoveResultError(int rslt, int errinfo) +{ + int err; + switch (rslt) + { + case -1: // + err = ERR_MV_PARA; + break; + case -2: // ݴ + err = ERR_FILL_DATA; + break; + case -3: // FPGAд + err = ERR_FPGA_RESET; // FPGAλ + break; + case -4: // FPGA汾 + err = ERR_FPGA_ERR; // ˶оƬ汾 + break; + case 1: // + err = ERR_DRIVER; + break; + case 0: // ˶ִ + case 2: // ֹͣͣ + case 3: // ֹͣͣ + case 4: // ͨͣͣ + err = errinfo; + break; + case 5: + err = ERR_FPGA_RESET; + break; + default: // + err = ERR_NONE; + break; + } + return err; +} + +//--------------------------------------------------- + +// Ƕת +// pdir == 0, תΪ -180--180֮, +// pdir != 0 ôתΪ 0-- 360֮ +void ChangeMsToNP180(s32 * pval, int pdir) +{ + while (*pval < ((s32)(MS_PULSE_PER_CIRCLE/2) * -1)) + { + *pval += (s32)(MS_PULSE_PER_CIRCLE); + } + + while (*pval > ((s32)(MS_PULSE_PER_CIRCLE/2))) + { + *pval -= (s32)(MS_PULSE_PER_CIRCLE); + } + + if (pdir != 0) // ת + { + if (*pval < 0) + { + *pval += MS_PULSE_PER_CIRCLE; + } + } +} + +void ChangeMsToNP360(s32 * pval) +{ + *pval %= MS_PULSE_PER_CIRCLE; + + while (*pval < ((s32)(MS_PULSE_PER_CIRCLE) * -1)) + { + *pval += (s32)(MS_PULSE_PER_CIRCLE); + } + + while(*pval > ((s32)(MS_PULSE_PER_CIRCLE))) + { + *pval -= (s32)(MS_PULSE_PER_CIRCLE); + } +} + +void ChangeMsTo0To360(s32 * pval) +{ + *pval %= MS_PULSE_PER_CIRCLE; + + while (*pval < 0) + { + *pval += (s32)(MS_PULSE_PER_CIRCLE); + } + + while(*pval > ((s32)(MS_PULSE_PER_CIRCLE))) + { + *pval -= (s32)(MS_PULSE_PER_CIRCLE); + } +} + +//-------------------------------------------------------------------------------- +// ֹͨͣ +int MoveToSensorAsMidPosNStopScan(u32 para1, u32 para2) +{ + int rslt; + MTSAMPCtrl * pmts; + + pmts = (MTSAMPCtrl*)(para1); + + rslt = GetCommonNStop(); + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + return rslt; +} + +// ֹͣ +int MoveToSensorAsMidPosQStopScan(u32 para1, u32 para2) +{ + int rslt; + MTSAMPCtrl * pmts; + + pmts = (MTSAMPCtrl*)(para1); + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + if (rslt == ERR_NONE) + { + if (pmts->zerosensor != NULL) // λ + { + if (pmts->zerosensor() == pmts->zeroval) + { + rslt = STA_MTZ_SUCCESS; // ɹ + } + } + } + + return rslt; +} + +// ͣ +int MoveToSensorAsMidPosEmsScan(u32 para1, u32 para2) +{ + int rslt; + MTSAMPCtrl * pmts; + + pmts = (MTSAMPCtrl*)(para1); + + rslt = GetCommonEms(); + + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + if (pmts->emcstopscan != NULL) + { + rslt = pmts->emcstopscan(); + } + + if (rslt != ERR_NONE) + { + return rslt; + } + + if (pmts->movement > 0) + { + if (pmts->limitpsensor != NULL) // λ + { + if (pmts->limitpsensor() == SENSOR_ON) + { + rslt = ERR_LMT_POSITIVE; // λ + } + } + } + else if (pmts->movement < 0) + { + if (pmts->limitnsensor != NULL) // ⷴλ + { + if (pmts->limitnsensor() == SENSOR_ON) + { + rslt = ERR_LMT_NEGATIVE; // λ + } + } + } + else + { + rslt = ERR_MTZ_ERROR; // + } + + return rslt; +} + +// ҵƬλֹͣ +int MoveToMidPosQStopScan(u32 para1, u32 para2) +{ + static int isckzero = 0; + + int rslt = 0; + MTSAMPCtrl * pmts; + + pmts = (MTSAMPCtrl*)(para1); + + rslt = GetCommonQStop(); + if (rslt != ERR_NONE || pmts == NULL) + { + return rslt; + } + + if (rslt == ERR_NONE) + { + if (pmts->zerosensor != NULL) // λ + { + if (isckzero == 1) + { + if (pmts->zerosensor() != pmts->zeroval) + { + isckzero = 0; + rslt = 1; + } + } + else + { + if (pmts->zerosensor() == pmts->zeroval) + { + isckzero = 1; + } + } + } + } + + return rslt; +} + +// ֱ˶λҵƬλ,ر˵,ֹ㷽ʽʹôлڵĵƬ,ǻڲλ +// return -1: +int LineRunToSensorAsMidPosCtrl(MTSAMPCtrl * pmtsampc) +{ + int rslt, err; + InterMoveCtrl lmctrl; + u16 axisIdx; + int mvnum = 0; // ˶,˶,λһ,˶λûҵλ,ʧ + + if (pmtsampc == NULL) + { + return -1; + } + + axisIdx = pmtsampc->axisIdx; + assert_param(axisIdx < AXIS_NUM); + + memset(&lmctrl, 0, sizeof(InterMoveCtrl)); + + lmctrl.vAxisId = pmtsampc->vAxisId; // ʹ + lmctrl.motosConfig.newConfig = pmtsampc->newCfg; // Ҫµ + + err = ERR_NONE; + +#if (1) + //if (pmtsampc->syncflag == 0) + { + err = MoveToSensorAsMidPosEmsScan(lmctrl.condPara1, lmctrl.condPara2); // ⼱ͣ + if ((pmtsampc->movement < 0 && err == ERR_LMT_NEGATIVE) || + (pmtsampc->movement > 0 && err == ERR_LMT_POSITIVE) ) // λ + { + mvnum++; + pmtsampc->movement = pmtsampc->movement * (-1); // λ˶ + } + + err = MoveToSensorAsMidPosQStopScan(lmctrl.condPara1, lmctrl.condPara2); // ֹͣ + if (err == STA_MTZ_SUCCESS) // λλ + { + pmtsampc->movement = 0; // λλ,ֱƶҵƬλ + } + } +#endif + + if (pmtsampc->newCfg == 0 && pmtsampc->syncflag != 0) + { + for (int i = 0; i < AXIS_NUM; i++) + { + if (pmtsampc->syncList[i] != 0) + { + lmctrl.mvmtPara.movement[i] = pmtsampc->movement; // ˶0˶˶ȣλp + } + } + } + else + { + lmctrl.motosConfig.axisConfig[axisIdx].axisConfig = pmtsampc->axisCfg; // ʵ + lmctrl.motosConfig.axisConfig[axisIdx].poutType = pmtsampc->poutType; // ģʽ(CW/CCWPULSE/DIR) + lmctrl.motosConfig.axisConfig[axisIdx].spdSource = MAKE_POUT_CMD(lmctrl.vAxisId); // ʵٶȿģʽ(123) + lmctrl.motosConfig.axisConfig[axisIdx].datSource = DATI_INTERPOLATION; // ʵݻȡģʽ(Ӳ岹涯ӳ) + + lmctrl.mvmtPara.movement[axisIdx] = pmtsampc->movement; // ˶0˶˶ȣλp + } + + lmctrl.mvmtPara.extraRepeat = 0; // ظ + lmctrl.mvmtPara.interLong = abs(pmtsampc->movement); // 岹λƣڻmovementеֵ + lmctrl.mvmtPara.pulsePerSegment = PULSE_PER_SEGMENT; // ÿ + + // ٶȿƲ + lmctrl.spdPara.startPPS = pmtsampc->lspd.stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pmtsampc->lspd.stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pmtsampc->lspd.runSpd; // ٶ + lmctrl.spdPara.slowPPS = pmtsampc->lspd.stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pmtsampc->lspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pmtsampc->lspd.spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pmtsampc->lspd.brkAdd; // ɲٶ + + lmctrl.stopMode = STOP_MODE_SPD; // ֹͣ˶ʽ + + // ص + lmctrl.Delay = DelayRef; // ʱص + lmctrl.RefreshPosition = NormalRefPosition; // ˢ»ص + lmctrl.refPosPara = 0; // ˢ² + lmctrl.WorkBeforeRun = NULL; // йص + lmctrl.WorkAfterRun = NULL; // кص + lmctrl.workPara1 = 0; + lmctrl.workPara2 = 0; // + lmctrl.GetSlowDown = NULL; // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + lmctrl.GetNormalStop = MoveToSensorAsMidPosNStopScan; // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + lmctrl.GetQuickStop = MoveToSensorAsMidPosQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + lmctrl.GetEmergencyStop = MoveToSensorAsMidPosEmsScan; // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + lmctrl.condPara1 = (u32)(pmtsampc);; + lmctrl.condPara2 = 0; // + + // ˶λ + while(mvnum < 2 && pmtsampc->movement != 0) + { + rslt = InterpolationMotion(&lmctrl); // ˶ + + if (rslt == 3) + { + err = MoveToSensorAsMidPosQStopScan(lmctrl.condPara1, lmctrl.condPara2); // ֹͣ + break; + } + else if (rslt == 2) + { + err = MoveToSensorAsMidPosEmsScan(lmctrl.condPara1, lmctrl.condPara2); // ⼱ͣ + if ( (pmtsampc->movement < 0 && err == ERR_LMT_NEGATIVE) || + (pmtsampc->movement > 0 && err == ERR_LMT_POSITIVE) || // λ + 0 ) + { + mvnum++; + pmtsampc->movement = pmtsampc->movement * (-1); // ˶ + lmctrl.mvmtPara.movement[axisIdx] = pmtsampc->movement; + } + else + { + break; + } + } + else + { + break; + } + } + + if (mvnum >= 2) // λ˶δҵλ, + { + err = ERR_MTZ_ERROR; + return err; + } + + if (err == STA_MTZ_SUCCESS) // ɹ,ʼƶƬλ + { + s32 pos1, pos2; // Ƭλü¼ + + pmtsampc->movement = pmtsampc->bafflewidth + 1000; + lmctrl.mvmtPara.movement[axisIdx] = pmtsampc->movement; + lmctrl.mvmtPara.interLong = abs(pmtsampc->movement); // 岹λƣڻmovementеֵ + + lmctrl.spdPara.startPPS = pmtsampc->mposspd.stspSpd; // ٶ + lmctrl.spdPara.stopPPS = pmtsampc->mposspd.stspSpd; // ֹͣٶ + lmctrl.spdPara.runPPS = pmtsampc->mposspd.runSpd; // ٶ + lmctrl.spdPara.slowPPS = pmtsampc->mposspd.stspSpd; // ٶ + lmctrl.spdPara.addPPSG = pmtsampc->mposspd.spdAdd; // ټٶ + lmctrl.spdPara.decPPSG = pmtsampc->mposspd.spdAdd/2; // ټٶ + lmctrl.spdPara.brkPPSG = pmtsampc->mposspd.brkAdd; // ɲٶ + + lmctrl.GetQuickStop = MoveToMidPosQStopScan; // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + + err = ERR_NONE; + rslt = InterpolationMotion(&lmctrl); // ˶ + err = GetMoveResultError(rslt, lmctrl.errInfo); + + if (err == 1) + { + pos1 = GetMotoCounter(axisIdx); + pmtsampc->movement = pmtsampc->movement * (-1); + lmctrl.mvmtPara.movement[axisIdx] = pmtsampc->movement; + + err = ERR_NONE; + rslt = InterpolationMotion(&lmctrl); // ˶ + err = GetMoveResultError(rslt, lmctrl.errInfo); + + if (err == 1) + { + int dir; + pos2 = GetMotoCounter(axisIdx); + if (pmtsampc->movement > 0) + { + dir = -1; // ǰһ˶෴ + } + else + { + dir = 1; + } + pmtsampc->movement = abs(pos1-pos2)/2; // 20220317 BUG޸,ȡֵֻᵥ˶,ʵ˶л + pmtsampc->movement *= dir; + lmctrl.mvmtPara.movement[axisIdx] = pmtsampc->movement; + lmctrl.mvmtPara.interLong = abs(pmtsampc->movement); + lmctrl.GetQuickStop = NULL; // 20210812 ЩƬл(ٴʱ,ʵʴֹ㷽ʽȫҪٴ) + // ˶ʱ,»ڴӦ + // ʴ˴ƶƬλʱټֹͣ + + err = ERR_NONE; + rslt = InterpolationMotion(&lmctrl); // ˶ + err = GetMoveResultError(rslt, lmctrl.errInfo); + + if (err == ERR_NONE) + { + err = STA_MTZ_SUCCESS; + } + } + } + } + + return err; +} + + diff --git a/EMBOS/Users/EmbFunc/movectrl/movectrl.h b/EMBOS/Users/EmbFunc/movectrl/movectrl.h new file mode 100644 index 0000000..ea5b085 --- /dev/null +++ b/EMBOS/Users/EmbFunc/movectrl/movectrl.h @@ -0,0 +1,424 @@ + +#ifndef __MOVECTRL_H__ +#define __MOVECTRL_H__ + +#include "config.h" +#include "motos.h" +#include "stm32motos.h" +#include "funcs.h" + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + +typedef struct +{ + u32 stspSpd; // ͣٶȣλpps + u32 runSpd; // ٶȣλpps + u32 spdAdd; // ͣٶȣλpps2 + u32 brkAdd; // ɲٶȣλpps2 +} __attribute__ ((packed)) MotoSpd; + +//------------------------------------------------------------------------------- + +// ת +typedef struct +{ + u16 vAxisId; // + u16 axisIdx; // ˶ + u16 axisCfg; // + u16 axisOtp; // + u16 newCfg; // + + s32 circleNum; // Ȧ + + MotoSpd rspd; // ٶȲ + + int syncflag; // ͬƶ־ + int syncList[AXIS_NUM]; // ͬƶѡ + + u8 (*sensorscan)(void); +//------------------- + int (*stopscan)(void); // ֹͣ +//------------------- + int zeroflag; // Ѿλñ־ + int cansflag; // ־ + int canscount; // λ + int cansmvmt; // λ + + int val; // λ״̬ + +}RSenserCheck; + +int RoundRunToSensor(RSenserCheck * pck); +int RoundRunToSensorEdge(RSenserCheck * pck); +int RoundRunToSensorCenter(RSenserCheck * pck); +int RoundRunToSensorBase(RSenserCheck * pck, int flag); + +//------------------------------------------------------------------------------- +// תijλ + +typedef struct +{ + u16 vAxisId; // + u16 newCfg; // + + struct + { + int axisIdx; // + u16 axisCfg; // + u16 poutType; // + s32 movement; // ˶ + }config[AXIS_NUM]; + + u32 mrepeat; // ظ + u32 interLong; // λ + u32 stopmode; // ֹͣģʽ + u32 segmentNum; // ֶ + + MotoSpd rspd; // ٶ + + //----------- + int escStop; // ֹͣ + + //----------- + void (*RRunProc)(void); + +}RMotoRun; + +int RoundRunAsOffset(RMotoRun * pmr); + +//------------------------------------------------------------------------------- + +// ֱ˶ +typedef struct +{ + u16 vAxisId; // + u16 axisIdx; // ˶ + + u16 axisCfg; // + u16 poutType; // + u16 newCfg; // + + s32 movement; // ƶλ + s32 mvposi; // ƶλ + + int syncflag; // ͬƶ־ + int syncList[AXIS_NUM]; // ͬƶѡ + + MotoSpd lspd; // ٶ + + u8 (*slowsensor)(void); // ټ⴫ + u8 (*zerosensor)(void); // λ⴫ + int zeroval; // λ״̬ + + u8 (*limitpsensor)(void); // λ + u8 (*limitnsensor)(void); // λ + + int (*emcstopscan)(void); // ֹͣ + + u32 para; + + int (*moveasoffset)(s32, MotoSpd*); // ƶ + +//------------------------- + int slowsta; // ״̬ + +}MTSCtrl; + +int LineRunToSensorCtrl(MTSCtrl * pmtsc); + +//------------------------------------------------------------------------------- + +// ֱ˶λҵƬλ +typedef struct +{ + u16 vAxisId; // + u16 axisIdx; // ˶ + + u16 axisCfg; // + u16 poutType; // + u16 newCfg; // + + s32 movement; // ƶλ + u32 bafflewidth;// Ƭ + + int syncflag; // ͬƶ־ + int syncList[AXIS_NUM]; // ͬƶѡ + + MotoSpd lspd; // ٶ + MotoSpd mposspd; // ҵƬλٶ + + u8 (*zerosensor)(void); // λ⴫ + int zeroval; // λ״̬ + + u8 (*limitpsensor)(void); // λ + u8 (*limitnsensor)(void); // λ + + int (*emcstopscan)(void); // ֹͣ + +}MTSAMPCtrl; + +int LineRunToSensorAsMidPosCtrl(MTSAMPCtrl * pmtsampc); + +//------------------------------------------------------------------------------------ + +typedef struct +{ + u16 vAxisId; // + u16 axisIdx; // ˶ + + u16 axisCfg; // + u16 poutType; // + u16 newCfg; // + + s32 movement; // ƶλ + + int syncflag; // ͬƶ־ + int syncList[AXIS_NUM]; // ͬƶѡ + + u32 ppSegment; + + MotoSpd hspd; // ٶ + + u8 (*limitpsensor)(u32); // λ + u8 (*limitnsensor)(u32); // λ + + int (*precondition)(u32); // Ⱦ + int (*stopscan)(u32); // ֹͣ + int (*slowscan)(u32); + + u32 para; + +}MVByHandCtrl; + +int MoveByHandCtrl(MVByHandCtrl * pmbhc); + + +//------------------------------------------------------------------------------- +// 첽˶ +// ʹSTM32ٶ& +typedef struct +{ + u16 axisIdx; // ˶ + u16 axisCfg; // + u16 poutType; // + u16 newCfg; // + + u16 useOutPort; // ǷʹIO 0:ʹM,1:ʹIO + + s32 movement; // λ + + u32 startPPS; // ٶ + u32 runPPS; // ˶ٶ + u32 addPPSG; // ͣٶ + u32 brkPPSG; // ɲٶ + + u32 funTestTime; // йⲿʱ 0:ⲿ (λ:0.1ms) + int syncList[AXIS_NUM]; // ͬƶѡ + + // ָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣͣٶȽ٣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȽ٣ + u32 condPara1, condPara2; // + + int blockRunflag; // б־ + void (*ExecWhenRun)(void); // йִеĺ + void (*ExecWhenStart)(void); // ʱִеĺ + void (*ExecWhenStop)(void); // ֹͣʱִеĺ +}SepMoveCtrl; + +int SeparateExerStart(SepMoveCtrl * pCtrl); // 첽˶ +int SeparateExerStop(u16 axisIdx); // 첽˶ ֹͣ +int GetSeparateExerState(u16 axisIdx); // 첽˶ õǰ״̬ + +//------------------------------------------------------------------------------- +int GetCommonNStop(void); +int GetCommonQStop(void); +int GetCommonEms(void); + + +//------------------------------------------------------------------------------- + +#define MMPSS_TO_ST_PPSG(mmpss) (((mmpss)*PULSE_PER_MM)/(10*1000)) // 0.1msʱ + +//------------------------------------------------------------------------------- + + +#define MTM1_IDX 0 // 1 +#define MTM1_CFG MOTOENAB_CFG // +#define MTM1_OTP POUT_CWCCW +#define MTM1_MOD 0x0001 + +#define MTM2_IDX 1 // 2 +#define MTM2_CFG MOTOENAB_CFG // +#define MTM2_OTP POUT_CWCCW +#define MTM2_MOD 0x0002 + +#define MTM3_IDX 2 // 3 +#define MTM3_CFG MOTOENAB_CFG // +#define MTM3_OTP POUT_CWCCW +#define MTM3_MOD 0x0004 + +#define MTM4_IDX 3 // 4 +#define MTM4_CFG MOTOENAB_CFG // +#define MTM4_OTP POUT_CWCCW +#define MTM4_MOD 0x0008 + +#define MTM5_IDX 4 // 5 +#define MTM5_CFG MOTOENAB_CFG // DEFAULT_CFG +#define MTM5_OTP POUT_CWCCW +#define MTM5_MOD 0x0010 + +#define MTM6_IDX 5 // 6 +#define MTM6_CFG MOTOENAB_CFG // +#define MTM6_OTP POUT_CWCCW +#define MTM6_MOD 0x0020 + + +#define ALL_MOTO_MOD (MTM1_MOD|MTM2_MOD|MTM3_MOD|MTM4_MOD|MTM5_MOD|MTM6_MOD) + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + +// λתɡסתΪ +#define MM_TO_PULSE(mm) ((mm)*PULSE_PER_MM) + +// λתɡÿ롱תΪÿ롱 +#define MMPS_TO_PPS(mmps) ((mmps)*PULSE_PER_MM) + +// λת STM32첽˶ٶ +#define MMPSS_ASYN_TO_PPSG(mmpss) ((mmpss)*PULSE_PER_MM) + +// λתɡÿƽתΪÿλΪ1/72000000 +#define MMPSS_TO_PPSG(mmpss) (FPGA_CLK/(PULSE_PER_MM)/(mmpss)) + +// λתɡÿתΪÿƽÿλΪ1/72000000 +#define MMPSSS_TO_PPSSG(mmpsss) (FPGA_CLK/(PULSE_PER_MM)/(mmpsss)) + +// λתɡÿƽתΪÿλΪ1/72000000 +#define PPSS_TO_PPSG(ppss) (FPGA_CLK/(ppss)) + +// λתɡÿ롱תΪÿ롱 +#define PPS_TO_MMPS(pps) ((pps)/PULSE_PER_MM) + +//------------------------------------------------------------------------------- + +#ifndef MS_PULSE_PER_CIRCLE + #define MS_PULSE_PER_CIRCLE (10000) // ÿת +#endif + +// λתġȡתΪ +#define MS_DEG_TO_PULSE(deg) ((deg)*MS_PULSE_PER_CIRCLE/DEG_PER_CIRCLE) + +// λתɡ0.01ȡתΪ +#define MS_001DEG_TO_PULSE(deg) ((deg)*MS_PULSE_PER_CIRCLE/DEG001_PER_CIRCLE) + +// λתɡתÿ֡תΪÿ롱 +#define RPM_TO_PPS(rpm) (((rpm)*MS_PULSE_PER_CIRCLE)/60) + +// λתɡתÿƽתΪÿ뷽 +#define RPSS_TO_PPSS(rpss) ((rpss)*MS_PULSE_PER_CIRCLE) + +// λתɡתÿƽתΪÿλΪ1/72000000 +#define RPSS_TO_PPSG(rpss) (FPGA_CLK/((rpss)*MS_PULSE_PER_CIRCLE)) + +// λת ÿ롱תΪתÿ֡ +#define PPS_TO_RPM(pps) ((pps)* 60 / MS_PULSE_PER_CIRCLE) + + +//------------------------------------------------------------------------------- + +#ifndef ECD_PULSE_PER_CIRCLE + #define ECD_PULSE_PER_CIRCLE (1000) // ÿת +#endif + +//------------------------------------------------------------------------------- + +#ifndef PULSE_PER_SEGMENT + #define PULSE_PER_SEGMENT (1000) // ֱ߲岹ÿ +#endif + +//------------------------------------------------------------------------------- + +// ÿȦĶλ ȣ +#define DEG_PER_CIRCLE (360) + +#define DEG001_PER_DEG (100) + +// ÿȦĶλ 0.01ȣ +#define DEG001_PER_CIRCLE (DEG_PER_CIRCLE*DEG001_PER_DEG) + +//------------------------------------------------------------------------------- + +// תÿת 10000 +#ifndef ROT_PULSE_PER_CIRCLE + #define ROT_PULSE_PER_CIRCLE (10000) +#endif + +// λתɡȡתΪ +#define ROT_DEG_TO_PULSE(deg) ((deg)*(s32)(ROT_PULSE_PER_CIRCLE)/DEG_PER_CIRCLE) + +// λתɡ0.01ȡתΪ +#define ROT_001DEG_TO_PULSE(deg) ((deg)*(s32)(ROT_PULSE_PER_CIRCLE)/DEG001_PER_CIRCLE) + +// λתɡתΪ0.01ȡ +#define PULSE_TO_ROT_001DEG(pls) ((pls)*(s32)(DEG001_PER_CIRCLE)/(ROT_PULSE_PER_CIRCLE)) + +// λתɡÿ롱תΪÿ롱 +#define DPS_TO_PPS(dps) ((dps)*ROT_PULSE_PER_CIRCLE/DEG_PER_CIRCLE) + +// λתɡÿƽתΪÿλΪ1/72000000 +#define DPSS_TO_PPSG(dpss) (FPGA_CLK/((dpss)*ROT_PULSE_PER_CIRCLE/DEG_PER_CIRCLE)) + +// λתɡȡתΪ֮һȡ +#define ROT_DEG_TO_PITK(deg) ((double)(deg)*2*PI*RADIAN_ACCURACY/DEG_PER_CIRCLE) + +// λתɡ0.01ȡתΪ֮һȡ +#define ROT_001DEG_TO_PITK(deg) ((double)(deg)*2*PI*RADIAN_ACCURACY/DEG001_PER_CIRCLE) + +// λתɡ֮һȡתΪ +#define PITK_TO_RPP(dr) (((double)(dr))*ROT_PULSE_PER_CIRCLE/RADIAN_ACCURACY/PI/2+0.5*(dr>0?1:-1)) + +// λתɡתΪ֮һȡ +#define RPP_TO_PITK(rpp) (((double)(rpp)*2*PI*RADIAN_ACCURACY/ROT_PULSE_PER_CIRCLE)+0.5*(rpp>0?1:-1)) + + + +//------------------------------------------------------------------------------- + + +// תתΪ -180--180֮ +void ChangeRotToNP180(s32 * pval); + +// תתΪ -360--360֮ +void ChangeRotToNP360(s32 * pval); + +// תתΪ 0--360֮ +void ChangeRotTo0To360(s32 * pval); + +// תתΪ -360--0֮ +void ChangeRotToN360To0(s32 * pval); + +// תΪ -180--180֮ +void ChangeMsToNP180(s32 * pval, int pdir); + +// תΪ -360--360֮ +void ChangeMsToNP360(s32 * pval); + +void ChangeMsTo0To360(s32 * pval); + +//------------------------------------------------------------------------------- + +int GetMoveResultError(int rslt, int errinfo); + +//------------------------------------------------------------------------------- +#endif + diff --git a/EMBOS/Users/EmbFunc/operator/datadef.h b/EMBOS/Users/EmbFunc/operator/datadef.h new file mode 100644 index 0000000..210f997 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/datadef.h @@ -0,0 +1,445 @@ + +#ifndef __DATADEF_H__ +#define __DATADEF_H__ + +#include "config.h" + +//------------------------------------------------------------------------- + +// ִݶ +typedef struct +{ + u8 ctrl; // ֽ + u8 attr; // ֽ + s16 dx; // Xƫ + s16 dy; // Yƫ + s16 dr; // Rƫ + u16 len; // xyϳɳ + u8 action[2]; //Ӷ + + u8 rev[4]; + +}__attribute__ ((packed)) DataItem, Ds16Item; + +typedef struct +{ + u8 ctrl; // ֽ + u8 attr; // ֽ + s16 dx; // Xƫ + s16 dy; // Yƫ + s16 dr; // Rƫ + +}__attribute__ ((packed)) Ds8Item; + +typedef struct +{ + u8 ctrl; // ֽ + u8 attr; // ֽ + u8 dx; // Xƫ + u8 dy; // Yƫ + +}__attribute__ ((packed)) DsrItem, Ds4Item; + +// ˫ֽѹʽ +typedef struct +{ + s8 cdx; // X + s8 cdy; // Y + +/* + ʽ + cdx x + cdy y + + ÿֽڵλΪλ7λΪλλλǷλ + + λһγ4ֿݣ: + cdx.0 cdy.0 + 0 0 ݣݷΧ-128 -- +126, ֻżã0.2mmλ0.1mm + 0 1 ݣݷΧ-128 -- +126, ֻżã0.2mmλ0.1mm + 1 0 󲽿ݣݷΧ-128 -- +126, ֻżã2mmλ1mm + 1 1 ݣλΪͲ cdx Ϊ, cdx Ϊ + +*/ +}__attribute__ ((packed)) ToBItem, Ds2Item; + +// ctrl +// ֽ, Ϊ룬 + +#define DATA_NULL 0x00 // ļ +#define DATA_SEWING 0x01 // , Ҫһһ, ͬʱ X, YR ƫ˶dx,dy,dr 򲽽ʽ˶˶ +#define DATA_OFFSET 0x02 // ƫ, ֻƶ X, YR ƫ dx,dy,dr˶ +#define DATA_CUTTING 0x03 // е, Ҫеתͬʱ X, YR ƫ dx,dy,drеѡ񶯿ʽ +#define DATA_LASER 0x04 // , Ҫ, ͬʱX, YRƫ dx,dy,dr˶ǿȺ˶ٶйϵ +#define DATA_DRAWING 0x05 // Ǻ, ҪǺűȷ, ͬʱX, YRƫdx,dy,dr˶ +#define DATA_SEWING_R 0x06 // һͷңҪһһ, ͬʱ X, YR ƫ˶dx,dy,dr 򲽽ʽ˶˶ + +#define DATA_SECF_SEW 0x11 // ڶ +#define DATA_SECF_OFST 0x12 // ڶƫ + +#define DATA_SECF_SEW_R 0x16 // ڶһͷңҪһһΣתȦ(빦ܵĻ)), ͬʱ X, YR ƫ˶dx,dy,dr 򲽽ʽ˶˶ + + +// DSR +#define DATA_SYNCSEW 0x07 // ͬݣ Ҫһһ, ͬʱ X, YR ƫ˶ dx,dy,drX2, Y2 Ҳ˶ dx,dy򲽽ʽ˶˶ +#define DATA_PAUSE_OLD 0x08 // ͣ +#define DATA_ANGLE_OLD 0x09 // յ +#define DATA_CUT_OLD 0x0A // +#define DATA_END_OLD 0x10 // + +#define DATA_JUMP 0x0B // ݣҪһ˶,ͷ, X, YR ƫ˶ dx,dy,dr 򲽽ʽ˶˶ +#define DATA_PUNCH 0x0C // , ҪתһȦͬʱ X, YR ƫ dx,dy,dr +#define DATA_EMB 0x0D // 廨ݣҪƽһ, ͬʱ X, Yƫ˶dx,dy 򲽽ʽ˶ +#define DATA_CHGND_OLD 0x0E // ɫ + +#define DATA_SYNCOFST 0x0F // ͬƫ + +#define DATA_MILLING 0x21 // ϳ +#define DATA_DRILL 0x22 // +#define DATA_RKNIFE 0x23 // Բ, ҪԲתͬʱ X, YR ƫ dx,dy,dr +#define DATA_SKNIFE 0x24 // , Ҫתͬʱ X, YR ƫ dx,dy,dr +#define DATA_TAPE_OFST 0x25 // ֯ƫ + +#define DATA_WHEEL 0x26 // ѹ +#define DATA_PRESSURE 0x27 // ѹ +#define DATA_OPTI 0x28 // ˿ + +#define DATA_BASE1 0x2A // 1 +#define DATA_BASE2 0x2B // 2 +#define DATA_BASE3 0x2C // 3 + +#define DATA_EKNIFE1 0x2D // ƫĵ1 +#define DATA_EKNIFE2 0x2E // ƫĵ2 + +#define DATA_CHENILLE 0x41 // ë +#define DATA_CHAIN 0x42 // ʽ +#define DATA_HIGHT 0x43 // ߶(ë) +#define DATA_COIL 0x44 // +#define DATA_ZIGZAG 0x45 // +#define DATA_RIBBON 0x46 // ̴ + +#define DATA_END 0x80 // +#define DATA_PAUSE 0x81 // ͣ +#define DATA_CHGND 0x82 // 廨˹루ɫ +#define DATA_CUTTRD 0x83 // ߹ +#define DATA_CUT_TAPE 0x84 // ֯ +#define DATA_MOVE_PHOTO 0x85 // ƶյ㹦 +#define DATA_GET_IMAGE 0x86 // չ + +#define DATA_ANGLE 0x89 // յ + +// atrr, ֽڣΪ˶ֽ + +// 벽Զ壺 + +// attr.7, ȵȼH +// attr.6, ȵȼL +// attr.5, +// attr.4, һ־ +// attr.3, ˲־(=0=1) +// attr.2, ˲־(=0=1) +// attr.1, ٶȵȼH +// attr.0, ٶȵȼL + +#define ATTR_CLAMP_LV 0xC0 // ȵȼ +#define ATTR_RESEW 0x10 // ־ +#define ATTR_FOOT_LV 0x60 // ѹŸ߶ȵȼ +#define ATTR_R_TOUP 0x08 // ˲־(=0=1) +#define ATTR_L_TOUP 0x04 // ˲־(=0=1) +#define ATTR_SPD_LV 0x03 // ٶȵȼ + + +// 廨벽Զ壺 +// attr.5, ־ + +#define ATTR_JUMP 0x20 // ־ + + +#define EMB_ACTION 0x20 // 帽Ӷ +// 帽Ӷ +// Ƭ +#define ACT_SEQUIN1 0x01 +#define ACT_SEQUIN2 0x02 +#define ACT_SEQUIN3 0x03 +#define ACT_SEQUIN4 0x04 +#define ACT_SEQUIN5 0x05 +#define ACT_SEQUIN6 0x06 +#define ACT_SEQUIN7 0x07 +#define ACT_SEQUIN8 0x08 +#define ACT_SEQUIN9 0x09 +#define ACT_SEQUIN10 0x0A +#define ACT_SEQUIN11 0x0B +#define ACT_SEQUIN12 0x0C + +// ɢ +#define ACT_SCBEAD1 0x11 +#define ACT_SCBEAD2 0x12 +#define ACT_SCBEAD3 0x13 +#define ACT_SCBEAD4 0x14 +#define ACT_SCBEAD5 0x15 +#define ACT_SCBEAD6 0x16 + +// ë +#define ACT_EASYCHENILLE 0x20 + + +#define WIRE_ACTION 0x40 // ߻Ӷ + +#define ACT_ZIGZAGL 0x01 // Զλ +#define ACT_ZIGZAGR 0x02 // λ + +// ϳԶ壺 + +// attr.7, +// attr.6, +// attr.5, +// attr.4, +// attr.3, ѹHH +// attr.2, ѹHL +// attr.1, ѹLH +// attr.0, ѹLL + +#define ATTR_HIGH_MARK 0x0F // ϳѹȵ + + +// dx, xƫֵ, з, ΧΪ -32768--32767, λΪ 0.01mm +// dy, yƫֵ, з, ΧΪ -32768--32767, λΪ 0.01mm +// dr, rƫֵ, з, ΧΪ -32768--32767, λΪ 0.0001 +// len, xy ĺϳɳ,޷,Χ0--65535, λΪ 0.01mm + +//------------------------------------------------------------------------- + +#ifndef PULSE_PER_MM +#define PULSE_PER_MM (100) // ÿ +#endif + +#define RADIAN_ACCURACY 10000 // ֮һ + +//------------------------------------------------------------------------- +// ɫ +#define MAX_SWITCH_NEEDLE 512 // ɫɫ + +// ˳ +// ƽ +#define EMB_NEEDNO_MIN 1 +#define EMB_NEEDNO_MAX 32 // ƽ廨 1 -- 32 + +// +#define PUNCH_NEEDNO_MIN 33 +#define PUNCH_NEEDNO_MAX 48 // 33 -- 48 + +// +#define SEW_NEEDNO_MIN 49 +#define SEW_NEEDNO_MAX 50 + +// ̴ +#define RIBBON_NEEDNO_MIN 51 +#define RIBBON_NEEDNO_MAX 52 + +#define RIBBON_NEEDNO_MODE1 51 // ̴ģʽ1 ̴ +#define RIBBON_NEEDNO_MODE2 52 // ̴ģʽ2 + +// ë +#define CHENILLE_NEEDNO_MIN 53 +#define CHENILLE_NEEDNO_MAX 68 + +// ʽ +#define CHAIN_NEEDNO_MIN 69 +#define CHAIN_NEEDNO_MAX 84 + +// +#define COIL_NEEDNO_MIN 85 +#define COIL_NEEDNO_MAX 100 + +#define COIL_NEEDNO_L1 85 // 1 +#define COIL_NEEDNO_L2 86 // 2 +#define COIL_NEEDNO_L3 87 // 3 +#define COIL_NEEDNO_L4 88 // 4 +#define COIL_NEEDNO_R1 89 // 1 +#define COIL_NEEDNO_R2 90 // 2 +#define COIL_NEEDNO_R3 91 // 3 +#define COIL_NEEDNO_R4 92 // 4 +#define COIL_EMB_NEEDNO 93 // ƽ(ʹòƻͷƽ) + +// +#define SAWTOOTH_NEEDNO_MIN 101 +#define SAWTOOTH_NEEDNO_MAX 112 + +#define SAWTOOTH_NEEDNO_MODE1 101 // ģʽ1 +#define SAWTOOTH_NEEDNO_MODE2 102 // ģʽ2 +#define SAWTOOTH_NEEDNO_MODE3 103 // ģʽ3 +#define SAWTOOTH_NEEDNO_MODE4 104 // ģʽ4 +#define SAWTOOTH_NEEDNO_MODE5 105 // ģʽ5 +#define SAWTOOTH_NEEDNO_MODE6 106 // ģʽ6 + +// ,ͬɫͬиٶ,ɵ͵ +#define LASER_NEEDNO_MIN 113 +#define LASER_NEEDNO_MAX 122 + +#define LASER_NEEDNO_SPEED1 113 +#define LASER_NEEDNO_SPEED2 114 +#define LASER_NEEDNO_SPEED3 115 +#define LASER_NEEDNO_SPEED4 116 +#define LASER_NEEDNO_SPEED5 117 +#define LASER_NEEDNO_SPEED6 118 +#define LASER_NEEDNO_SPEED7 119 +#define LASER_NEEDNO_SPEED8 120 +#define LASER_NEEDNO_SPEED9 121 +#define LASER_NEEDNO_SPEED10 122 + +// +#define CUT_NEEDNO 123 +// +#define HOLE_NEEDNO 124 + +// ͣ +#define PAUSE_SW_CODE 255 + + +// ļͷ +//------------------------------------------------------------------------- +typedef union +{ + u8 buff[0x400]; + + struct + { + // 0x00 + u8 hdIdenti[0x40]; + u8 fileparas[0x400 - 0x40]; + } __attribute__ ((packed)) headparts; // + + struct + { + // 0x00 + char fileName[32]; // ļ + // 0x20 + u32 dataSize; // ֽ + u32 itemNums; // + u16 bytesPerItem; // ÿռֽ + u16 bytesPerBlk; // ݻֿС + u32 dataChecksum; // ۼУ + u16 checkCrc; // ǰ6ֶεCRCУ飬6ֶηֱΪļƣֽÿֽÿֽۼӺ͵CRCУֵ + // 0x32 + u8 begHead; // ͵Ļͷ + u8 rev0; + u32 fileid; // ļΨһʶʶǷΪͬһļ + + // 0x38 + u8 reserved1[0x40-0x38]; // 1 + // 20221114 廨,ռô8ֽ,廨زʹ + + // 0x40 + s32 anchorX; // λX + s32 anchorY; // λY + // 0x48 + s32 beginX; // X + s32 beginY; // Y + s32 beginR; // Z + + // 0x54 + s32 minX; + s32 maxX; + s32 minY; + s32 maxY; // Χ + + // 0x64 + u32 sizeX; + u32 sizeY; // ƬС + + // 0x6C + s32 anchorX2; // λX2 + s32 anchorY2; // λY2 + s32 beginX2; // X2 + s32 beginY2; // Y2 + s32 beginR2; // R2 + + // 0x80 + u32 runAct; // Ӷ, + // bit0: 0:ɺ 1:ɺ + + // 0x84 + u32 EnFlag; // + // bit0,ƫƵX 0, 1, + // bit1,ƫƵY 0, 1, + // bit2, + // bit3, + // bit4, + // bit5, + // bit6,ȼ 0,X 1,Y + + s32 offsetX; // ƫƵX + s32 offsetY; + + // 0x90 + u8 xRepeatNums; // X򷴸,Χ0-99,Ĭ0 + u8 yRepeatNums; // Y򷴸 + s32 xRepeatDistance; // X򷴸,λmm,0.01,Χ-100000-100000,Ĭ0 + s32 yRepeatDistance; // Y򷴸 + + // 0x9A + u16 pressureHigh2; // ѹ2, Χ 0--65.000λ0.001mm + u16 pressureHigh3; // ѹ3, Χ 0--65.000λ0.001mm + u16 pressureHigh5; // ѹ5, Χ 0--65.000λ0.001mm + u16 pressureHigh6; // ѹ6, Χ 0--65.000λ0.001mm + u16 pressureHigh7; // ѹ7, Χ 0--65.000λ0.001mm + u16 pressureHigh8; // ѹ8, Χ 0--65.000λ0.001mm + u16 pressureHigh9; // ѹ9, Χ 0--65.000λ0.001mm + + // 0xA8 + u8 reserved2[0x200-0xA8]; + + // 0x200 + u8 switchNeedleTable[0x400-0x200]; // ɫ趨, ֧512ɫ趨 + + } __attribute__ ((packed)) fileHead; // ļͷ + +}DataFileHead; + +typedef struct +{ + s32 anchorX; + s32 anchorY; + + s32 beginX; + s32 beginY; + +}__attribute__ ((packed)) DataFilePara; // ļ + +// ļִвṹ +typedef struct +{ + u32 newIdx; + s32 newXPos; + s32 newYPos; + s32 newRPos; + u32 newColorIdx; // λ + u32 newHighIdx; // ¸߶(廨ë߶) + u32 mvFrameflag; // ƿ־(ִнʱǷƿ) + + u32 rev[256-7]; +}__attribute__ ((packed)) FileExecPara; + + +//------------------------------------------------------------------------- + +void ReSetFileParaOld(DataFilePara * pNewPara); +void ReSetFilePara(DataFileHead * pNewPara); + +u16 GetFileParaCheckCrc(void); + +//------------------------------------------------------------------------- +#ifndef MAX_EX_SW_ND +#define MAX_EX_SW_ND 512 // չɫ +#endif + +#define TEMP_DATA1 0x01 +#define TEMP_DATA2 0x02 +#define TEMP_DATA3 0x03 +#define TEMP_DATA4 0x04 + +//------------------------------------------------------------------------- + +#endif + + diff --git a/EMBOS/Users/EmbFunc/operator/datafile.c b/EMBOS/Users/EmbFunc/operator/datafile.c new file mode 100644 index 0000000..4387224 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/datafile.c @@ -0,0 +1,3944 @@ + +#define _IN_DATAFILE_C +#include "datafile.h" + +#include "math.h" +#include "crc16.h" +#include "norflash.h" +#include "inout.h" + +//------------------------------------------------------------------------------- + + + + + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + + +// ļ +#if (1) + +//------------------------------------------------------------------------------- + +// ⲿSRAMļ +// ļ + +#define DS16ITEMSIZE (DATA_FILE_SIZE/sizeof(Ds16Item)) +#define DS8ITEMSIZE (DATA_FILE_SIZE/sizeof(Ds8Item)) +#define DS4ITEMSIZE (DATA_FILE_SIZE/sizeof(Ds4Item)) + +#define DS16ITEMSIZE_AT_BUF1 (DATA_FILE_SIZE1/sizeof(Ds16Item)) +#define DS8ITEMSIZE_AT_BUF1 (DATA_FILE_SIZE1/sizeof(Ds8Item)) +#define DS4ITEMSIZE_AT_BUF1 (DATA_FILE_SIZE1/sizeof(Ds4Item)) + +// ߿ļ +#define DS16FRAMESIZE (DATA_FILE_SIZE3/sizeof(Ds16Item)) +#define DS8FRAMESIZE (DATA_FILE_SIZE3/sizeof(Ds8Item)) +#define DS4FRAMESIZE (DATA_FILE_SIZE3/sizeof(Ds4Item)) + +//------------------------------------------------------------------------------- + +// ⲿ NOR Flash ļ + +// FLASH ļŵַ +#define NOR_FILE_BASE SNF_DAT_FILE_BEGIN // ļ 16M ֽ + +// ļ򻮷 +// |-----------------|-----------------|-------------| +// | name | begin addr | size | +// |-----------------|-----------------|-------------| +// | file data area | 0x00 | 0x00FFE000 | ļ +// |-----------------|-----------------|-------------| +// | file manage | 0x00FFE000 | 0x00001000 | ļռ1 +// |-----------------|-----------------|-------------| + + +#define NOR_FILE_DATA (NOR_FILE_BASE + 0x00000000) +#define MAX_NOR_FILE_SIZE (SNF_DAT_FILE_SIZE - SNF_BYTES_PER_SEC) + +#define NOR_DAT_MANAGE (NOR_FILE_BASE + MAX_NOR_FILE_SIZE) + + +#define DS16SIZEINNOR (MAX_NOR_FILE_SIZE/sizeof(Ds16Item)) +#define DS8SIZEINNOR (MAX_NOR_FILE_SIZE/sizeof(Ds8Item )) +#define DS4SIZEINNOR (MAX_NOR_FILE_SIZE/sizeof(Ds4Item )) + + +// FLASH ƽ㷨ѭ÷IJ + +// 16Mļ洢 +// 4KΪļĻλ4096 +// һֽڴһָʾ4096ֽڡ +// Ϊѭ洢беġ +// Թ涨ֵֽĿʼѭеĿʼ +// ȫΪ0xffô0ǵһʼõ +// һδ洢ļʱռ10ôӵ09ӦֽдΪ0x7F +// 洢ļʱҪռ5ôӵ1014ӦֽΪ0x7F +// ԴƣֽڱдΪ0x7FôֽھҪд0x3F +// ѭÿѭһΣдֽڵƶһλֱдֽڱΪ0x00 +// ֽڶ0x00ô¼Ҫ + +// ¼DZ֤IJȣӳʹ + +#define NOR_DAT_SEC_BEG 0 +#define NOR_DAT_SEC_NUM (MAX_NOR_FILE_SIZE / (SNF_BYTES_PER_SEC)) + +//------------------------------------------------------------------------------- + +typedef struct +{ + u8 wrflag; // дļ¼ֽ + int begSecIdx; // ѭеʼ + int queueSecNum; // ѭеij, + int releaseFlag; // ͷű־ +}NorSectorManager; + +NorSectorManager g_norManager; + +void InitNorSectorManage(void) +{ + int i, idx; + u8 flag; + u8 rdata[SNF_BYTES_PER_SEC]; + memset(&g_norManager, 0, sizeof(NorSectorManager)); + + DatFlashRdData(NOR_DAT_MANAGE, rdata, SNF_BYTES_PER_SEC); // ȡһ + + // ɨõflagֵ + flag = 0; + for (i = 0, idx = 0; i < NOR_DAT_SEC_NUM; i++) // NOR_DAT_SEC_NUM 4095 + { + if (flag < rdata[i]) + { + flag = rdata[i]; // ȡֵ,õд¼ֽ + idx = i; + } + } + + if (flag == 0) + { + // + printf("Erase NOR_DAT_MANAGE\r\n"); + DatFlash4kErase(NOR_DAT_MANAGE, 1); + flag = 0xff; + idx = 0; + } + + flag >>= 1; // + + g_norManager.wrflag = flag; + g_norManager.begSecIdx = idx; + g_norManager.queueSecNum = 0; + g_norManager.releaseFlag = 0; + +// printf("InitNorSectorManage, wrflag=0x%x, begSecIdx=%d, queueSecNum=%d\r\n", g_norManager.wrflag, g_norManager.begSecIdx, g_norManager.queueSecNum); +} + +// ͨõַ +u32 GetAddrFromSecIdx(int sidx) +{ + sidx += g_norManager.begSecIdx; + while (sidx >= NOR_DAT_SEC_NUM) + { + sidx -= NOR_DAT_SEC_NUM; + } + return NOR_FILE_DATA + sidx * (SNF_BYTES_PER_SEC); +} + +// ͨݴСõ׵ַ +u32 GetAddrFromDatIdx(int didx, int size) +{ + u32 addr; + u32 sidx, sofst; + + sidx = didx * size / (SNF_BYTES_PER_SEC); // ߼ַ + sofst = (didx * size) % (SNF_BYTES_PER_SEC); // ƫ + + addr = GetAddrFromSecIdx(sidx) + sofst; + + return addr; +} + +u32 GetAddrFromLAddr(int laddr, int size) +{ + u32 addr; + u32 sidx, sofst; + + sidx = laddr / (SNF_BYTES_PER_SEC); // ߼ַ + sofst = laddr % (SNF_BYTES_PER_SEC); // ƫ + + addr = GetAddrFromSecIdx(sidx) + sofst; + + return addr; +} + +// ռڴ棬ռÿռ䣬ñ־ +// allocBytes:Ҫֽ +void NorAllocAndSetUsingFlags(int allocBytes) +{ + int i, idx; + int alcsecs; // ռ + u8 rdata[SNF_BYTES_PER_SEC]; + + // ռ + alcsecs = allocBytes + (SNF_BYTES_PER_SEC-1); + alcsecs /= (SNF_BYTES_PER_SEC); // ռ + + printf("NorAllocAndSetUsingFlags, allocbyte=%d, alcsecs=%d\r\n", allocBytes, alcsecs); + + g_norManager.begSecIdx += g_norManager.queueSecNum; + while (g_norManager.begSecIdx >= NOR_DAT_SEC_NUM) + { + g_norManager.begSecIdx -= NOR_DAT_SEC_NUM; + } + + printf("before alloc, begsecidx=%d, queuenum=%d, wrflag=0x%x\r\n", g_norManager.begSecIdx, g_norManager.queueSecNum, g_norManager.wrflag); + + if (alcsecs > NOR_DAT_SEC_NUM) + { + printf("alcsecs=%d > %d\r\n", alcsecs, NOR_DAT_SEC_NUM); + alcsecs = NOR_DAT_SEC_NUM; + } + + DatFlashRdData(NOR_DAT_MANAGE, rdata, SNF_BYTES_PER_SEC); // ȡ¼ֽ + + g_norManager.queueSecNum = 0; + for (i = 0, idx = g_norManager.begSecIdx; i < alcsecs; i++) + { + g_norManager.queueSecNum++; // + + // ñ־ + rdata[idx] = g_norManager.wrflag; + + // + idx++; + if (idx >= NOR_DAT_SEC_NUM) + { + idx = 0; + if (g_norManager.wrflag == 0) + { + DatFlash4kErase(NOR_DAT_MANAGE, 1); + memset(rdata, 0xff, SNF_BYTES_PER_SEC); + g_norManager.wrflag = 0xff; + printf("re erase dat manage\r\n"); + } + + g_norManager.wrflag >>= 1; + printf("nor alloc queue return to 0, wrflag=0x%x\r\n", g_norManager.wrflag); + } + } + + if (g_norManager.queueSecNum != alcsecs) // ֤ + { + printf("Error: g_norManager.queueSecNum not euq alcsecs\r\n"); + } + + printf("after alloc, begsecidx=%d, queuenum=%d, wrflag=0x%x\r\n", g_norManager.begSecIdx, g_norManager.queueSecNum, g_norManager.wrflag); + + g_norManager.releaseFlag = 0; + DatFlashWrData(NOR_DAT_MANAGE, rdata, SNF_BYTES_PER_SEC); +} + +//------------------------------------------------------------------------------- +// ݣͷſռ +// sync:ͬ־ 0,ͬ 1,첽 +int ReleaseSpace(int sync) +{ + static int eraseidx = -1; // ID + if (sync != 0 && eraseidx == -1) + { + eraseidx = 0; + g_norManager.releaseFlag = 1; + } + + if (g_norManager.releaseFlag == 0) + { + eraseidx = 0; + g_norManager.releaseFlag++; + } + else if (g_norManager.releaseFlag == 1) + { + if (g_norManager.queueSecNum != 0) // Ϊ0 + { + u32 eaddr; + int idx, erflag; + printf("ReleaseSpace, secnum=%d, eraseidx=%d, sync=%d\r\n", g_norManager.queueSecNum, eraseidx, sync); + + for (idx = eraseidx; idx < g_norManager.queueSecNum; idx++) + { + eaddr = GetAddrFromSecIdx(idx); + erflag = IsDatFlashEmpty(eaddr, SNF_BYTES_PER_SEC); + if (erflag != 0) + { + printf("DatFlash4kErase eaddr=0x%x\r\n", eaddr); + DatFlash4kErase(eaddr, 1); + } + if (sync == 0) + { + idx++; + break; + } + } + eraseidx = idx; + if (eraseidx >= g_norManager.queueSecNum) + { + eraseidx = -1; + g_norManager.releaseFlag = 2; + } + } + else + { + g_norManager.releaseFlag = -1; // Сļ,ʹnorflash, + } + } + return g_norManager.releaseFlag; +} + +//------------------------------------------------------------------------------- +// ݴ洢λͨ綯̬䣩 + + +int GetADataItem(u8 fileBlk, u32 idx, DataItem * pDat) +{ + return GetADataItemBase(fileBlk, idx, pDat, 1); +} + +int GetADataItemNoSqrt(u8 fileBlk, u32 idx, DataItem * pDat) +{ + return GetADataItemBase(fileBlk, idx, pDat, 0); +} + +//------------------------------------------------------------------------------- +/* return : 0: + * -1:ļ洢ʽֻ֧ݸʽ֧ + * -2:ûҵֵidx + * para:fileBlk,ʱ + * sqrtflag,Ƿƽlen,Ϻʱ + */ +int GetADataItemBase(u8 fileBlk, u32 idx, DataItem * pDat, int sqrtflag) +{ + u32 address; + + // 20231115 + if (idx >= g_datFile.pFileHead->fileHead.itemNums) + { + printf("GetADataItem error, idx=%d > %d\r\n", idx, g_datFile.pFileHead->fileHead.itemNums); + return -1; + } + + if (pDat == NULL) + { + return -1; + } + + if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds16Item)) // Ds16 + { + if (g_datFile.storage == STORAGE_EXSRAM) // ļ洢ڴ洢SRAM + { + if (idx >= DS16ITEMSIZE) + { + memset(pDat, 0, sizeof(DataItem)); + return -1; + } + + { + Ds16Item * pDs16Item; + + if (idx < DS16ITEMSIZE_AT_BUF1) + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff1BegAddr); + pDs16Item += idx; + } + else + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff2BegAddr); + pDs16Item += (idx - DS16ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs16Item, sizeof(Ds16Item)); + } + } + else if (g_datFile.storage == STORAGE_SPAREARAM) // ߿ļ(ҲͿλ) + { + if (idx >= DS16FRAMESIZE) + { + memset(pDat, 0, sizeof(DataItem)); + return -1; + } + + { + Ds16Item * pDs16Item; + + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff3BegAddr); + pDs16Item += idx; + } + memcpy(pDat, pDs16Item, sizeof(Ds16Item)); + } + } + else if (g_datFile.storage == STORAGE_NORFLASH) // ļ洢NORFlash + { + u32 daddr; + if (idx >= DS16SIZEINNOR) + { + memset(pDat, 0, sizeof(DataItem)); + return -1; + } + daddr = NOR_FILE_DATA+idx*sizeof(Ds16Item); + address = (u32)pDat; + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds16Item)); + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS16ITEMSIZE+DS16SIZEINNOR)) + { + memset(pDat, 0, sizeof(DataItem)); + return -1; + } + + if (idx < DS16ITEMSIZE) + { + Ds16Item * pDs16Item; + + if (idx < DS16ITEMSIZE_AT_BUF1) + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff1BegAddr); + pDs16Item += idx; + } + else + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff2BegAddr); + pDs16Item += (idx - DS16ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs16Item, sizeof(Ds16Item)); + } + else + { + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS16ITEMSIZE, sizeof(Ds16Item)); + address = (u32)pDat; + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds16Item)); + } + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + int i; + u32 dataddr; + + for (i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + dataddr = idx * sizeof(Ds16Item); // ļеĵַ + + if ((dataddr >= g_datFile.pDatExCtrl->datExBeg[i]) && + (dataddr < g_datFile.pDatExCtrl->datExBeg[i]+DAT_BLOCK_SIZE) ) // ڷΧڣ + { + dataddr -= g_datFile.pDatExCtrl->datExBeg[i]; // ڿڵĵַԵַ + dataddr += (s32)(&(g_datFile.pDatExCtrl->datExBlock[i])); // ڻĵַʵʵַ + + memcpy(pDat, (u8*)dataddr, sizeof(DataItem)); + break; + } + } + } + if (i == FILE_EXBUF_NUM) + { + printf("not found the data of idx=%d\r\n", idx); + return -2; + } + } + else // ֵ֧Ĵ洢ʽ + { + printf("error2, not support storage\r\n"); + return -1; + } + } + else if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds8Item)) // Ds8 + { + if (g_datFile.storage == STORAGE_EXSRAM) + { + if (idx >= DS8ITEMSIZE) + { + memset(pDat, 0, sizeof(Ds8Item)); + return -1; + } + + { + Ds8Item * pDs8Item; + + if (idx < DS8ITEMSIZE_AT_BUF1) + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff1BegAddr); + pDs8Item += idx; + } + else + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff2BegAddr); + pDs8Item += (idx - DS8ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs8Item, sizeof(Ds8Item)); + } + } + else if (g_datFile.storage == STORAGE_SPAREARAM) + { + if (idx >= DS8FRAMESIZE) + { + memset(pDat, 0, sizeof(Ds8Item)); + return -1; + } + + { + Ds8Item * pDs8Item; + + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff3BegAddr); + pDs8Item += idx; + } + memcpy(pDat, pDs8Item, sizeof(Ds8Item)); + } + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + u32 daddr; + if (idx >= DS8SIZEINNOR) + { + memset(pDat, 0, sizeof(Ds8Item)); + return -1; + } + daddr = NOR_FILE_DATA+idx*sizeof(Ds8Item); + address = (u32)pDat; + + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds8Item)); + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS8ITEMSIZE+DS8SIZEINNOR)) + { + memset(pDat, 0, sizeof(Ds8Item)); + return -1; + } + + if (idx < DS8ITEMSIZE) + { + Ds8Item * pDs8Item; + + if (idx < DS8ITEMSIZE_AT_BUF1) + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff1BegAddr); + pDs8Item += idx; + } + else + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff2BegAddr); + pDs8Item += (idx - DS8ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs8Item, sizeof(Ds8Item)); + } + else + { + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS8ITEMSIZE, sizeof(Ds8Item)); + address = (u32)pDat; + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds8Item)); + } + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + int i; + u32 dataddr; + + for (i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + dataddr = idx * sizeof(Ds8Item); // ļеĵַ + + if ((dataddr >= g_datFile.pDatExCtrl->datExBeg[i]) && + (dataddr < g_datFile.pDatExCtrl->datExBeg[i]+DAT_BLOCK_SIZE) ) // ڷΧڣ + { + dataddr -= g_datFile.pDatExCtrl->datExBeg[i]; // ڿڵĵַԵַ + dataddr += (s32)(&(g_datFile.pDatExCtrl->datExBlock[i])); // ڻĵַʵʵַ + + memcpy(pDat, (u8*)dataddr, sizeof(Ds8Item)); + break; + } + } + } + if (i == FILE_EXBUF_NUM) + { + printf("not found the data of idx=%d\r\n", idx); + return -2; + } + } + else + { + return -1; + } + +#if (1) + if (sqrtflag != 0) + { + pDat->len = sqrt(pDat->dx*pDat->dx + pDat->dy*pDat->dy); + } +#else + pDat->len = 0; +#endif + // memset(pDat->rev, 0, 6); + } + else if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds4Item)) + { + Ds4Item dsr; + if (g_datFile.storage == STORAGE_EXSRAM) + { + if (idx >= DS4ITEMSIZE) + { + memset(pDat, 0, sizeof(Ds4Item)); + return -1; + } + + Ds4Item * pDs4Item = &dsr; + + if (idx < DS4ITEMSIZE_AT_BUF1) + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff1BegAddr); + pDs4Item += idx; + } + else + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff2BegAddr); + pDs4Item += (idx - DS4ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs4Item, sizeof(Ds4Item)); + } + else if (g_datFile.storage == STORAGE_SPAREARAM) + { + if (idx >= DS4FRAMESIZE) + { + memset(pDat, 0, sizeof(Ds4Item)); + return -1; + } + + Ds4Item * pDs4Item = &dsr; + + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff3BegAddr); + pDs4Item += idx; + } + memcpy(pDat, pDs4Item, sizeof(Ds4Item)); + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + u32 daddr; + if (idx >= DS4SIZEINNOR) + { + memset(pDat, 0, sizeof(Ds4Item)); + return -1; + } + daddr = NOR_FILE_DATA+idx*sizeof(Ds4Item); + address = (u32)(&dsr); + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds4Item)); + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS4ITEMSIZE+DS4SIZEINNOR)) + { + memset(pDat, 0, sizeof(Ds4Item)); + return -1; + } + + if (idx < DS4ITEMSIZE) + { + Ds4Item * pDs4Item = &dsr; + + if (idx < DS4ITEMSIZE_AT_BUF1) + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff1BegAddr); + pDs4Item += idx; + } + else + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff2BegAddr); + pDs4Item += (idx - DS4ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs4Item, sizeof(Ds4Item)); + } + else + { + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS4ITEMSIZE, sizeof(Ds4Item)); + address = (u32)(&dsr); + DatFlashRdData(daddr, (u8*)(address), sizeof(Ds4Item)); + } + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + int i; + u32 dataddr; + + for (i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + dataddr = idx * sizeof(Ds4Item); // ļеĵַ + + if ((dataddr >= g_datFile.pDatExCtrl->datExBeg[i]) && + (dataddr < g_datFile.pDatExCtrl->datExBeg[i]+DAT_BLOCK_SIZE) ) // ڷΧڣ + { + dataddr -= g_datFile.pDatExCtrl->datExBeg[i]; // ڿڵĵַԵַ + dataddr += (s32)(&(g_datFile.pDatExCtrl->datExBlock[i])); // ڻĵַʵʵַ + + memcpy(&dsr, (u8*)dataddr, sizeof(Ds4Item)); + break; + } + } + } + if (i == FILE_EXBUF_NUM) + { + printf("not found the data of idx=%d\r\n", idx); + return -2; + } + } + else + { + return -1; + } + + pDat->ctrl = dsr.ctrl; + pDat->attr = 0; + pDat->dx = dsr.dx; + pDat->dy = dsr.dx; + pDat->dr = 0; + + // + if ((dsr.attr & 0x80) != 0) + { + pDat->dx *= -10; + } + else + { + pDat->dx *= 10; + } + + if ((dsr.attr & 0x40) != 0) + { + pDat->dy *= -10; + } + else + { + pDat->dy *= 10; + } + + // ... + +#if (1) + if (sqrtflag != 0) + { + pDat->len = sqrt(pDat->dx*pDat->dx + pDat->dy*pDat->dy); + } +#else + pDat->len = 0; +#endif + // memset(pDat->rev, 0, 6); + } + else // Ds16,Ds8,Ds4 + { + return -1; + } + + return 0; +} + +int WriteADataItem(u8 fileBlk, u32 idx, DataItem * pDat) +{ + if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds16Item)) + { + if (g_datFile.storage == STORAGE_EXSRAM) + { + if (idx > DS16ITEMSIZE || + pDat == NULL || + 0 ) + { + return -1; + } + + { + Ds16Item * pDs16Item; + + if (idx < DS16ITEMSIZE_AT_BUF1) + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff1BegAddr); + pDs16Item += idx; + } + else + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff2BegAddr); + pDs16Item += (idx - DS16ITEMSIZE_AT_BUF1); + } + memcpy(pDs16Item, pDat, sizeof(Ds16Item)); + } + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + return -1; + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS16ITEMSIZE+DS16SIZEINNOR) || + pDat == NULL || + 0 ) + { + return -1; + } + + if (idx < DS16ITEMSIZE) + { + Ds16Item * pDs16Item; + + if (idx < DS16ITEMSIZE_AT_BUF1) + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff1BegAddr); + pDs16Item += idx; + } + else + { + pDs16Item = (Ds16Item*)(g_datFile.dataBuff2BegAddr); + pDs16Item += (idx - DS16ITEMSIZE_AT_BUF1); + } + memcpy(pDs16Item, pDat, sizeof(Ds16Item)); + } + else + { +/* // ֧д뵥벽...... + + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS16ITEMSIZE, sizeof(Ds16Item)); + address = (u32)pDat; + + NFlashWrData(daddr, (u16*)address, sizeof(Ds16Item)/2); +*/ + return -1; + } + + + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + return -1; + } + else + { + return -1; + } + + } + else if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds8Item)) + { + if (g_datFile.storage == STORAGE_EXSRAM) + { + if (idx > DS8ITEMSIZE || + pDat == NULL || + 0 ) + { + return -1; + } + + { + Ds8Item * pDs8Item; + + if (idx < DS8ITEMSIZE_AT_BUF1) + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff1BegAddr); + pDs8Item += idx; + } + else + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff2BegAddr); + pDs8Item += (idx - DS8ITEMSIZE_AT_BUF1); + } + memcpy(pDs8Item, pDat, sizeof(Ds8Item)); + } + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + return -1; + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS8ITEMSIZE+DS8SIZEINNOR) || + pDat == NULL || + 0 ) + { + return -1; + } + + if (idx < DS8ITEMSIZE) + { + Ds8Item * pDs8Item; + + if (idx < DS8ITEMSIZE_AT_BUF1) + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff1BegAddr); + pDs8Item += idx; + } + else + { + pDs8Item = (Ds8Item*)(g_datFile.dataBuff2BegAddr); + pDs8Item += (idx - DS8ITEMSIZE_AT_BUF1); + } + memcpy(pDs8Item, pDat, sizeof(Ds8Item)); + } + else + { +/* // ֵ֧벽д + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS8ITEMSIZE, sizeof(Ds8Item)); + address = (u32)pDat; + NFlashWrData(daddr, (u16*)address, sizeof(Ds8Item)/2); +*/ + return -1; + } + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + return -1; + } + else + { + return -1; + } + + } + else if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(Ds4Item)) + { + Ds4Item dsr; + + dsr.ctrl = pDat->ctrl; + dsr.attr = pDat->attr; + dsr.dx = pDat->dx / 10; + dsr.dx = pDat->dy / 10; + + if (g_datFile.storage == STORAGE_EXSRAM) + { + if (idx >= (DS4ITEMSIZE) || + pDat == NULL || + 0 ) + { + return -1; + } + + { + Ds4Item * pDs4Item = &dsr; + + if (idx < DS4ITEMSIZE_AT_BUF1) + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff1BegAddr); + pDs4Item += idx; + } + else + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff2BegAddr); + pDs4Item += (idx - DS4ITEMSIZE_AT_BUF1); + } + memcpy(pDs4Item, pDat, sizeof(Ds4Item)); + } + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + return -1; + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + if (idx >= (DS4ITEMSIZE+DS4SIZEINNOR) || + pDat == NULL || + 0 ) + { + return -1; + } + + if (idx < DS4ITEMSIZE) + { + Ds4Item * pDs4Item = &dsr; + + if (idx < DS4ITEMSIZE_AT_BUF1) + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff1BegAddr); + pDs4Item += idx; + } + else + { + pDs4Item = (Ds4Item*)(g_datFile.dataBuff2BegAddr); + pDs4Item += (idx - DS4ITEMSIZE_AT_BUF1); + } + memcpy(pDat, pDs4Item, sizeof(Ds4Item)); + } + else + { +/* // ֵ֧벽д + u32 daddr; + daddr = GetAddrFromDatIdx(idx-DS4ITEMSIZE, sizeof(Ds4Item)); + address = (u32)(&dsr); + NFlashWrData(daddr, (u16*)(address), sizeof(Ds4Item)/2); +*/ + } + + return -1; + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + return -1; + } + else + { + return -1; + } + } + else + { + return -1; + } + + return 0; +} + +// begaddr ߼洢ַ +int WriteFileData(u8 fileBlk, u32 begaddr, u8 * pBuf, u32 size) +{ + if (pBuf == NULL) + { + return -1; + } + + if (g_datFile.storage == STORAGE_EXSRAM) + { + u8 * pData; + if (begaddr+size <= g_datFile.dataBuff1Len) + { + pData = (u8 *)(g_datFile.dataBuff1BegAddr + begaddr); + } + else if (begaddr+size <= g_datFile.dataBuff1Len+g_datFile.dataBuff2Len) + { + pData = (u8 *)(g_datFile.dataBuff2BegAddr + begaddr - g_datFile.dataBuff1Len); + } + else + { + return -1; + } + +// printf("WriteFileData from 0x%x to 0x%x, size=%d\r\n", (u32)pBuf, (u32)pData, size); + memcpy(pData, pBuf, size); + } + else if (g_datFile.storage == STORAGE_SPAREARAM) + { + u8 * pData; + if (begaddr+size <= g_datFile.dataBuff3Len) + { + pData = (u8 *)(g_datFile.dataBuff3BegAddr + begaddr); + } + else + { + return -1; + } + +// printf("WriteFileData from 0x%x to 0x%x, size=%d\r\n", (u32)pBuf, (u32)pData, size); + memcpy(pData, pBuf, size); + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + if ((begaddr+size) > DS16SIZEINNOR*sizeof(Ds16Item) || + 0 ) + { + return -1; + } + + DatFlashWrDataWithErase(NOR_FILE_DATA+begaddr, (u8*)pBuf, size); + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + u8 * pData; + + if (begaddr+size <= g_datFile.dataBuff1Len) + { + pData = (u8 *)(g_datFile.dataBuff1BegAddr + begaddr); + memcpy(pData, pBuf, size); +// printf("WriteFileData from 0x%x to 0x%x, size=%d\r\n", (u32)pBuf, (u32)pData, size); + } + else if (begaddr+size <= g_datFile.dataBuff1Len+g_datFile.dataBuff2Len) + { + pData = (u8 *)(g_datFile.dataBuff2BegAddr + begaddr - g_datFile.dataBuff1Len); + memcpy(pData, pBuf, size); +// printf("WriteFileData from 0x%x to 0x%x, size=%d\r\n", (u32)pBuf, (u32)pData, size); + } + else if (begaddr+size <= g_datFile.dataBuff1Len+g_datFile.dataBuff2Len+MAX_NOR_FILE_SIZE) + { + u32 daddr; + + // ReleaseSpace(1); + + daddr = GetAddrFromLAddr(begaddr-(g_datFile.dataBuff1Len+g_datFile.dataBuff2Len), size); + DatFlashWrDataWithErase(daddr, (u8*)pBuf, size); + } + else + { + return -1; + } + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + u32 blkidx, blkaddr; + int bufidx; + if ((size) != DAT_BLOCK_SIZE || // ֻܴ洢1ݰĴС + (begaddr) >= g_datFile.pFileHead->fileHead.dataSize || + 0 ) + { + printf("(size=%d) != DAT_BLOCK_SIZE or (begaddr=%d) > (dataSize=%d)\r\n", size, begaddr, g_datFile.pFileHead->fileHead.dataSize); + return -1; + } + + // 㵱ǰݰеʼַ + blkidx = begaddr / DAT_BLOCK_SIZE; // + blkaddr = blkidx * DAT_BLOCK_SIZE; // ַ + if (blkaddr != begaddr) + { + printf("(blkaddr=%d) != (begaddr=%d)\r\n", blkaddr, begaddr); + return -1; + } + + // ҵЧbufΪݴ洢 + bufidx = -1; + for (int i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID && g_datFile.pDatExCtrl->datExBeg[i] == blkaddr) // Ѵ洢ͬĴ洢ַ + { + printf("save dat to same addr, blkidx=%d\r\n", blkidx); + // ݴʱظ洢 + break; + } + else if (g_datFile.pDatExCtrl->exbufFlag[i] == 0) + { + bufidx = i; + break; + } + } + + if (bufidx >= 0 && bufidx < FILE_EXBUF_NUM) + { + u8 * pData; + g_datFile.pDatExCtrl->exbufFlag[bufidx] = DATA_VALID; // ӱ־ + g_datFile.pDatExCtrl->datExBeg[bufidx] = blkaddr; // ¼ʼַ + pData = (u8*)(&(g_datFile.pDatExCtrl->datExBlock[bufidx])); // buffеʵʵַ + memcpy(pData, pBuf, size); + printf("save data bldidx=%d begaddr=0x%x to bufidx=%d\r\n", blkidx, begaddr, bufidx); + } + } + return 0; +} + +// жǷڻ +// return:0,ڵǰ洢Χ +int IsDatIdxInBuf(int idx) +{ + int i; + u32 dataddr; + int rslt = 0; + + if (g_datFile.storage == STORAGE_NETWORK) + { + if ((g_datFile.enflag == DATA_VALID) && + (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(DataItem)) && + 1 ) + { + // ǰҪڻ + if (idx >= 0 || idx < (s32)g_datFile.pFileHead->fileHead.itemNums) + { + for (i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + dataddr = idx * sizeof(DataItem); // ļеĵַ + + if ((dataddr >= g_datFile.pDatExCtrl->datExBeg[i]) && + (dataddr < g_datFile.pDatExCtrl->datExBeg[i]+DAT_BLOCK_SIZE) ) // ڷΧڣ + { + rslt = 1; + break; + } + } + } + } + } + } + else + { + rslt = 1; + } + return rslt; +} + +#define MAX_IDX_RANGE 7 +#define MIN_IDX_RANGE 3 // Χ :ǰ 7:3 ǰݿ󲿷 + +// Ԥװļ +int GetBlockIdxNeedtoLoad(int datidx) +{ + int curidx, curaddr, minaddr, maxaddr, maxblkaddr, tempaddr; + int requestIdx = -1; + int rslt; + + if (g_datFile.pFileHead->fileHead.bytesPerItem == sizeof(DataItem)) + { + curidx = datidx; + if (curidx < 0) + { + curidx = 0; + } + else if (curidx >= g_datFile.pFileHead->fileHead.itemNums) + { + curidx = g_datFile.pFileHead->fileHead.itemNums - 1; + } + + curaddr = curidx * sizeof(Ds16Item); // ǰļڵĵַ + curaddr /= DAT_BLOCK_SIZE; + curaddr *= DAT_BLOCK_SIZE; // 㵱ǰݿʼַ + + minaddr = curaddr - FILE_EXBUF_NUM * MIN_IDX_RANGE / 10 * DAT_BLOCK_SIZE; + if (minaddr < 0) + { + minaddr = 0; + } + + maxblkaddr = (g_datFile.pFileHead->fileHead.itemNums - 1) * sizeof(Ds16Item); + maxblkaddr /= DAT_BLOCK_SIZE; + maxblkaddr *= DAT_BLOCK_SIZE; + + maxaddr = curaddr + (FILE_EXBUF_NUM * MAX_IDX_RANGE / 10 - 1) * DAT_BLOCK_SIZE; + if (maxaddr > maxblkaddr) + { + maxaddr = maxblkaddr; + } + + for (int i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + if (g_datFile.pDatExCtrl->datExBeg[i] < minaddr || + g_datFile.pDatExCtrl->datExBeg[i] > maxaddr || + 0) + { + g_datFile.pDatExCtrl->exbufFlag[i] = 0; + } + } + } + + tempaddr = curaddr; + while(tempaddr <= maxaddr) + { + rslt = 0; + for (int i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + if (tempaddr == g_datFile.pDatExCtrl->datExBeg[i]) + { + rslt = 1; + break; + } + } + } + if (rslt == 0) + { + requestIdx = tempaddr; + break; + } + else + { + tempaddr += DAT_BLOCK_SIZE; + } + } + + if (requestIdx < 0) + { + tempaddr = curaddr; + while(tempaddr >= minaddr) + { + rslt = 0; + for (int i = 0; i < FILE_EXBUF_NUM; i++) + { + if (g_datFile.pDatExCtrl->exbufFlag[i] == DATA_VALID) + { + if (tempaddr == g_datFile.pDatExCtrl->datExBeg[i]) + { + rslt = 1; + break; + } + } + } + if (rslt == 0) + { + requestIdx = tempaddr; + break; + } + else + { + tempaddr -= DAT_BLOCK_SIZE; + } + } + } + } + + if (requestIdx >= 0) + { + requestIdx /= DAT_BLOCK_SIZE; + } + + return requestIdx; +} + +void OutFileInfo(void) +{ + printf("\r\ndata file info:\r\n"); + + printf("\tenflag=0x%x, storage=0x%x, ", g_datFile.enflag, g_datFile.storage); + if (g_datFile.storage == STORAGE_EXSRAM) + { + printf("data store at exsram\r\n"); + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + printf("data store at norflash\r\n"); + } + else if (g_datFile.storage == STORAGE_NANDFLASH) + { + printf("data store at nandflash\r\n"); + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + printf("data store at exsram and norflash\r\n"); + } + else if (g_datFile.storage == STORAGE_NETWORK) + { + printf("data store at network\r\n"); + } + else if (g_datFile.storage == STORAGE_SPAREARAM) + { + printf("data store at frame exram\r\n"); + } + else + { + printf("not support storage type\r\n"); + } + + printf("\r\n\tfilehead:\r\n"); + printf("\tfilename=%s\r\n", g_datFile.pFileHead->fileHead.fileName); + printf("\tfilelen=%d,itemnums=%d,bytesperitem=%d,bytesperblk=%d\r\n", \ + g_datFile.pFileHead->fileHead.dataSize, g_datFile.pFileHead->fileHead.itemNums, g_datFile.pFileHead->fileHead.bytesPerItem, g_datFile.pFileHead->fileHead.bytesPerBlk); + printf("\tchecksum=0x%x,checkCrc=0x%x\r\n", g_datFile.pFileHead->fileHead.dataChecksum, g_datFile.pFileHead->fileHead.checkCrc); + + printf("\tbegHead=%d\r\n", g_datFile.pFileHead->fileHead.begHead); + + printf("\tfileID=0x%x\r\n", g_datFile.pFileHead->fileHead.fileid); + + printf("\tanchorx=%d,anchory=%d,\r\n\tbeginx=%d,beginy=%d,beginr=%d\r\n\tminx=%d,maxx=%d,miny=%d,maxy=%d\r\n", \ + g_datFile.pFileHead->fileHead.anchorX, g_datFile.pFileHead->fileHead.anchorY, \ + g_datFile.pFileHead->fileHead.beginX, g_datFile.pFileHead->fileHead.beginY, g_datFile.pFileHead->fileHead.beginR,\ + g_datFile.pFileHead->fileHead.minX,g_datFile.pFileHead->fileHead.maxX,g_datFile.pFileHead->fileHead.minY,g_datFile.pFileHead->fileHead.maxY); + + printf("\tanchorx2=%d,anchory2=%d,\r\n\tbeginx2=%d,beginy2=%d,beginr2=%d\r\n", \ + g_datFile.pFileHead->fileHead.anchorX2, g_datFile.pFileHead->fileHead.anchorY2, \ + g_datFile.pFileHead->fileHead.beginX2, g_datFile.pFileHead->fileHead.beginY2, g_datFile.pFileHead->fileHead.beginR2); + + printf("\tEnFlag=0x%x,offsetX=%d,offsetY=%d\r\n", g_datFile.pFileHead->fileHead.EnFlag, + g_datFile.pFileHead->fileHead.offsetX, g_datFile.pFileHead->fileHead.offsetY); + + printf("\txRepeatNums=%d,yRepeatNums=%d,xRepeatDistance=%d,yRepeatDistance=%d\r\n", g_datFile.pFileHead->fileHead.xRepeatNums, + g_datFile.pFileHead->fileHead.yRepeatNums, g_datFile.pFileHead->fileHead.xRepeatDistance, g_datFile.pFileHead->fileHead.yRepeatDistance); +} + +//--------------------------------------------------------------------------------------------------------- +// жļǷЧ +int IsDatFileAvailable(void) +{ + if (g_datFile.enflag == DATA_VALID) + { + return TRUE; + } + return FALSE; +} + +// жļֵǷЧ +int IsDatIndexAvailable(u32 idx) +{ + if (IsDatFileAvailable() == TRUE) + { + if (idx < (s32)g_datFile.pFileHead->fileHead.itemNums) + { + return TRUE; + } + } + + return FALSE; +} + +u32 GetFileItemNums(void) +{ + return g_datFile.pFileHead->fileHead.itemNums; +} + +s32 GetFileWide(void)//ļ +{ + return (g_datFile.pFileHead->fileHead.maxX-g_datFile.pFileHead->fileHead.minX); +} + +s32 GetFileHigh(void)//ļ߶ +{ + return (g_datFile.pFileHead->fileHead.maxY-g_datFile.pFileHead->fileHead.minY); +} + +// ļʧЧ +int InvalidDatFile(u32 idx) +{ + printf("InvalidDatFile\r\n"); + + g_datFile.enflag = 0; + return TRUE; +} + +int AvalidDatFile(u32 idx) +{ + printf("AvalidDatFile\r\n"); + + g_datFile.enflag = DATA_VALID; + return TRUE; +} + +// ݿʧЧ +void InvalidDatBlock(void) +{ + printf("InvalidDatBlock\r\n"); + + memset(&(g_datFile.pDatExCtrl->exbufFlag[0]), 0, sizeof(int)*FILE_EXBUF_NUM); // ݽ +} + +void SetNewDatFlag(u32 idx, int en) +{ + g_datFile.newFile = en; +} + +int IsNewDatFile(u32 idx) +{ + if (g_datFile.newFile != 0) + { + return TRUE; + } + return FALSE; +} + + +void ReSetFileParaOld(DataFilePara * pNewPara) +{ + s32 tbx, tby; + tbx = pNewPara->beginX - g_datFile.pFileHead->fileHead.beginX; + tby = pNewPara->beginY - g_datFile.pFileHead->fileHead.beginY; + + g_datFile.pFileHead->fileHead.minX += tbx; + g_datFile.pFileHead->fileHead.maxX += tbx; + g_datFile.pFileHead->fileHead.minY += tby; + g_datFile.pFileHead->fileHead.maxY += tby; // ʼ㷢仯, Ÿı + + g_datFile.pFileHead->fileHead.anchorX = pNewPara->anchorX; + g_datFile.pFileHead->fileHead.anchorY = pNewPara->anchorY; + g_datFile.pFileHead->fileHead.beginX = pNewPara->beginX; + g_datFile.pFileHead->fileHead.beginY = pNewPara->beginY; + + SetNewDatFlag(0, TRUE); +} + + +void ReSetFilePara(DataFileHead * pNewPara) +{ + printf("set new file para:\r\n\r\n"); + +#if (0) + printf("before set, filepara:\r\n"); + OutFileInfo(); +#endif + + // Ƚǰֽ + + // + + // 20210902 ߿ + //memcpy(g_datFile.pFileHead->headparts.fileparas, pNewPara->headparts.fileparas, sizeof(pNewPara->headparts.fileparas)); + memcpy(g_datFile.pFileHead, pNewPara, sizeof(DataFileHead)); + + SetNewDatFlag(0, TRUE); + +#if (0) + printf("after set, filepara:\r\n"); + OutFileInfo(); +#endif +} + +// ļУ +u16 GetFileParaCheckCrc(void) +{ + u16 crc; + crc = 0; + + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.anchorX, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.anchorY, sizeof(u32)); + + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginX, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginY, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginR, sizeof(u32)); + + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.minX, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.maxX, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.minY, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.maxY, sizeof(u32)); + + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.sizeX, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.sizeY, sizeof(u32)); + + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.anchorX2, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.anchorY2, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginX2, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginY2, sizeof(u32)); + crc += CalcCrc16((u8*)&g_datFile.pFileHead->fileHead.beginR2, sizeof(u32)); + + return crc; +} + +//------------------------------------------------------------------------- + +void InitTempData(int type) +{ + u8 * pData = NULL; + + if (type == TEMP_DATA1) + { + pData = (u8 *)(TEMP_DATA1_ADDR); + memset(pData, 0, TEMP_DATA1_SIZE); + } + else if (type == TEMP_DATA2) + { + pData = (u8 *)(TEMP_DATA2_ADDR); + memset(pData, 0, TEMP_DATA2_SIZE); + } + else if (type == TEMP_DATA3) + { + pData = (u8 *)(TEMP_DATA3_ADDR); + memset(pData, 0, TEMP_DATA3_SIZE); + } + else if (type == TEMP_DATA4) + { + pData = (u8 *)(TEMP_DATA4_ADDR); + memset(pData, 0, TEMP_DATA4_SIZE); + } +} + +u8 * GetTempData(int type) +{ + u8 * pData = NULL; + + if (type == TEMP_DATA1) + { + pData = (u8 *)(TEMP_DATA1_ADDR); + } + else if (type == TEMP_DATA2) + { + pData = (u8 *)(TEMP_DATA2_ADDR); + } + else if (type == TEMP_DATA3) + { + pData = (u8 *)(TEMP_DATA3_ADDR); + } + else if (type == TEMP_DATA4) + { + pData = (u8 *)(TEMP_DATA4_ADDR); + } + + return pData; +} + +int SetTempData(int type, int idx, u8 * pBuf) +{ + if (pBuf == NULL) + { + return -1; + } + + u8 * pData = NULL; + + if (type == TEMP_DATA1) + { + if ((idx+1)*1024 <= TEMP_DATA1_SIZE) + { + pData = (u8 *)(TEMP_DATA1_ADDR + idx*1024); + } + } + else if (type == TEMP_DATA2) + { + if ((idx+1)*1024 <= TEMP_DATA2_SIZE) + { + pData = (u8 *)(TEMP_DATA2_ADDR + idx*1024); + } + } + else if (type == TEMP_DATA3) + { + if ((idx+1)*1024 <= TEMP_DATA3_SIZE) + { + pData = (u8 *)(TEMP_DATA3_ADDR + idx*1024); + } + } + else if (type == TEMP_DATA4) + { + if ((idx+1)*1024 <= TEMP_DATA4_SIZE) + { + pData = (u8 *)(TEMP_DATA4_ADDR + idx*1024); + } + } + else + { + return -3; + } + + if (pData != NULL) + { + memcpy(pData, pBuf, 1024); + + return 0; + } + else + { + return -2; + } +} + +//------------------------------------------------------------------------- +int GetMinMaxFromFileDatWithAnchor(s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy) +{ + return GetMinMaxFromFileDatBase(1, pminx, pmaxx, pminy, pmaxy); +} + +int GetMinMaxFromFileDat(s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy) +{ + return GetMinMaxFromFileDatBase(0, pminx, pmaxx, pminy, pmaxy); +} + +int GetMinMaxFromFileDatBase(int point, s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy) +{ + s32 minx, maxx, miny, maxy, actx, acty; + u32 idx, nums; + DataItem item; + int rslt; + + if (IsDatFileAvailable() != TRUE) + { + minx = 0; + maxx = 0; + miny = 0; + maxy = 0; + } + else + { + nums = g_datFile.pFileHead->fileHead.itemNums; + + if (point == 0) + { + actx = g_datFile.pFileHead->fileHead.beginX; + acty = g_datFile.pFileHead->fileHead.beginY; + } + else + { + actx = g_datFile.pFileHead->fileHead.anchorX; + acty = g_datFile.pFileHead->fileHead.anchorY; + } + + minx = actx; + maxx = actx; + miny = acty; + maxy = acty; + + if (point == 0) + { + printf("file info, begx=%d, begy=%d\r\n", actx, acty); + } + else + { + printf("file info, anchorX=%d, anchorY=%d\r\n", actx, acty); + } + + for (idx = 0; idx < nums; idx++) + { + rslt = GetADataItemNoSqrt(0, idx, &item); + if (rslt != 0) + { + printf("get item error at GetMinMaxFromFileDatBase, rslt = %d\r\n", rslt); + break; // + } + + if (item.ctrl == DATA_END || // + item.ctrl == DATA_NULL || // ļ + item.ctrl == DATA_END_OLD || // + 0 ) + { + idx++; + break; + } + + if (item.ctrl == DATA_PAUSE || // ͣ + item.ctrl == DATA_PAUSE_OLD || // ͣ + item.ctrl == DATA_CHGND || // 빦루ɫ + item.ctrl == DATA_CUTTRD || // ߹ + item.ctrl == DATA_CUT_OLD || // ߹ + item.ctrl == DATA_ANGLE || // յ + item.ctrl == DATA_ANGLE_OLD || // յ + 0 ) + { + continue; + } + + actx += item.dx; + acty += item.dy; + + if (actx < minx) + { + minx = actx; + } + if (actx > maxx) + { + maxx = actx; + } + + if (acty < miny) + { + miny = acty; + } + if (acty > maxy) + { + maxy = acty; + } + } + g_datFile.pFileHead->fileHead.itemNums = idx; + } + + printf("GetMinMaxFromFileDatBase, num=%d minx=%d, maxx=%d, miny=%d, maxy=%d \r\n", g_datFile.pFileHead->fileHead.itemNums, minx, maxx, miny, maxy); + + *pminx = minx; + *pmaxx = maxx; + *pminy = miny; + *pmaxy = maxy; + + return 0; +} + +void InitDatFiles(void) +{ + memset(&g_datFile, 0, sizeof(DatFileCtrl)); + + g_datFile.pFileHead = &g_fileHead1; + + g_datFile.dataBuff1BegAddr = DATA_FILE_ADDR1; // 1 + g_datFile.dataBuff1Len = DATA_FILE_SIZE1; + + g_datFile.dataBuff2BegAddr = DATA_FILE_ADDR2; // 2 + g_datFile.dataBuff2Len = DATA_FILE_SIZE2; + + g_datFile.dataBuff3BegAddr = DATA3_BASE_ADDR; // 3,ڴű߿͵ļ + g_datFile.dataBuff3Len = DATA_FILE_SIZE3; + + g_datFile.pDatExCtrl = (DatExCtrl*)g_datFile.dataBuff1BegAddr; + g_datFile.enflag = 0; + + InitNorSpi(); // ʼ nor flash SPI + DatFlashInit(SetNorSpiNssOn, SetNorSpiNssOff, NorSpiReadByte, NorSpiWriteByte); + +} + + + + +//--------------------------------------------------------------------------------------------------------- +// ļ㷨 + +#if (1) + +// ֧ds8 ds16 +#define DATA_ITEM Ds8Item // Ds16Item +#define SAVE_LEN 8 // 16 + +// ֱָ +int CalcLine(double x0, double y0, double x1, double y1, int * pactx, int * pacty, int stepSize, DATA_ITEM * pData, u8 type, s16 dr) +{ + double length, tmp; + double stepx, stepy; + double sx, sy; + double xlk; + int i, count; + int actx, acty; + s32 sdx, sdy; + u8 attr; + + attr = 0; + + if (x0 == x1 && y0 == y1) + { + return 0; + } + + if (x0 > x1) + { + sx = -1.0; // x + } + else + { + sx = 1.0; + } + + if (y0 > y1) + { + sy = -1.0; // y + } + else + { + sy = 1.0; + } + + // ʼָ벽 + length = sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)); + tmp = length/stepSize; // ʵ벽 + count = (int)(tmp); // 벽 + + if (tmp - count >= 0.5) + { + count += 1; +// printf("count++=%d\r\n", count); + } + + if (count == 0 && length > 0) // ֱ + { + count = 1; + } + + if (pData == NULL) + { + return count; + } + + actx = *pactx; + acty = *pacty; + + if (x1 != x0 && y1 == y0) // ֱ + { + // printf("H Line: \r\n"); + sdy = 0; + for (i = 0; i < count; i++) + { + tmp = ((i+1)*(length)/count)*sx + x0; // ʵ + + stepx = (tmp - actx); + sdx = (s32)(stepx+0.5*sx); + + pData[i].ctrl = type; + pData[i].attr = attr; + pData[i].dx = sdx; + pData[i].dy = sdy; + pData[i].dr = 0; + +#if (SAVE_LEN == 16) + { + double len; + len = sqrt(1.0*sdx*sdx + 1.0*sdy*sdy); + pData[i].len = (u16)(len+0.9); + } +#endif + actx += sdx; + acty += sdy; + } + } + else if (x1 == x0 && y1 != y0) // ֱ + { + // printf("v Line: \r\n"); + + sdx = 0; + for (i = 0; i < count; i++) + { + tmp = ((i+1)*(length)/count)*sy + y0; // ʵ벽 + + stepy = (tmp - acty); + sdy = (s32)(stepy+0.5*sy); + + pData[i].ctrl = type; + pData[i].attr = attr; + pData[i].dx = sdx; + pData[i].dy = sdy; + pData[i].dr = 0; + +#if (SAVE_LEN == 16) + len = sqrt(1.0*sdx*sdx + 1.0*sdy*sdy); + pData[i].len = (u16)(len+0.9); +#endif + actx += sdx; + acty += sdy; + } + } + else if(x1 != x0 && y1 != y0) // б + { + // б + xlk = (y1-y0)/(x1-x0); + // printf("any Line: k=%f\r\n", xlk); + + for (i = 0; i < count; i++) + { + tmp = ((i+1)*(length)/count); // ʵ벽 + + stepx = fabs(tmp*cos(atan(xlk)))*sx + x0 - actx; + stepy = fabs(tmp*sin(atan(xlk)))*sy + y0 - acty; + + sdx = (s32)(stepx+0.5*sx); + sdy = (s32)(stepy+0.5*sy); + + pData[i].ctrl = type; + pData[i].attr = attr; + pData[i].dx = sdx; + pData[i].dy = sdy; + pData[i].dr = 0; + +#if (SAVE_LEN == 16) + len = sqrt(1.0*sdx*sdx + 1.0*sdy*sdy); + pData[i].len = (u16)(len+0.9); +#endif + actx += sdx; + acty += sdy; + } + } + pData[0].dr = dr; // һr仯 + + *pactx = actx; + *pacty = acty; + + return count; +} + +//--------------------------------------------------------------------------------------------------------- +// Բ + +// תֵ +void Rotatec(double xin, double yin, double * px, double * py, double angle) +{ + *px=xin*cos(angle)-yin*sin(angle); + *py=xin*sin(angle)+yin*cos(angle); +} + +// ȷӷ +int ArcDir(const double x[], const double y[]) +{ + double k; + if(x[1] > x[0]) + { + k = (y[1] - y[0]) / (x[1]-x[0]); + if (y[2] < (k*(x[2]-x[1]) + y[1])) + { + return -1; + } + else + { + return 1; + } + } + else if (x[1] < x[0]) + { + k = (y[1] - y[0]) / (x[1] - x[0]); + if (y[2] < (k * (x[2]-x[1]) + y[1])) + { + return 1; + } + else + { + return -1; + } + } + else if ( (x[2]>x[1] && y[1]x[1] && y[1]>y[0]) || (x[2]y[1]) ) + { + return -1; + } + else + { + printf("1. what's this case?\r\n"); + return 0; + } +} + +// 㹲 +int IsThreePointOnALine(const double threex[], const double threey[]) +{ + double k0,k1,k2; + + if ((fabs(threex[0]-threex[1]) < 1e-6) && + (fabs(threex[0]-threex[2]) < 1e-6) && + (fabs(threex[2]-threex[1]) < 1e-6) && + (fabs(threey[0]-threey[1]) < 1e-6) && + (fabs(threey[0]-threey[2]) < 1e-6) && + (fabs(threey[2]-threey[1]) < 1e-6) && + 1 ) + { +// printf("1.IsThreePointOnALine\r\n"); + return 1; + } + else if ( ((fabs(threex[0]-threex[1]) < 1e-6) && (fabs(threey[0]-threey[1]) < 1e-6)) || + ((fabs(threex[0]-threex[2]) < 1e-6) && (fabs(threey[0]-threey[2]) < 1e-6)) || + ((fabs(threex[2]-threex[1]) < 1e-6) && (fabs(threey[2]-threey[1]) < 1e-6)) || + 0 ) + { +// printf("2.IsThreePointOnALine\r\n"); + return 1; + } + else if ( (fabs(threex[0]-threex[1]) < 1e-6) && + (fabs(threex[0]-threex[2]) < 1e-6) && + (fabs(threex[2]-threex[1]) < 1e-6) && + 1 ) + { +// printf("3.IsThreePointOnALine\r\n"); + return 1; + } + else if ( (fabs(threey[0]-threey[1]) < 1e-6) && + (fabs(threey[0]-threey[2]) < 1e-6) && + (fabs(threey[2]-threey[1]) < 1e-6) && + 1 ) + { +// printf("4.IsThreePointOnALine\r\n"); + return 1; + } + else if ( (fabs(threex[2]-threex[1]) >= 1e-6) && + (fabs(threex[2]-threex[0]) >= 1e-6) && + (fabs(threex[1]-threex[0]) >= 1e-6) && + (fabs(threey[2]-threey[1]) >= 1e-6) && + (fabs(threey[2]-threey[0]) >= 1e-6) && + (fabs(threey[1]-threey[0]) >= 1e-6) && + 1 ) + { + k0 = (threey[2]-threey[1])/(threex[2]-threex[1]); + k1 = (threey[2]-threey[0])/(threex[2]-threex[0]); + k2 = (threey[1]-threey[0])/(threex[1]-threex[0]); + + if(fabs(k0-k1) < 1e-6 && fabs(k1-k2) < 1e-6) + { +// printf("5.IsThreePointOnALine\r\n"); + return 1; + } + else + { +// printf("6.IsThreePointOnALine\r\n"); + return 0; + } + } + else + { +// printf("7.IsThreePointOnALine\r\n"); + return 0; + } +} + +// õԲĺͰ뾶 +int GetArcCenter(const double x[], const double y[], double * pxc, double * pyc, double * pr) +{ + long double a, b, c, d, e, f; + double xc, yc, r; + + if (IsThreePointOnALine(x, y) == 1) + { + return -1; + } + + a = 2 * (x[1]-x[0]); + b = 2 * (y[1]-y[0]); + c = x[1]*x[1] + y[1]*y[1] - x[0]*x[0] - y[0]*y[0]; + d = 2 * (x[2]-x[1]); + e = 2 * (y[2]-y[1]); + f = x[2]*x[2] + y[2]*y[2] - x[1]*x[1] - y[1]*y[1]; + + xc = (b*f-e*c)/(b*d-e*a); + yc = (d*c-a*f)/(b*d-e*a); + r = sqrt((xc-x[0])*(xc-x[0])+(yc-y[0])*(yc-y[0])); + + *pxc = xc; + *pyc = yc; + *pr = r; + + return 0; +} + +// õֱ߽ǶȺͽǶȲ + +s16 GetAngle(const double bx, const double by, const double ex, const double ey, int * pActAng) +{ + double cosf, angle, length; + s32 dr; + + length = sqrt((ex-bx)*(ex-bx) + (ey-by)*(ey-by)); + if (length != 0) + { + // ֱ߽ǶȣxļнǡȱʾΧΪ 0--2PI + cosf = (ex-bx)/length; + angle = acos(cosf); + if (ey < by) + { + angle = 2*PI - angle; + } + + // ǶȲ + if ((angle*RADIAN_ACCURACY - *pActAng) > PI*RADIAN_ACCURACY) // ǶȲ180ȣ + { + dr = (s32)(angle*RADIAN_ACCURACY - *pActAng - 2*PI* RADIAN_ACCURACY); // 򵽴ĿǶ + *pActAng += (int)(2*PI*RADIAN_ACCURACY)+dr; // ʵλ + } + else if ((angle*RADIAN_ACCURACY - *pActAng) < (-1)*PI*RADIAN_ACCURACY) // ǶȲ180 + { + dr = (s32)(angle*RADIAN_ACCURACY - *pActAng + 2*PI* RADIAN_ACCURACY); + *pActAng += (int)(-2*PI*RADIAN_ACCURACY)+dr; // ʵλ + } + else + { + dr = (s32)(angle*RADIAN_ACCURACY - *pActAng); // + *pActAng += dr; + } + + while (*pActAng > 2*PI*RADIAN_ACCURACY) + { + *pActAng -= 2*PI*RADIAN_ACCURACY; + } + while (*pActAng < 0) + { + *pActAng += 2*PI*RADIAN_ACCURACY; + } + + return dr; + } + return 0; +} + +// ָԲ +int CalcCurve(double threex[], double threey[], int * pactx, int * pacty, int * pActAng, int stepSize, DATA_ITEM * pData, u8 type) +{ + u8 attr; + s16 dx, dy, dr; + + double k, alph, increment; + double xc, yc, r; + double distance2; + double curx, cury, lastx, lasty; + double xrot, yrot; + int actx, acty; + int ddx, ddy; + int count = 0; + int i; + + dx = 0; + dy = 0; + dr = 0; +// printf("Calc Curve x0=%.2f,y0=%.2f,x1=%.2f,\r\n\t y1=%.2f,x2=%.2f,y2=%.2f\r\n", threex[0],threey[0],threex[1],threey[1],threex[2],threey[2]); + + if(IsThreePointOnALine(threex, threey) == 1) // 3㹲 + { + // ֱߺXļн, ʽ: cos=OA1A2+B1B2O/[(A1^2+B1^2)(A2^2+B2^2)] + if (pData != NULL) + { + dr = GetAngle(threex[0], threey[0], threex[2], threey[2], pActAng); + } + return CalcLine(threex[0], threey[0], threex[2], threey[2], pactx, pacty, stepSize, pData, type, dr); // Ϊֱ߷ָ + } + + // ԲĺͰ뾶 + GetArcCenter(threex, threey, &xc, &yc, &r); + + printf("center=%f,%f,r=%f\r\n", xc, yc, r); + + // ҳԲĽ + distance2 = ((threex[0]-threex[2])*(threex[0]-threex[2])+(threey[0]-threey[2])*(threey[0]-threey[2])); // ҳ + k = ((r*r+r*r)-distance2)/(2*r*r); // cosc = (a*a + b*b - c*c)/2*a*b + if (k < -1) + { + k = -1; + } + else if (k > 1) + { + k = 1; + } + +#if (0) + distance2 = sqrt(distance2); + printf("distance=%f, k=%f\r\n", distance2, k); +#endif + + // ԲĽ + alph = acos(k); +#if (0) + printf("calc alph=%f\r\n", alph); + printf("long double size=%d\r\n", sizeof(long double)); +#endif + // ޺ת + k = (threex[0]-threex[1])*(threex[2]-threex[1]) + (threey[0]-threey[1])*(threey[2]-threey[1]); // 01 21 ļнǵҵķ-- > 0 С90. < 0 90 = 0, 90 + + if (k > 0) // нС90, ˵ǴڰԲ + { + alph = 2*PI-alph; + } + else // нǴڵ90, ˵СڵڰԲ, Ҫ + { + } +#if (0) + printf("act alph=%f, arclen=%d\r\n", alph, alph*r); +#endif + + // ÿ벽ӦĻĽǴС + if (fabsl(2*r*r-1.0*stepSize*stepSize)/(2*r*r) > 1) + { + increment = alph; + } + else + { + increment = (acos((2*r*r-1.0*stepSize*stepSize)/(r*r+r*r))); + } + + // ָ벽 + count = (int)(alph/increment+0.5); + if (count == 0) + { + count++; + } +// printf("1.count=%d, increment=%f\r\n", count, increment); + + if (pData == NULL) // ظ + { + return count; + } + + // ¼ÿ벽Ľ + increment = alph/count; + + // ȷ벽ӵĽǶȺͷ + increment *= ArcDir(threex, threey); + printf("2.count=%d, increment=%f\r\n", count, increment); + + // + lastx = threex[0]; + lasty = threey[0]; + + actx = *pactx; + acty = *pacty; + + i = 0; + do + { + if (i == count-1) + { + // һ벽 +// printf("the last step\r\n"); + curx = threex[2]; + cury = threey[2]; + } + else + { + // (lastx, lasty) Բת +// printf("before Rotatec point(%f, %f)\r\n", lastx, lasty); + Rotatec(lastx-xc, lasty-yc, &xrot, &yrot, increment); + curx = xrot + xc; + cury = yrot + yc; + } + + ddx = curx-actx; + ddy = cury-acty; + + dx = (s16)(curx-actx+(0.5*(ddx>=0?1:-1))); + dy = (s16)(cury-acty+(0.5*(ddy>=0?1:-1))); + dr = GetAngle(lastx, lasty, curx, cury, pActAng); // ֱ (lastx, lasty) curx, curyֱߵĽǶȲ + + attr = 0; + + pData[i].ctrl = type; + pData[i].attr = attr; + pData[i].dx = dx; + pData[i].dy = dy; + pData[i].dr = dr; + +#if (SAVE_LEN == 16) + { + double len; + len = sqrt(1.0*dx*dx + 1.0*dy*dy); + pData[i].len = (u16)(len+0.9); + } +#endif + +// printf("after Rotatec point(%f, %f)\r\n", lastx, lasty); + + lastx = curx; + lasty = cury; + actx += dx; + acty += dy; + i++; + + } while(i < count); + + *pactx = actx; + *pacty = acty; + + return count; +} + +int CreateCommFile(SqrtInfo * pSqrt) +{ + double threex[3], threey[3]; + + int begx, begy, begr, begflag; + +// int begx2, begy2, begr2, begflag2; + + int paraBLockNum, paraBLockTimes, paraBLockJumps; + int paraELockNum, paraELockTimes, paraELockJumps; + int blockNum, blockTimes; + int elockNum, elockTimes; + int blockjumps, elockjumps; + int stepSize, sqrtNum; + int actx, acty, actr; + int i, j, k, idx; + int stepNumber, curtNumber, totalNumber; + int n, cutflag; + + u8 ctrl, oldctrl, attr; + + DATA_ITEM * pSteps, * pData, * pTemp; + + InitDatFiles(); + g_datFile.storage = STORAGE_EXSRAM; // 洢ⲿRAM + + pSteps = (DATA_ITEM*)(g_datFile.dataBuff1BegAddr); // ݴŵַ + + if (pSqrt == NULL) + { + return -1; + } + + if (pSqrt->sqrtNum <= 0) + { + return -1; + } + + + + +//------------------ +#if (0) + printf("SqrtInfo para:\r\n"); + + printf("\t midy = %d\r\n", pSqrt->sqrtNum); + printf("\t stepSize = %d\r\n", pSqrt->stepSize); + printf("\t blockNum = %d\r\n", pSqrt->blockNum); + printf("\t blockTimes = %d\r\n", pSqrt->blockTimes); + printf("\t elockNum = %d\r\n", pSqrt->elockNum); + printf("\t elockTimes = %d\r\n", pSqrt->elockTimes); + printf("\t blockjumps = %d\r\n", pSqrt->blockjumps); + printf("\t elockjumps = %d\r\n", pSqrt->elockjumps); +#endif + + sqrtNum = pSqrt->sqrtNum; // ͼθ + + begx = pSqrt->sqrtItem[0].begx; + begy = pSqrt->sqrtItem[0].begy; + begr = 0; + + actx = begx; + acty = begy; + actr = 0; + + begflag = 0; +// begflag2 = 0; + totalNumber = 0; + oldctrl = 0; + ctrl = 0; + cutflag = 0; + +//------------------ + // ļ + + for (idx = 0; idx < sqrtNum; idx++) + { + stepSize = pSqrt->sqrtItem[idx].stepSize; // ָ벽С + + if (stepSize == 0) + { + stepSize = pSqrt->stepSize; // ָ벽С + } + + paraBLockNum = pSqrt->sqrtItem[idx].blockNum; + paraBLockTimes = pSqrt->sqrtItem[idx].blockTimes; + paraBLockJumps = pSqrt->sqrtItem[idx].blockjumps; + paraELockNum = pSqrt->sqrtItem[idx].elockNum; + paraELockTimes = pSqrt->sqrtItem[idx].elockTimes; + paraELockJumps = pSqrt->sqrtItem[idx].elockjumps; +#if (0) + printf("SqrtInfo[%d] para:\r\n", idx); + + printf("\t stepSize = %d\r\n", pSqrt->sqrtItem[idx].stepSize); + printf("\t blockNum = %d\r\n", pSqrt->sqrtItem[idx].blockNum); + printf("\t blockTimes = %d\r\n", pSqrt->sqrtItem[idx].blockTimes); + printf("\t blockjumps = %d\r\n", pSqrt->sqrtItem[idx].blockjumps); + printf("\t elockNum = %d\r\n", pSqrt->sqrtItem[idx].elockNum); + printf("\t elockTimes = %d\r\n", pSqrt->sqrtItem[idx].elockTimes); + printf("\t elockjumps = %d\r\n", pSqrt->sqrtItem[idx].elockjumps); +#endif + + // ʼ + if (paraBLockTimes > 0 && paraBLockNum > 0) + { + if (paraBLockJumps > paraBLockTimes*paraBLockNum) + { + paraBLockNum = 0; + paraBLockTimes = 0; + paraBLockJumps = 0; + } + } + else + { + paraBLockNum = 0; + paraBLockTimes = 0; + paraBLockJumps = 0; + } + while (paraBLockJumps >= paraBLockNum && paraBLockTimes > 1) // ֤jumpsСlocknums + { + paraBLockJumps -= paraBLockNum; + paraBLockTimes--; + } + + // + if (paraELockTimes > 0 && paraELockNum > 0) + { + if (paraELockJumps > paraELockTimes*paraELockNum) + { + paraELockNum = 0; + paraELockTimes = 0; + paraELockJumps = 0; + } + } + else + { + paraELockNum = 0; + paraELockTimes = 0; + paraELockJumps = 0; + } + while (paraELockJumps >= paraELockNum && paraELockTimes > 1) // ֤jumpsСlocknums + { + paraELockJumps -= paraELockNum; + paraELockTimes--; + } + //------------------ + +#if (0) + qDebug("calc para:\r\n"); + + qDebug("\t sqrtNum = %d\r\n", sqrtNum); + qDebug("\t stepSize = %d\r\n", stepSize); + qDebug("\t blockNum = %d\r\n", paraBLockNum); + qDebug("\t blockTimes = %d\r\n", paraBLockTimes); + qDebug("\t blockjumps = %d\r\n", paraBLockJumps); + qDebug("\t elockNum = %d\r\n", paraELockNum); + qDebug("\t elockTimes = %d\r\n", paraELockTimes); + qDebug("\t elockjumps = %d\r\n", paraELockJumps); +#endif + +#if (0) + printf("\t begx = %f\r\n", pSqrt->sqrtItem[idx].begx); + printf("\t begy = %f\r\n", pSqrt->sqrtItem[idx].begy); + printf("\t endx = %f\r\n", pSqrt->sqrtItem[idx].endx); + printf("\t endy = %f\r\n", pSqrt->sqrtItem[idx].endy); + printf("\t midx = %f\r\n", pSqrt->sqrtItem[idx].midx); + printf("\t midy = %f\r\n", pSqrt->sqrtItem[idx].midy); +#endif + //------------------ + if (begflag != 0) // ʼƫ + { + if (pSqrt->sqrtItem[idx].begx != pSqrt->sqrtItem[idx-1].endx || + pSqrt->sqrtItem[idx].begy != pSqrt->sqrtItem[idx-1].endy || + 0 ) + { + // Զƫ + threex[0] = pSqrt->sqrtItem[idx-1].endx; + threey[0] = pSqrt->sqrtItem[idx-1].endy; + threex[1] = pSqrt->sqrtItem[idx].begx; + threey[1] = pSqrt->sqrtItem[idx].begy; + threex[2] = pSqrt->sqrtItem[idx].begx; + threey[2] = pSqrt->sqrtItem[idx].begy; // 㹲ߣΪֱ + + stepNumber = CalcCurve(threex, threey, &actx, &acty, &actr, S16_MAX/2, pSteps, pSqrt->defofst); + pSteps += stepNumber; + totalNumber += stepNumber; + if (stepNumber != 0) + { + ctrl = pSqrt->defofst; + } + } + } +/* + if (begflag2 != 0) // ʼƫ + { + if (pSqrt->sqrtItem[idx].begx != pSqrt->sqrtItem[idx-1].endx || + pSqrt->sqrtItem[idx].begy != pSqrt->sqrtItem[idx-1].endy || + 0 ) + { + // Զƫ + threex[0] = pSqrt->sqrtItem[idx-1].endx; + threey[0] = pSqrt->sqrtItem[idx-1].endy; + threex[1] = pSqrt->sqrtItem[idx].begx; + threey[1] = pSqrt->sqrtItem[idx].begy; + threex[2] = pSqrt->sqrtItem[idx].begx; + threey[2] = pSqrt->sqrtItem[idx].begy; // 㹲ߣΪֱ + + stepNumber = CalcCurve(threex, threey, &actx, &acty, &actr, S16_MAX/2, pSteps, DATA_SECF_SEW); + pSteps += stepNumber; + totalNumber += stepNumber; + if (stepNumber != 0) + { + ctrl = DATA_SECF_SEW; + } + } + } +*/ + oldctrl = ctrl; + ctrl = pSqrt->sqrtItem[idx].type; + + blockNum = 0; + blockTimes = 0; + blockjumps = 0; + + elockNum = 0; + elockTimes = 0; + elockjumps = 0; + cutflag = 0; + + if (ctrl == DATA_SEWING || + ctrl == DATA_SEWING_R || + ctrl == DATA_SECF_SEW || + ctrl == DATA_SECF_SEW_R || + ctrl == DATA_SYNCSEW || + 0 ) + { + if (oldctrl != ctrl) + { + blockNum = paraBLockNum; // ʼ + blockTimes = paraBLockTimes; // ʼ + blockjumps = paraBLockJumps; // + + if ((blockTimes%2) != 0) // ʹΪż + { + blockTimes++; + blockjumps += blockNum; + } + } + + if ( idx+1 >= sqrtNum || + (pSqrt->sqrtItem[idx+1].type != ctrl && + ((pSqrt->sqrtItem[idx+1].type == DATA_SEWING && ctrl != DATA_SYNCSEW) || + (pSqrt->sqrtItem[idx+1].type == DATA_SECF_SEW && ctrl != DATA_SYNCSEW) || + (pSqrt->sqrtItem[idx+1].type == DATA_SYNCSEW && ctrl != DATA_SEWING) || + (pSqrt->sqrtItem[idx+1].type == DATA_SYNCSEW && ctrl != DATA_SECF_SEW) || + 0 ) && + + 1 ) || + pSqrt->sqrtItem[idx+1].begx != pSqrt->sqrtItem[idx].endx || + pSqrt->sqrtItem[idx+1].begy != pSqrt->sqrtItem[idx].endy || + 0 ) + { + elockNum = paraELockNum; // + elockTimes = paraELockTimes; // + elockjumps = paraELockJumps; // + if ((elockTimes%2) != 0) // ʹΪż + { + elockTimes++; + elockjumps += elockNum; + } + + cutflag = 1; + } + } + + threex[0] = pSqrt->sqrtItem[idx].begx; + threey[0] = pSqrt->sqrtItem[idx].begy; + threex[1] = pSqrt->sqrtItem[idx].midx; + threey[1] = pSqrt->sqrtItem[idx].midy; + threex[2] = pSqrt->sqrtItem[idx].endx; + threey[2] = pSqrt->sqrtItem[idx].endy; + + stepNumber = CalcCurve(threex, threey, NULL, NULL, NULL, stepSize, NULL, ctrl); + curtNumber = stepNumber + blockNum*blockTimes - blockjumps + elockNum*elockTimes; // ֱʼ + // printf("stepNumber = %d, cur totalNumber=%d:\r\n", stepNumber, curtNumber); + + pData = pSteps + (blockNum*blockTimes) - blockjumps; // ֱʼԤλ + n = CalcCurve(threex, threey, &actx, &acty, &actr, stepSize, pData, ctrl); + if (n != stepNumber) + { + printf("create number =%d, is not equal to stepNumber=%d:\r\n", n, stepNumber); + } + +#if (0) + // ʼϢ + printf("before add lock:\r\n"); + for (i = 0; i < curtNumber; i++) + { + printf("DataItem %d:ctrl=0x%x, attr=0x%x, dx=%d, dy=%d\r\n", i, pSteps[i].ctrl, pSteps[i].attr, pSteps[i].dx, pSteps[i].dy); + } +#endif + + // + pTemp = pData - 1; + k = blockTimes*blockNum; + for (i = 0; i < blockTimes; i++) + { + if (i%2 == 0) // + { +// printf("ji shu:\r\n"); + for (j = 0; j < blockNum; j++) + { + // 벽 + k--; + if (k < blockjumps) // + { + // pTemp->ctrl = pSqrt->defofst; // תΪoffset + } + else + { + memcpy(pTemp, &(pData[j]), sizeof(DATA_ITEM)); + pTemp->dx *= (-1); + pTemp->dy *= (-1); // ȡ + pTemp->dr *= (-1); // ȡ + attr = pTemp->attr; + attr |= ATTR_RESEW; // ־ + pTemp->attr = attr; + pTemp--; + + if (begflag == 0) // ı + { + begx += pData[j].dx * 1; + begx += pData[j].dy * 1; + begx += pData[j].dr * 1; + } + } + + } + } + else // ż + { +// printf("ou shu:\r\n"); + for (j = blockNum-1; j >= 0; j--) + { + // 벽 + k--; + if (k < blockjumps) // + { + // pTemp->ctrl = pSqrt->defofst; // תΪoffset + } + else + { + memcpy(pTemp, &(pData[j]), sizeof(DATA_ITEM)); + attr = pTemp->attr; + attr |= ATTR_RESEW; // ־ + pTemp->attr = attr; + pTemp--; + + if (begflag == 0) // ı + { + begx += pData[j].dx * (-1); + begx += pData[j].dy * (-1); + begx += pData[j].dr * (-1); + } + } + } + } + } + /**/ + // ɨ裬еdr + k = blockTimes*blockNum; + pTemp = pData - k; + if(blockTimes != 0 ) + { + for (i = 0; i <= blockTimes; i++) // һ(ż) + { + if (i%2 == 0) // ż + { + if (i == 0) // һ, ﲻӵ˶droffset + { + } + else + { + pTemp->dr = 0; + } + pTemp += blockNum; + } + else // + { + pTemp += blockNum - 1 ; + pTemp->dr = 0; + pTemp++; + } + } + } + +#if (0) + // Ϣ + printf("after add begin lock:\r\n"); + for (i = 0; i < curtNumber; i++) + { + printf("DataItem %d:ctrl=0x%x, attr=0x%x, dx=%d, dy=%d\r\n", i, pData[i].ctrl, pData[i].attr, pData[i].dx, pData[i].dy); + } +#endif + + // ˳ĩ + pTemp = pData + stepNumber; + k = 0; + for (i = 0; i < elockTimes; i++) + { + if (i%2 == 0) // + { + for (j = 0; j < elockNum; j++) + { + // 벽 + memcpy(pTemp, &(pData[stepNumber-1-j]), sizeof(DATA_ITEM)); + pTemp->dx *= -1; + pTemp->dy *= -1; // ȡ + pTemp->dr *= -1; // ȡ + + k++; + if (k > elockTimes*elockNum - elockjumps) // + { + pTemp->ctrl = pSqrt->defofst; // תΪoffset + } + else + { + attr = pTemp->attr; + attr |= ATTR_RESEW; // ־ + pTemp->attr = attr; + } + pTemp++; + } + } + else + { + for (j = elockNum-1; j >= 0; j--) + { + // 벽 + memcpy(pTemp, &(pData[stepNumber-1-j]), sizeof(DATA_ITEM)); + k++; + if (k > elockTimes*elockNum - elockjumps) // + { + pTemp->ctrl = pSqrt->defofst; // תΪoffset + } + else + { + attr = pTemp->attr; + attr |= ATTR_RESEW; // ־ + pTemp->attr = attr; + } + pTemp++; + } + } + } + +#if (0) + printf("after add end lock:\r\n"); + for (i = 0; i < curtNumber; i++) + { + printf("DataItem %d:ctrl=0x%x, attr=0x%x, dx=%d, dy=%d\r\n", i, pData[i].ctrl, pData[i].attr, pData[i].dx, pData[i].dy); + } +#endif + + stepNumber = curtNumber; + + if (cutflag != 0) // 벽Ӽ + { + // Ӽ + pSteps[stepNumber].ctrl = DATA_CUTTRD; + pSteps[stepNumber].attr = 0; + pSteps[stepNumber].dx = 0; + pSteps[stepNumber].dy = 0; + pSteps[stepNumber].dr = 0; + stepNumber++; + } + +#if (0) + printf("after jump lock:\r\n"); + for (i = 0; i < curtNumber; i++) + { + printf("DataItem %d:ctrl=0x%x, attr=0x%x, dx=%d, dy=%d\r\n", i, pSteps[i].ctrl, pSteps[i].attr, pSteps[i].dx, pSteps[i].dy); + } +#endif + + pSteps += stepNumber; + totalNumber += stepNumber; + begflag = 1; + + } // end of for(idx...... + + // һӽ + pData = (DATA_ITEM*)(g_datFile.dataBuff1BegAddr); // Դ + + pData[totalNumber].ctrl = DATA_END; + pData[totalNumber].attr = 0; + pData[totalNumber].dx = 0; + pData[totalNumber].dy = 0; + pData[totalNumber].dr = 0; + totalNumber++; + +#if (0) + printf("after calc, begx=%d, begy=%d, stepNumber=%d\r\n", begx, begy, totalNumber); +#endif + +#if (1) + + pData = (DATA_ITEM*)(g_datFile.dataBuff1BegAddr); // Դ + begflag = 0; + + // Ƶ֮ + for (i = 0; i < totalNumber; i++) + { + if ((pData->ctrl == DATA_SEWING || pData->ctrl == DATA_SYNCSEW)) + { + begflag = 1; + } + else if (pData->ctrl == pSqrt->defofst) + { + if (begflag == 1) + { + pSteps = pData; + begflag = 2; + } + else if (begflag != 2) + { + begflag = 0; + } + } + else if (pData->ctrl == DATA_CUTTRD) + { + if (begflag == 2) + { + // pSteps pData + DATA_ITEM tmpItem; + memcpy(&tmpItem, pData, sizeof(DATA_ITEM)); + memcpy(pData, pSteps, sizeof(DATA_ITEM)); + memcpy(pSteps, &tmpItem, sizeof(DATA_ITEM)); + } + begflag = 0; + } + else + { + begflag = 0; + } + pData++; + } +#endif // Ƶ֮ + + pData = (DATA_ITEM*)(g_datFile.dataBuff1BegAddr); // Դ + pSteps = pData; // Ŀ + // ɨݣȷ꣬ϲoffset + // + + begr = pData[0].dr; // һ벽drǴ0ʼı仯 + pData[0].dr = 0; // õһ벽ı仯Ϊ0 + + i = 0; +#if (0) + for (i = 0; i < totalNumber; i++) + { + if (pData->ctrl != pSqrt->defofst) // ʼoffsetϲ + { + break; + } + + begx += pData->dx; + begy += pData->dy; + begr += pData->dr; // ıλ + pData++; // Դ + } +#endif + +#if (0) + { + int offsetdr = 0; + + begflag = 0; + actr = begr; + // ɨݣϲoffset + for (i = i, j = 0; i < totalNumber; i++) + { + if (pData->ctrl == pSqrt->defofst) + { + if (begflag == 0) + { + // ʼoffset + threex[0] = 0; + threey[0] = 0; + threex[1] = 0; + threey[1] = 0; + threex[2] = 0; + threey[2] = 0; + offsetdr = 0; + begflag = 1; + } + + threex[2] += pData->dx; + threey[2] += pData->dy; + offsetdr += pData->dr; + + } + else + { + if (begflag != 0 && pData->ctrl != DATA_END) // ɾǰoffset + { + // ²ƫ + actx = 0; + acty = 0; + stepNumber = CalcCurve(threex, threey, &actx, &acty, &actr, S16_MAX/2, pSteps, pSqrt->defofst); + pSteps->dr = offsetdr ; + + pSteps += stepNumber; + j += stepNumber; + begflag = 0; + } + if (pSteps != pData) + { + memcpy(pSteps, pData, sizeof(DATA_ITEM)); + } + j++; + actr += pSteps->dr; + pSteps++; + } + + pData++; + } + + totalNumber = j; + } +#endif + +#if (0) + // ɾǰoffset + begflag = 0; + pData = (DATA_ITEM*)(g_datFile.dataBuff1BegAddr); // Դ + pData += totalNumber; + + // ɨݣϲoffset + for (i = i, j = 0; i < totalNumber; i++) + { + if (pData->ctrl == pSqrt->defofst || pData->ctrl == DATA_END) + { + pData->ctrl = DATA_END; + totalNumber--; + } + else + { + break; + } + + pData--; + } +#endif + + +#if (1) + printf("before write begx=%d, begy=%d, stepNumber=%d\r\n", begx, begy, totalNumber); +#endif + + +#if (1) + // дļͷ + strcpy(g_datFile.pFileHead->fileHead.fileName, "test.dsr"); // ļ + g_datFile.pFileHead->fileHead.dataSize = totalNumber*sizeof(DATA_ITEM); // ļ + g_datFile.pFileHead->fileHead.itemNums = totalNumber; // Ч + g_datFile.pFileHead->fileHead.bytesPerItem = sizeof(DATA_ITEM); // ÿռֽ + g_datFile.pFileHead->fileHead.bytesPerBlk = 1024; // ļݻֿС + + g_datFile.pFileHead->fileHead.dataChecksum = CalcCrc16((u8*)(g_datFile.dataBuff1BegAddr), g_datFile.pFileHead->fileHead.dataSize); // ۼУ + g_datFile.pFileHead->fileHead.checkCrc = CalcCrc16((u8*)&(g_datFile.pFileHead), 48); + + // ǰ6ֶCRCУ飬ļƣļȣЧÿֽۼӺ͵CRCУֵ + g_datFile.pFileHead->fileHead.anchorX = begx; // pSqrt->startx; + g_datFile.pFileHead->fileHead.anchorY = begy; // pSqrt->starty; // λ + + g_datFile.pFileHead->fileHead.beginX = begx; // pSqrt->startx; + g_datFile.pFileHead->fileHead.beginY = begy; // pSqrt->starty; + g_datFile.pFileHead->fileHead.beginR = begr; // ʼ + + g_datFile.pFileHead->fileHead.anchorX2 = pSqrt->startx2; + g_datFile.pFileHead->fileHead.anchorY2 = pSqrt->starty2; // λ + + g_datFile.pFileHead->fileHead.beginX2 = pSqrt->startx2; + g_datFile.pFileHead->fileHead.beginY2 = pSqrt->starty2; + g_datFile.pFileHead->fileHead.beginR2 = 0; // ʼ + + g_datFile.enflag = DATA_VALID; + + { + s32 minx, miny, maxx, maxy; + + GetMinMaxFromFileDat(&minx, &maxx, &miny, &maxy); + + g_datFile.pFileHead->fileHead.minX = minx; + g_datFile.pFileHead->fileHead.maxX = maxx; + g_datFile.pFileHead->fileHead.minY = miny; + g_datFile.pFileHead->fileHead.maxY = maxy; + } + +#if (0) + printf("finial write:\r\n"); + for (i = 0; i < stepNumber; i++) + { + printf("DataItem %d:ctrl=0x%x, attr=0x%x, dx=%d, dy=%d\r\n", i, pData[i].ctrl, pData[i].attr, pData[i].dx, pData[i].dy); + } +#endif + +#endif // дļͷ + + return 0; +} + + +#if (1) + +//#include "motos.h" + +int WriteTestFile(int sel, int cx, int cy, int sx, int sy, int dex, int dey, u16 type, int stepSize) +{ + SqrtInfo info; + + memset(&info, 0, sizeof(SqrtInfo)); + + printf("sizeof(SqrtItem)=%d, sizeof(SqrtInfo)=%d\r\n", sizeof(SqrtItem), sizeof(SqrtInfo)); + info.defofst = DATA_OFFSET; + + if (sel == 0) + { + // + info.sqrtItem[0].begx = cx-sx/2; + info.sqrtItem[0].begy = cy-sy/2; + info.sqrtItem[0].midx = cx-sx/2; + info.sqrtItem[0].midy = cy+sy/2; + info.sqrtItem[0].endx = cx-sx/2; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx-sx/2; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx+sx/2; + info.sqrtItem[1].midy = cy+sy/2; + info.sqrtItem[1].endx = cx+sx/2; + info.sqrtItem[1].endy = cy+sy/2; + info.sqrtItem[1].type = type; + + info.sqrtItem[2].begx = cx+sx/2; + info.sqrtItem[2].begy = cy+sy/2; + info.sqrtItem[2].midx = cx+sx/2; + info.sqrtItem[2].midy = cy-sy/2; + info.sqrtItem[2].endx = cx+sx/2; + info.sqrtItem[2].endy = cy-sy/2; + info.sqrtItem[2].type = type; + + info.sqrtItem[3].begx = cx+sx/2; + info.sqrtItem[3].begy = cy-sy/2; + info.sqrtItem[3].midx = cx-sx/2; + info.sqrtItem[3].midy = cy-sy/2; + info.sqrtItem[3].endx = cx-sx/2; + info.sqrtItem[3].endy = cy-sy/2; + info.sqrtItem[3].type = type; + + /* info.sqrtItem[4].begx = cx-sx; + info.sqrtItem[4].begy = cy-sy; + info.sqrtItem[4].midx = cx; + info.sqrtItem[4].midy = cy; + info.sqrtItem[4].endx = cx; + info.sqrtItem[4].endy = cy; + info.sqrtItem[4].type = DATA_OFFSET;*/ + + info.sqrtNum = 4; + } + else if (sel == 1) + { + // Բ + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy-sy/2; + info.sqrtItem[0].midx = cx-sx/2; + info.sqrtItem[0].midy = cy; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx+sx/2; + info.sqrtItem[1].midy = cy; + info.sqrtItem[1].endx = cx; + info.sqrtItem[1].endy = cy-sy/2; + info.sqrtItem[1].type = type; + + info.sqrtNum = 2; + } + else if (sel == 2) + { + int idx; + idx = 0; + while(idx < MAX_SQRT-1) + { + sx -= dex; + sy -= dey; + idx += 2; + } + + idx = 0; + while(idx < MAX_SQRT-1) + { + // ͬԲ + info.sqrtItem[idx+0].begx = cx; + info.sqrtItem[idx+0].begy = cy-sy/2; + info.sqrtItem[idx+0].midx = cx-sx/2; + info.sqrtItem[idx+0].midy = cy; + info.sqrtItem[idx+0].endx = cx; + info.sqrtItem[idx+0].endy = cy+sy/2; + info.sqrtItem[idx+0].type = type; + + info.sqrtItem[idx+1].begx = cx; + info.sqrtItem[idx+1].begy = cy+sy/2; + info.sqrtItem[idx+1].midx = cx+sx/2; + info.sqrtItem[idx+1].midy = cy; + info.sqrtItem[idx+1].endx = cx; + info.sqrtItem[idx+1].endy = cy-sy/2; + info.sqrtItem[idx+1].type = type; + + sx += dex; + sy += dey; + idx += 2; + } + info.sqrtNum = idx; + } + else if (sel == 3) + { + int idx; + idx = 0; + while(idx < MAX_SQRT-1) + { + // ͬԲ + info.sqrtItem[idx+0].begx = cx-sx/2; + info.sqrtItem[idx+0].begy = cy; + info.sqrtItem[idx+0].midx = cx; + info.sqrtItem[idx+0].midy = cy+sy/2; + info.sqrtItem[idx+0].endx = cx+sx/2; + info.sqrtItem[idx+0].endy = cy; + info.sqrtItem[idx+0].type = type; + + info.sqrtItem[idx+1].begx = cx+sx/2; + info.sqrtItem[idx+1].begy = cy; + info.sqrtItem[idx+1].midx = cx; + info.sqrtItem[idx+1].midy = cy-sy/2; + info.sqrtItem[idx+1].endx = cx-sx/2; + info.sqrtItem[idx+1].endy = cy; + info.sqrtItem[idx+1].type = type; + + sx -= dex; + sy -= dey; + idx += 2; + } + info.sqrtNum = idx; + } + else if (sel == 4) + { + // Ƭ + info.sqrtItem[0].begx = cx-sx/2; + info.sqrtItem[0].begy = cy-sy/2; + info.sqrtItem[0].midx = cx-sx/2; + info.sqrtItem[0].midy = cy+sy/2; + info.sqrtItem[0].endx = cx-sx/2; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx-sx/2; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx-sx/32; + info.sqrtItem[1].midy = cy+sy/2; + info.sqrtItem[1].endx = cx-sx/32; + info.sqrtItem[1].endy = cy+sy/2; + info.sqrtItem[1].type = type; + + info.sqrtItem[2].begx = cx-sx/32; + info.sqrtItem[2].begy = cy+sy/2; + info.sqrtItem[2].midx = cx; + info.sqrtItem[2].midy = cy+sy/2-sy/24; + info.sqrtItem[2].endx = cx; + info.sqrtItem[2].endy = cy+sy/2-sy/24; + info.sqrtItem[2].type = type; + + info.sqrtItem[3].begx = cx; + info.sqrtItem[3].begy = cy+sy/2-sy/24; + info.sqrtItem[3].midx = cx+sx/32; + info.sqrtItem[3].midy = cy+sy/2; + info.sqrtItem[3].endx = cx+sx/32; + info.sqrtItem[3].endy = cy+sy/2; + info.sqrtItem[3].type = type; + + info.sqrtItem[4].begx = cx+sx/32; + info.sqrtItem[4].begy = cy+sy/2; + info.sqrtItem[4].midx = cx+sx/2; + info.sqrtItem[4].midy = cy+sy/2; + info.sqrtItem[4].endx = cx+sx/2; + info.sqrtItem[4].endy = cy+sy/2; + info.sqrtItem[4].type = type; + + info.sqrtItem[5].begx = cx+sx/2; + info.sqrtItem[5].begy = cy+sy/2; + info.sqrtItem[5].midx = cx+sx/2; + info.sqrtItem[5].midy = cy-sy/2; + info.sqrtItem[5].endx = cx+sx/2; + info.sqrtItem[5].endy = cy-sy/2; + info.sqrtItem[5].type = type; + + info.sqrtItem[6].begx = cx+sx/2; + info.sqrtItem[6].begy = cy-sy/2; + info.sqrtItem[6].midx = cx+sx/2-sx*1/8+sx/24; + info.sqrtItem[6].midy = cy-sy/2-sy*1/8+sy/12; + info.sqrtItem[6].endx = cx+sx/2-sx*1/8; + info.sqrtItem[6].endy = cy-sy/2-sy*1/8; + info.sqrtItem[6].type = type; + + info.sqrtItem[7].begx = cx+sx/2-sx*1/8; + info.sqrtItem[7].begy = cy-sy/2-sy*1/8; + info.sqrtItem[7].midx = cx-sx/2+sx*1/8; + info.sqrtItem[7].midy = cy-sy/2-sy*1/8; + info.sqrtItem[7].endx = cx-sx/2+sx*1/8; + info.sqrtItem[7].endy = cy-sy/2-sy*1/8; + info.sqrtItem[7].type = type; + + info.sqrtItem[8].begx = cx-sx/2+sx*1/8; + info.sqrtItem[8].begy = cy-sy/2-sy*1/8; + info.sqrtItem[8].midx = cx-sx/2+sx*1/8-sx/24; + info.sqrtItem[8].midy = cy-sy/2-sy*1/8+sy/12; + info.sqrtItem[8].endx = cx-sx/2; + info.sqrtItem[8].endy = cy-sy/2; + info.sqrtItem[8].type = type; + + info.sqrtItem[9].begx = cx-sx/2; + info.sqrtItem[9].begy = cy-sy/2; + info.sqrtItem[9].midx = cx; + info.sqrtItem[9].midy = cy; + info.sqrtItem[9].endx = cx; + info.sqrtItem[9].endy = cy; + info.sqrtItem[9].type = DATA_OFFSET; + + info.sqrtNum = 10; + } + else if (sel == 5) + { + // Y + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy; + info.sqrtItem[0].midx = cx+sx/2; + info.sqrtItem[0].midy = cy+sy/4; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx-sx/2; + info.sqrtItem[1].midy = cy+sy*3/4; + info.sqrtItem[1].endx = cx; + info.sqrtItem[1].endy = cy+sy; + info.sqrtItem[1].type = type; + + info.sqrtNum = 2; + } + else if (sel == 6) + { + // Y + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy; + info.sqrtItem[0].midx = cx-sx/2; + info.sqrtItem[0].midy = cy+sy/4; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx+sx/2; + info.sqrtItem[1].midy = cy+sy*3/4; + info.sqrtItem[1].endx = cx; + info.sqrtItem[1].endy = cy+sy; + info.sqrtItem[1].type = type; + + info.sqrtNum = 2; + } + else if (sel == 7) + { + // Yֱ + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy; + info.sqrtItem[0].midx = cx; + info.sqrtItem[0].midy = cy; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy; + info.sqrtItem[0].type = type; + + info.sqrtNum = 1; + } + else if (sel == 8) + {// ͼ, dex x dey yӣӴСsx, sy + int i,j; + + info.startx = cx; + info.starty = cy; + + for (i = 0; i <= dey; i++) // x + { + if ((i%2) == 0) + { + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy+i*sy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy+i*sy; + info.sqrtItem[i].endx = cx+dex*sx; + info.sqrtItem[i].endy = cy+i*sy; + info.sqrtItem[i].type = type; + } + else + { + info.sqrtItem[i].begx = cx+dex*sx; + info.sqrtItem[i].begy = cy+i*sy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy+i*sy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+i*sy; + info.sqrtItem[i].type = type; + } + } + for (j = 0; j <= dex; j++,i++) // y + { + if ((i%2) == 0) + { + info.sqrtItem[i].begx = cx+(j)*sx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx+(j)*sx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx+(j)*sx; + info.sqrtItem[i].endy = cy+dey*sy; + info.sqrtItem[i].type = type; + } + else + { + info.sqrtItem[i].begx = cx+(j)*sx; + info.sqrtItem[i].begy = cy+dey*sy; + info.sqrtItem[i].midx = cx+(j)*sx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx+(j)*sx; + info.sqrtItem[i].endy = cy; + info.sqrtItem[i].type = type; + } + } + info.sqrtNum = i; + } + else if (sel == 10) + { + // + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy-sy*12/24; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy*10/24; + info.sqrtItem[0].midx = cx+sy*11/24; + info.sqrtItem[0].midy = cy-sy*1/24; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx; + info.sqrtItem[1].begy = cy+sy*10/24; + info.sqrtItem[1].endx = cx; + info.sqrtItem[1].endy = cy-sy*8/24; + info.sqrtItem[1].midx = cx-sy*9/24; + info.sqrtItem[1].midy = cy+sy*1/24; + info.sqrtItem[1].type = type; + + info.sqrtItem[2].begx = cx; + info.sqrtItem[2].begy = cy-sy*8/24; + info.sqrtItem[2].endx = cx; + info.sqrtItem[2].endy = cy+sy*6/24; + info.sqrtItem[2].midx = cx+sy*7/24; + info.sqrtItem[2].midy = cy-sy*1/24; + info.sqrtItem[2].type = type; + + info.sqrtItem[3].begx = cx; + info.sqrtItem[3].begy = cy+sy*6/24; + info.sqrtItem[3].endx = cx; + info.sqrtItem[3].endy = cy-sy*4/24; + info.sqrtItem[3].midx = cx-sy*5/24; + info.sqrtItem[3].midy = cy+sy*1/24; + info.sqrtItem[3].type = type; + + info.sqrtItem[4].begx = cx; + info.sqrtItem[4].begy = cy-sy*4/24; + info.sqrtItem[4].endx = cx; + info.sqrtItem[4].endy = cy; + info.sqrtItem[4].midx = cx+sy*2/24; + info.sqrtItem[4].midy = cy-sy*2/24; + info.sqrtItem[4].type = type; + + info.sqrtItem[5].begx = cx; + info.sqrtItem[5].begy = cy; + info.sqrtItem[5].endx = cx; + info.sqrtItem[5].endy = cy+sy*4/24; + info.sqrtItem[5].midx = cx-sy*2/24; + info.sqrtItem[5].midy = cy+sy*2/24; + info.sqrtItem[5].type = type; + + info.sqrtItem[6].begx = cx; + info.sqrtItem[6].begy = cy+sy*4/24; + info.sqrtItem[6].endx = cx; + info.sqrtItem[6].endy = cy-sy*6/24; + info.sqrtItem[6].midx = cx+sy*5/24; + info.sqrtItem[6].midy = cy-sy*1/24; + info.sqrtItem[6].type = type; + + info.sqrtItem[7].begx = cx; + info.sqrtItem[7].begy = cy-sy*6/24; + info.sqrtItem[7].endx = cx; + info.sqrtItem[7].endy = cy+sy*8/24; + info.sqrtItem[7].midx = cx-sy*7/24; + info.sqrtItem[7].midy = cy+sy*1/24; + info.sqrtItem[7].type = type; + + info.sqrtItem[8].begx = cx; + info.sqrtItem[8].begy = cy+sy*8/24; + info.sqrtItem[8].endx = cx; + info.sqrtItem[8].endy = cy-sy*10/24; + info.sqrtItem[8].midx = cx+sy*9/24; + info.sqrtItem[8].midy = cy-sy*1/24; + info.sqrtItem[8].type = type; + + info.sqrtItem[9].begx = cx; + info.sqrtItem[9].begy = cy-sy*10/24; + info.sqrtItem[9].endx = cx; + info.sqrtItem[9].endy = cy+sy*12/24; + info.sqrtItem[9].midx = cx-sy*11/24; + info.sqrtItem[9].midy = cy+sy*1/24; + info.sqrtItem[9].type = type; + + info.sqrtNum = 10; + } + else if (sel == 11) + { + // ʱԲ + info.sqrtItem[0].begx = cx; + info.sqrtItem[0].begy = cy-sy/2; + info.sqrtItem[0].midx = cx+sx/2; + info.sqrtItem[0].midy = cy; + info.sqrtItem[0].endx = cx; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx-sx/2; + info.sqrtItem[1].midy = cy; + info.sqrtItem[1].endx = cx; + info.sqrtItem[1].endy = cy-sy/2; + info.sqrtItem[1].type = type; + + info.sqrtNum = 2; + } + else if (sel == 12) + { + // Բ + info.sqrtItem[0].begx = cx-sx/2; + info.sqrtItem[0].begy = cy-sy/2; + info.sqrtItem[0].midx = cx-sx/2; + info.sqrtItem[0].midy = cy+sy/2; + info.sqrtItem[0].endx = cx-sx/2; + info.sqrtItem[0].endy = cy+sy/2; + info.sqrtItem[0].type = type; + + info.sqrtItem[1].begx = cx-sx/2; + info.sqrtItem[1].begy = cy+sy/2; + info.sqrtItem[1].midx = cx+sx/2; + info.sqrtItem[1].midy = cy+sy/2; + info.sqrtItem[1].endx = cx+sx/2; + info.sqrtItem[1].endy = cy+sy/2; + info.sqrtItem[1].type = type; + + info.sqrtItem[2].begx = cx+sx/2; + info.sqrtItem[2].begy = cy+sy/2; + info.sqrtItem[2].midx = cx+sx/2; + info.sqrtItem[2].midy = cy-sy/2; + info.sqrtItem[2].endx = cx+sx/2; + info.sqrtItem[2].endy = cy-sy/2; + info.sqrtItem[2].type = type; + + info.sqrtItem[3].begx = cx+sx/2; + info.sqrtItem[3].begy = cy-sy/2; + info.sqrtItem[3].midx = cx-sx/2; + info.sqrtItem[3].midy = cy-sy/2; + info.sqrtItem[3].endx = cx-sx/2; + info.sqrtItem[3].endy = cy-sy/2; + info.sqrtItem[3].type = type; + + info.sqrtItem[4].begx = cx; + info.sqrtItem[4].begy = cy-sy/2; + info.sqrtItem[4].midx = cx+sx/2; + info.sqrtItem[4].midy = cy; + info.sqrtItem[4].endx = cx; + info.sqrtItem[4].endy = cy+sy/2; + info.sqrtItem[4].type = type; + + info.sqrtItem[5].begx = cx; + info.sqrtItem[5].begy = cy+sy/2; + info.sqrtItem[5].midx = cx-sx/2; + info.sqrtItem[5].midy = cy; + info.sqrtItem[5].endx = cx; + info.sqrtItem[5].endy = cy-sy/2; + info.sqrtItem[5].type = type; + + info.sqrtNum = 6; + } + else if (sel == 100) // 360 + { + int idx, n, bx; + double temp; + idx = 0; + + // Բ + info.sqrtItem[idx].begx = cx-sx/2; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy+sy/2; + info.sqrtItem[idx].endx = cx-sx/2; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + info.sqrtItem[idx].begx = cx-sx/2; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy+sy/2; + info.sqrtItem[idx].endx = cx+sx/2; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + info.sqrtItem[idx].begx = cx+sx/2; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy-sy/2; + info.sqrtItem[idx].endx = cx+sx/2; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + info.sqrtItem[idx].begx = cx+sx/2; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy-sy/2; + info.sqrtItem[idx].endx = cx-sx/2; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + info.sqrtItem[idx].begx = cx; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy; + info.sqrtItem[idx].endx = cx; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + info.sqrtItem[idx].begx = cx; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy; + info.sqrtItem[idx].endx = cx; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_SEWING; + idx++; + + temp = sx; + temp /= sqrt(2); + sx = (int)(temp + 0.5); + + temp = sy; + temp /= sqrt(2); + sy = (int)(temp + 0.5); + + // Բ廨 + info.sqrtItem[idx].begx = cx-sx/2; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy+sy/2; + info.sqrtItem[idx].endx = cx-sx/2; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + info.sqrtItem[idx].begx = cx-sx/2; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy+sy/2; + info.sqrtItem[idx].endx = cx+sx/2; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + info.sqrtItem[idx].begx = cx+sx/2; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy-sy/2; + info.sqrtItem[idx].endx = cx+sx/2; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + info.sqrtItem[idx].begx = cx+sx/2; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy-sy/2; + info.sqrtItem[idx].endx = cx-sx/2; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + info.sqrtItem[idx].begx = cx; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = cx+sx/2; + info.sqrtItem[idx].midy = cy; + info.sqrtItem[idx].endx = cx; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + info.sqrtItem[idx].begx = cx; + info.sqrtItem[idx].begy = cy+sy/2; + info.sqrtItem[idx].midx = cx-sx/2; + info.sqrtItem[idx].midy = cy; + info.sqrtItem[idx].endx = cx; + info.sqrtItem[idx].endy = cy-sy/2; + info.sqrtItem[idx].type = DATA_EMB; + idx++; + + // ䷽ + temp = sx; + temp /= sqrt(2); + sx = (int)(temp + 0.5); + + temp = sy; + temp /= sqrt(2); + sy = (int)(temp + 0.5); + + n = sx / stepSize; + bx = cx - sx/2; + if (n > 0) + { + temp = sx; + temp /= n; + } + while (n > 0) + { + info.sqrtItem[idx].begx = bx; + info.sqrtItem[idx].begy = cy-sy/2; + info.sqrtItem[idx].midx = bx; + info.sqrtItem[idx].midy = cy+sy/2; + info.sqrtItem[idx].endx = bx; + info.sqrtItem[idx].endy = cy+sy/2; + info.sqrtItem[idx].type = DATA_PUNCH; + + idx++; + n--; + bx += temp; + } + info.sqrtNum = idx; + } + else if (sel == 201 || sel == 202 || sel == 203) // ˫ͷֱ笷Ի + { + int i; + int curtype, curofst; + + int mistep, normalstep; + + s32 begx, begy, endy; + // s32 endx; + s32 temp1, temp2; + + begx = cx; + begy = cy; + + // endx = cx; + endy = sy; + + if (sel == 201) + { + curtype = DATA_SEWING; + curofst = DATA_OFFSET; + + info.startx = begx; + info.starty = begy; + info.startx2 = 0; + info.starty2 = begy; + } + else if (sel == 202) + { + curtype = DATA_SECF_SEW; + curofst = DATA_SECF_OFST; + + info.startx = 266600; + info.starty = begy; + info.startx2 = begx; + info.starty2 = begy; + } + else if (sel == 203) + { + curtype = DATA_SECF_SEW; + curofst = DATA_SECF_OFST; + + info.startx = begx; + info.starty = begy; + info.startx2 = begx + 20000; + info.starty2 = begy; + } + + info.defofst = curofst; + + mistep = 400; + normalstep = 1200; + + temp1 = begy + 5000; + temp2 = endy - 5000; + + i = 0; + // AͷBͷ + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = begy; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = begy; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = temp1; + info.sqrtItem[i].stepSize = mistep; + info.sqrtItem[i].type = curtype; + i++; + + // AͷBͷ ͨ벽 + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = temp1; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = temp1; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = temp2; + info.sqrtItem[i].stepSize = normalstep; + info.sqrtItem[i].type = curtype; + i++; + + // AͷBͷ + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = temp2; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = temp2; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = endy; + info.sqrtItem[i].stepSize = mistep; + info.sqrtItem[i].type = curtype; + i++; + + // Խ + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = endy; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = endy; + info.sqrtItem[i].endx = begx+10000; + info.sqrtItem[i].endy = endy; + info.sqrtItem[i].stepSize = S16_MAX/2; + info.sqrtItem[i].type = curofst; + + begx += 10000; + + // AͷBͷ + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = endy; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = endy; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = temp2; + info.sqrtItem[i].stepSize = mistep; + info.sqrtItem[i].type = curtype; + i++; + + // AͷBͷ ͨ벽 + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = temp2; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = temp2; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = temp1; + info.sqrtItem[i].stepSize = normalstep; + info.sqrtItem[i].type = curtype; + i++; + + // AͷBͷ + info.sqrtItem[i].begx = begx; + info.sqrtItem[i].begy = temp1; + info.sqrtItem[i].midx = begx; + info.sqrtItem[i].midy = temp1; + info.sqrtItem[i].endx = begx; + info.sqrtItem[i].endy = begy; + info.sqrtItem[i].stepSize = mistep; + info.sqrtItem[i].type = curtype; + i++; + + info.sqrtNum = i; + } + else if (sel == 204) + { + int i; + +#define MIZHEN_LEN 5000 +#define NMZHEN1_LEN 10000 +#define NMZHEN2_LEN 100000 + + i = 0; + + // AB ͷƶ + // Aͷƶ + // Bͷƶ + + // Aͷ 50mm + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+MIZHEN_LEN; + info.sqrtItem[i].stepSize = 400; + info.sqrtItem[i].type = DATA_SEWING; + i++; + + cy += MIZHEN_LEN; + // Aͷ ͨ벽100mm + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+NMZHEN1_LEN; + info.sqrtItem[i].stepSize = 1000; + info.sqrtItem[i].type = DATA_SEWING; + i++; + + cy += NMZHEN1_LEN; + // ABͷ 50mm + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+5000; + info.sqrtItem[i].stepSize = 400; + info.sqrtItem[i].type = DATA_SYNCSEW; + i++; + + // ABͷ ͨ벽 100000 + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+NMZHEN2_LEN; + info.sqrtItem[i].stepSize = 1000; + info.sqrtItem[i].type = DATA_SYNCSEW; + i++; + + cy += NMZHEN2_LEN; + + // ABͷ + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+5000; + info.sqrtItem[i].stepSize = 400; + info.sqrtItem[i].type = DATA_SYNCSEW; + i++; + + // Aͷ ͨ벽 100mm + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+NMZHEN1_LEN; + info.sqrtItem[i].stepSize = 1000; + info.sqrtItem[i].type = DATA_SEWING; + i++; + + // Aͷ 50mm + info.sqrtItem[i].begx = cx; + info.sqrtItem[i].begy = cy; + info.sqrtItem[i].midx = cx; + info.sqrtItem[i].midy = cy; + info.sqrtItem[i].endx = cx; + info.sqrtItem[i].endy = cy+MIZHEN_LEN; + info.sqrtItem[i].stepSize = 400; + info.sqrtItem[i].type = DATA_SEWING; + i++; + + // AB ͷƶ + // Aͷƶ + // Bͷƶ + + // Bͷ + // Bͷ ͨ벽 + + // ABͷ + // ABͷ ͨ벽 + + // ABͷ + // Bͷ ͨ벽 + // Bͷ + + // Aͷƶ + // Bͷƶ + + + } + else + { + return 0; + } + + if (stepSize <= 0 || stepSize >= 65536) + { + stepSize = 100; + printf("stepsize is not support, use default\r\n"); + } + + info.stepSize = stepSize; + info.blockNum = 0; + info.blockTimes = 0; + info.elockNum = 0; + info.elockTimes = 0; + + info.blockjumps = 0; + info.elockjumps = 0; + + return CreateCommFile(&info); +} + +#endif + + + +#endif // ļ㷨 + + +//--------------------------------------------------------------------------------------------------------- + + + +#endif + + + + diff --git a/EMBOS/Users/EmbFunc/operator/datafile.h b/EMBOS/Users/EmbFunc/operator/datafile.h new file mode 100644 index 0000000..c6b4d74 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/datafile.h @@ -0,0 +1,243 @@ + +#ifndef __DATAFILE_H__ +#define __DATAFILE_H__ + +#include "datadef.h" +#include "exram.h" + +//------------------------------------------------------------------------- + +#define MAX_FILE_NUM 16 // ֿ֧ɱļĸ16 ļ + + +#define DATA_FILE_ADDR1 EXRAM1_DATA_ADDR_BEG +#define DATA_FILE_ADDR2 EXRAM2_DATA_ADDR_BEG + +#define DATA_FILE_SIZE1 MAX_DATA_EXRAM1_SIZE +#define DATA_FILE_SIZE2 MAX_DATA_EXRAM2_SIZE + +#define DATA_FILE_SIZE (DATA_FILE_SIZE1+DATA_FILE_SIZE2) + +#ifndef DATA_FILE_SIZE3 +#define DATA_FILE_SIZE3 (0) +#endif + +#ifndef DATA3_BASE_ADDR +#define DATA3_BASE_ADDR (EXRAM1_BASE_ADDR) +#endif + +//------------------------------------------------------------------------- +/* + * ļ飨ĸ + * Ϊ10,СΪ10 + * ԵǰΪ׼,:ǰ 7:3ı,ǰݿ󲿷 + * ݴ洢SRAM + */ +#ifndef FILE_EXBUF_NUM +#define FILE_EXBUF_NUM (50) +#endif + + +#define DAT_BLOCK_SIZE (1024) // ÿС +#define ITEM_NUM_PER_BLK ((DAT_BLOCK_SIZE)/sizeof(DataItem)) // ÿɴ洢 +#define REQUEST_GAP 200 // ʱ,λms + +typedef struct +{ + int exbufFlag[FILE_EXBUF_NUM]; // Ч־ 0,Ч + u32 datExBeg [FILE_EXBUF_NUM]; // ݿƫʼ + u8 datExBlock[FILE_EXBUF_NUM][DAT_BLOCK_SIZE]; // ݿݻ + +}DatExCtrl; + + +// ļ +typedef struct +{ + int enflag; // ļЧ־ + int storage; // ļ洢ʽ0ⲿSRAM; 1, ⲿNorFLASH; 2, 洢ⲿNandFlash; 3, λ(); + int newFile; // ļ־ + + u32 fileIdxMap; + s32 fileIdx; // ǰļ + + DataFileHead * pFileHead; // ļ + + u32 dataBuff1BegAddr; // ļ1ַ + u32 dataBuff1Len; // ļ1С + + u32 dataBuff2BegAddr; // ļ2ַ + u32 dataBuff2Len; // ļ2С + + u32 dataBuff3BegAddr; // ļ3ַ,EXRAMжһ,ڴű߿͵ļ + u32 dataBuff3Len; // ļ3С + + // ļ + DatExCtrl * pDatExCtrl; // ļ + +}DatFileCtrl; + +#define STORAGE_EXSRAM 0 // 洢SRAM +#define STORAGE_NORFLASH 1 // 洢NORFlash +#define STORAGE_NANDFLASH 2 // 洢NANDFlash +#define STORAGE_NETWORK 3 // 洢 +#define STORAGE_SRAMANDNOR 4 // 洢SRAMNorFlash +#define STORAGE_TRANS 5 // ת,洢 +#define STORAGE_SPAREARAM 6 // 洢SRAMض,ڴ洢߿͵ļ +#define STORAGE_INFLASH 7 // 洢ڲFLASH + + +//------------------------------------------------------------------------- + +#define MAX_SQRT 256 + +typedef struct +{ + float begx; + float begy; // + + float midx; + float midy; // м +/* + float midx2; + float midy2; // м2 +*/ + float endx; + float endy; // յ + + u8 line_type; // = 0 ֱ = 1 Բ = 2 + u8 type; // + + u8 blockNum; // ʼ + u8 blockTimes; // ʼ + u8 elockNum; // + u8 elockTimes; // + u8 blockjumps; // ʼ + u8 elockjumps; // + + u32 stepSize; // + +}__attribute__ ((packed)) SqrtItem; + +typedef struct +{ + SqrtItem sqrtItem[MAX_SQRT]; // ͼб + int sqrtNum; // + + u32 stepSize; // + u8 blockNum; // ʼ + u8 blockTimes; // ʼ + u8 elockNum; // + u8 elockTimes; // + u8 blockjumps; // ʼ + u8 elockjumps; // + + s32 startx; + s32 starty; + + s32 startx2; + s32 starty2; + + u8 defofst; +} SqrtInfo; + +int CreateCommFile(SqrtInfo * pSqrt); + +int WriteTestFile(int sel, int cx, int cy, int sx, int sy, int dex, int dey, u16 type, int stepSize); + +//------------------------------------------------------------------------- + +#ifdef _IN_DATAFILE_C +DatFileCtrl g_datFile; +DataFileHead g_fileHead1; +DataFileHead g_fileHead2; +#else +extern DatFileCtrl g_datFile; +extern DataFileHead g_fileHead1; +extern DataFileHead g_fileHead2; +#endif + +//------------------------------------------------------------------------- + +// õһ +int GetADataItem(u8 fileBlk, u32 idx, DataItem * pDat); +int GetADataItemNoSqrt(u8 fileBlk, u32 idx, DataItem * pDat); +int GetADataItemBase(u8 fileBlk, u32 idx, DataItem * pDat, int sqrtflag); +int WriteADataItem(u8 fileBlk, u32 idx, DataItem * pDat); +int WriteFileData(u8 fileBlk, u32 begaddr, u8 * pBuf, u32 size); + +u32 GetFileItemNums(void); +s32 GetFileWide(void); +s32 GetFileHigh(void); + +int GetMinMaxFromFileDatWithAnchor(s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy); +int GetMinMaxFromFileDat(s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy); +int GetMinMaxFromFileDatBase(int point, s32 * pminx, s32 * pmaxx, s32 * pminy, s32 * pmaxy); + +int InvalidDatFile(u32 idx); +int AvalidDatFile(u32 idx); +int IsDatFileAvailable(void); +int IsDatIndexAvailable(u32 idx); + +void InvalidDatBlock(void); + +void SetNewDatFlag(u32 idx, int en); +int IsNewDatFile(u32 idx); + +void InitNorSectorManage(void); +void NorAllocAndSetUsingFlags(int allocBytes); +int ReleaseSpace(int sync); + +//------------------------------------------------------------------------- + +void InitDatFiles(void); + +void OutFileInfo(void); + +int IsDatIdxInBuf(int idx); +int GetBlockIdxNeedtoLoad(int datidx); + + +#ifndef TEMP_DATA1_SIZE +#define TEMP_DATA1_SIZE (0) +#endif + +#ifndef TEMP_DATA1_ADDR +#define TEMP_DATA1_ADDR (EXRAM1_BASE_ADDR) +#endif + +#ifndef TEMP_DATA2_SIZE +#define TEMP_DATA2_SIZE (0) +#endif + +#ifndef TEMP_DATA2_ADDR +#define TEMP_DATA2_ADDR (TEMP_DATA1_ADDR+TEMP_DATA1_SIZE) +#endif + +#ifndef TEMP_DATA3_SIZE +#define TEMP_DATA3_SIZE (0) +#endif + +#ifndef TEMP_DATA3_ADDR +#define TEMP_DATA3_ADDR (TEMP_DATA2_ADDR+TEMP_DATA2_SIZE) +#endif + +#ifndef TEMP_DATA4_SIZE +#define TEMP_DATA4_SIZE (0) +#endif + +#ifndef TEMP_DATA4_ADDR +#define TEMP_DATA4_ADDR (TEMP_DATA3_ADDR+TEMP_DATA3_SIZE) +#endif + +void InitTempData(int type); +u8 * GetTempData(int type); +int SetTempData(int type, int idx, u8 * pBuf); + +//------------------------------------------------------------------------- + +#endif + + + + diff --git a/EMBOS/Users/EmbFunc/operator/exbfiletrans.c b/EMBOS/Users/EmbFunc/operator/exbfiletrans.c new file mode 100644 index 0000000..7e09da7 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/exbfiletrans.c @@ -0,0 +1,322 @@ + +#include "exbfiletrans.h" + +#include "delay.h" +#include "crc16.h" +#include "extendboards.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) +#include "workctrl.h" +#endif + +// ݰת,ӲݰתɷΧCANݰ +void FileHeadFromOperToCan(u8 fileType, BoardFileCtrl * pBoardFile) +{ + // ͷЭ,淢͵nodeidΪ0㲥ӦĻͷ,Ҫ֪ĽڵID + if (pBoardFile->fileHead.protocol == BN_PROTOCOL_HEAD) + { +#if (MAX_SUPPORT_HEAD > 0) + HeadControl * head = GetHeadFromList(1); // ĬϹ㲥 + HeadControl * temp = NULL; // ʱ洢 + int hdnm = pBoardFile->fileHead.nodeid; // ͷ,0Ϊ㲥 + if (hdnm != 0) + {// ǹ㲥,ҵӦڵ + for(int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + temp = GetHeadFromList(i+1); + if (temp->nodeTye == pBoardFile->fileHead.nodeType) + { + if (hdnm <= 1) + { + head = temp; + break; + } + else + { + hdnm--; + } + } + } + } + int timeout = 10; + while(timeout > 0) + { + if (head->transFlag == 0) + { + head->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = FILE_HEAD_ID; + pBoardFile->filepkt.pktHead.head.fnum = 6; // ļͷݹ6CAN֡ + + // + // ļ + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 8; j++) + { + pBoardFile->filepkt.pktData[i].data[j] = pBoardFile->fileHead.fileName[i*8+j]; + } + } + pBoardFile->filepkt.pktData[4].check.datasize = pBoardFile->fileHead.dataSize; + pBoardFile->filepkt.pktData[4].check.dataChecksum = pBoardFile->fileHead.dataChecksum; + pBoardFile->filepkt.pktData[5].info.fileType = fileType; + pBoardFile->filepkt.pktData[5].info.nodeType = pBoardFile->fileHead.nodeType; + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)&pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileHeadFromOperToCan err\r\n"); + } + } +#endif + } + else if (pBoardFile->fileHead.protocol == BN_PROTOCOL_COLOR) + {// ɫЭ Э鲻 ҽڵIDΪ̶ֵ nodeidΪڼ 0ȻΪ㲥 +#if (MAX_SUPPORT_COLOR > 0) + ColorControl * color = GetColorFromList(pBoardFile->fileHead.nodeid+1); + int timeout = 10; + while(timeout > 0) + { + if (color->transFlag == 0) + { + color->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = FILE_HEAD_ID; + pBoardFile->filepkt.pktHead.head.fnum = 6; // ļͷݹ6CAN֡ + + // + // ļ + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 8; j++) + { + pBoardFile->filepkt.pktData[i].data[j] = pBoardFile->fileHead.fileName[i*8+j]; + } + } + pBoardFile->filepkt.pktData[4].check.datasize = pBoardFile->fileHead.dataSize; + pBoardFile->filepkt.pktData[4].check.dataChecksum = pBoardFile->fileHead.dataChecksum; + pBoardFile->filepkt.pktData[5].data[0] = fileType; + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)&pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileHeadFromOperToCan err\r\n"); + } + } +#endif + } + else if (pBoardFile->fileHead.protocol == BN_PROTOCOL_EXTIO) + {// IOչЭ Э鲻 ҽڵIDΪ̶ֵ nodeidΪڼ 0ȻΪ㲥 +#if (MAX_SUPPORT_EXTIO > 0) + ExtIOControl * extio = GetExtIOFromList(pBoardFile->fileHead.nodeid+1); + int timeout = 10; + while(timeout > 0) + { + if (extio->transFlag == 0) + { + extio->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = FILE_HEAD_ID; + pBoardFile->filepkt.pktHead.head.fnum = 6; // ļͷݹ6CAN֡ + + // + // ļ + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 8; j++) + { + pBoardFile->filepkt.pktData[i].data[j] = pBoardFile->fileHead.fileName[i*8+j]; + } + } + pBoardFile->filepkt.pktData[4].check.datasize = pBoardFile->fileHead.dataSize; + pBoardFile->filepkt.pktData[4].check.dataChecksum = pBoardFile->fileHead.dataChecksum; + pBoardFile->filepkt.pktData[5].data[0] = fileType; + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)&pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileHeadFromOperToCan err\r\n"); + } + } +#endif + } +} + +// ݰת,ӲݰתɷΧCANݰ +void FileDataFromOperToCan(OperPacket * pPkt, BoardFileCtrl * pBoardFile) +{ + if (pBoardFile->fileHead.protocol == BN_PROTOCOL_HEAD) + {// ͷЭ,淢͵nodeidΪ0㲥ӦĻͷ,Ҫ֪ĽڵID +#if (MAX_SUPPORT_HEAD > 0) + HeadControl * head = GetHeadFromList(1); // ĬϹ㲥 + HeadControl * temp = NULL; // ʱ洢 + int hdnm = pBoardFile->fileHead.nodeid; // ͷ,0Ϊ㲥 + if (hdnm != 0) + { + for(int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + temp = GetHeadFromList(i+1); + if (temp->nodeTye == pBoardFile->fileHead.nodeType) + { + if (hdnm <= 1) + { + head = temp; + break; + } + else + { + hdnm--; + } + } + } + } + int timeout = 10; + while(timeout > 0) + { + if (head->transFlag == 0) + { + head->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = pPkt->transFileData.pktIdx; + pBoardFile->filepkt.pktHead.head.fnum = (pPkt->transFileData.exLen + CAN_DATA_LEN - 1) / CAN_DATA_LEN; + + // + // ļ + for (int i = 0; i < pBoardFile->filepkt.pktHead.head.fnum; i++) + { + memcpy(&pBoardFile->filepkt.pktData[i].data[0], &pPkt->transFileData.exData[i*CAN_DATA_LEN], CAN_DATA_LEN); + } + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileDataFromOperToCan err\r\n"); + } + } +#endif + } + else if (pBoardFile->fileHead.protocol == BN_PROTOCOL_COLOR) + {// ɫЭ Э鲻 ҽڵIDΪ̶ֵ nodeidΪڼ 0ȻΪ㲥 +#if (MAX_SUPPORT_COLOR > 0) + ColorControl * color = GetColorFromList(pBoardFile->fileHead.nodeid+1); + int timeout = 10; + while(timeout > 0) + { + if (color->transFlag == 0) + { + color->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = pPkt->transFileData.pktIdx; + pBoardFile->filepkt.pktHead.head.fnum = (pPkt->transFileData.exLen + CAN_DATA_LEN - 1) / CAN_DATA_LEN; + + // + // ļ + for (int i = 0; i < pBoardFile->filepkt.pktHead.head.fnum; i++) + { + memcpy(&pBoardFile->filepkt.pktData[i].data[0], &pPkt->transFileData.exData[i*CAN_DATA_LEN], CAN_DATA_LEN); + } + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*8); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileDataFromOperToCan err\r\n"); + } + } +#endif + } + else if (pBoardFile->fileHead.protocol == BN_PROTOCOL_EXTIO) + {// IOչЭ Э鲻 ҽڵIDΪ̶ֵ nodeidΪڼ 0ȻΪ㲥 +#if (MAX_SUPPORT_EXTIO > 0) + ExtIOControl * extio = GetExtIOFromList(pBoardFile->fileHead.nodeid+1); + int timeout = 10; + while(timeout > 0) + { + if (extio->transFlag == 0) + { + extio->transFlag = 1; + memset(&pBoardFile->filepkt, 0, sizeof(BoardFilePacketCtrl)); + + // ݰͷ + memcpy(pBoardFile->filepkt.pktHead.head.sync, CDP_SYNC, CDPSYNC_LEN); + pBoardFile->filepkt.pktHead.head.pktId = pPkt->transFileData.pktIdx; + pBoardFile->filepkt.pktHead.head.fnum = (pPkt->transFileData.exLen + CAN_DATA_LEN - 1) / CAN_DATA_LEN; + + // + // ļ + for (int i = 0; i < pBoardFile->filepkt.pktHead.head.fnum; i++) + { + memcpy(&pBoardFile->filepkt.pktData[i].data[0], &pPkt->transFileData.exData[i*CAN_DATA_LEN], CAN_DATA_LEN); + } + + pBoardFile->filepkt.pktHead.head.crc = CalcCrc16((u8*)pBoardFile->filepkt.pktData, pBoardFile->filepkt.pktHead.head.fnum*8); + + break; + } + DelayRef(100); + timeout--; + if (timeout <= 0) + {// CANͨѶʱ + printf("FileDataFromOperToCan err\r\n"); + } + } +#endif + } +} + +// CAN֡ĸʽݰ +void SendPacketWithCanData(u32 exid, BoardFileCtrl * pBoardFile) +{ + CanTxMsg txMsg; + txMsg.canTxhead.ExtId = exid; + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + + for (int idx = 0; idx < pBoardFile->filepkt.pktHead.head.fnum+1; idx++) + { + memcpy(&txMsg.data, ((u8*)&pBoardFile->filepkt.pktHead)+idx*CAN_DATA_LEN, CAN_DATA_LEN); // ݳ + SendACANDataPacket(&txMsg); + DelayMs(1); + } +} + diff --git a/EMBOS/Users/EmbFunc/operator/exbfiletrans.h b/EMBOS/Users/EmbFunc/operator/exbfiletrans.h new file mode 100644 index 0000000..d0fbf51 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/exbfiletrans.h @@ -0,0 +1,13 @@ + +#ifndef _EXBFILETRANS_H_ +#define _EXBFILETRANS_H_ + +#include "operator.h" +#include "transdata.h" + +void FileHeadFromOperToCan(u8 fileType, BoardFileCtrl * pBoardFile); // ݰת,ӲݰתɷΧCANݰ +void FileDataFromOperToCan(OperPacket * pPkt, BoardFileCtrl * pBoardFile); // ݰת,ӲݰתɷΧCANݰ + +void SendPacketWithCanData(u32 exid, BoardFileCtrl * pBoardFile); + +#endif /* _EXBFILETRANS_H_ */ diff --git a/EMBOS/Users/EmbFunc/operator/filetrans.c b/EMBOS/Users/EmbFunc/operator/filetrans.c new file mode 100644 index 0000000..3663d75 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/filetrans.c @@ -0,0 +1,660 @@ + +#define _IN_TILETRANS_C +#include "filetrans.h" + +#include "transdata.h" +#include "exbfiletrans.h" + +//------------------------------------------------------ + +//------------------------------------------------------ + +//------------------------------------------------------ + +FileTransCtrl g_fileTransCtrl; + +//------------------------------------------------------ + +//------------------------------------------------------ + +//------------------------------------------------------ + +#if (TRANS_DATA_FILE != 0) + +int ResetFileList(OperPacket * pPkt) +{ + if (pPkt == NULL) + { + return -1; + } + + g_datFile.fileIdxMap = pPkt->setFilesList.fileIdxMap; + if (g_datFile.fileIdx == -1) + { + // ǰûѡļ,ļʧЧ + InvalidDatFile(0); + } + else + { + // ǰļλͼЧ,ļʧЧ + if ((g_datFile.fileIdxMap & (0x01<packet.vldp.exlen != sizeof(DataFileHead) && +#endif + pPkt->packet.vldp.exlen != sizeof(AppFileHead) && + pPkt->packet.vldp.exlen != sizeof(BoardFileHead)&& + 1 ) + { + return -1; + } + + printf("get cmd start receive file\r\n"); + InitFileTransCtrl(&g_fileTransCtrl); + + // ݷ͵ļȷ淽ʽַ +#if (TRANS_DATA_FILE != 0) + if (pPkt->startTrans.fileType == FILE_TYPE_DAT) // ļ + { +#if (FILE_NETWORK == 0) + DataFileHead * pHead; + pHead = (DataFileHead *)(pPkt->packet.vldp.exData); + + InitNorSectorManage(); // ʼnorflash + // ݴСsramnorflash + if (pHead->fileHead.dataSize <= DATA_FILE_SIZE) + { + save = STORAGE_EXSRAM; + } + else + { + save = STORAGE_SRAMANDNOR; // ϴ + //InitNorSectorManage(); + if (pHead->fileHead.dataSize > DATA_FILE_SIZE) + { + NorAllocAndSetUsingFlags(pHead->fileHead.dataSize - DATA_FILE_SIZE); + } + } +#else + save = STORAGE_NETWORK; +#endif + } + else +#endif + if (pPkt->startTrans.fileType == FILE_TYPE_PGM) // ļ + { +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + save = STORAGE_NORFLASH; +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) // 20230523 ʹⲿRAM + save = STORAGE_EXSRAM; +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + save = STORAGE_INFLASH; +#endif + InitSaveApp(); // APPʼ + } + else if (pPkt->startTrans.fileType == FILE_TYPE_BOARD) // Χļ + { + save = STORAGE_TRANS; // ת,д洢 + } + else if (pPkt->startTrans.fileType == FILE_TYPE_FRAME) // ߿ļ + { + save = STORAGE_SPAREARAM; + } + else + { + printf("not support file\r\n"); + return -1; + } + + if (save == STORAGE_EXSRAM) + { +#if (TRANS_DATA_FILE != 0) + if (pPkt->startTrans.fileType == FILE_TYPE_DAT) // ļ + { + g_datFile.storage = STORAGE_EXSRAM; + g_datFile.fileIdx = g_fileTransCtrl.fileIdx; + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = &g_datFile; + g_fileTransCtrl.pAppFile = NULL; + + g_datFile.pFileHead = &g_fileHead1; + memcpy((u8*)g_fileTransCtrl.pDatFile->pFileHead, pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize+g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk-1)/g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk); + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; +// printf("rsv packet num=%d, bitmap len=%d\r\n", g_fileTransCtrl.packetNum, g_fileTransCtrl.lenBmp); + memset(g_fileTransCtrl.rsvBitmap, 0, LEN_RSV_BMP); // սȱ־λͼ + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + InvalidDatFile(0); + SetNewDatFlag(0, FALSE); + } + else +#endif + // 20230523 ʹⲿRAM + if (pPkt->startTrans.fileType == FILE_TYPE_PGM) // ļ + { + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = NULL; + g_fileTransCtrl.pAppFile = &g_appFile; + + memcpy(&(g_fileTransCtrl.pAppFile->fileHead), pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pAppFile->fileHead.dataSize+1024-1)/1024); // ֻ֧1024ֽڵİ + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + memset(g_fileTransCtrl.rsvBitmap, 0, g_fileTransCtrl.lenBmp); // ļսȱ־λͼ + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + + InvalidDatFile(0); + SetNewDatFlag(0, FALSE); + } + } + else if (save == STORAGE_SPAREARAM) + { + if (pPkt->startTrans.fileType == FILE_TYPE_FRAME) // ߿ļ + { + g_datFile.storage = STORAGE_SPAREARAM; + g_datFile.fileIdx = g_fileTransCtrl.fileIdx; + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = &g_datFile; + g_fileTransCtrl.pAppFile = NULL; + + g_datFile.pFileHead = &g_fileHead2; + memcpy(&(g_fileTransCtrl.pDatFile->pFileHead), pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize+g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk-1)/g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk); + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + printf("rsv packet num=%d, bitmap len=%d\r\n", g_fileTransCtrl.packetNum, g_fileTransCtrl.lenBmp); + memset(g_fileTransCtrl.rsvBitmap, 0, LEN_RSV_BMP); // սȱ־λͼ + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + InvalidDatFile(0); + SetNewDatFlag(0, FALSE); + } + } + else if (save == STORAGE_NORFLASH || save == STORAGE_SRAMANDNOR) + { +#if (TRANS_DATA_FILE != 0) + if (pPkt->startTrans.fileType == FILE_TYPE_DAT) // ļ + { + g_datFile.storage = save; + g_datFile.fileIdx = g_fileTransCtrl.fileIdx; + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = &g_datFile; + g_fileTransCtrl.pAppFile = NULL; + + g_datFile.pFileHead = &g_fileHead1; + memcpy((u8*)g_fileTransCtrl.pDatFile->pFileHead, pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize+g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk-1)/g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk); + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + memset(g_fileTransCtrl.rsvBitmap, 0, g_fileTransCtrl.lenBmp); // սȱ־λͼ + + printf("rsv packet num=%d, bitmap len=%d\r\n", g_fileTransCtrl.packetNum, g_fileTransCtrl.lenBmp); + + if (1) // δʹλд1 + { + int idx = g_fileTransCtrl.packetNum; + while((idx % 8) != 0) + { + WriteRsvBitmap(idx, 1, &g_fileTransCtrl); + idx++; + } + if (g_fileTransCtrl.lenBmp < LEN_RSV_BMP) + { + memset(&(g_fileTransCtrl.rsvBitmap[g_fileTransCtrl.lenBmp]), 0xff, LEN_RSV_BMP - g_fileTransCtrl.lenBmp); // սȱ־λͼ + } + } + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + + InvalidDatFile(0); + SetNewDatFlag(0, FALSE); + } + else +#endif + if (pPkt->startTrans.fileType == FILE_TYPE_PGM) // ļ + { + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = NULL; + g_fileTransCtrl.pAppFile = &g_appFile; + + memcpy(&(g_fileTransCtrl.pAppFile->fileHead), pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pAppFile->fileHead.dataSize+1024-1)/1024); // ֻ֧1024ֽڵİ + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + memset(g_fileTransCtrl.rsvBitmap, 0, g_fileTransCtrl.lenBmp); // ļսȱ־λͼ + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + } + } + else if (save == STORAGE_NETWORK) + { +#if (TRANS_DATA_FILE != 0) + if (pPkt->startTrans.fileType == FILE_TYPE_DAT) // ļ + { + g_datFile.storage = STORAGE_NETWORK; + g_datFile.fileIdx = g_fileTransCtrl.fileIdx; + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_REQUEST; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; + + g_fileTransCtrl.pDatFile = &g_datFile; + g_fileTransCtrl.pAppFile = NULL; + + g_datFile.pFileHead = &g_fileHead1; + memcpy((u8*)g_fileTransCtrl.pDatFile->pFileHead, pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize+g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk-1)/g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk); + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + memset(g_fileTransCtrl.rsvBitmap, 0xff, LEN_RSV_BMP); // սȱ־λͼΪ״̬ + + printf("rsv packet num=%d, bitmap len=%d\r\n", g_fileTransCtrl.packetNum, g_fileTransCtrl.lenBmp); + + memset(&(g_datFile.pDatExCtrl->exbufFlag[0]), 0, sizeof(int)*FILE_EXBUF_NUM); // ݽ + g_fileTransCtrl.transflag = TRANS_REQUEST; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + + AvalidDatFile(0); // ļЧ + SetNewDatFlag(0, TRUE); // ļ־ + printf("get a new file, saved at network\r\n"); + } +#endif + } + else if (save == STORAGE_TRANS) // ת,洢 + { + if (pPkt->startTrans.fileType == FILE_TYPE_BOARD) // Χļ + { + g_fileTransCtrl.transActive = TRANS_NONE; + g_fileTransCtrl.transflag = TRANS_NOT_BEG; + g_fileTransCtrl.fileType = pPkt->startTrans.fileType; // ļ,Χļ + g_fileTransCtrl.fileIdx = pPkt->startTrans.fileIdx; // ļ + g_fileTransCtrl.fileId = pPkt->startTrans.fileId; // ļID + + g_fileTransCtrl.pDatFile = NULL; + g_fileTransCtrl.pAppFile = NULL; + g_fileTransCtrl.pBoardFile = &g_boardFile; + + memcpy(&(g_fileTransCtrl.pBoardFile->fileHead), pPkt->packet.vldp.exData, pPkt->packet.vldp.exlen); // ݵṹ + + g_fileTransCtrl.packetNum = ((g_fileTransCtrl.pBoardFile->fileHead.dataSize+1024-1)/1024); // ֻ֧1024ֽڵİ + g_fileTransCtrl.lenBmp = (g_fileTransCtrl.packetNum+7)/8; + memset(g_fileTransCtrl.rsvBitmap, 0, g_fileTransCtrl.lenBmp); // ļսȱ־λͼ + + g_fileTransCtrl.transflag = TRANS_READY; + g_fileTransCtrl.transActive = TRANS_ACTIVE; + + printf("start exboard update\r\n"); + + // ļ + FileHeadFromOperToCan(FILE_TYPE_PGM, g_fileTransCtrl.pBoardFile); + } + } + return 0; +} + +// һݿ +void RequestADataBlock(int datblockIdx) +{ + if (g_fileTransCtrl.pDatFile->storage == STORAGE_NETWORK) + { + if (g_fileTransCtrl.transActive == TRANS_ACTIVE && + g_fileTransCtrl.transflag == TRANS_REQUEST && + g_fileTransCtrl.pDatFile->enflag == DATA_VALID && + 1 ) + { + if ( (datblockIdx >= 0) && + ((datblockIdx * g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk) < g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize) ) + { + printf("send request cmd, dbidx=%d\r\n", datblockIdx); + RequestFileData(g_fileTransCtrl.fileType, g_fileTransCtrl.fileIdx, g_fileTransCtrl.fileId, datblockIdx); + } + else + { + printf("datblockIdx=%d, out of range. bytesPerBlk=%d, dataSize=%d\r\n", datblockIdx, g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk, g_fileTransCtrl.pDatFile->pFileHead->fileHead.dataSize); + } + } + else + { + printf("request failed, transActive=0x%x, transflag=%d, enflag=0x%x\r\n", g_fileTransCtrl.transActive, g_fileTransCtrl.transflag, g_fileTransCtrl.pDatFile->enflag); + } + } +} + +int CreateFileInfo(OperPacket * pPkt) +{ + int rslt; + int idx; + int type; + + rslt = 0; + if (pPkt == NULL) + { + return -1; + } + + idx = pPkt->getFileInfo.fileIdx; + type = pPkt->getFileInfo.fileType; + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->sendFileInfo.cmdCode = DCMD_SEND_FILE_INFO; + pPkt->sendFileInfo.fileType = type; + pPkt->sendFileInfo.fileIdx = idx; + +#if (TRANS_DATA_FILE != 0) + if (type == FILE_TYPE_DAT) + { + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&g_datFile.pFileHead), sizeof(DataFileHead)); + } + else +#endif + if (type == FILE_TYPE_PGM) + { + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(g_appFile.fileHead)), sizeof(AppFileHead)); + } + + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateFileInfo\r\n"); + } + + return rslt; +} + +int CreateTransResult(OperPacket * pPkt) +{ + int rslt; + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + if (g_fileTransCtrl.transActive != TRANS_ACTIVE) + { + g_fileTransCtrl.lenBmp = 0; + g_fileTransCtrl.transflag = 0; + } + + pPkt->sendTransResult.cmdCode = DCMD_SEND_TRANS_RESULT; + pPkt->sendTransResult.fileId = g_fileTransCtrl.fileId; + pPkt->sendTransResult.active = g_fileTransCtrl.transActive; + pPkt->sendTransResult.result = g_fileTransCtrl.transflag; + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(g_fileTransCtrl.rsvBitmap), g_fileTransCtrl.lenBmp); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateTransResult\r\n"); + } + + return rslt; +} + +int SavePreProc(void) +{ +#if (1) + { + return ReleaseSpace(0); + } +#endif + return -1; +} + +int ReceiveFileData(OperPacket * pPkt) +{ + if (pPkt == NULL) + { + return -1; + } + + if (g_fileTransCtrl.transActive != TRANS_ACTIVE) + { + printf("Trans file not active\r\n"); + return -2; + } + + if (g_fileTransCtrl.transflag != TRANS_READY && + g_fileTransCtrl.transflag != TRANS_DOING && + g_fileTransCtrl.transflag != TRANS_REQUEST && + 1 ) + { + printf("Trans file not ready\r\n"); + return -2; + } + + if (g_fileTransCtrl.transflag == TRANS_READY) + { + g_fileTransCtrl.transflag = TRANS_DOING; + } + + if (pPkt->transFileData.fileId != g_fileTransCtrl.fileId) + { + printf("fileID is not equal in ReceiveFileData, thisid=%d, saveid=%d\r\n", pPkt->transFileData.fileId, g_fileTransCtrl.fileId); + return -3; + } + + //printf("get trans data, idx=%d\r\n", pPkt->transFileData.pktIdx); + +#if (TRANS_DATA_FILE != 0) + if (g_fileTransCtrl.fileType == FILE_TYPE_DAT) // ļ + { + // + WriteFileData(g_fileTransCtrl.fileIdx, (pPkt->transFileData.pktIdx)*g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk, pPkt->transFileData.exData, pPkt->transFileData.exLen); + WriteRsvBitmap(pPkt->transFileData.pktIdx, 1, &g_fileTransCtrl); + } + else +#endif + if (g_fileTransCtrl.fileType == FILE_TYPE_PGM) // ļ + { + // + int rst; + rst = SaveAppData(pPkt->transFileData.pktIdx, pPkt->transFileData.exData, pPkt->transFileData.exLen, 0); + if (rst >= 0) + { + WriteRsvBitmap(pPkt->transFileData.pktIdx, 1, &g_fileTransCtrl); + } + else + { + printf("WriteFileApp error rst= %d \r\n", rst); + } + } + else if (g_fileTransCtrl.fileType == FILE_TYPE_FRAME) // ߿ļ + { + // + WriteFileData(g_fileTransCtrl.fileIdx, (pPkt->transFileData.pktIdx)*g_fileTransCtrl.pDatFile->pFileHead->fileHead.bytesPerBlk, pPkt->transFileData.exData, pPkt->transFileData.exLen); + WriteRsvBitmap(pPkt->transFileData.pktIdx, 1, &g_fileTransCtrl); + } + else if (g_fileTransCtrl.fileType == FILE_TYPE_BOARD) // Χļ + { + // ת,дλͼ + FileDataFromOperToCan(pPkt, g_fileTransCtrl.pBoardFile); + WriteRsvBitmap(pPkt->transFileData.pktIdx, 1, &g_fileTransCtrl); + } + + if (g_fileTransCtrl.transflag == TRANS_REQUEST) + { + //printf("Receive request block =%d\r\n", pPkt->transFileData.pktIdx); + } + else + { + // 鿴λͼǷ + if (IsResvFinish(&g_fileTransCtrl) == TRUE) + { +#if (TRANS_DATA_FILE != 0) + if (g_fileTransCtrl.fileType == FILE_TYPE_DAT) + { + OutFileInfo(); + AvalidDatFile(0); + #if (0) // ¼XYСֵ + if (g_datFile.storage == STORAGE_EXSRAM) + { + s32 minx, miny, maxx, maxy; + + printf("recalc min max\r\n"); + GetMinMaxFromFileDat(&minx, &maxx, &miny, &maxy); + + g_fileTransCtrl.pDatFile->fileHead.fileHead.minX = minx; + g_fileTransCtrl.pDatFile->fileHead.fileHead.maxX = maxx; + g_fileTransCtrl.pDatFile->fileHead.fileHead.minY = miny; + g_fileTransCtrl.pDatFile->fileHead.fileHead.maxY = maxy; + + OutFileInfo(); + } + else if (g_datFile.storage == STORAGE_NORFLASH) + { + } + else if (g_datFile.storage == STORAGE_SRAMANDNOR) + { + + } + #endif + SetNewDatFlag(0, TRUE); + } + else +#endif + if (g_fileTransCtrl.fileType == FILE_TYPE_PGM) + { + + } + else if (g_fileTransCtrl.fileType == FILE_TYPE_BOARD) + {// CAN߾߱ACKӦ + } + else if (g_fileTransCtrl.fileType == FILE_TYPE_FRAME) + { + OutFileInfo(); + AvalidDatFile(0); + SetNewDatFlag(0, TRUE); + } + + g_fileTransCtrl.transflag = TRANS_DONE; // + printf("Receive file finish\r\n"); + } + } + + return 0; +} + +// ļ +int ReceiveFileParas(OperPacket * pPkt) +{ + int rslt; + if (pPkt == NULL) + { + return -1; + } + + if (pPkt->setFileParas.exLen == sizeof(DataFileHead)) + { + ReSetFilePara((DataFileHead*)(pPkt->setParas.exData)); + rslt = 0; + } + else if (pPkt->setFileParas.exLen == sizeof(DataFilePara)) + { + ReSetFileParaOld((DataFilePara*)(pPkt->setParas.exData)); + rslt = 0; + } + else + { + printf("receive len not equ, receivelen=%d, DataFilePara = %d", pPkt->setFileParas.exLen, sizeof(DataFileHead)); + rslt = -2; + } + + + return rslt; +} + +/* + * return: 0, + * -1, + * -2,ݴС + * -3,չʹ + */ +int ReceiveFileExData(OperPacket * pPkt) +{ + int rslt = 0; + + if (pPkt == NULL) + { + return -1; + } + + if (pPkt->setFileExData.exLen != 1024) + { + return -2; + } + + rslt = SetTempData(pPkt->setFileExData.exDataType, pPkt->setFileExData.exDataIdx, &pPkt->setFileExData.exData[0]); + + return rslt; +} + +// Χݴ +// CAN֡ĸʽݰ +void ExboardDataTrans(u32 exid) +{ + SendPacketWithCanData(exid, g_fileTransCtrl.pBoardFile); +} + + + diff --git a/EMBOS/Users/EmbFunc/operator/filetrans.h b/EMBOS/Users/EmbFunc/operator/filetrans.h new file mode 100644 index 0000000..de26f0c --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/filetrans.h @@ -0,0 +1,53 @@ + +#ifndef __FILETRANS_H__ +#define __FILETRANS_H__ + +#include "operator.h" + +//---------------------------------------------------------- + +#ifndef TRANS_DATA_FILE +#define TRANS_DATA_FILE 0 +#endif + +#ifndef TRANS_APP_FILE +#define TRANS_APP_FILE 0 +#endif + +//---------------------------------------------------------- + +#ifndef FILE_NETWORK +#define FILE_NETWORK 0 // ļ洢 +#endif + +//---------------------------------------------------------- + + +//---------------------------------------------------------- + + +//---------------------------------------------------------- + + +//---------------------------------------------------------- + + +//------------------------------------------------------ + +int ResetFileList(OperPacket * pPkt); +int StartReceiveFile(OperPacket * pPkt); +int CreateFileInfo(OperPacket * pPkt); +int CreateTransResult(OperPacket * pPkt); +int ReceiveFileData(OperPacket * pPkt); +int ReceiveFileParas(OperPacket * pPkt); +int ReceiveFileExData(OperPacket * pPkt); + +void RequestADataBlock(int datblockIdx); + +int SavePreProc(void); + +void ExboardDataTrans(u32 exid); + +//------------------------------------------------------ + +#endif diff --git a/EMBOS/Users/EmbFunc/operator/operator.c b/EMBOS/Users/EmbFunc/operator/operator.c new file mode 100644 index 0000000..aea8a95 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/operator.c @@ -0,0 +1,1447 @@ + +#define _IN_OPERATOR_C + +#include "operator.h" + +#include "serial.h" +#include "delay.h" +#include "tcpserver.h" +#include "filetrans.h" +#include "trigger.h" +#include "stapp.h" +#include "paras.h" + +#include "extendboards.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + +#include "workctrl.h" +#include "installment.h" +#include "error.h" + +#else + +#include "cpuid.h" + +#endif + +//--------------------------------------------------------------- + +int ReceiveMcParas(OperPacket * pPkt); +int CreateMcParas(OperPacket * pPkt, int type, int id); +void CleanBuffAfterAction(void); + +//--------------------------------------------------------------- + +#if (OPERATOR_PORT == COMM_ETHERNET) + +SocketCtrl * g_pOperatorSocket = NULL; +#define OPERATOR_SIDX TCP_SERVER_SN_BEG // udp socket + +// +int OperatorSendData(u8 * pDatBuf, int len) +{ + return EthernetSendData(g_pOperatorSocket, pDatBuf, len); +} + +// +int OperatorGetData(u8 * pDat, int expectLen) +{ + return EthernetGetData(g_pOperatorSocket, pDat, expectLen); +} + +// ѽݳ +int OperatorGetRsLen(void) +{ + return EthernetGetRsLen(g_pOperatorSocket); +} + +// õͻг +int OperatorGetSdFreeLen(void) +{ + return EthernetGetSdFreeLen(g_pOperatorSocket); +} + +#endif + +DataExFuns g_operDataExFuns; + +//--------------------------------------------------------------- + +int SendOperCommData(const u8 * pDatBuf, int len) +{ + printf("SendOperCommData is Empty\r\n"); + return 0; +} + +int GetOperCommData(u8 * pDat, int expectLen) +{ + printf("GetOperCommData is Empty\r\n"); + return 0; +} + +int GetOperRsvLen(void) +{ + printf("GetOperRsvLen is Empty\r\n"); + return 0; +} + +int GetOperTrsFreeLen(void) +{ + printf("GetOperTrsFreeLen is Empty\r\n"); + return 0; +} + +void InitOperator(void) +{ +#if (OPERATOR_PORT == COMM_ETHERNET) + InitEthernet(); + + g_pOperatorSocket = GetCtrlFromSocketIdx(OPERATOR_SIDX); + + g_operDataExFuns.SendCommData = OperatorSendData; + g_operDataExFuns.GetCommData = OperatorGetData; + g_operDataExFuns.GetRsvLen = OperatorGetRsLen; + g_operDataExFuns.GetTrsFreeLen = OperatorGetSdFreeLen; + g_operDataExFuns.Delay = DelayMs; + + AddTriggerToList(1000, NULL, EthernetServiceRun); // 1000ms ̫ + +#elif (OPERATOR_PORT == COMM_USART1) + InitUsart1(B115200, '8', 'N', '1'); + + g_operDataExFuns.SendCommData = Usart1SendData; + g_operDataExFuns.GetCommData = Usart1GetData; + g_operDataExFuns.GetRsvLen = Usart1GetRsLen; + g_operDataExFuns.GetTrsFreeLen = Usart1GetSdFreeLen; + g_operDataExFuns.Delay = DelayMs; + +#else + + g_operDataExFuns.SendCommData = SendOperCommData; + g_operDataExFuns.GetCommData = GetOperCommData; + g_operDataExFuns.GetRsvLen = GetOperRsvLen; + g_operDataExFuns.GetTrsFreeLen = GetOperTrsFreeLen; + g_operDataExFuns.Delay = DelayMs; + +#endif + +} + +// ļݰ +void RequestFileData(u8 fileType, u8 fileIdx, u16 fileId, int datblockIdx) +{ + int rslt; + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + memset(pDatpkt, 0, LEN_NORMAL_PACKET); + + operpkt.requestDatBlock.cmdCode = DCMD_REQUEST_DAT; + operpkt.requestDatBlock.fileType = fileType; + operpkt.requestDatBlock.fileIdx = fileIdx; + operpkt.requestDatBlock.fileId = fileId; + operpkt.requestDatBlock.datBlockIdx = datblockIdx; // ݰÿ1024ֽ) + + rslt = PacketAFLDP(&(operpkt.packet)); + if (rslt != 0) + { +// printf("error at call PacketAFLDP in SendMcStatus\r\n"); + } + else + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + + if (rslt != 0) + { + // printf("error at call SendAPacket in SendMcStatus\r\n"); + } + } +} + +#if (CUR_CORE_BOARD != CORE_BOARD_BOOT) + +void OperatorTask(void) +{ + int rslt; + + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + // ȡ + rslt = GetANormalPacket(&g_operDataExFuns, pDatpkt); + + // ݰִ + if (rslt > 0) // յݰ + { + switch(operpkt.packet.fldp.cmd) // Ȱ̶Ƚ + { + case UCMD_GET_MC_INFO: // ȡϢ + { + printf("get mc info cmd, toggle=%d\r\n", operpkt.getMcInfo.toggle); + rslt = CreateMcInfo(&operpkt, operpkt.getMcInfo.toggle); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_MC_INFO \r\n"); + } + } + else + { + printf("error at call CreateMcInfo in OperatorTask UCMD_GET_MC_INFO \r\n"); + } + break; + } + case UCMD_GET_MC_STATUS: // ȡ״̬ + { + // printf("get mc status cmd, toggle=%d\r\n", operpkt.getMcStatus.toggle); + rslt = CreateMcStatus(&operpkt, operpkt.getMcStatus.toggle); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_MC_STATUS \r\n"); + } + } + else + { + printf("error at call CreateMcStatus in OperatorTask UCMD_GET_MC_STATUS \r\n"); + } + break; + } + case UCMD_GET_MC_PARAS: // ȡ + { + printf("get mc paras cmd\r\n"); + rslt = CreateMcParas(&operpkt, operpkt.getMcParas.paraType, operpkt.getMcParas.paraId); + if (rslt == 0) + { + // int temp = GetMsSoftTimer(); + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 10000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_MC_PARAS \r\n"); + } + } + else + { + printf("error at call CreateMcParas in OperatorTask UCMD_GET_MC_PARAS \r\n"); + } + break; + } + case UCMD_GET_MEM_DATA: // ȡڴ + break; + case UCMD_GET_SENSORS: // ȡź + { + //printf("get mc sensors cmd\r\n"); + rslt = CreateSensorsStatus(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_SENSORS \r\n"); + } + } + else + { + printf("error at call CreateSensorsStatus in OperatorTask UCMD_GET_SENSORS \r\n"); + } + break; + } + case UCMD_GET_SENSORS_BMP: // ȡЧλͼ + { + printf("get mc sensors bmp cmd\r\n"); + rslt = CreateSensorsBmp(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_SENSORS_BMP \r\n"); + } + } + else + { + printf("error at call CreateSensorsBmp in OperatorTask UCMD_GET_SENSORS_BMP \r\n"); + } + break; + } + case UCMD_GET_FILE_INFO: // ȡļϢ + { + rslt = CreateFileInfo(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_FILE_INFO \r\n"); + } + } + else + { + printf("error at call CreateFileInfo in OperatorTask UCMD_GET_FILE_INFO \r\n"); + } + break; + } + case UCMD_GET_TRANS_RESULT: // ȡ + { + printf("1. get trans result cmd\r\n"); + rslt = CreateTransResult(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_TRANS_RESULT \r\n"); + } + } + else + { + printf("error at call CreateTransResult in OperatorTask UCMD_GET_TRANS_RESULT \r\n"); + } + + break; + } + case UCMD_SET_MC_CONFIG: // û + { + break; + } + case UCMD_SET_MC_STATUS: // û״̬ + { + printf("SetMcStatus when stop\r\n"); + SetMcStatus(operpkt.setMcStatus.staCode, operpkt.setMcStatus.para); + break; + } + case UCMD_SET_MC_PARAS: // û + { + printf("receive set mc para cmd\r\n"); + ReceiveMcParas(&operpkt); + break; + } + case UCMD_SET_MEM_DATA: // ڴ + { + break; + } + case UCMD_SET_FILE_PARAS: // ļ + { + ReceiveFileParas(&operpkt); + break; + } + case UCMD_SET_FILE_EXDATA: // ļչ + { + ReceiveFileExData(&operpkt); + break; + } + case UCMD_SET_EXEC_PROGRESS: // ִн + { + SetExecProgress(&operpkt); + break; + } + case UCMD_SET_INSTALLMENT: // ÷ + { + int rslt; + printf("set installment\r\n"); + rslt = SetInstallMent((char*)(operpkt.setInstallment.exData)); + + RefreshWorkTimeEn(); + + if (rslt >= 0) + { + ReportError(ERR_INSTALLMENT_OK); // óɹ + } + else + { + ReportError(ERR_INSTALLMENT_FAIL); // ʧ + } + break; + } + case UCMD_SET_ELAPSED_TIME: // þʱ + { + printf("set elapsed, type=%d, time = %d\r\n", operpkt.setElapsedTime.type, operpkt.setElapsedTime.time); + + if (g_workCtrl.cansetelapsed == 0) + { + u32 time; + s32 val; + time = operpkt.setElapsedTime.time; + if (time > 5000*3600) // 5000Сʱ + { + time = 5000*3600; + } + time /= 60; // + val = time; + val *= -1; + + if (abs(val) < 60) + { + printf("close time=%d min\r\n", val); + } + else if (abs(val) < 1440) + { + s32 hour, min; + hour = val / 60; + min = val % 60; + printf("close time=%d hour %d min\r\n", hour, min); + } + else + { + s32 day, hour, min; + day = val / 1440; + hour = val % 1440; + min = hour % 60; + hour /= 60; + printf("close time=%d day %d hour %d min\r\n", day, hour, min); + } + RefWorkableTimer(val); + + RefreshWorkTimeEn(); + g_workCtrl.cansetelapsed = 1; + } + else + { + printf("has set elapsed already\r\n"); + } + break; + } + //--------------- + + case UCMD_ACT_BYHAND: // ֶ + { + ReportError(ERR_NONE); + ControlByHand(&operpkt); + + CleanBuffAfterAction(); + + break; + } + case UCMD_MC_WORK: // + { + ReportError(ERR_NONE); + ControlWork(&operpkt); + CleanBuffAfterAction(); + break; + } + case UCMD_MOVE_TO: // ƶ + { + MoveFrameTo(&operpkt); + break; + } + case UCMD_MOVE_OFST: // ƶƫ + { + MoveFrameAsOfst(&operpkt); + break; + } + case UCMD_START_TRANS: // ļ + { + StartReceiveFile(&operpkt); + SaveFileIdxFromDatafile(); + if (IsNewDatFile(0) == FALSE) + { + SetFileOkFlag(0); + } + break; + } + case UCMD_TRANS_FILE_DATA: // ļ + { + u32 thistimer, oldtimer; + oldtimer = GetMsSoftTimer(); + do + { + int svrslt = SavePreProc(); + if (svrslt == 2 || svrslt < 0) + { + break; + } + thistimer = GetMsSoftTimer(); + if ((thistimer - oldtimer) > 3000) + { + oldtimer = thistimer; + SendStatus(1); // ״̬,ֹϿ + } + }while(1); + + ReceiveFileData(&operpkt); + if (IsNewDatFile(0) == TRUE) + { + SetFileOkFlag(1); // ļձ־ + } + + break; + } + case UCMD_SET_FILE_LIST: // ļб + { + ResetFileList(&operpkt); + SaveFileIdxFromDatafile(); + break; + } + case UCMD_BOARD_UPDATE: // Χ + { + // ͷЭ,λҪ֪ӦĽڵID,ֻ֪ڵͺͻͷż + // ɫЭ ֪ڼ + printf("update ex board, protocolType=%d, nodetype=%d, nodeId=%d\r\n", operpkt.updateBoard.protocolType, operpkt.updateBoard.nodetype, operpkt.updateBoard.nodeId); + StartBoardUpdate(operpkt.updateBoard.protocolType, operpkt.updateBoard.nodetype, operpkt.updateBoard.nodeId); + DelayRef(1); + break; + } + case UCMD_MC_UPDATE: // λ + { + printf("receive updat mc cmd\r\n"); + DelayRef(100); + StartAppUpdate(1); // + break; + } + case UCMD_GET_FILE_LIST: // ȡλļб + { + rslt = CreateFileList(&operpkt, g_datFile.fileIdxMap); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_FILE_LIST \r\n"); + } + } + else + { + printf("error at call CreateMcStatus in OperatorTask UCMD_GET_FILE_LIST \r\n"); + } + break; + } + case UCMD_SET_DEF_PARA : // Ĭϲ + { + printf("receive set def para cmd\r\n"); + char * info = "set mc and wk def para"; + SendDebugInfo(info); + WriteDefMcPara(); + WriteDefWkPara(); + break; + } + case UCMD_SET_MVANGDEF_PARA: // öǶĬϲ + { + printf("receive set move angle def para cmd\r\n"); + char * info = "set mv angle def para"; + SendDebugInfo(info); + WriteDefMvAngPara(); + break; + } + case UCMD_SET_HEADDEF_PARA: // ûͷĬϲ + { + printf("set head def para, nodetype=%d, id=%d\r\n", operpkt.setDefParas.nodetype, operpkt.setDefParas.id); + char buf[1024]; + sprintf(buf, "set head def para, nodetype=%d", operpkt.setDefParas.nodetype); + SendDebugInfo(&buf[0]); + SetBoardNvPara(BN_PROTOCOL_HEAD, operpkt.setDefParas.nodetype, operpkt.setDefParas.id, 255, 0, 0); + break; + } + case UCMD_SET_COLORDEF_PARA: // ûɫĬϲ + { + printf("set color def para, boardnum=%d\r\n", operpkt.setDefParas.id); + char buf[1024]; + sprintf(buf, "set color def para, id=%d", operpkt.setDefParas.id); + SendDebugInfo(&buf[0]); + SetBoardNvPara(BN_PROTOCOL_COLOR, 0, operpkt.setDefParas.id, 255, 0, 0); + break; + } + case UCMD_TRA_BOARD: // ͷ + { + printf("traverse cmd, protocolType=%d, nodeId=%d, nodeType=%d, traNum=%d\r\n", operpkt.traverse.protocolType, + operpkt.traverse.nodeId, operpkt.traverse.nodeType, operpkt.traverse.traNum); + TraverseTask(operpkt.traverse.protocolType, + operpkt.traverse.nodeId, + operpkt.traverse.nodeType, + operpkt.traverse.traNum); + break; + } + case UCMD_GET_BOARD_VER: // ȡΧ汾 + { + RequestBoardVer(); + DelayRef(100); +#if (MAX_SUPPORT_COLOR > 0) + ColorControl * color = NULL; + for (int i = 1; i < MAX_SUPPORT_COLOR+1; i++) + { + color = GetColorFromList(i+1); + if (color->verFlag == 1) + { + color->verFlag = 0; + rslt = CreateBoardVer(&operpkt, BN_PROTOCOL_COLOR, color->nodeId, 0, &color->regVal); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + else + { + printf("error at call CreateBoardVer in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + } +#endif +#if (MAX_SUPPORT_HEAD > 0) + HeadControl * head = NULL; + for (int i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + head = GetHeadFromList(i+1); + if (head->verFlag == 1) + { + head->verFlag = 0; + rslt = CreateBoardVer(&operpkt, BN_PROTOCOL_HEAD, head->nodeId, head->nodeTye, &head->regVal); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + else + { + printf("error at call CreateBoardVer in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + } +#endif +#if (MAX_SUPPORT_EXTIO > 0) + ExtIOControl * extio = NULL; + for (int i = 1; i < MAX_SUPPORT_EXTIO+1; i++) + { + extio = GetExtIOFromList(i+1); + if (extio->verFlag == 1) + { + extio->verFlag = 0; + rslt = CreateBoardVer(&operpkt, BN_PROTOCOL_EXTIO, extio->nodeId, 0, &extio->regVal); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + else + { + printf("error at call CreateBoardVer in OperatorTask DCMD_SEND_BOARDVER \r\n"); + } + } + } +#endif + break; + } +#if (RD_HEAD_PARA_NUM > 0) + case UCMD_GET_HEAD_PARA: // ȡͷ + { + /* + * 20220601 ʵַʽǰ߼ɹ + * λҪ֪ĽڵID,ֻ֪λڵ(ƽ,ë,)ͶӦĻͷż + */ + int i, hdnm; + hdnm = operpkt.boardPara.nodeId; // Ӧͷ + for (i = 1; i < MAX_SUPPORT_HEAD+1; i++) + { + HeadControl * phd = GetHeadFromList(i+1); + if (phd->nodeTye == operpkt.boardPara.nodeType) + {// 㲥,ȡӦڵ͵ĵһڵ + if (hdnm <= 1) + { + break; + } + else + { + hdnm--; + } + } + } + + if (i <= MAX_SUPPORT_HEAD) // ҵӦĽڵ + { + printf("read head=%d para\r\n", i); + RequestAHeadNvPara(i); // ȡijڵIJ + DelayRef(100); + HeadControl * head = GetHeadFromList(i+1); + if (head->nvParaFlag == 1) + { + head->nvParaFlag = 0; + int id = 0;; + if (head->nodeTye == FLAT_EMB_HEAD) + { + id = 1; + } + else if (head->nodeTye == CHENILLE_HEAD) + { + id = 2; + } + else if (head->nodeTye == COIL_HEAD) + { + id = 3; + } + rslt = CreateHeadBoardPara(&operpkt, i, operpkt.boardPara.nodeType, GetBoardNvPara(id)); + if (rslt == 0) + { + printf("send head para\r\n"); + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask DCMD_SEND_HEADPARA \r\n"); + } + } + else + { + printf("error at call CreateHeadBoardPara in OperatorTask DCMD_SEND_HEADPARA \r\n"); + } + } + else + { + printf("receive err\r\n"); + ReportError(ERR_READ_HEAD_PARA); + } + } + else // ߼ + { + printf("not find node\r\n"); + ReportError(ERR_READ_HEAD_PARA); + } + break; + } + case UCMD_GET_COLOR_PARA: // ȡɫư + { + if (operpkt.boardPara.nodeId != 0) // ֹ֧㲥ȡ + { + ColorControl * color = GetColorFromList(operpkt.boardPara.nodeId+1); + if (color != NULL) + { + color->refNvPara = 1; + DelayRef(100); + if (color->nvParaFlag == 1) + { + color->nvParaFlag = 0; + int id = 0;; + if (operpkt.boardPara.nodeId == 2) + {// ëɫ + id = 4; + } + rslt = CreateColorBoardPara(&operpkt, operpkt.boardPara.nodeId, GetBoardNvPara(id)); + if (rslt == 0) + { + printf("send color para, nodeid=%d\r\n", operpkt.boardPara.nodeId); + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_COLOR_PARA \r\n"); + } + } + else + { + printf("error at call CreateColorBoardPara in OperatorTask UCMD_GET_COLOR_PARA \r\n"); + } + } + else + { + printf("receive err\r\n"); + ReportError(ERR_READ_COLOR_PARA); + } + } + } + else + { + printf("not support broadcast read color para\r\n"); + } + break; + } +#endif + case UCMD_GET_HEAD_NVPARAS: // ѡԶȡͷ + {// ɶȡͷ ,͸λ + printf("get head type=%d id=%d nvparaid=%d\r\n", operpkt.boardPara.nodeType, operpkt.boardPara.nodeId, operpkt.boardPara.paraid); + u32 buf[32] = {0}; + int rslt = RequestHeadNvParas(operpkt.boardPara.nodeType, operpkt.boardPara.nodeId, operpkt.boardPara.paraid, &buf[0]); + if (rslt == 0) + { + rslt = CreateHeadNvParas(&operpkt, operpkt.boardPara.nodeType, operpkt.boardPara.nodeId, operpkt.boardPara.paraid, (u8*)(&buf[0])); + if (rslt == 0) + { + printf("send head nv paras\r\n"); + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_HEAD_NVPARAS \r\n"); + } + } + else + { + printf("error at call CreateHeadNvParas in OperatorTask UCMD_GET_HEAD_NVPARAS \r\n"); + } + } + else + { + printf("read head nv paras error, rslt=%d\r\n", rslt); + ReportError(ERR_READ_HEAD_PARA); + } + break; + } + + case UCMD_SET_HEAD_PARA: // ûͷ + { + printf("set head para, nodetype=%d, nodeId=%d\r\n", operpkt.boardPara.nodeType, operpkt.boardPara.nodeId); + BoardFilePacketCtrl boardpkt; + ParaDataFromOperToCan(BN_PROTOCOL_HEAD, &operpkt, &boardpkt); + break; + } + + case UCMD_SET_COLOR_PARA: // ûɫư + { + printf("set color para, boardnum=%d\r\n", operpkt.boardPara.nodeId); + BoardFilePacketCtrl boardpkt; + ParaDataFromOperToCan(BN_PROTOCOL_COLOR, &operpkt, &boardpkt); + break; + } + + case UCMD_SET_HEAD_NVPARA: // ѡûͷ + { + printf("set head type=%d id=%d paraid=%d nvpara\r\n", operpkt.boardPara.nodeType, operpkt.boardPara.nodeId, operpkt.boardPara.paraid); +// SetHeadNvPara(operpkt.boardPara.nodeType, operpkt.boardPara.nodeId, operpkt.boardPara.paraid, (u32*)(&operpkt.boardPara.exData)); + break; + } + + default: + { + break; + } + } + } +// SavePreProc(); +} + +void CleanBuffAfterAction(void) +{ + int ret; + int temp, timer; + + timer = GetMsSoftTimer(); + do + { + ret = ReadBuffEmpty(&g_operDataExFuns); // սջ + if (ret == 0) + { + break; + } + else + { + printf("ReadBuffEmpty rslt=%d\r\n", ret); + } + DelayRef(1); + temp = GetMsSoftTimer(); + if (temp - timer > 10) + { + printf("CleanBuffAfterAction timout\r\n"); + break; + } + }while(1); +} + +// ״̬ +void SendMcStatus(int force) +{ + int rslt; + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + if (IsStatusChanged() != 0 || force != 0) + { + rslt = CreateMcStatus(&operpkt, 0); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); +// printf("SendMcStatus\r\n"); + if (rslt != 0) + { +// printf("error at call SendAPacket in SendMcStatus\r\n"); + } + } + else + { + printf("error at call CreateMcStatus in SendMcStatus\r\n"); + } + + SetLightStaByCode(g_workCtrl.cursta.errorCode); + } +} +// -------------------------------------------- + +int IsSocketConnected(void) +{ +#if (OPERATOR_PORT == COMM_ETHERNET) + if (g_pOperatorSocket->status == STA_CONNECT) + { + return TRUE; + } +#endif + return FALSE; +} + +int IsNewOperCmd(void) +{ + int rslt; + + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + rslt = GetANormalPacket(&g_operDataExFuns, pDatpkt); + if (rslt > 0) // յݰ + { + return TRUE; + } +#if (OPERATOR_PORT == COMM_ETHERNET) + if (IsSocketConnected() != TRUE) + { +// return TRUE; + } +#endif + + return FALSE; +} + +void OperatorTaskWhenRun(int revfile) +{ + int rslt; + + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + // ȡ + rslt = GetANormalPacket(&g_operDataExFuns, pDatpkt); + + // ݰִ + if (rslt > 0) // յݰ + { + switch(operpkt.packet.fldp.cmd) // Ȱ̶Ƚ + { + case UCMD_GET_MC_STATUS: // ȡ״̬ + { + printf("get mc status cmd when run\r\n"); + rslt = CreateMcStatus(&operpkt, operpkt.getMcStatus.toggle); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 0); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTaskWhenRun UCMD_GET_MC_STATUS \r\n"); + } + } + else + { + printf("error at call CreateMcStatus in OperatorTaskWhenRun UCMD_GET_MC_STATUS \r\n"); + } + break; + } + case UCMD_GET_MC_PARAS: // ȡ + { + printf("get mc paras cmd\r\n"); + rslt = CreateMcParas(&operpkt, operpkt.getMcParas.paraType, operpkt.getMcParas.paraId); + if (rslt == 0) + { + // int temp = GetMsSoftTimer(); + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 10000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_MC_PARAS \r\n"); + } + } + else + { + printf("error at call CreateMcParas in OperatorTask UCMD_GET_MC_PARAS \r\n"); + } + break; + } + case UCMD_SET_MC_STATUS: // û״̬ + { + printf("SetMcStatus when run\r\n"); + SetMcStatus(operpkt.setMcStatus.staCode, operpkt.setMcStatus.para); + break; + } + case UCMD_MC_WORK: // + { + printf("get control work cmd when run\r\n"); + ControlWorkWhenWorking(&operpkt); + break; + } + case UCMD_GET_FILE_INFO: // ȡļϢ + { + if (revfile == 1) + { + rslt = CreateFileInfo(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTaskWhenRun UCMD_GET_FILE_INFO \r\n"); + } + } + else + { + printf("error at call CreateFileInfo in OperatorTaskWhenRun UCMD_GET_FILE_INFO \r\n"); + } + } + break; + } + case UCMD_GET_TRANS_RESULT: // ȡ + { + if (revfile == 1) + { + printf("3. get trans result cmd\r\n"); + rslt = CreateTransResult(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTaskWhenRun UCMD_GET_TRANS_RESULT \r\n"); + } + } + else + { + printf("error at call CreateTransResult in OperatorTaskWhenRun UCMD_GET_TRANS_RESULT \r\n"); + } + } + break; + } + case UCMD_SET_FILE_PARAS: // ļ + { + if (revfile == 1) + { + ReceiveFileParas(&operpkt); + } + break; + } + case UCMD_START_TRANS: // ļ + { + if (revfile == 1) + { + StartReceiveFile(&operpkt); + SaveFileIdxFromDatafile(); + if (IsNewDatFile(0) == FALSE) + { + SetFileOkFlag(0); + } + } + break; + } + case UCMD_TRANS_FILE_DATA: // ļ + { + if (revfile == 1) + { + ReceiveFileData(&operpkt); + if (IsNewDatFile(0) == TRUE) + { + SetFileOkFlag(1); // ļձ־ + } + } + break; + } + case UCMD_SET_FILE_LIST: // ļб + { + ResetFileList(&operpkt); + SaveFileIdxFromDatafile(); + break; + } + + case UCMD_SET_EXEC_PROGRESS: // ִн + { + if (revfile == 1) + { + SetExecProgress(&operpkt); + } + break; + } + + default: + printf("get cmd = 0x%x when run\r\n", operpkt.packet.fldp.cmd); + break; + } + } + if (revfile == 1) + { +// SavePreProc(); + } +} + +int ReceiveMcParas(OperPacket * pPkt) +{ + int rslt; + + rslt = 0; + if (pPkt == NULL) + { + return -1; + } + +//----------- + + //printf("ReceiveParas type = %d, exlen=%d\r\n", pPkt->setParas.paraType, pPkt->setParas.exLen); + + if (pPkt->setParas.paraType == SEW_MCPARA_MACH) + { + if (pPkt->setParas.exLen == sizeof(g_mcPara)) + { + memcpy((u8*)(&g_mcPara), pPkt->setParas.exData, sizeof(g_mcPara)); + CheckMcParaRange(); + SaveMcPara(); + RefreshParas(PARA_MC_VALID); + SetNewParasFlag(PARA_MC_VALID); + rslt = 0; + } + else if (pPkt->setParas.exLen == sizeof(u32)) + { + SetAMcPara(pPkt->setParas.paraId, *((u32*)(pPkt->setParas.exData))); + SaveMcPara(); + RefreshParas(PARA_MC_VALID); + SetNewParasFlag(PARA_MC_VALID); + } + else + { + rslt = -2; + } + } + else if (pPkt->setParas.paraType == SEW_MCPARA_WORK) + { + if (pPkt->setParas.exLen == sizeof(g_wkPara)) + { + memcpy((u8*)(&g_wkPara), pPkt->setParas.exData, sizeof(g_wkPara)); + CheckWkParaRange(); + SaveWkPara(); + RefreshParas(PARA_WK_VALID); + SetNewParasFlag(PARA_WK_VALID); + rslt = 0; + } + else if (pPkt->setParas.exLen == sizeof(u32)) + { + SetAWkPara(pPkt->setParas.paraId, *((u32*)(pPkt->setParas.exData))); + SaveWkPara(); + RefreshParas(PARA_WK_VALID); + SetNewParasFlag(PARA_WK_VALID); + } + else + { + rslt = -2; + } + } + else if (pPkt->setParas.paraType == EMB_MVSTANG_PARA) // ʼǶ + { + if (pPkt->setParas.exLen == sizeof(g_angPara)) + { + memcpy((u8*)(&g_angPara), pPkt->setParas.exData, sizeof(g_angPara)); + SaveAngPara(); + rslt = 0; + printf("receive angle para\r\n"); + } + else if (pPkt->setParas.exLen == sizeof(u16)) + { + SetAAnglePara(pPkt->setParas.paraId, *((u16*)pPkt->setParas.exData)); + SaveAngPara(); + } + else + { + rslt = -2; + } + } + else if (pPkt->setParas.paraType == EMB_PATCH_DATA_IDX) // ,(廨) + { + if (pPkt->setParas.exLen == 1024) + { + memcpy((u8*)(&g_patchData), pPkt->setParas.exData, sizeof(g_patchData)); + printf("receive patch data (idx) para\r\n"); + rslt = 0; + } + else + { + rslt = -2; + } + } + else + { + printf("other para\r\n"); + } + + return rslt; +} + +int CreateMcParas(OperPacket * pPkt, int type, int id) +{ + int rslt; + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + + pPkt->sendMcParas.cmdCode = DCMD_SEND_MC_PARAS; + pPkt->sendMcParas.paraType = type; + pPkt->sendMcParas.paraId = id; + if (id == 0) + { + if (type == SEW_MCPARA_MACH) + { + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&g_mcPara), sizeof(g_mcPara)); + } + else if (type == SEW_MCPARA_WORK) + { + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&g_wkPara), sizeof(g_wkPara)); + } + else if (type == EMB_MVSTANG_PARA) // ʼǶȲ + { + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&g_angPara), sizeof(g_angPara)); + } + else + { + rslt = -2; + } + } + else + { + if (type == SEW_MCPARA_MACH) + { + u32 val = GetAMcPara(id); + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&val), sizeof(u32)); + } + else if (type == SEW_MCPARA_WORK) + { + u32 val = GetAWkPara(id); + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&val), sizeof(u32)); + } + } + + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcParas\r\n"); + } + + return rslt; + +} + +#else + + +__WEAK int CreateMemDatList(OperPacket * pPkt, u32 begAddr, u16 rdSize){return 0;}; +__WEAK int SetMemDats(u32 setAddr, u8 * buff, u16 len){return 0;}; + +int CreateMcInfoWhenBoot(OperPacket * pPkt, int toggle) +{ + int rslt; + MCInfo info; + CpuId id; + u32 cpuid; + + if (pPkt == NULL) + { + return -1; + } + + memset(pPkt, 0, LEN_NORMAL_PACKET); + memset(&info, 0, sizeof(MCInfo)); + + pPkt->sendMcInfo.cmdCode = DCMD_SEND_MC_INFO; + pPkt->sendMcInfo.toggle = (u16)toggle; + + GetVersionStr(info.softwareVerStr); // 汾Ϣ + + GetBuildStr(info.buildInfoStr); // ʱϢ + + // 忨IDϢ + cpuid = 0; + GetCpuID(&id); + cpuid += id.dword.dword1; + cpuid += id.dword.dword2; + cpuid += id.dword.dword3; + cpuid += id.dword.dword4; + sprintf(info.boardId, "CPUID: %u", cpuid); + + printf("create system info as follow:\r\n"); + + printf("%s\r\n", info.softwareVerStr); // 汾 + printf("%s\r\n", info.buildInfoStr); // Ϣ + printf("%s\r\n", info.boardId); // 忨ID + + rslt = PacketAVLDP(&(pPkt->packet), (u8*)(&(info)), sizeof(MCInfo)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in CreateMcInfoWhenBoot\r\n"); + } + + return rslt; +} + +void OperatorTaskWhenBoot(void) +{ + int rslt; + + OperPacket operpkt; + DataPacket* pDatpkt = (DataPacket*)(&operpkt); + + // ȡ + rslt = GetANormalPacket(&g_operDataExFuns, pDatpkt); + + // ݰִ + if (rslt > 0) // յݰ + { + switch(operpkt.packet.fldp.cmd) // Ȱ̶Ƚ + { + case UCMD_GET_MC_INFO: // ȡϢ + { + printf("get mc info cmd, toggle=%d\r\n", operpkt.getMcInfo.toggle); + rslt = CreateMcInfoWhenBoot(&operpkt, operpkt.getMcInfo.toggle); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTaskWhenBoot UCMD_GET_MC_INFO \r\n"); + } + } + else + { + printf("error at call CreateMcInfo in OperatorTaskWhenBoot UCMD_GET_MC_INFO \r\n"); + } + break; + } + case UCMD_GET_MEM_DATA: // ȡڴ + { + rslt = CreateMemDatList(&operpkt, operpkt.getMemData.begAddr, operpkt.getMemData.rdSize); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call OperatorTaskWhenBoot in OperatorTask UCMD_GET_MEM_DATA \r\n"); + } + } + else + { + printf("error at call OperatorTaskWhenBoot in OperatorTask UCMD_GET_MEM_DATA \r\n"); + } + break; + } + + case UCMD_SET_MEM_DATA: // ڴ + { + SetMemDats(operpkt.setMemData.begAddr, operpkt.setMemData.exData, operpkt.setMemData.exLen); + break; + } + + case UCMD_GET_FILE_INFO: // ȡļϢ + { + rslt = CreateFileInfo(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_FILE_INFO \r\n"); + } + } + else + { + printf("error at call CreateFileInfo in OperatorTask UCMD_GET_FILE_INFO \r\n"); + } + break; + } + case UCMD_GET_TRANS_RESULT: // ȡ + { + printf("2. get trans result cmd\r\n"); + rslt = CreateTransResult(&operpkt); + if (rslt == 0) + { + rslt = SendAPacket(&g_operDataExFuns, pDatpkt, 1000); + if (rslt != 0) + { + printf("error at call SendAPacket in OperatorTask UCMD_GET_TRANS_RESULT \r\n"); + } + } + else + { + printf("error at call CreateTransResult in OperatorTask UCMD_GET_TRANS_RESULT \r\n"); + } + break; + } + case UCMD_START_TRANS: // ļ + StartReceiveFile(&operpkt); + // SaveFileIdxFromDatafile(); + break; + case UCMD_TRANS_FILE_DATA: // ļ + ReceiveFileData(&operpkt); + break; + + case UCMD_MC_UPDATE: // λ + printf("get update cmd\r\n"); + StartAppUpdate(0); // + break; + + default: + break; + } + } +} + +#endif + +//------------------------------------------------------ + +int SendDebugInfo(char * pStr) +{ + int rslt; + + OperPacket pkt; + + memset(&pkt, 0, LEN_NORMAL_PACKET); + + pkt.sendDebugInfo.cmdCode = DCMD_SEND_DEBUG_INFO; + + rslt = PacketAVLDP(&(pkt.packet), (u8*)(pStr), strlen(pStr)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in SendDebugInfo\r\n"); + } + else + { + rslt = SendAPacket(&g_operDataExFuns, (DataPacket *)(&pkt), 0); + } + + return rslt; +} + +int SendFileParas(int beginX, int beginY) +{ + int rslt; + OperPacket pkt; + DataFilePara newPara; + + memset(&pkt, 0, LEN_NORMAL_PACKET); + + newPara.anchorX = beginX; + newPara.anchorY = beginY; + newPara.beginX = beginX; + newPara.beginY = beginY; + + pkt.setFileParas.cmdCode = UCMD_SET_FILE_PARAS; + + rslt = PacketAVLDP(&(pkt.packet), (u8*)(&newPara), sizeof(DataFilePara)); + if (rslt != 0) + { + printf("error at call PacketAVLDP in SendFileParas\r\n"); + } + else + { + rslt = SendAPacket(&g_operDataExFuns, (DataPacket *)(&pkt), 0); + } + + return rslt; +} + + + diff --git a/EMBOS/Users/EmbFunc/operator/operator.h b/EMBOS/Users/EmbFunc/operator/operator.h new file mode 100644 index 0000000..cf602c1 --- /dev/null +++ b/EMBOS/Users/EmbFunc/operator/operator.h @@ -0,0 +1,1551 @@ + +#ifndef __OPERATOR_H__ +#define __OPERATOR_H__ + +#include "config.h" +#include "comm.h" + +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ + +/* +ͨѶһ + + 1. λ + + ظ ˵ + ȡϢ UCMD_GET_MC_INFO 0x0001 FLDP Ϣ࣬ãϵͳ汾Ϣ + ȡ״̬ UCMD_GET_MC_STATUS 0x0002 FLDP ȡ״̬״̬״̬λãȣļϢȡ + ȡ UCMD_GET_MC_PARAS 0x0003 FLDP ȡڴлб + ȡڴ UCMD_GET_MEM_DATA 0x0004 FLDP ȡ洢ݣƬSRAMƬSRAMNAND FLASHȵ + ȡź UCMD_GET_SENSORS 0x0005 FLDP ȡIOź״̬λãλõϢ + ȡļϢ UCMD_GET_FILE_INFO 0x0006 FLDP ȡļϢ + ȡ UCMD_GET_TRANS_RESULT 0x0007 FLDP ȡļĽλͼļļ + + û UCMD_SET_MC_CONFIG 0x0101 VLDP ûãźʹõĶ˿ڵϢ + û״̬ UCMD_SET_MC_STATUS 0x0102 FLDP ûĹ״̬Ƿȡ + û UCMD_SET_MC_PARAS 0x0103 VLDP бλ + ڴ UCMD_SET_MEM_DATA 0x0104 FLDP ıijڴ浥Ԫ== + + ֶ UCMD_ACT_BYHAND 0x0201 FLDP ֶƵתOUTPUTźſصȶ + UCMD_MC_WORK 0x0202 FLDP ƻĹֹͣ˶ijλõ + ƶXY UCMD_MOVE_TO 0x0203 FLDP ƶXY + + ļ UCMD_START_TRANS 0x0301 VLDP ļ + ļ UCMD_TRANS_FILE_DATA 0x0302 VLDP ļݰ + + λ UCMD_MC_UPDATE 0x0401 VLDP + + UCMD_TRA_BOARD 0x0501 FLDP ijЭ͵Ľڵ + + 2. λ + + ظ ˵ + ͻϢ DCMD_SEND_MC_INFO 0x8001 VLDP ͻϢ࣬ãϵͳ汾Ϣ + ͻ״̬ DCMD_SEND_MC_STATUS 0x8002 VLDP ȡ״̬״̬״̬λãȣļϢȡ + ͻ DCMD_SEND_MC_PARAS 0x8003 VLDP ڴлб + ڴ DCMD_SEND_MEM_DATA 0x8004 VLDP ͻ洢ݣƬSRAMƬSRAMNAND FLASHȵ + ʹź DCMD_SEND_SENSORS 0x8005 VLDP IOź״̬λãλõϢ + ļϢ DCMD_SEND_FILE_INFO 0x8006 VLDP ļϢ + ʹ DCMD_SEND_TRANS_RESULT 0x8007 VLDP ļĽλͼ + + + +*/ + +// λ +#define UCMD_GET_MC_INFO 0x0001 // ȡϢ +#define UCMD_GET_MC_STATUS 0x0002 // ȡ״̬ +#define UCMD_GET_MC_PARAS 0x0003 // ȡ +#define UCMD_GET_MEM_DATA 0x0004 // ȡڴ +#define UCMD_GET_SENSORS 0x0005 // ȡź +#define UCMD_GET_FILE_INFO 0x0006 // ȡļϢ +#define UCMD_GET_TRANS_RESULT 0x0007 // ȡ +#define UCMD_GET_SENSORS_BMP 0x0008 // ȡЧλͼ + +#define UCMD_GET_BOARD_VER 0x000A // ȡΧ汾 +#define UCMD_GET_HEAD_PARA 0x000B // ȡͷ +#define UCMD_GET_COLOR_PARA 0x000C // ȡɫư +#define UCMD_GET_HEAD_NVPARAS 0x000D // ѡԶȡͷ + +#define UCMD_SET_MC_CONFIG 0x0101 // û +#define UCMD_SET_MC_STATUS 0x0102 // û״̬ +#define UCMD_SET_MC_PARAS 0x0103 // û +#define UCMD_SET_MEM_DATA 0x0104 // ڴ +#define UCMD_SET_FILE_PARAS 0x0105 // ļ +#define UCMD_SET_EXEC_PROGRESS 0x0106 // ִн +#define UCMD_SET_INSTALLMENT 0x0107 // ÷ +#define UCMD_SET_ELAPSED_TIME 0x0108 // þʱ +#define UCMD_SET_DEF_PARA 0x0109 // Ĭϲ + +#define UCMD_SET_HEADDEF_PARA 0x010A // ûͷĬϲ +#define UCMD_SET_HEAD_PARA 0x010B // ûͷ +#define UCMD_SET_COLOR_PARA 0x010C // ûɫư +#define UCMD_SET_MVANGDEF_PARA 0x010D // öǶĬϲ +#define UCMD_SET_COLORDEF_PARA 0x010E // ûɫĬϲ +#define UCMD_SET_FILE_EXDATA 0x010F // ļչ +#define UCMD_SET_HEAD_NVPARA 0x0110 // ѡûͷ + +#define UCMD_ACT_BYHAND 0x0201 // ֶ +#define UCMD_MC_WORK 0x0202 // +#define UCMD_MOVE_TO 0x0203 // ƶXY +#define UCMD_MOVE_OFST 0x0205 // XYƶƫ + +#define UCMD_START_TRANS 0x0301 // ļ +#define UCMD_TRANS_FILE_DATA 0x0302 // ļ +#define UCMD_INVALID_FILE 0x0303 // ļʧЧ +#define UCMD_SET_FILE_LIST 0x0304 // ļб +#define UCMD_GET_FILE_LIST 0x0305 // ȡλļб + + +#define UCMD_MC_UPDATE 0x0401 // λ +#define UCMD_BOARD_UPDATE 0x0402 // Χ + +#define UCMD_TRA_BOARD 0x0501 // + +// λ +#define DCMD_REQUEST_DAT 0x8000 // ļ +#define DCMD_SEND_MC_INFO 0x8001 // ͻϢ +#define DCMD_SEND_MC_STATUS 0x8002 // ͻ״̬ +#define DCMD_SEND_MC_PARAS 0x8003 // ͻ +#define DCMD_SEND_MEM_DATA 0x8004 // ڴ +#define DCMD_SEND_SENSORS 0x8005 // ʹź +#define DCMD_SEND_FILE_INFO 0x8006 // ļϢ +#define DCMD_SEND_TRANS_RESULT 0x8007 // ʹ +#define DCMD_SEND_SENSORS_BMP 0x8008 // Чλͼ + +#define DCMD_SEND_BOARDVER 0x800A // Χ汾 +#define DCMD_SEND_HEADPARA 0x800B // ͻͷ +#define DCMD_SEND_COLORPARA 0x800C // ͻɫư + +#define DCMD_SEND_HEAD_NVPARAS 0x800E // ѡԷͻͷ + +#define DCMD_SEND_DEBUG_INFO 0x8010 // Ϣ + +#define DCMD_SEND_FILE_LIST 0x8011 // λļб + + +//------------------------------------------------------------------------ + +// + +//------------------------------------------------------------------------ + +// ȡϢ +#ifdef UCMD_GET_MC_INFO + +// Ϣṹ + + + +#endif + +//------------------------------------------------------------------------ + +// ȡ״̬ +#ifdef UCMD_GET_MC_STATUS + +/* + |-------------------------------------------------------------------| + |-------------------------------------------------------------------| + | B10 B11 | B12 B13 | | + |-------------------------------------------------------------------| + | л־ | | | + |-------------------------------------------------------------------| + | | | | | + | | | | | + |-------------------------------------------------------------------| + |-------------------------------------------------------------------| + +*/ + +// ݽṹ + + +// Ϣṹ +typedef struct +{ +// 0 + char fpgaHardVerStr[16]; // FPGAӲ汾 + char fpgaSoftVerStr[16]; // FPGA汾 + char softwareVerStr[48]; // 汾 + char buildInfoStr[32]; // Ϣ + char boardId[32]; // 忨ID + char installment[32]; // һεķַ +// 176 + char rev1[512-176]; + +// 512 + u32 localIP; // 忨IPַ + u32 submask; // + u32 gateIP; // IP + +// 524 + u8 rev2[1024-524]; + +} __attribute__ ((packed)) MCInfo; + +//------------------------------------------------------------------------------- + +#endif + +//------------------------------------------------------------------------ + +// ȡ +#ifdef UCMD_GET_MC_PARAS + + + + + +#endif + +//------------------------------------------------------------------------ + + + +//------------------------------------------------------------------------ + +// ȡź +#ifdef UCMD_GET_SENSORS + + + + +#endif + +//------------------------------------------------------------------------ + +// ȡļϢ +#ifdef UCMD_GET_FILE_INFO + + + +#endif + +//------------------------------------------------------------------------ + +// ȡ +#ifdef UCMD_GET_TRANS_RESULT + + + +#endif + +//------------------------------------------------------------------------ + +// û +#ifdef UCMD_SET_MC_CONFIG + +#endif + +//------------------------------------------------------------------------ + +// û״̬ +#ifdef UCMD_SET_MC_STATUS + +#define MC_STA_CLENA_ERR 0x0000 // +#define MC_STA_EN_WORK 0x0001 // (״̬) +#define MC_STA_DIS_WORK 0x0002 // ֹ(״̬) +#define MC_STA_EN_TIME 0x0003 // (ʱ) +#define MC_STA_DIS_TIME 0x0004 // ֹ(ʱ) +#define MC_CLEAN_COUNT 0x0005 // +#define MC_STA_MANUAL 0x0006 // ֶ״̬ +#define MC_STA_AUTO 0x0007 // Զ״̬ +#define MC_FILE_SWITCH 0x0008 // ļл +#define MC_INVALID_FILE 0x0009 // ļʧЧ +#define MC_CLEAN_PARA_REF 0x000A // ˢ²־ +#define MC_SET_TO_NORMAL 0x000B // Ϊ״̬ +#define MC_SET_TO_SIMULATE 0x000C // Ϊģ⹤״̬ + +#define MC_SET_ERR_STA 0x000D // Ϊ״̬ +#define MC_SEL_WORK_HEADS 0x000E // ùͷ +#define MC_CLEAN_FIDX 0x000F // λ + +#define MC_CLEAN_BOBBIN 0x0010 // ߼λ + +#define MC_SET_ENTER_SCAN_SENSOR 0x0011 // Ϊ ɨ贫״̬ +#define MC_SET_EXIT_SCAN_SENSOR 0x0012 // Ϊ ˳ ɨ贫״̬ + +#define MC_SET_ENTER_TEST_OUTPUT 0x0013 // Ϊ ״̬ +#define MC_SET_EXIT_TEST_OUTPUT 0x0014 // Ϊ ˳ ״̬ + + +#define MC_CHANGE_HOOK_START 0x0020 // 뻻״̬ +#define MC_CHANGE_HOOK_END 0x0021 // ˳״̬ + +#define MC_STA_EXIT_TRA 0x0023 // ˳״̬ +#define MC_STA_EXIT_THREADBK 0x0024 // ˳߲ + +#define MC_INVALID_FILEBLOCK 0x0026 // ļݿʧЧ + +#endif + +//------------------------------------------------------------------------ + +// û +#ifdef UCMD_SET_MC_PARAS + +#define SEW_MCPARA_MACH 0x00 // ò +#define SEW_MCPARA_WORK 0x01 // + +#define EMB_MVSTANG_PARA 0x06 // ʼǶ + +#define EMB_PATCH_DATA_IDX 0x09 // , + +#endif + +//------------------------------------------------------------------------ + +// ȡڴ +// ڴ +#ifdef UCMD_GET_MEM_DATA +#ifdef UCMD_SET_MEM_DATA + +// (Ϊַֽ) +#define MEM_INSRAM 0x01 // Ƭڴ洢ֻ + #define INSRAM_ADDR_MIN 0 + #define INSRAM_ADDR_MAX (0xFFFF) + +#define MEM_EXSRAM 0x02 // Ƭ洢д + #define EXSRAM_ADDR_MIN 0 + #define EXSRAM_ADDR_MAX ((512*1024+512*1024)-1) + +#define MEM_NORFLASH 0x03 // Ƭ norflash д + #define NORFLASH_ADDR_MIN 0 + #define NORFLASH_ADDR_MAX ((512*1024+512*1024)-1) + +#define MEM_FRAM 0x04 // FRAM 洢 + #define FRAM_ADDR_MIN 0 + #define FRAM_ADDR_MAX ((8*1024)-1) + +#define MEM_GPIO 0x05 // IO ˿ + #define GPIO_ADDR_MIN 0 + #define GPIO_ADDR_MAX ((1*1024)-1) + + +#define MEM_MOTOS 0x06 // + #define MOTOS_ADDR_MIN 0 + #define MOTOS_ADDR_MAX (0x5F) + // 0x00--0x03 1λ + // 0x10--0x13 2λ + // 0x20--0x23 3λ + // 0x30--0x33 4λ + // 0x40--0x43 5λ + // 0x50--0x53 6λ + + // õijλãתλãȡλõ趨λã˶ + +#define MEM_ECDS 0x07 // ֻ + #define ECDS_ADDR_MIN 0 + #define ECDS_ADDR_MAX (0x2F) + // 0x00--0x03 1 + // 0x10--0x13 2 + // 0x20--0x23 MP + +#define MEM_ADC 0x08 // ADֵֻ + #define ADC_ADDR_MIN 0 + #define ADC_ADDR_MAX (0x1F) + // 0x00--0x01 ADC1ֵ + // 0x10--0x11 ADC2ֵ + +#define MEM_COMM 0x09 // ͨѶ˿ + + #define COMM_ADDR_MIN 0 + #define COMM_ADDR_MAX (0x1F) + // 0x00 -- 0x0F 232 1BUF + // 0x10 -- 0x1F 232 2BUF + // 0x20 -- 0x2F 485 3BUF + + // 0x70 -- 0x7F CANBUF + + // 0x100 -- 0x10F 232 1BUF + // 0x110 -- 0x11F 232 2BUF + // 0x120 -- 0x12F 485 3BUF + + // 0x170 -- 0x17F CANBUF + +#endif +#endif + +//------------------------------------------------------------------------ +// ļ +#ifdef UCMD_SET_FILE_PARAS + +#endif + +//------------------------------------------------------------------------ +// ִн +#ifdef UCMD_SET_EXEC_PROGRESS + +#endif + + +//------------------------------------------------------------------------ +// ÷ +#ifdef UCMD_SET_INSTALLMENT + +#endif + +//------------------------------------------------------------------------ +// þʱ +#ifdef UCMD_SET_ELAPSED_TIME + +#endif + +//------------------------------------------------------------------------ + +// ֶ +#ifdef UCMD_ACT_BYHAND + +/* + |-------------------------------------------------------------------| + |-------------------------------------------------------------------| + | B6 B7 | B8 B9 | B10 B11 | B12 B13 | + |-------------------------------------------------------------------| + | ƶ | Ʋ1 | Ʋ2 | Ʋ3 | + |-------------------------------------------------------------------| + | | | | | + | | | | | + | | | | | + |-------------------------------------------------------------------| + |-------------------------------------------------------------------| + +*/ + +//-------------------------------------------------- +// ƶ + +#define MOTO_TO_ZERO 0x0001 // +#define MOVE_BY_HAND 0x0002 // ֶƶ +#define OUTPUT_CTRL 0x0003 // +#define MOTO_EN_CTRL 0x0004 // ʹܿ +#define MANUAL_ACTION 0x0005 // ֶƹ +#define TEST_THREADBK 0x0007 // Զ߼ +#define SHAKE_FRAME_TEST 0x0008 // + +// 1ҪӦ + +// ֶƶ Ʋ2 +#define MT_MOVE_DIR_STOP 0x0000 // ֹͣת +#define MT_MOVE_DIR_POSI 0x0001 // ƶxңyϣϣ +#define MT_MOVE_DIR_NEGA 0x0002 // ƶxy££ + + +// ֶƶ Ʋ3 +// ٶֵrpm mmps + + +// ʹܵ Ʋ2 +#define MT_SERVO_ON 0x0001 // ʹܿ +#define MT_SERVO_OFF 0x0002 // ʹܹ + + +// ֶƹܵľҪӦ + + + + + +#endif + + +//------------------------------------------------------------------------ + +// +#ifdef UCMD_MC_WORK + +/* + |-------------------------------------------------------| + |-------------------------------------------------------| + | B6 B7 | B8 B9 B10 B11 | B12 B13 | + |-------------------------------------------------------| + | ƹ | Ʋ1 | Ʋ2 | + |-------------------------------------------------------| + | | | | + | | | | + | | | | + |-------------------------------------------------------| + |-------------------------------------------------------| + +*/ + +// ƹ + +#define WORK_START 0x0001 // +#define WORK_PAUSE 0x0002 // ͣ +#define WORK_FINISH 0x0003 // ̸λ +#define WORK_FIND_ZERO 0x0004 // Զ + +#define WORK_GOTO_START 0x0005 // +#define WORK_GOTO_ANCHOR 0x0006 // ضλ +#define WORK_GOTO_OFFSET 0x0007 // ƫƵ +#define WORK_CHECK_FRAME 0x0008 // ߿ +#define WORK_CUT_FRAME 0x0009 // ߿и +#define WORK_CUT_XLINE 0x000A // ֶϲ + +#define WORK_FAST_JUMP 0x000B // ٽ +#define WORK_GOTO_WKPOS 0x000C // ع + +#define WORK_GOTO_FEEDT 0x000D // شߵ +#define WORK_GOTO_CHGBO 0x000E // ػλ + +#define WORK_FEED_MOVE 0x000F // + +#define WORK_DRAW_LATTICE 0x0010 // ͼ + +#define WORK_GOTO_FINISH 0x0011 // ؽ +#define WORK_GOTO_ZERO 0x0012 // 㣨ԭ㣩 + + +#define WORK_RPM_CHG 0x0020 // ٶȸı +#define WORK_FILE_IDX_CHG 0x0021 // ļŸı + + +#define WORK_SIMULATION_FRAME 0x0026 // ߱߿ +#define WORK_GOTO_FEED 0x0027 // ϵ +#define WORK_SET_OFFSET 0x0028 // ƫƵ +#define WORK_SET_FEED 0x0029 // ϵ + +#define WORK_ACT_OIL 0x0050 // м + +// +#define WKMD_ONCE 0 +#define WKMD_NORMAL 1 // +#define WKMD_SIMULATION 2 // ģ⣨ߣ +#define WKMD_BACKWORD 3 // + + +#endif + + +#ifdef UCMD_MOVE_TO + +/* + |-------------------------------------------------------| + |-------------------------------------------------------| + | B6 B7 B8 B9 | B10 B11 B12 B13 | + |-------------------------------------------------------| + | x | Y | + |-------------------------------------------------------| + | | | + | | | + | | | + |-------------------------------------------------------| + |-------------------------------------------------------| + +*/ + + +#endif + +//------------------------------------------------------------------------ + +// ļ +#ifdef UCMD_START_TRANS + + +#endif + +//------------------------------------------------------------------------ + +// ļ +#ifdef UCMD_TRANS_FILE_DATA + + +#endif + + +//------------------------------------------------------------------------ +#ifdef UCMD_INVALID_FILE // ļʧЧ + + +#endif + + +//------------------------------------------------------------------------ + +#ifdef UCMD_SET_FILE_LIST // ļб + + +#endif + + +//------------------------------------------------------------------------ +#ifdef UCMD_TRA_BOARD + + +#endif +//------------------------------------------------------------------------ + + +// λ +#ifdef UCMD_MC_UPDATE + + +#endif + +//------------------------------------------------------------------------ + +// ʹź +// u8 sendSensors.exData[MAX_EXDP_LEN] + + +#ifdef DCMD_SEND_SENSORS + + #define DSS_DEF_IDX 0x03FE // δʹýӿڶַ + #define DSS_DEF_BIT 0x01 // δʹýӿڶλ + +//---------------------------------------------------------------- +// λ: + #define DSS_BIT1 0x01 // idx1 + #define DSS_BIT2 0x02 // idx2 + #define DSS_BIT3 0x04 // idx3 + #define DSS_BIT4 0x08 // idx4 + #define DSS_BIT5 0x10 // idx5 + #define DSS_BIT6 0x20 // idx6 + #define DSS_BIT7 0x40 // idx7 + #define DSS_BIT8 0x80 // idx8 + +// ͷ1~16λ: + #define DSS_HEAD_01 DSS_BIT1 // idx1 + #define DSS_HEAD_02 DSS_BIT2 // idx2 + #define DSS_HEAD_03 DSS_BIT3 // idx3 + #define DSS_HEAD_04 DSS_BIT4 // idx4 + #define DSS_HEAD_05 DSS_BIT5 // idx5 + #define DSS_HEAD_06 DSS_BIT6 // idx6 + #define DSS_HEAD_07 DSS_BIT7 // idx7 + #define DSS_HEAD_08 DSS_BIT8 // idx8 + #define DSS_HEAD_09 DSS_BIT1 // idx1 + #define DSS_HEAD_10 DSS_BIT2 // idx2 + #define DSS_HEAD_11 DSS_BIT3 // idx3 + #define DSS_HEAD_12 DSS_BIT4 // idx4 + #define DSS_HEAD_13 DSS_BIT5 // idx5 + #define DSS_HEAD_14 DSS_BIT6 // idx6 + #define DSS_HEAD_15 DSS_BIT7 // idx7 + #define DSS_HEAD_16 DSS_BIT8 // idx8 + +//---------------------------------------------------------------- +// 1.ź 0x0000~0x001F +#if (1) + //-------------------------------- + #define DSS1_B_START_BT 0x0000 // ť(1~8) + #define DSS1_B_PAUSE_BT 0x0001 // ͣť(1~8) + #define DSS1_B_JOG_BT 0x0002 // 㶯ť(1~8) + #define DSS1_B_FRMOP_BT 0x0003 // ť(1~8) + #define DSS1_B_AUTO_BT 0x0004 // ֶť(1~8) + #define DSS1_B_READY_BT 0x0005 // ť(1~8) + #define DSS1_B_KEY_BT 0x0006 // Կװť(1~8) + #define DSS1_B_AIR_TEST 0x0007 // ѹ(1~8) + #define DSS1_B_SAFE_TEST 0x0008 // ȫ(1~8) + #define DSS1_B_TPLPOS 0x0009 // ģ嵽λ(1~8) + #define DSS1_B_MOTO_ALM1 0x000A // (1~8) + #define DSS1_B_MOTO_ALM2 0x000B // (9~16) + #define DSS1_B_MOTO_ALM3 0x000C // (17~24) + #define DSS1_B_MOTO_ALM4 0x000D // (25~32) + #define DSS1_B_MOTO_ALM5 0x000E // (33~40) + #define DSS1_B_MOTO_ALM6 0x000F // (41~48) + + #define DSS1_B_BASE_TEST 0x0010 // ȫ(1~8) + #define DSS1_BASE_POW DSS_BIT1 // ӵź + #define DSS1_B_OIL_BT 0x0011 // Ͱť(1~8) +// 0x0011 ~ 0x001F // ź Ԥ +#endif + +//---------------------------------------------------------------- +// 2.λ()ź 0x0020~0x007F +#if (1) + //-------------------------------- + #define DSS2_F1_ZERO_POS 0x0020 // ()1 λ + #define DSS2_F1_SLOW_POS 0x0021 // ()1 + #define DSS2_F1_NLIMT_POS 0x0022 // ()1 λ- + #define DSS2_F1_PLIMT_POS 0x0023 // ()1 λ+ + #define DSS2_F1_X DSS_BIT1 // X (X) + #define DSS2_F1_Y DSS_BIT2 // Y (Y) + #define DSS2_F1_Y2 DSS_BIT3 // Y (Y2) + #define DSS2_F1_X2 DSS_BIT4 // X (X2) + + #define DSS2_F2_ZERO_POS 0x0024 // ()2 λ + #define DSS2_F2_SLOW_POS 0x0025 // ()2 + #define DSS2_F2_NLIMT_POS 0x0026 // ()2 λ- + #define DSS2_F2_PLIMT_POS 0x0027 // ()2 λ+ + #define DSS2_F2_SP0 DSS_BIT1 // 2 + #define DSS2_F2_SP1 DSS_BIT2 // 2 + #define DSS2_F2_SP2 DSS_BIT3 // 2 + #define DSS2_F2_SP3 DSS_BIT4 // 2 + #define DSS2_F2_SP4 DSS_BIT5 // 2 + #define DSS2_F2_SP5 DSS_BIT6 // 2 + #define DSS2_F2_SP6 DSS_BIT7 // 2 + #define DSS2_F2_SP7 DSS_BIT8 // 2 + + #define DSS2_F3_ZERO_POS 0x0028 // ()3 λ + #define DSS2_F3_SLOW_POS 0x0029 // ()3 + #define DSS2_F3_NLIMT_POS 0x002A // ()3 λ- + #define DSS2_F3_PLIMT_POS 0x002B // ()3 λ+ + #define DSS2_F3_SP0 DSS_BIT1 // 3 + #define DSS2_F3_SP1 DSS_BIT2 // 3 + #define DSS2_F3_SP2 DSS_BIT3 // 3 + #define DSS2_F3_SP3 DSS_BIT4 // 3 + #define DSS2_F3_SP4 DSS_BIT5 // 3 + #define DSS2_F3_SP5 DSS_BIT6 // 3 + #define DSS2_F3_SP6 DSS_BIT7 // 3 + #define DSS2_F3_SP7 DSS_BIT8 // 3 + + #define DSS2_F4_ZERO_POS 0x002C // ()4 λ + #define DSS2_F4_SLOW_POS 0x002D // ()4 + #define DSS2_F4_NLIMT_POS 0x002E // ()4 λ- + #define DSS2_F4_PLIMT_POS 0x002F // ()4 λ+ + #define DSS2_F4_SP0 DSS_BIT1 // 4 + #define DSS2_F4_SP1 DSS_BIT2 // 4 + #define DSS2_F4_SP2 DSS_BIT3 // 4 + #define DSS2_F4_SP3 DSS_BIT4 // 4 + #define DSS2_F4_SP4 DSS_BIT5 // 4 + #define DSS2_F4_SP5 DSS_BIT6 // 4 + #define DSS2_F4_SP6 DSS_BIT7 // 4 + #define DSS2_F4_SP7 DSS_BIT8 // 4 + + //-------------------------------- + #define DSS2_RU_ZERO1_POS 0x0030 // תλ(1~8) + #define DSS2_RU_ZERO2_POS 0x0031 // תλ(9~16) + #define DSS2_RU_NLIMT1_POS 0x0032 // תλ-(1~8) + #define DSS2_RU_NLIMT2_POS 0x0033 // תλ-(9~16) + #define DSS2_RU_PLIMT1_POS 0x0034 // תλ+(1~8) + #define DSS2_RU_PLIMT2_POS 0x0035 // תλ+(9~16) + #define DSS2_RD_ZERO1_POS 0x0036 // תλ(1~8) + #define DSS2_RD_ZERO2_POS 0x0037 // תλ(9~16) + #define DSS2_RD_NLIMT1_POS 0x0038 // תλ-(1~8) + #define DSS2_RD_NLIMT2_POS 0x0039 // תλ-(9~16) + #define DSS2_RD_PLIMT1_POS 0x003A // תλ+(1~8) + #define DSS2_RD_PLIMT2_POS 0x003B // תλ+(9~16) + #define DSS2_CT_ZERO1_POS 0x003C // õתλ(1~8) + #define DSS2_CT_ZERO2_POS 0x003D // õתλ(9~16) + #define DSS2_PU_SP1_POS 0x003E // תλ(1~8) + #define DSS2_PU_SP2_POS 0x003F // תλ(9~16) + + //-------------------------------- + #define DSS2_UD_SU1_POS 0x0040 // һͷ λ(1~8) + #define DSS2_UD_SU2_POS 0x0041 // һͷ λ(9~16) + #define DSS2_UD_SD1_POS 0x0042 // һͷ λ(1~8) + #define DSS2_UD_SD2_POS 0x0043 // һͷ λ(9~16) + #define DSS2_UD_PU1_POS 0x0044 // ׻ͷ λ(1~8) + #define DSS2_UD_PU2_POS 0x0045 // ׻ͷ λ(9~16) + #define DSS2_UD_PD1_POS 0x0046 // ׻ͷ λ(1~8) + #define DSS2_UD_PD2_POS 0x0047 // ׻ͷ λ(9~16) + #define DSS2_UD_CU1_POS 0x0048 // лͷ λ(1~8) + #define DSS2_UD_CU2_POS 0x0049 // лͷ λ(9~16) + #define DSS2_UD_CD1_POS 0x004A // лͷ λ(1~8) + #define DSS2_UD_CD2_POS 0x004B // лͷ λ(9~16) + #define DSS2_UD_IU1_POS 0x004C // ʻͷ λ(1~8) + #define DSS2_UD_IU2_POS 0x004D // ʻͷ λ(9~16) + #define DSS2_UD_ID1_POS 0x004E // ʻͷ λ(1~8) + #define DSS2_UD_ID2_POS 0x004F // ʻͷ λ(9~16) + + //-------------------------------- + #define DSS2_UD_ZU1_POS 0x0050 // ѹѹͷ λ(1~8) + #define DSS2_UD_ZU2_POS 0x0051 // ѹѹͷ λ(9~16) + #define DSS2_UD_ZD1_POS 0x0052 // ѹѹͷ λ(1~8) + #define DSS2_UD_ZD2_POS 0x0053 // ѹѹͷ λ(9~16) + #define DSS2_UD_SP1U1_POS 0x0054 // ̨ λ(1~8) + #define DSS2_UD_SP1U2_POS 0x0055 // ̨ λ(9~16) + #define DSS2_UD_SP2D1_POS 0x0056 // ̨ λ(1~8) + #define DSS2_UD_SP2D2_POS 0x0057 // ̨ λ(9~16) + #define DSS2_UD_SP3U1_POS 0x0058 // ̨ λ(1~8) + #define DSS2_UD_SP3U2_POS 0x0059 // ̨ λ(9~16) + #define DSS2_UD_SP4D1_POS 0x005A // ̨ λ(1~8) + #define DSS2_UD_SP4D2_POS 0x005B // ̨ λ(9~16) + #define DSS2_UD_SP5U1_POS 0x005C // ̨ λ(1~8) + #define DSS2_UD_SP5U2_POS 0x005D // ̨ λ(9~16) + #define DSS2_UD_SP6D1_POS 0x005E // ̨ λ(1~8) + #define DSS2_UD_SP6D2_POS 0x005F // ̨ λ(9~16) + + // 0x0060 ~ 0x007F // λź Ԥ +#endif +//---------------------------------------------------------------- +// 3.λź 0x080~0x00BF +#if (1) + //-------------------------------- + #define DSS3_HS_UZ1_POS 0x0080 // ͣλ(1~8) + #define DSS3_HS_UZ2_POS 0x0081 // ͣλ(9~16) + #define DSS3_HS_UG1_POS 0x0082 // 빴λ(1~8) + #define DSS3_HS_UG2_POS 0x0083 // 빴λ(9~16) + #define DSS3_HS_UU1_POS 0x0084 // λ(1~8) + #define DSS3_HS_UU2_POS 0x0085 // λ(9~16) + #define DSS3_HS_UL1_POS 0x0086 // ϶λ(1~8) + #define DSS3_HS_UL2_POS 0x0087 // ϶λ(9~16) + #define DSS3_HS_DZ1_POS 0x0088 // ͣλ(1~8) + #define DSS3_HS_DZ2_POS 0x0089 // ͣλ(9~16) + #define DSS3_HS_DG1_POS 0x008A // λ(1~8) + #define DSS3_HS_DG2_POS 0x008B // λ(9~16) + #define DSS3_HS_SP1_POS 0x008C // Ԥ(1~8) + #define DSS3_HS_SP2_POS 0x008D // Ԥ(9~16) + #define DSS3_HS_SP3_POS 0x008E // Ԥ(1~8) + #define DSS3_HS_SP4_POS 0x008F // Ԥ(9~16) + + //-------------------------------- + #define DSS3_HE_PZ1_POS 0x0090 // λ(1~8) + #define DSS3_HE_PZ2_POS 0x0091 // λ(9~16) + #define DSS3_HE_CZ1_POS 0x0092 // õλ(1~8) + #define DSS3_HE_CZ2_POS 0x0093 // õλ(9~16) + #define DSS3_HE_TNZ1_POS 0x0094 // ëλ(1~8) + #define DSS3_HE_TNZ2_POS 0x0095 // ëλ(9~16) + #define DSS3_HE_TSZ1_POS 0x0096 // ëλ(1~8) + #define DSS3_HE_TSZ2_POS 0x0097 // ëλ(9~16) + #define DSS3_HE_EZ1_POS 0x0098 // 廨λ(1~8) + #define DSS3_HE_EZ2_POS 0x0099 // 廨λ(9~16) + #define DSS3_HE_SP1_POS 0x009A // ǷԤ(1~8) + #define DSS3_HE_SP2_POS 0x009B // ǷԤ(9~16) + #define DSS3_HE_EH1_POS 0x009C // 廨λ(1~8) + #define DSS3_HE_EH2_POS 0x009D // 廨λ(9~16) + #define DSS3_HE_SP5_POS 0x009E // ǷԤ(1~8) + #define DSS3_HE_SP6_POS 0x009F // ǷԤ(9~16) + #define DSS3_HE_PMP1_POS 0x00A0 // λ(1~8) + #define DSS3_HE_PMP2_POS 0x00A1 // λ(9~16) + // 0x00A0 ~ 0x00BF // λź Ԥ +#endif + +//---------------------------------------------------------------- +// 4.ͷť()ź 0x00C0~0x00FF +#if (1) + //-------------------------------- + #define DSS4_K_SU1_BT 0x00C0 // ť(1~8) + #define DSS4_K_SU2_BT 0x00C1 // ť(9~16) + #define DSS4_K_KU1_BT 0x00C2 // ť(1~8) + #define DSS4_K_KU2_BT 0x00C3 // ť(9~16) + #define DSS4_K_CU1_BT 0x00C4 // õť(1~8) + #define DSS4_K_CU2_BT 0x00C5 // õť(9~16) + #define DSS4_K_PU1_BT 0x00C6 // ť(1~8) + #define DSS4_K_PU2_BT 0x00C7 // ť(9~16) + #define DSS4_K_ZU1_BT 0x00C8 // ѹť(1~8) + #define DSS4_K_ZU2_BT 0x00C9 // ѹť(9~16) + #define DSS4_K_SL1_BT 0x00CA // ͷť(1~8) + #define DSS4_K_SL2_BT 0x00CB // ͷť(9~16) + #define DSS4_K_PL1_BT 0x00CC // ͷť(1~8) + #define DSS4_K_PL2_BT 0x00CD // ͷť(9~16) + #define DSS4_K_SR1_BT 0x00CE // Ҳ찴ť(1~8) + #define DSS4_K_SR2_BT 0x00CF // Ҳ찴ť(9~16) + + #define DSS4_K_BLT_BT 0x00D0 // ʹť + #define DSS4_K_BLT1 DSS_BIT1 // ʹǰť + #define DSS4_K_BLT2 DSS_BIT2 // ʹ˰ť + #define DSS4_K_BLT3 DSS_BIT3 // ϴʹǰť + #define DSS4_K_BLT4 DSS_BIT4 // ϴʹ˰ť + #define DSS4_K_BLT5 DSS_BIT5 // Ҵʹǰť + #define DSS4_K_BLT6 DSS_BIT6 // Ҵʹ˰ť + #define DSS4_K_BLT7 DSS_BIT7 // + #define DSS4_K_BLT8 DSS_BIT8 // + + + + // 0x00D0 ~ 0x00FF // ͷť()ź Ԥ +#endif + +//---------------------------------------------------------------- +// 5.ͷź 0x0100~0x01FF +#if (1) + //-------------------------------- + // 5.1 廨 0x0100~0x016F + #if (1) + // 0x0100 ~ 0x016F // 廨ͷź Ԥ + #define DSS5_ST0_DCZ1 0x0100 // 廨¼߻λ(1~8) + #define DSS5_ST0_DCZ2 0x0101 // 廨¼߻λ(9~16) + #define DSS5_ST0_MAZP 0x0102 // Mλ + #define DSS5_MA_CHENILLE DSS_BIT1 // ëMλ + #define DSS5_MA_RING DSS_BIT2 // ëλ + #define DSS5_MA_COIL DSS_BIT3 // Mλ + #define DSS5_MA_CAP DSS_BIT4 // ñλ + + #define DSS5_ST0_DEVS 0x0103 // װź + #define DSS5_ACS_ALM DSS_BIT1 // Զ󱨾 + #define DSS5_TR_ALM DSS_BIT2 // 屨 + + #define DSS5_ST0_QUI 0x0104 // λ + #define DSS5_SZ_HOOK DSS_BIT1 // λ + #define DSS5_SZ_COLOR DSS_BIT2 // ɫλ + #define DSS5_SZ_CPOS1 DSS_BIT3 // ɫλ1 + #define DSS5_SZ_CPOS2 DSS_BIT4 // ɫλ2 + #define DSS5_SZ_CPOS3 DSS_BIT5 // ɫλ3 + #define DSS5_SZ_CPOS4 DSS_BIT6 // ɫλ4 + #define DSS5_SZ_FOOT DSS_BIT7 // ̤ + + #endif + + //-------------------------------- + // 5.2 һ 0x0170~0x01AF + #if (1) + //-------------------------------- + #define DSS5_ST1_BKU1 0x0170 // ߶߼(1~8) + #define DSS5_ST1_BKU2 0x0171 // ߶߼(9~16) + #define DSS5_ST1_BKD1 0x0172 // ҵ߶߼(1~8) + #define DSS5_ST1_BKD2 0x0173 // ҵ߶߼(9~16) + #define DSS5_ST1_DCZ1 0x0174 // ¼߻λ(1~8) + #define DSS5_ST1_DCZ2 0x0175 // ¼߻λ(9~16) + #define DSS5_ST1_FTZ1 0x0176 // ѹλ(1~8) + #define DSS5_ST1_FTZ2 0x0177 // ѹλ(9~16) + #define DSS5_ST1_JXH1 0x0178 // Ҽ߸λ(1~8) + #define DSS5_ST1_JXH2 0x0179 // Ҽ߸λ(9~16) + #define DSS5_ST1_JXL1 0x017A // Ҽߵλ(1~8) + #define DSS5_ST1_JXL2 0x017B // Ҽߵλ(9~16) + #define DSS5_ST1_JXO1 0x017C // Ҽ߿λ(1~8) + #define DSS5_ST1_JXO2 0x017D // Ҽ߿λ(9~16) + #define DSS5_ST1_JXC1 0x017E // Ҽߺλ(1~8) + #define DSS5_ST1_JXC2 0x017F // Ҽߺλ(9~16) + + // 0x0180 ~ 0x01AF // һͷź Ԥ + #define DSS5_ST1_DCO1 0x0180 // ¼߿λ(1~8) + #define DSS5_ST1_DCO2 0x0181 // ¼߿λ(9~16) + + #define DSS5_ST1_NLC1 0x0182 // Ǽ(1~8) + #define DSS5_ST1_NLC2 0x0183 // Ǽ(9~16) + + #define DSS5_ST1_SNZ1 0x0184 // λ(1~8) + #define DSS5_ST1_SNZ2 0x0185 // λ(9~16) + #endif + +// 0x0180 ~ 0x01AF // һͷź Ԥ + + //-------------------------------- + // 5.3 /ô/ϳ 0x01B0~0x01FF + #if (1) + //-------------------------------- + // 0x01B0 ~ 0x01FF // Ƿͷź Ԥ + #endif + +#endif + +//---------------------------------------------------------------- +// 6.ͨüź(ͻ) 0x0200~0x02FF +#if (1) +//-------------------------------- + +// 6.4 0x02B0~0x02FF + #if (1) + //-------------------------------- + // 0x02B0 ~ 0x02FF // ͼź Ԥ + #define DSS6_ADDR_02B0 0x02B0 // Զź + // BIT1 : λ + // BIT2 : λ + // BIT3 : תλ + // BIT4 : תջλ + // BIT5 : ƶλ + // BIT6 : ƶջλ + // BIT7 : ڶλ + // BIT8 : ڶջλ + #define DSS6_ADDR_02B1 0x02B1 // ԶԱź + // BIT1 : Ա1λ + // BIT2 : Ա1λ + // BIT3 : Ա1λ + // BIT4 : Ա1λ + // BIT5 : Ա2λ + // BIT6 : Ա2λ + // BIT7 : Ա2λ + // BIT8 : Ա2λ + #define DSS6_ADDR_02B2 0x02B2 // Զϼź + // BIT1 : ϼ1ȱ + // BIT2 : ϼ1 + // BIT3 : ϼ1 + // BIT4 : Ԥ4 + // BIT5 : ϼ2ȱ + // BIT6 : ϼ2 + // BIT7 : ϼ2 + // BIT8 : Ԥ8 + #define DSS6_ADDR_02B3 0x02B3 // ź + // BIT1 : 1 + // BIT2 : 1ֹͣ + // BIT3 : 2 + // BIT4 : 2ֹͣ + // BIT5 : 3 + // BIT6 : 3ֹͣ + // BIT7 : 4 + // BIT8 : 4ֹͣ + + #define DSS6_ADDR_02B8 0x02B8 // ȹ߻ź + // BIT1 : ϻͷλ + // BIT2 : »ͷλ + // BIT3 : ϻͷ߼ + // BIT4 : »ͷ߼ + // BIT5 : ưť + // BIT6 : ȱϼ + // BIT7 : + // BIT8 : + + #define DSS6_ADDR_02B9 0x02B9 // ȹ߻ź + // BIT1 : ϶Աλ + // BIT2 : ϶Աλ + // BIT3 : ϶Ա + // BIT4 : ϶ԱҼ + // BIT5 : ϻͷԱλ + // BIT6 : ϻͷԱλ + // BIT7 : ϻͷԱ + // BIT8 : ϻͷԱҼ + #endif + +#endif + + +//---------------------------------------------------------------- +// 7.ź(ڻ) 0x0300~0x03FF +#if (1) + //-------------------------------- + // 0x0300 ~ 0x030F + + //-------------------------------- + // 0x03D0 ~ 0x03DF + #if (1) + #endif + + //-------------------------------- + // 0x03E0 ~ 0x03EF + #if (1) + #endif + + //-------------------------------- + // 0x03F0 ~ 0x03FE + #if (1) + #endif + + +#endif + +#endif //#ifdef DCMD_SEND_SENSORS // ʹź +//------------------------------------------------------------------------ + +// ṹ + +typedef union +{ + DataPacket packet; + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 toggle; + u8 rev[6]; + u16 crc; + } __attribute__ ((packed)) getMcInfo; // ȡϢ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 toggle; + u8 rev[6]; + u16 crc; + } __attribute__ ((packed)) getMcStatus; // ȡ״̬ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 paraType; + u16 paraId; // 0, в; 1--256, ӦIJ + u8 rev[4]; + u16 crc; + } __attribute__ ((packed)) getMcParas; // ȡ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u32 begAddr; + u16 rdSize; + u8 rev[2]; + + u16 crc; + } __attribute__ ((packed)) getMemData; // ȡڴ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 backType; + u8 rev[6]; + u16 crc; + } __attribute__ ((packed)) getSensors; // ȡź + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 fileType; + u8 fileIdx; + u8 rev[6]; + u16 crc; + } __attribute__ ((packed)) getFileInfo; // ȡļϢ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 fileId; + u8 rev[6]; + u16 crc; + } __attribute__ ((packed)) getTransResult; // ȡ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 cfgItem; + u8 rev[2]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) setMcConfig; // û + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 staCode; + u16 para; + u8 rev[4]; + u16 crc; + } __attribute__ ((packed)) setMcStatus; // û״̬ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 paraType; + u16 paraId; // 0, в; 1--256, ӦIJ + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) setParas; // λ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u32 begAddr; + + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) setMemData; // ڴ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 rev[4]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) setFileParas; // ļ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 exDataType; // չ + u8 exDataIdx; + u8 rev[2]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) setFileExData; // ļչ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 id; + u8 nodetype; + + u8 rev[6]; + + u16 crc; + } __attribute__ ((packed)) setDefParas; // Ĭϲ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 fileType; + u8 fileIdx; + u16 fileId; + + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + + } __attribute__ ((packed)) setExecProgress; // ý + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 rev[4]; + + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + + } __attribute__ ((packed)) setInstallment; // ÷ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 type; + u32 time; // λ + + u8 rev[3]; + + u16 crc; + + } __attribute__ ((packed)) setElapsedTime; // UCMD_SET_ELAPSED_TIME þʱ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 actCode; + u16 para1; + u16 para2; + u16 para3; + u16 crc; + } __attribute__ ((packed)) actByhand; // ֶ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 workCode; + u32 para1; + u16 para2; + u16 crc; + } __attribute__ ((packed)) mcWork; // + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + s32 posx; + s32 posy; + u16 crc; + } __attribute__ ((packed)) moveFrameTo; // ƶܵλ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 fileType; + u8 fileIdx; + u16 fileId; + + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) startTrans; // ļ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 pktIdx; + u16 fileId; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) transFileData; // ļݴ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + u32 fileIdxMap; + u16 crc; + + } __attribute__ ((packed)) setFilesList; // ļб + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + u16 upObj; + u16 upFileID; + u8 rev[4]; + u16 crc; + } __attribute__ ((packed)) mcUpdate; // ϵͳ + + + //---------------------------------- + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 fileType; + u8 fileIdx; + u16 fileId; + u32 datBlockIdx; // ݰÿ1024ֽ) + + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) requestDatBlock; // ļ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 toggle; + u8 rev[2]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendMcInfo; // ͻϢ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 toggle; + u8 rev[2]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendMcStatus; // ͻ״̬ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 paraType; + u16 paraId; // 0, в; 1--256, ӦIJ + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendMcParas; // ͻ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u32 begAddr; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendMemData; // ڴ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 rev[4]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendSensors; // ʹź + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 fileType; + u8 fileIdx; + u8 rev[2]; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendFileInfo; // ļϢ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u16 fileId; + u8 active; + u8 result; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendTransResult; // ʹ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + u16 exLen; + u16 exCrc; + u8 rev[4]; + u16 crc; + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) sendDebugInfo; // ͵Ϣ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 protocolType; // Э + u8 nodeType; // ڵ + u8 traNum; // + u8 nodeId; // ʼڵID + u8 rev[4]; + u16 crc; + } __attribute__ ((packed)) traverse; // + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 rev[8]; + u16 crc; + } __attribute__ ((packed)) rdBoardVer; // ȡΧ汾 + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u8 protocolType; // Э + u8 nodeId; // ڵID + u8 nodetype; // ڵ + u8 rev[5]; + u16 crc; + } __attribute__ ((packed)) updateBoard; // Χ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 protocolType; // Э + u8 nodeId; // ڵID + u8 nodeType; // ڵ + u8 rev; + u16 crc; + + u32 ver[8]; + u8 exData[MAX_EXDP_LEN-32]; + } __attribute__ ((packed)) sendBoardVer; // Χ汾 + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmdCode; + + u16 exLen; + u16 exCrc; + + u8 nodeId; + u8 nodeType; + u8 paraid; + u8 rev; + u16 crc; + + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) boardPara; // ΧʧԲ + +}OperPacket; + +//------------------------------------------------------------------------ + +void InitOperator(void); +void OperatorTask(void); +void OperatorTaskWhenRun(int revfile); +void OperatorTaskWhenBoot(void); + +//------------------------------------------------------------------------ + +int IsNewOperCmd(void); + +void SendMcStatus(int force); + +void RequestFileData(u8 fileType, u8 fileIdx, u16 fileId, int datblockIdx); +int SendDebugInfo(char * pStr); +int SendFileParas(int beginX, int beginY); + +//------------------------------------------------------------------------ + +#endif diff --git a/EMBOS/Users/EmbFunc/security/installment.c b/EMBOS/Users/EmbFunc/security/installment.c new file mode 100644 index 0000000..ec40716 --- /dev/null +++ b/EMBOS/Users/EmbFunc/security/installment.c @@ -0,0 +1,605 @@ + +#include "installment.h" +#include "password.h" +#include "fram.h" +#include "paras.h" +#include "cpuid.h" +#include "shell.h" +#include "trigger.h" + +/* + + + +*/ +//------------------------------------------------------------------------------- + +u32 GetRTCSecond(void) +{ +// RTC_GetCounter +// LL_RTC_TIME_GetSecond + return 0; +} + +//------------------------------------------------------------------------------- +#define INS_SIZE 64 + +typedef struct +{ + // 0 + u8 curmc; // ǰ,CUR_MACHINE + u16 mctype; // ,MC_TYPE + + u8 clientId; // ͻ + u32 cpuId; + + // 8 + u8 lastpswd[24]; // + + // 32 + s32 workableTimer; // ɹʱʣʱΪλ + u32 rtcSecondTimer; // ʵʱʱӼ + // 40 + u8 rev[INS_SIZE - 4 - 40]; + u32 encount; // дЧ +} __attribute__ ((packed)) Installment; + + +#define UNLOCK_COUNTER_MIN (S32_MAX - S16_MAX - U16_MAX) // ȫڴΪȫ⣩ +#define UNLOCK_COUNTER_MAX (S32_MAX) + +#define UNLOCK_COUNTER (UNLOCK_COUNTER_MIN+S16_MAX + (S16_MAX)/2) // Ĭȫ + + +//------------------------------------------------------------------------------- +Installment g_installment; +int g_instsel = -1; + + +//------------------------------------------------------------------------------- + +void TestInstall(char * para1, char * para2); + +void ResetInstall(void); + + +//------------------------------------------------------------------------------- + +// ʼ +int InitInstallment(void) +{ + int rslt; + u32 cpuid; + Installment tmpinstall1, tmpinstall2; + rslt = 0; + + if (g_instsel >= 0) + { + return 0; + } + + cpuid = 0; + { + CpuId id; + GetCpuID(&id); + cpuid += id.dword.dword1; + cpuid += id.dword.dword2; + cpuid += id.dword.dword3; + cpuid += id.dword.dword4; + } + + memset(&g_installment, 0, sizeof(Installment)); + + // ȷĸЧ + ReadFramData(ENC_ADDR, (u8*)&tmpinstall1, sizeof(Installment)); + ReadFramData(ENC_ADDR+INS_SIZE, (u8*)&tmpinstall2, sizeof(Installment)); + + if (1 && + tmpinstall1.curmc == CUR_MACHINE && + tmpinstall1.mctype == MC_TYPE && + tmpinstall1.clientId == CUR_CLINET && + tmpinstall1.cpuId == cpuid && + 1 ) + { + if (1 && + tmpinstall2.curmc == CUR_MACHINE && + tmpinstall2.mctype == MC_TYPE && + tmpinstall2.clientId == CUR_CLINET && + tmpinstall2.cpuId == cpuid && + 1 ) + { + if (tmpinstall2.encount > tmpinstall1.encount) + { + g_instsel = 1; + } + else + { + g_instsel = 0; + } + } + else + { + g_instsel = 0; + // ЧдЧĻ + WriteFramData(ENC_ADDR+INS_SIZE, (u8*)&tmpinstall1, sizeof(Installment)); + } + } + else + { + if (1 && + tmpinstall2.curmc == CUR_MACHINE && + tmpinstall2.mctype == MC_TYPE && + tmpinstall2.clientId == CUR_CLINET && + tmpinstall2.cpuId == cpuid && + 1 ) + { + g_instsel = 1; + + // ЧдЧĻ + WriteFramData(ENC_ADDR, (u8*)&tmpinstall2, sizeof(Installment)); + } + else + { + // Ч + } + } + + if (g_instsel < 0) + { + ResetInstall(); + } + + // ¶ + if (g_instsel == 0) + { + printf("load enc 0\r\n"); + ReadFramData(ENC_ADDR, (u8*)&g_installment, sizeof(Installment)); + } + else if (g_instsel == 1) + { + printf("load enc 1\r\n"); + ReadFramData(ENC_ADDR+INS_SIZE, (u8*)&g_installment, sizeof(Installment)); + } + else + { + printf("load enc error\r\n"); + } + + if (0 || + g_installment.curmc != CUR_MACHINE || + g_installment.mctype != MC_TYPE || + g_installment.clientId != CUR_CLINET || + g_installment.cpuId != cpuid || + 0 ) + { + printf("reload enc error\r\n"); + ResetInstall(); + } + else + { + // ֤ + int rslt = -1; + PswdCtrl pswdctrl; + rslt = DecodePswdString(&pswdctrl, (char*)(g_installment.lastpswd), g_installment.clientId); // + if (rslt < 0) + { + printf("DecodePswdString error, reset ResetInstall\r\n"); + // 벻ȷ, ûù + ResetInstall(); + } + else + { + if (pswdctrl.clientId == g_installment.clientId && + pswdctrl.cpuId == g_installment.cpuId && + 1 ) + { + s32 thishours = pswdctrl.thishours; + + if (thishours >= UNLOCK_MIN && thishours <= UNLOCK_MAX) + { + // ȫ + g_installment.workableTimer = UNLOCK_COUNTER; // Ϊ + } + else if (thishours < 0) + { + thishours *= -1; + if (thishours >= LOCK_MIN && thishours <= LOCK_MAX) + { + g_installment.workableTimer = 0; // ȫ + } + } + } + else + { + printf("clientId or cpuId not equ, reset ResetInstall\r\n"); + ResetInstall(); + } + } + } + + // ıصеʱ + if (g_installment.workableTimer < UNLOCK_COUNTER_MIN) // ʹ + { + u32 temp; + temp = GetRTCSecond(); // ȡRTCֵ + if (temp >= g_installment.rtcSecondTimer) + { + temp -= g_installment.rtcSecondTimer; + + printf("rtc record, close time=%u sec\r\n", temp); + + temp /= 60; // ػ + temp++; // ټȥ1 + + g_installment.workableTimer -= temp; + + if (g_installment.workableTimer < 0) + { + g_installment.workableTimer = 0; + } + + if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) + { + g_installment.workableTimer = UNLOCK_COUNTER_MIN-1; + } + + rslt = temp - 1; + } + else + { + printf("rtc reset\r\n"); + // ǵص, rtc λ + } + } + + g_installment.rtcSecondTimer = GetRTCSecond(); // ȡRTCֵ¼¼ + + AddShellCmd("INS", "Install function", TestInstall); + return rslt; +} + + +void ResetInstall() +{ + Installment tmpinstall; + + u32 cpuid; + cpuid = 0; + { + CpuId id; + GetCpuID(&id); + cpuid += id.dword.dword1; + cpuid += id.dword.dword2; + cpuid += id.dword.dword3; + cpuid += id.dword.dword4; + } + + // ʼ + memset(&tmpinstall, 0, sizeof(Installment)); + + tmpinstall.curmc = CUR_MACHINE; + tmpinstall.mctype = MC_TYPE; + tmpinstall.clientId = CUR_CLINET; + tmpinstall.cpuId = cpuid; + tmpinstall.encount = 100; + tmpinstall.workableTimer = 0; // ʱΪ0 + tmpinstall.rtcSecondTimer = GetRTCSecond(); // ȡRTCֵ + + WriteFramData(ENC_ADDR, (u8*)&tmpinstall, sizeof(Installment)); + WriteFramData(ENC_ADDR+INS_SIZE, (u8*)&tmpinstall, sizeof(Installment)); + g_instsel = 0; + printf("ResetInstall\r\n"); +} + +int SetInstallMent(char * pPswdStr) +{ + int rslt = -1; + PswdCtrl pswdctrl; + + ChangeToUper(pPswdStr); // תΪд + + do + { + if (g_instsel >= 0) + { + rslt = DecodePswdString(&pswdctrl, pPswdStr, g_installment.clientId); // + if (rslt >= 0) + { + // 6. ֤ͻʶʶǷϵǰ豸 + if (pswdctrl.clientId == g_installment.clientId && + pswdctrl.cpuId == g_installment.cpuId && + 1 ) + { + PswdCtrl oldctrl; + + if (g_installment.lastpswd[0] != 0) // ǵһ + { + rslt = DecodePswdString(&oldctrl, (char*)(g_installment.lastpswd), g_installment.clientId); // ϴ + if (rslt < 0) + { + break; + } + } + else + { + if (pswdctrl.totaltime >= 0 && pswdctrl.totaltime < TIME_MUTI) + { + oldctrl.nexttotaltime = pswdctrl.totaltime; + } + else + { + rslt = -1; // òɹ + break; + } + } + + // 7.֤ϴμۼʱǷͰ忨һ£Сʱ֤ + if (pswdctrl.totaltime == oldctrl.nexttotaltime) + { + // 8.µĸıʱӵǰʱ䣬д + s32 thishours = pswdctrl.thishours; + + if (thishours >= NORMAL_MIN && thishours <= NORMAL_MAX) // ʱü + { + if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN || // ϴȫ + g_installment.workableTimer < 0 ) // ϴ + { + g_installment.workableTimer = thishours*60; // Ϊ״̬ + } + else + { + g_installment.workableTimer += thishours*60; // ʱ + if (g_installment.workableTimer < 0) + { + g_installment.workableTimer = 0; + } + if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) + { + g_installment.workableTimer = UNLOCK_COUNTER_MIN-1; + } + } + } + else if (thishours >= UNLOCK_MIN && thishours <= UNLOCK_MAX) // ȫ + { + // ȫ + g_installment.workableTimer = UNLOCK_COUNTER; // Ϊ + } + else if (thishours < 0) // ʱ + { + thishours *= -1; + if (thishours >= NORMAL_MIN && thishours <= NORMAL_MAX) // ʱ + { + if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) // ϴȫ + { + g_installment.workableTimer = 0; // ȫ + } + else + { + g_installment.workableTimer -= thishours*60; // ʹʱ + if (g_installment.workableTimer < 0) + { + g_installment.workableTimer = 0; + } + if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) + { + g_installment.workableTimer = UNLOCK_COUNTER_MIN-1; + } + } + } + else if (thishours >= LOCK_MIN && thishours <= LOCK_MAX) + { + g_installment.workableTimer = 0; // ȫ + } + else + { + rslt = -1; // òɹ + break; + } + } + else + { + rslt = -1; // òɹ + break; + } + + // 9.봮¼ + memcpy(g_installment.lastpswd, pPswdStr, PSWDSTR_LEN); + g_installment.lastpswd[PSWDSTR_LEN] = 0; + RefWorkableTimer(0); + rslt = 0; + break; + } + else + { + rslt = -1; + break; + } + } + else + { + rslt = -1; + break; + } + } + } + }while(0); + + + return rslt; +} + +// õʣ๤ʱλΪ +int GetWorkableTime(void) +{ + if (g_instsel >= 0) + { + return g_installment.workableTimer; + } + else + { + return 0; + } +} + + +// ¼λΪ +int RefWorkableTimer(s32 val) +{ + if (g_instsel < 0) + { + g_installment.workableTimer = 0; + } + else + { + g_installment.rtcSecondTimer = GetRTCSecond(); // ÿ1ӣ¼rtcļֵ + + /* + * 20221024 ljs++ + * ,͵Ĺػʱ + * UCMD_SET_ELAPSED_TIME + * ,ȫ·͹ػʱ5000Сʱ,ʵʲûйػ,ֻؽ + * ɵʱƱʱ,뵽 + * Ϊ,ifж + * ȫ,¼ + */ + if (g_installment.workableTimer < UNLOCK_COUNTER_MIN) // ȫ + { + g_installment.workableTimer += val; + } + + if (g_installment.workableTimer < 0) + { + g_installment.workableTimer = 0; + } + else if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) + { + g_installment.workableTimer = UNLOCK_COUNTER; + } + + g_installment.encount++; + if (g_instsel == 0) + { + WriteFramData(ENC_ADDR+INS_SIZE, (u8*)&g_installment, sizeof(Installment)); + g_instsel = 1; + } + else + { + WriteFramData(ENC_ADDR, (u8*)&g_installment, sizeof(Installment)); + g_instsel = 0; + } + } + +#if (0) // + { + static u32 timer = 0; + u32 gap = 0; + u32 temp; + temp = GetMsSoftTimer(); + if (timer == 0) + { + gap = 0; + } + else + { + gap = temp - timer; + } + + timer = temp; + + printf("at %d, RefWorkableTimer, gap = %d, ",timer, gap); + + if (g_installment.workableTimer <= 0) + { + g_installment.workableTimer = 0; + printf("limit use\r\n"); + } + else if (g_installment.workableTimer >= UNLOCK_COUNTER_MIN) + { + g_installment.workableTimer = UNLOCK_COUNTER; + printf("no limit\r\n"); + } + else + { + printf("change workabletimer to %d\r\n", g_installment.workableTimer); + } + } +#endif + + return g_installment.workableTimer; +} + +// 忨IDϢ +void GetBoardIdInfo(char * boardId) +{ + sprintf(boardId, "CPUID: %u", g_installment.cpuId); +} + +// ַ +void GetLastInstallment(char * installment) +{ + sprintf(installment, "LPSWD: %s", g_installment.lastpswd); +} + +// ȡǰһ +void GetLastpswd(u8 * lastpswd) +{ + memcpy(lastpswd, g_installment.lastpswd, 24); +} + +void TestInstall(char * para1, char * para2) +{ + int p1, p2; + + p1 = 0; + p2 = 0; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + + if (p1 == p2) + { + } + + //-------------------------------- + { + if (p1 == 0) + { + char buff[32]; + GetBoardIdInfo(buff); // 忨IDϢ + printf("%s\r\n", buff); + GetLastInstallment(buff); // ַ + printf("%s\r\n", buff); + + printf("Workable = %d min\r\n", GetWorkableTime()); + } + else if (p1 == 1) + { + SetInstallMent(para2); + } + else if (p1 == 2) + { + RefWorkableTimer(p2); + } + else if (p1 == 100) + { + ResetInstall(); + } + } +} + + + diff --git a/EMBOS/Users/EmbFunc/security/installment.h b/EMBOS/Users/EmbFunc/security/installment.h new file mode 100644 index 0000000..fa25e79 --- /dev/null +++ b/EMBOS/Users/EmbFunc/security/installment.h @@ -0,0 +1,30 @@ + +#ifndef __INSTALLMENT_H__ +#define __INSTALLMENT_H__ + +#include "config.h" + + +// ʼ +int InitInstallment(void); + +// +int SetInstallMent(char * pPswdStr); + +// õʣ๤ʱλΪ +int GetWorkableTime(void); + + +// ¼λΪ +int RefWorkableTimer(s32 val); + +// 忨IDϢ +void GetBoardIdInfo(char * boardId); + +// ַ +void GetLastInstallment(char * installment); + +// ǰһ +void GetLastpswd(u8 * lastpswd); + +#endif diff --git a/EMBOS/Users/EmbFunc/security/password.c b/EMBOS/Users/EmbFunc/security/password.c new file mode 100644 index 0000000..430360c --- /dev/null +++ b/EMBOS/Users/EmbFunc/security/password.c @@ -0,0 +1,306 @@ + +#include "password.h" +#include "crc8.h" + + +//------------------------------------------------------------------------------- + +// 봮ַ +#define CHAR_TAB_LEN 32 +#define CHAR_BITS 5 + +#define PSWD_BIT_LEN (PSWDSTR_LEN*CHAR_BITS) +#define PSWD_BYTE_LEN ((PSWD_BIT_LEN+CHAR_BITS-1)/8) + +#define CHAR32MASK 0x1F + +#define XOR_VAL 0x59 + + +static const char g_charTable[CHAR_TAB_LEN] = +{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', + 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', +}; + +#define CLINET_NUM 3 // ͻ + + + +// 洢б +static const u8 g_saveSWTab[CLINET_NUM+1][PSWDSTR_LEN] = +{ + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }, // Ĭ + { 4, 9, 17, 5, 10, 14, 16, 6, 18, 3, 20, 11, 1, 13, 19, 15, 2, 7, 12, 8 }, // ӯ + { 13, 7, 12, 4, 6, 19, 3, 10, 17, 20, 11, 18, 15, 5, 14, 2, 8, 1, 9, 16 }, // Ϲ + { 10, 4, 11, 8, 16, 12, 5, 9, 17, 19, 7, 14, 20, 3, 13, 1, 15, 2, 6, 18 }, // ٵ +}; + + +//------------------------------------------------------------------------------- + +typedef union +{ + u8 pswdbin[PSWD_BYTE_LEN]; + struct + { + u8 check; // У + s32 totalTime; // ۼƸıʱ + s16 thisTime; // θıʱ + u32 cpuId; // CPU ID + u8 clientId; // ͻID + u8 moveBit; // λ + } __attribute__ ((packed)) pswdstruct; + + struct + { + u8 check; // У + u8 datbuff[12]; + } __attribute__ ((packed)) pswdckdat; + +} Password; + + +//------------------------------------------------------------------------------- + + +// õijλֵ +int GetBitVal(u8 * buff, int bitidx) +{ + int i; + u8 mod = 0x01; + u8 num = bitidx % 8; + buff += bitidx / 8; + + for (i = 0; i < num; i++) + { + mod *= 2; + } + + if ((*buff & mod) != 0) + { + return 1; + } + else + { + return 0; + } +} + +// ijλֵ +void SetBitVal(u8 * buff, int bitidx, int bitval) +{ + int i; + u8 mod = 0x01; + u8 num = bitidx % 8; + buff += bitidx / 8; + + for (i = 0; i < num; i++) + { + mod *= 2; + } + + if (bitval != 0) + { + *buff |= mod; + } + else + { + *buff &= (~mod); + } +} + + +// ѭλ +// movenum > 0, +// movenum < 0, +void CyclicShift(u8 * buff, int bitlen, int movenum) +{ + int mvdir; + if (buff == 0 || bitlen <= 1 || movenum == 0) + { + return; + } + + if (movenum < 0) // + { + mvdir = -1; + } + else // + { + mvdir = 1; + } + + movenum *= mvdir; + movenum %= bitlen; + + int bitidx = 0; + int nbidx; + int bitval, tmpval; + // ȡ bitidx == 0 λ + bitval = GetBitVal(buff, bitidx); + do + { + // µλ + if (mvdir < 0) // + { + nbidx = bitidx - movenum; + if (nbidx < 0) + { + nbidx += bitlen; + } + } + else // + { + nbidx = bitidx + movenum; + if (nbidx >= bitlen) + { + nbidx -= bitlen; + } + } + + // ȡ nbidx ԭλ + tmpval = GetBitVal(buff, nbidx); + // bitidx λд뵽 nbidx λ + SetBitVal(buff, nbidx, bitval); + bitidx = nbidx; + bitval = tmpval; + }while(bitidx != 0); +} + +//------------------------------------------------------------------------------- + +// +int DecodePswdString(PswdCtrl * pCtrl, char * pswdStr, u8 clientId) +{ + char pslist[PSWDSTR_LEN]; // 32 ݴ + Password pswd; + u8 moveBit; + + if (pCtrl == 0 || pswdStr == 0) + { + return -1; + } + + memset(pCtrl, 0, sizeof(PswdCtrl)); + + if (clientId <= 0 || clientId > CLINET_NUM) + { + return -1; + } + + // 1. õ봮󣬰տͻзõȷе32ݴ + { + int i, idx; + for (i = 0; i < PSWDSTR_LEN; i++) + { + idx = g_saveSWTab[clientId][i] - 1; + pslist[i] = pswdStr[idx]; + } + } + // 2. 32ݴõ100λĶݴ + { + int i, j; + u8 buff32[PSWDSTR_LEN]; // 32ݵĶƱʾ + for (i = 0; i < PSWDSTR_LEN; i++) + { + char ch32 = pslist[i]; + for (j = 0; j < CHAR_TAB_LEN; j++) + { + if (ch32 == g_charTable[j]) + { + break; + } + } + if (j >= CHAR_TAB_LEN) + { + return -1; + } + + buff32[i] = j; + } + memset(&pswd, 0, sizeof(Password)); + for (i = PSWDSTR_LEN-1; i >= 0; i--) + { + u8 bin = buff32[i]; + bin &= CHAR32MASK; + + for (j = PSWD_BYTE_LEN-1; j > 0; j--) // λ 5 λ + { + pswd.pswdbin[j] <<= CHAR_BITS; + pswd.pswdbin[j] |= (pswd.pswdbin[j-1] >> (8-CHAR_BITS)); + } + pswd.pswdbin[0] <<= CHAR_BITS; + pswd.pswdbin[0] |= bin; + } + } +// 3.Զַ + { + int i; + for (i = 0; i < PSWD_BYTE_LEN; i++) + { + pswd.pswdbin[i] ^= XOR_VAL; + } + pswd.pswdbin[PSWD_BYTE_LEN-1] &= 0x0f; + } + + // 4. λ򣬷λϢݶκ󣬵õϢݶΡ + { + int movenum, idx; + pswd.pswdstruct.moveBit &= 0x0f; // λݶ + moveBit = pswd.pswdstruct.moveBit; // λ + movenum = g_saveSWTab[clientId][moveBit]; // λ + idx = 0x10; + + while (idx < PSWDSTR_LEN && (movenum == 5 || movenum == 10 || movenum == 15 || movenum == 20)) + { + movenum = g_saveSWTab[clientId][idx]; + idx++; + } + if (idx == PSWDSTR_LEN || (movenum == 5 || movenum == 10 || movenum == 15 || movenum == 20) || movenum <= 0 || movenum > PSWDSTR_LEN) + { + return -1; + } + + if ((moveBit & 0x01) != 0) // ܣѭƶ + { + // ѭ + } + else + { + // ѭ + movenum *= -1; + } + CyclicShift(pswd.pswdbin, PSWD_BIT_LEN-4, movenum); + } + // 5. У㷨Ϣݶεȷԡ + { + u8 crc = CalcCrc8(pswd.pswdckdat.datbuff, sizeof(Password)-1); + if (crc != pswd.pswdstruct.check) + { + return -1; + } + pCtrl->clientId = pswd.pswdstruct.clientId; + pCtrl->cpuId = pswd.pswdstruct.cpuId; + pCtrl->thishours = pswd.pswdstruct.thisTime / TIME_MUTI; + pCtrl->totalhours = pswd.pswdstruct.totalTime / TIME_MUTI; + + pCtrl->nexttotaltime = (pCtrl->thishours+pCtrl->totalhours)*TIME_MUTI + (int)(pswd.pswdstruct.thisTime+pswd.pswdstruct.totalTime)%TIME_MUTI; + pCtrl->totaltime = pswd.pswdstruct.totalTime; + pCtrl->thistime = pswd.pswdstruct.thisTime; + } + +/* +6.֤ͻʶʶǷϵǰ豸 +7.֤ϴμۼʱǷͰ忨һ£Сʱ֤ +8.µĸıʱӵǰʱ䣬д +9.봮¼ +*/ + return 0; +} + + + + diff --git a/EMBOS/Users/EmbFunc/security/password.h b/EMBOS/Users/EmbFunc/security/password.h new file mode 100644 index 0000000..95c676d --- /dev/null +++ b/EMBOS/Users/EmbFunc/security/password.h @@ -0,0 +1,48 @@ + +#ifndef __PASSWORD_H__ +#define __PASSWORD_H__ + + +#include "config.h" + + + +#define PSWDSTR_LEN 20 // 봮 + + +#define NORMAL_MIN 1 +#define NORMAL_MAX 5000 + +#define UNLOCK_MIN 5200 +#define UNLOCK_MAX 5300 + +#define LOCK_MIN 5200 +#define LOCK_MAX 5300 + +#define TIME_MUTI 6 + + +typedef struct +{ + u32 clientId; + u32 cpuId; + int thishours; + int totalhours; + + int nexttotaltime; + int thistime; + int totaltime; + + int rand1; + int rand2; + +}PswdCtrl; + + +int DecodePswdString(PswdCtrl * pCtrl, char * pswdStr, u8 clientId); + + +#endif + + + diff --git a/EMBOS/Users/tasks.c b/EMBOS/Users/tasks.c new file mode 100644 index 0000000..ee8d883 --- /dev/null +++ b/EMBOS/Users/tasks.c @@ -0,0 +1,34 @@ + +#include "tasks.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) +#include "boottasks.h" +#else +#include "apptasks.h" +#endif + +void SetVectorTable(void) +{ +#if (__CORTEX_M == 0) + // ʹSTM32F0XXʱIAPAPPнжSRAMϵͳӳ䵽SRAMʹжϻָ +#else + CLEAR_ALL_INT(); +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + SCB->VTOR = FLASH_BASE | 0; +#else + SCB->VTOR = FLASH_BASE | STM32_BOOT_SIZE; +#endif + SET_ALL_INT(); +#endif +} + +void MainTasks(void) +{ +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + BootMainTask(); // +#else + AppMainTask(); // Ӧô +#endif +} + + diff --git a/EMBOS/Users/tasks.h b/EMBOS/Users/tasks.h new file mode 100644 index 0000000..833ea5c --- /dev/null +++ b/EMBOS/Users/tasks.h @@ -0,0 +1,12 @@ + +#ifndef __TASKS_H__ +#define __TASKS_H__ + +#include "config.h" + +void SetVectorTable(void); +void MainTasks(void); + + +#endif + diff --git a/EMBOS/readme.txt b/EMBOS/readme.txt new file mode 100644 index 0000000..20e19e9 --- /dev/null +++ b/EMBOS/readme.txt @@ -0,0 +1,5 @@ +汾˵: +汾.Ӱ汾.汾 +ʼ汾:10.01.01 + +汾ļ¼: \ No newline at end of file diff --git a/NxBase/afxdef.h b/NxBase/afxdef.h new file mode 100644 index 0000000..e68ce43 --- /dev/null +++ b/NxBase/afxdef.h @@ -0,0 +1,180 @@ + +#ifndef __AFXDEF_H__ +#define __AFXDEF_H__ + +#include +#include +#include +#include + +//--------------------------------------------------------------- + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + + +//--------------------------------------------------------------- + +#define Bit_RESET 0 +#define Bit_SET 1 + +#define SensorSta GPIO_PinState +#define SENSOR_ON Bit_RESET +#define SENSOR_OFF Bit_SET + +#define OUTPUT_ON Bit_RESET +#define OUTPUT_OFF Bit_SET + +#define DATA_VALID 0x55AA + + +#define DAT_ZERO Bit_RESET // 0 +#define DAT_ONE Bit_SET // 1 + +//--------------------------------------------------------------- + +#define BOOL int +#define BYTE uint8_t +#define WORD uint16_t +#define DWORD uint32_t + +#define u8 uint8_t +#define u16 uint16_t +#define u32 uint32_t +#define u64 uint64_t + +#define s8 int8_t +#define s16 int16_t +#define s32 int32_t + +#define vu16 volatile u16 + +//--------------------------------------------------------------- + +#define U8_MAX ((u8)255) +#define S8_MAX ((s8)127) +#define S8_MIN ((s8)(-128)) +#define U16_MAX ((u16)65535u) +#define S16_MAX ((s16)32767) +#define S16_MIN ((s16)(-32768)) +#define U32_MAX ((u32)4294967295uL) +#define S32_MAX ((s32)2147483647) +#define S32_MIN ((s32)(-2147483648)) + +//--------------------------------------------------------------- + +#define CLEAR_INT() __set_PRIMASK(1) +#define SET_INT() __set_PRIMASK(0) + +#ifdef __set_FAULTMASK +#define CLEAR_ALL_INT() __set_FAULTMASK(1) +#define SET_ALL_INT() __set_FAULTMASK(0) +#endif + + +#ifndef CLEAR_ALL_INT +#define CLEAR_ALL_INT CLEAR_INT +#endif + +#ifndef SET_ALL_INT +#define SET_ALL_INT SET_INT +#endif + + +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +//--------------------------------------------------------------- + +#ifndef LOBYTE +#define LOBYTE(w) ((BYTE)(((WORD)(w)) & 0xff)) +#endif + +#ifndef HIBYTE +#define HIBYTE(w) ((BYTE)((((WORD)(w)) >> 8) & 0xff)) +#endif + +#ifndef LOWORD +#define LOWORD(l) ((WORD)(((DWORD)(l)) & 0xffff)) +#endif + +#ifndef HIWORD +#define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xffff)) +#endif + +#define MAKEWORD(a, b) ((WORD)((BYTE)(a)) | (((WORD)((BYTE)(b))) << 8)) +#define MAKEDWORD(a, b) ((DWORD)((WORD)(a)) | (((DWORD)((WORD)(b))) << 16)) +#define MAKEDWORDF(a, b, c, d) ((DWORD)((BYTE)(a)) | (((DWORD)((BYTE)(b))) << 8) | (DWORD)((BYTE)(c)) << 16 | (((DWORD)((BYTE)(d))) << 24)) + +#define LOHFBYTE(b) ((BYTE)((b) & 0x0f)) +#define HIHFBYTE(b) ((BYTE)(((b) >> 4) & 0x0f)) +#define MAKEBYTE(a, b) ((BYTE)((BYTE)((a) & 0x0f)) | ((BYTE)(((BYTE)((b) & 0x0f)) << 4))) + +//--------------------------------------------------------------- + +#define MOD_BIT_0 0x00000001 +#define MOD_BIT_1 0x00000002 +#define MOD_BIT_2 0x00000004 +#define MOD_BIT_3 0x00000008 +#define MOD_BIT_4 0x00000010 +#define MOD_BIT_5 0x00000020 +#define MOD_BIT_6 0x00000040 +#define MOD_BIT_7 0x00000080 +#define MOD_BIT_8 0x00000100 +#define MOD_BIT_9 0x00000200 +#define MOD_BIT_10 0x00000400 +#define MOD_BIT_11 0x00000800 +#define MOD_BIT_12 0x00001000 +#define MOD_BIT_13 0x00002000 +#define MOD_BIT_14 0x00004000 +#define MOD_BIT_15 0x00008000 +#define MOD_BIT_16 0x00010000 +#define MOD_BIT_17 0x00020000 +#define MOD_BIT_18 0x00040000 +#define MOD_BIT_19 0x00080000 +#define MOD_BIT_20 0x00100000 +#define MOD_BIT_21 0x00200000 +#define MOD_BIT_22 0x00400000 +#define MOD_BIT_23 0x00800000 +#define MOD_BIT_24 0x01000000 +#define MOD_BIT_25 0x02000000 +#define MOD_BIT_26 0x04000000 +#define MOD_BIT_27 0x08000000 +#define MOD_BIT_28 0x10000000 +#define MOD_BIT_29 0x20000000 +#define MOD_BIT_30 0x40000000 +#define MOD_BIT_31 0x80000000 + +//--------------------------------------------------------------- + +#define MAKEIP(ip1,ip2,ip3,ip4) ((u32)( (((u32)(ip4&0xff))<<24) + (((u32)(ip3&0xff))<<16) + (((u32)(ip2&0xff))<<8) + (((u32)(ip1&0xff))<<0))) + +#define GETIP1(ip) ((u8)(((u32)(ip)) >> 0) & 0xFF) +#define GETIP2(ip) ((u8)(((u32)(ip)) >> 8) & 0xFF) +#define GETIP3(ip) ((u8)(((u32)(ip)) >> 16) & 0xFF) +#define GETIP4(ip) ((u8)(((u32)(ip)) >> 24) & 0xFF) + +//--------------------------------------------------------------- + +#ifndef PI +#define PI 3.1415926535897932 +#endif + +//--------------------------------------------------------------- + +typedef u8 (*SENSOR_FUN)(void); + +//---------------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------- + +#endif diff --git a/NxBase/buttons.c b/NxBase/buttons.c new file mode 100644 index 0000000..c8b3c28 --- /dev/null +++ b/NxBase/buttons.c @@ -0,0 +1,381 @@ + +#define __IN_BUTTONS_C +#include "buttons.h" +#include "trigger.h" +//---------------------------------------------------------------------------------------------------------------- + +#define KEY_SCAN_NUM 2 // ȥ, Ϊȶƽ(100ms) +#define KEY_LONG_DOWN_NUM 50 // 500msӰ, Ϊdzʱ䰴 +#define KEY_TASK_DISABLE 50 // 500msûӦ, ôΪЧ + +//-------------------------------------------------------- + + +//-------------------------------------------------------- +#ifndef MAX_BUTTONS_NUM +#define MAX_BUTTONS_NUM 10 // ְ֧ť +#endif + +typedef struct +{ + ScanFunc scanfunc; // ⺯ + u8 checkState; // ״̬ + + TaskFunc ldtaskFunc; // + TaskFunc dtaskFunc; // + TaskFunc ctaskFunc; // + TaskFunc dQuktaskFunc; // Ӧ + +}ButtonScan; + + +typedef struct +{ + ButtonScan buttonsList[MAX_BUTTONS_NUM]; + int buttonsNumber; // עİť + int buttonTask; // ťӦ -1:Ӧ 0: 1: 2: 3: + int scanIndex; // ǰɨ/ȴִеİť + + u16 buttonCount; // ťɨ + u16 taskCount; // ťӦ + + u8 shakeSta[KEY_SCAN_NUM]; // ȥĴ + u8 shakeIdx; // ȥĴָ + + DelayRun delay; + + int execing; // ִб־ +}ButtonCtrl; + + +ButtonCtrl g_buttonCtrl; + +//---------------------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------- + +void InitButtonCtrl(void) +{ + int i; + + g_buttonCtrl.buttonsNumber = 0; // עİť + g_buttonCtrl.buttonTask = 0; // ťӦ + g_buttonCtrl.scanIndex = -1; // ûɨİť + + memset(g_buttonCtrl.buttonsList, 0, sizeof(ButtonScan)*MAX_BUTTONS_NUM); + for (i = 0; i < MAX_BUTTONS_NUM; i++) + { + g_buttonCtrl.buttonsList[i].scanfunc = NULL; + } + g_buttonCtrl.delay = NULL; + + AddTriggerToList(10, ScanButtons, NULL); // 10ms +} + +//-------------------------------------------------------- +// Bottonɨб + +int AddButtonToList(ScanFunc fp, u8 sta, TaskFunc ldtsk, TaskFunc ctsk, TaskFunc dtsk, TaskFunc dqtsk) +{ + if ((fp != NULL) && + ((ldtsk != NULL) || (ctsk != NULL) || (dtsk != NULL) || (dqtsk != NULL)) && + (g_buttonCtrl.buttonsNumber < MAX_BUTTONS_NUM) && + 1 ) + { + memset(&(g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber]), 0, sizeof(ButtonScan)); + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].scanfunc = fp; + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].checkState = sta; + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].ldtaskFunc = ldtsk; + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].ctaskFunc = ctsk; + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].dtaskFunc = dtsk; + g_buttonCtrl.buttonsList[g_buttonCtrl.buttonsNumber].dQuktaskFunc = dqtsk; + g_buttonCtrl.buttonsNumber++; + + // printf("add a new button to %d\r\n", g_buttonCtrl.buttonsNumber); + + return g_buttonCtrl.buttonsNumber; + } + else + { + printf("add button more than enable\r\n"); + return -1; + } +} + +//-------------------------------------------------------- +// ÿ10msɨһ + +void ScanButtons(void) +{ + u8 sta,staOk; + int i; + ButtonScan * pScan; + + if (g_buttonCtrl.scanIndex == -1) + {// ûȷĿ갴ť + for (i = 0; i < g_buttonCtrl.buttonsNumber; i++) + { + pScan = (&(g_buttonCtrl.buttonsList[i])); + if (pScan->scanfunc == NULL) + { + continue; + } + + sta = pScan->scanfunc(); + if (sta == pScan->checkState) // аڰ״̬ + { + g_buttonCtrl.scanIndex = i; // ǰɨ/ȴִеİť + g_buttonCtrl.shakeIdx = 0; // ȥĴָ + g_buttonCtrl.taskCount = 0; // ťӦ + g_buttonCtrl.buttonCount = 0; // ťɨ + memset(g_buttonCtrl.shakeSta, (~pScan->checkState), KEY_SCAN_NUM); // ȥĴ + break; + } + } + } + else if (g_buttonCtrl.scanIndex < g_buttonCtrl.buttonsNumber) + {// жϰť״̬ + pScan = (&(g_buttonCtrl.buttonsList[g_buttonCtrl.scanIndex])); + if (pScan->scanfunc != NULL) + { + sta = pScan->scanfunc(); // ֵ + staOk = 1; // ˲ͬʱΪ1,Ϊ0 + + // ȥ + if (KEY_SCAN_NUM > 1) + { + g_buttonCtrl.shakeSta[g_buttonCtrl.shakeIdx++] = sta; + g_buttonCtrl.shakeIdx %= KEY_SCAN_NUM; + + for (i = 0; i < KEY_SCAN_NUM-1; i++) + { + if (g_buttonCtrl.shakeSta[i] != g_buttonCtrl.shakeSta[i+1]) + { + staOk = 0; + break; + } + } + } + + // ťЧж + if (g_buttonCtrl.buttonCount == 0) + {// Ч + if ((sta == pScan->checkState) && (staOk == 1)) + {// Ч + g_buttonCtrl.buttonCount = 1; + if (pScan->dQuktaskFunc != NULL) + {// Ӧ + pScan->dQuktaskFunc(); + } + + if (pScan->dtaskFunc != NULL) + {// + g_buttonCtrl.buttonTask = 1; // ť -1:Ӧ 0: 1: 2: 3: + g_buttonCtrl.taskCount = KEY_TASK_DISABLE; // ťӦ + } + } + } + else if (g_buttonCtrl.buttonTask != 3) + {// ͵¼,¼Ч󲻼 + if (sta == pScan->checkState) + {// ťס + if (g_buttonCtrl.buttonCount < KEY_LONG_DOWN_NUM) + { + g_buttonCtrl.buttonCount++; + } + else if (g_buttonCtrl.buttonCount == KEY_LONG_DOWN_NUM) + {// + if (pScan->ldtaskFunc != NULL) + { + g_buttonCtrl.taskCount = KEY_TASK_DISABLE; // ťӦ + g_buttonCtrl.buttonTask = 2; // ť -1:Ӧ 0: 1: 2: 3: + } + g_buttonCtrl.buttonCount++; + } + } + else + {// ţ̌ + if (staOk == 1) // ţ̌˲ + {// + if (pScan->ctaskFunc != NULL) + { + g_buttonCtrl.taskCount = KEY_TASK_DISABLE; // ťӦ + g_buttonCtrl.buttonTask = 3; // ť -1:Ӧ 0: 1: 2: 3: + } + else + { + if (((pScan->dtaskFunc == NULL) && (pScan->ldtaskFunc == NULL) && (pScan->ctaskFunc == NULL)) || // ֻע˿Ӧ + (g_buttonCtrl.buttonTask == -1) || // »򳤰Ӧ + 0 ) + { + g_buttonCtrl.buttonTask = 0; + g_buttonCtrl.scanIndex = -1; // ްť + return; + } + } + } + } + } + + // ťӦж + if ((g_buttonCtrl.buttonTask > 0) && // Ҫִ + (g_buttonCtrl.taskCount != 0) && // δʱ + 1 ) + { + if (--g_buttonCtrl.taskCount == 0) + { + if (g_buttonCtrl.buttonTask == 3) + { + g_buttonCtrl.scanIndex = -1; // ްť + } + g_buttonCtrl.buttonTask = -1; + } + } + } + } +} + +//-------------------------------------------------------- + +int WaitAllButtonUp(void) +{ + int i, j; + int rslt; + u32 startTime,loopTime; //ʱ λ:s + ButtonScan * pScan; + + rslt = 0; + startTime = GetMsSoftTimer(); + do + { + j = 0; + for (i = 0; i < g_buttonCtrl.buttonsNumber; i++) + { + pScan = (&(g_buttonCtrl.buttonsList[i])); + if (pScan->scanfunc == NULL) + { + continue; + } + if (pScan->scanfunc() != pScan->checkState) + { + j++; + } + } + + if (g_buttonCtrl.buttonsNumber == j) + { + break; + } + + ScanButtons(); // ɨ谴 // аťδ̧,ִаť + + if (g_buttonCtrl.delay != NULL) + { + g_buttonCtrl.delay(1); + } + + loopTime = GetMsSoftTimer(); + if ((loopTime - startTime) > 5000) // ֻȴ5sʱ + { + rslt = -1; + break; + } + }while(1); + + g_buttonCtrl.buttonTask = 0; + g_buttonCtrl.scanIndex = -1; // ǰɨ/ȴִеİť + + return rslt; +} + +void RegDelayFun(DelayRun delay) +{ + g_buttonCtrl.delay = delay; +} + +void CleanButtonTask(void) +{ + g_buttonCtrl.buttonTask = 0; // ťӦ -1:Ӧ 0: 1: 2: 3: + g_buttonCtrl.scanIndex = -1; // ǰɨ/ȴִеİť +} + +void ButtonsTask() +{ + int i, rslt; + u8 sta; + ButtonScan * pScan; + + if (g_buttonCtrl.execing != 0) // ִֻһΰ, Ƕ׵ + { + return; + } + + g_buttonCtrl.execing++; + + if ((g_buttonCtrl.buttonTask > 0) && + (g_buttonCtrl.scanIndex >= 0) && + 1 ) + { + rslt = 0; + for (i = 0; i < g_buttonCtrl.buttonsNumber; i++) + {// ϰťʱ,Ӧǰ + pScan = (&(g_buttonCtrl.buttonsList[i])); + if (pScan->scanfunc == NULL) + { + continue; + } + + sta = pScan->scanfunc(); + if (sta == pScan->checkState) + { + if (i == g_buttonCtrl.scanIndex) + {// ָť + rslt++; + } + else + {// 쳣ť + rslt--; + printf("button%d state error\r\n", g_buttonCtrl.scanIndex); + } + } + } + + if (((g_buttonCtrl.buttonTask != 3) && (rslt == 1)) || + ((g_buttonCtrl.buttonTask == 3) && (rslt == 0)) || + 0 ) + {// ֻһƶťʱ,ִ¼ + pScan = (&(g_buttonCtrl.buttonsList[g_buttonCtrl.scanIndex])); + if (pScan != NULL) + { + + if (g_buttonCtrl.buttonTask == 1) + {// 1: + if (pScan->dtaskFunc != NULL) + { + rslt = pScan->dtaskFunc(); + } + } + else if (g_buttonCtrl.buttonTask == 2) + {// 2: + if (pScan->ldtaskFunc != NULL) + { + rslt = pScan->ldtaskFunc(); + } + } + else if (g_buttonCtrl.buttonTask == 3) + {// 3: + if (pScan->ctaskFunc != NULL) + { + rslt = pScan->ctaskFunc(); + CleanButtonTask(); // ť + } + } + } + } + g_buttonCtrl.buttonTask = -1; // ִ + } + + g_buttonCtrl.execing = 0; +} + + diff --git a/NxBase/buttons.h b/NxBase/buttons.h new file mode 100644 index 0000000..ab18261 --- /dev/null +++ b/NxBase/buttons.h @@ -0,0 +1,37 @@ + +#ifndef __BUTTONS_H__ +#define __BUTTONS_H__ + +#include "config.h" + +//------------------------------------------------------------------- + +typedef u8 (*ScanFunc)(void); +typedef int (*TaskFunc)(void); +typedef void (*DelayRun)(u32); + +//------------------------------------------------------------------- + +#define DIS_DOWN_TASK 0x01 // ΰť¼Ӧ +#define DIS_LDOWN_TASK 0x02 // ΰť¼Ӧ +#define DIS_CLICK_TASK 0x04 // ΰť¼Ӧ + +void InitButtonCtrl(void); + +int AddButtonToList(ScanFunc fp, u8 sta, TaskFunc ldtsk, TaskFunc ctsk, TaskFunc dtsk, TaskFunc dqtsk); + +void ScanButtons(void); + +void ButtonsTask(void); + +void CleanButtonTask(void); + +int WaitAllButtonUp(void); + +void RegDelayFun(DelayRun delay); + +//------------------------------------------------------------------- + + + +#endif diff --git a/NxBase/canctrl.c b/NxBase/canctrl.c new file mode 100644 index 0000000..a4c0415 --- /dev/null +++ b/NxBase/canctrl.c @@ -0,0 +1,370 @@ + +#include "canctrl.h" + +#if (COMM_CAN != 0) + +#include "trigger.h" +#include "cpuid.h" + +//------------------------------------------------------------------------------- + +CanRxCtrl g_canRxCtrl; +CanTxCtrl g_canTxCtrl; + +//------------------------------------------------------------------------ + +void InitCanMsgList(void); +void InitCanFilter(void); + +//------------------------------------------------------------------------ +// ĬϹݰ +void DefaultCanFilter(u8 fifo) +{ + HAL_StatusTypeDef halsta; + + CAN_FilterTypeDef hFilterConfig; + hFilterConfig.FilterBank = 0; // ʼĹΪ0--13 , 14--27 + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // ڱʶλģʽ + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + hFilterConfig.FilterIdHigh = 0x0000; // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterIdLow = 0x0000; // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + hFilterConfig.FilterMaskIdHigh = 0x0000; // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + hFilterConfig.FilterMaskIdLow = 0x0000; // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO + hFilterConfig.SlaveStartFilterBank = 14; // ӽڵCANCAN壩˫CANϵͳ + hFilterConfig.FilterActivation = CAN_FILTER_ENABLE; // ʹܹ + + halsta = HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); + + printf("DefaultCanFilter at fifo%d, halsta=%d\r\n", fifo, halsta); +} + + +void (*SetCanFilter)(u8) = DefaultCanFilter; + +void RegistFilter(void*func) +{ + SetCanFilter = (void (*)(u8))func; +} + +//------------------------------------------------------------------------ + +void InitCanCtrl(void) +{ + HAL_StatusTypeDef halsta; // ״̬ + + InitCanMsgList(); // ݽṹʼ + + if (SetCanFilter != NULL) // ʼ + { + SetCanFilter(CAN_FILTER_FIFO0); + } + + halsta = HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_MSG_PENDING); // CANж + if (halsta != HAL_OK) + { + printf("HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_MSG_PENDING) failed\r\n"); + } + + halsta = HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_FULL); // CANж + if (halsta != HAL_OK) + { + printf("HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_FULL) failed\r\n"); + } + + halsta = HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // رշж + if (halsta != HAL_OK) + { + printf("HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY) failed\r\n"); + } + + halsta = HAL_CAN_Start(&HCAN); // CANģ + if (halsta != HAL_OK) + { + printf("HAL_CAN_Start failed\r\n"); + } +} + +// ʼƽṹ +void InitCanMsgList(void) +{ + memset(&g_canTxCtrl, 0, sizeof(CanTxCtrl)); + memset(&g_canRxCtrl, 0, sizeof(CanRxCtrl)); + + g_canTxCtrl.pktTxListHead = g_canTxCtrl.pktTxList; // ͷָ + g_canTxCtrl.pktTxListTail = g_canTxCtrl.pktTxList; // βָ + g_canTxCtrl.pktTxNumber = 0; // Ч + g_canTxCtrl.sendingFlag = 0; + + g_canRxCtrl.pktRxListHead = g_canRxCtrl.pktRxList; // ͷָ + g_canRxCtrl.pktRxListTail = g_canRxCtrl.pktRxList; // βָ + g_canRxCtrl.pktRxNumber = 0; // Ч +} + +//--------------------------------------------------------- +/* + HAL_OK = 0x00U, + HAL_ERROR = 0x01U, + HAL_BUSY = 0x02U, + HAL_TIMEOUT = 0x03U, + */ +// ݵ +int TransCanDataToBus(void) +{ + HAL_StatusTypeDef halsta; // ״̬ + u32 tsmBox; // + +// printf("TransCanDataToBus\r\n"); + + // Ӷȡһݰ + if (g_canTxCtrl.pktTxNumber <= 0) + { + //printf("pktTxNumber=%d\r\n", g_canTxCtrl.pktTxNumber); + return 1; + } + + halsta = HAL_CAN_AddTxMessage(&HCAN, &(g_canTxCtrl.pktTxListTail->canTxhead) , g_canTxCtrl.pktTxListTail->data, &tsmBox); + //printf("exid=0x%x,tsmBox=%d,halsta=%d\r\n", g_canTxCtrl.pktTxListTail->canTxhead.ExtId, tsmBox,halsta); + if (halsta == HAL_OK) + { + EnterCritical(); + g_canTxCtrl.pktTxNumber--; + g_canTxCtrl.pktTxListTail++; + if (g_canTxCtrl.pktTxListTail > &(g_canTxCtrl.pktTxList[TRANS_PKT_LIST_NUM-1])) + { + g_canTxCtrl.pktTxListTail = &(g_canTxCtrl.pktTxList[0]); + } + ExitCritical(); + +// printf("HAL_OK, g_canTxCtrl.pktTxNumber=%d\r\n", num); + + return 0; + } + else + { + printf("TransCanDataToBus:other sta, halsta=%d\r\n", halsta); + return 2; + } +} + +// Ͻ +int ResvCanDataFromBus(void) +{ + HAL_StatusTypeDef halsta; + CanRxMsg rxMsg; + + halsta = HAL_CAN_GetRxMessage(&HCAN, CAN_RX_FIFO0, &(rxMsg.canRxhead), rxMsg.data); // ȡ + if (halsta == HAL_OK) + { + //printf("get a can packet:\r\n"); + //printf("exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + if (g_canRxCtrl.pktRxNumber < RESV_PKT_LIST_NUM-1) // ӵ + { + // printf("add to rxlist, add=0x%x\r\n", g_canRxCtrl.pktRxListHead); + memcpy(g_canRxCtrl.pktRxListHead, &rxMsg, sizeof(CanRxMsg)); + + g_canRxCtrl.pktRxNumber++; + g_canRxCtrl.pktRxListHead++; + if (g_canRxCtrl.pktRxListHead > &(g_canRxCtrl.pktRxList[RESV_PKT_LIST_NUM-1])) + { + g_canRxCtrl.pktRxListHead = &(g_canRxCtrl.pktRxList[0]); + } + //printf("resv RxNum=%d\r\n", g_canRxCtrl.pktRxNumber); + return 0; + } + else + { + printf("can receive buff is full\r\n"); + } + } + else + { + printf("ResvCanDataFromBus:other sta, halsta=%d\r\n", halsta); + } + return 1; +} + +//--------------------------------------------------------- + +// ӷݵ +int SendACANDataPacket(CanTxMsg * pMsg) +{ + int rslt; + if (pMsg == NULL) + { + printf("SendACANDataPacket:para error\r\n"); + return -1; + } + + if (g_canTxCtrl.pktTxNumber < TRANS_PKT_LIST_NUM) + { + // һݰͶ + memcpy(g_canTxCtrl.pktTxListHead, pMsg, sizeof(CanTxMsg)); // + + EnterCritical(); + g_canTxCtrl.pktTxNumber++; + g_canTxCtrl.pktTxListHead++; + if (g_canTxCtrl.pktTxListHead > &(g_canTxCtrl.pktTxList[TRANS_PKT_LIST_NUM-1])) + { + g_canTxCtrl.pktTxListHead = &(g_canTxCtrl.pktTxList[0]); + } + ExitCritical(); + + if (g_canTxCtrl.sendingFlag == 0) // ûз + { + rslt = TransCanDataToBus(); // Ͷݵ + + if (rslt == 0) // ӵгɹ + { + //printf("send a can packet in app\r\n"); + g_canTxCtrl.sendingFlag = 1; // ñ־ + HAL_CAN_ActivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ж + } + else if (rslt == 1) // ûҪ + { + //printf("send list empty in app\r\n"); + g_canTxCtrl.sendingFlag = 0; + HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ûݷͣرж + } + else // ûкʵ + { + printf("no mail box in app, start later\r\n"); + } + } + else + { + //printf("sendingFlag=1\r\n"); + HAL_CAN_ActivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ж + } + rslt = 0; + } + else + { + printf("can send buff is full\r\n"); + rslt = 1; + } + + return rslt; +} + + +// Ӷжȡ +int GetACanDataPacket(CanRxMsg * pMsg) +{ + int rslt; + if (pMsg == NULL) + { + return -1; + } + + if (g_canRxCtrl.pktRxNumber > 0) + { + memcpy(pMsg, g_canRxCtrl.pktRxListTail, sizeof(CanRxMsg)); + + EnterCritical(); + g_canRxCtrl.pktRxNumber--; + //printf("2.RxNum=%d\r\n", g_canRxCtrl.pktRxNumber); + g_canRxCtrl.pktRxListTail++; + if (g_canRxCtrl.pktRxListTail > &(g_canRxCtrl.pktRxList[RESV_PKT_LIST_NUM-1])) + { + g_canRxCtrl.pktRxListTail = &(g_canRxCtrl.pktRxList[0]); + } + ExitCritical(); + + rslt = 0; + } + else + { + rslt = 1; + } + + return rslt; +} + +//--------------------------------------------------------- + +void CanTransIntProc(void) +{ + int rslt; + + rslt = TransCanDataToBus(); + + if (rslt == 0) // ҷͳɹ + { + //printf("send a can packet in int\r\n"); + } + else if (rslt == 1) // ûҪ + { + // printf("send list empty in int, close int\r\n"); + g_canTxCtrl.sendingFlag = 0; + HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ûݷͣرж + } + else // û + { + printf("no mail box in int\r\n"); + } +} + +void CanResvIntProc(void) +{ + u32 len; + len = HAL_CAN_GetRxFifoFillLevel(&HCAN, CAN_RX_FIFO0); // + while(len != 0) + { + //printf("get a can packet:\r\n"); + ResvCanDataFromBus(); // ȡݣӵ + len--; + } +} + +//--------------------------------------------------------- + +// CAN0жϵĻص +void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *pcan) +{ +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + } +} + +// CAN1жϵĻص +void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *pcan) +{ +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + } +} + +// CAN2жϵĻص +void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *pcan) +{ +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + } +} + +// CAN0жϻص +void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *pcan) +{ +// if (pcan->Instance == CAN1) + { + //printf("rx fifo 0\r\n"); + CanResvIntProc(); + } +} + +void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *pcan) +{ + printf("can rx fifo0 full\r\n"); +} + +void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) +{ + printf("can error\r\n"); +} +//--------------------------------------------------------- +#endif + diff --git a/NxBase/canctrl.h b/NxBase/canctrl.h new file mode 100644 index 0000000..458a180 --- /dev/null +++ b/NxBase/canctrl.h @@ -0,0 +1,87 @@ + +#ifndef __CANCTRL_H__ +#define __CANCTRL_H__ + +#include "config.h" + +#if (COMM_CAN != 0) + +#include "can.h" + + +//--------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------- + +#ifndef HCAN +#define HCAN hcan +#endif + +//------------------------------------------------------------------------------- + +#ifndef CAN_DATA_LEN +#define CAN_DATA_LEN 8 +#endif + +#ifndef RESV_PKT_LIST_NUM +#define RESV_PKT_LIST_NUM 16 +#endif + +#ifndef TRANS_PKT_LIST_NUM +#define TRANS_PKT_LIST_NUM 16 +#endif + +typedef struct +{ + CAN_TxHeaderTypeDef canTxhead; + u8 data[CAN_DATA_LEN]; +}CanTxMsg; + +typedef struct +{ + CAN_RxHeaderTypeDef canRxhead; + u8 data[8]; +}CanRxMsg; + + + +typedef struct +{ + CanRxMsg pktRxList[RESV_PKT_LIST_NUM]; // ջ + + CanRxMsg * pktRxListHead; // ͷָ + CanRxMsg * pktRxListTail; // βָ + int pktRxNumber; // Ч +}CanRxCtrl; + + +typedef struct +{ + CanTxMsg pktTxList[TRANS_PKT_LIST_NUM]; // ͻ + + CanTxMsg * pktTxListHead; // ͷָ + CanTxMsg * pktTxListTail; // βָ + int pktTxNumber; // Ч + int sendingFlag; // ͱ־ + +}CanTxCtrl; + +//--------------------------------------------------------------------------------------------- + +void InitCanCtrl(void); + +void DefaultCanFilter(u8 fifo); + + +void RegistFilter(void*func); + +int SendACANDataPacket(CanTxMsg * pMsg); +int GetACanDataPacket(CanRxMsg * pMsg); + +//--------------------------------------------------------------------------------------------- +#endif + + +#endif + + + diff --git a/NxBase/console.c b/NxBase/console.c new file mode 100644 index 0000000..7099fb5 --- /dev/null +++ b/NxBase/console.c @@ -0,0 +1,915 @@ + +#define _IN_CONSOLE_C +#include "console.h" +#include "serial.h" +#include "trigger.h" +#include "cpuid.h" + +//--------------------------------------------------------------------------------------------- + +int g_useQueue = 1; // = 0, ʹöͬȴڷɡ= 1ʹö + +//--------------------------------------------------------------------------------------------- +void SetConsoleOutType(int type) +{ + if (type != 0) + { + g_useQueue = 1; + } + else + { + g_useQueue = 0; + } +} + +//--------------------------------------------------------------------------------------------- + +int SendData(u8 * pDatBuf, int len) +{ + if (g_useQueue == 1) + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1SendData(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART2) + return Usart2SendData(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART3) + return Usart3SendData(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART4) + return Usart4SendData(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART5) + return Usart5SendData(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART6) + return Usart6SendData(pDatBuf, len); +#else + return 0; +#endif + } + else + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1SendDataSync(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART2) + return Usart2SendDataSync(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART3) + return Usart3SendDataSync(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART4) + return Usart4SendDataSync(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART5) + return Usart5SendDataSync(pDatBuf, len); +#elif (CONSOLE_PORT == COMM_USART6) + return Usart6SendDataSync(pDatBuf, len); +#else + return 0; +#endif + } +} + +int ResvData(u8 * pDat, int expectLen) +{ + if (g_useQueue == 1) + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1GetData(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART2) + return Usart2GetData(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART3) + return Usart3GetData(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART4) + return Usart4GetData(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART5) + return Usart5GetData(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART6) + return Usart6GetData(pDat, expectLen); +#else + return 0; +#endif + } + else + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1GetDataSync(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART2) + return Usart2GetDataSync(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART3) + return Usart3GetDataSync(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART4) + return Usart4GetDataSync(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART5) + return Usart5GetDataSync(pDat, expectLen); +#elif (CONSOLE_PORT == COMM_USART6) + return Usart6GetDataSync(pDat, expectLen); +#else + return 0; +#endif + } +} + +// ѡ +#if (CONSOLE_PORT == COMM_USART1) + +#define INIT_USART InitUsart1 + +#elif (CONSOLE_PORT == COMM_USART2) + +#define INIT_USART InitUsart2 + +#elif (CONSOLE_PORT == COMM_USART3) + +#define INIT_USART InitUsart3 + +#elif (CONSOLE_PORT == COMM_USART4) + +#define INIT_USART InitUsart4 + +#elif (CONSOLE_PORT == COMM_USART5) + +#define INIT_USART InitUsart5 + +#elif (CONSOLE_PORT == COMM_USART6) + +#define INIT_USART InitUsart6 + +#else + +#endif + +//--------------------------------------------------------------------------------------------- + +// ֧ + +#include +#include + +#if defined ( __CC_ARM ) + +#pragma import(__use_no_semihosting_swi) + +//׼Ҫֺ֧ + +struct __FILE +{ + int handle; +}; + +FILE __stdout; +FILE __stdin; + +// ض fputc +int fputc(int ch, FILE *f) +{ + u8 c = (u8)ch; + SendData(&c, 1); + return ch; +} + +// ض fgetc +int fgetc(FILE *f) +{ + int ch; + u8 c; + + ch = ResvData(&c, 1); + if (ch == 1) + { +#if (0) // + SendData(&c, 1); +#endif + return c; + } + + return -1; +} + +int ferror(FILE *f) +{ + // Ӵ + return EOF; +} + + +void _ttywrch(int ch) +{ + u8 c = (u8)ch; + SendData(&c, 1); +} + +void _sys_exit(int return_code) +{ + while (1); +} + +#define GETCHAR getchar +#define PUTCHAR putchar + +#elif defined ( __GNUC__ ) + +int __io_putchar(int ch) +{ + u8 c; + c = ch; + SendData(&c, 1); + return ch; +} + +int __io_getchar(void) +{ + int ch; + u8 c; + + ch = ResvData(&c, 1); + if (ch == 1) + { + ch = (int)c; + return ch; + } + return 0; +} + +int _read(int file, char *ptr, int len) +{ + int rslt; + rslt = ResvData((u8*)ptr, len); + return rslt; +} + +int _write(int file, char *ptr, int len) +{ + SendData((u8*)ptr, len); + return len; +} + +#define PUTCHAR __io_putchar +#define GETCHAR __io_getchar + +#endif + + +int PutChar(int ch) +{ + return PUTCHAR(ch); +} +int GetChar(void) +{ + return GETCHAR(); +} + + +//--------------------------------------------------------------------------------------------- + + +typedef struct +{ + int pause; // ͣ + int newCmd; // ־ + int cmdExec; // ִб־ + int cancel; // ˳ִб־ + char command[MAX_CMD_LINE]; // + + int cmdInCtrl; // ״̬ + int cmdPointer; // ָ + int cmdLen; //  + char cmdBuf[MAX_CMD_LINE]; // л +}CmdLine; + +CmdLine g_cmdLine; + + +//--------------------------------------------------------------------------------------------- +int IsNewCommand(void) +{ + return g_cmdLine.newCmd; +} + +int LockExecAndGetCmdStr(char*pBuf) +{ + int len; + EnterCritical(); + len = g_cmdLine.cmdLen; + g_cmdLine.cmdExec = 1; + g_cmdLine.newCmd = 0; + ExitCritical(); + + memcpy(pBuf, g_cmdLine.command, len); + + return len; +} + +void UnlockExec(void) +{ + g_cmdLine.cmdExec = 0; +} + +void SetPauseStatus(int sta) +{ + if (sta != 0) + { + g_cmdLine.pause = 1; + } + else + { + g_cmdLine.pause = 0; + } +} + +//--------------------------------------------------------------------------------------------- +// ѭбʷ + +#define HISTORY_CMD_NUM 10 // ʷ洢 + +char g_cmdHistory[HISTORY_CMD_NUM][MAX_CMD_LINE]; +int g_cmdHisIdx = 0; // ʷָ +int g_cmdHisNum = 0; // ʷ +int g_cmdHisSer = -1; // ʷ + +int g_cursorNum = 0; // 20220412 + +void InitHistory(void) +{ + g_cmdHisIdx = 0; // ʷָ + g_cmdHisNum = 0; // ʷ + g_cmdHisSer = -1; // ʷ + + g_cursorNum = 0; + + memset(g_cmdHistory, 0, HISTORY_CMD_NUM*MAX_CMD_LINE); +} + +void AddNewCmdToHistory(char * pCmd) +{ + if (pCmd != NULL) + { + // жϵǰǷѾʷ,Ѵ,ȡβ + for (int i = 0; i < g_cmdHisNum; i++) + { + if (strcmp(&(g_cmdHistory[i][0]), pCmd) == 0) // Ѵ + { + int temp1, temp2; + int count; + // ȡβ + if (i >= g_cmdHisIdx) + { + count = g_cmdHisNum - (i - g_cmdHisIdx); + } + else + { + count = g_cmdHisIdx - i; + } + count--; + // ȡ + for (int j = 0; j < count; j++) + { + temp1 = i + j; + temp2 = temp1 + 1; + if (temp1 >= g_cmdHisNum) + { + temp1 -= g_cmdHisNum; + } + if (temp2 >= g_cmdHisNum) + { + temp2 -= g_cmdHisNum; + } + memset(&(g_cmdHistory[temp1][0]), 0, MAX_CMD_LINE); + strcpy(&(g_cmdHistory[temp1][0]), &(g_cmdHistory[temp2][0])); + if (j == (count - 1)) + { + memset(&(g_cmdHistory[temp2][0]), 0, MAX_CMD_LINE); + strcpy(&(g_cmdHistory[temp2][0]), pCmd); + } + } + + return; + } + } + + if (g_cmdHisIdx >= HISTORY_CMD_NUM) + { + g_cmdHisIdx = 0; + } + memset(&(g_cmdHistory[g_cmdHisIdx][0]), 0, MAX_CMD_LINE); + strcpy(&(g_cmdHistory[g_cmdHisIdx][0]), pCmd); + g_cmdHisIdx++; + if (g_cmdHisNum < HISTORY_CMD_NUM) + { + g_cmdHisNum++; + } + } +} + +// Ϲ괦 +void UpCursorProc(void) +{ + if (g_cursorNum > 0) + { + g_cursorNum--; + } + else + { + return; + } + + g_cmdHisSer--; + if (g_cmdHisSer < 0) + { + g_cmdHisSer = g_cmdHisNum - 1; + } + + if (1) + { + // ˸, + while (g_cmdLine.cmdPointer != 0) + { + PUTCHAR(0x08); // ˸ + PUTCHAR(' '); // ո + PUTCHAR(0x08); // ˸ + g_cmdLine.cmdPointer--; + } + + // ʾʷ + if (g_cmdLine.cmdExec == 0 && g_cmdLine.newCmd == 0) + { + char ch; + for (int i = 0; i < MAX_CMD_LINE; i++) + { + ch = g_cmdHistory[g_cmdHisSer][i]; + if (ch > 0x1F && ch < 0x7F) // ַ + { + if (g_cmdLine.cmdPointer < MAX_CMD_LINE-1) + { + PUTCHAR(ch); // ʾ + g_cmdLine.cmdBuf[g_cmdLine.cmdPointer] = ch; + g_cmdLine.cmdPointer++; + } + } + } + } + else + { + g_cmdLine.cmdPointer = 0; + g_cmdLine.cmdBuf[0] = 0; + } + } +} + +// ¹괦 +void DownCursorProc(void) +{ + if (g_cursorNum < g_cmdHisNum) + { + g_cursorNum++; + } + else + { + return; + } + + g_cmdHisSer++; + + if (g_cursorNum == g_cmdHisNum) + { + // ˸, + while (g_cmdLine.cmdPointer != 0) + { + PUTCHAR(0x08); // ˸ + PUTCHAR(' '); // ո + PUTCHAR(0x08); // ˸ + g_cmdLine.cmdPointer--; + } + return; + } + + if (g_cmdHisSer >= g_cmdHisNum) + { + g_cmdHisSer = 0; + } + + if (1) + { + // ˸, + while (g_cmdLine.cmdPointer != 0) + { + PUTCHAR(0x08); // ˸ + PUTCHAR(' '); // ո + PUTCHAR(0x08); // ˸ + g_cmdLine.cmdPointer--; + } + + // ʾʷ + if (g_cmdLine.cmdExec == 0 && g_cmdLine.newCmd == 0) + { + char ch; + for (int i = 0; i < MAX_CMD_LINE; i++) + { + ch = g_cmdHistory[g_cmdHisSer][i]; + if (ch > 0x1F && ch < 0x7F) // ַ + { + if (g_cmdLine.cmdPointer < MAX_CMD_LINE-1) + { + PUTCHAR(ch); // ʾ + g_cmdLine.cmdBuf[g_cmdLine.cmdPointer] = ch; + g_cmdLine.cmdPointer++; + } + } + } + } + else + { + g_cmdLine.cmdPointer = 0; + g_cmdLine.cmdBuf[0] = 0; + } + } +} + +//--------------------------------------------------------------------------------------------- + +void OutNewCmdLine(void) +{ + g_cmdLine.cmdPointer = 0; // ָ + g_cmdLine.cmdLen = 0; //  + + PUTCHAR(0x0D); // س + PUTCHAR(0x0A); // + PUTCHAR('C'); + PUTCHAR('M'); + PUTCHAR('D'); + PUTCHAR(':'); + PUTCHAR('>'); +} + +//--------------------------------------------------------------------------------------------- + +void InitConsole(void) +{ + InitTrigger(); +#if (CONSOLE_PORT != COMM_NONE) + INIT_USART(B115200, '8', 'N', '1'); +#endif + + AddTriggerToList(10, ConsoleCmdScan, NULL); // 10ms Ӧ̨ + + printf("\x0c"); // ն + printf("\033[1;40;32m"); // óն˱ΪɫַΪɫ + printf("\x0c"); // ն + + memset(&g_cmdLine, 0, sizeof(CmdLine)); + + g_useQueue = 1; // = 0, ʹöͬȴڷɡ= 1ʹö + + InitHistory(); +} + +// ʱԺͼ +void ConsoleCmdScan() +{ + int ch; + + if (g_cmdLine.pause != 0) + { + return; + } + + ch = GETCHAR(); + if (ch < 0) + { + g_cmdLine.cmdInCtrl = 0; + return; + } + + //  + switch(ch) + { + case 0x00: // NUL (Null char) + case 0x01: // SOH (Start of Header) ļ + case 0x02: // STX (Start of Text) ıʼ + ch = ch; + break; + case 0x03: // ETX (End of Text) ıβ + if (g_cmdLine.cmdExec == TRUE) // ctrl+C Ϊֹ + { + OutNewCmdLine(); + g_cmdLine.cancel = 1; + } + break; + case 0x04: // EOT (End of Transmission) ͽ + case 0x05: // ENQ (Enquiry) + case 0x06: // ACK (Acknowledgment) ȷ + case 0x07: // BEL (Bell) + ch = ch; + break; + case 0x08: // BS (Backspace) ˸ + if (g_cmdLine.cmdPointer != 0) + { + PUTCHAR(0x08); // ˸ + PUTCHAR(' '); // ո + PUTCHAR(0x08); // ˸ + g_cmdLine.cmdPointer--; + } + break; + case 0x09: // HT (Horizontal Tab) + // Զȫ...... + break; + case 0x0A: // LF (Line Feed) + case 0x0B: // VT (Vertical Tab) + case 0x0C: // FF (Form Feed) ҳ/ + ch = ch; + break; + case 0x0D: // CR (Carriage Return) س + { + if (g_cmdLine.newCmd == 0 && g_cmdLine.cmdExec == 0) + { + PUTCHAR(0x0D); // ӻس + PUTCHAR(0x0A); // ӻ + g_cmdLine.cmdBuf[g_cmdLine.cmdPointer] = 0; // ַβ + g_cmdLine.cmdLen = g_cmdLine.cmdPointer; // + strcpy(g_cmdLine.command, g_cmdLine.cmdBuf); // + if (g_cmdLine.cmdLen != 0) // 20220412 ȲΪ0,Ŵʷ + { + AddNewCmdToHistory(g_cmdLine.cmdBuf); // + } + g_cmdHisSer = g_cmdHisIdx; // 20220412 + g_cursorNum = g_cmdHisNum; + g_cmdLine.newCmd = 1; // + } + break; + } + case 0x0E: // SO (Shift Out)SHIFT ɿ + case 0x0F: // SI (Shift In) + case 0x10: // DLE (Data Link Escape) + case 0x11: // DC1 (XON) (Device Control 1) + case 0x12: // DC2 (Device Control 2) + case 0x13: // DC3 (XOFF)(Device Control 3) + case 0x14: // DC4 (Device Control 4) + case 0x15: // NAK (Negative Acknowledgement) + case 0x16: // SYN (Synchronous Idle) + case 0x17: // ETB (End of Trans. Block) + case 0x18: // CAN (Cancel) + case 0x19: // EM (End of Medium) + case 0x1A: // SUB (Substitute) // pause + ch = ch; + break; + case 0x1B: // ESC (Escape) ˳ + g_cmdLine.cmdInCtrl = 1; + break; + case 0x1C: // FS (File Separator) + case 0x1D: // GS (Group Separator) + case 0x1E: // RS (Request to Send/Record Separator) + case 0x1F: // US (Unit Separator) + ch = ch; + break; + case 0x7F: + if (g_cmdLine.cmdPointer != 0) + { + PUTCHAR(0x08); // ˸ + PUTCHAR(' '); // ո + PUTCHAR(0x08); // ˸ + g_cmdLine.cmdPointer--; + if (g_cmdLine.cmdLen != 0) + { + g_cmdLine.cmdLen--; + } + } + break; + default: + break; + } + + if (ch != 0x1B && g_cmdLine.cmdInCtrl != 0) + { + if (g_cmdLine.cmdInCtrl == 1 && ch == 0x5B) + { + ch = GETCHAR(); + switch(ch) + { + case 0x41: // Ϲ + ch = 'u'; + // Ϸʷ¼ + UpCursorProc(); // 20220412 + break; + case 0x42: // ¹ + ch = 'd'; + DownCursorProc(); // ·ʷ¼ + break; + case 0x43: // ҹ + ch = 'r'; + break; + case 0x44: // + ch = 'l'; + break; + case 0x31: + { + ch = GETCHAR(); + if (ch == 0x7E) // HOME + { + ch = 'h'; + } + else if (ch == 0x31) + { + ch = GETCHAR(); + if (ch == 0x7E) // F1 + { + ch = '1'; + } + } + else if (ch == 0x32) + { + ch = GETCHAR(); + if (ch == 0x7E) // F2 + { + ch = '2'; + } + } + else if (ch == 0x33) + { + ch = GETCHAR(); + if (ch == 0x7E) // F3 + { + ch = '3'; + } + } + else if (ch == 0x34) + { + ch = GETCHAR(); + if (ch == 0x7E) // F4 + { + ch = '4'; + } + } + else if (ch == 0x35) + { + ch = GETCHAR(); + if (ch == 0x7E) // F5 + { + ch = '5'; + } + } + else if (ch == 0x37) + { + ch = GETCHAR(); + if (ch == 0x7E) // F6 + { + ch = '6'; + } + } + else if (ch == 0x38) + { + ch = GETCHAR(); + if (ch == 0x7E) // F7 + { + ch = '7'; + } + } + else if (ch == 0x39) + { + ch = GETCHAR(); + if (ch == 0x7E) // F8 + { + ch = '8'; + } + } + break; + } + case 0x32: + { + ch = GETCHAR(); + if (ch == 0x7E) // INS + { + ch = 'i'; + } + else if (ch == 0x30) + { + ch = GETCHAR(); + if (ch == 0x7E) // F9 + { + ch = '9'; + } + } + else if (ch == 0x31) + { + ch = GETCHAR(); + if (ch == 0x7E) // F10 + { + ch = 'a'; + } + } + else if (ch == 0x33) + { + ch = GETCHAR(); + if (ch == 0x7E) // F11 + { + ch = 'b'; + } + } + else if (ch == 0x34) + { + ch = GETCHAR(); + if (ch == 0x7E) // F12 + { + ch = 'c'; + } + } + break; + } + case 0x33: + ch = GETCHAR(); + if (ch == 0x7E) // DEL + { + ch = 'd'; + } + break; + case 0x34: + ch = GETCHAR(); + if (ch == 0x7E) // END + { + ch = 'e'; + } + break; + case 0x35: + ch = GETCHAR(); + if (ch == 0x7E) // PAGE UP + { + ch = 'u'; + } + break; + case 0x36: + ch = GETCHAR(); + if (ch == 0x7E) // PAGE DOWN + { + ch = 'd'; + } + break; + default: + g_cmdLine.cmdInCtrl = 0; + break; + } + } + else + { + g_cmdLine.cmdInCtrl = 0; + } + + if (g_cmdLine.cmdInCtrl != 0) + { + ch = 0; + g_cmdLine.cmdInCtrl = 0; + } + } + + if (g_cmdLine.cmdExec == 0 && g_cmdLine.newCmd == 0) + { + if (ch > 0x1F && ch < 0x7F) // ַ + { + if (g_cmdLine.cmdPointer < MAX_CMD_LINE-1) + { + PUTCHAR(ch); // ʾ + + g_cmdLine.cmdBuf[g_cmdLine.cmdPointer] = ch; + g_cmdLine.cmdPointer++; + } + } + } + else + { + g_cmdLine.cmdPointer = 0; + g_cmdLine.cmdBuf[0] = 0; + } +} + + +int IsConsoleCancel(void) +{ + int rslt = g_cmdLine.cancel; + g_cmdLine.cancel = 0; + return rslt; +} + +// 20220412 ṩһⲿӿ,ڻȡ洢ʷ +int GetHistoryCmd(int hisIdx, char * pch) +{ + if (hisIdx < 0 || hisIdx > HISTORY_CMD_NUM || pch == NULL) + { + return -1; + } + + strncpy(pch, &(g_cmdHistory[hisIdx][0]), MAX_CMD_LINE); + + return 0; +} + +int GetHistoryNum(void) +{ + return g_cmdHisNum; +} + +int GetHistoryMaxNum(void) +{ + return HISTORY_CMD_NUM; +} + +int GetHistoryIdx(void) +{ + return g_cmdHisIdx; +} +//--------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------- + + diff --git a/NxBase/console.h b/NxBase/console.h new file mode 100644 index 0000000..07eae88 --- /dev/null +++ b/NxBase/console.h @@ -0,0 +1,66 @@ + +#ifndef __CONSOLE_H__ +#define __CONSOLE_H__ + +#include "config.h" + +//--------------------------------------------------------------------------------------------- + +#ifndef MAX_CMD_LINE +#define MAX_CMD_LINE 50 +#endif + +#ifdef _IN_CONSOLE_C + +int g_netDebugInfo = 0; // = 0, ʹ = 1, Ϣ + +#else + +extern int g_netDebugInfo; + +#endif + +//--------------------------------------------------------------------------------------------- + +#define MAX_DEBUG_INFO_LEN 127 + +#define DEBUG_INFO(...) do\ +{\ + if (g_netDebugInfo != 0)\ + {\ + char str[MAX_DEBUG_INFO_LEN+1]; \ + sprintf(str, __VA_ARGS__); \ + str[MAX_DEBUG_INFO_LEN] = 0; \ + SendDebugInfo(str); \ + } \ + printf(__VA_ARGS__); \ +}while(0) + +//--------------------------------------------------------------------------------------------- + + +void InitConsole(void); + +void ConsoleCmdScan(void); + +void OutNewCmdLine(void); + +int IsConsoleCancel(void); + +int PutChar(int ch); +int GetChar(void); + +void SetConsoleOutType(int type); +int IsNewCommand(void); +int LockExecAndGetCmdStr(char*pBuf); +void UnlockExec(void); +void SetPauseStatus(int sta); + +int GetHistoryCmd(int hisIdx, char * pch); +int GetHistoryNum(void); +int GetHistoryMaxNum(void); +int GetHistoryIdx(void); + +//--------------------------------------------------------------------------------------------- + +#endif diff --git a/NxBase/cpuid.c b/NxBase/cpuid.c new file mode 100644 index 0000000..2829feb --- /dev/null +++ b/NxBase/cpuid.c @@ -0,0 +1,129 @@ + +#include "cpuid.h" +#include "crc32.h" + +#define CPUID_BEG UID_BASE + +#define ID_SEQUE (4671014970607679160ull) // 0x40D2C75E1F9A36B8 + +#define STM32_CPUID_LEN 12 // stm32 cpuid + +// õ CPU ID16ֽ +u32 g_cpuIDBeg = CPUID_BEG; + +void InitCpuIDBase(u32 base) +{ + g_cpuIDBeg = base; +} + +void GetCpuID(CpuId * pId) +{ + int i; + u8 * pBuf; + u8 dat; + u32 addr = (g_cpuIDBeg) / 7; + + if (pId != NULL) + { + addr *= 7; + addr += (g_cpuIDBeg) % 7; + pBuf = (u8*)(addr); + for (i = 0; i < STM32_CPUID_LEN; i++) + { + dat = *pBuf; + pId->buff[i] = dat; + pBuf++; + } + + // УΪidӳ + pId->dword.dword4 = CalcCrc32(pId->buff, STM32_CPUID_LEN); + +#if (0) // Ϣ + printf("\r\nread cpuid: "); + for (i = 0; i < CPUID_LEN; i++) + { + printf("%02x ", pId->buff[i]); + } + printf("\r\n"); +#endif + +#if (1) // Ϣ + { +#define XMOVE_NUM 1 // λ1--7ıϢ仯 + // ȡλ + uint64_t seque = ID_SEQUE; // + u8 idx, temp, first; + CpuId tmpbuf; + + memcpy(tmpbuf.buff, pId->buff, CPUID_LEN); + + // ȡ + for (i = 0; i < CPUID_LEN; i++) + { + dat = tmpbuf.buff[i]; + idx = (seque & 0x0F); + seque >>= 4; + pId->buff[idx] = ~dat; + } + + // λ + for (idx = 0; idx < XMOVE_NUM; idx++) + { + first = pId->buff[0]; + for (i = 1; i <= CPUID_LEN; i++) + { + dat = pId->buff[i-1]; + dat >>= 1; + if (i == CPUID_LEN) + { + temp = first; + } + else + { + temp = pId->buff[i]; + } + temp <<= 7; + dat |= temp; + pId->buff[i-1] = dat; + } + } + } +#endif + } +} + +//---------------------------------- + +static int g_cricount = 0; + +void EnterCritical(void) +{ + if (g_cricount == 0) + { + __disable_irq(); + } + g_cricount++; +} + +void ExitCritical(void) +{ + if (g_cricount != 0) + { + g_cricount--; + } + + if (g_cricount == 0) + { + __enable_irq(); + } +} + +// STM32λ +void RestartMcu(void) +{ + printf("restart the mcu...\r\n"); + + __disable_irq(); + + NVIC_SystemReset(); // ϵͳλ +} diff --git a/NxBase/cpuid.h b/NxBase/cpuid.h new file mode 100644 index 0000000..0d82cb6 --- /dev/null +++ b/NxBase/cpuid.h @@ -0,0 +1,47 @@ + +#ifndef __CPUID_H__ +#define __CPUID_H__ + +#include "config.h" + + +#define CPUID_LEN 16 + +typedef union +{ + u8 buff[CPUID_LEN]; + + u16 wbuff[CPUID_LEN/2]; + + struct + { + u16 word1; + u16 word2; + u16 word3; + u16 word4; + u16 word5; + u16 word6; + u16 word7; + u16 word8; + }__attribute__ ((packed)) word; + + struct + { + u32 dword1; + u32 dword2; + u32 dword3; + u32 dword4; + }__attribute__ ((packed)) dword; + +}CpuId; + +void InitCpuIDBase(u32 base); +void GetCpuID(CpuId * pId); + +void EnterCritical(void); +void ExitCritical(void); + +void RestartMcu(void); + + +#endif diff --git a/NxBase/delay.c b/NxBase/delay.c new file mode 100644 index 0000000..ef3fbae --- /dev/null +++ b/NxBase/delay.c @@ -0,0 +1,49 @@ + +#include "delay.h" +#include "trigger.h" + + +void DelayNs(u32 ns) +{ + u32 bns, tmpns; + bns = Get100NsSoftTimer(); + ns /= 100; + do + { + tmpns = Get100NsSoftTimer(); + if (tmpns - bns > ns) + { + break; + } + }while(1); +} + + +void DelayUs(u32 us) +{ + u32 bus, tmpus; + bus = GetUsSoftTimer(); + do + { + tmpus = GetUsSoftTimer(); + if (tmpus - bus > us) + { + break; + } + }while(1); +} + +void DelayMs(u32 ms) +{ + u32 bus, msus, tmpus; + bus = GetUsSoftTimer(); + msus = ms * 1000; + do + { + tmpus = GetUsSoftTimer(); + if (tmpus - bus > msus) + { + break; + } + }while(1); +} diff --git a/NxBase/delay.h b/NxBase/delay.h new file mode 100644 index 0000000..b295d75 --- /dev/null +++ b/NxBase/delay.h @@ -0,0 +1,12 @@ + +#ifndef __DELAY_H__ +#define __DELAY_H__ + +#include "config.h" + +void DelayNs(u32 ns); +void DelayUs(u32 us); +void DelayMs(u32 ms); + + +#endif diff --git a/NxBase/encrypt.c b/NxBase/encrypt.c new file mode 100644 index 0000000..9ed228a --- /dev/null +++ b/NxBase/encrypt.c @@ -0,0 +1,71 @@ + +#include "encrypt.h" +#include "cpuid.h" + +/* + ļܹ + + ĿģֹоƬĿص忨ʹ + + ʹ÷ + 1, .cļж const static u16 ı + 2. AddToEncrypt ӵܹ + 3. ںʵʱ CheckEncrypt Ƿϼܹ + 4. ϣ... + +*/ + +#define MAX_ENCRYPT_NUM 32 // ֵ֧ļָ + +int g_encryptNum = 0; +const u16 * g_encryptList[MAX_ENCRYPT_NUM]; + +// Ӽֵܹ const static ģ +int AddToEncrypt(const u16 * pEncryptWord) +{ + if (g_encryptNum < MAX_ENCRYPT_NUM) + { + g_encryptList[g_encryptNum] = pEncryptWord; + g_encryptNum++; + } + return g_encryptNum; +} + +// ϢΪ0Ƿ +int CheckEncrypt(void) +{ + int rslt = 0; + int i, j; + const u16 * pEncrype; + + int idnum = sizeof(CpuId) / sizeof(u16); + + CpuId id; + GetCpuID(&id); + + for (i = 0, j = 0; i < g_encryptNum; i++, j++) + { + pEncrype = g_encryptList[i]; + j %= idnum; + if (id.wbuff[j] != *pEncrype) + { + if (*pEncrype == 0xffff) // һдidдflash + { +/* + FLASH_Unlock(); + FLASH_ClearFlag(FLASH_FLAG_BSY|FLASH_FLAG_EOP|FLASH_FLAG_PGERR|FLASH_FLAG_WRPRTERR); + FLASH_ProgramWord((u32)pEncrype, id.wbuff[j]); + FLASH_Lock(); +*/ + } + else + { + rslt = i+1; + break; + } + } + } + return rslt; +} + + diff --git a/NxBase/encrypt.h b/NxBase/encrypt.h new file mode 100644 index 0000000..65a4309 --- /dev/null +++ b/NxBase/encrypt.h @@ -0,0 +1,20 @@ + +#ifndef __ENCRYPT_H__ +#define __ENCRYPT_H__ + +#include "config.h" + + +// Ӽֵܹ const static ģ +int AddToEncrypt(const u16 * pEncryptWord); + +// ǷϼҪ +int CheckEncrypt(void); + + + + +//--------------------------------------------------- + +#endif + diff --git a/NxBase/funcs.c b/NxBase/funcs.c new file mode 100644 index 0000000..23c47c5 --- /dev/null +++ b/NxBase/funcs.c @@ -0,0 +1,2 @@ + +#include "funcs.h" diff --git a/NxBase/funcs.h b/NxBase/funcs.h new file mode 100644 index 0000000..e72df8c --- /dev/null +++ b/NxBase/funcs.h @@ -0,0 +1,119 @@ + +#ifndef __FUNCS_H__ +#define __FUNCS_H__ + +#include "config.h" + +//------------------------------------------------------------ + +#define ALM_LIT_STA_OFF 0 // ر״̬ +#define ALM_LIT_STA_ON 1 // ״̬ + +#define ALM_LIT_OFF 0 // ص +#define ALM_LIT_ON 1 // +#define ALM_LIT_FLASH 2 // ˸ +#define ALM_LIT_FLASH_FAST 3 // ˸ +#define ALM_LIT_FLASH_SLOW 4 // ˸ + +#define FLASH_LIGHT(flag, sta, onfunc, offfunc) do \ +{\ + if (flag == ALM_LIT_OFF)\ + {\ + if (sta != ALM_LIT_STA_OFF)\ + {\ + sta = ALM_LIT_STA_OFF;\ + offfunc();\ + }\ + }\ + else if (flag == ALM_LIT_ON)\ + {\ + if (sta != ALM_LIT_STA_ON)\ + {\ + sta = ALM_LIT_STA_ON;\ + onfunc();\ + }\ + }\ + else if (flag == ALM_LIT_FLASH || flag == ALM_LIT_FLASH_FAST || flag == ALM_LIT_FLASH_SLOW)\ + {\ + if (sta == ALM_LIT_STA_ON)\ + {\ + sta = ALM_LIT_STA_OFF;\ + offfunc();\ + }\ + else if (sta == ALM_LIT_STA_OFF)\ + {\ + sta = ALM_LIT_STA_ON;\ + onfunc();\ + }\ + else \ + {\ + sta = ALM_LIT_STA_OFF;\ + }\ + }\ + else \ + {\ + flag = ALM_LIT_OFF;\ + }\ +}while(0) + + +//------------------------------------------------------------ + +#define OUTPUT_FUNCS(Name, LABEL) \ +void Set##Name##On(void) \ +{ \ + LL_GPIO_ResetOutputPin(LABEL##_GPIO_Port, LABEL##_Pin); \ +} \ +void Set##Name##Off(void)\ +{ \ + LL_GPIO_SetOutputPin(LABEL##_GPIO_Port, LABEL##_Pin); \ +} \ +void Set##Name##Toggle(void) \ +{ \ + LL_GPIO_TogglePin(LABEL##_GPIO_Port, LABEL##_Pin); \ +} \ +u8 Get##Name##Status(void) \ +{ \ + return LL_GPIO_IsOutputPinSet(LABEL##_GPIO_Port, LABEL##_Pin); \ +} \ + +//------------------------------------------------------------ + +#define INPUT_FUNCS(Name, LABEL) \ +u8 Get##Name##Status(void)\ +{\ + return LL_GPIO_IsInputPinSet(LABEL##_GPIO_Port, LABEL##_Pin);\ +} + +//------------------------------------------------------------ + + +//------------------------------------------------------------ +#define OUTPUT_NULL_FUNCS(Name, LABEL) \ +void Set##Name##On(void) \ +{ \ + SetOutputNull(); \ +} \ +void Set##Name##Off(void)\ +{ \ + SetOutputNull(); \ +} \ +void Set##Name##Toggle(void) \ +{ \ + SetOutputNull(); \ +} \ +u8 Get##Name##Status(void) \ +{ \ + return GetInputNullOff(); \ +} \ + +//------------------------------------------------------------ +#define INPUT_NULL_FUNCS(Name, LABEL) \ +u8 Get##Name##Status(void)\ +{\ + return GetInputNullOff(); \ +} + +//------------------------------------------------------------ + +#endif diff --git a/NxBase/i2crw.c b/NxBase/i2crw.c new file mode 100644 index 0000000..577d35d --- /dev/null +++ b/NxBase/i2crw.c @@ -0,0 +1,342 @@ + +#include "i2crw.h" + +#ifndef MAX_MSG_NUM +#define MAX_MSG_NUM 0 +#endif + + +#if (MAX_MSG_NUM > 0) + + +#ifndef MAX_MSG_DAT_LEN +#define MAX_MSG_DAT_LEN 128 +#endif + +typedef struct +{ + int transDir; // ䷽ + int transSteps; // 䲽 + u8 slaveAddr; // ӽڵַ + u8 regAddr; // Ĵַ + + u8 datbuff[MAX_MSG_DAT_LEN]; // ݻ + int dataNums; // ݳ + int datIndex; // ݴָ + +}TransI2cMsg; + + +// ䷽ +#define TRANS_DIR_RD 0 +#define TRANS_DIR_WR 1 + +// 䲽 +#define TRANS_STEP_FREE 0 // +#define TRANS_STEP_START 1 // +#define TRANS_STEP_R_START 2 // ظ +#define TRANS_STEP_ADDR 3 // ַ +#define TRANS_STEP_RDDAT 4 // ȡ +#define TRANS_STEP_FINISH 5 // +#define TRANS_STEP_ERROR 6 // + + + +TransI2cMsg g_msgList[10]; + + +#endif + + + + + + + + + + + + + +/* + + + + +typedef enum +{ + i2cWrite, + i2cRead +} I2cDirection; + + +typedef enum +{ + I2C_STATUS_FREE = 0, + I2C_STATUS_START, + I2C_STATUS_ADDRESS, + I2C_STATUS_START_R,//ʱڶηʼź + I2C_STATUS_REDATA, + I2C_STATUS_FINSIH,// + I2C_STATUS_ERR,// + +}I2C_STATUS; + +typedef struct _I2cMessage +{ + uint32_t Length; + uint32_t Index; + uint8_t slaveAddress; + I2cDirection direction; + I2C_STATUS status; + uint16_t regAddress; + uint8_t *buffer; +} I2cMessage; + + +static I2cMessage Message; + + +void i2cdrvInitBus() +{ + I2C_InitTypeDef I2C_InitStructure; + NVIC_InitTypeDef NVIC_InitStructure; + GPIO_InitTypeDef GPIO_InitStructure; + + + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); + + RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE); + + + GPIO_StructInit(&GPIO_InitStructure); + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; // SCL + GPIO_Init(GPIOB, &GPIO_InitStructure); + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; // SDA + GPIO_Init(GPIOB, &GPIO_InitStructure); + + + GPIO_PinAFConfig(GPIOB, GPIO_PinSource8, GPIO_AF_I2C1); + GPIO_PinAFConfig(GPIOB, GPIO_Pin_9Source, GPIO_AF_I2C1); + + I2C_DeInit(I2C1); + I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; + I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; + I2C_InitStructure.I2C_OwnAddress1 = 0x30;; + I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; + I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; + I2C_InitStructure.I2C_ClockSpeed = 400000; + I2C_Init(I2C1, &I2C_InitStructure); + + I2C_ITConfig(I2C1, I2C_IT_ERR, ENABLE); + + NVIC_InitStructure.NVIC_IRQChannel = I2C1_EV_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 7; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); + NVIC_InitStructure.NVIC_IRQChannel = I2C1_ER_IRQn; + NVIC_Init(&NVIC_InitStructure); + + GPIO_SetBits(GPIOB, GPIO_Pin_8); + GPIO_SetBits(GPIOB, GPIO_Pin_9); + +} + + + +//ȡ +bool i2cdevRead(uint8_t devAddr, uint8_t ReadAddr, uint8_t DatasLen, uint8_t *DataRead) +{ + int waitTime; + Message.status = I2C_STATUS_START; + Message.slaveAddress = devAddr; + Message.Index = 0; + + Message.buffer = DataRead; + + Message.Length = DatasLen; + Message.regAddress = ReadAddr;//Ĵַ + Message.direction = i2cRead; + + I2C_ITConfig(I2C1, I2C_IT_BUF, DISABLE); + I2C_ITConfig(I2C1, I2C_IT_EVT, ENABLE); + I2C1->CR1 = (I2C_CR1_START | I2C_CR1_PE);//1 ʼж + waitTime = clock(); + while (1)//ȴ + { + if (Message.status == I2C_STATUS_FINSIH) + { + return true; + } + if (Message.status == I2C_STATUS_ERR) + { + return false; + } + if (clock() - waitTime > 10) + { + I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF, DISABLE); + return false; + } + } +} + + +//һֽ +bool i2cdevWriteByte(uint8_t devAddr, uint8_t WriteAddr, uint8_t DataToWrite) +{ + int waitTime; + Message.status = I2C_STATUS_START; + Message.slaveAddress = devAddr; + Message.Index = 0; + + Message.buffer = &DataToWrite; + + Message.Length = 1; + Message.regAddress = WriteAddr;//Ĵַ + Message.direction = i2cWrite; + + I2C_ITConfig(I2C1, I2C_IT_BUF, DISABLE); + I2C_ITConfig(I2C1, I2C_IT_EVT, ENABLE); + I2C1->CR1 = (I2C_CR1_START | I2C_CR1_PE);//1 ʼж + waitTime = clock(); + while (1)//ȴ + { + if (Message.status == I2C_STATUS_FINSIH) + { + return true; + } + if (Message.status == I2C_STATUS_ERR) + { + return false; + } + if (clock() - waitTime > 10) + { + I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF, DISABLE); + return false; + } + } +} + +void I2C1_ER_IRQHandler(void) +{ + if (I2C_GetFlagStatus(I2C1, I2C_FLAG_AF)) + { + I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF, DISABLE); + + I2C_ClearFlag(I2C1, I2C_FLAG_AF); + + Message.status = I2C_STATUS_ERR; + } + if (I2C_GetFlagStatus(I2C1, I2C_FLAG_BERR)) + { + I2C_ClearFlag(I2C1, I2C_FLAG_BERR); + } + if (I2C_GetFlagStatus(I2C1, I2C_FLAG_OVR)) + { + I2C_ClearFlag(I2C1, I2C_FLAG_OVR); + } + if (I2C_GetFlagStatus(I2C1, I2C_FLAG_ARLO)) + { + I2C_ClearFlag(I2C1, I2C_FLAG_ARLO); + } +} + + + +void I2C1_EV_IRQHandler() +{ + uint16_t SR1; + uint16_t SR2; + + SR1 = I2C1->SR1; + + // Start bit event + if (SR1 & I2C_SR1_SB) + { + if (Message.status == I2C_STATUS_START) + { + I2C_Send7bitAddress(I2C1, Message.slaveAddress << 1, I2C_Direction_Transmitter);//2 + Message.status = I2C_STATUS_ADDRESS; + } + else if (Message.status == I2C_STATUS_START_R) + { + I2C_AcknowledgeConfig(I2C1, ENABLE);//5 תΪ + I2C_Send7bitAddress(I2C1, Message.slaveAddress << 1, I2C_Direction_Receiver); + Message.status = I2C_STATUS_REDATA; + } + } + else if (SR1 & I2C_SR1_ADDR)//ַ + { + SR2 = I2C1->SR2; + + if (Message.status == I2C_STATUS_ADDRESS)//ͼĴַ + { + I2C_SendData(I2C1, Message.regAddress);//4 ͵ַ + } + if (Message.Length == 1)//ֻһֽ + { + if (Message.status == I2C_STATUS_REDATA) + { + I2C_AcknowledgeConfig(I2C1, DISABLE); + } + } + + I2C_ITConfig(I2C1, I2C_IT_BUF, ENABLE); + } + else if (SR1 & I2C_SR1_BTF) + { + //4 ϴδ + + if (SR1&I2C_SR1_TXE)// + { + if (Message.direction == i2cRead)// + { + if (Message.status == I2C_STATUS_ADDRESS)//Ĵ + { + I2C1->CR1 = (I2C_CR1_START | I2C_CR1_PE);// + Message.status = I2C_STATUS_START_R;// + } + } + else//д + { + I2C_SendData(I2C1, Message.buffer[Message.Index++]); + if (Message.Index == Message.Length) + { + I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF, DISABLE);//رж + I2C1->CR1 = (I2C_CR1_STOP | I2C_CR1_PE);//Ƿ + Message.status = I2C_STATUS_FINSIH; + } + } + } + } + if (SR1 & I2C_SR1_RXNE) + { + + Message.buffer[Message.Index++] = I2C_ReceiveData(I2C1); + + if (Message.Index == Message.Length - 1) + { + I2C_AcknowledgeConfig(I2C1, DISABLE);//ĩβݽֹӦ + } + + if (Message.Index == Message.Length) + { + I2C1->CR1 = (I2C_CR1_STOP | I2C_CR1_PE);//Ƿ + I2C_ITConfig(I2C1, I2C_IT_EVT | I2C_IT_BUF, DISABLE);//ܽ + Message.status = I2C_STATUS_FINSIH; + } + } + else if (SR1 & I2C_SR1_TXE) + { + + } +} + + +*/ diff --git a/NxBase/i2crw.h b/NxBase/i2crw.h new file mode 100644 index 0000000..e7ce4cd --- /dev/null +++ b/NxBase/i2crw.h @@ -0,0 +1,15 @@ + +#ifndef __I2CRW_H__ +#define __I2CRW_H__ + +#include "config.h" + +// I2Cշ + + + + + + + +#endif diff --git a/NxBase/iwdog.c b/NxBase/iwdog.c new file mode 100644 index 0000000..cbfdfc6 --- /dev/null +++ b/NxBase/iwdog.c @@ -0,0 +1,74 @@ + +#include "iwdog.h" + +/* + Źһ40KHzʱӣͨԤƵֵװֵȷŹλ + + ʽ: + Tout = ((4 2^prer) rlr) / 40; + + Tout Ϊλʱ䣬λms + prer ΪŹʱԤƵֵдֵ 0--7ǷƵϵ/4: 4Ƶֵ0, 64 Ƶ дֵ4 + rlr ǿŹװֵ +*/ + +//------------------------------------------------------------------------------- + +#define MAX_IWD_MS 6553 + +#ifdef USE_STDPERIPH_DRIVER +#define IWDG_PRE IWDG_Prescaler_4 // 4ƵƵ0.1ms +#endif + +#ifdef USE_FULL_LL_DRIVER +#define IWDG_PRE LL_IWDG_PRESCALER_4 // 4ƵƵ0.1ms +#endif + +//------------------------------------------------------------------------------- + +void InitIWDog(u16 ms) +{ + if (ms < MAX_IWD_MS) + { + ms *= 10; + } + else + { + ms = 65535; + } +#if (USE_IWDOG == 1) +#ifdef USE_STDPERIPH_DRIVER + IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); // ȡĴд + IWDG_SetPrescaler(IWDG_PRE); // öŹԤƵϵ + IWDG_SetReload(ms); // öŹװֵ + + IWDG_ReloadCounter(); // ؼֵ, һι + IWDG_Enable(); // Ź +#endif + +#ifdef USE_FULL_LL_DRIVER + LL_IWDG_EnableWriteAccess(IWDG); // ȡĴд + LL_IWDG_SetPrescaler(IWDG, IWDG_PRE); // öŹԤƵϵ + LL_IWDG_SetWindow(IWDG, ms); // ô + LL_IWDG_SetReloadCounter(IWDG, ms); // öŹװֵ + + LL_IWDG_ReloadCounter(IWDG); // ؼֵ, һι + + LL_IWDG_Enable(IWDG); // Ź +#endif +#endif + +} + +void FeedIWDog(void) +{ +#if (USE_IWDOG == 1) +#ifdef USE_STDPERIPH_DRIVER + IWDG_ReloadCounter(); +#endif + +#ifdef USE_FULL_LL_DRIVER + LL_IWDG_ReloadCounter(IWDG); +#endif +#endif +} diff --git a/NxBase/iwdog.h b/NxBase/iwdog.h new file mode 100644 index 0000000..da157be --- /dev/null +++ b/NxBase/iwdog.h @@ -0,0 +1,15 @@ + +#ifndef __IWDOG_H__ +#define __IWDOG_H__ + +#include "config.h" + +// ʼŹ +// ms Źλʱ䣬λmsֵ֧ 6553 +void InitIWDog(u16 ms); + +// ι +void FeedIWDog(void); + + +#endif diff --git a/NxBase/serial.c b/NxBase/serial.c new file mode 100644 index 0000000..5a826e8 --- /dev/null +++ b/NxBase/serial.c @@ -0,0 +1,461 @@ + +#define _IN_SERIAL_C + +#include "serial.h" +#include "cpuid.h" + +/*------------------------------------------------------------------------------------------*/ + +#ifndef MAX_STBUF1_SIZE +#define MAX_STBUF1_SIZE (128) +#endif + +#ifndef MAX_SRBUF1_SIZE +#define MAX_SRBUF1_SIZE (128) +#endif + +#ifndef MAX_STBUF2_SIZE +#define MAX_STBUF2_SIZE (128) +#endif + +#ifndef MAX_SRBUF2_SIZE +#define MAX_SRBUF2_SIZE (128) +#endif + +#ifndef MAX_STBUF3_SIZE +#define MAX_STBUF3_SIZE (128) +#endif + +#ifndef MAX_SRBUF3_SIZE +#define MAX_SRBUF3_SIZE (128) +#endif + +#ifndef MAX_STBUF4_SIZE +#define MAX_STBUF4_SIZE (128) +#endif + +#ifndef MAX_SRBUF4_SIZE +#define MAX_SRBUF4_SIZE (128) +#endif + +#ifndef MAX_STBUF5_SIZE +#define MAX_STBUF5_SIZE (128) +#endif + +#ifndef MAX_SRBUF5_SIZE +#define MAX_SRBUF5_SIZE (128) +#endif + +#ifndef MAX_STBUF6_SIZE +#define MAX_STBUF6_SIZE (128) +#endif + +#ifndef MAX_SRBUF6_SIZE +#define MAX_SRBUF6_SIZE (128) +#endif + + +typedef struct +{ + // + u16 sEnFlag; // Ч־ = 0x55aaṹЧ + USART_TypeDef * USARTx; + BAUD_TypeDef baud; + + // + int squeueLen; // ͻ + u8 * sendQueue; // ͻ + u8 * pSdQueueHead; // Ͷͷָ + u8 * pSdQueueTail; // Ͷβָ + u16 lenSdQueue; // ͶЧ + u16 ctrlSdFlag; // ͱ־, TRUE, ڷ; FALSE, ûз + + int rqueueLen; // ջ + u8 * rsevQueue; // ջ + u8 * pRsQueueHead; // նͷָ + u8 * pRsQueueTail; // նβָ + u16 lenRsQueue; // նЧ + u16 ctrlRsFlag; // ־, TRUE, ڽ; FALSE, ڽ + + ResvExProc resvexproc; // ⲿָ +}UsartCtrl; + +#define FLAG_ENABLE 0x55AA + +/*------------------------------------------------------------------------------------------*/ + +#define IsUsartRxneFlag(usart) LL_USART_IsActiveFlag_RXNE(usart) +#define IsUsartTxeFlag(usart) LL_USART_IsActiveFlag_TXE(usart) +#define IsUsartTcFlag(usart) LL_USART_IsActiveFlag_TC(usart) + +#define EnableItReceive(usart) LL_USART_EnableIT_RXNE(usart) +#define DisableItReceive(usart) LL_USART_DisableIT_RXNE(usart) + +#define EnableItTrans(usart) LL_USART_EnableIT_TXE(usart) +#define DisableItTrans(usart) LL_USART_DisableIT_TXE(usart) + +#define ReceiveData LL_USART_ReceiveData8 +#define TransmitData LL_USART_TransmitData8 + + +/*------------------------------------------------------------------------------------------*/ + +// жϴ꣬дͬ + +#define INITUSART(usart) do \ +{\ + /* ʹܽж */ \ + LL_USART_ReceiveData8(USART##usart); \ + LL_USART_EnableIT_RXNE(USART##usart); \ +\ + /* 򿪴 */ \ + LL_USART_Enable(USART##usart); \ +} while (0) + +/*------------------------------------------------------------------------------------------*/ + +#define USART_PROC(usart) \ + \ +u8 g_usart##usart##TBuff[MAX_STBUF##usart##_SIZE];\ +u8 g_usart##usart##RBuff[MAX_SRBUF##usart##_SIZE];\ +UsartCtrl g_uCtrl##usart; \ + \ +int InitUsart##usart(BAUD_TypeDef baud, char dat, char parity, char stop) \ +{ \ + /* շ */ \ + memset(&g_uCtrl##usart, 0, sizeof(UsartCtrl)); \ + g_uCtrl##usart.sendQueue = g_usart##usart##TBuff; \ + g_uCtrl##usart.squeueLen = MAX_STBUF##usart##_SIZE; \ + g_uCtrl##usart.rsevQueue = g_usart##usart##RBuff; \ + g_uCtrl##usart.rqueueLen = MAX_SRBUF##usart##_SIZE; \ + g_uCtrl##usart.USARTx = USART##usart; \ + g_uCtrl##usart.baud = baud; \ + \ + g_uCtrl##usart.pSdQueueHead = &(g_uCtrl##usart.sendQueue[0]); \ + g_uCtrl##usart.pSdQueueTail = g_uCtrl##usart.pSdQueueHead; \ + g_uCtrl##usart.lenSdQueue = 0; \ + g_uCtrl##usart.ctrlSdFlag = FALSE; \ + \ + g_uCtrl##usart.pRsQueueHead = &(g_uCtrl##usart.rsevQueue[0]); \ + g_uCtrl##usart.pRsQueueTail = g_uCtrl##usart.pRsQueueHead; \ + g_uCtrl##usart.lenRsQueue = 0; \ + g_uCtrl##usart.ctrlRsFlag = TRUE; \ + \ + g_uCtrl##usart.sEnFlag = FLAG_ENABLE; \ + g_uCtrl##usart.resvexproc = NULL; \ + \ + INITUSART(usart); \ + return 0; \ +} \ + \ +/*------------------------------------------------------------------------------------------*/ \ +/* ܣݣӵͶ */ \ +/* pDatBufݻ */ \ +/* len, ݳ */ \ +/* أ >= 0, ʵʷ */ \ +/* أ -1, */ \ +/* -2, ûгʼ*/ \ +/* -3, ջƴ*/ \ +int Usart##usart##SendData(u8 * pDatBuf, int len) \ +{ \ + int i; \ + u8 * pSDat; \ + \ + if (pDatBuf == NULL || len < 0) \ + { \ + return -1; \ + } \ + if (g_uCtrl##usart.sEnFlag != FLAG_ENABLE) \ + { \ + return -2; \ + } \ + \ + /* ݳ */ \ + EnterCritical(); \ + if (g_uCtrl##usart.lenSdQueue+len > g_uCtrl##usart.squeueLen) \ + { \ + len = 0; /*g_uCtrl##usart.squeueLen - g_uCtrl##usart.lenSdQueue;*/ \ + } \ + pSDat = g_uCtrl##usart.pSdQueueTail; \ + ExitCritical(); \ + \ + if (len < 0) \ + { \ + return -3; \ + } \ + /* */ \ + for (i = 0; i < len; i++) \ + { \ + *pSDat++ = *pDatBuf++; \ + if (pSDat > &(g_uCtrl##usart.sendQueue[g_uCtrl##usart.squeueLen-1])) \ + { \ + pSDat = &(g_uCtrl##usart.sendQueue[0]); \ + } \ + } \ + /* */ \ + if (len != 0) \ + { \ + EnterCritical(); \ + g_uCtrl##usart.pSdQueueTail = pSDat; \ + g_uCtrl##usart.lenSdQueue += len; \ + if (g_uCtrl##usart.ctrlSdFlag != TRUE && g_uCtrl##usart.lenSdQueue != 0) \ + { \ + g_uCtrl##usart.ctrlSdFlag = TRUE; /* ñ־ */ \ + EnableItTrans(g_uCtrl##usart.USARTx); /* жϣ൱ */ \ + } \ + ExitCritical(); \ + } \ + return len; \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* ܣݣݴӽնȡ */ \ +/* pDatŻ*/ \ +/* expectLenϣõݵĴС */ \ +/* أ >= 0ʵʵõݵĴС */ \ +/* -1, */ \ +/* -2, ûгʼ*/ \ +/* -3, ջƴ*/ \ + \ +int Usart##usart##GetData(u8 * pDat, int expectLen) \ +{ \ + int i, len; \ + u8 * pSDat; \ + \ + if (pDat == NULL || expectLen < 0) \ + { \ + return -1; \ + } \ + \ + if (g_uCtrl##usart.sEnFlag != FLAG_ENABLE) \ + { \ + return -2; \ + } \ + \ + EnterCritical(); \ + pSDat = g_uCtrl##usart.pRsQueueHead; \ + len = g_uCtrl##usart.lenRsQueue; \ + ExitCritical(); \ + \ + if (len < 0) \ + { \ + return -3; \ + } \ + \ + if (expectLen > len) /* Ҫݴڴе */ \ + { \ + return 0; \ + } \ + \ + /* ȡ */ \ + for (i = 0; i < expectLen; i++) \ + { \ + *pDat++ = *pSDat; \ + pSDat++; \ + if (pSDat > &(g_uCtrl##usart.rsevQueue[g_uCtrl##usart.rqueueLen-1])) \ + { \ + pSDat = &(g_uCtrl##usart.rsevQueue[0]); \ + } \ + } \ + \ + EnterCritical(); \ + g_uCtrl##usart.pRsQueueHead = pSDat; \ + g_uCtrl##usart.lenRsQueue -= expectLen; \ + ExitCritical(); \ + \ + return expectLen; \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* սջ */ \ +int Usart##usart##CleanRsBuf(void) \ +{ \ + int len; \ + EnterCritical(); \ + g_uCtrl##usart.pRsQueueHead = g_uCtrl##usart.pRsQueueTail; \ + len = g_uCtrl##usart.lenRsQueue; \ + g_uCtrl##usart.lenRsQueue = 0; \ + ExitCritical(); \ + return len; \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* õݵij */ \ +int Usart##usart##GetRsLen(void) \ +{ \ + int len; \ + EnterCritical(); \ + len = g_uCtrl##usart.lenRsQueue; \ + ExitCritical(); \ + return len; \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* շͻ */ \ +int Usart##usart##CleanSdBuf(void) \ +{ \ + int len; \ + EnterCritical(); \ + g_uCtrl##usart.pSdQueueHead = g_uCtrl##usart.pSdQueueTail; \ + len = g_uCtrl##usart.lenSdQueue; \ + g_uCtrl##usart.lenSdQueue = 0; \ + ExitCritical(); \ + return len; \ +} \ + \ +/*------------------------------------------------------------------------------------------*/ \ +/* õͻг */ \ +int Usart##usart##GetSdFreeLen(void) \ +{ \ + int len; \ + EnterCritical(); \ + len = g_uCtrl##usart.squeueLen - g_uCtrl##usart.lenSdQueue; \ + ExitCritical(); \ + return len; \ +} \ + \ +/*------------------------------------------------------------------------------------------*/ \ +/* жϷͻǷΪ */ \ +int IsUsart##usart##SendBufEmpty(void) \ +{ \ + int len; \ + EnterCritical(); \ + len = g_uCtrl##usart.lenSdQueue; \ + ExitCritical(); \ + if (len != 0) \ + { \ + return FALSE; \ + } \ + else \ + { \ + return TRUE; \ + } \ +} \ +/* Ƿ */ \ +int IsUsart##usart##SendOver(void) \ +{ \ + int flag; \ + EnterCritical(); \ + flag = g_uCtrl##usart.ctrlSdFlag; \ + ExitCritical(); \ + if (flag == TRUE) \ + { \ + return FALSE; \ + } \ + else \ + { \ + return TRUE; \ + } \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* жϴ */ \ +void USART##usart##IntProc(void) \ +{ \ + u8 dat; \ + if (IsUsartRxneFlag(g_uCtrl##usart.USARTx) != RESET) /* USART ж */ \ + { \ + dat = ReceiveData(g_uCtrl##usart.USARTx); \ + if (g_uCtrl##usart.sEnFlag != FLAG_ENABLE) \ + { \ + return; \ + } \ + if (g_uCtrl##usart.lenRsQueue < g_uCtrl##usart.rqueueLen) \ + { \ + *(g_uCtrl##usart.pRsQueueTail) = dat; /* */ \ + g_uCtrl##usart.pRsQueueTail++; \ + if (g_uCtrl##usart.pRsQueueTail > &(g_uCtrl##usart.rsevQueue[g_uCtrl##usart.rqueueLen-1])) \ + { \ + g_uCtrl##usart.pRsQueueTail = &(g_uCtrl##usart.rsevQueue[0]); \ + } \ + g_uCtrl##usart.lenRsQueue++; /* */ \ + } \ + if (g_uCtrl##usart.resvexproc != NULL) \ + { \ + g_uCtrl##usart.resvexproc(dat); \ + } \ + } \ + if (IsUsartTxeFlag(g_uCtrl##usart.USARTx) != RESET) /* USART ж */ \ + { \ + if (g_uCtrl##usart.sEnFlag != FLAG_ENABLE) \ + { \ + DisableItTrans(g_uCtrl##usart.USARTx); /* رж */ \ + return; \ + } \ + if (g_uCtrl##usart.lenSdQueue != 0) \ + { \ + TransmitData(g_uCtrl##usart.USARTx, *(g_uCtrl##usart.pSdQueueHead)); /* */ \ + g_uCtrl##usart.pSdQueueHead++; /* ָ */ \ + if (g_uCtrl##usart.pSdQueueHead > &(g_uCtrl##usart.sendQueue[g_uCtrl##usart.squeueLen-1])) \ + { \ + g_uCtrl##usart.pSdQueueHead = &(g_uCtrl##usart.sendQueue[0]); \ + } \ + g_uCtrl##usart.lenSdQueue--; /* ȼС */ \ + g_uCtrl##usart.ctrlSdFlag = TRUE; /* ñ־ */ \ + } \ + else \ + { \ + g_uCtrl##usart.ctrlSdFlag = FALSE; /* ñ־ */ \ + DisableItTrans(g_uCtrl##usart.USARTx); /* رж */ \ + } \ + } \ +} \ +/*------------------------------------------------------------------------------------------*/ \ +/* עⲿ */ \ +void RegUsart##usart##ResvExFunc(ResvExProc proc) \ +{ \ + g_uCtrl##usart.resvexproc = proc; \ +} \ + \ +/*------------------------------------------------------------------------------------------*/ \ +/* USARTxͬ */ \ +int Usart##usart##SendDataSync(u8 * pDatBuf, int len) \ +{ \ + DisableItTrans(g_uCtrl##usart.USARTx); /* رж */ \ + while(len != 0) \ + { \ + while(IsUsartTcFlag(g_uCtrl##usart.USARTx) == RESET); \ + TransmitData(g_uCtrl##usart.USARTx, *pDatBuf); \ + pDatBuf++; \ + len--; \ + } \ + return len; \ +} \ + \ +/* USARTxͬ */ \ +int Usart##usart##GetDataSync(u8 * pDat, int expectLen) \ +{ \ + int count = 0; \ + DisableItReceive(g_uCtrl##usart.USARTx); /* رж */ \ + while(expectLen != 0) \ + { \ + while(IsUsartTcFlag(g_uCtrl##usart.USARTx) == RESET); \ + *pDat = ReceiveData(g_uCtrl##usart.USARTx); \ + pDat++; \ + expectLen--; \ + count++; \ + } \ + return count; \ +}\ +/*------------------------------------------------------------------------------------------*/ + +#ifdef COMM_USART1 +USART_PROC(1); +#endif + +#ifdef COMM_USART2 +USART_PROC(2); +#endif + +#ifdef COMM_USART3 +USART_PROC(3); +#endif + +#ifdef COMM_USART4 +USART_PROC(4); +#endif + +#ifdef COMM_USART5 +USART_PROC(5); +#endif + +#ifdef COMM_USART6 +USART_PROC(6); +#endif + + diff --git a/NxBase/serial.h b/NxBase/serial.h new file mode 100644 index 0000000..1394bf6 --- /dev/null +++ b/NxBase/serial.h @@ -0,0 +1,115 @@ + +#ifndef __SERIAL_H__ +#define __SERIAL_H__ + + +//--------------------------------------------------------------------------- + +#include "config.h" + +//--------------------------------------------------------------------------- + +typedef enum +{ + B4800 = 4800, + B9600 = 9600, + B14400 = 14400, + B19200 = 19200, + B38400 = 38400, + B57600 = 57600, + B115200 = 115200, + B230400 = 230400, + B460800 = 460800, + B921600 = 921600, + B1000000 = 1000000 + +}BAUD_TypeDef; + +//----------------------------------------------------------------------- + +typedef void (*ResvExProc)(u8 dat); + +//----------------------------------------------------------------------- + +#define USART_FUNC_DEF(usart) \ + \ +/* ʼUSART */ \ +int InitUsart##usart(BAUD_TypeDef baud, char dat, char parity, char stop); \ +/* */ \ +int Usart##usart##SendData(u8 * pDatBuf, int len); \ +/* */ \ +int Usart##usart##GetData(u8 * pDat, int expectLen); \ +/* սջ */ \ +int Usart##usart##CleanRsBuf(void); \ +/* õѽݵij */ \ +int Usart##usart##GetRsLen(void); \ +/* շͻ */ \ +int Usart##usart##CleanSdBuf(void); \ +/* õͻг */ \ +int Usart##usart##GetSdFreeLen(void); \ +/* ͻǷΪ */ \ +int IsUsart##usart##SendBufEmpty(void); \ +/* Ƿ */ \ +int IsUsart##usart##SendOver(void); \ +/* жϴ */ \ +void USART##usart##IntProc(void); \ +/* עⲿ */ \ +void RegUsart##usart##ResvExFunc(ResvExProc proc); \ +/* ͬ */ \ +int Usart##usart##SendDataSync(u8 * pDatBuf, int len); \ +/* ͬ */ \ +int Usart##usart##GetDataSync(u8 * pDat, int expectLen); \ +//----------- + +//----------------------------------------------------------------------- + +#ifdef COMM_USART1 +USART_FUNC_DEF(1); +#endif + +//----------------------------------------------------------------------- + +#ifdef COMM_USART2 +USART_FUNC_DEF(2); +#endif + +//----------------------------------------------------------------------- + +#ifdef COMM_USART3 +USART_FUNC_DEF(3); +#endif + +//----------------------------------------------------------------------- + +#ifdef COMM_USART4 +USART_FUNC_DEF(4); +#endif + +//----------------------------------------------------------------------- + + +#ifdef COMM_USART5 +USART_FUNC_DEF(5); +#endif + +//----------------------------------------------------------------------- + + +#ifdef COMM_USART6 +USART_FUNC_DEF(6); +#endif + +//----------------------------------------------------------------------- + +typedef int (*InitUsart)(BAUD_TypeDef baud, char dat, char parity, char stop); // ʼ +typedef int (*UsartSendData)(u8 * pDatBuf, int len); // +typedef int (*UsartGetData)(u8 * pDat, int expectLen); // +typedef int (*UsartCleanRsBuf)(void); // սջ +typedef int (*UsartGetRsLen)(void); // õѽݵij +typedef int (*UsartGetSdFreeLen)(void); // õͻг +typedef int (*UsartCleanSdBuf)(void); // շͻ +typedef int (*IsUsartSendOver)(void); // ͻǷΪ + +//----------------------------------------------------------------------- + +#endif diff --git a/NxBase/shell.c b/NxBase/shell.c new file mode 100644 index 0000000..6322b36 --- /dev/null +++ b/NxBase/shell.c @@ -0,0 +1,345 @@ + +#include "shell.h" +#include "cpuid.h" + +//------------------------------------------------------------------------- + +ShellCmdItem g_cmdList[MAX_CMD_NUM]; +int g_cmdNum = 0; + +//------------------------------------------------------------------------- + +void ChangeToUper(char * str) +{ + char tmp; + while (str != NULL) + { + tmp = *str; + if (tmp == 0) + { + break; + } + + if (tmp >= 'a' && tmp <= 'z') + { + tmp -= ('a'-'A'); + *str = tmp; + } + str++; + } +} + +int AddShellCmd(const char*pCmd, const char*pHelp, ShellFunc func) +{ + if (g_cmdNum < MAX_CMD_NUM) + { + if ((strlen(pCmd) >= MAX_CMD_STR)) + { + memcpy(g_cmdList[g_cmdNum].cmdstr, pCmd, MAX_CMD_STR-1); + g_cmdList[g_cmdNum].cmdstr[MAX_CMD_STR-1] = 0; + } + else + { + strcpy(g_cmdList[g_cmdNum].cmdstr, pCmd); + } + + ChangeToUper(g_cmdList[g_cmdNum].cmdstr); +#if (1) // Ϊָ + g_cmdList[g_cmdNum].helpstr = pHelp; +#else + if ((strlen(pHelp) >= MAX_HELP_STR)) + { + memcpy(g_cmdList[g_cmdNum].helpstr, pHelp, MAX_HELP_STR-1); + g_cmdList[g_cmdNum].helpstr[MAX_HELP_STR-1] = 0; + } + else + { + strcpy(g_cmdList[g_cmdNum].helpstr, pHelp); + } +#endif + g_cmdList[g_cmdNum].shellfunc = func; + g_cmdNum++; + return g_cmdNum; + } + else + { + printf("AddShellCmd failed, g_cmdNum=%d\r\n", g_cmdNum); + return -1; + } +} + +int ShellTask(void) +{ + int i, j, k; + int sta; + char ch, ch1; + char command[MAX_CMD_LINE]; + char cmd[MAX_CMD_LINE]; + char para1[MAX_CMD_LINE]; + char para2[MAX_CMD_LINE]; + int cmdlen, para1len, para2len; + int cmdstrlen; + + if (IsNewCommand() == 0) // + { + return -1; + } + + // õͲ + cmdstrlen = LockExecAndGetCmdStr(command); + + sta = 0; + cmdlen = 0; + para1len = 0; + para2len = 0; + + cmd[0] = 0; + para1[0] = 0; + para2[0] = 0; + + for(i = 0; i < cmdstrlen; i++) + { + ch = command[i]; +// printf("0x%x ", ch); + if (sta == 0) + { + if (cmdlen == 0 && ch == ' ') // ǰո + { + continue; + } + else if (cmdlen != 0 && ch == ' ') // ո + { + cmd[cmdlen] = 0; + sta = 1; + } + else + { + if (cmdlen < MAX_CMD_LINE-1) + { + cmd[cmdlen] = ch; + cmdlen++; + } + } + } + else if (sta == 1) + { + if (para1len == 0 && ch == ' ') // ǰո + { + continue; + } + else if (para1len != 0 && ch == ' ') // ո + { + para1[para1len] = 0; + sta = 2; + } + else + { + if (para1len < MAX_CMD_LINE-1) + { + para1[para1len] = ch; + para1len++; + } + } + } + else if (sta == 2) + { + if (para2len == 0 && ch == ' ') // ǰո + { + continue; + } + else if (para2len != 0 && ch == ' ') // ո + { + para2[para2len] = 0; + sta = 3; + } + else + { + if (para2len < MAX_CMD_LINE-1) + { + para2[para2len] = ch; + para2len++; + } + } + } + else + { + break; + } + } + + cmd[cmdlen] = 0; + para1[para1len] = 0; + para2[para2len] = 0; + +// printf("cmd=%s,para1=%s,para2=%s", cmd, para1, para2); + + ChangeToUper(cmd); + ChangeToUper(para1); + ChangeToUper(para2); + + // ִ + for (i = 0; i < g_cmdNum; i++) + { + if (strcmp(g_cmdList[i].cmdstr, cmd) == 0) + { + if (g_cmdList[i].shellfunc != NULL) + { + g_cmdList[i].shellfunc(para1, para2); + } + break; + } + } + + if (i >= g_cmdNum) // ûҵƥѰҾֲƥ + { + k = -1; + for (i = 0; i < g_cmdNum; i++) + { + for (j = 0; j < cmdlen; j++) + { + ch = cmd[j]; + ch1 = g_cmdList[i].cmdstr[j]; + if (ch == ' ' || ch == 0 || ch1 == ' ' || ch1 == 0) // + { + break; + } + + if (ch != ch1) + { + break; + } + } + + if (j == cmdlen && cmdlen != 0) // ƥ + { + k = i; + break; + } + } + + if (k >= 0) // ƥ + { + if (g_cmdList[k].shellfunc != NULL) + { + g_cmdList[k].shellfunc(para1, para2); + } + } + } + + OutNewCmdLine(); + UnlockExec(); + + return 0; +} + +//------------------------------------------------------------------------- + +// 汾 +void VersionInfo(char * para1, char * para2) +{ + char buff[VERSION_LEN+1]; + + GetVersionStr(buff); + buff[VERSION_LEN] = 0; + printf("Software Version = %s\r\n", buff); + GetBuildStr(buff); + printf("%s\r\n", buff); +} + +// +void HelpString(char * para1, char * para2) +{ + int i; + if (para1 == para2) + { + } + + for (i = 0; i < g_cmdNum; i++) + { + printf("\r\n%s\r\n", g_cmdList[i].cmdstr); + printf("\t%s\r\n", g_cmdList[i].helpstr); + } +} + +// +void CleanScreen(char * para1, char * para2) +{ + if (para1 == para2) + { + } + putchar(0x0C); // +} + +void Restart(char * para1, char * para2) +{ + RestartMcu(); +} + +void ShowHistoryCmd(char * para1, char * para2) +{ + if (para1 == NULL || para2 == NULL) + { + return; + } + + int num = GetHistoryNum(); // Ѿ洢ʷ + int maxnum = GetHistoryMaxNum(); + int rslt; + char ch[MAX_CMD_LINE]; + + printf("show all history cmd:\r\n"); + + if (num == maxnum) + { + int i = 0; + for (int idx = GetHistoryIdx(); idx < maxnum; idx++) + { + rslt = GetHistoryCmd(idx, &ch[0]); + if (rslt == 0) + { + printf("\t%d.%s\r\n", i+1, ch); + i++; + } + } + for (int idx = 0; idx < GetHistoryIdx(); idx++) + { + rslt = GetHistoryCmd(idx, &ch[0]); + if (rslt == 0) + { + printf("\t%d.%s\r\n", i+1, ch); + i++; + } + } + } + else if (num < maxnum) + { + for (int i = 0; i < num; i++) + { + rslt = GetHistoryCmd(i, &ch[0]); + if (rslt == 0) + { + printf("\t%d.%s\r\n", i+1, ch); + } + } + } +} + +//------------------------------------------------------------------------- + + +void InitShell(void) +{ + InitConsole(); // ʼ̨ + + memset(g_cmdList, 0, sizeof(ShellCmdItem)*MAX_CMD_NUM); + g_cmdNum = 0; + + // + AddShellCmd("HELP", "show the help info", HelpString); + AddShellCmd("VERSION", "show the version info", VersionInfo); +// AddShellCmd("CLS", "clean the screen", CleanScreen); + AddShellCmd("REBOOT", "reboot the mcu", Restart); + +// AddShellCmd("HISTORY", "show all history cmd", ShowHistoryCmd); + +} diff --git a/NxBase/shell.h b/NxBase/shell.h new file mode 100644 index 0000000..f815548 --- /dev/null +++ b/NxBase/shell.h @@ -0,0 +1,36 @@ + +#ifndef __SHELL_H__ +#define __SHELL_H__ + +#include "console.h" + +//-------------------------------------------------------- +#ifndef MAX_CMD_NUM +#define MAX_CMD_NUM 32 +#endif + +#define MAX_CMD_STR 12 +#define MAX_HELP_STR 24 + +typedef void (*ShellFunc)(char *, char *); + +typedef struct +{ + char cmdstr[MAX_CMD_STR]; +// char helpstr[MAX_HELP_STR]; + const char * helpstr; // Ϊָ + + ShellFunc shellfunc; +}ShellCmdItem; + +//-------------------------------------------------------- + +void InitShell(void); +int ShellTask(void); +void ChangeToUper(char * str); + +int AddShellCmd(const char*pCmd, const char*pHelp, ShellFunc func); + +//-------------------------------------------------------- + +#endif diff --git a/NxBase/spirw.c b/NxBase/spirw.c new file mode 100644 index 0000000..2ca8c6f --- /dev/null +++ b/NxBase/spirw.c @@ -0,0 +1,199 @@ + +#include "spirw.h" + +#ifndef SOFT_SPI1 +#define SOFT_SPI1 0 +#endif + +#ifndef SOFT_SPI2 +#define SOFT_SPI2 0 +#endif + +#ifndef SOFT_SPI3 +#define SOFT_SPI3 0 +#endif + +#ifndef SOFT_SPI4 +#define SOFT_SPI4 0 +#endif + +#define SPIRW_PROC(spi) \ +u8 g_spi##spi##InitFlag = 0; \ +void InitSpi##spi(void) \ +{ \ + LL_SPI_Enable(SPI##spi); \ + g_spi##spi##InitFlag = 1; \ +} \ +u8 IsSpi##spi##Inited(void) \ +{ \ + return g_spi##spi##InitFlag; \ +} \ +/* \ +// : SPI1ֽ \ +// : dat, ͵ \ +// : \ +// ˵: \ +*/ \ +u8 Spi##spi##SwapByte(u8 dat) \ +{ \ + while (LL_SPI_IsActiveFlag_TXE(SPI##spi) == 0); /* ȴݼĴ */ \ + LL_SPI_TransmitData8(SPI##spi, dat); \ + while (LL_SPI_IsActiveFlag_RXNE(SPI##spi) == 0); /* ȴ--ʱҲ */ \ + return LL_SPI_ReceiveData8(SPI##spi); \ +} \ + \ +/* ֽ */ \ +void Spi##spi##WriteByte(u8 txData) \ +{ \ + Spi##spi##SwapByte(txData); \ +} \ + \ +/* ֽ */ \ +u8 Spi##spi##ReadByte(void) \ +{ \ + return Spi##spi##SwapByte(0xff); \ +} \ +/* \ +// : SPI1 \ +// : dat, ͵ \ +// : \ +// ˵: \ +*/ \ +u16 Spi##spi##SwapWord(u16 dat) \ +{ \ + while (LL_SPI_IsActiveFlag_TXE(SPI##spi) == 0); /* ȴݼĴ */ \ + LL_SPI_TransmitData16(SPI##spi, dat); \ + while (LL_SPI_IsActiveFlag_RXNE(SPI##spi) == 0); /* ȴ--ʱҲ */ \ + return LL_SPI_ReceiveData16(SPI##spi); \ +} \ + \ +/* */ \ +void Spi##spi##WriteWord(u16 txData) \ +{ \ + Spi##spi##SwapWord(txData); \ +} \ + \ +/* */ \ +u16 Spi##spi##ReadWord(void) \ +{ \ + return Spi##spi##SwapWord(0xffff); \ +} \ +//------ + +#define SOFT_SPIRW_PROC(spi) \ +u8 g_spi##spi##InitFlag = 0; \ +void InitSpi##spi(void) \ +{ \ + g_spi##spi##InitFlag = 1; \ +} \ +u8 IsSpi##spi##Inited(void) \ +{ \ + return g_spi##spi##InitFlag; \ +} \ +/* \ +// : SPI1ֽ \ +// : dat, ͵ \ +// : \ +*/ \ +u8 Spi##spi##SwapByte(u8 dat) \ +{/* ģ׼SPI,CLKضд */ \ + u8 rslt, mod; \ + rslt = 0; \ + mod = 0x80; \ +\ + Spi##spi##ClockLow(); \ +\ + for (int i = 0; i < 8; i++) \ + { \ + /* ú */ \ + if ((dat & mod) != 0) \ + { \ + Spi##spi##MdoWrite(DAT_ONE); \ + } \ + else \ + { \ + Spi##spi##MdoWrite(DAT_ZERO); \ + } \ + /* ׼,CLK */ \ + Spi##spi##ClockHigh(); \ +\ + if(Spi##spi##MdiRead() == DAT_ONE) /* ȡ */ \ + { \ + rslt |= mod; \ + } \ + mod >>= 1; \ +\ + Spi##spi##ClockLow(); \ + } \ + return rslt; \ +} \ + \ +/* ֽ */ \ +void Spi##spi##WriteByte(u8 txData) \ +{ \ + Spi##spi##SwapByte(txData); \ +} \ + \ +/* ֽ */ \ +u8 Spi##spi##ReadByte(void) \ +{ \ + return Spi##spi##SwapByte(0xff); \ +} \ +/* \ +// : SPI1 \ +// : dat, ͵ \ +// : \ +*/ \ +u16 Spi##spi##SwapWord(u16 dat) \ +{ \ + return 0;\ +} \ + \ +/* */ \ +void Spi##spi##WriteWord(u16 txData) \ +{ \ + Spi##spi##SwapWord(txData); \ +} \ + \ +/* */ \ +u16 Spi##spi##ReadWord(void) \ +{ \ + return Spi##spi##SwapWord(0xffff); \ +} \ +//------ + +//-------------------- +#ifdef SRW_SPI1 +#if (SOFT_SPI1 == 0) +SPIRW_PROC(1); +#else +SOFT_SPIRW_PROC(1); +#endif +#endif + +#ifdef SRW_SPI2 +#if (SOFT_SPI2 == 0) +SPIRW_PROC(2); +#else +SOFT_SPIRW_PROC(2); +#endif +#endif + +#ifdef SRW_SPI3 +#if (SOFT_SPI3 == 0) +SPIRW_PROC(3); +#else +SOFT_SPIRW_PROC(3); +#endif +#endif + +#ifdef SRW_SPI4 +#if (SOFT_SPI4 == 0) +SPIRW_PROC(4); +#else +SOFT_SPIRW_PROC(4); +#endif +#endif + + + diff --git a/NxBase/spirw.h b/NxBase/spirw.h new file mode 100644 index 0000000..430d7b5 --- /dev/null +++ b/NxBase/spirw.h @@ -0,0 +1,56 @@ + +#ifndef __SPIRW_H__ +#define __SPIRW_H__ + +#include "config.h" + +#if (SOFT_SPI1 != 0) +#include "inout.h" +#endif + +#define SPI_FUNC_DEF(spi) \ +\ +/* ʼSPI */ \ +void InitSpi##spi(void); \ +\ +/* ǷѾʼ */\ +u8 IsSpi##spi##Inited(void);\ +/* ֽ */ \ +u8 Spi##spi##SwapByte(u8 dat); \ +/* ֽ */ \ +void Spi##spi##WriteByte(u8 txData); \ +/* ֽ */ \ +u8 Spi##spi##ReadByte(void); \ +\ +/* */ \ +u16 Spi##spi##SwapWord(u16 dat); \ +/* */ \ +void Spi##spi##WriteWord(u16 txData); \ +/* */ \ +u16 Spi##spi##ReadWord(void); \ +//------ + +#ifdef SRW_SPI1 +SPI_FUNC_DEF(1); +#endif + +#ifdef SRW_SPI2 +SPI_FUNC_DEF(2); +#endif + + +#ifdef SRW_SPI3 +SPI_FUNC_DEF(3); +#endif + + +#ifdef SRW_SPI4 +SPI_FUNC_DEF(4); +#endif + + + + + + +#endif diff --git a/NxBase/trigger.c b/NxBase/trigger.c new file mode 100644 index 0000000..9171a58 --- /dev/null +++ b/NxBase/trigger.c @@ -0,0 +1,238 @@ + +#define _IN_TRIGGER_C +#include "trigger.h" +#include "iwdog.h" + +//------------------------------------------------------- + +//------------------------------------------------------- + +//------------------------------------------------------- + + +#define TRIGGER_TIME 10 // 10 + +#define MS_SYS_TICK (SYSCLK/1000) + +#define US100_SYS_TICK (SYSCLK/10000) + +#define US_SYS_TICK (SYSCLK/1000000) + +#define NS100_SYS_TICK (SYSCLK/10000000) + +//------------------------------------------------------- + +//#define SYS_TICK_NUM MS_SYS_TICK + +int volatile g_mstimer = 0; // 1ms++ + +//------------------------------------------------------- + +int g_triggerListNum = 0; +TriggerCtrl g_triggerCtrlList[MAX_TRIGGER_TASK]; + +u32 volatile g_triggerTimer = 0; // ÿ10ms++ +int g_triggerTask = 0; +int g_triggerInited = 0; + +//------------------------------------------------------- + +void InitTrigger(void) +{ + if (g_triggerInited == 0) + { + SysTick_Config(MS_SYS_TICK); // ϵͳʱӲ1msж + NVIC_SetPriority(SysTick_IRQn, 0); + + g_mstimer = 0; + + // + g_triggerListNum = 0; + memset(&g_triggerCtrlList, 0, sizeof(TriggerCtrl)*MAX_TRIGGER_TASK); + + g_triggerTimer = 0; + g_triggerTask = 0; + g_triggerInited = 1; + + InitIWDog(1000); // 1븴λŹ + } +} + +int AddTriggerToList(int gapms, TriggerFunc exf, TriggerFunc tskf) +{ + int rslt; + + if (gapms <= 0) + { + gapms = 1; + } + + // ȡ +// gapms = (gapms + (TRIGGER_TIME-1)) / TRIGGER_TIME; +// gapms *= TRIGGER_TIME; + + if (g_triggerInited != 0 && g_triggerListNum < MAX_TRIGGER_TASK && gapms != 0) + { + g_triggerCtrlList[g_triggerListNum].triggerTimer = gapms; + g_triggerCtrlList[g_triggerListNum].triggerExFunc = exf; + g_triggerCtrlList[g_triggerListNum].triggerTaskFunc = tskf; + rslt = g_triggerListNum; + g_triggerListNum++; + } + else + { + printf("AddTriggerToList failed, g_triggerInited=%d, g_triggerListNum = %d, gap=%d\r\n", g_triggerInited, g_triggerListNum, gapms); + rslt = -1; + } + + return rslt; +} + +void TriggerExTask(void) +{ + int i; + if (g_triggerInited != 0) + { + for (i = 0; i < g_triggerListNum; i++) + { + if ((g_mstimer % g_triggerCtrlList[i].triggerTimer) == 0) + { + if (g_triggerCtrlList[i].triggerExFunc != NULL) + { + g_triggerCtrlList[i].triggerExFunc(); + } + if (g_triggerCtrlList[i].triggerTaskFunc != NULL) + { + g_triggerCtrlList[i].triggerTask = 1; + g_triggerTask = 1; + } + } + } + } +} + +#if (TRIGGER_MAXTIM > 0) +// ʱ +void TriggerTask(void) +{ + static int index = 0; + int i = 0; + if (g_triggerInited != 0 && g_triggerTask != 0) + { + u32 timer = GetUsSoftTimer(); + for (i = index; i < g_triggerListNum; i++) + { + if (g_triggerCtrlList[i].triggerTask != 0) + { + g_triggerCtrlList[i].triggerTask = 0; + g_triggerCtrlList[i].triggerTaskFunc(); + } + if (GetUsSoftTimer() - timer > TRIGGER_MAXTIM) + { + //printf("TriggerTask use > 1ms, break\r\n"); + i++; + break; + } + } + if (i >= g_triggerListNum) + { + i = 0; + } + index = i; + } +} +#else +// ʱ +void TriggerTask(void) +{ + int i; + if (g_triggerInited != 0 && g_triggerTask != 0) + { + for (i = 0; i < g_triggerListNum; i++) + { + if (g_triggerCtrlList[i].triggerTask != 0) + { + g_triggerCtrlList[i].triggerTask = 0; + g_triggerCtrlList[i].triggerTaskFunc(); + } + } + } +} +#endif + +// 1ms ж +void TriggerIntProc(void) +{ + g_mstimer++; + TriggerExTask(); + if ((g_mstimer%TRIGGER_TIME) == 0) // ÿ10msִһ + { + g_triggerTimer++; + FeedIWDog(); // ιŹ + } +} + +u32 GetTickTimer(void) +{ + return SysTick->VAL; +} + +// õʱ, λ100ns +u32 Get100NsSoftTimer(void) +{ + u32 val, stim, stim2; + stim = g_mstimer; // ȡ + val = SysTick->VAL; + stim2 = g_mstimer; // ٴζȡ + if (stim != stim2) // ͬ, ˵мж + { + val = SysTick->VAL; // ¶ȡ + stim = stim2; + } + + return (stim + 1) * 10000 - ((val+1) / NS100_SYS_TICK); +} + +// õʱ, λ1us +u32 GetUsSoftTimer(void) +{ + u32 volatile val, stim, stim2; + stim = g_mstimer; // ȡ + val = SysTick->VAL; + stim2 = g_mstimer; // ٴζȡ + if (stim != stim2) // ͬ, ˵мж + { + val = SysTick->VAL; // ¶ȡ + stim = stim2; + } + + return (stim + 1) * 1000 - ((val+1) / US_SYS_TICK); +} + +// õʱ, λ0.1ms +u32 Get100UsSoftTimer(void) +{ + u32 volatile val, stim, stim2; + stim = g_mstimer; // ȡ + val = SysTick->VAL; + stim2 = g_mstimer; // ٴζȡ + if (stim != stim2) // ͬ, ˵мж + { + val = SysTick->VAL; // ¶ȡ + stim = stim2; + } + return (stim + 1)* 10 - ((val+1) / US100_SYS_TICK); +} + +// õʱ, λ1ms +u32 GetMsSoftTimer(void) +{ + return g_mstimer; +} + +// õʱ, λ:1ms :10ms +u32 GetMsSoftTimer10(void) +{ + return g_mstimer; +// return g_triggerTimer*TRIGGER_TIME; +} diff --git a/NxBase/trigger.h b/NxBase/trigger.h new file mode 100644 index 0000000..e4043b7 --- /dev/null +++ b/NxBase/trigger.h @@ -0,0 +1,70 @@ + +#ifndef __TRIGGER_H__ +#define __TRIGGER_H__ + +#include "config.h" + +//--------------------------------------------------------------------------- + + +//--------------------------------------------------------------------------- + +typedef void (*TriggerFunc)(void); + +typedef struct +{ + u32 triggerTimer; // ʱֵ + + TriggerFunc triggerExFunc; // ִкִУûӳ٣ռʱ̫ + int triggerTask; // ־ + TriggerFunc triggerTaskFunc; // 񣬿ܻӳ٣ + +}TriggerCtrl; + +#ifndef MAX_TRIGGER_TASK +#define MAX_TRIGGER_TASK 10 +#endif + +/* + * 20220726 + * ʱ񵥴ִĵʱ,ʱ򲻼ִ,´ִ + * λus + * Ϊ˱ⵥִĵʱ̫,Ӱ쵽 + */ +#ifndef TRIGGER_MAXTIM +#define TRIGGER_MAXTIM (0) +#endif + +//--------------------------------------------------------------------------- + +void InitTrigger(void); + +void TriggerIntProc(void); +void TriggerTask(void); + +// Ӵ¼б +int AddTriggerToList(int gapms, TriggerFunc exf, TriggerFunc tskf); + +u32 GetTickTimer(void); + +// õʱ, λ100ns +u32 Get100NsSoftTimer(void); + +// õʱ, λ1us +u32 GetUsSoftTimer(void); + +// õʱ, λ0.1ms +u32 Get100UsSoftTimer(void); + +// õʱ, λ1ms:1ms +u32 GetMsSoftTimer(void); + +// õʱ, λ:1ms :10ms +u32 GetMsSoftTimer10(void); + + + +//--------------------------------------------------------------------------- + + +#endif diff --git a/NxFuncs/README.md b/NxFuncs/README.md new file mode 100644 index 0000000..f0a4e0d --- /dev/null +++ b/NxFuncs/README.md @@ -0,0 +1 @@ +NxFuncs diff --git a/NxFuncs/closedriver/drivermotion.c b/NxFuncs/closedriver/drivermotion.c new file mode 100644 index 0000000..2357e02 --- /dev/null +++ b/NxFuncs/closedriver/drivermotion.c @@ -0,0 +1,486 @@ + + +#include "drivermotion.h" + +#if (DEV_MOTIONS_NUM > 0) + +//---------------------------------------------------------------- + +// ּ˶Ƶļ + +#ifndef CALC_TIMES_PER_SEC +#define CALC_TIMES_PER_SEC (10000) // ÿӼ +#endif + +#ifndef USE_FLOAT_CALC +#define USE_FLOAT_CALC 1 // 0, , 1, +#endif + +#if (USE_FLOAT_CALC == 1) +#define CALC_TYPE float +#define CALC_MUTI 1.0f +#else + +#define CALC_TYPE s32 +#define CALC_MUTI 10000 + +#endif + + +//---------------------------------------------------------------- + + + +typedef struct +{ + // + CALC_TYPE startSpd; // ֹͣٶ + CALC_TYPE runSpd; // ˶ٶ + CALC_TYPE runAdd; // ͣٶ + CALC_TYPE brkAdd; // ɲٶ + + u32 funTestTime; // йⲿʱ 0:ⲿ (λ:0.1ms) + + // ָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣͣٶȽ٣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȽ٣ + u32 condPara1, condPara2; // + + int blockRunflag; // б־, =1,ͬ˶ =0,,첽˶ + void (*ExecWhenRun)(void); // йִеĺ + void (*ExecWhenStart)(void); // ʱִеĺ + void (*ExecWhenStop)(void); // ֹͣʱִеĺ + void (*DelayWhenBlock)(u32); // ʱDelay + +//--------------------- + + // ״̬ + int runState; // ״̬ + s32 realpos; // + int startrunflag; // б־ + int stopflag; // ֹͣ־ + + //--------------------- + + // Ʊ + int rundir; // з + u32 totalNums; // ˶ + u32 pulseCount; // ǰ + u32 decPos; // ٵλ + + u32 funTestCount; // йⲿʱ + + CALC_TYPE currentSpd; // ǰٶ + CALC_TYPE currentAcc; // ǰٶ + CALC_TYPE currentPos; // ǰλ + //--------------------- + +} DriverMotionCtrl; + +DriverMotionCtrl g_drvMotionsCtrlList[DEV_MOTIONS_NUM]; + +//---------------------------------------------------------------- +// ּ + +void IntegrationMotionCalc(DriverMotionCtrl * pCtrl) +{ + if (pCtrl == NULL || + 0 ) + { + return; + } + + if (pCtrl->runState <= DRV_MOTION_STOP || + pCtrl->startrunflag <= 0) // ֹͣ״̬ + { + return; // ִ + } + + if (pCtrl->stopflag != 0) + { + if (pCtrl->stopflag == 1) + { + pCtrl->currentAcc = pCtrl->runAdd; // ǰٶ + pCtrl->runState = DRV_MOTION_NSTOP; + } + else + { + pCtrl->currentAcc = pCtrl->brkAdd; // ǰٶ + pCtrl->runState = DRV_MOTION_ESTOP; + } + } + + if (pCtrl->funTestTime > 0) // + { + pCtrl->funTestCount++; // + if ((pCtrl->funTestCount >= pCtrl->funTestTime) && // ˲ʱ + 1 ) + { + pCtrl->funTestCount = 0; + if (pCtrl->GetNormalStop != NULL) // һֹͣ + { + if ((pCtrl->runState == DRV_MOTION_ADD) || // + (pCtrl->runState == DRV_MOTION_RUN) || // + (pCtrl->runState == DRV_MOTION_DEC) || // + 0 ) + { + if (pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2) != 0) + { + pCtrl->currentAcc = pCtrl->runAdd; // ǰٶ + pCtrl->runState = DRV_MOTION_NSTOP; // ͨͣ + } + } + } + if (pCtrl->GetQuickStop != NULL) // ֹͣ + { + if ((pCtrl->runState == DRV_MOTION_ADD) || // + (pCtrl->runState == DRV_MOTION_RUN) || // + (pCtrl->runState == DRV_MOTION_DEC) || // + (pCtrl->runState == DRV_MOTION_ESTOP) || // ͣ + 0 ) + { + if (pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2) != 0) + { + pCtrl->currentAcc = pCtrl->brkAdd; // ǰٶ + pCtrl->runState = DRV_MOTION_ESTOP; // ͣͣ + } + } + } + if (pCtrl->ExecWhenRun != NULL) // йִеĺ + { + pCtrl->ExecWhenRun(); + } + } + } + + // + if (pCtrl->runState == DRV_MOTION_ADD) + { + pCtrl->currentSpd += pCtrl->currentAcc; // ı䵱ǰٶ + if (pCtrl->currentSpd >= pCtrl->runSpd) // ǰٶȴٶ,״̬ + { + pCtrl->runState = DRV_MOTION_RUN; + pCtrl->currentSpd = pCtrl->runSpd; + pCtrl->decPos = (pCtrl->totalNums - pCtrl->pulseCount); // ٵλ + } + } + + // + if (pCtrl->runState == DRV_MOTION_DEC) // + { + pCtrl->currentSpd -= pCtrl->currentAcc; // ǰٶ + if (pCtrl->currentSpd <= pCtrl->startSpd) + { + pCtrl->currentSpd = pCtrl->startSpd; + } + } + + // ͣ + if ((pCtrl->runState == DRV_MOTION_NSTOP) || // ͣ + (pCtrl->runState == DRV_MOTION_ESTOP) || // ɲ + 0 ) + { + pCtrl->currentSpd -= pCtrl->currentAcc; // ǰٶ + if (pCtrl->currentSpd <= pCtrl->startSpd) // ǰٶСٶ,ֹͣ״̬ + { + pCtrl->currentSpd = pCtrl->startSpd; + pCtrl->runState = DRV_MOTION_STOPING; + } + } + + // λü + { + pCtrl->currentPos += pCtrl->currentSpd * pCtrl->rundir; // ٶȻ + if (pCtrl->currentPos > CALC_MUTI || pCtrl->currentPos < -CALC_MUTI) // λƳ + { + int ofst = (int)(pCtrl->currentPos/CALC_MUTI); // λƫ + pCtrl->currentPos -= ofst*CALC_MUTI; + pCtrl->realpos += ofst; // λøı + pCtrl->pulseCount += abs(ofst); // ֵ + } + } + + // ֹͣ + { + if ((pCtrl->pulseCount >= pCtrl->totalNums) || // + (pCtrl->runState <= DRV_MOTION_STOP) || // ֹͣź + (pCtrl->runState == DRV_MOTION_STOPING) || // ֹͣ + 0 ) + { + if (pCtrl->runState > DRV_MOTION_STOP) // ״̬ + { + pCtrl->runState = DRV_MOTION_STOP; // Ϊر״̬ + pCtrl->startrunflag = 0; // رб־ + if (pCtrl->ExecWhenStop != NULL) // ִйرʱĺ + { + pCtrl->ExecWhenStop(); + } + } + } + else + { + if ( (pCtrl->runState == DRV_MOTION_ADD) && // ״̬ + (pCtrl->pulseCount >= (pCtrl->totalNums>>1)) && // λƵһ + 1 ) + { + pCtrl->runState = DRV_MOTION_RUN; + pCtrl->currentAcc = pCtrl->runAdd; // ǰٶ + pCtrl->decPos = pCtrl->pulseCount; +#if (0) +#if (USE_FLOAT_CALC == 0) + printf("enter dec, spd=%d\r\n", pCtrl->currentSpd); +#else +#endif +#endif + } + + if ( (pCtrl->runState == DRV_MOTION_RUN) && // + (pCtrl->pulseCount >= pCtrl->decPos) && // ڽٵ + 1 ) + { + pCtrl->runState = DRV_MOTION_DEC; + pCtrl->currentAcc = pCtrl->runAdd; // ǰٶ + } + } + } +} + +CALC_TYPE pps_to_ppg(s32 pps) +{ + return pps*CALC_MUTI / CALC_TIMES_PER_SEC; +} + +//---------------------------------------------------------------- +// ˶ƣֹͣ״̬ʱã +int DrvMotionStart(int driverIdx, DrvMotionPara * pPara) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + printf("DrvMotionStart fail, driverIdx error\r\n"); + return -1; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + if (pPara == NULL) + { + printf("DrvMotionStart fail, pPara is NULL\r\n"); + return -1; + } + + if (pCtrl->runState <= DRV_MOTION_STOP) // ͣ/״̬ + { + pCtrl->startrunflag = 0; // رб־ + + if (pPara->movement == 0) // + { + pCtrl->runState = DRV_MOTION_STOP; + printf("driverIdx=%d, movement=0\r\n", driverIdx); + pCtrl->rundir = 0; + return 0; + } + + if (pPara->startPPS < 10) + { + pPara->startPPS = 10; + } + if (pPara->runPPS < 10) + { + pPara->runPPS = 10; + } + if (pPara->startPPS > pPara->runPPS) + { + pPara->startPPS = pPara->runPPS; + } + if (pPara->addPPSS < 1) + { + pPara->addPPSS = 1; + } + + // ٶȲ + pCtrl->startSpd = pps_to_ppg(pPara->startPPS); // ֹͣٶ + pCtrl->runSpd = pps_to_ppg(pPara->runPPS); // ˶ٶ + pCtrl->runAdd = pps_to_ppg(pPara->addPPSS); // ͣٶ + pCtrl->brkAdd = pps_to_ppg(pPara->brkPPSS); // ɲٶ + + pCtrl->currentSpd = pCtrl->startSpd; // ǰٶ + pCtrl->currentAcc = pCtrl-> runAdd; // ǰٶ + pCtrl->currentPos = 1; // ǰλ, һ + pCtrl->runState = DRV_MOTION_ADD; // ״̬, + + pCtrl->funTestTime = pPara->funTestTime; + pCtrl->funTestCount = 0; // йⲿʱ + + // ָ + pCtrl->GetNormalStop = pPara->GetNormalStop; // һֹͣ + pCtrl->GetQuickStop = pPara->GetQuickStop; // ֹͣ + pCtrl->condPara1 = pPara->condPara1; // + pCtrl->condPara2 = pPara->condPara2; // + + pCtrl->blockRunflag = pPara->blockRunflag; // б־ + pCtrl->ExecWhenStart = pPara->ExecWhenStart; // ʱִеĺ + pCtrl->ExecWhenRun = pPara->ExecWhenRun; // йִеĺ + pCtrl->ExecWhenStop = pPara->ExecWhenStop; // ֹͣʱִеĺ + pCtrl->DelayWhenBlock = pPara->DelayWhenBlock; // ʱִеĺ + + if (pCtrl->ExecWhenStart != NULL) // ǰִ + { + pCtrl->ExecWhenStart(); + } + //--------------------- + // λ + pCtrl->rundir = (pPara->movement > 0) ? 1:-1; // + pCtrl->totalNums = abs(pPara->movement); // λ + pCtrl->pulseCount = 0; // + pCtrl->decPos = pCtrl->totalNums; // λ + + // + pCtrl->stopflag = 0; + pCtrl->startrunflag = 1; // б־ + + return DrvMotionRun(driverIdx); + } + else + { + printf("DrvMotionStart failed, drv%d is running\r\n", driverIdx); + return -2; // + } +} + +// ֹͣ˶ƣ˶ʱõ +void DrvMotionStop(int driverIdx) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + pCtrl->stopflag = 1; +} + +// ֹͣ˶ƣ˶ʱõ +void DrvMotionBreak(int driverIdx) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + pCtrl->stopflag = 2; +} + + +int DrvMotionRun(int driverIdx) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return -1; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + // ѭ + do + { + if (pCtrl->runState <= DRV_MOTION_STOP) + { + break; + } + + if (pCtrl->blockRunflag == 0) // б־ + { + break; + } + + if (pCtrl->DelayWhenBlock != NULL) + { + pCtrl->DelayWhenBlock(0); + } + + }while(1); + + return pCtrl->runState; +} + +// õ˶״̬˶ʱõ +int GetDrvMotionState(int driverIdx) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return 0; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + return pCtrl->runState; +} + +// õǰ˶λã˶ʱõ +s32 GetDrvMotionRealPos(int driverIdx) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return 0; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + return pCtrl->realpos; +} + +// õǰ˶λãֹͣ״̬ʱã +// ֹӦòʹô˴,õ,ʹResetDriverPos +void SetDrvMotionRealPos(int driverIdx, s32 pos) +{ + DriverMotionCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DEV_MOTIONS_NUM) + { + return ; + } + + pCtrl = &(g_drvMotionsCtrlList[driverIdx]); + + pCtrl->realpos = pos; +// printf("set drv%d realpos to %d\r\n", driverIdx+1, pos); +} + +//---------------------------------------------------------------- + +// ʼ +void InitDrvMotions(void) +{ + memset(&g_drvMotionsCtrlList, 0, sizeof(DriverMotionCtrl)*DEV_MOTIONS_NUM); + + // +} + +// +void DrvMotionCalcProc(void) +{ + DriverMotionCtrl * pCtrl; + int i; + for (i = 0; i < DEV_MOTIONS_NUM; i++) + { + pCtrl = &(g_drvMotionsCtrlList[i]); + IntegrationMotionCalc(pCtrl); + } +} + +//---------------------------------------------------------------- + + + + + +#endif + diff --git a/NxFuncs/closedriver/drivermotion.h b/NxFuncs/closedriver/drivermotion.h new file mode 100644 index 0000000..0ebea88 --- /dev/null +++ b/NxFuncs/closedriver/drivermotion.h @@ -0,0 +1,75 @@ + +#ifndef __DRIVERMOTION_H__ +#define __DRIVERMOTION_H__ + +#include "config.h" + +#define DEV_MOTIONS_NUM DRIVERS_NUM // ˶ + +// ˶ +typedef struct +{ + // + s32 movement; // λ + + u32 startPPS; // ٶȣλ/룩 + u32 runPPS; // ˶ٶȣλ/룩 + u32 addPPSS; // ͣٶȣλ/룩 + u32 brkPPSS; // ɲٶȣλ/룩 + + u32 funTestTime; // йⲿʱ 0:ⲿ (λ:0.1ms) + + // ָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣͣٶȽ٣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȽ٣ + u32 condPara1, condPara2; // + + int blockRunflag; // б־, =1,ͬ˶ =0,,첽˶ + void (*ExecWhenRun)(void); // йִеĺ + void (*ExecWhenStart)(void); // ʱִеĺ + void (*ExecWhenStop)(void); // ֹͣʱִеĺ + void (*DelayWhenBlock)(u32); // ʱDelay(Ϊٶģʽʱ˶ʱҪ˴Ϊ,޷ѭ) +}DrvMotionPara; + + + +//------------------------------------------------------------------------------- + +//--------------------------------------------------------------- + +void InitDrvMotions(); +void DrvMotionCalcProc(); + +//------------------------------- + +int DrvMotionStart(int driverIdx, DrvMotionPara * pPara); // ˶ƣֹͣ״̬ʱã +void DrvMotionStop(int driverIdx); // ֹͣ˶ƣ˶ʱõ +void DrvMotionBreak(int driverIdx); // ֹͣ˶ƣ˶ʱõ +int DrvMotionRun(int driverIdx); // к +int GetDrvMotionState(int driverIdx); // õ˶״̬˶ʱõ +s32 GetDrvMotionRealPos(int driverIdx); // õǰ˶λã˶ʱõ +void SetDrvMotionRealPos(int driverIdx, s32 pos); // õǰ˶λãֹͣ״̬ʱã + +//------------------------------- + +// ˶״̬ +#define DRV_MOTION_ERR -1 // 쳣 +#define DRV_MOTION_STOP 0 // ֹͣ +#define DRV_MOTION_ADD 1 // +#define DRV_MOTION_RUN 2 // +#define DRV_MOTION_DEC 3 // () +#define DRV_MOTION_NSTOP 4 // ͣ(ͣ) +#define DRV_MOTION_ESTOP 5 // ɲ(ɲ) +#define DRV_MOTION_STOPING 6 // ֹͣ + + +//------------------------------- + + + + + + + +#endif + diff --git a/NxFuncs/closedriver/driverparas.c b/NxFuncs/closedriver/driverparas.c new file mode 100644 index 0000000..317524c --- /dev/null +++ b/NxFuncs/closedriver/driverparas.c @@ -0,0 +1,398 @@ + + +#define _IN_DRIVERPARAS_C +#include "driverparas.h" + +#if (DRIVERS_NUM > 0) + +#if (DRIVER_PARA == DRIVER_PARA_ST) + +DriverPara g_defPara[DRIVERS_NUM]; + +#endif + + +#ifndef DEF_DRV1_CTRLMODE +#define DEF_DRV1_CTRLMODE CTRLMODE_OPEN +#endif + +#ifndef DEF_DRV2_CTRLMODE +#define DEF_DRV2_CTRLMODE CTRLMODE_OPEN +#endif + +#ifndef DEF_DRV3_CTRLMODE +#define DEF_DRV3_CTRLMODE CTRLMODE_OPEN +#endif + +#ifndef DEF_DRV4_CTRLMODE +#define DEF_DRV4_CTRLMODE CTRLMODE_OPEN +#endif + +#ifndef DEF_DRV1_STEPCIRCLE +#define DEF_DRV1_STEPCIRCLE 4000 +#endif + +#ifndef DEF_DRV2_STEPCIRCLE +#define DEF_DRV2_STEPCIRCLE 4000 +#endif + +#ifndef DEF_DRV3_STEPCIRCLE +#define DEF_DRV3_STEPCIRCLE 4000 +#endif + +#ifndef DEF_DRV4_STEPCIRCLE +#define DEF_DRV4_STEPCIRCLE 4000 +#endif + +void InitDriverParas(void) +{ +#if (DRIVER_PARA == DRIVER_PARA_NOR) + InitNorParas(); + +#if (DRIVERS_NUM >= 1) + SetNorParaList(DRIVER1_PARA_BLOCK, (void*)&g_defDriverParaList); // òб + SetNorParaNameString(DRIVER1_PARA_BLOCK, (void*)&g_driverParaStrList); // òб + + if (GetNorParaEn(DRIVER1_PARA_BLOCK) != PARA_VALID) // Ч,ʹĬϲ + { + printf("driver 1 load default para\r\n"); + LoadNorDefPara(DRIVER1_PARA_BLOCK); + if (DEF_DRV1_CTRLMODE == CTRLMODE_OPEN || DEF_DRV1_CTRLMODE == CTRLMODE_CLOSE) + { + GetDriverParas(0)->closeCtrlMode = DEF_DRV1_CTRLMODE; + } + GetDriverParas(0)->stepPerCircle = DEF_DRV1_STEPCIRCLE; +#ifdef DEF_DRV1_CLOSECIRCLE + GetDriverParas(0)->closeCircle = DEF_DRV1_CLOSECIRCLE; +#endif +#ifdef DEF_DRV1_KP + GetDriverParas(0)->kp = DEF_DRV1_KP; +#endif +#ifdef DEF_DRV1_KI + GetDriverParas(0)->ki = DEF_DRV1_KI; +#endif +#ifdef DEF_DRV1_BASECIRCLE + GetDriverParas(0)->basecircle = DEF_DRV1_BASECIRCLE; +#endif + SaveNorParas(DRIVER1_PARA_BLOCK); + } + + if (GetDriverParas(0)->stepPerCircle != DEF_DRV1_STEPCIRCLE || + GetDriverParas(0)->closeCtrlMode != DEF_DRV1_CTRLMODE || + 0) + { + GetDriverParas(0)->stepPerCircle = DEF_DRV1_STEPCIRCLE; + GetDriverParas(0)->closeCtrlMode = DEF_DRV1_CTRLMODE; + SaveNorParas(DRIVER1_PARA_BLOCK); + } + + CheckParaRange(DRIVER1_PARA_BLOCK); // вΧ +#endif + +#if (DRIVERS_NUM >= 2) + SetNorParaList(DRIVER2_PARA_BLOCK, (void*)&g_defDriverParaList); // òб + SetNorParaNameString(DRIVER2_PARA_BLOCK, (void*)&g_driverParaStrList); // òб + + if (GetNorParaEn(DRIVER2_PARA_BLOCK) != PARA_VALID) // Ч,ʹĬϲ + { + printf("driver 2 load default para\r\n"); + LoadNorDefPara(DRIVER2_PARA_BLOCK); + if (DEF_DRV2_CTRLMODE == CTRLMODE_OPEN || DEF_DRV2_CTRLMODE == CTRLMODE_CLOSE) + { + GetDriverParas(1)->closeCtrlMode = DEF_DRV2_CTRLMODE; + } + GetDriverParas(1)->stepPerCircle = DEF_DRV2_STEPCIRCLE; +#ifdef DEF_DRV2_CLOSECIRCLE + GetDriverParas(1)->closeCircle = DEF_DRV2_CLOSECIRCLE; +#endif +#ifdef DEF_DRV2_KP + GetDriverParas(1)->kp = DEF_DRV2_KP; +#endif +#ifdef DEF_DRV2_KI + GetDriverParas(1)->ki = DEF_DRV2_KI; +#endif +#ifdef DEF_DRV2_BASECIRCLE + GetDriverParas(1)->basecircle = DEF_DRV2_BASECIRCLE; +#endif + SaveNorParas(DRIVER2_PARA_BLOCK); + } + + if (GetDriverParas(1)->stepPerCircle != DEF_DRV2_STEPCIRCLE || + GetDriverParas(1)->closeCtrlMode != DEF_DRV2_CTRLMODE || + 0) + { + GetDriverParas(1)->stepPerCircle = DEF_DRV2_STEPCIRCLE; + GetDriverParas(1)->closeCtrlMode = DEF_DRV2_CTRLMODE; + SaveNorParas(DRIVER2_PARA_BLOCK); + } + + CheckParaRange(DRIVER2_PARA_BLOCK); // вΧ +#endif + +#if (DRIVERS_NUM >= 3) + SetNorParaList(DRIVER3_PARA_BLOCK, (void*)&g_defDriverParaList); // òб + SetNorParaNameString(DRIVER3_PARA_BLOCK, (void*)&g_driverParaStrList); // òб + + if (GetNorParaEn(DRIVER3_PARA_BLOCK) != PARA_VALID) // Ч,ʹĬϲ + { + printf("driver 3 load default para\r\n"); + LoadNorDefPara(DRIVER3_PARA_BLOCK); + if (DEF_DRV3_CTRLMODE == CTRLMODE_OPEN || DEF_DRV3_CTRLMODE == CTRLMODE_CLOSE) + { + GetDriverParas(2)->closeCtrlMode = DEF_DRV3_CTRLMODE; + } + GetDriverParas(2)->stepPerCircle = DEF_DRV3_STEPCIRCLE; +#ifdef DEF_DRV3_CLOSECIRCLE + GetDriverParas(2)->closeCircle = DEF_DRV3_CLOSECIRCLE; +#endif +#ifdef DEF_DRV3_KP + GetDriverParas(2)->kp = DEF_DRV3_KP; +#endif +#ifdef DEF_DRV3_KI + GetDriverParas(2)->ki = DEF_DRV3_KI; +#endif + SaveNorParas(DRIVER3_PARA_BLOCK); + } + + if (GetDriverParas(2)->stepPerCircle != DEF_DRV3_STEPCIRCLE || + GetDriverParas(2)->closeCtrlMode != DEF_DRV3_CTRLMODE || + 0) + { + GetDriverParas(2)->stepPerCircle = DEF_DRV3_STEPCIRCLE; + GetDriverParas(2)->closeCtrlMode = DEF_DRV3_CTRLMODE; + SaveNorParas(DRIVER3_PARA_BLOCK); + } + + CheckParaRange(DRIVER3_PARA_BLOCK); // вΧ +#endif + +#if (DRIVERS_NUM >= 4) + SetNorParaList(DRIVER4_PARA_BLOCK, (void*)&g_defDriverParaList); // òб + SetNorParaNameString(DRIVER4_PARA_BLOCK, (void*)&g_driverParaStrList); // òб + + if (GetNorParaEn(DRIVER4_PARA_BLOCK) != PARA_VALID) // Ч,ʹĬϲ + { + printf("driver 4 load default para\r\n"); + LoadNorDefPara(DRIVER4_PARA_BLOCK); + if (DEF_DRV4_CTRLMODE == CTRLMODE_OPEN || DEF_DRV4_CTRLMODE == CTRLMODE_CLOSE) + { + GetDriverParas(3)->closeCtrlMode = DEF_DRV4_CTRLMODE; + } + GetDriverParas(3)->stepPerCircle = DEF_DRV4_STEPCIRCLE; +#ifdef DEF_DRV4_CLOSECIRCLE + GetDriverParas(3)->closeCircle = DEF_DRV4_CLOSECIRCLE; +#endif +#ifdef DEF_DRV4_KP + GetDriverParas(3)->kp = DEF_DRV4_KP; +#endif +#ifdef DEF_DRV4_KI + GetDriverParas(3)->ki = DEF_DRV4_KI; +#endif + SaveNorParas(DRIVER4_PARA_BLOCK); + } + + if (GetDriverParas(3)->stepPerCircle != DEF_DRV4_STEPCIRCLE || + GetDriverParas(3)->closeCtrlMode != DEF_DRV4_CTRLMODE || + 0) + { + GetDriverParas(3)->stepPerCircle = DEF_DRV4_STEPCIRCLE; + GetDriverParas(3)->closeCtrlMode = DEF_DRV4_CTRLMODE; + SaveNorParas(DRIVER4_PARA_BLOCK); + } + + CheckParaRange(DRIVER4_PARA_BLOCK); // вΧ +#endif + +#else + +#if (DRIVERS_NUM >= 1) + { + u32 * pDat = (u32 *)&g_defPara[0]; + for (int i = 0; i < DRV_PARA_NUMS; i++) + { + *pDat = g_defDriverParaList[i][2]; + pDat++; + } + g_defPara[0].closeCtrlMode = DEF_DRV1_CTRLMODE; + g_defPara[0].stepPerCircle = DEF_DRV1_STEPCIRCLE; +#ifdef DEF_DRV1_CLOSECIRCLE + g_defPara[0].closeCircle = DEF_DRV1_CLOSECIRCLE; +#endif +#ifdef DEF_DRV1_KP + g_defPara[0].kp = DEF_DRV1_KP; +#endif +#ifdef DEF_DRV1_KI + g_defPara[0].ki = DEF_DRV1_KI; +#endif + } +#endif + +#if (DRIVERS_NUM >= 2) + { + u32 * pDat = (u32 *)&g_defPara[1]; + for (int i = 0; i < DRV_PARA_NUMS; i++) + { + *pDat = g_defDriverParaList[i][2]; + pDat++; + } + g_defPara[1].closeCtrlMode = DEF_DRV2_CTRLMODE; + g_defPara[1].stepPerCircle = DEF_DRV2_STEPCIRCLE; +#ifdef DEF_DRV2_CLOSECIRCLE + g_defPara[1].closeCircle = DEF_DRV2_CLOSECIRCLE; +#endif +#ifdef DEF_DRV2_KP + g_defPara[1].kp = DEF_DRV2_KP; +#endif +#ifdef DEF_DRV2_KI + g_defPara[1].ki = DEF_DRV2_KI; +#endif + } +#endif + +#if (DRIVERS_NUM >= 3) + { + u32 * pDat = (u32 *)&g_defPara[2]; + for (int i = 0; i < DRV_PARA_NUMS; i++) + { + *pDat = g_defDriverParaList[i][2]; + pDat++; + } + g_defPara[2].closeCtrlMode = DEF_DRV3_CTRLMODE; + g_defPara[2].stepPerCircle = DEF_DRV3_STEPCIRCLE; +#ifdef DEF_DRV3_CLOSECIRCLE + g_defPara[2].closeCircle = DEF_DRV3_CLOSECIRCLE; +#endif +#ifdef DEF_DRV3_KP + g_defPara[2].kp = DEF_DRV3_KP; +#endif +#ifdef DEF_DRV3_KI + g_defPara[2].ki = DEF_DRV3_KI; +#endif + } +#endif + +#if (DRIVERS_NUM >= 4) + { + u32 * pDat = (u32 *)&g_defPara[3]; + for (int i = 0; i < DRV_PARA_NUMS; i++) + { + *pDat = g_defDriverParaList[i][2]; + pDat++; + } + g_defPara[3].closeCtrlMode = DEF_DRV4_CTRLMODE; + g_defPara[3].stepPerCircle = DEF_DRV4_STEPCIRCLE; +#ifdef DEF_DRV4_CLOSECIRCLE + g_defPara[3].closeCircle = DEF_DRV4_CLOSECIRCLE; +#endif +#ifdef DEF_DRV4_KP + g_defPara[3].kp = DEF_DRV4_KP; +#endif +#ifdef DEF_DRV4_KI + g_defPara[3].ki = DEF_DRV4_KI; +#endif + } +#endif + +#endif + +} + +DriverPara * GetDriverParas(int didx) +{ +#if (DRIVER_PARA == DRIVER_PARA_NOR) + +#if (DRIVERS_NUM >= 1) + if (didx == 0) + { + return (DriverPara *)GetNorParaBlock(DRIVER1_PARA_BLOCK); + } + else +#endif + +#if (DRIVERS_NUM >= 2) + if (didx == 1) + { + return (DriverPara *)GetNorParaBlock(DRIVER2_PARA_BLOCK); + } + else +#endif +#if (DRIVERS_NUM >= 3) + if (didx == 2) + { + return (DriverPara *)GetNorParaBlock(DRIVER3_PARA_BLOCK); + } + else +#endif +#if (DRIVERS_NUM >= 4) + if (didx == 3) + { + return (DriverPara *)GetNorParaBlock(DRIVER4_PARA_BLOCK); + } + else +#endif + +#else + if (didx >= 0 && didx < DRIVERS_NUM) + { + return (DriverPara *)(&g_defPara[didx]); + } + else +#endif + { + return NULL; + } +} + +void SaveDriverParas(int didx) +{ +#if (DRIVER_PARA == DRIVER_PARA_NOR) + +#if (DRIVERS_NUM >= 1) + if (didx == 0) + { + SaveNorParas(DRIVER1_PARA_BLOCK); + } + else +#endif + +#if (DRIVERS_NUM >= 2) + if (didx == 1) + { + SaveNorParas(DRIVER2_PARA_BLOCK); + } + else +#endif +#if (DRIVERS_NUM >= 3) + if (didx == 2) + { + SaveNorParas(DRIVER3_PARA_BLOCK); + } + else +#endif +#if (DRIVERS_NUM >= 4) + if (didx == 3) + { + SaveNorParas(DRIVER4_PARA_BLOCK); + } + else +#endif + +#else +#endif + { + } +} + +const char * GetDriverParaName(int pidx) +{ + if (pidx >= 0 && pidx < DRV_PARA_NUMS) + { + return (const char*)&(g_driverParaStrList[pidx]); + } + else + { + return NULL; + } +} + +#endif diff --git a/NxFuncs/closedriver/driverparas.h b/NxFuncs/closedriver/driverparas.h new file mode 100644 index 0000000..e8336ed --- /dev/null +++ b/NxFuncs/closedriver/driverparas.h @@ -0,0 +1,259 @@ + + +#ifndef __DRIVERPARAS_H__ +#define __DRIVERPARAS_H__ + +#include "config.h" + +#define DRIVER_PARA_ST 0 +#define DRIVER_PARA_NOR 1 + +#ifndef DRIVER_PARA +#define DRIVER_PARA DRIVER_PARA_NOR +#endif + + +#if (DRIVERS_NUM > 0) + +#if (DRIVER_PARA == DRIVER_PARA_NOR) +#include "norparas.h" +#define DRV_PARA_NUMS PARA_NUM_PER_BLK +#define DRV_PARA_STR_LEN PARA_STR_LEN +#else + +#define DRV_PARA_NUMS 64 +#define DRV_PARA_STR_LEN 30 + +#endif + + +#define CTRLMODE_OPEN 0 +#define CTRLMODE_CLOSE 1 + +typedef struct +{ + // 0 + int closeCtrlMode; // ջģʽ + int cmdSource; // Դ, 0 ڲ; 1, ⲿ; + int stepPerCircle; // ÿȦ + + // 3 + int openRunCircle; // е + int openLockCircle; // + int openMaxOffset; // ƫ + + // 6 + s32 maxSpeed; // ת, λ: ɿλø/ + + // 7 + int closeAdjust; // ջų + int closeCircle; // ջ + + // 9 + int maxAdvance; // ƫ + + // 10 + // ջλÿpid + int kp; // λû Χ(0--1000), Ĭ 500 + int ki; // λû Χ(0--1000), Ĭ 20 + int kd; // λû΢ Χ(0--1000), Ĭ 800 + + // 13 + int ecdAdjust; // ׼ + + // 14 + u32 startPPS; // ٶ + u32 runPPS; // ٶ + u32 addPPSS; // ٶ + u32 brkPPSS; // ɲٶ + + // 18 + u32 numerator; // ӳַ + u32 denominator; // ӳַĸ + + // 20 + u32 basecircle; // ջС + + // 21 + u32 rev[DRV_PARA_NUMS-21]; +}DriverPara; + +#ifdef _IN_DRIVERPARAS_C + +// Ĭϲ +static const u32 g_defDriverParaList[DRV_PARA_NUMS][3] = +{ +// С Ĭ +// 0 + {0, 1, 0 } , // int closeCtrlMode; // ջģʽ + {0, 1, 0 } , // int cmdSource; // Դ, 0 ڲ; 1, ⲿ; + {100, 204800, 4000} , // int stepPerCircle; // ÿȦ + + // 3 + {1, 320, 200 } , // int openRunCircle; // е + {0, 320, 0 } , // int openLockCircle; // + {1, 1000, 200 } , // int openMaxOffset; // ƫ + + // 6 + {1, 10000, 4000} , // s32 maxSpeed; // ת, λ: ɿλø/ + + // 7 + {0, 0, 0 } , // int closeAdjust; // ջų + {1, 1000, 100 } , // int closeCircle; // ջ + {1, 1200, 1200} , // int maxAdvance; // ƫ + + // 10 + // ջpid + {0, 1000, 400 } , // int kp; // λû Χ(0--1000), Ĭ 400 + {0, 1000, 20 } , // int ki; // λû Χ(0--1000), Ĭ 20 + {0, 1000, 800 } , // int kd; // λû΢ Χ(0--1000), Ĭ 800 + + // 13 + {0, 0, 0 } , // int ecdAdjust; // ׼ + + // 14 + {1, 10000, 1000 } , // u32 startPPS; // ٶ + {1, 200000, 40000 } , // u32 runPPS; // ٶ + {1, 40000, 100 } , // u32 addPPSS; // ٶ + {1, 40000, 10000 } , // u32 brkPPSS; // ɲٶ + + // 18 + {100, 204800, 4000} , // u32 numerator; // ӳַ + {1, 204800, 1 } , // u32 denominator; // ӳַĸ + + // 20 + {0, 50, 0 }, // ջС + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + + // 32 + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, + {0, 0, 0 }, +}; + +static const char g_driverParaStrList[DRV_PARA_NUMS][DRV_PARA_STR_LEN] = +{ + "ջģʽ; 0; 1, ջ;", + "Դ, 0 ڲ; 1, ⲿ;", + "ÿȦ", + "е", + "", + "ƫ", + "ת", + "ջų", + "ջ", + "ջƫ", + "λû(0--1000)", + "λû(0--1000)", + "λû΢(0--1000)", + "׼Ĭ0", + "ٶ", + "ٶ", + "ٶ", + "ɲٶ", + "ӳַ", + "ӳַĸ", + + // 20 + "ջС(0-50)", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +// 32 + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +}; + +#endif + +//----------------------- + +void InitDriverParas(void); + +DriverPara * GetDriverParas(int didx); +void SaveDriverParas(int didx); + +const char * GetDriverParaName(int pidx); + +//----------------------- + +#endif + +//----------------------- + +#endif diff --git a/NxFuncs/closedriver/driversctrl.c b/NxFuncs/closedriver/driversctrl.c new file mode 100644 index 0000000..d588f49 --- /dev/null +++ b/NxFuncs/closedriver/driversctrl.c @@ -0,0 +1,1518 @@ + + +#include "config.h" +#include "driversctrl.h" + +#if (DRIVERS_NUM > 0) + +#include "stepmotos.h" + +#include "inout.h" +#include "delay.h" +#include "shell.h" +#include "trigger.h" +#include "cpuid.h" + +#include "driverparas.h" + +//------------------------------------------------------------------------ + +#include "drivermotion.h" + +//------------------------------------------------------------------------ + +#ifndef MOTO_ECD_PER_CIRCLE +#define MOTO_ECD_PER_CIRCLE 4000 +#endif + +//------------------------------------------------------------------------ + +#define OUT_INFO_NUM 0 + +typedef struct +{ + s32 cmdPosition; // ָλ + s32 targetMotoPos; // Ŀλ + s32 ecdPosition; // λ + + s32 thisPosErr; // λƫ + s32 integral; // ƫ + s32 differential; // λ΢ + s32 thisactVel; // μٶֵ + + s32 pospid; // λPID + + s32 setMotoPos; // λ + s32 effort; // õ + +}DrvOutInfo; + +#ifndef DEF_SPD_FIL +#define DEF_SPD_FIL 0 +#endif + +typedef struct +{ + //---------------------- + int motoIdx; // + + void (*InitEncoder)(void); + int (*ReadEncoderCounter)(void); + + //---------------------- + DriverPara paras; // + + //---------------------- + int powerEnFlag; // ʹܱ־ + //---------------------- + float stepAngle; // ϸ + //---------------------- + s32 runspeed; // ٶ + s32 speedadd; // ڲмٶ + int runsta; + //---------------------- + s32 cmdPosition; // ָλͳƣǶȣ + s32 ecdPosition; // λͳƣǶȣ + s32 runPosition; // λͳƣǶȣ + + s32 lastPosErr; // ϴεƫ(Ƕ) + s32 integral; + s32 differential; +#if (DEF_SPD_FIL > 1) + s32 spdBuff[DEF_SPD_FIL]; + s32 spdIdx; + s32 spdSum; +#endif + +// s32 lastVel; +// s32 lastVErr; +// s32 lastDErr; // ϴεƫ + + s32 intev; + s32 effort; // + //---------------------- + s32 lastThetaGap; + //---------------------- + s32 exCmdCounter; // ⲿָ + //---------------------- + s32 posOffset; + //---------------------- + + int first; + s32 oldTheta; // ϴεĽǶ(Ƕ) + s32 oldCounter; // ϴεָ + s32 halfCounter; // + //---------------------- + int errorCode; // + //---------------------- +#if (OUT_INFO_NUM != 0) + int timeCount; + int timeGap; + int outInfoIdx; + int outInfoEn; + + DrvOutInfo outInfoList[OUT_INFO_NUM+1]; +#endif + +}DriverCtrl; + +//------------------------------------------------------------------------ + +DriverCtrl g_driverCtrl[DRIVERS_NUM]; + +//------------------------------------------------------------------------ + +void InitCloseCtrl(int driverIdx); + +int GetThetaValue(int driverIdx); +void SetMotoDirectionCtrl(int driverIdx, int dirbit); +void SetMotoPulseCtrl(int driverIdx, int dirbit); + +//------------------------------------------------------------------------ + +float CalcStepAngle(s32 stepPerCircle, s32 numerator, s32 denominator); + +int GetThetaFromEcd(int ecdvalue); +int LoadCtrlPara(); + +//------------------------------------------------------------------------ + +const char * DRV_HLP_STR = + "\t""Ե" "\r\n" + "\t" "p1 p2" "\r\n" + "\t" "0 x" "ʾx, 0 ȫʾ" "\r\n" + "\t""x0d n" "xdֵΪn" "\r\n" + "\t""x000 m" "ʽ˶x" "\r\n" + "\t\t" "m=0" "ʧ" "\r\n" + "\t\t" "m=1" "ʹ" "\r\n" + "\t\t" "m=2" "" "\r\n" + "\t\t" "m=3" "" "\r\n" + "\t\t" "m=4" "΢" "\r\n" + "\t\t" "m=5" "΢" "\r\n" + "\t" "x000d n" "ʽ˶x,λΪn" "\r\n" +; + +void TestDriver(char * para1, char * para2); +void ShowDriver(char * para1, char * para2); + +//------------------------------------------------------------------------ + +#define RD_CALIB_PPC (100) // (4000) + +//----------------------------------------------------------- +#define IDX_RANGE 10 +#define PID_RANGE 1024 // PID ĸ + +#define PULSE_COUNTER_RELOAD (S32_MAX-1) // ⲿװֵ + +#define LOW_CIRCLE_TIME 2000 // ͵ʱ (2k) +#define ADVANCE_ADJ_MAX ((MOTO_PPC)/MOTO_NOPP/5) // ƫ + +#define MIN_PE_LIMIT ((MOTO_PPC)/MOTO_NOPP/32) // Сƫ +#define MAX_PE_LIMIT (MOTO_PPC/10) // ƫ + +#define MAX_IG_LIMIT (RD_CALIB_PPC*PID_RANGE) // Ŀ + +#define MAX_IS_LIMIT (MAX_IG_LIMIT*90/100) // ֶַ +#define MIN_IS_LIMIT (MAX_IG_LIMIT*50/100) // ֶַС + +#define EFF_MAX (MAX_OUT_LEV *1) +#define EFF_MIN (MAX_OUT_LEV *-1) + +#define MIN_OUT_EFF 0 + +#define DEF_OUT_EFF 50 + +#define POS_PER_CIRCLE (MOTO_ECD_PER_CIRCLE) + +//------------------------------------------------------------------------ + + +//------------------------------------------------------------------------ +#define MOTO_INIT(id) do \ +{\ + SetMotoCtrlFuncs(DRIVER##id##_IDX, \ + SetMoto##id##CoilAPwm, SetMoto##id##ACPOn, SetMoto##id##ACPOff, SetMoto##id##ACNOn, SetMoto##id##ACNOff, \ + SetMoto##id##CoilBPwm, SetMoto##id##BCPOn, SetMoto##id##BCPOff, SetMoto##id##BCNOn, SetMoto##id##BCNOff); \ + \ + SetMotoCCWDir(DRIVER##id##_IDX, MOTO##id##_CCWDIR); /* ÷ */ \ + \ + SetMoto##id##CoilPwmEnable(); /* PWM */ \ + \ + g_driverCtrl[id-1].ReadEncoderCounter = ReadMoto##id##EncoderCounter; \ + g_driverCtrl[id-1].InitEncoder = InitMoto##id##Encoder; \ +}while(0) + +//------------------------------------------------------------------------ + +void InitDriversCtrl(void) +{ + int i; + + // ʼ + InitStepMotos(); // ʼ + + InitDrvMotions(); // ʼ˶ + + // + memset(g_driverCtrl, 0, sizeof(DriverCtrl)*DRIVERS_NUM); + +#if (DRIVERS_NUM >= 1) + MOTO_INIT(1); +#endif + +#if (DRIVERS_NUM >= 2) + MOTO_INIT(2); +#endif + +#if (DRIVERS_NUM >= 3) + MOTO_INIT(3); +#endif + +#if (DRIVERS_NUM >= 4) + MOTO_INIT(4); +#endif + + // װĬϲ + InitDriverParas(); + + for (i = 0; i < DRIVERS_NUM; i++) + { + g_driverCtrl[i].motoIdx = i; + + // Ӳļװزֵ + memcpy(&(g_driverCtrl[i].paras), GetDriverParas(i), sizeof(DriverPara)); + + // ϸ + g_driverCtrl[i].stepAngle = CalcStepAngle(g_driverCtrl[i].paras.stepPerCircle, g_driverCtrl[i].paras.numerator, g_driverCtrl[i].paras.denominator); + printf("moto%d stepAngle=%.2f\r\n", i+1, g_driverCtrl[i].stepAngle); + + // Ĭϲ + + } + + //----------------------- + + //----------------------- + // ջƳʼλ + for (i = 0; i < DRIVERS_NUM; i++) + { + SetEnableCtrl(i, 0); + } + + DelayMs(10); + + // ʼʱ̶λ + for (i = 0; i < DRIVERS_NUM; i++) + { + if (g_driverCtrl[i].paras.closeCtrlMode != 0) + { + ResetMotoPos(i, 100); + } + else + { + g_driverCtrl[i].halfCounter = LOW_CIRCLE_TIME; + } + } + + DelayMs(200); + + // ʼݹ̶λã + for (i = 0; i < DRIVERS_NUM; i++) + { + g_driverCtrl[i].InitEncoder(); + } + + DelayMs(10); + + // ʹܵ + for (i = 0; i < DRIVERS_NUM; i++) + { + SetEnableCtrl(i, 1); + } + + DelayMs(100); + +#if (OUT_INFO_NUM != 0) + g_driverCtrl[0].outInfoIdx = 0; + g_driverCtrl[0].timeGap = 0; + g_driverCtrl[0].outInfoEn = 1; +#endif + + // 򿪿ڣʼ + if (1) + { + printf("StartControlCycle\r\n"); + StartControlCycle(); + } + +#if (0) + AddShellCmd("DRIVER", DRV_HLP_STR, TestDriver); +#else + AddShellCmd("DRIVER", "", ShowDriver); +#endif +} + +//------------------------------------------------------------------------ + + +void InitCloseCtrl(int driverIdx) +{ + s32 rdTheta = 0; + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + rdTheta = GetThetaValue(driverIdx); + + pCtrl->cmdPosition = rdTheta / pCtrl->stepAngle; // ָλͳƣǶȣ + pCtrl->ecdPosition = rdTheta; // λͳƣǶȣ + pCtrl->runPosition = rdTheta; // λͳƣǶȣ + + pCtrl->lastPosErr = 0; // ϴεƫ + pCtrl->integral = 0; // +// pCtrl->lastDErr = 0; // ϴεƫ + pCtrl->effort = 0; // + + printf("\r\n InitCloseCtrl, g_driverCtrl[%d]:\r\n" + "\t rdTheta=%d, \r\n" + "\t stepAngle=%f, \r\n" + "\t cmdPosition=%d, \r\n" + "\t ecdPosition=%d, \r\n" + "\t runPosition=%d, \r\n", + driverIdx, rdTheta, pCtrl->stepAngle, pCtrl->cmdPosition, pCtrl->ecdPosition, pCtrl->runPosition); + + pCtrl->first = 1; +} + +void SetEnableCtrl(int driverIdx, int enbit) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + if (enbit != 0) + { + if (pCtrl->powerEnFlag == 0 && pCtrl->paras.closeCtrlMode != 0) + { + InitCloseCtrl(driverIdx); + SetMotoPosTo(pCtrl->motoIdx, pCtrl->ecdPosition, DEF_OUT_EFF); // ߵĿλ + } + pCtrl->powerEnFlag = 1; + + printf("set moto%d en on\r\n", pCtrl->motoIdx+1); + } + else + { + if (pCtrl->powerEnFlag != 0) + { + pCtrl->powerEnFlag = 0; + DelayUs(200); + SetMotoEnable(pCtrl->motoIdx, 0); + } + printf("set moto%d en off\r\n", pCtrl->motoIdx+1); + } +} + + +int GetThetaFromEcd(int ecdvalue) +{ +#if (SIN_TAB_SIZE == POS_PER_CIRCLE) // 򻯼, ұͬ + ecdvalue *= MOTO_NOPP; +#else + ecdvalue *= MOTO_PPC; + ecdvalue /= POS_PER_CIRCLE; +#endif + return ecdvalue; +} + +int GetMotoThetaValue(DriverCtrl * pCtrl) +{ + if (pCtrl == NULL) + { + return 0; + } + + int ecdvalue = pCtrl->ReadEncoderCounter(); + ecdvalue += pCtrl->paras.ecdAdjust; + + return GetThetaFromEcd(ecdvalue); +} + +// +int GetThetaValue(int driverIdx) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return 0; + } + pCtrl = &g_driverCtrl[driverIdx]; + return GetMotoThetaValue(pCtrl); +} + + +float CalcStepAngle(s32 stepPerCircle, s32 numerator, s32 denominator) +{ + float stepAngle = 1.0f; + if (stepPerCircle != 0) + { + stepAngle = (1.0f*MOTO_PPC/stepPerCircle); + } + else if (denominator != 0) + { + stepAngle = (1.0f*MOTO_PPC*numerator/denominator); + } + + return stepAngle; +} +//------------------------------------------------------------------------ +//------------------------------------------------------------------------------------ + +void MotoCloseCtrlProc(DriverCtrl * pCtrl) +{ + if (pCtrl == NULL) + { + return; + } + if (pCtrl->powerEnFlag <= 0) // ʹ״̬ + { + return; + } + +#if (OUT_INFO_NUM != 0) + pCtrl->timeCount++; + + if (pCtrl->outInfoEn != 0) + { + if (pCtrl->timeGap <= 0) + { + pCtrl->timeGap = 1; + } + if ((pCtrl->timeCount % pCtrl->timeGap) == 0) + { + pCtrl->outInfoIdx++; + if (pCtrl->outInfoIdx >= OUT_INFO_NUM) + { + pCtrl->outInfoEn = 0; + } + } + } +#endif + + s32 targetMotoPos; // Ŀλ + s32 setMotoPos; // μʵĿλ + s32 effort; // + s32 tmps32; + s32 thisactVel = 0; // һαȽϵĵǶȲֵ + // ȡλ +// if (pCtrl->paras.closeCtrlMode != 0) + { + s32 rdTheta; // ǰǶ + s32 thisThetaGap; // ǶȲֵ(һαȽ) + rdTheta = GetMotoThetaValue(pCtrl); // ȡ, תΪǶ + + if (pCtrl->first == 1) + { + pCtrl->oldTheta = rdTheta; + } + + thisThetaGap = rdTheta - pCtrl->oldTheta; // ǶȲֵ + // תΪ-180-180֮ + if (thisThetaGap < -MOTO_PPC/2) // ת + { + thisThetaGap += MOTO_PPC; + } + else if (thisThetaGap > MOTO_PPC/2) + { + thisThetaGap -= MOTO_PPC; + } + +#if (DEF_SPD_FIL > 1) + pCtrl->spdIdx++; + if (pCtrl->spdIdx >= DEF_SPD_FIL) + { + pCtrl->spdIdx = 0; + } + pCtrl->spdSum -= pCtrl->spdBuff[pCtrl->spdIdx]; + pCtrl->spdBuff[pCtrl->spdIdx] = thisThetaGap; + pCtrl->spdSum += thisThetaGap; + thisactVel = pCtrl->spdSum/DEF_SPD_FIL; // ٶֵ +#else + thisactVel = thisThetaGap; +#endif + pCtrl->ecdPosition += thisThetaGap; + +#if (OUT_INFO_NUM != 0) + pCtrl->outInfoList[pCtrl->outInfoIdx].thisactVel = thisactVel; + pCtrl->outInfoList[pCtrl->outInfoIdx].ecdPosition = pCtrl->ecdPosition; +#endif + + pCtrl->oldTheta = rdTheta; + } + + // ȡָλ + { + s32 thisCmdGap; // κϴεָλƫ + s32 rdCounter; // Ŀλ,ָ + rdCounter = pCtrl->exCmdCounter; + + if (pCtrl->first == 1) + { + pCtrl->oldCounter = rdCounter; + + if (pCtrl->paras.closeCtrlMode != 0) // ջģʽ + { + pCtrl->cmdPosition = pCtrl->ecdPosition / pCtrl->stepAngle; + } + } + + thisCmdGap = rdCounter - pCtrl->oldCounter; + if (thisCmdGap < -1*(s32)(PULSE_COUNTER_RELOAD/2)) // ת + { + thisCmdGap += PULSE_COUNTER_RELOAD; + } + else if (thisCmdGap > PULSE_COUNTER_RELOAD/2) + { + thisCmdGap -= PULSE_COUNTER_RELOAD; + } + pCtrl->oldCounter = rdCounter; + + // ۼָλ + pCtrl->cmdPosition += thisCmdGap; + +#if (OUT_INFO_NUM != 0) + pCtrl->outInfoList[pCtrl->outInfoIdx].cmdPosition = pCtrl->cmdPosition; +#endif + } + + targetMotoPos = (s32)(pCtrl->cmdPosition * pCtrl->stepAngle); // λóֵΪָλ + +#if (OUT_INFO_NUM != 0) + pCtrl->outInfoList[pCtrl->outInfoIdx].targetMotoPos = targetMotoPos; +#endif + + if (pCtrl->paras.closeCtrlMode == 0) // ģʽ + { + if (targetMotoPos == pCtrl->runPosition) + { + pCtrl->halfCounter++; + } + else + { + pCtrl->halfCounter = 0; + + // ģʽµٶ, ֹ + tmps32 = targetMotoPos - pCtrl->runPosition; + if (tmps32 > pCtrl->paras.openMaxOffset) + { + targetMotoPos = pCtrl->runPosition + pCtrl->paras.openMaxOffset; + } + else if (tmps32 < -1*pCtrl->paras.openMaxOffset) + { + targetMotoPos = pCtrl->runPosition - pCtrl->paras.openMaxOffset; + } + } + setMotoPos = targetMotoPos; + + if (pCtrl->halfCounter > LOW_CIRCLE_TIME) + { + pCtrl->halfCounter = LOW_CIRCLE_TIME; + effort = pCtrl->paras.openLockCircle; // + } + else + { + effort = pCtrl->paras.openRunCircle; // + } + } + else // ջ + { + // λñջ + s32 pospid = 0; + s32 thisPosErr = 0; // λƫ(Ƕ) + { + int index = 0; + thisPosErr = targetMotoPos - pCtrl->ecdPosition; + + // ƫ36? + if (thisPosErr > MAX_PE_LIMIT) // ƫΧ + { + thisPosErr = MAX_PE_LIMIT; + } + else if (thisPosErr < -MAX_PE_LIMIT) + { + thisPosErr = -MAX_PE_LIMIT; + } + + // λPID + // ֶλ + if ((thisPosErr >= 0 && pCtrl->lastPosErr <= 0) || + (thisPosErr <= 0 && pCtrl->lastPosErr >= 0) ) // ϴ˶෴ + { + pCtrl->integral /= 128; // ֿ½ + } + + if (abs(thisPosErr + pCtrl->lastPosErr) < 10) // ǷΪӽĿλûĿλø + { + index = IDX_RANGE; + pCtrl->integral /= 16; // 2 // ֿ½ + } + else if (abs(thisPosErr) > MAX_IS_LIMIT) + { + index = 0; + } + else + { + if (abs(thisPosErr) < MIN_IS_LIMIT) + { + index = IDX_RANGE; + } + else + { + index = ((MAX_IS_LIMIT) - abs(thisPosErr)) * IDX_RANGE / ((MAX_IS_LIMIT - MIN_IS_LIMIT)); + } + + // ֱ + if (pCtrl->effort > EFF_MAX) + { + if (thisPosErr < 0) + { + pCtrl->integral += thisPosErr; + } + } + else if (pCtrl->effort < EFF_MIN) + { + if (thisPosErr > 0) + { + pCtrl->integral += thisPosErr; + } + } + else + { + pCtrl->integral += thisPosErr; + } + + //  + if (pCtrl->integral > MAX_IG_LIMIT) + { + pCtrl->integral = MAX_IG_LIMIT; + } + else if (pCtrl->integral < -MAX_IG_LIMIT) + { + pCtrl->integral = -MAX_IG_LIMIT; + } + } + + // ΢, ΢˲ + tmps32 = (thisPosErr - pCtrl->lastPosErr); + pCtrl->differential = (pCtrl->differential * 26 + tmps32 * 230) / 256; + + pCtrl->lastPosErr = thisPosErr; // ¼ϴε + + // λPID + pospid = ( ( (pCtrl->paras.kp * thisPosErr) + + (pCtrl->paras.ki * pCtrl->integral * index / PID_RANGE) + + (pCtrl->paras.kd * pCtrl->differential) ) / PID_RANGE); +#if (OUT_INFO_NUM != 0) + pCtrl->outInfoList[pCtrl->outInfoIdx].thisPosErr = thisPosErr; + pCtrl->outInfoList[pCtrl->outInfoIdx].integral = pCtrl->integral; + pCtrl->outInfoList[pCtrl->outInfoIdx].differential = pCtrl->differential; + + pCtrl->outInfoList[pCtrl->outInfoIdx].pospid = pospid; +#endif + } + + // λǰ + tmps32 = pCtrl->ecdPosition + pCtrl->paras.closeAdjust; // ԱλΪ׼λ + + s32 advance = thisactVel; // ٶΪ ǰǶ + s32 basecircle = pCtrl->paras.basecircle; + +#if (0) + // 20240105 ʱĽ + if (pospid > 200) + { + advance += (MAX_ADVANCE+MICO_ADVANCE+MIN_ADVANCE); + } + else if(pospid < -200) + { + advance -= (MAX_ADVANCE+MICO_ADVANCE+MIN_ADVANCE); + } + else if (pospid > 100) + { + advance += (MAX_ADVANCE+MIN_ADVANCE); + } + else if(pospid < -100) + { + advance -= (MAX_ADVANCE+MIN_ADVANCE); + } + else +#endif + if (pospid > 50) + { + advance += (MAX_ADVANCE); // 1.8 + } + else if(pospid < -50) + { + advance -= (MAX_ADVANCE); + } + else if (pospid > 10) + { + advance += (MICO_ADVANCE); // 0.36 + } + else if(pospid < -10) + { + advance -= (MICO_ADVANCE); + } + else + { +#if (0)// ʱʹ + static int flag = 0; + if (abs(advance) < MIN_ADVANCE) + { + if (flag == 0) + { + printf("pid=%d,A:%d\r\n", pospid, advance); + flag = 1; + } + basecircle = 0; + advance = 0; + } + else + { + flag = 0; + } +#else + if (abs(advance) <= MIN_ADVANCE) + { + basecircle = 0; + advance = 0; + } +#endif + } + + setMotoPos = tmps32 + advance; + // +#if (0) // 20240826 + effort = abs(pospid); + if (effort > 4000) + { + effort /= 8; + } + else if (effort > 2000) + { + effort /= 6; + } + else if (effort > 800) + { + effort /= 4; + } + else if (effort > 200) + { + effort /= 2; + } + effort = basecircle + effort * pCtrl->paras.closeCircle / PID_RANGE; +#else + effort = basecircle + abs(pospid)/8 * pCtrl->paras.closeCircle / PID_RANGE; +#endif + // 20240109 ljs ӳ½ + if (effort < pCtrl->effort) + { + if (abs(effort - pCtrl->effort) > 10) + { + effort = pCtrl->effort - 10; + } + } + } + + // + { + SetMotoPosTo(pCtrl->motoIdx, setMotoPos, effort); // ߵĿλ + + pCtrl->runPosition = setMotoPos; // ¼λãǶȣ + pCtrl->effort = effort; + +#if (OUT_INFO_NUM != 0) + pCtrl->outInfoList[pCtrl->outInfoIdx].setMotoPos = setMotoPos; + pCtrl->outInfoList[pCtrl->outInfoIdx].effort = effort; +#endif + } +#if (0) + if (pCtrl->first == 1) + { + printf("MotoCloseCtrlProc first run\r\n"); + } +#endif + pCtrl->first = 0; +} + +//------------------------------------------------------------------------ + +#define CPU_RATE 0 // + +u32 g_workGap = 0; +float g_cpuRate = 0; + +void CPURateIntProc(int section) +{ +#if (CPU_RATE != 0) +#if (1) + if (section == 0) + { + SetDebugOn(); + } + else if (section == 1) + { + SetDebugOff(); + } +#else + static u32 workBeg = 0; + static u32 workEnd = 0; + static u32 lastEnd = 0; + + if (section == 0) + { + SetDebugOn(); + workBeg = GetUsSoftTimer(); + } + else if (section == 1) + { + workEnd = GetUsSoftTimer(); + g_workGap = workEnd - lastEnd; + lastEnd = workEnd; + if (g_workGap != 0) + { + g_cpuRate = (workEnd - workBeg) * 100.0 / g_workGap; + } + + SetDebugOff(); + } +#endif +#endif +} + +// жϣ 10K +void DriversCtrlIntProc(void) +{ +#if (1) + // ˶Ƽ + DrvMotionCalcProc(); +#endif + +#if (1) + // + DriverCtrl * pCtrl; + for (int i = 0; i < DRIVERS_NUM; i++) + { + pCtrl = &g_driverCtrl[i]; + if (pCtrl->paras.cmdSource == 0) // ڲָ + { + pCtrl->exCmdCounter = GetDrvMotionRealPos(i) + pCtrl->posOffset; // ˶λõָλ + } + MotoCloseCtrlProc(pCtrl); + } + +#endif +} + +//------------------------------------------------------------------------ + +u32 GetDrvErrorCode(int driverIdx) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return 0; + } + pCtrl = &g_driverCtrl[driverIdx]; + return pCtrl->errorCode; +} + +void CleanDrvErrorCode(int driverIdx) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + pCtrl->errorCode = 0; +} + +void SetDrvErrorCode(int driverIdx, int code) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + pCtrl->errorCode = code; +} + +//-------------------------------------------------------------------------- +#ifndef CLOSEMOTO_POSERR_MAXVAL +#define CLOSEMOTO_POSERR_MAXVAL (MOTO_PPC*2) +#endif + +void DriverRunTask(void) +{ + s32 poserr = 0; + DriverCtrl * pCtrl; + for (int i = 0; i < DRIVERS_NUM; i++) + { + pCtrl = &g_driverCtrl[i]; + if (pCtrl->errorCode == 0 && + pCtrl->paras.closeCtrlMode == CTRLMODE_CLOSE && + 1) + { + // λ + poserr = abs(pCtrl->cmdPosition*pCtrl->stepAngle - pCtrl->ecdPosition); + if (poserr > CLOSEMOTO_POSERR_MAXVAL) + { + printf("driver %d pos error, cmdPosition=%d, ecdPosition=%d, sub=%d\r\n", i+1, pCtrl->cmdPosition, pCtrl->ecdPosition, poserr); + pCtrl->errorCode = DR_ERR_POS; // ִ + SetEnableCtrl(i, 0); // ʹ + } + } + } +} + +//------------------------------------------------------------------------ + +// λ +void ResetDriverPos(int driverIdx, s32 pos) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + printf("reset pos to=%d\r\n", pos); + + EnterCritical(); + s32 cpos = GetDrvMotionRealPos(driverIdx); + SetDrvMotionRealPos(driverIdx, pos); + s32 ofst = cpos - pos; + pCtrl->posOffset += ofst; + ExitCritical(); +} + +void SetDriverTargetPos(int driverIdx, s32 tpos) +{ + SetDrvMotionRealPos(driverIdx, tpos); +} + +void SetDriverOffset(int driverIdx, s32 ofst) +{ + s32 cpos = GetDrvMotionRealPos(driverIdx); + s32 tpos = cpos + ofst; + SetDrvMotionRealPos(driverIdx, tpos); +} + +//------------------------------------------------------------------------------------ + +void SetOpenRunCircle(int driverIdx, int circle) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + pCtrl->paras.openRunCircle = circle; +} + +void SetOpenLockCircle(int driverIdx, int circle) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + pCtrl->paras.openLockCircle = circle; +} + +void SetOpenMaxOffset(int driverIdx, int maxofst) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + pCtrl->paras.openMaxOffset = maxofst; +} + +s32 GetClosePositionFromEcd(int driverIdx) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return 0; + } + pCtrl = &g_driverCtrl[driverIdx]; + return pCtrl->ecdPosition / pCtrl->stepAngle; +} + +void SetCloseCircle(int driverIdx, int circle) +{ + DriverCtrl * pCtrl; + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM) + { + return; + } + pCtrl = &g_driverCtrl[driverIdx]; + + pCtrl->paras.closeCircle = circle; +} + +//------------------------------------------------------------------------------------ + +#define ANGLE_PER_CIRCLE 36000 // 360 + +s32 CalcAngleByEcdValue(s32 ecd) +{ + s32 angle = -1; + float counter; + counter = ecd; + if (counter < 0) + { + } + counter = (counter * ANGLE_PER_CIRCLE / MOTO_ECD_PER_CIRCLE); // Ƕ + + angle = counter + (counter>0?(counter!=0?1:0):-1) * (0.500001f); + + // Ƕֵ [0, ANGLE_PER_CIRCLE) + while (angle < 0) + { + angle += ANGLE_PER_CIRCLE; + } + while (angle >= ANGLE_PER_CIRCLE) + { + angle -= ANGLE_PER_CIRCLE; + } + return angle; +} + +//------------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------------ + +// õģʽ, 0 1ջ +void SetDriverCtrlMode(int driverIdx, int mode) +{ + if (driverIdx < 0 || driverIdx >= DRIVERS_NUM || + (mode != 0 && mode != 1) || + 0) + { + return; + } + + // òȥʹ + SetEnableCtrl(driverIdx, 0); + int ctrlmod = g_driverCtrl[driverIdx].paras.closeCtrlMode; + + if (mode == 0) + { + printf("set moto%d ctrlmode to open\r\n", driverIdx+1); + } + else if (mode == 1) + { + printf("set moto%d ctrlmode to close\r\n", driverIdx+1); + } + + g_driverCtrl[driverIdx].paras.closeCtrlMode = mode; + + if (ctrlmod != g_driverCtrl[driverIdx].paras.closeCtrlMode && // ģʽͬ + g_driverCtrl[driverIdx].paras.closeCtrlMode != 0 && // ջ + 1) + { + ResetMotoPos(driverIdx, 100); + DelayMs(200); + g_driverCtrl[driverIdx].InitEncoder(); + DelayMs(10); + } + + DelayMs(1); + + SetEnableCtrl(driverIdx, 1); +} + +//------------------------------------------------------------------------------------ + +void DlBlk(u32 dl) +{ + +} + +// DRIVER +void TestDriver(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (para1 != NULL && strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (para2 != NULL && strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + //-------------------------------- + DriverPara * pParas; + + if (p1 >= 0 && p1 < 500) + { + int i; + int alllop = 0; + int dridx = p1/100; + int paidx = p1%100; + + int lopcount; + int didxcount; + + if (dridx == 0) + { + if (p2 == 0) + { + printf("gap=%d, cpu rate=%.2f%%\r\n", g_workGap, g_cpuRate); + alllop = DRIVERS_NUM; + } + } + else + { + dridx -= 1; + } + + lopcount = alllop; + didxcount = dridx; + do + { + if (didxcount >= 0 && didxcount < DRIVERS_NUM) + { + pParas = &(g_driverCtrl[didxcount].paras); + + if (paidx == 0) + { + printf("\r\nmoto%d paras:\r\n", didxcount+1); + for (i = 0; i < DRV_PARA_NUMS; i++) + { + const char * parastr = GetDriverParaName(i); + if (parastr != NULL && strlen(parastr) != 0) + { + printf(" %d. %s = %d\r\n", i+1, parastr, *((int*)(((u32)pParas) + i*4))); + } + } + + printf("\r\n g_driverCtrl[%d] values:\r\n" + "\t cmdPosition=%d, \r\n" + "\t ecdPosition=%d, \r\n" + "\t runPosition=%d, \r\n", + didxcount, g_driverCtrl[didxcount].cmdPosition, g_driverCtrl[didxcount].ecdPosition, g_driverCtrl[didxcount].runPosition); + } + else + { + // òȥʹ + SetEnableCtrl(didxcount, 0); + int ctrlmod = g_driverCtrl[dridx].paras.closeCtrlMode; + + printf("set %s = %d, old = %d\r\n", GetDriverParaName(paidx-1), p2, *((int*)(((u32)pParas) + (paidx-1)*4))); + + *((int*)(((u32)pParas) + (paidx-1)*4)) = p2; + g_driverCtrl[dridx].stepAngle = CalcStepAngle(g_driverCtrl[dridx].paras.stepPerCircle, g_driverCtrl[dridx].paras.numerator, g_driverCtrl[dridx].paras.denominator); + + if (ctrlmod != g_driverCtrl[dridx].paras.closeCtrlMode && + g_driverCtrl[dridx].paras.closeCtrlMode != 0 ) + { + ResetMotoPos(dridx, 50); + DelayMs(200); + g_driverCtrl[dridx].InitEncoder(); + DelayMs(10); + } + printf("moto%d stepAngle=%.2f\r\n", dridx+1, g_driverCtrl[dridx].stepAngle); + + DelayMs(1); + +#if (OUT_INFO_NUM != 0) + g_driverCtrl[dridx].outInfoIdx = 0; + g_driverCtrl[dridx].timeGap = 0; + g_driverCtrl[dridx].outInfoEn = 1; +#endif + SetEnableCtrl(didxcount, 1); + } + } + if (lopcount != 0) + { + lopcount--; + didxcount++; + DelayMs(100); + continue; + } + else + { + break; + } + + }while(1); + } +#if (1) + if (p1 >= 1000 && p1 < 5000) + {// Ե + int dridx = p1/1000 - 1; + int paidx = p1%1000; + + if (dridx < 0 || dridx >= DRIVERS_NUM) + { + return; + } + + int sel, count; + sel = p2%10; + count = p2/10; + + DriverCtrl * pCtrl; + pCtrl = &(g_driverCtrl[dridx]); + + int rslt, arsult; + int ang; + + SetEnableCtrl(dridx, 0); + + DelayMs(1); + + do + { + rslt = pCtrl->ReadEncoderCounter(); + ang = CalcAngleByEcdValue(rslt); + printf("before run moto%d, rslt=%d(0x%x), ang=%.2f\r\n", dridx+1, rslt, rslt, ang/100.0); + + if (paidx == 0) + { + if (sel == 0) + { + ResetMotoPos(dridx, 0); + } + else if (sel == 1) + { + ResetMotoPos(dridx, 50); + } + else if (sel == 2) + { + MotoOneFullStep(dridx, 1, 50); + } + else if (sel == 3) + { + MotoOneFullStep(dridx, -1, 50); + } + else if (sel == 4) + { + MotoOneMicoStep(dridx, 1, 50); + } + else if (sel == 5) + { + MotoOneMicoStep(dridx, -1, 50); + } + else if (sel == 100) + { + } + } + DelayMs(50); + arsult = pCtrl->ReadEncoderCounter(); + ang = CalcAngleByEcdValue(arsult); + printf("after run moto%d, rslt=%d(0x%x), ang=%.2f\r\n", dridx+1, arsult, arsult, ang/100.0, arsult-rslt); + count--; + }while(count > 0); + } +#endif + if (p1 >= 10000 && p1 < 50000) + {// Ե˶ + int dridx = p1/10000 - 1; + u32 timer; + int rslt, arsult, ang; + if (dridx < 0 || dridx >= DRIVERS_NUM) + { + return; + } + + DriverCtrl * pCtrl; + pCtrl = &(g_driverCtrl[dridx]); + + rslt = pCtrl->ReadEncoderCounter(); + ang = CalcAngleByEcdValue(rslt); + printf("before run moto%d, rslt=%d(0x%x), ang=%.2f, sub=%d\r\n", dridx+1, rslt, rslt, ang/100.0); + + printf("test run start, idx=%d, ", dridx); + + timer = GetMsSoftTimer(); + + { + DrvMotionPara drpara; + memset(&drpara, 0, sizeof(DrvMotionPara)); + + // + drpara.movement = p2; // λ + drpara.startPPS = pCtrl->paras.startPPS; // ٶ + drpara.runPPS = pCtrl->paras.runPPS; // ˶ٶ + drpara.addPPSS = pCtrl->paras.addPPSS; // ͣٶ + drpara.brkPPSS = pCtrl->paras.brkPPSS; // ɲٶ + drpara.DelayWhenBlock = DlBlk; + + drpara.blockRunflag = 1; // б־, =1,ͬ˶ =0,,첽˶ + + DrvMotionStart(dridx, &drpara); // ˶ + } + + timer = GetMsSoftTimer() - timer; + printf("test run over, time=%dms\r\n", timer); + + DelayMs(100); + + arsult = pCtrl->ReadEncoderCounter(); + ang = CalcAngleByEcdValue(arsult); + printf("after run moto%d, rslt=%d(0x%x), ang=%.2f\r\n", dridx+1, arsult, arsult, ang/100.0, arsult-rslt); + } + + if (p1 >= 100000 && p1 < 200000) + { + int dridx = 0; + + // + DrvMotionPara drpara; + DriverCtrl * pCtrl; + + for (dridx = 0; dridx < DRIVERS_NUM; dridx++) + { + printf("test run start, idx=%d, ", dridx); + pCtrl = &(g_driverCtrl[dridx]); + + memset(&drpara, 0, sizeof(DrvMotionPara)); + + drpara.movement = p2; // λ + drpara.startPPS = pCtrl->paras.startPPS; // ٶ + drpara.runPPS = pCtrl->paras.runPPS; // ˶ٶ + drpara.addPPSS = pCtrl->paras.addPPSS; // ͣٶ + drpara.brkPPSS = pCtrl->paras.brkPPSS; // ɲٶ + + drpara.funTestTime = 0; // йⲿʱ + + drpara.blockRunflag = 0; // б־, =1,ͬ˶ =0,,첽˶ + + DrvMotionStart(dridx, &drpara); // ˶ + } + + do + { + printf("gap=%d, cpu rate=%.2f%%\r\n", g_workGap, g_cpuRate); + if (IsConsoleCancel() != 0) + { + break; + } + + DelayMs(10); + + }while(1); + } + + if (p1 >= 200000 && p1 <= 240000) + { +#if (OUT_INFO_NUM != 0) + int dridx = (p1-200000)/10000; + if (dridx < 0 || dridx >= DRIVERS_NUM) + { + return; + } + + DriverCtrl * pCtrl; + pCtrl = &(g_driverCtrl[dridx]); + int gap = p1 % 10000; + + if (p2 < 0) + { + int i = 0; + int num = pCtrl->outInfoIdx; + printf("out info num=%d\r\n", num); + + for (i = 1; i < num; i++) + { + printf( "%d " + "%d " + "%d " + "%d " + "%d " + "%d " + "%d " + "%d " + + "%d " + "%d " + "%d " + "\r\n" + ,i + ,pCtrl->outInfoList[i].cmdPosition // ָλ + ,pCtrl->outInfoList[i].targetMotoPos // Ŀλ + ,pCtrl->outInfoList[i].ecdPosition // λ + ,pCtrl->outInfoList[i].thisPosErr // λƫ + ,pCtrl->outInfoList[i].integral // ƫ + ,pCtrl->outInfoList[i].differential // λ΢ + ,pCtrl->outInfoList[i].pospid // λPID + ,pCtrl->outInfoList[i].thisactVel // ٶ + + ,pCtrl->outInfoList[i].setMotoPos // λ + ,pCtrl->outInfoList[i].effort // õ + ); + + if (IsConsoleCancel() != 0) + { + break; + } + DelayMs(10); + } + } + else + { + pCtrl->outInfoIdx = 0; + pCtrl->timeGap = gap; + pCtrl->outInfoEn = 1; + + printf("test out begin, idx=%d\r\n", dridx); + + // + DrvMotionPara drpara; + memset(&drpara, 0, sizeof(DrvMotionPara)); + + drpara.movement = p2; // λ + drpara.startPPS = pCtrl->paras.startPPS; // ٶ + drpara.runPPS = pCtrl->paras.runPPS; // ˶ٶ + drpara.addPPSS = pCtrl->paras.addPPSS; // ͣٶ + drpara.brkPPSS = pCtrl->paras.brkPPSS; // ɲٶ + + drpara.blockRunflag = 0; // б־, =1,ͬ˶ =0,,첽˶ + + DrvMotionStart(dridx, &drpara); // ˶ + + do + { + if (pCtrl->outInfoEn == 0) + { + break; + } + + if (IsConsoleCancel() != 0) + { + break; + } + }while(1); + + printf("test out end\r\n"); + } +#endif + } + +} + +void ShowDriver(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (para1 != NULL && strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (para2 != NULL && strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + + if (p1 == 1) + { + if (p2 > 0 && p2 <= DRIVERS_NUM) + { + printf("%d.cmdPosition=%d, ecdPosition=%d, runPosition=%d\r\n", + p2, g_driverCtrl[p2-1].cmdPosition, g_driverCtrl[p2-1].ecdPosition, g_driverCtrl[p2-1].runPosition); + } + } +} + +#endif diff --git a/NxFuncs/closedriver/driversctrl.h b/NxFuncs/closedriver/driversctrl.h new file mode 100644 index 0000000..02bf157 --- /dev/null +++ b/NxFuncs/closedriver/driversctrl.h @@ -0,0 +1,62 @@ + + +#ifndef __DRIVERSCTRL_H__ +#define __DRIVERSCTRL_H__ + +#include "config.h" + +#ifndef DRIVERS_NUM +#define DRIVERS_NUM 0 +#endif + +// ֧4· +#if (DRIVERS_NUM > 4) +#undef DRIVERS_NUM +#define DRIVERS_NUM 4 +#endif + + +#define DRIVER1_IDX 0 +#define DRIVER2_IDX 1 +#define DRIVER3_IDX 2 +#define DRIVER4_IDX 3 +//-------------------------------------------- +// 붨 +#define DR_ERR_POS 0x01 // λ + +// ״̬ +#define DR_ERR_ZERO 0x101 // +#define DR_STA_DIS 0x102 // ʧ + +//-------------------------------------------- + +void InitDriversCtrl(void); + +void DriversCtrlIntProc(void); + +void CPURateIntProc(int section); + +u32 GetDrvErrorCode(int driverIdx); +void CleanDrvErrorCode(int driverIdx); +void SetDrvErrorCode(int driverIdx, int code); + +void DriverRunTask(void); + +void SetOpenRunCircle(int driverIdx, int circle); +void SetOpenLockCircle(int driverIdx, int circle); +void SetOpenMaxOffset(int driverIdx, int maxofst); +s32 GetClosePositionFromEcd(int driverIdx); +void SetCloseCircle(int driverIdx, int circle); + +void ResetDriverPos(int driverIdx, s32 pos); + +void SetDriverTargetPos(int driverIdx, s32 tpos); +void SetDriverOffset(int driverIdx, s32 ofst); + +void SetDriverCtrlMode(int driverIdx, int mode); + +void SetEnableCtrl(int driverIdx, int enbit); + +//-------------------------------------------- + +#endif diff --git a/NxFuncs/closedriver/sintable.c b/NxFuncs/closedriver/sintable.c new file mode 100644 index 0000000..7a818d8 --- /dev/null +++ b/NxFuncs/closedriver/sintable.c @@ -0,0 +1,331 @@ + +#include "config.h" +#include "sintable.h" + +// ұ +// sin_x[i] = sin(x/SIN_TAB_SIZE) * SIN_ITEM_MUTI x = [0--2PI) + +#if (USE_1DIV4_TAB == 1) +#define ACT_TAB_SIZE (SIN_TAB_SIZE/4) +#else +#define ACT_TAB_SIZE (SIN_TAB_SIZE) +#endif +const static s16 sin_x[ACT_TAB_SIZE + 1] = +{ +#if (SIN_TAB_SIZE == TAB_SIZE1K) + 0, 103, 206, 309, 412, 515, 618, 720, 823, 926, + 1029, 1131, 1234, 1337, 1439, 1542, 1644, 1747, 1849, 1951, + 2053, 2156, 2258, 2359, 2461, 2563, 2665, 2766, 2868, 2969, + 3070, 3171, 3272, 3373, 3474, 3574, 3674, 3775, 3875, 3975, + 4075, 4174, 4274, 4373, 4472, 4571, 4670, 4768, 4867, 4965, + 5063, 5161, 5258, 5356, 5453, 5550, 5647, 5743, 5839, 5936, + 6031, 6127, 6222, 6317, 6412, 6507, 6601, 6695, 6789, 6883, + 6976, 7069, 7162, 7254, 7346, 7438, 7530, 7621, 7712, 7803, + 7893, 7983, 8073, 8162, 8251, 8340, 8429, 8517, 8604, 8692, + 8779, 8866, 8952, 9038, 9124, 9209, 9294, 9379, 9463, 9547, + 9630, 9713, 9796, 9878, 9960, 10042, 10123, 10204, 10284, 10364, + 10444, 10523, 10601, 10680, 10758, 10835, 10912, 10989, 11065, 11140, + 11216, 11290, 11365, 11439, 11512, 11585, 11658, 11730, 11802, 11873, + 11943, 12014, 12083, 12153, 12221, 12290, 12358, 12425, 12492, 12558, + 12624, 12689, 12754, 12819, 12883, 12946, 13009, 13071, 13133, 13194, + 13255, 13315, 13375, 13434, 13493, 13551, 13608, 13666, 13722, 13778, + 13833, 13888, 13943, 13996, 14050, 14102, 14155, 14206, 14257, 14308, + 14357, 14407, 14455, 14504, 14551, 14598, 14645, 14691, 14736, 14781, + 14825, 14868, 14911, 14954, 14995, 15036, 15077, 15117, 15156, 15195, + 15233, 15271, 15308, 15344, 15380, 15415, 15450, 15484, 15517, 15550, + 15582, 15614, 15645, 15675, 15704, 15733, 15762, 15790, 15817, 15843, + 15869, 15895, 15919, 15943, 15967, 15989, 16012, 16033, 16054, 16074, + 16094, 16113, 16131, 16149, 16166, 16182, 16198, 16213, 16228, 16242, + 16255, 16267, 16279, 16291, 16301, 16311, 16321, 16329, 16337, 16345, + 16352, 16358, 16363, 16368, 16372, 16376, 16379, 16381, 16383, 16384, +#elif (SIN_TAB_SIZE == TAB_SIZE2K) + 0 , 51 , 103 , 154 , 206 , 257 , 309 , 360 , 412 , 463 , + 515 , 566 , 618 , 669 , 720 , 772 , 823 , 875 , 926 , 977 , + 1029 , 1080 , 1131 , 1183 , 1234 , 1285 , 1337 , 1388 , 1439 , 1491 , + 1542 , 1593 , 1644 , 1696 , 1747 , 1798 , 1849 , 1900 , 1951 , 2002 , + 2053 , 2105 , 2156 , 2207 , 2258 , 2309 , 2359 , 2410 , 2461 , 2512 , + 2563 , 2614 , 2665 , 2715 , 2766 , 2817 , 2868 , 2918 , 2969 , 3019 , + 3070 , 3121 , 3171 , 3222 , 3272 , 3322 , 3373 , 3423 , 3474 , 3524 , + 3574 , 3624 , 3674 , 3725 , 3775 , 3825 , 3875 , 3925 , 3975 , 4025 , + 4075 , 4124 , 4174 , 4224 , 4274 , 4323 , 4373 , 4423 , 4472 , 4522 , + 4571 , 4620 , 4670 , 4719 , 4768 , 4818 , 4867 , 4916 , 4965 , 5014 , + 5063 , 5112 , 5161 , 5210 , 5258 , 5307 , 5356 , 5404 , 5453 , 5501 , + 5550 , 5598 , 5647 , 5695 , 5743 , 5791 , 5839 , 5888 , 5936 , 5983 , + 6031 , 6079 , 6127 , 6175 , 6222 , 6270 , 6317 , 6365 , 6412 , 6460 , + 6507 , 6554 , 6601 , 6648 , 6695 , 6742 , 6789 , 6836 , 6883 , 6929 , + 6976 , 7023 , 7069 , 7115 , 7162 , 7208 , 7254 , 7300 , 7346 , 7392 , + 7438 , 7484 , 7530 , 7575 , 7621 , 7667 , 7712 , 7757 , 7803 , 7848 , + 7893 , 7938 , 7983 , 8028 , 8073 , 8118 , 8162 , 8207 , 8251 , 8296 , + 8340 , 8384 , 8429 , 8473 , 8517 , 8561 , 8604 , 8648 , 8692 , 8735 , + 8779 , 8822 , 8866 , 8909 , 8952 , 8995 , 9038 , 9081 , 9124 , 9167 , + 9209 , 9252 , 9294 , 9336 , 9379 , 9421 , 9463 , 9505 , 9547 , 9589 , + 9630 , 9672 , 9713 , 9755 , 9796 , 9837 , 9878 , 9919 , 9960 , 10001, + 10042, 10082, 10123, 10163, 10204, 10244, 10284, 10324, 10364, 10404, + 10444, 10483, 10523, 10562, 10601, 10641, 10680, 10719, 10758, 10796, + 10835, 10873, 10912, 10950, 10989, 11027, 11065, 11103, 11140, 11178, + 11216, 11253, 11290, 11328, 11365, 11402, 11439, 11476, 11512, 11549, + 11585, 11622, 11658, 11694, 11730, 11766, 11802, 11837, 11873, 11908, + 11943, 11979, 12014, 12049, 12083, 12118, 12153, 12187, 12221, 12256, + 12290, 12324, 12358, 12391, 12425, 12458, 12492, 12525, 12558, 12591, + 12624, 12657, 12689, 12722, 12754, 12787, 12819, 12851, 12883, 12914, + 12946, 12977, 13009, 13040, 13071, 13102, 13133, 13164, 13194, 13225, + 13255, 13285, 13315, 13345, 13375, 13405, 13434, 13463, 13493, 13522, + 13551, 13580, 13608, 13637, 13666, 13694, 13722, 13750, 13778, 13806, + 13833, 13861, 13888, 13916, 13943, 13970, 13996, 14023, 14050, 14076, + 14102, 14129, 14155, 14180, 14206, 14232, 14257, 14282, 14308, 14333, + 14357, 14382, 14407, 14431, 14455, 14480, 14504, 14528, 14551, 14575, + 14598, 14622, 14645, 14668, 14691, 14713, 14736, 14758, 14781, 14803, + 14825, 14847, 14868, 14890, 14911, 14932, 14954, 14974, 14995, 15016, + 15036, 15057, 15077, 15097, 15117, 15137, 15156, 15176, 15195, 15214, + 15233, 15252, 15271, 15290, 15308, 15326, 15344, 15362, 15380, 15398, + 15415, 15433, 15450, 15467, 15484, 15501, 15517, 15534, 15550, 15566, + 15582, 15598, 15614, 15629, 15645, 15660, 15675, 15690, 15704, 15719, + 15733, 15748, 15762, 15776, 15790, 15803, 15817, 15830, 15843, 15856, + 15869, 15882, 15895, 15907, 15919, 15931, 15943, 15955, 15967, 15978, + 15989, 16001, 16012, 16022, 16033, 16044, 16054, 16064, 16074, 16084, + 16094, 16103, 16113, 16122, 16131, 16140, 16149, 16157, 16166, 16174, + 16182, 16190, 16198, 16206, 16213, 16221, 16228, 16235, 16242, 16248, + 16255, 16261, 16267, 16273, 16279, 16285, 16291, 16296, 16301, 16306, + 16311, 16316, 16321, 16325, 16329, 16333, 16337, 16341, 16345, 16348, + 16352, 16355, 16358, 16361, 16363, 16366, 16368, 16370, 16372, 16374, + 16376, 16377, 16379, 16380, 16381, 16382, 16383, 16383, 16384, 16384, +#elif (SIN_TAB_SIZE == TAB_SIZE4K) + 0 , 26 , 51 , 77 , 103 , 129 , 154 , 180 , 206 , 232 , + 257 , 283 , 309 , 335 , 360 , 386 , 412 , 437 , 463 , 489 , + 515 , 540 , 566 , 592 , 618 , 643 , 669 , 695 , 720 , 746 , + 772 , 797 , 823 , 849 , 875 , 900 , 926 , 952 , 977 , 1003 , + 1029 , 1054 , 1080 , 1106 , 1131 , 1157 , 1183 , 1208 , 1234 , 1260 , + 1285 , 1311 , 1337 , 1362 , 1388 , 1414 , 1439 , 1465 , 1491 , 1516 , + 1542 , 1567 , 1593 , 1619 , 1644 , 1670 , 1696 , 1721 , 1747 , 1772 , + 1798 , 1823 , 1849 , 1875 , 1900 , 1926 , 1951 , 1977 , 2002 , 2028 , + 2053 , 2079 , 2105 , 2130 , 2156 , 2181 , 2207 , 2232 , 2258 , 2283 , + 2309 , 2334 , 2359 , 2385 , 2410 , 2436 , 2461 , 2487 , 2512 , 2538 , + 2563 , 2588 , 2614 , 2639 , 2665 , 2690 , 2715 , 2741 , 2766 , 2792 , + 2817 , 2842 , 2868 , 2893 , 2918 , 2944 , 2969 , 2994 , 3019 , 3045 , + 3070 , 3095 , 3121 , 3146 , 3171 , 3196 , 3222 , 3247 , 3272 , 3297 , + 3322 , 3348 , 3373 , 3398 , 3423 , 3448 , 3474 , 3499 , 3524 , 3549 , + 3574 , 3599 , 3624 , 3649 , 3674 , 3700 , 3725 , 3750 , 3775 , 3800 , + 3825 , 3850 , 3875 , 3900 , 3925 , 3950 , 3975 , 4000 , 4025 , 4050 , + 4075 , 4099 , 4124 , 4149 , 4174 , 4199 , 4224 , 4249 , 4274 , 4298 , + 4323 , 4348 , 4373 , 4398 , 4423 , 4447 , 4472 , 4497 , 4522 , 4546 , + 4571 , 4596 , 4620 , 4645 , 4670 , 4694 , 4719 , 4744 , 4768 , 4793 , + 4818 , 4842 , 4867 , 4891 , 4916 , 4940 , 4965 , 4989 , 5014 , 5038 , + 5063 , 5087 , 5112 , 5136 , 5161 , 5185 , 5210 , 5234 , 5258 , 5283 , + 5307 , 5331 , 5356 , 5380 , 5404 , 5429 , 5453 , 5477 , 5501 , 5526 , + 5550 , 5574 , 5598 , 5622 , 5647 , 5671 , 5695 , 5719 , 5743 , 5767 , + 5791 , 5815 , 5839 , 5863 , 5888 , 5912 , 5936 , 5959 , 5983 , 6007 , + 6031 , 6055 , 6079 , 6103 , 6127 , 6151 , 6175 , 6198 , 6222 , 6246 , + 6270 , 6294 , 6317 , 6341 , 6365 , 6389 , 6412 , 6436 , 6460 , 6483 , + 6507 , 6530 , 6554 , 6578 , 6601 , 6625 , 6648 , 6672 , 6695 , 6719 , + 6742 , 6766 , 6789 , 6813 , 6836 , 6859 , 6883 , 6906 , 6929 , 6953 , + 6976 , 6999 , 7023 , 7046 , 7069 , 7092 , 7115 , 7139 , 7162 , 7185 , + 7208 , 7231 , 7254 , 7277 , 7300 , 7323 , 7346 , 7369 , 7392 , 7415 , + 7438 , 7461 , 7484 , 7507 , 7530 , 7553 , 7575 , 7598 , 7621 , 7644 , + 7667 , 7689 , 7712 , 7735 , 7757 , 7780 , 7803 , 7825 , 7848 , 7870 , + 7893 , 7916 , 7938 , 7961 , 7983 , 8006 , 8028 , 8050 , 8073 , 8095 , + 8118 , 8140 , 8162 , 8185 , 8207 , 8229 , 8251 , 8274 , 8296 , 8318 , + 8340 , 8362 , 8384 , 8406 , 8429 , 8451 , 8473 , 8495 , 8517 , 8539 , + 8561 , 8583 , 8604 , 8626 , 8648 , 8670 , 8692 , 8714 , 8735 , 8757 , + 8779 , 8801 , 8822 , 8844 , 8866 , 8887 , 8909 , 8931 , 8952 , 8974 , + 8995 , 9017 , 9038 , 9060 , 9081 , 9102 , 9124 , 9145 , 9167 , 9188 , + 9209 , 9230 , 9252 , 9273 , 9294 , 9315 , 9336 , 9358 , 9379 , 9400 , + 9421 , 9442 , 9463 , 9484 , 9505 , 9526 , 9547 , 9568 , 9589 , 9609 , + 9630 , 9651 , 9672 , 9693 , 9713 , 9734 , 9755 , 9775 , 9796 , 9817 , + 9837 , 9858 , 9878 , 9899 , 9919 , 9940 , 9960 , 9981 , 10001, 10022, + 10042, 10062, 10082, 10103, 10123, 10143, 10163, 10184, 10204, 10224, + 10244, 10264, 10284, 10304, 10324, 10344, 10364, 10384, 10404, 10424, + 10444, 10463, 10483, 10503, 10523, 10542, 10562, 10582, 10601, 10621, + 10641, 10660, 10680, 10699, 10719, 10738, 10758, 10777, 10796, 10816, + 10835, 10854, 10873, 10893, 10912, 10931, 10950, 10969, 10989, 11008, + 11027, 11046, 11065, 11084, 11103, 11121, 11140, 11159, 11178, 11197, + 11216, 11234, 11253, 11272, 11290, 11309, 11328, 11346, 11365, 11383, + 11402, 11420, 11439, 11457, 11476, 11494, 11512, 11531, 11549, 11567, + 11585, 11603, 11622, 11640, 11658, 11676, 11694, 11712, 11730, 11748, + 11766, 11784, 11802, 11819, 11837, 11855, 11873, 11890, 11908, 11926, + 11943, 11961, 11979, 11996, 12014, 12031, 12049, 12066, 12083, 12101, + 12118, 12135, 12153, 12170, 12187, 12204, 12221, 12239, 12256, 12273, + 12290, 12307, 12324, 12341, 12358, 12375, 12391, 12408, 12425, 12442, + 12458, 12475, 12492, 12508, 12525, 12542, 12558, 12575, 12591, 12608, + 12624, 12640, 12657, 12673, 12689, 12706, 12722, 12738, 12754, 12770, + 12787, 12803, 12819, 12835, 12851, 12867, 12883, 12898, 12914, 12930, + 12946, 12962, 12977, 12993, 13009, 13024, 13040, 13056, 13071, 13087, + 13102, 13117, 13133, 13148, 13164, 13179, 13194, 13209, 13225, 13240, + 13255, 13270, 13285, 13300, 13315, 13330, 13345, 13360, 13375, 13390, + 13405, 13419, 13434, 13449, 13463, 13478, 13493, 13507, 13522, 13536, + 13551, 13565, 13580, 13594, 13608, 13623, 13637, 13651, 13666, 13680, + 13694, 13708, 13722, 13736, 13750, 13764, 13778, 13792, 13806, 13820, + 13833, 13847, 13861, 13875, 13888, 13902, 13916, 13929, 13943, 13956, + 13970, 13983, 13996, 14010, 14023, 14036, 14050, 14063, 14076, 14089, + 14102, 14115, 14129, 14142, 14155, 14167, 14180, 14193, 14206, 14219, + 14232, 14244, 14257, 14270, 14282, 14295, 14308, 14320, 14333, 14345, + 14357, 14370, 14382, 14394, 14407, 14419, 14431, 14443, 14455, 14468, + 14480, 14492, 14504, 14516, 14528, 14539, 14551, 14563, 14575, 14587, + 14598, 14610, 14622, 14633, 14645, 14656, 14668, 14679, 14691, 14702, + 14713, 14725, 14736, 14747, 14758, 14769, 14781, 14792, 14803, 14814, + 14825, 14836, 14847, 14857, 14868, 14879, 14890, 14900, 14911, 14922, + 14932, 14943, 14954, 14964, 14974, 14985, 14995, 15006, 15016, 15026, + 15036, 15047, 15057, 15067, 15077, 15087, 15097, 15107, 15117, 15127, + 15137, 15147, 15156, 15166, 15176, 15186, 15195, 15205, 15214, 15224, + 15233, 15243, 15252, 15262, 15271, 15280, 15290, 15299, 15308, 15317, + 15326, 15335, 15344, 15353, 15362, 15371, 15380, 15389, 15398, 15407, + 15415, 15424, 15433, 15441, 15450, 15459, 15467, 15475, 15484, 15492, + 15501, 15509, 15517, 15525, 15534, 15542, 15550, 15558, 15566, 15574, + 15582, 15590, 15598, 15606, 15614, 15621, 15629, 15637, 15645, 15652, + 15660, 15667, 15675, 15682, 15690, 15697, 15704, 15712, 15719, 15726, + 15733, 15741, 15748, 15755, 15762, 15769, 15776, 15783, 15790, 15796, + 15803, 15810, 15817, 15824, 15830, 15837, 15843, 15850, 15856, 15863, + 15869, 15876, 15882, 15888, 15895, 15901, 15907, 15913, 15919, 15925, + 15931, 15937, 15943, 15949, 15955, 15961, 15967, 15972, 15978, 15984, + 15989, 15995, 16001, 16006, 16012, 16017, 16022, 16028, 16033, 16038, + 16044, 16049, 16054, 16059, 16064, 16069, 16074, 16079, 16084, 16089, + 16094, 16099, 16103, 16108, 16113, 16117, 16122, 16127, 16131, 16136, + 16140, 16144, 16149, 16153, 16157, 16162, 16166, 16170, 16174, 16178, + 16182, 16186, 16190, 16194, 16198, 16202, 16206, 16209, 16213, 16217, + 16221, 16224, 16228, 16231, 16235, 16238, 16242, 16245, 16248, 16252, + 16255, 16258, 16261, 16264, 16267, 16270, 16273, 16276, 16279, 16282, + 16285, 16288, 16291, 16293, 16296, 16299, 16301, 16304, 16306, 16309, + 16311, 16314, 16316, 16318, 16321, 16323, 16325, 16327, 16329, 16331, + 16333, 16335, 16337, 16339, 16341, 16343, 16345, 16347, 16348, 16350, + 16352, 16353, 16355, 16356, 16358, 16359, 16361, 16362, 16363, 16365, + 16366, 16367, 16368, 16369, 16370, 16371, 16372, 16373, 16374, 16375, + 16376, 16377, 16377, 16378, 16379, 16379, 16380, 16381, 16381, 16382, + 16382, 16382, 16383, 16383, 16383, 16383, 16384, 16384, 16384, 16384, +#elif (SIN_TAB_SIZE == TAB_SIZE256) + 0, 402, 804, 1205, + 1606, 2006, 2404, 2801, + 3196, 3590, 3981, 4370, + 4756, 5139, 5520, 5897, + 6270, 6639, 7005, 7366, + 7723, 8076, 8423, 8765, + 9102, 9434, 9760, 10080, + 10394, 10702, 11003, 11297, + 11585, 11866, 12140, 12406, + 12665, 12916, 13160, 13395, + 13623, 13842, 14053, 14256, + 14449, 14635, 14811, 14978, + 15137, 15286, 15426, 15557, + 15679, 15791, 15893, 15986, + 16069, 16143, 16207, 16261, + 16305, 16340, 16364, 16379, +#elif (SIN_TAB_SIZE == TAB_SIZE1024) + 0, 101, 201, 302, 402, 503, 603, 704, 804, 904, 1005, 1105, 1205, 1306, 1406, 1506, + 1606, 1706, 1806, 1906, 2006, 2105, 2205, 2305, 2404, 2503, 2603, 2702, 2801, 2900, 2999, 3098, + 3196, 3295, 3393, 3492, 3590, 3688, 3786, 3883, 3981, 4078, 4176, 4273, 4370, 4467, 4563, 4660, + 4756, 4852, 4948, 5044, 5139, 5235, 5330, 5425, 5520, 5614, 5708, 5803, 5897, 5990, 6084, 6177, + 6270, 6363, 6455, 6547, 6639, 6731, 6823, 6914, 7005, 7096, 7186, 7276, 7366, 7456, 7545, 7635, + 7723, 7812, 7900, 7988, 8076, 8163, 8250, 8337, 8423, 8509, 8595, 8680, 8765, 8850, 8935, 9019, + 9102, 9186, 9269, 9352, 9434, 9516, 9598, 9679, 9760, 9841, 9921, 10001, 10080, 10159, 10238, 10316, + 10394, 10471, 10549, 10625, 10702, 10778, 10853, 10928, 11003, 11077, 11151, 11224, 11297, 11370, 11442, 11514, + 11585, 11656, 11727, 11797, 11866, 11935, 12004, 12072, 12140, 12207, 12274, 12340, 12406, 12472, 12537, 12601, + 12665, 12729, 12792, 12854, 12916, 12978, 13039, 13100, 13160, 13219, 13279, 13337, 13395, 13453, 13510, 13567, + 13623, 13678, 13733, 13788, 13842, 13896, 13949, 14001, 14053, 14104, 14155, 14206, 14256, 14305, 14354, 14402, + 14449, 14497, 14543, 14589, 14635, 14680, 14724, 14768, 14811, 14854, 14896, 14937, 14978, 15019, 15059, 15098, + 15137, 15175, 15213, 15250, 15286, 15322, 15357, 15392, 15426, 15460, 15493, 15525, 15557, 15588, 15619, 15649, + 15679, 15707, 15736, 15763, 15791, 15817, 15843, 15868, 15893, 15917, 15941, 15964, 15986, 16008, 16029, 16049, + 16069, 16088, 16107, 16125, 16143, 16160, 16176, 16192, 16207, 16221, 16235, 16248, 16261, 16273, 16284, 16295, + 16305, 16315, 16324, 16332, 16340, 16347, 16353, 16359, 16364, 16369, 16373, 16376, 16379, 16381, 16383, 16384, +#elif (SIN_TAB_SIZE == TAB_SIZE4096) + 0, 25, 50, 75, 101, 126, 151, 176, 201, 226, 251, 276, 302, 327, 352, 377, + 402, 427, 452, 477, 503, 528, 553, 578, 603, 628, 653, 678, 704, 729, 754, 779, + 804, 829, 854, 879, 904, 929, 955, 980, 1005, 1030, 1055, 1080, 1105, 1130, 1155, 1180, + 1205, 1230, 1255, 1280, 1306, 1331, 1356, 1381, 1406, 1431, 1456, 1481, 1506, 1531, 1556, 1581, + 1606, 1631, 1656, 1681, 1706, 1731, 1756, 1781, 1806, 1831, 1856, 1881, 1906, 1931, 1956, 1981, + 2006, 2031, 2055, 2080, 2105, 2130, 2155, 2180, 2205, 2230, 2255, 2280, 2305, 2329, 2354, 2379, + 2404, 2429, 2454, 2479, 2503, 2528, 2553, 2578, 2603, 2628, 2652, 2677, 2702, 2727, 2752, 2776, + 2801, 2826, 2851, 2875, 2900, 2925, 2949, 2974, 2999, 3024, 3048, 3073, 3098, 3122, 3147, 3172, + 3196, 3221, 3246, 3270, 3295, 3320, 3344, 3369, 3393, 3418, 3442, 3467, 3492, 3516, 3541, 3565, + 3590, 3614, 3639, 3663, 3688, 3712, 3737, 3761, 3786, 3810, 3835, 3859, 3883, 3908, 3932, 3957, + 3981, 4005, 4030, 4054, 4078, 4103, 4127, 4151, 4176, 4200, 4224, 4249, 4273, 4297, 4321, 4346, + 4370, 4394, 4418, 4442, 4467, 4491, 4515, 4539, 4563, 4587, 4612, 4636, 4660, 4684, 4708, 4732, + 4756, 4780, 4804, 4828, 4852, 4876, 4900, 4924, 4948, 4972, 4996, 5020, 5044, 5068, 5092, 5115, + 5139, 5163, 5187, 5211, 5235, 5259, 5282, 5306, 5330, 5354, 5377, 5401, 5425, 5449, 5472, 5496, + 5520, 5543, 5567, 5591, 5614, 5638, 5661, 5685, 5708, 5732, 5756, 5779, 5803, 5826, 5850, 5873, + 5897, 5920, 5943, 5967, 5990, 6014, 6037, 6060, 6084, 6107, 6130, 6154, 6177, 6200, 6223, 6247, + 6270, 6293, 6316, 6339, 6363, 6386, 6409, 6432, 6455, 6478, 6501, 6524, 6547, 6570, 6593, 6616, + 6639, 6662, 6685, 6708, 6731, 6754, 6777, 6800, 6823, 6846, 6868, 6891, 6914, 6937, 6960, 6982, + 7005, 7028, 7050, 7073, 7096, 7118, 7141, 7164, 7186, 7209, 7231, 7254, 7276, 7299, 7321, 7344, + 7366, 7389, 7411, 7434, 7456, 7478, 7501, 7523, 7545, 7568, 7590, 7612, 7635, 7657, 7679, 7701, + 7723, 7746, 7768, 7790, 7812, 7834, 7856, 7878, 7900, 7922, 7944, 7966, 7988, 8010, 8032, 8054, + 8076, 8098, 8119, 8141, 8163, 8185, 8207, 8228, 8250, 8272, 8293, 8315, 8337, 8358, 8380, 8401, + 8423, 8445, 8466, 8488, 8509, 8531, 8552, 8573, 8595, 8616, 8638, 8659, 8680, 8702, 8723, 8744, + 8765, 8787, 8808, 8829, 8850, 8871, 8892, 8914, 8935, 8956, 8977, 8998, 9019, 9040, 9061, 9082, + 9102, 9123, 9144, 9165, 9186, 9207, 9227, 9248, 9269, 9290, 9310, 9331, 9352, 9372, 9393, 9413, + 9434, 9455, 9475, 9496, 9516, 9537, 9557, 9577, 9598, 9618, 9638, 9659, 9679, 9699, 9720, 9740, + 9760, 9780, 9800, 9820, 9841, 9861, 9881, 9901, 9921, 9941, 9961, 9981, 10001, 10020, 10040, 10060, + 10080, 10100, 10120, 10139, 10159, 10179, 10198, 10218, 10238, 10257, 10277, 10296, 10316, 10336, 10355, 10374, + 10394, 10413, 10433, 10452, 10471, 10491, 10510, 10529, 10549, 10568, 10587, 10606, 10625, 10644, 10663, 10683, + 10702, 10721, 10740, 10759, 10778, 10796, 10815, 10834, 10853, 10872, 10891, 10909, 10928, 10947, 10966, 10984, + 11003, 11021, 11040, 11059, 11077, 11096, 11114, 11133, 11151, 11169, 11188, 11206, 11224, 11243, 11261, 11279, + 11297, 11316, 11334, 11352, 11370, 11388, 11406, 11424, 11442, 11460, 11478, 11496, 11514, 11532, 11550, 11567, + 11585, 11603, 11621, 11638, 11656, 11674, 11691, 11709, 11727, 11744, 11762, 11779, 11797, 11814, 11831, 11849, + 11866, 11883, 11901, 11918, 11935, 11952, 11970, 11987, 12004, 12021, 12038, 12055, 12072, 12089, 12106, 12123, + 12140, 12157, 12173, 12190, 12207, 12224, 12240, 12257, 12274, 12290, 12307, 12324, 12340, 12357, 12373, 12390, + 12406, 12423, 12439, 12455, 12472, 12488, 12504, 12520, 12537, 12553, 12569, 12585, 12601, 12617, 12633, 12649, + 12665, 12681, 12697, 12713, 12729, 12744, 12760, 12776, 12792, 12807, 12823, 12839, 12854, 12870, 12885, 12901, + 12916, 12932, 12947, 12963, 12978, 12993, 13008, 13024, 13039, 13054, 13069, 13085, 13100, 13115, 13130, 13145, + 13160, 13175, 13190, 13205, 13219, 13234, 13249, 13264, 13279, 13293, 13308, 13323, 13337, 13352, 13366, 13381, + 13395, 13410, 13424, 13439, 13453, 13467, 13482, 13496, 13510, 13524, 13538, 13553, 13567, 13581, 13595, 13609, + 13623, 13637, 13651, 13665, 13678, 13692, 13706, 13720, 13733, 13747, 13761, 13774, 13788, 13802, 13815, 13829, + 13842, 13856, 13869, 13882, 13896, 13909, 13922, 13935, 13949, 13962, 13975, 13988, 14001, 14014, 14027, 14040, + 14053, 14066, 14079, 14092, 14104, 14117, 14130, 14143, 14155, 14168, 14181, 14193, 14206, 14218, 14231, 14243, + 14256, 14268, 14280, 14293, 14305, 14317, 14329, 14341, 14354, 14366, 14378, 14390, 14402, 14414, 14426, 14438, + 14449, 14461, 14473, 14485, 14497, 14508, 14520, 14531, 14543, 14555, 14566, 14578, 14589, 14601, 14612, 14623, + 14635, 14646, 14657, 14668, 14680, 14691, 14702, 14713, 14724, 14735, 14746, 14757, 14768, 14779, 14789, 14800, + 14811, 14822, 14832, 14843, 14854, 14864, 14875, 14885, 14896, 14906, 14917, 14927, 14937, 14948, 14958, 14968, + 14978, 14989, 14999, 15009, 15019, 15029, 15039, 15049, 15059, 15069, 15078, 15088, 15098, 15108, 15118, 15127, + 15137, 15146, 15156, 15166, 15175, 15184, 15194, 15203, 15213, 15222, 15231, 15240, 15250, 15259, 15268, 15277, + 15286, 15295, 15304, 15313, 15322, 15331, 15340, 15349, 15357, 15366, 15375, 15383, 15392, 15401, 15409, 15418, + 15426, 15435, 15443, 15451, 15460, 15468, 15476, 15485, 15493, 15501, 15509, 15517, 15525, 15533, 15541, 15549, + 15557, 15565, 15573, 15581, 15588, 15596, 15604, 15611, 15619, 15627, 15634, 15642, 15649, 15656, 15664, 15671, + 15679, 15686, 15693, 15700, 15707, 15715, 15722, 15729, 15736, 15743, 15750, 15757, 15763, 15770, 15777, 15784, + 15791, 15797, 15804, 15810, 15817, 15824, 15830, 15837, 15843, 15849, 15856, 15862, 15868, 15875, 15881, 15887, + 15893, 15899, 15905, 15911, 15917, 15923, 15929, 15935, 15941, 15946, 15952, 15958, 15964, 15969, 15975, 15980, + 15986, 15991, 15997, 16002, 16008, 16013, 16018, 16024, 16029, 16034, 16039, 16044, 16049, 16054, 16059, 16064, + 16069, 16074, 16079, 16084, 16088, 16093, 16098, 16103, 16107, 16112, 16116, 16121, 16125, 16130, 16134, 16138, + 16143, 16147, 16151, 16156, 16160, 16164, 16168, 16172, 16176, 16180, 16184, 16188, 16192, 16195, 16199, 16203, + 16207, 16210, 16214, 16218, 16221, 16225, 16228, 16232, 16235, 16238, 16242, 16245, 16248, 16251, 16255, 16258, + 16261, 16264, 16267, 16270, 16273, 16276, 16279, 16281, 16284, 16287, 16290, 16292, 16295, 16298, 16300, 16303, + 16305, 16308, 16310, 16312, 16315, 16317, 16319, 16321, 16324, 16326, 16328, 16330, 16332, 16334, 16336, 16338, + 16340, 16341, 16343, 16345, 16347, 16348, 16350, 16352, 16353, 16355, 16356, 16358, 16359, 16360, 16362, 16363, + 16364, 16365, 16367, 16368, 16369, 16370, 16371, 16372, 16373, 16374, 16375, 16375, 16376, 16377, 16378, 16378, + 16379, 16380, 16380, 16381, 16381, 16382, 16382, 16382, 16383, 16383, 16383, 16384, 16384, 16384, 16384, 16384, +#else + +#endif + + 16384, +}; + +int GetSinValue(int angidx) +{ + angidx %= SIN_TAB_SIZE; + if (angidx < 0) + { + angidx += SIN_TAB_SIZE; + } +#if (USE_1DIV4_TAB == 1) + { + int dir = 1; + int actidx = angidx; + if (angidx >= ACT_TAB_SIZE*3) + { + actidx = ACT_TAB_SIZE*4 - angidx; + dir = -1; + } + else if (angidx >= ACT_TAB_SIZE*2) + { + actidx = angidx - ACT_TAB_SIZE*2; + dir = -1; + } + else if (angidx >= ACT_TAB_SIZE*1) + { + actidx = ACT_TAB_SIZE*2 - angidx; + } + // printf("angidx=%d, actidx=%d, dir=%d\r\n", angidx, actidx, dir); + return sin_x[actidx] * dir; + } +#else + return sin_x[angidx]; +#endif +} + diff --git a/NxFuncs/closedriver/sintable.h b/NxFuncs/closedriver/sintable.h new file mode 100644 index 0000000..9c8e713 --- /dev/null +++ b/NxFuncs/closedriver/sintable.h @@ -0,0 +1,28 @@ + + +#ifndef __SINTABLE_H__ +#define __SINTABLE_H__ + +#include "config.h" + +#define TAB_SIZE1K 1000 +#define TAB_SIZE2K 2000 +#define TAB_SIZE4K 4000 + +#define TAB_SIZE256 256 +#define TAB_SIZE1024 1024 +#define TAB_SIZE4096 4096 + +#define USE_1DIV4_TAB 1 // ķ֮һ + +#ifndef SIN_TAB_SIZE +#define SIN_TAB_SIZE TAB_SIZE4K // (0 -- SIN_TAB_SIZE) +#endif + +#define SIN_ITEM_MUTI 16384 // ֵΧ(-SIN_ITEM_MUTI -- SIN_ITEM_MUTI) + +// ȡֵ +// GetSinValue(i) = sin(i*2PI/SIN_TAB_SIZE) * SIN_ITEM_MUTI +int GetSinValue(int angidx); + +#endif diff --git a/NxFuncs/closedriver/stepmotos.c b/NxFuncs/closedriver/stepmotos.c new file mode 100644 index 0000000..74492be --- /dev/null +++ b/NxFuncs/closedriver/stepmotos.c @@ -0,0 +1,348 @@ + + +#include "stepmotos.h" +#include "inout.h" + +//------------------------------------------------------------------------ + + +void DefaultMotoCoilPwm(int coil){}; +void DefaultMotoCoilCtrl(void){}; + +#define FULL_STEP_VAL (1.0f*MOTO_PPC/FULL_STEP_PPC) // ӳֵ +#define DEF_MICO_STEP_VAL (1.0f*MOTO_PPC/MICO_STEP_PPC) // Ĭ΢ӳֵ + + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + +typedef struct +{ + POS_TYPE motoPos; // λ + + POS_TYPE fullStepAng; // ӳֵ + POS_TYPE micoStepAng; // ɱӳֵ + + int ccwdir; + + void (*MotoCoilAPwm)(int); + void (*SetMotoACPOn)(void); + void (*SetMotoACPOff)(void); + + void (*SetMotoACNOn)(void); + void (*SetMotoACNOff)(void); + + void (*MotoCoilBPwm)(int); + void (*SetMotoBCPOn)(void); + void (*SetMotoBCPOff)(void); + + void (*SetMotoBCNOn)(void); + void (*SetMotoBCNOff)(void); + +}StepMotoCtrl; + +StepMotoCtrl g_stepMotoCtrl[STEP_MOTOS_NUM]; + +//------------------------------------------------------------------------ + +void InitStepMotos(void) +{ + memset(g_stepMotoCtrl, 0, sizeof(StepMotoCtrl)*STEP_MOTOS_NUM); + + for (int i = 0; i < STEP_MOTOS_NUM; i++) + { + g_stepMotoCtrl[i].motoPos = 0; // λ + g_stepMotoCtrl[i].ccwdir = CCWDIR_POSI; // + + g_stepMotoCtrl[i].fullStepAng = FULL_STEP_VAL; // ӳֵ + g_stepMotoCtrl[i].micoStepAng = DEF_MICO_STEP_VAL; // ɱӳֵ + + g_stepMotoCtrl[i].MotoCoilAPwm = DefaultMotoCoilPwm; + g_stepMotoCtrl[i].SetMotoACPOn = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoACPOff = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoACNOn = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoACNOff = DefaultMotoCoilCtrl; + + g_stepMotoCtrl[i].MotoCoilBPwm= DefaultMotoCoilPwm; + g_stepMotoCtrl[i].SetMotoBCPOn = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoBCPOff = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoBCNOn = DefaultMotoCoilCtrl; + g_stepMotoCtrl[i].SetMotoBCNOff = DefaultMotoCoilCtrl; + } +} + +//------------------------------------------------------------------------ + +void SetMotoCtrlFuncs(int motoIdx, + MotoCoilPwm coilapwm, MotoCoilCtrl acpon, MotoCoilCtrl acpoff, MotoCoilCtrl acnon, MotoCoilCtrl acnoff, + MotoCoilPwm coilbpwm, MotoCoilCtrl bcpon, MotoCoilCtrl bcpoff, MotoCoilCtrl bcnon, MotoCoilCtrl bcnoff) +{ + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + pCtrl->MotoCoilAPwm = coilapwm; + pCtrl->SetMotoACPOn = acpon; + pCtrl->SetMotoACPOff = acpoff; + pCtrl->SetMotoACNOn = acnon; + pCtrl->SetMotoACNOff = acnoff; + + pCtrl->MotoCoilBPwm= coilbpwm; + pCtrl->SetMotoBCPOn = bcpon; + pCtrl->SetMotoBCPOff = bcpoff; + pCtrl->SetMotoBCNOn = bcnon; + pCtrl->SetMotoBCNOff = bcnoff; +} + +void SetMotoCCWDir(int motoIdx, int dir) +{ + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + if (dir >= 0) + { + pCtrl->ccwdir = CCWDIR_POSI; + } + else + { + pCtrl->ccwdir = CCWDIR_NEGA; + } +} + +//------------------------------------------------------------------------ +// +// theta ǶȣÿȦ 200Kλ 50K ) +// effort + +int StepMotoOut(int motoIdx, int theta, int effort) +{ + int angleA, angleB; + int coilA, coilB; + int sinA, sinB; + StepMotoCtrl * pCtrl; + + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return 0; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + + if (effort < 0) + { + effort = -effort; + } + if (effort > MAX_OUT_LEV) + { + effort = MAX_OUT_LEV; + } + + theta *= pCtrl->ccwdir; + angleA = theta % SIN_TAB_SIZE; // ((int)(theta * PHASE_MUTI)) % SIN_TAB_SIZE; + angleB = angleA + (SIN_TAB_SIZE/4); // λ 90 + + sinA = GetSinValue(angleA); + sinB = GetSinValue(angleB); + + coilA = (int)(effort * sinA / SIN_ITEM_MUTI); + coilB = (int)(effort * sinB / SIN_ITEM_MUTI); + + if (coilA > 0) + { + pCtrl->MotoCoilAPwm(coilA); + pCtrl->SetMotoACNOn(); + pCtrl->SetMotoACPOff(); + } + else if (coilA < 0) + { + pCtrl->MotoCoilAPwm(-coilA); + pCtrl->SetMotoACPOn(); + pCtrl->SetMotoACNOff(); + } + else + { + pCtrl->MotoCoilAPwm(0); + pCtrl->SetMotoACNOn(); + pCtrl->SetMotoACPOn(); + } + + if (coilB > 0) + { + pCtrl->MotoCoilBPwm(coilB); + pCtrl->SetMotoBCNOn(); + pCtrl->SetMotoBCPOff(); + } + else if (coilB < 0) + { + pCtrl->MotoCoilBPwm(-coilB); + pCtrl->SetMotoBCPOn(); + pCtrl->SetMotoBCNOff(); + } + else + { + pCtrl->MotoCoilBPwm(0); + pCtrl->SetMotoBCNOn(); + pCtrl->SetMotoBCPOn(); + } +#if (0) + printf("StepMotoOut, idx=%d, theta=%d, effort=%d\r\n", motoIdx, theta, effort); + printf("angleA=%d, sinA=%d, coilA=%d\r\n", angleA, sinA, coilA); + printf("angleB=%d, sinB=%d, coilB=%d\r\n", angleB, sinB, coilB); +#endif + + return 0; +} + +//-------------------------------------------------------------- + +void ResetMotoPos(int motoIdx, int eff) +{ + int pos; + + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + pCtrl->motoPos = 0; + pos = (int)pCtrl->motoPos; + StepMotoOut(motoIdx, pos, eff); +} + +void SetMotoEnable(int motoIdx, int eff) +{ + int pos; + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + pos = (int)pCtrl->motoPos; + StepMotoOut(motoIdx, pos, eff); +} + +void SetMotoPosTo(int motoIdx, POS_TYPE pos, int eff) +{ + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + pCtrl->motoPos = pos; + StepMotoOut(motoIdx, pos, eff); +} + +POS_TYPE GetMotoPos(int motoIdx) +{ + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return 0; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + return pCtrl->motoPos; +} + +//-------------------------------------------------------------- +// һ1.8Ⱥ +// dir 1, ; -1, ; 0 +// eff ֵ +int MotoOneFullStep(int motoIdx, int dir, int eff) +{ + int pos; + + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return 0; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + if (dir > 0) + { + pCtrl->motoPos += pCtrl->fullStepAng; + } + else if (dir < 0) + { + pCtrl->motoPos -= pCtrl->fullStepAng; + } + + pos = (int)(pCtrl->motoPos + 0.5f*(pCtrl->motoPos>=0?1:-1)); + + if (pos > MAX_MOTO_POS) + { + pos -= MAX_MOTO_POS; + pCtrl->motoPos -= MAX_MOTO_POS; + } + + if (pos < -MAX_MOTO_POS) + { + pos += MAX_MOTO_POS; + pCtrl->motoPos += MAX_MOTO_POS; + } + + StepMotoOut(motoIdx, pos, eff); + + return pos; +} + +//------------------------------------------------------------------------------------- + +// һ΢ +// dir 1, ; -1, ; 0 +// eff ֵ +// صλ + +int MotoOneMicoStep(int motoIdx, int dir, int eff) +{ + int pos; + + StepMotoCtrl * pCtrl; + if (motoIdx < 0 || motoIdx >= STEP_MOTOS_NUM) + { + return 0; + } + pCtrl = &(g_stepMotoCtrl[motoIdx]); + + if (dir > 0) + { + pCtrl->motoPos += pCtrl->micoStepAng; + } + else if (dir < 0) + { + pCtrl->motoPos -= pCtrl->micoStepAng; + } + + pos = (int)(pCtrl->motoPos + (0.5f*(pCtrl->motoPos>=0?1:-1))); + + if (pos > MAX_MOTO_POS) + { + pos -= MAX_MOTO_POS; + pCtrl->motoPos -= MAX_MOTO_POS; + } + + if (pos < -MAX_MOTO_POS) + { + pos += MAX_MOTO_POS; + pCtrl->motoPos += MAX_MOTO_POS; + } + + StepMotoOut(motoIdx, pos, eff); + + return pos; +} + diff --git a/NxFuncs/closedriver/stepmotos.h b/NxFuncs/closedriver/stepmotos.h new file mode 100644 index 0000000..0554fe7 --- /dev/null +++ b/NxFuncs/closedriver/stepmotos.h @@ -0,0 +1,95 @@ + +#ifndef __STEPMOTOS_H__ +#define __STEPMOTOS_H__ + +#include "config.h" +#include "sintable.h" + +//------------------------------------------------------------------------ +#ifndef STEP_MOTOS_NUM +#define STEP_MOTOS_NUM 0 +#endif + +#if (STEP_MOTOS_NUM > 4) +#undef STEP_MOTOS_NUM +#define STEP_MOTOS_NUM 4 +#endif + +//------------------------------------------------------------------------ + +#ifndef MOTO1_CCWDIR +#define MOTO1_CCWDIR CCWDIR_POSI +#endif + +#ifndef MOTO2_CCWDIR +#define MOTO2_CCWDIR CCWDIR_POSI +#endif + +#ifndef MOTO3_CCWDIR +#define MOTO3_CCWDIR CCWDIR_POSI +#endif + +#ifndef MOTO4_CCWDIR +#define MOTO4_CCWDIR CCWDIR_POSI +#endif + +//------------------------------------------------------------------------ + + +// ಽ, Ȧ, ų90, A+, A-, B+, B- +// Ϊ50ڣÿ 7.2 +// һڽڷ 1024 4096 , Ӧһ (sintable) + +#define MOTO_NOPP (50) // + +#define MOTO_PPC (MOTO_NOPP*SIN_TAB_SIZE) // ÿȦɿλ (50 * 4K = 200K) + +#define MAX_OUT_LEV 240 // 320 pwmռձȣ + +#define FULL_STEP_PPC 200 // /Ȧ + +#ifndef MICO_STEP_PPC +#define MICO_STEP_PPC 1000 // ΢/Ȧ +#endif + +#define PHASE_MUTI ((1.0f*MOTO_NOPP*SIN_TAB_SIZE)/(MOTO_PPC)) + +#define MAX_ABPOS_CIRCLE (1024*10) // Ȧ + +#define MAX_MOTO_POS (MAX_ABPOS_CIRCLE*MOTO_PPC) // + +#define MAX_ADVANCE (MOTO_PPC/FULL_STEP_PPC) // 1.8 +#define MIN_ADVANCE (MOTO_PPC/FULL_STEP_PPC/10) // 0.18 +#define MICO_ADVANCE (MAX_ADVANCE/5) // 0.36 + +//------------------------------------------------------------------------ + +#define CCWDIR_POSI 1 // ʱ +#define CCWDIR_NEGA -1 // ʱ뷴 + +//------------------------------------------------------------------------ + +#define POS_TYPE float +typedef void(*MotoCoilPwm)(int); +typedef void(*MotoCoilCtrl)(void); + +//------------------------------------------------------------------------ + +void InitStepMotos(void); + +void SetMotoCtrlFuncs(int motoIdx, + MotoCoilPwm coilapwm, MotoCoilCtrl acpon, MotoCoilCtrl acpoff, MotoCoilCtrl acnon, MotoCoilCtrl acnoff, + MotoCoilPwm coilbpwm, MotoCoilCtrl bcpon, MotoCoilCtrl bcpoff, MotoCoilCtrl bcnon, MotoCoilCtrl bcnoff); + +void SetMotoCCWDir(int motoIdx, int dir); + +void ResetMotoPos(int motoIdx, int eff); +void SetMotoEnable(int motoIdx, int eff); +void SetMotoPosTo(int motoIdx, POS_TYPE pos, int eff); +POS_TYPE GetMotoPos(int motoIdx); +int MotoOneFullStep(int motoIdx, int dir, int eff); +int MotoOneMicoStep(int motoIdx, int dir, int eff); + +//------------------------------------------------------------------------ + +#endif diff --git a/NxFuncs/comm/comm.c b/NxFuncs/comm/comm.c new file mode 100644 index 0000000..8851d87 --- /dev/null +++ b/NxFuncs/comm/comm.c @@ -0,0 +1,461 @@ + +#define _IN_COMM_C +#include "comm.h" +#include "crc16.h" + + +//-------------------------------------------------------------------------------------------------- + +// ջ +// ջ +int ReadBuffEmpty(DataExFuns * funs) +{ + int rslt, len; + int rdlen; +#define ONCE_READ 16 + u8 tempbuf[ONCE_READ]; + + len = funs->GetRsvLen(); + + while (len > 0) + { + if (len < ONCE_READ) + { + rdlen = len; + } + else + { + rdlen = ONCE_READ; + } + rslt = funs->GetCommData(tempbuf, rdlen); + + if (rslt <= 0) + { + rslt = 0; + break; + } + len -= rslt; + } + return len; +} + +//-------------------------------------------------------------------------------------------------- +// : ͨѶڽջеõһݰ, +// ֻȡͨݰṹ. ݰи, ôҪ GetExCommData ȡ +// : pPacket, ݰָ +// : >=0, ɹȡһݰݰͿɱ䳤ݰֵΪݰ +// -1, +// -2, CRC +// -3, ݲ +// -4, ûҵͬ +// -5ȴݳʱ +// -6, ݰ +// -7, CRC +// -8, δ֪ + +// : ȷȡݰͨѶû, ѭβָƶ + +#define MAX_TCP_PACKET 1500 + + +typedef struct +{ + int len; // Ѷȡݳ + u8 buff[LEN_NORMAL_PACKET+MAX_TCP_PACKET]; // ջ + +}GetPacketCtrl; + +GetPacketCtrl g_gtpCtrl = {0}; + +#define MAX_ONCE_SCAN (LEN_NORMAL_PACKET) // һɨֽ + +/* + * return: -1, + * -2,CRCУ + * -3,û㹻 + */ +int GetANormalPacket(DataExFuns * funs, DataPacket * pPacket) +{ + int rslt, len; + int i; + int phase; + int status; // ͬ 1,FLDP 2,VLDP + int exlen; + int begidx; + + u8 temp; + u8 rdBuf[LEN_NORMAL_PACKET]; + DataPacket * pDat = (DataPacket *)(rdBuf); + + if (funs == NULL || pPacket == NULL) + { + return -1; + } + + // ȡһݰ + if (g_gtpCtrl.len < LEN_NORMAL_PACKET + MAX_EXDP_LEN) + { + len = funs->GetRsvLen(); // ȡѽݳ + + if (len <= 0) + { + rslt = -3; // û㹻 + } + else + { + if (len + g_gtpCtrl.len <= MAX_TCP_PACKET) + { + rslt = funs->GetCommData(&(g_gtpCtrl.buff[g_gtpCtrl.len]), len); // ȡһ + } + else + { +// printf("Get a big packet, len=%d\r\n", len); + rslt = funs->GetCommData(&(g_gtpCtrl.buff[g_gtpCtrl.len]), MAX_TCP_PACKET-g_gtpCtrl.len); // ȡһ + } + + g_gtpCtrl.len += rslt; // ʵݳ +// printf("load a packet to buff, len=%d, buflen=%d\r\n", len, g_gtpCtrl.len); + } + } + + len = g_gtpCtrl.len; + if (len < LEN_NORMAL_PACKET) + { + rslt = -3; + return rslt; // û㹻 + } + + i = 0; // ɨֽڼ + begidx = 0; // ȷݰʼ + phase = 0; + status = 0; + rslt = 0; + + while(phase < LEN_NORMAL_PACKET) + { + if (phase == 0 && i > MAX_ONCE_SCAN) + { + rslt = -4; + break; // ͬг󵥴ɨֽ + } + + if (i < g_gtpCtrl.len) + { + temp = g_gtpCtrl.buff[i]; + i++; // ɨ + } + else + { +// printf("data not enough\r\n"); + rslt = -3; // ݲ + break; + } + + pDat->buff.normal[phase] = temp; // + if (phase < DP_SYNC_LEN) // ʶͬ + { + if (phase == 0) + { + if (temp == FLDP_SYNC[0]) + { + begidx = i-1; + status = 1; + } + else if (temp == VLDP_SYNC[0]) + { + begidx = i-1; + status = 2; + } + else + { + begidx = i; + status = 0; + phase = 0; + rslt = 0; // ͬУɨ + continue; + } + } + else + { + if (status == 1) + { + if (temp != FLDP_SYNC[phase]) // ͬвȷɨ + { + begidx = 0; + status = 0; + phase = 0; + rslt = 0; + continue; + } + } + else if (status == 2) + { + if (temp != VLDP_SYNC[phase]) // ͬвȷɨ + { + begidx = 0; + status = 0; + phase = 0; + rslt = 0; + continue; + } + } + else + { + begidx = 0; + status = 0; + phase = 0; + rslt = -8; + printf("1. error status in GetANormalPacket\r\n"); + break; + } + } + } + phase++; + } + + if (phase >= LEN_NORMAL_PACKET) // õݰ + { + u16 crc; + crc = CalcCrc16(pDat->normal.content, DP_CONT_LEN); + if (crc == pDat->normal.crc) + { + // õȷݰ + memcpy(pPacket, pDat, LEN_NORMAL_PACKET); +// printf("GetANormalPacket ok\r\n"); + rslt = LEN_NORMAL_PACKET; + } + else + { + // CRC ȷ + begidx = i; + printf("2. crc error in GetANormalPacket\r\n"); + rslt = -2; + } + } + + if (rslt == LEN_NORMAL_PACKET) // ȷõ + { + if (memcmp(pPacket->normal.sync, VLDP_SYNC, DP_SYNC_LEN) == 0) // ǿɱ䳤ݰ vldp + { + // + exlen = pPacket->vldp.exlen; + if (exlen > MAX_EXDP_LEN) + { + begidx += LEN_NORMAL_PACKET+exlen; + printf("data exlen error, len=%d\r\n", exlen); + rslt = -6; // ݰ + } + else if (exlen == 0) + { + begidx += LEN_NORMAL_PACKET; + rslt = LEN_NORMAL_PACKET; + } + else if (exlen + LEN_NORMAL_PACKET > g_gtpCtrl.len) + { + // ݲ, ʱ˳ + // printf("exdata not enough, exlen=%d, g_gtpCtrl.len=%d\r\n", exlen, g_gtpCtrl.len); + rslt = -3; // ݲ + } + else + { + // 20240606 ljs ޸ʱĵַ +#if (1) + // չCRCУ(1kֽУʱԼ1ms) + u16 crc; + crc = CalcCrc16(&g_gtpCtrl.buff[i], exlen); + if (crc == pDat->vldp.excrc) + { + memcpy(pPacket->buff.exData, &(g_gtpCtrl.buff[i]), exlen); // + if (exlen < MAX_EXDP_LEN) + { + pPacket->buff.exData[exlen] = 0; + } + rslt = LEN_NORMAL_PACKET+exlen; + } + else + { + printf("3. excrc error in GetANormalPacket\r\n"); + rslt = -2; + } + begidx += LEN_NORMAL_PACKET+exlen; +#else + begidx += LEN_NORMAL_PACKET+exlen; + memcpy(pPacket->buff.exData, &(g_gtpCtrl.buff[i]), exlen); // + if (exlen < MAX_EXDP_LEN) + { + pPacket->buff.exData[exlen] = 0; + } + rslt = LEN_NORMAL_PACKET+exlen; +#endif + } + } + else + { + begidx += LEN_NORMAL_PACKET; // ̶ݰ + } + } + + // ʣݵǰ + if (begidx > 0 && begidx <= g_gtpCtrl.len) + { + if (begidx < g_gtpCtrl.len) + { + // printf("copy data, begidx=%d, len=%d\r\n", begidx, (g_gtpCtrl.len - begidx)); + memcpy(&(g_gtpCtrl.buff[0]), &g_gtpCtrl.buff[begidx], (g_gtpCtrl.len - begidx)); + } + g_gtpCtrl.len -= begidx; + begidx = 0; + } + else if (begidx < 0) + { + printf("beginidx < 0\r\n"); + } + else if (begidx > g_gtpCtrl.len) + { + g_gtpCtrl.len = 0; + printf("begidx=%d > g_gtpCtrl.len=%d, set g_gtpCtrl.len = 0\r\n", begidx, g_gtpCtrl.len); + } + else + { + } + + return rslt; +} + +//-------------------------------------------------------------------------------------------------- + +// : ݵͶ, ͨͨѶڷ +// : pPacket, Ҫ͵ݣѾȷӦֶΡ +// : +// 0, Է, ӵ˷ݶ +// -1, +// -2ʹ +// 1, , ܷ +int SendAPacket(DataExFuns * funs, DataPacket * pPacket, int waittime) +{ + int rslt; + int freelen, sendlen; + + if (pPacket == NULL) + { + return -1; + } + + if (memcmp(pPacket->normal.sync, FLDP_SYNC, DP_SYNC_LEN) == 0) + { + sendlen = LEN_NORMAL_PACKET; + } + else if (memcmp(pPacket->normal.sync, VLDP_SYNC, DP_SYNC_LEN) == 0) + { + sendlen = LEN_NORMAL_PACKET + pPacket->vldp.exlen; + } + else + { + printf("para err, not a corrected packet\r\n"); + return -1; + } + + rslt = 0; + do + { + freelen = funs->GetTrsFreeLen(); + if (freelen <= 0) // δ + { + // printf("error at call GetTrsFreeLen, freelen=%d\r\n", freelen); + rslt = -2; + break; + } + if (freelen >= sendlen) + { + break; + } + + waittime--; + if (waittime <= 0) + { + rslt = 1; +// printf("buff is full in SendAPacket, timout\r\n"); + break; + } + if (funs->Delay != NULL) + { + funs->Delay(1); + } + }while(1); + + if (rslt == 0) + { + rslt = funs->SendCommData(pPacket->datbuff, sendlen); + if (rslt != sendlen) + { + printf("error at call SendCommData, rslt=%d\r\n", rslt); + return -2; + } + } + else + { + //printf("error:Not SendCommData\r\n"); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------- + +// : һ̶ݰ +// : +// pPacket, ҪݰгsynccrcIJѾ +// : +// 0, +// -1, + +int PacketAFLDP(DataPacket * pPacket) +{ + if (pPacket == NULL) + { + return -1; + } + + memcpy(pPacket->normal.sync, FLDP_SYNC, DP_SYNC_LEN); + pPacket->normal.crc = CalcCrc16(pPacket->normal.content, DP_CONT_LEN); + + return 0; +} + +//-------------------------------------------------------------------------------------------------- + +// : һɱ䳤ݰ +// : pPacket, ҪݰҪе SYNC EXLEN EXCRC EXDAT Ȳ +// pExdat, ݣΪ +// exlenݳȣΪ0 +// : +// 0, +// -1, +// -2 + +int PacketAVLDP(DataPacket * pPacket, const u8 * pExdat, u16 exlen) +{ + if (pPacket == NULL) + { + return -1; + } + + if (pExdat == NULL) + { + exlen = 0; + } + + memcpy(pPacket->vldp.sync, VLDP_SYNC, DP_SYNC_LEN); + pPacket->vldp.exlen = exlen; + pPacket->vldp.excrc = CalcCrc16(pExdat, exlen); + pPacket->vldp.crc = CalcCrc16(pPacket->normal.content, DP_CONT_LEN); + if (exlen != 0 && pPacket->vldp.exData != pExdat) + { + memcpy(pPacket->vldp.exData, pExdat, exlen); + } + return 0; +} + +//-------------------------------------------------------------------------------------------------- + + diff --git a/NxFuncs/comm/comm.h b/NxFuncs/comm/comm.h new file mode 100644 index 0000000..afcfc91 --- /dev/null +++ b/NxFuncs/comm/comm.h @@ -0,0 +1,187 @@ + +#ifndef __COMM_H__ +#define __COMM_H__ + +#include "config.h" +//------------------------------------------------------------------------ + +// ͨѶݰ + +//------------------------------------ +/* +һݰʽ + + 1. ̶ݰʽ + + |-------------------------------------------------------------------|-----------| + | ʶ | | У | + |-------------------------------------------------------------------|-----------| + | B0 B1 B2 B3 | B4 B5 | B6 B7 B8 B9 B10 B11 B12 B13 | B14 B15 | + |-------------------------------------------------------------------|-----------| + | ̶ | | ͬ岻ͬ | B4--B13 | + | | ݰID | 嶨οϸ˵ | | + | 'F','L','P','S' | | | 16λCRC | + |-------------------------------------------------------------------|-----------| + + 2. ɱ䳤ݰʽ + + |---------------------------------------------------------------------------|-----------|---------------- + | ʶ | | У | | + |---------------------------------------------------------------------------|-----------|---------------| + | B0 B1 B2 B3 | B4 B5 | B6 B7 | B8 B9 | B10 B11 B12 B13 | B14 B15 | B16--Bn | + |---------------------------------------------------------------------------|-----------|---------------| + | ̶ | | | | ͬ | B4--B13 | | + | | ݰID | | | 岻ͬ | | | + | 'V','L','P','S' | | | У | οϸ˵ | 16λCRC | | + |---------------------------------------------------------------------------|-----------|---------------| + + ݳȡֵΧΪ 0--1024 +*/ + +//------------------------------------ + +#define DP_SYNC_LEN 4 // ʶг +#define DP_CONT_LEN 10 // ݳ +#define DP_CRC_LEN 2 // Уֳ +#define MAX_EXDP_LEN 1024 // 󸽼ݳ + +#define LEN_NORMAL_PACKET (DP_SYNC_LEN+DP_CONT_LEN+DP_CRC_LEN) + +#define MAX_INDP_PARA 8 + +#ifdef _IN_COMM_C + +const u8 FLDP_SYNC[DP_SYNC_LEN] = +{ + 'F','S','F','D', +}; + +const u8 VLDP_SYNC[DP_SYNC_LEN] = +{ + 'V','S','F','D', +}; + + +#else + +extern const u8 FLDP_SYNC[DP_SYNC_LEN]; +extern const u8 VLDP_SYNC[DP_SYNC_LEN]; + +#endif + +//----------------------------------------------------------------------- + +typedef union +{ + u8 datbuff[LEN_NORMAL_PACKET+MAX_EXDP_LEN]; // dat buff ʽ + + struct + { + u8 normal[LEN_NORMAL_PACKET]; + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) buff; // buffʽ + + struct + { + u8 sync[DP_SYNC_LEN]; + u8 content[DP_CONT_LEN]; + u16 crc; + } __attribute__ ((packed)) normal; // ͨ÷ʽ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmd; + u8 para[8]; + u16 crc; + } __attribute__ ((packed)) fldp; // fldpʽ + + struct + { + u8 sync[DP_SYNC_LEN]; + u16 cmd; + u16 exlen; + u16 excrc; + u8 para[4]; + u16 crc; + u8 exData[MAX_EXDP_LEN]; + } __attribute__ ((packed)) vldp; // vldpʽ + +} DataPacket; + +//----------------------------------------------------------------------- + +typedef struct +{ + int (*SendCommData)(u8 *, int); + int (*GetCommData)(u8 *, int); + int (*GetRsvLen)(void); + int (*GetTrsFreeLen)(void); + void (*Delay)(u32); +} DataExFuns; + + +//----------------------------------------------------------------------- + +// ջ +int ReadBuffEmpty(DataExFuns * funs); + + +//----------------------------------------------------------------------- + +// : ͨѶڽջеõһݰ, +// ֻȡͨݰṹ. ݰи, ôҪ GetExCommData ȡ +// : pPacket, ݰָ +// : >=0, ɹȡһݰݰͿɱ䳤ݰֵΪݰ +// -1, +// -2, CRC +// -3, ݲ +// -4, ûҵͬ +// -5ȴݳʱ +// -6, ݰ +// -7, CRC +// -8, δ֪ + +// : ȷȡݰͨѶû, ѭβָƶ + +int GetANormalPacket(DataExFuns * funs, DataPacket * pPacket); + +//-------------------------------------------------------------------------------------------------- + +// : ݵͶ, ͨͨѶڷ +// : pPacket, Ҫ͵ݣѾȷӦֶΡ +// : +// 0, Է, ӵ˷ݶ +// -1, +// -2ʹ +// 1, , ܷ +int SendAPacket(DataExFuns * funs, DataPacket * pPacket, int waittime); + +//-------------------------------------------------------------------------------------------------- + +// : һ̶ݰ +// : +// pPacket, ҪݰгsynccrcIJѾ +// : +// 0, +// -1, + +int PacketAFLDP(DataPacket * pPacket); + +//-------------------------------------------------------------------------------------------------- + +// : һɱ䳤ݰ +// : pPacket, ҪݰҪе SYNC EXLEN EXCRC EXDAT Ȳ +// pExdat, ݣΪ +// exlenݳȣΪ0 +// : +// 0, +// -1, +// -2 + +int PacketAVLDP(DataPacket * pPacket, const u8 * pExdat, u16 exlen); + +//-------------------------------------------------------------------------------------------------- + + +#endif diff --git a/NxFuncs/comm/mtcomm.c b/NxFuncs/comm/mtcomm.c new file mode 100644 index 0000000..4764f67 --- /dev/null +++ b/NxFuncs/comm/mtcomm.c @@ -0,0 +1,460 @@ + +#define _IN_MTCOMM_C +#include "mtcomm.h" +#include "crc8.h" +#include "trigger.h" + +//------------------------------------------------------ + + +//------------------------------------------------------ + +typedef struct +{ + MtCommExFuncs commExFuncs; // + + MtCommPacket sendPacket; // ͵ݰ + MtCommPacket resvPacket; // յݰ + + // ̿ + int transEnable; // , 0, ; 1, 2 + int transId; // ǰID + + int sendStatus; // ״̬, 0, ; 1, ; 2ջذ; 3, ɡ + int sendResult; // ͽ, 0 У 1ͳɹ 2 ʧܣ 3ȴذɹ4 ȴذʱ + int sendSteps; // ͿƲ + + int hasBack; // ǷлذԶȴذ + + int resvStatus; // ״̬ 0 ; 1, ȴ; 2, յݰ; 3. ֹͣ + + u32 ustimer; + +}MtCommCtrl; + + +MtCommCtrl g_mtCommCtrl; + +//------------------------------------------------------ + + +// ʼ +// עշ485غ +void InitMtComm(MtCommExFuncs * pExFuncs) +{ + memset(&g_mtCommCtrl, 0, sizeof(MtCommCtrl)); + + if (pExFuncs != NULL) + { + memcpy(&(g_mtCommCtrl.commExFuncs), pExFuncs, sizeof(MtCommExFuncs)); + } +} + +// 첽շ,ݵշ̡ +// Ҫڿвͣ +void MtCommAsyncTask(void) +{ + if (g_mtCommCtrl.transEnable == 1) // + { + switch (g_mtCommCtrl.sendSteps) + { + case 0: + g_mtCommCtrl.sendStatus = 1; // + g_mtCommCtrl.sendResult = 0; + g_mtCommCtrl.sendSteps++; + break; + case 1: // 򿪷 + { + if (g_mtCommCtrl.commExFuncs.Set485TxEnOn != NULL) + { + g_mtCommCtrl.commExFuncs.Set485TxEnOn(); // + } + g_mtCommCtrl.ustimer = GetUsSoftTimer(); + g_mtCommCtrl.sendSteps++; + break; + } + case 2: // ȴЧ, ʼݰ + { + u32 thisus; + thisus = GetUsSoftTimer(); + if (thisus - g_mtCommCtrl.ustimer > 200) + { + if (g_mtCommCtrl.commExFuncs.SendMtCommData != NULL) + { + g_mtCommCtrl.commExFuncs.SendMtCommData((u8*)&g_mtCommCtrl.sendPacket, LEN_MTCOMM_PKT); // + } + + g_mtCommCtrl.sendSteps++; + } + break; + } + case 3: // ȴ + { + int freelen = 0; + if (g_mtCommCtrl.commExFuncs.GetTrsFreeLen != NULL) + { + freelen = g_mtCommCtrl.commExFuncs.GetTrsFreeLen(); + } + if (freelen <= 0) + { + g_mtCommCtrl.ustimer = GetUsSoftTimer(); + g_mtCommCtrl.sendSteps++; + } + break; + } + case 4: // ȴһ, رշ + { + u32 thisus; + thisus = GetUsSoftTimer(); + if (thisus - g_mtCommCtrl.ustimer > 200) + { + if (g_mtCommCtrl.commExFuncs.Set485TxEnOff != NULL) + { + g_mtCommCtrl.commExFuncs.Set485TxEnOff(); // ر + } + g_mtCommCtrl.sendSteps++; + } + break; + } + + case 5: + { + if (g_mtCommCtrl.hasBack != 0) // лذ + { + g_mtCommCtrl.sendStatus = 2; // ȴذ״̬ + g_mtCommCtrl.ustimer = GetUsSoftTimer(); // ¼ʱ + + g_mtCommCtrl.resvStatus = 0; + g_mtCommCtrl.transEnable = 2; // + } + else + { + g_mtCommCtrl.sendStatus = 3; // + g_mtCommCtrl.sendResult = 1; // ͳɹ + g_mtCommCtrl.transEnable = 0; // + } + break; + } + default: + { + g_mtCommCtrl.sendStatus = 3; // + g_mtCommCtrl.sendResult = 2; // ʧ + g_mtCommCtrl.transEnable = 0; // + break; + } + } + } + else if (g_mtCommCtrl.transEnable == 2) // + { + int rsvlen = 0; + + g_mtCommCtrl.resvStatus = 1; // + if (g_mtCommCtrl.commExFuncs.Set485TxEnOff != NULL) // رշ + { + g_mtCommCtrl.commExFuncs.Set485TxEnOff(); // ر + } + + if (g_mtCommCtrl.commExFuncs.GetMtRsvLen != NULL) + { + rsvlen = g_mtCommCtrl.commExFuncs.GetMtRsvLen(); // õѽݳ + } + if (rsvlen >= LEN_MTCOMM_PKT) // ݳȹ + { + if (g_mtCommCtrl.commExFuncs.GetMtCommData != NULL) + { + g_mtCommCtrl.commExFuncs.GetMtCommData((u8*)&g_mtCommCtrl.resvPacket, LEN_MTCOMM_PKT); // + } + + if (g_mtCommCtrl.hasBack != 0) // лذ + { + g_mtCommCtrl.hasBack = 0; + g_mtCommCtrl.sendStatus = 3; // + g_mtCommCtrl.sendResult = 3; // ȷ + } + g_mtCommCtrl.resvStatus = 2; // յݰ + g_mtCommCtrl.ustimer = GetUsSoftTimer(); // ¼ʱ + g_mtCommCtrl.transEnable = 0; // رմ + } + else + { + if (g_mtCommCtrl.hasBack != 0) // лذ + { + u32 thisus; + thisus = GetUsSoftTimer(); + if (thisus - g_mtCommCtrl.ustimer > 10000) // 10ms ʱ + { + g_mtCommCtrl.resvStatus = 3; // ֹͣ + + g_mtCommCtrl.hasBack = 0; + g_mtCommCtrl.sendStatus = 3; // + g_mtCommCtrl.sendResult = 4; // ʱ + g_mtCommCtrl.transEnable = 0; // رմ + } + } + else + { + // ȴ + } + } + } + else // , ʲôҲ + { + } +} + +// һݰ +// ֣ͬCRC +int PacketAMtComm(MtCommPacket * pPacket) +{ + if (pPacket == NULL) + { + return -1; + } + + memcpy(pPacket->sync, MTCOMM_SYNC, MT_SYNC_LEN); + pPacket->crc8 = CalcCrc8((u8*)pPacket, MT_CHECK_LEN); + + return 0; +} + +// Уһݰ +// ֺ֤ͬCRC +// 0 +int CheckAMtPacket(MtCommPacket * pPacket) +{ + int rslt; + if (pPacket == NULL) + { + return -1; + } + rslt = memcmp(pPacket->sync, MTCOMM_SYNC, MT_SYNC_LEN); + if (rslt == 0) + { + u8 crc; + crc = CalcCrc8((u8*)pPacket, MT_CHECK_LEN); + if (pPacket->crc8 != crc) + { + rslt = -2; + } + } + return rslt; +} + +// սbuff +void ReadMtCommBuffEmpty(void) +{ + int rslt, len; + u8 temp; + + len = 0; + if (g_mtCommCtrl.commExFuncs.GetMtRsvLen != NULL) + { + len = g_mtCommCtrl.commExFuncs.GetMtRsvLen(); + } + + while (len > 0) + { + if (g_mtCommCtrl.commExFuncs.GetMtCommData != NULL) + { + rslt = g_mtCommCtrl.commExFuncs.GetMtCommData(&temp, 1); + } + else + { + break; + } + if (rslt != 1) + { + rslt = 0; + break; + } + len--; + } +} + +// һη +// شID +int SendAMtPacket(MtCommPacket * pPacket, int hasback) +{ + if (pPacket == NULL) + { + return -1; + } + if (g_mtCommCtrl.sendStatus != 0 || g_mtCommCtrl.sendStatus != 3) + { + return -2; + } + + g_mtCommCtrl.transEnable = 0; + + g_mtCommCtrl.sendStatus = 0; + g_mtCommCtrl.sendResult = 0; + g_mtCommCtrl.sendSteps = 0; + + // Ƿȴذ + g_mtCommCtrl.hasBack = hasback; + + g_mtCommCtrl.transId++; // ID + if (g_mtCommCtrl.transId < 10 || g_mtCommCtrl.transId > 10000000) + { + g_mtCommCtrl.transId = 10; + } + + memcpy(&g_mtCommCtrl.sendPacket, pPacket, LEN_MTCOMM_PKT); + + g_mtCommCtrl.transEnable = 1; // + + return g_mtCommCtrl.transId; // صǰIDѯʹ +} + +// ȡ״̬ +int GetSendStatus(int id) +{ + int sta; + if (g_mtCommCtrl.transId != id) + { + return -1; + } + + sta = g_mtCommCtrl.sendStatus; + if (sta == 3) + { + g_mtCommCtrl.sendStatus = 0; // Զ + } + return sta; +} + +// ȡͽ +int GetSendResult(int id) +{ + if (g_mtCommCtrl.transId != id) + { + return -1; + } + + return g_mtCommCtrl.sendResult; +} + + +// ȡһݰ +// յ ذpPacket +int GetAMtPacket(MtCommPacket * pPacket) +{ + if (g_mtCommCtrl.transEnable != 2) // ǽ״̬ + { + g_mtCommCtrl.transEnable = 0; + + g_mtCommCtrl.resvStatus = 0; + + ReadMtCommBuffEmpty(); + + g_mtCommCtrl.transEnable = 2; // + } + +#define MAX_MTCOMM_SCAN 128 // ɨ + + if (1) + { + int rslt, len; + int i; + int phase; + + u8 temp; + u8 rdBuf[LEN_MTCOMM_PKT]; + MtCommPacket * pDat; + + if (pPacket == NULL || + g_mtCommCtrl.commExFuncs.GetMtRsvLen == NULL || + g_mtCommCtrl.commExFuncs.GetMtCommData == NULL || + 0 ) + { + return -1; + } + + i = 0; // ɨֽڼ + pDat = (MtCommPacket *)rdBuf; + + do + { + len = g_mtCommCtrl.commExFuncs.GetMtRsvLen(); + + if (len < LEN_MTCOMM_PKT) + { + rslt = -3; + break; // û㹻 + } + + phase = 0; + rslt = 0; + + // ӽջݰ + while(((len + phase) >= LEN_MTCOMM_PKT) && (phase < LEN_MTCOMM_PKT)) + { + if (phase == 0 && i > MAX_MTCOMM_SCAN) + { + rslt = -4; + break; // ͬг󵥴ɨֽ + } + + rslt = g_mtCommCtrl.commExFuncs.GetMtCommData(&temp, 1); // ȡһֽ + if (rslt != 1) + { + printf("error at GetMtCommData rslt\r\n"); + rslt = -8; + break; + } + + rslt = 0; + i++; // ɨ + len--; // ʣ೤ȼС + + if (phase < MT_SYNC_LEN) // ʶͬ + { + if (temp != MTCOMM_SYNC[phase]) + { + phase = 0; + rslt = 0; + break; + } + } + + rdBuf[phase] = temp; // + phase++; + } + + if (rslt != 0) + { + break; + } + + if (phase >= LEN_MTCOMM_PKT) // õݰ + { + u8 crc8; + crc8 = CalcCrc8(rdBuf, MT_CHECK_LEN); + if (crc8 == pDat->crc8) + { + // õȷݰ + memcpy(pPacket, pDat, LEN_MTCOMM_PKT); + // printf("GetAMtCommPacket ok\r\n"); + rslt = LEN_MTCOMM_PKT; + break; + } + else + { + // CRC ȷ + printf("1. crc error in GetAMtCommPacket\r\n"); + // Ҫжϵ + // continue; + } + } + else + { + // ûҵͬе + // continue; + } + }while(1); + + return rslt; + } +} + + diff --git a/NxFuncs/comm/mtcomm.h b/NxFuncs/comm/mtcomm.h new file mode 100644 index 0000000..1b2d917 --- /dev/null +++ b/NxFuncs/comm/mtcomm.h @@ -0,0 +1,185 @@ + +#ifndef __MTCOMM_H__ +#define __MTCOMM_H__ + +#include "config.h" +//------------------------------------------------------------------------ + + +/* + ջͨѶƽӿ +// Э飺 + ͨ485ͨѶϿԹڶջ + + 485ͨѶ + ʣ 115200 bps + ֡: 1ʼλ8λ1ֹͣλûУλ + 8λͨѶЧݣ1ֽڣ + ֡һݰ + չ̶8ֽһݰ + + |---------------------------------------------------------------------------------------| + | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | + |---------------|---------------|-----------|-------------------------------|-----------| + | ݰͷ | Ŀվ | | | У | + |---------------|---------------|-----------|-------------------------------|-----------| + | ̶ֽ | Ŀվ | | | У | + | | | |-------------------------------|-----------| + | | 0 վ | | | B1--B6 | + | 0xEB | 1--250 վ | 1--255 | 4ֽڣݸ | 8λCRCУ | + | | 255 㲥 | | | | + | | 251--254 | | | | + |---------------|---------------|-----------|-------------------------------|-----------| + | | | | | | + |---------------------------------------------------------------------------------------| + + ݰմB0--B7˳䣬ϵͨѶݰΪλ + + + + Ĭ£ûͨѶվڷ״̬վڽ״̬ + + лذͨѶͨѶĹ£ + + վ + 1.Ϊ״̬ijվȫվ㷢 + 2.ɺΪ״̬ + 3.ȴذ10msûյذΪͨѶʱ + 4.ز1 + + վ + 1.Ϊ״̬ȴվ + 2.յ󣬵ȴ1ms + 3.Ϊ״̬ͻذվ + 4.ȴɺת1 + + ûлذվͣҪлΪ״̬ + վյݺִֻӦлΪ״̬ + +*/ + + +//------------------------------------ + +#define MT_SYNC_LEN 1 // ʶг +#define MT_ADDR_LEN 1 // ַ +#define MT_CMD_LEN 1 //  +#define MT_CONT_LEN 4 // ݳ +#define MT_CHK_LEN 1 // Уֳ + +#define MT_CHECK_LEN (MT_ADDR_LEN+MT_CMD_LEN+MT_CONT_LEN) +#define LEN_MTCOMM_PKT (MT_SYNC_LEN+MT_ADDR_LEN+MT_CMD_LEN+MT_CONT_LEN+MT_CHK_LEN) + +//------------------------------------ + +#ifdef _IN_MTCOMM_C + +const u8 MTCOMM_SYNC[MT_SYNC_LEN] = +{ + 0xEB, +}; + +#endif + + +//------------------------------------ +// ݽṹ + +typedef struct +{ + u8 sync[MT_SYNC_LEN]; + //-------- + u8 addr; + u8 cmd; + //----- + u8 content[MT_CONT_LEN]; + //-------- + u8 crc8; +} __attribute__ ((packed)) MtCommPacket; + + +//------------------------------------ + +#define MTTS_ADDR_MAIN 0 // վַ +#define MTTS_ADDR_BROADCAST 0xFF // 㲥ַ + +//------------------------------------ + +//  + +// վվ +#define MTCMD_ADDR_INIT 0x01 // վųʼ +#define MTCMD_SET_NEW_AD 0x02 // վ +#define MTCMD_GET_INFO 0x03 // ѯվϢ +#define MTCMD_READ_DATA 0x04 // ȡ +#define MTCMD_WRITE_DATA 0x05 // + +// վվ +#define MTCMD_REV_INFO 0x83 // ѯվϢĻذ +#define MTCMD_REV_DATA 0x84 // ȡĻذ + +//------------------------------------------------------ + +#define MTCOMM_NONE 0 +#define MTCOMM_MASTER 1 // ڵ +#define MTCOMM_SLAVE 2 // ӽڵ + +// ڵ +#ifndef MTCOMM_AS +#define MTCOMM_AS MTCOMM_NONE +#endif + +#if (MTCOMM_AS != MTCOMM_NONE && MTCOMM_AS != MTCOMM_MASTER && MTCOMM_AS != MTCOMM_SLAVE) +#undef MTCOMM_AS +#define MTCOMM_AS MTCOMM_NONE +#endif + + +//------------------------------------------------------ + +// ͨѶ +typedef struct +{ + int (*SendMtCommData)(u8 *, int); // ݺ + int (*GetMtCommData)(u8 *, int); // ݺ + int (*GetMtRsvLen)(void); // õѽݳȺ + int (*GetTrsFreeLen)(void); // õݻȺ + void (*Set485TxEnOn)(void); // 򿪺 + void (*Set485TxEnOff)(void); // رպ +}MtCommExFuncs; + +//------------------------------------------------------ + +// ʼ +// עշ485غ +void InitMtComm(MtCommExFuncs * pExFuncs); + +// 첽շ,ݵշ̡ +// Ҫڿвͣ +void MtCommAsyncTask(void); + +// +// ֣ͬCRC +int PacketAMtComm(MtCommPacket * pPacket); + +// Уһݰ +// ֺ֤ͬCRC +int CheckAMtPacket(MtCommPacket * pPacket); + +// һη +// شID +int SendAMtPacket(MtCommPacket * pPacket, int hasback); + +// ȡ״̬ +int GetSendStatus(int id); +// ȡͽ +int GetSendResult(int id); + +// ȡһݰ +// յ, pPacket +int GetAMtPacket(MtCommPacket * pPacket); + + + + +#endif diff --git a/NxFuncs/comm/ocom.c b/NxFuncs/comm/ocom.c new file mode 100644 index 0000000..2d3113c --- /dev/null +++ b/NxFuncs/comm/ocom.c @@ -0,0 +1,271 @@ + +#define _IN_OCOM_C +#include "ocom.h" +#include "crc16.h" + +void ReadOComBuffEmpty(OComExFuns * funs) +{ + int rslt, len; + u8 temp; + + len = funs->GetRsvLen(); + + while (len > 0) + { + rslt = funs->GetOComData(&temp, 1); + if (rslt != 1) + { + rslt = 0; + break; + } + len--; + } + +} + +#ifndef MAX_OCOM_SCAN +#define MAX_OCOM_SCAN 128 // ɨ +#endif + +int GetAOComPacket(OComExFuns * funs, OComPacket * pPacket) +{ + int rslt, len; + int i; + int phase; + + u8 temp; + u8 rdBuf[LEN_OCOM_PKT]; + OComPacket * pDat; + + if (funs == NULL || pPacket == NULL) + { + return -1; + } + + i = 0; // ɨֽڼ + pDat = (OComPacket *)rdBuf; + + do + { + len = funs->GetRsvLen(); + + if (len < LEN_OCOM_PKT) + { + rslt = -3; + break; // û㹻 + } + + phase = 0; + rslt = 0; + + // ӽջݰ + while(((len + phase) >= LEN_OCOM_PKT) && (phase < LEN_OCOM_PKT)) + { + if (phase == 0 && i > MAX_OCOM_SCAN) + { + rslt = -4; + break; // ͬг󵥴ɨֽ + } + + rslt = funs->GetOComData(&temp, 1); // ȡһֽ + if (rslt != 1) + { + printf("error at GetOComData rslt\r\n"); + rslt = -8; + break; + } + + rslt = 0; + i++; // ɨ + len--; // ʣ೤ȼС + + if (phase < DC_SYNC_LEN) // ʶͬ + { + if (temp != OCOM_SYNC[phase]) + { + phase = 0; + rslt = 0; + break; + } + } + + pDat->buff.normal[phase] = temp; // + phase++; + } + + if (rslt != 0) + { + break; + } + + if (phase >= LEN_OCOM_PKT) // õݰ + { + u16 check; + check = CalcCheckSum(&(pDat->buff.normal[DC_SYNC_LEN]), DC_CHECK_LEN); + if (check == pDat->normal.check) + { + // õȷݰ + memcpy(pPacket, pDat, LEN_OCOM_PKT); +// printf("GetANormalPacket ok\r\n"); + rslt = LEN_OCOM_PKT; + break; + } + else + { + // CRC ȷ + printf("1. crc error in GetANormalPacket\r\n"); + // Ҫжϵ +// continue; + } + } + else + { + // ûҵͬе +// continue; + } + }while(1); + + return rslt; +} + +int GetOComExData(OComExFuns * funs, u8 * pBuff, int exlen) +{ + int rslt, len; + u16 getcrc; + + if (funs == NULL || pBuff == NULL || exlen <= 0) + { + return -1; + } + + u8 * pDat = (u8 *)pBuff; + do + { + len = funs->GetRsvLen(); + if (len < exlen + 2) + { + rslt = -3; + break; // û㹻 + } + + rslt = 0; + + rslt = funs->GetOComData(pDat, exlen); // ȡ + if (rslt != exlen) + { + printf("error at GetOComData rslt=%d\r\n", rslt); + rslt = -8; + break; + } + + rslt = funs->GetOComData((u8*)(&getcrc), 2); // ȡcrc + if (rslt != 2) + { + printf("error at GetOComData rslt=%d\r\n", rslt); + rslt = -9; + break; + } + + { + u16 check; + + check = CalcCheckSum(pDat, exlen); + if (check == getcrc) + { + // õȷݰ + // printf("GetOComExData ok\r\n"); + rslt = exlen; + break; + } + else + { + // CRC ȷ + printf("2. crc error in GetOComExData\r\n"); + rslt = -7; + } + } + }while (0); + + return rslt; +} + +int SendAOComPacket(OComExFuns * funs, OComPacket * pPacket) +{ + int rslt; + int freelen, sendlen; + + if (funs == NULL || pPacket == NULL) + { + return -1; + } + sendlen = LEN_OCOM_PKT; + + freelen = funs->GetTrsFreeLen(); + + if (freelen < sendlen) + { +// printf("buff is full in SendAOComPacket\r\n"); + return 1; + } + + rslt = funs->SendOComData(pPacket->buff.normal, sendlen); + if (rslt != sendlen) + { + printf("error at call SendOComData, rslt=%d\r\n", rslt); + return -2; + } + + return 0; +} + +int SendOComExData(OComExFuns * funs, u8 * pBuff, int exlen) +{ + int rslt; + int freelen, sendlen; + u16 check; + + if (funs == NULL || pBuff == NULL || exlen <= 0) + { + return -1; + } + sendlen = exlen; + + freelen = funs->GetTrsFreeLen(); + + if (freelen < sendlen + 2) + { +// printf("buff is full in SendOComExData\r\n"); + return 1; + } + + rslt = funs->SendOComData(pBuff, sendlen); + if (rslt != sendlen) + { + printf("error at call SendOComData, rslt=%d\r\n", rslt); + return -2; + } + + check = CalcCheckSum(pBuff, sendlen); + rslt = funs->SendOComData((u8*)(&check), 2); + if (rslt != 2) + { + printf("error at call SendOComData, rslt=%d\r\n", rslt); + return -2; + } + + return 0; +} + +int PacketAOCom(OComPacket * pPacket) +{ + if (pPacket == NULL) + { + return -1; + } + + memcpy(pPacket->normal.sync, OCOM_SYNC, DC_SYNC_LEN); + pPacket->normal.check = CalcCheckSum(&(pPacket->buff.normal[DC_SYNC_LEN]), DC_CHECK_LEN); + + return 0; + +} diff --git a/NxFuncs/comm/ocom.h b/NxFuncs/comm/ocom.h new file mode 100644 index 0000000..d900f14 --- /dev/null +++ b/NxFuncs/comm/ocom.h @@ -0,0 +1,123 @@ + +#ifndef __OCOM_H__ +#define __OCOM_H__ + +#include "config.h" +//------------------------------------------------------------------------ + + +// ͨѶݰ + +//------------------------------------ +/* +һݰʽ + + 1. ̶ݰʽ + + |-------------------------------------------------------------------|-----------| + | ʶ | | | У | + |-------------------------------------------------------------------|-----------| + | B0 B1 B2 | B3 | B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 | B14 B15 | + |-------------------------------------------------------------------|-----------| + | ̶ | | ͬ岻ͬ | B4--B13 | + | | ID | 嶨οϸ˵ |16λУ | + | 0xEB,0x90,0xD7| | | | + |-------------------------------------------------------------------|-----------| + +*/ + +//------------------------------------ + +#define DC_SYNC_LEN 3 // ʶг +#define DC_CMD_LEN 1 //  +#define DC_CONT_LEN 10 // ݳ +#define DC_CHK_LEN 2 // Уֳ + +#define DC_CHECK_LEN (DC_CMD_LEN+DC_CONT_LEN) +#define LEN_OCOM_PKT (DC_SYNC_LEN+DC_CMD_LEN+DC_CONT_LEN+DC_CHK_LEN) + +//------------------------------------ + +#ifdef _IN_OCOM_C + +const u8 OCOM_SYNC[DC_SYNC_LEN] = +{ + 0xEB, + 0x90, + 0xD7, +}; + + +#else + +extern const u8 OCOM_SYNC[DC_SYNC_LEN]; + +#endif + + +//------------------------------------ + +typedef union +{ + struct + { + u8 normal[LEN_OCOM_PKT]; + } __attribute__ ((packed)) buff; // buffʽ + + struct + { + u8 sync[DC_SYNC_LEN]; + u8 cmd; + u8 content[DC_CONT_LEN]; + u16 check; + } __attribute__ ((packed)) normal; // ͨ÷ʽ + + struct + { + u8 sync[DC_SYNC_LEN]; + u8 cmd; + u8 toggle; + u8 attr; + s32 ax; + s32 ay; + u16 check; + } __attribute__ ((packed)) offcmd; // ߼ƫ + + struct + { + u8 sync[DC_SYNC_LEN]; + u8 cmd; + u8 toggle; + u16 exlen; + u8 data1[7]; + u16 check; + } __attribute__ ((packed)) d21cmd; // D21 + +}OComPacket; + +typedef struct +{ + int (*SendOComData)(u8 *, int); + int (*GetOComData)(u8 *, int); + int (*GetRsvLen)(void); + int (*GetTrsFreeLen)(void); + void (*Delay)(u32); +}OComExFuns; + +//------------------------------------ + +// ջ +void ReadOComBuffEmpty(OComExFuns * funs); + +int GetAOComPacket(OComExFuns * funs, OComPacket * pPacket); +int GetOComExData(OComExFuns * funs, u8 * pBuff, int exlen); + +int SendAOComPacket(OComExFuns * funs, OComPacket * pPacket); +int SendOComExData(OComExFuns * funs, u8 * pBuff, int exlen); + + +int PacketAOCom(OComPacket * pPacket); + +#define GetAOComNormalPacket GetAOComPacket + +#endif diff --git a/NxFuncs/comm/protocol.c b/NxFuncs/comm/protocol.c new file mode 100644 index 0000000..edb26cb --- /dev/null +++ b/NxFuncs/comm/protocol.c @@ -0,0 +1,5 @@ + +#define _IN_PROTOCOL_C +#include "protocol.h" + + diff --git a/NxFuncs/comm/protocol.h b/NxFuncs/comm/protocol.h new file mode 100644 index 0000000..edbb30c --- /dev/null +++ b/NxFuncs/comm/protocol.h @@ -0,0 +1,11 @@ + +#ifndef __PROTOCOL_H__ +#define __PROTOCOL_H__ + +#include "config.h" +#include "comm.h" + + + +#endif + diff --git a/NxFuncs/comm/xmodem.c b/NxFuncs/comm/xmodem.c new file mode 100644 index 0000000..89e575a --- /dev/null +++ b/NxFuncs/comm/xmodem.c @@ -0,0 +1,367 @@ + +#include "xmodem.h" +#include "serial.h" +#include "trigger.h" +#include "shell.h" +#include "delay.h" + +//--------------------------------------------------------- + +#define DEBUG_OK 0 + +#if (DEBUG_OK == 1) + +#define DEBUG_OUT(...) do \ +{\ + printf(__VA_ARGS__); \ +}while(0) + +void OutDebugBufInfo(void){}; + +#elif (DEBUG_OK == 2) + +char g_debugbuf[200][50]; +int g_debugidx = 0; + +#define DEBUG_OUT(...) do \ +{\ + if (g_debugidx < 200) \ + { \ + sprintf((char*)&(g_debugbuf[g_debugidx][0]), __VA_ARGS__); \ + g_debugidx++; \ + } \ +}while(0) + + +#if (DEBUG_OK == 2) +void OutDebugBufInfo(void) +{ + printf("\r\nDebug buff info (%d):\r\n", g_debugidx); + for (int i = 0; i < g_debugidx; i++) + { + printf("%s", (char*)(&g_debugbuf[i][0])); + DelayMs(10); + } + printf("\r\nDebug buff info end\r\n"); + + g_debugidx = 0; +} +#endif + + +#else + +#define DEBUG_OUT(...) do {}while(0) + +void OutDebugBufInfo(void){}; + +#endif + +//--------------------------------------------------------- + +// xmodemcrcֵ +u16 CalcXModemCrc(u8 * pDat, int count) +{ + u16 crc; + int i; + + crc = 0; + while (--count >= 0) + { + crc = crc ^ (u16) (*pDat++ << 8); + i = 8; + do + { + if (crc & 0x8000) + { + crc = crc << 1 ^ 0x1021; // X16+X12+X5+X0 + } + else + { + crc = crc << 1; + } + } while (--i); + } + + return (crc); +} + +// xmodemݰȷ +int CheckXModemDat(int crcflag, u8 * pBuf, int size) +{ + if(crcflag != 0) + { + u16 crc = CalcXModemCrc(pBuf, size); + u16 tcrc = ((u16)(pBuf[size])<<8) + pBuf[size+1]; + + if (crc == tcrc) + { + return 1; + } + } + else + { + int i = 0; + u8 cks = 0; + + for(i = 0; i < size; i++) + { + cks += pBuf[i]; + } + + if (cks == pBuf[size]) + { + return 1; + } + } + + return 0; +} + +// xmodem +int XmodemReceive(XmodemCtrl * pCtrl) +{ + int rslt, err, retry, recvsize, exsize; + int timer; + u8 packid, tmpid, temp; + u8 trychar, svchar; + u8 xbuff[XMODEM1K_FRAME_C]; + u8 ch; + int crcflag; + int datidx; + + trychar = 'C'; // crcУ鷽ʽ + svchar = trychar; + recvsize = 0; + packid = 1; + err = 0; + datidx = 0; + + pCtrl->InitSave(); + + DEBUG_OUT("Start XmodemReceive\r\n"); + +#define MAX_RETRY 32 + + // + for (retry = 0; retry < MAX_RETRY; retry++) // + { + // 1. ͷֽͬ + if(trychar != 0) + { + xbuff[0] = trychar; + pCtrl->XmodemOutBuff(xbuff, 1); + } + + // 2. ȴظݰ + timer = GetMsSoftTimer(); // ¼ʱ + recvsize = 0; + do + { + rslt = pCtrl->XmodemInBuff(xbuff, 1); + if (rslt != 1) // ȵַ + { + if (GetMsSoftTimer() - timer > 1000) // жǷʱ + { + break; + } + continue; + } + + ch = xbuff[0]; + switch(ch) + { + case XMODEM_SOH: // Xmodemݰͷ + { + DEBUG_OUT("get soh\r\n"); + recvsize = XMODEM_F_SIZE; + break; + } + case XMODEM_STX: // 1K-Xmodemݰͷ + { + DEBUG_OUT("get stx\r\n"); + recvsize = XMODEM1K_F_SIZE; + break; + } + case XMODEM_EOT: // + { + DEBUG_OUT("get eot\r\n"); + + pCtrl->XmodemCleanBuff(); // Ѿ + xbuff[0] = XMODEM_ACK; // ȷϻظ + pCtrl->XmodemOutBuff(xbuff, 1); + err = 1; + break; + } + case XMODEM_CAN: // ȡ + { + DEBUG_OUT("get can\r\n"); + + pCtrl->XmodemCleanBuff(); // Ѿ + xbuff[0] = XMODEM_ACK; // ȷϻظ + pCtrl->XmodemOutBuff(xbuff, 1); + err = -2; + break; + } + + default: + { + DEBUG_OUT("get others\r\n"); + break; + } + } + + break; + }while(1); + + if (err == 0) + { + // 3. жϻظǷȷ + if (recvsize == 0) // ֳͬʱ + { + if (trychar == 'C') + { + if (retry >= MAX_RETRY-1) + { + trychar = XMODEM_NAK; // ΪʹúУ鷽ʽ + retry = 0; + } + continue; // ¿ʼ + } + else + { + if (retry >= MAX_RETRY-1) + { + err = -1; // 泬ʱ˳ + } + else + { + continue; + } + } + } + if (trychar != 0) + { + DEBUG_OUT("save trychar\r\n"); + svchar = trychar; + } + trychar = 0; // Ѿ˴ + } + + // ļ + if (err == 0 && recvsize != 0) + { + if (svchar == 'C') + { + DEBUG_OUT("exsize = 4\r\n"); + exsize = XMODEM_HEAD_SIZE+XMODEM_CRC_SIZE-1; + crcflag = 1; + } + else + { + DEBUG_OUT("exsize = 3\r\n"); + exsize = XMODEM_HEAD_SIZE+XMODEM_CHECK_SIZE-1; + crcflag = 0; + } + + // ݰ + timer = GetMsSoftTimer(); // ¼ʱ + DEBUG_OUT("timer=%d\r\n", timer); + + do + { + rslt = pCtrl->XmodemInBuff(&(xbuff[1]), recvsize+exsize); + if (rslt == recvsize+exsize) // ȵַ + { + DEBUG_OUT("get exsize+recvsize=%d+%d\r\n", exsize, recvsize); + + tmpid = xbuff[1]; + temp = ~(xbuff[2]); + + if ((tmpid == temp) && + (CheckXModemDat(crcflag, &(xbuff[3]), recvsize) != 0)) + { + xbuff[0] = XMODEM_ACK; // ظACKȷϽյһݰ + pCtrl->XmodemOutBuff(xbuff, 1); + + DEBUG_OUT("check ok, send ack\r\n"); + + if (tmpid == packid) // + { + int svlen; + int svflag = (datidx == 0 ? 0:1); + svlen = pCtrl->SaveData(svflag, &(xbuff[3]), recvsize, pCtrl->savedsize); // + if (svlen > 0) + { + pCtrl->savedsize += svlen; + } + datidx++; + packid++; + } + retry = 0; + } + else + { + xbuff[0] = XMODEM_NAK; // ظ NAKҪ´ݰ + pCtrl->XmodemOutBuff(xbuff, 1); + + DEBUG_OUT("crc err, send NAK\r\n"); + } + break; + } + else + { + int tptimer; + + // + tptimer = GetMsSoftTimer(); + if (tptimer - timer > recvsize*1) // жǷʱ + { + DEBUG_OUT("tptimer=%d, timer=%d, gap=%d\r\n", tptimer, timer, tptimer - timer); + + rslt = pCtrl->XmodemGetInBuffLen(); + if (rslt > 0) + { + pCtrl->XmodemCleanBuff(); // Ѿ + xbuff[0] = XMODEM_NAK; // ظ NAKҪ´ݰ + pCtrl->XmodemOutBuff(xbuff, 1); + DEBUG_OUT("resvlen = %d, send NAK\r\n", rslt); + } + else + { + DEBUG_OUT("not data, error\r\n"); + err = -1; // ճʱ˳ + } + + DEBUG_OUT("wait timeout\r\n"); + break; + } + else + { + // ȴ + } + } + }while(1); + } + else + { + DEBUG_OUT("err != 0 || recvsize == 0\r\n"); + break; + } + + if (err < 0) + { + DEBUG_OUT("err < 0 sanc cancel\r\n"); + + xbuff[0] = XMODEM_CAN; // ȡ + pCtrl->XmodemOutBuff(xbuff, 1); + pCtrl->XmodemOutBuff(xbuff, 1); + pCtrl->XmodemOutBuff(xbuff, 1); + break; + } + } // end of for + + return err; +} + + diff --git a/NxFuncs/comm/xmodem.h b/NxFuncs/comm/xmodem.h new file mode 100644 index 0000000..12b8664 --- /dev/null +++ b/NxFuncs/comm/xmodem.h @@ -0,0 +1,157 @@ + +#ifndef __XMODEM_H__ +#define __XMODEM_H__ + +#include "config.h" + +/* + Xmodem Эһִͨй㷺õ첽ļЭ顣 + Ϊ׼Xmodem1k-Xmodem֣ǰ128ֽڿʽݣֽڿΪ1k1024ֽڣÿ鶼ʹһУ͹д⡣ + УշһУڷͷУͬʱշͷһȷֽ(ACK) + XmodemҪÿ鶼Ͽɣ⽫½رʱȽϳijϣЭԵЧʸ͡ + XmodemYmodemZmodemЭ顣ǵЭݺXmodemƣͬYmodemļ䣬ЧʸߣZmodemǸĽXmodemֻҪ𻵵ĿطȷĿ鲻Ҫȷֽڣͨ + + + ׼XmodemЭ飨ÿݰ128ֽݣ֡ʽ + + ________________________________________________________________ + | | | | | | + | SOH | Ϣ | ϢŵIJ | | У | + |_____|_____________|___________________|___________|___________| + | | | | | | + | 1B | 1B | 1B | 128B | 1B | + |_____|_____________|___________________|___________|___________| + + + SOH0x01ַ + + Ŵ1--255255ͷٿʼ + + ݶڱ׼XmodemЭ128ֽڣ͵ļ128ôһݰЧݿ϶С֡IJҪCTRL-Z(0x1A)䡣 + + УεۼӺУ + + + XModem չЭ飨ÿݰ128ֽݣ֡ʽ + + ________________________________________________________________ + | | | | | | + | SOH | Ϣ | ϢŵIJ | | CRCУ | + |_____|_____________|___________________|___________|___________| + | | | | | | + | 1B | 1B | 1B | 128B | 2B | + |_____|_____________|___________________|___________|___________| + + CRCУε16λCRCУ飨MSBţ + + X16+X12+X5+X0 + + 1K-Xmodemÿݰ1024ֽݣ֡ʽ + ________________________________________________________________ + | | | | | | + | STX | Ϣ | ϢŵIJ | | CRCУ | + |_____|_____________|___________________|___________|___________| + | | | | | | + | 1B | 1B | 1B | 1024B | 2B | + |_____|_____________|___________________|___________|___________| + + + Э飺 + + 1. + + ɽշͷ"C"NAK (עŶᵽNAKġǻῴNAKݲشĻ) + շNAKźűʾշۼӺУ飻ַ"C"ʾշʹCRCУ顣 + + 2. + + շ͵ĵһ"C"NAK﷢ͷͷΪԷ͵һݰѾ + ͷӦýÿ128ֽڵݼϰͷţŲ룬ĩβУͻCRCУ飬֡ʽ͡ + ͷ˵һ͵ȴշȷֽACKյշACKȷϣΪݰշȷգҽշҪͷһ + ͷյշNAK(NAK߷ͷش)ֽڣʾշطղŵݰ + ͷյշCANֽڣʾշֹͣ䡣 + + 3. + + ͷȫݣҪ䣬Ҫͷ EOT ֽ֪ͨշշACKȷϡ + ȻշҲǿֹͣ䣬շ CAN ֽڸͷʾշֹͣ䣬ͷյCAN󣬲Ҫٷ EOTȷϡ + + 4. ⴦ + + Ȼݰ SOH ־һϢʼģ SOH λEOTʾݴҲûݴ + շӦȷݰŵԣͨݰȡȻݰŵIJ򣬽Ϊ0ʾȷΪ0NAKش + շȷݰȷȻǷšõݰţ˵شӦ÷һ CAN ֹ䡣 + յݰİźǰһͬôշظͷ ACK ׼һ + շȷϢŵԺȷĺֻ 128 ֽڵνУ飬֡һֽڵУͻ2ֽڵCRCȽϣͬ ACKͬ NAK + + 5У˵ + + XmodemЭ֧2УͣۼӺCRCУ顣 + շһʼʱ͵NAKʾϣۼӺͷʽУ顣 + շһʼʱ͵ַCʾϣCRCʽУ顣 + XmodemҪͷ֧CRCľͱͬʱ֧ۼӺ͡ + ͷֻ֧ۼӺͣշַCôͷֻҪշ͡CκûյӦ𣬾ԶΪNAKͷ֧ܲCRCУ飬ҪΪۼӺУ鷽ʽ + ͷյNAK͸ϽݰӦ + +*/ + +#define XMODEM_SOH 0x01 // Xmodemݰͷ +#define XMODEM_STX 0x02 // 1K-Xmodemݰͷ +#define XMODEM_EOT 0x04 // +#define XMODEM_ACK 0x06 // ϿӦ磺ݰȷ +#define XMODEM_NAK 0x15 // ϿӦ +#define XMODEM_CAN 0x18 // ȡ +#define XMODEM_CTRLZ 0x1A // + + +//----------------------------------------------- + +#define XMODEM_F_SIZE 128 +#define XMODEM1K_F_SIZE 1024 + +#define XMODEM_HEAD_SIZE 3 + +#define XMODEM_CHECK_SIZE 1 +#define XMODEM_CRC_SIZE 2 + + +#define XMODEM_FRAME (XMODEM_F_SIZE+XMODEM_HEAD_SIZE+XMODEM_CHECK_SIZE) +#define XMODEM1K_FRAME (XMODEM1K_F_SIZE+XMODEM_HEAD_SIZE+XMODEM_CHECK_SIZE) + +#define XMODEM_FRAME_C (XMODEM_F_SIZE+XMODEM_HEAD_SIZE+XMODEM_CRC_SIZE) +#define XMODEM1K_FRAME_C (XMODEM1K_F_SIZE+XMODEM_HEAD_SIZE+XMODEM_CRC_SIZE) + +//----------------------------------------------- + + + + +typedef struct +{ + void (*InitSave)(void); + int (*SaveData)(int, u8 *, int, u32); + int (*XmodemOutBuff)(u8 *, int); + int (*XmodemInBuff)(u8 *, int); + int (*XmodemGetInBuffLen)(void); + int (*XmodemCleanBuff)(void); + + int savedsize; + int xpktlen; +}XmodemCtrl; + +//----------------------------------------------- + + +int XmodemReceive(XmodemCtrl * pCtrl); + + +void OutDebugBufInfo(void); + +//----------------------------------------------- + + + + + +#endif + diff --git a/NxFuncs/controlbus/colorcontrol.c b/NxFuncs/controlbus/colorcontrol.c new file mode 100644 index 0000000..a666791 --- /dev/null +++ b/NxFuncs/controlbus/colorcontrol.c @@ -0,0 +1,48 @@ + +#include "colorcontrol.h" + +#if (CONTROL_BUS == COMM_CAN) + +void InitColorControl(ColorControl * pCtrl) +{ + if (pCtrl != NULL) + { + memset(pCtrl, 0, sizeof(ColorControl)); + } +} + +void SendColorCommand(ColorControl * pCtrl, ColorCommand * pCmd) +{ + if (pCtrl != NULL && pCmd != NULL) + { + memcpy(pCtrl->ctrlCmd.cancomm.data.buff, pCmd->buff, CAN_DATA_LEN); + pCtrl->cmdFlag = 1; + } +} + +void RequestColorStatus(ColorControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refSta = 1; + } +} + +void RequestColorVersion(ColorControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refVer = 1; + } +} + +void RequestColorNvPara(ColorControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refNvPara = 1; + } +} + + +#endif diff --git a/NxFuncs/controlbus/colorcontrol.h b/NxFuncs/controlbus/colorcontrol.h new file mode 100644 index 0000000..da81a97 --- /dev/null +++ b/NxFuncs/controlbus/colorcontrol.h @@ -0,0 +1,171 @@ + +#ifndef __COLORCONTROL_H__ +#define __COLORCONTROL_H__ + +#include "controlbus.h" + +#if (CONTROL_BUS == COMM_CAN) + +/* + +*/ + +//------------------------------------------------------------------------------- + +typedef struct +{ + u8 nodeId; + + CtrlBusPacket ctrlCmd; // ΧĿ + CtrlBusPacket exbSta; // Χ巵ص״̬ + BoardRegVal regVal; // ΧĴֵ + CtrlBusPacket rdReg; // ȡΧĴֵ + + int cmdFlag; // ־ + int staFlag; // ״̬־ + + int refSta; // ˢ״̬־ + + int verFlag; // ³汾־ + int refVer; // ˢ³汾־ + + int transFlag; // ݴ־ + + u8 exbupdateFlag; // Χ־ + + u8 refNvPara; // ˢ·ʧԲ + u8 nvParaFlag; // յʧԲ־ + +}ColorControl; + +//------------------------------------------------------------------------------- + +typedef union +{ + u8 buff[CAN_DATA_LEN]; + + //--------------- + + struct + { + u16 cmd; + u8 subcmd; + u8 para[5]; + } __attribute__ ((packed)) colorCtrl; // + + struct + { + u16 cmd; + u8 needleNums; // + u8 rev[5]; // Ԥ + } __attribute__ ((packed)) colorPara; // + + struct + { + u16 cmd; + u8 parablockID; // ID + u8 paraID; // ID + s32 paraval; // ֵ + } __attribute__ ((packed)) colorNvPara; // ʧԲ + + struct + { + u16 staBits; // ״̬λ + u16 potValue; // λֵ + s8 curNeedle; // ǰλ + s8 needleNums; // + u8 rev[2]; + } __attribute__ ((packed)) colorSta; // ״̬ + + //----------------------------------------------- + + struct + { + u16 cmd; + u8 subcmd; // + u8 para[5]; + } __attribute__ ((packed)) chenilleCtrl; // ë + + struct + { + u16 staBits; // ״̬λ + u16 potValue; // λֵ(ɽߵλ) + s8 curNeedle; // ǰλ + s8 needleNums; // + s8 elasticWirePos; // ɽߵλ + u8 rev; + } __attribute__ ((packed)) chenilleSta; // ë״̬ + + struct + { + u16 cmd; + u8 para[6]; // Ԥ + } __attribute__ ((packed)) chenillePara; // ë + +}ColorCommand; + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- +// + +/* +#define CTRL_CMD_EMB_HEAD_CTRL 0x1000 // ƽͷ +#define CTRL_CMD_EMB_HEAD_PARA 0x1001 // ƽͷ +#define CTRL_CMD_HEAD_NVPARA 0x1002 // ƽͷʧԲ + +#define CTRL_CMD_CHENILLE_HEAD_CTRL 0x1010 // ëͷ +#define CTRL_CMD_CHENILLE_HEAD_PARA 0x1011 // ëͷ +#define CTRL_CMD_CHENILLE_NVPARA 0x1012 // ëͷʧԲ + +#define CTRL_CMD_COIL_HEAD_CTRL 0x1020 // ƻͷ +#define CTRL_CMD_COIL_HEAD_PARA 0x1021 // ƻͷ +#define CTRL_CMD_COIL_NVPARA 0x1022 // ƻͷʧԲ +*/ + +#define CTRL_CMD_COLOR_CTRL 0x1100 // +#define CTRL_CMD_COLOR_PARA 0x1101 // +#define CTRL_CMD_COLOR_NVPARA 0x1102 // ʧԲ + +// +#define CTRL_SUBCMD_SWITCH_NEEDLE 0x01 // ɫ +#define CTRL_SUBCMD_CHG_MOTO_CTRL 0x02 // ɫ + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- +// ë +#define CTRL_CMD_CHENILLE_CTRL 0x1110 //ë + +// +#define CTRL_SUBCMD_ELASTIC_CTRL 0x01 // ɽ߿ +#define CTRL_SUBCMD_CHENILLE_COLOR 0x02 // ëɫ + +// ɽ߿para[0] +#define ELASTICWIRE_COLORCHANGE_POS 1 // ɽߵɫλ +#define ELASTICWIRE_TRIMMING_POS 2 // ɽߵλ +#define ELASTICWIRE_CHAIN_POS 3 // ɽߵʽλ +#define ELASTICWIRE_CHENILLE_POS 4 // ɽߵëλ + +//------------------------------------------------------------------------------- + +void InitColorControl(ColorControl * pCtrl); + +void SendColorCommand(ColorControl * pCtrl, ColorCommand * pCmd); + +void RequestColorStatus(ColorControl * pCtrl); + +void RequestColorVersion(ColorControl * pCtrl); + +void RequestColorNvPara(ColorControl * pCtrl); + +//------------------------------------------------------------------------------- + + + + +//------------------------------------------------------------------------------- + +#endif +#endif diff --git a/NxFuncs/controlbus/controlbus.c b/NxFuncs/controlbus/controlbus.c new file mode 100644 index 0000000..4378c32 --- /dev/null +++ b/NxFuncs/controlbus/controlbus.c @@ -0,0 +1,7 @@ + +#include "controlbus.h" + + + + + diff --git a/NxFuncs/controlbus/controlbus.h b/NxFuncs/controlbus/controlbus.h new file mode 100644 index 0000000..4968303 --- /dev/null +++ b/NxFuncs/controlbus/controlbus.h @@ -0,0 +1,275 @@ + +#ifndef __CONTROLBUS_H__ +#define __CONTROLBUS_H__ + +#include "canctrl.h" + +/* + ߵĿϵͳ֧CAN485 + + пԹضڵ㣬ÿڵΨһID + ڵIDͨ߱ãú̻ڵСҪ֤нڵIDΨһԡ + + + Ϲ򣬽ڵĹϵԷΪ ͡ݡ + ÿڵԽ + +*/ + +//------------------------------------------------------------------------------------------------------------- +//-------------------------------------- CAN ͨѶЭ鶨 ----------------------------------------------- +//------------------------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------- +// CAN ݰ + +// |-------------------------------------------------------------------- +// | exId | data +// |-------------------------------------------------------------------- +// | +// |-------------------------------------------------------------------- +// | +// |-------------------------------------------------------------------- + +// CAN Զ̰ + +//------------------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------------------- + +// exId ĸ֣29λ + +#define BNMASK_PRT 0x1F000000 // ͨѶЭ +#define BNMASK_TID 0x00FF0000 // Ŀ豸ID +#define BNMASK_SID 0x0000FF00 // Դ豸ID +#define BNMASK_CMD 0x000000FF // + +#define BNMASK_ID (BNMASK_TID|BNMASK_SID) + +// Ŀ豸Ŀ豸ID ͨѶڵıʶͨѶڵʶCANҪΨһ + +//---------------------------------------------------------------- +// ͨѶѭЭ +// ͨѶЭͶ +#define BN_PROTOCOL_ALL 0x00 // 豸ͨѶ +#define BN_PROTOCOL_MVCTRL 0x01 // ˶Э +#define BN_PROTOCOL_HEAD 0x05 // ͷͨѶЭ +#define BN_PROTOCOL_COLOR 0x06 // ɫЭ +#define BN_PROTOCOL_EXTIO 0x07 // IOչЭ +#define BN_PROTOCOL_SEWHD 0xA1 // һͷЭ + +//---------------------------------------------------------------- + +// 豸ID Ŀ豸ID Դ豸IDÿЭµIDǿظġ +#define BN_ID_BROADCAST 0x00 // ID㲥ID + +// 1--255ÿӵķIDִ +// ID ķ̷ͨ߱䣬ҲԹ̶ +// +// + +//---------------------------------------------------------------- + +// ͨѶ +#define BN_CMD_BROADCAST 0x00 // 㲥 +#define BN_CMD_TRAVERSE 0x01 // // ָ-巢Χ +#define BN_CMD_BUSSTA 0x02 // ״̬ // ָ-Χ巢 +#define BN_CMD_INPUTCHG 0x03 // źű仯 +#define BN_CMD_CHGOUTPUT 0x04 // 仯ź +#define BN_CMD_REGVAL 0x05 // ״̬˿ڱ仯ȡĴֵ +#define BN_CMD_WTREG 0x06 // дݣüĴֵ +#define BN_CMD_EXCTRL 0x07 // Χ +#define BN_CMD_EXSTA 0x08 // Χ״̬ + +#define BN_CMD_TRANS_DATA 0x09 // ݴ +#define BN_CMD_NVPARA 0x0A // ȡ or ʧԲ + +//---------------------------------------------------------------- +//  +#define TRA_CMD_ENTER_TRA 0x01 // ״̬ +#define TRA_CMD_EXIT_TRA 0x02 // ˳״̬ +#define TRA_CMD_NODE_TRA_BEG 0x03 // ijڵIDʼ +#define TRA_CMD_NODE_TRA_END 0x04 // ijڵID + +#define TRA_CMD_ASK_TRA_STA 0x05 // ѯнڵ״̬ + +//---------------------------------------------------------------- +// ߽ڵ״̬ +#define TRA_STA_INIT 0x00 // ʼ״̬ +#define TRA_STA_TRA 0x01 // ״̬,յ ״̬ +#define TRA_STA_BEG 0X02 // ʼ״̬ڱ״̬£յýڵID +#define TRA_STA_RESP 0x03 // Ӧ״̬ڱʼ״̬£ͨش +#define TRA_STA_COMP 0x04 // ״̬ڱӦ״̬£ͨ巢ݰ +//---------------------------------------------------------------- +// Ĵ +#define BOARD_VER_LEN 8 // Χ汾 + +// 洢ȡļĴֵ(Ĵ,Ϊ) +typedef struct +{ + u8 rdnewbverflag; // ȡ³汾־ + u32 rdbverbitmap; // 汾λͼ + u32 exbVer[BOARD_VER_LEN]; // Χ汾 + // ... +}BoardRegVal; + +#define PORT_ADDR_HIGH 0xFFFF0000 +#define PORT_ADDR_LOW 0x0000FFFF + +#define BOARD_VERSION 0x00010000 // 汾 +#define EXBOARD_UPDATE 0x00080000 // Χ +#define GET_NV_PARA 0x00100000 // ȡ + +//---------------------------------------------------------------- + +// EXID +#define MAKE_EXID(prt, tid, sid, cmd) ( (((u32)((prt)&0x1f))<<24) | (((u32)((tid)&0xff))<<16) | (((u32)((sid)&0xff))<<8) | (((u32)((cmd)&0xff))) ) + +// EXIDֶ +#define GET_PRT_FROM_EXID(exid) ((u8)((((u32)(exid))&BNMASK_PRT) >> 24)) +#define GET_TID_FROM_EXID(exid) ((u8)((((u32)(exid))&BNMASK_TID) >> 16)) +#define GET_SID_FROM_EXID(exid) ((u8)((((u32)(exid))&BNMASK_SID) >> 8)) +#define GET_CMD_FROM_EXID(exid) ((u8)((((u32)(exid))&BNMASK_CMD) >> 0)) + +//---------------------------------------------------------------- + +// 㲥ID +#define BROADCAST_EXID (MAKE_EXID(BN_PROTOCOL_ALL, BN_ID_BROADCAST, BN_ID_BROADCAST, BN_CMD_BROADCAST)) + +// ɹ +#define MAKE_FILTER(exid, rtr) ((((u32)exid)<<3) | CAN_ID_EXT | rtr) + +//---------------------------------------------------------------- +//---------------------------------------------------------------- + +typedef union +{ + // ʹôʱͨѶʽ + struct + { + u32 sync; + u16 cmd; + u32 addr; + u32 val; + u16 crc; + } __attribute__ ((packed)) sercomm; + + // ʹCANʱͨѶ + struct + { + u16 rev1; + union + { + u32 id; + + struct + { + u8 type; // ͨѶڵ࣬ЧλΪ5λ֧0--3132֣ + u8 tid; // ĿͨѶڵidЧλΪ8λ֧0--255256 + u8 sid; // ԴͨѶڵidЧλΪ8λ֧0--255256 + u8 cmd; // ͨѶܱ룩 + } __attribute__ ((packed)) desc; + + } __attribute__ ((packed)) exId; // can ͨѶ29λ exid + + union + { + u8 buff[8]; // buff + + struct + { + u8 tracmd; // + u8 nodeid; // ڵID + u8 nodetype; // ڵ + u8 rev[5]; + } __attribute__ ((packed)) traverse; // + + struct + { + u8 staCode; // ״̬ + u32 cpuid; // ɰ忨CPUIDɵУ + u8 nodetype; + u8 signal; // źż,쳣Ϊ1 + // bit0,ZP + // bit1,MP + u8 rev; + } __attribute__ ((packed)) busSta; // ״̬ + + int64_t inputs; // ź + + struct + { + u32 mask; + u32 value; + } __attribute__ ((packed)) outputs; // ź + + struct + { + u32 portaddr; + u32 status; + } __attribute__ ((packed)) rdport; // ״̬˿ + + struct + { + u32 portaddr; + u32 wrdata; + } __attribute__ ((packed)) wrport; // д˿ + + struct + { + u16 ccmd; // + u8 para[6]; // + } __attribute__ ((packed)) exctrl; // Χ + + struct + { + u16 esta; // ״̬ + u8 para[6]; // + } __attribute__ ((packed)) exsta; // Χ״̬ + + struct + { + u16 ccmd; // + u8 subcmd; + u8 para1; + s32 para2; + } __attribute__ ((packed)) mctrl; // M + + struct + { + u16 ccmd; // + u8 currentNP; // ǰλ + u16 mrotCtnAng; + u8 para[3]; + } __attribute__ ((packed)) coilpara; + + struct + { + u16 cmd; // + u8 parablockID; // ID + u8 paraID; // ID + s32 paraval; // ֵ + } __attribute__ ((packed)) headNvPara; // ʧԲ + + } __attribute__ ((packed)) data; // can ͨѶ8ֽ + + u16 rev2; + + } __attribute__ ((packed)) cancomm; + + // ݰʽ...... + + + +} CtrlBusPacket; + + +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + + + + +//---------------------------------------------------------------- + +#endif diff --git a/NxFuncs/controlbus/corecontrol.c b/NxFuncs/controlbus/corecontrol.c new file mode 100644 index 0000000..b775f5d --- /dev/null +++ b/NxFuncs/controlbus/corecontrol.c @@ -0,0 +1,10 @@ + +#include "corecontrol.h" + +void InitCoreControl(CoreControl * pCtrl) +{ + if (pCtrl != NULL) + { + memset(pCtrl, 0, sizeof(CoreControl)); // ֵȫΪ0 + } +} diff --git a/NxFuncs/controlbus/corecontrol.h b/NxFuncs/controlbus/corecontrol.h new file mode 100644 index 0000000..94292b7 --- /dev/null +++ b/NxFuncs/controlbus/corecontrol.h @@ -0,0 +1,41 @@ + +#ifndef __CORECONTROL_H__ +#define __CORECONTROL_H__ + +#include "controlbus.h" + +#define CORE_STA_BUF_LEN 8 +#define CORE_CHG_BUF_LEN 8 + +typedef struct +{ + u32 staexid; + u32 cmdexid; + + // ״̬ + int refreshflag; // ˢ±־ + void (*ReSendStatus)(int); // ˢ״̬ + + int stachangeflag; // ״̬仯־DZ壬״̬ı䣬־״̬ߡӣ±־ + u32 stabuff[CORE_STA_BUF_LEN]; // ״̬DZ壬ô汾״̬ӡӣŶȡӵ״̬ + + // + int newcmdflag; // ־DZ壬ӷ־ӣ־Ҫ + u32 cmdbuff[CORE_CHG_BUF_LEN]; // DZ壬ӷӣд͡ + +}CoreControl; + +//------------------------------------------------ + + +//------------------------------------------------ + +void InitCoreControl(CoreControl * pCtrl); + + + + + + + +#endif diff --git a/NxFuncs/controlbus/extiocontrol.c b/NxFuncs/controlbus/extiocontrol.c new file mode 100644 index 0000000..e6aae9f --- /dev/null +++ b/NxFuncs/controlbus/extiocontrol.c @@ -0,0 +1,48 @@ + +#include "extiocontrol.h" + +#if (CONTROL_BUS == COMM_CAN) + + +void InitExtIOControl(ExtIOControl * pCtrl) +{ + if (pCtrl != NULL) + { + memset(pCtrl, 0, sizeof(ExtIOControl)); + } +} + +void SendExtIOCommand(ExtIOControl * pCtrl, ExtIOCommand * pCmd) +{ + if (pCtrl != NULL && pCmd != NULL) + { + memcpy(pCtrl->ctrlCmd.cancomm.data.buff, pCmd->buff, CAN_DATA_LEN); + pCtrl->cmdFlag = 1; + } +} + +void RequestExtIOStatus(ExtIOControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refSta = 1; + } +} + + +void RequestExtIOVersion(ExtIOControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refVer = 1; + } +} + +#endif + + + + + + + diff --git a/NxFuncs/controlbus/extiocontrol.h b/NxFuncs/controlbus/extiocontrol.h new file mode 100644 index 0000000..6a43c27 --- /dev/null +++ b/NxFuncs/controlbus/extiocontrol.h @@ -0,0 +1,106 @@ + +#ifndef __EXTIOCONTROL_H__ +#define __EXTIOCONTROL_H__ + +#include "controlbus.h" + +#if (CONTROL_BUS == COMM_CAN) +/* + IOչ +*/ + +//------------------------------------------------------------------------------- + +typedef struct +{ + u8 nodeId; // ڵID + + CtrlBusPacket ctrlCmd; // ΧĿ + CtrlBusPacket exbSta; // Χ巵ص״̬ + BoardRegVal regVal; // ΧĴֵ + CtrlBusPacket rdReg; // ȡΧĴֵ + + u8 cmdFlag; // ־ N5--յ + + u8 staFlag; // ״̬־ N5--BN_CMD_EXSTA + u8 refSta; // ˢ״̬־ N5--BN_CMD_EXSTA + + u8 refVer; + u8 verFlag; + + u8 transFlag; // ݴ־ + u8 exbupdateFlag; // Χ־ + +}ExtIOControl; + +//------------------------------------------------------------------------------- + +typedef union +{ + u8 buff[CAN_DATA_LEN]; + + struct + { + u16 cmd; + u8 subcmd; + u16 outctrl; + u8 para[3]; + } __attribute__ ((packed)) extIOCtrl; // IOչ + + struct + { + u16 inputSta; + u8 rev[6]; + } __attribute__ ((packed)) extIOSta; // ״̬ + +}ExtIOCommand; + +//------------------------------------------------------------------------------- +//  + +/* +#define CTRL_CMD_EMB_HEAD_CTRL 0x1000 // ƽͷ +#define CTRL_CMD_EMB_HEAD_PARA 0x1001 // ƽͷ +#define CTRL_CMD_HEAD_NVPARA 0x1002 // ƽͷʧԲ + +#define CTRL_CMD_CHENILLE_HEAD_CTRL 0x1010 // ëͷ +#define CTRL_CMD_CHENILLE_HEAD_PARA 0x1011 // ëͷ +#define CTRL_CMD_CHENILLE_NVPARA 0x1012 // ëͷʧԲ + +#define CTRL_CMD_COIL_HEAD_CTRL 0x1020 // ƻͷ +#define CTRL_CMD_COIL_HEAD_PARA 0x1021 // ƻͷ +#define CTRL_CMD_COIL_NVPARA 0x1022 // ƻͷʧԲ +*/ + +/* +#define CTRL_CMD_COLOR_CTRL 0x1100 // +#define CTRL_CMD_COLOR_PARA 0x1101 // +#define CTRL_CMD_COLOR_NVPARA 0x1102 // ʧԲ +*/ + +#define CTRL_CMD_EXTIO_CTRL 0x1200 // + +//------------------------------------------------------------------------------- +// ӿ +#define CTRL_SUBCMD_OUT_ON 0x01 +#define CTRL_SUBCMD_OUT_OFF 0x02 + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + +void InitExtIOControl(ExtIOControl * pCtrl); + +void SendExtIOCommand(ExtIOControl * pCtrl, ExtIOCommand * pCmd); + +void RequestExtIOStatus(ExtIOControl * pCtrl); + +void RequestExtIOVersion(ExtIOControl * pCtrl); + +//------------------------------------------------------------------------------- + + +#endif + +#endif diff --git a/NxFuncs/controlbus/headcontrol.c b/NxFuncs/controlbus/headcontrol.c new file mode 100644 index 0000000..1625bb1 --- /dev/null +++ b/NxFuncs/controlbus/headcontrol.c @@ -0,0 +1,58 @@ + +#include "headcontrol.h" + +#if (CONTROL_BUS == COMM_CAN) + + + + +void InitHeadControl(HeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + memset(pCtrl, 0, sizeof(HeadControl)); + } +} + +void SendHeadCommand(HeadControl * pCtrl, HeadCommand * pCmd) +{ + if (pCtrl != NULL && pCmd != NULL) + { + memcpy(pCtrl->ctrlCmd.cancomm.data.buff, pCmd->buff, CAN_DATA_LEN); + pCtrl->cmdFlag = 1; + } +} + +void RequestHeadStatus(HeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refSta = 1; + } +} + + +void RequestHeadVersion(HeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refVer = 1; + } +} + +void RequestHeadNvPara(HeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refNvPara = 1; + } +} + +#endif + + + + + + + diff --git a/NxFuncs/controlbus/headcontrol.h b/NxFuncs/controlbus/headcontrol.h new file mode 100644 index 0000000..8f0485e --- /dev/null +++ b/NxFuncs/controlbus/headcontrol.h @@ -0,0 +1,305 @@ + +#ifndef __HEADCONTROL_H__ +#define __HEADCONTROL_H__ + +#include "controlbus.h" + +#if (CONTROL_BUS == COMM_CAN) +/* + ͷư + +*/ + +//------------------------------------------------------------------------------- + +typedef struct +{ + u8 nodeTye; // ڵ + u8 nodeId; // ڵID + + CtrlBusPacket ctrlCmd; // ΧĿ + CtrlBusPacket exbSta; // Χ巵ص״̬ + CtrlBusPacket busSta; // Χ巵ص״̬ + CtrlBusPacket traCmd; // Χı + BoardRegVal regVal; // ΧĴֵ + CtrlBusPacket rdReg; // ȡΧĴֵ + + u8 cmdFlag; // ־ N5--յ + + u8 staFlag; // ״̬־ N5--BN_CMD_EXSTA + u8 refSta; // ˢ״̬־ N5--BN_CMD_EXSTA + + u8 traFlag; // ־ N5--յ + u8 busFlag; // ״̬־ N5--BN_CMD_BUSSTA + + u8 refVer; + u8 verFlag; + + u8 transFlag; // ݴ־ + u8 exbupdateFlag; // Χ־ + + u8 refNvPara; // ˢ·ʧԲ + u8 nvParaFlag; // յʧԲ־ + + u8 refHeadPara; // ˢ»ͷ + u8 headParaFlag; // ջͷ־ + +}HeadControl; + +//------------------------------------------------------------------------------- + +typedef union +{ + u8 buff[CAN_DATA_LEN]; + + struct + { + u16 cmd; + u8 subcmd; + u8 para[5]; + } __attribute__ ((packed)) headCtrl; // ͷ + + struct + { + u16 cmd; + u8 needleNums; // + u8 currentNP; // ǰλ + u8 rev[4]; // + } __attribute__ ((packed)) headPara; // ͷ + + struct + { + u16 cmd; // + u8 parablockID; // ID + u8 paraID; // ID + s32 paraval; // ֵ + } __attribute__ ((packed)) headNvPara; // ʧԲ + + struct + { + u32 staBits; // ״̬λ + u8 setedNP; // õĵǰλ + u16 potValue; // λֵ(ë) + s8 curHoistLevel; // ǰλ + } __attribute__ ((packed)) headSta; // ״̬ + + struct + { + u32 staBits; // ״̬λ + u8 setedNP; // õĵǰλ + s16 footmotopos; // ѹŵλ + u8 rev; + } __attribute__ ((packed)) footHeadSta; // ״̬(ѹ) + + struct + { + u16 cmd; + u8 validFlag; // Ч־ + u16 msang; // Ƕ + u8 nodetype; // 20220523 Ϊԭлϼë,ͬʱǺӵIJƵ.. + // ڵ(ƽͷ,ëͷ,ƻͷ) + u8 para[2]; // + } __attribute__ ((packed)) setmsang; // Ƕ + + struct + { + u16 cmd; + u8 para[6]; + } __attribute__ ((packed)) chenillePara; // ë + + struct + { + u16 cmd; + u8 subcmd; + u8 para1; + s32 para2; + } __attribute__ ((packed)) coilMCtrl; // M + + struct + { + u16 cmd; + u8 currentNP; // ǰλ + u16 mrotCtnAng; // MתǶ + u8 rev[3]; // + } __attribute__ ((packed)) coilheadPara; // ƻͷ + + struct + { + u32 staBits; // ״̬λ + s16 footmotopos; // ѹŵλ + s16 swmotopos; // λ + } __attribute__ ((packed)) wireHeadSta; // ״̬(߻) + +}HeadCommand; + +//------------------------------------------------------------------------------- +//  + +#define CTRL_CMD_EMB_HEAD_CTRL 0x1000 // ƽͷ +#define CTRL_CMD_EMB_HEAD_PARA 0x1001 // ƽͷ +#define CTRL_CMD_HEAD_NVPARA 0x1002 // ƽͷʧԲ + +#define CTRL_CMD_CHENILLE_HEAD_CTRL 0x1010 // ëͷ +#define CTRL_CMD_CHENILLE_HEAD_PARA 0x1011 // ëͷ +#define CTRL_CMD_CHENILLE_NVPARA 0x1012 // ëͷʧԲ + +#define CTRL_CMD_COIL_HEAD_CTRL 0x1020 // ƻͷ +#define CTRL_CMD_COIL_HEAD_PARA 0x1021 // ƻͷ +#define CTRL_CMD_COIL_NVPARA 0x1022 // ƻͷʧԲ + +#define CTRL_CMD_PUNCH_HEAD_CTRL 0x1030 // ׻ͷ +#define CTRL_CMD_PUNCH_HEAD_PARA 0x1031 // ׻ͷ +#define CTRL_CMD_PUNCH_NVPARA 0x1032 // ׻ͷʧԲ + +#define CTRL_CMD_HEAD_MSANG 0x1050 // Ƕ + +/* +#define CTRL_CMD_COLOR_CTRL 0x1100 // +#define CTRL_CMD_COLOR_PARA 0x1101 // +#define CTRL_CMD_COLOR_NVPARA 0x1102 // ʧԲ +*/ + +//------------------------------------------------------------------------------- +// ӿ + +#define CTRL_SUBCMD_DISABLE 0x00 // ͷƹܹر +#define CTRL_SUBCMD_ENABLE 0x01 // ͷƹܴ +#define CTRL_SUBCMD_MS_ACTIVE 0x02 // ᶯ̬ +#define CTRL_SUBCMD_MS_STATIC 0x03 // ᾲ̬ +#define CTRL_SUBCMD_LOCK_NEEDLE 0x04 // +#define CTRL_SUBCMD_UNLOCK_NEEDLE 0x05 // +#define CTRL_SUBCMD_TBD_ENABLE 0x06 // ϼ +#define CTRL_SUBCMD_TBD_DISABLE 0x07 // ϼֹ +#define CTRL_SUBCMD_TBD_RESET 0x08 // ϼ츴λ +#define CTRL_SUBCMD_TBD_DETE 0x09 // ߼ +#define CTRL_SUBCMD_HOOK_THREAD 0x0A // ߹ +#define CTRL_SUBCMD_HOOK_TEST 0x0B // Թ +#define CTRL_SUBCMD_TRD_LOOSE_ON 0x0C // ߿ɣ +#define CTRL_SUBCMD_TRD_LOOSE_OFF 0x0D // ߹أг֣ +#define CTRL_SUBCMD_MEND_BEGIN 0x0E // ʼ +#define CTRL_SUBCMD_MEND_END 0x0F // +#define CTRL_SUBCMD_MEND_PAUSE 0x10 // ͣ + +#define CTRL_SUBCMD_BUS_DECT_BEG 0x11 // ߼⿪ʼ() +#define CTRL_SUBCMD_BUS_DECTING 0x12 // ߼() +#define CTRL_SUBCMD_BUS_DECT_END 0x13 // ߼(״̬) + +#define CTRL_SUBCMD_SCATBEAD_PUSH_ON 0x14 // ɢ +#define CTRL_SUBCMD_SCATBEAD_PUSH_OFF 0x15 // ɢ +#define CTRL_SUBCMD_SCATBEAD_GET 0x16 // ɢȡ +#define CTRL_SUBCMD_SCATBEAD_CHCO 0x17 // ɢ黻ɫ,ĸ(ȡ鶯) +#define CTRL_SUBCMD_SCBE_CHCOZERO 0x18 // ɢ黻ɫ +#define CTRL_SUBCMD_SCATBEAD_LIFT 0x19 // ɢ,1½, 0 +#define CTRL_SUBCMD_SCATBEAD_RESET 0x1A // ɢ鸴λ +#define CTRL_SUBCMD_SCATBEAD_STA 0x1B // ɢ״̬ +#define CTRL_SUBCMD_SCATBEAD_FEED 0x1C // ɢ + +#define CTRL_SUBCMD_SEQUIN_PARA 0x1D // Ƭ +#define CTRL_SUBCMD_SEQUIN_ONCE 0x1E // ƬƬ +#define CTRL_SUBCMD_SEQUIN_PUSH 0x1F // Ƭ +#define CTRL_SUBCMD_SEQUIN_CHCO 0x20 // Ƭɫ,ĸ +#define CTRL_SUBCMD_SEQUIN_CHCOZERO 0x21 // Ƭɫ +#define CTRL_SUBCMD_SEQUIN_LIFT 0x22 // Ƭ,1½, 0 +#define CTRL_SUBCMD_SEQUIN_CUT 0x23 // ƬƬ + +#define CTRL_SUBCMD_BEADSEQ_CHANGE 0x24 // Ƭл + +#define CTRL_SUBCMD_EASY_CHENILLE_LIFT 0x25 // ë +#define CTRL_SUBCMD_EASY_CHENILLE_CTRL 0x26 // ë + +#define CTRL_SUBCMD_TRACK_LIFT 0x27 // +#define CTRL_SUBCMD_TRACK_TO_POS 0x28 // תȥijλ +#define CTRL_SUBCMD_TRACK_CHECK 0x29 // +#define CTRL_SUBCMD_TRACK_RESET 0x2A // 帴λ + +#define CTRL_SUBCMD_LASERLIGHT_ON 0x30 // ⶨλƿ +#define CTRL_SUBCMD_LASERLIGHT_OFF 0x31 // ⶨλƹ +#define CTRL_SUBCMD_LASER_ON 0x32 // +#define CTRL_SUBCMD_LASER_OFF 0x33 // ع +#define CTRL_SUBCMD_LASERBLOW_ON 0x34 // ⴵ +#define CTRL_SUBCMD_LASERBLOW_OFF 0x35 // ⴵ + +#define CTRL_SUBCMD_HOIST_CTRL 0x40 // ë +#define CTRL_SUBCMD_CUT_CTRL 0x41 // ë߿ +#define CTRL_SUBCMD_SET_WORK_LEVEL 0x42 // λ +#define CTRL_SUBCMD_GOTO_WORK_LEVEL 0x43 // ȥ + +#define CTRL_SUBCMD_MAXIS_CTRL 0x50 // M +#define CTRL_SUBCMD_MAXIS_RUN 0x51 // M˶ +#define CTRL_SUBCMD_FOOT_CTRL 0x52 // ѹſ +#define CTRL_SUBCMD_ZIGZAG_CTRL 0x53 // ݿ +#define CTRL_SUBCMD_COIL_CTRL 0x54 // ƿ + +// ߻ +#define CTRL_SUBCMD_CLIPWIRE_CTRL 0x60 // е˿ +#define CTRL_SUBCMD_UPLINE_CTRL 0x61 // ߿ +#define CTRL_SUBCMD_PRESSWIRE_CTRL 0x62 // ѹ˿ +#define CTRL_SUBCMD_UPCUT_CTRL 0x63 // ϼ߿ +#define CTRL_SUBCMD_WIREALARM_DECT 0x64 // ߱ +#define CTRL_SUBCMD_WIREALARM_RESET 0x65 // ߱λ +#define CTRL_SUBCMD_STFED_ENABLE 0x66 // +#define CTRL_SUBCMD_STFED_DISABLE 0x67 // ֹ߽ +#define CTRL_SUBCMD_STFED_RESET 0x68 // ߸λ +#define CTRL_SUBCMD_HOLE_CTRL 0x69 // ׿ +#define CTRL_SUBCMD_HOLE_LIFT_CTRL 0x6A // +#define CTRL_SUBCMD_LIFT_CTRL 0x6B // ͷ +// ɫ +#define CTRL_SUBCMD_CON_SWITCH_NEEDLE 0x70 // ɫλ +//------------------------------------------------------------------------------- +// ״̬λ + +#define HDSTA_HEAD_LOCK 0x00000001 // ͷ״̬־۰ťͷͷ +#define HDSTA_THREAD_BREAK 0x00000002 // ߶״̬־ +#define HDSTA_DTHREAD_BREAK 0x00000004 // ߶״̬־ +#define HDSTA_MEND_EMB 0x00000008 // ״̬ +#define HDSTA_MEND_PAUSE 0x00000010 // ͣ +#define HDSTA_MEND_WORK 0x00000020 // 幤ģʽ +#define HDSTA_CUT_POS 0x00000040 // ڻλ +#define HDSTA_SCBE_ALARM 0x00000080 // ɢ鱨 +#define HDSTA_TRACK_ALARM 0x00000100 // 屨 +#define HDSTA_FOOT_DOWN 0x00000200 // ѹλ +#define HDSTA_FOOT_UP 0x00000400 // ѹλ +#define HDSTA_CUT_WORKPOS 0x00000800 // λ(߻) +#define HDSTA_WIRE_ALARM 0x00001000 // ߱(߻) +#define HDSTA_FEEDWIRE_TIMEOUT 0x00002000 // ߳ʱ(߻) +#define HDSTA_FEEDWIRE_ALARM 0x00004000 // (߻) +#define HDSTA_FEEDWIRE_NULL 0x00008000 // δ(߻) +#define HDSTA_HOLE_LIFT_UP 0x00010000 // λ(߻) +#define HDSTA_HOLE_LIFT_DOWN 0x00020000 // λ(߻) +#define HDSTA_LASER_ALM 0x00040000 // ⱨ(߻) +#define HDSTA_LIFT_UP 0x00080000 // ͷλ(߻) +#define HDSTA_LIFT_DOWN 0x00100000 // ͷλ(߻) + +//------------------------------------------------------------------------------- +// ͷͶ + +#define FLAT_EMB_HEAD 0x01 // ƽͷ +#define CHENILLE_HEAD 0x02 // ë()ͷ +#define COIL_HEAD 0x03 // ƻͷ +#define CHENILLE_DN_HEAD 0x04 // ë»ͷ +#define LASER_HEAD 0x05 // ͷ + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + +void InitHeadControl(HeadControl * pCtrl); + +void SendHeadCommand(HeadControl * pCtrl, HeadCommand * pCmd); + +void RequestHeadStatus(HeadControl * pCtrl); + +void RequestHeadVersion(HeadControl * pCtrl); + +void RequestHeadNvPara(HeadControl * pCtrl); + +//------------------------------------------------------------------------------- + + + + +//------------------------------------------------------------------------------- + +#endif + +#endif diff --git a/NxFuncs/controlbus/sewhdcontrol.c b/NxFuncs/controlbus/sewhdcontrol.c new file mode 100644 index 0000000..67eccea --- /dev/null +++ b/NxFuncs/controlbus/sewhdcontrol.c @@ -0,0 +1,67 @@ +//------------------------------------------------------------------------------- +// File Name: SewHeadControl.c +// Brief: +// Version: 1.0.0 +// Create Date: 2017/05/08 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2017/05/08 +//------------------------------------------------------------------------------- + +#include "sewhdcontrol.h" + +#if (CONTROL_BUS == COMM_CAN) +void InitSewHeadControl(SewHeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + memset(pCtrl, 0, sizeof(SewHeadControl)); + } +} + +void SendSewHeadCommand(SewHeadControl * pCtrl, SewHeadCommand * pCmd) +{ + if (pCtrl != NULL && pCmd != NULL) + { + memcpy(pCtrl->ctrlCmd.cancomm.data.buff, pCmd->buff, CAN_DATA_LEN); + pCtrl->cmdFlag = 1; + } +} + +void RequestSewHeadStatus(SewHeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refSta = 1; + } +} + + +void RequestSewHeadVersion(SewHeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refVer = 1; + } +} + +void RequestSewHeadNvPara(SewHeadControl * pCtrl) +{ + if (pCtrl != NULL) + { + pCtrl->refNvPara = 1; + } +} + +#endif + + + + + + + diff --git a/NxFuncs/controlbus/sewhdcontrol.h b/NxFuncs/controlbus/sewhdcontrol.h new file mode 100644 index 0000000..3f665fe --- /dev/null +++ b/NxFuncs/controlbus/sewhdcontrol.h @@ -0,0 +1,169 @@ + +//------------------------------------------------------------------------------- +// File Name: headcontrol.h +// Brief: +// Version: 1.0.0 +// Create Date: 2018/05/02 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2018/05/02 +//------------------------------------------------------------------------------- + + +#ifndef __SEWHDCONTROL_H__ +#define __SEWHDCONTROL_H__ + +#include "controlbus.h" + +#if (CONTROL_BUS == COMM_CAN) +/* + ͷư + +*/ + +//------------------------------------------------------------------------------- + +typedef struct +{ + u8 nodeTye; // ڵ + u8 nodeId; // ڵID + + CtrlBusPacket ctrlCmd; // ΧĿ + CtrlBusPacket exbSta; // Χ巵ص״̬ + CtrlBusPacket busSta; // Χ巵ص״̬ + CtrlBusPacket traCmd; // Χı + BoardRegVal regVal; // ΧĴֵ + CtrlBusPacket rdReg; // ȡΧĴֵ + + u8 cmdFlag; // ־ N5--յ + + u8 staFlag; // ״̬־ N5--BN_CMD_EXSTA + u8 refSta; // ˢ״̬־ N5--BN_CMD_EXSTA + + u8 traFlag; // ־ N5--յ + u8 busFlag; // ״̬־ N5--BN_CMD_BUSSTA + + u8 refVer; + u8 verFlag; + + u8 transFlag; // ݴ־ + u8 exbupdateFlag; // Χ־ + + u8 refNvPara; // ˢ·ʧԲ + u8 nvParaFlag; // յʧԲ־ + + u8 refHeadPara; // ˢ»ͷ + u8 headParaFlag; // ջͷ־ + +}SewHeadControl; + +//------------------------------------------------------------------------------- + +typedef union +{ + u8 buff[CAN_DATA_LEN]; + + struct + { + u16 cmd; + u8 subcmd; + u8 para[5]; + } __attribute__ ((packed)) headCtrl; // ͷ + + struct + { + u16 cmd; + u16 pataId; + s32 paraVal; // + } __attribute__ ((packed)) headPara; // ͷ + + struct + { + u16 cmd; // + u8 parablockID; // ID + u8 paraID; // ID + s32 paraval; // ֵ + } __attribute__ ((packed)) headNvPara; // ʧԲ + + struct + { + u32 staBits; // ״̬λ + u8 setedNP; // õĵǰλ + u16 potValue; // λֵ(ë) + s8 curHoistLevel; // ǰλ + } __attribute__ ((packed)) headSta; // ״̬ + + struct + { + u32 staBits; // ״̬λ + u8 setedNP; // õĵǰλ + s16 footmotopos; // ѹŵλ + u8 rev; + } __attribute__ ((packed)) footHeadSta; // ״̬(ѹ) + +}SewHeadCommand; + +//------------------------------------------------------------------------------- +//  + +#define CTRL_CMD_SEW_HEAD_CTRL 0x1000 // һͷ +#define CTRL_CMD_SEW_HEAD_PARA 0x1001 // һͷ +#define CTRL_CMD_SEW_HEAD_NVPARA 0x1002 // һͷʧԲ + +//------------------------------------------------------------------------------- +// ӿ + +#define CTRL_SUBCMD_SEW_WORK_STA 0x00 // ״̬ˢ +#define CTRL_SUBCMD_SEW_ENABLE 0x01 // ͷƹܴ +#define CTRL_SUBCMD_SEW_DISABLE 0x02 // ͷƹܹر +#define CTRL_SUBCMD_SEW_OUTPUT_CTRL 0x03 // IO +#define CTRL_SUBCMD_SEW_ELCLIP_CTRL 0x04 // Ӽ߿ +#define CTRL_SUBCMD_SEW_IN_WORK 0x05 // 빤״̬ + +#define CTRL_SUBCMD_SEW_PFOOT_CTRL 0x10 // ѹŵ +//------------------------------------------------------------------------------- + #define CTRL_PFOOT_CMD_TO_ZERO 0x00 // ѹŵ + #define CTRL_PFOOT_CMD_DIS 0x01 // ѹŵʧ + #define CTRL_PFOOT_CMD_EN 0x02 // ѹŵʹ + #define CTRL_PFOOT_CMD_RESET 0x03 // ѹŵ + #define CTRL_PFOOT_CMD_UP 0x04 // ѹŵ + #define CTRL_PFOOT_CMD_DOWN 0x05 // ѹŵ½ + #define CTRL_PFOOT_CMD_BACK 0x06 // ѹŵȥλ +//------------------------------------------------------------------------------- +#define CTRL_SUBCMD_SEW_PFOOT_FOLLOW_CTRL 0x11 // ѹŵ +#define CTRL_SUBCMD_SEW_PFOOT_SET_POS 0x12 // 趨ѹŹλ +#define CTRL_SUBCMD_SEW_PFOOT_SET_ECD 0x13 // Уλ + + +// ״̬λ + +#define HDSTA_SEW_HEAD_LOCK 0x00000001 // ͷ״̬־۰ťͷͷ + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + +void InitSewHeadControl(SewHeadControl * pCtrl); + +void SendSewHeadCommand(SewHeadControl * pCtrl, SewHeadCommand * pCmd); + +void RequestSewHeadStatus(SewHeadControl * pCtrl); + +void RequestSewHeadVersion(SewHeadControl * pCtrl); + +void RequestSewHeadNvPara(SewHeadControl * pCtrl); + +//------------------------------------------------------------------------------- + + + + +//------------------------------------------------------------------------------- + +#endif + +#endif diff --git a/NxFuncs/crc/crc16.c b/NxFuncs/crc/crc16.c new file mode 100644 index 0000000..10b999e --- /dev/null +++ b/NxFuncs/crc/crc16.c @@ -0,0 +1,127 @@ + +#include "crc16.h" + +//------------------------------------------------------------------------------- + +#ifdef USE_CRC_TABLE + +// 16 λ crc б +static const u16 CRC16_LIST[256] = +{ + 0x0000, 0x3096, 0x612C, 0x51BA, 0xC419, 0xF48F, 0xA535, 0x95A3, + 0x8832, 0xB8A4, 0xE91E, 0xD988, 0x4C2B, 0x7CBD, 0x2D07, 0x1D91, + 0x1064, 0x20F2, 0x7148, 0x41DE, 0xD47D, 0xE4EB, 0xB551, 0x85C7, + 0x9856, 0xA8C0, 0xF97A, 0xC9EC, 0x5C4F, 0x6CD9, 0x3D63, 0x0DF5, + 0x20C8, 0x105E, 0x41E4, 0x7172, 0xE4D1, 0xD447, 0x85FD, 0xB56B, + 0xA8FA, 0x986C, 0xC9D6, 0xF940, 0x6CE3, 0x5C75, 0x0DCF, 0x3D59, + 0x30AC, 0x003A, 0x5180, 0x6116, 0xF4B5, 0xC423, 0x9599, 0xA50F, + 0xB89E, 0x8808, 0xD9B2, 0xE924, 0x7C87, 0x4C11, 0x1DAB, 0x2D3D, + 0x4190, 0x7106, 0x20BC, 0x102A, 0x8589, 0xB51F, 0xE4A5, 0xD433, + 0xC9A2, 0xF934, 0xA88E, 0x9818, 0x0DBB, 0x3D2D, 0x6C97, 0x5C01, + 0x51F4, 0x6162, 0x30D8, 0x004E, 0x95ED, 0xA57B, 0xF4C1, 0xC457, + 0xD9C6, 0xE950, 0xB8EA, 0x887C, 0x1DDF, 0x2D49, 0x7CF3, 0x4C65, + 0x6158, 0x51CE, 0x0074, 0x30E2, 0xA541, 0x95D7, 0xC46D, 0xF4FB, + 0xE96A, 0xD9FC, 0x8846, 0xB8D0, 0x2D73, 0x1DE5, 0x4C5F, 0x7CC9, + 0x713C, 0x41AA, 0x1010, 0x2086, 0xB525, 0x85B3, 0xD409, 0xE49F, + 0xF90E, 0xC998, 0x9822, 0xA8B4, 0x3D17, 0x0D81, 0x5C3B, 0x6CAD, + 0x8320, 0xB3B6, 0xE20C, 0xD29A, 0x4739, 0x77AF, 0x2615, 0x1683, + 0x0B12, 0x3B84, 0x6A3E, 0x5AA8, 0xCF0B, 0xFF9D, 0xAE27, 0x9EB1, + 0x9344, 0xA3D2, 0xF268, 0xC2FE, 0x575D, 0x67CB, 0x3671, 0x06E7, + 0x1B76, 0x2BE0, 0x7A5A, 0x4ACC, 0xDF6F, 0xEFF9, 0xBE43, 0x8ED5, + 0xA3E8, 0x937E, 0xC2C4, 0xF252, 0x67F1, 0x5767, 0x06DD, 0x364B, + 0x2BDA, 0x1B4C, 0x4AF6, 0x7A60, 0xEFC3, 0xDF55, 0x8EEF, 0xBE79, + 0xB38C, 0x831A, 0xD2A0, 0xE236, 0x7795, 0x4703, 0x16B9, 0x262F, + 0x3BBE, 0x0B28, 0x5A92, 0x6A04, 0xFFA7, 0xCF31, 0x9E8B, 0xAE1D, + 0xC2B0, 0xF226, 0xA39C, 0x930A, 0x06A9, 0x363F, 0x6785, 0x5713, + 0x4A82, 0x7A14, 0x2BAE, 0x1B38, 0x8E9B, 0xBE0D, 0xEFB7, 0xDF21, + 0xD2D4, 0xE242, 0xB3F8, 0x836E, 0x16CD, 0x265B, 0x77E1, 0x4777, + 0x5AE6, 0x6A70, 0x3BCA, 0x0B5C, 0x9EFF, 0xAE69, 0xFFD3, 0xCF45, + 0xE278, 0xD2EE, 0x8354, 0xB3C2, 0x2661, 0x16F7, 0x474D, 0x77DB, + 0x6A4A, 0x5ADC, 0x0B66, 0x3BF0, 0xAE53, 0x9EC5, 0xCF7F, 0xFFE9, + 0xF21C, 0xC28A, 0x9330, 0xA3A6, 0x3605, 0x0693, 0x5729, 0x67BF, + 0x7A2E, 0x4AB8, 0x1B02, 0x2B94, 0xBE37, 0x8EA1, 0xDF1B, 0xEF8D, +}; + +#else + +#ifdef SHIFT_RIGHT // + +#define CRC_GEN 0xa001 // ʹöʽ 0xa001 + +#else // + +#define CRC_GEN 0x8005 // ʹöʽ 0x8005 + +#endif // #ifdef SHIFT_RIGHT + +#endif + +//------------------------------------------------------------------------------- + +u16 AddCrc16(u16 crcword, u8 dat) +{ +#ifdef USE_CRC_TABLE // crc + crcword = (crcword >> 8) ^ CRC16_LIST[((crcword ^ dat) & 0xFF)]; +#else + u8 i; + crcword ^= dat; + for (i = 0; i < 8; i++) + { +#ifdef SHIFT_RIGHT // Ƽcrc + if ((LOBYTE(crcword) & 0x01) != 0) + { + crcword >>= 1; + crcword ^= CRC_GEN; + } + else + { + crcword >>= 1; + } +#else // Ƽcrc + if ((HIBYTE(crcword) & 0x80) != 0) + { + crcword <<= 1; + crcword ^= CRC_GEN; + } + else + { + crcword <<= 1; + } +#endif + } + +#endif + return crcword; +} + +//------------------------------------------------------------------------------- + +u16 CalcCrc16(const u8 * pBuf, int lenBuf) +{ + int i; + u16 crcword = CRC_INIT; + + for (i = 0; i < lenBuf; i++) + { + crcword = AddCrc16(crcword, pBuf[i]); + } + + return crcword; +} + +//------------------------------------------------------------------------------- + +u32 CalcCheckSum(const u8 * pBuf, int lenBuf) +{ + int i; + u32 checksum = 0; + + for (i = 0; i < lenBuf; i++) + { + checksum += pBuf[i]; + } + + return checksum; +} + +//------------------------------------------------------------------------------- diff --git a/NxFuncs/crc/crc16.h b/NxFuncs/crc/crc16.h new file mode 100644 index 0000000..0651603 --- /dev/null +++ b/NxFuncs/crc/crc16.h @@ -0,0 +1,43 @@ + +#ifndef __CRC16_H__ +#define __CRC16_H__ + +/* + + CRC16 㷨ģ + + ṩλ CRC16 㷨 + +*/ + +#include "afxdef.h" + +#define USE_CRC_TABLE // òcrc, , λ +#define SHIFT_RIGHT // λ + +#ifdef USE_CRC_TABLE + +#define CRC_INIT 0x0000 // crcֵΪ0 + +#else + +#ifdef SHIFT_RIGHT // + +#define CRC_INIT 0xFFFF // crcֵΪ0xFFFF + +#else // + +#define CRC_INIT 0x0000 // crcֵΪ0 + +#endif // #ifdef SHIFT_RIGHT + +#endif + + +u16 CalcCrc16(const u8 * pBuf, int lenBuf); +u32 CalcCheckSum(const u8 * pBuf, int lenBuf); + + + +#endif + diff --git a/NxFuncs/crc/crc32.c b/NxFuncs/crc/crc32.c new file mode 100644 index 0000000..9dfda58 --- /dev/null +++ b/NxFuncs/crc/crc32.c @@ -0,0 +1,60 @@ + +#include "crc32.h" + +//------------------------------------------------------------------------------- + +static const u32 CRC32_LIST[256] = +{ + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, + 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, + 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, + 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, + 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, + 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, + 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, + 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, + 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, + 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, + 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, + 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L, + 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, + 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L, + 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, + 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, + 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, + 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, + 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, + 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, + 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, + 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, + 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, + 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL, + 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, + 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL, +}; + + +u32 AddCrc32(u32 crcword, u8 dat) +{ + return (crcword >> 8) ^ CRC32_LIST[((crcword ^ dat) & 0xFF)]; +} + +u32 CalcCrc32(u8 * pBuf, int lenBuf) +{ + int i; + u32 crcword = CRC32_INIT; + + for (i = 0; i < lenBuf; i++) + { + crcword = AddCrc32(crcword, pBuf[i]); + } + + return crcword; +} + diff --git a/NxFuncs/crc/crc32.h b/NxFuncs/crc/crc32.h new file mode 100644 index 0000000..e361d3b --- /dev/null +++ b/NxFuncs/crc/crc32.h @@ -0,0 +1,19 @@ + +#ifndef __CRC32_H__ +#define __CRC32_H__ + +/* + CRC32 㷨ģ +*/ + +#include "afxdef.h" + +#define CRC32_INIT 0xffffffff // crcֵ + + +u32 AddCrc32(u32 crcword, u8 dat); +u32 CalcCrc32(u8 * pBuf, int lenBuf); + + + +#endif diff --git a/NxFuncs/crc/crc8.c b/NxFuncs/crc/crc8.c new file mode 100644 index 0000000..9af8b3c --- /dev/null +++ b/NxFuncs/crc/crc8.c @@ -0,0 +1,49 @@ + +#include "crc8.h" + +#define CRC8_INIT 0x00 + + +// 8λcrcУ + +static const u8 CRC8_TABLE[256] = +{ + 0x00,0x07,0x0E,0x09,0x1C,0x1B,0x12,0x15,0x38,0x3F,0x36,0x31,0x24,0x23,0x2A,0x2D, + 0x70,0x77,0x7E,0x79,0x6C,0x6B,0x62,0x65,0x48,0x4F,0x46,0x41,0x54,0x53,0x5A,0x5D, + 0xE0,0xE7,0xEE,0xE9,0xFC,0xFB,0xF2,0xF5,0xD8,0xDF,0xD6,0xD1,0xC4,0xC3,0xCA,0xCD, + 0x90,0x97,0x9E,0x99,0x8C,0x8B,0x82,0x85,0xA8,0xAF,0xA6,0xA1,0xB4,0xB3,0xBA,0xBD, + 0xC7,0xC0,0xC9,0xCE,0xDB,0xDC,0xD5,0xD2,0xFF,0xF8,0xF1,0xF6,0xE3,0xE4,0xED,0xEA, + 0xB7,0xB0,0xB9,0xBE,0xAB,0xAC,0xA5,0xA2,0x8F,0x88,0x81,0x86,0x93,0x94,0x9D,0x9A, + 0x27,0x20,0x29,0x2E,0x3B,0x3C,0x35,0x32,0x1F,0x18,0x11,0x16,0x03,0x04,0x0D,0x0A, + 0x57,0x50,0x59,0x5E,0x4B,0x4C,0x45,0x42,0x6F,0x68,0x61,0x66,0x73,0x74,0x7D,0x7A, + 0x89,0x8E,0x87,0x80,0x95,0x92,0x9B,0x9C,0xB1,0xB6,0xBF,0xB8,0xAD,0xAA,0xA3,0xA4, + 0xF9,0xFE,0xF7,0xF0,0xE5,0xE2,0xEB,0xEC,0xC1,0xC6,0xCF,0xC8,0xDD,0xDA,0xD3,0xD4, + 0x69,0x6E,0x67,0x60,0x75,0x72,0x7B,0x7C,0x51,0x56,0x5F,0x58,0x4D,0x4A,0x43,0x44, + 0x19,0x1E,0x17,0x10,0x05,0x02,0x0B,0x0C,0x21,0x26,0x2F,0x28,0x3D,0x3A,0x33,0x34, + 0x4E,0x49,0x40,0x47,0x52,0x55,0x5C,0x5B,0x76,0x71,0x78,0x7F,0x6A,0x6D,0x64,0x63, + 0x3E,0x39,0x30,0x37,0x22,0x25,0x2C,0x2B,0x06,0x01,0x08,0x0F,0x1A,0x1D,0x14,0x13, + 0xAE,0xA9,0xA0,0xA7,0xB2,0xB5,0xBC,0xBB,0x96,0x91,0x98,0x9F,0x8A,0x8D,0x84,0x83, + 0xDE,0xD9,0xD0,0xD7,0xC2,0xC5,0xCC,0xCB,0xE6,0xE1,0xE8,0xEF,0xFA,0xFD,0xF4,0xF3, +}; + + +// : õһе8λcrcУ +// : pBuf, ҪμУָ +// len, pBufָݵĸ +// : 8λcrcУ + +u8 CalcCrc8(const u8 * pBuf, int lenBuf) +{ + u8 crcValue = CRC8_INIT; + + while(lenBuf != 0) + { + crcValue = CRC8_TABLE[*pBuf^crcValue]^0xFF; + pBuf++; + lenBuf--; + } + + return crcValue; +} + + diff --git a/NxFuncs/crc/crc8.h b/NxFuncs/crc/crc8.h new file mode 100644 index 0000000..b94bb79 --- /dev/null +++ b/NxFuncs/crc/crc8.h @@ -0,0 +1,20 @@ + +#ifndef __CRC8_H__ +#define __CRC8_H__ + +/* + + CRC8 㷨ģ + + ṩλ CRC8 㷨 + +*/ + +#include "afxdef.h" + + +u8 CalcCrc8(const u8 * pBuf, int lenBuf); + + +#endif + diff --git a/NxFuncs/encrychip/smec98sp.c b/NxFuncs/encrychip/smec98sp.c new file mode 100644 index 0000000..bfa07bf --- /dev/null +++ b/NxFuncs/encrychip/smec98sp.c @@ -0,0 +1,904 @@ + +//=========================== оƬ SMEC98SP ӿ ===========================// +#include "smec98sp.h" + +#ifdef SMEC_CHIP + +#include +#include "afxdef.h" +#include "stm32f4xx_ll_gpio.h" + +//SMEC98SP IICIOģIICЭ +#define IIC_NOACK TRUE +#define IIC_ACK FALSE +#define HIGHT TRUE +#define LOW FALSE + +#define IIC_DELAYTIME 24 //bitλʱ(ʵС22,ȶͨѶ) +#define ACKCHECKTIME 2000 //ȴACKʱʱ +#define IIC_START_TIMES 500 //ͣSTARTź+ַֽڣ Ĵ + +//=========================== SMEC98SPͨѶĹܽŶ ===========================// +#define IIC_SCL_Pin LL_GPIO_PIN_8 +#define IIC_SCL_GPIO_Port GPIOA +#define IIC_SCL_GPIO_Clock LL_AHB1_GRP1_PERIPH_GPIOA + +#define IIC_SDA_Pin LL_GPIO_PIN_9 +#define IIC_SDA_GPIO_Port GPIOC +#define IIC_SDA_GPIO_Clock LL_AHB1_GRP1_PERIPH_GPIOC + +//=========================== I2CͨѶ ===========================// +#if (1) + +int initedFlag = 0; // ʼ־ +#define IIC_ADDR 0x00 //ӦSMEC98SPеַ + +//--------------------------------------------------------- +//ܣģ˿ڻóʼ +//--------------------------------------------------------- +void SMEC_I2cInit(void) +{ + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + LL_GPIO_SetOutputPin(IIC_SCL_GPIO_Port, IIC_SCL_Pin); + LL_GPIO_SetOutputPin(IIC_SDA_GPIO_Port, IIC_SDA_Pin); + + GPIO_InitStruct.Pin = IIC_SCL_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(IIC_SCL_GPIO_Port, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = IIC_SDA_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(IIC_SDA_GPIO_Port, &GPIO_InitStruct); + + // GPIO_InitTypeDef GPIO_InitStructure; + // GPIO_InitStructure.GPIO_Pin = IIC_SDA_PIN; + // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//GPIO_Speed_2MHz; + // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; + // GPIO_Init(IIC_PORT, &GPIO_InitStructure); + + // GPIO_InitStructure.GPIO_Pin = IIC_SCL_PIN; + // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//GPIO_Speed_2MHz; + // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//GPIO_Mode_Out_OD;//GPIO_Mode_Out_PP; + // GPIO_Init(IIC_PORT, &GPIO_InitStructure); + + initedFlag = 0x5a5a; // ʼ־ +} + +//źΪģʽ +void SdaInputMode(void) +{ + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + GPIO_InitStruct.Pin = IIC_SDA_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(IIC_SDA_GPIO_Port, &GPIO_InitStruct); + + // GPIO_InitTypeDef GPIO_InitStructure; + // GPIO_InitStructure.GPIO_Pin = IIC_SDA_PIN; + // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//GPIO_Speed_2MHz; + // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; + // GPIO_Init(IIC_PORT, &GPIO_InitStructure); + +} + +//źΪģʽ +void SdaOutputMode(void) +{ + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + GPIO_InitStruct.Pin = IIC_SDA_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(IIC_SDA_GPIO_Port, &GPIO_InitStruct); + + // GPIO_InitTypeDef GPIO_InitStructure; + // GPIO_InitStructure.GPIO_Pin = IIC_SDA_PIN; + // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//GPIO_Speed_2MHz; + // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + // GPIO_Init(IIC_PORT, &GPIO_InitStructure); +} + +void IIC_Delay(unsigned int times) +{ + u16 loop; + for(loop=0;loop 124) || (bLen == 0)) + { + return 1; + } + + bBuf[0] = 0x02; + bBuf[1] = 0x00; + bBuf[2] = 0x00; + bBuf[3] = bLen ; + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, (bLen+2)); + } + + if (rst == 0) + { + for (i=0;i<(bLen+2);i++) + {// У + sum += bBuf[i]; + } + } + + if ((rst == 0) && + (bBuf[0] == 0x82) && // 0x82 ʾִȷ, ʾ + (sum == 0) && // У + 1 ) + { + memcpy(pRandom, bBuf + 2, bLen); + } + else + { + rst = 1; + } + + return rst; +} + +//--------------------------------------------------------- +//: Flash +//˵ +// pbData - ȡݴŵַ +// bLen - ȡݳ +//ֵ˵ +// 0 - ɹ +// 1 - ʧ +//˵: +//--------------------------------------------------------- +u8 SMEC_ReadFlash(u16 wAddr, u8 *pbData, u8 bLen) +{ + u8 i = 0; + u8 rst = 0; + u8 sum = 0; + u8 bBuf[128] = {0}; + + if ((pbData == NULL) || (bLen > 124) || (bLen == 0)) + { + return 1; + } + + bBuf[0] = 0x03; + bBuf[1] = (u8)(wAddr>>8); + bBuf[2] = (u8) wAddr; + bBuf[3] = bLen; //Ҫȡݳ + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, (bLen+2)); + } + + if (rst == 0) + { + for (i=0;i<(bLen+2);i++) + {// У + sum += bBuf[i]; + } + } + + if ((rst == 0) && + (bBuf[0] == 0x83) && // 0x83 ʾִȷ, ʾ + (sum == 0) && // У + 1 ) + { + memcpy(pbData, bBuf + 2, bLen); + } + else + { + rst = 1; + } + + return rst; +} + +//--------------------------------------------------------- +//: Flash +//˵ +// wAddr - ַ +//ֵ˵ +// 0 - ɹ +// 1 - ʧ +//˵: +//--------------------------------------------------------- +u8 SMEC_EraseFlash(u16 wAddr) +{ + u8 i = 0; + u8 rst = 0; + u8 sum = 0; + u8 bBuf[128] = {0}; + + + bBuf[0] = 0x04; + bBuf[1] = (u8)(wAddr>>8); + bBuf[2] = (u8) wAddr; + bBuf[3] = 0x00; + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, 2); + } + + if (rst == 0) + { + for (i=0;i<2;i++) + {// У + sum += bBuf[i]; + } + } + + if ((rst == 0) && + (bBuf[0] == 0x84) && // 0x84 ʾִȷ, ʾ + (sum == 0) && // У + 1 ) + { + } + else + { + rst = 1; + } + + return rst; +} + +//--------------------------------------------------------- +//: дFlash +//˵ +// pbData - дݴŵַ +// bLen - дݳ +//ֵ˵ +// 0 - ɹ +// 1 - ʧ +//˵: +//--------------------------------------------------------- +u8 SMEC_WriteFlash(u16 wAddr, u8 *pbData, u8 bLen) +{ + u8 i = 0; + u8 rst = 0; + u8 sum = 0; + u8 bBuf[128] = {0}; + + if ((pbData == NULL) || (bLen > 124) || (bLen == 0)) + { + return 1; + } + + bBuf[0] = 0x05; + bBuf[1] = (u8)(wAddr>>8); + bBuf[2] = (u8) wAddr; + bBuf[3] = bLen; //Ҫȡݳ + memcpy(&bBuf[4], pbData, bLen); + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, bLen + 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, 2); + } + + if (rst == 0) + { + for (i=0;i<2;i++) + {// У + sum += bBuf[i]; + } + } + + if ((rst == 0) && + (bBuf[0] == 0x85) && // 0x85 ʾִȷ, ʾ + (sum == 0) && // У + 1 ) + { + } + else + { + rst = 1; + } + + return rst; +} + + +//--------------------------------------------------------- +//: +//˵ +// key - (0~127) +// pbData - дݴŵַ +// bLen - дݳ +//ֵ˵ +// 0 - ɹ +// 1 - ʧ +//˵: +//--------------------------------------------------------- +u8 SMEC_EncryptionData(u8 key, u8 *pbData, u8 bLen) +{ + u8 i = 0; + u8 rst = 0; + u8 sum = 0; + u8 bBuf[128] = {0}; + + if ((pbData == NULL) || (key > 127) || (bLen >= 124) || (bLen == 0)) + { + return 1; + } + + bBuf[0] = 0x06; + bBuf[1] = 0x00; + bBuf[2] = key; + bBuf[3] = bLen; //Ҫȡݳ + memcpy(&bBuf[4], pbData, bLen); + + sum = 0; + for (i=0;i<(bLen+4);i++) + {// У + sum += bBuf[i]; + } + bBuf[1] = 0 - sum; + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, bLen + 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, (bLen+2)); + } + + if (rst == 0) + { + sum = 0; + for (i=0;i<(bLen+2);i++) + {// У + sum += bBuf[i]; + } + } + + if (rst == 0) + { + if (sum != 0) + { + rst |= 4; + } + else if (bBuf[0] != 0x86) + { + rst = bBuf[0]; + } + } + + if (rst == 0) + { + memcpy(pbData, bBuf + 2, bLen); + } + + return rst; +} + +//--------------------------------------------------------- +//: +//˵ +// key - (0~127) +// pbData - дݴŵַ +// bLen - дݳ +//ֵ˵ +// 0 - ɹ +// 1 - ʧ +//˵: +//--------------------------------------------------------- +u8 SMEC_DecryptionData(u8 key, u8 *pbData, u8 bLen) +{ + u8 i = 0; + u8 rst = 0; + u8 sum = 0; + u8 bBuf[128] = {0}; + + if ((pbData == NULL) || (key > 127) || (bLen >= 124) || (bLen == 0)) + { + return 1; + } + + bBuf[0] = 0x07; + bBuf[1] = 0x00; + bBuf[2] = key; + bBuf[3] = bLen; //Ҫȡݳ + memcpy(&bBuf[4], pbData, bLen); + + sum = 0; + for (i=0;i<(bLen+4);i++) + {// У + sum += bBuf[i]; + } + bBuf[1] = 0 - sum; + + rst = IIC_WriteWithAddr(IIC_ADDR & 0xFE, bBuf, bLen + 4); + + if (rst == 0) + { + rst = IIC_ReadWithAddr(IIC_ADDR | 0x1, bBuf, (bLen+2)); + } + + if (rst == 0) + { + sum = 0; + for (i=0;i<(bLen+2);i++) + {// У + sum += bBuf[i]; + } + } + + if (rst == 0) + { + if (sum != 0) + { + rst |= 4; + } + else if (bBuf[0] != 0x87) + { + rst = bBuf[0]; + } + } + + if (rst == 0) + { + memcpy(pbData, bBuf + 2, bLen); + } + + return rst; +} + +// оƬ֤ +int SMEC_Detection(void) +{ + int rslt = 0; + u8 dat1[12] = {0}; + u8 dat2[12] = {0}; + + rslt = SMEC_GetUid(dat1); + + if (rslt == 0) + { + rslt = SMEC_GetRandom(dat1,12); + } + + if (rslt == 0) + { + memcpy(dat2, dat1, 12); + rslt = SMEC_EncryptionData(0, dat2, 12); + } + + if (rslt == 0) + { + rslt = SMEC_DecryptionData(0, dat2, 12); + } + + if (rslt == 0) + { + for (int i=0;i<12;i++) + { + if (dat2[i] != dat1[i]) + { + rslt = 1; + } + } + } + return rslt; +} + +#endif + diff --git a/NxFuncs/encrychip/smec98sp.h b/NxFuncs/encrychip/smec98sp.h new file mode 100644 index 0000000..c5e998a --- /dev/null +++ b/NxFuncs/encrychip/smec98sp.h @@ -0,0 +1,20 @@ +#ifndef __SMEC98SP_H +#define __SMEC98SP_H + +#include "config.h" + +#ifdef SMEC_CHIP + +u16 SMEC_GetVer(void); +u8 SMEC_GetUid(u8 * pUID); +u8 SMEC_GetRandom(u8 *pRandom, u8 bLen); +u8 SMEC_ReadFlash(u16 wAddr, u8 *pbData, u8 bLen); +u8 SMEC_EraseFlash(u16 wAddr); +u8 SMEC_WriteFlash(u16 wAddr, u8 *pbData, u8 bLen); +u8 SMEC_EncryptionData(u8 key, u8 *pbData, u8 bLen); +u8 SMEC_DecryptionData(u8 key, u8 *pbData, u8 bLen); +int SMEC_Detection(void); + +#endif + +#endif diff --git a/NxFuncs/exio/exio.c b/NxFuncs/exio/exio.c new file mode 100644 index 0000000..807d112 --- /dev/null +++ b/NxFuncs/exio/exio.c @@ -0,0 +1,328 @@ + + +#include "exio.h" + +#if (SHIFT_REG_NUM > 0) + +#include "shell.h" +#include "delay.h" +#include "inout.h" +#include "trigger.h" + +#define OUT_TM_INFO 0 + +//------------------------------------------ +#ifndef ExDelay +#define ExDelay() DelayUs(1) +#endif + +//------------------------------------------ + +void ReadExInputs(u8 * inputList); +void WriteExOutputs(u8* outputList); +void ExioSwapData(void); + +void TestExInout(char * para1, char * para2); + +//------------------------------------------ + +#define MAX_EX_INPUTS_NUM (SHIFT_REG_NUM*IN_NUM_PER_REG) +#define MAX_EX_OUTPUTS_NUM (SHIFT_REG_NUM*OUT_NUM_PER_REG) + +u8 g_exInputStaList[MAX_EX_INPUTS_NUM]; +u8 g_exOutputStaList[MAX_EX_OUTPUTS_NUM]; + +//------------------------------------------ + +#ifndef SetOutputEnHigh +#define SetOutputEnHigh SetOutputNull +#endif + +#ifndef SetOutputEnLow +#define SetOutputEnLow SetOutputNull +#endif + +void InitExInOuts(void) +{ + memset(g_exInputStaList, 0, sizeof(u8)*MAX_EX_INPUTS_NUM); + memset(g_exOutputStaList, 0, sizeof(u8)*MAX_EX_INPUTS_NUM); + + SetOutputEnHigh(); + GetExInputSta(-1); // ȡź״̬ + SetExOutputOff(0); // źΪoff + SetOutputEnLow(); + +// AddShellCmd("TESTEX", "test Ex inout", TestExInout); +} + +// ȡź״̬ +void ReadExInputs(u8 * inputList) +{ + int i; + if (inputList == NULL) + { + return; + } + + SetClkHigh(); // Ϊߵƽ + SetInputLatchLow(); // 浽Ĵ + ExDelay(); + SetInputLatchHigh(); // + ExDelay(); // ȴȶ + + // ȡݣӵλʼ + for(i = 0; i < MAX_EX_INPUTS_NUM; i++) + { + ExDelay(); // ȴȶ + SetClkLow(); // ƽת + *inputList++ = GetDinStatus(); // ȡ + ExDelay(); + SetClkHigh(); // ݿʼλ + } +} + +// +void WriteExOutputs(u8* outputList) +{ + int i; + + if (outputList == NULL) + { + return; + } + + SetClkLow(); + SetOutputLatchLow(); + ExDelay(); + + // ݣӸλʼ + for(i = MAX_EX_OUTPUTS_NUM; i > 0; i--) + { + if ((outputList[i-1]) != 0) + { + SetDOutLow(); + } + else + { + SetDOutHigh(); + } + ExDelay(); // ȴȶ + SetClkHigh(); // λ + ExDelay(); // ȴȶ + SetClkLow(); // תΪ͵ƽ + } + + SetOutputLatchHigh(); // أλĴĴ + ExDelay(); + SetOutputLatchLow(); // תΪ͵ƽ +} + +// +void ExioSwapData(void) +{ + int i, j; + SetClkLow(); // Ϊ͵ƽ + SetOutputLatchLow(); // Ϊ͵ƽ + SetInputLatchLow(); // 浽Ĵ + ExDelay(); + SetInputLatchHigh(); // + ExDelay(); // ȴȶ + + for(i = MAX_EX_OUTPUTS_NUM, j = 0; i > 0; i--, j++) + { + // + if ((g_exInputStaList[i-1]) != 0) + { + SetDOutLow(); + } + else + { + SetDOutHigh(); + } + ExDelay(); // ȴȶ + SetClkHigh(); // ݿʼλ + ExDelay(); + g_exInputStaList[j] = GetDinStatus(); // ȡ + SetClkLow(); // תΪ͵ƽ + } + + SetOutputLatchHigh(); // أλĴĴ + ExDelay(); + SetOutputLatchLow(); // תΪ͵ƽ +} + +#ifndef RD_EXIN_GAP +#define RD_EXIN_GAP 0 // λms +#endif + +u8 GetExInputSta(int id) +{ +#if (OUT_TM_INFO == 1) + u32 temp, timer; + timer = GetUsSoftTimer(); +#endif +#if (RD_EXIN_GAP > 0) + static u32 oldtimer = 0; + u32 newtimer = GetMsSoftTimer(); + if (newtimer - oldtimer > RD_EXIN_GAP) + { + oldtimer = newtimer; + ReadExInputs(g_exInputStaList); + } +#else + ReadExInputs(g_exInputStaList); +#endif +#if (OUT_TM_INFO == 1) + temp = GetUsSoftTimer(); + printf("GetExInputSta time=%d\r\n", temp-timer); +#endif + if (id > 0 && id <= MAX_EX_INPUTS_NUM) + { + return g_exInputStaList[id-1]; + } + + return 0xff; +} + +u8 GetExOutputSta(int id) +{ + if (id > 0 && id <= MAX_EX_OUTPUTS_NUM) + { + return g_exOutputStaList[id-1]; + } + return 0xff; +} + +void SetExOutputOn(int id) +{ +#if (OUT_TM_INFO == 1) + u32 temp, timer; + timer = GetUsSoftTimer(); +#endif + if (id > 0 && id <= MAX_EX_OUTPUTS_NUM) + { + g_exOutputStaList[id-1] = 1; + } + else if (id == 0) + { + memset(g_exOutputStaList, 1, sizeof(u8)*MAX_EX_INPUTS_NUM); // ȫ + } + + WriteExOutputs(g_exOutputStaList); +#if (OUT_TM_INFO == 1) + temp = GetUsSoftTimer(); + printf("GetExInputSta time=%d\r\n", temp-timer); +#endif +} + +void SetExOutputOff(int id) +{ +#if (OUT_TM_INFO == 1) + u32 temp, timer; + timer = GetUsSoftTimer(); +#endif + if (id > 0 && id <= MAX_EX_OUTPUTS_NUM) + { + g_exOutputStaList[id-1] = 0; + } + else if (id == 0) + { + memset(g_exOutputStaList, 0, sizeof(u8)*MAX_EX_INPUTS_NUM); // ȫر + } + WriteExOutputs(g_exOutputStaList); +#if (OUT_TM_INFO == 1) + temp = GetUsSoftTimer(); + printf("GetExInputSta time=%d\r\n", temp-timer); +#endif +} + +void TestExInout(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (para1 != NULL && strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (para2 != NULL && strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + //-------------------------------- + + if (p1 < 100) + {// ʾ״̬ + s8 oldinput[MAX_EX_INPUTS_NUM] = {-1}; + do + { + GetExInputSta(-1); + + for (int i = 0; i < MAX_EX_INPUTS_NUM; i++) + { + if (oldinput[i] != g_exInputStaList[i]) + { + oldinput[i] = g_exInputStaList[i]; + if (oldinput[i] == 0) + { + printf("%d.input is on\r\n", i+1); + } + else + { + printf("%d.input is off\r\n", i+1); + } + } + } + + if (IsConsoleCancel() != 0 || p1 == 0) // նֹͣ + { + break; + } + + DelayMs(50); + + }while(1); + } + else + {// + p1 -= 100; + if (p1 == 0) + {// ʾ״̬ + for (int i = 0; i < MAX_EX_OUTPUTS_NUM; i++) + { + if (g_exOutputStaList[i] == 1) + { + printf("%d.output is on\r\n", i+1); + } + else + { + printf("%d.output is off\r\n", i+1); + } + } + } + else + {// ״̬ + if (p2 == 0) + {// off + if (p1 > 0 && p1 <= MAX_EX_OUTPUTS_NUM) + { + g_exOutputStaList[p1-1] = 0; + WriteExOutputs(g_exOutputStaList); + } + } + else + {// on + if (p1 > 0 && p1 <= MAX_EX_OUTPUTS_NUM) + { + g_exOutputStaList[p1-1] = 1; + WriteExOutputs(g_exOutputStaList); + } + } + } + } +} + +#endif diff --git a/NxFuncs/exio/exio.h b/NxFuncs/exio/exio.h new file mode 100644 index 0000000..d89a03b --- /dev/null +++ b/NxFuncs/exio/exio.h @@ -0,0 +1,39 @@ + + +#ifndef __EXIO_H__ +#define __EXIO_H__ + +#include "config.h" + +// λĴչIO + +#ifndef SHIFT_REG_NUM +#define SHIFT_REG_NUM 0 // λĴ,Ĭʹ8λλĴ +#endif + +#if (SHIFT_REG_NUM < 0) +#undef SHIFT_REG_NUM +#define SHIFT_REG_NUM 0 +#endif + +#if (SHIFT_REG_NUM > 32) +#undef SHIFT_REG_NUM +#define SHIFT_REG_NUM 32 +#endif + +#define IN_NUM_PER_REG 8 // ÿλĴ +#define OUT_NUM_PER_REG 8 // ÿλĴ + + + +void InitExInOuts(void); + +u8 GetExInputSta(int id); + +u8 GetExOutputSta(int id); + +void SetExOutputOn(int id); +void SetExOutputOff(int id); + +#endif + diff --git a/NxFuncs/fmc/corefmc.c b/NxFuncs/fmc/corefmc.c new file mode 100644 index 0000000..61a1235 --- /dev/null +++ b/NxFuncs/fmc/corefmc.c @@ -0,0 +1,150 @@ + +#include "corefmc.h" +#include "fmc.h" +#include "delay.h" + +//---------------------------------------------------------------------------- + +void InitSDRAM(void); + +//---------------------------------------------------------------------------- + +void InitCoreFmc(void) +{ + InitSDRAM(); +} + +//---------------------------------------------------------------------------- + +#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000) +#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001) +#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002) +#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004) +#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000) +#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008) +#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020) +#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030) +#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000) +#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000) +#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200) + +//---------------------------------------------------------------------------- + +uint8_t SDRAM_SendCommand1(uint32_t CommandMode, uint32_t Bank, uint32_t RefreshNum, uint32_t RegVal) +{ + uint32_t CommandTarget; + FMC_SDRAM_CommandTypeDef Command; + + if(Bank == 1) + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; + else if(Bank == 2) + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; + else + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1_2; + + Command.CommandMode = CommandMode; + Command.CommandTarget = CommandTarget; + Command.AutoRefreshNumber = RefreshNum; + Command.ModeRegisterDefinition = RegVal; + if (HAL_SDRAM_SendCommand(&hsdram1, &Command, 0x1000) == HAL_OK) + { + return 1; + } + return 0; +} + +uint8_t SDRAM_SendCommand2(uint32_t CommandMode, uint32_t Bank, uint32_t RefreshNum, uint32_t RegVal) +{ + uint32_t CommandTarget; + FMC_SDRAM_CommandTypeDef Command; + + if(Bank == 1) + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; + else if(Bank == 2) + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; + else + CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1_2; + + Command.CommandMode = CommandMode; + Command.CommandTarget = CommandTarget; + Command.AutoRefreshNumber = RefreshNum; + Command.ModeRegisterDefinition = RegVal; + if (HAL_SDRAM_SendCommand(&hsdram2, &Command, 0x1000) == HAL_OK) + { + return 1; + } + return 0; +} + +void InitSDRAM(void) +{ + uint32_t temp; + + // sdram1 + SDRAM_SendCommand1(FMC_SDRAM_CMD_CLK_ENABLE, 1, 1, 0); //3ʹʱźţSDCKE0 = 1 + DelayUs(500); //4ʱ200us + SDRAM_SendCommand1(FMC_SDRAM_CMD_PALL, 1, 1, 0); //5ȫԤ + SDRAM_SendCommand1(FMC_SDRAM_CMD_AUTOREFRESH_MODE, 1, 8, 0); //6Զˢ´ + + temp = SDRAM_MODEREG_BURST_LENGTH_1 | //ͻȣ1 + SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL | //ͻͣ + SDRAM_MODEREG_CAS_LATENCY_3 | //CASֵ3 + SDRAM_MODEREG_OPERATING_MODE_STANDARD | //òģʽ׼ + SDRAM_MODEREG_WRITEBURST_MODE_SINGLE; //ͻдģʽ + + SDRAM_SendCommand1(FMC_SDRAM_CMD_LOAD_MODE, 1, 1, temp); //7װģʽĴֵ + + // SDRAMˢ64ms8192УʱƵ180MHz/2=90MHz + // COUNT = (64ms/8192)/(1/90us)-20 = 64000*90/8192-20 = 683 + HAL_SDRAM_ProgramRefreshRate(&hsdram1, 683); //8ˢ + + // sdram2 + SDRAM_SendCommand2(FMC_SDRAM_CMD_CLK_ENABLE, 2, 1, 0); //3ʹʱźţSDCKE0 = 1 + DelayUs(500); //4ʱ200us + SDRAM_SendCommand2(FMC_SDRAM_CMD_PALL, 2, 1, 0); //5ȫԤ + SDRAM_SendCommand2(FMC_SDRAM_CMD_AUTOREFRESH_MODE, 2, 8, 0); //6Զˢ´ + + temp = SDRAM_MODEREG_BURST_LENGTH_1 | //ͻȣ1 + SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL | //ͻͣ + SDRAM_MODEREG_CAS_LATENCY_3 | //CASֵ3 + SDRAM_MODEREG_OPERATING_MODE_STANDARD | //òģʽ׼ + SDRAM_MODEREG_WRITEBURST_MODE_SINGLE; //ͻдģʽ + + SDRAM_SendCommand2(FMC_SDRAM_CMD_LOAD_MODE, 2, 1, temp); //7װģʽĴֵ + + HAL_SDRAM_ProgramRefreshRate(&hsdram2, 683); //8ˢ +} + +//---------------------------------------------------------------------------- + + +// д +void FmcWriteReg(u32 wAddr, u16 data) +{ + *((u16*)(wAddr)) = data; +} + +// ȡ +u16 FmcReadReg(u32 rAddr) +{ + return (*((vu16 *)(rAddr))); +} + +void FmcWriteConstBuf(u32 wAddr, u16* pBuffer, u32 num) +{ +// printf("FmcWriteConstBuf, addr=0x%x, len=%d\r\n", wAddr, num); + while(num != 0) + { + *((u16*)(wAddr)) = *pBuffer++; + num--; + } +} + +void FmcReadConstBuf(u32 rAddr, u16* pBuffer, u32 num) +{ + while(num != 0) + { + *pBuffer++ = *((vu16*)(rAddr)); + num--; + } +} diff --git a/NxFuncs/fmc/corefmc.h b/NxFuncs/fmc/corefmc.h new file mode 100644 index 0000000..b48f7b0 --- /dev/null +++ b/NxFuncs/fmc/corefmc.h @@ -0,0 +1,52 @@ + +#ifndef __COREFMC_H__ +#define __COREFMC_H__ + +//--------------------------------------------------------------------------------- + +#include "config.h" + +//--------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------- + +// FMC Ϲҽ SDAM, FPGA, Լ + +// BANK1 ַ +#define Bank1_SRAM1_ADDR ((u32)0x60000000) // NE1 FPGA +#define Bank1_SRAM2_ADDR ((u32)0x64000000) // NE2 +#define Bank1_SRAM3_ADDR ((u32)0x68000000) // NE3 +#define Bank1_SRAM4_ADDR ((u32)0x6C000000) // NE4 + +#define CORE_FPGA_ADDR_BEG Bank1_SRAM1_ADDR +#define CORE_FPGA_BANK FSMC_Bank1_NORSRAM1 + + +// SDRAM BANK +#define SDRAM_BANK1_ADDR ((u32)0xC0000000UL) +#define SDRAM_BANK2_ADDR ((u32)0xD0000000UL) + +#define CORE_SDRAM1_ADDR_BEG SDRAM_BANK1_ADDR +#define CORE_SDRAM2_ADDR_BEG SDRAM_BANK2_ADDR + +#define CORE_SDRAM1_SIZE (4*1024*1024*4*16/8) // ֽ 32M ֽ +#define CORE_SDRAM2_SIZE (4*1024*1024*4*16/8) // ֽ 32M ֽ + +//--------------------------------------------------------------------------------- + +// ʼFMC +void InitCoreFmc(void); + +// д +void FmcWriteReg(u32 wAddr, u16 data); + +// ȡ +u16 FmcReadReg(u32 rAddr); + +// дݵ̶ַ +void FmcWriteConstBuf(u32 wAddr, u16* pBuffer, u32 num); + +// ӹ̶ַ +void FmcReadConstBuf(u32 rAddr, u16* pBuffer, u32 num); + +#endif diff --git a/NxFuncs/fram/fram.c b/NxFuncs/fram/fram.c new file mode 100644 index 0000000..27fe21a --- /dev/null +++ b/NxFuncs/fram/fram.c @@ -0,0 +1,74 @@ + +#include "fram.h" +#include "inout.h" + +//------------------------------------------------------------------------------- +// д + + +//---------------------------------------- +// + +#define FRAM_CMD_WREN 0x06 // д +#define FRAM_CMD_WRDI 0x04 // д +#define FRAM_CMD_RDSR 0x05 // ״̬Ĵ +#define FRAM_CMD_WRSR 0x01 // д״̬Ĵ +#define FRAM_CMD_READ 0x03 // +#define FRAM_CMD_WRITE 0x02 // д + + +//------------------------------------------------------------------------------------------ +// ʼ Fram +void InitFram(void) +{ + InitFramSpi(); +} + +//------------------------------------------------------------------------------------------ +// +int ReadFramData(u16 addr, u8 * pBuf, u16 len) +{ + int i; + if (len != 0 && pBuf != NULL) + { + FramNceOn(); + FramWriteByte(FRAM_CMD_READ); // + FramWriteByte(HIBYTE(addr)); + FramWriteByte(LOBYTE(addr)); + for (i = 0; i < len; i++) + { + *pBuf++ = FramReadByte(); + } + FramNceOff(); + + return len; + } + + return 0; +} + +//------------------------------------------------------------------------------------------ +// д +int WriteFramData(u16 addr, u8 * pBuf, u16 len) +{ + int i; + + if (len != 0 && pBuf != NULL) + { + FramNceOn(); + FramWriteByte(FRAM_CMD_WREN); // д + FramNceOff(); + + FramNceOn(); + FramWriteByte(FRAM_CMD_WRITE); // д + FramWriteByte(HIBYTE(addr)); + FramWriteByte(LOBYTE(addr)); + for (i = 0; i < len; i++) + { + FramWriteByte(*pBuf++); + } + FramNceOff(); + return len; + } + return 0; +} diff --git a/NxFuncs/fram/fram.h b/NxFuncs/fram/fram.h new file mode 100644 index 0000000..fa7fe0a --- /dev/null +++ b/NxFuncs/fram/fram.h @@ -0,0 +1,23 @@ + +#ifndef __FRAM_H__ +#define __FRAM_H__ + +#include "config.h" + +//---------------------------------------------------------------------------------------------- + +// FRAM + +// 8Kֽ + + +//---------------------------------------------------------------------------------------------- + +void InitFram(void); // ʼ Fram +int ReadFramData(u16 addr, u8 * pBuf, u16 len); // +int WriteFramData(u16 addr, u8 * pBuf, u16 len); // д + +//---------------------------------------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/keyled/digitaltube.c b/NxFuncs/keyled/digitaltube.c new file mode 100644 index 0000000..33e9ffa --- /dev/null +++ b/NxFuncs/keyled/digitaltube.c @@ -0,0 +1,276 @@ + + +#include "digitaltube.h" +#include "shell.h" +#include "string.h" + +//------------------------------------------------------------- + +/* + a + ********* + * * + f* *b + * g * + ********* + * * + e* *c + * d * **p + ********* ** +*/ + +// ܵĶζ +#define LED_A 0x01 +#define LED_B 0x02 +#define LED_C 0x04 +#define LED_D 0x08 +#define LED_E 0x10 +#define LED_F 0x20 +#define LED_G 0x40 +#define LED_P 0x80 + +//------------------------------------------------------------- + +// ʾַ + +// +static const u8 g_ledNumList[10] = +{ + (LED_A|LED_B|LED_C|LED_D|LED_E|LED_F| 0) , // '0', + (LED_B|LED_C) , // '1', + (LED_A|LED_B|LED_D|LED_E|LED_G) , // '2', + (LED_A|LED_B|LED_C|LED_D|LED_G) , // '3', + (LED_B|LED_C|LED_F|LED_G) , // '4', + (LED_A|LED_C|LED_D|LED_F|LED_G) , // '5', + (LED_A|LED_C|LED_D|LED_E|LED_F|LED_G) , // '6', + (LED_A|LED_B|LED_C) , // '7', + (LED_A|LED_B|LED_C|LED_D|LED_E|LED_F|LED_G) , // '8', + (LED_A|LED_B|LED_C|LED_D|LED_F|LED_G) , // '9', +}; + +// ĸ +static const u8 g_ledCharList[26] = +{ + (LED_A|LED_B|LED_C|LED_E|LED_F|LED_G) , // 'A', + (LED_C|LED_D|LED_E|LED_F|LED_G) , // 'B', + (LED_A|LED_D|LED_E|LED_F) , // 'C', + (LED_B|LED_C|LED_D|LED_E|LED_G) , // 'D', + (LED_A|LED_D|LED_E|LED_F|LED_G) , // 'E', + (LED_A|LED_E|LED_F|LED_G) , // 'F', + (LED_A|LED_C|LED_D|LED_E|LED_F) , // 'G', + (LED_B|LED_C|LED_E|LED_F|LED_G) , // 'H', + (LED_E) , // 'I', + (LED_B|LED_C|LED_D|LED_E) , // 'J', + (LED_B|LED_D|LED_E|LED_F|LED_G) , // 'K', + (LED_D|LED_E|LED_F) , // 'L', + (LED_A|LED_C|LED_E|LED_G) , // 'M', + (LED_C|LED_E|LED_G) , // 'N', + (LED_C|LED_D|LED_E|LED_G) , // 'O', + (LED_A|LED_B|LED_E|LED_F|LED_G) , // 'P', + (LED_A|LED_B|LED_C|LED_F|LED_G) , // 'Q', + (LED_E|LED_G) , // 'R', + (LED_A|LED_C|LED_F|LED_G) , // 'S', + (LED_D|LED_E|LED_F|LED_G) , // 'T', + (LED_B|LED_C|LED_D|LED_E|LED_F) , // 'U', + (LED_B|LED_C|LED_D|LED_E|LED_F|LED_G) , // 'V', + (LED_A|LED_C|LED_D|LED_E) , // 'W', + (LED_B|LED_D|LED_F|LED_G) , // 'X', + (LED_B|LED_C|LED_D|LED_F|LED_G) , // 'Y', + (LED_A|LED_D|LED_G) , // 'Z', +}; + +typedef struct +{ + u8 ch; + u8 code; +}SignMap; + +#define SIGN_NUM 5 +// Ŷ +static const SignMap g_ledSignList[SIGN_NUM] = +{ + {'\0', (0)}, // ַ + {' ', (0)}, // ո + {'`', (0)}, // ʾΪ + {'-', (LED_G)}, // ţܣ + {'_', (LED_D)}, // » +}; + +// õLEDʾֵ +u8 GetLedValue(u8 ch) +{ + u8 code = 0; + if (ch >= '0' && ch <= '9') // + { + code = g_ledNumList[ch-'0']; + } + else if (ch >= 'a' && ch <= 'z') // Сдĸ + { + code = g_ledCharList[ch-'a']; + } + else if (ch >= 'A' && ch <= 'Z') // дĸ + { + code = g_ledCharList[ch-'A']; + } + else + { + int i; + for (i = 0; i < SIGN_NUM; i++) + { + if (g_ledSignList[i].ch == ch) + { + code = g_ledSignList[i].code; + break; + } + } + } + + return (code & 0x7F); +} + +// ӵϢ +u8 AddDota(u8 ch) +{ + return ch |= LED_P; +} + +//------------------------------------------------------------- + +typedef struct +{ + u8 ledvalue[LED_NUM]; // ʾֵ + u8 dotvalue[LED_NUM]; // ʾ + u8 dispBuf[LED_NUM]; // ʾֵ + u8 displev; // ʾ +}LedCtrl; + +LedCtrl g_ledctrl; + +void TestLeds(char * para1, char * para2); +void MakeLedsDisp(void); + +void InitDigialtubes(void) +{ + memset(&g_ledctrl, 0, sizeof(LedCtrl)); + g_ledctrl.displev = DISP_LEV(3)|DISP_ON; + + TM1637SetLedDisp(0); + + MakeLedsDisp(); + TM1637WriteLedData(LED_REG_BEG_ADDR, g_ledctrl.dispBuf, g_ledctrl.displev); + + TM1637SetLedDisp(5); + + //AddShellCmd("LED", "test leds", TestLeds); +} + +void MakeLedsDisp(void) +{ + int i; + u8 disp; + for (i = 0; i < LED_NUM; i++) + { + disp = GetLedValue(g_ledctrl.ledvalue[i]); + if (g_ledctrl.dotvalue[i] == '.') + { + disp = AddDota(disp); + } + g_ledctrl.dispBuf[i] = disp; + } +} + +void DisplayOnDig(char * strBuf, char * dotBuf) +{ + int len; + memset(g_ledctrl.ledvalue, 0, LED_NUM); + memset(g_ledctrl.dotvalue, 0, LED_NUM); + + if (strBuf != NULL) + { + len = strlen(strBuf); + if (len > LED_NUM) + { + len = LED_NUM; + } + memcpy(g_ledctrl.ledvalue, strBuf, len); + } + + if (dotBuf != NULL) + { + len = strlen(dotBuf); + if (len > LED_NUM) + { + len = LED_NUM; + } + memcpy(g_ledctrl.dotvalue, dotBuf, len); + } + + MakeLedsDisp(); + TM1637WriteLedData(LED_REG_BEG_ADDR, g_ledctrl.dispBuf, g_ledctrl.displev); +} + +//------------------------------------------------------------- +// Թ + +void TestLeds(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + } + + if (p1 == p2) + { + } + + //-------------------------------- + + { + if (p1 == 0) + { + if (p2 == 100) + { + memset(&g_ledctrl, 0, sizeof(LedCtrl)); + g_ledctrl.displev = DISP_LEV(3)|DISP_ON; + } + } + else if (p1 > 0 && p1 <= 5) + { + g_ledctrl.ledvalue[p1-1] = p2; + } + else if (p1 > 10 && p1 <= 15) + { + g_ledctrl.dotvalue[p1-11] = p2; + } + else if (p1 == 100) + { + memset(g_ledctrl.ledvalue, 0, LED_NUM); + memcpy(g_ledctrl.ledvalue, para2, LED_NUM); + } + + MakeLedsDisp(); + TM1637WriteLedData(LED_REG_BEG_ADDR, g_ledctrl.dispBuf, g_ledctrl.displev); + } + +} + +//------------------------------------------------------------- + + + + diff --git a/NxFuncs/keyled/digitaltube.h b/NxFuncs/keyled/digitaltube.h new file mode 100644 index 0000000..3c0b709 --- /dev/null +++ b/NxFuncs/keyled/digitaltube.h @@ -0,0 +1,19 @@ + +#ifndef __DIGITALTUBE_H__ +#define __DIGITALTUBE_H__ + +#include "tm1637.h" + +// ֧6 + +#define LED_NUM 6 + +// ʼ +void InitDigialtubes(void); + +void DisplayOnDig(char * strBuf, char * dotBuf); + + + + +#endif // __DIGITALTUBE_H__ diff --git a/NxFuncs/keyled/tm1637.c b/NxFuncs/keyled/tm1637.c new file mode 100644 index 0000000..6c00897 --- /dev/null +++ b/NxFuncs/keyled/tm1637.c @@ -0,0 +1,254 @@ + + + +#include "tm1637.h" + +#if (LEDKEY_TM1637 != 0) + +#include "delay.h" +#include "inout.h" + +//------------------------------------------------------------------------------ + +// ģI2C + +#define SetTM1637CLKLow SetI2cSCLOn +#define SetTM1637CLKHigh SetI2cSCLOff + +#define SetTM1637DIOLow SetI2cSDAOn +#define SetTM1637DIOHigh SetI2cSDAOff + +#define SetTM1637DIOIn SetI2cSDAIn +#define SetTM1637DIOOut SetI2cSDAOut + +#define GetTM1637DIOStatus GetI2cSDAInputStatus + +#ifndef TM1637Delay +#define TM1637Delay(dl) DelayUs(dl) +#endif + +//--------------------------------------- + +// ʼλ +// CLK ΪߵƽʱDIOɸ߱ +void SetI2CStart(void) +{ + SetTM1637DIOOut(); + SetTM1637CLKHigh(); + SetTM1637DIOHigh(); + TM1637Delay(2); + SetTM1637DIOLow(); + TM1637Delay(2); +} + +// ֹͣλ +// CLK ΪߵƽʱDIOɵͱ +void SetI2CStop(void) +{ + SetTM1637DIOOut(); + SetTM1637CLKLow(); + TM1637Delay(2); + SetTM1637DIOLow(); + TM1637Delay(2); + SetTM1637CLKHigh(); + TM1637Delay(2); + SetTM1637DIOHigh(); + TM1637Delay(2); +} + +// ȴӦλ +// ȷʱ, ڵڰ˸ʱ½, оƬڲһACKź, DIOܽ, ڵھŸʱӽ֮ͷDIOߡ +// ֵ0Ӧɹ +// -1Ӧʧ + +int WaitI2CAck(void) +{ + int timout; + + SetTM1637CLKLow(); // ھŸ½ + + SetTM1637DIOIn(); // Ϊ + + TM1637Delay(5); // ڵڰ˸ʱ½֮ʱ 5us, ʼж ACK ź + + // ȴ ACK + timout = 100; + do + { + if (GetTM1637DIOStatus() == 0) // ACK ͵ƽ + { + break; + } + timout--; + TM1637Delay(1); + }while (timout > 0); + +#if (1) // ʱ + if (timout <= 0) + { + SetI2CStop(); + printf("I2C No reply\r\n"); + return -1; + } +#endif + + SetTM1637CLKHigh(); // õ9CLKΪߵƽ, ACK״̬ + TM1637Delay(2); + + SetTM1637CLKLow(); // Ϊ͵ƽ, + + return 0; +} + +// дһֽ +// CLKĵ͵ƽʱܣCLKĸߵƽ䣨ܱ仯 +// ÿһֽ, оƬڲڵڰ˸ʱ½زһACK +void WriteI2CByte(u8 dat) +{ + int i; + SetTM1637DIOOut(); + for (i = 0; i < 8; i++) + { + SetTM1637CLKLow(); // Ϊ͵ƽ, ׼ + if ((dat & 0x01) != 0) // TM1637 λǰ, ͱ׼I2Cͬ + { + SetTM1637DIOHigh(); + } + else + { + SetTM1637DIOLow(); + } + + TM1637Delay(3); + dat >>= 1; + SetTM1637CLKHigh(); // Ϊߵƽ, + TM1637Delay(3); + } +} + +// ϶һֽ +u8 ReadI2CByte(void) +{ + int i; + u8 dat = 0; + SetTM1637DIOIn(); // Ϊ״̬ + + for (i = 0; i < 8; i++) + { + SetTM1637CLKLow(); // Ϊ͵ƽ, ׼ + dat >>= 1; + TM1637Delay(3); // 4 + SetTM1637CLKHigh(); // Ϊߵƽ, ȡ + + if ((GetTM1637DIOStatus()) != 0) // TM1637 λǰ, ͱ׼I2Cͬ + { + dat |= 0x80; + } + TM1637Delay(3); // 4 + } + return dat; +} + +//--------------------------------------------------------- +// ȡϢ +// ʱʱƵӦС 250Kȶλλ +// S0S1S2K1K2 ΪϢ +u8 TM1637ReadKey(void) +{ + u8 keyval; + + // command + SetI2CStart(); // ʼλ + WriteI2CByte(DATA_CMD_BITS|READ_KEY_VAL); // + WaitI2CAck(); // ȴӦ + + // ݶȡ + keyval = ReadI2CByte(); // ȡ + + WaitI2CAck(); // ȴӦ + SetI2CStop(); // + + switch (keyval) + { + case KEY_K1SG1: + case KEY_K1SG2: + case KEY_K1SG3: + case KEY_K1SG4: + case KEY_K1SG5: + case KEY_K1SG6: + case KEY_K1SG7: + case KEY_K1SG8: + + case KEY_K2SG1: + case KEY_K2SG2: + case KEY_K2SG3: + case KEY_K2SG4: + case KEY_K2SG5: + case KEY_K2SG6: + case KEY_K2SG7: + case KEY_K2SG8: + break; + default: + keyval = KEY_NONE; + } + return keyval; +} + +// дʾĴ(ַ) +void TM1637WriteLedData(u8 baddr, u8 * pBuff, u8 disp) +{ + if (baddr < LED_REG1_ADDR || baddr > LED_REG6_ADDR || pBuff == NULL) + { + return; + } + +// printf("TM1637WriteLedData begin\r\n"); + + // command1 + // printf("command1\r\n"); + + SetI2CStart(); // ʼλ + WriteI2CByte(DATA_CMD_BITS|WRITE_LED_REG|ADDR_AUTO_INC); // дݵʾĴ, ַԶ + WaitI2CAck(); // ȴӦ + SetI2CStop(); // + + // command2 õַ + // printf("command2\r\n"); + SetI2CStart(); // ʼλ + WriteI2CByte(ADDR_CMD_BITS|LED_REG_BEG_ADDR); // дΪʼַ + WaitI2CAck(); // ȴӦ + + // Data1~Nʾ + //printf("send data\r\n"); + while (baddr <= LED_REG6_ADDR) + { + //printf("data=0x%x\r\n", *pBuff); + WriteI2CByte(*pBuff); // дLED + WaitI2CAck(); // ȴӦ + pBuff++; + baddr++; + } + SetI2CStop(); // + + // printf("command3\r\n"); + // command3 ʾ + SetI2CStart(); // ʼλ + WriteI2CByte(DISP_CTRL_BITS|(disp & 0x0f)); // дʾ + WaitI2CAck(); // ȴӦ + SetI2CStop(); // + + // printf("TM1637WriteLedData end\r\n"); +} + +// ʾģʽ +// غ +void TM1637SetLedDisp(u8 disp) +{ + SetI2CStart(); // ʼλ + WriteI2CByte(DISP_CTRL_BITS|(disp & 0x0f)); // дʾ + WaitI2CAck(); // ȴӦ + SetI2CStop(); // +} + + +#endif diff --git a/NxFuncs/keyled/tm1637.h b/NxFuncs/keyled/tm1637.h new file mode 100644 index 0000000..b36b377 --- /dev/null +++ b/NxFuncs/keyled/tm1637.h @@ -0,0 +1,134 @@ + + +#ifndef __TM1637_H__ +#define __TM1637_H__ + +#include "config.h" + +#ifndef LEDKEY_TM1637 +#define LEDKEY_TM1637 0 +#endif + + +// tm1637 ṩ 8x2 6 8 Ŀ + +//----------------------------------------------------------------- +/* + ------------------------------------------------------------------------------------------------- + | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 | + |-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------| + | | Ϊ0 | ͬģʽ | + |-----------------------|-----------------------|-----------------------------------------------| + | | | | | 0 | 0 | дݵʾĴ + | | | | | 1 | 0 | ɨ + | 0 1 | | | 0 | | | Զַ + | | | | 1 | | | ̶ַ + | | | 0 | | | | ͨģʽ + | | | 1 | | | | ģʽڲʹã + |-----------------------|-----------------------|-----------------------------------------------| + | | | 0 | 0 | 0 | 0 | ʾַ0 + | ַ | | 0 | 0 | 0 | 1 | ʾַ1 + | 1 1 | | 0 | 0 | 1 | 0 | ʾַ2 + | | | 0 | 0 | 1 | 1 | ʾַ3 + | | | 0 | 1 | 0 | 0 | ʾַ4 + | | | 0 | 1 | 0 | 1 | ʾַ5 + |-----------------------|-----------------------|-----------------------------------------------| + | | | | 0 | 0 | 0 | Ϊ 1/16 + | ʾ | | | 0 | 0 | 1 | Ϊ 2/16 + | 1 0 | | | 0 | 1 | 0 | Ϊ 4/16 + | | | | 0 | 1 | 1 | Ϊ 10/16 + | | | | 1 | 0 | 0 | Ϊ 11/16 + | | | | 1 | 0 | 1 | Ϊ 12/16 + | | | | 1 | 0 | 0 | Ϊ 13/16 + | | | | 1 | 0 | 1 | Ϊ 14/16 + | | | 0 | | | | ʾ + | | | 1 | | | | ʾ + |-----------------------|-----------------------|-----------------------------------------------| + +ڸоƬĿʱͽӿЭͱ׼I2CвûеֶַΣÿֽڵĴ˳һ LSB ׼ MSB,ԣоƬģI2Cʵ֡ + +*/ + +//-------------------------- + +// bit7 bit6 +#define DATA_CMD_BITS 0x40 // +#define ADDR_CMD_BITS 0xC0 // ַʾĴַ +#define DISP_CTRL_BITS 0x80 // ʾ + +//-------------------------- +// Ķ +// bit1 bit0 +#define WRITE_LED_REG 0x00 // дݵʾĴ +#define READ_KEY_VAL 0x02 // + +// bit2 +#define ADDR_AUTO_INC 0x00 // ַԶ +#define ADDR_FIXED 0x04 // ̶ַ + +//-------------------------- +// ַĶ +#define LED_REG_BEG_ADDR 0x00 + + +#define LED_REG1_ADDR (LED_REG_BEG_ADDR+0x00) +#define LED_REG2_ADDR (LED_REG_BEG_ADDR+0x01) +#define LED_REG3_ADDR (LED_REG_BEG_ADDR+0x02) +#define LED_REG4_ADDR (LED_REG_BEG_ADDR+0x03) +#define LED_REG5_ADDR (LED_REG_BEG_ADDR+0x04) +#define LED_REG6_ADDR (LED_REG_BEG_ADDR+0x05) + + +//-------------------------- +// ʾĶ +#define DISP_OFF 0x00 +#define DISP_ON 0x08 + +#define DISP_LEV(lev) ((lev)&0x07) + +//--------------------------------------- + +// , ֵ 16 +#define KEY_NONE 0xFF + +#define KEY_K1SG1 0xF7 +#define KEY_K1SG2 0xF6 +#define KEY_K1SG3 0xF5 +#define KEY_K1SG4 0xF4 +#define KEY_K1SG5 0xF3 +#define KEY_K1SG6 0xF2 +#define KEY_K1SG7 0xF1 +#define KEY_K1SG8 0xF0 + +#define KEY_K2SG1 0xEF +#define KEY_K2SG2 0xEE +#define KEY_K2SG3 0xED +#define KEY_K2SG4 0xEC +#define KEY_K2SG5 0xEB +#define KEY_K2SG6 0xEA +#define KEY_K2SG7 0xE9 +#define KEY_K2SG8 0xE8 + + + +//------------------------------------------------------------------------------ + +// ȡֵ +u8 TM1637ReadKey(void); + +// дʾĴ(ַ) +void TM1637WriteLedData(u8 baddr, u8 * pBuff, u8 disp); + +// ʾģʽ(غ) +void TM1637SetLedDisp(u8 disp); + + +//------------------------------------------------------------------------------ + +// + + + +#endif + + diff --git a/NxFuncs/modbus/ef_a.c b/NxFuncs/modbus/ef_a.c new file mode 100644 index 0000000..3e5c81b --- /dev/null +++ b/NxFuncs/modbus/ef_a.c @@ -0,0 +1,543 @@ + +#include "ef_a.h" + +#include "inout.h" +#include "delay.h" +#include "trigger.h" + +#ifndef EF_NUM +#define EF_NUM 1 +#endif + +EFCommCtrl g_efCommCtrl[EF_NUM]; + +void EFDefOutEn(void) +{ +} + +void EFDefOutDis(void) +{ +} + +void RegisterEFCommFunc(EFCommCtrl* pCtrl, UsartSendData send, UsartGetData get, UsartCleanRsBuf clean, IsUsartSendOver sdover, CommOutFunc outen, CommOutFunc outdis) +{ + pCtrl->EFCommSend = send; + pCtrl->EFCommReceive = get; + pCtrl->EFCommCleanRsBuf = clean; + pCtrl->IsEFCommSendOver = sdover; + + pCtrl->CommOutEn = outen; + pCtrl->CommOutDis = outdis; +} + +void InitEF(int idx, int usart, BAUD_TypeDef baud, char dat, char parity, char stop) +{ + if (idx < 0 || idx >= EF_NUM) + { + return; + } + + memset(&g_efCommCtrl[idx], 0, sizeof(EFCommCtrl)); + + // ʱ + switch(baud) + { + // λ + 1ʼλ + żУλ(Уû) + ֹͣλ + // ݲ ͨѶʱ, λus = 10000000 / baud(һֽ10λ, 8 N 1) + case B4800: + { + g_efCommCtrl[idx].efSendWait = 2200; + break; + } + case B9600: + { + g_efCommCtrl[idx].efSendWait = 1100; + break; + } + case B14400: + { + g_efCommCtrl[idx].efSendWait = 750; + break; + } + case B19200: + { + g_efCommCtrl[idx].efSendWait = 600; + break; + } + case B38400: + { + g_efCommCtrl[idx].efSendWait = 300; + break; + } + case B57600: + { + g_efCommCtrl[idx].efSendWait = 200; + break; + } + case B115200: + { + g_efCommCtrl[idx].efSendWait = 100; + break; + } + case B230400: + { + g_efCommCtrl[idx].efSendWait = 50; + break; + } + case B460800: + { + g_efCommCtrl[idx].efSendWait = 25; + break; + } + case B921600: + { + g_efCommCtrl[idx].efSendWait = 13; + break; + } + default: + { + g_efCommCtrl[idx].efSendWait = 0; + } + } + +#ifndef USART1_485OutEn +#define USART1_485OutEn EFDefOutEn +#endif + +#ifndef USART1_485OutDis +#define USART1_485OutDis EFDefOutDis +#endif + +#ifndef USART2_485OutEn +#define USART2_485OutEn EFDefOutEn +#endif + +#ifndef USART2_485OutDis +#define USART2_485OutDis EFDefOutDis +#endif + +#ifndef USART3_485OutEn +#define USART3_485OutEn EFDefOutEn +#endif + +#ifndef USART3_485OutDis +#define USART3_485OutDis EFDefOutDis +#endif + +#ifndef USART4_485OutEn +#define USART4_485OutEn EFDefOutEn +#endif + +#ifndef USART4_485OutDis +#define USART4_485OutDis EFDefOutDis +#endif + +#ifndef USART5_485OutEn +#define USART5_485OutEn EFDefOutEn +#endif + +#ifndef USART5_485OutDis +#define USART5_485OutDis EFDefOutDis +#endif + +#ifndef USART6_485OutEn +#define USART6_485OutEn EFDefOutEn +#endif + +#ifndef USART6_485OutDis +#define USART6_485OutDis EFDefOutDis +#endif + + // ʼ + switch(usart) + { +#ifdef COMM_USART1 + case COMM_USART1: + { + InitUsart1(baud, dat, parity, stop); // 1 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart1SendData, Usart1GetData, Usart1CleanRsBuf, IsUsart1SendOver, USART1_485OutEn, USART1_485OutDis); + break; + } +#endif +#ifdef COMM_USART2 + case COMM_USART2: + { + InitUsart2(baud, dat, parity, stop); // 2 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart2SendData, Usart2GetData, Usart2CleanRsBuf, IsUsart2SendOver, USART2_485OutEn, USART2_485OutDis); + break; + } +#endif +#ifdef COMM_USART3 + case COMM_USART3: + { + InitUsart3(baud, dat, parity, stop); // 3 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart3SendData, Usart3GetData, Usart3CleanRsBuf, IsUsart3SendOver, USART3_485OutEn, USART3_485OutDis); + break; + } +#endif +#ifdef COMM_USART4 + case COMM_USART4: + { + InitUsart4(baud, dat, parity, stop); // 4 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart4SendData, Usart4GetData, Usart4CleanRsBuf, IsUsart4SendOver, USART4_485OutEn, USART4_485OutDis); + break; + } +#endif +#ifdef COMM_USART5 + case COMM_USART5: + { + InitUsart5(baud, dat, parity, stop); // 5 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart5SendData, Usart5GetData, Usart5CleanRsBuf, IsUsart5SendOver, USART5_485OutEn, USART5_485OutDis); + break; + } +#endif +#ifdef COMM_USART6 + case COMM_USART6: + { + InitUsart6(baud, dat, parity, stop); // 6 + RegisterEFCommFunc(&g_efCommCtrl[idx], Usart6SendData, Usart6GetData, Usart6CleanRsBuf, IsUsart6SendOver, USART6_485OutEn, USART6_485OutDis); + break; + } +#endif + default: + { + break; + } + + } + + g_efCommCtrl[idx].CommOutDis(); // رշ +} + +int EFTx(int idx, u8 addr, u16 data, int steps) +{ + int i, timeout, result; + u8 pSDat[3]; + + if ( ((addr & 0xF0) != 0xE0) && ((addr & 0xF0) != 0xF0) ) + { + return -1; + } + + if (steps == 1 || steps == -1) + { + g_efCommCtrl[idx].CommOutEn(); // 򿪷 + + if (steps == -1) + { + DelayUs(100); + } + } + + if (steps == 2 || steps == -1) + { + i = 0; + result = 0; + + pSDat[i++] = addr; + + if ((addr & 0xF0) == 0xF0) + { + pSDat[i++] = HIBYTE(data); + pSDat[i++] = LOBYTE(data); + } + else + { + pSDat[i++] = data; + } + + g_efCommCtrl[idx].EFCommSend(pSDat, i); + } + + if (steps == 3) + { + if (g_efCommCtrl[idx].IsEFCommSendOver() != TRUE) + { + return 0; + } + } + else if (steps == -1) // ͬ + { + timeout = (i*2 + 4) * g_efCommCtrl[idx].efSendWait; // ʱʱ,λus((ֽ*2 + 4) * ÿֽڷʱ) + + do //ȴ + { + if (g_efCommCtrl[idx].IsEFCommSendOver() == TRUE) + { + break; + } + + DelayUs(1); + + if (timeout-- <= 0) + { + result = -2; + break; + } + }while(1); + + DelayUs(g_efCommCtrl[idx].efSendWait); // ȴһֽڷ + + } + + if (steps == 4 || steps == -1) + { + g_efCommCtrl[idx].EFCommCleanRsBuf(); // ѽյ + g_efCommCtrl[idx].CommOutDis(); // رշ + } + + if (steps != -1) + { + return steps; + } + + return result; + +} + +int EFRx(int idx, u16 * pData, int steps) +{ + int exlen, timeout, result; + u8 pRDat[3]; + + if (pData == NULL || (steps != 1 && steps != -1)) + { + return -1; + } + + memset(pRDat, 0, 3); + + exlen = 3; + timeout = exlen*2 + 200; // ʱʱ + + do + { + result = g_efCommCtrl[idx].EFCommReceive(pRDat, exlen); // ӻȡ + if (result >= exlen) + { + // ݰ + + if (pRDat[0] != 0xE0) + { + result = -4; // մ + break; + } + + *pData = MAKEWORD(pRDat[2], pRDat[1]); + + break; + } + else if (result < 0) + { + if (result == -2) // ûгʼ + { + printf("usart is not inited\r\n"); + } + else if (result == -3) // ջƴ + { + printf("usart receive buf ctrl error\r\n"); + } + break; + } + + if (steps == -1) + { + // ȴ + DelayUs(g_efCommCtrl[idx].efSendWait); + + if (timeout-- <= 0) + { + printf("2. call EFRx timeout\r\n"); + result = -5; //ճʱ + break; + } + } + else + { + result = 0; + break; + } + + }while(1); + + return result; +} + +int EFComm(int idx, u8 addr, u16 wrDat, u16 * pRdBuf) +{ + int result; + + result = EFTx(idx, addr, wrDat, -1); + + if (result == 0) + { + // ȴذ + if (addr == 0xE0 && wrDat >= 32 && wrDat <= 63) + { + if (pRdBuf != NULL) + { + result = EFRx(idx, pRdBuf, -1); + } + } + } + + return result; +} + +AsyncEFCtrl g_asyncefCtrl[EF_NUM]; + +void InitAsyncEFCtrl(int idx, int rsvtimout) +{ + memset(&g_asyncefCtrl[idx], 0, sizeof(AsyncEFCtrl)); + + // ȡʱʱ + if (rsvtimout < 20) + { + g_asyncefCtrl[idx].efrsvTimout = 20; + } + else if (rsvtimout > 200) + { + g_asyncefCtrl[idx].efrsvTimout = 200; + } + else + { + g_asyncefCtrl[idx].efrsvTimout = rsvtimout; + } +} + +void RegEFCmdProc(int idx, ResvEFProc proc) +{ + g_asyncefCtrl[idx].resvefproc = proc; +} + +int AddEFCmd(EFCmd * pCmd) +{ + if (pCmd != NULL) + { + AsyncEFCtrl * p485Ctrl = &g_asyncefCtrl[pCmd->idx]; + + if (p485Ctrl != NULL) + { + if (p485Ctrl->bufCmdNum < MAX_EF_CMD && p485Ctrl->bufTail < MAX_EF_CMD) + { + memcpy(&(p485Ctrl->cmdbuf[p485Ctrl->bufTail]), pCmd, sizeof(EFCmd)); + p485Ctrl->bufTail++; + if (p485Ctrl->bufTail >= MAX_EF_CMD) + { + p485Ctrl->bufTail = 0; + } + p485Ctrl->bufCmdNum++; + return p485Ctrl->bufCmdNum; + } + else + { + printf("ef %d cmd buff full\r\n", pCmd->idx); + return -2; + } + } + return -1; + } + + return -1; +} + +int GetEFCmdBufLen(int idx) +{ + return g_asyncefCtrl[idx].bufCmdNum; +} + +int AsyncEFTask(int idx) +{ + // ֲִ + int rslt; + u32 curIime; + + EFCmd *pCmd; + + AsyncEFCtrl * p485Ctrl = &g_asyncefCtrl[idx]; + + if (p485Ctrl == NULL) + { + return -1; + } + + pCmd = &(p485Ctrl->cmdbuf[p485Ctrl->bufHead]); + + // ȡǰʱ + curIime = GetUsSoftTimer(); + + if ((curIime - p485Ctrl->stepTime) > g_efCommCtrl[pCmd->idx].efSendWait) + { + p485Ctrl->stepTime = curIime; + + if (p485Ctrl->working == 0 && + p485Ctrl->bufCmdNum > 0 && + p485Ctrl->steps == 0) + { + p485Ctrl->working = 1; + p485Ctrl->steps = 1; + } + + if (p485Ctrl->working == 0) + { + p485Ctrl->steps = 0; + return 0; + } + + if (p485Ctrl->steps > 0 && p485Ctrl->steps < 5) + { + rslt = EFTx(pCmd->idx, pCmd->addr, pCmd->wrdat, p485Ctrl->steps); + + if (rslt == p485Ctrl->steps) + { + p485Ctrl->steps++; + } + } + else if (p485Ctrl->steps >= 5 && p485Ctrl->steps < p485Ctrl->efrsvTimout) + { + // ȴذ + if (pCmd->addr == 0xE0 && pCmd->wrdat >= 32 && pCmd->wrdat <= 63) + { + rslt = EFRx(pCmd->idx, &pCmd->rddat, 1); + if (rslt == 3) // ȷ + { + // ִжݺ + if (p485Ctrl->resvefproc != NULL) + { + p485Ctrl->resvefproc(pCmd); + } + p485Ctrl->steps = p485Ctrl->efrsvTimout; + } + else + { + p485Ctrl->steps++; + } + } + else + { + p485Ctrl->steps = p485Ctrl->efrsvTimout; + } + } + else + { + p485Ctrl->steps++; + } + + if (p485Ctrl->steps >= p485Ctrl->efrsvTimout) + { + if (p485Ctrl->bufCmdNum > 0) + { + p485Ctrl->bufCmdNum--; + } + p485Ctrl->steps = 0; + p485Ctrl->working = 0; + p485Ctrl->bufHead++; + if (p485Ctrl->bufHead >= MAX_EF_CMD) + { + p485Ctrl->bufHead = 0; + } + } + } + return p485Ctrl->steps; +} + diff --git a/NxFuncs/modbus/ef_a.h b/NxFuncs/modbus/ef_a.h new file mode 100644 index 0000000..ab67767 --- /dev/null +++ b/NxFuncs/modbus/ef_a.h @@ -0,0 +1,73 @@ +/* + * յEF_AЭ + */ + +#ifndef _EF_A_H_ +#define _EF_A_H_ + +#include "config.h" +#include "serial.h" + +typedef struct +{ + int idx; + u8 addr; + u16 wrdat; + u16 rddat; +}EFCmd; + +#ifndef MAX_EF_CMD +#define MAX_EF_CMD 50 +#endif + +typedef void (*ResvEFProc)(EFCmd * pcmd); // յݴ + +typedef struct +{ + EFCmd cmdbuf[MAX_EF_CMD]; + + // շ + int working; // ڶд; = 1, Уշ + + int bufCmdNum; // ; != 0, + int bufHead; + int bufTail; + + int steps; + u32 stepTime; + + ResvEFProc resvefproc; // յݴ + + int efrsvTimout; // ȡʱʱ + +}AsyncEFCtrl; + +typedef void (*CommOutFunc)(void); + +typedef struct +{ + u32 efSendWait; // ͨѶʱ, λus,һֽʱ + + // ͨѶָ + UsartSendData EFCommSend; // + UsartGetData EFCommReceive; // + UsartCleanRsBuf EFCommCleanRsBuf; // սջ + IsUsartSendOver IsEFCommSendOver; // жϷͻǷΪ + + CommOutFunc CommOutEn; // ݷ + CommOutFunc CommOutDis; // ݷͽֹ + +}EFCommCtrl; + +void InitEF(int idx, int usart, BAUD_TypeDef baud, char dat, char parity, char stop); +int EFTx(int idx, u8 addr, u16 data, int steps); +int EFRx(int idx, u16 * pData, int steps); +int EFComm(int idx, u8 addr, u16 wrDat, u16 * pRdBuf); + +void InitAsyncEFCtrl(int idx, int rsvtimout); +void RegEFCmdProc(int idx, ResvEFProc proc); +int AddEFCmd(EFCmd * pCmd); +int GetEFCmdBufLen(int idx); +int AsyncEFTask(int idx); + +#endif /* _EF_A_H_ */ diff --git a/NxFuncs/modbus/modbus_def.c b/NxFuncs/modbus/modbus_def.c new file mode 100644 index 0000000..25419ff --- /dev/null +++ b/NxFuncs/modbus/modbus_def.c @@ -0,0 +1,180 @@ + +#include "modbus_def.h" + +// עmodbusͨѶ +void RegisterModbusCommFunc(ModbusCtrl* pCtrl, UsartSendData send, UsartGetData get, UsartCleanRsBuf clean, IsUsartSendOver sdover, OnOffFunc outen, OnOffFunc outdis) +{ + pCtrl->ModBusCommSend = send; + pCtrl->ModBusCommReceive = get; + pCtrl->ModBusCommCleanRsBuf = clean; + pCtrl->IsModBusCommSendOver = sdover; + + pCtrl->CommOutEn = outen; + pCtrl->CommOutDis = outdis; +} + +//----------------------------------------------------------------- +// ĬϺ +int DefSendData(u8 * pDatBuf, int len) +{ + return 0; +} + +int DefGetData(u8 * pDat, int expectLen) +{ + return 0; +} + +int DefCleanRsBuf(void) +{ + return 0; +} + +int DefIsSendOver(void) +{ + return 0; +} + +void DefOutEn(void) +{ +} + +void DefOutDis(void) +{ +} + +// ASCIIģʽ +//----------------------------------------------------------------- +// :ASCII -> RTU + +u8 AsciiToRtu(u8 ascii) +{ + if ((ascii >= '0') && (ascii <= '9')) + { + return ascii - '0'; + } + else if ((ascii >= 'A') && (ascii <= 'F')) + { + return ascii - 'A' + 10; + } + else if ((ascii >= 'a') && (ascii <= 'f')) + { + return ascii - 'a' + 10; + } + else + { + return 0; + } +} +//----------------------------------------------------------------- +// :RTU -> ASCII + +u8 RtuToAscii(u8 rtu) +{ + if (rtu < 10) + { + return rtu + '0'; + } + else if (rtu < 16) + { + return rtu + 'A' - 10; + } + else + { + return rtu; + } +} + + +//----------------------------------------------------------------- + +// RTUģʽCRCУݼ +static unsigned char auchCRCHi[] = +{ + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41, + 0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0, + 0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1, + 0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1, + 0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40, + 0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1, + 0x81,0x40,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40, + 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0, + 0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41, + 0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41, + 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40, + 0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1, + 0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41, + 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0, + 0x80,0x41,0x00,0xC1,0x81,0x40 +}; + +//CRCλֵֽ +static char auchCRCLo[] = +{ + 0x00,0xC0,0xC1,0x01,0xC3,0x03,0x02,0xC2,0xC6,0x06, + 0x07,0xC7,0x05,0xC5,0xC4,0x04,0xCC,0x0C,0x0D,0xCD, + 0x0F,0xCF,0xCE,0x0E,0x0A,0xCA,0xCB,0x0B,0xC9,0x09, + 0x08,0xC8,0xD8,0x18,0x19,0xD9,0x1B,0xDB,0xDA,0x1A, + 0x1E,0xDE,0xDF,0x1F,0xDD,0x1D,0x1C,0xDC,0x14,0xD4, + 0xD5,0x15,0xD7,0x17,0x16,0xD6,0xD2,0x12,0x13,0xD3, + 0x11,0xD1,0xD0,0x10,0xF0,0x30,0x31,0xF1,0x33,0xF3, + 0xF2,0x32,0x36,0xF6,0xF7,0x37,0xF5,0x35,0x34,0xF4, + 0x3C,0xFC,0xFD,0x3D,0xFF,0x3F,0x3E,0xFE,0xFA,0x3A, + 0x3B,0xFB,0x39,0xF9,0xF8,0x38,0x28,0xE8,0xE9,0x29, + 0xEB,0x2B,0x2A,0xEA,0xEE,0x2E,0x2F,0xEF,0x2D,0xED, + 0xEC,0x2C,0xE4,0x24,0x25,0xE5,0x27,0xE7,0xE6,0x26, + 0x22,0xE2,0xE3,0x23,0xE1,0x21,0x20,0xE0,0xA0,0x60, + 0x61,0xA1,0x63,0xA3,0xA2,0x62,0x66,0xA6,0xA7,0x67, + 0xA5,0x65,0x64,0xA4,0x6C,0xAC,0xAD,0x6D,0xAF,0x6F, + 0x6E,0xAE,0xAA,0x6A,0x6B,0xAB,0x69,0xA9,0xA8,0x68, + 0x78,0xB8,0xB9,0x79,0xBB,0x7B,0x7A,0xBA,0xBE,0x7E, + 0x7F,0xBF,0x7D,0xBD,0xBC,0x7C,0xB4,0x74,0x75,0xB5, + 0x77,0xB7,0xB6,0x76,0x72,0xB2,0xB3,0x73,0xB1,0x71, + 0x70,0xB0,0x50,0x90,0x91,0x51,0x93,0x53,0x52,0x92, + 0x96,0x56,0x57,0x97,0x55,0x95,0x94,0x54,0x9C,0x5C, + 0x5D,0x9D,0x5F,0x9F,0x9E,0x5E,0x5A,0x9A,0x9B,0x5B, + 0x99,0x59,0x58,0x98,0x88,0x48,0x49,0x89,0x4B,0x8B, + 0x8A,0x4A,0x4E,0x8E,0x8F,0x4F,0x8D,0x4D,0x4C,0x8C, + 0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,0x82,0x42, + 0x43,0x83,0x41,0x81,0x80,0x40 +}; + +//һcrcУֵ +void ModbusAddCrc16(u8 Data, u8 * pcrch, u8 * pcrcl) +{ + int idx; + idx = *pcrch ^ Data; /*CRC*/ + *pcrch = *pcrcl ^ auchCRCHi[idx]; + *pcrcl = auchCRCLo[idx]; +} + +//----------------------------------------------------- +// u8 *puchMsg; //ҪCRCУϢ +// u16 usDataLen;// Ϣֽ +u16 ModbusCrc16(u8 *puchMsg, u16 usDataLen) +{ + u8 crch, crcl; + crch = 0xff; + crcl = 0xff; + + while(usDataLen) /// Ϣ + { + ModbusAddCrc16(*puchMsg, &crch, &crcl); + usDataLen--; + puchMsg++; + } + + return((crch<<8)|crcl); +} + diff --git a/NxFuncs/modbus/modbus_def.h b/NxFuncs/modbus/modbus_def.h new file mode 100644 index 0000000..f4e64dd --- /dev/null +++ b/NxFuncs/modbus/modbus_def.h @@ -0,0 +1,146 @@ + +#ifndef __MODBUS_DEF_H__ +#define __MODBUS_DEF_H__ + +#include "config.h" +#include "serial.h" + +//---------------------------------------------------------------- + +// modbus Э鶨 +/* + +*/ + +//------------------------------------------------------------------ +/*modbusַ,ֵ֧ѰַռΪ256 + * ---------------------------------- + * | 0 | 1-247 | 248-255 | + * |--------------------------------- + * |㲥ַ|ӽڵַ| | + * |--------------------------------- + */ +#ifndef MODBUS_IDXMAX +#define MODBUS_IDXMAX 247 // ֵ֧վ +#endif + +#define MODBUS_LENMAX 50 // ݰֵ(λ: ) + +#define MDBSRXLEN_A (MODBUS_LENMAX*4 + 21) // ASCII ʽ +#define MDBSRXLEN_R (MODBUS_LENMAX*2 + 10) // RTU ʽ + +#define MDBSRXLEN_MAX MDBSRXLEN_A // λֽ + + +//------------------------------------------------------------------ + + +//------------------------------------------------------------------ +// ֵ֧ +#define READ_COIL_STATUS 0x01 // ȡȦ״̬(λ) +#define READ_INPUT_STATUS 0x02 // ȡ״̬(λ) +#define READ_HOLDING_REGISTER 0x03 // ȡּĴ +#define READ_INPUT_REGISTER 0x04 // ȡĴ +#define WRITE_SINGLE_COIL 0x05 // дȦ(λ) +#define WRITE_SINGLE_REGISTER 0x06 // дּĴ +#define WRITE_MULTIPLE_COIL 0x0F // дȦ(λ) +#define WRITE_MULTIPLE_REGISTER 0x10 // дּĴ + +//------------------------------------------------------------------ + +#define MODBUS_RD READ_HOLDING_REGISTER // +#define MODBUS_WR WRITE_SINGLE_REGISTER // д +#define MODBUS_WR_MULTI WRITE_MULTIPLE_REGISTER // д + +//------------------------------------------------------------------ +#ifndef MODBUS_MAX_WR +#define MODBUS_MAX_WR 10 +#endif + +#ifndef MODBUS_MAX_RD +#define MODBUS_MAX_RD 10 +#endif + +typedef struct +{ + // + u8 midx; // վ + u8 index; // վţ1~247(ʮ) + u8 cmd; // + u16 addr; // ݵַ + u16 wrdat[MODBUS_MAX_WR]; // д + u16 wlen; // дݳ + u16 rddat[MODBUS_MAX_RD]; // + u16 rlen; // ȡݳ +}Rs485Cmd; + +#ifndef MAX_485CMD +#define MAX_485CMD 20 +#endif + +typedef void (*Resv485ExProc)(Rs485Cmd * pcmd); // յݴ + +typedef struct +{ + int init; // 1:ʼ + u8 idxNum; + u8 idxList[MODBUS_IDXMAX]; // վб,ģվĶ1~247(ʮ) + + Rs485Cmd cmdbuf[MAX_485CMD]; + // շ + int working; // ڶд; = 1, Уշ + + int bufCmdNum; // ; != 0, + int bufHead; + int bufTail; + + int steps; + u32 stepTime; + + Resv485ExProc resv485exproc; // յݴ + + int modrsvTimout; // ȡʱʱ + +}Rs485Ctrl; + + +//------------------------------------------------------------------ + +typedef void (*OnOffFunc)(void); + +// ݽṹ +typedef struct +{ + int modBusMode; // ͨѶģʽ, = 0, RTUģʽ; = 1, ASCIIģʽ + int filterChk; // Уλ־, = 0, ; = 1, + + u32 modBusWait; // ͨѶʱ, λus,һֽʱ + + // ͨѶָ + UsartSendData ModBusCommSend; // + UsartGetData ModBusCommReceive; // + UsartCleanRsBuf ModBusCommCleanRsBuf; // սջ + IsUsartSendOver IsModBusCommSendOver; // жϷͻǷΪ + + OnOffFunc CommOutEn; // ݷ + OnOffFunc CommOutDis; // ݷͽֹ + +}ModbusCtrl; + +// עmodbusͨѶ +void RegisterModbusCommFunc(ModbusCtrl* pCtrl, UsartSendData send, UsartGetData get, UsartCleanRsBuf clean, IsUsartSendOver sdover, OnOffFunc outen, OnOffFunc outdis); + +//------------------------------------------------------------------ + +// ĬϺ +int DefSendData(u8 * pDatBuf, int len); +int DefGetData(u8 * pDat, int expectLen); +int DefCleanRsBuf(void); +int DefIsSendOver(void); +void DefOutEn(void); +void DefOutDis(void); +u16 ModbusCrc16(u8 * puchMsg, u16 usDataLen); +u8 AsciiToRtu(u8 ascii); +u8 RtuToAscii(u8 rtu); + +#endif diff --git a/NxFuncs/modbus/modbus_m.c b/NxFuncs/modbus/modbus_m.c new file mode 100644 index 0000000..76f0f90 --- /dev/null +++ b/NxFuncs/modbus/modbus_m.c @@ -0,0 +1,1247 @@ + +#include "modbus_m.h" + +#ifdef MODBUS_M + +#include "inout.h" +#include "delay.h" +#include "trigger.h" + +#ifndef MODBUS_M_NUM +#define MODBUS_M_NUM 1 +#endif + +//----------------------------------------------------------------- +// ƽṹ +ModbusCtrl g_modBusMCtrl[MODBUS_M_NUM]; + +//----------------------------------------------------------------- + + + + +/*----------------------------------------------------------------- +:ʼ Modbus 豸 +midx : վ +baud : +dat: ݳ +parity: Уλ +stop: ֹͣλ +mode: ģʽ +*/ + +void InitModbus_m(int midx, int usart, BAUD_TypeDef baud, char dat, char parity, char stop, char mode) +{ + if (midx < 0 || midx >= MODBUS_M_NUM) + { + printf("init modbus_m, idx error\r\n"); + return; + } + + memset(&g_modBusMCtrl[midx], 0, sizeof(ModbusCtrl)); + + if (mode == 'A' || mode == 'a') + { + g_modBusMCtrl[midx].modBusMode = 1; + } + else + { + g_modBusMCtrl[midx].modBusMode = 0; + } + + // ʱ + switch(baud) + { + // λ + 1ʼλ + żУλ(Уû) + ֹͣλ + // ݲ ͨѶʱ, λus = 10000000 / baud(һֽ10λ, 8 N 1) + case B4800: + { + g_modBusMCtrl[midx].modBusWait = 2200; + break; + } + case B9600: + { + g_modBusMCtrl[midx].modBusWait = 1100; + break; + } + case B14400: + { + g_modBusMCtrl[midx].modBusWait = 750; + break; + } + case B19200: + { + g_modBusMCtrl[midx].modBusWait = 600; + break; + } + case B38400: + { + g_modBusMCtrl[midx].modBusWait = 300; + break; + } + case B57600: + { + g_modBusMCtrl[midx].modBusWait = 200; + break; + } + case B115200: + { + g_modBusMCtrl[midx].modBusWait = 100; + break; + } + case B230400: + { + g_modBusMCtrl[midx].modBusWait = 50; + break; + } + case B460800: + { + g_modBusMCtrl[midx].modBusWait = 25; + break; + } + case B921600: + { + g_modBusMCtrl[midx].modBusWait = 13; + break; + } + default: + { + g_modBusMCtrl[midx].modBusWait = 0; + } + } + if ((dat == '8') && (parity != 'N') && (parity != 'n')) // 7λݹУλ + { + g_modBusMCtrl[midx].filterChk = 1; + } + else + { + g_modBusMCtrl[midx].filterChk = 0; + } + +#ifndef USART1_485OutEn +#define USART1_485OutEn DefOutEn +#endif + +#ifndef USART1_485OutDis +#define USART1_485OutDis DefOutDis +#endif + +#ifndef USART2_485OutEn +#define USART2_485OutEn DefOutEn +#endif + +#ifndef USART2_485OutDis +#define USART2_485OutDis DefOutDis +#endif + +#ifndef USART3_485OutEn +#define USART3_485OutEn DefOutEn +#endif + +#ifndef USART3_485OutDis +#define USART3_485OutDis DefOutDis +#endif + +#ifndef USART4_485OutEn +#define USART4_485OutEn DefOutEn +#endif + +#ifndef USART4_485OutDis +#define USART4_485OutDis DefOutDis +#endif + +#ifndef USART5_485OutEn +#define USART5_485OutEn DefOutEn +#endif + +#ifndef USART5_485OutDis +#define USART5_485OutDis DefOutDis +#endif + +#ifndef USART6_485OutEn +#define USART6_485OutEn DefOutEn +#endif + +#ifndef USART6_485OutDis +#define USART6_485OutDis DefOutDis +#endif + + // ʼ + switch(usart) + { +#ifdef COMM_USART1 + case COMM_USART1: + { + InitUsart1(baud, dat, parity, stop); // 1 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart1SendData, Usart1GetData, Usart1CleanRsBuf, IsUsart1SendOver, USART1_485OutEn, USART1_485OutDis); + break; + } +#endif +#ifdef COMM_USART2 + case COMM_USART2: + { + InitUsart2(baud, dat, parity, stop); // 2 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart2SendData, Usart2GetData, Usart2CleanRsBuf, IsUsart2SendOver, USART2_485OutEn, USART2_485OutDis); + break; + } +#endif +#ifdef COMM_USART3 + case COMM_USART3: + { + InitUsart3(baud, dat, parity, stop); // 3 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart3SendData, Usart3GetData, Usart3CleanRsBuf, IsUsart3SendOver, USART3_485OutEn, USART3_485OutDis); + break; + } +#endif +#ifdef COMM_USART4 + case COMM_USART4: + { + InitUsart4(baud, dat, parity, stop); // 4 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart4SendData, Usart4GetData, Usart4CleanRsBuf, IsUsart4SendOver, USART4_485OutEn, USART4_485OutDis); + break; + } +#endif +#ifdef COMM_USART5 + case COMM_USART5: + { + InitUsart5(baud, dat, parity, stop); // 5 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart5SendData, Usart5GetData, Usart5CleanRsBuf, IsUsart5SendOver, USART5_485OutEn, USART5_485OutDis); + break; + } +#endif +#ifdef COMM_USART6 + case COMM_USART6: + { + InitUsart6(baud, dat, parity, stop); // 6 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart6SendData, Usart6GetData, Usart6CleanRsBuf, IsUsart6SendOver, USART6_485OutEn, USART6_485OutDis); + break; + } +#endif + default: + { + RegisterModbusCommFunc(&g_modBusMCtrl[midx], DefSendData, DefGetData, DefCleanRsBuf, DefIsSendOver, DefOutEn, DefOutDis); + break; + } + + } + + g_modBusMCtrl[midx].CommOutDis(); // رշ +} + +//----------------------------------------------------------------- +// :һMODBUSЭ +// : +// midx: վ +// index: վ: 1~247(ʮ) +// cmd: : 03H () +// 06H (д) +// 10H (д) +// addr: ʼַ: 0000H~FFFFH +// pData: : λ:(ʱΪȡ,дʱΪд) +// len: ݳ,λ,ʱ̶Ϊ1,дʱΪд볤 +// steps Ͳ +// ֵ: 0: +// -1: +// -2: ͳʱ + +// Է4(1--4), ִȷز; +// steps == -1, Ƿֲãͬã +/* + * 1:򿪷 + * 2:ݷ + * 3:ȴ + * 4:رշ + */ +int ModbusTx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps) +{ + int i, j, timeout, result; + u8 checksum, temp; // У(ASCII) + u16 checkcrc; // CRC У(RTU) + u16 data; + u8 pSDat[MDBSRXLEN_MAX]; // + + if ((cmd != MODBUS_RD) && (cmd != MODBUS_WR) && (cmd != MODBUS_WR_MULTI)) + { + result = -1; + return result; + } + + if (pData == NULL || len == 0) + { + result = -1; + return result; + } + + if (midx < 0 || midx >= MODBUS_M_NUM) + { + result = -1; + return result; + } + + if (steps == 1 || steps == -1) + { + g_modBusMCtrl[midx].CommOutEn(); // 򿪷 + + if (steps == -1) + { + DelayUs(100); + } + } + + if (steps == 2 || steps == -1) + { + i = 0; + result = 0; + + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + { + checksum = 0; + pSDat[i++] = ':'; //':' + + temp = HIHFBYTE(index); + pSDat[i++] = RtuToAscii(temp); // IDX_H + temp = LOHFBYTE(index); + pSDat[i++] = RtuToAscii(temp); // IDX_L + checksum += index; + + temp = HIHFBYTE(cmd); + pSDat[i++] = RtuToAscii(temp); // CMD_H + temp = LOHFBYTE(cmd); + pSDat[i++] = RtuToAscii(temp); // CMD_L + checksum += cmd; + + temp = HIHFBYTE(HIBYTE(addr)); + pSDat[i++] = RtuToAscii(temp); // ADDR_HH + temp = LOHFBYTE(HIBYTE(addr)); + pSDat[i++] = RtuToAscii(temp); // ADDR_HL + checksum += HIBYTE(addr); + + temp = HIHFBYTE(LOBYTE(addr)); + pSDat[i++] = RtuToAscii(temp); // ADDR_LH + temp = LOHFBYTE(LOBYTE(addr)); + pSDat[i++] = RtuToAscii(temp); // ADDR_LL + checksum += LOBYTE(addr); + + if (cmd == MODBUS_WR_MULTI) + {// + // ݸ,λ + temp = HIHFBYTE(HIBYTE(len)); + pSDat[i++] = RtuToAscii(temp); // LEN_HH + temp = LOHFBYTE(HIBYTE(len)); + pSDat[i++] = RtuToAscii(temp); // LEN_HL + checksum += HIBYTE(len); + + temp = HIHFBYTE(LOBYTE(len)); + pSDat[i++] = RtuToAscii(temp); // LEN_LH + temp = LOHFBYTE(LOBYTE(len)); + pSDat[i++] = RtuToAscii(temp); // LEN_LL + checksum += LOBYTE(len); + + // ֽ + temp = HIHFBYTE(LOBYTE(len)<<1); + pSDat[i++] = RtuToAscii(temp); // LEN_H + temp = LOHFBYTE(LOBYTE(len)<<1); + pSDat[i++] = RtuToAscii(temp); // LEN_L + checksum += LOBYTE(len<<1); + } + + for (j = 0; j < len; j++) + { + data = pData[j]; + temp = HIHFBYTE(HIBYTE(data)); + pSDat[i++] = RtuToAscii(temp); // DATA_HH + temp = LOHFBYTE(HIBYTE(data)); + pSDat[i++] = RtuToAscii(temp); // DATA_HL + checksum += HIBYTE(data); + + temp = HIHFBYTE(LOBYTE(data)); + pSDat[i++] = RtuToAscii(temp); // DATA_LH + temp = LOHFBYTE(LOBYTE(data)); + pSDat[i++] = RtuToAscii(temp); // DATA_LL + + checksum += LOBYTE(data); + } + + checksum = ~checksum + 1; + pSDat[i++] = RtuToAscii(HIHFBYTE(checksum)); // LRC_H + pSDat[i++] = RtuToAscii(LOHFBYTE(checksum)); // LRC_L + pSDat[i++] = '\r'; // CR + pSDat[i++] = '\n'; // LF + } + else // RTUģʽ + { + pSDat[i++] = index; // IDX + pSDat[i++] = cmd; // CMD + pSDat[i++] = HIBYTE(addr); // ADDR_H + pSDat[i++] = LOBYTE(addr); // ADDR_L + + if (cmd == MODBUS_WR_MULTI) + {// + // ݸ,λ + pSDat[i++] = HIBYTE(len); // LEN_H + pSDat[i++] = LOBYTE(len); // LEN_L + + // ֽ + pSDat[i++] = LOBYTE(len)<<1; // LEN_L * 2 + } + + for (j = 0; j < len; j++) + { + data = pData[j]; + + pSDat[i++] = HIBYTE(data); // DATA_H + pSDat[i++] = LOBYTE(data); // DATA_L + } + + checkcrc = ModbusCrc16(&pSDat[0], i); + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + } + + g_modBusMCtrl[midx].ModBusCommSend(pSDat, i); + } + + if (steps == 3) + { + if (g_modBusMCtrl[midx].IsModBusCommSendOver() != TRUE) + { + return 0; + } + } + else if (steps == -1) // ͬ + { + timeout = (i*2 + 4) * g_modBusMCtrl[midx].modBusWait; // ʱʱ,λus((ֽ*2 + 4) * ÿֽڷʱ) + + do //ȴ + { + if (g_modBusMCtrl[midx].IsModBusCommSendOver() == TRUE) + { + break; + } + + DelayUs(1); + + if (timeout-- <= 0) + { + result = -2; + break; + } + }while(1); + + DelayUs(g_modBusMCtrl[midx].modBusWait); // ȴһֽڷ + } + + if (steps == 4 || steps == -1) + { + g_modBusMCtrl[midx].ModBusCommCleanRsBuf(); // ѽյ + g_modBusMCtrl[midx].CommOutDis(); // رշ + } + + if (steps != -1) + { + return steps; + } + + return result; +} + +//----------------------------------------------------------------- +// :һMODBUSЭӦ +// : +// midx: վ +// index: Ӧýյվ: 1~247(ʮ) +// cmd: Ӧýյ: 03H () +// 06H (д) +// 10H (д) +// addr: Ӧýյʼַ: 0000H~FFFFH +// *pData: : λ: +// len: Ӧýյݳ: λ: +// steps: ղ +// ֵ: >0: ,ֵΪյݳ +// -1: +// -2: ճʱ +// -3: մ +// -4:ڽմ +// Էֲ +// steps == -1, ͬãֱյݻʱ +// steps == 1, 첽ñ־ȷõݽΪ len, 0ΪûݣΪ + +int ModbusRx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps) +{ + int i, j, result, exlen, timeout; + u8 pRDat[MDBSRXLEN_MAX]; // ݻ + u16 checkcrc; // crcУ(RTU) + u8 checksum; // У(ASCII) + u8 temp_h, temp_l, tempH, tempL; // + + if ((cmd != MODBUS_RD) && (cmd != MODBUS_WR) && (cmd != MODBUS_WR_MULTI)) + { + return -1; // + } + + if ((len > MODBUS_LENMAX) || (len == 0)) + { + return -1; // + } + + if (midx < 0 || midx >= MODBUS_M_NUM) + { + result = -1; + return result; + } + + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + { + if (cmd == MODBUS_RD) // + { + exlen = len * 4 + 11; // + } + else if (cmd == MODBUS_WR) // д + { + exlen = 17; // + } + else if (cmd == MODBUS_WR_MULTI) // д + { + exlen = 17; // + } + else + { + exlen = 17; // + } + + exlen -= 1; // ȥʼ : + } + else // RTU ģʽ + { + if (cmd == MODBUS_RD) // + { + exlen = len * 2 + 5; // + } + else if (cmd == MODBUS_WR) // д + { + exlen = 8; // + } + else if (cmd == MODBUS_WR_MULTI) // д + { + exlen = 8; // + } + else + { + exlen = 8; // + } + } + + if (steps == 1 || steps == -1) + { + memset(pRDat, 0, MDBSRXLEN_MAX); + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + { + timeout = exlen*2 + 400; // ʱʱ + do + { + result = g_modBusMCtrl[midx].ModBusCommReceive(pRDat, 1); // ӻȡ + + if (result == 1) + { + if (pRDat[0] == ':') // ҵʼ־ + { + result = 0; + break; + } + else + { + if (steps == 1) + { + result = 1; // 첽,ִв + break; + } + } + } + + if (steps == -1) + { + DelayUs(g_modBusMCtrl[midx].modBusWait); + + if (timeout-- <= 0) + { + printf("1. call ModbusRx timeout\r\n"); + result = -2; //ճʱ + break; + } + } + }while(1); + + if (result != 0) + { + return result; + } + } + } + + if (steps != -1 && g_modBusMCtrl[midx].modBusMode == 0) // RTU ģʽ + { + steps = 2; + } + + if (steps == 2 || steps == -1) + { + timeout = exlen*2 + 400; // ʱʱ + + do + { + result = g_modBusMCtrl[midx].ModBusCommReceive(pRDat, exlen); // ӻȡ + if (result >= exlen) + { + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + { + if (g_modBusMCtrl[midx].filterChk != 0) // 7λݹУλ + { + for (i = 0; i < result; i++) + { + pRDat[i] &= 0x7F; + } + } + + // ݰ + result = 0; + i = 0; + checksum = 0; + + if (pRDat[i] != RtuToAscii(HIHFBYTE(index))) // INDEX_H + { + result = -3; // մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(index))) // INDEX_L + { + result = -3; // մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (pRDat[i] != RtuToAscii(HIHFBYTE(cmd))) // CMD_H + { + result = -3; // մ + break; + } + + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(cmd))) // CMD_L + { + result = -3; // մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (cmd == MODBUS_RD) // + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(len) << 1))) // LEN_H + { + result = -3; // մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(len) << 1))) // LEN_L + { + result = -3; // մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + } + else if (cmd == MODBUS_WR) // д + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(addr)))) // ADDR_HH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(addr)))) // ADDR_HL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(addr)))) // ADDR_LH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(addr)))) // ADDR_LL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + } + else if (cmd == MODBUS_WR_MULTI) // д + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(addr)))) // ADDR_HH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(addr)))) // ADDR_HL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(addr)))) // ADDR_LH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(addr)))) // ADDR_LL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(len)))) // LEN_HH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(len)))) // LEN_HL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(len)))) // LEN_LH + { + result = -3; //մ + break; + } + temp_h = AsciiToRtu(pRDat[i++]); + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(len)))) // LEN_LL + { + result = -3; //մ + break; + } + temp_l = AsciiToRtu(pRDat[i++]); + checksum += MAKEBYTE(temp_l,temp_h); + } + + if (cmd == MODBUS_RD || // + cmd == MODBUS_WR || // д + 0) + { + for (j = 0; j < len; j++) + { + temp_h = AsciiToRtu(pRDat[i++]); + temp_l = AsciiToRtu(pRDat[i++]); + tempH = MAKEBYTE(temp_l, temp_h); + checksum += tempH; + + temp_h = AsciiToRtu(pRDat[i++]); + temp_l = AsciiToRtu(pRDat[i++]); + tempL = MAKEBYTE(temp_l, temp_h); + + checksum += tempL; + pData[j] = MAKEWORD(tempL, tempH); + } + } + + checksum = ~checksum + 1; + + if (pRDat[i++] != RtuToAscii(HIHFBYTE(checksum))) // LRC_H + { + result = -3; //մ + break; + } + if (pRDat[i++] != RtuToAscii(LOHFBYTE(checksum))) // LRC_L + { + result = -3; //մ + break; + } + if (pRDat[i++] != '\r') // CR + { + // result = -3; //մ + break; + } + if (pRDat[i++] != '\n') // LF + { + //result = -3; //մ + break; + } + + if (result == 0) + { + result = len; + } + break; + } + else // RTU ģʽ + { + // ݰ + result = 0; + i = 0; + + if (pRDat[i++] != index) // վַ + { + result = -3; // մ + break; + } + + if (pRDat[i++] != cmd) + { + result = -3; // մ + break; + } + + if (cmd == MODBUS_RD) // + { + if (pRDat[i++] != (LOBYTE(len) << 1)) // LEN + { + result = -3; // մ + break; + } + } + else if (cmd == MODBUS_WR) // д + { + if (pRDat[i++] != HIBYTE(addr)) // ADDR_H + { + result = -3; // մ + break; + } + + if (pRDat[i++] != LOBYTE(addr)) // ADDR_L + { + result = -3; // մ + break; + } + } + else if (cmd == MODBUS_WR_MULTI) // д + { + if (pRDat[i++] != HIBYTE(addr)) // ADDR_H + { + result = -3; // մ + break; + } + + if (pRDat[i++] != LOBYTE(addr)) // ADDR_L + { + result = -3; // մ + break; + } + + if (pRDat[i++] != HIBYTE(len)) // LEN_H + { + result = -3; // մ + break; + } + + if (pRDat[i++] != LOBYTE(len)) // LEN_L + { + result = -3; // մ + break; + } + } + + if (cmd == MODBUS_RD || // + cmd == MODBUS_WR || // д + 0) + { + for (j = 0; j < len; j++) + { + pData[j] = MAKEWORD(pRDat[i+1], pRDat[i]); + i += 2; + } + } + + checkcrc = ModbusCrc16(&pRDat[0], i); + + if (pRDat[i++] != HIBYTE(checkcrc)) // LRC_H + { + result = -3; // մ + break; + } + + if (pRDat[i++] != LOBYTE(checkcrc)) // LRC_L + { + result = -3; // մ + break; + } + + if (result == 0) + { + result = len; + } + break; + } + } + else if (result < 0) + { + if (result == -1) // + { + printf("para error\r\n"); + } + else if (result == -2) // ûгʼ + { + printf("usart is not inited\r\n"); + } + else if (result == -3) // ջƴ + { + printf("usart receive buf ctrl error\r\n"); + } + else + { + } + result = -4; + break; + } + else if (result > 0) + { + printf("receive data len error\r\n"); + result = -3; + break; + } + else // result == 0 + { + } + + if (steps == -1) + { + // ȴ + DelayUs(g_modBusMCtrl[midx].modBusWait); + + if (timeout-- <= 0) + { + printf("2. call ModbusRx timeout, index=%d\r\n", index); + result = -2; //ճʱ + break; + } + } + else + { + result = 0; + break; + } + + }while(1); + } + + if (result == -3) // մ + { + printf("Rx data error, index=%d\r\n", index); + } + + return result; +} + +//----------------------------------------------------------------- +// :һMODBUSЭ,ȴذ +// : +// index: վ: 1~247(ʮ) +// cmd: : 03H () +// 06H (д) +// addr: ʼַ: 0000H~FFFFH +// pWrDat: д +// wLen: д볤 λ: +// pRdBuf: ذָ: +// rLen: ȡ(ذ)ݳ: λ: + +// ֵ: >=0:(޻ذ,򷵻0;лذ,򷵻ݳ) +// -1: +// -2: ճʱ +// -3: մ + +int ModbusComm(int midx, u8 index, u8 cmd, u16 addr, u16 * pWrDat, u16 wLen, u16 * pRdBuf, u16 rLen) +{ + int result; + u16 rdatabuf[MDBSRXLEN_MAX]; + + if (cmd != MODBUS_RD) // 20231027 + { + if (pWrDat == NULL || wLen == 0) + { + return -1; + } + } + + if (cmd == MODBUS_RD) + { + result = ModbusTx(midx, index, cmd, addr, &rLen, 1, -1); + } + else + { + result = ModbusTx(midx, index, cmd, addr, pWrDat, wLen, -1); + } + + if (result == 0) + { + // ȴذ + if (index != 0 && + ((index & 0x80) == 0 || cmd == MODBUS_RD) && + 1) + { + if (pRdBuf == NULL) + { + result = ModbusRx(midx, index, cmd, addr, rdatabuf, rLen, -1); + } + else + { + result = ModbusRx(midx, index, cmd, addr, pRdBuf, rLen, -1); + } + } + } + + return result; +} + +//----------------------------------------------------------------- +// :16λݶд + +int ModbusComm16(int midx, u8 index, u8 cmd, u16 addr, u16 wrDat, u16 * pData) +{ + int i,rst; + + for (i = 0; i < 3; i++) + { + rst = ModbusComm(midx, index, cmd, addr, &wrDat, 1, pData, 1); + DelayMs(1); + if (rst >= 0) + { + break; + } + } + return rst; +} + +//----------------------------------------------------------------- +// :32λݶд +int ModbusComm32(int midx, u8 index, u8 cmd, u16 addr, u32 wrDat, u32 * pData) +{ + int i,rst; + + if (cmd == MODBUS_WR) + {//дת + cmd = MODBUS_WR_MULTI; + } + + for (i = 0; i < 3; i++) + { + rst = ModbusComm(midx, index, cmd, addr, (u16*)(&wrDat), 2, (u16*)pData, 2); + DelayMs(1); + if (rst >= 0) + { + break; + } + } + + return rst; +} + +int ModbusCommMulti(int midx, u8 index, u8 cmd, u16 addr, u16 * pWrDat, u8 wlen, u16 * pRdDat, u8 rlen) +{ + int i,rst; + + if (cmd == MODBUS_WR) + {//дת + cmd = MODBUS_WR_MULTI; + } + + for (i = 0; i < 3; i++) + { + rst = ModbusComm(midx, index, cmd, addr, pWrDat, wlen, pRdDat, rlen); + DelayMs(1); + if (rst >= 0) + { + break; + } + } + + return rst; +} + +//----------------------------------------------------------------- + +Rs485Ctrl g_rs485Ctrl; + +void InitRs485Ctrl(int rsvtimout) +{ + memset(&g_rs485Ctrl, 0, sizeof(Rs485Ctrl)); + + // ȡʱʱ + if (rsvtimout < 50) + { + g_rs485Ctrl.modrsvTimout = 50; + } + else if (rsvtimout > 500) + { + g_rs485Ctrl.modrsvTimout = 500; + } + else + { + g_rs485Ctrl.modrsvTimout = rsvtimout; + } +} + +void RegRsCmdProc(Resv485ExProc proc) +{ + g_rs485Ctrl.resv485exproc = proc; +} + +int AddRs485Cmd(Rs485Cmd * pCmd) +{ + Rs485Ctrl * p485Ctrl = &g_rs485Ctrl; + + if (p485Ctrl != NULL && pCmd != NULL) + { + if (p485Ctrl->bufCmdNum < MAX_485CMD && p485Ctrl->bufTail < MAX_485CMD) + { + memcpy(&(p485Ctrl->cmdbuf[p485Ctrl->bufTail]), pCmd, sizeof(Rs485Cmd)); + p485Ctrl->bufTail++; + if (p485Ctrl->bufTail >= MAX_485CMD) + { + p485Ctrl->bufTail = 0; + } + p485Ctrl->bufCmdNum++; + return p485Ctrl->bufCmdNum; + } + return -2; + } + + return -1; +} + +int GetRs485CmdBufLen(void) +{ + return g_rs485Ctrl.bufCmdNum; +} + +int Rs485Task(void) +{ + // ֲִ + int rslt; + u32 curIime; + + Rs485Cmd *pCmd; + + Rs485Ctrl * p485Ctrl = &g_rs485Ctrl; + + if (p485Ctrl == NULL) + { + return -1; + } + + pCmd = &(p485Ctrl->cmdbuf[p485Ctrl->bufHead]); + + // ȡǰʱ + curIime = GetUsSoftTimer(); + + if ((curIime - p485Ctrl->stepTime) > g_modBusMCtrl[pCmd->midx].modBusWait) + { + p485Ctrl->stepTime = curIime; + + if (p485Ctrl->working == 0 && + p485Ctrl->bufCmdNum > 0 && + p485Ctrl->steps == 0) + { + p485Ctrl->working = 1; + p485Ctrl->steps = 1; + } + + if (p485Ctrl->working == 0) + { + p485Ctrl->steps = 0; + return 0; + } + + if (p485Ctrl->steps > 0 && p485Ctrl->steps < 5) + { + if (pCmd->cmd == MODBUS_RD) + { + rslt = ModbusTx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, &(pCmd->rlen), 1, p485Ctrl->steps); + } + else + { + rslt = ModbusTx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->wrdat, pCmd->wlen, p485Ctrl->steps); + } + + if (rslt == p485Ctrl->steps) + { + p485Ctrl->steps++; + } + } + else if (p485Ctrl->steps >= 5 && p485Ctrl->steps < p485Ctrl->modrsvTimout) + { + // ȴذ + if (pCmd->index != 0 && + ((pCmd->index & 0x80) == 0 || pCmd->cmd == MODBUS_RD) && + 1) + { + if (pCmd->cmd == MODBUS_RD) + { + rslt = ModbusRx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->rddat, pCmd->rlen, 1); + } + else + { + rslt = ModbusRx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->rddat, 1, 1); + } + if (rslt == pCmd->rlen) // ȷ + { + // ִжݺ + if (p485Ctrl->resv485exproc != NULL) + { + p485Ctrl->resv485exproc(pCmd); + } + p485Ctrl->steps = p485Ctrl->modrsvTimout; + } + else + { + p485Ctrl->steps++; + } + } + else + { + p485Ctrl->steps = p485Ctrl->modrsvTimout; + } + } + else + { + p485Ctrl->steps++; + } + + if (p485Ctrl->steps >= p485Ctrl->modrsvTimout) + { + if (p485Ctrl->bufCmdNum > 0) + { + p485Ctrl->bufCmdNum--; + } + p485Ctrl->steps = 0; + p485Ctrl->working = 0; + p485Ctrl->bufHead++; + if (p485Ctrl->bufHead >= MAX_485CMD) + { + p485Ctrl->bufHead = 0; + } + } + } + return p485Ctrl->steps; +} + +//----------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/modbus/modbus_m.h b/NxFuncs/modbus/modbus_m.h new file mode 100644 index 0000000..d6fb38b --- /dev/null +++ b/NxFuncs/modbus/modbus_m.h @@ -0,0 +1,34 @@ + +#ifndef __MODBUS_M_H__ +#define __MODBUS_M_H__ + +#include "modbus_def.h" + +//---------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------------- + +// ܣʼ modbus ͨѶ +void InitModbus_m(int midx, int usart, BAUD_TypeDef baud, char dat, char parity, char stop,char mode); + +int ModbusTx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps); // :һMODBUSЭ +int ModbusRx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps); // :һMODBUSЭӦ + +int ModbusComm16(int midx, u8 index, u8 cmd, u16 addr, u16 wrDat, u16 * pData); // :16λݶд +int ModbusComm32(int midx, u8 index, u8 cmd, u16 addr, u32 wrDat, u32 * pData); // :32λݶд +int ModbusCommMulti(int midx, u8 index, u8 cmd, u16 addr, u16 * pWrDat, u8 wlen, u16 * pRdDat, u8 rlen); + +//---------------------------------------------------------------------------------------------- + +void InitRs485Ctrl(int rsvtimout); +void RegRsCmdProc(Resv485ExProc proc); +int AddRs485Cmd(Rs485Cmd * pCmd); +int GetRs485CmdBufLen(void); +int Rs485Task(void); + + +#endif + + diff --git a/NxFuncs/modbus/modbus_s.c b/NxFuncs/modbus/modbus_s.c new file mode 100644 index 0000000..99c1088 --- /dev/null +++ b/NxFuncs/modbus/modbus_s.c @@ -0,0 +1,1204 @@ + +#include "modbus_s.h" + +#ifdef MODBUS_S_PORT + +#include "inout.h" +#include "delay.h" +#include "trigger.h" + +//----------------------------------------------------------------- +// ƽṹ +u16 * mdbsReg[MODBUS_REG_MAX - MODBUS_REG_MIN + 1] = {NULL}; // Modbus 豸ַռ + +ModbusCtrl g_modBusSCtrl; +Rs485Ctrl g_rs485SCtrl; + +int ModbusSTx(Rs485Cmd * pCmd); // :һMODBUSЭӦ +int ModbusSRx(u8 rDat); // :һMODBUSЭ + +int AddModbusSCmd(Rs485Cmd * pCmd); //  +int GetModbusSCmd(Rs485Cmd * pCmd); // Ӷжȡ +int GetModbusSCmdBufLen(void); // õ + +void ReadModbusSData(u16 addr, u16 * pBuf, u16 len); // +void WriteModbusSData(u16 addr, u16 * pBuf, u16 len); // д + +//----------------------------------------------------------------- + +/*----------------------------------------------------------------- +:ʼ Modbus 豸 +baud : +dat: ݳ +parity: Уλ +stop: ֹͣλ +mode: ģʽ +*/ +void InitModbusS(BAUD_TypeDef baud, char dat, char parity, char stop, char mode) +{ + memset(&g_modBusSCtrl, 0, sizeof(ModbusCtrl)); + + if (mode == 'A' || mode == 'a') + { + g_modBusSCtrl.modBusMode = 1; + } + else + { + g_modBusSCtrl.modBusMode = 0; + } + + // ʱ + switch(baud) + { + // λ + 1ʼλ + żУλ(Уû) + ֹͣλ + // ݲ ͨѶʱ, λus = 10000000 / baud(һֽ10λ, 8 N 1) + case B4800: + { + g_modBusSCtrl.modBusWait = 2200; + break; + } + case B9600: + { + g_modBusSCtrl.modBusWait = 1100; + break; + } + case B14400: + { + g_modBusSCtrl.modBusWait = 750; + break; + } + case B19200: + { + g_modBusSCtrl.modBusWait = 600; + break; + } + case B38400: + { + g_modBusSCtrl.modBusWait = 300; + break; + } + case B57600: + { + g_modBusSCtrl.modBusWait = 200; + break; + } + case B115200: + { + g_modBusSCtrl.modBusWait = 100; + break; + } + case B230400: + { + g_modBusSCtrl.modBusWait = 50; + break; + } + case B460800: + { + g_modBusSCtrl.modBusWait = 25; + break; + } + case B921600: + { + g_modBusSCtrl.modBusWait = 13; + break; + } + default: + { + g_modBusSCtrl.modBusWait = 0; + } + } + if ((dat == '8') && (parity != 'N') && (parity != 'n')) // 7λݹУλ + { + g_modBusSCtrl.filterChk = 1; // Уλ־ 1, + } + else + { + g_modBusSCtrl.filterChk = 0; + } + + +#ifndef USART1_485OutEn +#define USART1_485OutEn DefOutEn +#endif + +#ifndef USART1_485OutDis +#define USART1_485OutDis DefOutDis +#endif + +#ifndef USART2_485OutEn +#define USART2_485OutEn DefOutEn +#endif + +#ifndef USART2_485OutDis +#define USART2_485OutDis DefOutDis +#endif + +#ifndef USART3_485OutEn +#define USART3_485OutEn DefOutEn +#endif + +#ifndef USART3_485OutDis +#define USART3_485OutDis DefOutDis +#endif + +#ifndef USART4_485OutEn +#define USART4_485OutEn DefOutEn +#endif + +#ifndef USART4_485OutDis +#define USART4_485OutDis DefOutDis +#endif + +#ifndef USART5_485OutEn +#define USART5_485OutEn DefOutEn +#endif + +#ifndef USART5_485OutDis +#define USART5_485OutDis DefOutDis +#endif + +#ifndef USART6_485OutEn +#define USART6_485OutEn DefOutEn +#endif + +#ifndef USART6_485OutDis +#define USART6_485OutDis DefOutDis +#endif + + // ʼ +#if (MODBUS_S_PORT == COMM_USART1) + InitUsart1(baud, dat, parity, stop); // 1 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart1SendData, Usart1GetData, Usart1CleanRsBuf, IsUsart1SendOver, USART1_485OutEn, USART1_485OutDis); +#elif (MODBUS_S_PORT == COMM_USART2) + InitUsart2(baud, dat, parity, stop); // 2 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart2SendData, Usart2GetData, Usart2CleanRsBuf, IsUsart2SendOver, USART2_485OutEn, USART2_485OutDis); +#elif (MODBUS_S_PORT == COMM_USART3) + InitUsart3(baud, dat, parity, stop); // 3 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart3SendData, Usart3GetData, Usart3CleanRsBuf, IsUsart3SendOver, USART3_485OutEn, USART3_485OutDis); +#elif (MODBUS_S_PORT == COMM_USART4) + InitUsart4(baud, dat, parity, stop); // 4 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart4SendData, Usart4GetData, Usart4CleanRsBuf, IsUsart4SendOver, USART4_485OutEn, USART4_485OutDis); +#elif (MODBUS_S_PORT == COMM_USART5) + InitUsart5(baud, dat, parity, stop); // 5 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart5SendData, Usart5GetData, Usart5CleanRsBuf, IsUsart5SendOver, USART5_485OutEn, USART5_485OutDis); +#elif (MODBUS_S_PORT == COMM_USART6) + InitUsart6(baud, dat, parity, stop); // 6 + RegisterModbusCommFunc(&g_modBusSCtrl, Usart6SendData, Usart6GetData, Usart6CleanRsBuf, IsUsart6SendOver, USART6_485OutEn, USART6_485OutDis); +#else + RegisterModbusCommFunc(&g_modBusSCtrl, DefSendData, DefGetData, DefCleanRsBuf, DefIsSendOver, DefOutEn, DefOutDis); +#endif + + g_modBusSCtrl.CommOutDis(); // رշ +} + +/*----------------------------------------------------------------- +:һASCIIʽMODBUSЭӦ,Ӧ03 +*/ +int Modbus_TX03A(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_A]; // + u8 Lrc_check = 0; // У + u16 data[MODBUS_REG_MAX - MODBUS_REG_MIN + 1] = {0}; + u8 temp; // ʱ + u8 temp_data; // ʱ + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = ':'; //':' + + temp_data = pCmd->index; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_L + Lrc_check += temp_data; + + temp_data = pCmd->cmd; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_L + Lrc_check += temp_data; + + //ݸ + temp_data = pCmd->rlen << 1; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Bytes Count_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Bytes Count_L + Lrc_check += temp_data; + + //ֽ + ReadModbusSData(pCmd->addr, &data[0], pCmd->rlen); + for (int j = 0; j < pCmd->rlen; j++) + { + temp_data = HIBYTE(data[j]); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); + Lrc_check += temp_data; + + temp_data = LOBYTE(data[j]); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); + Lrc_check += temp_data; + } + + Lrc_check = ~Lrc_check + 1; + pSDat[i++] = RtuToAscii(HIHFBYTE(Lrc_check)); //LRC_H + pSDat[i++] = RtuToAscii(LOHFBYTE(Lrc_check)); //LRC_L + pSDat[i++] = 0x0D; //CR + pSDat[i++] = 0x0A; //LF + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + + +/*----------------------------------------------------------------- +:һASCIIʽMODBUSЭӦ,Ӧ06 +*/ +int Modbus_TX06A(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_A]; // + u8 Lrc_check = 0; //У + u8 temp; //ʱ + u8 temp_data; //ʱ + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = ':'; //':' + + temp_data = pCmd->index; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_L + Lrc_check += temp_data; + + temp_data = pCmd->cmd; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_L + Lrc_check += temp_data; + + temp_data = HIBYTE(pCmd->addr); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_L + Lrc_check += temp_data; + + temp_data = LOBYTE(pCmd->addr); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_L + Lrc_check += temp_data; + + temp_data = HIBYTE(pCmd->wrdat[0]); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Data_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Data_L + Lrc_check += temp_data; + + temp_data = LOBYTE(pCmd->wrdat[0]); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Data_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Data_L + Lrc_check += temp_data; + + Lrc_check = ~Lrc_check + 1; + pSDat[i++] = RtuToAscii(HIHFBYTE(Lrc_check)); //LRC_H + pSDat[i++] = RtuToAscii(LOHFBYTE(Lrc_check)); //LRC_L + pSDat[i++] = 0x0D; //CR + pSDat[i++] = 0x0A; //LF + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + +/*----------------------------------------------------------------- +:һASCIIʽMODBUSЭӦ,Ӧ10H +*/ +int Modbus_TX10A(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_A]; // + u8 Lrc_check = 0; //У + u8 temp; //ʱ + u8 temp_data; //ʱ + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = ':'; //':' + + temp_data = pCmd->index; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //IDX_L + Lrc_check += temp_data; + + temp_data = pCmd->cmd; + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //CMD_L + Lrc_check += temp_data; + + temp_data = HIBYTE(pCmd->addr); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_L + Lrc_check += temp_data; + + temp_data = LOBYTE(pCmd->addr); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //Addr_L + Lrc_check += temp_data; + + temp_data = HIBYTE(pCmd->wlen); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //len_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //len_L + Lrc_check += temp_data; + + temp_data = LOBYTE(pCmd->wlen); + temp = HIHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //len_H + temp = LOHFBYTE(temp_data); + pSDat[i++] = RtuToAscii(temp); //len_L + Lrc_check += temp_data; + + Lrc_check = ~Lrc_check + 1; + pSDat[i++] = RtuToAscii(HIHFBYTE(Lrc_check)); //LRC_H + pSDat[i++] = RtuToAscii(LOHFBYTE(Lrc_check)); //LRC_L + pSDat[i++] = 0x0D; //CR + pSDat[i++] = 0x0A; //LF + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + +/*----------------------------------------------------------------- +:һRTUʽMODBUSЭӦ,Ӧ03 +*/ +int Modbus_TX03R(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_R]; // + u16 checkcrc; //crcУ + u16 data[MODBUS_REG_MAX - MODBUS_REG_MIN + 1] = {0}; + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = pCmd->index; // ADR + pSDat[i++] = pCmd->cmd; // CMD + + pSDat[i++] = pCmd->rlen << 1; // ֽ + + ReadModbusSData(pCmd->addr, &data[0], pCmd->rlen); + for (int j = 0; j < pCmd->rlen; j++) + { + pSDat[i++] = HIBYTE(data[j]); // DATA_H + pSDat[i++] = LOBYTE(data[j]); // DATA_L + } + + checkcrc = ModbusCrc16(&pSDat[0], i); + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + +/*----------------------------------------------------------------- +:һRTUʽMODBUSЭӦ,Ӧ06 +*/ +int Modbus_TX06R(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_R]; // + u16 checkcrc; //crcУ + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = pCmd->index; // ADR + pSDat[i++] = pCmd->cmd; // CMD + pSDat[i++] = HIBYTE(pCmd->addr); // ADDR_H + pSDat[i++] = LOBYTE(pCmd->addr); // ADDR_L + + pSDat[i++] = HIBYTE(pCmd->wrdat[0]); // DATA_H + pSDat[i++] = LOBYTE(pCmd->wrdat[0]); // DATA_L + + checkcrc = ModbusCrc16(&pSDat[0], i); + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + +/*----------------------------------------------------------------- +:һRTUʽMODBUSЭӦ,Ӧ10H +*/ +int Modbus_TX10R(Rs485Cmd * pCmd) +{ + int i = 0; + u8 pSDat[MDBSRXLEN_R]; // + u8 checkcrc; //crcУ + + if (pCmd == NULL) + { + return -1; + } + + pSDat[i++] = pCmd->index; // ADR + pSDat[i++] = pCmd->cmd; // CMD + pSDat[i++] = HIBYTE(pCmd->addr); // ADDR_H + pSDat[i++] = LOBYTE(pCmd->addr); // ADDR_L + + // ݸ,λ + pSDat[i++] = HIBYTE(pCmd->wlen); // LEN_H + pSDat[i++] = LOBYTE(pCmd->wlen); // LEN_L + + checkcrc = ModbusCrc16(&pSDat[0], i); + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + + g_modBusSCtrl.ModBusCommSend(pSDat, i); // ݷ뷢ͻ + + return 0; +} + +//----------------------------------------------------------------- +// :һMODBUSЭĻذ,ݷ뷢ͻ +// : pCmd: +// ֵ: 0: +// -1: + +int ModbusSTx(Rs485Cmd * pCmd) +{ + int result = 0; + u8 cmd; + + if (pCmd == NULL) + { + return -1; + } + + cmd = pCmd->cmd; + + if ((cmd != MODBUS_RD) && + (cmd != MODBUS_WR) && + (cmd != MODBUS_WR_MULTI) && + 1) + { + return -1; + } + + if (pCmd->index != 0 && + ((pCmd->index & 0x80) == 0 || cmd == MODBUS_RD) && + 1) + { + if (g_modBusSCtrl.modBusMode != 0) + {// ASCIIģʽ + if (cmd == MODBUS_RD) + { + Modbus_TX03A(pCmd); + } + else if (cmd == MODBUS_WR) + { + Modbus_TX06A(pCmd); + } + else if (cmd == MODBUS_WR_MULTI) + { + Modbus_TX10A(pCmd); + } + } + else + {// RTUģʽ + if (cmd == MODBUS_RD) + { + Modbus_TX03R(pCmd); + } + else if (cmd == MODBUS_WR) + { + Modbus_TX06R(pCmd); + } + else if (cmd == MODBUS_WR_MULTI) + { + Modbus_TX10R(pCmd); + } + } + } + + return result; +} + +//----------------------------------------------------------------- +// :һMODBUSЭ +// : +// rDat: յĴ + +// ֵ: 0: (յ Rs485Cmd cmdbuf[MAX_485CMD] ) + +int ModbusSRx(u8 rDat) +{ + int i; + int rst = -1; + u32 time; + static u32 timeBuf = 0; + static u8 rxDat[MDBSRXLEN_MAX] = {0}; // ݻ + static u8 beg = 0; // յʼ + static u16 idx = 0; // Ч + static u16 num = 0; // յַ + static u8 rxDat_H = 0; // ǰֽ + + u16 checkcrc = 0; // crcУ(RTU) + u8 checksum = 0; // У(ASCII) + + Rs485Cmd newCmd; + + memset(&newCmd, 0, sizeof(Rs485Cmd)); + + if (g_modBusSCtrl.modBusMode != 0) + {// ASCIIģʽ + if (g_modBusSCtrl.filterChk != 0) // 7λݹУλ + { + rDat &= (0x7F); + } + + time = GetUsSoftTimer(); + + if (((time - timeBuf) > (g_modBusSCtrl.modBusWait * g_rs485SCtrl.modrsvTimout)) || // ȡʱʱ + (idx > MDBSRXLEN_A) || // λ + 0) + {// ½ݰ + beg = 0; + idx = 0; + num = 1; + } + else + { + num++; + } + + timeBuf = time; + + if (((rDat == ':') || (rDat == 0x0D) || (rDat == 0x0A)) || + ((rDat >= '0') && (rDat <= '9')) || + ((rDat >= 'a') && (rDat <= 'f')) || + ((rDat >= 'A') && (rDat <= 'F')) || + 0) + {// յȷ + if (beg == 1) + { + idx++; + } + } + else + {// ½ݰ + beg = 0; + idx = 0; + } + + if (rDat == ':') + {// յʼ + beg = 1; + idx = 0; + } + else if (rDat != 0x0A) + {// յͨ + if ((idx & 0x01) == 0) + {//յż,ת + rxDat[(idx >> 1)-1] = MAKEBYTE(AsciiToRtu(rDat),AsciiToRtu(rxDat_H)); + } + else + {//յ,ݴŵʱĴ + rxDat_H = rDat; + } + } + else if (rDat == 0x0A) // \n + {// յֹ + if (rxDat_H == 0x0D) // \r + {// ֹ + if ((idx & 0x01) == 0) + {//ݸҪ + idx = (idx >> 1) - 2; //ȷЧС(Уλ) + + //УǷȷ + checksum = 0; + for (i = 0; i < idx; i++) + { + checksum += rxDat[i]; + } + checksum = ~checksum + 1; + + if(checksum == rxDat[idx]) + {//lrcУȷ + u8 index = rxDat[0]; // վ + int cur = 0; + + index &= 0x7f; + for (i = 0; i < g_rs485SCtrl.idxNum; i++) + {// ǷǷԼ + if ((index == 0) || + (index == g_rs485SCtrl.idxList[i]) || + 0) + { + cur = 1; + break; + } + } + + if(cur == 1) + {//վȷ + //ж + newCmd.index = rxDat[0]; // վ + newCmd.cmd = rxDat[1]; // + newCmd.addr = MAKEWORD(rxDat[3],rxDat[2]); // ݵַ + + switch(newCmd.cmd) + { + case MODBUS_RD: // 03H (ȡּĴ) + { + newCmd.rlen = MAKEWORD(rxDat[5],rxDat[4]); //ݳ + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + case MODBUS_WR: // 06H (дּĴ) + { + newCmd.wrdat[0] = MAKEWORD(rxDat[5],rxDat[4]); // + newCmd.wlen = 1; //ݳ + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + case MODBUS_WR_MULTI: // 10H (дּĴ) + { + newCmd.wlen = MAKEWORD(rxDat[5],rxDat[4]); //ݳ + for (i = 0; i < (rxDat[6]/2); i++) + { + newCmd.wrdat[i] = MAKEWORD(rxDat[i*2+8],rxDat[i*2+7]); // + } + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + default: + break; + } //switch(newCmd.cmd) + } //if (cur == 1) + } //if (checksum == rxDat[idx]) + } //if ((idx & 0x01) == 0) + } //if (rxDat_H == 0x0D) + idx = 0; + beg = 0; // ½ݰ + } //if (rDat == 0x0A) + } + else + {// RTUģʽ + time = GetUsSoftTimer(); + + if (((time - timeBuf) > (g_modBusSCtrl.modBusWait * g_rs485SCtrl.modrsvTimout)) || // ȡʱʱ + (idx > (MDBSRXLEN_R)) || // λ + 0) + {// ½ݰ + if (num > 1) + { + printf("data packet restart, old num=%d, rDat=0x%x\r\n", num, rDat); + } + idx = 0; + num = 1; + } + else + { + num++; + } + + timeBuf = time; + + int receive = 0; // ɱ־ + + if (num < 8) // δ + { + rxDat[idx] = rDat; + idx++; + } + else if (num >= 8) + { + u16 len; + + if (rxDat[1] == MODBUS_WR_MULTI) + { + len = 9 + rxDat[6]; + } + else + { + len = 8; + } + + if (num < len) // δ + { + rxDat[idx] = rDat; + idx++; + } + else // + { + rxDat[idx] = rDat; + receive = 1; + } + } + + if (receive == 1) + { + /* + printf("receive a RTU modbus packet:"); + for (int j = 0; j < num; j++) + { + printf("\t0x%x", rxDat[j]); + } + printf("\r\n"); + */ + + //УǷȷ + checkcrc = ModbusCrc16(&rxDat[0], num-2); + + if (rxDat[num-2] == HIBYTE(checkcrc) && rxDat[num-1] == LOBYTE(checkcrc)) + {//crcУȷ + u8 index = rxDat[0]; // վ + int cur = 0; + + index &= 0x7f; // ֻС128վ + for (i = 0; i < g_rs485SCtrl.idxNum; i++) + {// ǷǷԼ + if ((index == 0) || + (index == g_rs485SCtrl.idxList[i]) || + 0) + { + cur = 1; + break; + } + } + + if(cur == 1) + {//վȷ + newCmd.index = rxDat[0]; // վ + newCmd.cmd = rxDat[1]; // + newCmd.addr = MAKEWORD(rxDat[3],rxDat[2]); // ݵַ + + switch(newCmd.cmd) + { + case MODBUS_RD: // 03H (ȡּĴ) + { + newCmd.rlen = MAKEWORD(rxDat[5],rxDat[4]); //ݳ + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + case MODBUS_WR: // 06H (дּĴ) + { + newCmd.wrdat[0] = MAKEWORD(rxDat[5],rxDat[4]); // + newCmd.wlen = 1; //ݳ + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + case MODBUS_WR_MULTI: // 10H (дּĴ) + { + newCmd.wlen = MAKEWORD(rxDat[5],rxDat[4]); //ݳ + for (i = 0; i < newCmd.wlen; i++) + { + newCmd.wrdat[i] = MAKEWORD(rxDat[8+i*2], rxDat[7+i*2]); // + } + AddModbusSCmd(&newCmd); // + rst = 0; + break; + } + + default: + break; + } + } + else + { + printf("index error, index=%d\r\n", index); + } + } + else + { + printf("check crc error, calc crc:0x%x 0x%x, receive crc:0x%x 0x%x\r\n", + HIBYTE(checkcrc), LOBYTE(checkcrc), rxDat[num-2], rxDat[num-1]); + } + idx = 0; + num = 0; // ½ݰ + } + } + + return rst; +} + +//----------------------------------------------------------------- + +// idx վ +void InitModbusSCtrl(u8 idx, int rsvtimout) +{ + memset(&g_rs485SCtrl, 0, sizeof(Rs485Ctrl)); + + g_rs485SCtrl.init = 1; // ʼ + g_rs485SCtrl.idxList[g_rs485SCtrl.idxNum] = idx; // վ + g_rs485SCtrl.idxNum++; + + // ȡʱʱ + if (rsvtimout < 10) + { + g_rs485SCtrl.modrsvTimout = 10; + } + else if (rsvtimout > 100) + { + g_rs485SCtrl.modrsvTimout = 100; + } + else + { + g_rs485SCtrl.modrsvTimout = rsvtimout; + } +} + +// עⲿӦ +void RegModbusSCmdProc(Resv485ExProc exProc) +{ + g_rs485SCtrl.resv485exproc = exProc; +} + +// Ӹվ +void AddModbusSIdx(u8 idx) +{ + if (g_rs485SCtrl.idxNum < MODBUS_IDXMAX) + { + g_rs485SCtrl.idxList[g_rs485SCtrl.idxNum] = idx; // վ + g_rs485SCtrl.idxNum++; + } +} + +// 뻺 +int AddModbusSCmd(Rs485Cmd * pCmd) +{ + Rs485Ctrl * p485Ctrl = &g_rs485SCtrl; + + if (p485Ctrl != NULL && pCmd != NULL) + { + if (p485Ctrl->bufCmdNum < MAX_485CMD && p485Ctrl->bufTail < MAX_485CMD) + { + memcpy(&(p485Ctrl->cmdbuf[p485Ctrl->bufTail]), pCmd, sizeof(Rs485Cmd)); + p485Ctrl->bufTail++; + if (p485Ctrl->bufTail >= MAX_485CMD) + { + p485Ctrl->bufTail = 0; + } + p485Ctrl->bufCmdNum++; + return p485Ctrl->bufCmdNum; + } + return -2; + } + + return -1; +} + +// õһڵ +int GetModbusSCmd(Rs485Cmd * pCmd) +{ + Rs485Ctrl * p485Ctrl = &g_rs485SCtrl; + + if (p485Ctrl != NULL && pCmd != NULL) + { + if (p485Ctrl->bufCmdNum > 0 && p485Ctrl->bufHead < MAX_485CMD) + { + memcpy(pCmd, &(p485Ctrl->cmdbuf[p485Ctrl->bufHead]), sizeof(Rs485Cmd)); + p485Ctrl->bufHead++; + if (p485Ctrl->bufHead >= MAX_485CMD) + { + p485Ctrl->bufHead = 0; + } + p485Ctrl->bufCmdNum--; + return p485Ctrl->bufCmdNum; + } + else + { + return -2; + } + } + + return -1; +} + +int GetModbusSCmdBufLen(void) +{ + return g_rs485SCtrl.bufCmdNum; +} + +// modbus豸,첽Ӧ +int ModbusSTask(void) +{ + static u32 lastTime; // λus + + static Rs485Cmd cmd; + + Rs485Ctrl * p485Ctrl = &g_rs485SCtrl; + + if (p485Ctrl == NULL) + { + return -1; + } + + if (p485Ctrl->init == 0) + {// ûгʼ,ֱ + return -1; + } + + switch(p485Ctrl->steps) + { + case 0: // ״̬ + { + if (1) + {// մڻ + u8 rDat; + int len; + int rslt; + do + { + len = g_modBusSCtrl.ModBusCommReceive(&rDat, 1); // ӻȡ + if (len == 1) + {// յ + rslt = ModbusSRx(rDat); + if (rslt == 0) + {// յһݰ + break; + } + } + else + { + break; + } + }while(1); + } + + if (GetModbusSCmdBufLen() != 0)// + { + memset(&cmd, 0, sizeof(Rs485Cmd)); + GetModbusSCmd(&cmd); // õ + if (cmd.index != 0 && + ((cmd.index & 0x80) == 0 || cmd.cmd == MODBUS_RD) && + 1) + {// Ҫذ + lastTime = GetUsSoftTimer(); + p485Ctrl->steps++; + } + else + {// Ҫذ + p485Ctrl->steps = 5; + } + } + break; + } + + case 1: // ݷ + { + if ((GetUsSoftTimer() - lastTime) > (g_modBusSCtrl.modBusWait * 2)) + { + g_modBusSCtrl.CommOutEn(); + lastTime = GetUsSoftTimer(); + p485Ctrl->steps++; + } + break; + } + + case 2: // ذ + { + if (GetUsSoftTimer() - lastTime > 100) + { + ModbusSTx(&cmd); + p485Ctrl->steps++; + } + break; + } + + case 3: // ȴ + { + if (g_modBusSCtrl.IsModBusCommSendOver() == TRUE) + { + lastTime = GetUsSoftTimer(); + p485Ctrl->steps++; + } + break; + } + + case 4: // ȴһֽڷ + { + if ((GetUsSoftTimer() - lastTime) > (g_modBusSCtrl.modBusWait * 2)) + { + p485Ctrl->steps++; + } + break; + } + + case 5: // ִⲿ + { + g_modBusSCtrl.CommOutDis(); // ݷͽֹ + if (cmd.cmd == MODBUS_WR || cmd.cmd == MODBUS_WR_MULTI) + { + WriteModbusSData(cmd.addr, &cmd.wrdat[0], cmd.wlen); + } + if (g_rs485SCtrl.resv485exproc != NULL) + { + g_rs485SCtrl.resv485exproc(&cmd); + } + else + { + printf("resv485exproc is NULL\r\n"); + } + p485Ctrl->steps = 0; + break; + } + + default: + { + g_modBusSCtrl.CommOutDis(); // ݷͽֹ + p485Ctrl->steps = 0; + break; + } + } + return p485Ctrl->steps; +} + + +//------------------------------------------------------------------------------------------ +// ʼĴ +int InitModbusReg(u16 addr, u16 * pBuf, u16 len) +{ + if (len != 0 && pBuf != NULL) + { + if ((addr + len - 1) > MODBUS_REG_MAX) + { + printf("[Warning]: modbus addr outsize !! addr=0x%x, max=0x%x\r\n", (addr + len - 1), MODBUS_REG_MAX); + } + else if (addr < MODBUS_REG_MIN) + { + printf("[Warning]: modbus addr outsize !! addr=0x%x, min=0x%x\r\n", addr, MODBUS_REG_MIN); + } + else + { + for (int i = addr; i < (addr+len); i++) + { + mdbsReg[i - MODBUS_REG_MIN] = pBuf++; + } + return len; + } + } + return 0; +} + +// +void ReadModbusSData(u16 addr, u16 * pBuf, u16 len) +{ + if (len != 0 && pBuf != NULL) + { + if ((addr + len - 1) > MODBUS_REG_MAX) + { + printf("[Warning]: modbus addr outsize !! addr=0x%x, max=0x%x\r\n", (addr + len - 1), MODBUS_REG_MAX); + } + else if (addr < MODBUS_REG_MIN) + { + printf("[Warning]: modbus addr outsize !! addr=0x%x, min=0x%x\r\n", addr, MODBUS_REG_MIN); + } + else + { + for (int i = addr; i < (addr+len); i++) + { + if (mdbsReg[i - MODBUS_REG_MIN] == NULL) + { + printf("[Warning]: modbus addr NULL !! addr=0x%x\r\n", i); + } + else + { + *pBuf++ = *mdbsReg[i - MODBUS_REG_MIN]; + } + } + } + } +} + +// д +void WriteModbusSData(u16 addr, u16 * pBuf, u16 len) +{ + if (len != 0 && pBuf != NULL) + { + if ((addr + len - 1) > MODBUS_REG_MAX) + { + //printf("[Warning]: modbus addr outsize !! addr=0x%x, max=0x%x\r\n", (addr + len - 1), MODBUS_REG_MAX); + } + else if (addr < MODBUS_REG_MIN) + { + //printf("[Warning]: modbus addr outsize !! addr=0x%x, min=0x%x\r\n", addr, MODBUS_REG_MIN); + } + else + { + for (int i = addr; i < (addr+len); i++) + { + if (mdbsReg[i - MODBUS_REG_MIN] == NULL) + { + //printf("[Warning]: modbus addr NULL !! addr=0x%x\r\n", i); + } + else + { + *mdbsReg[i - MODBUS_REG_MIN] = *pBuf++; + } + } + } + } +} + +#endif + diff --git a/NxFuncs/modbus/modbus_s.h b/NxFuncs/modbus/modbus_s.h new file mode 100644 index 0000000..2d43eda --- /dev/null +++ b/NxFuncs/modbus/modbus_s.h @@ -0,0 +1,30 @@ + +#ifndef __MODBUS_S_H__ +#define __MODBUS_S_H__ + +#include "modbus_def.h" + +//---------------------------------------------------------------------------------------------- + +#ifndef MODBUS_REG_MIN +#define MODBUS_REG_MIN 0 // ֵ֧ĵַռ +#endif + +#ifndef MODBUS_REG_MAX +#define MODBUS_REG_MAX 10 // ֵ֧ĵַռ +#endif + +//---------------------------------------------------------------------------------------------- + +// ܣʼ modbus S ͨѶ +void InitModbusS(BAUD_TypeDef baud, char dat, char parity, char stop,char mode); // ʼ +void InitModbusSCtrl(u8 idx, int rsvtimout); // ʼModBus豸 +void RegModbusSCmdProc(Resv485ExProc exProc); // עⲿӦ +void AddModbusSIdx(u8 idx); // Ӹվ +int InitModbusReg(u16 addr, u16 * pBuf, u16 len); + +int ModbusSTask(void); // 첽ˢº + +#endif + + diff --git a/NxFuncs/modbus/modbus_tcp.c b/NxFuncs/modbus/modbus_tcp.c new file mode 100644 index 0000000..47e9bf4 --- /dev/null +++ b/NxFuncs/modbus/modbus_tcp.c @@ -0,0 +1,196 @@ + +#include "modbus_tcp.h" +#include "trigger.h" + +#if (MAX_MODBUS_TCP_NODE > 0) +#include "ethernet.h" + +//------------------------------ + +// ݽṹ +typedef struct +{ + SocketCtrl * pSocket; + + // ƿ + int transing; // 0, ; 1, 󣬵ȴذ + u16 transId; // ͵ƣ㿪ʼ + u32 begtime; // ͵ʱ + int expectAnswerPduLen; // PDU + + // ļ¼ + ModbusTcpADU request; // + ModbusTcpADU answer; // Ӧ + +}ModbusTcpCtrl; + +//------------------------------ + +#define MODBUSTCP_SIDX TCP_CLIENT_SN_BEG + +ModbusTcpCtrl g_modbusTcpCtrl[MAX_MODBUS_TCP_NODE]; + +//------------------------------ + +// +#define ModbusTcpSendData EthernetSendData +// +#define ModbusTcpGetData EthernetGetData +// ѽݳ +#define ModbusTcpGetRsLen EthernetGetRsLen +// õͻг +#define ModbusTcpGetSdFreeLen EthernetGetSdFreeLen + +//------------------------------ + +void InitModbusTcp() +{ + int i; + memset(&g_modbusTcpCtrl, 0, sizeof(ModbusTcpCtrl)*MAX_MODBUS_TCP_NODE); + + for (i = 0; i < MAX_MODBUS_TCP_NODE; i++) + { + g_modbusTcpCtrl[i].pSocket = GetCtrlFromSocketIdx(MODBUSTCP_SIDX+i); + } +} + +// 첽ܣͻmodbustcpݣͨѶ +void ModbusTcpServerRun(void) +{ + int i; + int rslt; + ModbusTcpADU * pRequestAdu; + ModbusTcpADU * pAnswerAdu; + + for (i = 0; i < MAX_MODBUS_TCP_NODE; i++) + { + if (g_modbusTcpCtrl[i].transing == 1) // ڷͣȴذ + { + pRequestAdu = &(g_modbusTcpCtrl[i].request); + pAnswerAdu = &(g_modbusTcpCtrl[i].answer); + + rslt = ModbusTcpGetRsLen(g_modbusTcpCtrl[i].pSocket); + if (rslt >= g_modbusTcpCtrl[i].expectAnswerPduLen) + { + rslt = ModbusTcpGetData(g_modbusTcpCtrl[i].pSocket, pAnswerAdu->datbuff, g_modbusTcpCtrl[i].expectAnswerPduLen); + if (rslt == g_modbusTcpCtrl[i].expectAnswerPduLen) + { + if ( pRequestAdu->normal.transId == pAnswerAdu->normal.transId && + pRequestAdu->normal.cmd == pAnswerAdu->normal.cmd && + // + 1 ) + { + // յȷظ + printf("get ModbusTcp %d ACK\r\n", i); + } + } + g_modbusTcpCtrl[i].transing = 0; + } + else if (rslt == LEN_ERR_ANSWER) // + { + rslt = ModbusTcpGetData(g_modbusTcpCtrl[i].pSocket, pAnswerAdu->datbuff, LEN_ERR_ANSWER); + if (rslt == LEN_ERR_ANSWER) + { + if ( pRequestAdu->normal.transId == pAnswerAdu->normal.transId && + pRequestAdu->normal.cmd == (pAnswerAdu->normal.cmd | 0x80) && + // + 1 ) + { + // յظ + printf("get ModbusTcp %d NAK\r\n", i); + } + } + g_modbusTcpCtrl[i].transing = 0; + } + else if (rslt > 0) + { + printf("get ModbusTcp %d dat err len = %d\r\n", i, rslt); // Ȳ + g_modbusTcpCtrl[i].transing = 0; + } + else + { + u32 time; + time = GetMsSoftTimer(); + if (time - g_modbusTcpCtrl[i].begtime > 100) + { + printf("wait ModbusTcp %d answer timout\r\n", i); // ʱ + g_modbusTcpCtrl[i].transing = 0; + } + // ȴ + } + } + } +} + +u16 SwapHighLow(u16 data) +{ + u16 temp; + temp = LOBYTE(data); // DATA_L + temp <<= 8; + temp += HIBYTE(data); // DATA_H; + return temp; +} + +// : дĴ +int ModbusTcpWriteRegs(int nidx, u16 addr, u16 * regAry, u16 nums) +{ + int i, pdulen; + ModbusTcpADU * pRequestAdu; +// ModbusTcpADU * pAnswerAdu; + + if (nidx < 0 || nidx > MAX_MODBUS_TCP_NODE || nums < 1 || regAry == NULL) + { + printf("ModbusTcpWriteRegs trans para err, nidx=%d, nums=%d\r\n", nidx, nums); + return -1; + } + + if (g_modbusTcpCtrl[nidx].transing != 0) + { + printf("ModbusTcpWriteRegs trans at %d is busy\r\n", nidx); + return -1; + } + + if (nums > MAX_WR_REG_NUMS) + { + nums = MAX_WR_REG_NUMS; + } + pdulen = 6 + nums*2; + + pRequestAdu = &(g_modbusTcpCtrl[nidx].request); +// pAnswerAdu = &(g_modbusTcpCtrl[nidx].answer); + + //-------- + // MBAP + pRequestAdu->writeRegArrayRequest.transId = SwapHighLow(g_modbusTcpCtrl[nidx].transId); // Ԫʶ0ʼ + pRequestAdu->writeRegArrayRequest.protId = SwapHighLow(0); // ЭʶMODBUS ЭʶΪ0x000x00 + pRequestAdu->writeRegArrayRequest.len = SwapHighLow(pdulen + 1); // ֡ȡ + pRequestAdu->writeRegArrayRequest.unitId = 0x01; // Ԫʶ + + //-------- + // MODBUS PDU + pRequestAdu->writeRegArrayRequest.cmd = WRITE_MULTIPLE_REGISTER; // дĴ + pRequestAdu->writeRegArrayRequest.regBegAddr = SwapHighLow(addr); // Ĵʼλַ 0x00000xFFFF + pRequestAdu->writeRegArrayRequest.regsNum = SwapHighLow(nums); // Ĵ 0x00010x007B123 + pRequestAdu->writeRegArrayRequest.bytes = nums * 2; // ֽ N = Ĵ * 2 + for (i = 0; i < nums; i++) + { + pRequestAdu->writeRegArrayRequest.regsArray[i] = SwapHighLow(regAry[i]); // ĴֵMSB + } + + //-------- + // ¼ǰ + g_modbusTcpCtrl[nidx].transing = 1; // ʼ + g_modbusTcpCtrl[nidx].begtime = GetMsSoftTimer(); // ¼ʼ͵ʱ + g_modbusTcpCtrl[nidx].expectAnswerPduLen = 5; + + g_modbusTcpCtrl[nidx].transId++; + //-------- + // + ModbusTcpSendData(g_modbusTcpCtrl[nidx].pSocket, pRequestAdu->datbuff, LEN_MBAP+pdulen); + + return 0; +} + +#endif + + diff --git a/NxFuncs/modbus/modbus_tcp.h b/NxFuncs/modbus/modbus_tcp.h new file mode 100644 index 0000000..fbfaed5 --- /dev/null +++ b/NxFuncs/modbus/modbus_tcp.h @@ -0,0 +1,454 @@ + +#ifndef __MODBUS_TCP_H__ +#define __MODBUS_TCP_H__ + +#include "config.h" + +/* + ֡ + __________________________________________________ + | Modbus ADU | + |------------------------------------------------| + | MBAP | PDU | + |---------------------------------|--------------| + | Ԫʶ | Эʶ | | Ԫʶ | | | + || + + +Ԫʶ2ֽڣԡӦУMODBUSʶ + ̫дһ⣬ȷǿʶһTCPкţֹɵշҡ + Ȳʶͳһʹ0x000x01 +Эʶ2ֽڣMODBUS ЭʶΪ0x000x00 +ȣ2ֽڣһֽԪʶ +Ԫʶ1ֽڣ豸ıšʹÿIPַʶ + MODBUS MODBUS+·ж豸ѰַʱDZʶ豸ַ£ԪʶЯһԶ豸MODBUSվַ + MODBUSӵMODBUS+MODBUS·ͨһŻõַMODBUSԪʶʶӵŻغĴվ豸DZġ + ĿIPַʶűĵַʹMODBUSԪʶתȷĴվ豸 + 䴮·MODBUSվ豸ַΪ124710ƣַ0Ϊ㲥ַ + TCP/IP ˵IPַѰַMODBUSˣMODBUSԪʶõġʹֵ0xFF + ֱӵTCP/IPϵMODBUSѰַʱ鲻ҪڡԪʶʹЧMODBUSվַ + һԶϵͳ·IPַ£ǰMODBUSIPֱַָأʹһЧĴվַܻص·ɲ鷳 + ʹЧĴվַؽǼ򵥵طMODBUD PDUκ⡣飺ڲ0xFFΪԪʶЧֵ + ע0ҲMODBUS/TCP豸ֱͨš + +MODBUS PDU ׼ MODBUS RTU ȥCRCУ IJ + + +*/ + +//------------------------------------------------------------------ + +#define LEN_MBAP 7 +#define MAX_RD_REG_NUMS 125 +#define MAX_WR_REG_NUMS 123 + +#define MAX_MBDAT MAX_RD_REG_NUMS + +#define MAX_LEN_PDU (1+MAX_MBDAT*2) + +#define MAX_RD_BIT_NUMS (MAX_RD_REG_NUMS*16) + +#define MAX_WR_BIT_NUMS (MAX_WR_REG_NUMS*16) + +#define LEN_ERR_ANSWER (LEN_MBAP + 2) +//------------------------------------------------------------------ + +typedef union +{ + u8 datbuff[LEN_MBAP+MAX_LEN_PDU]; // dat buff ʽ + + struct + { + // MBAP + u8 mbap[LEN_MBAP]; + // MODBUS PDU + u8 pdu[MAX_LEN_PDU]; // + + } __attribute__ ((packed)) mbappdu; // ͨ÷ʽ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // + u16 data[MAX_MBDAT]; // + + } __attribute__ ((packed)) normal; // ͨ÷ʽ + + // Ȧ(ɢ) 0x01 ɢ 0x02 + /* + һԶ豸УʹøùȡȦ()1 2000 ״̬PDU ϸ˵ʼַָĵһȦ()ַȦ()š + ѰַȦ()㿪ʼѰַȦ()1-16 Ϊ0-15 + ÿؽӦеȦ()ֳΪһλָʾ״̬Ϊ1= ON 0= OFF + һֽڵLSBЧλѯѰַȦ()Ȧ()ƣһֱֽڵĸλΪֹںֽдӵλλ˳ + صȦ()ǰ˵ıֽеʣأһֱֽڵĸλˣֽ˵ݵֽ + */ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x01 0x02 + u16 bitBegAddr; // λʼַ 0x00000xFFFF + u16 bitsNum; // λ 120000x7D0 + } __attribute__ ((packed)) readBitsStatusRequest; // ȡλ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x01 0x02 + u8 bytes; // ֽ N = /80ô N=N+1 + u8 bitsStatus[MAX_RD_BIT_NUMS/8]; // λ״̬, + } __attribute__ ((packed)) readBitsStatusAnswer; // ȡλӦ + + // ּĴ(Ĵ) 0x03 Ĵ 0x04 + /* + һԶ豸УʹøùȡּĴݡPDU˵ʼĴַͼĴ㿪ʼѰַĴˣѰַĴ1-16 Ϊ0-15 + ӦеļĴݷֳÿĴֽڣÿֱֽӵصݡ + ÿĴһֽڰλأҵڶֽڰλء + */ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x03 0x04 + u16 begAddr; // ʼַ (MSB) 0x00000xFFFF + u16 regsNum; // Ĵ (MSB) 11250x7D + + } __attribute__ ((packed)) readRegisterRequest; // ȡĴ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x03 0x04 + u8 bytes; // ֽ 2xN NΪĴ + u16 regsValue[MAX_RD_REG_NUMS]; // ȡļĴݣÿĴռֽڣֽǰֽں (MSB) + + } __attribute__ ((packed)) readRegisterAnswer; // ȡĴӦ + + // дȦ 0x05 + /* + һԶ豸ϣʹøùдΪON OFF + еij˵ON/OFF״̬ʮֵFF 00ΪONʮֵ00 00 ΪOFFֵǷǷģҶá + PDU˵ǿƵȦַ㿪ʼѰַȦˣѰַȦ1 Ϊ0Ȧֵij˵ON/OFF ״̬ + ʮֵ0XFF00ȦΪONʮֵ0X0000ȦΪOFFֵΪǷģҶȦá + ӦӦдȦ״̬֮󷵻Ӧ + */ + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x05 + u16 bitBegAddr; // ʼַ 0x00000xFFFF + u8 bitValue; // λֵ 0x00 0xFF + } __attribute__ ((packed)) writeBitRequest; // дλ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x05 + u8 bitStatus; // λ״̬ 0x00 0xFF + } __attribute__ ((packed)) writeBitAnswer; // дλӦ + + // дĴ 0x06 + /* + һԶ豸УʹøùдּĴ + PDU ˵˱дĴĵַ㿪ʼѰַĴˣѰַĴ1 Ϊ0 + ӦӦдĴ֮󷵻Ӧ + */ + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x06 + u16 regBegAddr; // ʼַ 0x00000xFFFF + u16 regValue; // Ĵֵ 0x0000 0xFFFF + } __attribute__ ((packed)) writeRegisterRequest; // дλ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x06 + u16 regValue; // Ĵֵ 0x0000 0xFFFF + } __attribute__ ((packed)) writeRegisterAnswer; // дλӦ + + // дȦ 0x0F + /* + һԶ豸УʹøùǿȦеÿȦΪON OFFPDU˵ǿƵȦο㿪ʼѰַȦˣѰַȦ1 Ϊ0 + ˵˱ON/OFF ״̬λе߼1ӦΪONλе߼0ӦΪOFF + Ӧع롢ʼַǿƵȦ + */ + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x05 + u16 bitBegAddr; // ʼλַ 0x00000xFFFF + u16 bitsNum; // λ 0x00010x07B02000 + u8 bytes; // ֽ N = /80ôN=N+1 + u8 bitsArray[MAX_WR_BIT_NUMS/8]; // λֵλֽLSB + } __attribute__ ((packed)) writeBitArrayRequest; // дλ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x05 + u16 bitBegAddr; // ʼλַ 0x00000xFFFF + u16 bitsNum; // λ 0x00010x07B02000 + } __attribute__ ((packed)) writeBitArrayAnswer; // дλӦ + + // дĴ 0x10 + /* + һԶ豸УʹøùдĴ(1 Լ120 Ĵ) + ˵дֵÿĴݷֳֽڡ + Ӧع롢ʼַͱдĴ + */ + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // = 0x10 + u16 regBegAddr; // Ĵʼλַ 0x00000xFFFF + u16 regsNum; // Ĵ 0x00010x007B123 + u8 bytes; // ֽ N = Ĵ * 2 + u16 regsArray[MAX_WR_REG_NUMS]; // ĴֵMSB + } __attribute__ ((packed)) writeRegArrayRequest; // дλ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // ȷӦ = = 0x05 + u16 regBegAddr; // Ĵʼλַ 0x00000xFFFF + u16 regsNum; // Ĵ 0x00010x007B123 + } __attribute__ ((packed)) writeRegArrayAnswer; // дλӦ + +/* + Դ⹦ +*/ + // ȡӲ 0x65 + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // + u16 begAddr; // ʼַ + u16 subAddr; // ӵַ + + } __attribute__ ((packed)) readSubRegRequest; // Ӳ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // + u8 bytes; // ֽ N = Ĵ * 2 + u16 subRegsArray[MAX_RD_REG_NUMS]; // ĴֵMSB + + } __attribute__ ((packed)) readSubRegAnswer; // ӲӦ + + // дӲ 0x69 + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // 0x69 + u16 regBegAddr; // Ĵʼλַ 0x00000xFFFF + u16 subAddr; // Ĵӵַ + u8 bytes; // ֽ N = Ĵ * 2 + u16 subRegsArray[MAX_RD_REG_NUMS]; // ĴֵMSB ʵʼĴ N = (len - 6) / 2 + + } __attribute__ ((packed)) writeSubRegRequest; // Ӳ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 cmd; // + u16 regBegAddr; // Ĵʼλַ 0x00000xFFFF + u16 subAddr; // Ĵӵַ + + } __attribute__ ((packed)) writeSubRegAnswer; // ӲӦ + + struct + { + // MBAP + u16 transId; // ԪʶMODBUS/Ӧʶ롣 + u16 protId; // ЭʶMODBUS ЭʶΪ0x000x00 + u16 len; // ֡ȡ + u8 unitId; // Ԫʶ + + // MODBUS PDU + u8 acmd; // Ӧ = +0x80 + u8 errCode; // + + } __attribute__ ((packed)) answerError; // Ӧ + +} ModbusTcpADU; + + +/* +// MODBUS + ________________________________________________________________ + | | | | | + || + | ɢ | | ֻ | I/Oϵͳṩ | + |-----------|-----------|-----------|---------------------------| + | Ȧ | | д | ͨӦóı | + |-----------|-----------|-----------|---------------------------| + | Ĵ | 16 | ֻ | I/Oϵͳṩ | + |-----------|-----------|-----------|---------------------------| + | ּĴ | 16 | д | ͨӦóı | + || +*/ + +// MODBUS +#define READ_COIL_STATUS 0x01 // ȡȦ״̬ڲػȦ +#define READ_INPUT_STATUS 0x02 // ȡ״̬ɢ룩 +#define READ_HOLDING_REGISTER 0x03 // ּĴڲ洢洢 +#define READ_INPUT_REGISTER 0x04 // ȡĴĴ +#define WRITE_SINGLE_COIL 0x05 // дȦڲػȦ +#define WRITE_SINGLE_REGISTER 0x06 // дĴڲ洢洢 +#define WRITE_MULTIPLE_COIL 0x0F // дȦڲػȦ +#define WRITE_MULTIPLE_REGISTER 0x10 // дĴڲ洢洢 + +#define READ_FILE_RECORD 0x14 // ļ¼ļ¼ʣ +#define WRITE_FILE_RECORD 0x15 // дļ¼ļ¼ʣ +#define WRITE_MASK_REGISTER 0x16 // дĴڲ洢洢 +#define RW_MULTIPLE_REGISTER 0x17 // /дĴڲ洢洢 + +#define READ_FILE_RECORD_SUBCODE 0x06 // ļ¼ļ¼ʣ +#define WRITE_FILE_RECORD_SUBCODE 0x06 // дļ¼ļ¼ʣ + + +// Դ +#define READ_REGISTER_SUBPARA 0x65 // ȡӲ +#define WRITE_REGISTER_SUBPARA 0x69 // дӲ + + +// MODBUS TCP 쳣 +#define MODBUS_TCP_ERR01 0x01 // ǷĹ, ˽⹦ +#define MODBUS_TCP_ERR02 0x02 // Ƿݵַ, й +#define MODBUS_TCP_ERR03 0x03 // Ƿֵ, й +#define MODBUS_TCP_ERR04 0x04 // , ִйУ +#define MODBUS_TCP_ERR05 0x05 // ȷ, ܷãҪԳʱɷˣһýյȷϡ +#define MODBUS_TCP_ERR06 0x06 // æ, ܽMODBUSPDUͻӦξǷͺʱط +#define MODBUS_TCP_ERR0A 0x0A // ع, ·Чġ +#define MODBUS_TCP_ERR0B 0x0B // ع, Ŀ豸ûӦ쳣Ϣ + +//------------------------------------------------------------------ + + +//------------------------------------------------------------------ + +#ifndef MAX_MODBUS_TCP_NODE +#define MAX_MODBUS_TCP_NODE 0 +#endif + +//------------------------------------------------------------------ + +void InitModbusTcp(void); + +void ModbusTcpServerRun(void); + +// : дĴ +int ModbusTcpWriteRegs(int nidx, u16 addr, u16 * regAry, u16 nums); + +u16 SwapHighLow(u16 data); + +//------------------------------------------------------------------ + +#endif + + diff --git a/NxFuncs/modbus/one2onecomm.c b/NxFuncs/modbus/one2onecomm.c new file mode 100644 index 0000000..ed202db --- /dev/null +++ b/NxFuncs/modbus/one2onecomm.c @@ -0,0 +1,467 @@ + +#include "one2onecomm.h" +#include "delay.h" +#include "crc16.h" +#include "trigger.h" + +//----------------------------------------------------------------- +// ݽṹ +typedef struct +{ + u16 modBusWait; // ͨѶʱ, λus + + // ͨѶָ + UsartSendData One2OneCommSend; // + UsartGetData One2OneCommReceive; // + IsUsartSendOver IsOne2OneCommSendOver; // жϷͻǷΪ + +}One2OneCommCtrl; + +// ƽṹ +One2OneCommCtrl g_one2onecommCtrl; + +#define MAX_ONE2ONE_CMD 10 // ֵ֧ + +typedef struct +{ + One2OneCmd cmdbuf[MAX_ONE2ONE_CMD]; + + u8 sending; // =1, + + u8 bufCmdNum; // != 0, + u8 bufHead; + u8 bufTail; + + u8 steps; + + ResvOne2OneExProc resvexproc; // յݴ + + u16 rsvTimout; // ȡʱʱ, λΪ 100us + +}One2OneCtrl; + +One2OneCtrl g_one2oneCtrl; + +//----------------------------------------------------------------- +// ܣʼһһͨѶ +void InitOne2OneComm(int usart, BAUD_TypeDef baud, char dat, char parity, char stop); +int One2OneCommTx(u16 addr, u16 * pData, u8 len, int steps); // : +int One2OneCommRx(u8 rDat); // : + +//----------------------------------------------------------------- + +// עͨѶ +void RegisterOne2OneCommFunc(One2OneCommCtrl* pCtrl, UsartSendData send, UsartGetData get, IsUsartSendOver sdover) +{ + pCtrl->One2OneCommSend = send; + pCtrl->One2OneCommReceive = get; + pCtrl->IsOne2OneCommSendOver = sdover; +} + + +/*----------------------------------------------------------------- +:ʼ豸 +usart; ͨ +baud : +dat: ݳ +parity: Уλ +stop: ֹͣλ +*/ +void InitOne2OneComm(int usart, BAUD_TypeDef baud, char dat, char parity, char stop) +{ + memset(&g_one2onecommCtrl, 0, sizeof(One2OneCommCtrl)); + + // ʱ + switch(baud) + { + // ݲ ͨѶʱ, λus = 10000000 / baud + case B4800: + { + g_one2onecommCtrl.modBusWait = 2200; + break; + } + case B9600: + { + g_one2onecommCtrl.modBusWait = 1100; + break; + } + case B14400: + { + g_one2onecommCtrl.modBusWait = 750; + break; + } + case B19200: + { + g_one2onecommCtrl.modBusWait = 600; + break; + } + case B38400: + { + g_one2onecommCtrl.modBusWait = 300; + break; + } + case B57600: + { + g_one2onecommCtrl.modBusWait = 200; + break; + } + case B115200: + { + g_one2onecommCtrl.modBusWait = 100; + break; + } + case B230400: + { + g_one2onecommCtrl.modBusWait = 50; + break; + } + case B460800: + { + g_one2onecommCtrl.modBusWait = 25; + break; + } + case B921600: + { + g_one2onecommCtrl.modBusWait = 13; + break; + } + default: + { + break; + } + } + + // ʼ + switch(usart) + { +#ifdef COMM_USART1 + case COMM_USART1: + { + InitUsart1(baud, dat, parity, stop); // 1 + RegisterOne2OneCommFunc(&g_one2onecommCtrl, Usart1SendData, Usart1GetData, IsUsart1SendOver); + break; + } +#endif +#ifdef COMM_USART2 + case COMM_USART2: + { + InitUsart2(baud, dat, parity, stop); // 2 + RegisterOne2OneCommFunc(&g_one2onecommCtrl, Usart2SendData, Usart2GetData, IsUsart2SendOver); + break; + } +#endif +#ifdef COMM_USART3 + case COMM_USART3: + { + InitUsart3(baud, dat, parity, stop); // 3 + RegisterOne2OneCommFunc(&g_one2onecommCtrl, Usart3SendData, Usart3GetData, IsUsart3SendOver); + break; + } +#endif +#ifdef COMM_USART4 + case COMM_USART4: + { + InitUsart4(baud, dat, parity, stop); // 4 + RegisterOne2OneCommFunc(&g_one2onecommCtrl, Usart4SendData, Usart4GetData, IsUsart4SendOver); + break; + } +#endif +#ifdef COMM_USART5 + case COMM_USART5: + { + InitUsart5(baud, dat, parity, stop); // 5 + RegisterOne2OneCommFunc(&g_one2onecommCtrl, Usart5SendData, Usart5GetData, IsUsart5SendOver); + break; + } +#endif + default: + { + break; + } + } +} + +//----------------------------------------------------------------- +// : +// : +// addr: ʼַ: 0000H~FFFFH +// data: : λ: +// len: ݳ +// steps:-1,ִͬ +// 1, +// 2,ȴݷ +// ֵ: +// >0:Ӧִ +// 0:δ +// -1: +// -2: ͳʱ +int One2OneCommTx(u16 addr, u16 * pData, u8 len, int steps) +{ + int i, timeout, result; + u16 checkcrc; // CRC У + u16 data; + u8 pSDat[5+2*MAX_REG_WR]; // + + i = 0; + + if (pData == NULL || len > MAX_REG_WR) + { + return -1; + } + + if (steps == 1 || steps == -1) + { + i = 0; + result = 0; + + pSDat[i++] = HIBYTE(addr); // ADDR_H + pSDat[i++] = LOBYTE(addr); // ADDR_L + + pSDat[i++] = len; + + for (int j = 0; j < len; j++) + { + data = pData[j]; + + pSDat[i++] = HIBYTE(data); // DATA_H + pSDat[i++] = LOBYTE(data); // DATA_L + } + + checkcrc = CalcCrc16(&pSDat[0], i); + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + + g_one2onecommCtrl.One2OneCommSend(pSDat, i); + } + + if (steps == 2) + { + if (g_one2onecommCtrl.IsOne2OneCommSendOver() != TRUE) + { + return 0; + } + } + else if (steps == -1) + { + timeout = (u8)(i*2) + 4; // ʱʱ(ÿֽڷʱ*2*ֽ + ÿֽڷʱ*4 ) + + do //ȴ + { + if (g_one2onecommCtrl.IsOne2OneCommSendOver() == TRUE) + { + break; + } + + if (timeout-- <= 0) + { + result = -2; + break; + } + + DelayUs(g_one2onecommCtrl.modBusWait); + + }while(1); + } + + if (steps != -1) + { + return steps; + } + + return result; +} + +//----------------------------------------------------------------- + +int One2OneCommRx(u8 rDat) +{ + int rst = -1; + u32 time; + static u32 timeBuf = 0; + static u8 rxDat[15+2*MAX_REG_WR]; // ݻ + static u8 idx = 0; // Ч + static u8 num = 0; // յַ + + u16 checkcrc = 0; // crcУ + + One2OneCmd newCmd; + + memset(&newCmd, 0, sizeof(One2OneCmd)); + + time = Get100UsSoftTimer(); // 100us + + if (0 || + ((time - timeBuf) > g_one2oneCtrl.rsvTimout) || // ȡʱʱ, λΪ 100us + (idx >= 15+2*MAX_REG_WR) || // λ + 0) + {// ½ݰ + if (num > 1) + { + printf("data begin, num=%d\r\n", num); + } + idx = 0; + num = 1; + } + else + { + num++; + } + + timeBuf = time; + + if (num < 7) // δ + { + rxDat[idx] = rDat; + //printf("num=%d, rxDat[%d] is 0x%x \r\n", num, idx, rxDat[idx]); + idx++; + } + else + { + rxDat[idx] = rDat; + + if (num == rxDat[2]*2 + 5) // + { + //УǷȷ + checkcrc = CalcCrc16(&rxDat[0], num-2); + + if (rxDat[num-2] == HIBYTE(checkcrc) && rxDat[num-1] == LOBYTE(checkcrc)) + {//crcУȷ + newCmd.addr = MAKEWORD(rxDat[1],rxDat[0]); // ݵַ + newCmd.rdlen = rxDat[2]; + for (int i = 0; i < newCmd.rdlen; i++) + { + newCmd.rddat[i] = MAKEWORD(rxDat[i*2+4],rxDat[i*2+3]); // + } + // ִⲿ + if (g_one2oneCtrl.resvexproc != NULL) + { + g_one2oneCtrl.resvexproc(&newCmd); + } + rst = 0; + } + else + { + printf("check crc error, calc crc:0x%x 0x%x, receive crc:0x%x 0x%x\r\n", + HIBYTE(checkcrc), LOBYTE(checkcrc), rxDat[num-2], rxDat[num-1]); + } + idx = 0; + num = 0; // ½ݰ + } + else + { + idx++; + } + } + + return rst; +} + +//----------------------------------------------------------------- + +void InitOne2OneCtrl(int usart, BAUD_TypeDef baud, char dat, char parity, char stop, int rsvtimout) +{ + InitOne2OneComm(usart, baud, dat, parity, stop); + + memset(&g_one2oneCtrl, 0, sizeof(One2OneCtrl)); + + g_one2oneCtrl.rsvTimout = rsvtimout; +} + +void RegOne2OneCmdProc(ResvOne2OneExProc proc) +{ + g_one2oneCtrl.resvexproc = proc; +} + +int AddOne2OneCmd(One2OneCmd * pCmd) +{ + if (pCmd != NULL) + { + if (g_one2oneCtrl.bufCmdNum < MAX_ONE2ONE_CMD && g_one2oneCtrl.bufHead < MAX_ONE2ONE_CMD) + { + memcpy(&(g_one2oneCtrl.cmdbuf[g_one2oneCtrl.bufHead]), pCmd, sizeof(One2OneCmd)); + g_one2oneCtrl.bufHead++; + if (g_one2oneCtrl.bufHead >= MAX_ONE2ONE_CMD) + { + g_one2oneCtrl.bufHead = 0; + } + g_one2oneCtrl.bufCmdNum++; + return g_one2oneCtrl.bufCmdNum; + } + printf("bufcmd full\r\n"); + return -2; + } + + printf("para error\r\n"); + return -1; +} + +void One2OneTask(void) +{ + int rslt; + + // 첽 + if (g_one2oneCtrl.sending == 0 && + g_one2oneCtrl.bufCmdNum > 0 && + g_one2oneCtrl.steps == 0) + { + g_one2oneCtrl.sending = 1; + g_one2oneCtrl.steps = 1; + } + + if (g_one2oneCtrl.sending != 0) + { + One2OneCmd *pCmd; + pCmd = &(g_one2oneCtrl.cmdbuf[g_one2oneCtrl.bufTail]); + + if (g_one2oneCtrl.steps > 0 && g_one2oneCtrl.steps < 3) + { + rslt = One2OneCommTx(pCmd->addr, &pCmd->wrdat[0], pCmd->wrlen, g_one2oneCtrl.steps); + + if (rslt == g_one2oneCtrl.steps) + { + g_one2oneCtrl.steps++; + } + } + else if (g_one2oneCtrl.steps == 3) + { + if (g_one2oneCtrl.bufCmdNum > 0) + { + g_one2oneCtrl.bufCmdNum--; + } + g_one2oneCtrl.steps = 0; + g_one2oneCtrl.sending = 0; + g_one2oneCtrl.bufTail++; + if (g_one2oneCtrl.bufTail >= MAX_ONE2ONE_CMD) + { + g_one2oneCtrl.bufTail = 0; + } + } + } + + // մڻ + u8 rDat; + int len; + do + { + len = g_one2onecommCtrl.One2OneCommReceive(&rDat, 1); // ӻȡ + if (len == 1) + {// յ + rslt = One2OneCommRx(rDat); + if (rslt == 0) + {// յһݰ + break; + } + } + else + { + break; + } + }while(1); +} + +//----------------------------------------------------------------- + + + + diff --git a/NxFuncs/modbus/one2onecomm.h b/NxFuncs/modbus/one2onecomm.h new file mode 100644 index 0000000..7d247c6 --- /dev/null +++ b/NxFuncs/modbus/one2onecomm.h @@ -0,0 +1,39 @@ + +#ifndef __ONE2ONECOMM_H__ +#define __ONE2ONECOMM_H__ + +//---------------------------------------------------------------------------------------------- +#include "config.h" +#include "serial.h" + +//---------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------------- + +#define MAX_REG_WR 10 // շ10 + +typedef struct +{ + // + u16 addr; // ݵַ + u16 wrdat[MAX_REG_WR]; // ͵ + u8 wrlen; // ͵ݳ + u16 rddat[MAX_REG_WR]; // յ + u8 rdlen; // յݳ +}One2OneCmd; + +typedef void (*ResvOne2OneExProc)(One2OneCmd * pcmd); // յݴ + +void InitOne2OneCtrl(int usart, BAUD_TypeDef baud, char dat, char parity, char stop, int rsvtimout); +void RegOne2OneCmdProc(ResvOne2OneExProc proc); +int AddOne2OneCmd(One2OneCmd * pCmd); +void One2OneTask(void); + +//---------------------------------------------------------------------------------------------- + +#endif + + diff --git a/NxFuncs/motions/curves.c b/NxFuncs/motions/curves.c new file mode 100644 index 0000000..6dd3c04 --- /dev/null +++ b/NxFuncs/motions/curves.c @@ -0,0 +1,513 @@ + +#include "curves.h" + +//-------------------------------------------------- +#include "trigger.h" +#include + +//-------------------------------------------------- + +#if (1) // Tٶ߼Ӽ٣ĵʽΣ + +//-------------------------------------------------- + +// ӼҪλ +// : pps1 ٶ1 +// pps2 ٶ2 +// ppss ٶ +// : +// λֵ +u32 TTypeCalcDisplacement(float pps1, float pps2, float ppss) +{ + // ʽ: d=(v2+v1)*(v2-v1)/(2a) + // v1 = pps1 + // v2 = pps2 + // a = ppss + float temp; + + if (ppss == 0) // ٶΪ0ֱ˶ + { + return 0; + } + + if (pps1 < pps2) + { + temp = (pps2-pps1); + } + else + { + temp = (pps1-pps2); + } + temp *= (pps1+pps2); + temp /= ppss; + temp /= 2; + return (temp+0.5f); +} + +//-------------------------------------------------- + +// ܣijλٶȱ仯Ҫٶ +// +// disp λ +// pps1 ٶ1 +// pps2 ٶ2 +// : ٶ + +float TTypeCalcAddPPSS(u32 disp, float pps1, float pps2) +{ + float temp; + // ʽ: a=(v2+v1)*(v2-v1)/(2*d) + // v1 = pps1 + // v2 = pps2 + // d = disp + + if (disp == 0 || pps1 == pps2) + { + return 0; + } + if (pps1 < pps2) + { + temp = (pps2-pps1); + } + else + { + temp = (pps1-pps2); + } + temp *= (pps1+pps2); + temp /= disp; + temp /= 2; + return (temp); +} + +//-------------------------------------------------- + +// ijλƺijٶ£յٶֵ +// +// disp λ +// pps1 ٶ1 +// ppss ٶ +// +// : +// ٶֵ + +float TTypeCalcEndSpd(u32 disp, float pps1, float ppss) +{ + float temp; + // ʽ: a=(v2+v1)*(v2-v1)/(2*d) + // v1 = pps1 + // d = disp + // pps2 = sqrt(2*disp*ppss + pps1*pps1) + + temp = 2.0f*disp; + temp *= ppss; + temp += pps1*pps1; + if (temp > 0) + { + temp = sqrt(temp); + } + else + { + temp = 0; + } + + return (temp); +} + +//-------------------------------------------------- +// ˶ʱ +float TTypeCalcRunTime(u32 disp, u32 startpps, u32 stoppps, u32 runpps, u32 addppss) +{ + TTypeCtrl tctrl; + float runtime = 0; + float time = 0; + + memset(&tctrl, 0, sizeof(TTypeCtrl)); + + // мͽ + tctrl.movement = disp; + tctrl.begPPS = startpps; // γʼٶ + tctrl.endPPS = stoppps; // νٶ + tctrl.runPPS = runpps; // ٶ + tctrl.maxPPSS = addppss; // ļٶ + TTypeCalcRunParas(&tctrl); // Ӽٲ + + { + s32 newPPSS1, newPPSS2; + + newPPSS1 = tctrl.newAddPPSS; + newPPSS2 = tctrl.newAddPPSS; + + if (tctrl.begPPS > tctrl.newRunPPS) + { + newPPSS1 *= -1; + } + if (tctrl.endPPS > tctrl.newRunPPS) + { + newPPSS2 *= -1; + } + + runtime = 0; + if (tctrl.mvmtseg[0] != 0 && newPPSS1 != 0) + { + time = (int)tctrl.newRunPPS - (int)tctrl.begPPS; + time /= newPPSS1; + runtime += time; + } + + if (tctrl.mvmtseg[1] != 0 && tctrl.newRunPPS != 0) + { + time = tctrl.mvmtseg[1]; + time /= (int)tctrl.newRunPPS; + runtime += time; + } + + if (tctrl.mvmtseg[2] != 0 && newPPSS2 != 0) + { + time = (int)tctrl.newRunPPS - (int)tctrl.endPPS; + time /= newPPSS2; + runtime += time; + } + // printf("run time = %.6f\r\n", runtime); + } + + return runtime; +} + +//-------------------------------------------------- + +// ٶȼ +int TTypeCalcRunParas(TTypeCtrl * pTTypeCtrl) +{ +#define TCDEBUG_OUT 0 // Ϣ + + int rslt; +// ֪ +// ǰλƶε˶ܻٶһ䣬㣩 + +// õı + u32 movement; // λ + u32 begPPS, endPPS, runPPS; + u32 addPPSS; // ٶ + + movement = pTTypeCtrl->movement; + begPPS = pTTypeCtrl->begPPS; + endPPS = pTTypeCtrl->endPPS; + runPPS = pTTypeCtrl->runPPS; + addPPSS = pTTypeCtrl->maxPPSS; + + // ֤ٶȴٶ + if (runPPS < begPPS || runPPS < endPPS) + { + runPPS = begPPS > endPPS ? begPPS:endPPS; + } + + rslt = 0; + // 1. жǷﵽٶȣελ + { + u32 mvmt1, mvmt2, mvmt3; + + mvmt1 = TTypeCalcDisplacement(begPPS, runPPS, addPPSS); + mvmt3 = TTypeCalcDisplacement(endPPS, runPPS, addPPSS); + + if (mvmt1 + mvmt3 >= movement) // ܴﵽٶ + { + float tmpv; + tmpv = movement * 2; + tmpv = sqrt((tmpv*addPPSS + begPPS*begPPS + endPPS*endPPS)/2.0); // ܹﵽķֵٶ + runPPS = (tmpv); +#if (TCDEBUG_OUT == 1) + printf("TTypeCalcRunParas runPPS=%d\r\n", runPPS); +#endif + if (runPPS < begPPS || runPPS < endPPS) // ¼ٶСֹͣٶ + { + u32 tpmvmt; + tpmvmt = TTypeCalcDisplacement(begPPS, endPPS, addPPSS); // ֱӱСλ + if (tpmvmt > movement) // Ҫλ̫󣬲ɼӼ٣滮ʧ + { + addPPSS = TTypeCalcAddPPSS(movement, begPPS, endPPS); // ¼ٶ +#if (TCDEBUG_OUT == 1) + printf("TTypeCalcRunParas addPPSS=%d\r\n", addPPSS); +#endif + if (begPPS <= endPPS) + { + mvmt1 = movement; + mvmt2 = 0; + mvmt3 = 0; + } + else + { + mvmt1 = 0; + mvmt2 = 0; + mvmt3 = movement; + } + } + else + { + if (begPPS <= endPPS) + { + mvmt1 = tpmvmt; + mvmt2 = movement - tpmvmt; + mvmt3 = 0; + } + else + { + mvmt1 = 0; + mvmt2 = movement - tpmvmt; + mvmt3 = tpmvmt; + } + } + } + else + { + mvmt1 = TTypeCalcDisplacement(begPPS, runPPS, addPPSS); + mvmt3 = TTypeCalcDisplacement(endPPS, runPPS, addPPSS); // ¼λ + + if (mvmt1 + mvmt3 > movement) + { + mvmt2 = 0; + mvmt3 = movement - mvmt1; + } + else + { + mvmt2 = movement - mvmt1 - mvmt3; + } + } + } + else // Դﵽٶ + { + mvmt2 = movement - mvmt1 - mvmt3; + } + + pTTypeCtrl->mvmtseg[0] = mvmt1; // һ + pTTypeCtrl->mvmtseg[1] = mvmt2; // ڶ + pTTypeCtrl->mvmtseg[2] = mvmt3; // + pTTypeCtrl->newRunPPS = runPPS; + pTTypeCtrl->newAddPPSS = addPPSS; + } +#if (TCDEBUG_OUT == 1) + printf("TTypeCalcRunParas: seg[0]=%d, seg[2]=%d, seg[1]=%d, newRunPPS[1]=%.1f, newAddPPSS=%.1f\r\n", + pTTypeCtrl->mvmtseg[0], pTTypeCtrl->mvmtseg[2], pTTypeCtrl->mvmtseg[1], pTTypeCtrl->newRunPPS, pTTypeCtrl->newAddPPSS); +#endif + + return rslt; +} +//-------------------------------------------- +// Ƶϵ +int TTypeCalcDivTab(u32 fin, TTypeCtrl * pTTypeCtrl, u32 * pFidvTab, u32 * pTablen) +{ +#define TDEBUG_OUT 0 // Ϣ + +#if (TDEBUG_OUT == 1) + u32 time, tptm, lstm; +#endif + int rslt; + int totalclk = 0; // ʱ䣨λ1ʱƬ + u32 movement; + + if (fin <= 0 || pTTypeCtrl == NULL || pFidvTab == NULL || pTablen == NULL) + { + return -1; + } + +#if (TDEBUG_OUT == 1) + time = GetUsSoftTimer(); + lstm = time; +#endif + + // ˶ + TTypeCalcRunParas(pTTypeCtrl); + + *pTablen = 0; + rslt = 0; + // ƵϵÿķƵϵ + { + u32 i; + float begPPS; // γʼٶ + float endPPS; // νٶ + float runPPS; // ٶ + float newPPSS1, newPPSS2; + + float pps; // ٶֵ + float add; + float rpps1, rpps2; // ܹٶ + int runclk; + int coef; + u32 * pBuf; + + movement = pTTypeCtrl->movement; + begPPS = pTTypeCtrl->begPPS; + endPPS = pTTypeCtrl->endPPS; + runPPS = pTTypeCtrl->newRunPPS; + newPPSS1 = pTTypeCtrl->newAddPPSS; + newPPSS2 = pTTypeCtrl->newAddPPSS; + + if (begPPS > runPPS) + { + newPPSS1 *= -1; + } + if (endPPS > runPPS) + { + newPPSS2 *= -1; + } + +#if (TDEBUG_OUT == 1) + lstm = GetUsSoftTimer(); +#endif + pps = begPPS; + rpps1 = pps; + runclk = 0; + add = newPPSS1; + add /= fin; + pBuf = &(pFidvTab[0]); + for (i = 0; i < pTTypeCtrl->mvmtseg[0]; i++) // һ + { + if (pps > runPPS) + { + pps = runPPS; + } + if (newPPSS1 < 0 && pps < endPPS) + { + pps = endPPS; + } + coef = fin / pps; // ٶֵõϵ + *pBuf++ = coef; // ¼Ƶϵ + runclk += coef; // ݷƵϵõһʱ + pps = begPPS + runclk * add; // ٶȹ滮һʱ̵ٶֵ + } + rpps1 = pps; + totalclk += runclk; + +#if (TDEBUG_OUT == 1) + tptm = GetUsSoftTimer(); + printf("TCDiv seg1 tm=%uus\r\n", tptm-lstm); + lstm = tptm; +#endif + // + pps = endPPS; + rpps2 = pps; + runclk = 0; + add = newPPSS2; + add /= fin; + pBuf = &(pFidvTab[movement - 1]); + for (i = 0; i < pTTypeCtrl->mvmtseg[2]; i++) + { + if (pps > runPPS) + { + pps = runPPS; + } + if (newPPSS2 < 0 && pps < endPPS) + { + pps = endPPS; + } + coef = fin / pps; // ٶֵõϵ + *pBuf-- = coef; // ¼Ƶϵ + runclk += coef; // ݷƵϵõһʱ + pps = endPPS + runclk * add; // ٶȹ滮һʱ̵ٶֵ + } + rpps2 = pps; + totalclk += runclk; +#if (TDEBUG_OUT == 1) + tptm = GetUsSoftTimer(); + printf("TCDiv seg3 tm=%uus\r\n", tptm-lstm); + lstm = tptm; +#endif + // ٶ + pps = (rpps1 + rpps2) / 2; + if (pps > runPPS) + { + pps = runPPS; + } + if (newPPSS2 < 0 && pps < endPPS) + { + pps = endPPS; + } + runclk = 0; + pBuf = &(pFidvTab[pTTypeCtrl->mvmtseg[0]]); + coef = fin / pps; // ٶֵõϵ + for (i = 0; i < pTTypeCtrl->mvmtseg[1]; i++) + { + *pBuf++ = coef; // ¼Ƶϵ + } + runclk = pTTypeCtrl->mvmtseg[1] * coef; + totalclk += runclk; +#if (TDEBUG_OUT == 1) + tptm = GetUsSoftTimer(); + printf("TCDiv seg2 tm=%uus\r\n", tptm-lstm); + lstm = tptm; +#endif + } + + if (rslt < 0) + { + rslt++; + } + else + { + *pTablen = movement; + rslt = totalclk; + } +#if (TDEBUG_OUT == 1) + tptm = GetUsSoftTimer(); + printf("TCDiv tm=%uus\r\n", tptm-time); +#endif + + return rslt; +} + +//-------------------------------------------- + +#endif + +//---------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------- + +#if (0) // Sٶ߼Ӽ٣߶Σ + + +typedef struct +{ +// + u32 movement; // λ + + float begPPS; // γʼٶ + float endPPS; // νٶ + float runPPS; // ٶȣv + float maxPPSS; // ļٶȣa + float maxPPSSS; // ļӼٶȣj + +// мͽ + u32 timeseg[7]; // ߶ʱ䳤, λΪ1ʱƬ + u32 mvmtseg[7]; // ߶λ, ֶελ (λΪ, ˵) + float newRunPPS; // µٶ + +}STypeCtrl; + +// λ +u32 STypeCalcDisplacement(float pps1, float pps2, float ppss); + +// ٶ +float STypeCalcAddPPSS(u32 disp, float pps1, float pps2); + +// ˶ٶ +float STypeCalcEndSpd(u32 disp, float pps1, float ppss); + +// ˶ʱ +float STypeCalcRunTime(u32 disp, u32 startpps, u32 stoppps, u32 runpps, u32 addppss); + +// ˶ز +int STypeCalcRunParas(STypeCtrl * pSTypeCtrl); + +// ɷƵϵ +int STypeCalcDivTab(u32 fin, STypeCtrl * pSTypeCtrl, u32 * pFidvTab, u32 * pTablen); + + + + + + + + + + +#endif diff --git a/NxFuncs/motions/curves.h b/NxFuncs/motions/curves.h new file mode 100644 index 0000000..8f5020c --- /dev/null +++ b/NxFuncs/motions/curves.h @@ -0,0 +1,93 @@ + +#ifndef __CURVES_H__ +#define __CURVES_H__ + +#include "config.h" + +//-------------------------------------------------- +// μӼ + +typedef struct +{ +// + u32 movement; // λ + + float begPPS; // γʼٶ + float endPPS; // νٶ + float runPPS; // ٶ + float maxPPSS; // ļٶ + +// мͽ + u32 mvmtseg[3]; // λ, ֶελ (λΪ, ˵) + float newRunPPS; // µٶ + float newAddPPSS; // µļٶ + +}TTypeCtrl; + +//-------------------------------------------------- + +// λ +u32 TTypeCalcDisplacement(float pps1, float pps2, float ppss); + +// ٶ +float TTypeCalcAddPPSS(u32 disp, float pps1, float pps2); + +// ˶ٶ +float TTypeCalcEndSpd(u32 disp, float pps1, float ppss); + +// ˶ʱ +float TTypeCalcRunTime(u32 disp, u32 startpps, u32 stoppps, u32 runpps, u32 addppss); + +// ˶ز +int TTypeCalcRunParas(TTypeCtrl * pTTypeCtrl); + +// ɷƵϵ +int TTypeCalcDivTab(u32 fin, TTypeCtrl * pTTypeCtrl, u32 * pFidvTab, u32 * pTablen); + + +//-------------------------------------------------- +// 7SͼӼ + +typedef struct +{ +// + u32 movement; // λ + + float begPPS; // γʼٶ + float endPPS; // νٶ + float runPPS; // ٶȣv + float maxPPSS; // ļٶȣa + float maxPPSSS; // ļӼٶȣj + +// мͽ + u32 timeseg[7]; // ߶ʱ䳤, λΪ1ʱƬ + u32 mvmtseg[7]; // ߶λ, ֶελ (λΪ, ˵) + float newRunPPS; // µٶ + +}STypeCtrl; + + +// λ +u32 STypeCalcDisplacement(float pps1, float pps2, float ppss); + +// ٶ +float STypeCalcAddPPSS(u32 disp, float pps1, float pps2); + +// ˶ٶ +float STypeCalcEndSpd(u32 disp, float pps1, float ppss); + +// ˶ʱ +float STypeCalcRunTime(u32 disp, u32 startpps, u32 stoppps, u32 runpps, u32 addppss); + +// ˶ز +int STypeCalcRunParas(STypeCtrl * pSTypeCtrl); + +// ɷƵϵ +int STypeCalcDivTab(u32 fin, STypeCtrl * pSTypeCtrl, u32 * pFidvTab, u32 * pTablen); + + +//-------------------------------------------------- + +#endif + + diff --git a/NxFuncs/motions/motion.c b/NxFuncs/motions/motion.c new file mode 100644 index 0000000..8b58b71 --- /dev/null +++ b/NxFuncs/motions/motion.c @@ -0,0 +1,2 @@ + +#include "motion.h" diff --git a/NxFuncs/motions/motion.h b/NxFuncs/motions/motion.h new file mode 100644 index 0000000..3d858fd --- /dev/null +++ b/NxFuncs/motions/motion.h @@ -0,0 +1,176 @@ + +#ifndef __MOTION_H__ +#define __MOTION_H__ + +#include "config.h" + +//-------------------------------------------------- +// ˶ + +#ifndef MAX_AXIS_NUM +#define MAX_AXIS_NUM 4 +#endif + +//---------------------------------------------------------------------------------------------------------- + +// ٶȽṹ +typedef struct +{ + u32 startPPS; // ٶ + u32 stopPPS; // ֹͣٶ + u32 runPPS; // ˶ٶ + u32 slowPPS; // ٶ + u32 addPPSS; // ټٶ + u32 brkPPSS; // ɲٶ + u32 slowPPSS; // ټٶ +}MotionSpeedCtrl; + +typedef struct +{ + void (*RefreshPosition)(u32, s32*); // ˢ»ص + u32 refPosPara; // ˢ² + + int (*GetSlowDown)(u32,u32); // ˶Ϊʱ⽵; Ϊʱ㣬ٶȽͣʧٶȻָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣټٶȣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȣ + int (*GetEmergencyStop)(u32,u32); // ֹͣΪʱ⼱ͣ; Ϊʱ㣬ֹͣ壨轵٣ + u32 condPara1, condPara2; // + +}MotionCallbackCtrl; + +//-------------------------------------------------- +// 첽켣˶ + +#define SPM_PARA_NUM 100 // ڵSeparateMotionCtrl.paraList + +typedef struct +{ + int motoIdx; // ˶ + int runtype; // ˶ģʽ0, λģʽλɣȻֹͣ; 1, ٶģʽ˶ģʽֱֹֹͣͣ + int blockRun; // б־ + s32 movement; // λ + + MotionSpeedCtrl spdPara; // ٶ + + // ص + MotionCallbackCtrl callback; + + // Ϣ + int errInfo; // Ϣ + int exerslt; // ִн + int runningflag; // б־ + int startflag; // ־ + int stopflag; // ֹͣ־ⲿã + + // м + union + { + u32 buff[SPM_PARA_NUM]; + + struct + { + int initedflag; + int outdir; + int oldcondsel; + + s32 posbeforerun; // ˶ǰλ + + float startpps, runpps, slowpps, stoppps; // ٶ + float addppss, brkppss, slowppss; // ٶ + + u32 totalnum, runmidx; + u32 mvmtseg[3]; // ˶ελ + u32 decpoint; // ٷֽ + u32 tablen12, tablen3; + u32 slowmvmt; + + int slowsta, inslow; // ״̬ڽٱ־ + int brksta, inbrk; // ɲ״̬ɲ־ + int nstpsta, innstp; // ͣ״̬ͣ־ + }paraList; + }ctrlPara; + +}SeparateMotionCtrl; + + +#define PULSE_DIR_POSI 1 +#define PULSE_DIR_NEGA -1 + +#define SEPRUN_TPYE_MVMT 0 // λÿ +#define SEPRUN_TPYE_SPEED 1 // ٶȿ + +//-------------------------------------------------- +// ֱ߲岹˶ + +// ֱ߲岹˶ƽṹ +typedef struct +{ + s32 movement[MAX_AXIS_NUM]; // ˶0˶˶ȣλp + + MotionSpeedCtrl spdPara; // ٶȿƲ + + // ص + MotionCallbackCtrl callback; + + // Ϣ + int errInfo; // Ϣ + +}InterMotionCtrl; + +//-------------------------------------------------- +// λ˶ + +// +typedef struct +{ + // + u32 mvmtStatus; // ˶״̬0Ч1Ч + s32 movement; // λƲλ + + s32 thisIdx; + float thisBegPPS; // εٶ,Ҳ϶νʱٶ + float thisEndPPS; // νʱٶ + float thisRunPPS; // εٶ + float thisAddPPSS; // εмٶ + + //----״̬ + int bufsta; // ״̬ + int runsta; + s32 exeingIdx; + float exeingMaxPPS; + + s32 lastmvmt; // ϶ελ + float lastRunPPS; + float lastEndPPS; // ϴνʱٶȣҲDZΣִжΣʼٶȣÿαʱã + float lastAddPPSS; // + + int rslt; + int err; + +}MotionSwapData; + +typedef struct +{ + int motoIdx; // ˶ + + // ص + void (*RefreshPosition)(u32, s32*); // ˢ»ص + u32 refPosPara; // ˢ² + + void (*RefreshData)(u32, u32); // ˢ»ص + u32 refDatPara; // ˢº + + MotionSwapData swapData; // λƺٶ + + // Ϣ + int errInfo; // Ϣ + int exerslt; + int stopflag; + int runningflag; + + // м + +}ContinuousMotionCtrl; + + +#endif diff --git a/NxFuncs/network/ethernet.c b/NxFuncs/network/ethernet.c new file mode 100644 index 0000000..0333e64 --- /dev/null +++ b/NxFuncs/network/ethernet.c @@ -0,0 +1,686 @@ + +#define _IN_ETHERNET_C +#include "ethernet.h" +#include "inout.h" +#include "delay.h" +#include "tcpserver.h" +#include "tcpclient.h" +#include "udptrans.h" +#include "trigger.h" +#include "cpuid.h" +#include "crc16.h" + +//-------------------------------------------------------------------------- + + + + +//-------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------- + +void W5500IntConfig(void); +void RegNetCallBack(void); +void LoadDefNetParas(void); +int ChipParaConfig(void); +void NetworkParaConfig(void); + +//-------------------------------------------------------------------------- + + +void InitEthernet(void) +{ + W5500IntConfig(); // ж + + InitWNetSpi(); // ʼSpiͨѶ + + RegNetCallBack(); // ûص + + LoadDefNetParas(); // Ĭϲ + + InitNetConfig(); // оƬ +} + + +void InitNetConfig(void) +{ + ChipParaConfig(); // оƬ + +#if (SERVER_NUM > 0) + InitTcpServer(); + SetTcpKeepAlive(); +#endif + +#if (CLIENT_NUM > 0) + InitTcpClient(); +#endif + + NetworkParaConfig(); // +} + + +//-------------------------------------------------------------------------- + +// W5500 ж +void W5500IntConfig(void) +{ + +} + +//--------------------------------------------------------------------------- + +// ٽ +#define SPI_CrisEnter EnterCritical + +// ˳ٽ +#define SPI_CrisExit ExitCritical + +// Ƭѡź͵ƽ +#define SPI_CS_Select WNetNceOn + +// Ƭѡźߵƽ +#define SPI_CS_Deselect WNetNceOff + +#define SPI_ReadByte WNetSpiReadByte + +#define SPI_WriteByte WNetSpiWriteByte + + +void RegNetCallBack(void) +{ + // עٽ +// reg_wizchip_cris_cbfunc(SPI_CrisEnter, SPI_CrisExit); + + // עSPIƬѡźź + reg_wizchip_cs_cbfunc(SPI_CS_Select, SPI_CS_Deselect); + + // עд + reg_wizchip_spi_cbfunc(SPI_ReadByte, SPI_WriteByte); + + // עд +// reg_wizchip_spiburst_cbfunc(,); +} + +//--------------------------------------------------------------------------- + +void SetNetAddr(u32 ip, u32 mask, u32 gateway, u32 dns) +{ + // ԴIPַIP + g_netInfo.ip[0] = GETIP1(ip); + g_netInfo.ip[1] = GETIP2(ip); + g_netInfo.ip[2] = GETIP3(ip); + g_netInfo.ip[3] = GETIP4(ip); + + // + g_netInfo.sn[0] = GETIP1(mask); + g_netInfo.sn[1] = GETIP2(mask); + g_netInfo.sn[2] = GETIP3(mask); + g_netInfo.sn[3] = GETIP4(mask); + + // IP + g_netInfo.gw[0] = GETIP1(gateway); + g_netInfo.gw[1] = GETIP2(gateway); + g_netInfo.gw[2] = GETIP3(gateway); + g_netInfo.gw[3] = GETIP4(gateway); + + // DNSIP + g_netInfo.dns[0] = GETIP1(dns); + g_netInfo.dns[1] = GETIP2(dns); + g_netInfo.dns[2] = GETIP3(dns); + g_netInfo.dns[3] = GETIP4(dns); +} + +//--------------------------------------------------------------------------- + +// ͨCPUIDַ +void MakeMacAddr(u8 * mac) +{ + CpuId cpuid; + u16 crc; + u8 chrcksum; + + GetCpuID(&cpuid); + + crc = CalcCrc16(cpuid.buff, CPUID_LEN); + + chrcksum = CalcCheckSum(cpuid.buff, CPUID_LEN); + + if (mac != NULL) + { + mac[0] = 0x52; + mac[1] = 0x50; // Զ峧 "RP" + mac[2] = 0x4E; // ƷʶN + mac[3] = HIBYTE(crc); + mac[4] = LOBYTE(crc); + mac[5] = chrcksum; + } +} + +// Ĭ +void LoadDefNetParas(void) +{ +// + g_phyConfig.by = PHY_CONFBY_SW; // ͨ + g_phyConfig.mode = PHY_MODE_MANUAL; // ֶ + g_phyConfig.speed = PHY_SPEED_100; // 100 + g_phyConfig.duplex = PHY_DUPLEX_FULL; // ȫ˫ + +// + // Դַ + MakeMacAddr(g_netInfo.mac); + + g_localIP = LOCAL_IP; + g_netMask = NET_MASK; + g_gateWay = GATE_WAY; + g_dnsIP = DNS_IP; + + SetNetAddr(g_localIP, g_netMask, g_gateWay, g_dnsIP); + + // DHCPģʽ + g_netInfo.dhcp = NETINFO_STATIC; + +// ʱ + // ARPTO = time_100us x 0.1ms x (retry_cnt+1) + + g_netTimeout.retry_cnt = 3; + g_netTimeout.time_100us = 2000; + + // TCPTO = (2000) x 0.1ms // retry_cnt == 0 + // (2000 + 4000) x 0.1ms // retry_cnt == 1 + // (2000 + 4000 + 8000) x 0.1ms // retry_cnt == 2 + // (2000 + 4000 + 8000 + 16000) x 0.1ms // retry_cnt == 3 + // (2000 + 4000 + 8000 + 16000 + 32000 + ((retry_cnt - 4) x 64000)) x 0.1ms // retry_cnt >= 4 +} + +void GetChipConfig(void) +{ + ctlwizchip(CW_GET_PHYCONF, (void*)(&g_phyConfig)); + + printf("after set config, phy config is:\r\n"); + if (g_phyConfig.by == PHY_CONFBY_SW) + { + printf("config by software:\r\n"); + } + else if(g_phyConfig.by == PHY_CONFBY_HW) + { + printf("config by hardware:\r\n"); + } + else + { + printf("config by %d:\r\n", g_phyConfig.by); + } + + if (g_phyConfig.mode == PHY_MODE_AUTONEGO) + { + printf("mode is PHY_MODE_AUTONEGO:\r\n"); + } + else if (g_phyConfig.mode == PHY_MODE_MANUAL) + { + printf("mode is PHY_MODE_MANUAL:\r\n"); + } + else + { + printf("mode is %d:\r\n", g_phyConfig.mode); + } + + if (g_phyConfig.speed == PHY_SPEED_100) + { + printf("speed is PHY_SPEED_100:\r\n"); + } + else if (g_phyConfig.speed == PHY_SPEED_10) + { + printf("speed is PHY_SPEED_10:\r\n"); + } + else + { + printf("speed is %d:\r\n", g_phyConfig.speed); + } + + if (g_phyConfig.duplex == PHY_DUPLEX_FULL) + { + printf("duplex is PHY_DUPLEX_FULL:\r\n"); + } + else if (g_phyConfig.duplex == PHY_DUPLEX_HALF) + { + printf("duplex is PHY_DUPLEX_HALF:\r\n"); + } + else + { + printf("duplex is %d:\r\n", g_phyConfig.duplex); + } +} + + +// ʼоƬ +int ChipParaConfig(void) +{ + int rslt; + u8 tmp8; + u16 tmp16; + u8 chipId[6]; + + u8 memsize[2][8] = { + {2,2,2,2,2,2,2,2}, + {2,2,2,2,2,2,2,2}, + }; + + // λоƬ + ctlwizchip(CW_RESET_WIZCHIP, 0); + + DelayMs(10); + + // λ + ctlwizchip(CW_RESET_PHY, 0); + + DelayMs(10); + + // + ctlwizchip(CW_SET_PHYCONF, (void*)(&g_phyConfig)); + + DelayMs(10); + + // λ + ctlwizchip(CW_RESET_PHY, 0); + + DelayMs(10); + +#if (1) + // ȡ + GetChipConfig(); +#endif + + // WIZCHIP SOCKET ʼ + rslt = ctlwizchip(CW_INIT_WIZCHIP, (void*)(memsize)); + if(rslt == -1) + { + printf("WIZCHIP Initialized fail.\r\n"); + return -1; + } + + // ȡԴģʽ + ctlwizchip(CW_GET_PHYPOWMODE, (void*)(&tmp8)); + + printf("powermode is %d:\r\n", tmp8); + + // жλ + tmp16 = 0 + | IK_IP_CONFLICT // IPͻ + | IK_DEST_UNREACH // Ŀ겻ɴ + | IK_PPPOE_TERMINATED // PPPOEӹر + | IK_WOL // 绽 +// | IK_SOCK_ALL // еSOCKETж + | 0; + + ctlwizchip(CW_SET_INTRMASK, (void*)(&tmp16)); + ctlwizchip(CW_GET_INTRMASK, (void*)(&tmp16)); + + // жϱ־ + ctlwizchip(CW_GET_INTERRUPT, (void*)(&tmp16)); + tmp16 = 0 + | IK_IP_CONFLICT // IPͻ + | IK_DEST_UNREACH // Ŀ겻ɴ + | IK_PPPOE_TERMINATED // PPPOEӹر + | IK_WOL // 绽 + | IK_SOCK_ALL; // еSOCKETж + ctlwizchip(CW_CLR_INTERRUPT, (void*)(&tmp16)); + + // жϼʱ + tmp16 = 25; + ctlwizchip(CW_SET_INTRTIME, (void*)(&tmp16)); + ctlwizchip(CW_GET_INTRTIME, (void*)(&tmp16)); + + printf("intrtime is %d:\r\n", tmp16); + + // ȡоƬID + ctlwizchip(CW_GET_ID, (void*)(&chipId)); + printf("chip ID is %x %x %x %x %x %x\r\n", chipId[0],chipId[1],chipId[2],chipId[3],chipId[4],chipId[5]); + + // PHY״̬ + rslt = ctlwizchip(CW_GET_PHYLINK, (void*)(&tmp8)); + if(rslt == -1) + { + printf("Unknown PHY Link stauts.\r\n"); + } + else + { + if (tmp8 == PHY_LINK_ON) + { + printf("PHY Link ON.\r\n"); + } + else if (tmp8 == PHY_LINK_OFF) + { + printf("PHY Link OFF.\r\n"); + } + } + return rslt; +} + +// +void NetworkParaConfig(void) +{ + u8 tmp8; + u8 tmpstr[6]; + +// ģʽ + tmp8 = 0 +// | NM_FORCEARP // ǿARP +// | NM_WAKEONLAN // 绽 +// | NM_PINGBLOCK // ping +// | NM_PPPOE // PPPoE ģʽ + | 0; + ctlnetwork(CN_SET_NETMODE, (void*)(&tmp8)); + +// MACַIPַ룬DNSDHCP + ctlnetwork(CN_SET_NETINFO, (void*)(&g_netInfo)); + DelayMs(10); + ctlnetwork(CN_GET_NETINFO, (void*)(&g_netInfo)); + + ctlwizchip(CW_GET_ID, (void*)(tmpstr)); + + // ʾ +#if (1) + printf("\r\n=== %s NET CONF ===\r\n",(char*)(tmpstr)); + printf("MAC: %X:%X:%X:%X:%X:%X\r\n",g_netInfo.mac[0],g_netInfo.mac[1],g_netInfo.mac[2], + g_netInfo.mac[3],g_netInfo.mac[4],g_netInfo.mac[5]); + printf("SIP: %d.%d.%d.%d\r\n", g_netInfo.ip[0],g_netInfo.ip[1],g_netInfo.ip[2],g_netInfo.ip[3]); + printf("GAW: %d.%d.%d.%d\r\n", g_netInfo.gw[0],g_netInfo.gw[1],g_netInfo.gw[2],g_netInfo.gw[3]); + printf("SUB: %d.%d.%d.%d\r\n", g_netInfo.sn[0],g_netInfo.sn[1],g_netInfo.sn[2],g_netInfo.sn[3]); + printf("DNS: %d.%d.%d.%d\r\n", g_netInfo.dns[0],g_netInfo.dns[1],g_netInfo.dns[2],g_netInfo.dns[3]); + if (g_netInfo.dhcp == 1) + { + printf("alloc ip static\r\n"); + } + else if (g_netInfo.dhcp == 2) + { + printf("alloc ip by dhcp\r\n"); + } + printf("======================\r\n"); +#endif + + // ʱ + ctlnetwork(CN_SET_TIMEOUT, (void*)(&g_netTimeout)); +} + + +//----------------------------------------------------------------------------------------------------- + +// жϴ +void EthernetIntProc(void) +{ + u16 intr; + + // ж + ctlwizchip(CW_GET_INTERRUPT, &intr); // ȡж + ctlwizchip(CW_CLR_INTERRUPT, &intr); // жϱ־ + +#if (1) + // ж + if ((intr & IK_WOL) != 0) // 绽 + { + printf("Wake on LAN\r\n"); + } + + if ((intr & IK_PPPOE_TERMINATED) != 0) // PPPOEӹر + { + printf("PPPOE terminated\r\n"); + } + + if ((intr & IK_DEST_UNREACH) != 0) // Ŀ겻ɴ + { + printf("Destination Unreachable\r\n"); + } + + if ((intr & IK_IP_CONFLICT) != 0) // IPͻ + { + printf("IP conflict\r\n"); + } +#endif + +} + +//----------------------------------------------------------------------------------------------------- + +int IsSocketErr(int err) +{ + int rslt; + rslt = 0; + + switch(err) + { + case SOCK_OK: + printf("Result is OK about socket process.\r\n"); + break; + case SOCK_BUSY: + printf("Socket is busy on processing the operation. Valid only Non-block IO Mode.\r\n"); + break; + case SOCK_FATAL: + printf("Result is fatal error about socket process.\r\n"); + break; + case SOCKERR_SOCKNUM: + printf("Invalid socket number\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKOPT: + printf("Invalid socket option\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKINIT: + printf("Socket is not initialized or SIPR is Zero IP address when Sn_MR_TCP\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKCLOSED: + printf("Socket unexpectedly closed.\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKMODE: + printf("Invalid socket mode for socket operation.\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKFLAG: + printf("Invalid socket flag\r\n"); + rslt = -1; + break; + case SOCKERR_SOCKSTATUS: + printf("Invalid socket status for socket operation.\r\n"); + rslt = -1; + break; + case SOCKERR_ARG: + printf("Invalid argument.\r\n"); + rslt = -1; + break; + case SOCKERR_PORTZERO: + printf("Port number is zero\r\n"); + rslt = -1; + break; + case SOCKERR_IPINVALID: + printf("Invalid IP address\r\n"); + rslt = -1; + break; + case SOCKERR_TIMEOUT: + printf("Timeout occurred\r\n"); + rslt = -1; + break; + case SOCKERR_DATALEN: + printf("Data length is zero or greater than buffer max size.\r\n"); + rslt = -1; + break; + case SOCKERR_BUFFER: + printf("Socket buffer is not enough for data communication.\r\n"); + rslt = -1; + break; + case SOCKFATAL_PACKLEN: + printf("Invalid packet length. Fatal Error.\r\n"); + rslt = -1; + break; + default: + rslt = err; + break; + } + + EthernetServiceRun(); + + return rslt; +} + +//----------------------------------------------------------------------------------------------------- + +// Ethernet +// ܣݣӵͶв +// pDatBufݻ +// len, ݳ +// أ >= 0, ʵʷ +// أ -1, +// -2, ƽṹûгʼ +// -3, ջƴ + +int EthernetSendData(SocketCtrl * pCtrl, u8 * pDatBuf, int len) +{ + int rslt, err; + rslt = 0; + + if (pCtrl->type == TCP_SERVER || pCtrl->type == TCP_CLIENT) + { + if (pCtrl->status == STA_CONNECT) // + { + err = send(pCtrl->socket, pDatBuf, len); + + rslt = IsSocketErr(err); + } + else + { + printf("socket not connect\r\n"); + } + } +#if (UDP_NUM > 0) + else if (pCtrl->type == UDP_COMM) + { + err = UdpTransData(pDatBuf, len); // sendto + rslt = IsSocketErr(err); + } +#endif + else + { + + } + + return rslt; +} + +// ܣݣݴӽջȡ +// pDatŻ +// expectLenϣõݵĴС +// أ >= 0ʵʵõݵĴС +// -1, +// -2, ûгʼ +// -3, ջƴ + +int EthernetGetData(SocketCtrl * pCtrl, u8 * pDat, int expectLen) +{ + int rslt, err; + rslt = 0; + if (pCtrl->type == TCP_SERVER || pCtrl->type == TCP_CLIENT) + { + if (pCtrl->status == STA_CONNECT) // + { + err = recv(pCtrl->socket, pDat, expectLen); + rslt = IsSocketErr(err); + } + else + { + printf("socket not connect\r\n"); + } + } +#if (UDP_NUM > 0) + else if (pCtrl->type == UDP_COMM) + { + err = UdpRecvData(pDat, expectLen); // recvfrom + rslt = IsSocketErr(err); + } +#endif + else + { + + } + return rslt; +} + +// Ethernet ѽݳ +int EthernetGetRsLen(SocketCtrl * pCtrl) +{ + if (pCtrl->status == STA_CONNECT || +#if (UDP_NUM > 0) + pCtrl->type == UDP_COMM || +#endif + 0 ) // + { + return getSn_RX_RSR(pCtrl->socket); + } + else + { +// printf("socket not connect\r\n"); + return -1; + } +} + +// õͻг +int EthernetGetSdFreeLen(SocketCtrl * pCtrl) +{ + if (pCtrl->status == STA_CONNECT || +#if (UDP_NUM > 0) + pCtrl->type == UDP_COMM || +#endif + 0 ) // + { + return getSn_TX_FSR(pCtrl->socket); + } + else + { +// printf("socket not connect\r\n"); + return -1; + } +} + +SocketCtrl * GetCtrlFromSocketIdx(int sIdx) +{ + if (sIdx < UDP_SN_BEG+UDP_NUM) + { + return GetUdpCtrlFromSocketId(sIdx-UDP_SN_BEG); + } +#if (SERVER_NUM > 0) + else if (sIdx < TCP_SERVER_SN_BEG+SERVER_NUM) + { + return GetTcpServerCtrlFromSocketId(sIdx-TCP_SERVER_SN_BEG); + } +#endif +#if (CLIENT_NUM > 0) + else if (sIdx < TCP_CLIENT_SN_BEG+CLIENT_NUM) + { + return GetTcpClientCtrlFromSocketId(sIdx-TCP_CLIENT_SN_BEG); + } +#endif + else + { + return NULL; + } +} + +//------------------------------------------------------------------------------------------------------------------- + +// +void EthernetServiceRun() +{ +#if (SERVER_NUM > 0) + TcpServerRun(); +#endif + +#if (CLIENT_NUM > 0) + TcpClientRun(); +#endif + +#if (UDP_NUM > 0) +// UdpTransRun(); +#endif +} + + diff --git a/NxFuncs/network/ethernet.h b/NxFuncs/network/ethernet.h new file mode 100644 index 0000000..0d9bf2e --- /dev/null +++ b/NxFuncs/network/ethernet.h @@ -0,0 +1,232 @@ + +// ͨ SPI W5500ʵ̫ӹ + +#include "config.h" + +#ifndef __ETHERNET_H__ +#define __ETHERNET_H__ + + +#include "socket.h" + +//------------------------------------------------------------------- + +typedef struct +{ + int type; + int status; + u8 socket; + u32 localIp; + u16 localPort; + + u32 remoteIp; + u16 remotePort; + + int newconnect; + +}SocketCtrl; + + +#define STA_INIT 0 +#define STA_CLOSED 1 +#define STA_CONNECT 2 +#define STA_READY 3 + +#define FLAG_ENABLE 0x55AA + +#define MAX_TRANS_DATA 1500 + +//------------------------------------------------------------------- + +// ĬIPַ +#ifndef DEF_LOCAL_IP1 +#define DEF_LOCAL_IP1 192 +#endif +#ifndef DEF_LOCAL_IP2 +#define DEF_LOCAL_IP2 168 +#endif +#ifndef DEF_LOCAL_IP3 +#define DEF_LOCAL_IP3 16 +#endif +#ifndef DEF_LOCAL_IP4 +#define DEF_LOCAL_IP4 253 +#endif + +#ifndef DEF_GATEWAY_IP1 +#define DEF_GATEWAY_IP1 192 +#endif +#ifndef DEF_GATEWAY_IP2 +#define DEF_GATEWAY_IP2 168 +#endif +#ifndef DEF_GATEWAY_IP3 +#define DEF_GATEWAY_IP3 16 +#endif +#ifndef DEF_GATEWAY_IP4 +#define DEF_GATEWAY_IP4 1 +#endif + +#ifndef DEF_DNS_IP1 +#define DEF_DNS_IP1 192 +#endif +#ifndef DEF_DNS_IP2 +#define DEF_DNS_IP2 168 +#endif +#ifndef DEF_DNS_IP3 +#define DEF_DNS_IP3 16 +#endif +#ifndef DEF_DNS_IP4 +#define DEF_DNS_IP4 1 +#endif + +#ifndef DEF_REMOTE_IP1 +#define DEF_REMOTE_IP1 192 +#endif +#ifndef DEF_REMOTE_IP2 +#define DEF_REMOTE_IP2 168 +#endif +#ifndef DEF_REMOTE_IP3 +#define DEF_REMOTE_IP3 16 +#endif +#ifndef DEF_REMOTE_IP4 +#define DEF_REMOTE_IP4 41 +#endif + +//------------------------------------------------------------------- + +// UDP ͨѶ +#ifndef UDP_NUM +#define UDP_NUM 0 +#endif + +#define UDP_SN_BEG 0 +#define UDP_LOCAL_PORT_BEG 5100 +#define UDP_LOCAL_IP MAKEIP(DEF_LOCAL_IP1,DEF_LOCAL_IP2,DEF_LOCAL_IP3,DEF_LOCAL_IP4) + +#define UDP_REMOTE_PORT 5101 +#define UDP_REMOTE_IP MAKEIP(DEF_REMOTE_IP1,DEF_REMOTE_IP2,DEF_REMOTE_IP3,DEF_REMOTE_IP4) + +//------------------------------------------------------------------- + +#define UDP_COMM 0 +#define TCP_SERVER 1 +#define TCP_CLIENT 2 + +//------------------------------------------------------------------- + +#define LOCAL_IP MAKEIP(DEF_LOCAL_IP1,DEF_LOCAL_IP2,DEF_LOCAL_IP3,DEF_LOCAL_IP4) +#define NET_MASK MAKEIP(255,255,255,0) +#define GATE_WAY MAKEIP(DEF_GATEWAY_IP1,DEF_GATEWAY_IP2,DEF_GATEWAY_IP3,DEF_GATEWAY_IP4) +#define DNS_IP MAKEIP(DEF_DNS_IP1,DEF_DNS_IP2,DEF_DNS_IP3,DEF_DNS_IP4) + +#define TCP_REMOTE_IP MAKEIP(DEF_REMOTE_IP1,DEF_REMOTE_IP2,DEF_REMOTE_IP3,DEF_REMOTE_IP4) + +//------------------------------------------------------------------- + +// TCP server +#ifndef SERVER_NUM +#define SERVER_NUM 0 // +#endif + +#define TCP_SERVER_SN_BEG (UDP_SN_BEG+UDP_NUM) // TCP ʼ Socket , ֧ 1--7; SERVER_NUM+TCP_SERVER_SN_BEG С 7 +#define TCP_SERVER_PORT_BEG 5000 // ˿ں +#define TCP_SERVER_LOCAL_IP_BEG LOCAL_IP +#define TCP_SERVER_LOCAL_IP_ADD ((u32)1<<24) + +//------------------------------------------------------------------- + +// TCP client +#ifndef CLIENT_NUM +#define CLIENT_NUM 0 // ͻ˸ +#endif + +#define TCP_CLIENT_SN_BEG (TCP_SERVER_SN_BEG+SERVER_NUM) // TCP ͻʼ Socket , ֧ 1--7; SERVER_NUM+TCP_SERVER_SN_BEG С 7 +#define TCP_CLIENT_LOCAL_PORT_BEG (TCP_SERVER_PORT_BEG+8) // port +#define TCP_CLIENT_LOCAL_IP LOCAL_IP + +#define TCP_CLIENT_REMOTE_IP_BEG (TCP_REMOTE_IP+(TCP_CLIENT_REMOTE_IP_ADD*SERVER_NUM)) +#define TCP_CLIENT_REMOTE_PORT_BEG 502 + +#define TCP_CLIENT_REMOTE_IP_ADD ((u32)1<<24) + +//------------------------------------------------------------------- + + +//--------------------------------------------------------------------------- +// + +#ifdef _IN_ETHERNET_C + +wiz_NetInfo g_netInfo; +wiz_PhyConf g_phyConfig; +wiz_NetTimeout g_netTimeout; + +u32 g_localIP; +u32 g_netMask; +u32 g_gateWay; +u32 g_dnsIP; + + +#else + +extern wiz_NetInfo g_netInfo; +extern wiz_PhyConf g_phyConfig; +extern wiz_NetTimeout g_netTimeout; + + +extern u32 g_localIP; +extern u32 g_netMask; +extern u32 g_gateWay; +extern u32 g_dnsIP; + +#endif + +#define LINK_INIT 0 +#define LINK_UP 1 +#define LINK_WAIT 2 +#define LINK_DOWN 3 + +//------------------------------------------------------------------- + +// ʼ +void InitEthernet(void); + +void InitNetConfig(void); + +// жϴ +void EthernetIntProc(void); + +// ̫ +void EthernetServiceRun(void); + +void GetChipConfig(void); + +// Ethernet +int EthernetSendData(SocketCtrl * pCtrl, u8 * pDatBuf, int len); + +// Ethernet +int EthernetGetData(SocketCtrl * pCtrl, u8 * pDat, int expectLen); + +// Ethernet ѽݳ +int EthernetGetRsLen(SocketCtrl * pCtrl); + +// õͻг +int EthernetGetSdFreeLen(SocketCtrl * pCtrl); + +// ַ +void SetNetAddr(u32 ip, u32 mask, u32 gateway, u32 dns); + +SocketCtrl * GetCtrlFromSocketIdx(int sIdx); + +//------------------------------------------------------------------- + +#define MAKEIP(ip1,ip2,ip3,ip4) ((u32)( (((u32)(ip4&0xff))<<24) + (((u32)(ip3&0xff))<<16) + (((u32)(ip2&0xff))<<8) + (((u32)(ip1&0xff))<<0))) + +#define GETIP1(ip) ((u8)(((u32)(ip)) >> 0) & 0xFF) +#define GETIP2(ip) ((u8)(((u32)(ip)) >> 8) & 0xFF) +#define GETIP3(ip) ((u8)(((u32)(ip)) >> 16) & 0xFF) +#define GETIP4(ip) ((u8)(((u32)(ip)) >> 24) & 0xFF) + +//------------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.c b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.c new file mode 100644 index 0000000..68d4cb8 --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.c @@ -0,0 +1,267 @@ +//***************************************************************************** +// +//! \file w5500.c +//! \brief W5500 HAL Interface. +//! \version 1.0.2 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2014/05/01> V1.0.2 +//! 1. Implicit type casting -> Explicit type casting. Refer to M20140501 +//! Fixed the problem on porting into under 32bit MCU +//! Issued by Mathias ClauBen, wizwiki forum ID Think01 and bobh +//! Thank for your interesting and serious advices. +//! <2013/12/20> V1.0.1 +//! 1. Remove warning +//! 2. WIZCHIP_READ_BUF WIZCHIP_WRITE_BUF in case _WIZCHIP_IO_MODE_SPI_FDM_ +//! for loop optimized(removed). refer to M20131220 +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//***************************************************************************** +//#include +#include "w5500.h" + +#define _W5500_SPI_VDM_OP_ 0x00 +#define _W5500_SPI_FDM_OP_LEN1_ 0x01 +#define _W5500_SPI_FDM_OP_LEN2_ 0x02 +#define _W5500_SPI_FDM_OP_LEN4_ 0x03 + +#if (_WIZCHIP_ == 5500) +//////////////////////////////////////////////////// + +uint8_t WIZCHIP_READ(uint32_t AddrSel) +{ + uint8_t ret; + uint8_t spi_data[3]; + + WIZCHIP_CRITICAL_ENTER(); + WIZCHIP.CS._select(); + + AddrSel |= (_W5500_SPI_READ_ | _W5500_SPI_VDM_OP_); + + if(!WIZCHIP.IF.SPI._read_burst || !WIZCHIP.IF.SPI._write_burst) // byte operation + { + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0); + } + else // burst operation + { + spi_data[0] = (AddrSel & 0x00FF0000) >> 16; + spi_data[1] = (AddrSel & 0x0000FF00) >> 8; + spi_data[2] = (AddrSel & 0x000000FF) >> 0; + WIZCHIP.IF.SPI._write_burst(spi_data, 3); + } + ret = WIZCHIP.IF.SPI._read_byte(); + + WIZCHIP.CS._deselect(); + WIZCHIP_CRITICAL_EXIT(); + return ret; +} + +void WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb ) +{ + uint8_t spi_data[4]; + + WIZCHIP_CRITICAL_ENTER(); + WIZCHIP.CS._select(); + + AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_); + + //if(!WIZCHIP.IF.SPI._read_burst || !WIZCHIP.IF.SPI._write_burst) // byte operation + if(!WIZCHIP.IF.SPI._write_burst) // byte operation + { + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0); + WIZCHIP.IF.SPI._write_byte(wb); + } + else // burst operation + { + spi_data[0] = (AddrSel & 0x00FF0000) >> 16; + spi_data[1] = (AddrSel & 0x0000FF00) >> 8; + spi_data[2] = (AddrSel & 0x000000FF) >> 0; + spi_data[3] = wb; + WIZCHIP.IF.SPI._write_burst(spi_data, 4); + } + + WIZCHIP.CS._deselect(); + WIZCHIP_CRITICAL_EXIT(); +} + +void WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len) +{ + uint8_t spi_data[3]; + uint16_t i; + + WIZCHIP_CRITICAL_ENTER(); + WIZCHIP.CS._select(); + + AddrSel |= (_W5500_SPI_READ_ | _W5500_SPI_VDM_OP_); + + if(!WIZCHIP.IF.SPI._read_burst || !WIZCHIP.IF.SPI._write_burst) // byte operation + { + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0); + for(i = 0; i < len; i++) + pBuf[i] = WIZCHIP.IF.SPI._read_byte(); + } + else // burst operation + { + spi_data[0] = (AddrSel & 0x00FF0000) >> 16; + spi_data[1] = (AddrSel & 0x0000FF00) >> 8; + spi_data[2] = (AddrSel & 0x000000FF) >> 0; + WIZCHIP.IF.SPI._write_burst(spi_data, 3); + WIZCHIP.IF.SPI._read_burst(pBuf, len); + } + + WIZCHIP.CS._deselect(); + WIZCHIP_CRITICAL_EXIT(); +} + +void WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len) +{ + uint8_t spi_data[3]; + uint16_t i; + + WIZCHIP_CRITICAL_ENTER(); + WIZCHIP.CS._select(); + + AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_); + + if(!WIZCHIP.IF.SPI._write_burst) // byte operation + { + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8); + WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0); + for(i = 0; i < len; i++) + WIZCHIP.IF.SPI._write_byte(pBuf[i]); + } + else // burst operation + { + spi_data[0] = (AddrSel & 0x00FF0000) >> 16; + spi_data[1] = (AddrSel & 0x0000FF00) >> 8; + spi_data[2] = (AddrSel & 0x000000FF) >> 0; + WIZCHIP.IF.SPI._write_burst(spi_data, 3); + WIZCHIP.IF.SPI._write_burst(pBuf, len); + } + + WIZCHIP.CS._deselect(); + WIZCHIP_CRITICAL_EXIT(); +} + + +uint16_t getSn_TX_FSR(uint8_t sn) +{ + uint16_t val=0,val1=0; + + do + { + val1 = WIZCHIP_READ(Sn_TX_FSR(sn)); + val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1)); + if (val1 != 0) + { + val = WIZCHIP_READ(Sn_TX_FSR(sn)); + val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1)); + } + }while (val != val1); + return val; +} + + +uint16_t getSn_RX_RSR(uint8_t sn) +{ + uint16_t val=0,val1=0; + + do + { + val1 = WIZCHIP_READ(Sn_RX_RSR(sn)); + val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1)); + if (val1 != 0) + { + val = WIZCHIP_READ(Sn_RX_RSR(sn)); + val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1)); + } + }while (val != val1); + return val; +} + +void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len) +{ + uint16_t ptr = 0; + uint32_t addrsel = 0; + + if(len == 0) return; + ptr = getSn_TX_WR(sn); + //M20140501 : implict type casting -> explict type casting + //addrsel = (ptr << 8) + (WIZCHIP_TXBUF_BLOCK(sn) << 3); + addrsel = ((uint32_t)ptr << 8) + (WIZCHIP_TXBUF_BLOCK(sn) << 3); + // + WIZCHIP_WRITE_BUF(addrsel,wizdata, len); + + ptr += len; + setSn_TX_WR(sn,ptr); +} + +void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len) +{ + uint16_t ptr = 0; + uint32_t addrsel = 0; + + if(len == 0) return; + ptr = getSn_RX_RD(sn); + //M20140501 : implict type casting -> explict type casting + //addrsel = ((ptr << 8) + (WIZCHIP_RXBUF_BLOCK(sn) << 3); + addrsel = ((uint32_t)ptr << 8) + (WIZCHIP_RXBUF_BLOCK(sn) << 3); + // + WIZCHIP_READ_BUF(addrsel, wizdata, len); + ptr += len; + + setSn_RX_RD(sn,ptr); +} + + +void wiz_recv_ignore(uint8_t sn, uint16_t len) +{ + uint16_t ptr = 0; + + ptr = getSn_RX_RD(sn); + ptr += len; + setSn_RX_RD(sn,ptr); +} + +#endif diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.h b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.h new file mode 100644 index 0000000..3afc16e --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/W5500/w5500.h @@ -0,0 +1,2163 @@ +//***************************************************************************** +// +//! \file w5500.h +//! \brief W5500 HAL Header File. +//! \version 1.0.0 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//***************************************************************************** + +// + +#ifndef _W5500_H_ +#define _W5500_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "wizchip_conf.h" + +/// @cond DOXY_APPLY_CODE +#if (_WIZCHIP_ == 5500) +/// @endcond + +#define _W5500_IO_BASE_ 0x00000000 + +#define _W5500_SPI_READ_ (0x00 << 2) //< SPI interface Read operation in Control Phase +#define _W5500_SPI_WRITE_ (0x01 << 2) //< SPI interface Write operation in Control Phase + +#define WIZCHIP_CREG_BLOCK 0x00 //< Common register block +#define WIZCHIP_SREG_BLOCK(N) (1+4*N) //< Socket N register block +#define WIZCHIP_TXBUF_BLOCK(N) (2+4*N) //< Socket N Tx buffer address block +#define WIZCHIP_RXBUF_BLOCK(N) (3+4*N) //< Socket N Rx buffer address block + +#define WIZCHIP_OFFSET_INC(ADDR, N) (ADDR + (N<<8)) //< Increase offset address + + +/////////////////////////////////////// +// Definition For Legacy Chip Driver // +/////////////////////////////////////// +#define IINCHIP_READ(ADDR) WIZCHIP_READ(ADDR) ///< The defined for legacy chip driver +#define IINCHIP_WRITE(ADDR,VAL) WIZCHIP_WRITE(ADDR,VAL) ///< The defined for legacy chip driver +#define IINCHIP_READ_BUF(ADDR,BUF,LEN) WIZCHIP_READ_BUF(ADDR,BUF,LEN) ///< The defined for legacy chip driver +#define IINCHIP_WRITE_BUF(ADDR,BUF,LEN) WIZCHIP_WRITE(ADDR,BUF,LEN) ///< The defined for legacy chip driver + +////////////////////////////// +//-------------------------- defgroup --------------------------------- +/** + * @defgroup W5500 W5500 + * + * @brief WHIZCHIP register defines and I/O functions of @b W5500. + * + * - @ref WIZCHIP_register : @ref Common_register_group and @ref Socket_register_group + * - @ref WIZCHIP_IO_Functions : @ref Basic_IO_function, @ref Common_register_access_function and @ref Socket_register_access_function + */ + + +/** + * @defgroup WIZCHIP_register WIZCHIP register + * @ingroup W5500 + * + * @brief WHIZCHIP register defines register group of @b W5500. + * + * - @ref Common_register_group : Common register group + * - @ref Socket_register_group : \c SOCKET n register group + */ + + +/** + * @defgroup WIZCHIP_IO_Functions WIZCHIP I/O functions + * @ingroup W5500 + * + * @brief This supports the basic I/O functions for @ref WIZCHIP_register. + * + * - Basic I/O function \n + * WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() \n\n + * + * - @ref Common_register_group access functions \n + * -# @b Mode \n + * getMR(), setMR() + * -# @b Interrupt \n + * getIR(), setIR(), getIMR(), setIMR(), getSIR(), setSIR(), getSIMR(), setSIMR(), getINTLEVEL(), setINTLEVEL() + * -# Network Information \n + * getSHAR(), setSHAR(), getGAR(), setGAR(), getSUBR(), setSUBR(), getSIPR(), setSIPR() + * -# @b Retransmission \n + * getRCR(), setRCR(), getRTR(), setRTR() + * -# @b PPPoE \n + * getPTIMER(), setPTIMER(), getPMAGIC(), getPMAGIC(), getPSID(), setPSID(), getPHAR(), setPHAR(), getPMRU(), setPMRU() + * -# ICMP packet \n + * getUIPR(), getUPORTR() + * -# @b etc. \n + * getPHYCFGR(), setPHYCFGR(), getVERSIONR() \n\n + * + * - \ref Socket_register_group access functions \n + * -# SOCKET control \n + * getSn_MR(), setSn_MR(), getSn_CR(), setSn_CR(), getSn_IMR(), setSn_IMR(), getSn_IR(), setSn_IR() + * -# SOCKET information \n + * getSn_SR(), getSn_DHAR(), setSn_DHAR(), getSn_PORT(), setSn_PORT(), getSn_DIPR(), setSn_DIPR(), getSn_DPORT(), setSn_DPORT() + * getSn_MSSR(), setSn_MSSR() + * -# SOCKET communication \n + * getSn_RXBUF_SIZE(), setSn_RXBUF_SIZE(), getSn_TXBUF_SIZE(), setSn_TXBUF_SIZE() \n + * getSn_TX_RD(), getSn_TX_WR(), setSn_TX_WR() \n + * getSn_RX_RD(), setSn_RX_RD(), getSn_RX_WR() \n + * getSn_TX_FSR(), getSn_RX_RSR(), getSn_KPALVTR(), setSn_KPALVTR() + * -# IP header field \n + * getSn_FRAG(), setSn_FRAG(), getSn_TOS(), setSn_TOS() \n + * getSn_TTL(), setSn_TTL() + */ + + + +/** + * @defgroup Common_register_group Common register + * @ingroup WIZCHIP_register + * + * @brief Common register group\n + * It set the basic for the networking\n + * It set the configuration such as interrupt, network information, ICMP, etc. + * @details + * @sa MR : Mode register. + * @sa GAR, SUBR, SHAR, SIPR + * @sa INTLEVEL, IR, IMR, SIR, SIMR : Interrupt. + * @sa _RTR_, _RCR_ : Data retransmission. + * @sa PTIMER, PMAGIC, PHAR, PSID, PMRU : PPPoE. + * @sa UIPR, UPORTR : ICMP message. + * @sa PHYCFGR, VERSIONR : etc. + */ + + + +/** + * @defgroup Socket_register_group Socket register + * @ingroup WIZCHIP_register + * + * @brief Socket register group.\n + * Socket register configures and control SOCKETn which is necessary to data communication. + * @details + * @sa Sn_MR, Sn_CR, Sn_IR, Sn_IMR : SOCKETn Control + * @sa Sn_SR, Sn_PORT, Sn_DHAR, Sn_DIPR, Sn_DPORT : SOCKETn Information + * @sa Sn_MSSR, Sn_TOS, Sn_TTL, Sn_KPALVTR, Sn_FRAG : Internet protocol. + * @sa Sn_RXBUF_SIZE, Sn_TXBUF_SIZE, Sn_TX_FSR, Sn_TX_RD, Sn_TX_WR, Sn_RX_RSR, Sn_RX_RD, Sn_RX_WR : Data communication + */ + + + + /** + * @defgroup Basic_IO_function Basic I/O function + * @ingroup WIZCHIP_IO_Functions + * @brief These are basic input/output functions to read values from register or write values to register. + */ + +/** + * @defgroup Common_register_access_function Common register access functions + * @ingroup WIZCHIP_IO_Functions + * @brief These are functions to access common registers. + */ + +/** + * @defgroup Socket_register_access_function Socket register access functions + * @ingroup WIZCHIP_IO_Functions + * @brief These are functions to access socket registers. + */ + +//------------------------------- defgroup end -------------------------------------------- +//----------------------------- W5500 Common Registers IOMAP ----------------------------- +/** + * @ingroup Common_register_group + * @brief Mode Register address(R/W)\n + * @ref MR is used for S/W reset, ping block mode, PPPoE mode and etc. + * @details Each bit of @ref MR defined as follows. + * + * + * + *
7 6 5 4 3 2 1 0
RST Reserved WOL PB PPPoE Reserved FARP Reserved
+ * - \ref MR_RST : Reset + * - \ref MR_WOL : Wake on LAN + * - \ref MR_PB : Ping block + * - \ref MR_PPPOE : PPPoE mode + * - \ref MR_FARP : Force ARP mode + */ +#define MR (_W5500_IO_BASE_ + (0x0000 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Gateway IP Register address(R/W) + * @details @ref GAR configures the default gateway address. + */ +#define GAR (_W5500_IO_BASE_ + (0x0001 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Subnet mask Register address(R/W) + * @details @ref SUBR configures the subnet mask address. + */ +#define SUBR (_W5500_IO_BASE_ + (0x0005 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Source MAC Register address(R/W) + * @details @ref SHAR configures the source hardware address. + */ +#define SHAR (_W5500_IO_BASE_ + (0x0009 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Source IP Register address(R/W) + * @details @ref SIPR configures the source IP address. + */ +#define SIPR (_W5500_IO_BASE_ + (0x000F << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Set Interrupt low level timer register address(R/W) + * @details @ref INTLEVEL configures the Interrupt Assert Time. + */ +#define INTLEVEL (_W5500_IO_BASE_ + (0x0013 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Interrupt Register(R/W) + * @details @ref IR indicates the interrupt status. Each bit of @ref IR will be still until the bit will be written to by the host. + * If @ref IR is not equal to x00 INTn PIN is asserted to low until it is x00\n\n + * Each bit of @ref IR defined as follows. + * + * + * + *
7 6 5 4 3 2 1 0
CONFLICT UNREACH PPPoE MP Reserved Reserved Reserved Reserved
+ * - \ref IR_CONFLICT : IP conflict + * - \ref IR_UNREACH : Destination unreachable + * - \ref IR_PPPoE : PPPoE connection close + * - \ref IR_MP : Magic packet + */ +#define IR (_W5500_IO_BASE_ + (0x0015 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Interrupt mask register(R/W) + * @details @ref _IMR_ is used to mask interrupts. Each bit of @ref _IMR_ corresponds to each bit of @ref IR. + * When a bit of @ref _IMR_ is and the corresponding bit of @ref IR is an interrupt will be issued. In other words, + * if a bit of @ref _IMR_ is an interrupt will not be issued even if the corresponding bit of @ref IR is \n\n + * Each bit of @ref _IMR_ defined as the following. + * + * + * + *
7 6 5 4 3 2 1 0
IM_IR7 IM_IR6 IM_IR5 IM_IR4 Reserved Reserved Reserved Reserved
+ * - \ref IM_IR7 : IP Conflict Interrupt Mask + * - \ref IM_IR6 : Destination unreachable Interrupt Mask + * - \ref IM_IR5 : PPPoE Close Interrupt Mask + * - \ref IM_IR4 : Magic Packet Interrupt Mask + */ +//M20150401 : Rename SYMBOE ( Re-define error in a compile) +//#define IMR (_W5500_IO_BASE_ + (0x0016 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +#define _IMR_ (_W5500_IO_BASE_ + (0x0016 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Socket Interrupt Register(R/W) + * @details @ref SIR indicates the interrupt status of Socket.\n + * Each bit of @ref SIR be still until @ref Sn_IR is cleared by the host.\n + * If @ref Sn_IR is not equal to x00 the n-th bit of @ref SIR is and INTn PIN is asserted until @ref SIR is x00 */ +#define SIR (_W5500_IO_BASE_ + (0x0017 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Socket Interrupt Mask Register(R/W) + * @details Each bit of @ref SIMR corresponds to each bit of @ref SIR. + * When a bit of @ref SIMR is and the corresponding bit of @ref SIR is Interrupt will be issued. + * In other words, if a bit of @ref SIMR is an interrupt will be not issued even if the corresponding bit of @ref SIR is + */ +#define SIMR (_W5500_IO_BASE_ + (0x0018 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Timeout register address( 1 is 100us )(R/W) + * @details @ref _RTR_ configures the retransmission timeout period. The unit of timeout period is 100us and the default of @ref _RTR_ is x07D0. + * And so the default timeout period is 200ms(100us X 2000). During the time configured by @ref _RTR_, W5500 waits for the peer response + * to the packet that is transmitted by \ref Sn_CR (CONNECT, DISCON, CLOSE, SEND, SEND_MAC, SEND_KEEP command). + * If the peer does not respond within the @ref _RTR_ time, W5500 retransmits the packet or issues timeout. + */ +//M20150401 : Rename SYMBOE ( Re-define error in a compile) +//#define RTR (_W5500_IO_BASE_ + (0x0019 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +#define _RTR_ (_W5500_IO_BASE_ + (0x0019 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Retry count register(R/W) + * @details @ref _RCR_ configures the number of time of retransmission. + * When retransmission occurs as many as ref _RCR_+1 Timeout interrupt is issued (@ref Sn_IR_TIMEOUT = '1'). + */ +//M20150401 : Rename SYMBOE ( Re-define error in a compile) +//#define RCR (_W5500_IO_BASE_ + (0x001B << 8) + (WIZCHIP_CREG_BLOCK << 3)) +#define _RCR_ (_W5500_IO_BASE_ + (0x001B << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PPP LCP Request Timer register in PPPoE mode(R/W) + * @details @ref PTIMER configures the time for sending LCP echo request. The unit of time is 25ms. + */ +#define PTIMER (_W5500_IO_BASE_ + (0x001C << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PPP LCP Magic number register in PPPoE mode(R/W) + * @details @ref PMAGIC configures the 4bytes magic number to be used in LCP negotiation. + */ +#define PMAGIC (_W5500_IO_BASE_ + (0x001D << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PPP Destination MAC Register address(R/W) + * @details @ref PHAR configures the PPPoE server hardware address that is acquired during PPPoE connection process. + */ +#define PHAR (_W5500_IO_BASE_ + (0x001E << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PPP Session Identification Register(R/W) + * @details @ref PSID configures the PPPoE sever session ID acquired during PPPoE connection process. + */ +#define PSID (_W5500_IO_BASE_ + (0x0024 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PPP Maximum Segment Size(MSS) register(R/W) + * @details @ref PMRU configures the maximum receive unit of PPPoE. + */ +#define PMRU (_W5500_IO_BASE_ + (0x0026 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Unreachable IP register address in UDP mode(R) + * @details W5500 receives an ICMP packet(Destination port unreachable) when data is sent to a port number + * which socket is not open and @ref IR_UNREACH bit of @ref IR becomes and @ref UIPR & @ref UPORTR indicates + * the destination IP address & port number respectively. + */ +#define UIPR (_W5500_IO_BASE_ + (0x0028 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief Unreachable Port register address in UDP mode(R) + * @details W5500 receives an ICMP packet(Destination port unreachable) when data is sent to a port number + * which socket is not open and @ref IR_UNREACH bit of @ref IR becomes and @ref UIPR & @ref UPORTR + * indicates the destination IP address & port number respectively. + */ +#define UPORTR (_W5500_IO_BASE_ + (0x002C << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief PHY Status Register(R/W) + * @details @ref PHYCFGR configures PHY operation mode and resets PHY. In addition, @ref PHYCFGR indicates the status of PHY such as duplex, Speed, Link. + */ +#define PHYCFGR (_W5500_IO_BASE_ + (0x002E << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +// Reserved (_W5500_IO_BASE_ + (0x002F << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0030 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0031 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0032 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0033 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0034 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0035 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0036 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0037 << 8) + (WIZCHIP_CREG_BLOCK << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0038 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + +/** + * @ingroup Common_register_group + * @brief chip version register address(R) + * @details @ref VERSIONR always indicates the W5500 version as @b 0x04. + */ +#define VERSIONR (_W5500_IO_BASE_ + (0x0039 << 8) + (WIZCHIP_CREG_BLOCK << 3)) + + +//----------------------------- W5500 Socket Registers IOMAP ----------------------------- +/** + * @ingroup Socket_register_group + * @brief socket Mode register(R/W) + * @details @ref Sn_MR configures the option or protocol type of Socket n.\n\n + * Each bit of @ref Sn_MR defined as the following. + * + * + * + *
7 6 5 4 3 2 1 0
MULTI/MFEN BCASTB ND/MC/MMB UCASTB/MIP6B Protocol[3] Protocol[2] Protocol[1] Protocol[0]
+ * - @ref Sn_MR_MULTI : Support UDP Multicasting + * - @ref Sn_MR_BCASTB : Broadcast block in UDP Multicasting + * - @ref Sn_MR_ND : No Delayed Ack(TCP) flag + * - @ref Sn_MR_MC : IGMP version used in UDP mulitcasting + * - @ref Sn_MR_MMB : Multicast Blocking in @ref Sn_MR_MACRAW mode + * - @ref Sn_MR_UCASTB : Unicast Block in UDP Multicating + * - @ref Sn_MR_MIP6B : IPv6 packet Blocking in @ref Sn_MR_MACRAW mode + * - Protocol + * + * + * + * + * + * + *
Protocol[3] Protocol[2] Protocol[1] Protocol[0] @b Meaning
0 0 0 0 Closed
0 0 0 1 TCP
0 0 1 0 UDP
0 1 0 0 MACRAW
+ * - @ref Sn_MR_MACRAW : MAC LAYER RAW SOCK \n + * - @ref Sn_MR_UDP : UDP + * - @ref Sn_MR_TCP : TCP + * - @ref Sn_MR_CLOSE : Unused socket + * @note MACRAW mode should be only used in Socket 0. + */ +#define Sn_MR(N) (_W5500_IO_BASE_ + (0x0000 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Socket command register(R/W) + * @details This is used to set the command for Socket n such as OPEN, CLOSE, CONNECT, LISTEN, SEND, and RECEIVE.\n + * After W5500 accepts the command, the @ref Sn_CR register is automatically cleared to 0x00. + * Even though @ref Sn_CR is cleared to 0x00, the command is still being processed.\n + * To check whether the command is completed or not, please check the @ref Sn_IR or @ref Sn_SR. + * - @ref Sn_CR_OPEN : Initialize or open socket. + * - @ref Sn_CR_LISTEN : Wait connection request in TCP mode(Server mode) + * - @ref Sn_CR_CONNECT : Send connection request in TCP mode(Client mode) + * - @ref Sn_CR_DISCON : Send closing request in TCP mode. + * - @ref Sn_CR_CLOSE : Close socket. + * - @ref Sn_CR_SEND : Update TX buffer pointer and send data. + * - @ref Sn_CR_SEND_MAC : Send data with MAC address, so without ARP process. + * - @ref Sn_CR_SEND_KEEP : Send keep alive message. + * - @ref Sn_CR_RECV : Update RX buffer pointer and receive data. + */ +#define Sn_CR(N) (_W5500_IO_BASE_ + (0x0001 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Socket interrupt register(R) + * @details @ref Sn_IR indicates the status of Socket Interrupt such as establishment, termination, receiving data, timeout).\n + * When an interrupt occurs and the corresponding bit of @ref Sn_IMR is the corresponding bit of @ref Sn_IR becomes \n + * In order to clear the @ref Sn_IR bit, the host should write the bit to \n + * + * + * + *
7 6 5 4 3 2 1 0
Reserved Reserved Reserved SEND_OK TIMEOUT RECV DISCON CON
+ * - \ref Sn_IR_SENDOK : SEND_OK Interrupt + * - \ref Sn_IR_TIMEOUT : TIMEOUT Interrupt + * - \ref Sn_IR_RECV : RECV Interrupt + * - \ref Sn_IR_DISCON : DISCON Interrupt + * - \ref Sn_IR_CON : CON Interrupt + */ +#define Sn_IR(N) (_W5500_IO_BASE_ + (0x0002 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Socket status register(R) + * @details @ref Sn_SR indicates the status of Socket n.\n + * The status of Socket n is changed by @ref Sn_CR or some special control packet as SYN, FIN packet in TCP. + * @par Normal status + * - @ref SOCK_CLOSED : Closed + * - @ref SOCK_INIT : Initiate state + * - @ref SOCK_LISTEN : Listen state + * - @ref SOCK_ESTABLISHED : Success to connect + * - @ref SOCK_CLOSE_WAIT : Closing state + * - @ref SOCK_UDP : UDP socket + * - @ref SOCK_MACRAW : MAC raw mode socket + *@par Temporary status during changing the status of Socket n. + * - @ref SOCK_SYNSENT : This indicates Socket n sent the connect-request packet (SYN packet) to a peer. + * - @ref SOCK_SYNRECV : It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer. + * - @ref SOCK_FIN_WAIT : Connection state + * - @ref SOCK_CLOSING : Closing state + * - @ref SOCK_TIME_WAIT : Closing state + * - @ref SOCK_LAST_ACK : Closing state + */ +#define Sn_SR(N) (_W5500_IO_BASE_ + (0x0003 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief source port register(R/W) + * @details @ref Sn_PORT configures the source port number of Socket n. + * It is valid when Socket n is used in TCP/UDP mode. It should be set before OPEN command is ordered. + */ +#define Sn_PORT(N) (_W5500_IO_BASE_ + (0x0004 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Peer MAC register address(R/W) + * @details @ref Sn_DHAR configures the destination hardware address of Socket n when using SEND_MAC command in UDP mode or + * it indicates that it is acquired in ARP-process by CONNECT/SEND command. + */ +#define Sn_DHAR(N) (_W5500_IO_BASE_ + (0x0006 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Peer IP register address(R/W) + * @details @ref Sn_DIPR configures or indicates the destination IP address of Socket n. It is valid when Socket n is used in TCP/UDP mode. + * In TCP client mode, it configures an IP address of TCP serverbefore CONNECT command. + * In TCP server mode, it indicates an IP address of TCP clientafter successfully establishing connection. + * In UDP mode, it configures an IP address of peer to be received the UDP packet by SEND or SEND_MAC command. + */ +#define Sn_DIPR(N) (_W5500_IO_BASE_ + (0x000C << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Peer port register address(R/W) + * @details @ref Sn_DPORT configures or indicates the destination port number of Socket n. It is valid when Socket n is used in TCP/UDP mode. + * In TCP clientmode, it configures the listen port number of TCP serverbefore CONNECT command. + * In TCP Servermode, it indicates the port number of TCP client after successfully establishing connection. + * In UDP mode, it configures the port number of peer to be transmitted the UDP packet by SEND/SEND_MAC command. + */ +#define Sn_DPORT(N) (_W5500_IO_BASE_ + (0x0010 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Maximum Segment Size(Sn_MSSR0) register address(R/W) + * @details @ref Sn_MSSR configures or indicates the MTU(Maximum Transfer Unit) of Socket n. + */ +#define Sn_MSSR(N) (_W5500_IO_BASE_ + (0x0012 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +// Reserved (_W5500_IO_BASE_ + (0x0014 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief IP Type of Service(TOS) Register(R/W) + * @details @ref Sn_TOS configures the TOS(Type Of Service field in IP Header) of Socket n. + * It is set before OPEN command. + */ +#define Sn_TOS(N) (_W5500_IO_BASE_ + (0x0015 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +/** + * @ingroup Socket_register_group + * @brief IP Time to live(TTL) Register(R/W) + * @details @ref Sn_TTL configures the TTL(Time To Live field in IP header) of Socket n. + * It is set before OPEN command. + */ +#define Sn_TTL(N) (_W5500_IO_BASE_ + (0x0016 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0017 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0018 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x0019 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x001A << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x001B << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x001C << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) +// Reserved (_W5500_IO_BASE_ + (0x001D << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Receive memory size register(R/W) + * @details @ref Sn_RXBUF_SIZE configures the RX buffer block size of Socket n. + * Socket n RX Buffer Block size can be configured with 1,2,4,8, and 16 Kbytes. + * If a different size is configured, the data cannot be normally received from a peer. + * Although Socket n RX Buffer Block size is initially configured to 2Kbytes, + * user can re-configure its size using @ref Sn_RXBUF_SIZE. The total sum of @ref Sn_RXBUF_SIZE can not be exceed 16Kbytes. + * When exceeded, the data reception error is occurred. + */ +#define Sn_RXBUF_SIZE(N) (_W5500_IO_BASE_ + (0x001E << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Transmit memory size register(R/W) + * @details @ref Sn_TXBUF_SIZE configures the TX buffer block size of Socket n. Socket n TX Buffer Block size can be configured with 1,2,4,8, and 16 Kbytes. + * If a different size is configured, the data can�t be normally transmitted to a peer. + * Although Socket n TX Buffer Block size is initially configured to 2Kbytes, + * user can be re-configure its size using @ref Sn_TXBUF_SIZE. The total sum of @ref Sn_TXBUF_SIZE can not be exceed 16Kbytes. + * When exceeded, the data transmission error is occurred. + */ +#define Sn_TXBUF_SIZE(N) (_W5500_IO_BASE_ + (0x001F << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Transmit free memory size register(R) + * @details @ref Sn_TX_FSR indicates the free size of Socket n TX Buffer Block. It is initialized to the configured size by @ref Sn_TXBUF_SIZE. + * Data bigger than @ref Sn_TX_FSR should not be saved in the Socket n TX Buffer because the bigger data overwrites the previous saved data not yet sent. + * Therefore, check before saving the data to the Socket n TX Buffer, and if data is equal or smaller than its checked size, + * transmit the data with SEND/SEND_MAC command after saving the data in Socket n TX buffer. But, if data is bigger than its checked size, + * transmit the data after dividing into the checked size and saving in the Socket n TX buffer. + */ +#define Sn_TX_FSR(N) (_W5500_IO_BASE_ + (0x0020 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Transmit memory read pointer register address(R) + * @details @ref Sn_TX_RD is initialized by OPEN command. However, if Sn_MR(P[3:0]) is TCP mode(001, it is re-initialized while connecting with TCP. + * After its initialization, it is auto-increased by SEND command. + * SEND command transmits the saved data from the current @ref Sn_TX_RD to the @ref Sn_TX_WR in the Socket n TX Buffer. + * After transmitting the saved data, the SEND command increases the @ref Sn_TX_RD as same as the @ref Sn_TX_WR. + * If its increment value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs), + * then the carry bit is ignored and will automatically update with the lower 16bits value. + */ +#define Sn_TX_RD(N) (_W5500_IO_BASE_ + (0x0022 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Transmit memory write pointer register address(R/W) + * @details @ref Sn_TX_WR is initialized by OPEN command. However, if Sn_MR(P[3:0]) is TCP mode(001, it is re-initialized while connecting with TCP.\n + * It should be read or be updated like as follows.\n + * 1. Read the starting address for saving the transmitting data.\n + * 2. Save the transmitting data from the starting address of Socket n TX buffer.\n + * 3. After saving the transmitting data, update @ref Sn_TX_WR to the increased value as many as transmitting data size. + * If the increment value exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry bit occurs), + * then the carry bit is ignored and will automatically update with the lower 16bits value.\n + * 4. Transmit the saved data in Socket n TX Buffer by using SEND/SEND command + */ +#define Sn_TX_WR(N) (_W5500_IO_BASE_ + (0x0024 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Received data size register(R) + * @details @ref Sn_RX_RSR indicates the data size received and saved in Socket n RX Buffer. + * @ref Sn_RX_RSR does not exceed the @ref Sn_RXBUF_SIZE and is calculated as the difference between + * �Socket n RX Write Pointer (@ref Sn_RX_WR)and �Socket n RX Read Pointer (@ref Sn_RX_RD) + */ +#define Sn_RX_RSR(N) (_W5500_IO_BASE_ + (0x0026 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Read point of Receive memory(R/W) + * @details @ref Sn_RX_RD is initialized by OPEN command. Make sure to be read or updated as follows.\n + * 1. Read the starting save address of the received data.\n + * 2. Read data from the starting address of Socket n RX Buffer.\n + * 3. After reading the received data, Update @ref Sn_RX_RD to the increased value as many as the reading size. + * If the increment value exceeds the maximum value 0xFFFF, that is, is greater than 0x10000 and the carry bit occurs, + * update with the lower 16bits value ignored the carry bit.\n + * 4. Order RECV command is for notifying the updated @ref Sn_RX_RD to W5500. + */ +#define Sn_RX_RD(N) (_W5500_IO_BASE_ + (0x0028 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Write point of Receive memory(R) + * @details @ref Sn_RX_WR is initialized by OPEN command and it is auto-increased by the data reception. + * If the increased value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs), + * then the carry bit is ignored and will automatically update with the lower 16bits value. + */ +#define Sn_RX_WR(N) (_W5500_IO_BASE_ + (0x002A << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief socket interrupt mask register(R) + * @details @ref Sn_IMR masks the interrupt of Socket n. + * Each bit corresponds to each bit of @ref Sn_IR. When a Socket n Interrupt is occurred and the corresponding bit of @ref Sn_IMR is + * the corresponding bit of @ref Sn_IR becomes When both the corresponding bit of @ref Sn_IMR and @ref Sn_IR are and the n-th bit of @ref IR is + * Host is interrupted by asserted INTn PIN to low. + */ +#define Sn_IMR(N) (_W5500_IO_BASE_ + (0x002C << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Fragment field value in IP header register(R/W) + * @details @ref Sn_FRAG configures the FRAG(Fragment field in IP header). + */ +#define Sn_FRAG(N) (_W5500_IO_BASE_ + (0x002D << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +/** + * @ingroup Socket_register_group + * @brief Keep Alive Timer register(R/W) + * @details @ref Sn_KPALVTR configures the transmitting timer of �KEEP ALIVE(KA)packet of SOCKETn. It is valid only in TCP mode, + * and ignored in other modes. The time unit is 5s. + * KA packet is transmittable after @ref Sn_SR is changed to SOCK_ESTABLISHED and after the data is transmitted or received to/from a peer at least once. + * In case of '@ref Sn_KPALVTR > 0', W5500 automatically transmits KA packet after time-period for checking the TCP connection (Auto-keepalive-process). + * In case of '@ref Sn_KPALVTR = 0', Auto-keep-alive-process will not operate, + * and KA packet can be transmitted by SEND_KEEP command by the host (Manual-keep-alive-process). + * Manual-keep-alive-process is ignored in case of '@ref Sn_KPALVTR > 0'. + */ +#define Sn_KPALVTR(N) (_W5500_IO_BASE_ + (0x002F << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + +//#define Sn_TSR(N) (_W5500_IO_BASE_ + (0x0030 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) + + +//----------------------------- W5500 Register values ----------------------------- + +/* MODE register values */ +/** + * @brief Reset + * @details If this bit is All internal registers will be initialized. It will be automatically cleared as after S/W reset. + */ +#define MR_RST 0x80 + +/** + * @brief Wake on LAN + * @details 0 : Disable WOL mode\n + * 1 : Enable WOL mode\n + * If WOL mode is enabled and the received magic packet over UDP has been normally processed, the Interrupt PIN (INTn) asserts to low. + * When using WOL mode, the UDP Socket should be opened with any source port number. (Refer to Socket n Mode Register (@ref Sn_MR) for opening Socket.) + * @note The magic packet over UDP supported by W5500 consists of 6 bytes synchronization stream (xFFFFFFFFFFFF and + * 16 times Target MAC address stream in UDP payload. The options such like password are ignored. You can use any UDP source port number for WOL mode. + */ +#define MR_WOL 0x20 + +/** + * @brief Ping block + * @details 0 : Disable Ping block\n + * 1 : Enable Ping block\n + * If the bit is it blocks the response to a ping request. + */ +#define MR_PB 0x10 + +/** + * @brief Enable PPPoE + * @details 0 : DisablePPPoE mode\n + * 1 : EnablePPPoE mode\n + * If you use ADSL, this bit should be + */ +#define MR_PPPOE 0x08 + +/** + * @brief Enable UDP_FORCE_ARP CHECHK + * @details 0 : Disable Force ARP mode\n + * 1 : Enable Force ARP mode\n + * In Force ARP mode, It forces on sending ARP Request whenever data is sent. + */ +#define MR_FARP 0x02 + +/* IR register values */ +/** + * @brief Check IP conflict. + * @details Bit is set as when own source IP address is same with the sender IP address in the received ARP request. + */ +#define IR_CONFLICT 0x80 + +/** + * @brief Get the destination unreachable message in UDP sending. + * @details When receiving the ICMP (Destination port unreachable) packet, this bit is set as + * When this bit is Destination Information such as IP address and Port number may be checked with the corresponding @ref UIPR & @ref UPORTR. + */ +#define IR_UNREACH 0x40 + +/** + * @brief Get the PPPoE close message. + * @details When PPPoE is disconnected during PPPoE mode, this bit is set. + */ +#define IR_PPPoE 0x20 + +/** + * @brief Get the magic packet interrupt. + * @details When WOL mode is enabled and receives the magic packet over UDP, this bit is set. + */ +#define IR_MP 0x10 + + +/* PHYCFGR register value */ +#define PHYCFGR_RST ~(1<<7) //< For PHY reset, must operate AND mask. +#define PHYCFGR_OPMD (1<<6) // Configre PHY with OPMDC value +#define PHYCFGR_OPMDC_ALLA (7<<3) +#define PHYCFGR_OPMDC_PDOWN (6<<3) +#define PHYCFGR_OPMDC_NA (5<<3) +#define PHYCFGR_OPMDC_100FA (4<<3) +#define PHYCFGR_OPMDC_100F (3<<3) +#define PHYCFGR_OPMDC_100H (2<<3) +#define PHYCFGR_OPMDC_10F (1<<3) +#define PHYCFGR_OPMDC_10H (0<<3) +#define PHYCFGR_DPX_FULL (1<<2) +#define PHYCFGR_DPX_HALF (0<<2) +#define PHYCFGR_SPD_100 (1<<1) +#define PHYCFGR_SPD_10 (0<<1) +#define PHYCFGR_LNK_ON (1<<0) +#define PHYCFGR_LNK_OFF (0<<0) + +/* IMR register values */ +/** + * @brief IP Conflict Interrupt Mask. + * @details 0: Disable IP Conflict Interrupt\n + * 1: Enable IP Conflict Interrupt + */ +#define IM_IR7 0x80 + +/** + * @brief Destination unreachable Interrupt Mask. + * @details 0: Disable Destination unreachable Interrupt\n + * 1: Enable Destination unreachable Interrupt + */ +#define IM_IR6 0x40 + +/** + * @brief PPPoE Close Interrupt Mask. + * @details 0: Disable PPPoE Close Interrupt\n + * 1: Enable PPPoE Close Interrupt + */ +#define IM_IR5 0x20 + +/** + * @brief Magic Packet Interrupt Mask. + * @details 0: Disable Magic Packet Interrupt\n + * 1: Enable Magic Packet Interrupt + */ +#define IM_IR4 0x10 + +/* Sn_MR Default values */ +/** + * @brief Support UDP Multicasting + * @details 0 : disable Multicasting\n + * 1 : enable Multicasting\n + * This bit is applied only during UDP mode(P[3:0] = 010.\n + * To use multicasting, @ref Sn_DIPR & @ref Sn_DPORT should be respectively configured with the multicast group IP address & port number + * before Socket n is opened by OPEN command of @ref Sn_CR. + */ +#define Sn_MR_MULTI 0x80 + +/** + * @brief Broadcast block in UDP Multicasting. + * @details 0 : disable Broadcast Blocking\n + * 1 : enable Broadcast Blocking\n + * This bit blocks to receive broadcasting packet during UDP mode(P[3:0] = 010.\m + * In addition, This bit does when MACRAW mode(P[3:0] = 100 + */ +#define Sn_MR_BCASTB 0x40 + +/** + * @brief No Delayed Ack(TCP), Multicast flag + * @details 0 : Disable No Delayed ACK option\n + * 1 : Enable No Delayed ACK option\n + * This bit is applied only during TCP mode (P[3:0] = 001.\n + * When this bit is It sends the ACK packet without delay as soon as a Data packet is received from a peer.\n + * When this bit is It sends the ACK packet after waiting for the timeout time configured by @ref _RTR_. + */ +#define Sn_MR_ND 0x20 + +/** + * @brief Unicast Block in UDP Multicasting + * @details 0 : disable Unicast Blocking\n + * 1 : enable Unicast Blocking\n + * This bit blocks receiving the unicast packet during UDP mode(P[3:0] = 010 and MULTI = + */ +#define Sn_MR_UCASTB 0x10 + +/** + * @brief MAC LAYER RAW SOCK + * @details This configures the protocol mode of Socket n. + * @note MACRAW mode should be only used in Socket 0. + */ +#define Sn_MR_MACRAW 0x04 + +#define Sn_MR_IPRAW 0x03 /**< IP LAYER RAW SOCK */ + +/** + * @brief UDP + * @details This configures the protocol mode of Socket n. + */ +#define Sn_MR_UDP 0x02 + +/** + * @brief TCP + * @details This configures the protocol mode of Socket n. + */ +#define Sn_MR_TCP 0x01 + +/** + * @brief Unused socket + * @details This configures the protocol mode of Socket n. + */ +#define Sn_MR_CLOSE 0x00 + +/* Sn_MR values used with Sn_MR_MACRAW */ +/** + * @brief MAC filter enable in @ref Sn_MR_MACRAW mode + * @details 0 : disable MAC Filtering\n + * 1 : enable MAC Filtering\n + * This bit is applied only during MACRAW mode(P[3:0] = 100.\n + * When set as W5500 can only receive broadcasting packet or packet sent to itself. + * When this bit is W5500 can receive all packets on Ethernet. + * If user wants to implement Hybrid TCP/IP stack, + * it is recommended that this bit is set as for reducing host overhead to process the all received packets. + */ +#define Sn_MR_MFEN Sn_MR_MULTI + +/** + * @brief Multicast Blocking in @ref Sn_MR_MACRAW mode + * @details 0 : using IGMP version 2\n + * 1 : using IGMP version 1\n + * This bit is applied only during UDP mode(P[3:0] = 010 and MULTI = + * It configures the version for IGMP messages (Join/Leave/Report). + */ +#define Sn_MR_MMB Sn_MR_ND + +/** + * @brief IPv6 packet Blocking in @ref Sn_MR_MACRAW mode + * @details 0 : disable IPv6 Blocking\n + * 1 : enable IPv6 Blocking\n + * This bit is applied only during MACRAW mode (P[3:0] = 100. It blocks to receiving the IPv6 packet. + */ +#define Sn_MR_MIP6B Sn_MR_UCASTB + +/* Sn_MR value used with Sn_MR_UDP & Sn_MR_MULTI */ +/** + * @brief IGMP version used in UDP mulitcasting + * @details 0 : disable Multicast Blocking\n + * 1 : enable Multicast Blocking\n + * This bit is applied only when MACRAW mode(P[3:0] = 100. It blocks to receive the packet with multicast MAC address. + */ +#define Sn_MR_MC Sn_MR_ND + +/* Sn_MR alternate values */ +/** + * @brief For Berkeley Socket API + */ +#define SOCK_STREAM Sn_MR_TCP + +/** + * @brief For Berkeley Socket API + */ +#define SOCK_DGRAM Sn_MR_UDP + + +/* Sn_CR values */ +/** + * @brief Initialize or open socket + * @details Socket n is initialized and opened according to the protocol selected in Sn_MR(P3:P0). + * The table below shows the value of @ref Sn_SR corresponding to @ref Sn_MR.\n + * + * + * + * + * + * + *
\b Sn_MR (P[3:0]) \b Sn_SR
Sn_MR_CLOSE (000)
Sn_MR_TCP (001) SOCK_INIT (0x13)
Sn_MR_UDP (010) SOCK_UDP (0x22)
S0_MR_MACRAW (100) SOCK_MACRAW (0x02)
+ */ +#define Sn_CR_OPEN 0x01 + +/** + * @brief Wait connection request in TCP mode(Server mode) + * @details This is valid only in TCP mode (\ref Sn_MR(P3:P0) = \ref Sn_MR_TCP). + * In this mode, Socket n operates as a TCP serverand waits for connection-request (SYN packet) from any TCP client + * The @ref Sn_SR changes the state from \ref SOCK_INIT to \ref SOCKET_LISTEN. + * When a TCP clientconnection request is successfully established, + * the @ref Sn_SR changes from SOCK_LISTEN to SOCK_ESTABLISHED and the @ref Sn_IR(0) becomes + * But when a TCP clientconnection request is failed, @ref Sn_IR(3) becomes and the status of @ref Sn_SR changes to SOCK_CLOSED. + */ +#define Sn_CR_LISTEN 0x02 + +/** + * @brief Send connection request in TCP mode(Client mode) + * @details To connect, a connect-request (SYN packet) is sent to TCP serverconfigured by @ref Sn_DIPR & Sn_DPORT(destination address & port). + * If the connect-request is successful, the @ref Sn_SR is changed to @ref SOCK_ESTABLISHED and the Sn_IR(0) becomes \n\n + * The connect-request fails in the following three cases.\n + * 1. When a @b ARPTO occurs (@ref Sn_IR[3] = ) because destination hardware address is not acquired through the ARP-process.\n + * 2. When a @b SYN/ACK packet is not received and @b TCPTO (Sn_IR(3) = )\n + * 3. When a @b RST packet is received instead of a @b SYN/ACK packet. In these cases, @ref Sn_SR is changed to @ref SOCK_CLOSED. + * @note This is valid only in TCP mode and operates when Socket n acts as TCP client + */ +#define Sn_CR_CONNECT 0x04 + +/** + * @brief Send closing request in TCP mode + * @details Regardless of TCP serveror TCP client the DISCON command processes the disconnect-process (b>Active closeor Passive close.\n + * @par Active close + * it transmits disconnect-request(FIN packet) to the connected peer\n + * @par Passive close + * When FIN packet is received from peer, a FIN packet is replied back to the peer.\n + * @details When the disconnect-process is successful (that is, FIN/ACK packet is received successfully), @ref Sn_SR is changed to @ref SOCK_CLOSED.\n + * Otherwise, TCPTO occurs (\ref Sn_IR(3)='1') and then @ref Sn_SR is changed to @ref SOCK_CLOSED. + * @note Valid only in TCP mode. + */ +#define Sn_CR_DISCON 0x08 + +/** + * @brief Close socket + * @details Sn_SR is changed to @ref SOCK_CLOSED. + */ +#define Sn_CR_CLOSE 0x10 + +/** + * @brief Update TX buffer pointer and send data + * @details SEND transmits all the data in the Socket n TX buffer.\n + * For more details, please refer to Socket n TX Free Size Register (@ref Sn_TX_FSR), Socket n, + * TX Write Pointer Register(@ref Sn_TX_WR), and Socket n TX Read Pointer Register(@ref Sn_TX_RD). + */ +#define Sn_CR_SEND 0x20 + +/** + * @brief Send data with MAC address, so without ARP process + * @details The basic operation is same as SEND.\n + * Normally SEND transmits data after destination hardware address is acquired by the automatic ARP-process(Address Resolution Protocol).\n + * But SEND_MAC transmits data without the automatic ARP-process.\n + * In this case, the destination hardware address is acquired from @ref Sn_DHAR configured by host, instead of APR-process. + * @note Valid only in UDP mode. + */ +#define Sn_CR_SEND_MAC 0x21 + +/** + * @brief Send keep alive message + * @details It checks the connection status by sending 1byte keep-alive packet.\n + * If the peer can not respond to the keep-alive packet during timeout time, the connection is terminated and the timeout interrupt will occur. + * @note Valid only in TCP mode. + */ +#define Sn_CR_SEND_KEEP 0x22 + +/** + * @brief Update RX buffer pointer and receive data + * @details RECV completes the processing of the received data in Socket n RX Buffer by using a RX read pointer register (@ref Sn_RX_RD).\n + * For more details, refer to Socket n RX Received Size Register (@ref Sn_RX_RSR), Socket n RX Write Pointer Register (@ref Sn_RX_WR), + * and Socket n RX Read Pointer Register (@ref Sn_RX_RD). + */ +#define Sn_CR_RECV 0x40 + +/* Sn_IR values */ +/** + * @brief SEND_OK Interrupt + * @details This is issued when SEND command is completed. + */ +#define Sn_IR_SENDOK 0x10 + +/** + * @brief TIMEOUT Interrupt + * @details This is issued when ARPTO or TCPTO occurs. + */ +#define Sn_IR_TIMEOUT 0x08 + +/** + * @brief RECV Interrupt + * @details This is issued whenever data is received from a peer. + */ +#define Sn_IR_RECV 0x04 + +/** + * @brief DISCON Interrupt + * @details This is issued when FIN or FIN/ACK packet is received from a peer. + */ +#define Sn_IR_DISCON 0x02 + +/** + * @brief CON Interrupt + * @details This is issued one time when the connection with peer is successful and then @ref Sn_SR is changed to @ref SOCK_ESTABLISHED. + */ +#define Sn_IR_CON 0x01 + +/* Sn_SR values */ +/** + * @brief Closed + * @details This indicates that Socket n is released.\n + * When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to @ref SOCK_CLOSED regardless of previous status. + */ +#define SOCK_CLOSED 0x00 + +/** + * @brief Initiate state + * @details This indicates Socket n is opened with TCP mode.\n + * It is changed to @ref SOCK_INIT when @ref Sn_MR(P[3:0]) = 001 and OPEN command is ordered.\n + * After @ref SOCK_INIT, user can use LISTEN /CONNECT command. + */ +#define SOCK_INIT 0x13 + +/** + * @brief Listen state + * @details This indicates Socket n is operating as TCP servermode and waiting for connection-request (SYN packet) from a peer TCP client.\n + * It will change to @ref SOCK_ESTALBLISHED when the connection-request is successfully accepted.\n + * Otherwise it will change to @ref SOCK_CLOSED after TCPTO @ref Sn_IR(TIMEOUT) = '1') is occurred. + */ +#define SOCK_LISTEN 0x14 + +/** + * @brief Connection state + * @details This indicates Socket n sent the connect-request packet (SYN packet) to a peer.\n + * It is temporarily shown when @ref Sn_SR is changed from @ref SOCK_INIT to @ref SOCK_ESTABLISHED by CONNECT command.\n + * If connect-accept(SYN/ACK packet) is received from the peer at SOCK_SYNSENT, it changes to @ref SOCK_ESTABLISHED.\n + * Otherwise, it changes to @ref SOCK_CLOSED after TCPTO (@ref Sn_IR[TIMEOUT] = '1') is occurred. + */ +#define SOCK_SYNSENT 0x15 + +/** + * @brief Connection state + * @details It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.\n + * If socket n sends the response (SYN/ACK packet) to the peer successfully, it changes to @ref SOCK_ESTABLISHED. \n + * If not, it changes to @ref SOCK_CLOSED after timeout (@ref Sn_IR[TIMEOUT] = '1') is occurred. + */ +#define SOCK_SYNRECV 0x16 + +/** + * @brief Success to connect + * @details This indicates the status of the connection of Socket n.\n + * It changes to @ref SOCK_ESTABLISHED when the TCP SERVERprocessed the SYN packet from the TCP CLIENTduring @ref SOCK_LISTEN, or + * when the CONNECT command is successful.\n + * During @ref SOCK_ESTABLISHED, DATA packet can be transferred using SEND or RECV command. + */ +#define SOCK_ESTABLISHED 0x17 + +/** + * @brief Closing state + * @details These indicate Socket n is closing.\n + * These are shown in disconnect-process such as active-close and passive-close.\n + * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. + */ +#define SOCK_FIN_WAIT 0x18 + +/** + * @brief Closing state + * @details These indicate Socket n is closing.\n + * These are shown in disconnect-process such as active-close and passive-close.\n + * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. + */ +#define SOCK_CLOSING 0x1A + +/** + * @brief Closing state + * @details These indicate Socket n is closing.\n + * These are shown in disconnect-process such as active-close and passive-close.\n + * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. + */ +#define SOCK_TIME_WAIT 0x1B + +/** + * @brief Closing state + * @details This indicates Socket n received the disconnect-request (FIN packet) from the connected peer.\n + * This is half-closing status, and data can be transferred.\n + * For full-closing, DISCON command is used. But For just-closing, CLOSE command is used. + */ +#define SOCK_CLOSE_WAIT 0x1C + +/** + * @brief Closing state + * @details This indicates Socket n is waiting for the response (FIN/ACK packet) to the disconnect-request (FIN packet) by passive-close.\n + * It changes to @ref SOCK_CLOSED when Socket n received the response successfully, or when timeout(@ref Sn_IR[TIMEOUT] = '1') is occurred. + */ +#define SOCK_LAST_ACK 0x1D + +/** + * @brief UDP socket + * @details This indicates Socket n is opened in UDP mode(@ref Sn_MR(P[3:0]) = '010').\n + * It changes to SOCK_UDP when @ref Sn_MR(P[3:0]) = '010' and @ref Sn_CR_OPEN command is ordered.\n + * Unlike TCP mode, data can be transfered without the connection-process. + */ +#define SOCK_UDP 0x22 + +#define SOCK_IPRAW 0x32 /**< IP raw mode socket */ + +/** + * @brief MAC raw mode socket + * @details This indicates Socket 0 is opened in MACRAW mode (S0_MR(P[3:0]) = 100and is valid only in Socket 0.\n + * It changes to SOCK_MACRAW when S0_MR(P[3:0] = 100and OPEN command is ordered.\n + * Like UDP mode socket, MACRAW mode Socket 0 can transfer a MAC packet (Ethernet frame) without the connection-process. + */ +#define SOCK_MACRAW 0x42 + +//#define SOCK_PPPOE 0x5F + +/* IP PROTOCOL */ +#define IPPROTO_IP 0 //< Dummy for IP +#define IPPROTO_ICMP 1 //< Control message protocol +#define IPPROTO_IGMP 2 //< Internet group management protocol +#define IPPROTO_GGP 3 //< Gateway^2 (deprecated) +#define IPPROTO_TCP 6 //< TCP +#define IPPROTO_PUP 12 //< PUP +#define IPPROTO_UDP 17 //< UDP +#define IPPROTO_IDP 22 //< XNS idp +#define IPPROTO_ND 77 //< UNOFFICIAL net disk protocol +#define IPPROTO_RAW 255 //< Raw IP packet + + +/** + * @brief Enter a critical section + * + * @details It is provided to protect your shared code which are executed without distribution. \n \n + * + * In non-OS environment, It can be just implemented by disabling whole interrupt.\n + * In OS environment, You can replace it to critical section api supported by OS. + * + * \sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() + * \sa WIZCHIP_CRITICAL_EXIT() + */ +#define WIZCHIP_CRITICAL_ENTER() WIZCHIP.CRIS._enter() + +#ifdef _exit +#undef _exit +#endif + +/** + * @brief Exit a critical section + * + * @details It is provided to protect your shared code which are executed without distribution. \n\n + * + * In non-OS environment, It can be just implemented by disabling whole interrupt. \n + * In OS environment, You can replace it to critical section api supported by OS. + * + * @sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() + * @sa WIZCHIP_CRITICAL_ENTER() + */ +#define WIZCHIP_CRITICAL_EXIT() WIZCHIP.CRIS._exit() + + +//////////////////////// +// Basic I/O Function // +//////////////////////// + +/** + * @ingroup Basic_IO_function + * @brief It reads 1 byte value from a register. + * @param AddrSel Register address + * @return The value of register + */ +uint8_t WIZCHIP_READ (uint32_t AddrSel); + +/** + * @ingroup Basic_IO_function + * @brief It writes 1 byte value to a register. + * @param AddrSel Register address + * @param wb Write data + * @return void + */ +void WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb ); + +/** + * @ingroup Basic_IO_function + * @brief It reads sequence data from registers. + * @param AddrSel Register address + * @param pBuf Pointer buffer to read data + * @param len Data length + */ +void WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len); + +/** + * @ingroup Basic_IO_function + * @brief It writes sequence data to registers. + * @param AddrSel Register address + * @param pBuf Pointer buffer to write data + * @param len Data length + */ +void WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len); + +///////////////////////////////// +// Common Register I/O function // +///////////////////////////////// +/** + * @ingroup Common_register_access_function + * @brief Set Mode Register + * @param (uint8_t)mr The value to be set. + * @sa getMR() + */ +#define setMR(mr) \ + WIZCHIP_WRITE(MR,mr) + + +/** + * @ingroup Common_register_access_function + * @brief Get Mode Register + * @return uint8_t. The value of Mode register. + * @sa setMR() + */ +#define getMR() \ + WIZCHIP_READ(MR) + +/** + * @ingroup Common_register_access_function + * @brief Set gateway IP address + * @param (uint8_t*)gar Pointer variable to set gateway IP address. It should be allocated 4 bytes. + * @sa getGAR() + */ +#define setGAR(gar) \ + WIZCHIP_WRITE_BUF(GAR,gar,4) + +/** + * @ingroup Common_register_access_function + * @brief Get gateway IP address + * @param (uint8_t*)gar Pointer variable to get gateway IP address. It should be allocated 4 bytes. + * @sa setGAR() + */ +#define getGAR(gar) \ + WIZCHIP_READ_BUF(GAR,gar,4) + +/** + * @ingroup Common_register_access_function + * @brief Set subnet mask address + * @param (uint8_t*)subr Pointer variable to set subnet mask address. It should be allocated 4 bytes. + * @sa getSUBR() + */ +#define setSUBR(subr) \ + WIZCHIP_WRITE_BUF(SUBR, subr,4) + + +/** + * @ingroup Common_register_access_function + * @brief Get subnet mask address + * @param (uint8_t*)subr Pointer variable to get subnet mask address. It should be allocated 4 bytes. + * @sa setSUBR() + */ +#define getSUBR(subr) \ + WIZCHIP_READ_BUF(SUBR, subr, 4) + +/** + * @ingroup Common_register_access_function + * @brief Set local MAC address + * @param (uint8_t*)shar Pointer variable to set local MAC address. It should be allocated 6 bytes. + * @sa getSHAR() + */ +#define setSHAR(shar) \ + WIZCHIP_WRITE_BUF(SHAR, shar, 6) + +/** + * @ingroup Common_register_access_function + * @brief Get local MAC address + * @param (uint8_t*)shar Pointer variable to get local MAC address. It should be allocated 6 bytes. + * @sa setSHAR() + */ +#define getSHAR(shar) \ + WIZCHIP_READ_BUF(SHAR, shar, 6) + +/** + * @ingroup Common_register_access_function + * @brief Set local IP address + * @param (uint8_t*)sipr Pointer variable to set local IP address. It should be allocated 4 bytes. + * @sa getSIPR() + */ +#define setSIPR(sipr) \ + WIZCHIP_WRITE_BUF(SIPR, sipr, 4) + +/** + * @ingroup Common_register_access_function + * @brief Get local IP address + * @param (uint8_t*)sipr Pointer variable to get local IP address. It should be allocated 4 bytes. + * @sa setSIPR() + */ +#define getSIPR(sipr) \ + WIZCHIP_READ_BUF(SIPR, sipr, 4) + +/** + * @ingroup Common_register_access_function + * @brief Set INTLEVEL register + * @param (uint16_t)intlevel Value to set @ref INTLEVEL register. + * @sa getINTLEVEL() + */ +#define setINTLEVEL(intlevel) {\ + WIZCHIP_WRITE(INTLEVEL, (uint8_t)(intlevel >> 8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(INTLEVEL,1), (uint8_t) intlevel); \ + } + + +/** + * @ingroup Common_register_access_function + * @brief Get INTLEVEL register + * @return uint16_t. Value of @ref INTLEVEL register. + * @sa setINTLEVEL() + */ +//M20150401 : Type explict declaration +/* +#define getINTLEVEL() \ + ((WIZCHIP_READ(INTLEVEL) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(INTLEVEL,1))) +*/ +#define getINTLEVEL() \ + (((uint16_t)WIZCHIP_READ(INTLEVEL) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(INTLEVEL,1))) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref IR register + * @param (uint8_t)ir Value to set @ref IR register. + * @sa getIR() + */ +#define setIR(ir) \ + WIZCHIP_WRITE(IR, (ir & 0xF0)) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref IR register + * @return uint8_t. Value of @ref IR register. + * @sa setIR() + */ +#define getIR() \ + (WIZCHIP_READ(IR) & 0xF0) +/** + * @ingroup Common_register_access_function + * @brief Set @ref _IMR_ register + * @param (uint8_t)imr Value to set @ref _IMR_ register. + * @sa getIMR() + */ +#define setIMR(imr) \ + WIZCHIP_WRITE(_IMR_, imr) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref _IMR_ register + * @return uint8_t. Value of @ref _IMR_ register. + * @sa setIMR() + */ +#define getIMR() \ + WIZCHIP_READ(_IMR_) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref SIR register + * @param (uint8_t)sir Value to set @ref SIR register. + * @sa getSIR() + */ +#define setSIR(sir) \ + WIZCHIP_WRITE(SIR, sir) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref SIR register + * @return uint8_t. Value of @ref SIR register. + * @sa setSIR() + */ +#define getSIR() \ + WIZCHIP_READ(SIR) +/** + * @ingroup Common_register_access_function + * @brief Set @ref SIMR register + * @param (uint8_t)simr Value to set @ref SIMR register. + * @sa getSIMR() + */ +#define setSIMR(simr) \ + WIZCHIP_WRITE(SIMR, simr) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref SIMR register + * @return uint8_t. Value of @ref SIMR register. + * @sa setSIMR() + */ +#define getSIMR() \ + WIZCHIP_READ(SIMR) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref _RTR_ register + * @param (uint16_t)rtr Value to set @ref _RTR_ register. + * @sa getRTR() + */ +#define setRTR(rtr) {\ + WIZCHIP_WRITE(_RTR_, (uint8_t)(rtr >> 8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(_RTR_,1), (uint8_t) rtr); \ + } + +/** + * @ingroup Common_register_access_function + * @brief Get @ref _RTR_ register + * @return uint16_t. Value of @ref _RTR_ register. + * @sa setRTR() + */ +//M20150401 : Type explict declaration +/* +#define getRTR() \ + ((WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1))) +*/ +#define getRTR() \ + (((uint16_t)WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1))) + + +/** + * @ingroup Common_register_access_function + * @brief Set @ref _RCR_ register + * @param (uint8_t)rcr Value to set @ref _RCR_ register. + * @sa getRCR() + */ +#define setRCR(rcr) \ + WIZCHIP_WRITE(_RCR_, rcr) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref _RCR_ register + * @return uint8_t. Value of @ref _RCR_ register. + * @sa setRCR() + */ +#define getRCR() \ + WIZCHIP_READ(_RCR_) + +//================================================== test done =========================================================== + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PTIMER register + * @param (uint8_t)ptimer Value to set @ref PTIMER register. + * @sa getPTIMER() + */ +#define setPTIMER(ptimer) \ + WIZCHIP_WRITE(PTIMER, ptimer) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PTIMER register + * @return uint8_t. Value of @ref PTIMER register. + * @sa setPTIMER() + */ +#define getPTIMER() \ + WIZCHIP_READ(PTIMER) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PMAGIC register + * @param (uint8_t)pmagic Value to set @ref PMAGIC register. + * @sa getPMAGIC() + */ +#define setPMAGIC(pmagic) \ + WIZCHIP_WRITE(PMAGIC, pmagic) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PMAGIC register + * @return uint8_t. Value of @ref PMAGIC register. + * @sa setPMAGIC() + */ +#define getPMAGIC() \ + WIZCHIP_READ(PMAGIC) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PHAR address + * @param (uint8_t*)phar Pointer variable to set PPP destination MAC register address. It should be allocated 6 bytes. + * @sa getPHAR() + */ +#define setPHAR(phar) \ + WIZCHIP_WRITE_BUF(PHAR, phar, 6) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PHAR address + * @param (uint8_t*)phar Pointer variable to PPP destination MAC register address. It should be allocated 6 bytes. + * @sa setPHAR() + */ +#define getPHAR(phar) \ + WIZCHIP_READ_BUF(PHAR, phar, 6) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PSID register + * @param (uint16_t)psid Value to set @ref PSID register. + * @sa getPSID() + */ +#define setPSID(psid) {\ + WIZCHIP_WRITE(PSID, (uint8_t)(psid >> 8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(PSID,1), (uint8_t) psid); \ + } + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PSID register + * @return uint16_t. Value of @ref PSID register. + * @sa setPSID() + */ +//uint16_t getPSID(void); +//M20150401 : Type explict declaration +/* +#define getPSID() \ + ((WIZCHIP_READ(PSID) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PSID,1))) +*/ +#define getPSID() \ + (((uint16_t)WIZCHIP_READ(PSID) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PSID,1))) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PMRU register + * @param (uint16_t)pmru Value to set @ref PMRU register. + * @sa getPMRU() + */ +#define setPMRU(pmru) { \ + WIZCHIP_WRITE(PMRU, (uint8_t)(pmru>>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(PMRU,1), (uint8_t) pmru); \ + } + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PMRU register + * @return uint16_t. Value of @ref PMRU register. + * @sa setPMRU() + */ +//M20150401 : Type explict declaration +/* +#define getPMRU() \ + ((WIZCHIP_READ(PMRU) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PMRU,1))) +*/ +#define getPMRU() \ + (((uint16_t)WIZCHIP_READ(PMRU) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PMRU,1))) + +/** + * @ingroup Common_register_access_function + * @brief Get unreachable IP address + * @param (uint8_t*)uipr Pointer variable to get unreachable IP address. It should be allocated 4 bytes. + */ +//M20150401 : Size Error of UIPR (6 -> 4) +/* +#define getUIPR(uipr) \ + WIZCHIP_READ_BUF(UIPR,uipr,6) +*/ +#define getUIPR(uipr) \ + WIZCHIP_READ_BUF(UIPR,uipr,4) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref UPORTR register + * @return uint16_t. Value of @ref UPORTR register. + */ +//M20150401 : Type explict declaration +/* +#define getUPORTR() \ + ((WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(UPORTR,1))) +*/ +#define getUPORTR() \ + (((uint16_t)WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(UPORTR,1))) + +/** + * @ingroup Common_register_access_function + * @brief Set @ref PHYCFGR register + * @param (uint8_t)phycfgr Value to set @ref PHYCFGR register. + * @sa getPHYCFGR() + */ +#define setPHYCFGR(phycfgr) \ + WIZCHIP_WRITE(PHYCFGR, phycfgr) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref PHYCFGR register + * @return uint8_t. Value of @ref PHYCFGR register. + * @sa setPHYCFGR() + */ +#define getPHYCFGR() \ + WIZCHIP_READ(PHYCFGR) + +/** + * @ingroup Common_register_access_function + * @brief Get @ref VERSIONR register + * @return uint8_t. Value of @ref VERSIONR register. + */ +#define getVERSIONR() \ + WIZCHIP_READ(VERSIONR) + +///////////////////////////////////// + +/////////////////////////////////// +// Socket N register I/O function // +/////////////////////////////////// +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_MR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)mr Value to set @ref Sn_MR + * @sa getSn_MR() + */ +#define setSn_MR(sn, mr) \ + WIZCHIP_WRITE(Sn_MR(sn),mr) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_MR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_MR. + * @sa setSn_MR() + */ +#define getSn_MR(sn) \ + WIZCHIP_READ(Sn_MR(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_CR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)cr Value to set @ref Sn_CR + * @sa getSn_CR() + */ +#define setSn_CR(sn, cr) \ + WIZCHIP_WRITE(Sn_CR(sn), cr) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_CR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_CR. + * @sa setSn_CR() + */ +#define getSn_CR(sn) \ + WIZCHIP_READ(Sn_CR(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_IR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)ir Value to set @ref Sn_IR + * @sa getSn_IR() + */ +#define setSn_IR(sn, ir) \ + WIZCHIP_WRITE(Sn_IR(sn), (ir & 0x1F)) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_IR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_IR. + * @sa setSn_IR() + */ +#define getSn_IR(sn) \ + (WIZCHIP_READ(Sn_IR(sn)) & 0x1F) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_IMR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)imr Value to set @ref Sn_IMR + * @sa getSn_IMR() + */ +#define setSn_IMR(sn, imr) \ + WIZCHIP_WRITE(Sn_IMR(sn), (imr & 0x1F)) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_IMR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_IMR. + * @sa setSn_IMR() + */ +#define getSn_IMR(sn) \ + (WIZCHIP_READ(Sn_IMR(sn)) & 0x1F) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_SR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_SR. + */ +#define getSn_SR(sn) \ + WIZCHIP_READ(Sn_SR(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_PORT register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)port Value to set @ref Sn_PORT. + * @sa getSn_PORT() + */ +#define setSn_PORT(sn, port) { \ + WIZCHIP_WRITE(Sn_PORT(sn), (uint8_t)(port >> 8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1), (uint8_t) port); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_PORT register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_PORT. + * @sa setSn_PORT() + */ +//M20150401 : Type explict declaration +/* +#define getSn_PORT(sn) \ + ((WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1))) +*/ +#define getSn_PORT(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_DHAR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t*)dhar Pointer variable to set socket n destination hardware address. It should be allocated 6 bytes. + * @sa getSn_DHAR() + */ +#define setSn_DHAR(sn, dhar) \ + WIZCHIP_WRITE_BUF(Sn_DHAR(sn), dhar, 6) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_MR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t*)dhar Pointer variable to get socket n destination hardware address. It should be allocated 6 bytes. + * @sa setSn_DHAR() + */ +#define getSn_DHAR(sn, dhar) \ + WIZCHIP_READ_BUF(Sn_DHAR(sn), dhar, 6) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_DIPR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t*)dipr Pointer variable to set socket n destination IP address. It should be allocated 4 bytes. + * @sa getSn_DIPR() + */ +#define setSn_DIPR(sn, dipr) \ + WIZCHIP_WRITE_BUF(Sn_DIPR(sn), dipr, 4) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_DIPR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t*)dipr Pointer variable to get socket n destination IP address. It should be allocated 4 bytes. + * @sa setSn_DIPR() + */ +#define getSn_DIPR(sn, dipr) \ + WIZCHIP_READ_BUF(Sn_DIPR(sn), dipr, 4) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_DPORT register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)dport Value to set @ref Sn_DPORT + * @sa getSn_DPORT() + */ +#define setSn_DPORT(sn, dport) { \ + WIZCHIP_WRITE(Sn_DPORT(sn), (uint8_t) (dport>>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1), (uint8_t) dport); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_DPORT register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_DPORT. + * @sa setSn_DPORT() + */ +//M20150401 : Type explict declaration +/* +#define getSn_DPORT(sn) \ + ((WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1))) +*/ +#define getSn_DPORT(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_MSSR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)mss Value to set @ref Sn_MSSR + * @sa setSn_MSSR() + */ +#define setSn_MSSR(sn, mss) { \ + WIZCHIP_WRITE(Sn_MSSR(sn), (uint8_t)(mss>>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1), (uint8_t) mss); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_MSSR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_MSSR. + * @sa setSn_MSSR() + */ +//M20150401 : Type explict declaration +/* +#define getSn_MSSR(sn) \ + ((WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1))) +*/ +#define getSn_MSSR(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_TOS register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)tos Value to set @ref Sn_TOS + * @sa getSn_TOS() + */ +#define setSn_TOS(sn, tos) \ + WIZCHIP_WRITE(Sn_TOS(sn), tos) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TOS register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of Sn_TOS. + * @sa setSn_TOS() + */ +#define getSn_TOS(sn) \ + WIZCHIP_READ(Sn_TOS(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_TTL register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)ttl Value to set @ref Sn_TTL + * @sa getSn_TTL() + */ +#define setSn_TTL(sn, ttl) \ + WIZCHIP_WRITE(Sn_TTL(sn), ttl) + + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TTL register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_TTL. + * @sa setSn_TTL() + */ +#define getSn_TTL(sn) \ + WIZCHIP_READ(Sn_TTL(sn)) + + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_RXBUF_SIZE register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)rxbufsize Value to set @ref Sn_RXBUF_SIZE + * @sa getSn_RXBUF_SIZE() + */ +#define setSn_RXBUF_SIZE(sn, rxbufsize) \ + WIZCHIP_WRITE(Sn_RXBUF_SIZE(sn),rxbufsize) + + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_RXBUF_SIZE register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_RXBUF_SIZE. + * @sa setSn_RXBUF_SIZE() + */ +#define getSn_RXBUF_SIZE(sn) \ + WIZCHIP_READ(Sn_RXBUF_SIZE(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_TXBUF_SIZE register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)txbufsize Value to set @ref Sn_TXBUF_SIZE + * @sa getSn_TXBUF_SIZE() + */ +#define setSn_TXBUF_SIZE(sn, txbufsize) \ + WIZCHIP_WRITE(Sn_TXBUF_SIZE(sn), txbufsize) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TXBUF_SIZE register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_TXBUF_SIZE. + * @sa setSn_TXBUF_SIZE() + */ +#define getSn_TXBUF_SIZE(sn) \ + WIZCHIP_READ(Sn_TXBUF_SIZE(sn)) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TX_FSR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_TX_FSR. + */ +uint16_t getSn_TX_FSR(uint8_t sn); + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TX_RD register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_TX_RD. + */ +//M20150401 : Type explict declaration +/* +#define getSn_TX_RD(sn) \ + ((WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1))) +*/ +#define getSn_TX_RD(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_TX_WR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)txwr Value to set @ref Sn_TX_WR + * @sa GetSn_TX_WR() + */ +#define setSn_TX_WR(sn, txwr) { \ + WIZCHIP_WRITE(Sn_TX_WR(sn), (uint8_t)(txwr>>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1), (uint8_t) txwr); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_TX_WR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_TX_WR. + * @sa setSn_TX_WR() + */ +//M20150401 : Type explict declaration +/* +#define getSn_TX_WR(sn) \ + ((WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1))) +*/ +#define getSn_TX_WR(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1))) + + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_RX_RSR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_RX_RSR. + */ +uint16_t getSn_RX_RSR(uint8_t sn); + + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_RX_RD register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)rxrd Value to set @ref Sn_RX_RD + * @sa getSn_RX_RD() + */ +#define setSn_RX_RD(sn, rxrd) { \ + WIZCHIP_WRITE(Sn_RX_RD(sn), (uint8_t)(rxrd>>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1), (uint8_t) rxrd); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_RX_RD register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_RX_RD. + * @sa setSn_RX_RD() + */ +//M20150401 : Type explict declaration +/* +#define getSn_RX_RD(sn) \ + ((WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1))) +*/ +#define getSn_RX_RD(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_RX_WR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_RX_WR. + */ +//M20150401 : Type explict declaration +/* +#define getSn_RX_WR(sn) \ + ((WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1))) +*/ +#define getSn_RX_WR(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_FRAG register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint16_t)frag Value to set @ref Sn_FRAG + * @sa getSn_FRAD() + */ +#define setSn_FRAG(sn, frag) { \ + WIZCHIP_WRITE(Sn_FRAG(sn), (uint8_t)(frag >>8)); \ + WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_FRAG(sn),1), (uint8_t) frag); \ + } + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_FRAG register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of @ref Sn_FRAG. + * @sa setSn_FRAG() + */ +//M20150401 : Type explict declaration +/* +#define getSn_FRAG(sn) \ + ((WIZCHIP_READ(Sn_FRAG(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAG(sn),1))) +*/ +#define getSn_FRAG(sn) \ + (((uint16_t)WIZCHIP_READ(Sn_FRAG(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAG(sn),1))) + +/** + * @ingroup Socket_register_access_function + * @brief Set @ref Sn_KPALVTR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param (uint8_t)kpalvt Value to set @ref Sn_KPALVTR + * @sa getSn_KPALVTR() + */ +#define setSn_KPALVTR(sn, kpalvt) \ + WIZCHIP_WRITE(Sn_KPALVTR(sn), kpalvt) + +/** + * @ingroup Socket_register_access_function + * @brief Get @ref Sn_KPALVTR register + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint8_t. Value of @ref Sn_KPALVTR. + * @sa setSn_KPALVTR() + */ +#define getSn_KPALVTR(sn) \ + WIZCHIP_READ(Sn_KPALVTR(sn)) + +////////////////////////////////////// + +///////////////////////////////////// +// Sn_TXBUF & Sn_RXBUF IO function // +///////////////////////////////////// +/** + * @brief Socket_register_access_function + * @brief Gets the max buffer size of socket sn passed as parameter. + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of Socket n RX max buffer size. + */ +//M20150401 : Type explict declaration +/* +#define getSn_RxMAX(sn) \ + (getSn_RXBUF_SIZE(sn) << 10) +*/ +#define getSn_RxMAX(sn) \ + (((uint16_t)getSn_RXBUF_SIZE(sn)) << 10) + +/** + * @brief Socket_register_access_function + * @brief Gets the max buffer size of socket sn passed as parameters. + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @return uint16_t. Value of Socket n TX max buffer size. + */ +//M20150401 : Type explict declaration +/* +#define getSn_TxMAX(sn) \ + (getSn_TXBUF_SIZE(sn) << 10) +*/ +#define getSn_TxMAX(sn) \ + (((uint16_t)getSn_TXBUF_SIZE(sn)) << 10) + +/** + * @ingroup Basic_IO_function + * @brief It copies data to internal TX memory + * + * @details This function reads the Tx write pointer register and after that, + * it copies the wizdata(pointer buffer) of the length of len(variable) bytes to internal TX memory + * and updates the Tx write pointer register. + * This function is being called by send() and sendto() function also. + * + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param wizdata Pointer buffer to write data + * @param len Data length + * @sa wiz_recv_data() + */ +void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len); + +/** + * @ingroup Basic_IO_function + * @brief It copies data to your buffer from internal RX memory + * + * @details This function read the Rx read pointer register and after that, + * it copies the received data from internal RX memory + * to wizdata(pointer variable) of the length of len(variable) bytes. + * This function is being called by recv() also. + * + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param wizdata Pointer buffer to read data + * @param len Data length + * @sa wiz_send_data() + */ +void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len); + +/** + * @ingroup Basic_IO_function + * @brief It discard the received data in RX memory. + * @details It discards the data of the length of len(variable) bytes in internal RX memory. + * @param (uint8_t)sn Socket number. It should be 0 ~ 7. + * @param len Data length + */ +void wiz_recv_ignore(uint8_t sn, uint16_t len); + +/// @cond DOXY_APPLY_CODE +#endif +/// @endcond + +#ifdef __cplusplus +} +#endif + +#endif // _W5500_H_ diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.c b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.c new file mode 100644 index 0000000..65b7646 --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.c @@ -0,0 +1,937 @@ +//***************************************************************************** +// +//! \file socket.c +//! \brief SOCKET APIs Implements file. +//! \details SOCKET APIs like as Berkeley Socket APIs. +//! \version 1.0.3 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2014/05/01> V1.0.3. Refer to M20140501 +//! 1. Implicit type casting -> Explicit type casting. +//! 2. replace 0x01 with PACK_REMAINED in recvfrom() +//! 3. Validation a destination ip in connect() & sendto(): +//! It occurs a fatal error on converting unint32 address if uint8* addr parameter is not aligned by 4byte address. +//! Copy 4 byte addr value into temporary uint32 variable and then compares it. +//! <2013/12/20> V1.0.2 Refer to M20131220 +//! Remove Warning. +//! <2013/11/04> V1.0.1 2nd Release. Refer to "20131104". +//! In sendto(), Add to clear timeout interrupt status (Sn_IR_TIMEOUT) +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//***************************************************************************** +#include "socket.h" + +//M20150401 : Typing Error +//#define SOCK_ANY_PORT_NUM 0xC000; +#define SOCK_ANY_PORT_NUM 0xC000 + +static uint16_t sock_any_port = SOCK_ANY_PORT_NUM; +static uint16_t sock_io_mode = 0; +static uint16_t sock_is_sending = 0; + +static uint16_t sock_remained_size[_WIZCHIP_SOCK_NUM_] = {0,0,}; + +//M20150601 : For extern decleation +//static uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,}; +uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,}; +// + +#if _WIZCHIP_ == 5200 + static uint16_t sock_next_rd[_WIZCHIP_SOCK_NUM_] ={0,}; +#endif + +//A20150601 : For integrating with W5300 +#if _WIZCHIP_ == 5300 + uint8_t sock_remained_byte[_WIZCHIP_SOCK_NUM_] = {0,}; // set by wiz_recv_data() +#endif + + +#define CHECK_SOCKNUM() \ + do{ \ + if(sn > _WIZCHIP_SOCK_NUM_) return SOCKERR_SOCKNUM; \ + }while(0); \ + +#define CHECK_SOCKMODE(mode) \ + do{ \ + if((getSn_MR(sn) & 0x0F) != mode) return SOCKERR_SOCKMODE; \ + }while(0); \ + +#define CHECK_SOCKINIT() \ + do{ \ + if((getSn_SR(sn) != SOCK_INIT)) return SOCKERR_SOCKINIT; \ + }while(0); \ + +#define CHECK_SOCKDATA() \ + do{ \ + if(len == 0) return SOCKERR_DATALEN; \ + }while(0); \ + + + +int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag) +{ + CHECK_SOCKNUM(); + switch(protocol) + { + case Sn_MR_TCP : + { + //M20150601 : Fixed the warning - taddr will never be NULL + /* + uint8_t taddr[4]; + getSIPR(taddr); + */ + uint32_t taddr; + getSIPR((uint8_t*)&taddr); + if(taddr == 0) return SOCKERR_SOCKINIT; + break; + } + case Sn_MR_UDP : + case Sn_MR_MACRAW : + case Sn_MR_IPRAW : + break; + #if ( _WIZCHIP_ < 5200 ) + case Sn_MR_PPPoE : + break; + #endif + default : + return SOCKERR_SOCKMODE; + } + //M20150601 : For SF_TCP_ALIGN & W5300 + //if((flag & 0x06) != 0) return SOCKERR_SOCKFLAG; + if((flag & 0x04) != 0) return SOCKERR_SOCKFLAG; +#if _WIZCHIP_ == 5200 + if(flag & 0x10) return SOCKERR_SOCKFLAG; +#endif + + if(flag != 0) + { + switch(protocol) + { + case Sn_MR_TCP: + //M20150601 : For SF_TCP_ALIGN & W5300 + #if _WIZCHIP_ == 5300 + if((flag & (SF_TCP_NODELAY|SF_IO_NONBLOCK|SF_TCP_ALIGN))==0) return SOCKERR_SOCKFLAG; + #else + if((flag & (SF_TCP_NODELAY|SF_IO_NONBLOCK))==0) return SOCKERR_SOCKFLAG; + #endif + + break; + case Sn_MR_UDP: + if(flag & SF_IGMP_VER2) + { + if((flag & SF_MULTI_ENABLE)==0) return SOCKERR_SOCKFLAG; + } + #if _WIZCHIP_ == 5500 + if(flag & SF_UNI_BLOCK) + { + if((flag & SF_MULTI_ENABLE) == 0) return SOCKERR_SOCKFLAG; + } + #endif + break; + default: + break; + } + } + close(sn); + //M20150601 + #if _WIZCHIP_ == 5300 + setSn_MR(sn, ((uint16_t)(protocol | (flag & 0xF0))) | (((uint16_t)(flag & 0x02)) << 7) ); + #else + setSn_MR(sn, (protocol | (flag & 0xF0))); + #endif + if(!port) + { + port = sock_any_port++; + if(sock_any_port == 0xFFF0) sock_any_port = SOCK_ANY_PORT_NUM; + } + setSn_PORT(sn,port); + setSn_CR(sn,Sn_CR_OPEN); + while(getSn_CR(sn)); + //A20150401 : For release the previous sock_io_mode + sock_io_mode &= ~(1 < sn + //if( ((getSn_MR(s)& 0x0F) == Sn_MR_TCP) && (getSn_TX_FSR(s) != getSn_TxMAX(s)) ) + if( ((getSn_MR(sn)& 0x0F) == Sn_MR_TCP) && (getSn_TX_FSR(sn) != getSn_TxMAX(sn)) ) + { + uint8_t destip[4] = {0, 0, 0, 1}; + // TODO + // You can wait for completing to sending data; + // wait about 1 second; + // if you have completed to send data, skip the code of erratum 1 + // ex> wait_1s(); + // if (getSn_TX_FSR(s) == getSn_TxMAX(s)) continue; + // + //M20160503 : The socket() of close() calls close() itself again. It occures a infinite loop - close()->socket()->close()->socket()-> ~ + //socket(s,Sn_MR_UDP,0x3000,0); + //sendto(s,destip,1,destip,0x3000); // send the dummy data to an unknown destination(0.0.0.1). + setSn_MR(sn,Sn_MR_UDP); + setSn_PORTR(sn, 0x3000); + setSn_CR(sn,Sn_CR_OPEN); + while(getSn_CR(sn) != 0); + while(getSn_SR(sn) != SOCK_UDP); + sendto(sn,destip,1,destip,0x3000); // send the dummy data to an unknown destination(0.0.0.1). + }; +#endif + setSn_CR(sn,Sn_CR_CLOSE); + /* wait to process the command... */ + while( getSn_CR(sn) ); + /* clear all interrupt of the socket. */ + setSn_IR(sn, 0xFF); + //A20150401 : Release the sock_io_mode of socket n. + sock_io_mode &= ~(1< freesize) len = freesize; // check size not to exceed MAX size. + while(1) + { + freesize = getSn_TX_FSR(sn); + tmp = getSn_SR(sn); + if ((tmp != SOCK_ESTABLISHED) && (tmp != SOCK_CLOSE_WAIT)) + { + close(sn); + return SOCKERR_SOCKSTATUS; + } + if( (sock_io_mode & (1< freesize) ) return SOCK_BUSY; + if(len <= freesize) break; + } + wiz_send_data(sn, buf, len); + #if _WIZCHIP_ == 5200 + sock_next_rd[sn] = getSn_TX_RD(sn) + len; + #endif + + #if _WIZCHIP_ == 5300 + setSn_TX_WRSR(sn,len); + #endif + + setSn_CR(sn,Sn_CR_SEND); + /* wait to process the command... */ + while(getSn_CR(sn)); + sock_is_sending |= (1 << sn); + //M20150409 : Explicit Type Casting + //return len; + return (int32_t)len; +} + + +int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len) +{ + uint8_t tmp = 0; + uint16_t recvsize = 0; +//A20150601 : For integarating with W5300 +#if _WIZCHIP_ == 5300 + uint8_t head[2]; + uint16_t mr; +#endif +// + CHECK_SOCKNUM(); + CHECK_SOCKMODE(Sn_MR_TCP); + CHECK_SOCKDATA(); + + recvsize = getSn_RxMAX(sn); + if(recvsize < len) len = recvsize; + +//A20150601 : For Integrating with W5300 +#if _WIZCHIP_ == 5300 + //sock_pack_info[sn] = PACK_COMPLETED; // for clear + if(sock_remained_size[sn] == 0) + { +#endif +// + while(1) + { + recvsize = getSn_RX_RSR(sn); + tmp = getSn_SR(sn); + if (tmp != SOCK_ESTABLISHED) + { + if(tmp == SOCK_CLOSE_WAIT) + { + if(recvsize != 0) break; + else if(getSn_TX_FSR(sn) == getSn_TxMAX(sn)) + { + close(sn); + return SOCKERR_SOCKSTATUS; + } + } + else + { + close(sn); + return SOCKERR_SOCKSTATUS; + } + } + if((sock_io_mode & (1< sock_remained_size[sn]) len = sock_remained_size[sn]; + recvsize = len; + if(sock_pack_info[sn] & PACK_FIFOBYTE) + { + *buf = sock_remained_byte[sn]; + buf++; + sock_pack_info[sn] &= ~(PACK_FIFOBYTE); + recvsize -= 1; + sock_remained_size[sn] -= 1; + } + if(recvsize != 0) + { + wiz_recv_data(sn, buf, recvsize); + setSn_CR(sn,Sn_CR_RECV); + while(getSn_CR(sn)); + } + sock_remained_size[sn] -= recvsize; + if(sock_remained_size[sn] != 0) + { + sock_pack_info[sn] |= PACK_REMAINED; + if(recvsize & 0x1) sock_pack_info[sn] |= PACK_FIFOBYTE; + } + else sock_pack_info[sn] = PACK_COMPLETED; + if(getSn_MR(sn) & Sn_MR_ALIGN) sock_remained_size[sn] = 0; + //len = recvsize; +#else + if(recvsize < len) len = recvsize; + wiz_recv_data(sn, buf, len); + setSn_CR(sn,Sn_CR_RECV); + while(getSn_CR(sn)); +#endif + + //M20150409 : Explicit Type Casting + //return len; + return (int32_t)len; +} + +int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port) +{ + uint8_t tmp = 0; + uint16_t freesize = 0; + uint32_t taddr; + + CHECK_SOCKNUM(); + switch(getSn_MR(sn) & 0x0F) + { + case Sn_MR_UDP: + case Sn_MR_MACRAW: +// break; +// #if ( _WIZCHIP_ < 5200 ) + case Sn_MR_IPRAW: + break; +// #endif + default: + return SOCKERR_SOCKMODE; + } + CHECK_SOCKDATA(); + //M20140501 : For avoiding fatal error on memory align mismatched + //if(*((uint32_t*)addr) == 0) return SOCKERR_IPINVALID; + //{ + //uint32_t taddr; + taddr = ((uint32_t)addr[0]) & 0x000000FF; + taddr = (taddr << 8) + ((uint32_t)addr[1] & 0x000000FF); + taddr = (taddr << 8) + ((uint32_t)addr[2] & 0x000000FF); + taddr = (taddr << 8) + ((uint32_t)addr[3] & 0x000000FF); + //} + // + //if(*((uint32_t*)addr) == 0) return SOCKERR_IPINVALID; + if((taddr == 0) && ((getSn_MR(sn)&Sn_MR_MACRAW) != Sn_MR_MACRAW)) return SOCKERR_IPINVALID; + if((port == 0) && ((getSn_MR(sn)&Sn_MR_MACRAW) != Sn_MR_MACRAW)) return SOCKERR_PORTZERO; + tmp = getSn_SR(sn); +//#if ( _WIZCHIP_ < 5200 ) + if((tmp != SOCK_MACRAW) && (tmp != SOCK_UDP) && (tmp != SOCK_IPRAW)) return SOCKERR_SOCKSTATUS; +//#else +// if(tmp != SOCK_MACRAW && tmp != SOCK_UDP) return SOCKERR_SOCKSTATUS; +//#endif + + setSn_DIPR(sn,addr); + setSn_DPORT(sn,port); + freesize = getSn_TxMAX(sn); + if (len > freesize) len = freesize; // check size not to exceed MAX size. + while(1) + { + freesize = getSn_TX_FSR(sn); + if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED; + if( (sock_io_mode & (1< freesize) ) return SOCK_BUSY; + if(len <= freesize) break; + }; + wiz_send_data(sn, buf, len); + + #if _WIZCHIP_ < 5500 //M20150401 : for WIZCHIP Errata #4, #5 (ARP errata) + getSIPR((uint8_t*)&taddr); + if(taddr == 0) + { + getSUBR((uint8_t*)&taddr); + setSUBR((uint8_t*)"\x00\x00\x00\x00"); + } + else taddr = 0; + #endif + +//A20150601 : For W5300 +#if _WIZCHIP_ == 5300 + setSn_TX_WRSR(sn, len); +#endif +// + setSn_CR(sn,Sn_CR_SEND); + /* wait to process the command... */ + while(getSn_CR(sn)); + while(1) + { + tmp = getSn_IR(sn); + if(tmp & Sn_IR_SENDOK) + { + setSn_IR(sn, Sn_IR_SENDOK); + break; + } + //M:20131104 + //else if(tmp & Sn_IR_TIMEOUT) return SOCKERR_TIMEOUT; + else if(tmp & Sn_IR_TIMEOUT) + { + setSn_IR(sn, Sn_IR_TIMEOUT); + //M20150409 : Fixed the lost of sign bits by type casting. + //len = (uint16_t)SOCKERR_TIMEOUT; + //break; + #if _WIZCHIP_ < 5500 //M20150401 : for WIZCHIP Errata #4, #5 (ARP errata) + if(taddr) setSUBR((uint8_t*)&taddr); + #endif + return SOCKERR_TIMEOUT; + } + //////////// + } + #if _WIZCHIP_ < 5500 //M20150401 : for WIZCHIP Errata #4, #5 (ARP errata) + if(taddr) setSUBR((uint8_t*)&taddr); + #endif + //M20150409 : Explicit Type Casting + //return len; + return (int32_t)len; +} + + + +int32_t recvfrom(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port) +{ +//M20150601 : For W5300 +#if _WIZCHIP_ == 5300 + uint16_t mr; + uint16_t mr1; +#else + uint8_t mr; +#endif +// + uint8_t head[8]; + uint16_t pack_len=0; + + CHECK_SOCKNUM(); + //CHECK_SOCKMODE(Sn_MR_UDP); +//A20150601 +#if _WIZCHIP_ == 5300 + mr1 = getMR(); +#endif + + switch((mr=getSn_MR(sn)) & 0x0F) + { + case Sn_MR_UDP: + case Sn_MR_IPRAW: + case Sn_MR_MACRAW: + break; + #if ( _WIZCHIP_ < 5200 ) + case Sn_MR_PPPoE: + break; + #endif + default: + return SOCKERR_SOCKMODE; + } + CHECK_SOCKDATA(); + if(sock_remained_size[sn] == 0) + { + while(1) + { + pack_len = getSn_RX_RSR(sn); + if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED; + if( (sock_io_mode & (1< 1514) + { + close(sn); + return SOCKFATAL_PACKLEN; + } + sock_pack_info[sn] = PACK_FIRST; + } + if(len < sock_remained_size[sn]) pack_len = len; + else pack_len = sock_remained_size[sn]; + wiz_recv_data(sn,buf,pack_len); + break; + //#if ( _WIZCHIP_ < 5200 ) + case Sn_MR_IPRAW: + if(sock_remained_size[sn] == 0) + { + wiz_recv_data(sn, head, 6); + setSn_CR(sn,Sn_CR_RECV); + while(getSn_CR(sn)); + addr[0] = head[0]; + addr[1] = head[1]; + addr[2] = head[2]; + addr[3] = head[3]; + sock_remained_size[sn] = head[4]; + //M20150401 : For Typing Error + //sock_remaiend_size[sn] = (sock_remained_size[sn] << 8) + head[5]; + sock_remained_size[sn] = (sock_remained_size[sn] << 8) + head[5]; + sock_pack_info[sn] = PACK_FIRST; + } + // + // Need to packet length check + // + if(len < sock_remained_size[sn]) pack_len = len; + else pack_len = sock_remained_size[sn]; + wiz_recv_data(sn, buf, pack_len); // data copy. + break; + //#endif + default: + wiz_recv_ignore(sn, pack_len); // data copy. + sock_remained_size[sn] = pack_len; + break; + } + setSn_CR(sn,Sn_CR_RECV); + /* wait to process the command... */ + while(getSn_CR(sn)) ; + sock_remained_size[sn] -= pack_len; + //M20150601 : + //if(sock_remained_size[sn] != 0) sock_pack_info[sn] |= 0x01; + if(sock_remained_size[sn] != 0) + { + sock_pack_info[sn] |= PACK_REMAINED; + #if _WIZCHIP_ == 5300 + if(pack_len & 0x01) sock_pack_info[sn] |= PACK_FIFOBYTE; + #endif + } + else sock_pack_info[sn] = PACK_COMPLETED; +#if _WIZCHIP_ == 5300 + pack_len = len; +#endif + // + //M20150409 : Explicit Type Casting + //return pack_len; + return (int32_t)pack_len; +} + + +int8_t ctlsocket(uint8_t sn, ctlsock_type cstype, void* arg) +{ + uint8_t tmp = 0; + CHECK_SOCKNUM(); + switch(cstype) + { + case CS_SET_IOMODE: + tmp = *((uint8_t*)arg); + if(tmp == SOCK_IO_NONBLOCK) sock_io_mode |= (1< explict type casting + //*((uint8_t*)arg) = (sock_io_mode >> sn) & 0x0001; + *((uint8_t*)arg) = (uint8_t)((sock_io_mode >> sn) & 0x0001); + // + break; + case CS_GET_MAXTXBUF: + *((uint16_t*)arg) = getSn_TxMAX(sn); + break; + case CS_GET_MAXRXBUF: + *((uint16_t*)arg) = getSn_RxMAX(sn); + break; + case CS_CLR_INTERRUPT: + if( (*(uint8_t*)arg) > SIK_ALL) return SOCKERR_ARG; + setSn_IR(sn,*(uint8_t*)arg); + break; + case CS_GET_INTERRUPT: + *((uint8_t*)arg) = getSn_IR(sn); + break; + #if _WIZCHIP_ != 5100 + case CS_SET_INTMASK: + if( (*(uint8_t*)arg) > SIK_ALL) return SOCKERR_ARG; + setSn_IMR(sn,*(uint8_t*)arg); + break; + case CS_GET_INTMASK: + *((uint8_t*)arg) = getSn_IMR(sn); + break; + #endif + default: + return SOCKERR_ARG; + } + return SOCK_OK; +} + +int8_t setsockopt(uint8_t sn, sockopt_type sotype, void* arg) +{ + // M20131220 : Remove warning + //uint8_t tmp; + CHECK_SOCKNUM(); + switch(sotype) + { + case SO_TTL: + setSn_TTL(sn,*(uint8_t*)arg); + break; + case SO_TOS: + setSn_TOS(sn,*(uint8_t*)arg); + break; + case SO_MSS: + setSn_MSSR(sn,*(uint16_t*)arg); + break; + case SO_DESTIP: + setSn_DIPR(sn, (uint8_t*)arg); + break; + case SO_DESTPORT: + setSn_DPORT(sn, *(uint16_t*)arg); + break; +#if _WIZCHIP_ != 5100 + case SO_KEEPALIVESEND: + CHECK_SOCKMODE(Sn_MR_TCP); + #if _WIZCHIP_ > 5200 + if(getSn_KPALVTR(sn) != 0) return SOCKERR_SOCKOPT; + #endif + setSn_CR(sn,Sn_CR_SEND_KEEP); + while(getSn_CR(sn) != 0) + { + // M20131220 + //if ((tmp = getSn_IR(sn)) & Sn_IR_TIMEOUT) + if (getSn_IR(sn) & Sn_IR_TIMEOUT) + { + setSn_IR(sn, Sn_IR_TIMEOUT); + return SOCKERR_TIMEOUT; + } + } + break; + #if !( (_WIZCHIP_ == 5100) || (_WIZCHIP_ == 5200) ) + case SO_KEEPALIVEAUTO: + CHECK_SOCKMODE(Sn_MR_TCP); + setSn_KPALVTR(sn,*(uint8_t*)arg); + break; + #endif +#endif + default: + return SOCKERR_ARG; + } + return SOCK_OK; +} + +int8_t getsockopt(uint8_t sn, sockopt_type sotype, void* arg) +{ + CHECK_SOCKNUM(); + switch(sotype) + { + case SO_FLAG: + *(uint8_t*)arg = getSn_MR(sn) & 0xF0; + break; + case SO_TTL: + *(uint8_t*) arg = getSn_TTL(sn); + break; + case SO_TOS: + *(uint8_t*) arg = getSn_TOS(sn); + break; + case SO_MSS: + *(uint16_t*) arg = getSn_MSSR(sn); + break; + case SO_DESTIP: + getSn_DIPR(sn, (uint8_t*)arg); + break; + case SO_DESTPORT: + *(uint16_t*) arg = getSn_DPORT(sn); + break; + #if _WIZCHIP_ > 5200 + case SO_KEEPALIVEAUTO: + CHECK_SOCKMODE(Sn_MR_TCP); + *(uint16_t*) arg = getSn_KPALVTR(sn); + break; + #endif + case SO_SENDBUF: + *(uint16_t*) arg = getSn_TX_FSR(sn); + break; + case SO_RECVBUF: + *(uint16_t*) arg = getSn_RX_RSR(sn); + break; + case SO_STATUS: + *(uint8_t*) arg = getSn_SR(sn); + break; + case SO_REMAINSIZE: + if(getSn_MR(sn) & Sn_MR_TCP) + *(uint16_t*)arg = getSn_RX_RSR(sn); + else + *(uint16_t*)arg = sock_remained_size[sn]; + break; + case SO_PACKINFO: + //CHECK_SOCKMODE(Sn_MR_TCP); +#if _WIZCHIP_ != 5300 + if((getSn_MR(sn) == Sn_MR_TCP)) + return SOCKERR_SOCKMODE; +#endif + *(uint8_t*)arg = sock_pack_info[sn]; + break; + default: + return SOCKERR_SOCKOPT; + } + return SOCK_OK; +} diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.h b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.h new file mode 100644 index 0000000..72469a7 --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/socket.h @@ -0,0 +1,489 @@ +//***************************************************************************** +// +//! \file socket.h +//! \brief SOCKET APIs Header file. +//! \details SOCKET APIs like as berkeley socket api. +//! \version 1.0.2 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2014/05/01> V1.0.2. Refer to M20140501 +//! 1. Modify the comment : SO_REMAINED -> PACK_REMAINED +//! 2. Add the comment as zero byte udp data reception in getsockopt(). +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//***************************************************************************** +/** + * @defgroup WIZnet_socket_APIs 1. WIZnet socket APIs + * @brief WIZnet socket APIs are based on Berkeley socket APIs, thus it has much similar name and interface. + * But there is a little bit of difference. + * @details + * Comparison between WIZnet and Berkeley SOCKET APIs + * + * + * + * + * + * + * + * + * + * + * + * + *
API WIZnet Berkeley
socket() O O
bind() X O
listen() O O
connect() O O
accept() X O
recv() O O
send() O O
recvfrom() O O
sendto() O O
closesocket() O
close() & disconnect()
O
+ * There are @b bind() and @b accept() functions in @b Berkeley SOCKET API but, + * not in @b WIZnet SOCKET API. Because socket() of WIZnet is not only creating a SOCKET but also binding a local port number, + * and listen() of WIZnet is not only listening to connection request from client but also accepting the connection request. \n + * When you program "TCP SERVER" with Berkeley SOCKET API, you can use only one listen port. + * When the listen SOCKET accepts a connection request from a client, it keeps listening. + * After accepting the connection request, a new SOCKET is created and the new SOCKET is used in communication with the client. \n + * Following figure shows network flow diagram by Berkeley SOCKET API. + * @image html Berkeley_SOCKET.jpg "" + * But, When you program "TCP SERVER" with WIZnet SOCKET API, you can use as many as 8 listen SOCKET with same port number. \n + * Because there's no accept() in WIZnet SOCKET APIs, when the listen SOCKET accepts a connection request from a client, + * it is changed in order to communicate with the client. + * And the changed SOCKET is not listening any more and is dedicated for communicating with the client. \n + * If there're many listen SOCKET with same listen port number and a client requests a connection, + * the SOCKET which has the smallest SOCKET number accepts the request and is changed as communication SOCKET. \n + * Following figure shows network flow diagram by WIZnet SOCKET API. + * @image html WIZnet_SOCKET.jpg "" + */ +#ifndef _SOCKET_H_ +#define _SOCKET_H_ +#ifdef __cplusplus + extern "C" { +#endif + +#include "wizchip_conf.h" + +#define SOCKET uint8_t ///< SOCKET type define for legacy driver + +#define SOCK_OK 1 ///< Result is OK about socket process. +#define SOCK_BUSY 0 ///< Socket is busy on processing the operation. Valid only Non-block IO Mode. +#define SOCK_FATAL -1000 ///< Result is fatal error about socket process. + +#define SOCK_ERROR 0 +#define SOCKERR_SOCKNUM (SOCK_ERROR - 1) ///< Invalid socket number +#define SOCKERR_SOCKOPT (SOCK_ERROR - 2) ///< Invalid socket option +#define SOCKERR_SOCKINIT (SOCK_ERROR - 3) ///< Socket is not initialized or SIPR is Zero IP address when Sn_MR_TCP +#define SOCKERR_SOCKCLOSED (SOCK_ERROR - 4) ///< Socket unexpectedly closed. +#define SOCKERR_SOCKMODE (SOCK_ERROR - 5) ///< Invalid socket mode for socket operation. +#define SOCKERR_SOCKFLAG (SOCK_ERROR - 6) ///< Invalid socket flag +#define SOCKERR_SOCKSTATUS (SOCK_ERROR - 7) ///< Invalid socket status for socket operation. +#define SOCKERR_ARG (SOCK_ERROR - 10) ///< Invalid argument. +#define SOCKERR_PORTZERO (SOCK_ERROR - 11) ///< Port number is zero +#define SOCKERR_IPINVALID (SOCK_ERROR - 12) ///< Invalid IP address +#define SOCKERR_TIMEOUT (SOCK_ERROR - 13) ///< Timeout occurred +#define SOCKERR_DATALEN (SOCK_ERROR - 14) ///< Data length is zero or greater than buffer max size. +#define SOCKERR_BUFFER (SOCK_ERROR - 15) ///< Socket buffer is not enough for data communication. + +#define SOCKFATAL_PACKLEN (SOCK_FATAL - 1) ///< Invalid packet length. Fatal Error. + +/* + * SOCKET FLAG + */ +#define SF_ETHER_OWN (Sn_MR_MFEN) ///< In @ref Sn_MR_MACRAW, Receive only the packet as broadcast, multicast and own packet +#define SF_IGMP_VER2 (Sn_MR_MC) ///< In @ref Sn_MR_UDP with \ref SF_MULTI_ENABLE, Select IGMP version 2. +#define SF_TCP_NODELAY (Sn_MR_ND) ///< In @ref Sn_MR_TCP, Use to nodelayed ack. +#define SF_MULTI_ENABLE (Sn_MR_MULTI) ///< In @ref Sn_MR_UDP, Enable multicast mode. + +#if _WIZCHIP_ == 5500 + #define SF_BROAD_BLOCK (Sn_MR_BCASTB) ///< In @ref Sn_MR_UDP or @ref Sn_MR_MACRAW, Block broadcast packet. Valid only in W5500 + #define SF_MULTI_BLOCK (Sn_MR_MMB) ///< In @ref Sn_MR_MACRAW, Block multicast packet. Valid only in W5500 + #define SF_IPv6_BLOCK (Sn_MR_MIP6B) ///< In @ref Sn_MR_MACRAW, Block IPv6 packet. Valid only in W5500 + #define SF_UNI_BLOCK (Sn_MR_UCASTB) ///< In @ref Sn_MR_UDP with \ref SF_MULTI_ENABLE. Valid only in W5500 +#endif + +//A201505 : For W5300 +#if _WIZCHIP_ == 5300 + #define SF_TCP_ALIGN 0x02 ///< Valid only \ref Sn_MR_TCP and W5300, refer to \ref Sn_MR_ALIGN +#endif + +#define SF_IO_NONBLOCK 0x01 ///< Socket nonblock io mode. It used parameter in \ref socket(). + +/* + * UDP & MACRAW Packet Infomation + */ +#define PACK_FIRST 0x80 ///< In Non-TCP packet, It indicates to start receiving a packet. (When W5300, This flag can be applied) +#define PACK_REMAINED 0x01 ///< In Non-TCP packet, It indicates to remain a packet to be received. (When W5300, This flag can be applied) +#define PACK_COMPLETED 0x00 ///< In Non-TCP packet, It indicates to complete to receive a packet. (When W5300, This flag can be applied) +//A20150601 : For Integrating with W5300 +#define PACK_FIFOBYTE 0x02 ///< Valid only W5300, It indicate to have read already the Sn_RX_FIFOR. +// + +/** + * @ingroup WIZnet_socket_APIs + * @brief Open a socket. + * @details Initializes the socket with 'sn' passed as parameter and open. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param protocol Protocol type to operate such as TCP, UDP and MACRAW. + * @param port Port number to be bined. + * @param flag Socket flags as \ref SF_ETHER_OWN, \ref SF_IGMP_VER2, \ref SF_TCP_NODELAY, \ref SF_MULTI_ENABLE, \ref SF_IO_NONBLOCK and so on.\n + * Valid flags only in W5500 : @ref SF_BROAD_BLOCK, @ref SF_MULTI_BLOCK, @ref SF_IPv6_BLOCK, and @ref SF_UNI_BLOCK. + * @sa Sn_MR + * + * @return @b Success : The socket number @b 'sn' passed as parameter\n + * @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number\n + * @ref SOCKERR_SOCKMODE - Not support socket mode as TCP, UDP, and so on. \n + * @ref SOCKERR_SOCKFLAG - Invaild socket flag. + */ +int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Close a socket. + * @details It closes the socket with @b'sn' passed as parameter. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * + * @return @b Success : @ref SOCK_OK \n + * @b Fail : @ref SOCKERR_SOCKNUM - Invalid socket number + */ +int8_t close(uint8_t sn); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Listen to a connection request from a client. + * @details It is listening to a connection request from a client. + * If connection request is accepted successfully, the connection is established. Socket sn is used in passive(server) mode. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @return @b Success : @ref SOCK_OK \n + * @b Fail :\n @ref SOCKERR_SOCKINIT - Socket is not initialized \n + * @ref SOCKERR_SOCKCLOSED - Socket closed unexpectedly. + */ +int8_t listen(uint8_t sn); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Try to connect a server. + * @details It requests connection to the server with destination IP address and port number passed as parameter.\n + * @note It is valid only in TCP client mode. + * In block io mode, it does not return until connection is completed. + * In Non-block io mode, it return @ref SOCK_BUSY immediately. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param addr Pointer variable of destination IP address. It should be allocated 4 bytes. + * @param port Destination port number. + * + * @return @b Success : @ref SOCK_OK \n + * @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number\n + * @ref SOCKERR_SOCKMODE - Invalid socket mode\n + * @ref SOCKERR_SOCKINIT - Socket is not initialized\n + * @ref SOCKERR_IPINVALID - Wrong server IP address\n + * @ref SOCKERR_PORTZERO - Server port zero\n + * @ref SOCKERR_TIMEOUT - Timeout occurred during request connection\n + * @ref SOCK_BUSY - In non-block io mode, it returned immediately\n + */ +int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Try to disconnect a connection socket. + * @details It sends request message to disconnect the TCP socket 'sn' passed as parameter to the server or client. + * @note It is valid only in TCP server or client mode. \n + * In block io mode, it does not return until disconnection is completed. \n + * In Non-block io mode, it return @ref SOCK_BUSY immediately. \n + + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @return @b Success : @ref SOCK_OK \n + * @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number \n + * @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n + * @ref SOCKERR_TIMEOUT - Timeout occurred \n + * @ref SOCK_BUSY - Socket is busy. + */ +int8_t disconnect(uint8_t sn); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Send data to the connected peer in TCP socket. + * @details It is used to send outgoing data to the connected socket. + * @note It is valid only in TCP server or client mode. It can't send data greater than socket buffer size. \n + * In block io mode, It doesn't return until data send is completed - socket buffer size is greater than data. \n + * In non-block io mode, It return @ref SOCK_BUSY immediately when socket buffer is not enough. \n + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param buf Pointer buffer containing data to be sent. + * @param len The byte length of data in buf. + * @return @b Success : The sent data size \n + * @b Fail : \n @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n + * @ref SOCKERR_TIMEOUT - Timeout occurred \n + * @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n + * @ref SOCKERR_SOCKNUM - Invalid socket number \n + * @ref SOCKERR_DATALEN - zero data length \n + * @ref SOCK_BUSY - Socket is busy. + */ +int32_t send(uint8_t sn, uint8_t * buf, uint16_t len); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Receive data from the connected peer. + * @details It is used to read incoming data from the connected socket.\n + * It waits for data as much as the application wants to receive. + * @note It is valid only in TCP server or client mode. It can't receive data greater than socket buffer size. \n + * In block io mode, it doesn't return until data reception is completed - data is filled as len in socket buffer. \n + * In non-block io mode, it return @ref SOCK_BUSY immediately when len is greater than data size in socket buffer. \n + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param buf Pointer buffer to read incoming data. + * @param len The max data length of data in buf. + * @return @b Success : The real received data size \n + * @b Fail :\n + * @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n + * @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n + * @ref SOCKERR_SOCKNUM - Invalid socket number \n + * @ref SOCKERR_DATALEN - zero data length \n + * @ref SOCK_BUSY - Socket is busy. + */ +int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Sends datagram to the peer with destination IP address and port number passed as parameter. + * @details It sends datagram of UDP or MACRAW to the peer with destination IP address and port number passed as parameter.\n + * Even if the connectionless socket has been previously connected to a specific address, + * the address and port number parameters override the destination address for that particular datagram only. + * @note In block io mode, It doesn't return until data send is completed - socket buffer size is greater than len. + * In non-block io mode, It return @ref SOCK_BUSY immediately when socket buffer is not enough. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param buf Pointer buffer to send outgoing data. + * @param len The byte length of data in buf. + * @param addr Pointer variable of destination IP address. It should be allocated 4 bytes. + * @param port Destination port number. + * + * @return @b Success : The sent data size \n + * @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number \n + * @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n + * @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n + * @ref SOCKERR_DATALEN - zero data length \n + * @ref SOCKERR_IPINVALID - Wrong server IP address\n + * @ref SOCKERR_PORTZERO - Server port zero\n + * @ref SOCKERR_SOCKCLOSED - Socket unexpectedly closed \n + * @ref SOCKERR_TIMEOUT - Timeout occurred \n + * @ref SOCK_BUSY - Socket is busy. + */ +int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); + +/** + * @ingroup WIZnet_socket_APIs + * @brief Receive datagram of UDP or MACRAW + * @details This function is an application I/F function which is used to receive the data in other then TCP mode. \n + * This function is used to receive UDP and MAC_RAW mode, and handle the header as well. + * This function can divide to received the packet data. + * On the MACRAW SOCKET, the addr and port parameters are ignored. + * @note In block io mode, it doesn't return until data reception is completed - data is filled as len in socket buffer + * In non-block io mode, it return @ref SOCK_BUSY immediately when len is greater than data size in socket buffer. + * + * @param sn Socket number. It should be 0 ~ @ref \_WIZCHIP_SOCK_NUM_. + * @param buf Pointer buffer to read incoming data. + * @param len The max data length of data in buf. + * When the received packet size <= len, receives data as packet sized. + * When others, receives data as len. + * @param addr Pointer variable of destination IP address. It should be allocated 4 bytes. + * It is valid only when the first call recvfrom for receiving the packet. + * When it is valid, @ref packinfo[7] should be set as '1' after call @ref getsockopt(sn, SO_PACKINFO, &packinfo). + * @param port Pointer variable of destination port number. + * It is valid only when the first call recvform for receiving the packet. +* When it is valid, @ref packinfo[7] should be set as '1' after call @ref getsockopt(sn, SO_PACKINFO, &packinfo). + * + * @return @b Success : This function return real received data size for success.\n + * @b Fail : @ref SOCKERR_DATALEN - zero data length \n + * @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n + * @ref SOCKERR_SOCKNUM - Invalid socket number \n + * @ref SOCKBUSY - Socket is busy. + */ +int32_t recvfrom(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); + + +///////////////////////////// +// SOCKET CONTROL & OPTION // +///////////////////////////// +#define SOCK_IO_BLOCK 0 ///< Socket Block IO Mode in @ref setsockopt(). +#define SOCK_IO_NONBLOCK 1 ///< Socket Non-block IO Mode in @ref setsockopt(). + +/** + * @defgroup DATA_TYPE DATA TYPE + */ + +/** + * @ingroup DATA_TYPE + * @brief The kind of Socket Interrupt. + * @sa Sn_IR, Sn_IMR, setSn_IR(), getSn_IR(), setSn_IMR(), getSn_IMR() + */ +typedef enum +{ + SIK_CONNECTED = (1 << 0), ///< connected + SIK_DISCONNECTED = (1 << 1), ///< disconnected + SIK_RECEIVED = (1 << 2), ///< data received + SIK_TIMEOUT = (1 << 3), ///< timeout occurred + SIK_SENT = (1 << 4), ///< send ok + //M20150410 : Remove the comma of last member + //SIK_ALL = 0x1F, ///< all interrupt + SIK_ALL = 0x1F ///< all interrupt +}sockint_kind; + +/** + * @ingroup DATA_TYPE + * @brief The type of @ref ctlsocket(). + */ +typedef enum +{ + CS_SET_IOMODE, ///< set socket IO mode with @ref SOCK_IO_BLOCK or @ref SOCK_IO_NONBLOCK + CS_GET_IOMODE, ///< get socket IO mode + CS_GET_MAXTXBUF, ///< get the size of socket buffer allocated in TX memory + CS_GET_MAXRXBUF, ///< get the size of socket buffer allocated in RX memory + CS_CLR_INTERRUPT, ///< clear the interrupt of socket with @ref sockint_kind + CS_GET_INTERRUPT, ///< get the socket interrupt. refer to @ref sockint_kind +#if _WIZCHIP_ > 5100 + CS_SET_INTMASK, ///< set the interrupt mask of socket with @ref sockint_kind, Not supported in W5100 + CS_GET_INTMASK ///< get the masked interrupt of socket. refer to @ref sockint_kind, Not supported in W5100 +#endif +}ctlsock_type; + + +/** + * @ingroup DATA_TYPE + * @brief The type of socket option in @ref setsockopt() or @ref getsockopt() + */ +typedef enum +{ + SO_FLAG, ///< Valid only in getsockopt(), For set flag of socket refer to flag in @ref socket(). + SO_TTL, ///< Set TTL. @ref Sn_TTL ( @ref setSn_TTL(), @ref getSn_TTL() ) + SO_TOS, ///< Set TOS. @ref Sn_TOS ( @ref setSn_TOS(), @ref getSn_TOS() ) + SO_MSS, ///< Set MSS. @ref Sn_MSSR ( @ref setSn_MSSR(), @ref getSn_MSSR() ) + SO_DESTIP, ///< Set the destination IP address. @ref Sn_DIPR ( @ref setSn_DIPR(), @ref getSn_DIPR() ) + SO_DESTPORT, ///< Set the destination Port number. @ref Sn_DPORT ( @ref setSn_DPORT(), @ref getSn_DPORT() ) +#if _WIZCHIP_ != 5100 + SO_KEEPALIVESEND, ///< Valid only in setsockopt. Manually send keep-alive packet in TCP mode, Not supported in W5100 + #if !( (_WIZCHIP_ == 5100) || (_WIZCHIP_ == 5200) ) + SO_KEEPALIVEAUTO, ///< Set/Get keep-alive auto transmission timer in TCP mode, Not supported in W5100, W5200 + #endif +#endif + SO_SENDBUF, ///< Valid only in getsockopt. Get the free data size of Socekt TX buffer. @ref Sn_TX_FSR, @ref getSn_TX_FSR() + SO_RECVBUF, ///< Valid only in getsockopt. Get the received data size in socket RX buffer. @ref Sn_RX_RSR, @ref getSn_RX_RSR() + SO_STATUS, ///< Valid only in getsockopt. Get the socket status. @ref Sn_SR, @ref getSn_SR() + SO_REMAINSIZE, ///< Valid only in getsockopt. Get the remained packet size in other then TCP mode. + SO_PACKINFO ///< Valid only in getsockopt. Get the packet information as @ref PACK_FIRST, @ref PACK_REMAINED, and @ref PACK_COMPLETED in other then TCP mode. +}sockopt_type; + +/** + * @ingroup WIZnet_socket_APIs + * @brief Control socket. + * @details Control IO mode, Interrupt & Mask of socket and get the socket buffer information. + * Refer to @ref ctlsock_type. + * @param sn socket number + * @param cstype type of control socket. refer to @ref ctlsock_type. + * @param arg Data type and value is determined according to @ref ctlsock_type. \n + * + * + * + * + * + *
@b cstype @b data type@b value
@ref CS_SET_IOMODE \n @ref CS_GET_IOMODE uint8_t @ref SOCK_IO_BLOCK @ref SOCK_IO_NONBLOCK
@ref CS_GET_MAXTXBUF \n @ref CS_GET_MAXRXBUF uint16_t 0 ~ 16K
@ref CS_CLR_INTERRUPT \n @ref CS_GET_INTERRUPT \n @ref CS_SET_INTMASK \n @ref CS_GET_INTMASK @ref sockint_kind @ref SIK_CONNECTED, etc.
+ * @return @b Success @ref SOCK_OK \n + * @b fail @ref SOCKERR_ARG - Invalid argument\n + */ +int8_t ctlsocket(uint8_t sn, ctlsock_type cstype, void* arg); + +/** + * @ingroup WIZnet_socket_APIs + * @brief set socket options + * @details Set socket option like as TTL, MSS, TOS, and so on. Refer to @ref sockopt_type. + * + * @param sn socket number + * @param sotype socket option type. refer to @ref sockopt_type + * @param arg Data type and value is determined according to sotype. \n + * + * + * + * + * + * + * + * + * + *
@b sotype @b data type@b value
@ref SO_TTL uint8_t 0 ~ 255
@ref SO_TOS uint8_t 0 ~ 255
@ref SO_MSS uint16_t 0 ~ 65535
@ref SO_DESTIP uint8_t[4]
@ref SO_DESTPORT uint16_t 0 ~ 65535
@ref SO_KEEPALIVESEND null null
@ref SO_KEEPALIVEAUTO uint8_t 0 ~ 255
+ * @return + * - @b Success : @ref SOCK_OK \n + * - @b Fail + * - @ref SOCKERR_SOCKNUM - Invalid Socket number \n + * - @ref SOCKERR_SOCKMODE - Invalid socket mode \n + * - @ref SOCKERR_SOCKOPT - Invalid socket option or its value \n + * - @ref SOCKERR_TIMEOUT - Timeout occurred when sending keep-alive packet \n + */ +int8_t setsockopt(uint8_t sn, sockopt_type sotype, void* arg); + +/** + * @ingroup WIZnet_socket_APIs + * @brief get socket options + * @details Get socket option like as FLAG, TTL, MSS, and so on. Refer to @ref sockopt_type + * @param sn socket number + * @param sotype socket option type. refer to @ref sockopt_type + * @param arg Data type and value is determined according to sotype. \n + * + * + * + * + * + * + * + * + * + * + * + * + * + *
@b sotype @b data type@b value
@ref SO_FLAG uint8_t @ref SF_ETHER_OWN, etc...
@ref SO_TOS uint8_t 0 ~ 255
@ref SO_MSS uint16_t 0 ~ 65535
@ref SO_DESTIP uint8_t[4]
@ref SO_DESTPORT uint16_t
@ref SO_KEEPALIVEAUTO uint8_t 0 ~ 255
@ref SO_SENDBUF uint16_t 0 ~ 65535
@ref SO_RECVBUF uint16_t 0 ~ 65535
@ref SO_STATUS uint8_t @ref SOCK_ESTABLISHED, etc..
@ref SO_REMAINSIZE uint16_t 0~ 65535
@ref SO_PACKINFO uint8_t @ref PACK_FIRST, etc...
+ * @return + * - @b Success : @ref SOCK_OK \n + * - @b Fail + * - @ref SOCKERR_SOCKNUM - Invalid Socket number \n + * - @ref SOCKERR_SOCKOPT - Invalid socket option or its value \n + * - @ref SOCKERR_SOCKMODE - Invalid socket mode \n + * @note + * The option as PACK_REMAINED and SO_PACKINFO is valid only in NON-TCP mode and after call @ref recvfrom(). \n + * When SO_PACKINFO value is PACK_FIRST and the return value of recvfrom() is zero, + * This means the zero byte UDP data(UDP Header only) received. + */ +int8_t getsockopt(uint8_t sn, sockopt_type sotype, void* arg); + +#ifdef __cplusplus + } +#endif + +#endif // _SOCKET_H_ diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.c b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.c new file mode 100644 index 0000000..194d296 --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.c @@ -0,0 +1,907 @@ +//****************************************************************************/ +//! +//! \file wizchip_conf.c +//! \brief WIZCHIP Config Header File. +//! \version 1.0.1 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2014/05/01> V1.0.1 Refer to M20140501 +//! 1. Explicit type casting in wizchip_bus_readdata() & wizchip_bus_writedata() +// Issued by Mathias ClauBen. +//! uint32_t type converts into ptrdiff_t first. And then recoverting it into uint8_t* +//! For remove the warning when pointer type size is not 32bit. +//! If ptrdiff_t doesn't support in your complier, You should must replace ptrdiff_t into your suitable pointer type. +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//*****************************************************************************/ +//A20140501 : for use the type - ptrdiff_t +#include +// + +#include "wizchip_conf.h" + +///////////// +//M20150401 : Remove ; in the default callback function such as wizchip_cris_enter(), wizchip_cs_select() and etc. +///////////// + +/** + * @brief Default function to enable interrupt. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_cris_enter(void) {}; +void wizchip_cris_enter(void) {} + +/** + * @brief Default function to disable interrupt. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_cris_exit(void) {}; +void wizchip_cris_exit(void) {} + +/** + * @brief Default function to select chip. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_cs_select(void) {}; +void wizchip_cs_select(void) {} + +/** + * @brief Default function to deselect chip. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_cs_deselect(void) {}; +void wizchip_cs_deselect(void) {} + +/** + * @brief Default function to read in direct or indirect interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ + //M20150601 : Rename the function for integrating with W5300 +//uint8_t wizchip_bus_readbyte(uint32_t AddrSel) { return * ((volatile uint8_t *)((ptrdiff_t) AddrSel)); } +iodata_t wizchip_bus_readdata(uint32_t AddrSel) { return * ((volatile iodata_t *)((ptrdiff_t) AddrSel)); } + +/** + * @brief Default function to write in direct or indirect interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//M20150601 : Rename the function for integrating with W5300 +//void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t*)((ptrdiff_t)AddrSel)) = wb; } +void wizchip_bus_writedata(uint32_t AddrSel, iodata_t wb) { *((volatile iodata_t*)((ptrdiff_t)AddrSel)) = wb; } + +/** + * @brief Default function to read in SPI interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//uint8_t wizchip_spi_readbyte(void) {return 0;}; +uint8_t wizchip_spi_readbyte(void) {return 0;} + +/** + * @brief Default function to write in SPI interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_spi_writebyte(uint8_t wb) {}; +void wizchip_spi_writebyte(uint8_t wb) {} + +/** + * @brief Default function to burst read in SPI interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {}; +void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {} + +/** + * @brief Default function to burst write in SPI interface. + * @note This function help not to access wrong address. If you do not describe this function or register any functions, + * null function is called. + */ +//void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {}; +void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {} + +/** + * @\ref _WIZCHIP instance + */ +// +//M20150401 : For a compiler didnot support a member of structure +// Replace the assignment of struct members with the assingment of array +// +/* +_WIZCHIP WIZCHIP = + { + .id = _WIZCHIP_ID_, + .if_mode = _WIZCHIP_IO_MODE_, + .CRIS._enter = wizchip_cris_enter, + .CRIS._exit = wizchip_cris_exit, + .CS._select = wizchip_cs_select, + .CS._deselect = wizchip_cs_deselect, + .IF.BUS._read_byte = wizchip_bus_readbyte, + .IF.BUS._write_byte = wizchip_bus_writebyte +// .IF.SPI._read_byte = wizchip_spi_readbyte, +// .IF.SPI._write_byte = wizchip_spi_writebyte + }; +*/ +_WIZCHIP WIZCHIP = +{ + _WIZCHIP_IO_MODE_, + _WIZCHIP_ID_ , + { + wizchip_cris_enter, + wizchip_cris_exit + }, + { + wizchip_cs_select, + wizchip_cs_deselect + }, + { + { + //M20150601 : Rename the function + //wizchip_bus_readbyte, + //wizchip_bus_writebyte + wizchip_bus_readdata, + wizchip_bus_writedata + }, + + } +}; + + +static uint8_t _DNS_[4]; // DNS server ip address +static dhcp_mode _DHCP_; // DHCP mode + +void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void)) +{ + if(!cris_en || !cris_ex) + { + WIZCHIP.CRIS._enter = wizchip_cris_enter; + WIZCHIP.CRIS._exit = wizchip_cris_exit; + } + else + { + WIZCHIP.CRIS._enter = cris_en; + WIZCHIP.CRIS._exit = cris_ex; + } +} + +void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void)) +{ + if(!cs_sel || !cs_desel) + { + WIZCHIP.CS._select = wizchip_cs_select; + WIZCHIP.CS._deselect = wizchip_cs_deselect; + } + else + { + WIZCHIP.CS._select = cs_sel; + WIZCHIP.CS._deselect = cs_desel; + } +} + +//M20150515 : For integrating with W5300 +//void reg_wizchip_bus_cbfunc(uint8_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb)) +void reg_wizchip_bus_cbfunc(iodata_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, iodata_t wb)) +{ + while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_BUS_)); + //M20150601 : Rename call back function for integrating with W5300 + /* + if(!bus_rb || !bus_wb) + { + WIZCHIP.IF.BUS._read_byte = wizchip_bus_readbyte; + WIZCHIP.IF.BUS._write_byte = wizchip_bus_writebyte; + } + else + { + WIZCHIP.IF.BUS._read_byte = bus_rb; + WIZCHIP.IF.BUS._write_byte = bus_wb; + } + */ + if(!bus_rb || !bus_wb) + { + WIZCHIP.IF.BUS._read_data = wizchip_bus_readdata; + WIZCHIP.IF.BUS._write_data = wizchip_bus_writedata; + } + else + { + WIZCHIP.IF.BUS._read_data = bus_rb; + WIZCHIP.IF.BUS._write_data = bus_wb; + } +} + +void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb)) +{ + while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_SPI_)); + + if(!spi_rb || !spi_wb) + { + WIZCHIP.IF.SPI._read_byte = wizchip_spi_readbyte; + WIZCHIP.IF.SPI._write_byte = wizchip_spi_writebyte; + } + else + { + WIZCHIP.IF.SPI._read_byte = spi_rb; + WIZCHIP.IF.SPI._write_byte = spi_wb; + } +} + +// 20140626 Eric Added for SPI burst operations +void reg_wizchip_spiburst_cbfunc(void (*spi_rb)(uint8_t* pBuf, uint16_t len), void (*spi_wb)(uint8_t* pBuf, uint16_t len)) +{ + while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_SPI_)); + + if(!spi_rb || !spi_wb) + { + WIZCHIP.IF.SPI._read_burst = wizchip_spi_readburst; + WIZCHIP.IF.SPI._write_burst = wizchip_spi_writeburst; + } + else + { + WIZCHIP.IF.SPI._read_burst = spi_rb; + WIZCHIP.IF.SPI._write_burst = spi_wb; + } +} + +int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg) +{ +#if _WIZCHIP_ == W5100S || _WIZCHIP_ == W5200 || _WIZCHIP_ == W5500 + uint8_t tmp = 0; +#endif + uint8_t* ptmp[2] = {0,0}; + switch(cwtype) + { + case CW_RESET_WIZCHIP: + wizchip_sw_reset(); + break; + case CW_INIT_WIZCHIP: + if(arg != 0) + { + ptmp[0] = (uint8_t*)arg; + ptmp[1] = ptmp[0] + _WIZCHIP_SOCK_NUM_; + } + return wizchip_init(ptmp[0], ptmp[1]); + case CW_CLR_INTERRUPT: + wizchip_clrinterrupt(*((intr_kind*)arg)); + break; + case CW_GET_INTERRUPT: + *((intr_kind*)arg) = wizchip_getinterrupt(); + break; + case CW_SET_INTRMASK: + wizchip_setinterruptmask(*((intr_kind*)arg)); + break; + case CW_GET_INTRMASK: + *((intr_kind*)arg) = wizchip_getinterruptmask(); + break; + //M20150601 : This can be supported by W5200, W5500 + //#if _WIZCHIP_ > W5100 + #if (_WIZCHIP_ == W5200 || _WIZCHIP_ == W5500) + case CW_SET_INTRTIME: + setINTLEVEL(*(uint16_t*)arg); + break; + case CW_GET_INTRTIME: + *(uint16_t*)arg = getINTLEVEL(); + break; + #endif + case CW_GET_ID: + ((uint8_t*)arg)[0] = WIZCHIP.id[0]; + ((uint8_t*)arg)[1] = WIZCHIP.id[1]; + ((uint8_t*)arg)[2] = WIZCHIP.id[2]; + ((uint8_t*)arg)[3] = WIZCHIP.id[3]; + ((uint8_t*)arg)[4] = WIZCHIP.id[4]; + ((uint8_t*)arg)[5] = WIZCHIP.id[5]; + ((uint8_t*)arg)[6] = 0; + break; + #if _WIZCHIP_ == W5100S || _WIZCHIP_ == W5500 + case CW_RESET_PHY: + wizphy_reset(); + break; + case CW_SET_PHYCONF: + wizphy_setphyconf((wiz_PhyConf*)arg); + break; + case CW_GET_PHYCONF: + wizphy_getphyconf((wiz_PhyConf*)arg); + break; + case CW_GET_PHYSTATUS: + break; + case CW_SET_PHYPOWMODE: + return wizphy_setphypmode(*(uint8_t*)arg); + #endif + #if _WIZCHIP_ == W5100S || _WIZCHIP_ == W5200 || _WIZCHIP_ == W5500 + case CW_GET_PHYPOWMODE: + tmp = wizphy_getphypmode(); + if((int8_t)tmp == -1) return -1; + *(uint8_t*)arg = tmp; + break; + case CW_GET_PHYLINK: + tmp = wizphy_getphylink(); + if((int8_t)tmp == -1) return -1; + *(uint8_t*)arg = tmp; + break; + #endif + default: + return -1; + } + return 0; +} + + +int8_t ctlnetwork(ctlnetwork_type cntype, void* arg) +{ + + switch(cntype) + { + case CN_SET_NETINFO: + wizchip_setnetinfo((wiz_NetInfo*)arg); + break; + case CN_GET_NETINFO: + wizchip_getnetinfo((wiz_NetInfo*)arg); + break; + case CN_SET_NETMODE: + return wizchip_setnetmode(*(netmode_type*)arg); + case CN_GET_NETMODE: + *(netmode_type*)arg = wizchip_getnetmode(); + break; + case CN_SET_TIMEOUT: + wizchip_settimeout((wiz_NetTimeout*)arg); + break; + case CN_GET_TIMEOUT: + wizchip_gettimeout((wiz_NetTimeout*)arg); + break; + default: + return -1; + } + return 0; +} + +void wizchip_sw_reset(void) +{ + uint8_t gw[4], sn[4], sip[4]; + uint8_t mac[6]; +//A20150601 +#if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_ + uint16_t mr = (uint16_t)getMR(); + setMR(mr | MR_IND); +#endif +// + getSHAR(mac); + getGAR(gw); getSUBR(sn); getSIPR(sip); + setMR(MR_RST); + getMR(); // for delay +//A2015051 : For indirect bus mode +#if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_ + setMR(mr | MR_IND); +#endif +// + setSHAR(mac); + setGAR(gw); + setSUBR(sn); + setSIPR(sip); +} + +int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize) +{ + int8_t i; +#if _WIZCHIP_ < W5200 + int8_t j; +#endif + int8_t tmp = 0; + wizchip_sw_reset(); + if(txsize) + { + tmp = 0; +//M20150601 : For integrating with W5300 +#if _WIZCHIP_ == W5300 + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { + if(txsize[i] > 64) return -1; //No use 64KB even if W5300 support max 64KB memory allocation + tmp += txsize[i]; + if(tmp > 128) return -1; + } + if(tmp % 8) return -1; +#else + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { + tmp += txsize[i]; + +#if _WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s + if(tmp > 8) return -1; +#else + if(tmp > 16) return -1; +#endif + } +#endif + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { +#if _WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 + j = 0; + while((txsize[i] >> j != 1)&&(txsize[i] !=0)){j++;} + setSn_TXBUF_SIZE(i, j); +#else + setSn_TXBUF_SIZE(i, txsize[i]); +#endif + } + } + + if(rxsize) + { + tmp = 0; +#if _WIZCHIP_ == W5300 + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { + if(rxsize[i] > 64) return -1; //No use 64KB even if W5300 support max 64KB memory allocation + tmp += rxsize[i]; + if(tmp > 128) return -1; + } + if(tmp % 8) return -1; +#else + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { + tmp += rxsize[i]; +#if _WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s + if(tmp > 8) return -1; +#else + if(tmp > 16) return -1; +#endif + } +#endif + for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++) + { +#if _WIZCHIP_ < W5200 // add condition for w5100 + j = 0; + while((rxsize[i] >> j != 1)&&(txsize[i] !=0)){j++;} + setSn_RXBUF_SIZE(i, j); +#else + setSn_RXBUF_SIZE(i, rxsize[i]); +#endif + } + } + return 0; +} + +void wizchip_clrinterrupt(intr_kind intr) +{ + uint8_t ir = (uint8_t)intr; + uint8_t sir = (uint8_t)((uint16_t)intr >> 8); +#if _WIZCHIP_ < W5500 + ir |= (1<<4); // IK_WOL +#endif +#if _WIZCHIP_ == W5200 + ir |= (1 << 6); +#endif + +#if _WIZCHIP_ < W5200 + sir &= 0x0F; +#endif + +#if _WIZCHIP_ <= W5100S + ir |= sir; + setIR(ir); +//A20150601 : For integrating with W5300 +#elif _WIZCHIP_ == W5300 + setIR( ((((uint16_t)ir) << 8) | (((uint16_t)sir) & 0x00FF)) ); +#else + setIR(ir); +//M20200227 : For clear + //setSIR(sir); + for(ir=0; ir<8; ir++){ + if(sir & (0x01 <> 8); + sir = (uint8_t)ret; +#else + ir = getIR(); + sir = getSIR(); +#endif + +//M20150601 : For Integrating with W5300 +//#if _WIZCHIP_ < W5500 +#if _WIZCHIP_ < W5200 + ir &= ~(1<<4); // IK_WOL +#endif +#if _WIZCHIP_ == W5200 + ir &= ~(1 << 6); +#endif + ret = sir; + ret = (ret << 8) + ir; + return (intr_kind)ret; +} + +void wizchip_setinterruptmask(intr_kind intr) +{ + uint8_t imr = (uint8_t)intr; + uint8_t simr = (uint8_t)((uint16_t)intr >> 8); +#if _WIZCHIP_ < W5500 + imr &= ~(1<<4); // IK_WOL +#endif +#if _WIZCHIP_ == W5200 + imr &= ~(1 << 6); +#endif + +#if _WIZCHIP_ < W5200 + simr &= 0x0F; + imr |= simr; + setIMR(imr); +//A20150601 : For integrating with W5300 +#elif _WIZCHIP_ == W5300 + setIMR( ((((uint16_t)imr) << 8) | (((uint16_t)simr) & 0x00FF)) ); +#else + setIMR(imr); + setSIMR(simr); +#endif +} + +intr_kind wizchip_getinterruptmask(void) +{ + uint8_t imr = 0; + uint8_t simr = 0; + uint16_t ret = 0; +#if _WIZCHIP_ < W5200 + imr = getIMR(); + simr = imr & 0x0F; +//A20150601 : For integrating with W5300 +#elif _WIZCHIP_ == W5300 + ret = getIMR(); + imr = (uint8_t)(ret >> 8); + simr = (uint8_t)ret; +#else + imr = getIMR(); + simr = getSIMR(); +#endif + +#if _WIZCHIP_ < W5500 + imr &= ~(1<<4); // IK_WOL +#endif +#if _WIZCHIP_ == W5200 + imr &= ~(1 << 6); // IK_DEST_UNREACH +#endif + ret = simr; + ret = (ret << 8) + imr; + return (intr_kind)ret; +} + +int8_t wizphy_getphylink(void) +{ + int8_t tmp = PHY_LINK_OFF; +#if _WIZCHIP_ == W5100S + if(getPHYSR() & PHYSR_LNK) + tmp = PHY_LINK_ON; +#elif _WIZCHIP_ == W5200 + if(getPHYSTATUS() & PHYSTATUS_LINK) + tmp = PHY_LINK_ON; +#elif _WIZCHIP_ == W5500 + if(getPHYCFGR() & PHYCFGR_LNK_ON) + tmp = PHY_LINK_ON; + +#else + tmp = -1; +#endif + return tmp; +} + +#if _WIZCHIP_ > W5100 + +int8_t wizphy_getphypmode(void) +{ + int8_t tmp = 0; + #if _WIZCHIP_ == W5200 + if(getPHYSTATUS() & PHYSTATUS_POWERDOWN) + tmp = PHY_POWER_DOWN; + else + tmp = PHY_POWER_NORM; + #elif _WIZCHIP_ == 5500 + if((getPHYCFGR() & PHYCFGR_OPMDC_ALLA) == PHYCFGR_OPMDC_PDOWN) + tmp = PHY_POWER_DOWN; + else + tmp = PHY_POWER_NORM; + #else + tmp = -1; + #endif + return tmp; +} +#endif + +#if _WIZCHIP_ == W5100S +void wizphy_reset(void) +{ + uint16_t tmp = wiz_mdio_read(PHYMDIO_BMCR); + tmp |= BMCR_RESET; + wiz_mdio_write(PHYMDIO_BMCR, tmp); + while(wiz_mdio_read(PHYMDIO_BMCR)&BMCR_RESET){} +} + +void wizphy_setphyconf(wiz_PhyConf* phyconf) +{ + uint16_t tmp = wiz_mdio_read(PHYMDIO_BMCR); + if(phyconf->mode == PHY_MODE_AUTONEGO) + tmp |= BMCR_AUTONEGO; + else + { + tmp &= ~BMCR_AUTONEGO; + if(phyconf->duplex == PHY_DUPLEX_FULL) + { + tmp |= BMCR_DUP; + } + else + { + tmp &= ~BMCR_DUP; + } + if(phyconf->speed == PHY_SPEED_100) + { + tmp |= BMCR_SPEED; + } + else + { + tmp &= ~BMCR_SPEED; + } + } + wiz_mdio_write(PHYMDIO_BMCR, tmp); +} + +void wizphy_getphyconf(wiz_PhyConf* phyconf) +{ + uint16_t tmp = 0; + tmp = wiz_mdio_read(PHYMDIO_BMCR); + phyconf->by = PHY_CONFBY_SW; + if(tmp & BMCR_AUTONEGO) + { + phyconf->mode = PHY_MODE_AUTONEGO; + } + else + { + phyconf->mode = PHY_MODE_MANUAL; + if(tmp&BMCR_DUP) phyconf->duplex = PHY_DUPLEX_FULL; + else phyconf->duplex = PHY_DUPLEX_HALF; + if(tmp&BMCR_SPEED) phyconf->speed = PHY_SPEED_100; + else phyconf->speed = PHY_SPEED_10; + } +} + +int8_t wizphy_setphypmode(uint8_t pmode) +{ + uint16_t tmp = 0; + tmp = wiz_mdio_read(PHYMDIO_BMCR); + if( pmode == PHY_POWER_DOWN) + { + tmp |= BMCR_PWDN; + } + else + { + tmp &= ~BMCR_PWDN; + } + wiz_mdio_write(PHYMDIO_BMCR, tmp); + tmp = wiz_mdio_read(PHYMDIO_BMCR); + if( pmode == PHY_POWER_DOWN) + { + if(tmp & BMCR_PWDN) return 0; + } + else + { + if((tmp & BMCR_PWDN) != BMCR_PWDN) return 0; + } + return -1; +} + +#endif +#if _WIZCHIP_ == W5500 +void wizphy_reset(void) +{ + uint8_t tmp = getPHYCFGR(); + tmp &= PHYCFGR_RST; + setPHYCFGR(tmp); + tmp = getPHYCFGR(); + tmp |= ~PHYCFGR_RST; + setPHYCFGR(tmp); +} + +void wizphy_setphyconf(wiz_PhyConf* phyconf) +{ + uint8_t tmp = 0; + if(phyconf->by == PHY_CONFBY_SW) + tmp |= PHYCFGR_OPMD; + else + tmp &= ~PHYCFGR_OPMD; + if(phyconf->mode == PHY_MODE_AUTONEGO) + tmp |= PHYCFGR_OPMDC_ALLA; + else + { + if(phyconf->duplex == PHY_DUPLEX_FULL) + { + if(phyconf->speed == PHY_SPEED_100) + tmp |= PHYCFGR_OPMDC_100F; + else + tmp |= PHYCFGR_OPMDC_10F; + } + else + { + if(phyconf->speed == PHY_SPEED_100) + tmp |= PHYCFGR_OPMDC_100H; + else + tmp |= PHYCFGR_OPMDC_10H; + } + } + setPHYCFGR(tmp); + wizphy_reset(); +} + +void wizphy_getphyconf(wiz_PhyConf* phyconf) +{ + uint8_t tmp = 0; + tmp = getPHYCFGR(); + phyconf->by = (tmp & PHYCFGR_OPMD) ? PHY_CONFBY_SW : PHY_CONFBY_HW; + switch(tmp & PHYCFGR_OPMDC_ALLA) + { + case PHYCFGR_OPMDC_ALLA: + case PHYCFGR_OPMDC_100FA: + phyconf->mode = PHY_MODE_AUTONEGO; + break; + default: + phyconf->mode = PHY_MODE_MANUAL; + break; + } + switch(tmp & PHYCFGR_OPMDC_ALLA) + { + case PHYCFGR_OPMDC_100FA: + case PHYCFGR_OPMDC_100F: + case PHYCFGR_OPMDC_100H: + phyconf->speed = PHY_SPEED_100; + break; + default: + phyconf->speed = PHY_SPEED_10; + break; + } + switch(tmp & PHYCFGR_OPMDC_ALLA) + { + case PHYCFGR_OPMDC_100FA: + case PHYCFGR_OPMDC_100F: + case PHYCFGR_OPMDC_10F: + phyconf->duplex = PHY_DUPLEX_FULL; + break; + default: + phyconf->duplex = PHY_DUPLEX_HALF; + break; + } +} + +void wizphy_getphystat(wiz_PhyConf* phyconf) +{ + uint8_t tmp = getPHYCFGR(); + phyconf->duplex = (tmp & PHYCFGR_DPX_FULL) ? PHY_DUPLEX_FULL : PHY_DUPLEX_HALF; + phyconf->speed = (tmp & PHYCFGR_SPD_100) ? PHY_SPEED_100 : PHY_SPEED_10; +} + +int8_t wizphy_setphypmode(uint8_t pmode) +{ + uint8_t tmp = 0; + tmp = getPHYCFGR(); + if((tmp & PHYCFGR_OPMD)== 0) return -1; + tmp &= ~PHYCFGR_OPMDC_ALLA; + if( pmode == PHY_POWER_DOWN) + tmp |= PHYCFGR_OPMDC_PDOWN; + else + tmp |= PHYCFGR_OPMDC_ALLA; + setPHYCFGR(tmp); + wizphy_reset(); + tmp = getPHYCFGR(); + if( pmode == PHY_POWER_DOWN) + { + if(tmp & PHYCFGR_OPMDC_PDOWN) return 0; + } + else + { + if(tmp & PHYCFGR_OPMDC_ALLA) return 0; + } + return -1; +} +#endif + + +void wizchip_setnetinfo(wiz_NetInfo* pnetinfo) +{ + setSHAR(pnetinfo->mac); + setGAR(pnetinfo->gw); + setSUBR(pnetinfo->sn); + setSIPR(pnetinfo->ip); + _DNS_[0] = pnetinfo->dns[0]; + _DNS_[1] = pnetinfo->dns[1]; + _DNS_[2] = pnetinfo->dns[2]; + _DNS_[3] = pnetinfo->dns[3]; + _DHCP_ = pnetinfo->dhcp; +} + +void wizchip_getnetinfo(wiz_NetInfo* pnetinfo) +{ + getSHAR(pnetinfo->mac); + getGAR(pnetinfo->gw); + getSUBR(pnetinfo->sn); + getSIPR(pnetinfo->ip); + pnetinfo->dns[0]= _DNS_[0]; + pnetinfo->dns[1]= _DNS_[1]; + pnetinfo->dns[2]= _DNS_[2]; + pnetinfo->dns[3]= _DNS_[3]; + pnetinfo->dhcp = _DHCP_; +} + +int8_t wizchip_setnetmode(netmode_type netmode) +{ + uint8_t tmp = 0; +#if _WIZCHIP_ != W5500 + if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK)) return -1; +#else + if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK | NM_FORCEARP)) return -1; +#endif + tmp = getMR(); + tmp |= (uint8_t)netmode; + setMR(tmp); + return 0; +} + +netmode_type wizchip_getnetmode(void) +{ + return (netmode_type) getMR(); +} + +void wizchip_settimeout(wiz_NetTimeout* nettime) +{ + setRCR(nettime->retry_cnt); + setRTR(nettime->time_100us); +} + +void wizchip_gettimeout(wiz_NetTimeout* nettime) +{ + nettime->retry_cnt = getRCR(); + nettime->time_100us = getRTR(); +} diff --git a/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.h b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.h new file mode 100644 index 0000000..a5d65f7 --- /dev/null +++ b/NxFuncs/network/ioLibrary_Driver-master/Ethernet/wizchip_conf.h @@ -0,0 +1,661 @@ +//***************************************************************************** +// +//! \file wizchip_conf.h +//! \brief WIZCHIP Config Header File. +//! \version 1.0.0 +//! \date 2013/10/21 +//! \par Revision history +//! <2015/02/05> Notice +//! The version history is not updated after this point. +//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. +//! >> https://github.com/Wiznet/ioLibrary_Driver +//! <2013/10/21> 1st Release +//! \author MidnightCow +//! \copyright +//! +//! Copyright (c) 2013, WIZnet Co., LTD. +//! All rights reserved. +//! +//! Redistribution and use in source and binary forms, with or without +//! modification, are permitted provided that the following conditions +//! are met: +//! +//! * Redistributions of source code must retain the above copyright +//! notice, this list of conditions and the following disclaimer. +//! * 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. +//! * Neither the name of the 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 OWNER 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. +// +//***************************************************************************** + +/** + * @defgroup extra_functions 2. WIZnet Extra Functions + * + * @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions. + * @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n + * + */ + +#ifndef _WIZCHIP_CONF_H_ +#define _WIZCHIP_CONF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +/** + * @brief Select WIZCHIP. + * @todo You should select one, \b W5100, \b W5100S, \b W5200, \b W5300, \b W5500 or etc. \n\n + * ex> #define \_WIZCHIP_ W5500 + */ + +#define W5100 5100 +#define W5100S 5100+5 +#define W5200 5200 +#define W5300 5300 +#define W5500 5500 + +#ifndef _WIZCHIP_ +#define _WIZCHIP_ W5500 // W5100, W5100S, W5200, W5300, W5500 +#endif + +#define _WIZCHIP_IO_MODE_NONE_ 0x0000 +#define _WIZCHIP_IO_MODE_BUS_ 0x0100 /**< Bus interface mode */ +#define _WIZCHIP_IO_MODE_SPI_ 0x0200 /**< SPI interface mode */ +//#define _WIZCHIP_IO_MODE_IIC_ 0x0400 +//#define _WIZCHIP_IO_MODE_SDIO_ 0x0800 +// Add to +// + +#define _WIZCHIP_IO_MODE_BUS_DIR_ (_WIZCHIP_IO_MODE_BUS_ + 1) /**< BUS interface mode for direct */ +#define _WIZCHIP_IO_MODE_BUS_INDIR_ (_WIZCHIP_IO_MODE_BUS_ + 2) /**< BUS interface mode for indirect */ + +#define _WIZCHIP_IO_MODE_SPI_VDM_ (_WIZCHIP_IO_MODE_SPI_ + 1) /**< SPI interface mode for variable length data*/ +#define _WIZCHIP_IO_MODE_SPI_FDM_ (_WIZCHIP_IO_MODE_SPI_ + 2) /**< SPI interface mode for fixed length data mode*/ +#define _WIZCHIP_IO_MODE_SPI_5500_ (_WIZCHIP_IO_MODE_SPI_ + 3) /**< SPI interface mode for fixed length data mode*/ + +#if (_WIZCHIP_ == W5100) + #define _WIZCHIP_ID_ "W5100\0" +/** + * @brief Define interface mode. + * @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_DIR_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ + */ +// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_DIR_ +// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_ + #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_ + +//A20150601 : Define the unit of IO DATA. + typedef uint8_t iodata_t; +//A20150401 : Indclude W5100.h file + #include "W5100/w5100.h" + +#elif (_WIZCHIP_ == W5100S) +#define _WIZCHIP_ID_ "W5100S\0" +/** +* @brief Define interface mode. +* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_DIR_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ +*/ +// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_ + //#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_5500_ + #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_ + +//A20150601 : Define the unit of IO DATA. + typedef uint8_t iodata_t; +//A20150401 : Indclude W5100.h file + #include "W5100S/w5100s.h" +#elif (_WIZCHIP_ == W5200) + #define _WIZCHIP_ID_ "W5200\0" +/** + * @brief Define interface mode. + * @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ or @ref \ _WIZCHIP_IO_MODE_BUS_INDIR_ + */ +#ifndef _WIZCHIP_IO_MODE_ +// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_ + #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_ +#endif +//A20150601 : Define the unit of IO DATA. + typedef uint8_t iodata_t; + #include "W5200/w5200.h" +#elif (_WIZCHIP_ == W5500) + #define _WIZCHIP_ID_ "W5500\0" + +/** + * @brief Define interface mode. \n + * @todo Should select interface mode as chip. + * - @ref \_WIZCHIP_IO_MODE_SPI_ \n + * -@ref \_WIZCHIP_IO_MODE_SPI_VDM_ : Valid only in @ref \_WIZCHIP_ == W5500 \n + * -@ref \_WIZCHIP_IO_MODE_SPI_FDM_ : Valid only in @ref \_WIZCHIP_ == W5500 \n + * - @ref \_WIZCHIP_IO_MODE_BUS_ \n + * - @ref \_WIZCHIP_IO_MODE_BUS_DIR_ \n + * - @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ \n + * - Others will be defined in future. \n\n + * ex> #define \_WIZCHIP_IO_MODE_ \_WIZCHIP_IO_MODE_SPI_VDM_ + * + */ +#ifndef _WIZCHIP_IO_MODE_ + //#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_ + #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_VDM_ +#endif +//A20150601 : Define the unit of IO DATA. + typedef uint8_t iodata_t; + #include "W5500/w5500.h" +#elif ( _WIZCHIP_ == W5300) + #define _WIZCHIP_ID_ "W5300\0" +/** + * @brief Define interface mode. + * @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_DIR_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ + */ +#ifndef _WIZCHIP_IO_MODE_ + #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_DIR_ +// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_ +#endif + +//A20150601 : Define the unit and bus width of IO DATA. + /** + * @brief Select the data width 8 or 16 bits. + * @todo you should select the bus width. Select one of 8 or 16. + */ + #ifndef _WIZCHIP_IO_BUS_WIDTH_ + #define _WIZCHIP_IO_BUS_WIDTH_ 16 // 8 + #endif + #if _WIZCHIP_IO_BUS_WIDTH_ == 8 + typedef uint8_t iodata_t; + #elif _WIZCHIP_IO_BUS_WIDTH_ == 16 + typedef uint16_t iodata_t; + #else + #error "Unknown _WIZCHIP_IO_BUS_WIDTH_. It should be 8 or 16." + #endif +// + #include "W5300/w5300.h" +#else + #error "Unknown defined _WIZCHIP_. You should define one of 5100, 5200, and 5500 !!!" +#endif + +#ifndef _WIZCHIP_IO_MODE_ + #error "Undefined _WIZCHIP_IO_MODE_. You should define it !!!" +#endif + +/** + * @brief Define I/O base address when BUS IF mode. + * @todo Should re-define it to fit your system when BUS IF Mode (@ref \_WIZCHIP_IO_MODE_BUS_, + * @ref \_WIZCHIP_IO_MODE_BUS_DIR_, @ref \_WIZCHIP_IO_MODE_BUS_INDIR_). \n\n + * ex> #define \_WIZCHIP_IO_BASE_ 0x00008000 + */ +#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS_ +// #define _WIZCHIP_IO_BASE_ 0x60000000 // for 5100S IND + #define _WIZCHIP_IO_BASE_ 0x68000000 // for W5300 +#elif _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_ + #define _WIZCHIP_IO_BASE_ 0x00000000 // for 5100S SPI +#endif + +#ifndef _WIZCHIP_IO_BASE_ +#define _WIZCHIP_IO_BASE_ 0x00000000 // 0x8000 +#endif + +//M20150401 : Typing Error +//#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS +#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS_ + #ifndef _WIZCHIP_IO_BASE_ + #error "You should be define _WIZCHIP_IO_BASE to fit your system memory map." + #endif +#endif + +#if _WIZCHIP_ >= W5200 + #define _WIZCHIP_SOCK_NUM_ 8 ///< The count of independant socket of @b WIZCHIP +#else + #define _WIZCHIP_SOCK_NUM_ 4 ///< The count of independant socket of @b WIZCHIP +#endif + + +/******************************************************** +* WIZCHIP BASIC IF functions for SPI, SDIO, I2C , ETC. +*********************************************************/ +/** + * @ingroup DATA_TYPE + * @brief The set of callback functions for W5500:@ref WIZCHIP_IO_Functions W5200:@ref WIZCHIP_IO_Functions_W5200 + */ +typedef struct __WIZCHIP +{ + uint16_t if_mode; ///< host interface mode + uint8_t id[8]; ///< @b WIZCHIP ID such as @b 5100, @b 5100S, @b 5200, @b 5500, and so on. + /** + * The set of critical section callback func. + */ + struct _CRIS + { + void (*_enter) (void); ///< crtical section enter + void (*_exit) (void); ///< critial section exit + }CRIS; + /** + * The set of @ref \_WIZCHIP_ select control callback func. + */ + struct _CS + { + void (*_select) (void); ///< @ref \_WIZCHIP_ selected + void (*_deselect)(void); ///< @ref \_WIZCHIP_ deselected + }CS; + /** + * The set of interface IO callback func. + */ + union _IF + { + /** + * For BUS interface IO + */ + //M20156501 : Modify the function name for integrating with W5300 + //struct + //{ + // uint8_t (*_read_byte) (uint32_t AddrSel); + // void (*_write_byte) (uint32_t AddrSel, uint8_t wb); + //}BUS; + struct + { + iodata_t (*_read_data) (uint32_t AddrSel); + void (*_write_data) (uint32_t AddrSel, iodata_t wb); + }BUS; + + /** + * For SPI interface IO + */ + struct + { + uint8_t (*_read_byte) (void); + void (*_write_byte) (uint8_t wb); + void (*_read_burst) (uint8_t* pBuf, uint16_t len); + void (*_write_burst) (uint8_t* pBuf, uint16_t len); + }SPI; + // To be added + // + }IF; +}_WIZCHIP; + +extern _WIZCHIP WIZCHIP; + +/** + * @ingroup DATA_TYPE + * WIZCHIP control type enumration used in @ref ctlwizchip(). + */ +typedef enum +{ + CW_RESET_WIZCHIP, ///< Resets WIZCHIP by softly + CW_INIT_WIZCHIP, ///< Initializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t. + CW_GET_INTERRUPT, ///< Get Interrupt status of WIZCHIP + CW_CLR_INTERRUPT, ///< Clears interrupt + CW_SET_INTRMASK, ///< Masks interrupt + CW_GET_INTRMASK, ///< Get interrupt mask + CW_SET_INTRTIME, ///< Set interval time between the current and next interrupt. + CW_GET_INTRTIME, ///< Set interval time between the current and next interrupt. + CW_GET_ID, ///< Gets WIZCHIP name. + +//D20150601 : For no modification your application code +//#if _WIZCHIP_ == W5500 + CW_RESET_PHY, ///< Resets internal PHY. Valid Only W5500 + CW_SET_PHYCONF, ///< When PHY configured by internal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000 + CW_GET_PHYCONF, ///< Get PHY operation mode in internal register. Valid Only W5500 + CW_GET_PHYSTATUS, ///< Get real PHY status on operating. Valid Only W5500 + CW_SET_PHYPOWMODE, ///< Set PHY power mode as normal and down when PHYSTATUS.OPMD == 1. Valid Only W5500 +//#endif +//D20150601 : For no modification your application code +//#if _WIZCHIP_ == W5200 || _WIZCHIP_ == W5500 + CW_GET_PHYPOWMODE, ///< Get PHY Power mode as down or normal, Valid Only W5100, W5200 + CW_GET_PHYLINK ///< Get PHY Link status, Valid Only W5100, W5200 +//#endif +}ctlwizchip_type; + +/** + * @ingroup DATA_TYPE + * Network control type enumration used in @ref ctlnetwork(). + */ +typedef enum +{ + CN_SET_NETINFO, ///< Set Network with @ref wiz_NetInfo + CN_GET_NETINFO, ///< Get Network with @ref wiz_NetInfo + CN_SET_NETMODE, ///< Set network mode as WOL, PPPoE, Ping Block, and Force ARP mode + CN_GET_NETMODE, ///< Get network mode as WOL, PPPoE, Ping Block, and Force ARP mode + CN_SET_TIMEOUT, ///< Set network timeout as retry count and time. + CN_GET_TIMEOUT, ///< Get network timeout as retry count and time. +}ctlnetwork_type; + +/** + * @ingroup DATA_TYPE + * Interrupt kind when CW_SET_INTRRUPT, CW_GET_INTERRUPT, CW_SET_INTRMASK + * and CW_GET_INTRMASK is used in @ref ctlnetwork(). + * It can be used with OR operation. + */ +typedef enum +{ +#if _WIZCHIP_ == W5500 + IK_WOL = (1 << 4), ///< Wake On Lan by receiving the magic packet. Valid in W500. +#elif _WIZCHIP_ == W5300 + IK_FMTU = (1 << 4), ///< Received a ICMP message (Fragment MTU) +#endif + + IK_PPPOE_TERMINATED = (1 << 5), ///< PPPoE Disconnected + +#if _WIZCHIP_ != W5200 + IK_DEST_UNREACH = (1 << 6), ///< Destination IP & Port Unreachable, No use in W5200 +#endif + + IK_IP_CONFLICT = (1 << 7), ///< IP conflict occurred + + IK_SOCK_0 = (1 << 8), ///< Socket 0 interrupt + IK_SOCK_1 = (1 << 9), ///< Socket 1 interrupt + IK_SOCK_2 = (1 << 10), ///< Socket 2 interrupt + IK_SOCK_3 = (1 << 11), ///< Socket 3 interrupt +#if _WIZCHIP_ > W5100S + IK_SOCK_4 = (1 << 12), ///< Socket 4 interrupt, No use in 5100 + IK_SOCK_5 = (1 << 13), ///< Socket 5 interrupt, No use in 5100 + IK_SOCK_6 = (1 << 14), ///< Socket 6 interrupt, No use in 5100 + IK_SOCK_7 = (1 << 15), ///< Socket 7 interrupt, No use in 5100 +#endif + +#if _WIZCHIP_ > W5100S + IK_SOCK_ALL = (0xFF << 8) ///< All Socket interrupt +#else + IK_SOCK_ALL = (0x0F << 8) ///< All Socket interrupt +#endif +}intr_kind; + +#define PHY_CONFBY_HW 0 ///< Configured PHY operation mode by HW pin +#define PHY_CONFBY_SW 1 ///< Configured PHY operation mode by SW register +#define PHY_MODE_MANUAL 0 ///< Configured PHY operation mode with user setting. +#define PHY_MODE_AUTONEGO 1 ///< Configured PHY operation mode with auto-negotiation +#define PHY_SPEED_10 0 ///< Link Speed 10 +#define PHY_SPEED_100 1 ///< Link Speed 100 +#define PHY_DUPLEX_HALF 0 ///< Link Half-Duplex +#define PHY_DUPLEX_FULL 1 ///< Link Full-Duplex +#define PHY_LINK_OFF 0 ///< Link Off +#define PHY_LINK_ON 1 ///< Link On +#define PHY_POWER_NORM 0 ///< PHY power normal mode +#define PHY_POWER_DOWN 1 ///< PHY power down mode + + +#if _WIZCHIP_ == W5100S || _WIZCHIP_ == W5500 +/** + * @ingroup DATA_TYPE + * It configures PHY configuration when CW_SET PHYCONF or CW_GET_PHYCONF in W5500, + * and it indicates the real PHY status configured by HW or SW in all WIZCHIP. \n + * Valid only in W5500. + */ +typedef struct wiz_PhyConf_t +{ + uint8_t by; ///< set by @ref PHY_CONFBY_HW or @ref PHY_CONFBY_SW + uint8_t mode; ///< set by @ref PHY_MODE_MANUAL or @ref PHY_MODE_AUTONEGO + uint8_t speed; ///< set by @ref PHY_SPEED_10 or @ref PHY_SPEED_100 + uint8_t duplex; ///< set by @ref PHY_DUPLEX_HALF @ref PHY_DUPLEX_FULL + //uint8_t power; ///< set by @ref PHY_POWER_NORM or @ref PHY_POWER_DOWN + //uint8_t link; ///< Valid only in CW_GET_PHYSTATUS. set by @ref PHY_LINK_ON or PHY_DUPLEX_OFF + }wiz_PhyConf; +#endif + +/** + * @ingroup DATA_TYPE + * It used in setting dhcp_mode of @ref wiz_NetInfo. + */ +typedef enum +{ + NETINFO_STATIC = 1, ///< Static IP configuration by manually. + NETINFO_DHCP ///< Dynamic IP configruation from a DHCP sever +}dhcp_mode; + +/** + * @ingroup DATA_TYPE + * Network Information for WIZCHIP + */ +typedef struct wiz_NetInfo_t +{ + uint8_t mac[6]; ///< Source Mac Address + uint8_t ip[4]; ///< Source IP Address + uint8_t sn[4]; ///< Subnet Mask + uint8_t gw[4]; ///< Gateway IP Address + uint8_t dns[4]; ///< DNS server IP Address + dhcp_mode dhcp; ///< 1 - Static, 2 - DHCP +}wiz_NetInfo; + +/** + * @ingroup DATA_TYPE + * Network mode + */ +typedef enum +{ +#if _WIZCHIP_ == W5500 + NM_FORCEARP = (1<<1), ///< Force to APP send whenever udp data is sent. Valid only in W5500 +#endif + NM_WAKEONLAN = (1<<5), ///< Wake On Lan + NM_PINGBLOCK = (1<<4), ///< Block ping-request + NM_PPPOE = (1<<3), ///< PPPoE mode +}netmode_type; + +/** + * @ingroup DATA_TYPE + * Used in CN_SET_TIMEOUT or CN_GET_TIMEOUT of @ref ctlwizchip() for timeout configruation. + */ +typedef struct wiz_NetTimeout_t +{ + uint8_t retry_cnt; ///< retry count + uint16_t time_100us; ///< time unit 100us +}wiz_NetTimeout; + +/** + *@brief Registers call back function for critical section of I/O functions such as + *\ref WIZCHIP_READ, @ref WIZCHIP_WRITE, @ref WIZCHIP_READ_BUF and @ref WIZCHIP_WRITE_BUF. + *@param cris_en : callback function for critical section enter. + *@param cris_ex : callback function for critical section exit. + *@todo Describe @ref WIZCHIP_CRITICAL_ENTER and @ref WIZCHIP_CRITICAL_EXIT marco or register your functions. + *@note If you do not describe or register, default functions(@ref wizchip_cris_enter & @ref wizchip_cris_exit) is called. + */ +void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void)); + + +/** + *@brief Registers call back function for WIZCHIP select & deselect. + *@param cs_sel : callback function for WIZCHIP select + *@param cs_desel : callback fucntion for WIZCHIP deselect + *@todo Describe @ref wizchip_cs_select and @ref wizchip_cs_deselect function or register your functions. + *@note If you do not describe or register, null function is called. + */ +void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void)); + +/** + *@brief Registers call back function for bus interface. + *@param bus_rb : callback function to read byte data using system bus + *@param bus_wb : callback function to write byte data using system bus + *@todo Describe @ref wizchip_bus_readbyte and @ref wizchip_bus_writebyte function + *or register your functions. + *@note If you do not describe or register, null function is called. + */ +//M20150601 : For integrating with W5300 +//void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb)); +void reg_wizchip_bus_cbfunc(iodata_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, iodata_t wb)); + +/** + *@brief Registers call back function for SPI interface. + *@param spi_rb : callback function to read byte using SPI + *@param spi_wb : callback function to write byte using SPI + *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function + *or register your functions. + *@note If you do not describe or register, null function is called. + */ +void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb)); + +/** + *@brief Registers call back function for SPI interface. + *@param spi_rb : callback function to burst read using SPI + *@param spi_wb : callback function to burst write using SPI + *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function + *or register your functions. + *@note If you do not describe or register, null function is called. + */ +void reg_wizchip_spiburst_cbfunc(void (*spi_rb)(uint8_t* pBuf, uint16_t len), void (*spi_wb)(uint8_t* pBuf, uint16_t len)); + +/** + * @ingroup extra_functions + * @brief Controls to the WIZCHIP. + * @details Resets WIZCHIP & internal PHY, Configures PHY mode, Monitor PHY(Link,Speed,Half/Full/Auto), + * controls interrupt & mask and so on. + * @param cwtype : Decides to the control type + * @param arg : arg type is dependent on cwtype. + * @return 0 : Success \n + * -1 : Fail because of invalid \ref ctlwizchip_type or unsupported \ref ctlwizchip_type in WIZCHIP + */ +int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg); + +/** + * @ingroup extra_functions + * @brief Controls to network. + * @details Controls to network environment, mode, timeout and so on. + * @param cntype : Input. Decides to the control type + * @param arg : Inout. arg type is dependent on cntype. + * @return -1 : Fail because of invalid \ref ctlnetwork_type or unsupported \ref ctlnetwork_type in WIZCHIP \n + * 0 : Success + */ +int8_t ctlnetwork(ctlnetwork_type cntype, void* arg); + + +/* + * The following functions are implemented for internal use. + * but You can call these functions for code size reduction instead of ctlwizchip() and ctlnetwork(). + */ + +/** + * @ingroup extra_functions + * @brief Reset WIZCHIP by softly. + */ +void wizchip_sw_reset(void); + +/** + * @ingroup extra_functions + * @brief Initializes WIZCHIP with socket buffer size + * @param txsize Socket tx buffer sizes. If null, initialized the default size 2KB. + * @param rxsize Socket rx buffer sizes. If null, initialized the default size 2KB. + * @return 0 : succcess \n + * -1 : fail. Invalid buffer size + */ +int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize); + +/** + * @ingroup extra_functions + * @brief Clear Interrupt of WIZCHIP. + * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t. + */ +void wizchip_clrinterrupt(intr_kind intr); + +/** + * @ingroup extra_functions + * @brief Get Interrupt of WIZCHIP. + * @return @ref intr_kind value operated OR. It can type-cast to uint16_t. + */ +intr_kind wizchip_getinterrupt(void); + +/** + * @ingroup extra_functions + * @brief Mask or Unmask Interrupt of WIZCHIP. + * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t. + */ +void wizchip_setinterruptmask(intr_kind intr); + +/** + * @ingroup extra_functions + * @brief Get Interrupt mask of WIZCHIP. + * @return : The operated OR vaule of @ref intr_kind. It can type-cast to uint16_t. + */ +intr_kind wizchip_getinterruptmask(void); + +//todo +#if _WIZCHIP_ > W5100 + int8_t wizphy_getphylink(void); ///< get the link status of phy in WIZCHIP. No use in W5100 + int8_t wizphy_getphypmode(void); ///< get the power mode of PHY in WIZCHIP. No use in W5100 +#endif + +#if _WIZCHIP_ == W5100S || _WIZCHIP_ == W5500 + void wizphy_reset(void); ///< Reset phy. Vailid only in W5500 +/** + * @ingroup extra_functions + * @brief Set the phy information for WIZCHIP without power mode + * @param phyconf : @ref wiz_PhyConf + */ + void wizphy_setphyconf(wiz_PhyConf* phyconf); + /** + * @ingroup extra_functions + * @brief Get phy configuration information. + * @param phyconf : @ref wiz_PhyConf + */ + void wizphy_getphyconf(wiz_PhyConf* phyconf); + /** + * @ingroup extra_functions + * @brief Get phy status. + * @param phyconf : @ref wiz_PhyConf + */ + void wizphy_getphystat(wiz_PhyConf* phyconf); + /** + * @ingroup extra_functions + * @brief set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in W5200 + * @param pmode Settig value of power down mode. + */ + int8_t wizphy_setphypmode(uint8_t pmode); +#endif + +/** +* @ingroup extra_functions + * @brief Set the network information for WIZCHIP + * @param pnetinfo : @ref wizNetInfo + */ +void wizchip_setnetinfo(wiz_NetInfo* pnetinfo); + +/** + * @ingroup extra_functions + * @brief Get the network information for WIZCHIP + * @param pnetinfo : @ref wizNetInfo + */ +void wizchip_getnetinfo(wiz_NetInfo* pnetinfo); + +/** + * @ingroup extra_functions + * @brief Set the network mode such WOL, PPPoE, Ping Block, and etc. + * @param pnetinfo Value of network mode. Refer to @ref netmode_type. + */ +int8_t wizchip_setnetmode(netmode_type netmode); + +/** + * @ingroup extra_functions + * @brief Get the network mode such WOL, PPPoE, Ping Block, and etc. + * @return Value of network mode. Refer to @ref netmode_type. + */ +netmode_type wizchip_getnetmode(void); + +/** + * @ingroup extra_functions + * @brief Set retry time value(@ref _RTR_) and retry count(@ref _RCR_). + * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission. + * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout. + */ +void wizchip_settimeout(wiz_NetTimeout* nettime); + +/** + * @ingroup extra_functions + * @brief Get retry time value(@ref _RTR_) and retry count(@ref _RCR_). + * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission. + * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout. + */ +void wizchip_gettimeout(wiz_NetTimeout* nettime); +#ifdef __cplusplus + } +#endif + +#endif // _WIZCHIP_CONF_H_ diff --git a/NxFuncs/network/tcpclient.c b/NxFuncs/network/tcpclient.c new file mode 100644 index 0000000..75ed6f6 --- /dev/null +++ b/NxFuncs/network/tcpclient.c @@ -0,0 +1,425 @@ + +#include "tcpclient.h" + +#if (CLIENT_NUM > 0) + +#include "socket.h" +#include "inout.h" +#include "console.h" +#include "delay.h" +#include "trigger.h" + +//---------------------------------------------------------------------- + +int g_clinetLinksta; // ״̬ +int g_clinetLinkCount; // ӶϿ + + +//------------------------------------------- + +SocketCtrl g_clientSocket[CLIENT_NUM] = +{ + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+0, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+0, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*0, TCP_CLIENT_REMOTE_PORT_BEG}, +#if (CLIENT_NUM > 1) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+1, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+1, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*1, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 2) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+2, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+2, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*2, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 3) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+3, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+3, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*3, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 4) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+4, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+4, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*4, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 5) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+5, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+5, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*5, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 6) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+6, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+6, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*6, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +#if (CLIENT_NUM > 7) + {TCP_CLIENT, STA_INIT, TCP_CLIENT_SN_BEG+7, TCP_CLIENT_LOCAL_IP, TCP_CLIENT_LOCAL_PORT_BEG+7, TCP_CLIENT_REMOTE_IP_BEG+TCP_CLIENT_REMOTE_IP_ADD*7, TCP_CLIENT_REMOTE_PORT_BEG}, +#endif +}; + + +//----------------------------------------------------------------------------------------------------- + +void InitTcpClient(void) +{ + int i; + + g_clinetLinksta = LINK_INIT; + g_clinetLinkCount = 0; + + for (i = 0; i < CLIENT_NUM; i++) + { + g_clientSocket[i].status = STA_CLOSED; + } + +} + +//----------------------------------------------------------------------------------------------------- + +void TcpClientRun(void) +{ + int i; + int rslt; + u8 sn, tmp8; + u16 port, ir; + int crsocket; + u16 sport; + u32 sip; + + crsocket = 0; + + // PHY״̬ + rslt = ctlwizchip(CW_GET_PHYLINK, (void*)(&tmp8)); + +#if (0) + { + u32 timer; + timer = GetMsSoftTimer(); + printf("at%d, TcpClientRun\r\n", timer); + } +#endif + + if(rslt == -1) + { + g_clinetLinksta = LINK_INIT; + printf("Unknown PHY Link stauts.\r\n"); + return; + } + else + { + if (tmp8 == PHY_LINK_ON) + { + if (g_clinetLinksta != LINK_UP) + { + crsocket = 1; // socket + g_clinetLinksta = LINK_UP; + printf("PHY Link UP.\r\n"); + } + } + else if (tmp8 == PHY_LINK_OFF) + { + if (g_clinetLinksta == LINK_INIT || g_clinetLinksta == LINK_UP) + { + if (g_clinetLinksta == LINK_INIT) + { + crsocket = 2; // رsocket + g_clinetLinksta = LINK_DOWN; + } + else + { + g_clinetLinkCount = 0; + g_clinetLinksta = LINK_WAIT; + } + printf("2. PHY Link DOWN.\r\n"); + } + else if (g_clinetLinksta == LINK_WAIT) + { + g_clinetLinkCount++; + if (g_clinetLinkCount > 10) + { + crsocket = 2; // رsocket + g_clinetLinksta = LINK_DOWN; + } + } + else + { + + } + } + else + { + printf("waite PHY connect.\r\n"); + return; + } + } + + // ر + if (g_clinetLinksta == LINK_DOWN && crsocket == 2) + { + printf("link down or crsocket == 2\r\n"); + for (i = 0; i < CLIENT_NUM; i++) + { + if (g_clientSocket[i].status != STA_CLOSED) + { + g_clientSocket[i].status = STA_CLOSED; + printf("close socket %d and disconnect.\r\n", g_clientSocket[i].socket); + disconnect(g_clientSocket[i].socket); + close(g_clientSocket[i].socket); + } + } + return; + } + + // tcp ͻ + for (i = 0; i < CLIENT_NUM; i++) + { + sn = g_clientSocket[i].socket; + port = g_clientSocket[i].localPort; + + tmp8 = getSn_SR(sn); + switch(tmp8) + { + case SOCK_ESTABLISHED: // + { + // printf("TCP client socket %d SOCK_ESTABLISHED\r\n", sn); + + ir = getSn_IR(sn); // ȡжϼĴ + if ((ir & Sn_IR_CON) != 0) + { + g_clientSocket[i].status = STA_CONNECT; + getsockopt(sn, SO_DESTIP, &sip); + getsockopt(sn, SO_DESTPORT, &sport); + printf("TCP client socket %d is connected, destination ip=%d.%d.%d.%d, port=%d\r\n", sn, + GETIP1(sip), GETIP2(sip), GETIP3(sip), GETIP4(sip), sport); + setSn_IR(sn, Sn_IR_CON); // ж״̬ + } + break; + } + + case SOCK_CLOSE_WAIT: // Էرյǰ + { + printf("TCP client socket %d wait close\r\n", sn); + disconnect(sn); + g_clientSocket[i].status = STA_CLOSED; + break; + } + + case SOCK_CLOSED: // ǹر״̬ + { + // ȴµ + + printf("TCP client socket %d is closed, create a new socket\r\n", sn); + rslt = socket(sn, Sn_MR_TCP, port, SF_IO_NONBLOCK); // + if (rslt == sn) + { + printf("Create TCP client success at socket %d\r\n", sn); + } + else + { + printf("Create TCP client failed at socket %d, code=%d\r\n", sn, rslt); + } + break; + } + case SOCK_INIT: // ʼ + { + sip = g_clientSocket[i].remoteIp; + sport = g_clientSocket[i].remotePort; + + printf("TCP client socket %d connect to ip=%d.%d.%d.%d, port=%d\r\n", sn, + GETIP1(sip), GETIP2(sip), GETIP3(sip), GETIP4(sip), sport); + + rslt = connect(sn, (u8*)(&sip), sport); + if (rslt == SOCK_OK) + { + g_clientSocket[i].status = STA_READY; + printf("TCP client socket %d connecting......\r\n", sn); + } + else + { + // printf("TCP client socket %d connect error, code=%d\r\n", sn, rslt); + } + break; + } + case SOCK_LISTEN: + { + printf("TCP client socket %d SOCK_LISTEN\r\n", sn); + break; + } + case SOCK_SYNSENT: + { + printf("TCP client socket %d SOCK_SYNSENT\r\n", sn); + break; + } + case SOCK_SYNRECV: + { + printf("TCP client socket %d SOCK_SYNRECV\r\n", sn); + break; + } + default: + { + // printf("default, TCP client socket %d status=0x%x\r\n", sn, tmp8); + break; + } + } // end of switch + } +} + + +/* + +void CreateTcpClient(void) +{ + int i; + int rslt; + u8 sn, tmp8; + u16 port; + for (i = 0; i < 8; i++) + { + if (g_clientSocket.status != STA_CLOSED) + { + printf("tcp clinet not closed\r\n"); + return; + } + + sn = g_clientSocket.socket; + port = g_clientSocket.port; + + tmp8 = SF_IO_NONBLOCK; + rslt = socket(sn, Sn_MR_TCP, port, tmp8); + if (rslt == sn) + { + g_clientSocket.status = STA_READY; + printf("create tcp client success\r\n"); + } + else + { + printf("create tcp client failed\r\n"); + } + } +} + +void ConnectTcpClient(void) +{ + int rslt; + u8 sn; + u16 port; + u32 ipaddr; + if (g_clientSocket.status != STA_READY) + { + printf("tcp clinet not ready\r\n"); + return; + } + + sn = g_clientSocket.socket; + ipaddr = PLC_SERVER_IP; + port = PLC_SERVER_PORT; + + rslt = connect(sn, (u8*)(&ipaddr), port); + if (rslt == SOCK_OK) + { + g_clientSocket.status = STA_CONNECT; + printf("connect server success......\r\n"); + } + else if (rslt == SOCKERR_SOCKNUM) + { + printf("Invalid socket number\r\n"); + } + else if (rslt == SOCKERR_SOCKMODE) + { + printf("Invalid socket mode\r\n"); + } + else if (rslt == SOCKERR_SOCKINIT) + { + printf("Socket is not initialized\r\n"); + } + else if (rslt == SOCKERR_IPINVALID) + { + printf("Wrong server IP address\r\n"); + } + else if (rslt == SOCKERR_PORTZERO) + { + printf("Server port zero\r\n"); + } + else if (rslt == SOCKERR_TIMEOUT) + { + printf("Timeout occurred during request connection\r\n"); + } + else // if (rslt == SOCK_BUSY) + { + printf("0. socket is busy\r\n"); + } +} +*/ + +void TestNetTrans(void) +{ + int i[8], sta[8], rslt; + int j; + u8 buff[MAX_TRANS_DATA]; + + memset(i, 0, sizeof(int)*8); + memset(sta, 0, sizeof(int)*8); + memset(buff, 0x5A, MAX_TRANS_DATA); + + do + { + if (IsConsoleCancel() != 0) + { + printf("send cancel\r\n"); + break; + } + + for (j = 0; j < CLIENT_NUM; j++) + { + if (g_clientSocket[j].status == STA_CONNECT) + { + if (sta[j] == 0) + { + if (i[j]%10 == 0) + { + printf("socket %d send data from tcp client to server %d times\r\n", g_clientSocket[j].socket, i[j]); + } + if (i[j]%2 == 0) + { + SetLedOn(); + } + else + { + SetLedOff(); + } + + sta[j] = 1; + } + + if (sta[j] == 1) + { + rslt = EthernetSendData(&(g_clientSocket[j]), buff, MAX_TRANS_DATA); + if (rslt != MAX_TRANS_DATA) + { + continue; + } + // printf("send data %d times success\r\n", i); + sta[j] = 0; + i[j]++; + } + } + } + }while(1); + +} +#endif + +SocketCtrl * GetTcpClientCtrlFromSocketId(int sIdx) +{ +#if (CLIENT_NUM > 0) + if (sIdx < CLIENT_NUM) + { + return &(g_clientSocket[sIdx]); + } + else +#endif + { + return NULL; + } +} + +int IsClinetConnect(int sIdx) +{ +#if (CLIENT_NUM > 0) + if (sIdx < CLIENT_NUM) + { + return g_clientSocket[sIdx].status; + } + else +#endif + { + return -1; + } +} + diff --git a/NxFuncs/network/tcpclient.h b/NxFuncs/network/tcpclient.h new file mode 100644 index 0000000..b396a17 --- /dev/null +++ b/NxFuncs/network/tcpclient.h @@ -0,0 +1,34 @@ + +#ifndef __TCPCLIENT_H__ +#define __TCPCLIENT_H__ + +#include "ethernet.h" + + +#if (CLIENT_NUM > 0) + + +//------------------------------------------------------------------- + +void InitTcpClient(void); + +void TcpClientRun(void); + +/* +void ConnectTcpClient(void); + +void CreateTcpClient(void); + +*/ + + +//---------------------------------------------------------------------- +#endif + +int IsClinetConnect(int sIdx); +SocketCtrl * GetTcpClientCtrlFromSocketId(int sIdx); + + +#endif + + diff --git a/NxFuncs/network/tcpserver.c b/NxFuncs/network/tcpserver.c new file mode 100644 index 0000000..a9503a8 --- /dev/null +++ b/NxFuncs/network/tcpserver.c @@ -0,0 +1,388 @@ + +#include "tcpserver.h" + +#if (SERVER_NUM > 0) + + +// TCP server +#include "socket.h" +#include "inout.h" + +//--------------------------------------------------------------- + +int g_linksta; // ״̬ +int g_linkCount; // ӶϿ + +//------------------------------------------- + +SocketCtrl g_serverSocket[SERVER_NUM] = +{ + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+0, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*0, TCP_SERVER_PORT_BEG+0, 0, 0}, +#if (SERVER_NUM > 1) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+1, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*1, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 2) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+2, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*2, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 3) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+3, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*3, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 4) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+4, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*4, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 5) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+5, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*5, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 6) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+6, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*6, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +#if (SERVER_NUM > 7) + {TCP_SERVER, STA_INIT, TCP_SERVER_SN_BEG+7, TCP_SERVER_LOCAL_IP_BEG+TCP_SERVER_LOCAL_IP_ADD*7, TCP_SERVER_PORT_BEG+0, 0, 0}, +#endif +}; + +void InitTcpServer(void) +{ + int i; + for (i = 0; i < SERVER_NUM; i++) + { + g_serverSocket[i].status = STA_CLOSED; + } + + g_linksta = LINK_INIT; + g_linkCount = 0; +} + +void SetTcpKeepAlive(void) +{ + int i; + uint8_t alivetime = 1; + for (i = 0; i < SERVER_NUM; i++) + { + setsockopt(g_serverSocket[i].socket, SO_KEEPALIVEAUTO, &alivetime); + printf("enable socket %d auto keep alive\r\n", g_serverSocket[i].socket); + } +} + +void TcpServerRun(void) +{ + int i; + int rslt; + int crsocket; + u8 sn, tmp8; + u16 port, ir; + + crsocket = 0; + + // PHY״̬ + rslt = ctlwizchip(CW_GET_PHYLINK, (void*)(&tmp8)); + + if (1) // ȡȶ + { + int tprslt, retry; + u8 temp; + retry = 10; + do + { + tprslt = ctlwizchip(CW_GET_PHYLINK, (void*)(&temp)); + if (rslt != tprslt) + { + printf("1. net link rslt = %d\r\n", tprslt); + break; + } + else + { + if (temp != tmp8) + { + printf("1. net link sta = 0x%x, old=0x%x\r\n", temp, tmp8); + break; + } + } + retry--; + }while(retry > 0); + if (retry != 0) + { + return; + } + } + + if (rslt == -1) + { + g_linksta = LINK_INIT; + printf("Unknown PHY Link stauts.\r\n"); + return; + } + else + { + if (tmp8 == PHY_LINK_ON) + { + if (g_linksta != LINK_UP) + { + crsocket = 1; // socket + g_linksta = LINK_UP; + printf("PHY Link UP.\r\n"); + g_linkCount = 0; + } + } + else if (tmp8 == PHY_LINK_OFF) + { + if (g_linksta == LINK_INIT || g_linksta == LINK_UP) + { + if (g_linksta == LINK_INIT) + { + crsocket = 2; // رsocket + g_linksta = LINK_DOWN; + printf("1. PHY Link DOWN.\r\n"); + } + else + { + g_linkCount = 0; + g_linksta = LINK_WAIT; + printf("1. PHY Link WAIT.\r\n"); + } + } + else if (g_linksta == LINK_WAIT) + { + printf("2. PHY Link WAIT.\r\n"); + g_linkCount++; + if (g_linkCount > 10) // Ͽʱ + { + crsocket = 2; // رsocket + g_linksta = LINK_DOWN; + printf("1. PHY Link DOWN.\r\n"); + } + } + else if (g_linksta == LINK_DOWN) + { + + } + else + { + printf("other Link sta.\r\n"); + } + } + else + { + printf("waite PHY connect.\r\n"); + return; + } + } + + // ر + if (g_linksta == LINK_DOWN && crsocket == 2) + { + for (i = 0; i < SERVER_NUM; i++) + { + if (g_serverSocket[i].status != STA_CLOSED) + { + g_serverSocket[i].status = STA_CLOSED; + printf("Close TCP server socket %d and disconnect.\r\n", g_serverSocket[i].socket); + disconnect(g_serverSocket[i].socket); + close(g_serverSocket[i].socket); + } + } + return; + } + + // tcp + for (i = 0; i < SERVER_NUM; i++) + { + sn = g_serverSocket[i].socket; + port = g_serverSocket[i].localPort; + tmp8 = getSn_SR(sn); + + if (1) // ȡȶ + { + int retry; + u8 temp; + retry = 10; + do + { + temp = getSn_SR(sn); + + if (temp != tmp8) + { + printf("1. socket %d sr = 0x%x, old=0x%x\r\n", sn, temp, tmp8); + break; + } + retry--; + }while(retry > 0); + if (retry != 0) + { + return; + } + } + + switch(tmp8) + { + case SOCK_ESTABLISHED: // + { + ir = getSn_IR(sn); // ȡжϼĴ + if ((ir & Sn_IR_CON) != 0) + { + u32 ip; + u16 port; + g_serverSocket[i].status = STA_CONNECT; + getsockopt(sn, SO_DESTIP, &ip); + getsockopt(sn, SO_DESTPORT, &port); + + printf("TCP server is connected to socket %d, destination ip=%d.%d.%d.%d, port=%d\r\n", sn, + GETIP1(ip), GETIP2(ip), GETIP3(ip), GETIP4(ip), port); + setSn_IR(sn, Sn_IR_CON); // ж״̬ + } + + if((ir & Sn_IR_CON) != 0) // + { + } + + if ((ir & Sn_IR_DISCON) != 0) // Ͽ + { + } + + if ((ir & Sn_IR_RECV) != 0) // յ + { + } + + if ((ir & Sn_IR_TIMEOUT) != 0) // ʱ + { + } + + if ((ir & Sn_IR_SENDOK) != 0) // + { + } + break; + } + + case SOCK_CLOSE_WAIT: // Էرյǰ + { + rslt = disconnect(sn); + close(sn); + + printf("TCP server socket %d wait close, rslt=%d\r\n", sn, rslt); + + // if (rslt == SOCK_OK) + { + g_serverSocket[i].status = STA_CLOSED; + } + break; + } + + case SOCK_CLOSED: // ǹر״̬ + { + printf("TCP server socket %d is closed, create a new socket\r\n", sn); + rslt = socket(sn, Sn_MR_TCP, port, SF_IO_NONBLOCK|0); // SF_TCP_NODELAY + if(rslt == sn) + { + printf("TCP server socket %d create success\r\n", sn); + } + else + { + printf("Create TCP server socket %d failed, code=%d\r\n", sn, rslt); + if (rslt == SOCKERR_SOCKINIT) + { + printf("Re Init Network\r\n"); + InitNetConfig(); // оƬ + } + } + break; + } + + case SOCK_INIT: // ʼ + { + rslt = listen(sn); + if (rslt == SOCK_OK) + { + g_serverSocket[i].status = STA_READY; + printf("TCP server socket %d Listening......\r\n\tserver ip= %d.%d.%d.%d, port=%d\r\n", \ + sn, g_netInfo.ip[0],g_netInfo.ip[1],g_netInfo.ip[2],g_netInfo.ip[3], port); + } + else + { + printf("TCP server socket %d Listen error, code=%d\r\n", sn, rslt); + } + break; + } + case SOCK_LISTEN: + { + break; + } + default: + { +/* + SOCK_SYNSENT 0x15 + SOCK_SYNRECV 0x16 + SOCK_ESTABLISHED 0x17 + SOCK_FIN_WAIT 0x18 + SOCK_CLOSING 0x1A + SOCK_TIME_WAIT 0x1B + SOCK_CLOSE_WAIT 0x1C + SOCK_LAST_ACK 0x1D + SOCK_UDP 0x22 + SOCK_MACRAW 0x42 + */ + if (tmp8 != 0) + { + printf("TCP server default, getSn_SR=0x%x\r\n", tmp8); + } + break; + } + } // end of switch + } +} + +SocketCtrl * GetTcpServerCtrlFromSocketId(int sIdx) +{ + if (sIdx < SERVER_NUM) + { + return &(g_serverSocket[sIdx]); + } + else + { + return NULL; + } +} + +#if (0) + +void TcpServerGetData(void) +{ + int i; + int len, rslt, expt; + u8 buff[MAX_TRANS_DATA]; + + for (i = 0; i < SERVER_NUM; i++) + { + len = EthernetGetRsLen(&(g_serverSocket[i])); + if (len != 0) + { + printf("receive data from socket%d, len=%d\r\n", g_serverSocket[i].socket, len); + } + + while (len != 0) + { + if (len > MAX_TRANS_DATA) + { + expt = MAX_TRANS_DATA; + } + else + { + expt = len; + } + rslt = EthernetGetData(&(g_serverSocket[i]), buff, expt); + + if (rslt == expt) + { + len -= expt; + } + else + { + printf("receive data error\r\n"); + } + } + } + +} + +#endif + +#endif diff --git a/NxFuncs/network/tcpserver.h b/NxFuncs/network/tcpserver.h new file mode 100644 index 0000000..e3cd4bb --- /dev/null +++ b/NxFuncs/network/tcpserver.h @@ -0,0 +1,21 @@ + +#ifndef __TCPSERVER_H__ +#define __TCPSERVER_H__ + +#include "ethernet.h" + +#if (SERVER_NUM > 0) + +void InitTcpServer(void); + +void SetTcpKeepAlive(void); + +SocketCtrl * GetTcpServerCtrlFromSocketId(int sIdx); + +// tcp +void TcpServerRun(void); + +#endif + + +#endif diff --git a/NxFuncs/network/udptrans.c b/NxFuncs/network/udptrans.c new file mode 100644 index 0000000..81a006d --- /dev/null +++ b/NxFuncs/network/udptrans.c @@ -0,0 +1,98 @@ + +#include "udptrans.h" + +typedef struct +{ + int socketSn; + u32 localIP; + u32 localPort; + u32 remoteIP; + u16 remotePort; + +}UdpCtrl; + +UdpCtrl g_udpCtrl; + +//------------------------------------------- + +#if (UDP_NUM > 0) + +//------------------------------------------- + +SocketCtrl g_udpSocket[UDP_NUM] = +{ + {UDP_COMM, STA_INIT, UDP_SN_BEG+0, UDP_LOCAL_PORT_BEG+0}, +#if (UDP_NUM > 1) + {UDP_COMM, STA_INIT, UDP_SN_BEG+1, UDP_LOCAL_PORT_BEG+1}, +#endif +#if (UDP_NUM > 2) + {UDP_COMM, STA_INIT, UDP_SN_BEG+2, UDP_LOCAL_PORT_BEG+2}, +#endif +#if (UDP_NUM > 3) + {UDP_COMM, STA_INIT, UDP_SN_BEG+3, UDP_LOCAL_PORT_BEG+3}, +#endif +#if (UDP_NUM > 4) + {UDP_COMM, STA_INIT, UDP_SN_BEG+4, UDP_LOCAL_PORT_BEG+4}, +#endif +#if (UDP_NUM > 5) + {UDP_COMM, STA_INIT, UDP_SN_BEG+5, UDP_LOCAL_PORT_BEG+5}, +#endif +#if (UDP_NUM > 6) + {UDP_COMM, STA_INIT, UDP_SN_BEG+6, UDP_LOCAL_PORT_BEG+6}, +#endif +#if (UDP_NUM > 7) + {UDP_COMM, STA_INIT, UDP_SN_BEG+7, UDP_LOCAL_PORT_BEG+7}, +#endif +}; + +#endif + + + +void InitUdpTrans(void) +{ + g_udpCtrl.socketSn = UDP_SN_BEG; + g_udpCtrl.localIP = UDP_LOCAL_IP; + g_udpCtrl.localPort = UDP_LOCAL_PORT_BEG; + + g_udpCtrl.remoteIP = UDP_REMOTE_IP; + g_udpCtrl.remotePort = UDP_REMOTE_PORT; +} + +int UdpTransData(u8 * pBuff, int len) +{ + int rslt; + + rslt = sendto(g_udpCtrl.socketSn, pBuff, len, (u8*)(&g_udpCtrl.remoteIP), g_udpCtrl.remotePort); + return rslt; +} + +int UdpRecvData(u8 * pBuff, int len) +{ + int rslt; + u32 ip; + u16 port; + + rslt = recvfrom(g_udpCtrl.socketSn, pBuff, len, (u8*)(&ip), &port); +/* + // ¶ԷIP PORT + g_udpCtrl.remoteIP; + g_udpCtrl.remotePort; +*/ + return rslt; +} + +SocketCtrl * GetUdpCtrlFromSocketId(int sIdx) +{ +#if (UDP_NUM > 0) + if (sIdx < UDP_NUM) + { + return &(g_udpSocket[sIdx]); + } + else +#endif + { + return NULL; + } +} + diff --git a/NxFuncs/network/udptrans.h b/NxFuncs/network/udptrans.h new file mode 100644 index 0000000..1393feb --- /dev/null +++ b/NxFuncs/network/udptrans.h @@ -0,0 +1,16 @@ + +#ifndef __UDPTRANS_H__ +#define __UDPTRANS_H__ + +#include "ethernet.h" + + +void InitUdpTrans(void); + +int UdpTransData(u8 * pBuff, int len); + +int UdpRecvData(u8 * pBuff, int len); + +SocketCtrl * GetUdpCtrlFromSocketId(int sIdx); + +#endif diff --git a/NxFuncs/norflash/norflash.c b/NxFuncs/norflash/norflash.c new file mode 100644 index 0000000..e3d893f --- /dev/null +++ b/NxFuncs/norflash/norflash.c @@ -0,0 +1,914 @@ + +#include "norflash.h" + +#include "trigger.h" +#include "shell.h" +#include "delay.h" + +//-------------------------------------------------------------------------------------------- + +// +//---------------------------------------------- + +// serial Norflash (׼/˫·/·SPIָ)ָ + +// // ʵ +#define SNF_WT_ENABLE 0x06 // * // дʹ +#define SNF_VSR_WR_ENABLE 0x50 // // ʧ洢SRдʹ +#define SNF_WT_DISABLE 0x04 // * // д + +#define SNF_RD_STREG1 0x05 // * // ״̬Ĵ1(S7--S0) +#define SNF_RD_STREG2 0x35 // * // ״̬Ĵ2(S15--S8) +#define SNF_WT_STREG12 0x01 // * // д״̬Ĵ12(S7--S0 S15--S8) + +#define SNF_READ_DATA 0x03 // * // (3ֽڵַ+1ֽ) +#define SNF_FAST_READ 0x0B // * // [ٶָ] (3ֽڵַ+1ֽ+1ֽ) + +#define SNF_PAGE_PROGRAM 0x02 // * // ҳд[д128(256ֽ),ҲԿҳ] 3ֽڵĵַ+2ֽݸ +#define SNF_4K_ERASE 0x20 // * // (4KB) (3ֽڵַ) +#define SNF_32K_ERASE 0x52 // * // (32KB) (3ֽڵַ) +#define SNF_64K_ERASE 0xD8 // * // (64KB) (3ֽڵַ) + + +#define SNF_CHIP_ERASE 0xC7 // * // Ƭ 0x60 + + +#define SNF_EP_SUSPEND 0x75 // // д +#define SNF_EP_RESUME 0x7A // // дָ(ӹУ +#define SNF_POWER_DOWN 0xB9 // // + +#define SNF_WKUP_DEVICE_ID 0xAB // // ϵͶȡ豸ID (3ֽ+1ֽ豸ID) +#define SNF_MANU_DEVICE_ID 0x90 // * // ȡID豸ID (2ֽ+00H+1ֽID+1ֽ豸ID) +#define SNF_JEDEC_ID 0x9F // * // оƬ JEDEC ID ̬Эᣩ(1ֽID+2ֽ豸ID(洢+洢)) +#define SNF_UNIQUE_ID 0x4B // * // ID (4ֽ+8ֽUID) +#define SNF_RD_SFDP 0x5A // // SFDPĴ(3ֽڵַ+1ֽ+1ֽ) + +#define SNF_ERASE_SECURITY 0x44 // // Ĵ(3ֽڵַ) 鱣ܼĴַ 0x0010xx 0x0020xx 0x0030xx +#define SNF_PROGRAM_SECURITY 0x42 // // Ĵ(3ֽڵַ+1ֽ) +#define SNF_READ_SECURITY 0x48 // // ȡ Ĵ(3ֽڵַ+1ֽ) + +#define SNF_RESET_DEVICE 0x66 // // λ +#define SNF_ENABLE_RESET 0x99 // // λоƬ + +/* +#define SNF_BLOCK_LOCK 0x7E // // ȫ +#define SNF_BLOCK_UNLOCK 0x98 // // ȫ +#define SNF_ENTER_QPI 0x38 // // QPIģʽ + +#define SNF_INDV_BLOCK_LOCK 0x36 // // +#define SNF_INDV_BLOCK_UNLOCK 0x39 // // +#define SNF_READ_BLOCK_LOCK 0x3D // // ȡ +*/ + +//--------------------------------------------------- + +#define DUMMY_BYTE 0xFF + +//-------------------------------------------------------------------------------------------- + +int SNFWaitNotBusyMs(u32 timeout); +int SNFWaitNotBusy10Us(u32 timeout); + +u8 SNFReadStatusReg1(void); +u8 SNFReadStatusReg2(void); +void SNFWriteStatusReg1And2(u8 reg1, u8 reg2); + +void ShowSNFInfo(void); +void SNFlashTest(char * para1, char * para2); // NorFlash + +//-------------------------------------------------------------------------------------------- + +typedef struct +{ + int inited; + // SPI д + void (*spicson)(void); + void (*spicsoff)(void); + u8 (*spird)(void); + void (*spiwr)(u8 wb); + +}SNFCtrl; + +SNFCtrl g_snfCtrl; + +//-------------------------------------------------------------------------------------------- + +// NorFlash ʼ +int SNFlashInit(void (*spicson)(void), void (*spicsoff)(void), u8 (*spird)(void), void (*spiwr)(u8 wb)) +{ + memset(&g_snfCtrl, 0, sizeof(SNFCtrl)); + + g_snfCtrl.spicson = spicson; + g_snfCtrl.spicsoff = spicsoff; + g_snfCtrl.spird = spird; + g_snfCtrl.spiwr = spiwr; + + if (g_snfCtrl.spicson == NULL || + g_snfCtrl.spicsoff == NULL || + g_snfCtrl.spird == NULL || + g_snfCtrl.spiwr == NULL || + 0 ) + { + printf("SNFlashInit para error\r\n"); + return -1; + } + + g_snfCtrl.inited = 1; + + SNFWirteEnable(); + + SNFWriteStatusReg1And2(0, 0); + + SNFWaitNotBusyMs(100); + + SNFWirteDisable(); + +#if (0) + ShowSNFInfo(); + AddShellCmd("NORFLASH", "test nor flash", SNFlashTest); +#endif + + return 0; +} + +//--------------------------------- + +// дʹܿ +// ״̬ĴеWEL λ Ϊ1 +// ִ д״̬Ĵָ֮ǰWELλ1 +void SNFWirteEnable(void) +{ + if (g_snfCtrl.inited == 0) + { + return; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_WT_ENABLE); + + g_snfCtrl.spicsoff(); +} + +//--------------------------------- + +// дʹܹأɹرշʧĴдʹܣ +// ״̬ĴеWEL λ Ϊ0 +// ִ д״̬Ĵָ֮ǰWELλ1 +void SNFWirteDisable(void) +{ + if (g_snfCtrl.inited == 0) + { + return; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_WT_DISABLE); + + g_snfCtrl.spicsoff(); +} + +//--------------------------------- + +// ״̬Ĵ1 +// ʱȡݿȡ +// SRP0 SEC TB PB2 PB1 PB0 WEL BUSY + +u8 SNFReadStatusReg1(void) +{ + u8 dat; + if (g_snfCtrl.inited == 0) + { + return 0; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_RD_STREG1); + + dat = g_snfCtrl.spird(); // + + g_snfCtrl.spicsoff(); + + return dat; +} + +//--------------------------------- + +// ״̬Ĵ2 +// ʱȡݿȡ +// SUS CMP LB3 LB2 LB1 (R) QE SRP1 +u8 SNFReadStatusReg2(void) +{ + u8 dat; + if (g_snfCtrl.inited == 0) + { + return 0; + } + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_RD_STREG2); + + dat = g_snfCtrl.spird(); // + + g_snfCtrl.spicsoff(); + + return dat; +} + +//--------------------------------- + +// д״̬Ĵ12 +void SNFWriteStatusReg1And2(u8 reg1, u8 reg2) +{ + if (g_snfCtrl.inited == 0) + { + return; + } + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_WT_STREG12); + + g_snfCtrl.spiwr(reg1); + + g_snfCtrl.spiwr(reg2); + + g_snfCtrl.spicsoff(); +} + +//--------------------------------- +// : жNorǷڿ״̬ +// ֵ: 0, +// 1, æ + +int SNFIsdStatusBusy(void) +{ + u8 sta1; + sta1 = SNFReadStatusReg1(); + sta1 &= 0x01; // WIP flag + + return sta1; +} + +//--------------------------------- +// (50Mµٶȣ +// 洢ڿȡ +int SNFlashRdData(u32 addr, u8 * pBuf, int len) +{ + int i; + if (pBuf == NULL || + len <= 0 || + g_snfCtrl.inited == 0 || + 0 ) + { + return -1; + } + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_READ_DATA); + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + for (i = 0; i < len; i++) + { + *pBuf++ = g_snfCtrl.spird(); + } + + g_snfCtrl.spicsoff(); + + return 0; +} + +//--------------------------------- +// ٶȡɴﵽ104M +// 洢ڿȡ +int SNFFastReadData(u32 addr, u8 * pBuf, int len) +{ + int i; + if (pBuf == NULL || + len <= 0 || + g_snfCtrl.inited == 0 || + 0 ) + { + return -1; + } + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_FAST_READ); + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + g_snfCtrl.spiwr(DUMMY_BYTE); + + for (i = 0; i < len; i++) + { + *pBuf++ = g_snfCtrl.spird(); + } + + g_snfCtrl.spicsoff(); + + return 0; +} + +//--------------------------------- +// жǷΪ +int IsSNFlashEmpty(u32 addr, int len) +{ + u32 i; + int rslt = 0; + if (g_snfCtrl.inited == 0) + { + return 0; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_READ_DATA); + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + for (i = 0; i < len; i++) + { + if (g_snfCtrl.spird() != 0xff) + { + rslt = 1; + break; + } + } + + g_snfCtrl.spicsoff(); + + return rslt; +} + +//--------------------------------- +// ҳд[д256ֽ] +// ݳһҳַѭصһҳʼд +int SNFPageProgram(u32 addr, u8 * pBuf, int len) +{ + int i; + if (pBuf == NULL || + len <= 0 || + g_snfCtrl.inited == 0 || + 0 ) + { + return -1; + } + + SNFWirteEnable(); + SNFWaitNotBusy10Us(100); + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_PAGE_PROGRAM); + + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + for (i = 0; i < len; i++) + { + g_snfCtrl.spiwr(*pBuf++); + } + + g_snfCtrl.spicsoff(); + + return SNFWaitNotBusy10Us(300); +} + +//--------------------------------- +// (4KB) +int SNFlash4kErase(u32 addr, int wait) +{ + int rslt = 1; + if (g_snfCtrl.inited == 0) + { + return rslt; + } + + SNFWirteEnable(); + SNFWaitNotBusy10Us(100); + + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_4K_ERASE); + + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + g_snfCtrl.spicsoff(); + + if (wait != 0) + { + rslt = SNFWaitNotBusyMs(300); + } + + return rslt; +} + +//--------------------------------- +// (32KB) +int SNFlash32kErase(u32 addr, int wait) +{ + int rslt = 1; + if (g_snfCtrl.inited == 0) + { + return rslt; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_32K_ERASE); + + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + g_snfCtrl.spicsoff(); + + if (wait != 0) + { + rslt = SNFWaitNotBusyMs(800); + } + + return rslt; +} + +//--------------------------------- +// (64KB) +int SNFlash64kErase(u32 addr, int wait) +{ + int rslt = 1; + if (g_snfCtrl.inited == 0) + { + return rslt; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_64K_ERASE); + + g_snfCtrl.spiwr(LOBYTE(HIWORD(addr))); + + g_snfCtrl.spiwr(HIBYTE(LOWORD(addr))); + + g_snfCtrl.spiwr(LOBYTE(LOWORD(addr))); + + g_snfCtrl.spicsoff(); + + if (wait != 0) + { + rslt = SNFWaitNotBusyMs(1000); + } + + return rslt; +} + +//--------------------------------- +// Ƭ +int SNFlashChipErase(u32 addr, int wait) +{ + int rslt = 1; + if (g_snfCtrl.inited == 0) + { + return rslt; + } + g_snfCtrl.spicson(); + + g_snfCtrl.spiwr(SNF_CHIP_ERASE); + + g_snfCtrl.spicsoff(); + + if (wait != 0) + { + rslt = SNFWaitNotBusyMs(6000); + } + + return rslt; +} + +//--------------------------------- +// ȡ id 豸 ID +// manufacturer id + device id + +u32 SNFGetManufacDeviceID(void) +{ + u32 mdid; + u8 mid,did; + if (g_snfCtrl.inited == 0) + { + return 0; + } + g_snfCtrl.spicson(); + g_snfCtrl.spiwr(SNF_MANU_DEVICE_ID); + g_snfCtrl.spiwr(0); + g_snfCtrl.spiwr(0); + g_snfCtrl.spiwr(0); + + mid = g_snfCtrl.spird(); + did = g_snfCtrl.spird(); + + g_snfCtrl.spicsoff(); + + mdid = MAKEDWORDF(did, mid, 0, 0); + +// printf("Nor flash manufacturer id and device id = 0x%x\r\n", mdid); + + return mdid; +} + +//--------------------------------- +// ȡ JEDEC ID +// manufacturer id + memory type + capacity + +u32 SNFGetJedecID(void) +{ + u32 jid; + u8 id1,id2,id3; + if (g_snfCtrl.inited == 0) + { + return 0; + } + g_snfCtrl.spicson(); + g_snfCtrl.spiwr(SNF_JEDEC_ID); + id3 = g_snfCtrl.spird(); + id2 = g_snfCtrl.spird(); + id1 = g_snfCtrl.spird(); + g_snfCtrl.spicsoff(); + + jid = MAKEDWORDF(id1, id2, id3, 0); + +// printf("Nor flash jedec id = 0x%x\r\n", jid); + + return jid; +} + +//--------------------------------- +// ȡ Unique ID +// 8ֽڵΨһк + +u64 SNFGetUniqueID(void) +{ + int i; + u8 id; + u64 uid; + u8 * pId = (u8 *)(&uid); + + if (g_snfCtrl.inited == 0) + { + return 0; + } + g_snfCtrl.spicson(); + g_snfCtrl.spiwr(SNF_UNIQUE_ID); + g_snfCtrl.spiwr(DUMMY_BYTE); + g_snfCtrl.spiwr(DUMMY_BYTE); + g_snfCtrl.spiwr(DUMMY_BYTE); + g_snfCtrl.spiwr(DUMMY_BYTE); + + printf("Nor flash Unique id = "); + + for (i = 0; i < 8; i++) + { + id = g_snfCtrl.spird(); + *pId++ = id; + printf("0x%x, ", id); + } + printf("\r\n"); + + g_snfCtrl.spicsoff(); + + return uid; +} + +//--------------------------------- +// д +int SNFlashWrData(u32 addr, u8 *data, int len) +{ + int rslt; + u32 pglen; + + pglen = addr % SNF_BYTES_PER_PAGE; + if (pglen == 0) + { + pglen = SNF_BYTES_PER_PAGE; + } + + do + { + rslt = SNFPageProgram(addr, data, pglen); + if (rslt != 0) + { + break; + } + addr += pglen; + data += pglen; + len -= pglen; + if (len >= SNF_BYTES_PER_PAGE) + { + pglen = SNF_BYTES_PER_PAGE; + } + else if (len > 0) + { + pglen = len; + } + else + { + break; + } + }while(1); + + return rslt; +} + +//--------------------------------- +/* + * ---------------------- eaddr:׵ַ(ʼַ) ----- + * | | | + * | | | + * | ҳ1 | | + * ---------------------- | + * | | | + * | | elen:׵ַдɵֽ + * | ҳ2 | | + * ---------------------- ---- addr:дʼַ | + * | | | | + * | | len:д볤 | + * | ҳ3 | | | + * ---------------------- ----- ---- + * | | + * | | + * | ҳ4 | + * ---------------------- + * | | + * | | + * | ҳ5 | + * ---------------------- + * | | + * | | + * | ҳ6 | + * ---------------------- + * | | + * | | + * | ҳ7 | + * ---------------------- + * | | + * | | + * | ҳ8 | + * ---------------------- + * | | + * | | + * | ҳ9 | + * ---------------------- + * | | + * | | + * | ҳ10 | + * ---------------------- + * | | + * | | + * | ҳ11 | + * ---------------------- + * | | + * | | + * | ҳ12 | + * ---------------------- + * | | + * | | + * | ҳ13 | + * ---------------------- + * | | + * | | + * | ҳ14 | + * ---------------------- + * | | + * | | + * | ҳ15 | + * ---------------------- + * | | + * | | + * | ҳ16 | + * ---------------------- + */ +// дݣԶ +int SNFlashWrDataWithErase(u32 addr, u8 *data, int len) +{ + int i, erflag, rslt; // erflag:־ = 1, + u8 rdata[SNF_BYTES_PER_SEC]; // 洢 + u32 eaddr; // ׵ַ + u32 elen, wlen; // elen:׵ַдɵֽ wlen:д볤 + + eaddr = (addr/SNF_BYTES_PER_SEC) * SNF_BYTES_PER_SEC; // ȡ׵ַ + rslt = 0; + + printf("nwe, fad=0x%x, sad=0x%x len=%d, \r\n", addr, eaddr, len); + + while(addr < SNF_TOTAL_BYTES && len > 0) + { + erflag = 0; + SNFlashRdData(eaddr, rdata, SNF_BYTES_PER_SEC); // ȡһ + + elen = SNF_BYTES_PER_SEC; + if ((addr-eaddr)+len < elen) + { + elen = len+(addr-eaddr); // ׵ַдɵֽ + } + + wlen = elen-(addr-eaddr); + + // жǷҪ + for (i = (addr-eaddr); i < elen; i++) // д(0--1) + { + if ((rdata[i] & data[i]) != data[i]) // ֮󣬺ҪдͬԲ + { + erflag = 1; // ־ + break; + } + } + + // printf("elen=%d, wlen=%d, bufbeg=%d\r\n", elen, wlen, addr-eaddr); + + if (erflag != 0) + { + SNFlash4kErase(eaddr, 1); // һ + + memcpy(&(rdata[(addr-eaddr)]), data, wlen); // д뻺 + rslt = SNFlashWrData(eaddr, rdata, SNF_BYTES_PER_SEC); // дflash + + printf("Erase 4K and wr\r\n"); + } + else + { + // printf("wr to fls\r\n"); + rslt = SNFlashWrData(addr, data, wlen); // дflash + } + + if (rslt != 0) + { + break; + } + + len -= wlen; + data += wlen; + addr += wlen; // ַ + eaddr += SNF_BYTES_PER_SEC; + } + + return rslt; +} + + +//--------------------------------- + +// : ȴNor +// ֵ: 0, +// -1, ʱ +int SNFWaitNotBusyMs(u32 timeout) +{ + u32 i; + int rst = -1; + + for (i = 0; i < timeout; i++) + { + if (SNFIsdStatusBusy() == 0) + { + rst = 0; + break; + } + DelayMs(1); // ˴滻Ϊʱ + } + + return rst; +} + +//--------------------------------- +// : ȴNor +// ֵ:0 +// -1:ʱ +int SNFWaitNotBusy10Us(u32 timeout) +{ + u32 i; + int rst = -1; + + for (i = 0; i < timeout; i++) + { + if (SNFIsdStatusBusy() == 0) + { + rst = 0; + break; + } + DelayUs(10); // ˴滻Ϊʱ + } + + return rst; +} + +//--------------------------------- + +void ShowSNFInfo(void) +{ + u32 id; + + printf("--------------nor flash info--------------\r\n"); + + id = SNFGetManufacDeviceID(); // ȡ id 豸 ID + printf("manufacturer id = 0x%x\r\n", HIBYTE(LOWORD(id))); + printf("device id = 0x%x\r\n", LOBYTE(LOWORD(id))); + + id = SNFGetJedecID(); // ȡ jedec id + + printf("manufacturer id = 0x%x\r\n", LOBYTE(HIWORD(id))); + printf("memory type = 0x%x\r\n", HIBYTE(LOWORD(id))); + printf("capacity = 0x%x\r\n", LOBYTE(LOWORD(id))); + + SNFGetUniqueID(); // 8ֽڵΨһк + + printf("------------------------------------------\r\n"); +} + +// NorFlash +void SNFlashTest(char * para1, char * para2) +{ + int p1, p2; + + p1 = p2 = 0; + if (para1 != NULL && strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (para2 != NULL && strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + //-------------------------------- + { + u8 buff[1024]; + int i; + + if (p1 == 0) + {// ӵַp2ʼȡ1Kֽ + memset(buff, 0, 1024); + DatFlashRdData(p2, buff, 1024); + printf("DatFlashRdData addr=0x%x,\r\n", p2); + for (i = 0; i < 1024; i++) + { + if ((i%16) == 0) + { + printf("\r\n%d:\t", i+1); + DelayMs(10); + } + printf("%02x ", buff[i]); + } + printf("\r\n"); + } + else if (p1 == 1) + {// ӵַp2ʼд1Kֽ + printf("DatFlashWrDataWithErase addr=0x%x,\r\n", p2); + + for (i = 0; i < 1024; i++) + { + buff[i] = p2 + i; + } + DatFlashWrDataWithErase(p2, buff, 1024); + printf("done \r\n"); + } + else if (p1 == 3) + {// ӵַ0x190000ʼȡ + int circle = p2; + int count = 0; + do + { + memset(buff, 0, 1024); + DatFlashRdData(0x190000+count*0x400, buff, 1024); + printf("DatFlashRdData addr=0x%x,\r\n", 0x190000+count*0x400); + for (i = 0; i < 1024; i++) + { + if ((i%16) == 0) + { + printf("\r\n%d:\t", count*1024+i+1); + DelayMs(10); + } + printf("%02x ", buff[i]); + } + printf("\r\n"); + circle--; + count++; + if (circle <= 0) + { + break; + } + }while(1); + } + } +} + diff --git a/NxFuncs/norflash/norflash.h b/NxFuncs/norflash/norflash.h new file mode 100644 index 0000000..3e38cb6 --- /dev/null +++ b/NxFuncs/norflash/norflash.h @@ -0,0 +1,187 @@ + +#ifndef __NORFLASH_H__ +#define __NORFLASH_H__ + +#include "config.h" + +//------------------------------------------------------------------------------- + +// Norflash ķʽӿ +// SPIӿ + +//---------------------------------------------- +// ֧ W25Q80, W25Q16, W25Q32, W25Q64, W25Q128, W25Q256 +#define W25Q80 8 // 8M Bit 1MB = 1024K = 1024 * 1024 B +#define W25Q16 16 // 16M Bit 2MB = 2048K = 2 * 1024 * 1024 B +#define W25Q32 32 +#define W25Q64 64 +#define W25Q128 128 // 128M Bit 16MB +#define W25Q256 256 // 256M Bit 32MB + +// оƬѡ +#ifndef SERNORFLASHTYPE +#define SERNORFLASHTYPE W25Q16 +#endif + + +//---------------------------------------------- + +#define RWSPI 1 +#define RWQPI 2 + +#ifndef RWMODE +#define RWMODE RWSPI +#endif + +//---------------------------------------------- +#define RWADDR3 1 +#define RWADDR4 2 + +#ifndef RWADDRMODE +#define RWADDRMODE RWADDR3 +#endif + +//------------------------------------------------------------------------------- + +// Norflash Сֽ +#define SNF_TOTAL_BYTES (SERNORFLASHTYPE*1024*(1024/8)) // ֽ + +#define SNF_BYTES_PER_PAGE 0x100 // ÿҳֽڸ(256)ҳDZдСλҳָ1/4 K +#define SNF_PAGES_PER_SEC 0x10 // ÿҳ(16)DzСλָ +#define SNF_BYTES_PER_SEC (SNF_BYTES_PER_PAGE*SNF_PAGES_PER_SEC) // ÿֽڸ(4096) 4K + +//------------------------------------------------------------------------------- + +// Norflash ʹû֣ͬĻֲͬ + + +// FLASH 򻮷, Сȱ֤λַ + +// |-----------------|-----------------|-------------| // W25Q256 W25Q16 W25Q80 +// | name | begin addr | size | +// |-----------------|-----------------|-------------| +// | file area | 0x00 | 0x01000000 | // 16MB +// |-----------------|-----------------|-------------| +// | rev area | 0x01000000 | 0x00E00000 | // 14MB +// |-----------------|-----------------|-------------| +// | run hour area | 0x01E00000 | 0x00100000 | // 1MB 1MB +// |-----------------|-----------------|-------------| +// | para area | 0x01F00000 | 0x00010000 | // 512KB 64KB 64KB +// |-----------------|-----------------|-------------| +// | rev area 2 | 0x01F10000 | 0x00070000 | // 512KB 448KB 448KB +// |-----------------|-----------------|-------------| +// | update area | 0x01F80000 | 0x00080000 | // 512KB 512KB 512KB +// |-----------------|-----------------|-------------| + +#if (SERNORFLASHTYPE == W25Q256) + +#define SNF_DAT_FILE_BEGIN 0x00000000 +#define SNF_DAT_FILE_SIZE 0x01000000 // ļ16MֽڣΪ洢ļչ + +#define SNF_RUNHOUR_BEGIN 0x01E00000 +#define SNF_RUNHOUR_SIZE 0x00100000 // ʱ, 1Mֽ + +#define SNF_PARAS_BEGIN 0x01F00000 +#define SNF_PARAS_SIZE 0x00010000 // ݴ洢, 64KBֽ + +#define SNF_UPDATE_BEGIN 0x01F80000 +#define SNF_UPDATE_SIZE 0x00080000 // ݴ洢, 512KBֽ + +#elif (SERNORFLASHTYPE == W25Q16) + +#define SNF_PARAS_BEGIN 0x00100000 +#define SNF_PARAS_SIZE 0x00010000 // ݴ洢, 64KBֽ + +#define SNF_UPDATE_BEGIN 0x00180000 +#define SNF_UPDATE_SIZE 0x00080000 // ݴ洢, 512KBֽ + +#elif (SERNORFLASHTYPE == W25Q80) + +#define SNF_PARAS_BEGIN 0x00000000 +#define SNF_PARAS_SIZE 0x00010000 // ݴ洢, 64KBֽ + +#define SNF_UPDATE_BEGIN 0x00080000 +#define SNF_UPDATE_SIZE 0x00080000 // ݴ洢, 512KBֽ + +#endif + +//-------------------------------- + +//-------------------------------- + +//-------------------------------- + +//-------------------------------- + + + +//------------------------------------------------------------------------------- +// ʼעд +int SNFlashInit(void (*spicson)(void), void (*spicsoff)(void), u8 (*spird)(void), void (*spiwr)(u8 wb)); + +// дʹܿ +void SNFWirteEnable(void); + +// дʹܹ +void SNFWirteDisable(void); + +// жNorǷڿ״̬ +int SNFIsdStatusBusy(void); + +// +int SNFlashRdData(u32 addr, u8 * pBuf, int len); + +// ٶȡɴﵽ104M +int SNFFastReadData(u32 addr, u8 * pBuf, int len); + +// ҳд[д256ֽ] +int SNFPageProgram(u32 addr, u8 * pBuf, int len); + +// (4KB) +int SNFlash4kErase(u32 addr, int wait); + +// (32KB) +int SNFlash32kErase(u32 addr, int wait); + +// (64KB) +int SNFlash64kErase(u32 addr, int wait); + +// Ƭ +int SNFlashChipErase(u32 addr, int wait); + +// ȡ id 豸 ID +u32 SNFGetManufacDeviceID(void); + +// ȡ JEDEC ID +u32 SNFGetJedecID(void); + +// ȡ Unique ID 8ֽڵΨһк +u64 SNFGetUniqueID(void); + +// д +int SNFlashWrData(u32 addr, u8 *data, int len); + +// дݣԶ +int SNFlashWrDataWithErase(u32 addr, u8 *data, int len); + +// жǷΪ +int IsSNFlashEmpty(u32 addr, int len); + + +//------------------------------------------------------------------------------- + +#define DatFlashInit SNFlashInit + +//#define DatFlashRdData SNFlashRdData +#define DatFlashRdData(saddr, taddr, blen) SNFlashRdData(saddr, (u8*)(taddr), blen) +#define DatFlashWrData SNFlashWrData +#define DatFlashWrDataWithErase SNFlashWrDataWithErase + +#define IsDatFlashEmpty IsSNFlashEmpty + +#define DatFlash4kErase SNFlash4kErase + + +//------------------------------------------------------------------------------- + +#endif diff --git a/NxFuncs/norparas/norparas.c b/NxFuncs/norparas/norparas.c new file mode 100644 index 0000000..64f3648 --- /dev/null +++ b/NxFuncs/norparas/norparas.c @@ -0,0 +1,711 @@ + +#define _IN_NORPARAS_C +#include "norparas.h" + + +#if (MAX_PARA_BLOCK > 0) +#include "norflash.h" +#include "inout.h" +#include "shell.h" +#include "delay.h" + +//---------------------------------------------------- + +#define NORPARA_BEG_ADDR (SNF_PARAS_BEGIN) // ʼַ,ÿռһ,16 + +#define NP_BLOCK_BYTES SNF_BYTES_PER_PAGE // ÿҳС(һҳ) +#define NP_SAVE_BYTES_PER_BLOCK SNF_BYTES_PER_SEC // ÿС(һ) +#define NP_SAVE_BLOCKS_PER_SEC 16 // ÿҳ,һҳ洢ҳЧ־,ʵʹ15ҳڴ洢 + + +#define GET_NORPARA_BLOCK_ADDR(bidx) (NORPARA_BEG_ADDR+(bidx)*NP_SAVE_BYTES_PER_BLOCK) // ȡʼַ + +//---------------------------------------------------- + +typedef struct +{ + int paraEn; // Ч־ + NorParaBlock norParaBlock; // + s32 * pParaList; // б(,СֵĬֵ) + char * pParasName; // б + + // 洢 + u32 pageFlag[NP_SAVE_BLOCKS_PER_SEC]; // ҳ־ + +}NorParaBlockCtrl; + +NorParaBlockCtrl g_norParaBlockList[MAX_PARA_BLOCK]; + +//---------------------------------------------------- + +const char * SHOWP_STR = + "\t" " ʾز " "\r\n" + "\t" " p1 p2" "\r\n" + "\t" " 0 0 ʾȫ " "\r\n" + "\t" " b001 0 ʾb " "\r\n" + "\t" " b002 0 bĬϲ " "\r\n" + "\t" " b003 0 b¼ز " "\r\n" +; + +void ShowPara(char * para1, char * para2); + +const char * SETP_STR = + "\t" "ò " "\r\n" + "\t" " p1 p2" "\r\n" + "\t" " b00x val òb, ID x, ֵ val " "\r\n" + "\t" " 10b000 0 b " "\r\n" +; + +void SetPara(char * para1, char * para2); +//---------------------------------------------------- + +void InitNorParas(void) +{ + static int g_inited = 0; + + if (g_inited == 0) + { + g_inited = 1; + InitNorSpi(); // ʼ nor flash SPI + SNFlashInit(SetNorSpiNssOn, SetNorSpiNssOff, NorSpiReadByte, NorSpiWriteByte); // ʼnor flash עд + + // ʼ + for(int i = 0; i < MAX_PARA_BLOCK; i++) + { + memset(&g_norParaBlockList[i], 0, sizeof(NorParaBlockCtrl)); + LoadNorParas(i); + } + AddShellCmd("SHOWPARA", SHOWP_STR, ShowPara); + AddShellCmd("SETPARA", SETP_STR, SetPara); + } +} + +// ȡЧ־ +int GetNorParaEn(int bIdx) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + + return g_norParaBlockList[bIdx].paraEn; +} + +// زҳЧ־ +int LoadParaPageFlag(int bIdx) +{ + NorParaBlockCtrl * pCtrl; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + pCtrl = &g_norParaBlockList[bIdx]; + + return DatFlashRdData(GET_NORPARA_BLOCK_ADDR(bIdx), (u8 *)(&pCtrl->pageFlag[0]), NP_SAVE_BLOCKS_PER_SEC*sizeof(u32)); +} + +// ҳЧ־ +int SaveParaPageFlag(int bIdx) +{ + NorParaBlockCtrl * pCtrl; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + pCtrl = &g_norParaBlockList[bIdx]; + + return DatFlashWrData(GET_NORPARA_BLOCK_ADDR(bIdx), (u8 *)(&pCtrl->pageFlag[0]), NP_SAVE_BLOCKS_PER_SEC*sizeof(u32)); +} + +// òҳЧ־ +int SetParaPageFlagValue(int bIdx, int pIdx, int enFlag) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK || pIdx < 0 || pIdx >= NP_SAVE_BLOCKS_PER_SEC) + { + return -1; + } + + if (enFlag == 0) + { + g_norParaBlockList[bIdx].pageFlag[pIdx] = 0; // ʧЧ,0xffffffffδʹҳ + } + else + { + g_norParaBlockList[bIdx].pageFlag[pIdx] = PARA_VALID+pIdx; // Ч + } + + return 0; +} + +// Ӳҳ־õǰЧҳ +int GetSaveIdxFromPageFlag(int bIdx) +{ + int i; + NorParaBlockCtrl * pCtrl; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + + pCtrl = &g_norParaBlockList[bIdx]; + + for(i = 1; i < NP_SAVE_BLOCKS_PER_SEC; i++) + { + if (pCtrl->pageFlag[i] == PARA_VALID+i) + { + return i; + } + } + + return -2; +} + +// õһδʹҳ +int GetNextSaveIdxFromPageFlag(int bIdx) +{ + int i; + NorParaBlockCtrl * pCtrl; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + + pCtrl = &g_norParaBlockList[bIdx]; + + for (i = 1; i < NP_SAVE_BLOCKS_PER_SEC; i++) + { + if (pCtrl->pageFlag[i] == 0xffffffff) + { + return i; + } + } + + return -2; +} + +// ȡ +// bIdx:ID +// return: -1:ش,вҳ,δҵЧ +// 0:ȷֵ +int LoadNorParas(int bIdx) +{ + u32 addr; // + NorParaBlockCtrl * pCtrl; + int idx, rslt; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + + pCtrl = &g_norParaBlockList[bIdx]; + + memset(pCtrl, 0, sizeof(NorParaBlockCtrl)); + + // 洢Ч־ + rslt = LoadParaPageFlag(bIdx); + if (rslt < 0) + { + return -1; + } + + idx = GetSaveIdxFromPageFlag(bIdx); // õǰЧҳid + + if (idx < 0) + { + printf("load nor para error, code=%d\r\n", idx); + return -1; + } + + printf("load nor para block %d, page is %d\r\n", bIdx, idx); + + addr = GET_NORPARA_BLOCK_ADDR(bIdx) + (idx * NP_BLOCK_BYTES); + DatFlashRdData(addr, (u8*)&pCtrl->norParaBlock, sizeof(NorParaBlock)); + + g_norParaBlockList[bIdx].paraEn = PARA_VALID; // Ч + + return 0; +} + +// +//bIdx IJID +int SaveNorParas(int bIdx) +{ + u32 addr; + int cidx, nidx; + + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return -1; + } + + cidx = GetSaveIdxFromPageFlag(bIdx); + nidx = GetNextSaveIdxFromPageFlag(bIdx); + if (cidx < 0) + { + cidx = 0; + } + + if (nidx < 0) // + { + printf("overflow, erase 4k\r\n"); + DatFlash4kErase(GET_NORPARA_BLOCK_ADDR(bIdx), 1); // + LoadParaPageFlag(bIdx); + cidx = 0; + nidx = GetNextSaveIdxFromPageFlag(bIdx); + } + + if (nidx < 0) // + { + printf("SaveNorParas error\r\n"); + return -2; + } + + // 洢֮ҳ + addr = GET_NORPARA_BLOCK_ADDR(bIdx) + ((nidx) * NP_BLOCK_BYTES); + DatFlashWrDataWithErase(addr, (u8 *)&g_norParaBlockList[bIdx].norParaBlock, sizeof(NorParaBlock)); + + SetParaPageFlagValue(bIdx, nidx, 1); // ²洢ҳЧ + + SetParaPageFlagValue(bIdx, cidx, 0); // ɵIJ洢ҳ + + SaveParaPageFlag(bIdx); // ҳ־ + + g_norParaBlockList[bIdx].paraEn = PARA_VALID; // Ч + + printf("save nor para successful, page is %d \r\n", nidx); + + return 0; +} + + +// ȡز +NorParaBlock * GetNorParaBlock(int bIdx) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK) + { + return NULL; + } + + return &g_norParaBlockList[bIdx].norParaBlock; +} + +// ò +void SetNorParaNameString(int bIdx, void * pName) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK ) + { + return; + } + + g_norParaBlockList[bIdx].pParasName = pName; +} + +// òб(,СֵĬֵ) +void SetNorParaList(int bIdx, void * pPara) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK ) + { + return; + } + + g_norParaBlockList[bIdx].pParaList = pPara; +} + +// Ĭϲ +void LoadNorDefPara(int bIdx) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK || g_norParaBlockList[bIdx].pParaList == NULL) + { + return; + } + + for(int i = 0; i < PARA_NUM_PER_BLK; i++) + { + int offset = i * 4 + 3; + g_norParaBlockList[bIdx].norParaBlock.buff[i] = * ( g_norParaBlockList[bIdx].pParaList + offset ); + } +} + + +// Χ(ڵȫ) +void CheckParaRange(int bIdx) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK || g_norParaBlockList[bIdx].pParaList == NULL) + { + return; + } + + for(int i = 0; i < PARA_NUM_PER_BLK; i++) + { + int paratype, minOffset, maxOffset; // ,Сֵָƫ + paratype = (i * 4); + minOffset = (i * 4 + 1); + maxOffset = (i * 4 + 2); + if ((*(g_norParaBlockList[bIdx].pParaList + paratype)) == PTYPE_S) + { + if (g_norParaBlockList[bIdx].norParaBlock.buff[i] < (*(g_norParaBlockList[bIdx].pParaList + minOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[i] = (*( g_norParaBlockList[bIdx].pParaList + minOffset)); + printf("less than min, equal min, block %d, id is %d\r\n", bIdx, i+1); + } + else if (g_norParaBlockList[bIdx].norParaBlock.buff[i] > (*( g_norParaBlockList[bIdx].pParaList + maxOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[i] = (*( g_norParaBlockList[bIdx].pParaList + maxOffset)); + printf("more than max, equal max, block %d, id is %d\r\n", bIdx, i+1); + } + } + else if ((*(g_norParaBlockList[bIdx].pParaList + paratype)) == PTYPE_U) + { + if ((u32)g_norParaBlockList[bIdx].norParaBlock.buff[i] < (u32)(*(g_norParaBlockList[bIdx].pParaList + minOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[i] = (*( g_norParaBlockList[bIdx].pParaList + minOffset)); + printf("less than min, equal min, block %d, id is %d\r\n", bIdx, i+1); + } + else if ((u32)g_norParaBlockList[bIdx].norParaBlock.buff[i] > (u32)(*( g_norParaBlockList[bIdx].pParaList + maxOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[i] = (*( g_norParaBlockList[bIdx].pParaList + maxOffset)); + printf("more than max, equal max, block %d, id is %d\r\n", bIdx, i+1); + } + } + } +} + + +// Χ(ڵij) +void CheckAParaRange(int bIdx, int id) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK || g_norParaBlockList[bIdx].pParaList == NULL) + { + return; + } + + if (id >= 0 && id < PARA_NUM_PER_BLK) + { + int paratype, minOffset, maxOffset; // ,Сֵָƫ + paratype = (id * 4); + minOffset = (id * 4 + 1); + maxOffset = (id * 4 + 2); + if ((*(g_norParaBlockList[bIdx].pParaList + paratype)) == PTYPE_S) + { + if (g_norParaBlockList[bIdx].norParaBlock.buff[id] < (*( g_norParaBlockList[bIdx].pParaList + minOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[id] = (*( g_norParaBlockList[bIdx].pParaList + minOffset)); + printf("less than min, equal min\r\n"); + } + else if (g_norParaBlockList[bIdx].norParaBlock.buff[id] > (*( g_norParaBlockList[bIdx].pParaList + maxOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[id] = (*( g_norParaBlockList[bIdx].pParaList + maxOffset)); + printf("more than max, equal max\r\n"); + } + } + else if ((*(g_norParaBlockList[bIdx].pParaList + paratype)) == PTYPE_U) + { + if ((u32)g_norParaBlockList[bIdx].norParaBlock.buff[id] < (u32)(*( g_norParaBlockList[bIdx].pParaList + minOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[id] = (*( g_norParaBlockList[bIdx].pParaList + minOffset)); + printf("less than min, equal min\r\n"); + } + else if ((u32)g_norParaBlockList[bIdx].norParaBlock.buff[id] > (u32)(*( g_norParaBlockList[bIdx].pParaList + maxOffset)) ) + { + g_norParaBlockList[bIdx].norParaBlock.buff[id] = (*( g_norParaBlockList[bIdx].pParaList + maxOffset)); + printf("more than max, equal max\r\n"); + } + } + } +} + + +// ȡһ +s32 GetANorPara(int bIdx, int id) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK ) + { + return -1; + } + + if (GetNorParaEn(bIdx) == PARA_VALID) + { + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM_PER_BLK) + { + return g_norParaBlockList[bIdx].norParaBlock.buff[idx]; + } + } + return 0; +} + +// һ +// úṩ湦,ɺֶ +// ע:norflashƵд +void SetANorPara(int bIdx, int id, s32 val) +{ + if (bIdx < 0 || bIdx >= MAX_PARA_BLOCK ) + { + return; + } + + char * pInfo = NULL; + int idx = id - 1; + + if (idx >= 0 && idx < PARA_NUM_PER_BLK) + { + if ((*(g_norParaBlockList[bIdx].pParaList + idx*4)) == PTYPE_S) + { + s32 old; + + pInfo = (g_norParaBlockList[bIdx].pParasName+(idx)*PARA_STR_LEN); + + printf("set para block %d\r\n", bIdx+1); + + old = g_norParaBlockList[bIdx].norParaBlock.buff[idx]; + g_norParaBlockList[bIdx].norParaBlock.buff[idx] = val; + + CheckAParaRange(bIdx, idx); + + if (pInfo == NULL) + { + pInfo = ""; + } + + printf("%d. (%s) = %d, oldvalue=%d\r\n", (id), pInfo, val, old); + } + else + { + u32 old; + + pInfo = (g_norParaBlockList[bIdx].pParasName+(idx)*PARA_STR_LEN); + + printf("set para block %d\r\n", bIdx+1); + + old = (u32)g_norParaBlockList[bIdx].norParaBlock.buff[idx]; + g_norParaBlockList[bIdx].norParaBlock.buff[idx] = val; + + CheckAParaRange(bIdx, idx); + + if (pInfo == NULL) + { + pInfo = ""; + } + + printf("%d. (%s) = %d, oldvalue=%d\r\n", (id), pInfo, (u32)val, old); + } + } +} + + +/* + * p1 p2 + * 1001 val // ò1,ID 1,ֵval + * 1002 val // ò1,ID 2,ֵval + ...... + * 2001 val // ò2,ID 1,ֵval + * 2002 val // ò2,ID 2,ֵval //ṩ湦 + ...... + * 101000 // 1 + * 102000 // 2 + */ + +void SetPara(char * para1, char * para2) +{ + int p1, p2, p3; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + + p3 = p1 / 1000; // id + p1 = p1 % 1000; // id + // p2:ֵ + + if (p3 > 0 && p3 <= MAX_PARA_BLOCK) + { + SetANorPara(p3-1, p1, p2); + } + else if (p3 > 100 && p3 <= 116) + { + p3 -= 101; + printf("save block %d\r\n", p3+1); + SaveNorParas(p3); + } +} + +/* + * p1 p2 + * // ʾȫ + * 1001 // ʾ1 + * 2001 // ʾ2 + * 1002 // 1Ĭϲ + * 2002 // 2Ĭϲ + * 1003 // 1¼ز + * 2003 // 2¼ز + */ +void ShowPara(char * para1, char * para2) +{ + int p1, p2, p3; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + } + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + if (p1 == p2) + { + } + p3 = p1 / 1000; // id + p1 = p1 % 1000; // + // p2: ID + + if (p3 <= MAX_PARA_BLOCK) + { + switch(p1) + { + case 0: + { + // ʾȫ + for (int j = 0; j < MAX_PARA_BLOCK; j++) + { + printf("\r\npara block %d:\r\n", j+1); + + if (g_norParaBlockList[j].pParasName == NULL) + { + continue; + } + + for(int i = 0; i < PARA_NUM_PER_BLK; i++) + { + char * pStr; + pStr = g_norParaBlockList[j].pParasName + (i*PARA_STR_LEN); + if (pStr == NULL) + { + pStr = ""; + } + + if ( strcmp(pStr, "") != 0 ) + { + if ((*(g_norParaBlockList[j].pParaList+i*4)) == PTYPE_S) + { + printf("%d. (%s) val=%d, min=%d, max=%d, def=%d\r\n", i+1, pStr, + GetANorPara(j, i+1), + *(g_norParaBlockList[j].pParaList+ i*4+1), + *(g_norParaBlockList[j].pParaList+ i*4+2), + *(g_norParaBlockList[j].pParaList+ i*4+3) ); + } + else + { + printf("%d. (%s) val=%d, min=%d, max=%d, def=%d\r\n", i+1, pStr, + (u32)GetANorPara(j, i+1), + (u32)(*(g_norParaBlockList[j].pParaList+ i*4+1)), + (u32)(*(g_norParaBlockList[j].pParaList+ i*4+2)), + (u32)(*(g_norParaBlockList[j].pParaList+ i*4+3)) ); + } + } + DelayMs(1); + } + } + break; + } + case 1: + { + // ʾij + printf("\r\npara block %d:\r\n", p3); + + if (g_norParaBlockList[p3-1].pParasName != NULL) + { + for(int i = 0; i < PARA_NUM_PER_BLK; i++) + { + char * pStr; + pStr = g_norParaBlockList[p3-1].pParasName + (i*PARA_STR_LEN); + if (pStr == NULL) + { + pStr = ""; + } + + if ( strcmp(pStr, "") != 0 ) + { + if ((*(g_norParaBlockList[j].pParaList+i*4)) == PTYPE_S) + { + printf("%d. (%s) val=%d, min=%d, max=%d, def=%d\r\n", i+1, pStr, + GetANorPara(p3-1, i+1), + *(g_norParaBlockList[p3-1].pParaList+ i*4+1), + *(g_norParaBlockList[p3-1].pParaList+ i*4+2), + *(g_norParaBlockList[p3-1].pParaList+ i*4+3) ); + } + else + { + printf("%d. (%s) val=%d, min=%d, max=%d, def=%d\r\n", i+1, pStr, + (u32)GetANorPara(p3-1, i+1), + (u32)(*(g_norParaBlockList[p3-1].pParaList+ i*4+1)), + (u32)(*(g_norParaBlockList[p3-1].pParaList+ i*4+2)), + (u32)(*(g_norParaBlockList[p3-1].pParaList+ i*4+3)) ); + } + } + DelayMs(1); + } + } + break; + } + case 2: + { + int bidx = p3 - 1; + // Ĭϲ + if (bidx >= 0) + { + printf("load def para block %d:\r\n", p3); + LoadNorDefPara(bidx); + } + break; + } + case 3: + { + int bidx = p3 - 1; + if (bidx >= 0) + { + printf("load para block %d:\r\n", p3); + // ¼ز + LoadNorParas(bidx); + } + break; + } + default: + break; + } + } +} + +#endif + diff --git a/NxFuncs/norparas/norparas.h b/NxFuncs/norparas/norparas.h new file mode 100644 index 0000000..8718657 --- /dev/null +++ b/NxFuncs/norparas/norparas.h @@ -0,0 +1,65 @@ + +#ifndef __NORPARAS_H__ +#define __NORPARAS_H__ + +#include "config.h" + +// Ķд + +// norflashĴ + +#ifndef MAX_PARA_BLOCK // ֲ֧ +#define MAX_PARA_BLOCK (0) +#endif + +#if (MAX_PARA_BLOCK > 16) // ֧16 +#undef MAX_PARA_BLOCK +#define MAX_PARA_BLOCK 16 +#endif + + + +#define PARA_NUM_PER_BLK (64) // 64,ÿռ4ֽ,256ֽ(һҳ) + +#define PARA_STR_LEN (30) // Ƴ + +#define PARA_VALID 0x55AA // Ч־,Զ + +//------------------------------------------------------------------------------ + +typedef struct +{ + s32 buff[PARA_NUM_PER_BLK]; +}NorParaBlock; + +// +#define PTYPE_S 0 // з +#define PTYPE_U 1 // ޷ +#define PTYPE_B 2 // λͼ + +//------------------------------------------------------------------------------ + + +void InitNorParas(void); // ʼ + +int GetNorParaEn(int bIdx); // ȡЧ־ + +int LoadNorParas(int bIdx); // ȡ bIdx:ID + +int SaveNorParas(int bIdx); // + +NorParaBlock * GetNorParaBlock(int bIdx); // ȡز + +void SetNorParaNameString(int bIdx, void * pName); // ò +void SetNorParaList(int bIdx, void * pPara); // òб +void LoadNorDefPara(int bIdx); // Ĭϲ +void CheckParaRange(int bIdx); // Χ(ȫ) +void CheckAParaRange(int bIdx, int id); // Χ() + +s32 GetANorPara(int bIdx, int id); //õֵ +void SetANorPara(int bIdx, int id, s32 val); //õֵ + + +//------------------------------------------------------------------------------ + +#endif // __NORPARAS_H__ diff --git a/NxFuncs/stadc/adcctrl.c b/NxFuncs/stadc/adcctrl.c new file mode 100644 index 0000000..f92ffad --- /dev/null +++ b/NxFuncs/stadc/adcctrl.c @@ -0,0 +1,321 @@ + +#include "adcctrl.h" + +#if (MAX_ADC1_CHANNEL_NUM != 0 || MAX_ADC2_CHANNEL_NUM != 0 || MAX_ADC3_CHANNEL_NUM != 0) + +#include "adc.h" + + +#include "filter.h" + +#if (MAX_ADC1_CHANNEL_NUM > 0) + +//------------------------------------------------------------------------------- + +// ad ˲ȼ +#ifndef ADC1_FILTER_NUM +#define ADC1_FILTER_NUM (20) // ˲ +#endif + +#ifndef HADC1 +#define HADC1 hadc1 +#endif + +#define ADC1VALBUFSIZE (ADC1_FILTER_NUM * MAX_ADC1_CHANNEL_NUM) + +u16 g_adc1valuebuf[ADC1VALBUFSIZE]; + +LPF1stData g_adc1lpf1st[MAX_ADC1_CHANNEL_NUM]; +LPF2ndData g_adc1lpf2nd[MAX_ADC1_CHANNEL_NUM]; +static int g_adc1Inited = 0; + +void InitADC1(void) +{ + int i; + + if (g_adc1Inited == 0) + { + g_adc1Inited = 1; + memset(g_adc1valuebuf, 0, ADC1VALBUFSIZE*sizeof(u16)); + + // ʼ˲ + for (i = 0; i < MAX_ADC1_CHANNEL_NUM; i++) + { + memcpy(&g_adc1lpf1st[i], &defaultLPF1st, sizeof(LPF1stData)); + memcpy(&g_adc1lpf2nd[i], &defaultLPF2nd, sizeof(LPF2ndData)); + } + HAL_ADC_Start_DMA(&HADC1, (u32*)(&g_adc1valuebuf[0]), ADC1VALBUFSIZE); + HAL_ADC_Start(&HADC1); + } +} + +void ADC1IntProc(void) +{ +/* + if(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == SET) + { + ADC_ClearFlag(ADC1,ADC_FLAG_EOC); + } +*/ +} + +/* + * HAL_ADC_PollForConversion(&HADC1, 0); // ȴת + * if (HAL_IS_BIT_SET(HAL_ADC_GetState(&HADC1), HAL_ADC_STATE_REG_EOC)) + * ADCжģʽֵֻ֧ͨ + * ADCжϻص + */ +void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) +{ + static int i = 0; + + g_adc1valuebuf[i] = HAL_ADC_GetValue(hadc); + i++; + if (i >= ADC1VALBUFSIZE) + { + i = 0; + } +} + +s32 GetADC1Value(int channelIdx, int flev) +{ + int i; + s32 value = 0; + int buff[ADC1_FILTER_NUM]; + int * pTBuf; + u16 * pSBuf; + + if (g_adc1Inited == 0 || channelIdx < 0 || channelIdx >= MAX_ADC1_CHANNEL_NUM) + { + return 0; + } + + // ǰͨIJɼ + pSBuf = &(g_adc1valuebuf[channelIdx]); + pTBuf = &(buff[0]); + for (i = 0; i < ADC1_FILTER_NUM; i++) + { + *pTBuf = (int)(*pSBuf); + pTBuf++; + pSBuf += MAX_ADC1_CHANNEL_NUM; + } + + // ĬΪλֵƽ˲ + value = MAFilter(buff, ADC1_FILTER_NUM); + + // һ˲ + if (flev >= 1) + { + value = LPF1st(&g_adc1lpf1st[channelIdx], value); + } + + // ˲ + if (flev >= 2) + { + value = LPF2nd(&g_adc1lpf2nd[channelIdx], value); + } + + return value; +} + +#endif + +//---------------------------------------------- + +#if (MAX_ADC2_CHANNEL_NUM > 0) + +// ad ˲ȼ +#ifndef ADC2_FILTER_NUM +#define ADC2_FILTER_NUM (10) // ˲ +#endif + +#ifndef HADC2 +#define HADC2 hadc2 +#endif + +#define ADC2VALBUFSIZE (ADC2_FILTER_NUM * MAX_ADC2_CHANNEL_NUM) + +u16 g_adc2valuebuf[ADC2VALBUFSIZE]; + +LPF1stData g_adc2lpf1st[MAX_ADC2_CHANNEL_NUM]; +LPF2ndData g_adc2lpf2nd[MAX_ADC2_CHANNEL_NUM]; +static int g_adc2Inited = 0; + +void InitADC2(void) +{ + int i; + + if (g_adc2Inited == 0) + { + g_adc2Inited = 1; + memset(g_adc2valuebuf, 0, ADC2VALBUFSIZE*sizeof(u16)); + + // ʼ˲ + for (i = 0; i < MAX_ADC2_CHANNEL_NUM; i++) + { + memcpy(&g_adc2lpf1st[i], &defaultLPF1st, sizeof(LPF1stData)); + memcpy(&g_adc2lpf2nd[i], &defaultLPF2nd, sizeof(LPF2ndData)); + } + + HAL_ADC_Start_DMA(&HADC2, (u32*)(&g_adc2valuebuf[0]), ADC2VALBUFSIZE); + HAL_ADC_Start(&HADC2); + } +} + +void ADC2IntProc(void) +{ +/* + if(ADC_GetFlagStatus(ADC2, ADC_FLAG_EOC) == SET) + { + ADC_ClearFlag(ADC2,ADC_FLAG_EOC); + } +*/ +} + + +s32 GetADC2Value(int channelIdx, int flev) +{ + int i; + s32 value = 0; + int buff[ADC2_FILTER_NUM]; + int * pTBuf; + u16 * pSBuf; + + if (g_adc2Inited == 0 || channelIdx < 0 || channelIdx >= MAX_ADC2_CHANNEL_NUM) + { + return 0; + } + + // ǰͨIJɼ + pSBuf = &(g_adc2valuebuf[channelIdx]); + pTBuf = &(buff[0]); + for (i = 0; i < ADC2_FILTER_NUM; i++) + { + *pTBuf = (int)(*pSBuf); + pTBuf++; + pSBuf += MAX_ADC2_CHANNEL_NUM; + } + + // ĬΪλֵƽ˲ + value = MAFilter(buff, ADC2_FILTER_NUM); + + // һ˲ + if (flev >= 1) + { + value = LPF1st(&g_adc2lpf1st[channelIdx], value); + } + + // ˲ + if (flev >= 2) + { + value = LPF2nd(&g_adc2lpf2nd[channelIdx], value); + } + + return value; +} + +#endif + +//------------------------------------------------------------------------------- + +#if (MAX_ADC3_CHANNEL_NUM > 0) +// ad ˲ȼ +#ifndef ADC3_FILTER_NUM +#define ADC3_FILTER_NUM 5 +#endif + +#ifndef HADC3 +#define HADC3 hadc3 +#endif + +#define ADC3VALBUFSIZE (ADC3_FILTER_NUM * MAX_ADC3_CHANNEL_NUM) + +u16 g_adc3valuebuf[ADC3VALBUFSIZE]; + +LPF1stData g_adc3lpf1st[MAX_ADC3_CHANNEL_NUM]; +LPF2ndData g_adc3lpf2nd[MAX_ADC3_CHANNEL_NUM]; +static int g_adc3Inited = 0; + + +void InitADC3(void) +{ + int i; + + if (g_adc3Inited == 0) + { + g_adc3Inited = 1; + memset(g_adc3valuebuf, 0, ADC3VALBUFSIZE*sizeof(u16)); + + // ʼ˲ + for (i = 0; i < MAX_ADC3_CHANNEL_NUM; i++) + { + memcpy(&g_adc3lpf1st[i], &defaultLPF1st, sizeof(LPF1stData)); + memcpy(&g_adc3lpf2nd[i], &defaultLPF2nd, sizeof(LPF2ndData)); + } + + HAL_ADC_Start_DMA(&HADC3, (u32*)(&g_adc3valuebuf[0]), ADC3VALBUFSIZE); + HAL_ADC_Start(&HADC3); + } +} + + + +void ADC3IntProc(void) +{ +/* + if(ADC_GetFlagStatus(ADC3, ADC_FLAG_EOC) == SET) + { + ADC_ClearFlag(ADC3,ADC_FLAG_EOC); + } +*/ +} + + +s32 GetADC3Value(int channelIdx, int flev) +{ + int i; + s32 value = 0; + int buff[ADC3_FILTER_NUM]; + int * pTBuf; + u16 * pSBuf; + + if (g_adc3Inited == 0 || channelIdx < 0 || channelIdx >= MAX_ADC3_CHANNEL_NUM) + { + return 0; + } + + // ǰͨIJɼ + pSBuf = &(g_adc3valuebuf[channelIdx]); + pTBuf = &(buff[0]); + for (i = 0; i < ADC3_FILTER_NUM; i++) + { + *pTBuf = (int)(*pSBuf); + pTBuf++; + pSBuf += MAX_ADC3_CHANNEL_NUM; + } + + // ĬΪλֵƽ˲ + value = MAFilter(buff, ADC3_FILTER_NUM); + + // һ˲ + if (flev >= 1) + { + value = LPF1st(&g_adc3lpf1st[channelIdx], value); + } + + // ˲ + if (flev >= 2) + { + value = LPF2nd(&g_adc3lpf2nd[channelIdx], value); + } + + return value; +} + + +#endif + +//------------------------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/stadc/adcctrl.h b/NxFuncs/stadc/adcctrl.h new file mode 100644 index 0000000..96833b3 --- /dev/null +++ b/NxFuncs/stadc/adcctrl.h @@ -0,0 +1,44 @@ + +#ifndef __ADCCTRL_H__ +#define __ADCCTRL_H__ + +#include "config.h" + +#ifndef MAX_ADC1_CHANNEL_NUM // ֧ͨ +#define MAX_ADC1_CHANNEL_NUM 0 +#endif + +#ifndef MAX_ADC2_CHANNEL_NUM // ֧ͨ +#define MAX_ADC2_CHANNEL_NUM 0 +#endif + +#ifndef MAX_ADC3_CHANNEL_NUM // ֧ͨ +#define MAX_ADC3_CHANNEL_NUM 0 +#endif + + +#if (MAX_ADC1_CHANNEL_NUM > 0) +void InitADC1(void); +s32 GetADC1Value(int channelIdx, int flev); // ȡADC1ֵ +void ADC1IntProc(void); // ADCжӦ + +#endif + +#if (MAX_ADC2_CHANNEL_NUM > 0) + +void InitADC2(void); +s32 GetADC2Value(int channelIdx, int lev); // ȡADC2ֵ +void ADC2IntProc(void); // ADCжӦ + +#endif + +#if (MAX_ADC3_CHANNEL_NUM > 0) + +void InitADC3(void); +s32 GetADC3Value(int channelIdx, int lev); // ȡADC3ֵ +void ADC3IntProc(void); // ADCжӦ + +#endif + +#endif /* __ADC_H__ */ + diff --git a/NxFuncs/stadc/filter.c b/NxFuncs/stadc/filter.c new file mode 100644 index 0000000..7a89115 --- /dev/null +++ b/NxFuncs/stadc/filter.c @@ -0,0 +1,155 @@ + +#define _IN_FILTER_C +#include "filter.h" + +//------------------------------------------------------ +// һͺ˲ +#if (1) + +int LPF1st(LPF1stData * pLpf1st, int newData) +{ + int data = 0; + if (pLpf1st != NULL) + { + if (pLpf1st->f1value < 0) + { + pLpf1st->f1value = newData; + } + + // һͺ˲ + pLpf1st->f1value = newData * pLpf1st->lowpassxs + pLpf1st->f1value * (1-pLpf1st->lowpassxs); + data = pLpf1st->f1value; + } + + return data; +} + +#endif + +// IIR˲ +#if (1) + +//------------------------------------------------------ + +int LPF2nd(LPF2ndData * pLpf2nd, int newData) +{ + int data = 0; + + if (pLpf2nd != NULL) + { + if (pLpf2nd->f2value < 0) + { + pLpf2nd->preout = newData; + pLpf2nd->lastout = newData; + } + + // ڶIIR˲ʽ:Yn)= b0*xn + b1*xn-1 + b2*xn-2 - (a1*xn-1 + a2*xn-2) + + // ˴b1 * xn-1 + b2 * xn-2 b1b2ϵΪ0 + pLpf2nd->f2value = (newData * pLpf2nd->b0)+ (pLpf2nd->lastout * pLpf2nd->a1) - (pLpf2nd->preout * pLpf2nd->a2); + + // ֵ´ + pLpf2nd->preout = pLpf2nd->lastout; + pLpf2nd->lastout = pLpf2nd->f2value; + data = pLpf2nd->lastout; + } + + return data; +} + +#endif + +//------------------------------------------------------ + +// Ȩƽ˲ +#if (1) + +// Ȩֵ +int WRAFilter(int * pBuff, int len) +{ + float value = 0; + int i; + int coe, coesum; + + if (pBuff == NULL || len <= 0) + { + return 0; + } + + coe = 1; // Ȩֵ1ʼ + coesum = 0; + for (i = 0; i < len; i++) + { + value += *pBuff++ * coe; // Ȩ + coesum += coe; + coe++; // ȨֵӣȨֵ + } + value /= coesum; // Ȩƽֵ + + return value; +} + +#endif + +//------------------------------------------------------ + +// λֵƽ˲ +#if (1) + +int MAFilter(int * pBuff, int len) +{ + int i; + s32 value = 0; + + if (pBuff == NULL || len <= 0) + { + return 0; + } + + if (len <= 5) // ٣ֱȡƽֵ + { + // ȡƽ + for (i = 0; i < len; i++) + { + value += *pBuff++; + } + value /= len; + } + else + { + s32 min, max, temp; + min = max = *pBuff; // һֵ + + // ȡֵۼӺͲõСֵ + for (i = 0; i < len; i++) + { + temp = *pBuff++; + value += temp; // ϵǰֵ + if (min > temp) + { + min = temp; + } + if (max < temp) + { + max = temp; + } + } + + // ۼӺͼȥСֵ + value -= min; + value -= max; + + // ʣݵƽֵ + value /= (len-2); + } + + return value; +} + +#endif + + +//------------------------------------------------------ + +//------------------------------------------------------ + diff --git a/NxFuncs/stadc/filter.h b/NxFuncs/stadc/filter.h new file mode 100644 index 0000000..259cf60 --- /dev/null +++ b/NxFuncs/stadc/filter.h @@ -0,0 +1,79 @@ + + +#ifndef __FILTER_H__ +#define __FILTER_H__ + +#include "config.h" + +//---------------------------------------------------------- + +// λֵƽ˲ +int MAFilter(int * pBuff, int len); + +//---------------------------------------------------------- + +// Ȩƽ˲(Ȩֵ) +int WRAFilter(int * pBuff, int len); + +//---------------------------------------------------------- + +// һ׵ͨ˲ +typedef struct +{ + float f1value; + float lowpassxs; +}LPF1stData; + +#ifdef _IN_FILTER_C +// οĬֵ +const LPF1stData defaultLPF1st = +{ + -1, + 0.5f, +}; +#else +extern const LPF1stData defaultLPF1st; +#endif + +int LPF1st(LPF1stData * pLpf1st, int newData); + +//---------------------------------------------------------- +// ˲ +typedef struct +{ + float f2value; + // + float b0; + float a1; + float a2; + + float preout; + float lastout; +}LPF2ndData; + +#ifdef _IN_FILTER_C +// οĬֵ +// ֹƵ(Ƶf0):30Hz Ƶfs:500Hz +const LPF2ndData defaultLPF2nd = +{ + -1, + 0.1883633f, + 1.023694f, + 0.2120577f, + 0, + 0, +}; +#else +extern const LPF2ndData defaultLPF2nd; +#endif + +int LPF2nd(LPF2ndData * pLpf2nd, int newData); + +//---------------------------------------------------------- + + + + + +#endif + diff --git a/NxFuncs/stdebug/stdebug.c b/NxFuncs/stdebug/stdebug.c new file mode 100644 index 0000000..3a8be45 --- /dev/null +++ b/NxFuncs/stdebug/stdebug.c @@ -0,0 +1,84 @@ + + +#include "stdebug.h" +#include "shell.h" +#include "inout.h" +#include "trigger.h" +#include "delay.h" + +//------------------------------------------------------------------------------------------------------------------------------------------------------------ + +void OutStackInfo(int type, u32 stackaddr) +{ + typedef struct + { + u32 R0; + u32 R1; + u32 R2; + u32 R3; + u32 R12; + u32 LR; + u32 PC; + u32 xPSR; + } StackData; + +#ifndef SetLedOn +#define SetLedOn() +#endif + +#ifndef SetLedOff +#define SetLedOff() +#endif + +#if (1) + StackData * pStack = (StackData *)(stackaddr); // ̣߳ʹ MSPջ + + SetConsoleOutType(0); // Ƕ + + while (1) + { + printf("\r\n-----------------------------------------\r\n"); + if (type == 0) + { + printf("In HardFault_Handler\r\n"); + } + else if (type == 1) + { + printf("In MemManage_Handler\r\n"); + } + else if (type == 2) + { + printf("In BusFault_Handler\r\n"); + } + else if (type == 3) + { + printf("In UsageFault_Handler\r\n"); + } + else if (type == 4) + { + printf("In NMI_Handler\r\n"); + } + + printf("Regs In stack\r\n"); + + printf ("R0 = 0x%lx\r\n", pStack->R0); + printf ("R1 = 0x%lx\r\n", pStack->R1); + printf ("R2 = 0x%lx\r\n", pStack->R2); + printf ("R3 = 0x%lx\r\n", pStack->R3); + printf ("R12 = 0x%lx\r\n",pStack->R12); + printf ("R14[LR] = 0x%lx\r\n", pStack->LR); + printf ("R15[PC] = 0x%lx\r\n", pStack->PC); + printf ("xPSR = 0x%lx\r\n", pStack->xPSR); + + for (int i = 0; i < 10; i++) + { + SetLedOn(); + DelayMs(50); + SetLedOff(); + DelayMs(100); + } + } +#endif +} + +//------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/NxFuncs/stdebug/stdebug.h b/NxFuncs/stdebug/stdebug.h new file mode 100644 index 0000000..ee3d035 --- /dev/null +++ b/NxFuncs/stdebug/stdebug.h @@ -0,0 +1,16 @@ + + +#ifndef __STDEBUG_H__ +#define __STDEBUG_H__ + +#include "config.h" + +//------------------------------------------------------------------------------- + +void OutStackInfo(int type, u32 stackaddr); + +//------------------------------------------------------------------------------- + +#endif + + diff --git a/NxFuncs/stepdriver/tmc260.c b/NxFuncs/stepdriver/tmc260.c new file mode 100644 index 0000000..4d15006 --- /dev/null +++ b/NxFuncs/stepdriver/tmc260.c @@ -0,0 +1,1321 @@ + + +#define _IN_TMC260_C +#include "tmc260.h" + +//------------------------------------------------------------------------- + +#if (TMC260_DRV_NUM != 0) + +//------------------------------------------------------------------------- + +#include "trigger.h" +#include "shell.h" +#include "inout.h" + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------ + +typedef struct +{ + TSpiCtrlConfig spiCtrlConfig; + TStepDirConfig stepDirConfig; + TChopperConfig chopperConfig; + TSmartEnergyControl smartEnergyControl; + TStallGuardConfig stallGuardConfig; + TDriverConfig driverConfig; + + TReadStatus readStatus; + u32 readData; +}TCConfig; + +//------------------------------------------------------------------------ + +TCConfig g_tcConfig[TMC260_DRV_NUM]; + +//------------------------------------------------------------------------ + +#define SReadWrite(cs, dat) SpiReadWrite(cs, dat, 20) // д20λ + +void SpiCsOff(SpiCs cs) +{ +#if (TMC260_DRV_NUM >= 1) + SetDriver1CsOff(); +#endif +#if (TMC260_DRV_NUM >= 2) + SetDriver2CsOff(); +#endif +#if (TMC260_DRV_NUM >= 3) + SetDriver3CsOff(); +#endif +#if (TMC260_DRV_NUM >= 4) + SetDriver4CsOff(); +#endif +#if (TMC260_DRV_NUM >= 5) + SetDriver5CsOff(); +#endif +#if (TMC260_DRV_NUM >= 6) + SetDriver6CsOff(); +#endif +} + +void SpiCsOn(SpiCs cs) +{ + SpiCsOff(cs); + + switch(cs) + { + case SC_MOTO1: +#if (TMC260_DRV_NUM >= 1) + SetDriver1CsOn(); +#endif + break; + case SC_MOTO2: +#if (TMC260_DRV_NUM >= 2) + SetDriver2CsOn(); +#endif + break; + case SC_MOTO3: +#if (TMC260_DRV_NUM >= 3) + SetDriver3CsOn(); +#endif + break; + case SC_MOTO4: +#if (TMC260_DRV_NUM >= 4) + SetDriver4CsOn(); +#endif + break; + case SC_MOTO5: +#if (TMC260_DRV_NUM >= 5) + SetDriver5CsOn(); +#endif + break; + case SC_MOTO6: +#if (TMC260_DRV_NUM >= 6) + SetDriver6CsOn(); +#endif + break; + default: + break; + } +} + +// ģ SPI ӳ֧64λ +uint64_t SpiReadWrite(SpiCs cs, uint64_t dat, u8 bitlen) +{ + int i; + uint64_t rslt; + uint64_t mod; + + SClockHigh(); + SpiCsOn(cs); // ƬѡЧʼִжд + + rslt = 0; + mod = 0x01; + mod <<= (bitlen-1); + + for(i = 0; i < bitlen; i++) + { + // ú + if ((dat&mod) != 0) + { + SMdoDataOne(); + } + else + { + SMdoDataZero(); + } + + SClockLow(); // Ϊ͵ƽ½оƬ׼ + SClockHigh(); // ΪߵƽоƬȡúõ + + if (SMdiRead() != 0) // ȡ + { + rslt |= mod; + } + mod >>= 1; + } + + SpiCsOff(cs); + //printf("SPI cs =0x%x, data =0x%x, rslt = 0x%x \r\n",cs,dat,rslt); + + return(rslt); +} + +//------------------------------------------------------------------------ + +int GetIdxFormCs(SpiCs moto) +{ + int idx = moto - 1; + if (idx < 0 || idx >= TMC260_DRV_NUM) + { + printf("not support moto idx\r\n"); + return -1; + } + return idx; +} + +//------------------------------------------------------------------------ +// ϸóʼӳ +void WriteStepDirConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = DRVCTRL0; + + if (g_tcConfig[idx].stepDirConfig.intpol != 0) + { + temp |= INTPOL; // ʹ16Ƶ + } + + if (g_tcConfig[idx].stepDirConfig.dEdge != 0) + { + temp |= DEDGE; // ʹ˫ + } + + if (g_tcConfig[idx].stepDirConfig.mRes > MRES1) + { + g_tcConfig[idx].stepDirConfig.mRes = MRES1; + } + + temp |= g_tcConfig[idx].stepDirConfig.mRes; + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + +//------------------------------------------------------------------------ +// SPI + +void WriteSpiCtrlConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = DRVCTRL1; + + if (g_tcConfig[idx].spiCtrlConfig.polarityA != 0) + { + temp |= PHA; + } + + if (g_tcConfig[idx].spiCtrlConfig.currentA > 255) + { + g_tcConfig[idx].spiCtrlConfig.currentA = 255; + } + + temp |= ((u32)g_tcConfig[idx].spiCtrlConfig.currentA) << 9; + + if (g_tcConfig[idx].spiCtrlConfig.polarityB != 0) + { + temp |= PHB; + } + + if (g_tcConfig[idx].spiCtrlConfig.currentB > 255) + { + g_tcConfig[idx].spiCtrlConfig.currentB = 255; + } + + temp |= ((u32)g_tcConfig[idx].spiCtrlConfig.currentB); + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + + +//------------------------------------------------------------------------ +// նĴʼ + +void WriteChopperConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = CHOPCONF; + + if (g_tcConfig[idx].chopperConfig.blankTime > 3) + { + g_tcConfig[idx].chopperConfig.blankTime = 3; + } + + if (g_tcConfig[idx].chopperConfig.hysteresisDecay > 3) + { + g_tcConfig[idx].chopperConfig.hysteresisDecay = 3; + } + + if (g_tcConfig[idx].chopperConfig.hysteresisEnd > 15) + { + g_tcConfig[idx].chopperConfig.hysteresisEnd = 15; + } + + if (g_tcConfig[idx].chopperConfig.hysteresisStart > 7) + { + g_tcConfig[idx].chopperConfig.hysteresisStart = 7; + } + + if (g_tcConfig[idx].chopperConfig.tOff > 15) + { + g_tcConfig[idx].chopperConfig.tOff = 15; + } + + temp |= ((u32)g_tcConfig[idx].chopperConfig.blankTime) << 15; + + if (g_tcConfig[idx].chopperConfig.chopperMode != 0) + { + temp |= CHM; + } + + if (g_tcConfig[idx].chopperConfig.randomTOff != 0) + { + temp |= RNDTF; + } + + temp |= ((u32)g_tcConfig[idx].chopperConfig.hysteresisDecay) << 11; + temp |= ((u32)g_tcConfig[idx].chopperConfig.hysteresisEnd) << 7; + temp |= ((u32)g_tcConfig[idx].chopperConfig.hysteresisStart) << 4; + if (g_tcConfig[idx].chopperConfig.enable != 0) + { + temp |= ((u32)g_tcConfig[idx].chopperConfig.tOff); + } + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + +//------------------------------------------------------------------------ +// ӦƳʼӳ +void WriteStallGuardConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = SGCSCONF; + + // 8 λзתΪ7λз, 7λз7λͷλ(-64--63֮ͬ + if (g_tcConfig[idx].stallGuardConfig.stallGuardThreshold > 63) + { + g_tcConfig[idx].stallGuardConfig.stallGuardThreshold = 63; + } + else if (g_tcConfig[idx].stallGuardConfig.stallGuardThreshold < -64) + { + g_tcConfig[idx].stallGuardConfig.stallGuardThreshold = -64; + } + + if(g_tcConfig[idx].stallGuardConfig.filterEnable != 0) + { + temp |= SFILT; + } + + temp |= (((u32) g_tcConfig[idx].stallGuardConfig.stallGuardThreshold & 0x7f) << 8); + temp |= (g_tcConfig[idx].stallGuardConfig.currentScale & 0x1F); + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + +//------------------------------------------------------------------------ +// ӦƳʼ +void WriteSmartEnergyConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = SMARTEN; + + if (g_tcConfig[idx].smartEnergyControl.smartIMin != 0) + { + temp |= SEIMIN; + } + + if (g_tcConfig[idx].smartEnergyControl.smartDownStep > 3) + { + g_tcConfig[idx].smartEnergyControl.smartDownStep = 3; + } + + if (g_tcConfig[idx].smartEnergyControl.smartStallLevelMax > 15) + { + g_tcConfig[idx].smartEnergyControl.smartStallLevelMax = 15; + } + + if (g_tcConfig[idx].smartEnergyControl.smartUpStep > 3) + { + g_tcConfig[idx].smartEnergyControl.smartUpStep = 3; + } + + if (g_tcConfig[idx].smartEnergyControl.smartStallLevelMin > 15) + { + g_tcConfig[idx].smartEnergyControl.smartStallLevelMin = 15; + } + + temp |= ((u32)g_tcConfig[idx].smartEnergyControl.smartDownStep) << 13; + temp |= ((u32)g_tcConfig[idx].smartEnergyControl.smartStallLevelMax) << 8; + temp |= ((u32)g_tcConfig[idx].smartEnergyControl.smartUpStep) << 5; + temp |= ((u32)g_tcConfig[idx].smartEnergyControl.smartStallLevelMin); + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + + + +//------------------------------------------------------------------------ +// ƼĴʼ + +void WriteDriverConfig(SpiCs moto) +{ + u32 temp; + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + temp = DRVCONF; + + if (g_tcConfig[idx].driverConfig.testMode != 0) + { + temp |= TST; + } + + temp |= ((u32)g_tcConfig[idx].driverConfig.slopeHighSide & 0x03) << 14; + temp |= ((u32)g_tcConfig[idx].driverConfig.slopeLowSide & 0x03) << 12; + + if (g_tcConfig[idx].driverConfig.protectionDisable != 0) + { + temp |= DISS2G; + } + + temp |= ((u32)g_tcConfig[idx].driverConfig.protectionTimer & 0x03) << 8; + + if (g_tcConfig[idx].driverConfig.stepDirDisable != 0) + { + temp |= SDOFF; + } + + if (g_tcConfig[idx].driverConfig.vSenseScale != 0) + { + temp |= VSENSE; + } + + temp |= ((u32) g_tcConfig[idx].driverConfig.readBackSelect & 0x03) << 4; + + g_tcConfig[idx].readData = SReadWrite(moto, temp); +} + +//------------------------------------------------------------------------ +// ȡ״ֵ̬ + +void ReadDriverState(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + WriteDriverConfig(moto); + + switch(g_tcConfig[idx].driverConfig.readBackSelect) // ȡ,0:΢λ,1:ֵ0--9λ, 2:ֵ5λ(5--9λ)õֵС + { + case 0: // 0 A΢λ + { + g_tcConfig[idx].readStatus.phases = (g_tcConfig[idx].readData >> 18) & 0x01; // STEP/DIRģʽµļλ; 0OA1OA2š 1OA2OA1š + g_tcConfig[idx].readStatus.mSteps = (g_tcConfig[idx].readData >> 10) & 0x1FF; // ȦAұе΢λ + break; + } + case 1: // 1 ֵ + { + g_tcConfig[idx].readStatus.stallGuard = (g_tcConfig[idx].readData >> 10) & 0x3FF; + break; + } + case 2: // 2ظ5λǰֵС + { + g_tcConfig[idx].readStatus.stallGuard &= 0x1f; + g_tcConfig[idx].readStatus.stallGuard |= (g_tcConfig[idx].readData >> 10) & 0x3E0; + g_tcConfig[idx].readStatus.smartEnergy = (g_tcConfig[idx].readData >> 10) & 0x1f; + break; + } + } + + g_tcConfig[idx].readStatus.flags = g_tcConfig[idx].readData & 0xff; // ͣٱ־λ, STEP +} + +//------------------------------------------------------------------------ +// ʼ + +void InitMotorDrivers(SpiCs moto) +{ + int idx; + + idx = moto-1; + if (idx < 0 || idx >= TMC260_DRV_NUM) + { + return; + } + + memset(&(g_tcConfig[idx]), 0, sizeof(TCConfig)); + + g_tcConfig[idx].stallGuardConfig.filterEnable = 1; // ʧ˲ 0:׼ģʽ1: 4fullstep˲ + g_tcConfig[idx].stallGuardConfig.stallGuardThreshold = 2; // ʧ-64~63ֵԽԽͣС-10 + g_tcConfig[idx].stallGuardConfig.currentScale = 1; // 0~31 + WriteStallGuardConfig(moto); // 0xd020a + + g_tcConfig[idx].driverConfig.slopeHighSide = 2; // Ϲʹܿб0:С3: + g_tcConfig[idx].driverConfig.slopeLowSide = 2; // ¹ʹܿб0:С3: + g_tcConfig[idx].driverConfig.protectionDisable = 0; // 0:·ʹ 1:ʹ + g_tcConfig[idx].driverConfig.protectionTimer = 0; // ·ʱ0: 3.2uS, 1: 1.6uS, 2: 1.2uS, 3: 0.8uS + g_tcConfig[idx].driverConfig.stepDirDisable = 0; // 0: 巽ģʽ1:SPIģʽ + g_tcConfig[idx].driverConfig.vSenseScale = 0; // οѹ0: 305mV, 1: 165mV + g_tcConfig[idx].driverConfig.readBackSelect = 1; // ȡ,0:΢λ,1:ֵ0--9λ, 2:ֵ5λ(5--9λ)õֵС + WriteDriverConfig(moto); // 0xea010 + + g_tcConfig[idx].smartEnergyControl.smartIMin = 1; // ܿС0: 1/2, 1: 1/4 + g_tcConfig[idx].smartEnergyControl.smartDownStep = 0; // ٶ0: 32, 1: 8, 2: 2, 3: 1 + g_tcConfig[idx].smartEnergyControl.smartStallLevelMax = 0; // λȫ0~15 + g_tcConfig[idx].smartEnergyControl.smartUpStep = 0; // ٶ0: 1, 1: 2, 2: 4, 3: 8 + g_tcConfig[idx].smartEnergyControl.smartStallLevelMin = 0; // λȫ0~15 + WriteSmartEnergyConfig(moto); // 0xa8000 + + g_tcConfig[idx].stepDirConfig.intpol = 0; // 16Ƶģʽ + g_tcConfig[idx].stepDirConfig.dEdge = 0; // ˫ģʽ + g_tcConfig[idx].stepDirConfig.mRes = MRES4; // ϸ + WriteStepDirConfig(moto); // 0x0 + + g_tcConfig[idx].chopperConfig.blankTime = 1; // նհʱ䣬Ҳǹضʱ䣬0: 16, 1: 24, 2: 36, 3: 54 + g_tcConfig[idx].chopperConfig.chopperMode = 0; // 0: նģʽ, 1: ϵģʽһѡ0 + g_tcConfig[idx].chopperConfig.hysteresisDecay = 0; // ˥0...3, 0:fast decrement 3:very slow decrement + g_tcConfig[idx].chopperConfig.hysteresisEnd = 3; // ˥ֵ 0...15 + g_tcConfig[idx].chopperConfig.hysteresisStart = 3; // ˥ʼֵ 0...7 + g_tcConfig[idx].chopperConfig.tOff = 5; // ն˥ʱ䣬Ӱ쿪Ƶ + g_tcConfig[idx].chopperConfig.enable = 1; // mosfet + WriteChopperConfig(moto); // 0x881b5 +} + +//------------------------------------------------------------------------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------ +// ΢ϸӳ +void SetStepDirMStepRes(SpiCs moto, u32 microstepResolution) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stepDirConfig.mRes = microstepResolution; + WriteStepDirConfig(moto); +} + +// +void SetStepDirInterpolation(SpiCs moto, u32 interpolation) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stepDirConfig.intpol = interpolation; + WriteStepDirConfig(moto); +} + +// +void SetStepDirDoubleEdge(SpiCs moto, u32 doubleEdge) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stepDirConfig.dEdge = doubleEdge; + WriteStepDirConfig(moto); +} + +// +u32 GetStepDirMStepRes(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stepDirConfig.mRes; +} + +// +u32 GetStepDirInterpolation(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stepDirConfig.intpol; +} + +// +u32 GetStepDirDoubleEdge(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stepDirConfig.dEdge; +} + +//------------------------------------------------------------------------ +// +void SetChopperBlankTime(SpiCs moto, u32 blankTime) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.blankTime = blankTime; + WriteChopperConfig(moto); +} + +// +void SetChopperMode(SpiCs moto, u32 mode) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.chopperMode = mode; + WriteChopperConfig(moto); +} + +// +void SetChopperRandomTOff(SpiCs moto, u32 randomTOff) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.randomTOff = randomTOff; + WriteChopperConfig(moto); +} + +// +void SetChopperHysteresisDecay(SpiCs moto, u32 hysteresisDecay) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.hysteresisDecay = hysteresisDecay; + WriteChopperConfig(moto); +} + +// +void SetChopperHysteresisEnd(SpiCs moto, u32 hysteresisEnd) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.hysteresisEnd = hysteresisEnd; + WriteChopperConfig(moto); +} + +// +void SetChopperHysteresisStart(SpiCs moto, u32 hysteresisStart) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.hysteresisStart = hysteresisStart; + WriteChopperConfig(moto); +} + +// +void SetChopperTOff(SpiCs moto, u32 tOff) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.tOff = tOff; + WriteChopperConfig(moto); +} + +void SetChopperEnable(SpiCs moto, u32 enable) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].chopperConfig.enable = enable; + WriteChopperConfig(moto); +} + +// +u32 GetChopperBlankTime(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.blankTime; +} + +// +u32 GetChopperMode(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.chopperMode; +} + +// +u32 GetChopperRandomTOff(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.randomTOff; +} + +// +u32 GetChopperHysteresisDecay(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.hysteresisDecay; +} + +// +u32 GetChopperHysteresisEnd(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.hysteresisEnd; +} + +// +u32 GetChopperHysteresisStart(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.hysteresisStart; +} + +// +u32 GetChopperTOff(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.tOff; +} + +u32 GetChopperEnable(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].chopperConfig.enable; +} + +//------------------------------------------------------------------------ +// +void SetSmartEnergyIMin(SpiCs moto, u32 smartIMin) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].smartEnergyControl.smartIMin = smartIMin; + WriteSmartEnergyConfig(moto); +} + +// +void SetSmartEnergyDownStep(SpiCs moto, u32 smartDownStep) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].smartEnergyControl.smartDownStep = smartDownStep; + WriteSmartEnergyConfig(moto); +} + +// +void SetSmartEnergyStallLevelMax(SpiCs moto, u32 stallLevelMax) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].smartEnergyControl.smartStallLevelMax = stallLevelMax; + WriteSmartEnergyConfig(moto); +} + +// +void SetSmartEnergyUpStep(SpiCs moto, u32 smartUpStep) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].smartEnergyControl.smartUpStep = smartUpStep; + WriteSmartEnergyConfig(moto); +} + +// +void SetSmartEnergyStallLevelMin(SpiCs moto, u32 stallLevelMin) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].smartEnergyControl.smartStallLevelMin = stallLevelMin; + WriteSmartEnergyConfig(moto); +} + +// +u32 GetSmartEnergyIMin(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].smartEnergyControl.smartIMin; +} + +// +u32 GetSmartEnergyDownStep(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].smartEnergyControl.smartDownStep; +} + +// +u32 GetSmartEnergyStallLevelMax(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].smartEnergyControl.smartStallLevelMax; +} + +// +u32 GetSmartEnergyUpStep(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].smartEnergyControl.smartUpStep; +} + +// +u32 GetSmartEnergyStallLevelMin(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].smartEnergyControl.smartStallLevelMin; +} + +//------------------------------------------------------------------------ +// +void SetStallGuardFilter(SpiCs moto, u32 enable) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stallGuardConfig.filterEnable = enable; + WriteStallGuardConfig(moto); +} + +// +void SetStallGuardThreshold(SpiCs moto, s32 threshold) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stallGuardConfig.stallGuardThreshold = threshold; + WriteStallGuardConfig(moto); +} + +// +void SetStallGuardCurrentScale(SpiCs moto, u32 currentScale) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].stallGuardConfig.currentScale = currentScale; + WriteStallGuardConfig(moto); +} + +// +u32 GetStallGuardFilter(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stallGuardConfig.filterEnable; +} + +// +s32 GetStallGuardThreshold(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stallGuardConfig.stallGuardThreshold; +} + +// +u32 GetStallGuardCurrentScale(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].stallGuardConfig.currentScale; +} + +//------------------------------------------------------------------------ +// +void SetDriverSlopeHighSide(SpiCs moto, u32 slopeHighSide) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.slopeHighSide = slopeHighSide; + WriteDriverConfig(moto); +} + +// +void SetDriverSlopeLowSide(SpiCs moto, u32 slopeLowSide) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.slopeHighSide = slopeLowSide; + WriteDriverConfig(moto); +} + +// +void SetDriverDisableProtection(SpiCs moto, u32 disableProtection) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.protectionDisable = disableProtection; + WriteDriverConfig(moto); +} + +// +void SetDriverProtectionTimer(SpiCs moto, u32 protectionTimer) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.protectionTimer = protectionTimer; + WriteDriverConfig(moto); +} + +// +void SetDriverStepDirectionOff(SpiCs moto, u32 sDOff) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.stepDirDisable = sDOff; + WriteDriverConfig(moto); +} + +// +void SetDriverVSenseScale(SpiCs moto, u32 scale) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.vSenseScale = scale; + WriteDriverConfig(moto); +} + +// +void SetDriverReadSelect(SpiCs moto, u32 readSelect) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.readBackSelect = readSelect; + WriteDriverConfig(moto); +} + +// +void SetDriverTestMode(SpiCs moto, u32 testMode) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return; + } + g_tcConfig[idx].driverConfig.testMode = testMode; + WriteDriverConfig(moto); +} + +// +u32 GetDriverSlopeHighSide(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.slopeHighSide; +} + +// +u32 GetDriverSlopeLowSide(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.slopeLowSide; +} + +// +u32 GetDriverDisableProtection(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.protectionDisable; +} + +// +u32 GetDriverProtectionTimer(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.protectionTimer; +} + +// +u32 GetDriverStepDirectionOff(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.stepDirDisable; +} + +// +u32 GetDriverVSenseScale(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.vSenseScale; +} + +// +u32 GetDriverReadSelect(SpiCs moto) +{ + int idx; + idx = moto-1; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.readBackSelect; +} + +// +u32 GetDriverTestMode(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].driverConfig.testMode; +} + +//------------------------------------------------------------------------ + +u32 GetPhases(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + + return g_tcConfig[idx].readStatus.phases; +} + +//------------------------------------------------------------------------ +u32 GetMStepPos(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + + return g_tcConfig[idx].readStatus.mSteps; +} + +//------------------------------------------------------------------------ +u32 GetStallGuard(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + + return g_tcConfig[idx].readStatus.stallGuard; +} + +//------------------------------------------------------------------------ +u32 GetSmartEnergy(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + + return g_tcConfig[idx].readStatus.smartEnergy; +} + +//------------------------------------------------------------------------ +// +u32 GetDriverFlag(SpiCs moto) +{ + int idx; + idx = GetIdxFormCs(moto); + if (idx < 0) + { + return 0; + } + return g_tcConfig[idx].readStatus.flags; +} + +// +void DriveDisable(SpiCs moto) +{ + SetChopperEnable(moto, 0); +} + +// +void DriveEnable(SpiCs moto) +{ + SetChopperEnable(moto, 1); +} + +//---------------------------------------------------------------------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ + + +void InitTmc260(void) +{ + InitMotorDrivers(SC_MOTO1); + InitMotorDrivers(SC_MOTO2); + InitMotorDrivers(SC_MOTO3); + InitMotorDrivers(SC_MOTO4); + InitMotorDrivers(SC_MOTO5); + InitMotorDrivers(SC_MOTO6); +} + +//------------------------------------------------------------------------ + +int GetResConfigFromLvnum(int subd) +{ + switch(subd) + { + case 1: // 1ϸ + return MRES1; + case 2: // 2ϸ + return MRES2; + case 4: // 4ϸ + return MRES4; + case 8: // 8ϸ + return MRES8; + case 16: // 16ϸ + return MRES16; + case 32: // 32ϸ + return MRES32; + case 64: // 64ϸ + return MRES64; + case 128: // 128ϸ + return MRES128; + case 256: // 256ϸ + return MRES256; + default: + return MRES256; + }; +} + +#endif + + diff --git a/NxFuncs/stepdriver/tmc260.h b/NxFuncs/stepdriver/tmc260.h new file mode 100644 index 0000000..5b8fd58 --- /dev/null +++ b/NxFuncs/stepdriver/tmc260.h @@ -0,0 +1,355 @@ + + +#ifndef __TMC260_H__ +#define __TMC260_H__ + + +#include "config.h" +#include "inout.h" + +//------------------------------------------------------------ + +// Ĵλ + +// Ĵ5, ÿ20λ + +// ַ +#define CFR 0x80000 +#define CFRSEL1 0x40000 +#define CFRSEL0 0x20000 + +#define DRVCTRL0 0 // SDOFF == 0 ʱ +#define DRVCTRL1 0 // SDOFF == 1 ʱ +#define CHOPCONF (CFR) +#define SMARTEN (CFR|CFRSEL0) +#define SGCSCONF (CFR|CFRSEL1) +#define DRVCONF (CFR|CFRSEL1|CFRSEL0) + +//------------------------------------------------------------ + +// SPIʽƼĴ +// sdoff == 1 DRVCTRL spiʽ + +#ifdef DRVCTRL1 + +// SPI +typedef struct +{ + u32 polarityA; // A; 0, OA1ܽŵOA2ܽ; 1, OA2ܽŵOA1ܽ + u32 currentA; // ȦAĴСΧΪ0248ͺƫȫʹá ʩͺƫƺĽֵܳ255 + + u32 polarityB; // B; 0, OB1ܽŵOB2ܽ; 1, OB2ܽŵOB1ܽ + u32 currentB; // ȦBĴСΧΪ0248ͺƫȫʹá ʩͺƫƺĽֵܳ255 + +}TSpiCtrlConfig; + +#define PHA 0x20000 +#define CA 0x1FE00 +#define PHB 0x00100 +#define CB 0x000FF + +#endif + + + + + + +#endif + + + + +//------------------------------------------------------------ + +// +Ʒʽ ƼĴ + +// sdoff == 0 DRVCTRL Ϊ step dir ʽ + +#ifdef DRVCTRL0 + +typedef struct +{ + u32 intpol; // Ƶ + u32 dEdge; // ˫ + u32 mRes; // ΢ +}TStepDirConfig; + +#define INTPOL 0x00200 // ʹ16Ƶ + +#define DEDGE 0x00100 // ʹ˫壬ԼٶԲƵʵҪ + +#define MRES1 0x00008 // 1ϸ +#define MRES2 0x00007 // 2ϸ +#define MRES4 0x00006 // 4ϸ +#define MRES8 0x00005 // 8ϸ +#define MRES16 0x00004 // 16ϸ +#define MRES32 0x00003 // 32ϸ +#define MRES64 0x00002 // 64ϸ +#define MRES128 0x00001 // 128ϸ +#define MRES256 0x00000 // 256ϸ + +#define MRES 0x0000F // ֻ4λЧ + +//------------------------------------------------------------ + +// նĴ +#ifdef CHOPCONF + +typedef struct +{ + u32 blankTime; // Ƚհʱѡ; 00հʱΪ 16 ʱ; 01հʱΪ 24 ʱ; 10հʱΪ 36 ʱ; 11հʱΪ 54 ʱ; + u32 chopperMode; // նģʽ; 0׼ģʽ 1Toff ΪĿ˥ģʽ + u32 randomTOff; // TOFF ʱ: 0նʱ̶ 1նʱɵ + u32 hysteresisDecay; // chopperMode==0ʱ, ˥; 0016 ʱ; 0132 ʱ; 1048 ʱ; 1164 ʱ; + // chopperMode==1ʱ, FDMODE ; bit0==1: ֹȽΪ˥ֹ; bit1:˥ʱλ + u32 hysteresisEnd; // chopperMode==0ʱ, ˥λֵ; 0--15 Ӧ˥ֵΪ -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12 + // chopperMode==1ʱ, Ҳƫ + u32 hysteresisStart; // chopperMode==0ʱ, ˥ʼֵ, ˥ 0--7hysteresisEnd 1 -- 8 + // chopperMode==1ʱ, ˥ʱ, ʱ = (((hysteresisDecay&0x02) << 2) | (hysteresisStart&0x07)) * 32 ʱ + u32 tOff; // ˥׶εijʱ; 1, TBL(blankTime) С 24 ʱ; 2--15, ʹùʽ 12 + (32 x tOffAndDisable) С 64 ʱڡ + u32 enable; // mosfet == 0, ֹ; = 1, + +}TChopperConfig; + + +#define TBL 0x18000 // 2λ + +#define CHM 0x04000 +#define RNDTF 0x02000 +#define HDEC 0x01800 // 2λ +#define HEND 0x00780 // 4λ +#define HSTRT 0x00070 // 3λ +#define TOFF 0x0000F // 4λ + +#define DRIVE_OFF 0 +#define DRIVE_ON 1 + + +#endif + + +//------------------------------------------------------------ + +// Ĵ (coolStep ) + +#ifdef SMARTEN + +typedef struct +{ + u32 smartIMin; // ܿС; = 01/2趨; = 1, 1/4趨 + u32 smartDownStep; // Сٶ; 00ÿ 32 ˥ֵСһλ; 01ÿ 8 ˥ֵСһλ; 10ÿ 2 ˥ֵСһλ; 11ÿ1˥ֵСһλ + u32 smartStallLevelMax; // Сʱص˥ֵ; ؼֵ>=(SEMIN+SEMAX+1)*32 صȫֵ 趨Χ 0--15 + u32 smartUpStep; // ; 00: ÿ 1 زֵһλ; 01: ÿ 2 زֵһλ; 00: ÿ 4 زֵһλ; 00: ÿ 8 زֵһλ; + u32 smartStallLevelMin; // ܵƵСؼֵ͵ʹ; ؼֵ < SEMIN*32СתǶȽ; 0ֹ; 1--15 ؼֵ +}TSmartEnergyControl; + +#define SEIMIN 0x08000 + +#define SEND 0x06000 // 2λ +#define SEMAX 0x00F00 // 4λ +#define SEUP 0x00060 // 2λ +#define SEMIN 0x0000F // 4λ + +#endif + + +//------------------------------------------------------------ +// ʧٱ͵趨Ĵ + +#ifdef SGCSCONF + +typedef struct +{ + u32 filterEnable; // ʹʧټ˲; 0, ׼ģʽ, 췴Ӧʱ; 1, ģʽÿIJһθ£Բṹı仯߾; + s32 stallGuardThreshold; // ʧټֵⷧ趨ֵԽ, Խ, ʧʱתԽ; з, ÷ΧΪ-64 -- +63 һΪ0õ-10 + u32 currentScale; // ű趨ֵ 0--31 Ӧ 1/32 -- 32/32. CS = 0, 1/32 + +}TStallGuardConfig; + + +#define SFILT 0x10000 +#define SGT 0x07F00 // 7λ +#define CS 0x0001F // 5λ + + + +#endif + + + +//------------------------------------------------------------ +// оƬüĴ + +#ifdef DRVCONF + +typedef struct +{ + u32 testMode; // Ϊģʽ; һΪ 0λ 1 ʱSG_TST ֲֵ, TEST_ANA ģֵͨ SGT1 SGT0 + u32 slopeHighSide; // ߶ؿ; 00Сֵ; 01Сֵ+tc; 10мֵ+tc 11ֵ; ¶Ȳģʽ£趨ֵΪǿȵһ + u32 slopeLowSide; // Ͷؿ; 0001Сֵ; 10мֵ; 11ֵ + u32 protectionDisable; // ·ر; 0, ʹ; 1, ر + u32 protectionTimer; // ·ⶨʱ; 003.2us011.6us101.2us0.8us + u32 stepDirDisable; // ͷģʽر; 0ʹͷģʽ1ʹ SPI ģʽرͷģʽ + u32 vSenseScale; // 趨IJֵ߽; 0ѹֵ 305mV; 1:ѹֵ 165mV. (ָǰΪ31DACֵΪ255) + u32 readBackSelect; // λѡ, 00΢λã01ظֵ10ظֵܵ11δʹ +}TDriverConfig; + +#define TST 0x10000 +#define SLPH 0x0C000 +#define SLPL 0x03000 + +#define DISS2G 0x00400 +#define TS2G 0x00300 +#define SDOFF 0x00080 +#define VSENSE 0x00040 +#define RDSEL 0x00030 + +#endif + +//------------------------------------------------------------ + +// ȡϢĴ +typedef struct +{ + u32 phases; // : 0OA1OA2š1OA2OA1š + u32 mSteps; // ΢STEP/DIRģʽȦAұе΢λá + u32 stallGuard; // ʧټֵ + u32 smartEnergy; // ֵ + u32 flags; // ־ + +}TReadStatus; + + +#define MSTEP 0xFFC00 +#define SG 0xFFC00 +#define SE 0x03C00 + + +// flags +#define ST_STST 0x0080 // ָʾ 1ָʾ 2^20 ηʱûв +#define ST_OLB 0x0040 // B ָʾնʱΪ 1 һ1/16 ͨʱ +#define ST_OLA 0x0020 // A ָʾնʱΪ 1 һ1/16 ͨʱ +#define ST_S2GB 0x0010 // B ·ָʾ, ·նֹ·һ 3 ʱҪλ +#define ST_S2GA 0x0008 // A ·ָʾ, ·նֹ·һ 3 ʱҪλ +#define ST_OTPW 0x0004 // Ԥ1ִбֵ +#define ST_OT 0x0002 // ±־, 1¶ +#define ST_SG 0x0001 // ״̬1طֵSG ߵƽ + + +//------------------------------------------------------------ + + +#ifndef TMC260_DRV_NUM +#define TMC260_DRV_NUM 0 +#endif + +#if (TMC260_DRV_NUM > 6) +#unfine TMC260_DRV_NUM +#define TMC260_DRV_NUM 6 +#endif + +#if (TMC260_DRV_NUM < 0) +#unfine TMC260_DRV_NUM +#define TMC260_DRV_NUM 0 +#endif + +//------------------------------------------------------------ + +typedef enum +{ + SC_MOTO1=1, + SC_MOTO2, + SC_MOTO3, + SC_MOTO4, + SC_MOTO5, + SC_MOTO6, +}SpiCs; + +//------------------------------------------------------------ + +void WriteStepDirConfig(SpiCs moto); +void WriteSpiCtrlConfig(SpiCs moto); +void WriteChopperConfig(SpiCs moto); +void WriteStallGuardConfig(SpiCs moto); +void WriteSmartEnergyConfig(SpiCs moto); +void WriteDriverConfig(SpiCs moto); +void ReadDriverState(SpiCs moto); + +void InitMotorDrivers(SpiCs moto); + +void SetStepDirMStepRes(SpiCs moto, u32 microstepResolution); +void SetStepDirInterpolation(SpiCs moto, u32 interpolation); +void SetStepDirDoubleEdge(SpiCs moto, u32 doubleEdge); +u32 GetStepDirMStepRes(SpiCs moto); +u32 GetStepDirInterpolation(SpiCs moto); +u32 GetStepDirDoubleEdge(SpiCs moto); +void SetChopperBlankTime(SpiCs moto, u32 blankTime); +void SetChopperMode(SpiCs moto, u32 mode); +void SetChopperRandomTOff(SpiCs moto, u32 randomTOff); +void SetChopperHysteresisDecay(SpiCs moto, u32 hysteresisDecay); +void SetChopperHysteresisEnd(SpiCs moto, u32 hysteresisEnd); +void SetChopperHysteresisStart(SpiCs moto, u32 hysteresisStart); +void SetChopperTOff(SpiCs moto, u32 tOff); +u32 GetChopperBlankTime(SpiCs moto); +u32 GetChopperMode(SpiCs moto); +u32 GetChopperRandomTOff(SpiCs moto); +u32 GetChopperHysteresisDecay(SpiCs moto); +u32 GetChopperHysteresisEnd(SpiCs moto); +u32 GetChopperHysteresisStart(SpiCs moto); +u32 GetChopperTOff(SpiCs moto); +void SetSmartEnergyIMin(SpiCs moto, u32 smartIMin); +void SetSmartEnergyDownStep(SpiCs moto, u32 smartDownStep); +void SetSmartEnergyStallLevelMax(SpiCs moto, u32 stallLevelMax); +void SetSmartEnergyUpStep(SpiCs moto, u32 smartUpStep); +void SetSmartEnergyStallLevelMin(SpiCs moto, u32 stallLevelMin); +u32 GetSmartEnergyIMin(SpiCs moto); +u32 GetSmartEnergyDownStep(SpiCs moto); +u32 GetSmartEnergyStallLevelMax(SpiCs moto); +u32 GetSmartEnergyUpStep(SpiCs moto); +u32 GetSmartEnergyStallLevelMin(SpiCs moto); +void SetStallGuardFilter(SpiCs moto, u32 enable); +void SetStallGuardThreshold(SpiCs moto, s32 threshold); +void SetStallGuardCurrentScale(SpiCs moto, u32 currentScale); +u32 GetStallGuardFilter(SpiCs moto); +s32 GetStallGuardThreshold(SpiCs moto); +u32 GetStallGuardCurrentScale(SpiCs moto); +void SetDriverSlopeHighSide(SpiCs moto, u32 slopeHighSide); +void SetDriverSlopeLowSide(SpiCs moto, u32 slopeLowSide); +void SetDriverDisableProtection(SpiCs moto, u32 disableProtection); +void SetDriverProtectionTimer(SpiCs moto, u32 protectionTimer); +void SetDriverStepDirectionOff(SpiCs moto, u32 sDOff); +void SetDriverVSenseScale(SpiCs moto, u32 scale); +void SetDriverReadSelect(SpiCs moto, u32 readSelect); +void SetDriverTestMode(SpiCs moto, u32 testMode); +u32 GetDriverSlopeHighSide(SpiCs moto); +u32 GetDriverSlopeLowSide(SpiCs moto); +u32 GetDriverDisableProtection(SpiCs moto); +u32 GetDriverProtectionTimer(SpiCs moto); +u32 GetDriverStepDirectionOff(SpiCs moto); +u32 GetDriverVSenseScale(SpiCs moto); +u32 GetDriverReadSelect(SpiCs moto); +u32 GetDriverTestMode(SpiCs moto); + +//------------------------------------------------------------ + +u32 GetPhases(SpiCs moto); +u32 GetMStepPos(SpiCs moto); +u32 GetStallGuard(SpiCs moto); +u32 GetSmartEnergy(SpiCs moto); +u32 GetDriverFlag(SpiCs moto); + +void DriveDisable(SpiCs moto); +void DriveEnable(SpiCs moto); + +//------------------------------------------------------------ + +void InitTmc260(void); + +void SetAsDriver(void); + +int GetResConfigFromLvnum(int subd); + +#endif + + diff --git a/NxFuncs/stiap/stapp.c b/NxFuncs/stiap/stapp.c new file mode 100644 index 0000000..7deb652 --- /dev/null +++ b/NxFuncs/stiap/stapp.c @@ -0,0 +1,493 @@ + +#define _IN_STAPP_C +#include "stapp.h" + +#if (APP_SAVE_TO != APP_SAVE_NONE) + +#include "crc32.h" +#include "cpuid.h" +#include "stiap.h" + +#include "stflash.h" + +//------------------------------------------------------------------------------- + + + + + +//------------------------------------------------------------------------------- + +// ļ + +//------------------------------------------------------------------------------- + +typedef struct +{ + char xorbuf[8]; + u8 xchgbuf[8]; + u32 datalen; + u32 bincrc; + u32 rnpucrc; + u32 hddatcrc; + u8 rev[1024-8-8-8-8]; +}GNPUHead; + +GNPUHead g_gnpuHead = +{ +#if (CUR_UPFL == GAUF_PMB1) // ͼ + { + 'G', 'O', 'A', 'P', 'M', 'B', 'O', 'S', + }, + { + 4, 6, 7, 2, 3, 5, 8, 1, + }, +#elif (CUR_UPFL == GAUF_EMB1) // 廨/߻ + { + 'G', 'O', 'A', 'E', 'M', 'B', 'O', 'S', + }, + { + 1, 3, 5, 2, 4, 8, 6, 7, + }, +#elif (CUR_UPFL == GAUF_EHA1) // ƽͷ + { + 'G', 'O', 'A', 'E', 'H', 'A', 'O', 'S', + }, + { + 5, 1, 3, 2, 7, 4, 8, 6, + }, +#elif (CUR_UPFL == GAUF_EHB1) // ߻ͷ + { + 'G', 'O', 'A', 'E', 'H', 'B', 'O', 'S', + }, + { + 1, 5, 2, 4, 3, 7, 6, 8, + }, +#elif (CUR_UPFL == GAUF_EMCLA1) // ƽ廻ɫ + { + 'G', 'O', 'A', 'E', 'C', 'L', 'A', '1', + }, + { + 6, 1, 7, 4, 2, 5, 3, 8, + }, +#elif (CUR_UPFL == GAUF_EXTIO) // չIO忨 +#else + { + 'R', 'P', 'U', 'P', 'D', 'A', 'T', 'E', + }, + { + 1, 2, 3, 4, 5, 6, 7, 8, + }, +#endif + 0, 0, 0, 0, + { + 0, + }, +}; + +// RNPU +int DecodeData(u8 * pBuf, int len) +{ + int i, j, k, num1; + u8 tpbuf[8], opbuf[8]; + u8 temp, mod; + + if (pBuf == NULL || len == 0) + { + return -1; + } + + for (i = 0; i < len && ((len - i) >= 8); i += 8) + { + // ÿ8ֽһݣ8ֽڵݣ + memcpy(tpbuf, &(pBuf[i]), 8); + + // ݽ8ֽڵ˳ + memcpy(opbuf, tpbuf, 8); + for (j = 0; j < 8; j++) + { + tpbuf[g_gnpuHead.xchgbuf[j]-1] = opbuf[j]; + } + + // λ1ĸ + num1 = 0; + for (j = 0; j < 8; j++) + { + mod = 0x01; + for (k = 0; k < 8; k++) + { + if ((tpbuf[j] & mod) != 0) + { + num1++; + } + mod *= 2; + } + } + + // ݸѭλƣżƣ + if ((num1 & 0x01) != 0) // + { + // ѭ + for (j = 0; j < num1; j++) + { + mod = tpbuf[7]; + for (k = 0; k < 8; k++) + { + temp = tpbuf[k]; + tpbuf[k] >>= 1; // + if ((mod & 0x01) != 0) + { + tpbuf[k] |= 0x80; + } + mod = temp; + } + } + } + else // ż + { + // ѭ + for (j = 0; j < num1; j++) + { + mod = tpbuf[0]; + for (k = 7; k >= 0; k--) + { + temp = tpbuf[k]; + tpbuf[k] <<= 1; // + if ((mod & 0x80) != 0) + { + tpbuf[k] |= 0x01; + } + mod = temp; + } + } + } + + // ݺͼַ + for (j = 0; j < 8; j++) + { + tpbuf[j] ^= g_gnpuHead.xorbuf[j]; + } + + // õյĽ + memcpy(&(pBuf[i]), tpbuf, 8); + } + + return 0; +} + +//------------------------------------------------------------------------------- + +typedef struct +{ + int enFlag; + int saveOffset; + int isrnpufile; + u32 bincrc; + u32 rnpucrc; + int rsvCounter; + +}SaveAppCtrl; + +SaveAppCtrl g_saveAppCtrl; + +void InitSaveApp(void) +{ + g_gnpuHead.datalen = 0; + g_gnpuHead.bincrc = 0; + g_gnpuHead.rnpucrc = 0; + g_gnpuHead.hddatcrc = 0; + + g_saveAppCtrl.saveOffset = 0; + g_saveAppCtrl.isrnpufile = 0; + + g_saveAppCtrl.bincrc = CRC32_INIT; + g_saveAppCtrl.rnpucrc = CRC32_INIT; + g_saveAppCtrl.rsvCounter = 0; + + IAPCleanUpdateArea(); // NORflashļ +} + +// һݵapp +int SaveAppData(int idx, u8 * pBuf, int len, u32 ofst) +{ + u32 addr, wtlen; + int i, thislen; + //printf("SaveAppData idx=%d, len=%d, ofst=0x%x\r\n", idx, len, ofst); + + if (idx < 0 || + pBuf == NULL || + (len != SUPPORT_LEN_1 && len != SUPPORT_LEN_2) || + 0 ) + { + printf("SaveAppData para err\r\n"); + return -1; + } + + // ļͷ + if (ofst == 0 && idx == 0 && g_saveAppCtrl.saveOffset < sizeof(g_gnpuHead)) + { + if (ofst == 0 && idx == 0) + { + printf("process file head\r\n"); + + if (memcmp(pBuf, g_gnpuHead.xorbuf, 8) == 0 && + memcmp(&(pBuf[8]), g_gnpuHead.xchgbuf, 8) == 0 && + 1 ) + { + u32 hdcrc, hddatsize; + g_saveAppCtrl.isrnpufile = 1; + // У + g_saveAppCtrl.bincrc = CRC32_INIT; + g_saveAppCtrl.rnpucrc = CRC32_INIT; + + g_gnpuHead.datalen = *((u32*)&(pBuf[16])); + g_gnpuHead.bincrc = *((u32*)&(pBuf[20])); + g_gnpuHead.rnpucrc = *((u32*)&(pBuf[24])); + g_gnpuHead.hddatcrc = *((u32*)&(pBuf[28])); + + hddatsize = sizeof(g_gnpuHead) - sizeof(g_gnpuHead.rev) - 4; + hdcrc = CalcCrc32((u8*)(&g_gnpuHead), hddatsize); + + if (hdcrc == g_gnpuHead.hddatcrc) + { + g_saveAppCtrl.rsvCounter = g_gnpuHead.datalen; + return 0; + } + else + { + printf("file head crc error\r\n"); + return -2; + } + } + else + { + printf("bin file not support\r\n"); // Ϊbinļȫ + return -1; + } + } + else + { + printf("file not correct\r\n"); + return 0; + } + } + else + { + } + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + addr = NOR_APP_ADDR; +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + addr = EXRAM_APP_ADDR; +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + addr = APP_ADDR_BEG; +#else + addr = 0; +#endif + + addr += ofst; + addr += ((idx-1)*len); // дַʹidx*len; ڶ,ߴݰʱַƫ + wtlen = len; + + g_saveAppCtrl.saveOffset += len; + + if (g_saveAppCtrl.isrnpufile != 0) + { + if (g_saveAppCtrl.rsvCounter > len) + { + thislen = len; + g_saveAppCtrl.rsvCounter -= len; + } + else + { + thislen = g_saveAppCtrl.rsvCounter; + g_saveAppCtrl.rsvCounter = 0; + } + for (i = 0; i < thislen; i++) + { + g_saveAppCtrl.rnpucrc = AddCrc32(g_saveAppCtrl.rnpucrc, pBuf[i]); + } + + DecodeData(pBuf, thislen); // + + for (i = 0; i < thislen; i++) + { + g_saveAppCtrl.bincrc = AddCrc32(g_saveAppCtrl.bincrc, pBuf[i]); + } + + for (i = thislen; i < len; i++) + { + pBuf[i] = 0xff; + } + } + else + { + thislen = len; + } + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + printf("save to norflash, addr=0x%lx, wtlen=%d\r\n", addr, wtlen); + DatFlashWrData(addr, pBuf, wtlen); +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + printf("save to exram, addr=0x%lx, wtlen=%d\r\n", addr, wtlen); + memcpy((void*)addr, (void*)pBuf, wtlen); +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + printf("save to in flash addr=0x%lx, wtlen=%d\r\n", addr, wtlen); + STMFlashWrite(addr, (u16*)pBuf, wtlen/2, 1); +#else + printf("not support addr=0x%lx, wtlen=%d\r\n", addr, wtlen); +#endif + return thislen; +} + +// жϽǷ +// ؽյ +int IsAppReceiveDone(void) +{ + return (int)g_gnpuHead.datalen - (int)g_saveAppCtrl.rsvCounter; +} + +u32 GetAppSaveDataCrc(u32 addr, u32 size) +{ +#define RD_DAT_BUF_LEN (1024) // ֽ + + // flashٴ֤ + u32 crc; + +#if (APP_SAVE_TO == APP_SAVE_EXRAM) + u8 rdata[RD_DAT_BUF_LEN]; +#else + u8 volatile rdata[RD_DAT_BUF_LEN]; +#endif + + int i, thislen, rsvlen; + rsvlen = size; + crc = CRC32_INIT; + + while(addr < APP_ADDR_BEG+size) + { + if (rsvlen > RD_DAT_BUF_LEN) + { + thislen = RD_DAT_BUF_LEN; + rsvlen -= RD_DAT_BUF_LEN; + } + else + { + thislen = rsvlen; + rsvlen = 0; + } +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + DatFlashRdData(addr, rdata, RD_DAT_BUF_LEN); // ȡһ +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + memcpy(rdata, (void*)addr, RD_DAT_BUF_LEN); +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + STMFlashRead(addr, (u16*)rdata, RD_DAT_BUF_LEN/2); +#else +#endif + + for (i = 0; i < thislen; i++) + { + crc = AddCrc32(crc, rdata[i]); + } + + addr += RD_DAT_BUF_LEN; // ַ + } + return crc; +} + + +int IsSaveDataCorrect(void) +{ + u32 crc, hddatsize; + int rslt; + + if (g_saveAppCtrl.isrnpufile == 0) + { + printf("g_isrnpufile == 0\r\n"); + return 0; + } + + hddatsize = sizeof(g_gnpuHead) - sizeof(g_gnpuHead.rev) - 4; // + crc = CalcCrc32((u8*)(&g_gnpuHead), hddatsize); + + rslt = -1; + + printf("check g_gnpuHead crc = 0x%lx \r\n",crc); + printf("g_gnpuHead.hddatcrc = 0x%lx \r\n",g_gnpuHead.hddatcrc); + printf("g_gnpuHead.bincrc = 0x%lx \r\n",g_gnpuHead.bincrc); + printf("g_saveAppCtrl.bincrc = 0x%lx \r\n",g_saveAppCtrl.bincrc); + printf("g_gnpuHead.rnpucrc = 0x%lx \r\n",g_gnpuHead.rnpucrc); + printf("g_saveAppCtrl.rnpucrc = 0x%lx \r\n",g_saveAppCtrl.rnpucrc); + printf("g_gnpuHead.datalen = 0x%lx \r\n",g_gnpuHead.datalen); + printf("g_saveAppCtrl.rsvCounter = 0x%lx \r\n",g_saveAppCtrl.rsvCounter); + + if (g_gnpuHead.hddatcrc == crc && + g_gnpuHead.bincrc == g_saveAppCtrl.bincrc && + g_gnpuHead.rnpucrc == g_saveAppCtrl.rnpucrc && + 1 ) + { + crc = GetAppSaveDataCrc(APP_ADDR_BEG, g_gnpuHead.datalen); + + printf("calc crc = 0x%x, g_gnpuHead.bincrc = 0x%x\r\n", crc, g_gnpuHead.bincrc); + + if (g_gnpuHead.bincrc == crc) + { + rslt = 0; + } + else + { + printf("re calc file data crc error\r\n"); + } + } + else + { + printf("receive file crc error\r\n"); + } + + return rslt; +} + + +// APP +void StartAppUpdate(int reboot) +{ + if (IsSaveDataCorrect() == 0) + { + u32 rdstart, wrstart, len, wtlen, check; + + rdstart = (APP_ADDR_BEG - APP_SAVE_BASE); + wrstart = (STM32_APP_ADDR - STM32_FLASH_BASE); // ļʼַ + len = g_gnpuHead.datalen; + wtlen = (g_gnpuHead.datalen + STM32_FLASH_RW_SIZE - 1) / STM32_FLASH_RW_SIZE; + wtlen *= STM32_FLASH_RW_SIZE; + check = g_gnpuHead.bincrc; + + printf("StartAppUpdate rdstart = 0x%x, wrstart = 0x%x, len = %d, wtlen = %d, wcrc=0x%x\r\n", rdstart, wrstart, len, wtlen, check); + + IapWritePara(rdstart, wrstart, len, wtlen, check); + +#if (1) // Ϊ֣Ҫ + RestartMcu(); // MCU +#else + if (reboot != 0) + { + RestartMcu(); // MCU + } + else + { + UpdateApp(); // ļ + JumpToApp(); // APP + } +#endif + } + else + { + printf("IsSaveDataCorrect failed\r\n"); + } +} + + +#endif + + + diff --git a/NxFuncs/stiap/stapp.h b/NxFuncs/stiap/stapp.h new file mode 100644 index 0000000..783d885 --- /dev/null +++ b/NxFuncs/stiap/stapp.h @@ -0,0 +1,76 @@ + +#ifndef __STAPP_H__ +#define __STAPP_H__ + +#include "config.h" + +//----------------------------------------------------- + +#define APP_SAVE_NONE 0 +#define APP_SAVE_NORFLASH 1 // ⲿnorflash +#define APP_SAVE_EXRAM 2 // ⲿRAM +#define APP_SAVE_INFLASH 3 // ֱFLASH(Cortex-M4ֹʹø÷ʽ) + +#ifndef APP_SAVE_TO +#define APP_SAVE_TO APP_SAVE_NONE // +#endif + +//----------------------------------------------------- + +// ļͷ +typedef struct +{ +// 0x00 + char fileName[32]; // ļ +// 0x20 + u32 dataSize; // ֽ + u32 dataChecksum; // ۼУ + +// 0x28 + u8 reserved1[0x30-0x28]; // 1 + +// 0x30 + u8 reserved2[0x64-0x30]; // 2 + +// 0x64 + u8 reserved3[0x80-0x64]; // 3 + +// 0x80 + u8 reserved4[0x100-0x80]; // 4 +}__attribute__ ((packed)) AppFileHead; + + +// ļƽṹ +typedef struct +{ + int enflag; // ļЧ־ + AppFileHead fileHead; // ļͷ + + u8 pAppBuff[1024]; // ݴ洢ַ + +}AppFileCtrl; + +//----------------------------------------------------- + +#ifdef _IN_STAPP_C +AppFileCtrl g_appFile; +#else +extern AppFileCtrl g_appFile; +#endif + +//----------------------------------------------------- + +// ֵ֧ݰ +#define SUPPORT_LEN_1 128 // for xmodem +#define SUPPORT_LEN_2 1024 // for xmodem or ethernet + +void InitSaveApp(void); +int SaveAppData(int idx, u8 * pBuf, int len, u32 ofst); +int IsAppReceiveDone(void); +int IsSaveDataCorrect(void); +void StartAppUpdate(int reboot); +u32 GetAppSaveDataCrc(u32 addr, u32 size); + +//----------------------------------------------------- + +#endif diff --git a/NxFuncs/stiap/stflash.c b/NxFuncs/stiap/stflash.c new file mode 100644 index 0000000..7c48388 --- /dev/null +++ b/NxFuncs/stiap/stflash.c @@ -0,0 +1,610 @@ + +#include "stflash.h" +#include "trigger.h" + +//-------------------------------------------------------------------- + +#define STM32_FLASH_TIMOUT -1 // ʱ +#define STM32_FLASH_OK 0 // +#define STM32_FLASH_BUSY 1 // æ +#define STM32_FLASH_ERROR 2 // + +//-------------------------------------------------------------------- + +#define MAX_WAIT_TIME 2000 // ȴʱ2 + +//-------------------------------------------------------------------- + +// ȴ +// waitmsȴʱ(ms) +int FlashWaitNoBusy(int waitms) +{ + int timout = waitms; + u32 timer; + u32 tick = GetMsSoftTimer(); + + do + { + if (READ_BIT(FLASH->SR, FLASH_SR_BSY) != (FLASH_SR_BSY)) + { + break; + } + timer = GetMsSoftTimer(); + + if ((timer - tick) > timout) + { + return STM32_FLASH_TIMOUT; + } + }while (1); + + if ((FLASH->SR & (FLASH_SR_EOP)) != 0) + { + CLEAR_BIT(FLASH->SR, FLASH_SR_EOP); + } +#if (0) + timer = GetMsSoftTimer(); + printf("FlashWaitNoBusy time=%d\r\n", timer - tick); +#endif + + return STM32_FLASH_OK; +} + +// ȡ״̬ +int FLASHGetStatus(void) +{ + u32 temp = FLASH->SR; + + if ((temp & FLASH_SR_BSY) != 0) + { + return STM32_FLASH_BUSY; // æ + } +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + if ((temp & ( FLASH_SR_WRPRTERR | // д + FLASH_SR_PGERR | // ̴ + 0 ) ) != 0) +#elif (__CORTEX_M == 4) + else if ((temp & ( FLASH_SR_WRPERR | // д + FLASH_SR_PGAERR | // ̶ + FLASH_SR_PGPERR | // λ + FLASH_SR_PGSERR | // ˳ + // FLASH_SR_RDERR | + 0 ) ) != 0) +#endif + { + return STM32_FLASH_ERROR; // + } + + return STM32_FLASH_OK; // +} + +// õ +int GetFlashSectorIdx(u32 faddr) +{ +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + if (faddr >= STM32_FLASH_BASE) + { + faddr -= STM32_FLASH_BASE; + if (faddr <= STM32_FLASH_SIZE) + { + faddr /= STM32_FLASH_SEC_SIZE; + if (faddr < STM32_FLASH_SEC_NUM) + { + return faddr; + } + } + } + +#elif (__CORTEX_M == 4) + +#define FLS_RGCK(ad) \ + if (faddr < STM32_FLASH_ADDR_SECTOR_##ad)\ + {\ + return (ad-1);\ + }\ + else \ +//------ + FLS_RGCK(0) + FLS_RGCK(1) + FLS_RGCK(2) + FLS_RGCK(3) + FLS_RGCK(4) + FLS_RGCK(5) + FLS_RGCK(6) + FLS_RGCK(7) + + if (faddr < STM32_FLASH_ADDR_SECTOR_7 + STM32_FLASH_SIZE_SECTOR_7) + { + return 7; + } +#endif + return -1; +} + +u32 GetFlashSectorBegAddr(u32 sidx) +{ + u32 addr = STM32_FLASH_BASE; + +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + + if (sidx < STM32_FLASH_SEC_NUM) + { + addr += sidx * STM32_FLASH_SEC_SIZE; + } + else + { + addr += STM32_FLASH_SIZE; + } + +#elif (__CORTEX_M == 4) + switch (sidx) + { + case 0: + addr = STM32_FLASH_ADDR_SECTOR_0; + break; + case 1: + addr = STM32_FLASH_ADDR_SECTOR_1; + break; + case 2: + addr = STM32_FLASH_ADDR_SECTOR_2; + break; + case 3: + addr = STM32_FLASH_ADDR_SECTOR_3; + break; + case 4: + addr = STM32_FLASH_ADDR_SECTOR_4; + break; + case 5: + addr = STM32_FLASH_ADDR_SECTOR_5; + break; + case 6: + addr = STM32_FLASH_ADDR_SECTOR_6; + break; + case 7: + addr = STM32_FLASH_ADDR_SECTOR_7; + break; + default: + break; + } +#endif + return addr; +} + +int GetFlashSectorSize(u32 sidx) +{ + int size = 0; + +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + + size = STM32_FLASH_SEC_SIZE; +#elif (__CORTEX_M == 4) + switch (sidx) + { + case 0: + size = STM32_FLASH_SIZE_SECTOR_0; + break; + case 1: + size = STM32_FLASH_SIZE_SECTOR_1; + break; + case 2: + size = STM32_FLASH_SIZE_SECTOR_2; + break; + case 3: + size = STM32_FLASH_SIZE_SECTOR_3; + break; + case 4: + size = STM32_FLASH_SIZE_SECTOR_4; + break; + case 5: + size = STM32_FLASH_SIZE_SECTOR_5; + break; + case 6: + size = STM32_FLASH_SIZE_SECTOR_6; + break; + case 7: + size = STM32_FLASH_SIZE_SECTOR_7; + break; + default: + break; + } +#endif + return size; +} + +int GetSecRemainSize(u32 faddr) +{ + int sidx = GetFlashSectorIdx(faddr); + int slen = GetFlashSectorSize(sidx); + u32 baddr = GetFlashSectorBegAddr(sidx); + if (sidx < 0 || slen <= 0) + { + return -1; + } + + return (baddr + slen - faddr); +} + +//-------------------------------------------------------------------- + +// +void FLASHUnlock() +{ +// printf("FLASHUnlock beg\r\n"); + + if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET) + { + WRITE_REG(FLASH->KEYR, FLASH_KEY1); + WRITE_REG(FLASH->KEYR, FLASH_KEY2); + } + + while((READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET)) + {} +// printf("FLASHUnlock ok\r\n"); +} + +// +void FLASHLock() +{ +// printf("FLASHLock\r\n"); + + SET_BIT(FLASH->CR, FLASH_CR_LOCK); // +} + +// STM32 flash д +// ȡַָİ +// faddr:ַ(˵ַΪ2ı) +// data: +void FLASHProgramHalfWord(uint32_t faddr, uint16_t data) +{ +#if (__CORTEX_M == 4) + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + SET_BIT(FLASH->CR, FLASH_PSIZE_HALF_WORD); // д +#endif + SET_BIT(FLASH->CR, FLASH_CR_PG); // + + *(__IO uint16_t*)faddr = data; +} + +// STM32 flash +// ȡַָİ(16λ) +// faddr:ַ(˵ַΪ2ı) +// ֵ:Ӧ +u16 FlashRDHalfWord(u32 faddr) +{ + return *( __IO uint16_t*)faddr; +} + +// +void FLASHEraseSector(uint32_t secIdx) +{ +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + SET_BIT(FLASH->CR, FLASH_CR_PER); + WRITE_REG(FLASH->AR, secIdx * STM32_FLASH_SEC_SIZE + STM32_FLASH_BASE); + SET_BIT(FLASH->CR, FLASH_CR_STRT); +#elif (__CORTEX_M == 4) + CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE); + SET_BIT(FLASH->CR, FLASH_PSIZE_HALF_WORD); // д + SET_BIT(FLASH->CR, FLASH_CR_SER); // òʽ + + CLEAR_BIT(FLASH->CR, FLASH_CR_SNB); // ַ + FLASH->CR |= (secIdx << FLASH_CR_SNB_Pos); // õַ + SET_BIT(FLASH->CR, FLASH_CR_STRT); // ʼ +#endif +} + +//----------------------------------------------- + +// д +// wrAddr: ʼַ +// pBuffer: ָ +// hwNumToWrite: (16λ) +int STMFlashWrNoCheck(u32 wrAddr, u16 *pBuffer, u16 hwNumToWrite) +{ + int rslt; + u16 i; + for (i = 0; i < hwNumToWrite; i++) + { + FLASHProgramHalfWord(wrAddr, *pBuffer); + pBuffer++; + wrAddr += 2; // ַ2 + + // ȴд + rslt = FlashWaitNoBusy(MAX_WAIT_TIME); + if (rslt != STM32_FLASH_OK) + { + rslt = FLASHGetStatus(); + break; + } + FLASH->CR &= (~FLASH_CR_PG); + } + return rslt; +} + + +//----------------------------------------------- +// + +int FLASHEraseSectorProc(uint32_t secIdx) +{ + int rslt; + + if (secIdx < 0 || secIdx >= STM32_FLASH_SEC_NUM) + { + return STM32_FLASH_ERROR; + } + + rslt = FlashWaitNoBusy(MAX_WAIT_TIME); + if (rslt != STM32_FLASH_OK) + { + rslt = FLASHGetStatus(); + return rslt; + } + + FLASHEraseSector(secIdx); + + rslt = FlashWaitNoBusy(MAX_WAIT_TIME); + if (rslt != STM32_FLASH_OK) + { + rslt = FLASHGetStatus(); + return rslt; + } +#if (__CORTEX_M == 0 || __CORTEX_M == 3) + CLEAR_BIT(FLASH->CR, FLASH_CR_PER); +#elif (__CORTEX_M == 4) + CLEAR_BIT(FLASH->CR, (FLASH_CR_SER | FLASH_CR_SNB)); +#endif + + return STM32_FLASH_OK; +} + +//----------------------------------------------- + + +void STMFlashUnlock() +{ + FLASHUnlock(); +} + +void STMFlashLock() +{ + FLASHLock(); +} + +int STMFlashErase(u32 secIdx, int secnums) +{ + int rslt = 0; + + FLASHUnlock(); + + for (int i = 0; i < secnums; i++) + { + rslt = FLASHEraseSectorProc(secIdx); + if (rslt != STM32_FLASH_OK) + { + printf("STMFlashErase error, rslt=%d\r\n", rslt); + rslt = -1; + break; + } +#if (0) + if (STMFlashCheck(secIdx * STM32_FLASH_SEC_SIZE + STM32_FLASH_BASE, 0, STM32_FLASH_SEC_SIZE) != 0) + { + printf("STMFlashErase and STMFlashCheck err, \r\n"); + } +#endif + secIdx++; + } + + FLASHLock(); // + + return rslt; +} +//----------------------------------------------- + +// ַָʼָȵ +// rdAddr: ʼַ +// pBuffer: ָ +// hwNumOfRead: (16λ) +int STMFlashRead(u32 rdAddr, u16 * pBuffer, u16 hwNumOfRead) +{ + u16 i; + if (pBuffer == NULL || + rdAddr < STM32_FLASH_BASE || + rdAddr + hwNumOfRead*2 > STM32_FLASH_BASE+STM32_FLASH_SIZE) + { + return -1; + } + + for (i = 0; i < hwNumOfRead; i++) + { + *pBuffer = FlashRDHalfWord(rdAddr); // ȡ2ֽ + pBuffer++; + rdAddr += 2; // ַ2 + } + return 0; +} + +// ַָʼȽָȵǷһ +// ckAddr: ʼַ +// pBuffer: ָ +// hwNumOfChekc: (16λ) +// ֵ: 0, ȫ +// +int STMFlashCheck(u32 ckAddr, u16 * pBuffer, u16 hwNumOfChekc) +{ + int i; + u16 tprd, tpdat; + for(i = 0; i < hwNumOfChekc; i++) + { + tprd = FlashRDHalfWord(ckAddr); // ȡ2ֽ + if (pBuffer != NULL) + { + tpdat = *pBuffer; + } + else + { + tpdat = 0xffff; + } + if (tpdat != tprd) + { + printf("STMFlashCheck error, tpdat=0x%x, tprd=0x%x, i=%d\r\n", tpdat, tprd, i); + return 1; + } + + if (pBuffer != NULL) + { + pBuffer++; + } + ckAddr += 2; // ַ2 + } + return 0; +} + +// ַָʼдָȵ +// wrAddr: ʼַ(˵ַΪ2ı) +// pBuffer: ָ +// hwNumToWrite: (16λ)(Ҫд16λݵĸ) +// svwhenera == 0, ʱд֮ +// svwhenera == 1, ʱд֮ǰ +// svwhenera == 2, ʱд֮ +// svwhenera == 3, ʱд֮ + +// ʹsdram һοռ䣨128K + +int STMFlashWrite(u32 wrAddr, u16 * pBuffer, u16 hwNumToWrite, int svwhenera) +{ + int rslt; + u16 * thiswrbuff; + + u32 addr, addrEnd, thiswraddr; + u32 wrlen, thiswrlen; + int thissidx, thisslen; + u32 thisaddr, thislen; + +#if (NO_BUFF_WHEN_WT == 0) + u32 i; + + u16 tempbuf[STM32_FLASH_SEC_SIZE/2]; + +#endif + + addr = wrAddr; + wrlen = hwNumToWrite * 2; + addrEnd = wrAddr + wrlen; + + if (wrAddr < STM32_FLASH_BASE || (addrEnd > (STM32_FLASH_BASE + STM32_FLASH_SIZE))) + { + return -1; // Ƿַ + } + + FLASHUnlock(); // flash + + // + while (addr < addrEnd) + { + thisaddr = addr; // ʼַ + + thissidx = GetFlashSectorIdx(thisaddr); + thisslen = GetFlashSectorSize(thissidx); + if (thissidx < 0 || thisslen <= 0) + { + return -1; + } + + thislen = GetSecRemainSize(thisaddr); // ʣ೤ + if (thislen > wrlen) + { + thislen = wrlen; + } + + rslt = FlashWaitNoBusy(MAX_WAIT_TIME); + if (rslt != STM32_FLASH_OK) + { + rslt = FLASHGetStatus(); + printf("STMFlashWrite error, FlashWaitNoBusy=%d\r\n", rslt); + return rslt; + } + +#if (NO_BUFF_WHEN_WT == 0) + // жǷҪ + STMFlashRead(thisaddr, tempbuf, thislen/2); // + for (i = 0; i < thislen/2; i++) // ǷҪ + { + #if (1) // st ڲ flash ֧дflashijЩ1λ0λ flash֧֣ + if (tempbuf[i] != 0xffff) // ֻҪȫ1, Ͳ + #else + if ((tempbuf[i] & pBuffer[i]) != pBuffer[i]) // ֮󣬺ҪдͬԲ + #endif + { + break; // Ҫ + } + } + + if (i < thislen/2) // Ҫ + { + u32 secbegaddr; + u8* wrbufaddr; + + // printf("\r\nErase sector %d\r\n", thissidx); + secbegaddr = GetFlashSectorBegAddr(thissidx); + + // ȡ + if (thisaddr != secbegaddr || thislen != thisslen) + { + STMFlashRead(secbegaddr, tempbuf, thisslen/2); + } + + // + if (FLASHEraseSectorProc(thissidx) != STM32_FLASH_OK) // + { + printf("\r\nErase sector %d error\r\n", thissidx); + break; + } + + // Ҫдݵ + wrbufaddr = (u8*)tempbuf; + wrbufaddr += thisaddr-secbegaddr; + memcpy(wrbufaddr, pBuffer, thislen); + + if (svwhenera == 0) // ʱд֮ + { + thiswraddr = thisaddr; + thiswrbuff = pBuffer; + thiswrlen = thislen; + } + else if (svwhenera == 1) // ʱд֮ǰ + { + thiswraddr = secbegaddr; + thiswrbuff = tempbuf; + thiswrlen = thislen + (thisaddr - secbegaddr); + } + else if (svwhenera == 2) // ʱд֮ + { + thiswraddr = thisaddr; + thiswrbuff = (u16*)wrbufaddr; + thiswrlen = thisslen - (thisaddr - secbegaddr); + } + else // if (svwhenera == 3) // ʱд֮ + { + thiswraddr = secbegaddr; + thiswrbuff = tempbuf; + thiswrlen = thisslen; // + } + } + else +#endif + { + thiswraddr = thisaddr; + thiswrbuff = pBuffer; + thiswrlen = thislen; + } + + // д + STMFlashWrNoCheck(thiswraddr, thiswrbuff, thiswrlen / 2); // д + pBuffer += thislen; + addr += thislen; + wrlen -= thislen; + } + + FLASHLock(); // + + return 0; +} diff --git a/NxFuncs/stiap/stflash.h b/NxFuncs/stiap/stflash.h new file mode 100644 index 0000000..e1a055c --- /dev/null +++ b/NxFuncs/stiap/stflash.h @@ -0,0 +1,139 @@ + +#ifndef __STFLASH_H__ +#define __STFLASH_H__ + +#include "config.h" + +#ifndef STM32_FLASH_BASE +#define STM32_FLASH_BASE FLASH_BASE // STM32 FLASH ʼַ +#endif + +#ifdef FLASH_END +#define STM32_FLASH_SIZE (FLASH_END - FLASH_BASE + 1) // ѡSTM32FLASHС(λΪֽ) +#else +#ifdef FLASH_BANK1_END +#define STM32_FLASH_SIZE (FLASH_BANK1_END - FLASH_BASE + 1) // ѡSTM32FLASHС(λΪֽ) +#endif +#endif + + + + +#if (__CORTEX_M == 0) +/* + С64Kÿ洢黮Ϊ1Kֽڵҳ(F03x, F04x, F05x) + + ڵ128Kÿ洢黮Ϊ2Kֽڵҳ(F07x, F09x) + + +*/ +#if (STM32_FLASH_SIZE <= (64*1024)) + #define STM32_FLASH_SEC_SIZE (1*1024) // +#else + #define STM32_FLASH_SEC_SIZE (2*1024) // +#endif + +#define STM32_FLASH_SEC_NUM (STM32_FLASH_SIZE/STM32_FLASH_SEC_SIZE) // + +#define STM32_FLASH_RW_SIZE (STM32_FLASH_SEC_SIZE) // ÿζдֽ + +#elif (__CORTEX_M == 3) + +/* + СƷ洢Ϊ4K64λÿ洢黮Ϊ321Kֽڵҳ + Ʒ洢Ϊ16K64λÿ洢黮Ϊ1281Kֽڵҳ + Ʒ洢Ϊ64K64λÿ洢黮Ϊ2562Kֽڵҳ + ͲƷ洢Ϊ32K64λÿ洢黮Ϊ1282Kֽڵҳ +*/ + +#if (STM32_FLASH_SIZE <= (128*1024)) + #define STM32_FLASH_SEC_SIZE (1*1024) // ÿֽ 1Kֽ +#else + #define STM32_FLASH_SEC_SIZE (2*1024) // ÿֽ 2Kֽ +#endif + +#define STM32_FLASH_SEC_NUM (STM32_FLASH_SIZE/STM32_FLASH_SEC_SIZE) // + +#define STM32_FLASH_RW_SIZE (STM32_FLASH_SEC_SIZE) // ÿζдֽ + + +#elif (__CORTEX_M == 4) + +// STM32 FLASH ʼַ +#define STM32_FLASH_ADDR_SECTOR_0 ((u32)(STM32_FLASH_BASE + 0x000000)) // 0 ʼַ, 16 Kbytes +#define STM32_FLASH_ADDR_SECTOR_1 ((u32)(STM32_FLASH_BASE + 0x004000)) // 1 ʼַ, 16 Kbytes +#define STM32_FLASH_ADDR_SECTOR_2 ((u32)(STM32_FLASH_BASE + 0x008000)) // 2 ʼַ, 16 Kbytes +#define STM32_FLASH_ADDR_SECTOR_3 ((u32)(STM32_FLASH_BASE + 0x00C000)) // 3 ʼַ, 16 Kbytes +#define STM32_FLASH_ADDR_SECTOR_4 ((u32)(STM32_FLASH_BASE + 0x010000)) // 4 ʼַ, 64 Kbytes +#define STM32_FLASH_ADDR_SECTOR_5 ((u32)(STM32_FLASH_BASE + 0x020000)) // 5 ʼַ, 128 Kbytes +#define STM32_FLASH_ADDR_SECTOR_6 ((u32)(STM32_FLASH_BASE + 0x040000)) // 6 ʼַ, 128 Kbytes +#define STM32_FLASH_ADDR_SECTOR_7 ((u32)(STM32_FLASH_BASE + 0x060000)) // 7 ʼַ, 128 Kbytes + +#if (STM32_FLASH_SIZE > (512*1024)) +#define STM32_FLASH_ADDR_SECTOR_8 ((u32)(STM32_FLASH_BASE + 0x080000)) // 8 ʼַ, 128 Kbytes +#define STM32_FLASH_ADDR_SECTOR_9 ((u32)(STM32_FLASH_BASE + 0x0A0000)) // 9 ʼַ, 128 Kbytes +#define STM32_FLASH_ADDR_SECTOR_10 ((u32)(STM32_FLASH_BASE + 0x0C0000)) // 10 ʼַ, 128 Kbytes +#define STM32_FLASH_ADDR_SECTOR_11 ((u32)(STM32_FLASH_BASE + 0x0E0000)) // 11 ʼַ, 128 Kbytes + +#define STM32_FLASH_SEC_NUM 12 +#else +#define STM32_FLASH_SEC_NUM 8 // +#endif + +#define STM32_FLASH_SIZE_SECTOR_0 ((u32)(16*1024)) // 0 С, 16 Kbytes +#define STM32_FLASH_SIZE_SECTOR_1 ((u32)(16*1024)) // 1 С, 16 Kbytes +#define STM32_FLASH_SIZE_SECTOR_2 ((u32)(16*1024)) // 2 С, 16 Kbytes +#define STM32_FLASH_SIZE_SECTOR_3 ((u32)(16*1024)) // 3 С, 16 Kbytes +#define STM32_FLASH_SIZE_SECTOR_4 ((u32)(64*1024)) // 4 С, 64 Kbytes +#define STM32_FLASH_SIZE_SECTOR_5 ((u32)(128*1024)) // 5 С, 128 Kbytes +#define STM32_FLASH_SIZE_SECTOR_6 ((u32)(128*1024)) // 6 С, 128 Kbytes +#define STM32_FLASH_SIZE_SECTOR_7 ((u32)(128*1024)) // 7 С, 128 Kbytes + +#if (STM32_FLASH_SIZE > (512*1024)) +#define STM32_FLASH_SIZE_SECTOR_8 ((u32)(128*1024)) // 8 С, 128 Kbytes +#define STM32_FLASH_SIZE_SECTOR_9 ((u32)(128*1024)) // 9 С, 128 Kbytes +#define STM32_FLASH_SIZE_SECTOR_10 ((u32)(128*1024)) // 10 С, 128 Kbytes +#define STM32_FLASH_SIZE_SECTOR_11 ((u32)(128*1024)) // 11 С, 128 Kbytes +#endif + +#define STM32_FLASH_RW_SIZE (2*1024) // ÿζдֽ + +#endif + +#define STM32_APP_ADDR (STM32_FLASH_BASE+STM32_BOOT_SIZE) // Ӧóʼַ(FLASH) + +#ifndef STF_UPDATE_SIZE +#define STF_UPDATE_SIZE (0) // ļ洢ĴС +#endif + +#ifndef STM32_PARA_SIZE +#define STM32_PARA_SIZE (0) // 洢С +#endif + +#ifdef STM32_FLASH_SEC_SIZE +#define MARK_SIZE (STM32_FLASH_RW_SIZE) // ־洢ĴС + +#define STF_UPDATE_BEGIN (STM32_FLASH_BASE+STM32_FLASH_SIZE-STM32_PARA_SIZE-STF_UPDATE_SIZE-MARK_SIZE) + +#define STM32_PARA_ADDR (STM32_FLASH_BASE+STM32_FLASH_SIZE-STM32_PARA_SIZE) + +#endif + +//------------------------------------------------------------------------- +// Cortex-M4,FLASHСһ,޻д +#ifndef NO_BUFF_WHEN_WT +#define NO_BUFF_WHEN_WT 0 +#endif + +//------------------------------------------------------------------------- +int GetFlashSectorIdx(u32 faddr); + +int STMFlashErase(u32 secIdx, int secnums); +int STMFlashRead(u32 rdAddr, u16 * pBuffer, u16 hwNumToWrite); +int STMFlashCheck(u32 ckAddr, u16 * pBuffer, u16 hwNumOfChekc); +int STMFlashWrite(u32 wrAddr, u16 * pBuffer, u16 hwNumToWrite, int svwhenera); + +//------------------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/stiap/stiap.c b/NxFuncs/stiap/stiap.c new file mode 100644 index 0000000..53e617f --- /dev/null +++ b/NxFuncs/stiap/stiap.c @@ -0,0 +1,453 @@ + +#include "stiap.h" + +#include "stapp.h" + +#include "crc32.h" +#include "trigger.h" +#include "shell.h" +#include "delay.h" + +#if (0) // ʱʩ, +#include "can.h" +#include "fmc.h" +#endif + +//=================================================================== +// IAP +// stfaddr: Ӧóʼַ +// saveaddr: Ӧó NORFLASH RAM ʼַ. +// size: ӦóС ֽڣ + +int WriteAppBinData(u32 stfaddr, u32 saveaddr, u32 size) +{ + int rslt = 0; + u32 faddr = stfaddr; + u32 saddr = saveaddr; + u32 wrsize = size; + u16 thissize; +#ifdef STM32_FLASH_SEC_SIZE // ÿֽ +#define STM32_RW_BUFF_SIZE (STM32_FLASH_SEC_SIZE) +#else +#define STM32_RW_BUFF_SIZE (STM32_FLASH_RW_SIZE) +#endif + + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH || APP_SAVE_TO == APP_SAVE_INFLASH) + u8 iapbuf[STM32_RW_BUFF_SIZE]; +#else + u8 * iapbuf; +#endif + +#if (NO_BUFF_WHEN_WT == 1) // 20230928 ljs ޻дʱǰӦ,дʧ + u32 secIdx = GetFlashSectorIdx(faddr); + u32 secnums = GetFlashSectorIdx(faddr+wrsize); + secnums = secnums - secIdx + 1; + STMFlashErase(secIdx, secnums); +#endif + + printf("Write data to addr = 0x%x begin\r\n", (unsigned int)faddr); + while (wrsize > 0) + { + if (wrsize < STM32_RW_BUFF_SIZE) + { + thissize = wrsize; + } + else + { + thissize = STM32_RW_BUFF_SIZE; + } + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + DatFlashRdData(saddr, iapbuf, thissize); // norflash +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + iapbuf = (u8*)saddr; // ram +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + STMFlashRead(saddr, (u16*)iapbuf, thissize/2); // st flash +#else + break; +#endif + + STMFlashWrite(faddr, (u16*)iapbuf, thissize/2, 1); // дݵstm32flash + + rslt = STMFlashCheck(faddr, (u16*)iapbuf, thissize/2); // ȷ + if (rslt != 0) + { + printf("\r\nWriteAppBinData error. addr=0x%x, size=%d\r\n", (unsigned int)faddr, thissize); + break; + } + PutChar('.'); + faddr += thissize; // ָƫ + saddr += thissize; // ָƫ + wrsize -= thissize; + } + + printf("write data finish\r\n"); + +#if (APP_SAVE_TO == APP_SAVE_EXRAM) + if (rslt == 0) + { + // У + printf("WriteAppBinData finish, check all data\r\n"); + rslt = STMFlashCheck(stfaddr, (u16*)saveaddr, size/2); // ȷ + if (rslt == 0) + { + printf("WriteAppBinData ok\r\n"); + } + } +#endif + + if (rslt != 0) + { + printf("WriteAppBinData failed\r\n"); + } + + return rslt; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// 20230523 ʹⲿRAM +#if (APP_SAVE_TO == APP_SAVE_EXRAM) +char g_appEnFlag[16] = {0xff}; +void SetAppEnFlag(int flag) +{ + if (flag == 0) + { + memset(g_appEnFlag, 0xff, 16); + } + else + { + strcpy(g_appEnFlag, APP_RIGHT); + } +} + +int IsAppRight(void) +{ + if (strcmp((void*)APP_RIGHT, g_appEnFlag) != 0) + { + return -1; + } + else + { + return 0; + } +} + +#endif + + +////////////////////////////////////////////////////////////////////////////////////////////////////// + +// bootloader ӿں +// ļӴ洢APP +int UpdateApp(void) +{ + int rslt = 0; + u32 saveaddr; // ݶȡַ + u32 stfaddr; // дַ + u32 appsize, wsize; + u32 crc; + IapHead iaphd; + u32 resetaddr, stacktop; + + memset(&iaphd, 0, sizeof(IapHead)); + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + u32 taddr = (u32)(&iaphd); + DatFlashRdData(APP_MARK_ADDR, (u8 *)(taddr), sizeof(IapHead)/sizeof(u8)); // +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + memcpy((void*)(&iaphd), (void*)APP_MARK_ADDR, sizeof(IapHead)); // iaphead + SetAppEnFlag(1); +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + u32 taddr = (u32)(&iaphd); + STMFlashRead(APP_MARK_ADDR, (u16*)(taddr), sizeof(IapHead)/sizeof(u16)); +#endif + + crc = CalcCrc32((u8*)&(iaphd), sizeof(IapHead)-sizeof(iaphd.checkcrc)); // У֮ǰֶ + + printf("UpdateApp begin\r\n"); +#if (0) + printf("iaphd.upmask=%s\r\n", iaphd.upmask); + printf("iaphd.rdaddr=0x%x\r\n", iaphd.rdaddr); + printf("iaphd.wraddr=0x%x\r\n", iaphd.wraddr); + printf("iaphd.size=0x%x\r\n", iaphd.size); + printf("iaphd.wsize=0x%x\r\n", iaphd.wsize); + printf("iaphd.appcheck=0x%x\r\n", iaphd.appcheck); + printf("calc iaphd crc = 0x%x, save iaphd.checkcrc = 0x%x\r\n", crc, iaphd.checkcrc); +#endif + + // У + if (crc != iaphd.checkcrc) + { + printf("updatedata checkcrc err\r\n"); + return -1; // У + } + + if (strcmp((void*)STM32_MARK, iaphd.upmask) != 0) // Ƚ + { + printf("updatedata upmask err\r\n"); + return 0; // һ, + } + + saveaddr = iaphd.rdaddr + APP_SAVE_BASE; // ȡַ + stfaddr = iaphd.wraddr + STM32_FLASH_BASE; // дַ + appsize = iaphd.size; + wsize = iaphd.wsize; + + if ((stfaddr < STM32_APP_ADDR) || + (stfaddr >= (STM32_FLASH_BASE + STM32_FLASH_SIZE)) || + (saveaddr < APP_ADDR_BEG) || + 0 ) // ַҪ + { + printf("flash addr error\r\n"); + return -2; + } + + crc = GetAppSaveDataCrc(saveaddr, appsize); + + if (crc != iaphd.appcheck) + { + printf("save data crc check error, crc=0x%x, appcheck=0x%x\r\n", crc, iaphd.appcheck); + return -2; + } + + // Ӵ洢жȡλַջַ +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + { + u8 buff[8]; + DatFlashRdData(APP_ADDR_BEG, buff, 8); + stacktop = *(__IO uint32_t*)(buff); // ջַ + resetaddr = *(__IO uint32_t*)(buff+4); // λַ + } +#elif (APP_SAVE_TO == APP_SAVE_EXRAM || APP_SAVE_TO == APP_SAVE_INFLASH) + stacktop = *(__IO uint32_t*)(APP_ADDR_BEG); // ջַ + resetaddr = *(__IO uint32_t*)(APP_ADDR_BEG+4); // λַ +#else + return -2; +#endif + + printf("save file stacktop = 0x%x, resetaddr=0x%x\r\n", (unsigned int)stacktop, (unsigned int)resetaddr); + if ((resetaddr >= STM32_APP_ADDR) && + ((resetaddr & 0xFF000000) == 0x08000000) && // жǷΪ0X08XXXXXX + ((stacktop & 0x2FFC0000) == 0x20000000) && // ջַǷϷ + 1 ) + { + printf("save data ok\r\n"); + } + else + { + printf("save data not right\r\n"); + return -2; + } +#if (APP_SAVE_TO == APP_SAVE_EXRAM) + SetAppEnFlag(0); // appȷ־.... +#endif + printf("UpdateApp: from add=0x%x to stadd=0x%x, size=%d, wsize=%d\r\n", saveaddr, stfaddr, appsize, wsize); + + rslt = WriteAppBinData(stfaddr, saveaddr, wsize); // FLASH + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + DatFlash4kErase(APP_MARK_ADDR, 1); // , ־, +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + memset((void*)APP_MARK_ADDR, 0xff, IAPHEAD_LEN); // ȫдΪ0xff +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + STMFlashErase(GetFlashSectorIdx(APP_MARK_ADDR), 1); +#endif + +#if (APP_SAVE_TO == APP_SAVE_EXRAM) + if (rslt == 0) + { + SetAppEnFlag(1); + } +#endif + return rslt; +} + +// ر +__WEAK void CloseAllPeripheral() +{ + __disable_irq(); // رж + +#if (0) // ʱʩ, + HAL_DeInit(); + + LL_GPIO_DeInit(GPIOA); + LL_GPIO_DeInit(GPIOB); + LL_GPIO_DeInit(GPIOC); + LL_GPIO_DeInit(GPIOD); + LL_GPIO_DeInit(GPIOE); + LL_GPIO_DeInit(GPIOF); + LL_GPIO_DeInit(GPIOG); + + LL_EXTI_DeInit(); + + HAL_ADC_DeInit(&hadc3); + + HAL_CAN_DeInit(&HCAN); + + HAL_SRAM_DeInit(&hsram1); + HAL_SRAM_DeInit(&hsram2); + HAL_SRAM_DeInit(&hsram3); + HAL_SRAM_DeInit(&hsram4); + + LL_SPI_DeInit(SPI1); + LL_SPI_DeInit(SPI2); + + LL_TIM_DeInit(TIM1); + LL_TIM_DeInit(TIM2); + LL_TIM_DeInit(TIM3); + LL_TIM_DeInit(TIM4); + LL_TIM_DeInit(TIM5); + LL_TIM_DeInit(TIM6); + LL_TIM_DeInit(TIM7); + LL_TIM_DeInit(TIM8); + + LL_USART_DeInit(USART1); + LL_USART_DeInit(USART2); + LL_USART_DeInit(USART3); + LL_USART_DeInit(UART4); + LL_USART_DeInit(UART5); +#else + LL_EXTI_DeInit(); +#endif + + __disable_irq(); // رж +} + +//=================================================================== + +// תӦó +int JumpToApp(void) +{ + typedef void (*iapfun)(void); // һ͵IJ. + int rslt; + u32 resetaddr, stacktop; + + printf("Begin run app\r\n"); + + // flashжȡλַջַ + stacktop = *(__IO uint32_t*)(STM32_APP_ADDR); // ջַ + resetaddr = *(__IO uint32_t*)(STM32_APP_ADDR+4); // λַ + rslt = 0; + +#if (APP_SAVE_TO == APP_SAVE_EXRAM) + rslt = IsAppRight(); +#endif + + printf("stacktop = 0x%x, resetaddr=0x%x\r\n", (unsigned int)stacktop, (unsigned int)resetaddr); + + DelayMs(100); + + if ( (rslt == 0) && + (resetaddr >= STM32_APP_ADDR) && + ((resetaddr & 0xFF000000) == 0x08000000) && // жǷΪ0X08XXXXXX + ((stacktop & 0x2FFC0000) == 0x20000000) && // ջַǷϷ + 1 ) + { + iapfun jump; + + printf("Jump to app address\r\n"); + + DelayMs(100); + + CloseAllPeripheral(); + DelayMs(100); + + jump = (iapfun)(resetaddr); // ûڶΪʼַ(λַ) + __set_MSP(stacktop); // ʼ APP ջָ (ûĵһڴջַ) + jump(); // תAPP. + } + + printf("run app failed\r\n"); + + return -1; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// app iapģ鹦ܽӿں + +void IAPCleanUpdateArea(void) +{ +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + // norflash Ŀ + u32 addr; + int erflag; + int count = 0; + + printf("IAPCleanUpdateArea, erase begin\r\n"); + + addr = NOR_SAVE_BASE; + while(addr < NOR_SAVE_END) + { + erflag = IsDatFlashEmpty(addr, SNF_BYTES_PER_SEC); // жһǷΪ + + if (erflag != 0) + { + DatFlash4kErase(addr, 1); // һ + PutChar('.'); + count++; + //erflag = IsDatFlashEmpty(addr, SNF_BYTES_PER_SEC); // жһǷΪ + //printf("erase failed, addr=%d, idx=%d, flag=%d\r\n", addr, (addr-NOR_SAVE_BASE)/SNF_BYTES_PER_SEC, erflag); + } + addr += SNF_BYTES_PER_SEC; // ַ + } + + printf("IAPCleanUpdateArea finish, count=%d\r\n", count); +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + memset((void*)EXRAM_SAVE_BASE, 0xff, STM32_FLASH_SIZE); // ȫдΪ0xff +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + STMFlashErase(GetFlashSectorIdx(APP_SAVE_BASE), (STF_UPDATE_SIZE+MARK_SIZE)/STM32_FLASH_SEC_SIZE); +#endif +} + +// дʼַ, Ⱥ־ +void IapWritePara(u32 rdAddr, u32 wrAddr, u32 len, u32 wlen, u32 check) +{ + // ݳȱΪ(STM32_FLASH_SEC_SIZE) + IapHead iaphd; + memset(&iaphd, 0xff, sizeof(IapHead)); + + strcpy(iaphd.upmask, STM32_MARK); + iaphd.rdaddr = rdAddr; + iaphd.wraddr = wrAddr; + iaphd.size = len; + iaphd.wsize = wlen; + iaphd.appcheck = check; + iaphd.checkcrc = CalcCrc32((u8*)&(iaphd.upmask[0]), sizeof(IapHead)-sizeof(iaphd.checkcrc)); // У֮ǰֶ + + printf("IapWritePara begin\r\n"); + +#if (0) + printf("iaphd.upmask %s\r\n", iaphd.upmask); + printf("iaphd.rdaddr=0x%x\r\n", iaphd.rdaddr); + printf("iaphd.wraddr=0x%x\r\n", iaphd.wraddr); + printf("iaphd.size=0x%x\r\n", iaphd.size); + printf("iaphd.wsize=0x%x\r\n", iaphd.wsize); + printf("iaphd.appcheck=0x%x\r\n", iaphd.appcheck); + printf("iaphd.checkcrc = 0x%x\r\n", iaphd.checkcrc); +#endif + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + DatFlash4kErase(NOR_MARK_ADDR, 1); // 4k + u32 taddr = (u32)(&iaphd); + DatFlashWrData(NOR_MARK_ADDR, (u8*)(taddr), sizeof(IapHead)/sizeof(u8)); // д +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + memcpy((void*)EXRAM_MARK_ADDR, (void*)(&(iaphd)), sizeof(IapHead)); +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + STMFlashErase(GetFlashSectorIdx(APP_MARK_ADDR), 1); + u32 taddr = (u32)(&iaphd); + STMFlashWrite(APP_MARK_ADDR, (u16*)(taddr), sizeof(IapHead)/sizeof(u16), 3); // д +#endif + + printf("IapWritePara end\r\n"); + + DelayMs(100); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +////////////////////////////////////////////////////////////////////////////////////////////////////// + diff --git a/NxFuncs/stiap/stiap.h b/NxFuncs/stiap/stiap.h new file mode 100644 index 0000000..69e8724 --- /dev/null +++ b/NxFuncs/stiap/stiap.h @@ -0,0 +1,116 @@ + +#ifndef __STIAP_H__ +#define __STIAP_H__ + +#include "config.h" +#include "stflash.h" +#include "stapp.h" + +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) +#include "norflash.h" +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) +#include "corefmc.h" +#endif +//------------------------------------------------------------------------------- +/* + iap Ƴ + ͨ bootloader app + ֧ ݵ norflash exram st-flash Ȼдapp +*/ +#if (APP_SAVE_TO == APP_SAVE_NORFLASH) + +#define NOR_SAVE_BASE (SNF_UPDATE_BEGIN) // NORflashдIAPݵĻַ = 32MB-512KB +#define NOR_SAVE_SIZE (SNF_UPDATE_SIZE) // NORflashдIAPС + +#define NOR_SAVE_END (NOR_SAVE_BASE+NOR_SAVE_SIZE) + +#define NOR_MARK_ADDR (NOR_SAVE_BASE) // NORflashд־ַ1K +#define NOR_APP_ADDR (NOR_SAVE_BASE+STM32_BOOT_SIZE) // NORflashӦóʼַ + +#define MASK_BUF_LEN 0x80 + + + #define APP_SAVE_BASE NOR_SAVE_BASE + #define APP_ADDR_BEG NOR_APP_ADDR + #define APP_MARK_ADDR NOR_MARK_ADDR + + +#elif (APP_SAVE_TO == APP_SAVE_EXRAM) + +#define EXRAM_SAVE_BASE CORE_SDRAM2_ADDR_BEG // + +#define EXRAM_APP_ADDR (EXRAM_SAVE_BASE + STM32_BOOT_SIZE) // APP ʼַ +#define TMP_SEC_ADDR EXRAM_SAVE_BASE // ʱݴ洢ַ +#define MAX_TMP_SIZE (STM32_BOOT_SIZE) // STM32_BOOT_SIZE + +#define EXRAM_MARK_ADDR TMP_SEC_ADDR + +#define MASK_BUF_LEN 0x80 + + #define APP_SAVE_BASE EXRAM_SAVE_BASE + #define APP_ADDR_BEG EXRAM_APP_ADDR + #define APP_MARK_ADDR EXRAM_MARK_ADDR + +#elif (APP_SAVE_TO == APP_SAVE_INFLASH) + +#define INFLASH_SAVE_BASE STF_UPDATE_BEGIN + +#define INFLASH_MARK_ADDR INFLASH_SAVE_BASE +#define INFLASH_APP_ADDR (INFLASH_SAVE_BASE+MARK_SIZE) + + #define MASK_BUF_LEN 0x80 + + #define APP_SAVE_BASE INFLASH_SAVE_BASE + #define APP_ADDR_BEG INFLASH_APP_ADDR + #define APP_MARK_ADDR INFLASH_MARK_ADDR +#else + +#define MASK_BUF_LEN 0x80 +#define APP_SAVE_BASE 0 +#define APP_ADDR_BEG 0 +#define APP_MARK_ADDR 0 + +#endif + +//-------------------------------------------------------------------- + +#define IAPHEAD_LEN (1*1024) + +//-------------------------------------------------------------------- + +#define STM32_MARK "APP_CAN_UPDATE" // ؼ +#define APP_RIGHT "APP_FILE_RIGHT" + +typedef struct +{ + char upmask[MASK_BUF_LEN]; + u32 rdaddr; // ݶȡƫƵַ + u32 wraddr; // дƫƵַ + u32 size; // ݳȣֽ + u32 wsize; // д볤 + u32 appcheck; // app ݵУ + + u8 rev[IAPHEAD_LEN - MASK_BUF_LEN - 4*5 - 4]; + u32 checkcrc; // У +} __attribute__ ((packed)) IapHead; + +//-------------------------------------------------------------------- + +//bootloader ӿں +int UpdateApp(void); // ļ +int JumpToApp(void); // ִflashapp + +// ӿں +void IAPCleanUpdateArea(void); // norflashĿ +void IapWritePara(u32 rdAddr, u32 wrAddr, u32 len, u32 wlen, u32 check); // дʼַͳȺ־ +void IapRestartMcu(void); // STM32λ + +void CloseAllPeripheral(void); + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- + +#endif + diff --git a/NxFuncs/stm32motos/stm32motos.c b/NxFuncs/stm32motos/stm32motos.c new file mode 100644 index 0000000..f343a99 --- /dev/null +++ b/NxFuncs/stm32motos/stm32motos.c @@ -0,0 +1,1055 @@ + +#define _IN_STM32MOTOS_C +#include "stm32motos.h" +#include "inout.h" +#include "shell.h" + +//---------------------------------------------------------------------- + +void TestStm32Motos(char * para1, char * para2); //ն˵Խӿ + +//--------------------------------------------------------------------------------------------- + +typedef struct +{ + // ò + u32 pulseMode; // 0:cw/ccw !=0:pulse/dir + u32 startPPS; // ٶ + u32 runPPS; // ˶ٶ + u32 addPPSG; // ͣٶ + u32 brkPPSG; // ɲٶ + + // ˶в + s32 realpos; // + int runState; // ״̬ + int dir; // з + s32 currentSpd; // ǰٶ + u32 currentAcc; // ǰٶ + s32 totalAcc; // ۼӼٶ + u32 currentPos; // ǰλ + u32 totalPos; // λ + u32 decPos; // ٵλ + int pulseState; // ״̬ 0:ǰΪ0, !=ǰΪ1 + int startrunflag; // б־ + + // ָ + u32 funTestTime; // йⲿʱ λ:0.1ms + u32 funTestCount; // йⲿʱ + int syncList[6]; // ͬƶѡ + + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣͣٶȽ٣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȽ٣ + u32 condPara1, condPara2; // + + int blockRunflag; // б־ + void (*ExecWhenRun)(void); // йִеĺ + void (*ExecWhenStart)(void); // ʱִеĺ + void (*ExecWhenStop)(void); // ֹͣʱִеĺ + +}TimerCtrl; + + +//--------------------------------------------------------------------------------------------- + +#ifndef SPEED_PSC +#define SPEED_PSC 72 +#endif + +#define SPEED_TIME 100 // 0.1ms + +//--------------------------------------------------------------------------------------------- +// TIM1: 첽ٶȿ(0.1ж) + +#ifndef SPEED_TIM +#define SPEED_TIM TIM1 +#endif + +#ifndef MOTO1_TIM +#define MOTO1_TIM TIM2 +#endif + +#ifndef MOTO2_TIM +#define MOTO2_TIM TIM3 +#endif + +#ifndef MOTO3_TIM +#define MOTO3_TIM TIM4 +#endif + +#ifndef MOTO4_TIM +#define MOTO4_TIM TIM5 +#endif + +#ifndef MOTO5_TIM +#define MOTO5_TIM TIM6 +#endif + +#ifndef MOTO6_TIM +#define MOTO6_TIM TIM7 +#endif + +//--------------------------------------------------------------------------------------------- + +// ʱʱӣӦܽţж +#ifndef MOOT_TIM_PSC +#define MOOT_TIM_PSC 120 // ԤƵ +#endif + +#define MOTO_FIN ((SYSCLK/MOOT_TIM_PSC)) // ʱƵ = ((RTE_SYSCLK / MOOT_TIM_PSC)/(@25kʱУ׼ϵ)) + +#define SPD_MIN 10 // Ƶ λ: / = (MOTO_FIN / 65535) +#define SPD_MAX 50000 // Ƶ λ: / = (MOTO_FIN / 10) + +#define ADD_MIN 1 // Сٶ +#define ADD_MAX 100000 // ٶ λ: pps/s + +//--------------------------------------------------------------------------------------------- + + +OutFunc SoftPwmProc = SetOutputNull; + +OutFunc Moto1PulseOn = SetOutputNull; +OutFunc Moto1PulseOff = SetOutputNull; +OutFunc Moto1SignOn = SetOutputNull; +OutFunc Moto1SignOff = SetOutputNull; + +OutFunc Moto2PulseOn = SetOutputNull; +OutFunc Moto2PulseOff = SetOutputNull; +OutFunc Moto2SignOn = SetOutputNull; +OutFunc Moto2SignOff = SetOutputNull; + +OutFunc Moto3PulseOn = SetOutputNull; +OutFunc Moto3PulseOff = SetOutputNull; +OutFunc Moto3SignOn = SetOutputNull; +OutFunc Moto3SignOff = SetOutputNull; + +OutFunc Moto4PulseOn = SetOutputNull; +OutFunc Moto4PulseOff = SetOutputNull; +OutFunc Moto4SignOn = SetOutputNull; +OutFunc Moto4SignOff = SetOutputNull; + +OutFunc Moto5PulseOn = SetOutputNull; +OutFunc Moto5PulseOff = SetOutputNull; +OutFunc Moto5SignOn = SetOutputNull; +OutFunc Moto5SignOff = SetOutputNull; + +OutFunc Moto6PulseOn = SetOutputNull; +OutFunc Moto6PulseOff = SetOutputNull; +OutFunc Moto6SignOn = SetOutputNull; +OutFunc Moto6SignOff = SetOutputNull; + +//--------------------------------------------------------------------------------------------- + +// +void SetMotoPulseOn(int curAux, int syncList[6]) +{ + if ((curAux == 1) || (syncList[1-1] == 1)) + { + Moto1PulseOn(); + } + if ((curAux == 2) || (syncList[2-1] == 1)) + { + Moto2PulseOn(); + } + if ((curAux == 3) || (syncList[3-1] == 1)) + { + Moto3PulseOn(); + } + if ((curAux == 4) || (syncList[4-1] == 1)) + { + Moto4PulseOn(); + } + if ((curAux == 5) || (syncList[5-1] == 1)) + { + Moto5PulseOn(); + } + if ((curAux == 6) || (syncList[6-1] == 1)) + { + Moto6PulseOn(); + } +} + +// +void SetMotoPulseOff(int curAux, int syncList[6]) +{ + if ((curAux == 1) || (syncList[1-1] == 1)) + { + Moto1PulseOff(); + } + if ((curAux == 2) || (syncList[2-1] == 1)) + { + Moto2PulseOff(); + } + if ((curAux == 3) || (syncList[3-1] == 1)) + { + Moto3PulseOff(); + } + if ((curAux == 4) || (syncList[4-1] == 1)) + { + Moto4PulseOff(); + } + if ((curAux == 5) || (syncList[5-1] == 1)) + { + Moto5PulseOff(); + } + if ((curAux == 6) || (syncList[6-1] == 1)) + { + Moto6PulseOff(); + } +} + +// +void SetMotoSignOn(int curAux, int syncList[6]) +{ + if ((curAux == 1) || (syncList[1-1] == 1)) + { + Moto1SignOn(); + } + if ((curAux == 2) || (syncList[2-1] == 1)) + { + Moto2SignOn(); + } + if ((curAux == 3) || (syncList[3-1] == 1)) + { + Moto3SignOn(); + } + if ((curAux == 4) || (syncList[4-1] == 1)) + { + Moto4SignOn(); + } + if ((curAux == 5) || (syncList[5-1] == 1)) + { + Moto5SignOn(); + } + if ((curAux == 6) || (syncList[6-1] == 1)) + { + Moto6SignOn(); + } +} + +// +void SetMotoSignOff(int curAux, int syncList[6]) +{ + if ((curAux == 1) || (syncList[1-1] == 1)) + { + Moto1SignOff(); + } + if ((curAux == 2) || (syncList[2-1] == 1)) + { + Moto2SignOff(); + } + if ((curAux == 3) || (syncList[3-1] == 1)) + { + Moto3SignOff(); + } + if ((curAux == 4) || (syncList[4-1] == 1)) + { + Moto4SignOff(); + } + if ((curAux == 5) || (syncList[5-1] == 1)) + { + Moto5SignOff(); + } + if ((curAux == 6) || (syncList[6-1] == 1)) + { + Moto6SignOff(); + } +} + +//--------------------------------------- +// ƺ궨 + +#define USE_MOTO(x) \ +TimerCtrl g_moto##x##TimerCtrl; \ + \ +/*---------------------------------------*/ \ +void InitStm32Moto##x##OutFunc(OutFunc stepOn, OutFunc StepOff, OutFunc dirOn, OutFunc dirOff) \ +{ \ + Moto##x##PulseOn = stepOn; \ + Moto##x##PulseOff = StepOff; \ + Moto##x##SignOn = dirOn; \ + Moto##x##SignOff = dirOff; \ +}\ +\ +void InitSTM32Moto##x##Ctrl(void) \ +{ \ + LL_TIM_ClearFlag_UPDATE(MOTO##x##_TIM); /* жϱ־ */ \ + LL_TIM_DisableIT_UPDATE(MOTO##x##_TIM); /* رж */ \ + LL_TIM_DisableCounter(MOTO##x##_TIM); /* رնʱ */ \ +\ + memset(&g_moto##x##TimerCtrl, 0, sizeof(TimerCtrl)); \ + g_moto##x##TimerCtrl.pulseMode = MODE_STEPDIR; /* ģʽ */ \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* жϴ */ \ +void STM32Moto##x##IntProc(void) \ +{ \ + if (LL_TIM_IsActiveFlag_UPDATE(MOTO##x##_TIM) != RESET) /* ָTIMжϷ */ \ + { \ + LL_TIM_ClearFlag_UPDATE(MOTO##x##_TIM); /* TIMxжϴλ */ \ + \ + if ((g_moto##x##TimerCtrl.currentPos >= g_moto##x##TimerCtrl.totalPos) || /* */ \ + (g_moto##x##TimerCtrl.runState <= STM32MOTO_STOP) || /* ֹͣź */ \ + 0 ) \ + { \ + SetMotoPulseOff(x,g_moto##x##TimerCtrl.syncList); /* ر */ \ + SetMotoSignOff(x,g_moto##x##TimerCtrl.syncList); /* رշ */ \ + LL_TIM_DisableCounter(MOTO##x##_TIM); /* رնʱ */ \ + if (g_moto##x##TimerCtrl.runState > STM32MOTO_STOP) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_STOP; /* ״̬ */ \ + g_moto##x##TimerCtrl.startrunflag = 0; /* رб־ */ \ + if (g_moto##x##TimerCtrl.ExecWhenStop != NULL) \ + { \ + g_moto##x##TimerCtrl.ExecWhenStop(); \ + } \ + } \ + } \ + else \ + { \ + LL_TIM_SetAutoReload(MOTO##x##_TIM, (u16)((MOTO_FIN/g_moto##x##TimerCtrl.currentSpd)/2)); /* üֵ */ \ + \ + if (g_moto##x##TimerCtrl.pulseState == 0) \ + { \ + g_moto##x##TimerCtrl.pulseState = 1; \ + g_moto##x##TimerCtrl.currentPos++; /* ֵ */ \ + g_moto##x##TimerCtrl.realpos += g_moto##x##TimerCtrl.dir; \ + \ + if (g_moto##x##TimerCtrl.pulseMode == MODE_CWCCW) /* */ \ + { \ + if (g_moto##x##TimerCtrl.dir == 1) \ + { \ + SetMotoPulseOn(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOn(); */\ + } \ + else \ + { \ + SetMotoSignOn(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOn(); */\ + } \ + } \ + else \ + { \ + SetMotoPulseOn(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOn(); */\ + } \ + } \ + else \ + { \ + g_moto##x##TimerCtrl.pulseState = 0; \ + if (g_moto##x##TimerCtrl.pulseMode == MODE_CWCCW) \ + { \ + SetMotoPulseOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOff();*/ \ + SetMotoSignOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOff();*/ \ + } \ + else \ + { \ + SetMotoPulseOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOff();*/ \ + } \ + } \ + \ + /* */ \ + if (g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) \ + { \ + if (g_moto##x##TimerCtrl.currentPos >= (g_moto##x##TimerCtrl.totalPos>>1)) \ + {/* ǰλƴλƵһ,뽵״̬ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_DEC; \ + g_moto##x##TimerCtrl.decPos = g_moto##x##TimerCtrl.currentPos; /* ٵλ */ \ + /*printf("enter dec, spd=%d, pos=%d\r\n", g_moto##x##TimerCtrl.currentSpd, g_moto##x##TimerCtrl.decPos);*/ \ + } \ + } \ + \ + /* */ \ + if (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) \ + { \ + if (g_moto##x##TimerCtrl.currentPos >= g_moto##x##TimerCtrl.decPos) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_DEC; \ + g_moto##x##TimerCtrl.currentAcc = g_moto##x##TimerCtrl.addPPSG; /* ǰٶ */ \ + } \ + } \ + } \ + } \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣٶȿ */ \ +/* ٶȿжӦ */ \ +void STM32Moto##x##Speed (void) \ +{ \ + /* ֹͣ */ \ + if (g_moto##x##TimerCtrl.runState <= STM32MOTO_STOP || g_moto##x##TimerCtrl.startrunflag == 0) \ + { \ + return; \ + } \ + if ((g_moto##x##TimerCtrl.blockRunflag == 0) && (g_moto##x##TimerCtrl.funTestTime != 0)) /* б־ */ \ + { \ + g_moto##x##TimerCtrl.funTestCount++; \ + if ((g_moto##x##TimerCtrl.funTestCount >= g_moto##x##TimerCtrl.funTestTime)) \ + { \ + g_moto##x##TimerCtrl.funTestCount = 0; \ + if (g_moto##x##TimerCtrl.GetNormalStop != NULL) /* һֹͣ */ \ + { \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) || /* */ \ + 0 ) \ + { \ + if (g_moto##x##TimerCtrl.GetNormalStop(g_moto##x##TimerCtrl.condPara1, g_moto##x##TimerCtrl.condPara2) != 0) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_NSTOP; /* ͣ */ \ + } \ + } \ + } \ + /* жϿֹͣ */ \ + if (g_moto##x##TimerCtrl.GetQuickStop != NULL) /* ֹͣ */ \ + { \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_NSTOP) || /* ͣ */ \ + 0 ) \ + { \ + if (g_moto##x##TimerCtrl.GetQuickStop(g_moto##x##TimerCtrl.condPara1, g_moto##x##TimerCtrl.condPara2) != 0) \ + { \ + g_moto##x##TimerCtrl.currentAcc = g_moto##x##TimerCtrl.brkPPSG; /* ǰٶ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_EMC; /* ͣ */ \ + } \ + } \ + } \ + if (g_moto##x##TimerCtrl.ExecWhenRun != NULL) /* йִеĺ*/ \ + { \ + g_moto##x##TimerCtrl.ExecWhenRun(); \ + } \ + } \ + } \ + \ + /* */ \ + if (g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) \ + { \ + g_moto##x##TimerCtrl.totalAcc += g_moto##x##TimerCtrl.currentAcc; /* ۼٶ */ \ + do\ + {\ + if (g_moto##x##TimerCtrl.totalAcc >= 10000)\ + {\ + g_moto##x##TimerCtrl.currentSpd += 1; /* ǰٶ */ \ + g_moto##x##TimerCtrl.totalAcc -= 10000; /* ۼٶ */ \ + }\ + else\ + {\ + break;\ + }\ + }while(1);\ + if (g_moto##x##TimerCtrl.currentSpd >= (s32)g_moto##x##TimerCtrl.runPPS) \ + {/* ǰٶȴٶ,״̬ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_RUN; \ + g_moto##x##TimerCtrl.currentSpd = g_moto##x##TimerCtrl.runPPS; \ + g_moto##x##TimerCtrl.decPos = (g_moto##x##TimerCtrl.totalPos - g_moto##x##TimerCtrl.currentPos); /* ٵλ */ \ + /*printf("enter run, spd=%d, decpos=%d\r\n", g_moto##x##TimerCtrl.currentSpd, g_moto##x##TimerCtrl.decPos);*/ \ + } \ + } \ + \ + /* */ \ + if (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) /* */ \ + { \ + g_moto##x##TimerCtrl.totalAcc -= g_moto##x##TimerCtrl.currentAcc; /* ۼٶ */ \ + do\ + {\ + if ((g_moto##x##TimerCtrl.totalAcc < 0) && (g_moto##x##TimerCtrl.currentSpd > 0))\ + {\ + g_moto##x##TimerCtrl.currentSpd -= 1; /* ǰٶ */ \ + g_moto##x##TimerCtrl.totalAcc += 10000; /* ۼٶ */ \ + }\ + else\ + {\ + break;\ + }\ + }while(1);\ + if (g_moto##x##TimerCtrl.currentSpd <= (s32)g_moto##x##TimerCtrl.startPPS) \ + { \ + g_moto##x##TimerCtrl.currentSpd = g_moto##x##TimerCtrl.startPPS; \ + } \ + } \ + \ + /* ͣ */ \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_NSTOP) || /* ͣ */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_EMC) || /* ɲ */ \ + 0) \ + { \ + g_moto##x##TimerCtrl.totalAcc -= g_moto##x##TimerCtrl.currentAcc; /* ۼٶ */ \ + do\ + {\ + if ((g_moto##x##TimerCtrl.totalAcc < 0) && (g_moto##x##TimerCtrl.currentSpd > 0))\ + {\ + g_moto##x##TimerCtrl.currentSpd -= 1; /* ǰٶ */ \ + g_moto##x##TimerCtrl.totalAcc += 10000; /* ۼٶ */ \ + }\ + else\ + {\ + break;\ + }\ + }while(1);\ + if (g_moto##x##TimerCtrl.currentSpd <= (s32)g_moto##x##TimerCtrl.startPPS) \ + {/* ǰٶСٶ,ֹͣ״̬ */ \ + SetMotoPulseOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOff();*/ \ + SetMotoSignOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOff();*/ \ + LL_TIM_DisableCounter(MOTO##x##_TIM); /* رնʱ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_STOP; /* ״̬ */ \ + g_moto##x##TimerCtrl.startrunflag = 0; /* رб־ */ \ + if (g_moto##x##TimerCtrl.ExecWhenStop != NULL) \ + { \ + g_moto##x##TimerCtrl.ExecWhenStop(); \ + } \ + } \ + } \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣ */ \ +int STM32Moto##x##Start(MotoCtrl * pCtrl) \ +{ \ + int runflag = 1;\ + int rslt = 0;\ + if (g_moto##x##TimerCtrl.runState <= STM32MOTO_STOP) /* ͣ/״̬ */ \ + { \ + if (pCtrl->movement == 0) /* */\ + { \ + runflag = 0;\ + } \ + if (pCtrl->GetNormalStop != NULL) /* һֹͣ */ \ + {\ + rslt = pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2); \ + if (rslt != 0) \ + { \ + runflag = 0;\ + } \ + } \ + if (pCtrl->GetQuickStop != NULL) /* ֹͣ */ \ + { \ + rslt = pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2); \ + if (rslt != 0) \ + { \ + runflag = 0;\ + } \ + } \ + if (runflag == 0) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_STOP; \ + g_moto##x##TimerCtrl.startrunflag = 0; /* رб־ */ \ + return rslt; \ + } \ + if (pCtrl->ExecWhenStart != NULL) /* ִ */ \ + { \ + pCtrl->ExecWhenStart(); \ + } \ + /* λ */ \ + g_moto##x##TimerCtrl.currentPos = 0; /* ǰλ */ \ + g_moto##x##TimerCtrl.pulseState = 0; /* ǰΪ 0 */ \ + g_moto##x##TimerCtrl.totalPos = abs(pCtrl->movement); /* λ */ \ + g_moto##x##TimerCtrl.decPos = g_moto##x##TimerCtrl.totalPos; /* λ */ \ + if (pCtrl->movement > 0) \ + {/* */ \ + g_moto##x##TimerCtrl.dir = 1; \ + } \ + else \ + { \ + g_moto##x##TimerCtrl.dir = -1; \ + } \ + \ + /* ٶ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_ADD; /* */ \ + g_moto##x##TimerCtrl.startPPS = pCtrl->startPPS; /* ͣٶ */ \ + g_moto##x##TimerCtrl.runPPS = pCtrl->runPPS; /* ٶ */ \ + g_moto##x##TimerCtrl.addPPSG = pCtrl->addPPSG; /* ͣٶ */ \ + g_moto##x##TimerCtrl.brkPPSG = pCtrl->brkPPSG; /* ɲٶ */ \ + g_moto##x##TimerCtrl.totalAcc = 0; /* ۼӼٶ */ \ + \ + g_moto##x##TimerCtrl.funTestTime = pCtrl->funTestTime; /* йⲿʱ */ \ + g_moto##x##TimerCtrl.funTestCount = 0; /* йⲿʱ */ \ +\ + g_moto##x##TimerCtrl.syncList[0] = pCtrl->syncList[0]; /* ͬƶѡ */ \ + g_moto##x##TimerCtrl.syncList[1] = pCtrl->syncList[1]; /* ͬƶѡ */ \ + g_moto##x##TimerCtrl.syncList[2] = pCtrl->syncList[2]; /* ͬƶѡ */ \ + g_moto##x##TimerCtrl.syncList[3] = pCtrl->syncList[3]; /* ͬƶѡ */ \ + g_moto##x##TimerCtrl.syncList[4] = pCtrl->syncList[4]; /* ͬƶѡ */ \ + g_moto##x##TimerCtrl.syncList[5] = pCtrl->syncList[5]; /* ͬƶѡ */ \ + \ + g_moto##x##TimerCtrl.GetNormalStop = pCtrl -> GetNormalStop; /* һֹͣ */ \ + g_moto##x##TimerCtrl.GetQuickStop = pCtrl -> GetQuickStop; /* ֹͣ */ \ + g_moto##x##TimerCtrl.condPara1 = pCtrl -> condPara1; /* 1 */ \ + g_moto##x##TimerCtrl.condPara2 = pCtrl -> condPara2; /* 2 */ \ + \ + g_moto##x##TimerCtrl.blockRunflag = pCtrl -> blockRunflag; /* б־ */ \ + g_moto##x##TimerCtrl.ExecWhenRun = pCtrl -> ExecWhenRun; /* йִеĺ */ \ + g_moto##x##TimerCtrl.ExecWhenStart = pCtrl -> ExecWhenStart; /* ʱִеĺ */ \ + g_moto##x##TimerCtrl.ExecWhenStop = pCtrl -> ExecWhenStop; /* ֹͣʱִеĺ */ \ + \ + /* ٶУ */ \ + if (g_moto##x##TimerCtrl.startPPS > SPD_MAX) \ + { \ + g_moto##x##TimerCtrl.startPPS = SPD_MAX; \ + } \ + if (g_moto##x##TimerCtrl.startPPS < SPD_MIN) \ + { \ + g_moto##x##TimerCtrl.startPPS = SPD_MIN; \ + } \ + if (g_moto##x##TimerCtrl.runPPS > SPD_MAX) \ + { \ + g_moto##x##TimerCtrl.runPPS = SPD_MAX; \ + } \ + if (g_moto##x##TimerCtrl.runPPS < SPD_MIN) \ + { \ + g_moto##x##TimerCtrl.runPPS = SPD_MIN; \ + } \ + if (g_moto##x##TimerCtrl.startPPS > g_moto##x##TimerCtrl.runPPS) \ + { \ + g_moto##x##TimerCtrl.startPPS = g_moto##x##TimerCtrl.runPPS; \ + } \ + \ + /* ٶУ */ \ + if (g_moto##x##TimerCtrl.addPPSG > ADD_MAX) \ + { \ + g_moto##x##TimerCtrl.addPPSG = ADD_MAX; \ + } \ + if (g_moto##x##TimerCtrl.addPPSG <= ADD_MIN) \ + { \ + g_moto##x##TimerCtrl.addPPSG = ADD_MIN; \ + } \ + if (g_moto##x##TimerCtrl.brkPPSG > ADD_MAX) \ + { \ + g_moto##x##TimerCtrl.brkPPSG = ADD_MAX; \ + } \ + if (g_moto##x##TimerCtrl.brkPPSG <= ADD_MIN) \ + { \ + g_moto##x##TimerCtrl.brkPPSG = ADD_MIN; \ + } \ + g_moto##x##TimerCtrl.currentSpd = g_moto##x##TimerCtrl.startPPS; /* ǰٶ */ \ + g_moto##x##TimerCtrl.currentAcc = g_moto##x##TimerCtrl.addPPSG; /* ǰٶ */ \ + \ + /* */ \ + SetMotoPulseOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##PulseOff();*/ \ + if (g_moto##x##TimerCtrl.pulseMode != MODE_CWCCW) \ + { \ + if (g_moto##x##TimerCtrl.dir == 1) \ + { \ + SetMotoSignOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOff();*/ \ + } \ + else \ + { \ + SetMotoSignOn(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOn(); */\ + } \ + } \ + else \ + { \ + SetMotoSignOff(x,g_moto##x##TimerCtrl.syncList); /*SetMoto##x##SignOff();*/ \ + } \ + \ + LL_TIM_DisableIT_UPDATE(MOTO##x##_TIM); /* رж */ \ + LL_TIM_SetAutoReload(MOTO##x##_TIM, (u16)((MOTO_FIN/g_moto##x##TimerCtrl.currentSpd)/2)); /* üֵ */ \ + LL_TIM_EnableIT_UPDATE(MOTO##x##_TIM); /* ж */ \ + LL_TIM_EnableCounter(MOTO##x##_TIM); /* ʱ */ \ + g_moto##x##TimerCtrl.startrunflag = 1; /* б־ */ \ + \ + return STM32Moto##x##Run(pCtrl); \ + } \ + else \ + { \ + printf("moto is running, start failed\r\n"); \ + return -1; /* */ \ + } \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣֹͣ */ \ +void STM32Moto##x##Stop(void) \ +{ \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) || /* */ \ + 0 ) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_NSTOP; /* 뽵ͣ״̬ */ \ + if (g_moto##x##TimerCtrl.ExecWhenStop != NULL) \ + { \ + g_moto##x##TimerCtrl.ExecWhenStop(); \ + } \ + } \ +} \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣ */ \ +int STM32Moto##x##Run(MotoCtrl * pCtrl) \ +{ \ + /* жһֹͣ */ \ + do \ + { \ + if (pCtrl == NULL || \ + g_moto##x##TimerCtrl.runState <= STM32MOTO_STOP) /* */ \ + { \ + break; \ + } \ + if (pCtrl->GetNormalStop != NULL) /* һֹͣ */ \ + { \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) || /* */ \ + 0 ) \ + { \ + if (pCtrl->GetNormalStop(pCtrl->condPara1, pCtrl->condPara2) != 0) \ + { \ + g_moto##x##TimerCtrl.runState = STM32MOTO_NSTOP; /* ͣ */ \ + if (g_moto##x##TimerCtrl.ExecWhenStop != NULL) \ + { \ + g_moto##x##TimerCtrl.ExecWhenStop(); \ + } \ + } \ + } \ + } \ + /* жϿֹͣ */ \ + if (pCtrl->GetQuickStop != NULL) /* ֹͣ */ \ + { \ + if ((g_moto##x##TimerCtrl.runState == STM32MOTO_ADD) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_RUN) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_DEC) || /* */ \ + (g_moto##x##TimerCtrl.runState == STM32MOTO_NSTOP) || /* ͣ */ \ + 0 ) \ + { \ + if (pCtrl->GetQuickStop(pCtrl->condPara1, pCtrl->condPara2) != 0) \ + { \ + g_moto##x##TimerCtrl.currentAcc = g_moto##x##TimerCtrl.brkPPSG; /* ǰٶ */ \ + g_moto##x##TimerCtrl.runState = STM32MOTO_EMC; /* ͣ */ \ + } \ + } \ + } \ + if (pCtrl->ExecWhenRun != NULL) /* йִеĺ*/ \ + { \ + pCtrl->ExecWhenRun(); \ + } \ + if (pCtrl->blockRunflag == 0) /* б־ */ \ + { \ + break; \ + } \ + }while(1); \ + return g_moto##x##TimerCtrl.runState; \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣõ״̬ */ \ +int GetSTM32Moto##x##State(void) \ +{ \ + return g_moto##x##TimerCtrl.runState; \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣõǰ */ \ +s32 GetSTM32Moto##x##RealPos(void) \ +{ \ + return g_moto##x##TimerCtrl.realpos; \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣõǰ */ \ +void SetSTM32Moto##x##RealPos(s32 pos) \ +{ \ + g_moto##x##TimerCtrl.realpos = pos; \ +} \ + \ +/*-----------------------------------------------------------------------------------*/ \ +/* ܣõģʽ */ \ +void SetSTM32Moto##x##Mode(int mode) \ +{ \ + g_moto##x##TimerCtrl.pulseMode = mode; \ +} \ +/*-----------------------------------------------------------------------------------*/ \ + +//---------------------------------------------------------------------- +// 궨 + +#if (STM32_MOTOS_NUM >= 1) + USE_MOTO(1); +#endif +#if (STM32_MOTOS_NUM >= 2) + USE_MOTO(2); +#endif +#if (STM32_MOTOS_NUM >= 3) + USE_MOTO(3); +#endif +#if (STM32_MOTOS_NUM >= 4) + USE_MOTO(4); +#endif +#if (STM32_MOTOS_NUM >= 5) + USE_MOTO(5); +#endif +#if (STM32_MOTOS_NUM >= 6) + USE_MOTO(6); +#endif + +//---------------------------------------------------------------------- +// ʼٶȿƶʱж +void InitSTM32Speed(void) +{ +#if (STM32_MOTOS_NUM >= 1 || STM32_SOFT_PWM > 0) + LL_TIM_ClearFlag_UPDATE(SPEED_TIM); // жϱ־ + LL_TIM_EnableIT_UPDATE(SPEED_TIM); // ж + LL_TIM_EnableCounter(SPEED_TIM); // ʹܶʱ +#endif +} + +/*-----------------------------------------------------------------------------------*/ +// ٶȿжϴ +void STM32MotoSpeedIntProc(void) +{ +#if (STM32_MOTOS_NUM >= 1 || STM32_SOFT_PWM > 0) + + if (LL_TIM_IsActiveFlag_UPDATE(SPEED_TIM) != RESET) + { + LL_TIM_ClearFlag_UPDATE(SPEED_TIM); + #if (STM32_SOFT_PWM > 0) + SoftPwmProc(); + #endif + #if (STM32_MOTOS_NUM >= 1) + STM32Moto1Speed(); + #endif + #if (STM32_MOTOS_NUM >= 2) + STM32Moto2Speed(); + #endif + #if (STM32_MOTOS_NUM >= 3) + STM32Moto3Speed(); + #endif + #if (STM32_MOTOS_NUM >= 4) + STM32Moto4Speed(); + #endif + #if (STM32_MOTOS_NUM >= 5) + STM32Moto5Speed(); + #endif + #if (STM32_MOTOS_NUM >= 6) + STM32Moto6Speed(); + #endif + } +#endif +} + +//---------------------------------------------------------------------- + +void InitSTM32SoftPwm(OutFunc pwmProc) +{ +#if (STM32_MOTOS_NUM == 0 && STM32_SOFT_PWM != 0) + InitSTM32Speed(); +#endif + SoftPwmProc = pwmProc; +} + +//---------------------------------------------------------------------- + +void InitSTM32Motos(void) +{ +#if (STM32_MOTOS_NUM > 0) + InitSTM32Speed(); +#endif + +#if (STM32_MOTOS_NUM >= 1) + InitSTM32Moto1Ctrl(); +#endif + +#if (STM32_MOTOS_NUM >= 2) + InitSTM32Moto2Ctrl(); +#endif + +#if (STM32_MOTOS_NUM >= 3) + InitSTM32Moto3Ctrl(); +#endif + +#if (STM32_MOTOS_NUM >= 4) + InitSTM32Moto4Ctrl(); +#endif + +#if (STM32_MOTOS_NUM >= 5) + InitSTM32Moto5Ctrl(); +#endif + +#if (STM32_MOTOS_NUM >= 6) + InitSTM32Moto6Ctrl(); +#endif + +// AddShellCmd("TMR", "test stm32 moto run", TestStm32Motos); +} + +// ----------------------------------------------------------- + +//ն˵Խӿ +void TestStm32Motos(char * para1, char * para2) +{ +#if (STM32_MOTOS_NUM >= 1) + int p1, p2; + MotoCtrl mtcfg; // ò + + memset(&mtcfg, 0, sizeof(MotoCtrl)); + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + } + + if (p1 == 0) + {//ȡ״̬ + if (p2 == 0) + { + g_moto1TimerCtrl.realpos = 0; + } + else if (p2 == 1) + { + printf("moto1pos=%ld\r\n", g_moto1TimerCtrl.realpos); + } + + if (p2 == 100) + {// ״̬ + printf("moto1 state =%d\r\n",GetSTM32Moto1State()); + } + } + + if (p1 == 1) + {//moto1 + if (p2 == 0) + {// ֹͣ + STM32Moto1Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 300; + mtcfg.runPPS = 1000; + mtcfg.addPPSG = 10; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto1Start (&mtcfg); + } + } +#if (STM32_MOTOS_NUM >= 2) + if (p1 == 2) + {//moto2 + if (p2 == 0) + {// ֹͣ + STM32Moto2Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 300; + mtcfg.runPPS = 1000; + mtcfg.addPPSG = 10; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto2Start (&mtcfg); + } + } +#endif +#if (STM32_MOTOS_NUM >= 3) + if (p1 == 3) + {//moto3 + if (p2 == 0) + {// ֹͣ + STM32Moto3Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 50; + mtcfg.runPPS = 7000; + mtcfg.addPPSG = 5; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto3Start (&mtcfg); + } + } +#endif +#if (STM32_MOTOS_NUM >= 4) + if (p1 == 4) + {//moto4 + if (p2 == 0) + {// ֹͣ + STM32Moto4Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 50; + mtcfg.runPPS = 4000; + mtcfg.addPPSG = 5; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto4Start (&mtcfg); + } + } +#endif +#if (STM32_MOTOS_NUM >= 5) + if (p1 == 5) + {//moto5 + if (p2 == 0) + {// ֹͣ + STM32Moto5Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 100; + mtcfg.runPPS = 2000; + mtcfg.addPPSG = 50; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto5Start (&mtcfg); + } + } +#endif +#if (STM32_MOTOS_NUM >= 6) + if (p1 == 6) + {//moto5 + if (p2 == 0) + {// ֹͣ + STM32Moto6Stop(); + } + else + { + mtcfg.movement = p2; // λ + mtcfg.startPPS = 100; + mtcfg.runPPS = 2000; + mtcfg.addPPSG = 50; + mtcfg.brkPPSG = 50; + mtcfg.GetNormalStop = NULL; + mtcfg.GetQuickStop = NULL; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + STM32Moto6Start (&mtcfg); + } + } + +#endif + +#endif + +} + diff --git a/NxFuncs/stm32motos/stm32motos.h b/NxFuncs/stm32motos/stm32motos.h new file mode 100644 index 0000000..0d6645f --- /dev/null +++ b/NxFuncs/stm32motos/stm32motos.h @@ -0,0 +1,140 @@ + +//------------------------------------------------------------------------------- +// ʵ6·첽˶ +//------------------------------------------------------------------------------- + +#ifndef __STM32MOTOS_H__ +#define __STM32MOTOS_H__ + +#include "config.h" + +//------------------------------------------------------------------------------- +// ʵ6·첽˶ +// ʵֵԶ -- ˶ + +#ifndef STM32_MOTOS_NUM +#define STM32_MOTOS_NUM 0 // +#endif + +//--------------------------------------------------------------- +// PWMź +#ifndef STM32_SOFT_PWM +#define STM32_SOFT_PWM 0 +#endif + +//------------------------------------------------------------------------------- + +// ģʽ +#define MODE_CWCCW 0 +#define MODE_STEPDIR 1 + +//--------------------------------------------------------------- +// ˶״̬ +#define STM32MOTO_ERR -1 // 쳣 +#define STM32MOTO_STOP 0 // ֹͣ +#define STM32MOTO_ADD 1 // +#define STM32MOTO_RUN 2 // +#define STM32MOTO_DEC 3 // () +#define STM32MOTO_NSTOP 4 // ͣ(ͣ) +#define STM32MOTO_EMC 5 // ɲ(ɲ) + +//--------------------------------------------------------------- +// ˶ƽӿ +typedef struct +{ + // + s32 movement; // λ + + u32 startPPS; // ٶ + u32 runPPS; // ˶ٶ + u32 addPPSG; // ͣٶ + u32 brkPPSG; // ɲٶ + + u32 funTestTime; // йⲿʱ 0:ⲿ (λ:0.1ms) + int syncList[6]; // ͬƶѡ + + // ָ + int (*GetNormalStop)(u32,u32); // һֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣͣٶȽ٣ + int (*GetQuickStop)(u32,u32); // ֹͣΪʱֹͣ; Ϊʱ㣬ٵֹͣɲٶȽ٣ + u32 condPara1, condPara2; // + + int blockRunflag; // б־, =1,ͬ˶ =0,,첽˶ + void (*ExecWhenRun)(void); // йִеĺ + void (*ExecWhenStart)(void); // ʱִеĺ + void (*ExecWhenStop)(void); // ֹͣʱִеĺ + +}MotoCtrl; + +//--------------------------------------------------------------- + +typedef void (*OutFunc)(void); + + +#define MOTO_FUNC_DEF(x) \ +\ +void InitStm32Moto##x##OutFunc(OutFunc stepOn, OutFunc StepOff, OutFunc dirOn, OutFunc dirOff); /* ܣõ */ \ +int STM32Moto##x##Start(MotoCtrl * pCtrl); /* ܣ */ \ +void STM32Moto##x##Stop (void); /* ܣֹͣʱõ */ \ +int STM32Moto##x##Run(MotoCtrl * pCtrl); /* ܣУʱõ */ \ +int GetSTM32Moto##x##State(void); /* ܣõ״̬ʱõ */ \ +void SetSTM32Moto##x##Mode(int mode); /* ܣ巽ʽ */ \ +void SetSTM32Moto##x##RunSpd(u32 spd); /* ܣõתٶ(ʱõ) */ \ +s32 GetSTM32Moto##x##RealPos(void); /* ܣõǰ꣨ʱõ */ \ +void SetSTM32Moto##x##RealPos(s32 pos); /* ܣõǰ꣨ʱõ */ \ +void STM32Moto##x##IntProc(void); /* ܣжϴ */ \ +//------------------------------- + + +//--------------------------------------------------------------- +// ʼ +void InitSTM32Motos(void); +void InitSTM32SoftPwm(OutFunc pwmProc); + + +//------------------------------- +#if (STM32_MOTOS_NUM > 0 || STM32_SOFT_PWM > 0) +void STM32MotoSpeedIntProc(void); /* ܣжϴ */ +#endif + +// MOTO1 +#if (STM32_MOTOS_NUM >= 1) +MOTO_FUNC_DEF(1); +#endif + +// MOTO2 +#if (STM32_MOTOS_NUM >= 2) +MOTO_FUNC_DEF(2); +#endif + +// MOTO3 +#if (STM32_MOTOS_NUM >= 3) +MOTO_FUNC_DEF(3); +#endif + +// MOTO4 +#if (STM32_MOTOS_NUM >= 4) +MOTO_FUNC_DEF(4); +#endif + +// MOTO5 +#if (STM32_MOTOS_NUM >= 5) +MOTO_FUNC_DEF(5); +#endif + +// MOTO6 +#if (STM32_MOTOS_NUM >= 6) +MOTO_FUNC_DEF(6); +#endif + +//--------------------------------------------------------------- + + + +//--------------------------------------------------------------- + +#endif + + + + + diff --git a/NxFuncs/stpara/stparas.c b/NxFuncs/stpara/stparas.c new file mode 100644 index 0000000..2093b7c --- /dev/null +++ b/NxFuncs/stpara/stparas.c @@ -0,0 +1,27 @@ + +//------------------------------------------------------------------------------- +// File Name: stparas.c +// Brief: +// Version: 1.0.0 +// Create Date: 2019/06/25 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2019, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2019/06/25 +//------------------------------------------------------------------------------- + + +#define _IN_STPARAS_C +#include "stparas.h" + +//---------------------------------------------------------- + +//---------------------------------------------------------- + +//---------------------------------------------------------- + +//---------------------------------------------------------- + diff --git a/NxFuncs/stpara/stparas.h b/NxFuncs/stpara/stparas.h new file mode 100644 index 0000000..5ae2929 --- /dev/null +++ b/NxFuncs/stpara/stparas.h @@ -0,0 +1,286 @@ + +//------------------------------------------------------------------------------- +// File Name: stparas.h +// Brief: +// Version: 1.0.0 +// Create Date: 2017/05/08 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, GetonAgain Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2017/05/08 + +// Modify by: ljs +// Modify Date: 2021/12/23 +//------------------------------------------------------------------------------- + +#ifndef __STPARAS_H__ +#define __STPARAS_H__ + +#include "config.h" +#include "stflash.h" + +//--------------------------------- + +#ifndef MAX_PARA_NUM +#define MAX_PARA_NUM 32 +#endif + +#define PARA_NUM (MAX_PARA_NUM-1) + +#define PARA_STR_LEN 20 + +#define PARA_VALID 0x55AA + +// +#define PTYPE_U 0 // ޷ +#define PTYPE_S 1 // з +#define PTYPE_B 2 // λͼ + +//--------------------------------- + +typedef struct +{ + u32 paraEn; // 20211223 ӲЧ־,ڲЧʱԶдĬϲ + u32 buf[PARA_NUM]; +} __attribute__ ((packed)) StParaStruct; + +//--------------------------------- + +#define STPARA_ADDR (STM32_PARA_ADDR+0) + +//------------------------------------ + +#define ST_PARAS_CODE(staddr, name) \ +\ +StParaStruct g_##name##Para;\ +u32 * g_p##name##ParaList = NULL;\ +char * g_p##name##ParasName = NULL;\ +\ +int Read##name##ParaData(void)\ +{\ + int rslt;\ + u32 rdaddr = (u32)(&g_##name##Para);\ + rslt = STMFlashRead((u32)(staddr), (u16*)(rdaddr), (sizeof(StParaStruct))/2);\ + return rslt;\ +}\ +\ +void Write##name##ParaData(void)\ +{\ + u32 wraddr = (u32)(&g_##name##Para);\ + STMFlashWrite((u32)(staddr), (u16*)(wraddr), (sizeof(StParaStruct))/2, 3);\ +}\ +\ +void Save##name##Para(void)\ +{\ + printf("save %s para\r\n", #name);\ + Write##name##ParaData();\ +}\ +\ +void Set##name##ParaList(void* pDat)\ +{\ + g_p##name##ParaList = pDat;\ +}\ +\ +void WriteDef##name##Para(void)\ +{\ + printf("write def %s para\r\n", #name);\ + if (g_p##name##ParaList != NULL)\ + {\ + int offset;\ + for (int i = 0; i < PARA_NUM; i++)\ + {\ + offset = i * 4 + 3;\ + g_##name##Para.buf[i] = *(g_p##name##ParaList + offset);\ + }\ + g_##name##Para.paraEn = PARA_VALID+CUR_MACHINE;\ + Save##name##Para();\ + }\ + else\ + {\ + printf("%s para list is NULL\r\n", #name);\ + }\ +}\ +\ +void Set##name##ParaNameString(void* pDat)\ +{\ + g_p##name##ParasName = pDat;\ +}\ +\ +void Load##name##Para(void)\ +{\ + int rslt;\ + rslt = Read##name##ParaData();\ + if (rslt != 0 || g_##name##Para.paraEn != (PARA_VALID+CUR_MACHINE))\ + {\ + printf("%s para invalid, rslt=%d, paraEn=0x%x\r\n", #name, rslt, g_##name##Para.paraEn);\ + WriteDef##name##Para();\ + }\ + else\ + {\ + printf("load %s para successful\r\n", #name);\ + }\ +}\ +\ +void CheckA##name##ParaRange(int id)\ +{\ + if (id <= 0 || id > PARA_NUM || g_p##name##ParaList == NULL)\ + {\ + return;\ + }\ + int paratype, minOffset, maxOffset;\ + int idx = id - 1;\ + paratype = (idx * 4);\ + minOffset = (idx * 4 + 1);\ + maxOffset = (idx * 4 + 2);\ + if (*(g_p##name##ParaList+paratype) == PTYPE_U)\ + {\ + if (g_##name##Para.buf[idx] < *(g_p##name##ParaList+minOffset))\ + {\ + printf(#name " para id=%d, val=%d less than min=%d, set to min\r\n", id, g_##name##Para.buf[idx], *(g_p##name##ParaList+minOffset));\ + g_##name##Para.buf[idx] = *(g_p##name##ParaList+minOffset);\ + }\ + else if (g_##name##Para.buf[idx] > *(g_p##name##ParaList+maxOffset))\ + {\ + printf(#name " para id=%d, val=%d more than max=%d, set to max\r\n", id, g_##name##Para.buf[idx], *(g_p##name##ParaList+maxOffset));\ + g_##name##Para.buf[idx] = *(g_p##name##ParaList+maxOffset);\ + }\ + }\ + else if (*(g_p##name##ParaList+paratype) == PTYPE_S)\ + {\ + if ((s32)g_##name##Para.buf[idx] < (s32)*(g_p##name##ParaList+minOffset))\ + {\ + printf(#name " para id=%d, val=%d less than min=%d, set to min\r\n", id, (s32)g_##name##Para.buf[idx], (s32)*(g_p##name##ParaList+minOffset));\ + g_##name##Para.buf[idx] = *(g_p##name##ParaList+minOffset);\ + }\ + else if ((s32)g_##name##Para.buf[idx] > (s32)*(g_p##name##ParaList+maxOffset))\ + {\ + printf(#name " para id=%d, val=%d more than max=%d, set to max\r\n", id, (s32)g_##name##Para.buf[idx], (s32)*(g_p##name##ParaList+maxOffset));\ + g_##name##Para.buf[idx] = *(g_p##name##ParaList+maxOffset);\ + }\ + }\ +}\ +void Check##name##ParasRange(void)\ +{\ + for(int i = 1; i <= PARA_NUM; i++)\ + {\ + CheckA##name##ParaRange(i);\ + }\ +}\ +void SetA##name##Para(int id, int val)\ +{\ + if (id < 1 || id > PARA_NUM)\ + {\ + return;\ + }\ + int old;\ + old = (int)g_##name##Para.buf[id-1];\ + g_##name##Para.buf[id-1] = val;\ + if (g_p##name##ParasName != NULL)\ + {\ + printf("set a para %d. %s = %d, oldvalue=%d\r\n", id, (g_p##name##ParasName+(id-1)*PARA_STR_LEN), g_##name##Para.buf[id-1], old);\ + }\ + else\ + {\ + printf("set a para %d. = %d, oldvalue=%d\r\n", id, g_##name##Para.buf[id-1], old);\ + }\ + CheckA##name##ParaRange(id);\ +}\ +\ +void Show##name##Para(char * para1, char * para2)\ +{\ + int i;\ + int paratype;\ +\ + printf(#name " para:\r\n");\ +\ + if (g_p##name##ParasName != NULL)\ + {\ + for (i = 0; i < PARA_NUM; i++)\ + {\ + if (strlen(g_p##name##ParasName+i*PARA_STR_LEN) != 0)\ + {\ + paratype = (i * 4);\ + if (*(g_p##name##ParaList+paratype) == PTYPE_U)\ + {\ + printf("%d. %s = %d\r\n", i+1, (g_p##name##ParasName+i*PARA_STR_LEN), g_##name##Para.buf[i]);\ + DelayMs(2);\ + }\ + else if (*(g_p##name##ParaList+paratype) == PTYPE_S)\ + {\ + printf("%d. %s = %d\r\n", i+1, (g_p##name##ParasName+i*PARA_STR_LEN), (s32)g_##name##Para.buf[i]);\ + DelayMs(2);\ + }\ + else if (*(g_p##name##ParaList+paratype) == PTYPE_B)\ + {\ + printf("%d. %s = 0x%x\r\n", i+1, (g_p##name##ParasName+i*PARA_STR_LEN), g_##name##Para.buf[i]);\ + DelayMs(2);\ + }\ + }\ + }\ + }\ +}\ +\ +void Set##name##Para(char * para1, char * para2)\ +{\ + int p1, p2;\ +\ + if (para1 == NULL || para2 == NULL)\ + {\ + return;\ + }\ +\ + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0)\ + {\ + return;\ + }\ + p1 = atoi(para1);\ + p2 = atoi(para2);\ +\ + if (p1 == 0 && p2 == 0)\ + {\ + WriteDef##name##Para();\ + }\ + else if (p1 <= PARA_NUM && p1 >= 1)\ + {\ + SetA##name##Para(p1, p2);\ + }\ + else if (p1 == 1000)\ + {\ + Save##name##Para();\ + }\ + else\ + {\ + }\ +}\ +void Init##name##Paras(void)\ +{\ + Set##name##ParaList((void*)(&g_def##name##ParaList));\ +\ + Load##name##Para();\ +\ + Set##name##ParaNameString((void*)(&g_##name##ParaStrList[0][0]));\ +\ + Check##name##ParasRange();\ +\ + AddShellCmd("SHOW"#name"PARA", "show "#name" paras", Show##name##Para);\ + AddShellCmd("SET"#name"PARA", "set "#name" paras", Set##name##Para);\ +}\ +//---------------------- + + + + + +//--------------------------------- + + + +//--------------------------------- + + +#endif + + diff --git a/NxFuncs/transdata/transdata.c b/NxFuncs/transdata/transdata.c new file mode 100644 index 0000000..0ad4841 --- /dev/null +++ b/NxFuncs/transdata/transdata.c @@ -0,0 +1,232 @@ + +#define _IN_TRANSDATA_C + +#include "transdata.h" + +#if (TRANS_APP_FILE == 1 || TRANS_DATA_FILE == 1) + +#include "comm.h" +#include "canctrl.h" +#include "crc16.h" + +void InitFileTransCtrl(FileTransCtrl * pfileTransCtrl) +{ + //printf("InitFileTransCtrl\r\n"); + memset(pfileTransCtrl, 0, sizeof(FileTransCtrl)); +} + +int WriteRsvBitmap(u32 idx, u8 sta, FileTransCtrl * pfileTransCtrl) +{ + u8 mod; + u32 baddr, yus; + + if (idx >= LEN_RSV_BMP*8) + { + printf("error in WriteRsvBitmap idx=%d, packetNum=%d\r\n", idx, pfileTransCtrl->packetNum); + return -1; + } + + baddr = (idx)/8; + if (baddr >= LEN_RSV_BMP) + { + printf("error in WriteRsvBitmap baddr=%d, lenBmp=%d\r\n",baddr, pfileTransCtrl->lenBmp); + return -1; + } + + yus = idx%8; + mod = 0x01; + while (yus != 0) + { + yus--; + mod <<= 1; + } + + if (sta == 0) + { + pfileTransCtrl->rsvBitmap[baddr] &= ~mod; + } + else + { + pfileTransCtrl->rsvBitmap[baddr] |= mod; + } + return 0; +} + +int IsResvFinish(FileTransCtrl * pfileTransCtrl) +{ + u8 mod; + u32 zss, yus; + u32 i; + + zss = (pfileTransCtrl->packetNum)/8; + yus = pfileTransCtrl->packetNum%8; + + for (i = 0; i < zss; i++) + { + if (pfileTransCtrl->rsvBitmap[i] != 0xff) + { + return FALSE; + } + } + + mod = 0x01; + for (i = 0; i < yus; i++) + { + if ((pfileTransCtrl->rsvBitmap[zss] & mod) == 0) + { + return FALSE; + } + mod <<= 1; + } + + return TRUE; +} + +/* + * ݴ䴦 + *return: 0: + * + */ +int TransDataProc(BoardFileCanCtrl filecan, FileTransCtrl * pfileTransCtrl, u8 nodetype) +{ + if (filecan.head.sync[0] == CDP_SYNC[0] && + filecan.head.sync[1] == CDP_SYNC[1] && + filecan.head.sync[2] == CDP_SYNC[2] && + 1) // ݰͷ + { + //printf("get a packet head,id=%d\r\n", filecan.head.pktId); + if (filecan.head.pktId == FILE_HEAD_ID) // ļ + { + printf("start receive file\r\n"); + InitFileTransCtrl(pfileTransCtrl); + pfileTransCtrl->pBoardFile = &g_boardFile; + pfileTransCtrl->transActive = TRANS_ACTIVE; + pfileTransCtrl->transflag = TRANS_READY; + pfileTransCtrl->rsvPktCount = 0; + } + // ¼ǰյݰID,֡,crcУ + pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId = filecan.head.pktId; + pfileTransCtrl->pBoardFile->filepkt.pktHead.head.fnum = filecan.head.fnum; + pfileTransCtrl->pBoardFile->filepkt.pktHead.head.crc = filecan.head.crc; + pfileTransCtrl->rsvFrameCount = 0; + } + else // + { + //printf("get a packet data\r\n"); + if (pfileTransCtrl->transActive != TRANS_ACTIVE) + { + //printf("TransDataProc file not active\r\n"); + return -1; + } + + if (pfileTransCtrl->transflag != TRANS_READY && + pfileTransCtrl->transflag != TRANS_DOING && + 1 ) + { + //printf("TransDataProc file not ready\r\n"); + return -2; + } + + if (pfileTransCtrl->transflag == TRANS_READY) + { + pfileTransCtrl->transflag = TRANS_DOING; + } + + // ݿ + memcpy(&pfileTransCtrl->pBoardFile->filepkt.pktData[pfileTransCtrl->rsvFrameCount].data, &filecan.data, CAN_DATA_LEN); + pfileTransCtrl->rsvFrameCount++; + + // жݰǷ + if (pfileTransCtrl->rsvFrameCount == pfileTransCtrl->pBoardFile->filepkt.pktHead.head.fnum) + {// ,У + //printf("a packet receive over\r\n"); + u16 crc = CalcCrc16((u8*)&pfileTransCtrl->pBoardFile->filepkt.pktData, pfileTransCtrl->pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN); + if (crc == pfileTransCtrl->pBoardFile->filepkt.pktHead.head.crc) + {// Уȷ + if (pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId == FILE_HEAD_ID) + {// ļݰ,ļͷ + printf("receive start over\r\n"); + memcpy(&pfileTransCtrl->pBoardFile->fileHead, &pfileTransCtrl->pBoardFile->filepkt.pktData, 6*CAN_DATA_LEN);// 6Ϊļͷ֡ + if (pfileTransCtrl->pBoardFile->fileHead.nodeType != nodetype) + { + printf("send to nodetype=0x%x\r\n", pfileTransCtrl->pBoardFile->fileHead.nodeType); + pfileTransCtrl->transActive = TRANS_NONE; + pfileTransCtrl->transflag = TRANS_NOT_BEG; + return -3; + } + pfileTransCtrl->packetNum = ((pfileTransCtrl->pBoardFile->fileHead.dataSize+1024-1)/1024); + pfileTransCtrl->lenBmp = (pfileTransCtrl->packetNum+CAN_DATA_LEN-1)/CAN_DATA_LEN; + + printf("now dataChecksum=%d, receive:dataSize=%d, dataChecksum=0x%x\r\n", + pfileTransCtrl->dataChecksum, + pfileTransCtrl->pBoardFile->fileHead.dataSize, + pfileTransCtrl->pBoardFile->fileHead.dataChecksum); + + if (pfileTransCtrl->pBoardFile->fileHead.fileType == FILE_TYPE_PGM) + { + InitSaveApp(); // Ҫһʱ + } + } + else + { + pfileTransCtrl->dataChecksum += CalcCheckSum((u8*)&pfileTransCtrl->pBoardFile->filepkt.pktData, 128*CAN_DATA_LEN);// 128CAN֡ + if (pfileTransCtrl->pBoardFile->fileHead.fileType == FILE_TYPE_PGM) + {// ļ,norflash,дλͼ + int rst, idx; + u32 ofst; + idx = (pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId == 0 ? 0:1); + if (pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId == 0) + { + ofst = 0; + } + else + { + ofst = (pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId-1)*pfileTransCtrl->pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN; + } + rst = SaveAppData(idx, + (u8*)&pfileTransCtrl->pBoardFile->filepkt.pktData, + pfileTransCtrl->pBoardFile->filepkt.pktHead.head.fnum*CAN_DATA_LEN, + ofst); + if (rst >= 0) + { + pfileTransCtrl->rsvPktCount++; + WriteRsvBitmap(pfileTransCtrl->pBoardFile->filepkt.pktHead.head.pktId, 1, pfileTransCtrl); + } + else + { + printf("TransDataProc WriteFileApp error rst= %d \r\n", rst); + } + } + } + // 鿴λͼǷ + if ((IsResvFinish(pfileTransCtrl) == TRUE) && (pfileTransCtrl->rsvPktCount == pfileTransCtrl->packetNum)) + { + //if (pfileTransCtrl->dataChecksum == pfileTransCtrl->pBoardFile->fileHead.dataChecksum) + if (1) + { + pfileTransCtrl->transflag = TRANS_DONE; // + printf("TransDataProc Receive file finish\r\n"); + } + else + { + printf("TransDataProc dataChecksum error, calc=0x%x, send=0x%x\r\n", + pfileTransCtrl->dataChecksum, pfileTransCtrl->pBoardFile->fileHead.dataChecksum); + } + } + } + else + { + printf("TransDataProc check crc error\r\n"); + } + } + } + return 0; +} + +int GetLenBmp(FileTransCtrl * pfileTransCtrl) +{ + return pfileTransCtrl->lenBmp; +} + + +#endif diff --git a/NxFuncs/transdata/transdata.h b/NxFuncs/transdata/transdata.h new file mode 100644 index 0000000..6e7ad20 --- /dev/null +++ b/NxFuncs/transdata/transdata.h @@ -0,0 +1,171 @@ + + +#ifndef _TRANSDATA_H_ +#define _TRANSDATA_H_ + +#include "config.h" + +#if (TRANS_APP_FILE == 1) +#include "stapp.h" +#endif + + +#if (TRANS_DATA_FILE == 1) +#include "datafile.h" +#endif + +#define LEN_RSV_BMP 1024 // λͼ + +#define FILE_HEAD_ID 0xFFFF // ΧļݰID + +#define TRANS_NONE 0x00 +#define TRANS_ACTIVE 0x5A + +#define TRANS_NOT_BEG 0x00 // ûյ +#define TRANS_READY 0x01 // ׼ +#define TRANS_DOING 0x02 // ڽ +#define TRANS_DONE 0x03 // +#define TRANS_REQUEST 0x04 // ģʽ + +#define FILE_TYPE_DAT 0x00 // ļ +#define FILE_TYPE_PGM 0x02 // ļ +#define FILE_TYPE_BOARD 0x03 // Χļ +#define FILE_TYPE_FRAME 0x04 // ߿͵ļ(ҪڹɺԶлԭļ,ҲҪλ·ļ) + +// Χļͷ +typedef struct +{ +// 0x00 + char fileName[32]; // ļ +// 0x20 + u32 dataSize; // ֽ + u32 dataChecksum; // ۼУ + + u8 protocol; // ļҪЭ + u8 nodeid; // ļҪĽڵID,0Ϊ㲥 + u8 fileType; // ļ + u8 nodeType; // 20220608 ļҪĽڵ + +// 0x2C + u8 reserved1[0x30-0x2C]; // 1 + +// 0x30 + u8 reserved2[0x64-0x30]; // 2 + +// 0x64 + u8 reserved3[0x80-0x64]; // 3 + +// 0x80 + u8 reserved4[0x100-0x80]; // 4 +}__attribute__ ((packed)) BoardFileHead; + +// ΧļCAN֡ƽṹ +typedef union +{ + u8 data[8]; + + struct + { + u8 sync[3]; + u16 pktId; // ID + u8 fnum; // ֡ + u16 crc; + } __attribute__ ((packed)) head; + + struct + { + u32 datasize; // ֽ + u32 dataChecksum; // ۼУ + } __attribute__ ((packed)) check; + + struct + { + u8 protocol; // ļҪЭ + u8 nodeid; // ļҪĽڵID,0Ϊ㲥 + u8 fileType; // ļ + u8 nodeType; // ļҪĽڵ + + u8 rev[4]; + } __attribute__ ((packed)) info; + +}BoardFileCanCtrl; + +// Χļݰƽṹ +// һݰ129CAN֡ +typedef struct +{ + BoardFileCanCtrl pktHead; + BoardFileCanCtrl pktData[128]; + +}BoardFilePacketCtrl; + +// Χļƽṹ +typedef struct +{ + BoardFileHead fileHead; // ļͷ + BoardFilePacketCtrl filepkt; // յݰ + +}BoardFileCtrl; + +// ݽտ +typedef struct +{ + u8 transActive; // ṹЧ + u8 transflag; // սȱ־ = 0, δʼ; = 1, ڽ; = 2 + + //---------------ļ-------------------- + u8 fileType; // ļ + u8 fileIdx; // Ϊļţ֧16ļ + u16 fileId; // ļID + +#if (TRANS_DATA_FILE == 1) + DatFileCtrl * pDatFile; +#endif + +#if (TRANS_APP_FILE == 1) + AppFileCtrl * pAppFile; +#endif + //---------------ļ-------------------- + + //---------------Χļ-------------------- + u16 rsvPktCount; // ݰ + u8 rsvFrameCount; // ֡ + u32 dataChecksum; // ۼУ + + BoardFileCtrl * pBoardFile; + //---------------Χļ-------------------- + + u32 packetNum; // ĸ + + u16 lenBmp; // λͼЧ + u8 rsvBitmap[LEN_RSV_BMP]; // ļսȱ־λͼ + +} __attribute__ ((packed)) FileTransCtrl; + + +#define CDPSYNC_LEN 3 +#ifdef _IN_TRANSDATA_C +const u8 CDP_SYNC[CDPSYNC_LEN] = +{ + 'C','D','P', +}; +#else +extern const u8 CDP_SYNC[]; +#endif + +void InitFileTransCtrl(FileTransCtrl * pfileTransCtrl); + +int WriteRsvBitmap(u32 idx, u8 sta, FileTransCtrl * pfileTransCtrl); +int IsResvFinish(FileTransCtrl * pfileTransCtrl); + +int TransDataProc(BoardFileCanCtrl filecan, FileTransCtrl * pfileTransCtrl, u8 nodetype); // Χļմ + +int GetLenBmp(FileTransCtrl * pfileTransCtrl); + +#ifdef _IN_TRANSDATA_C +BoardFileCtrl g_boardFile; +#else +extern BoardFileCtrl g_boardFile; +#endif + +#endif /* _TRANSDATA_H_ */ diff --git a/RemoteSystemsTempFiles/.project b/RemoteSystemsTempFiles/.project new file mode 100644 index 0000000..5447a64 --- /dev/null +++ b/RemoteSystemsTempFiles/.project @@ -0,0 +1,12 @@ + + + RemoteSystemsTempFiles + + + + + + + org.eclipse.rse.ui.remoteSystemsTempNature + + diff --git a/SEW-EXA1/.cproject b/SEW-EXA1/.cproject new file mode 100644 index 0000000..76e2ef4 --- /dev/null +++ b/SEW-EXA1/.cproject @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SEW-EXA1/.mxproject b/SEW-EXA1/.mxproject new file mode 100644 index 0000000..1cb0b4b --- /dev/null +++ b/SEW-EXA1/.mxproject @@ -0,0 +1,34 @@ +[PreviousLibFiles] +LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h; + +[PreviousUsedCubeIDEFiles] +SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\can.c;Core\Src\tim.c;Core\Src\usart.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c;Core\Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c;Core\Src/system_stm32f1xx.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;; +HeaderPath=Drivers\STM32F1xx_HAL_Driver\Inc;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F1xx\Include;Drivers\CMSIS\Include;Core\Inc; +CDefines=USE_FULL_LL_DRIVER;USE_HAL_DRIVER;STM32F103xE;USE_FULL_LL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER; + +[PreviousGenFiles] +AdvancedFolderStructure=true +HeaderFileListSize=8 +HeaderFiles#0=D:/working-goa/SEW-EXA1/Core/Inc/gpio.h +HeaderFiles#1=D:/working-goa/SEW-EXA1/Core/Inc/can.h +HeaderFiles#2=D:/working-goa/SEW-EXA1/Core/Inc/tim.h +HeaderFiles#3=D:/working-goa/SEW-EXA1/Core/Inc/usart.h +HeaderFiles#4=D:/working-goa/SEW-EXA1/Core/Inc/stm32f1xx_it.h +HeaderFiles#5=D:/working-goa/SEW-EXA1/Core/Inc/stm32_assert.h +HeaderFiles#6=D:/working-goa/SEW-EXA1/Core/Inc/stm32f1xx_hal_conf.h +HeaderFiles#7=D:/working-goa/SEW-EXA1/Core/Inc/main.h +HeaderFolderListSize=1 +HeaderPath#0=D:/working-goa/SEW-EXA1/Core/Inc +HeaderFiles=; +SourceFileListSize=7 +SourceFiles#0=D:/working-goa/SEW-EXA1/Core/Src/gpio.c +SourceFiles#1=D:/working-goa/SEW-EXA1/Core/Src/can.c +SourceFiles#2=D:/working-goa/SEW-EXA1/Core/Src/tim.c +SourceFiles#3=D:/working-goa/SEW-EXA1/Core/Src/usart.c +SourceFiles#4=D:/working-goa/SEW-EXA1/Core/Src/stm32f1xx_it.c +SourceFiles#5=D:/working-goa/SEW-EXA1/Core/Src/stm32f1xx_hal_msp.c +SourceFiles#6=D:/working-goa/SEW-EXA1/Core/Src/main.c +SourceFolderListSize=1 +SourcePath#0=D:/working-goa/SEW-EXA1/Core/Src +SourceFiles=; + diff --git a/SEW-EXA1/.project b/SEW-EXA1/.project new file mode 100644 index 0000000..deda4a0 --- /dev/null +++ b/SEW-EXA1/.project @@ -0,0 +1,45 @@ + + + SEW-EXA1 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.st.stm32cube.ide.mcu.MCUProjectNature + com.st.stm32cube.ide.mcu.MCUCubeProjectNature + org.eclipse.cdt.core.cnature + com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature + com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature + com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature + com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature + com.st.stm32cube.ide.mcu.MCURootProjectNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + NxBase + 2 + D:/GOAQUI/NxBase + + + NxFunc + 2 + D:/GOAQUI/NxFuncs + + + diff --git a/SEW-EXA1/.settings/language.settings.xml b/SEW-EXA1/.settings/language.settings.xml new file mode 100644 index 0000000..0e6586d --- /dev/null +++ b/SEW-EXA1/.settings/language.settings.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SEW-EXA1/.settings/org.eclipse.cdt.codan.core.prefs b/SEW-EXA1/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..19f7155 --- /dev/null +++ b/SEW-EXA1/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,72 @@ +com.st.stm32cube.ide.mcu.ide.oss.source.checker.libnano.problem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Float formatting support\\")"} +eclipse.preferences.version=1 +org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false} +org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"} +org.eclipse.cdt.codan.checkers.localvarreturn=-Warning +org.eclipse.cdt.codan.checkers.localvarreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Returning the address of a local variable\\")"} +org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} +org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"} +org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false} +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} +org.eclipse.cdt.codan.internal.checkers.BlacklistProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.BlacklistProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function or method is blacklisted\\")",blacklist\=>()} +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"C-Style cast instead of C++ cast\\")",checkMacro\=>true} +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false} +org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Lack of copyright information\\")",regex\=>".*Copyright.*"} +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"} +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.FloatCompareProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.FloatCompareProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Direct float comparison\\")"} +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Goto statement used\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MagicNumberProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MagicNumberProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Avoid magic numbers\\")",checkArray\=>true,checkOperatorParen\=>true,exceptions\=>(1,0,-1,2,1.0,0.0,-1.0)} +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing cases in switch\\")"} +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing default in switch\\")",defaultWithAllEnums\=>false} +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing reference return value in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing self check in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.MultipleDeclarationsProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MultipleDeclarationsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Multiple variable declaration\\")"} +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} +org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} +org.eclipse.cdt.codan.internal.checkers.ShallowCopyProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ShallowCopyProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Miss copy constructor or assignment operator\\")",onlynew\=>false} +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.StaticVariableInHeaderProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.StaticVariableInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Static variable in header file\\")"} +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false} +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false} +org.eclipse.cdt.codan.internal.checkers.SymbolShadowingProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.SymbolShadowingProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol shadowing\\")",paramFuncParameters\=>true} +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Using directive in header\\")"} +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem=-Error +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Virtual method call in constructor/destructor\\")"} diff --git a/SEW-EXA1/.settings/org.eclipse.cdt.core.prefs b/SEW-EXA1/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000..c8ec5df --- /dev/null +++ b/SEW-EXA1/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,6 @@ +doxygen/doxygen_new_line_after_brief=true +doxygen/doxygen_use_brief_tag=false +doxygen/doxygen_use_javadoc_tags=true +doxygen/doxygen_use_pre_tag=false +doxygen/doxygen_use_structural_commands=false +eclipse.preferences.version=1 diff --git a/SEW-EXA1/.settings/org.eclipse.core.resources.prefs b/SEW-EXA1/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..bb29a1d --- /dev/null +++ b/SEW-EXA1/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=GBK diff --git a/SEW-EXA1/.settings/stm32cubeide.project.prefs b/SEW-EXA1/.settings/stm32cubeide.project.prefs new file mode 100644 index 0000000..0487b90 --- /dev/null +++ b/SEW-EXA1/.settings/stm32cubeide.project.prefs @@ -0,0 +1,3 @@ +8DF89ED150041C4CBC7CB9A9CAA90856=2CEE2BC71DC1124B933AFF1798B81568 +DC22A860405A8BF2F2C095E5B6529F12=2CEE2BC71DC1124B933AFF1798B81568 +eclipse.preferences.version=1 diff --git a/SEW-EXA1/Core/Inc/can.h b/SEW-EXA1/Core/Inc/can.h new file mode 100644 index 0000000..6ea1ad1 --- /dev/null +++ b/SEW-EXA1/Core/Inc/can.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * @file can.h + * @brief This file contains all the function prototypes for + * the can.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __CAN_H__ +#define __CAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +extern CAN_HandleTypeDef hcan; + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_CAN_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CAN_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/gpio.h b/SEW-EXA1/Core/Inc/gpio.h new file mode 100644 index 0000000..3149c8f --- /dev/null +++ b/SEW-EXA1/Core/Inc/gpio.h @@ -0,0 +1,49 @@ +/** + ****************************************************************************** + * @file gpio.h + * @brief This file contains all the function prototypes for + * the gpio.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __GPIO_H__ +#define __GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_GPIO_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif +#endif /*__ GPIO_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/main.h b/SEW-EXA1/Core/Inc/main.h new file mode 100644 index 0000000..2520739 --- /dev/null +++ b/SEW-EXA1/Core/Inc/main.h @@ -0,0 +1,154 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.h + * @brief : Header for main.c file. + * This file contains the common defines of the application. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAIN_H +#define __MAIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" +#include "stm32f1xx_ll_rcc.h" +#include "stm32f1xx_ll_bus.h" +#include "stm32f1xx_ll_system.h" +#include "stm32f1xx_ll_exti.h" +#include "stm32f1xx_ll_cortex.h" +#include "stm32f1xx_ll_utils.h" +#include "stm32f1xx_ll_pwr.h" +#include "stm32f1xx_ll_dma.h" +#include "stm32f1xx_ll_tim.h" +#include "stm32f1xx_ll_usart.h" +#include "stm32f1xx.h" +#include "stm32f1xx_ll_gpio.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void Error_Handler(void); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +/* Private defines -----------------------------------------------------------*/ +#define ERR_LED_Pin LL_GPIO_PIN_13 +#define ERR_LED_GPIO_Port GPIOC +#define SYS_LED_Pin LL_GPIO_PIN_14 +#define SYS_LED_GPIO_Port GPIOC +#define CAN_MP_Pin LL_GPIO_PIN_2 +#define CAN_MP_GPIO_Port GPIOC +#define OUTPWM2_Pin LL_GPIO_PIN_0 +#define OUTPWM2_GPIO_Port GPIOA +#define RS485_2_EN_Pin LL_GPIO_PIN_1 +#define RS485_2_EN_GPIO_Port GPIOA +#define MT_DIR_Pin LL_GPIO_PIN_4 +#define MT_DIR_GPIO_Port GPIOA +#define MT_STEP_Pin LL_GPIO_PIN_5 +#define MT_STEP_GPIO_Port GPIOA +#define MT_SON_Pin LL_GPIO_PIN_6 +#define MT_SON_GPIO_Port GPIOA +#define OUTPUT1_Pin LL_GPIO_PIN_7 +#define OUTPUT1_GPIO_Port GPIOA +#define OUTPUT2_Pin LL_GPIO_PIN_4 +#define OUTPUT2_GPIO_Port GPIOC +#define OUTPUT3_Pin LL_GPIO_PIN_5 +#define OUTPUT3_GPIO_Port GPIOC +#define OUTPUT4_Pin LL_GPIO_PIN_0 +#define OUTPUT4_GPIO_Port GPIOB +#define RS485_EN_Pin LL_GPIO_PIN_1 +#define RS485_EN_GPIO_Port GPIOB +#define OUTPUT5_Pin LL_GPIO_PIN_12 +#define OUTPUT5_GPIO_Port GPIOB +#define OUTPUT6_Pin LL_GPIO_PIN_13 +#define OUTPUT6_GPIO_Port GPIOB +#define OUTPUT7_Pin LL_GPIO_PIN_14 +#define OUTPUT7_GPIO_Port GPIOB +#define OUTPUT8_Pin LL_GPIO_PIN_15 +#define OUTPUT8_GPIO_Port GPIOB +#define OUTPWM1_Pin LL_GPIO_PIN_6 +#define OUTPWM1_GPIO_Port GPIOC +#define SW1_Pin LL_GPIO_PIN_7 +#define SW1_GPIO_Port GPIOC +#define SW2_Pin LL_GPIO_PIN_8 +#define SW2_GPIO_Port GPIOC +#define SW3_Pin LL_GPIO_PIN_9 +#define SW3_GPIO_Port GPIOC +#define AP_Pin LL_GPIO_PIN_8 +#define AP_GPIO_Port GPIOA +#define AP_EXTI_IRQn EXTI9_5_IRQn +#define BP_Pin LL_GPIO_PIN_9 +#define BP_GPIO_Port GPIOA +#define BP_EXTI_IRQn EXTI9_5_IRQn +#define ZP_Pin LL_GPIO_PIN_10 +#define ZP_GPIO_Port GPIOA +#define ZP_EXTI_IRQn EXTI15_10_IRQn +#define INPUT8_Pin LL_GPIO_PIN_15 +#define INPUT8_GPIO_Port GPIOA +#define INPUT7_Pin LL_GPIO_PIN_10 +#define INPUT7_GPIO_Port GPIOC +#define INPUT6_Pin LL_GPIO_PIN_11 +#define INPUT6_GPIO_Port GPIOC +#define INPUT5_Pin LL_GPIO_PIN_12 +#define INPUT5_GPIO_Port GPIOC +#define INPUT4_Pin LL_GPIO_PIN_2 +#define INPUT4_GPIO_Port GPIOD +#define INPUT3_Pin LL_GPIO_PIN_3 +#define INPUT3_GPIO_Port GPIOB +#define INPUT2_Pin LL_GPIO_PIN_4 +#define INPUT2_GPIO_Port GPIOB +#define INPUT1_Pin LL_GPIO_PIN_5 +#define INPUT1_GPIO_Port GPIOB +#define SW4_Pin LL_GPIO_PIN_8 +#define SW4_GPIO_Port GPIOB +#define CAN_ZP_Pin LL_GPIO_PIN_9 +#define CAN_ZP_GPIO_Port GPIOB +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIN_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/stm32_assert.h b/SEW-EXA1/Core/Inc/stm32_assert.h new file mode 100644 index 0000000..03511c4 --- /dev/null +++ b/SEW-EXA1/Core/Inc/stm32_assert.h @@ -0,0 +1,53 @@ +/** + ****************************************************************************** + * @file stm32_assert.h + * @brief STM32 assert file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2018 STMicroelectronics. + * All rights reserved.

+ * + * 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****/ diff --git a/SEW-EXA1/Core/Inc/stm32f1xx_hal_conf.h b/SEW-EXA1/Core/Inc/stm32f1xx_hal_conf.h new file mode 100644 index 0000000..cbf4442 --- /dev/null +++ b/SEW-EXA1/Core/Inc/stm32f1xx_hal_conf.h @@ -0,0 +1,391 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_CONF_H +#define __STM32F1xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ + +#define HAL_MODULE_ENABLED + /*#define HAL_ADC_MODULE_ENABLED */ +/*#define HAL_CRYP_MODULE_ENABLED */ +#define HAL_CAN_MODULE_ENABLED +/*#define HAL_CAN_LEGACY_MODULE_ENABLED */ +/*#define HAL_CEC_MODULE_ENABLED */ +/*#define HAL_CORTEX_MODULE_ENABLED */ +/*#define HAL_CRC_MODULE_ENABLED */ +/*#define HAL_DAC_MODULE_ENABLED */ +/*#define HAL_DMA_MODULE_ENABLED */ +/*#define HAL_ETH_MODULE_ENABLED */ +/*#define HAL_FLASH_MODULE_ENABLED */ +/*#define HAL_GPIO_MODULE_ENABLED */ +/*#define HAL_I2C_MODULE_ENABLED */ +/*#define HAL_I2S_MODULE_ENABLED */ +/*#define HAL_IRDA_MODULE_ENABLED */ +/*#define HAL_IWDG_MODULE_ENABLED */ +/*#define HAL_NOR_MODULE_ENABLED */ +/*#define HAL_NAND_MODULE_ENABLED */ +/*#define HAL_PCCARD_MODULE_ENABLED */ +/*#define HAL_PCD_MODULE_ENABLED */ +/*#define HAL_HCD_MODULE_ENABLED */ +/*#define HAL_PWR_MODULE_ENABLED */ +/*#define HAL_RCC_MODULE_ENABLED */ +/*#define HAL_RTC_MODULE_ENABLED */ +/*#define HAL_SD_MODULE_ENABLED */ +/*#define HAL_MMC_MODULE_ENABLED */ +/*#define HAL_SDRAM_MODULE_ENABLED */ +/*#define HAL_SMARTCARD_MODULE_ENABLED */ +/*#define HAL_SPI_MODULE_ENABLED */ +/*#define HAL_SRAM_MODULE_ENABLED */ +/*#define HAL_TIM_MODULE_ENABLED */ +/*#define HAL_UART_MODULE_ENABLED */ +/*#define HAL_USART_MODULE_ENABLED */ +/*#define HAL_WWDG_MODULE_ENABLED */ + +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED + +/* ########################## Oscillator Values adaptation ####################*/ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) + #define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) + #define HSI_VALUE 8000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 40000U /*!< LSI Typical Value in Hz */ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz + The real value may vary depending on the variations + in voltage and temperature. */ + +/** + * @brief External Low Speed oscillator (LSE) value. + * This value is used by the UART, RTC HAL module to compute the system frequency + */ +#if !defined (LSE_VALUE) + #define LSE_VALUE 32768U /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY 0U /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 1U + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD 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_MMC_REGISTER_CALLBACKS 0U /* MMC 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_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB 8U /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB 4U /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver +* Activated: CRC code is present inside driver +* Deactivated: CRC code cleaned from driver +*/ + +#define USE_SPI_CRC 0U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f1xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f1xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f1xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f1xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f1xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f1xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #include "Legacy/stm32f1xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f1xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f1xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f1xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f1xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f1xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f1xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f1xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f1xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f1xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f1xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f1xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f1xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f1xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f1xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f1xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f1xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f1xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f1xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f1xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f1xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f1xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f1xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f1xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f1xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f1xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f1xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)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 /* __STM32F1xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/stm32f1xx_it.h b/SEW-EXA1/Core/Inc/stm32f1xx_it.h new file mode 100644 index 0000000..e9b0fd0 --- /dev/null +++ b/SEW-EXA1/Core/Inc/stm32f1xx_it.h @@ -0,0 +1,77 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f1xx_it.h + * @brief This file contains the headers of the interrupt handlers. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F1xx_IT_H +#define __STM32F1xx_IT_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void NMI_Handler(void); +void HardFault_Handler(void); +void MemManage_Handler(void); +void BusFault_Handler(void); +void UsageFault_Handler(void); +void SVC_Handler(void); +void DebugMon_Handler(void); +void PendSV_Handler(void); +void SysTick_Handler(void); +void USB_HP_CAN1_TX_IRQHandler(void); +void USB_LP_CAN1_RX0_IRQHandler(void); +void EXTI9_5_IRQHandler(void); +void TIM1_BRK_IRQHandler(void); +void USART1_IRQHandler(void); +void USART2_IRQHandler(void); +void USART3_IRQHandler(void); +void EXTI15_10_IRQHandler(void); +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_IT_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/tim.h b/SEW-EXA1/Core/Inc/tim.h new file mode 100644 index 0000000..01cc0ba --- /dev/null +++ b/SEW-EXA1/Core/Inc/tim.h @@ -0,0 +1,50 @@ +/** + ****************************************************************************** + * @file tim.h + * @brief This file contains all the function prototypes for + * the tim.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __TIM_H__ +#define __TIM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_TIM1_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIM_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Inc/usart.h b/SEW-EXA1/Core/Inc/usart.h new file mode 100644 index 0000000..8aa759e --- /dev/null +++ b/SEW-EXA1/Core/Inc/usart.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * @file usart.h + * @brief This file contains all the function prototypes for + * the usart.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 __USART_H__ +#define __USART_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_USART1_UART_Init(void); +void MX_USART2_UART_Init(void); +void MX_USART3_UART_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USART_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/can.c b/SEW-EXA1/Core/Src/can.c new file mode 100644 index 0000000..57c168d --- /dev/null +++ b/SEW-EXA1/Core/Src/can.c @@ -0,0 +1,120 @@ +/** + ****************************************************************************** + * @file can.c + * @brief This file provides code for the configuration + * of the CAN instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "can.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +CAN_HandleTypeDef hcan; + +/* CAN init function */ +void MX_CAN_Init(void) +{ + + hcan.Instance = CAN1; + hcan.Init.Prescaler = 4; + hcan.Init.Mode = CAN_MODE_NORMAL; + hcan.Init.SyncJumpWidth = CAN_SJW_2TQ; + hcan.Init.TimeSeg1 = CAN_BS1_14TQ; + hcan.Init.TimeSeg2 = CAN_BS2_3TQ; + hcan.Init.TimeTriggeredMode = DISABLE; + hcan.Init.AutoBusOff = ENABLE; + hcan.Init.AutoWakeUp = DISABLE; + hcan.Init.AutoRetransmission = ENABLE; + hcan.Init.ReceiveFifoLocked = DISABLE; + hcan.Init.TransmitFifoPriority = DISABLE; + if (HAL_CAN_Init(&hcan) != HAL_OK) + { + Error_Handler(); + } + +} + +void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle) +{ + + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(canHandle->Instance==CAN1) + { + /* USER CODE BEGIN CAN1_MspInit 0 */ + + /* USER CODE END CAN1_MspInit 0 */ + /* CAN1 clock enable */ + __HAL_RCC_CAN1_CLK_ENABLE(); + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**CAN GPIO Configuration + PA11 ------> CAN_RX + PA12 ------> CAN_TX + */ + GPIO_InitStruct.Pin = GPIO_PIN_11; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = GPIO_PIN_12; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* CAN1 interrupt Init */ + HAL_NVIC_SetPriority(USB_HP_CAN1_TX_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn); + HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn); + /* USER CODE BEGIN CAN1_MspInit 1 */ + + /* USER CODE END CAN1_MspInit 1 */ + } +} + +void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle) +{ + + if(canHandle->Instance==CAN1) + { + /* USER CODE BEGIN CAN1_MspDeInit 0 */ + + /* USER CODE END CAN1_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_CAN1_CLK_DISABLE(); + + /**CAN GPIO Configuration + PA11 ------> CAN_RX + PA12 ------> CAN_TX + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); + + /* CAN1 interrupt Deinit */ + HAL_NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn); + HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); + /* USER CODE BEGIN CAN1_MspDeInit 1 */ + + /* USER CODE END CAN1_MspDeInit 1 */ + } +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/gpio.c b/SEW-EXA1/Core/Src/gpio.c new file mode 100644 index 0000000..f3145d3 --- /dev/null +++ b/SEW-EXA1/Core/Src/gpio.c @@ -0,0 +1,172 @@ +/** + ****************************************************************************** + * @file gpio.c + * @brief This file provides code for the configuration + * of all used GPIO pins. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "gpio.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/*----------------------------------------------------------------------------*/ +/* Configure GPIO */ +/*----------------------------------------------------------------------------*/ +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/** Configure pins as + * Analog + * Input + * Output + * EVENT_OUT + * EXTI +*/ +void MX_GPIO_Init(void) +{ + + LL_EXTI_InitTypeDef EXTI_InitStruct = {0}; + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* GPIO Ports Clock Enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC); + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD); + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + + /**/ + LL_GPIO_ResetOutputPin(GPIOC, ERR_LED_Pin|SYS_LED_Pin); + + /**/ + LL_GPIO_ResetOutputPin(GPIOA, RS485_2_EN_Pin|MT_DIR_Pin|MT_STEP_Pin|MT_SON_Pin); + + /**/ + LL_GPIO_ResetOutputPin(RS485_EN_GPIO_Port, RS485_EN_Pin); + + /**/ + LL_GPIO_SetOutputPin(GPIOA, OUTPWM2_Pin|OUTPUT1_Pin); + + /**/ + LL_GPIO_SetOutputPin(GPIOC, OUTPUT2_Pin|OUTPUT3_Pin|OUTPWM1_Pin); + + /**/ + LL_GPIO_SetOutputPin(GPIOB, OUTPUT4_Pin|OUTPUT5_Pin|OUTPUT6_Pin|OUTPUT7_Pin + |OUTPUT8_Pin); + + /**/ + GPIO_InitStruct.Pin = ERR_LED_Pin|SYS_LED_Pin|OUTPUT2_Pin|OUTPUT3_Pin + |OUTPWM1_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = CAN_MP_Pin|SW1_Pin|SW2_Pin|SW3_Pin + |INPUT7_Pin|INPUT6_Pin|INPUT5_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = OUTPWM2_Pin|RS485_2_EN_Pin|MT_DIR_Pin|MT_STEP_Pin + |MT_SON_Pin|OUTPUT1_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = OUTPUT4_Pin|RS485_EN_Pin|OUTPUT5_Pin|OUTPUT6_Pin + |OUTPUT7_Pin|OUTPUT8_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = INPUT8_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(INPUT8_GPIO_Port, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = INPUT4_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(INPUT4_GPIO_Port, &GPIO_InitStruct); + + /**/ + GPIO_InitStruct.Pin = INPUT3_Pin|INPUT2_Pin|INPUT1_Pin|SW4_Pin + |CAN_ZP_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE8); + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE9); + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE10); + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_8; + EXTI_InitStruct.LineCommand = ENABLE; + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + LL_EXTI_Init(&EXTI_InitStruct); + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_9; + EXTI_InitStruct.LineCommand = ENABLE; + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + LL_EXTI_Init(&EXTI_InitStruct); + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_10; + EXTI_InitStruct.LineCommand = ENABLE; + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + LL_EXTI_Init(&EXTI_InitStruct); + + /**/ + LL_GPIO_SetPinMode(AP_GPIO_Port, AP_Pin, LL_GPIO_MODE_FLOATING); + + /**/ + LL_GPIO_SetPinMode(BP_GPIO_Port, BP_Pin, LL_GPIO_MODE_FLOATING); + + /**/ + LL_GPIO_SetPinMode(ZP_GPIO_Port, ZP_Pin, LL_GPIO_MODE_FLOATING); + + /* EXTI interrupt init*/ + NVIC_SetPriority(EXTI9_5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(EXTI9_5_IRQn); + NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(EXTI15_10_IRQn); + +} + +/* USER CODE BEGIN 2 */ + +/* USER CODE END 2 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/main.c b/SEW-EXA1/Core/Src/main.c new file mode 100644 index 0000000..3694482 --- /dev/null +++ b/SEW-EXA1/Core/Src/main.c @@ -0,0 +1,192 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.c + * @brief : Main program body + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "can.h" +#include "tim.h" +#include "usart.h" +#include "gpio.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +#include "tasks.h" +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN PTD */ + +/* USER CODE END PTD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ + +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +void SystemClock_Config(void); +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/** + * @brief The application entry point. + * @retval int + */ +int main(void) +{ + /* USER CODE BEGIN 1 */ + + /* USER CODE END 1 */ + + /* MCU Configuration--------------------------------------------------------*/ + + /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + HAL_Init(); + + /* USER CODE BEGIN Init */ + + /* USER CODE END Init */ + + /* Configure the system clock */ + SystemClock_Config(); + + /* USER CODE BEGIN SysInit */ + + /* USER CODE END SysInit */ + + /* Initialize all configured peripherals */ + MX_GPIO_Init(); + MX_CAN_Init(); + MX_TIM1_Init(); + MX_USART1_UART_Init(); + MX_USART2_UART_Init(); + MX_USART3_UART_Init(); + /* USER CODE BEGIN 2 */ + + /* USER CODE END 2 */ + + /* Infinite loop */ + /* USER CODE BEGIN WHILE */ + while (1) + { + /* USER CODE END WHILE */ + + /* USER CODE BEGIN 3 */ + MainTasks(); + } + /* USER CODE END 3 */ +} + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); + while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_2) + { + } + LL_RCC_HSE_Enable(); + + /* Wait till HSE is ready */ + while(LL_RCC_HSE_IsReady() != 1) + { + + } + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9); + LL_RCC_PLL_Enable(); + + /* Wait till PLL is ready */ + while(LL_RCC_PLL_IsReady() != 1) + { + + } + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2); + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + + /* Wait till System clock is ready */ + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + { + + } + LL_SetSystemCoreClock(72000000); + + /* Update the time base */ + if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK) + { + Error_Handler(); + } +} + +/* USER CODE BEGIN 4 */ + +/* USER CODE END 4 */ + +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + __disable_irq(); + while (1) + { + } + /* USER CODE END Error_Handler_Debug */ +} + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) +{ + /* USER CODE BEGIN 6 */ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* USER CODE END 6 */ +} +#endif /* USE_FULL_ASSERT */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/stm32f1xx_hal_msp.c b/SEW-EXA1/Core/Src/stm32f1xx_hal_msp.c new file mode 100644 index 0000000..b866dfb --- /dev/null +++ b/SEW-EXA1/Core/Src/stm32f1xx_hal_msp.c @@ -0,0 +1,88 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f1xx_hal_msp.c + * @brief This file provides code for the MSP Initialization + * and de-Initialization codes. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN Define */ + +/* USER CODE END Define */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN Macro */ + +/* USER CODE END Macro */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* External functions --------------------------------------------------------*/ +/* USER CODE BEGIN ExternalFunctions */ + +/* USER CODE END ExternalFunctions */ + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ +/** + * Initializes the Global MSP. + */ +void HAL_MspInit(void) +{ + /* USER CODE BEGIN MspInit 0 */ + + /* USER CODE END MspInit 0 */ + + __HAL_RCC_AFIO_CLK_ENABLE(); + __HAL_RCC_PWR_CLK_ENABLE(); + + /* System interrupt init*/ + + /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled + */ + __HAL_AFIO_REMAP_SWJ_NOJTAG(); + + /* USER CODE BEGIN MspInit 1 */ + + /* USER CODE END MspInit 1 */ +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/stm32f1xx_it.c b/SEW-EXA1/Core/Src/stm32f1xx_it.c new file mode 100644 index 0000000..f64ab1b --- /dev/null +++ b/SEW-EXA1/Core/Src/stm32f1xx_it.c @@ -0,0 +1,341 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32f1xx_it.c + * @brief Interrupt Service Routines. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "stm32f1xx_it.h" +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +#include "trigger.h" +#include "serial.h" +#include "sewhead.h" +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* External variables --------------------------------------------------------*/ +extern CAN_HandleTypeDef hcan; +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/******************************************************************************/ +/* Cortex-M3 Processor Interruption and Exception Handlers */ +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + while (1) + { + } + /* USER CODE END NonMaskableInt_IRQn 1 */ +} + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + /* USER CODE BEGIN HardFault_IRQn 0 */ + + /* USER CODE END HardFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_HardFault_IRQn 0 */ + /* USER CODE END W1_HardFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ + /* USER CODE END W1_MemoryManagement_IRQn 0 */ + } +} + +/** + * @brief This function handles Prefetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + /* USER CODE BEGIN BusFault_IRQn 0 */ + + /* USER CODE END BusFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_BusFault_IRQn 0 */ + /* USER CODE END W1_BusFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + /* USER CODE BEGIN UsageFault_IRQn 0 */ + + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ + /* USER CODE END W1_UsageFault_IRQn 0 */ + } +} + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + /* USER CODE BEGIN SVCall_IRQn 0 */ + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + /* USER CODE BEGIN DebugMonitor_IRQn 0 */ + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + +/** + * @brief This function handles Pendable request for system service. + */ +void PendSV_Handler(void) +{ + /* USER CODE BEGIN PendSV_IRQn 0 */ + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ + TriggerIntProc(); + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + +/******************************************************************************/ +/* STM32F1xx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32f1xx.s). */ +/******************************************************************************/ + +/** + * @brief This function handles USB high priority or CAN TX interrupts. + */ +void USB_HP_CAN1_TX_IRQHandler(void) +{ + /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 0 */ + + /* USER CODE END USB_HP_CAN1_TX_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan); + /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 1 */ + + /* USER CODE END USB_HP_CAN1_TX_IRQn 1 */ +} + +/** + * @brief This function handles USB low priority or CAN RX0 interrupts. + */ +void USB_LP_CAN1_RX0_IRQHandler(void) +{ + /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 0 */ + + /* USER CODE END USB_LP_CAN1_RX0_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan); + /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 1 */ + + /* USER CODE END USB_LP_CAN1_RX0_IRQn 1 */ +} + +/** + * @brief This function handles EXTI line[9:5] interrupts. + */ +void EXTI9_5_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI9_5_IRQn 0 */ + + /* USER CODE END EXTI9_5_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_8) != RESET) + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_8); + /* USER CODE BEGIN LL_EXTI_LINE_8 */ + APIntProc(); + /* USER CODE END LL_EXTI_LINE_8 */ + } + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_9) != RESET) + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_9); + /* USER CODE BEGIN LL_EXTI_LINE_9 */ + BPIntProc(); + /* USER CODE END LL_EXTI_LINE_9 */ + } + /* USER CODE BEGIN EXTI9_5_IRQn 1 */ + + /* USER CODE END EXTI9_5_IRQn 1 */ +} + +/** + * @brief This function handles TIM1 break interrupt. + */ +void TIM1_BRK_IRQHandler(void) +{ + /* USER CODE BEGIN TIM1_BRK_IRQn 0 */ + SoftPwmIntProc(); + /* USER CODE END TIM1_BRK_IRQn 0 */ + /* USER CODE BEGIN TIM1_BRK_IRQn 1 */ + + /* USER CODE END TIM1_BRK_IRQn 1 */ +} + +/** + * @brief This function handles USART1 global interrupt. + */ +void USART1_IRQHandler(void) +{ + /* USER CODE BEGIN USART1_IRQn 0 */ +#ifdef COMM_USART1 + USART1IntProc(); +#endif + /* USER CODE END USART1_IRQn 0 */ + /* USER CODE BEGIN USART1_IRQn 1 */ + + /* USER CODE END USART1_IRQn 1 */ +} + +/** + * @brief This function handles USART2 global interrupt. + */ +void USART2_IRQHandler(void) +{ + /* USER CODE BEGIN USART2_IRQn 0 */ +#ifdef COMM_USART2 + USART2IntProc(); +#endif + /* USER CODE END USART2_IRQn 0 */ + /* USER CODE BEGIN USART2_IRQn 1 */ + + /* USER CODE END USART2_IRQn 1 */ +} + +/** + * @brief This function handles USART3 global interrupt. + */ +void USART3_IRQHandler(void) +{ + /* USER CODE BEGIN USART3_IRQn 0 */ +#ifdef COMM_USART3 + USART3IntProc(); +#endif + /* USER CODE END USART3_IRQn 0 */ + /* USER CODE BEGIN USART3_IRQn 1 */ + + /* USER CODE END USART3_IRQn 1 */ +} + +/** + * @brief This function handles EXTI line[15:10] interrupts. + */ +void EXTI15_10_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI15_10_IRQn 0 */ + + /* USER CODE END EXTI15_10_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_10) != RESET) + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_10); + /* USER CODE BEGIN LL_EXTI_LINE_10 */ + ZPIntProc(); + /* USER CODE END LL_EXTI_LINE_10 */ + } + /* USER CODE BEGIN EXTI15_10_IRQn 1 */ + + /* USER CODE END EXTI15_10_IRQn 1 */ +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/syscalls.c b/SEW-EXA1/Core/Src/syscalls.c new file mode 100644 index 0000000..4ec9584 --- /dev/null +++ b/SEW-EXA1/Core/Src/syscalls.c @@ -0,0 +1,159 @@ +/** + ****************************************************************************** + * @file syscalls.c + * @author Auto-generated by STM32CubeIDE + * @brief STM32CubeIDE Minimal System calls file + * + * For more information about which c-functions + * need which of these lowlevel functions + * please consult the Newlib libc-manual + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes */ +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Variables */ +//#undef errno +extern int errno; +extern int __io_putchar(int ch) __attribute__((weak)); +extern int __io_getchar(void) __attribute__((weak)); + +register char * stack_ptr asm("sp"); + +char *__env[1] = { 0 }; +char **environ = __env; + + +/* Functions */ +void initialise_monitor_handles() +{ +} + +int _getpid(void) +{ + return 1; +} + +int _kill(int pid, int sig) +{ + errno = EINVAL; + return -1; +} + +void _exit (int status) +{ + _kill(status, -1); + while (1) {} /* Make sure we hang here */ +} + +__attribute__((weak)) int _read(int file, char *ptr, int len) +{ + int DataIdx; + + for (DataIdx = 0; DataIdx < len; DataIdx++) + { + *ptr++ = __io_getchar(); + } + +return len; +} + +__attribute__((weak)) int _write(int file, char *ptr, int len) +{ + int DataIdx; + + for (DataIdx = 0; DataIdx < len; DataIdx++) + { + __io_putchar(*ptr++); + } + return len; +} + +int _close(int file) +{ + return -1; +} + + +int _fstat(int file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int _isatty(int file) +{ + return 1; +} + +int _lseek(int file, int ptr, int dir) +{ + return 0; +} + +int _open(char *path, int flags, ...) +{ + /* Pretend like we always fail */ + return -1; +} + +int _wait(int *status) +{ + errno = ECHILD; + return -1; +} + +int _unlink(char *name) +{ + errno = ENOENT; + return -1; +} + +int _times(struct tms *buf) +{ + return -1; +} + +int _stat(char *file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int _link(char *old, char *new) +{ + errno = EMLINK; + return -1; +} + +int _fork(void) +{ + errno = EAGAIN; + return -1; +} + +int _execve(char *name, char **argv, char **env) +{ + errno = ENOMEM; + return -1; +} diff --git a/SEW-EXA1/Core/Src/sysmem.c b/SEW-EXA1/Core/Src/sysmem.c new file mode 100644 index 0000000..d7cc52c --- /dev/null +++ b/SEW-EXA1/Core/Src/sysmem.c @@ -0,0 +1,80 @@ +/** + ****************************************************************************** + * @file sysmem.c + * @author Generated by STM32CubeIDE + * @brief STM32CubeIDE System Memory calls file + * + * For more information about which C functions + * need which of these lowlevel functions + * please consult the newlib libc manual + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes */ +#include +#include + +/** + * Pointer to the current high watermark of the heap usage + */ +static uint8_t *__sbrk_heap_end = NULL; + +/** + * @brief _sbrk() allocates memory to the newlib heap and is used by malloc + * and others from the C library + * + * @verbatim + * ############################################################################ + * # .data # .bss # newlib heap # MSP stack # + * # # # # Reserved by _Min_Stack_Size # + * ############################################################################ + * ^-- RAM start ^-- _end _estack, RAM end --^ + * @endverbatim + * + * This implementation starts allocating at the '_end' linker symbol + * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack + * The implementation considers '_estack' linker symbol to be RAM end + * NOTE: If the MSP stack, at any point during execution, grows larger than the + * reserved size, please increase the '_Min_Stack_Size'. + * + * @param incr Memory size + * @return Pointer to allocated memory + */ +void *_sbrk(ptrdiff_t incr) +{ + extern uint8_t _end; /* Symbol defined in the linker script */ + extern uint8_t _estack; /* Symbol defined in the linker script */ + extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */ + const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size; + const uint8_t *max_heap = (uint8_t *)stack_limit; + uint8_t *prev_heap_end; + + /* Initialize heap end at first call */ + if (NULL == __sbrk_heap_end) + { + __sbrk_heap_end = &_end; + } + + /* Protect heap from growing into the reserved MSP stack */ + if (__sbrk_heap_end + incr > max_heap) + { + errno = ENOMEM; + return (void *)-1; + } + + prev_heap_end = __sbrk_heap_end; + __sbrk_heap_end += incr; + + return (void *)prev_heap_end; +} diff --git a/SEW-EXA1/Core/Src/system_stm32f1xx.c b/SEW-EXA1/Core/Src/system_stm32f1xx.c new file mode 100644 index 0000000..bc96aae --- /dev/null +++ b/SEW-EXA1/Core/Src/system_stm32f1xx.c @@ -0,0 +1,408 @@ +/** + ****************************************************************************** + * @file system_stm32f1xx.c + * @author MCD Application Team + * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File. + * + * 1. This file provides two functions and one global variable to be called from + * user application: + * - SystemInit(): Setups the system clock (System clock source, PLL Multiplier + * factors, AHB/APBx prescalers and Flash settings). + * This function is called at startup just after reset and + * before branch to main program. This call is made inside + * the "startup_stm32f1xx_xx.s" file. + * + * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used + * by the user application to setup the SysTick + * timer or configure other parameters. + * + * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must + * be called whenever the core clock is changed + * during program execution. + * + * 2. After each device reset the HSI (8 MHz) is used as system clock source. + * Then SystemInit() function is called, in "startup_stm32f1xx_xx.s" file, to + * configure the system clock before to branch to main program. + * + * 4. The default value of HSE crystal is set to 8 MHz (or 25 MHz, depending on + * the product used), refer to "HSE_VALUE". + * When HSE is used as system clock source, directly or through PLL, and you + * are using different crystal you have to adapt the HSE value to your own + * configuration. + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f1xx_system + * @{ + */ + +/** @addtogroup STM32F1xx_System_Private_Includes + * @{ + */ + +#include "stm32f1xx.h" + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_TypesDefinitions + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_Defines + * @{ + */ + +#if !defined (HSE_VALUE) + #define HSE_VALUE 8000000U /*!< Default value of the External oscillator in Hz. + This value can be provided and adapted by the user application. */ +#endif /* HSE_VALUE */ + +#if !defined (HSI_VALUE) + #define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz. + This value can be provided and adapted by the user application. */ +#endif /* HSI_VALUE */ + +/*!< Uncomment the following line if you need to use external SRAM */ +#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) +/* #define DATA_IN_ExtSRAM */ +#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ + +/* Note: Following vector table addresses must be defined in line with linker + configuration. */ +/*!< Uncomment the following line if you need to relocate the vector table + anywhere in Flash or Sram, else the vector table is kept at the automatic + remap of boot address selected */ +/* #define USER_VECT_TAB_ADDRESS */ + +#if defined(USER_VECT_TAB_ADDRESS) +/*!< Uncomment the following line if you need to relocate your vector Table + in Sram else user remap will be done in Flash. */ +/* #define VECT_TAB_SRAM */ +#if defined(VECT_TAB_SRAM) +#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field. + This value must be a multiple of 0x200. */ +#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field. + This value must be a multiple of 0x200. */ +#else +#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field. + This value must be a multiple of 0x200. */ +#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field. + This value must be a multiple of 0x200. */ +#endif /* VECT_TAB_SRAM */ +#endif /* USER_VECT_TAB_ADDRESS */ + +/******************************************************************************/ + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_Variables + * @{ + */ + + /* This variable is updated in three ways: + 1) by calling CMSIS function SystemCoreClockUpdate() + 2) by calling HAL API function HAL_RCC_GetHCLKFreq() + 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency + Note: If you use this function to configure the system clock; then there + is no need to call the 2 first functions listed above, since SystemCoreClock + variable is updated automatically. + */ +uint32_t SystemCoreClock = 16000000; +const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; +const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4}; + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_FunctionPrototypes + * @{ + */ + +#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) +#ifdef DATA_IN_ExtSRAM + static void SystemInit_ExtMemCtl(void); +#endif /* DATA_IN_ExtSRAM */ +#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ + +/** + * @} + */ + +/** @addtogroup STM32F1xx_System_Private_Functions + * @{ + */ + +/** + * @brief Setup the microcontroller system + * Initialize the Embedded Flash Interface, the PLL and update the + * SystemCoreClock variable. + * @note This function should be used only after reset. + * @param None + * @retval None + */ +void SystemInit (void) +{ +#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) + #ifdef DATA_IN_ExtSRAM + SystemInit_ExtMemCtl(); + #endif /* DATA_IN_ExtSRAM */ +#endif + + /* Configure the Vector Table location -------------------------------------*/ +#if defined(USER_VECT_TAB_ADDRESS) + SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */ +#endif /* USER_VECT_TAB_ADDRESS */ +} + +/** + * @brief Update SystemCoreClock variable according to Clock Register Values. + * The SystemCoreClock variable contains the core clock (HCLK), it can + * be used by the user application to setup the SysTick timer or configure + * other parameters. + * + * @note Each time the core clock (HCLK) changes, this function must be called + * to update SystemCoreClock variable value. Otherwise, any configuration + * based on this variable will be incorrect. + * + * @note - The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * + * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) + * + * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) + * + * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) + * or HSI_VALUE(*) multiplied by the PLL factors. + * + * (*) HSI_VALUE is a constant defined in stm32f1xx.h file (default value + * 8 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * + * (**) HSE_VALUE is a constant defined in stm32f1xx.h file (default value + * 8 MHz or 25 MHz, depending on the product used), user has to ensure + * that HSE_VALUE is same as the real frequency of the crystal used. + * Otherwise, this function may have wrong result. + * + * - The result of this function could be not correct when using fractional + * value for HSE crystal. + * @param None + * @retval None + */ +void SystemCoreClockUpdate (void) +{ + uint32_t tmp = 0U, pllmull = 0U, pllsource = 0U; + +#if defined(STM32F105xC) || defined(STM32F107xC) + uint32_t prediv1source = 0U, prediv1factor = 0U, prediv2factor = 0U, pll2mull = 0U; +#endif /* STM32F105xC */ + +#if defined(STM32F100xB) || defined(STM32F100xE) + uint32_t prediv1factor = 0U; +#endif /* STM32F100xB or STM32F100xE */ + + /* Get SYSCLK source -------------------------------------------------------*/ + tmp = RCC->CFGR & RCC_CFGR_SWS; + + switch (tmp) + { + case 0x00U: /* HSI used as system clock */ + SystemCoreClock = HSI_VALUE; + break; + case 0x04U: /* HSE used as system clock */ + SystemCoreClock = HSE_VALUE; + break; + case 0x08U: /* PLL used as system clock */ + + /* Get PLL clock source and multiplication factor ----------------------*/ + pllmull = RCC->CFGR & RCC_CFGR_PLLMULL; + pllsource = RCC->CFGR & RCC_CFGR_PLLSRC; + +#if !defined(STM32F105xC) && !defined(STM32F107xC) + pllmull = ( pllmull >> 18U) + 2U; + + if (pllsource == 0x00U) + { + /* HSI oscillator clock divided by 2 selected as PLL clock entry */ + SystemCoreClock = (HSI_VALUE >> 1U) * pllmull; + } + else + { + #if defined(STM32F100xB) || defined(STM32F100xE) + prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U; + /* HSE oscillator clock selected as PREDIV1 clock entry */ + SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull; + #else + /* HSE selected as PLL clock entry */ + if ((RCC->CFGR & RCC_CFGR_PLLXTPRE) != (uint32_t)RESET) + {/* HSE oscillator clock divided by 2 */ + SystemCoreClock = (HSE_VALUE >> 1U) * pllmull; + } + else + { + SystemCoreClock = HSE_VALUE * pllmull; + } + #endif + } +#else + pllmull = pllmull >> 18U; + + if (pllmull != 0x0DU) + { + pllmull += 2U; + } + else + { /* PLL multiplication factor = PLL input clock * 6.5 */ + pllmull = 13U / 2U; + } + + if (pllsource == 0x00U) + { + /* HSI oscillator clock divided by 2 selected as PLL clock entry */ + SystemCoreClock = (HSI_VALUE >> 1U) * pllmull; + } + else + {/* PREDIV1 selected as PLL clock entry */ + + /* Get PREDIV1 clock source and division factor */ + prediv1source = RCC->CFGR2 & RCC_CFGR2_PREDIV1SRC; + prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U; + + if (prediv1source == 0U) + { + /* HSE oscillator clock selected as PREDIV1 clock entry */ + SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull; + } + else + {/* PLL2 clock selected as PREDIV1 clock entry */ + + /* Get PREDIV2 division factor and PLL2 multiplication factor */ + prediv2factor = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> 4U) + 1U; + pll2mull = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> 8U) + 2U; + SystemCoreClock = (((HSE_VALUE / prediv2factor) * pll2mull) / prediv1factor) * pllmull; + } + } +#endif /* STM32F105xC */ + break; + + default: + SystemCoreClock = HSI_VALUE; + break; + } + + /* Compute HCLK clock frequency ----------------*/ + /* Get HCLK prescaler */ + tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4U)]; + /* HCLK clock frequency */ + SystemCoreClock >>= tmp; +} + +#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) +/** + * @brief Setup the external memory controller. Called in startup_stm32f1xx.s + * before jump to __main + * @param None + * @retval None + */ +#ifdef DATA_IN_ExtSRAM +/** + * @brief Setup the external memory controller. + * Called in startup_stm32f1xx_xx.s/.c before jump to main. + * This function configures the external SRAM mounted on STM3210E-EVAL + * board (STM32 High density devices). This SRAM will be used as program + * data memory (including heap and stack). + * @param None + * @retval None + */ +void SystemInit_ExtMemCtl(void) +{ + __IO uint32_t tmpreg; + /*!< FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is + required, then adjust the Register Addresses */ + + /* Enable FSMC clock */ + RCC->AHBENR = 0x00000114U; + + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN); + + /* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */ + RCC->APB2ENR = 0x000001E0U; + + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN); + + (void)(tmpreg); + +/* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/ +/*---------------- SRAM Address lines configuration -------------------------*/ +/*---------------- NOE and NWE configuration --------------------------------*/ +/*---------------- NE3 configuration ----------------------------------------*/ +/*---------------- NBL0, NBL1 configuration ---------------------------------*/ + + GPIOD->CRL = 0x44BB44BBU; + GPIOD->CRH = 0xBBBBBBBBU; + + GPIOE->CRL = 0xB44444BBU; + GPIOE->CRH = 0xBBBBBBBBU; + + GPIOF->CRL = 0x44BBBBBBU; + GPIOF->CRH = 0xBBBB4444U; + + GPIOG->CRL = 0x44BBBBBBU; + GPIOG->CRH = 0x444B4B44U; + +/*---------------- FSMC Configuration ---------------------------------------*/ +/*---------------- Enable FSMC Bank1_SRAM Bank ------------------------------*/ + + FSMC_Bank1->BTCR[4U] = 0x00001091U; + FSMC_Bank1->BTCR[5U] = 0x00110212U; +} +#endif /* DATA_IN_ExtSRAM */ +#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/tim.c b/SEW-EXA1/Core/Src/tim.c new file mode 100644 index 0000000..ca15b99 --- /dev/null +++ b/SEW-EXA1/Core/Src/tim.c @@ -0,0 +1,56 @@ +/** + ****************************************************************************** + * @file tim.c + * @brief This file provides code for the configuration + * of the TIM instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "tim.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* TIM1 init function */ +void MX_TIM1_Init(void) +{ + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1); + + /* TIM1 interrupt Init */ + NVIC_SetPriority(TIM1_BRK_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(TIM1_BRK_IRQn); + + TIM_InitStruct.Prescaler = 71; + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct.Autoreload = 33; + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + TIM_InitStruct.RepetitionCounter = 0; + LL_TIM_Init(TIM1, &TIM_InitStruct); + LL_TIM_EnableARRPreload(TIM1); + LL_TIM_SetClockSource(TIM1, LL_TIM_CLOCKSOURCE_INTERNAL); + LL_TIM_SetTriggerOutput(TIM1, LL_TIM_TRGO_RESET); + LL_TIM_DisableMasterSlaveMode(TIM1); + +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Src/usart.c b/SEW-EXA1/Core/Src/usart.c new file mode 100644 index 0000000..373f1f8 --- /dev/null +++ b/SEW-EXA1/Core/Src/usart.c @@ -0,0 +1,160 @@ +/** + ****************************************************************************** + * @file usart.c + * @brief This file provides code for the configuration + * of the USART instances. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2024 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usart.h" + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* USART1 init function */ + +void MX_USART1_UART_Init(void) +{ + LL_USART_InitTypeDef USART_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + /**USART1 GPIO Configuration + PB6 ------> USART1_TX + PB7 ------> USART1_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_6; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = LL_GPIO_PIN_7; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + LL_GPIO_AF_EnableRemap_USART1(); + + /* USART1 interrupt Init */ + NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(USART1_IRQn); + + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART1, &USART_InitStruct); + LL_USART_ConfigAsyncMode(USART1); + LL_USART_Enable(USART1); + +} +/* USART2 init function */ + +void MX_USART2_UART_Init(void) +{ + LL_USART_InitTypeDef USART_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2); + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); + /**USART2 GPIO Configuration + PA2 ------> USART2_TX + PA3 ------> USART2_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_2; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = LL_GPIO_PIN_3; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USART2 interrupt Init */ + NVIC_SetPriority(USART2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(USART2_IRQn); + + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART2, &USART_InitStruct); + LL_USART_ConfigAsyncMode(USART2); + LL_USART_Enable(USART2); + +} +/* USART3 init function */ + +void MX_USART3_UART_Init(void) +{ + LL_USART_InitTypeDef USART_InitStruct = {0}; + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3); + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + /**USART3 GPIO Configuration + PB10 ------> USART3_TX + PB11 ------> USART3_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_10; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = LL_GPIO_PIN_11; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /* USART3 interrupt Init */ + NVIC_SetPriority(USART3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + NVIC_EnableIRQ(USART3_IRQn); + + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART3, &USART_InitStruct); + LL_USART_ConfigAsyncMode(USART3); + LL_USART_Enable(USART3); + +} + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Core/Startup/startup_stm32f103rctx.s b/SEW-EXA1/Core/Startup/startup_stm32f103rctx.s new file mode 100644 index 0000000..ef23cee --- /dev/null +++ b/SEW-EXA1/Core/Startup/startup_stm32f103rctx.s @@ -0,0 +1,471 @@ +/** + *************** (C) COPYRIGHT 2017 STMicroelectronics ************************ + * @file startup_stm32f103xe.s + * @author MCD Application Team + * @brief STM32F103xE Devices vector table for Atollic toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address + * - Configure the clock system + * - Configure external SRAM mounted on STM3210E-EVAL board + * to be used as data memory (optional, to be enabled by user) + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M3 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m3 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + +/* Copy the data segment initializers from flash to SRAM */ + ldr r0, =_sdata + ldr r1, =_edata + ldr r2, =_sidata + movs r3, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r4, [r2, r3] + str r4, [r0, r3] + adds r3, r3, #4 + +LoopCopyDataInit: + adds r4, r0, r3 + cmp r4, r1 + bcc CopyDataInit + +/* Zero fill the bss segment. */ + ldr r2, =_sbss + ldr r4, =_ebss + movs r3, #0 + b LoopFillZerobss + +FillZerobss: + str r3, [r2] + adds r2, r2, #4 + +LoopFillZerobss: + cmp r2, r4 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + bx lr +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex M3. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_IRQHandler + .word TAMPER_IRQHandler + .word RTC_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_2_IRQHandler + .word USB_HP_CAN1_TX_IRQHandler + .word USB_LP_CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_IRQHandler + .word TIM1_UP_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word TIM3_IRQHandler + .word TIM4_IRQHandler + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTC_Alarm_IRQHandler + .word USBWakeUp_IRQHandler + .word TIM8_BRK_IRQHandler + .word TIM8_UP_IRQHandler + .word TIM8_TRG_COM_IRQHandler + .word TIM8_CC_IRQHandler + .word ADC3_IRQHandler + .word FSMC_IRQHandler + .word SDIO_IRQHandler + .word TIM5_IRQHandler + .word SPI3_IRQHandler + .word UART4_IRQHandler + .word UART5_IRQHandler + .word TIM6_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_5_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word BootRAM /* @0x1E0. This is for boot in RAM mode for + STM32F10x High Density devices. */ + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_IRQHandler + .thumb_set PVD_IRQHandler,Default_Handler + + .weak TAMPER_IRQHandler + .thumb_set TAMPER_IRQHandler,Default_Handler + + .weak RTC_IRQHandler + .thumb_set RTC_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_2_IRQHandler + .thumb_set ADC1_2_IRQHandler,Default_Handler + + .weak USB_HP_CAN1_TX_IRQHandler + .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler + + .weak USB_LP_CAN1_RX0_IRQHandler + .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_IRQHandler + .thumb_set TIM1_BRK_IRQHandler,Default_Handler + + .weak TIM1_UP_IRQHandler + .thumb_set TIM1_UP_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak TIM3_IRQHandler + .thumb_set TIM3_IRQHandler,Default_Handler + + .weak TIM4_IRQHandler + .thumb_set TIM4_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak USBWakeUp_IRQHandler + .thumb_set USBWakeUp_IRQHandler,Default_Handler + + .weak TIM8_BRK_IRQHandler + .thumb_set TIM8_BRK_IRQHandler,Default_Handler + + .weak TIM8_UP_IRQHandler + .thumb_set TIM8_UP_IRQHandler,Default_Handler + + .weak TIM8_TRG_COM_IRQHandler + .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler + + .weak TIM8_CC_IRQHandler + .thumb_set TIM8_CC_IRQHandler,Default_Handler + + .weak ADC3_IRQHandler + .thumb_set ADC3_IRQHandler,Default_Handler + + .weak FSMC_IRQHandler + .thumb_set FSMC_IRQHandler,Default_Handler + + .weak SDIO_IRQHandler + .thumb_set SDIO_IRQHandler,Default_Handler + + .weak TIM5_IRQHandler + .thumb_set TIM5_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak UART4_IRQHandler + .thumb_set UART4_IRQHandler,Default_Handler + + .weak UART5_IRQHandler + .thumb_set UART5_IRQHandler,Default_Handler + + .weak TIM6_IRQHandler + .thumb_set TIM6_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_5_IRQHandler + .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Debug/Core/Src/can.d b/SEW-EXA1/Debug/Core/Src/can.d new file mode 100644 index 0000000..4fca837 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/can.d @@ -0,0 +1,107 @@ +Core/Src/can.o: ../Core/Src/can.c ../Core/Inc/can.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Core/Src/can.o b/SEW-EXA1/Debug/Core/Src/can.o new file mode 100644 index 0000000..c0a676c Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/can.o differ diff --git a/SEW-EXA1/Debug/Core/Src/can.su b/SEW-EXA1/Debug/Core/Src/can.su new file mode 100644 index 0000000..d470133 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/can.su @@ -0,0 +1,3 @@ +can.c:30:6:MX_CAN_Init 8 static +can.c:52:6:HAL_CAN_MspInit 40 static +can.c:90:6:HAL_CAN_MspDeInit 16 static diff --git a/SEW-EXA1/Debug/Core/Src/gpio.d b/SEW-EXA1/Debug/Core/Src/gpio.d new file mode 100644 index 0000000..4820082 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/gpio.d @@ -0,0 +1,107 @@ +Core/Src/gpio.o: ../Core/Src/gpio.c ../Core/Inc/gpio.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Core/Inc/gpio.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Core/Src/gpio.o b/SEW-EXA1/Debug/Core/Src/gpio.o new file mode 100644 index 0000000..bfc0067 Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/gpio.o differ diff --git a/SEW-EXA1/Debug/Core/Src/gpio.su b/SEW-EXA1/Debug/Core/Src/gpio.su new file mode 100644 index 0000000..dee2926 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/gpio.su @@ -0,0 +1,10 @@ +core_cm3.h:1499:26:__NVIC_GetPriorityGrouping 4 static +core_cm3.h:1511:22:__NVIC_EnableIRQ 16 static +core_cm3.h:1639:22:__NVIC_SetPriority 16 static +core_cm3.h:1686:26:NVIC_EncodePriority 40 static +stm32f1xx_ll_bus.h:763:22:LL_APB2_GRP1_EnableClock 24 static +stm32f1xx_ll_gpio.h:342:22:LL_GPIO_SetPinMode 40 static,ignoring_inline_asm +stm32f1xx_ll_gpio.h:804:22:LL_GPIO_SetOutputPin 16 static +stm32f1xx_ll_gpio.h:833:22:LL_GPIO_ResetOutputPin 16 static +stm32f1xx_ll_gpio.h:2268:22:LL_GPIO_AF_SetEXTISource 24 static,ignoring_inline_asm +gpio.c:41:6:MX_GPIO_Init 40 static diff --git a/SEW-EXA1/Debug/Core/Src/main.d b/SEW-EXA1/Debug/Core/Src/main.d new file mode 100644 index 0000000..80a647f --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/main.d @@ -0,0 +1,124 @@ +Core/Src/main.o: ../Core/Src/main.c ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h ../Core/Inc/tim.h \ + ../Core/Inc/usart.h ../Core/Inc/gpio.h D:/GOAQUI/SEW-EXA1/Users/tasks.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +../Core/Inc/tim.h: + +../Core/Inc/usart.h: + +../Core/Inc/gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/tasks.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: diff --git a/SEW-EXA1/Debug/Core/Src/main.o b/SEW-EXA1/Debug/Core/Src/main.o new file mode 100644 index 0000000..3410211 Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/main.o differ diff --git a/SEW-EXA1/Debug/Core/Src/main.su b/SEW-EXA1/Debug/Core/Src/main.su new file mode 100644 index 0000000..5feb26e --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/main.su @@ -0,0 +1,15 @@ +stm32f1xx_ll_rcc.h:774:22:LL_RCC_HSE_Enable 4 static +stm32f1xx_ll_rcc.h:794:26:LL_RCC_HSE_IsReady 4 static +stm32f1xx_ll_rcc.h:1014:22:LL_RCC_SetSysClkSource 16 static +stm32f1xx_ll_rcc.h:1027:26:LL_RCC_GetSysClkSource 4 static +stm32f1xx_ll_rcc.h:1047:22:LL_RCC_SetAHBPrescaler 16 static +stm32f1xx_ll_rcc.h:1063:22:LL_RCC_SetAPB1Prescaler 16 static +stm32f1xx_ll_rcc.h:1079:22:LL_RCC_SetAPB2Prescaler 16 static +stm32f1xx_ll_rcc.h:1387:22:LL_RCC_PLL_Enable 4 static +stm32f1xx_ll_rcc.h:1408:26:LL_RCC_PLL_IsReady 4 static +stm32f1xx_ll_rcc.h:1477:22:LL_RCC_PLL_ConfigDomain_SYS 16 static +stm32f1xx_ll_system.h:470:22:LL_FLASH_SetLatency 16 static +stm32f1xx_ll_system.h:483:26:LL_FLASH_GetLatency 4 static +main.c:67:5:main 8 static +main.c:116:6:SystemClock_Config 8 static +main.c:164:6:Error_Handler 4 static,ignoring_inline_asm diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.d b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.d new file mode 100644 index 0000000..dd703a0 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.d @@ -0,0 +1,105 @@ +Core/Src/stm32f1xx_hal_msp.o: ../Core/Src/stm32f1xx_hal_msp.c \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.o b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.o new file mode 100644 index 0000000..072565c Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.o differ diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.su b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.su new file mode 100644 index 0000000..6f735d5 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/stm32f1xx_hal_msp.su @@ -0,0 +1 @@ +stm32f1xx_hal_msp.c:64:6:HAL_MspInit 24 static diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.d b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.d new file mode 100644 index 0000000..f519c67 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.d @@ -0,0 +1,120 @@ +Core/Src/stm32f1xx_it.o: ../Core/Src/stm32f1xx_it.c ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/stm32f1xx_it.h D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/SEW-EXA1/Users/App/sewhead/sewhead.h + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/stm32f1xx_it.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/SEW-EXA1/Users/App/sewhead/sewhead.h: diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.o b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.o new file mode 100644 index 0000000..cbd0bcc Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.o differ diff --git a/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.su b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.su new file mode 100644 index 0000000..277a47d --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/stm32f1xx_it.su @@ -0,0 +1,19 @@ +stm32f1xx_ll_exti.h:775:26:LL_EXTI_IsActiveFlag_0_31 16 static +stm32f1xx_ll_exti.h:843:22:LL_EXTI_ClearFlag_0_31 16 static +stm32f1xx_it.c:73:6:NMI_Handler 4 static +stm32f1xx_it.c:88:6:HardFault_Handler 4 static +stm32f1xx_it.c:103:6:MemManage_Handler 4 static +stm32f1xx_it.c:118:6:BusFault_Handler 4 static +stm32f1xx_it.c:133:6:UsageFault_Handler 4 static +stm32f1xx_it.c:148:6:SVC_Handler 4 static +stm32f1xx_it.c:161:6:DebugMon_Handler 4 static +stm32f1xx_it.c:174:6:PendSV_Handler 4 static +stm32f1xx_it.c:187:6:SysTick_Handler 8 static +stm32f1xx_it.c:208:6:USB_HP_CAN1_TX_IRQHandler 8 static +stm32f1xx_it.c:222:6:USB_LP_CAN1_RX0_IRQHandler 8 static +stm32f1xx_it.c:236:6:EXTI9_5_IRQHandler 8 static +stm32f1xx_it.c:263:6:TIM1_BRK_IRQHandler 8 static +stm32f1xx_it.c:276:6:USART1_IRQHandler 8 static +stm32f1xx_it.c:291:6:USART2_IRQHandler 8 static +stm32f1xx_it.c:306:6:USART3_IRQHandler 8 static +stm32f1xx_it.c:321:6:EXTI15_10_IRQHandler 8 static diff --git a/SEW-EXA1/Debug/Core/Src/subdir.mk b/SEW-EXA1/Debug/Core/Src/subdir.mk new file mode 100644 index 0000000..ca28806 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/subdir.mk @@ -0,0 +1,64 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Core/Src/can.c \ +../Core/Src/gpio.c \ +../Core/Src/main.c \ +../Core/Src/stm32f1xx_hal_msp.c \ +../Core/Src/stm32f1xx_it.c \ +../Core/Src/syscalls.c \ +../Core/Src/sysmem.c \ +../Core/Src/system_stm32f1xx.c \ +../Core/Src/tim.c \ +../Core/Src/usart.c + +OBJS += \ +./Core/Src/can.o \ +./Core/Src/gpio.o \ +./Core/Src/main.o \ +./Core/Src/stm32f1xx_hal_msp.o \ +./Core/Src/stm32f1xx_it.o \ +./Core/Src/syscalls.o \ +./Core/Src/sysmem.o \ +./Core/Src/system_stm32f1xx.o \ +./Core/Src/tim.o \ +./Core/Src/usart.o + +C_DEPS += \ +./Core/Src/can.d \ +./Core/Src/gpio.d \ +./Core/Src/main.d \ +./Core/Src/stm32f1xx_hal_msp.d \ +./Core/Src/stm32f1xx_it.d \ +./Core/Src/syscalls.d \ +./Core/Src/sysmem.d \ +./Core/Src/system_stm32f1xx.d \ +./Core/Src/tim.d \ +./Core/Src/usart.d + + +# Each subdirectory must supply rules for building sources it contributes +Core/Src/can.o: ../Core/Src/can.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/can.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/gpio.o: ../Core/Src/gpio.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/gpio.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/main.o: ../Core/Src/main.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/stm32f1xx_hal_msp.o: ../Core/Src/stm32f1xx_hal_msp.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32f1xx_hal_msp.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/stm32f1xx_it.o: ../Core/Src/stm32f1xx_it.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32f1xx_it.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/syscalls.o: ../Core/Src/syscalls.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/syscalls.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/sysmem.o: ../Core/Src/sysmem.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/sysmem.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/system_stm32f1xx.o: ../Core/Src/system_stm32f1xx.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32f1xx.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/tim.o: ../Core/Src/tim.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/tim.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Core/Src/usart.o: ../Core/Src/usart.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/usart.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Core/Src/syscalls.d b/SEW-EXA1/Debug/Core/Src/syscalls.d new file mode 100644 index 0000000..8667c70 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/syscalls.d @@ -0,0 +1 @@ +Core/Src/syscalls.o: ../Core/Src/syscalls.c diff --git a/SEW-EXA1/Debug/Core/Src/syscalls.o b/SEW-EXA1/Debug/Core/Src/syscalls.o new file mode 100644 index 0000000..8b6144f Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/syscalls.o differ diff --git a/SEW-EXA1/Debug/Core/Src/syscalls.su b/SEW-EXA1/Debug/Core/Src/syscalls.su new file mode 100644 index 0000000..492a785 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/syscalls.su @@ -0,0 +1,18 @@ +syscalls.c:48:6:initialise_monitor_handles 4 static +syscalls.c:52:5:_getpid 4 static +syscalls.c:57:5:_kill 16 static +syscalls.c:63:6:_exit 16 static +syscalls.c:69:27:_read 32 static +syscalls.c:81:27:_write 32 static +syscalls.c:92:5:_close 16 static +syscalls.c:98:5:_fstat 16 static +syscalls.c:104:5:_isatty 16 static +syscalls.c:109:5:_lseek 24 static +syscalls.c:114:5:_open 12 static +syscalls.c:120:5:_wait 16 static +syscalls.c:126:5:_unlink 16 static +syscalls.c:132:5:_times 16 static +syscalls.c:137:5:_stat 16 static +syscalls.c:143:5:_link 16 static +syscalls.c:149:5:_fork 8 static +syscalls.c:155:5:_execve 24 static diff --git a/SEW-EXA1/Debug/Core/Src/sysmem.d b/SEW-EXA1/Debug/Core/Src/sysmem.d new file mode 100644 index 0000000..74fecf9 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/sysmem.d @@ -0,0 +1 @@ +Core/Src/sysmem.o: ../Core/Src/sysmem.c diff --git a/SEW-EXA1/Debug/Core/Src/sysmem.o b/SEW-EXA1/Debug/Core/Src/sysmem.o new file mode 100644 index 0000000..a726da8 Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/sysmem.o differ diff --git a/SEW-EXA1/Debug/Core/Src/sysmem.su b/SEW-EXA1/Debug/Core/Src/sysmem.su new file mode 100644 index 0000000..4474c68 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/sysmem.su @@ -0,0 +1 @@ +sysmem.c:54:7:_sbrk 32 static diff --git a/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.d b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.d new file mode 100644 index 0000000..9d46084 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.d @@ -0,0 +1,70 @@ +Core/Src/system_stm32f1xx.o: ../Core/Src/system_stm32f1xx.c \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.o b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.o new file mode 100644 index 0000000..81b99be Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.o differ diff --git a/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.su b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.su new file mode 100644 index 0000000..967fb21 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/system_stm32f1xx.su @@ -0,0 +1,2 @@ +system_stm32f1xx.c:176:6:SystemInit 4 static +system_stm32f1xx.c:225:6:SystemCoreClockUpdate 24 static diff --git a/SEW-EXA1/Debug/Core/Src/tim.d b/SEW-EXA1/Debug/Core/Src/tim.d new file mode 100644 index 0000000..a277195 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/tim.d @@ -0,0 +1,107 @@ +Core/Src/tim.o: ../Core/Src/tim.c ../Core/Inc/tim.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Core/Inc/tim.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Core/Src/tim.o b/SEW-EXA1/Debug/Core/Src/tim.o new file mode 100644 index 0000000..bf0ddb0 Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/tim.o differ diff --git a/SEW-EXA1/Debug/Core/Src/tim.su b/SEW-EXA1/Debug/Core/Src/tim.su new file mode 100644 index 0000000..bdbe15b --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/tim.su @@ -0,0 +1,10 @@ +core_cm3.h:1499:26:__NVIC_GetPriorityGrouping 4 static +core_cm3.h:1511:22:__NVIC_EnableIRQ 16 static +core_cm3.h:1639:22:__NVIC_SetPriority 16 static +core_cm3.h:1686:26:NVIC_EncodePriority 40 static +stm32f1xx_ll_bus.h:763:22:LL_APB2_GRP1_EnableClock 24 static +stm32f1xx_ll_tim.h:1243:22:LL_TIM_EnableARRPreload 16 static +stm32f1xx_ll_tim.h:2581:22:LL_TIM_SetClockSource 16 static +stm32f1xx_ll_tim.h:2627:22:LL_TIM_SetTriggerOutput 16 static +stm32f1xx_ll_tim.h:2693:22:LL_TIM_DisableMasterSlaveMode 16 static +tim.c:28:6:MX_TIM1_Init 32 static diff --git a/SEW-EXA1/Debug/Core/Src/usart.d b/SEW-EXA1/Debug/Core/Src/usart.d new file mode 100644 index 0000000..ee8efcb --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/usart.d @@ -0,0 +1,107 @@ +Core/Src/usart.o: ../Core/Src/usart.c ../Core/Inc/usart.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Core/Inc/usart.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Core/Src/usart.o b/SEW-EXA1/Debug/Core/Src/usart.o new file mode 100644 index 0000000..bfe3bd8 Binary files /dev/null and b/SEW-EXA1/Debug/Core/Src/usart.o differ diff --git a/SEW-EXA1/Debug/Core/Src/usart.su b/SEW-EXA1/Debug/Core/Src/usart.su new file mode 100644 index 0000000..cdd1915 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Src/usart.su @@ -0,0 +1,12 @@ +core_cm3.h:1499:26:__NVIC_GetPriorityGrouping 4 static +core_cm3.h:1511:22:__NVIC_EnableIRQ 16 static +core_cm3.h:1639:22:__NVIC_SetPriority 16 static +core_cm3.h:1686:26:NVIC_EncodePriority 40 static +stm32f1xx_ll_bus.h:447:22:LL_APB1_GRP1_EnableClock 24 static +stm32f1xx_ll_bus.h:763:22:LL_APB2_GRP1_EnableClock 24 static +stm32f1xx_ll_usart.h:411:22:LL_USART_Enable 16 static +stm32f1xx_ll_usart.h:1526:22:LL_USART_ConfigAsyncMode 16 static +stm32f1xx_ll_gpio.h:948:22:LL_GPIO_AF_EnableRemap_USART1 4 static +usart.c:29:6:MX_USART1_UART_Init 56 static +usart.c:73:6:MX_USART2_UART_Init 56 static +usart.c:115:6:MX_USART3_UART_Init 56 static diff --git a/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.d b/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.d new file mode 100644 index 0000000..4c76db5 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.d @@ -0,0 +1,2 @@ +Core/Startup/startup_stm32f103rctx.o: \ + ../Core/Startup/startup_stm32f103rctx.s diff --git a/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.o b/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.o new file mode 100644 index 0000000..62480af Binary files /dev/null and b/SEW-EXA1/Debug/Core/Startup/startup_stm32f103rctx.o differ diff --git a/SEW-EXA1/Debug/Core/Startup/subdir.mk b/SEW-EXA1/Debug/Core/Startup/subdir.mk new file mode 100644 index 0000000..9f10af1 --- /dev/null +++ b/SEW-EXA1/Debug/Core/Startup/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +S_SRCS += \ +../Core/Startup/startup_stm32f103rctx.s + +OBJS += \ +./Core/Startup/startup_stm32f103rctx.o + +S_DEPS += \ +./Core/Startup/startup_stm32f103rctx.d + + +# Each subdirectory must supply rules for building sources it contributes +Core/Startup/startup_stm32f103rctx.o: ../Core/Startup/startup_stm32f103rctx.s + arm-none-eabi-gcc -mcpu=cortex-m3 -g3 -c -x assembler-with-cpp -MMD -MP -MF"Core/Startup/startup_stm32f103rctx.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" "$<" + diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d new file mode 100644 index 0000000..d3516fa --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o new file mode 100644 index 0000000..4361094 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.su new file mode 100644 index 0000000..b50d33d --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.su @@ -0,0 +1,25 @@ +stm32f1xx_hal.c:142:19:HAL_Init 8 static +stm32f1xx_hal.c:175:19:HAL_DeInit 8 static +stm32f1xx_hal.c:200:13:HAL_MspInit 4 static +stm32f1xx_hal.c:211:13:HAL_MspDeInit 4 static +stm32f1xx_hal.c:234:26:HAL_InitTick 16 static +stm32f1xx_hal.c:293:13:HAL_IncTick 4 static +stm32f1xx_hal.c:304:17:HAL_GetTick 4 static +stm32f1xx_hal.c:313:10:HAL_GetTickPrio 4 static +stm32f1xx_hal.c:322:19:HAL_SetTickFreq 24 static +stm32f1xx_hal.c:354:21:HAL_GetTickFreq 4 static +stm32f1xx_hal.c:370:13:HAL_Delay 24 static +stm32f1xx_hal.c:396:13:HAL_SuspendTick 4 static +stm32f1xx_hal.c:412:13:HAL_ResumeTick 4 static +stm32f1xx_hal.c:422:10:HAL_GetHalVersion 4 static +stm32f1xx_hal.c:438:10:HAL_GetREVID 4 static +stm32f1xx_hal.c:454:10:HAL_GetDEVID 4 static +stm32f1xx_hal.c:463:10:HAL_GetUIDw0 4 static +stm32f1xx_hal.c:472:10:HAL_GetUIDw1 4 static +stm32f1xx_hal.c:481:10:HAL_GetUIDw2 4 static +stm32f1xx_hal.c:490:6:HAL_DBGMCU_EnableDBGSleepMode 4 static +stm32f1xx_hal.c:506:6:HAL_DBGMCU_DisableDBGSleepMode 4 static +stm32f1xx_hal.c:536:6:HAL_DBGMCU_EnableDBGStopMode 4 static +stm32f1xx_hal.c:552:6:HAL_DBGMCU_DisableDBGStopMode 4 static +stm32f1xx_hal.c:568:6:HAL_DBGMCU_EnableDBGStandbyMode 4 static +stm32f1xx_hal.c:584:6:HAL_DBGMCU_DisableDBGStandbyMode 4 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d new file mode 100644 index 0000000..a772c3a --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o new file mode 100644 index 0000000..c7bcb55 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.su new file mode 100644 index 0000000..acceba0 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.su @@ -0,0 +1,36 @@ +stm32f1xx_hal_can.c:274:19:HAL_CAN_Init 24 static +stm32f1xx_hal_can.c:459:19:HAL_CAN_DeInit 16 static +stm32f1xx_hal_can.c:506:13:HAL_CAN_MspInit 16 static +stm32f1xx_hal_can.c:522:13:HAL_CAN_MspDeInit 16 static +stm32f1xx_hal_can.c:838:19:HAL_CAN_ConfigFilter 32 static +stm32f1xx_hal_can.c:1004:19:HAL_CAN_Start 24 static +stm32f1xx_hal_can.c:1056:19:HAL_CAN_Stop 24 static +stm32f1xx_hal_can.c:1111:19:HAL_CAN_RequestSleep 24 static +stm32f1xx_hal_can.c:1142:19:HAL_CAN_WakeUp 32 static +stm32f1xx_hal_can.c:1191:10:HAL_CAN_IsSleepActive 24 static +stm32f1xx_hal_can.c:1222:19:HAL_CAN_AddTxMessage 40 static +stm32f1xx_hal_can.c:1330:19:HAL_CAN_AbortTxRequest 24 static +stm32f1xx_hal_can.c:1379:10:HAL_CAN_GetTxMailboxesFreeLevel 24 static +stm32f1xx_hal_can.c:1422:10:HAL_CAN_IsTxMessagePending 24 static +stm32f1xx_hal_can.c:1454:10:HAL_CAN_GetTxTimestamp 40 static,ignoring_inline_asm +stm32f1xx_hal_can.c:1488:19:HAL_CAN_GetRxMessage 32 static +stm32f1xx_hal_can.c:1578:10:HAL_CAN_GetRxFifoFillLevel 24 static +stm32f1xx_hal_can.c:1631:19:HAL_CAN_ActivateNotification 24 static +stm32f1xx_hal_can.c:1664:19:HAL_CAN_DeactivateNotification 24 static +stm32f1xx_hal_can.c:1695:6:HAL_CAN_IRQHandler 48 static +stm32f1xx_hal_can.c:2106:13:HAL_CAN_TxMailbox0CompleteCallback 16 static +stm32f1xx_hal_can.c:2123:13:HAL_CAN_TxMailbox1CompleteCallback 16 static +stm32f1xx_hal_can.c:2140:13:HAL_CAN_TxMailbox2CompleteCallback 16 static +stm32f1xx_hal_can.c:2157:13:HAL_CAN_TxMailbox0AbortCallback 16 static +stm32f1xx_hal_can.c:2174:13:HAL_CAN_TxMailbox1AbortCallback 16 static +stm32f1xx_hal_can.c:2191:13:HAL_CAN_TxMailbox2AbortCallback 16 static +stm32f1xx_hal_can.c:2208:13:HAL_CAN_RxFifo0MsgPendingCallback 16 static +stm32f1xx_hal_can.c:2225:13:HAL_CAN_RxFifo0FullCallback 16 static +stm32f1xx_hal_can.c:2242:13:HAL_CAN_RxFifo1MsgPendingCallback 16 static +stm32f1xx_hal_can.c:2259:13:HAL_CAN_RxFifo1FullCallback 16 static +stm32f1xx_hal_can.c:2276:13:HAL_CAN_SleepCallback 16 static +stm32f1xx_hal_can.c:2292:13:HAL_CAN_WakeUpFromRxMsgCallback 16 static +stm32f1xx_hal_can.c:2309:13:HAL_CAN_ErrorCallback 16 static +stm32f1xx_hal_can.c:2346:22:HAL_CAN_GetState 24 static +stm32f1xx_hal_can.c:2381:10:HAL_CAN_GetError 16 static +stm32f1xx_hal_can.c:2393:19:HAL_CAN_ResetError 24 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d new file mode 100644 index 0000000..bbd21fb --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o new file mode 100644 index 0000000..3a514f4 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.su new file mode 100644 index 0000000..634528a --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.su @@ -0,0 +1,29 @@ +core_cm3.h:1480:22:__NVIC_SetPriorityGrouping 24 static +core_cm3.h:1499:26:__NVIC_GetPriorityGrouping 4 static +core_cm3.h:1511:22:__NVIC_EnableIRQ 16 static +core_cm3.h:1547:22:__NVIC_DisableIRQ 16 static,ignoring_inline_asm +core_cm3.h:1566:26:__NVIC_GetPendingIRQ 16 static +core_cm3.h:1585:22:__NVIC_SetPendingIRQ 16 static +core_cm3.h:1600:22:__NVIC_ClearPendingIRQ 16 static +core_cm3.h:1617:26:__NVIC_GetActive 16 static +core_cm3.h:1639:22:__NVIC_SetPriority 16 static +core_cm3.h:1661:26:__NVIC_GetPriority 16 static +core_cm3.h:1686:26:NVIC_EncodePriority 40 static +core_cm3.h:1713:22:NVIC_DecodePriority 40 static +core_cm3.h:1762:34:__NVIC_SystemReset 4 static,ignoring_inline_asm +core_cm3.h:1834:26:SysTick_Config 16 static +stm32f1xx_hal_cortex.c:143:6:HAL_NVIC_SetPriorityGrouping 16 static +stm32f1xx_hal_cortex.c:165:6:HAL_NVIC_SetPriority 32 static +stm32f1xx_hal_cortex.c:187:6:HAL_NVIC_EnableIRQ 16 static +stm32f1xx_hal_cortex.c:203:6:HAL_NVIC_DisableIRQ 16 static +stm32f1xx_hal_cortex.c:216:6:HAL_NVIC_SystemReset 8 static +stm32f1xx_hal_cortex.c:229:10:HAL_SYSTICK_Config 16 static +stm32f1xx_hal_cortex.c:344:10:HAL_NVIC_GetPriorityGrouping 8 static +stm32f1xx_hal_cortex.c:371:6:HAL_NVIC_GetPriority 24 static +stm32f1xx_hal_cortex.c:386:6:HAL_NVIC_SetPendingIRQ 16 static +stm32f1xx_hal_cortex.c:404:10:HAL_NVIC_GetPendingIRQ 16 static +stm32f1xx_hal_cortex.c:420:6:HAL_NVIC_ClearPendingIRQ 16 static +stm32f1xx_hal_cortex.c:437:10:HAL_NVIC_GetActive 16 static +stm32f1xx_hal_cortex.c:454:6:HAL_SYSTICK_CLKSourceConfig 16 static +stm32f1xx_hal_cortex.c:472:6:HAL_SYSTICK_IRQHandler 8 static +stm32f1xx_hal_cortex.c:481:13:HAL_SYSTICK_Callback 4 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d new file mode 100644 index 0000000..faf75a6 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o new file mode 100644 index 0000000..a030d66 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.su new file mode 100644 index 0000000..5c24809 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.su @@ -0,0 +1,13 @@ +stm32f1xx_hal_dma.c:143:19:HAL_DMA_Init 24 static +stm32f1xx_hal_dma.c:220:19:HAL_DMA_DeInit 16 static +stm32f1xx_hal_dma.c:319:19:HAL_DMA_Start 32 static +stm32f1xx_hal_dma.c:362:19:HAL_DMA_Start_IT 32 static +stm32f1xx_hal_dma.c:416:19:HAL_DMA_Abort 24 static +stm32f1xx_hal_dma.c:457:19:HAL_DMA_Abort_IT 24 static +stm32f1xx_hal_dma.c:502:19:HAL_DMA_PollForTransfer 32 static +stm32f1xx_hal_dma.c:603:6:HAL_DMA_IRQHandler 24 static +stm32f1xx_hal_dma.c:693:19:HAL_DMA_RegisterCallback 32 static +stm32f1xx_hal_dma.c:744:19:HAL_DMA_UnRegisterCallback 24 static +stm32f1xx_hal_dma.c:820:22:HAL_DMA_GetState 16 static +stm32f1xx_hal_dma.c:832:10:HAL_DMA_GetError 16 static +stm32f1xx_hal_dma.c:858:13:DMA_SetConfig 24 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d new file mode 100644 index 0000000..339c486 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o new file mode 100644 index 0000000..0c8c189 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.su new file mode 100644 index 0000000..f6f8c99 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.su @@ -0,0 +1,9 @@ +stm32f1xx_hal_exti.c:143:19:HAL_EXTI_SetConfigLine 32 static +stm32f1xx_hal_exti.c:238:19:HAL_EXTI_GetConfigLine 32 static +stm32f1xx_hal_exti.c:317:19:HAL_EXTI_ClearConfigLine 32 static +stm32f1xx_hal_exti.c:370:19:HAL_EXTI_RegisterCallback 32 static +stm32f1xx_hal_exti.c:395:19:HAL_EXTI_GetHandle 16 static +stm32f1xx_hal_exti.c:435:6:HAL_EXTI_IRQHandler 24 static +stm32f1xx_hal_exti.c:467:10:HAL_EXTI_GetPending 32 static +stm32f1xx_hal_exti.c:499:6:HAL_EXTI_ClearPending 24 static +stm32f1xx_hal_exti.c:523:6:HAL_EXTI_GenerateSWI 24 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d new file mode 100644 index 0000000..d2659ee --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o new file mode 100644 index 0000000..b66a70c Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.su new file mode 100644 index 0000000..09fa98e --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.su @@ -0,0 +1,14 @@ +stm32f1xx_hal_flash.c:168:19:HAL_FLASH_Program 48 static +stm32f1xx_hal_flash.c:267:19:HAL_FLASH_Program_IT 40 static +stm32f1xx_hal_flash.c:332:6:HAL_FLASH_IRQHandler 24 static +stm32f1xx_hal_flash.c:606:13:HAL_FLASH_EndOfOperationCallback 16 static +stm32f1xx_hal_flash.c:624:13:HAL_FLASH_OperationErrorCallback 16 static +stm32f1xx_hal_flash.c:657:19:HAL_FLASH_Unlock 16 static +stm32f1xx_hal_flash.c:695:19:HAL_FLASH_Lock 4 static +stm32f1xx_hal_flash.c:712:19:HAL_FLASH_OB_Unlock 4 static +stm32f1xx_hal_flash.c:732:19:HAL_FLASH_OB_Lock 4 static +stm32f1xx_hal_flash.c:745:6:HAL_FLASH_OB_Launch 8 static +stm32f1xx_hal_flash.c:774:10:HAL_FLASH_GetError 4 static +stm32f1xx_hal_flash.c:797:13:FLASH_Program_HalfWord 16 static +stm32f1xx_hal_flash.c:826:19:FLASH_WaitForLastOperation 24 static +stm32f1xx_hal_flash.c:914:13:FLASH_SetErrorCode 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d new file mode 100644 index 0000000..0883265 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o new file mode 100644 index 0000000..39c3848 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.su new file mode 100644 index 0000000..354b9bf --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.su @@ -0,0 +1,16 @@ +stm32f1xx_hal_flash_ex.c:159:19:HAL_FLASHEx_Erase 24 static +stm32f1xx_hal_flash_ex.c:319:19:HAL_FLASHEx_Erase_IT 24 static +stm32f1xx_hal_flash_ex.c:397:19:HAL_FLASHEx_OBErase 16 static +stm32f1xx_hal_flash_ex.c:446:19:HAL_FLASHEx_OBProgram 24 static +stm32f1xx_hal_flash_ex.c:527:6:HAL_FLASHEx_OBGetConfig 16 static +stm32f1xx_hal_flash_ex.c:549:10:HAL_FLASHEx_OBGetUserData 24 static +stm32f1xx_hal_flash_ex.c:595:13:FLASH_MassErase 16 static +stm32f1xx_hal_flash_ex.c:644:26:FLASH_OB_EnableWRP 32 static +stm32f1xx_hal_flash_ex.c:767:26:FLASH_OB_DisableWRP 32 static +stm32f1xx_hal_flash_ex.c:886:26:FLASH_OB_RDP_LevelConfig 24 static +stm32f1xx_hal_flash_ex.c:937:26:FLASH_OB_UserConfig 24 static +stm32f1xx_hal_flash_ex.c:988:26:FLASH_OB_ProgramData 24 static +stm32f1xx_hal_flash_ex.c:1021:17:FLASH_OB_GetWRP 4 static +stm32f1xx_hal_flash_ex.c:1034:17:FLASH_OB_GetRDP 16 static +stm32f1xx_hal_flash_ex.c:1060:16:FLASH_OB_GetUser 4 static +stm32f1xx_hal_flash_ex.c:1089:6:FLASH_PageErase 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d new file mode 100644 index 0000000..73b20cc --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o new file mode 100644 index 0000000..6a61bef Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.su new file mode 100644 index 0000000..27b52b4 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.su @@ -0,0 +1,8 @@ +stm32f1xx_hal_gpio.c:178:6:HAL_GPIO_Init 48 static +stm32f1xx_hal_gpio.c:351:6:HAL_GPIO_DeInit 40 static +stm32f1xx_hal_gpio.c:431:15:HAL_GPIO_ReadPin 24 static +stm32f1xx_hal_gpio.c:465:6:HAL_GPIO_WritePin 16 static +stm32f1xx_hal_gpio.c:487:6:HAL_GPIO_TogglePin 24 static +stm32f1xx_hal_gpio.c:511:19:HAL_GPIO_LockPin 24 static +stm32f1xx_hal_gpio.c:546:6:HAL_GPIO_EXTI_IRQHandler 16 static +stm32f1xx_hal_gpio.c:561:13:HAL_GPIO_EXTI_Callback 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d new file mode 100644 index 0000000..abcfc21 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o new file mode 100644 index 0000000..b107f66 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.su new file mode 100644 index 0000000..87a538a --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.su @@ -0,0 +1,3 @@ +stm32f1xx_hal_gpio_ex.c:81:6:HAL_GPIOEx_ConfigEventout 16 static +stm32f1xx_hal_gpio_ex.c:95:6:HAL_GPIOEx_EnableEventout 4 static +stm32f1xx_hal_gpio_ex.c:104:6:HAL_GPIOEx_DisableEventout 4 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d new file mode 100644 index 0000000..bb6f40d --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o new file mode 100644 index 0000000..779c400 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.su new file mode 100644 index 0000000..3a73422 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.su @@ -0,0 +1,18 @@ +stm32f1xx_hal_pwr.c:117:13:PWR_OverloadWfe 4 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:156:6:HAL_PWR_DeInit 4 static +stm32f1xx_hal_pwr.c:169:6:HAL_PWR_EnableBkUpAccess 4 static +stm32f1xx_hal_pwr.c:182:6:HAL_PWR_DisableBkUpAccess 4 static +stm32f1xx_hal_pwr.c:316:6:HAL_PWR_ConfigPVD 16 static +stm32f1xx_hal_pwr.c:359:6:HAL_PWR_EnablePVD 4 static +stm32f1xx_hal_pwr.c:369:6:HAL_PWR_DisablePVD 4 static +stm32f1xx_hal_pwr.c:382:6:HAL_PWR_EnableWakeUpPin 24 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:397:6:HAL_PWR_DisableWakeUpPin 24 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:417:6:HAL_PWR_EnterSLEEPMode 16 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:463:6:HAL_PWR_EnterSTOPMode 16 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:503:6:HAL_PWR_EnterSTANDBYMode 4 static,ignoring_inline_asm +stm32f1xx_hal_pwr.c:528:6:HAL_PWR_EnableSleepOnExit 4 static +stm32f1xx_hal_pwr.c:541:6:HAL_PWR_DisableSleepOnExit 4 static +stm32f1xx_hal_pwr.c:554:6:HAL_PWR_EnableSEVOnPend 4 static +stm32f1xx_hal_pwr.c:567:6:HAL_PWR_DisableSEVOnPend 4 static +stm32f1xx_hal_pwr.c:580:6:HAL_PWR_PVD_IRQHandler 8 static +stm32f1xx_hal_pwr.c:597:13:HAL_PWR_PVDCallback 4 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d new file mode 100644 index 0000000..4961488 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o new file mode 100644 index 0000000..e4fb2e8 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.su new file mode 100644 index 0000000..aa05c10 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.su @@ -0,0 +1,15 @@ +stm32f1xx_hal_rcc.c:202:19:HAL_RCC_DeInit 16 static +stm32f1xx_hal_rcc.c:347:19:HAL_RCC_OscConfig 32 static +stm32f1xx_hal_rcc.c:813:19:HAL_RCC_ClockConfig 24 static +stm32f1xx_hal_rcc.c:1002:6:HAL_RCC_MCOConfig 48 static +stm32f1xx_hal_rcc.c:1039:6:HAL_RCC_EnableCSS 4 static +stm32f1xx_hal_rcc.c:1048:6:HAL_RCC_DisableCSS 4 static +stm32f1xx_hal_rcc.c:1082:10:HAL_RCC_GetSysClockFreq 48 static +stm32f1xx_hal_rcc.c:1176:10:HAL_RCC_GetHCLKFreq 4 static +stm32f1xx_hal_rcc.c:1187:10:HAL_RCC_GetPCLK1Freq 8 static +stm32f1xx_hal_rcc.c:1199:10:HAL_RCC_GetPCLK2Freq 8 static +stm32f1xx_hal_rcc.c:1212:6:HAL_RCC_GetOscConfig 16 static +stm32f1xx_hal_rcc.c:1312:6:HAL_RCC_GetClockConfig 16 static +stm32f1xx_hal_rcc.c:1347:6:HAL_RCC_NMI_IRQHandler 8 static +stm32f1xx_hal_rcc.c:1365:13:RCC_Delay 24 static,ignoring_inline_asm +stm32f1xx_hal_rcc.c:1379:13:HAL_RCC_CSSCallback 4 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d new file mode 100644 index 0000000..a909958 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o new file mode 100644 index 0000000..79bedc1 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.su new file mode 100644 index 0000000..dbe5d7b --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.su @@ -0,0 +1,3 @@ +stm32f1xx_hal_rcc_ex.c:100:19:HAL_RCCEx_PeriphCLKConfig 32 static +stm32f1xx_hal_rcc_ex.c:294:6:HAL_RCCEx_GetPeriphCLKConfig 24 static +stm32f1xx_hal_rcc_ex.c:387:10:HAL_RCCEx_GetPeriphCLKFreq 64 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d new file mode 100644 index 0000000..e0d4fd0 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o new file mode 100644 index 0000000..74ecd4a Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d new file mode 100644 index 0000000..4c96d72 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d @@ -0,0 +1,71 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o new file mode 100644 index 0000000..534eee8 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.d new file mode 100644 index 0000000..7fb28e7 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.d @@ -0,0 +1,77 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o new file mode 100644 index 0000000..7ad3240 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.su new file mode 100644 index 0000000..df10f60 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.su @@ -0,0 +1,14 @@ +stm32f1xx_ll_dma.h:527:22:LL_DMA_ConfigTransfer 24 static +stm32f1xx_ll_dma.h:880:22:LL_DMA_SetDataLength 24 static +stm32f1xx_ll_dma.h:965:22:LL_DMA_SetMemoryAddress 24 static +stm32f1xx_ll_dma.h:987:22:LL_DMA_SetPeriphAddress 24 static +stm32f1xx_ll_dma.h:1438:22:LL_DMA_ClearFlag_GI1 16 static +stm32f1xx_ll_dma.h:1449:22:LL_DMA_ClearFlag_GI2 16 static +stm32f1xx_ll_dma.h:1460:22:LL_DMA_ClearFlag_GI3 16 static +stm32f1xx_ll_dma.h:1471:22:LL_DMA_ClearFlag_GI4 16 static +stm32f1xx_ll_dma.h:1482:22:LL_DMA_ClearFlag_GI5 16 static +stm32f1xx_ll_dma.h:1493:22:LL_DMA_ClearFlag_GI6 16 static +stm32f1xx_ll_dma.h:1504:22:LL_DMA_ClearFlag_GI7 16 static +stm32f1xx_ll_dma.c:130:10:LL_DMA_DeInit 24 static +stm32f1xx_ll_dma.c:218:10:LL_DMA_Init 24 static +stm32f1xx_ll_dma.c:279:6:LL_DMA_StructInit 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.d new file mode 100644 index 0000000..4cab5b8 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.d @@ -0,0 +1,74 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o new file mode 100644 index 0000000..0522b4e Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.su new file mode 100644 index 0000000..e5fd6b0 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.su @@ -0,0 +1,11 @@ +stm32f1xx_ll_exti.h:266:22:LL_EXTI_EnableIT_0_31 16 static +stm32f1xx_ll_exti.h:302:22:LL_EXTI_DisableIT_0_31 16 static +stm32f1xx_ll_exti.h:381:22:LL_EXTI_EnableEvent_0_31 16 static +stm32f1xx_ll_exti.h:416:22:LL_EXTI_DisableEvent_0_31 16 static +stm32f1xx_ll_exti.h:498:22:LL_EXTI_EnableRisingTrig_0_31 16 static +stm32f1xx_ll_exti.h:538:22:LL_EXTI_DisableRisingTrig_0_31 16 static +stm32f1xx_ll_exti.h:618:22:LL_EXTI_EnableFallingTrig_0_31 16 static +stm32f1xx_ll_exti.h:656:22:LL_EXTI_DisableFallingTrig_0_31 16 static +stm32f1xx_ll_exti.c:81:10:LL_EXTI_DeInit 4 static +stm32f1xx_ll_exti.c:106:10:LL_EXTI_Init 24 static +stm32f1xx_ll_exti.c:187:6:LL_EXTI_StructInit 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.d new file mode 100644 index 0000000..8176062 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.d @@ -0,0 +1,77 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o new file mode 100644 index 0000000..bc7f329 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.su new file mode 100644 index 0000000..0f94b82 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.su @@ -0,0 +1,9 @@ +stm32f1xx_ll_gpio.h:342:22:LL_GPIO_SetPinMode 40 static,ignoring_inline_asm +stm32f1xx_ll_gpio.h:420:22:LL_GPIO_SetPinSpeed 40 static,ignoring_inline_asm +stm32f1xx_ll_gpio.h:494:22:LL_GPIO_SetPinOutputType 40 static,ignoring_inline_asm +stm32f1xx_ll_gpio.h:565:22:LL_GPIO_SetPinPull 32 static,ignoring_inline_asm +stm32f1xx_ll_bus.h:930:22:LL_APB2_GRP1_ForceReset 16 static +stm32f1xx_ll_bus.h:985:22:LL_APB2_GRP1_ReleaseReset 16 static +stm32f1xx_ll_gpio.c:90:13:LL_GPIO_DeInit 24 static +stm32f1xx_ll_gpio.c:156:13:LL_GPIO_Init 40 static,ignoring_inline_asm +stm32f1xx_ll_gpio.c:228:6:LL_GPIO_StructInit 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.d new file mode 100644 index 0000000..da89d40 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.d @@ -0,0 +1,74 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o new file mode 100644 index 0000000..f92219f Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.su new file mode 100644 index 0000000..7f075b9 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.su @@ -0,0 +1,24 @@ +stm32f1xx_ll_rcc.h:840:22:LL_RCC_HSI_Enable 4 static +stm32f1xx_ll_rcc.h:860:26:LL_RCC_HSI_IsReady 4 static +stm32f1xx_ll_rcc.h:886:22:LL_RCC_HSI_SetCalibTrimming 16 static +stm32f1xx_ll_rcc.h:1014:22:LL_RCC_SetSysClkSource 16 static +stm32f1xx_ll_rcc.h:1027:26:LL_RCC_GetSysClkSource 4 static +stm32f1xx_ll_rcc.h:1098:26:LL_RCC_GetAHBPrescaler 4 static +stm32f1xx_ll_rcc.h:1113:26:LL_RCC_GetAPB1Prescaler 4 static +stm32f1xx_ll_rcc.h:1128:26:LL_RCC_GetAPB2Prescaler 4 static +stm32f1xx_ll_rcc.h:1263:26:LL_RCC_GetUSBClockSource 16 static +stm32f1xx_ll_rcc.h:1280:26:LL_RCC_GetADCClockSource 16 static +stm32f1xx_ll_rcc.h:1408:26:LL_RCC_PLL_IsReady 4 static +stm32f1xx_ll_rcc.h:1520:26:LL_RCC_PLL_GetMainSource 4 static +stm32f1xx_ll_rcc.h:1554:26:LL_RCC_PLL_GetMultiplicator 4 static +stm32f1xx_ll_rcc.h:1584:26:LL_RCC_PLL_GetPrediv 4 static +stm32f1xx_ll_rcc.h:2028:22:LL_RCC_ClearResetFlags 4 static +stm32f1xx_ll_rcc.c:103:13:LL_RCC_DeInit 8 static +stm32f1xx_ll_rcc.c:190:6:LL_RCC_GetSystemClocksFreq 16 static +stm32f1xx_ll_rcc.c:247:10:LL_RCC_GetUSBClockFreq 24 static +stm32f1xx_ll_rcc.c:306:10:LL_RCC_GetADCClockFreq 32 static,ignoring_inline_asm +stm32f1xx_ll_rcc.c:340:10:RCC_GetSystemClockFreq 16 static +stm32f1xx_ll_rcc.c:372:10:RCC_GetHCLKClockFreq 16 static +stm32f1xx_ll_rcc.c:383:10:RCC_GetPCLK1ClockFreq 16 static +stm32f1xx_ll_rcc.c:394:10:RCC_GetPCLK2ClockFreq 16 static +stm32f1xx_ll_rcc.c:404:10:RCC_PLL_GetFreqDomain_SYS 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.d new file mode 100644 index 0000000..6a82d91 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.d @@ -0,0 +1,77 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o new file mode 100644 index 0000000..64e1065 Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.su new file mode 100644 index 0000000..0ef9dbd --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.su @@ -0,0 +1,34 @@ +stm32f1xx_ll_tim.h:1354:22:LL_TIM_SetPrescaler 16 static +stm32f1xx_ll_tim.h:1379:22:LL_TIM_SetAutoReload 16 static +stm32f1xx_ll_tim.h:1404:22:LL_TIM_SetRepetitionCounter 16 static +stm32f1xx_ll_tim.h:2045:22:LL_TIM_OC_SetCompareCH1 16 static +stm32f1xx_ll_tim.h:2059:22:LL_TIM_OC_SetCompareCH2 16 static +stm32f1xx_ll_tim.h:2073:22:LL_TIM_OC_SetCompareCH3 16 static +stm32f1xx_ll_tim.h:2087:22:LL_TIM_OC_SetCompareCH4 16 static +stm32f1xx_ll_tim.h:2598:22:LL_TIM_SetEncoderMode 16 static +stm32f1xx_ll_tim.h:3776:22:LL_TIM_GenerateEvent_UPDATE 16 static +stm32f1xx_ll_bus.h:638:22:LL_APB1_GRP1_ForceReset 16 static +stm32f1xx_ll_bus.h:701:22:LL_APB1_GRP1_ReleaseReset 16 static +stm32f1xx_ll_bus.h:930:22:LL_APB2_GRP1_ForceReset 16 static +stm32f1xx_ll_bus.h:985:22:LL_APB2_GRP1_ReleaseReset 16 static +stm32f1xx_ll_tim.c:168:13:LL_TIM_DeInit 24 static +stm32f1xx_ll_tim.c:306:6:LL_TIM_StructInit 16 static +stm32f1xx_ll_tim.c:325:13:LL_TIM_Init 24 static +stm32f1xx_ll_tim.c:377:6:LL_TIM_OC_StructInit 16 static +stm32f1xx_ll_tim.c:404:13:LL_TIM_OC_Init 32 static +stm32f1xx_ll_tim.c:436:6:LL_TIM_IC_StructInit 16 static +stm32f1xx_ll_tim.c:459:13:LL_TIM_IC_Init 32 static +stm32f1xx_ll_tim.c:490:6:LL_TIM_ENCODER_StructInit 16 static +stm32f1xx_ll_tim.c:513:13:LL_TIM_ENCODER_Init 24 static +stm32f1xx_ll_tim.c:576:6:LL_TIM_HALLSENSOR_StructInit 16 static +stm32f1xx_ll_tim.c:604:13:LL_TIM_HALLSENSOR_Init 32 static +stm32f1xx_ll_tim.c:683:6:LL_TIM_BDTR_StructInit 16 static +stm32f1xx_ll_tim.c:709:13:LL_TIM_BDTR_Init 24 static +stm32f1xx_ll_tim.c:760:20:OC1Config 32 static +stm32f1xx_ll_tim.c:839:20:OC2Config 32 static +stm32f1xx_ll_tim.c:918:20:OC3Config 32 static +stm32f1xx_ll_tim.c:997:20:OC4Config 32 static +stm32f1xx_ll_tim.c:1068:20:IC1Config 16 static +stm32f1xx_ll_tim.c:1101:20:IC2Config 16 static +stm32f1xx_ll_tim.c:1134:20:IC3Config 16 static +stm32f1xx_ll_tim.c:1167:20:IC4Config 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.d new file mode 100644 index 0000000..01c1d2e --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.d @@ -0,0 +1,80 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o new file mode 100644 index 0000000..46be81d Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.su new file mode 100644 index 0000000..a9ab8d0 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.su @@ -0,0 +1,14 @@ +stm32f1xx_ll_usart.h:436:26:LL_USART_IsEnabled 16 static +stm32f1xx_ll_usart.h:779:22:LL_USART_DisableSCLKOutput 16 static +stm32f1xx_ll_usart.h:808:22:LL_USART_SetStopBitsLength 16 static +stm32f1xx_ll_usart.h:952:22:LL_USART_SetHWFlowCtrl 16 static +stm32f1xx_ll_usart.h:1088:22:LL_USART_SetBaudRate 24 static +stm32f1xx_ll_bus.h:638:22:LL_APB1_GRP1_ForceReset 16 static +stm32f1xx_ll_bus.h:701:22:LL_APB1_GRP1_ReleaseReset 16 static +stm32f1xx_ll_bus.h:930:22:LL_APB2_GRP1_ForceReset 16 static +stm32f1xx_ll_bus.h:985:22:LL_APB2_GRP1_ReleaseReset 16 static +stm32f1xx_ll_usart.c:125:13:LL_USART_DeInit 24 static +stm32f1xx_ll_usart.c:199:13:LL_USART_Init 40 static +stm32f1xx_ll_usart.c:325:6:LL_USART_StructInit 16 static +stm32f1xx_ll_usart.c:351:13:LL_USART_ClockInit 24 static +stm32f1xx_ll_usart.c:410:6:LL_USART_ClockStructInit 16 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.d b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.d new file mode 100644 index 0000000..dabd2e0 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.d @@ -0,0 +1,80 @@ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o: \ + ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o new file mode 100644 index 0000000..d76373d Binary files /dev/null and b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o differ diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.su b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.su new file mode 100644 index 0000000..a1ea5be --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.su @@ -0,0 +1,28 @@ +stm32f1xx_ll_rcc.h:754:22:LL_RCC_HSE_EnableBypass 4 static +stm32f1xx_ll_rcc.h:764:22:LL_RCC_HSE_DisableBypass 4 static +stm32f1xx_ll_rcc.h:774:22:LL_RCC_HSE_Enable 4 static +stm32f1xx_ll_rcc.h:794:26:LL_RCC_HSE_IsReady 4 static +stm32f1xx_ll_rcc.h:840:22:LL_RCC_HSI_Enable 4 static +stm32f1xx_ll_rcc.h:860:26:LL_RCC_HSI_IsReady 4 static +stm32f1xx_ll_rcc.h:1014:22:LL_RCC_SetSysClkSource 16 static +stm32f1xx_ll_rcc.h:1027:26:LL_RCC_GetSysClkSource 4 static +stm32f1xx_ll_rcc.h:1047:22:LL_RCC_SetAHBPrescaler 16 static +stm32f1xx_ll_rcc.h:1063:22:LL_RCC_SetAPB1Prescaler 16 static +stm32f1xx_ll_rcc.h:1079:22:LL_RCC_SetAPB2Prescaler 16 static +stm32f1xx_ll_rcc.h:1098:26:LL_RCC_GetAHBPrescaler 4 static +stm32f1xx_ll_rcc.h:1387:22:LL_RCC_PLL_Enable 4 static +stm32f1xx_ll_rcc.h:1408:26:LL_RCC_PLL_IsReady 4 static +stm32f1xx_ll_rcc.h:1477:22:LL_RCC_PLL_ConfigDomain_SYS 16 static +stm32f1xx_ll_utils.h:218:22:LL_InitTick 16 static +stm32f1xx_ll_system.h:470:22:LL_FLASH_SetLatency 16 static +stm32f1xx_ll_system.h:483:26:LL_FLASH_GetLatency 4 static +stm32f1xx_ll_utils.c:196:6:LL_Init1msTick 16 static +stm32f1xx_ll_utils.c:212:6:LL_mDelay 24 static +stm32f1xx_ll_utils.c:270:6:LL_SetSystemCoreClock 16 static +stm32f1xx_ll_utils.c:285:13:LL_SetFlashLatency 32 static +stm32f1xx_ll_utils.c:365:13:LL_PLL_ConfigSystemClock_HSI 24 static +stm32f1xx_ll_utils.c:430:13:LL_PLL_ConfigSystemClock_HSE 32 static +stm32f1xx_ll_utils.c:539:17:UTILS_GetPLLOutputFrequency 24 static +stm32f1xx_ll_utils.c:572:20:UTILS_PLL_HSE_ConfigSystemClock 32 static +stm32f1xx_ll_utils.c:641:20:UTILS_PLL_IsBusy 16 static +stm32f1xx_ll_utils.c:681:20:UTILS_EnablePLLAndSwitchSystem 32 static diff --git a/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk new file mode 100644 index 0000000..e47a563 --- /dev/null +++ b/SEW-EXA1/Debug/Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk @@ -0,0 +1,119 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c \ +../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c + +OBJS += \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + +C_DEPS += \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.d \ +./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.d + + +# Each subdirectory must supply rules for building sources it contributes +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxBase/buttons.d b/SEW-EXA1/Debug/NxBase/buttons.d new file mode 100644 index 0000000..1f7c805 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/buttons.d @@ -0,0 +1,115 @@ +NxBase/buttons.o: D:/GOAQUI/NxBase/buttons.c D:/GOAQUI/NxBase/buttons.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxBase/buttons.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxBase/buttons.o b/SEW-EXA1/Debug/NxBase/buttons.o new file mode 100644 index 0000000..a5495cc Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/buttons.o differ diff --git a/SEW-EXA1/Debug/NxBase/buttons.su b/SEW-EXA1/Debug/NxBase/buttons.su new file mode 100644 index 0000000..7ed2660 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/buttons.su @@ -0,0 +1,7 @@ +buttons.c:57:6:InitButtonCtrl 16 static +buttons.c:78:5:AddButtonToList 24 static +buttons.c:108:6:ScanButtons 24 static +buttons.c:240:5:WaitAllButtonUp 32 static +buttons.c:291:6:RegDelayFun 16 static +buttons.c:296:6:CleanButtonTask 4 static +buttons.c:302:6:ButtonsTask 24 static diff --git a/SEW-EXA1/Debug/NxBase/canctrl.d b/SEW-EXA1/Debug/NxBase/canctrl.d new file mode 100644 index 0000000..797b109 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/canctrl.d @@ -0,0 +1,122 @@ +NxBase/canctrl.o: D:/GOAQUI/NxBase/canctrl.c D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/NxBase/cpuid.h + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/NxBase/cpuid.h: diff --git a/SEW-EXA1/Debug/NxBase/canctrl.o b/SEW-EXA1/Debug/NxBase/canctrl.o new file mode 100644 index 0000000..f2f3e7c Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/canctrl.o differ diff --git a/SEW-EXA1/Debug/NxBase/canctrl.su b/SEW-EXA1/Debug/NxBase/canctrl.su new file mode 100644 index 0000000..e22a878 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/canctrl.su @@ -0,0 +1,16 @@ +canctrl.c:21:6:DefaultCanFilter 64 static +canctrl.c:45:6:RegistFilter 16 static +canctrl.c:52:6:InitCanCtrl 16 static +canctrl.c:89:6:InitCanMsgList 8 static +canctrl.c:112:5:TransCanDataToBus 16 static +canctrl.c:151:5:ResvCanDataFromBus 48 static +canctrl.c:190:5:SendACANDataPacket 24 static +canctrl.c:252:5:GetACanDataPacket 24 static +canctrl.c:286:6:CanTransIntProc 16 static +canctrl.c:308:6:CanResvIntProc 16 static +canctrl.c:323:6:HAL_CAN_TxMailbox0CompleteCallback 16 static +canctrl.c:332:6:HAL_CAN_TxMailbox1CompleteCallback 16 static +canctrl.c:341:6:HAL_CAN_TxMailbox2CompleteCallback 16 static +canctrl.c:350:6:HAL_CAN_RxFifo0MsgPendingCallback 16 static +canctrl.c:359:6:HAL_CAN_RxFifo0FullCallback 16 static +canctrl.c:364:6:HAL_CAN_ErrorCallback 16 static diff --git a/SEW-EXA1/Debug/NxBase/console.d b/SEW-EXA1/Debug/NxBase/console.d new file mode 100644 index 0000000..849bde9 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/console.d @@ -0,0 +1,120 @@ +NxBase/console.o: D:/GOAQUI/NxBase/console.c D:/GOAQUI/NxBase/console.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/NxBase/cpuid.h + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/NxBase/cpuid.h: diff --git a/SEW-EXA1/Debug/NxBase/console.o b/SEW-EXA1/Debug/NxBase/console.o new file mode 100644 index 0000000..5402f48 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/console.o differ diff --git a/SEW-EXA1/Debug/NxBase/console.su b/SEW-EXA1/Debug/NxBase/console.su new file mode 100644 index 0000000..2305696 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/console.su @@ -0,0 +1,25 @@ +console.c:13:6:SetConsoleOutType 16 static +console.c:27:5:SendData 16 static +console.c:67:5:ResvData 16 static +console.c:206:5:__io_putchar 24 static +console.c:214:5:__io_getchar 16 static +console.c:228:5:_read 32 static +console.c:235:5:_write 24 static +console.c:247:5:PutChar 16 static +console.c:251:5:GetChar 8 static +console.c:278:5:IsNewCommand 4 static +console.c:283:5:LockExecAndGetCmdStr 24 static +console.c:297:6:UnlockExec 4 static +console.c:302:6:SetPauseStatus 16 static +console.c:326:6:InitHistory 8 static +console.c:337:6:AddNewCmdToHistory 40 static +console.c:399:6:UpCursorProc 16 static +console.c:454:6:DownCursorProc 16 static +console.c:524:6:OutNewCmdLine 8 static +console.c:540:6:InitConsole 8 static +console.c:561:6:ConsoleCmdScan 16 static +console.c:877:5:IsConsoleCancel 16 static +console.c:885:5:GetHistoryCmd 16 static +console.c:897:5:GetHistoryNum 4 static +console.c:902:5:GetHistoryMaxNum 4 static +console.c:907:5:GetHistoryIdx 4 static diff --git a/SEW-EXA1/Debug/NxBase/cpuid.d b/SEW-EXA1/Debug/NxBase/cpuid.d new file mode 100644 index 0000000..0e32f10 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/cpuid.d @@ -0,0 +1,115 @@ +NxBase/cpuid.o: D:/GOAQUI/NxBase/cpuid.c D:/GOAQUI/NxBase/cpuid.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxFuncs/crc/crc32.h + +D:/GOAQUI/NxBase/cpuid.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxFuncs/crc/crc32.h: diff --git a/SEW-EXA1/Debug/NxBase/cpuid.o b/SEW-EXA1/Debug/NxBase/cpuid.o new file mode 100644 index 0000000..01d3669 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/cpuid.o differ diff --git a/SEW-EXA1/Debug/NxBase/cpuid.su b/SEW-EXA1/Debug/NxBase/cpuid.su new file mode 100644 index 0000000..f199ae0 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/cpuid.su @@ -0,0 +1,6 @@ +core_cm3.h:1762:34:__NVIC_SystemReset 4 static,ignoring_inline_asm +cpuid.c:14:6:InitCpuIDBase 16 static +cpuid.c:19:6:GetCpuID 72 static +cpuid.c:99:6:EnterCritical 4 static,ignoring_inline_asm +cpuid.c:108:6:ExitCritical 4 static,ignoring_inline_asm +cpuid.c:122:6:RestartMcu 8 static,ignoring_inline_asm diff --git a/SEW-EXA1/Debug/NxBase/delay.d b/SEW-EXA1/Debug/NxBase/delay.d new file mode 100644 index 0000000..c67e9a5 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/delay.d @@ -0,0 +1,115 @@ +NxBase/delay.o: D:/GOAQUI/NxBase/delay.c D:/GOAQUI/NxBase/delay.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxBase/delay.o b/SEW-EXA1/Debug/NxBase/delay.o new file mode 100644 index 0000000..9b08020 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/delay.o differ diff --git a/SEW-EXA1/Debug/NxBase/delay.su b/SEW-EXA1/Debug/NxBase/delay.su new file mode 100644 index 0000000..252318f --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/delay.su @@ -0,0 +1,3 @@ +delay.c:6:6:DelayNs 24 static +delay.c:22:6:DelayUs 24 static +delay.c:36:6:DelayMs 32 static diff --git a/SEW-EXA1/Debug/NxBase/encrypt.d b/SEW-EXA1/Debug/NxBase/encrypt.d new file mode 100644 index 0000000..fd01397 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/encrypt.d @@ -0,0 +1,115 @@ +NxBase/encrypt.o: D:/GOAQUI/NxBase/encrypt.c D:/GOAQUI/NxBase/encrypt.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/cpuid.h + +D:/GOAQUI/NxBase/encrypt.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/cpuid.h: diff --git a/SEW-EXA1/Debug/NxBase/encrypt.o b/SEW-EXA1/Debug/NxBase/encrypt.o new file mode 100644 index 0000000..3000f1a Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/encrypt.o differ diff --git a/SEW-EXA1/Debug/NxBase/encrypt.su b/SEW-EXA1/Debug/NxBase/encrypt.su new file mode 100644 index 0000000..7caf938 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/encrypt.su @@ -0,0 +1,2 @@ +encrypt.c:24:5:AddToEncrypt 16 static +encrypt.c:35:5:CheckEncrypt 48 static diff --git a/SEW-EXA1/Debug/NxBase/funcs.d b/SEW-EXA1/Debug/NxBase/funcs.d new file mode 100644 index 0000000..24b0ed0 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/funcs.d @@ -0,0 +1,112 @@ +NxBase/funcs.o: D:/GOAQUI/NxBase/funcs.c D:/GOAQUI/NxBase/funcs.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +D:/GOAQUI/NxBase/funcs.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/NxBase/funcs.o b/SEW-EXA1/Debug/NxBase/funcs.o new file mode 100644 index 0000000..c8511b0 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/funcs.o differ diff --git a/SEW-EXA1/Debug/NxBase/funcs.su b/SEW-EXA1/Debug/NxBase/funcs.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxBase/i2crw.d b/SEW-EXA1/Debug/NxBase/i2crw.d new file mode 100644 index 0000000..4cbebec --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/i2crw.d @@ -0,0 +1,112 @@ +NxBase/i2crw.o: D:/GOAQUI/NxBase/i2crw.c D:/GOAQUI/NxBase/i2crw.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +D:/GOAQUI/NxBase/i2crw.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/NxBase/i2crw.o b/SEW-EXA1/Debug/NxBase/i2crw.o new file mode 100644 index 0000000..2b50245 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/i2crw.o differ diff --git a/SEW-EXA1/Debug/NxBase/i2crw.su b/SEW-EXA1/Debug/NxBase/i2crw.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxBase/iwdog.d b/SEW-EXA1/Debug/NxBase/iwdog.d new file mode 100644 index 0000000..0aab1ac --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/iwdog.d @@ -0,0 +1,112 @@ +NxBase/iwdog.o: D:/GOAQUI/NxBase/iwdog.c D:/GOAQUI/NxBase/iwdog.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +D:/GOAQUI/NxBase/iwdog.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/NxBase/iwdog.o b/SEW-EXA1/Debug/NxBase/iwdog.o new file mode 100644 index 0000000..c3350c3 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/iwdog.o differ diff --git a/SEW-EXA1/Debug/NxBase/iwdog.su b/SEW-EXA1/Debug/NxBase/iwdog.su new file mode 100644 index 0000000..e8d25eb --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/iwdog.su @@ -0,0 +1,2 @@ +iwdog.c:29:6:InitIWDog 16 static +iwdog.c:63:6:FeedIWDog 4 static diff --git a/SEW-EXA1/Debug/NxBase/serial.d b/SEW-EXA1/Debug/NxBase/serial.d new file mode 100644 index 0000000..4b677bf --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/serial.d @@ -0,0 +1,115 @@ +NxBase/serial.o: D:/GOAQUI/NxBase/serial.c D:/GOAQUI/NxBase/serial.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/cpuid.h + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/cpuid.h: diff --git a/SEW-EXA1/Debug/NxBase/serial.o b/SEW-EXA1/Debug/NxBase/serial.o new file mode 100644 index 0000000..9f8aec0 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/serial.o differ diff --git a/SEW-EXA1/Debug/NxBase/serial.su b/SEW-EXA1/Debug/NxBase/serial.su new file mode 100644 index 0000000..90fcba5 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/serial.su @@ -0,0 +1,49 @@ +stm32f1xx_ll_usart.h:411:22:LL_USART_Enable 16 static +stm32f1xx_ll_usart.h:1839:26:LL_USART_IsActiveFlag_RXNE 16 static +stm32f1xx_ll_usart.h:1850:26:LL_USART_IsActiveFlag_TC 16 static +stm32f1xx_ll_usart.h:1861:26:LL_USART_IsActiveFlag_TXE 16 static +stm32f1xx_ll_usart.h:2082:22:LL_USART_EnableIT_RXNE 16 static +stm32f1xx_ll_usart.h:2104:22:LL_USART_EnableIT_TXE 16 static +stm32f1xx_ll_usart.h:2178:22:LL_USART_DisableIT_RXNE 16 static +stm32f1xx_ll_usart.h:2200:22:LL_USART_DisableIT_TXE 16 static +stm32f1xx_ll_usart.h:2450:25:LL_USART_ReceiveData8 16 static +stm32f1xx_ll_usart.h:2473:22:LL_USART_TransmitData8 16 static +serial.c:438:1:InitUsart1 16 static +serial.c:438:1:Usart1SendData 24 static +serial.c:438:1:Usart1GetData 32 static +serial.c:438:1:Usart1CleanRsBuf 16 static +serial.c:438:1:Usart1GetRsLen 16 static +serial.c:438:1:Usart1CleanSdBuf 16 static +serial.c:438:1:Usart1GetSdFreeLen 16 static +serial.c:438:1:IsUsart1SendBufEmpty 16 static +serial.c:438:1:IsUsart1SendOver 16 static +serial.c:438:1:USART1IntProc 16 static +serial.c:438:1:RegUsart1ResvExFunc 16 static +serial.c:438:1:Usart1SendDataSync 16 static +serial.c:438:1:Usart1GetDataSync 24 static +serial.c:442:1:InitUsart2 16 static +serial.c:442:1:Usart2SendData 24 static +serial.c:442:1:Usart2GetData 32 static +serial.c:442:1:Usart2CleanRsBuf 16 static +serial.c:442:1:Usart2GetRsLen 16 static +serial.c:442:1:Usart2CleanSdBuf 16 static +serial.c:442:1:Usart2GetSdFreeLen 16 static +serial.c:442:1:IsUsart2SendBufEmpty 16 static +serial.c:442:1:IsUsart2SendOver 16 static +serial.c:442:1:USART2IntProc 16 static +serial.c:442:1:RegUsart2ResvExFunc 16 static +serial.c:442:1:Usart2SendDataSync 16 static +serial.c:442:1:Usart2GetDataSync 24 static +serial.c:446:1:InitUsart3 16 static +serial.c:446:1:Usart3SendData 24 static +serial.c:446:1:Usart3GetData 32 static +serial.c:446:1:Usart3CleanRsBuf 16 static +serial.c:446:1:Usart3GetRsLen 16 static +serial.c:446:1:Usart3CleanSdBuf 16 static +serial.c:446:1:Usart3GetSdFreeLen 16 static +serial.c:446:1:IsUsart3SendBufEmpty 16 static +serial.c:446:1:IsUsart3SendOver 16 static +serial.c:446:1:USART3IntProc 16 static +serial.c:446:1:RegUsart3ResvExFunc 16 static +serial.c:446:1:Usart3SendDataSync 16 static +serial.c:446:1:Usart3GetDataSync 24 static diff --git a/SEW-EXA1/Debug/NxBase/shell.d b/SEW-EXA1/Debug/NxBase/shell.d new file mode 100644 index 0000000..7dba973 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/shell.d @@ -0,0 +1,118 @@ +NxBase/shell.o: D:/GOAQUI/NxBase/shell.c D:/GOAQUI/NxBase/shell.h \ + D:/GOAQUI/NxBase/console.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/cpuid.h + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/cpuid.h: diff --git a/SEW-EXA1/Debug/NxBase/shell.o b/SEW-EXA1/Debug/NxBase/shell.o new file mode 100644 index 0000000..bbc0c37 Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/shell.o differ diff --git a/SEW-EXA1/Debug/NxBase/shell.su b/SEW-EXA1/Debug/NxBase/shell.su new file mode 100644 index 0000000..1a56a38 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/shell.su @@ -0,0 +1,9 @@ +shell.c:12:6:ChangeToUper 24 static +shell.c:32:5:AddShellCmd 24 static +shell.c:71:5:ShellTask 248 static +shell.c:238:6:VersionInfo 56 static +shell.c:250:6:HelpString 24 static +shell.c:265:6:CleanScreen 16 static +shell.c:273:6:Restart 16 static +shell.c:278:6:ShowHistoryCmd 96 static +shell.c:330:6:InitShell 8 static diff --git a/SEW-EXA1/Debug/NxBase/spirw.d b/SEW-EXA1/Debug/NxBase/spirw.d new file mode 100644 index 0000000..8d7cd9d --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/spirw.d @@ -0,0 +1,112 @@ +NxBase/spirw.o: D:/GOAQUI/NxBase/spirw.c D:/GOAQUI/NxBase/spirw.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +D:/GOAQUI/NxBase/spirw.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/NxBase/spirw.o b/SEW-EXA1/Debug/NxBase/spirw.o new file mode 100644 index 0000000..fa7736a Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/spirw.o differ diff --git a/SEW-EXA1/Debug/NxBase/spirw.su b/SEW-EXA1/Debug/NxBase/spirw.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxBase/subdir.mk b/SEW-EXA1/Debug/NxBase/subdir.mk new file mode 100644 index 0000000..e5a100e --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/subdir.mk @@ -0,0 +1,79 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxBase/buttons.c \ +D:/GOAQUI/NxBase/canctrl.c \ +D:/GOAQUI/NxBase/console.c \ +D:/GOAQUI/NxBase/cpuid.c \ +D:/GOAQUI/NxBase/delay.c \ +D:/GOAQUI/NxBase/encrypt.c \ +D:/GOAQUI/NxBase/funcs.c \ +D:/GOAQUI/NxBase/i2crw.c \ +D:/GOAQUI/NxBase/iwdog.c \ +D:/GOAQUI/NxBase/serial.c \ +D:/GOAQUI/NxBase/shell.c \ +D:/GOAQUI/NxBase/spirw.c \ +D:/GOAQUI/NxBase/trigger.c + +OBJS += \ +./NxBase/buttons.o \ +./NxBase/canctrl.o \ +./NxBase/console.o \ +./NxBase/cpuid.o \ +./NxBase/delay.o \ +./NxBase/encrypt.o \ +./NxBase/funcs.o \ +./NxBase/i2crw.o \ +./NxBase/iwdog.o \ +./NxBase/serial.o \ +./NxBase/shell.o \ +./NxBase/spirw.o \ +./NxBase/trigger.o + +C_DEPS += \ +./NxBase/buttons.d \ +./NxBase/canctrl.d \ +./NxBase/console.d \ +./NxBase/cpuid.d \ +./NxBase/delay.d \ +./NxBase/encrypt.d \ +./NxBase/funcs.d \ +./NxBase/i2crw.d \ +./NxBase/iwdog.d \ +./NxBase/serial.d \ +./NxBase/shell.d \ +./NxBase/spirw.d \ +./NxBase/trigger.d + + +# Each subdirectory must supply rules for building sources it contributes +NxBase/buttons.o: D:/GOAQUI/NxBase/buttons.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/buttons.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/canctrl.o: D:/GOAQUI/NxBase/canctrl.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/canctrl.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/console.o: D:/GOAQUI/NxBase/console.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/console.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/cpuid.o: D:/GOAQUI/NxBase/cpuid.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/cpuid.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/delay.o: D:/GOAQUI/NxBase/delay.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/delay.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/encrypt.o: D:/GOAQUI/NxBase/encrypt.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/encrypt.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/funcs.o: D:/GOAQUI/NxBase/funcs.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/funcs.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/i2crw.o: D:/GOAQUI/NxBase/i2crw.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/i2crw.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/iwdog.o: D:/GOAQUI/NxBase/iwdog.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/iwdog.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/serial.o: D:/GOAQUI/NxBase/serial.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/serial.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/shell.o: D:/GOAQUI/NxBase/shell.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/shell.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/spirw.o: D:/GOAQUI/NxBase/spirw.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/spirw.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxBase/trigger.o: D:/GOAQUI/NxBase/trigger.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxBase/trigger.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxBase/trigger.d b/SEW-EXA1/Debug/NxBase/trigger.d new file mode 100644 index 0000000..3e68436 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/trigger.d @@ -0,0 +1,115 @@ +NxBase/trigger.o: D:/GOAQUI/NxBase/trigger.c D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/iwdog.h + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/iwdog.h: diff --git a/SEW-EXA1/Debug/NxBase/trigger.o b/SEW-EXA1/Debug/NxBase/trigger.o new file mode 100644 index 0000000..a3012fe Binary files /dev/null and b/SEW-EXA1/Debug/NxBase/trigger.o differ diff --git a/SEW-EXA1/Debug/NxBase/trigger.su b/SEW-EXA1/Debug/NxBase/trigger.su new file mode 100644 index 0000000..695e297 --- /dev/null +++ b/SEW-EXA1/Debug/NxBase/trigger.su @@ -0,0 +1,13 @@ +core_cm3.h:1639:22:__NVIC_SetPriority 16 static +core_cm3.h:1834:26:SysTick_Config 16 static +trigger.c:40:6:InitTrigger 8 static +trigger.c:61:5:AddTriggerToList 32 static +trigger.c:91:6:TriggerExTask 16 static +trigger.c:146:6:TriggerTask 16 static +trigger.c:164:6:TriggerIntProc 8 static +trigger.c:175:5:GetTickTimer 4 static +trigger.c:181:5:Get100NsSoftTimer 24 static +trigger.c:197:5:GetUsSoftTimer 24 static +trigger.c:213:5:Get100UsSoftTimer 24 static +trigger.c:228:5:GetMsSoftTimer 4 static +trigger.c:234:5:GetMsSoftTimer10 4 static diff --git a/SEW-EXA1/Debug/NxFunc/comm/comm.d b/SEW-EXA1/Debug/NxFunc/comm/comm.d new file mode 100644 index 0000000..4676578 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/comm.d @@ -0,0 +1,116 @@ +NxFunc/comm/comm.o: D:/GOAQUI/NxFuncs/comm/comm.c \ + D:/GOAQUI/NxFuncs/comm/comm.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxFuncs/crc/crc16.h + +D:/GOAQUI/NxFuncs/comm/comm.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxFuncs/crc/crc16.h: diff --git a/SEW-EXA1/Debug/NxFunc/comm/comm.o b/SEW-EXA1/Debug/NxFunc/comm/comm.o new file mode 100644 index 0000000..da998e4 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/comm/comm.o differ diff --git a/SEW-EXA1/Debug/NxFunc/comm/comm.su b/SEW-EXA1/Debug/NxFunc/comm/comm.su new file mode 100644 index 0000000..de6a57d --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/comm.su @@ -0,0 +1,5 @@ +comm.c:11:5:ReadBuffEmpty 48 static +comm.c:77:5:GetANormalPacket 72 static +comm.c:334:5:SendAPacket 40 static +comm.c:412:5:PacketAFLDP 16 static +comm.c:436:5:PacketAVLDP 24 static diff --git a/SEW-EXA1/Debug/NxFunc/comm/mtcomm.d b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.d new file mode 100644 index 0000000..94bde1c --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.d @@ -0,0 +1,118 @@ +NxFunc/comm/mtcomm.o: D:/GOAQUI/NxFuncs/comm/mtcomm.c \ + D:/GOAQUI/NxFuncs/comm/mtcomm.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxFuncs/crc/crc8.h D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxFuncs/comm/mtcomm.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxFuncs/crc/crc8.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxFunc/comm/mtcomm.o b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.o new file mode 100644 index 0000000..e228827 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.o differ diff --git a/SEW-EXA1/Debug/NxFunc/comm/mtcomm.su b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.su new file mode 100644 index 0000000..39b7d4d --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/mtcomm.su @@ -0,0 +1,9 @@ +mtcomm.c:43:6:InitMtComm 16 static +mtcomm.c:55:6:MtCommAsyncTask 32 static +mtcomm.c:207:5:PacketAMtComm 16 static +mtcomm.c:223:5:CheckAMtPacket 24 static +mtcomm.c:244:6:ReadMtCommBuffEmpty 24 static +mtcomm.c:276:5:SendAMtPacket 16 static +mtcomm.c:310:5:GetSendStatus 24 static +mtcomm.c:327:5:GetSendResult 16 static +mtcomm.c:340:5:GetAMtPacket 48 static diff --git a/SEW-EXA1/Debug/NxFunc/comm/ocom.d b/SEW-EXA1/Debug/NxFunc/comm/ocom.d new file mode 100644 index 0000000..d6b656d --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/ocom.d @@ -0,0 +1,116 @@ +NxFunc/comm/ocom.o: D:/GOAQUI/NxFuncs/comm/ocom.c \ + D:/GOAQUI/NxFuncs/comm/ocom.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxFuncs/crc/crc16.h + +D:/GOAQUI/NxFuncs/comm/ocom.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxFuncs/crc/crc16.h: diff --git a/SEW-EXA1/Debug/NxFunc/comm/ocom.o b/SEW-EXA1/Debug/NxFunc/comm/ocom.o new file mode 100644 index 0000000..1a05e5a Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/comm/ocom.o differ diff --git a/SEW-EXA1/Debug/NxFunc/comm/ocom.su b/SEW-EXA1/Debug/NxFunc/comm/ocom.su new file mode 100644 index 0000000..b01d220 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/ocom.su @@ -0,0 +1,6 @@ +ocom.c:6:6:ReadOComBuffEmpty 32 static +ocom.c:30:5:GetAOComPacket 56 static +ocom.c:131:5:GetOComExData 40 static +ocom.c:192:5:SendAOComPacket 32 static +ocom.c:221:5:SendOComExData 40 static +ocom.c:259:5:PacketAOCom 16 static diff --git a/SEW-EXA1/Debug/NxFunc/comm/protocol.d b/SEW-EXA1/Debug/NxFunc/comm/protocol.d new file mode 100644 index 0000000..4ac758c --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/protocol.d @@ -0,0 +1,116 @@ +NxFunc/comm/protocol.o: D:/GOAQUI/NxFuncs/comm/protocol.c \ + D:/GOAQUI/NxFuncs/comm/protocol.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxFuncs/comm/comm.h + +D:/GOAQUI/NxFuncs/comm/protocol.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxFuncs/comm/comm.h: diff --git a/SEW-EXA1/Debug/NxFunc/comm/protocol.o b/SEW-EXA1/Debug/NxFunc/comm/protocol.o new file mode 100644 index 0000000..e7db5fc Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/comm/protocol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/comm/protocol.su b/SEW-EXA1/Debug/NxFunc/comm/protocol.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxFunc/comm/subdir.mk b/SEW-EXA1/Debug/NxFunc/comm/subdir.mk new file mode 100644 index 0000000..da837b1 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/subdir.mk @@ -0,0 +1,39 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/comm/comm.c \ +D:/GOAQUI/NxFuncs/comm/mtcomm.c \ +D:/GOAQUI/NxFuncs/comm/ocom.c \ +D:/GOAQUI/NxFuncs/comm/protocol.c \ +D:/GOAQUI/NxFuncs/comm/xmodem.c + +OBJS += \ +./NxFunc/comm/comm.o \ +./NxFunc/comm/mtcomm.o \ +./NxFunc/comm/ocom.o \ +./NxFunc/comm/protocol.o \ +./NxFunc/comm/xmodem.o + +C_DEPS += \ +./NxFunc/comm/comm.d \ +./NxFunc/comm/mtcomm.d \ +./NxFunc/comm/ocom.d \ +./NxFunc/comm/protocol.d \ +./NxFunc/comm/xmodem.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/comm/comm.o: D:/GOAQUI/NxFuncs/comm/comm.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/comm/comm.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/comm/mtcomm.o: D:/GOAQUI/NxFuncs/comm/mtcomm.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/comm/mtcomm.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/comm/ocom.o: D:/GOAQUI/NxFuncs/comm/ocom.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/comm/ocom.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/comm/protocol.o: D:/GOAQUI/NxFuncs/comm/protocol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/comm/protocol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/comm/xmodem.o: D:/GOAQUI/NxFuncs/comm/xmodem.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/comm/xmodem.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/comm/xmodem.d b/SEW-EXA1/Debug/NxFunc/comm/xmodem.d new file mode 100644 index 0000000..4452352 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/xmodem.d @@ -0,0 +1,126 @@ +NxFunc/comm/xmodem.o: D:/GOAQUI/NxFuncs/comm/xmodem.c \ + D:/GOAQUI/NxFuncs/comm/xmodem.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/NxBase/shell.h D:/GOAQUI/NxBase/console.h \ + D:/GOAQUI/NxBase/delay.h + +D:/GOAQUI/NxFuncs/comm/xmodem.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/NxBase/delay.h: diff --git a/SEW-EXA1/Debug/NxFunc/comm/xmodem.o b/SEW-EXA1/Debug/NxFunc/comm/xmodem.o new file mode 100644 index 0000000..64e9944 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/comm/xmodem.o differ diff --git a/SEW-EXA1/Debug/NxFunc/comm/xmodem.su b/SEW-EXA1/Debug/NxFunc/comm/xmodem.su new file mode 100644 index 0000000..31afef9 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/comm/xmodem.su @@ -0,0 +1,4 @@ +xmodem.c:56:6:OutDebugBufInfo 4 static +xmodem.c:63:5:CalcXModemCrc 24 static +xmodem.c:90:5:CheckXModemDat 40 static +xmodem.c:122:5:XmodemReceive 1112 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.d b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.d new file mode 100644 index 0000000..69d6e61 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.d @@ -0,0 +1,124 @@ +NxFunc/controlbus/colorcontrol.o: \ + D:/GOAQUI/NxFuncs/controlbus/colorcontrol.c \ + D:/GOAQUI/NxFuncs/controlbus/colorcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/colorcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.o b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.o new file mode 100644 index 0000000..cd2ccc6 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.su b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.su new file mode 100644 index 0000000..021e447 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/colorcontrol.su @@ -0,0 +1,5 @@ +colorcontrol.c:6:6:InitColorControl 16 static +colorcontrol.c:14:6:SendColorCommand 16 static +colorcontrol.c:23:6:RequestColorStatus 16 static +colorcontrol.c:31:6:RequestColorVersion 16 static +colorcontrol.c:39:6:RequestColorNvPara 16 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.d b/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.d new file mode 100644 index 0000000..c58dbdc --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.d @@ -0,0 +1,120 @@ +NxFunc/controlbus/controlbus.o: D:/GOAQUI/NxFuncs/controlbus/controlbus.c \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.o b/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.o new file mode 100644 index 0000000..78b6549 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.su b/SEW-EXA1/Debug/NxFunc/controlbus/controlbus.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.d b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.d new file mode 100644 index 0000000..e48d4f7 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.d @@ -0,0 +1,124 @@ +NxFunc/controlbus/corecontrol.o: \ + D:/GOAQUI/NxFuncs/controlbus/corecontrol.c \ + D:/GOAQUI/NxFuncs/controlbus/corecontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/corecontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.o b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.o new file mode 100644 index 0000000..47989c8 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.su b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.su new file mode 100644 index 0000000..2287682 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/corecontrol.su @@ -0,0 +1 @@ +corecontrol.c:4:6:InitCoreControl 16 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.d b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.d new file mode 100644 index 0000000..e03bfd6 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.d @@ -0,0 +1,124 @@ +NxFunc/controlbus/extiocontrol.o: \ + D:/GOAQUI/NxFuncs/controlbus/extiocontrol.c \ + D:/GOAQUI/NxFuncs/controlbus/extiocontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/extiocontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.o b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.o new file mode 100644 index 0000000..686b010 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.su b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.su new file mode 100644 index 0000000..fa56251 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/extiocontrol.su @@ -0,0 +1,4 @@ +extiocontrol.c:7:6:InitExtIOControl 16 static +extiocontrol.c:15:6:SendExtIOCommand 16 static +extiocontrol.c:24:6:RequestExtIOStatus 16 static +extiocontrol.c:33:6:RequestExtIOVersion 16 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.d b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.d new file mode 100644 index 0000000..47a03f1 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.d @@ -0,0 +1,124 @@ +NxFunc/controlbus/headcontrol.o: \ + D:/GOAQUI/NxFuncs/controlbus/headcontrol.c \ + D:/GOAQUI/NxFuncs/controlbus/headcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/headcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.o b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.o new file mode 100644 index 0000000..e3e2ef4 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.su b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.su new file mode 100644 index 0000000..060626f --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/headcontrol.su @@ -0,0 +1,5 @@ +headcontrol.c:9:6:InitHeadControl 16 static +headcontrol.c:17:6:SendHeadCommand 16 static +headcontrol.c:26:6:RequestHeadStatus 16 static +headcontrol.c:35:6:RequestHeadVersion 16 static +headcontrol.c:43:6:RequestHeadNvPara 16 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.d b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.d new file mode 100644 index 0000000..9d5b248 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.d @@ -0,0 +1,124 @@ +NxFunc/controlbus/sewhdcontrol.o: \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.c \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + ../Core/Inc/can.h ../Core/Inc/main.h + +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.o b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.o new file mode 100644 index 0000000..49fa9c6 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.o differ diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.su b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.su new file mode 100644 index 0000000..416b0a0 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/sewhdcontrol.su @@ -0,0 +1,5 @@ +sewhdcontrol.c:18:6:InitSewHeadControl 16 static +sewhdcontrol.c:26:6:SendSewHeadCommand 16 static +sewhdcontrol.c:35:6:RequestSewHeadStatus 16 static +sewhdcontrol.c:44:6:RequestSewHeadVersion 16 static +sewhdcontrol.c:52:6:RequestSewHeadNvPara 16 static diff --git a/SEW-EXA1/Debug/NxFunc/controlbus/subdir.mk b/SEW-EXA1/Debug/NxFunc/controlbus/subdir.mk new file mode 100644 index 0000000..3ae083a --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/controlbus/subdir.mk @@ -0,0 +1,44 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/controlbus/colorcontrol.c \ +D:/GOAQUI/NxFuncs/controlbus/controlbus.c \ +D:/GOAQUI/NxFuncs/controlbus/corecontrol.c \ +D:/GOAQUI/NxFuncs/controlbus/extiocontrol.c \ +D:/GOAQUI/NxFuncs/controlbus/headcontrol.c \ +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.c + +OBJS += \ +./NxFunc/controlbus/colorcontrol.o \ +./NxFunc/controlbus/controlbus.o \ +./NxFunc/controlbus/corecontrol.o \ +./NxFunc/controlbus/extiocontrol.o \ +./NxFunc/controlbus/headcontrol.o \ +./NxFunc/controlbus/sewhdcontrol.o + +C_DEPS += \ +./NxFunc/controlbus/colorcontrol.d \ +./NxFunc/controlbus/controlbus.d \ +./NxFunc/controlbus/corecontrol.d \ +./NxFunc/controlbus/extiocontrol.d \ +./NxFunc/controlbus/headcontrol.d \ +./NxFunc/controlbus/sewhdcontrol.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/controlbus/colorcontrol.o: D:/GOAQUI/NxFuncs/controlbus/colorcontrol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/colorcontrol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/controlbus/controlbus.o: D:/GOAQUI/NxFuncs/controlbus/controlbus.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/controlbus.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/controlbus/corecontrol.o: D:/GOAQUI/NxFuncs/controlbus/corecontrol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/corecontrol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/controlbus/extiocontrol.o: D:/GOAQUI/NxFuncs/controlbus/extiocontrol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/extiocontrol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/controlbus/headcontrol.o: D:/GOAQUI/NxFuncs/controlbus/headcontrol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/headcontrol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/controlbus/sewhdcontrol.o: D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/controlbus/sewhdcontrol.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc16.d b/SEW-EXA1/Debug/NxFunc/crc/crc16.d new file mode 100644 index 0000000..09ccbc0 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc16.d @@ -0,0 +1,6 @@ +NxFunc/crc/crc16.o: D:/GOAQUI/NxFuncs/crc/crc16.c \ + D:/GOAQUI/NxFuncs/crc/crc16.h D:/GOAQUI/NxBase/afxdef.h + +D:/GOAQUI/NxFuncs/crc/crc16.h: + +D:/GOAQUI/NxBase/afxdef.h: diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc16.o b/SEW-EXA1/Debug/NxFunc/crc/crc16.o new file mode 100644 index 0000000..fa0e77c Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/crc/crc16.o differ diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc16.su b/SEW-EXA1/Debug/NxFunc/crc/crc16.su new file mode 100644 index 0000000..1dab825 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc16.su @@ -0,0 +1,3 @@ +crc16.c:61:5:AddCrc16 16 static +crc16.c:99:5:CalcCrc16 24 static +crc16.c:114:5:CalcCheckSum 24 static diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc32.d b/SEW-EXA1/Debug/NxFunc/crc/crc32.d new file mode 100644 index 0000000..f6c42a7 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc32.d @@ -0,0 +1,6 @@ +NxFunc/crc/crc32.o: D:/GOAQUI/NxFuncs/crc/crc32.c \ + D:/GOAQUI/NxFuncs/crc/crc32.h D:/GOAQUI/NxBase/afxdef.h + +D:/GOAQUI/NxFuncs/crc/crc32.h: + +D:/GOAQUI/NxBase/afxdef.h: diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc32.o b/SEW-EXA1/Debug/NxFunc/crc/crc32.o new file mode 100644 index 0000000..0cae9a9 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/crc/crc32.o differ diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc32.su b/SEW-EXA1/Debug/NxFunc/crc/crc32.su new file mode 100644 index 0000000..83274dc --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc32.su @@ -0,0 +1,2 @@ +crc32.c:43:5:AddCrc32 16 static +crc32.c:48:5:CalcCrc32 24 static diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc8.d b/SEW-EXA1/Debug/NxFunc/crc/crc8.d new file mode 100644 index 0000000..1f4d040 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc8.d @@ -0,0 +1,6 @@ +NxFunc/crc/crc8.o: D:/GOAQUI/NxFuncs/crc/crc8.c \ + D:/GOAQUI/NxFuncs/crc/crc8.h D:/GOAQUI/NxBase/afxdef.h + +D:/GOAQUI/NxFuncs/crc/crc8.h: + +D:/GOAQUI/NxBase/afxdef.h: diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc8.o b/SEW-EXA1/Debug/NxFunc/crc/crc8.o new file mode 100644 index 0000000..20fd425 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/crc/crc8.o differ diff --git a/SEW-EXA1/Debug/NxFunc/crc/crc8.su b/SEW-EXA1/Debug/NxFunc/crc/crc8.su new file mode 100644 index 0000000..9c5d7f6 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/crc8.su @@ -0,0 +1 @@ +crc8.c:35:4:CalcCrc8 24 static diff --git a/SEW-EXA1/Debug/NxFunc/crc/subdir.mk b/SEW-EXA1/Debug/NxFunc/crc/subdir.mk new file mode 100644 index 0000000..830c939 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/crc/subdir.mk @@ -0,0 +1,29 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/crc/crc16.c \ +D:/GOAQUI/NxFuncs/crc/crc32.c \ +D:/GOAQUI/NxFuncs/crc/crc8.c + +OBJS += \ +./NxFunc/crc/crc16.o \ +./NxFunc/crc/crc32.o \ +./NxFunc/crc/crc8.o + +C_DEPS += \ +./NxFunc/crc/crc16.d \ +./NxFunc/crc/crc32.d \ +./NxFunc/crc/crc8.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/crc/crc16.o: D:/GOAQUI/NxFuncs/crc/crc16.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/crc/crc16.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/crc/crc32.o: D:/GOAQUI/NxFuncs/crc/crc32.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/crc/crc32.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/crc/crc8.o: D:/GOAQUI/NxFuncs/crc/crc8.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/crc/crc8.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/modbus/ef_a.d b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.d new file mode 100644 index 0000000..b901d8d --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.d @@ -0,0 +1,123 @@ +NxFunc/modbus/ef_a.o: D:/GOAQUI/NxFuncs/modbus/ef_a.c \ + D:/GOAQUI/NxFuncs/modbus/ef_a.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/SEW-EXA1/Users/Base/inout.h \ + D:/GOAQUI/NxBase/delay.h D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxFuncs/modbus/ef_a.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/ef_a.o b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.o new file mode 100644 index 0000000..c2376a4 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/ef_a.su b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.su new file mode 100644 index 0000000..e64ae9a --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/ef_a.su @@ -0,0 +1,12 @@ +ef_a.c:14:6:EFDefOutEn 4 static +ef_a.c:18:6:EFDefOutDis 4 static +ef_a.c:22:6:RegisterEFCommFunc 24 static +ef_a.c:33:6:InitEF 40 static +ef_a.c:212:5:EFTx 40 static +ef_a.c:298:5:EFRx 40 static +ef_a.c:366:5:EFComm 32 static +ef_a.c:389:6:InitAsyncEFCtrl 16 static +ef_a.c:408:6:RegEFCmdProc 16 static +ef_a.c:413:5:AddEFCmd 24 static +ef_a.c:444:5:GetEFCmdBufLen 16 static +ef_a.c:449:5:AsyncEFTask 32 static diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.d b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.d new file mode 100644 index 0000000..b6acca2 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.d @@ -0,0 +1,116 @@ +NxFunc/modbus/modbus_def.o: D:/GOAQUI/NxFuncs/modbus/modbus_def.c \ + D:/GOAQUI/NxFuncs/modbus/modbus_def.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h + +D:/GOAQUI/NxFuncs/modbus/modbus_def.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.o b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.o new file mode 100644 index 0000000..053f923 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.su b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.su new file mode 100644 index 0000000..2fec28b --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_def.su @@ -0,0 +1,11 @@ +modbus_def.c:5:6:RegisterModbusCommFunc 24 static +modbus_def.c:18:5:DefSendData 16 static +modbus_def.c:23:5:DefGetData 16 static +modbus_def.c:28:5:DefCleanRsBuf 4 static +modbus_def.c:33:5:DefIsSendOver 4 static +modbus_def.c:38:6:DefOutEn 4 static +modbus_def.c:42:6:DefOutDis 4 static +modbus_def.c:50:4:AsciiToRtu 16 static +modbus_def.c:72:4:RtuToAscii 16 static +modbus_def.c:154:6:ModbusAddCrc16 32 static +modbus_def.c:165:5:ModbusCrc16 24 static diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.d b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.d new file mode 100644 index 0000000..412c002 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.d @@ -0,0 +1,126 @@ +NxFunc/modbus/modbus_m.o: D:/GOAQUI/NxFuncs/modbus/modbus_m.c \ + D:/GOAQUI/NxFuncs/modbus/modbus_m.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_def.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/SEW-EXA1/Users/Base/inout.h \ + D:/GOAQUI/NxBase/delay.h D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxFuncs/modbus/modbus_m.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_def.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.o b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.o new file mode 100644 index 0000000..a5918e4 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.su b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.su new file mode 100644 index 0000000..089b318 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_m.su @@ -0,0 +1,12 @@ +modbus_m.c:33:6:InitModbus_m 40 static +modbus_m.c:255:5:ModbusTx 272 static +modbus_m.c:470:5:ModbusRx 280 static +modbus_m.c:969:5:ModbusComm 488 static +modbus_m.c:1015:5:ModbusComm16 40 static +modbus_m.c:1033:5:ModbusComm32 40 static +modbus_m.c:1055:5:ModbusCommMulti 48 static +modbus_m.c:1081:6:InitRs485Ctrl 16 static +modbus_m.c:1100:6:RegRsCmdProc 16 static +modbus_m.c:1105:5:AddRs485Cmd 24 static +modbus_m.c:1128:5:GetRs485CmdBufLen 4 static +modbus_m.c:1133:5:Rs485Task 56 static diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.d b/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.d new file mode 100644 index 0000000..d7a5dd1 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.d @@ -0,0 +1,119 @@ +NxFunc/modbus/modbus_s.o: D:/GOAQUI/NxFuncs/modbus/modbus_s.c \ + D:/GOAQUI/NxFuncs/modbus/modbus_s.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_def.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h + +D:/GOAQUI/NxFuncs/modbus/modbus_s.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_def.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.o b/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.o new file mode 100644 index 0000000..c97dcc6 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.su b/SEW-EXA1/Debug/NxFunc/modbus/modbus_s.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.d b/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.d new file mode 100644 index 0000000..a51fcc9 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.d @@ -0,0 +1,116 @@ +NxFunc/modbus/modbus_tcp.o: D:/GOAQUI/NxFuncs/modbus/modbus_tcp.c \ + D:/GOAQUI/NxFuncs/modbus/modbus_tcp.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxFuncs/modbus/modbus_tcp.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.o b/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.o new file mode 100644 index 0000000..6b1e721 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.su b/SEW-EXA1/Debug/NxFunc/modbus/modbus_tcp.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.d b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.d new file mode 100644 index 0000000..f3fa324 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.d @@ -0,0 +1,123 @@ +NxFunc/modbus/one2onecomm.o: D:/GOAQUI/NxFuncs/modbus/one2onecomm.c \ + D:/GOAQUI/NxFuncs/modbus/one2onecomm.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/serial.h D:/GOAQUI/NxBase/delay.h \ + D:/GOAQUI/NxFuncs/crc/crc16.h D:/GOAQUI/NxBase/trigger.h + +D:/GOAQUI/NxFuncs/modbus/one2onecomm.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/NxFuncs/crc/crc16.h: + +D:/GOAQUI/NxBase/trigger.h: diff --git a/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.o b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.o new file mode 100644 index 0000000..a721f12 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.o differ diff --git a/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.su b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.su new file mode 100644 index 0000000..429910c --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/one2onecomm.su @@ -0,0 +1,8 @@ +one2onecomm.c:54:6:RegisterOne2OneCommFunc 24 static +one2onecomm.c:70:6:InitOne2OneComm 24 static +one2onecomm.c:198:5:One2OneCommTx 72 static +one2onecomm.c:277:5:One2OneCommRx 96 static +one2onecomm.c:362:6:InitOne2OneCtrl 32 static +one2onecomm.c:371:6:RegOne2OneCmdProc 16 static +one2onecomm.c:376:5:AddOne2OneCmd 16 static +one2onecomm.c:399:6:One2OneTask 24 static diff --git a/SEW-EXA1/Debug/NxFunc/modbus/subdir.mk b/SEW-EXA1/Debug/NxFunc/modbus/subdir.mk new file mode 100644 index 0000000..bd19760 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/modbus/subdir.mk @@ -0,0 +1,44 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/modbus/ef_a.c \ +D:/GOAQUI/NxFuncs/modbus/modbus_def.c \ +D:/GOAQUI/NxFuncs/modbus/modbus_m.c \ +D:/GOAQUI/NxFuncs/modbus/modbus_s.c \ +D:/GOAQUI/NxFuncs/modbus/modbus_tcp.c \ +D:/GOAQUI/NxFuncs/modbus/one2onecomm.c + +OBJS += \ +./NxFunc/modbus/ef_a.o \ +./NxFunc/modbus/modbus_def.o \ +./NxFunc/modbus/modbus_m.o \ +./NxFunc/modbus/modbus_s.o \ +./NxFunc/modbus/modbus_tcp.o \ +./NxFunc/modbus/one2onecomm.o + +C_DEPS += \ +./NxFunc/modbus/ef_a.d \ +./NxFunc/modbus/modbus_def.d \ +./NxFunc/modbus/modbus_m.d \ +./NxFunc/modbus/modbus_s.d \ +./NxFunc/modbus/modbus_tcp.d \ +./NxFunc/modbus/one2onecomm.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/modbus/ef_a.o: D:/GOAQUI/NxFuncs/modbus/ef_a.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/ef_a.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/modbus/modbus_def.o: D:/GOAQUI/NxFuncs/modbus/modbus_def.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/modbus_def.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/modbus/modbus_m.o: D:/GOAQUI/NxFuncs/modbus/modbus_m.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/modbus_m.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/modbus/modbus_s.o: D:/GOAQUI/NxFuncs/modbus/modbus_s.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/modbus_s.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/modbus/modbus_tcp.o: D:/GOAQUI/NxFuncs/modbus/modbus_tcp.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/modbus_tcp.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +NxFunc/modbus/one2onecomm.o: D:/GOAQUI/NxFuncs/modbus/one2onecomm.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/modbus/one2onecomm.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.d b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.d new file mode 100644 index 0000000..2287a8e --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.d @@ -0,0 +1,126 @@ +NxFunc/stdebug/stdebug.o: D:/GOAQUI/NxFuncs/stdebug/stdebug.c \ + D:/GOAQUI/NxFuncs/stdebug/stdebug.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/shell.h D:/GOAQUI/NxBase/console.h \ + D:/GOAQUI/SEW-EXA1/Users/Base/inout.h D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/NxBase/delay.h + +D:/GOAQUI/NxFuncs/stdebug/stdebug.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/NxBase/delay.h: diff --git a/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.o b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.o new file mode 100644 index 0000000..a9be3ff Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.o differ diff --git a/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.su b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.su new file mode 100644 index 0000000..4795d29 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stdebug/stdebug.su @@ -0,0 +1 @@ +stdebug.c:11:6:OutStackInfo 24 static diff --git a/SEW-EXA1/Debug/NxFunc/stdebug/subdir.mk b/SEW-EXA1/Debug/NxFunc/stdebug/subdir.mk new file mode 100644 index 0000000..f032552 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stdebug/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/stdebug/stdebug.c + +OBJS += \ +./NxFunc/stdebug/stdebug.o + +C_DEPS += \ +./NxFunc/stdebug/stdebug.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/stdebug/stdebug.o: D:/GOAQUI/NxFuncs/stdebug/stdebug.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/stdebug/stdebug.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/stepdriver/subdir.mk b/SEW-EXA1/Debug/NxFunc/stepdriver/subdir.mk new file mode 100644 index 0000000..1e78fd5 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stepdriver/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/stepdriver/tmc260.c + +OBJS += \ +./NxFunc/stepdriver/tmc260.o + +C_DEPS += \ +./NxFunc/stepdriver/tmc260.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/stepdriver/tmc260.o: D:/GOAQUI/NxFuncs/stepdriver/tmc260.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/stepdriver/tmc260.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.d b/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.d new file mode 100644 index 0000000..3d1e065 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.d @@ -0,0 +1,116 @@ +NxFunc/stepdriver/tmc260.o: D:/GOAQUI/NxFuncs/stepdriver/tmc260.c \ + D:/GOAQUI/NxFuncs/stepdriver/tmc260.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/Base/inout.h + +D:/GOAQUI/NxFuncs/stepdriver/tmc260.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: diff --git a/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.o b/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.o new file mode 100644 index 0000000..c6eac72 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.o differ diff --git a/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.su b/SEW-EXA1/Debug/NxFunc/stepdriver/tmc260.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.d b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.d new file mode 100644 index 0000000..243ec6a --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.d @@ -0,0 +1,121 @@ +NxFunc/stm32motos/stm32motos.o: D:/GOAQUI/NxFuncs/stm32motos/stm32motos.c \ + D:/GOAQUI/NxFuncs/stm32motos/stm32motos.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/Base/inout.h D:/GOAQUI/NxBase/shell.h \ + D:/GOAQUI/NxBase/console.h + +D:/GOAQUI/NxFuncs/stm32motos/stm32motos.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: diff --git a/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.o b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.o new file mode 100644 index 0000000..88783e9 Binary files /dev/null and b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.o differ diff --git a/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.su b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.su new file mode 100644 index 0000000..9153317 --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stm32motos/stm32motos.su @@ -0,0 +1,27 @@ +stm32f1xx_ll_tim.h:1063:22:LL_TIM_EnableCounter 16 static +stm32f1xx_ll_tim.h:1074:22:LL_TIM_DisableCounter 16 static +stm32f1xx_ll_tim.h:1379:22:LL_TIM_SetAutoReload 16 static +stm32f1xx_ll_tim.h:2992:22:LL_TIM_ClearFlag_UPDATE 16 static +stm32f1xx_ll_tim.h:3003:26:LL_TIM_IsActiveFlag_UPDATE 16 static +stm32f1xx_ll_tim.h:3267:22:LL_TIM_EnableIT_UPDATE 16 static +stm32f1xx_ll_tim.h:3278:22:LL_TIM_DisableIT_UPDATE 16 static +stm32motos.c:144:6:SetMotoPulseOn 16 static +stm32motos.c:173:6:SetMotoPulseOff 16 static +stm32motos.c:202:6:SetMotoSignOn 16 static +stm32motos.c:231:6:SetMotoSignOff 16 static +stm32motos.c:766:2:InitStm32Moto1OutFunc 24 static +stm32motos.c:766:2:InitSTM32Moto1Ctrl 8 static +stm32motos.c:766:2:STM32Moto1IntProc 8 static +stm32motos.c:766:2:STM32Moto1Speed 8 static +stm32motos.c:766:2:STM32Moto1Start 24 static +stm32motos.c:766:2:STM32Moto1Stop 8 static +stm32motos.c:766:2:STM32Moto1Run 16 static +stm32motos.c:766:2:GetSTM32Moto1State 4 static +stm32motos.c:766:2:GetSTM32Moto1RealPos 4 static +stm32motos.c:766:2:SetSTM32Moto1RealPos 16 static +stm32motos.c:766:2:SetSTM32Moto1Mode 16 static +stm32motos.c:786:6:InitSTM32Speed 8 static +stm32motos.c:797:6:STM32MotoSpeedIntProc 8 static +stm32motos.c:831:6:InitSTM32SoftPwm 16 static +stm32motos.c:841:6:InitSTM32Motos 8 static +stm32motos.c:877:6:TestStm32Motos 104 static diff --git a/SEW-EXA1/Debug/NxFunc/stm32motos/subdir.mk b/SEW-EXA1/Debug/NxFunc/stm32motos/subdir.mk new file mode 100644 index 0000000..5a7ea3a --- /dev/null +++ b/SEW-EXA1/Debug/NxFunc/stm32motos/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +D:/GOAQUI/NxFuncs/stm32motos/stm32motos.c + +OBJS += \ +./NxFunc/stm32motos/stm32motos.o + +C_DEPS += \ +./NxFunc/stm32motos/stm32motos.d + + +# Each subdirectory must supply rules for building sources it contributes +NxFunc/stm32motos/stm32motos.o: D:/GOAQUI/NxFuncs/stm32motos/stm32motos.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"NxFunc/stm32motos/stm32motos.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/SEW-EXA1.bin b/SEW-EXA1/Debug/SEW-EXA1.bin new file mode 100644 index 0000000..c068d22 Binary files /dev/null and b/SEW-EXA1/Debug/SEW-EXA1.bin differ diff --git a/SEW-EXA1/Debug/SEW-EXA1.elf b/SEW-EXA1/Debug/SEW-EXA1.elf new file mode 100644 index 0000000..5195765 Binary files /dev/null and b/SEW-EXA1/Debug/SEW-EXA1.elf differ diff --git a/SEW-EXA1/Debug/SEW-EXA1.list b/SEW-EXA1/Debug/SEW-EXA1.list new file mode 100644 index 0000000..be312c5 --- /dev/null +++ b/SEW-EXA1/Debug/SEW-EXA1.list @@ -0,0 +1,24641 @@ + +SEW-EXA1.elf: file format elf32-littlearm + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .isr_vector 000001e4 08000000 08000000 00010000 2**0 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 1 .text 0000a75c 080001e4 080001e4 000101e4 2**2 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .rodata 0000074c 0800a940 0800a940 0001a940 2**2 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 3 .ARM.extab 00000000 0800b08c 0800b08c 0002053c 2**0 + CONTENTS + 4 .ARM 00000000 0800b08c 0800b08c 0002053c 2**0 + CONTENTS + 5 .preinit_array 00000000 0800b08c 0800b08c 0002053c 2**0 + CONTENTS, ALLOC, LOAD, DATA + 6 .init_array 00000004 0800b08c 0800b08c 0001b08c 2**2 + CONTENTS, ALLOC, LOAD, DATA + 7 .fini_array 00000004 0800b090 0800b090 0001b090 2**2 + CONTENTS, ALLOC, LOAD, DATA + 8 .data 0000053c 20000000 0800b094 00020000 2**2 + CONTENTS, ALLOC, LOAD, DATA + 9 .bss 000037f4 2000053c 0800b5d0 0002053c 2**2 + ALLOC + 10 ._user_heap_stack 00000600 20003d30 0800b5d0 00023d30 2**0 + ALLOC + 11 .ARM.attributes 00000029 00000000 00000000 0002053c 2**0 + CONTENTS, READONLY + 12 .debug_info 000201e8 00000000 00000000 00020565 2**0 + CONTENTS, READONLY, DEBUGGING + 13 .debug_abbrev 00005523 00000000 00000000 0004074d 2**0 + CONTENTS, READONLY, DEBUGGING + 14 .debug_aranges 00001698 00000000 00000000 00045c70 2**3 + CONTENTS, READONLY, DEBUGGING + 15 .debug_ranges 00001448 00000000 00000000 00047308 2**3 + CONTENTS, READONLY, DEBUGGING + 16 .debug_macro 00022708 00000000 00000000 00048750 2**0 + CONTENTS, READONLY, DEBUGGING + 17 .debug_line 00018a2a 00000000 00000000 0006ae58 2**0 + CONTENTS, READONLY, DEBUGGING + 18 .debug_str 000a45b6 00000000 00000000 00083882 2**0 + CONTENTS, READONLY, DEBUGGING + 19 .comment 0000007b 00000000 00000000 00127e38 2**0 + CONTENTS, READONLY + 20 .debug_frame 00005e34 00000000 00000000 00127eb4 2**2 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +080001e4 <__do_global_dtors_aux>: + 80001e4: b510 push {r4, lr} + 80001e6: 4c05 ldr r4, [pc, #20] ; (80001fc <__do_global_dtors_aux+0x18>) + 80001e8: 7823 ldrb r3, [r4, #0] + 80001ea: b933 cbnz r3, 80001fa <__do_global_dtors_aux+0x16> + 80001ec: 4b04 ldr r3, [pc, #16] ; (8000200 <__do_global_dtors_aux+0x1c>) + 80001ee: b113 cbz r3, 80001f6 <__do_global_dtors_aux+0x12> + 80001f0: 4804 ldr r0, [pc, #16] ; (8000204 <__do_global_dtors_aux+0x20>) + 80001f2: f3af 8000 nop.w + 80001f6: 2301 movs r3, #1 + 80001f8: 7023 strb r3, [r4, #0] + 80001fa: bd10 pop {r4, pc} + 80001fc: 2000053c .word 0x2000053c + 8000200: 00000000 .word 0x00000000 + 8000204: 0800a928 .word 0x0800a928 + +08000208 : + 8000208: b508 push {r3, lr} + 800020a: 4b03 ldr r3, [pc, #12] ; (8000218 ) + 800020c: b11b cbz r3, 8000216 + 800020e: 4903 ldr r1, [pc, #12] ; (800021c ) + 8000210: 4803 ldr r0, [pc, #12] ; (8000220 ) + 8000212: f3af 8000 nop.w + 8000216: bd08 pop {r3, pc} + 8000218: 00000000 .word 0x00000000 + 800021c: 20000540 .word 0x20000540 + 8000220: 0800a928 .word 0x0800a928 + +08000224 : + 8000224: 4603 mov r3, r0 + 8000226: f813 2b01 ldrb.w r2, [r3], #1 + 800022a: 2a00 cmp r2, #0 + 800022c: d1fb bne.n 8000226 + 800022e: 1a18 subs r0, r3, r0 + 8000230: 3801 subs r0, #1 + 8000232: 4770 bx lr + +08000234 : + +CAN_HandleTypeDef hcan; + +/* CAN init function */ +void MX_CAN_Init(void) +{ + 8000234: b580 push {r7, lr} + 8000236: af00 add r7, sp, #0 + + hcan.Instance = CAN1; + 8000238: 4b18 ldr r3, [pc, #96] ; (800029c ) + 800023a: 4a19 ldr r2, [pc, #100] ; (80002a0 ) + 800023c: 601a str r2, [r3, #0] + hcan.Init.Prescaler = 4; + 800023e: 4b17 ldr r3, [pc, #92] ; (800029c ) + 8000240: 2204 movs r2, #4 + 8000242: 605a str r2, [r3, #4] + hcan.Init.Mode = CAN_MODE_NORMAL; + 8000244: 4b15 ldr r3, [pc, #84] ; (800029c ) + 8000246: 2200 movs r2, #0 + 8000248: 609a str r2, [r3, #8] + hcan.Init.SyncJumpWidth = CAN_SJW_2TQ; + 800024a: 4b14 ldr r3, [pc, #80] ; (800029c ) + 800024c: f04f 7280 mov.w r2, #16777216 ; 0x1000000 + 8000250: 60da str r2, [r3, #12] + hcan.Init.TimeSeg1 = CAN_BS1_14TQ; + 8000252: 4b12 ldr r3, [pc, #72] ; (800029c ) + 8000254: f44f 2250 mov.w r2, #851968 ; 0xd0000 + 8000258: 611a str r2, [r3, #16] + hcan.Init.TimeSeg2 = CAN_BS2_3TQ; + 800025a: 4b10 ldr r3, [pc, #64] ; (800029c ) + 800025c: f44f 1200 mov.w r2, #2097152 ; 0x200000 + 8000260: 615a str r2, [r3, #20] + hcan.Init.TimeTriggeredMode = DISABLE; + 8000262: 4b0e ldr r3, [pc, #56] ; (800029c ) + 8000264: 2200 movs r2, #0 + 8000266: 761a strb r2, [r3, #24] + hcan.Init.AutoBusOff = ENABLE; + 8000268: 4b0c ldr r3, [pc, #48] ; (800029c ) + 800026a: 2201 movs r2, #1 + 800026c: 765a strb r2, [r3, #25] + hcan.Init.AutoWakeUp = DISABLE; + 800026e: 4b0b ldr r3, [pc, #44] ; (800029c ) + 8000270: 2200 movs r2, #0 + 8000272: 769a strb r2, [r3, #26] + hcan.Init.AutoRetransmission = ENABLE; + 8000274: 4b09 ldr r3, [pc, #36] ; (800029c ) + 8000276: 2201 movs r2, #1 + 8000278: 76da strb r2, [r3, #27] + hcan.Init.ReceiveFifoLocked = DISABLE; + 800027a: 4b08 ldr r3, [pc, #32] ; (800029c ) + 800027c: 2200 movs r2, #0 + 800027e: 771a strb r2, [r3, #28] + hcan.Init.TransmitFifoPriority = DISABLE; + 8000280: 4b06 ldr r3, [pc, #24] ; (800029c ) + 8000282: 2200 movs r2, #0 + 8000284: 775a strb r2, [r3, #29] + if (HAL_CAN_Init(&hcan) != HAL_OK) + 8000286: 4805 ldr r0, [pc, #20] ; (800029c ) + 8000288: f001 f8e0 bl 800144c + 800028c: 4603 mov r3, r0 + 800028e: 2b00 cmp r3, #0 + 8000290: d001 beq.n 8000296 + { + Error_Handler(); + 8000292: f000 fbc3 bl 8000a1c + } + +} + 8000296: bf00 nop + 8000298: bd80 pop {r7, pc} + 800029a: bf00 nop + 800029c: 2000058c .word 0x2000058c + 80002a0: 40006400 .word 0x40006400 + +080002a4 : + +void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle) +{ + 80002a4: b580 push {r7, lr} + 80002a6: b088 sub sp, #32 + 80002a8: af00 add r7, sp, #0 + 80002aa: 6078 str r0, [r7, #4] + + GPIO_InitTypeDef GPIO_InitStruct = {0}; + 80002ac: f107 0310 add.w r3, r7, #16 + 80002b0: 2200 movs r2, #0 + 80002b2: 601a str r2, [r3, #0] + 80002b4: 605a str r2, [r3, #4] + 80002b6: 609a str r2, [r3, #8] + 80002b8: 60da str r2, [r3, #12] + if(canHandle->Instance==CAN1) + 80002ba: 687b ldr r3, [r7, #4] + 80002bc: 681b ldr r3, [r3, #0] + 80002be: 4a24 ldr r2, [pc, #144] ; (8000350 ) + 80002c0: 4293 cmp r3, r2 + 80002c2: d141 bne.n 8000348 + { + /* USER CODE BEGIN CAN1_MspInit 0 */ + + /* USER CODE END CAN1_MspInit 0 */ + /* CAN1 clock enable */ + __HAL_RCC_CAN1_CLK_ENABLE(); + 80002c4: 4b23 ldr r3, [pc, #140] ; (8000354 ) + 80002c6: 69db ldr r3, [r3, #28] + 80002c8: 4a22 ldr r2, [pc, #136] ; (8000354 ) + 80002ca: f043 7300 orr.w r3, r3, #33554432 ; 0x2000000 + 80002ce: 61d3 str r3, [r2, #28] + 80002d0: 4b20 ldr r3, [pc, #128] ; (8000354 ) + 80002d2: 69db ldr r3, [r3, #28] + 80002d4: f003 7300 and.w r3, r3, #33554432 ; 0x2000000 + 80002d8: 60fb str r3, [r7, #12] + 80002da: 68fb ldr r3, [r7, #12] + + __HAL_RCC_GPIOA_CLK_ENABLE(); + 80002dc: 4b1d ldr r3, [pc, #116] ; (8000354 ) + 80002de: 699b ldr r3, [r3, #24] + 80002e0: 4a1c ldr r2, [pc, #112] ; (8000354 ) + 80002e2: f043 0304 orr.w r3, r3, #4 + 80002e6: 6193 str r3, [r2, #24] + 80002e8: 4b1a ldr r3, [pc, #104] ; (8000354 ) + 80002ea: 699b ldr r3, [r3, #24] + 80002ec: f003 0304 and.w r3, r3, #4 + 80002f0: 60bb str r3, [r7, #8] + 80002f2: 68bb ldr r3, [r7, #8] + /**CAN GPIO Configuration + PA11 ------> CAN_RX + PA12 ------> CAN_TX + */ + GPIO_InitStruct.Pin = GPIO_PIN_11; + 80002f4: f44f 6300 mov.w r3, #2048 ; 0x800 + 80002f8: 613b str r3, [r7, #16] + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + 80002fa: 2300 movs r3, #0 + 80002fc: 617b str r3, [r7, #20] + GPIO_InitStruct.Pull = GPIO_NOPULL; + 80002fe: 2300 movs r3, #0 + 8000300: 61bb str r3, [r7, #24] + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + 8000302: f107 0310 add.w r3, r7, #16 + 8000306: 4619 mov r1, r3 + 8000308: 4813 ldr r0, [pc, #76] ; (8000358 ) + 800030a: f002 f803 bl 8002314 + + GPIO_InitStruct.Pin = GPIO_PIN_12; + 800030e: f44f 5380 mov.w r3, #4096 ; 0x1000 + 8000312: 613b str r3, [r7, #16] + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + 8000314: 2302 movs r3, #2 + 8000316: 617b str r3, [r7, #20] + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + 8000318: 2303 movs r3, #3 + 800031a: 61fb str r3, [r7, #28] + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + 800031c: f107 0310 add.w r3, r7, #16 + 8000320: 4619 mov r1, r3 + 8000322: 480d ldr r0, [pc, #52] ; (8000358 ) + 8000324: f001 fff6 bl 8002314 + + /* CAN1 interrupt Init */ + HAL_NVIC_SetPriority(USB_HP_CAN1_TX_IRQn, 0, 0); + 8000328: 2200 movs r2, #0 + 800032a: 2100 movs r1, #0 + 800032c: 2013 movs r0, #19 + 800032e: f001 ffba bl 80022a6 + HAL_NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn); + 8000332: 2013 movs r0, #19 + 8000334: f001 ffd3 bl 80022de + HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 0, 0); + 8000338: 2200 movs r2, #0 + 800033a: 2100 movs r1, #0 + 800033c: 2014 movs r0, #20 + 800033e: f001 ffb2 bl 80022a6 + HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn); + 8000342: 2014 movs r0, #20 + 8000344: f001 ffcb bl 80022de + /* USER CODE BEGIN CAN1_MspInit 1 */ + + /* USER CODE END CAN1_MspInit 1 */ + } +} + 8000348: bf00 nop + 800034a: 3720 adds r7, #32 + 800034c: 46bd mov sp, r7 + 800034e: bd80 pop {r7, pc} + 8000350: 40006400 .word 0x40006400 + 8000354: 40021000 .word 0x40021000 + 8000358: 40010800 .word 0x40010800 + +0800035c <__NVIC_GetPriorityGrouping>: + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + 800035c: b480 push {r7} + 800035e: af00 add r7, sp, #0 + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); + 8000360: 4b04 ldr r3, [pc, #16] ; (8000374 <__NVIC_GetPriorityGrouping+0x18>) + 8000362: 68db ldr r3, [r3, #12] + 8000364: 0a1b lsrs r3, r3, #8 + 8000366: f003 0307 and.w r3, r3, #7 +} + 800036a: 4618 mov r0, r3 + 800036c: 46bd mov sp, r7 + 800036e: bc80 pop {r7} + 8000370: 4770 bx lr + 8000372: bf00 nop + 8000374: e000ed00 .word 0xe000ed00 + +08000378 <__NVIC_EnableIRQ>: + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + 8000378: b480 push {r7} + 800037a: b083 sub sp, #12 + 800037c: af00 add r7, sp, #0 + 800037e: 4603 mov r3, r0 + 8000380: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8000382: f997 3007 ldrsb.w r3, [r7, #7] + 8000386: 2b00 cmp r3, #0 + 8000388: db0b blt.n 80003a2 <__NVIC_EnableIRQ+0x2a> + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + 800038a: 79fb ldrb r3, [r7, #7] + 800038c: f003 021f and.w r2, r3, #31 + 8000390: 4906 ldr r1, [pc, #24] ; (80003ac <__NVIC_EnableIRQ+0x34>) + 8000392: f997 3007 ldrsb.w r3, [r7, #7] + 8000396: 095b lsrs r3, r3, #5 + 8000398: 2001 movs r0, #1 + 800039a: fa00 f202 lsl.w r2, r0, r2 + 800039e: f841 2023 str.w r2, [r1, r3, lsl #2] + } +} + 80003a2: bf00 nop + 80003a4: 370c adds r7, #12 + 80003a6: 46bd mov sp, r7 + 80003a8: bc80 pop {r7} + 80003aa: 4770 bx lr + 80003ac: e000e100 .word 0xe000e100 + +080003b0 <__NVIC_SetPriority>: + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + 80003b0: b480 push {r7} + 80003b2: b083 sub sp, #12 + 80003b4: af00 add r7, sp, #0 + 80003b6: 4603 mov r3, r0 + 80003b8: 6039 str r1, [r7, #0] + 80003ba: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 80003bc: f997 3007 ldrsb.w r3, [r7, #7] + 80003c0: 2b00 cmp r3, #0 + 80003c2: db0a blt.n 80003da <__NVIC_SetPriority+0x2a> + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80003c4: 683b ldr r3, [r7, #0] + 80003c6: b2da uxtb r2, r3 + 80003c8: 490c ldr r1, [pc, #48] ; (80003fc <__NVIC_SetPriority+0x4c>) + 80003ca: f997 3007 ldrsb.w r3, [r7, #7] + 80003ce: 0112 lsls r2, r2, #4 + 80003d0: b2d2 uxtb r2, r2 + 80003d2: 440b add r3, r1 + 80003d4: f883 2300 strb.w r2, [r3, #768] ; 0x300 + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + 80003d8: e00a b.n 80003f0 <__NVIC_SetPriority+0x40> + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80003da: 683b ldr r3, [r7, #0] + 80003dc: b2da uxtb r2, r3 + 80003de: 4908 ldr r1, [pc, #32] ; (8000400 <__NVIC_SetPriority+0x50>) + 80003e0: 79fb ldrb r3, [r7, #7] + 80003e2: f003 030f and.w r3, r3, #15 + 80003e6: 3b04 subs r3, #4 + 80003e8: 0112 lsls r2, r2, #4 + 80003ea: b2d2 uxtb r2, r2 + 80003ec: 440b add r3, r1 + 80003ee: 761a strb r2, [r3, #24] +} + 80003f0: bf00 nop + 80003f2: 370c adds r7, #12 + 80003f4: 46bd mov sp, r7 + 80003f6: bc80 pop {r7} + 80003f8: 4770 bx lr + 80003fa: bf00 nop + 80003fc: e000e100 .word 0xe000e100 + 8000400: e000ed00 .word 0xe000ed00 + +08000404 : + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + 8000404: b480 push {r7} + 8000406: b089 sub sp, #36 ; 0x24 + 8000408: af00 add r7, sp, #0 + 800040a: 60f8 str r0, [r7, #12] + 800040c: 60b9 str r1, [r7, #8] + 800040e: 607a str r2, [r7, #4] + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + 8000410: 68fb ldr r3, [r7, #12] + 8000412: f003 0307 and.w r3, r3, #7 + 8000416: 61fb str r3, [r7, #28] + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + 8000418: 69fb ldr r3, [r7, #28] + 800041a: f1c3 0307 rsb r3, r3, #7 + 800041e: 2b04 cmp r3, #4 + 8000420: bf28 it cs + 8000422: 2304 movcs r3, #4 + 8000424: 61bb str r3, [r7, #24] + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + 8000426: 69fb ldr r3, [r7, #28] + 8000428: 3304 adds r3, #4 + 800042a: 2b06 cmp r3, #6 + 800042c: d902 bls.n 8000434 + 800042e: 69fb ldr r3, [r7, #28] + 8000430: 3b03 subs r3, #3 + 8000432: e000 b.n 8000436 + 8000434: 2300 movs r3, #0 + 8000436: 617b str r3, [r7, #20] + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8000438: f04f 32ff mov.w r2, #4294967295 + 800043c: 69bb ldr r3, [r7, #24] + 800043e: fa02 f303 lsl.w r3, r2, r3 + 8000442: 43da mvns r2, r3 + 8000444: 68bb ldr r3, [r7, #8] + 8000446: 401a ands r2, r3 + 8000448: 697b ldr r3, [r7, #20] + 800044a: 409a lsls r2, r3 + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + 800044c: f04f 31ff mov.w r1, #4294967295 + 8000450: 697b ldr r3, [r7, #20] + 8000452: fa01 f303 lsl.w r3, r1, r3 + 8000456: 43d9 mvns r1, r3 + 8000458: 687b ldr r3, [r7, #4] + 800045a: 400b ands r3, r1 + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 800045c: 4313 orrs r3, r2 + ); +} + 800045e: 4618 mov r0, r3 + 8000460: 3724 adds r7, #36 ; 0x24 + 8000462: 46bd mov sp, r7 + 8000464: bc80 pop {r7} + 8000466: 4770 bx lr + +08000468 : + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_EnableClock(uint32_t Periphs) +{ + 8000468: b480 push {r7} + 800046a: b085 sub sp, #20 + 800046c: af00 add r7, sp, #0 + 800046e: 6078 str r0, [r7, #4] + __IO uint32_t tmpreg; + SET_BIT(RCC->APB2ENR, Periphs); + 8000470: 4b08 ldr r3, [pc, #32] ; (8000494 ) + 8000472: 699a ldr r2, [r3, #24] + 8000474: 4907 ldr r1, [pc, #28] ; (8000494 ) + 8000476: 687b ldr r3, [r7, #4] + 8000478: 4313 orrs r3, r2 + 800047a: 618b str r3, [r1, #24] + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB2ENR, Periphs); + 800047c: 4b05 ldr r3, [pc, #20] ; (8000494 ) + 800047e: 699a ldr r2, [r3, #24] + 8000480: 687b ldr r3, [r7, #4] + 8000482: 4013 ands r3, r2 + 8000484: 60fb str r3, [r7, #12] + (void)tmpreg; + 8000486: 68fb ldr r3, [r7, #12] +} + 8000488: bf00 nop + 800048a: 3714 adds r7, #20 + 800048c: 46bd mov sp, r7 + 800048e: bc80 pop {r7} + 8000490: 4770 bx lr + 8000492: bf00 nop + 8000494: 40021000 .word 0x40021000 + +08000498 : + * @arg @ref LL_GPIO_MODE_OUTPUT + * @arg @ref LL_GPIO_MODE_ALTERNATE + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) +{ + 8000498: b490 push {r4, r7} + 800049a: b088 sub sp, #32 + 800049c: af00 add r7, sp, #0 + 800049e: 60f8 str r0, [r7, #12] + 80004a0: 60b9 str r1, [r7, #8] + 80004a2: 607a str r2, [r7, #4] + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + 80004a4: 68fb ldr r3, [r7, #12] + 80004a6: 461a mov r2, r3 + 80004a8: 68bb ldr r3, [r7, #8] + 80004aa: 0e1b lsrs r3, r3, #24 + 80004ac: 4413 add r3, r2 + 80004ae: 461c mov r4, r3 + MODIFY_REG(*pReg, ((GPIO_CRL_CNF0 | GPIO_CRL_MODE0) << (POSITION_VAL(Pin) * 4U)), (Mode << (POSITION_VAL(Pin) * 4U))); + 80004b0: 6822 ldr r2, [r4, #0] + 80004b2: 68bb ldr r3, [r7, #8] + 80004b4: 617b str r3, [r7, #20] + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 80004b6: 697b ldr r3, [r7, #20] + 80004b8: fa93 f3a3 rbit r3, r3 + 80004bc: 613b str r3, [r7, #16] + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return result; + 80004be: 693b ldr r3, [r7, #16] + 80004c0: fab3 f383 clz r3, r3 + 80004c4: b2db uxtb r3, r3 + 80004c6: 009b lsls r3, r3, #2 + 80004c8: 210f movs r1, #15 + 80004ca: fa01 f303 lsl.w r3, r1, r3 + 80004ce: 43db mvns r3, r3 + 80004d0: 401a ands r2, r3 + 80004d2: 68bb ldr r3, [r7, #8] + 80004d4: 61fb str r3, [r7, #28] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 80004d6: 69fb ldr r3, [r7, #28] + 80004d8: fa93 f3a3 rbit r3, r3 + 80004dc: 61bb str r3, [r7, #24] + return result; + 80004de: 69bb ldr r3, [r7, #24] + 80004e0: fab3 f383 clz r3, r3 + 80004e4: b2db uxtb r3, r3 + 80004e6: 009b lsls r3, r3, #2 + 80004e8: 6879 ldr r1, [r7, #4] + 80004ea: fa01 f303 lsl.w r3, r1, r3 + 80004ee: 4313 orrs r3, r2 + 80004f0: 6023 str r3, [r4, #0] +} + 80004f2: bf00 nop + 80004f4: 3720 adds r7, #32 + 80004f6: 46bd mov sp, r7 + 80004f8: bc90 pop {r4, r7} + 80004fa: 4770 bx lr + +080004fc : + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + 80004fc: b480 push {r7} + 80004fe: b083 sub sp, #12 + 8000500: af00 add r7, sp, #0 + 8000502: 6078 str r0, [r7, #4] + 8000504: 6039 str r1, [r7, #0] + WRITE_REG(GPIOx->BSRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); + 8000506: 683b ldr r3, [r7, #0] + 8000508: 0a1b lsrs r3, r3, #8 + 800050a: b29a uxth r2, r3 + 800050c: 687b ldr r3, [r7, #4] + 800050e: 611a str r2, [r3, #16] +} + 8000510: bf00 nop + 8000512: 370c adds r7, #12 + 8000514: 46bd mov sp, r7 + 8000516: bc80 pop {r7} + 8000518: 4770 bx lr + +0800051a : + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + 800051a: b480 push {r7} + 800051c: b083 sub sp, #12 + 800051e: af00 add r7, sp, #0 + 8000520: 6078 str r0, [r7, #4] + 8000522: 6039 str r1, [r7, #0] + WRITE_REG(GPIOx->BRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); + 8000524: 683b ldr r3, [r7, #0] + 8000526: 0a1b lsrs r3, r3, #8 + 8000528: b29a uxth r2, r3 + 800052a: 687b ldr r3, [r7, #4] + 800052c: 615a str r2, [r3, #20] +} + 800052e: bf00 nop + 8000530: 370c adds r7, #12 + 8000532: 46bd mov sp, r7 + 8000534: bc80 pop {r7} + 8000536: 4770 bx lr + +08000538 : + * @arg @ref LL_GPIO_AF_EXTI_LINE14 + * @arg @ref LL_GPIO_AF_EXTI_LINE15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_SetEXTISource(uint32_t Port, uint32_t Line) +{ + 8000538: b480 push {r7} + 800053a: b085 sub sp, #20 + 800053c: af00 add r7, sp, #0 + 800053e: 6078 str r0, [r7, #4] + 8000540: 6039 str r1, [r7, #0] + MODIFY_REG(AFIO->EXTICR[Line & 0xFF], (Line >> 16), Port << POSITION_VAL((Line >> 16))); + 8000542: 4a13 ldr r2, [pc, #76] ; (8000590 ) + 8000544: 683b ldr r3, [r7, #0] + 8000546: b2db uxtb r3, r3 + 8000548: 3302 adds r3, #2 + 800054a: f852 2023 ldr.w r2, [r2, r3, lsl #2] + 800054e: 683b ldr r3, [r7, #0] + 8000550: 0c1b lsrs r3, r3, #16 + 8000552: 43db mvns r3, r3 + 8000554: ea02 0103 and.w r1, r2, r3 + 8000558: 683b ldr r3, [r7, #0] + 800055a: 0c1b lsrs r3, r3, #16 + 800055c: 60fb str r3, [r7, #12] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 800055e: 68fb ldr r3, [r7, #12] + 8000560: fa93 f3a3 rbit r3, r3 + 8000564: 60bb str r3, [r7, #8] + return result; + 8000566: 68bb ldr r3, [r7, #8] + 8000568: fab3 f383 clz r3, r3 + 800056c: b2db uxtb r3, r3 + 800056e: 461a mov r2, r3 + 8000570: 687b ldr r3, [r7, #4] + 8000572: fa03 f202 lsl.w r2, r3, r2 + 8000576: 4806 ldr r0, [pc, #24] ; (8000590 ) + 8000578: 683b ldr r3, [r7, #0] + 800057a: b2db uxtb r3, r3 + 800057c: 430a orrs r2, r1 + 800057e: 3302 adds r3, #2 + 8000580: f840 2023 str.w r2, [r0, r3, lsl #2] +} + 8000584: bf00 nop + 8000586: 3714 adds r7, #20 + 8000588: 46bd mov sp, r7 + 800058a: bc80 pop {r7} + 800058c: 4770 bx lr + 800058e: bf00 nop + 8000590: 40010000 .word 0x40010000 + +08000594 : + * Output + * EVENT_OUT + * EXTI +*/ +void MX_GPIO_Init(void) +{ + 8000594: b580 push {r7, lr} + 8000596: b088 sub sp, #32 + 8000598: af00 add r7, sp, #0 + + LL_EXTI_InitTypeDef EXTI_InitStruct = {0}; + 800059a: f107 0318 add.w r3, r7, #24 + 800059e: 2200 movs r2, #0 + 80005a0: 601a str r2, [r3, #0] + 80005a2: 605a str r2, [r3, #4] + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + 80005a4: 1d3b adds r3, r7, #4 + 80005a6: 2200 movs r2, #0 + 80005a8: 601a str r2, [r3, #0] + 80005aa: 605a str r2, [r3, #4] + 80005ac: 609a str r2, [r3, #8] + 80005ae: 60da str r2, [r3, #12] + 80005b0: 611a str r2, [r3, #16] + + /* GPIO Ports Clock Enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC); + 80005b2: 2010 movs r0, #16 + 80005b4: f7ff ff58 bl 8000468 + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD); + 80005b8: 2020 movs r0, #32 + 80005ba: f7ff ff55 bl 8000468 + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); + 80005be: 2004 movs r0, #4 + 80005c0: f7ff ff52 bl 8000468 + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + 80005c4: 2008 movs r0, #8 + 80005c6: f7ff ff4f bl 8000468 + + /**/ + LL_GPIO_ResetOutputPin(GPIOC, ERR_LED_Pin|SYS_LED_Pin); + 80005ca: 496c ldr r1, [pc, #432] ; (800077c ) + 80005cc: 486c ldr r0, [pc, #432] ; (8000780 ) + 80005ce: f7ff ffa4 bl 800051a + + /**/ + LL_GPIO_ResetOutputPin(GPIOA, RS485_2_EN_Pin|MT_DIR_Pin|MT_STEP_Pin|MT_SON_Pin); + 80005d2: f247 2172 movw r1, #29298 ; 0x7272 + 80005d6: 486b ldr r0, [pc, #428] ; (8000784 ) + 80005d8: f7ff ff9f bl 800051a + + /**/ + LL_GPIO_ResetOutputPin(RS485_EN_GPIO_Port, RS485_EN_Pin); + 80005dc: f240 2102 movw r1, #514 ; 0x202 + 80005e0: 4869 ldr r0, [pc, #420] ; (8000788 ) + 80005e2: f7ff ff9a bl 800051a + + /**/ + LL_GPIO_SetOutputPin(GPIOA, OUTPWM2_Pin|OUTPUT1_Pin); + 80005e6: f248 1181 movw r1, #33153 ; 0x8181 + 80005ea: 4866 ldr r0, [pc, #408] ; (8000784 ) + 80005ec: f7ff ff86 bl 80004fc + + /**/ + LL_GPIO_SetOutputPin(GPIOC, OUTPUT2_Pin|OUTPUT3_Pin|OUTPWM1_Pin); + 80005f0: f247 0170 movw r1, #28784 ; 0x7070 + 80005f4: 4862 ldr r0, [pc, #392] ; (8000780 ) + 80005f6: f7ff ff81 bl 80004fc + + /**/ + LL_GPIO_SetOutputPin(GPIOB, OUTPUT4_Pin|OUTPUT5_Pin|OUTPUT6_Pin|OUTPUT7_Pin + 80005fa: 4964 ldr r1, [pc, #400] ; (800078c ) + 80005fc: 4862 ldr r0, [pc, #392] ; (8000788 ) + 80005fe: f7ff ff7d bl 80004fc + |OUTPUT8_Pin); + + /**/ + GPIO_InitStruct.Pin = ERR_LED_Pin|SYS_LED_Pin|OUTPUT2_Pin|OUTPUT3_Pin + 8000602: 4b63 ldr r3, [pc, #396] ; (8000790 ) + 8000604: 607b str r3, [r7, #4] + |OUTPWM1_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + 8000606: 2301 movs r3, #1 + 8000608: 60bb str r3, [r7, #8] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 800060a: 2303 movs r3, #3 + 800060c: 60fb str r3, [r7, #12] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 800060e: 2300 movs r3, #0 + 8000610: 613b str r3, [r7, #16] + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + 8000612: 2301 movs r3, #1 + 8000614: 617b str r3, [r7, #20] + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + 8000616: 1d3b adds r3, r7, #4 + 8000618: 4619 mov r1, r3 + 800061a: 4859 ldr r0, [pc, #356] ; (8000780 ) + 800061c: f002 f9a8 bl 8002970 + + /**/ + GPIO_InitStruct.Pin = CAN_MP_Pin|SW1_Pin|SW2_Pin|SW3_Pin + 8000620: 4b5c ldr r3, [pc, #368] ; (8000794 ) + 8000622: 607b str r3, [r7, #4] + |INPUT7_Pin|INPUT6_Pin|INPUT5_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 8000624: 2304 movs r3, #4 + 8000626: 60bb str r3, [r7, #8] + LL_GPIO_Init(GPIOC, &GPIO_InitStruct); + 8000628: 1d3b adds r3, r7, #4 + 800062a: 4619 mov r1, r3 + 800062c: 4854 ldr r0, [pc, #336] ; (8000780 ) + 800062e: f002 f99f bl 8002970 + + /**/ + GPIO_InitStruct.Pin = OUTPWM2_Pin|RS485_2_EN_Pin|MT_DIR_Pin|MT_STEP_Pin + 8000632: f24f 33f3 movw r3, #62451 ; 0xf3f3 + 8000636: 607b str r3, [r7, #4] + |MT_SON_Pin|OUTPUT1_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + 8000638: 2301 movs r3, #1 + 800063a: 60bb str r3, [r7, #8] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 800063c: 2303 movs r3, #3 + 800063e: 60fb str r3, [r7, #12] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 8000640: 2300 movs r3, #0 + 8000642: 613b str r3, [r7, #16] + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + 8000644: 2301 movs r3, #1 + 8000646: 617b str r3, [r7, #20] + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + 8000648: 1d3b adds r3, r7, #4 + 800064a: 4619 mov r1, r3 + 800064c: 484d ldr r0, [pc, #308] ; (8000784 ) + 800064e: f002 f98f bl 8002970 + + /**/ + GPIO_InitStruct.Pin = OUTPUT4_Pin|RS485_EN_Pin|OUTPUT5_Pin|OUTPUT6_Pin + 8000652: 4b51 ldr r3, [pc, #324] ; (8000798 ) + 8000654: 607b str r3, [r7, #4] + |OUTPUT7_Pin|OUTPUT8_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; + 8000656: 2301 movs r3, #1 + 8000658: 60bb str r3, [r7, #8] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 800065a: 2303 movs r3, #3 + 800065c: 60fb str r3, [r7, #12] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 800065e: 2300 movs r3, #0 + 8000660: 613b str r3, [r7, #16] + GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; + 8000662: 2301 movs r3, #1 + 8000664: 617b str r3, [r7, #20] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 8000666: 1d3b adds r3, r7, #4 + 8000668: 4619 mov r1, r3 + 800066a: 4847 ldr r0, [pc, #284] ; (8000788 ) + 800066c: f002 f980 bl 8002970 + + /**/ + GPIO_InitStruct.Pin = INPUT8_Pin; + 8000670: 4b4a ldr r3, [pc, #296] ; (800079c ) + 8000672: 607b str r3, [r7, #4] + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 8000674: 2304 movs r3, #4 + 8000676: 60bb str r3, [r7, #8] + LL_GPIO_Init(INPUT8_GPIO_Port, &GPIO_InitStruct); + 8000678: 1d3b adds r3, r7, #4 + 800067a: 4619 mov r1, r3 + 800067c: 4841 ldr r0, [pc, #260] ; (8000784 ) + 800067e: f002 f977 bl 8002970 + + /**/ + GPIO_InitStruct.Pin = INPUT4_Pin; + 8000682: f240 4304 movw r3, #1028 ; 0x404 + 8000686: 607b str r3, [r7, #4] + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 8000688: 2304 movs r3, #4 + 800068a: 60bb str r3, [r7, #8] + LL_GPIO_Init(INPUT4_GPIO_Port, &GPIO_InitStruct); + 800068c: 1d3b adds r3, r7, #4 + 800068e: 4619 mov r1, r3 + 8000690: 4843 ldr r0, [pc, #268] ; (80007a0 ) + 8000692: f002 f96d bl 8002970 + + /**/ + GPIO_InitStruct.Pin = INPUT3_Pin|INPUT2_Pin|INPUT1_Pin|SW4_Pin + 8000696: 4b43 ldr r3, [pc, #268] ; (80007a4 ) + 8000698: 607b str r3, [r7, #4] + |CAN_ZP_Pin; + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 800069a: 2304 movs r3, #4 + 800069c: 60bb str r3, [r7, #8] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 800069e: 1d3b adds r3, r7, #4 + 80006a0: 4619 mov r1, r3 + 80006a2: 4839 ldr r0, [pc, #228] ; (8000788 ) + 80006a4: f002 f964 bl 8002970 + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE8); + 80006a8: 493f ldr r1, [pc, #252] ; (80007a8 ) + 80006aa: 2000 movs r0, #0 + 80006ac: f7ff ff44 bl 8000538 + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE9); + 80006b0: 493e ldr r1, [pc, #248] ; (80007ac ) + 80006b2: 2000 movs r0, #0 + 80006b4: f7ff ff40 bl 8000538 + + /**/ + LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE10); + 80006b8: 493d ldr r1, [pc, #244] ; (80007b0 ) + 80006ba: 2000 movs r0, #0 + 80006bc: f7ff ff3c bl 8000538 + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_8; + 80006c0: f44f 7380 mov.w r3, #256 ; 0x100 + 80006c4: 61bb str r3, [r7, #24] + EXTI_InitStruct.LineCommand = ENABLE; + 80006c6: 2301 movs r3, #1 + 80006c8: 773b strb r3, [r7, #28] + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + 80006ca: 2300 movs r3, #0 + 80006cc: 777b strb r3, [r7, #29] + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + 80006ce: 2301 movs r3, #1 + 80006d0: 77bb strb r3, [r7, #30] + LL_EXTI_Init(&EXTI_InitStruct); + 80006d2: f107 0318 add.w r3, r7, #24 + 80006d6: 4618 mov r0, r3 + 80006d8: f002 f816 bl 8002708 + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_9; + 80006dc: f44f 7300 mov.w r3, #512 ; 0x200 + 80006e0: 61bb str r3, [r7, #24] + EXTI_InitStruct.LineCommand = ENABLE; + 80006e2: 2301 movs r3, #1 + 80006e4: 773b strb r3, [r7, #28] + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + 80006e6: 2300 movs r3, #0 + 80006e8: 777b strb r3, [r7, #29] + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + 80006ea: 2301 movs r3, #1 + 80006ec: 77bb strb r3, [r7, #30] + LL_EXTI_Init(&EXTI_InitStruct); + 80006ee: f107 0318 add.w r3, r7, #24 + 80006f2: 4618 mov r0, r3 + 80006f4: f002 f808 bl 8002708 + + /**/ + EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_10; + 80006f8: f44f 6380 mov.w r3, #1024 ; 0x400 + 80006fc: 61bb str r3, [r7, #24] + EXTI_InitStruct.LineCommand = ENABLE; + 80006fe: 2301 movs r3, #1 + 8000700: 773b strb r3, [r7, #28] + EXTI_InitStruct.Mode = LL_EXTI_MODE_IT; + 8000702: 2300 movs r3, #0 + 8000704: 777b strb r3, [r7, #29] + EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING; + 8000706: 2301 movs r3, #1 + 8000708: 77bb strb r3, [r7, #30] + LL_EXTI_Init(&EXTI_InitStruct); + 800070a: f107 0318 add.w r3, r7, #24 + 800070e: 4618 mov r0, r3 + 8000710: f001 fffa bl 8002708 + + /**/ + LL_GPIO_SetPinMode(AP_GPIO_Port, AP_Pin, LL_GPIO_MODE_FLOATING); + 8000714: 2204 movs r2, #4 + 8000716: 4927 ldr r1, [pc, #156] ; (80007b4 ) + 8000718: 481a ldr r0, [pc, #104] ; (8000784 ) + 800071a: f7ff febd bl 8000498 + + /**/ + LL_GPIO_SetPinMode(BP_GPIO_Port, BP_Pin, LL_GPIO_MODE_FLOATING); + 800071e: 2204 movs r2, #4 + 8000720: 4925 ldr r1, [pc, #148] ; (80007b8 ) + 8000722: 4818 ldr r0, [pc, #96] ; (8000784 ) + 8000724: f7ff feb8 bl 8000498 + + /**/ + LL_GPIO_SetPinMode(ZP_GPIO_Port, ZP_Pin, LL_GPIO_MODE_FLOATING); + 8000728: 2204 movs r2, #4 + 800072a: 4924 ldr r1, [pc, #144] ; (80007bc ) + 800072c: 4815 ldr r0, [pc, #84] ; (8000784 ) + 800072e: f7ff feb3 bl 8000498 + + /* EXTI interrupt init*/ + NVIC_SetPriority(EXTI9_5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 8000732: f7ff fe13 bl 800035c <__NVIC_GetPriorityGrouping> + 8000736: 4603 mov r3, r0 + 8000738: 2200 movs r2, #0 + 800073a: 2100 movs r1, #0 + 800073c: 4618 mov r0, r3 + 800073e: f7ff fe61 bl 8000404 + 8000742: 4603 mov r3, r0 + 8000744: 4619 mov r1, r3 + 8000746: 2017 movs r0, #23 + 8000748: f7ff fe32 bl 80003b0 <__NVIC_SetPriority> + NVIC_EnableIRQ(EXTI9_5_IRQn); + 800074c: 2017 movs r0, #23 + 800074e: f7ff fe13 bl 8000378 <__NVIC_EnableIRQ> + NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 8000752: f7ff fe03 bl 800035c <__NVIC_GetPriorityGrouping> + 8000756: 4603 mov r3, r0 + 8000758: 2200 movs r2, #0 + 800075a: 2100 movs r1, #0 + 800075c: 4618 mov r0, r3 + 800075e: f7ff fe51 bl 8000404 + 8000762: 4603 mov r3, r0 + 8000764: 4619 mov r1, r3 + 8000766: 2028 movs r0, #40 ; 0x28 + 8000768: f7ff fe22 bl 80003b0 <__NVIC_SetPriority> + NVIC_EnableIRQ(EXTI15_10_IRQn); + 800076c: 2028 movs r0, #40 ; 0x28 + 800076e: f7ff fe03 bl 8000378 <__NVIC_EnableIRQ> + +} + 8000772: bf00 nop + 8000774: 3720 adds r7, #32 + 8000776: 46bd mov sp, r7 + 8000778: bd80 pop {r7, pc} + 800077a: bf00 nop + 800077c: 04600060 .word 0x04600060 + 8000780: 40011000 .word 0x40011000 + 8000784: 40010800 .word 0x40010800 + 8000788: 40010c00 .word 0x40010c00 + 800078c: 04f001f1 .word 0x04f001f1 + 8000790: 04607070 .word 0x04607070 + 8000794: 041f849f .word 0x041f849f + 8000798: 04f003f3 .word 0x04f003f3 + 800079c: 04800080 .word 0x04800080 + 80007a0: 40011400 .word 0x40011400 + 80007a4: 0403383b .word 0x0403383b + 80007a8: 000f0002 .word 0x000f0002 + 80007ac: 00f00002 .word 0x00f00002 + 80007b0: 0f000002 .word 0x0f000002 + 80007b4: 04010001 .word 0x04010001 + 80007b8: 04020002 .word 0x04020002 + 80007bc: 04040004 .word 0x04040004 + +080007c0 : + * @brief Enable HSE crystal oscillator (HSE ON) + * @rmtoll CR HSEON LL_RCC_HSE_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_Enable(void) +{ + 80007c0: b480 push {r7} + 80007c2: af00 add r7, sp, #0 + SET_BIT(RCC->CR, RCC_CR_HSEON); + 80007c4: 4b04 ldr r3, [pc, #16] ; (80007d8 ) + 80007c6: 681b ldr r3, [r3, #0] + 80007c8: 4a03 ldr r2, [pc, #12] ; (80007d8 ) + 80007ca: f443 3380 orr.w r3, r3, #65536 ; 0x10000 + 80007ce: 6013 str r3, [r2, #0] +} + 80007d0: bf00 nop + 80007d2: 46bd mov sp, r7 + 80007d4: bc80 pop {r7} + 80007d6: 4770 bx lr + 80007d8: 40021000 .word 0x40021000 + +080007dc : + * @brief Check if HSE oscillator Ready + * @rmtoll CR HSERDY LL_RCC_HSE_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void) +{ + 80007dc: b480 push {r7} + 80007de: af00 add r7, sp, #0 + return (READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY)); + 80007e0: 4b06 ldr r3, [pc, #24] ; (80007fc ) + 80007e2: 681b ldr r3, [r3, #0] + 80007e4: f403 3300 and.w r3, r3, #131072 ; 0x20000 + 80007e8: f5b3 3f00 cmp.w r3, #131072 ; 0x20000 + 80007ec: bf0c ite eq + 80007ee: 2301 moveq r3, #1 + 80007f0: 2300 movne r3, #0 + 80007f2: b2db uxtb r3, r3 +} + 80007f4: 4618 mov r0, r3 + 80007f6: 46bd mov sp, r7 + 80007f8: bc80 pop {r7} + 80007fa: 4770 bx lr + 80007fc: 40021000 .word 0x40021000 + +08000800 : + * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source) +{ + 8000800: b480 push {r7} + 8000802: b083 sub sp, #12 + 8000804: af00 add r7, sp, #0 + 8000806: 6078 str r0, [r7, #4] + MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source); + 8000808: 4b06 ldr r3, [pc, #24] ; (8000824 ) + 800080a: 685b ldr r3, [r3, #4] + 800080c: f023 0203 bic.w r2, r3, #3 + 8000810: 4904 ldr r1, [pc, #16] ; (8000824 ) + 8000812: 687b ldr r3, [r7, #4] + 8000814: 4313 orrs r3, r2 + 8000816: 604b str r3, [r1, #4] +} + 8000818: bf00 nop + 800081a: 370c adds r7, #12 + 800081c: 46bd mov sp, r7 + 800081e: bc80 pop {r7} + 8000820: 4770 bx lr + 8000822: bf00 nop + 8000824: 40021000 .word 0x40021000 + +08000828 : + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL + */ +__STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void) +{ + 8000828: b480 push {r7} + 800082a: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS)); + 800082c: 4b03 ldr r3, [pc, #12] ; (800083c ) + 800082e: 685b ldr r3, [r3, #4] + 8000830: f003 030c and.w r3, r3, #12 +} + 8000834: 4618 mov r0, r3 + 8000836: 46bd mov sp, r7 + 8000838: bc80 pop {r7} + 800083a: 4770 bx lr + 800083c: 40021000 .word 0x40021000 + +08000840 : + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler) +{ + 8000840: b480 push {r7} + 8000842: b083 sub sp, #12 + 8000844: af00 add r7, sp, #0 + 8000846: 6078 str r0, [r7, #4] + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler); + 8000848: 4b06 ldr r3, [pc, #24] ; (8000864 ) + 800084a: 685b ldr r3, [r3, #4] + 800084c: f023 02f0 bic.w r2, r3, #240 ; 0xf0 + 8000850: 4904 ldr r1, [pc, #16] ; (8000864 ) + 8000852: 687b ldr r3, [r7, #4] + 8000854: 4313 orrs r3, r2 + 8000856: 604b str r3, [r1, #4] +} + 8000858: bf00 nop + 800085a: 370c adds r7, #12 + 800085c: 46bd mov sp, r7 + 800085e: bc80 pop {r7} + 8000860: 4770 bx lr + 8000862: bf00 nop + 8000864: 40021000 .word 0x40021000 + +08000868 : + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler) +{ + 8000868: b480 push {r7} + 800086a: b083 sub sp, #12 + 800086c: af00 add r7, sp, #0 + 800086e: 6078 str r0, [r7, #4] + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler); + 8000870: 4b06 ldr r3, [pc, #24] ; (800088c ) + 8000872: 685b ldr r3, [r3, #4] + 8000874: f423 62e0 bic.w r2, r3, #1792 ; 0x700 + 8000878: 4904 ldr r1, [pc, #16] ; (800088c ) + 800087a: 687b ldr r3, [r7, #4] + 800087c: 4313 orrs r3, r2 + 800087e: 604b str r3, [r1, #4] +} + 8000880: bf00 nop + 8000882: 370c adds r7, #12 + 8000884: 46bd mov sp, r7 + 8000886: bc80 pop {r7} + 8000888: 4770 bx lr + 800088a: bf00 nop + 800088c: 40021000 .word 0x40021000 + +08000890 : + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler) +{ + 8000890: b480 push {r7} + 8000892: b083 sub sp, #12 + 8000894: af00 add r7, sp, #0 + 8000896: 6078 str r0, [r7, #4] + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler); + 8000898: 4b06 ldr r3, [pc, #24] ; (80008b4 ) + 800089a: 685b ldr r3, [r3, #4] + 800089c: f423 5260 bic.w r2, r3, #14336 ; 0x3800 + 80008a0: 4904 ldr r1, [pc, #16] ; (80008b4 ) + 80008a2: 687b ldr r3, [r7, #4] + 80008a4: 4313 orrs r3, r2 + 80008a6: 604b str r3, [r1, #4] +} + 80008a8: bf00 nop + 80008aa: 370c adds r7, #12 + 80008ac: 46bd mov sp, r7 + 80008ae: bc80 pop {r7} + 80008b0: 4770 bx lr + 80008b2: bf00 nop + 80008b4: 40021000 .word 0x40021000 + +080008b8 : + * @brief Enable PLL + * @rmtoll CR PLLON LL_RCC_PLL_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_Enable(void) +{ + 80008b8: b480 push {r7} + 80008ba: af00 add r7, sp, #0 + SET_BIT(RCC->CR, RCC_CR_PLLON); + 80008bc: 4b04 ldr r3, [pc, #16] ; (80008d0 ) + 80008be: 681b ldr r3, [r3, #0] + 80008c0: 4a03 ldr r2, [pc, #12] ; (80008d0 ) + 80008c2: f043 7380 orr.w r3, r3, #16777216 ; 0x1000000 + 80008c6: 6013 str r3, [r2, #0] +} + 80008c8: bf00 nop + 80008ca: 46bd mov sp, r7 + 80008cc: bc80 pop {r7} + 80008ce: 4770 bx lr + 80008d0: 40021000 .word 0x40021000 + +080008d4 : + * @brief Check if PLL Ready + * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void) +{ + 80008d4: b480 push {r7} + 80008d6: af00 add r7, sp, #0 + return (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == (RCC_CR_PLLRDY)); + 80008d8: 4b06 ldr r3, [pc, #24] ; (80008f4 ) + 80008da: 681b ldr r3, [r3, #0] + 80008dc: f003 7300 and.w r3, r3, #33554432 ; 0x2000000 + 80008e0: f1b3 7f00 cmp.w r3, #33554432 ; 0x2000000 + 80008e4: bf0c ite eq + 80008e6: 2301 moveq r3, #1 + 80008e8: 2300 movne r3, #0 + 80008ea: b2db uxtb r3, r3 +} + 80008ec: 4618 mov r0, r3 + 80008ee: 46bd mov sp, r7 + 80008f0: bc80 pop {r7} + 80008f2: 4770 bx lr + 80008f4: 40021000 .word 0x40021000 + +080008f8 : + * + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLMul) +{ + 80008f8: b480 push {r7} + 80008fa: b083 sub sp, #12 + 80008fc: af00 add r7, sp, #0 + 80008fe: 6078 str r0, [r7, #4] + 8000900: 6039 str r1, [r7, #0] + MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL, + 8000902: 4b08 ldr r3, [pc, #32] ; (8000924 ) + 8000904: 685b ldr r3, [r3, #4] + 8000906: f423 127c bic.w r2, r3, #4128768 ; 0x3f0000 + 800090a: 687b ldr r3, [r7, #4] + 800090c: f403 3140 and.w r1, r3, #196608 ; 0x30000 + 8000910: 683b ldr r3, [r7, #0] + 8000912: 430b orrs r3, r1 + 8000914: 4903 ldr r1, [pc, #12] ; (8000924 ) + 8000916: 4313 orrs r3, r2 + 8000918: 604b str r3, [r1, #4] + (Source & RCC_CFGR2_PREDIV1) | ((Source & (RCC_CFGR2_PREDIV1SRC << 4U)) >> 4U)); +#else + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1, (Source & RCC_CFGR2_PREDIV1)); +#endif /*RCC_CFGR2_PREDIV1SRC*/ +#endif /*RCC_CFGR2_PREDIV1*/ +} + 800091a: bf00 nop + 800091c: 370c adds r7, #12 + 800091e: 46bd mov sp, r7 + 8000920: bc80 pop {r7} + 8000922: 4770 bx lr + 8000924: 40021000 .word 0x40021000 + +08000928 : + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + * @retval None + */ +__STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency) +{ + 8000928: b480 push {r7} + 800092a: b083 sub sp, #12 + 800092c: af00 add r7, sp, #0 + 800092e: 6078 str r0, [r7, #4] + MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency); + 8000930: 4b06 ldr r3, [pc, #24] ; (800094c ) + 8000932: 681b ldr r3, [r3, #0] + 8000934: f023 0207 bic.w r2, r3, #7 + 8000938: 4904 ldr r1, [pc, #16] ; (800094c ) + 800093a: 687b ldr r3, [r7, #4] + 800093c: 4313 orrs r3, r2 + 800093e: 600b str r3, [r1, #0] +} + 8000940: bf00 nop + 8000942: 370c adds r7, #12 + 8000944: 46bd mov sp, r7 + 8000946: bc80 pop {r7} + 8000948: 4770 bx lr + 800094a: bf00 nop + 800094c: 40022000 .word 0x40022000 + +08000950 : + * @arg @ref LL_FLASH_LATENCY_0 + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + */ +__STATIC_INLINE uint32_t LL_FLASH_GetLatency(void) +{ + 8000950: b480 push {r7} + 8000952: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY)); + 8000954: 4b03 ldr r3, [pc, #12] ; (8000964 ) + 8000956: 681b ldr r3, [r3, #0] + 8000958: f003 0307 and.w r3, r3, #7 +} + 800095c: 4618 mov r0, r3 + 800095e: 46bd mov sp, r7 + 8000960: bc80 pop {r7} + 8000962: 4770 bx lr + 8000964: 40022000 .word 0x40022000 + +08000968
: +/** + * @brief The application entry point. + * @retval int + */ +int main(void) +{ + 8000968: b580 push {r7, lr} + 800096a: af00 add r7, sp, #0 + /* USER CODE END 1 */ + + /* MCU Configuration--------------------------------------------------------*/ + + /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + HAL_Init(); + 800096c: f000 fd0c bl 8001388 + /* USER CODE BEGIN Init */ + + /* USER CODE END Init */ + + /* Configure the system clock */ + SystemClock_Config(); + 8000970: f000 f810 bl 8000994 + /* USER CODE BEGIN SysInit */ + + /* USER CODE END SysInit */ + + /* Initialize all configured peripherals */ + MX_GPIO_Init(); + 8000974: f7ff fe0e bl 8000594 + MX_CAN_Init(); + 8000978: f7ff fc5c bl 8000234 + MX_TIM1_Init(); + 800097c: f000 fa7c bl 8000e78 + MX_USART1_UART_Init(); + 8000980: f000 fba6 bl 80010d0 + MX_USART2_UART_Init(); + 8000984: f000 fc0c bl 80011a0 + MX_USART3_UART_Init(); + 8000988: f000 fc70 bl 800126c + while (1) + { + /* USER CODE END WHILE */ + + /* USER CODE BEGIN 3 */ + MainTasks(); + 800098c: f008 ff76 bl 800987c + 8000990: e7fc b.n 800098c + ... + +08000994 : +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + 8000994: b580 push {r7, lr} + 8000996: af00 add r7, sp, #0 + LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); + 8000998: 2002 movs r0, #2 + 800099a: f7ff ffc5 bl 8000928 + while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_2) + 800099e: bf00 nop + 80009a0: f7ff ffd6 bl 8000950 + 80009a4: 4603 mov r3, r0 + 80009a6: 2b02 cmp r3, #2 + 80009a8: d1fa bne.n 80009a0 + { + } + LL_RCC_HSE_Enable(); + 80009aa: f7ff ff09 bl 80007c0 + + /* Wait till HSE is ready */ + while(LL_RCC_HSE_IsReady() != 1) + 80009ae: bf00 nop + 80009b0: f7ff ff14 bl 80007dc + 80009b4: 4603 mov r3, r0 + 80009b6: 2b01 cmp r3, #1 + 80009b8: d1fa bne.n 80009b0 + { + + } + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9); + 80009ba: f44f 11e0 mov.w r1, #1835008 ; 0x1c0000 + 80009be: f44f 3080 mov.w r0, #65536 ; 0x10000 + 80009c2: f7ff ff99 bl 80008f8 + LL_RCC_PLL_Enable(); + 80009c6: f7ff ff77 bl 80008b8 + + /* Wait till PLL is ready */ + while(LL_RCC_PLL_IsReady() != 1) + 80009ca: bf00 nop + 80009cc: f7ff ff82 bl 80008d4 + 80009d0: 4603 mov r3, r0 + 80009d2: 2b01 cmp r3, #1 + 80009d4: d1fa bne.n 80009cc + { + + } + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + 80009d6: 2000 movs r0, #0 + 80009d8: f7ff ff32 bl 8000840 + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2); + 80009dc: f44f 6080 mov.w r0, #1024 ; 0x400 + 80009e0: f7ff ff42 bl 8000868 + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); + 80009e4: 2000 movs r0, #0 + 80009e6: f7ff ff53 bl 8000890 + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + 80009ea: 2002 movs r0, #2 + 80009ec: f7ff ff08 bl 8000800 + + /* Wait till System clock is ready */ + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + 80009f0: bf00 nop + 80009f2: f7ff ff19 bl 8000828 + 80009f6: 4603 mov r3, r0 + 80009f8: 2b08 cmp r3, #8 + 80009fa: d1fa bne.n 80009f2 + { + + } + LL_SetSystemCoreClock(72000000); + 80009fc: 4806 ldr r0, [pc, #24] ; (8000a18 ) + 80009fe: f002 fadd bl 8002fbc + + /* Update the time base */ + if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK) + 8000a02: 2000 movs r0, #0 + 8000a04: f000 fcd6 bl 80013b4 + 8000a08: 4603 mov r3, r0 + 8000a0a: 2b00 cmp r3, #0 + 8000a0c: d001 beq.n 8000a12 + { + Error_Handler(); + 8000a0e: f000 f805 bl 8000a1c + } +} + 8000a12: bf00 nop + 8000a14: bd80 pop {r7, pc} + 8000a16: bf00 nop + 8000a18: 044aa200 .word 0x044aa200 + +08000a1c : +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + 8000a1c: b480 push {r7} + 8000a1e: af00 add r7, sp, #0 + __ASM volatile ("cpsid i" : : : "memory"); + 8000a20: b672 cpsid i + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + __disable_irq(); + while (1) + 8000a22: e7fe b.n 8000a22 + +08000a24 : +/* USER CODE END 0 */ +/** + * Initializes the Global MSP. + */ +void HAL_MspInit(void) +{ + 8000a24: b480 push {r7} + 8000a26: b085 sub sp, #20 + 8000a28: af00 add r7, sp, #0 + /* USER CODE BEGIN MspInit 0 */ + + /* USER CODE END MspInit 0 */ + + __HAL_RCC_AFIO_CLK_ENABLE(); + 8000a2a: 4b15 ldr r3, [pc, #84] ; (8000a80 ) + 8000a2c: 699b ldr r3, [r3, #24] + 8000a2e: 4a14 ldr r2, [pc, #80] ; (8000a80 ) + 8000a30: f043 0301 orr.w r3, r3, #1 + 8000a34: 6193 str r3, [r2, #24] + 8000a36: 4b12 ldr r3, [pc, #72] ; (8000a80 ) + 8000a38: 699b ldr r3, [r3, #24] + 8000a3a: f003 0301 and.w r3, r3, #1 + 8000a3e: 60bb str r3, [r7, #8] + 8000a40: 68bb ldr r3, [r7, #8] + __HAL_RCC_PWR_CLK_ENABLE(); + 8000a42: 4b0f ldr r3, [pc, #60] ; (8000a80 ) + 8000a44: 69db ldr r3, [r3, #28] + 8000a46: 4a0e ldr r2, [pc, #56] ; (8000a80 ) + 8000a48: f043 5380 orr.w r3, r3, #268435456 ; 0x10000000 + 8000a4c: 61d3 str r3, [r2, #28] + 8000a4e: 4b0c ldr r3, [pc, #48] ; (8000a80 ) + 8000a50: 69db ldr r3, [r3, #28] + 8000a52: f003 5380 and.w r3, r3, #268435456 ; 0x10000000 + 8000a56: 607b str r3, [r7, #4] + 8000a58: 687b ldr r3, [r7, #4] + + /* System interrupt init*/ + + /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled + */ + __HAL_AFIO_REMAP_SWJ_NOJTAG(); + 8000a5a: 4b0a ldr r3, [pc, #40] ; (8000a84 ) + 8000a5c: 685b ldr r3, [r3, #4] + 8000a5e: 60fb str r3, [r7, #12] + 8000a60: 68fb ldr r3, [r7, #12] + 8000a62: f023 63e0 bic.w r3, r3, #117440512 ; 0x7000000 + 8000a66: 60fb str r3, [r7, #12] + 8000a68: 68fb ldr r3, [r7, #12] + 8000a6a: f043 7300 orr.w r3, r3, #33554432 ; 0x2000000 + 8000a6e: 60fb str r3, [r7, #12] + 8000a70: 4a04 ldr r2, [pc, #16] ; (8000a84 ) + 8000a72: 68fb ldr r3, [r7, #12] + 8000a74: 6053 str r3, [r2, #4] + + /* USER CODE BEGIN MspInit 1 */ + + /* USER CODE END MspInit 1 */ +} + 8000a76: bf00 nop + 8000a78: 3714 adds r7, #20 + 8000a7a: 46bd mov sp, r7 + 8000a7c: bc80 pop {r7} + 8000a7e: 4770 bx lr + 8000a80: 40021000 .word 0x40021000 + 8000a84: 40010000 .word 0x40010000 + +08000a88 : + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine) +{ + 8000a88: b480 push {r7} + 8000a8a: b083 sub sp, #12 + 8000a8c: af00 add r7, sp, #0 + 8000a8e: 6078 str r0, [r7, #4] + return (READ_BIT(EXTI->PR, ExtiLine) == (ExtiLine)); + 8000a90: 4b07 ldr r3, [pc, #28] ; (8000ab0 ) + 8000a92: 695a ldr r2, [r3, #20] + 8000a94: 687b ldr r3, [r7, #4] + 8000a96: 4013 ands r3, r2 + 8000a98: 687a ldr r2, [r7, #4] + 8000a9a: 429a cmp r2, r3 + 8000a9c: bf0c ite eq + 8000a9e: 2301 moveq r3, #1 + 8000aa0: 2300 movne r3, #0 + 8000aa2: b2db uxtb r3, r3 +} + 8000aa4: 4618 mov r0, r3 + 8000aa6: 370c adds r7, #12 + 8000aa8: 46bd mov sp, r7 + 8000aaa: bc80 pop {r7} + 8000aac: 4770 bx lr + 8000aae: bf00 nop + 8000ab0: 40010400 .word 0x40010400 + +08000ab4 : + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine) +{ + 8000ab4: b480 push {r7} + 8000ab6: b083 sub sp, #12 + 8000ab8: af00 add r7, sp, #0 + 8000aba: 6078 str r0, [r7, #4] + WRITE_REG(EXTI->PR, ExtiLine); + 8000abc: 4a03 ldr r2, [pc, #12] ; (8000acc ) + 8000abe: 687b ldr r3, [r7, #4] + 8000ac0: 6153 str r3, [r2, #20] +} + 8000ac2: bf00 nop + 8000ac4: 370c adds r7, #12 + 8000ac6: 46bd mov sp, r7 + 8000ac8: bc80 pop {r7} + 8000aca: 4770 bx lr + 8000acc: 40010400 .word 0x40010400 + +08000ad0 : +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + 8000ad0: b480 push {r7} + 8000ad2: af00 add r7, sp, #0 + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + while (1) + 8000ad4: e7fe b.n 8000ad4 + +08000ad6 : + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + 8000ad6: b480 push {r7} + 8000ad8: af00 add r7, sp, #0 + /* USER CODE BEGIN HardFault_IRQn 0 */ + + /* USER CODE END HardFault_IRQn 0 */ + while (1) + 8000ada: e7fe b.n 8000ada + +08000adc : + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + 8000adc: b480 push {r7} + 8000ade: af00 add r7, sp, #0 + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + 8000ae0: e7fe b.n 8000ae0 + +08000ae2 : + +/** + * @brief This function handles Prefetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + 8000ae2: b480 push {r7} + 8000ae4: af00 add r7, sp, #0 + /* USER CODE BEGIN BusFault_IRQn 0 */ + + /* USER CODE END BusFault_IRQn 0 */ + while (1) + 8000ae6: e7fe b.n 8000ae6 + +08000ae8 : + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + 8000ae8: b480 push {r7} + 8000aea: af00 add r7, sp, #0 + /* USER CODE BEGIN UsageFault_IRQn 0 */ + + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + 8000aec: e7fe b.n 8000aec + +08000aee : + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + 8000aee: b480 push {r7} + 8000af0: af00 add r7, sp, #0 + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + 8000af2: bf00 nop + 8000af4: 46bd mov sp, r7 + 8000af6: bc80 pop {r7} + 8000af8: 4770 bx lr + +08000afa : + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + 8000afa: b480 push {r7} + 8000afc: af00 add r7, sp, #0 + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + 8000afe: bf00 nop + 8000b00: 46bd mov sp, r7 + 8000b02: bc80 pop {r7} + 8000b04: 4770 bx lr + +08000b06 : + +/** + * @brief This function handles Pendable request for system service. + */ +void PendSV_Handler(void) +{ + 8000b06: b480 push {r7} + 8000b08: af00 add r7, sp, #0 + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + 8000b0a: bf00 nop + 8000b0c: 46bd mov sp, r7 + 8000b0e: bc80 pop {r7} + 8000b10: 4770 bx lr + +08000b12 : + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + 8000b12: b580 push {r7, lr} + 8000b14: af00 add r7, sp, #0 + /* USER CODE BEGIN SysTick_IRQn 0 */ + TriggerIntProc(); + 8000b16: f003 fe49 bl 80047ac + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + 8000b1a: f000 fc7b bl 8001414 + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + 8000b1e: bf00 nop + 8000b20: bd80 pop {r7, pc} + ... + +08000b24 : + +/** + * @brief This function handles USB high priority or CAN TX interrupts. + */ +void USB_HP_CAN1_TX_IRQHandler(void) +{ + 8000b24: b580 push {r7, lr} + 8000b26: af00 add r7, sp, #0 + /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 0 */ + + /* USER CODE END USB_HP_CAN1_TX_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan); + 8000b28: 4802 ldr r0, [pc, #8] ; (8000b34 ) + 8000b2a: f001 f8f4 bl 8001d16 + /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 1 */ + + /* USER CODE END USB_HP_CAN1_TX_IRQn 1 */ +} + 8000b2e: bf00 nop + 8000b30: bd80 pop {r7, pc} + 8000b32: bf00 nop + 8000b34: 2000058c .word 0x2000058c + +08000b38 : + +/** + * @brief This function handles USB low priority or CAN RX0 interrupts. + */ +void USB_LP_CAN1_RX0_IRQHandler(void) +{ + 8000b38: b580 push {r7, lr} + 8000b3a: af00 add r7, sp, #0 + /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 0 */ + + /* USER CODE END USB_LP_CAN1_RX0_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan); + 8000b3c: 4802 ldr r0, [pc, #8] ; (8000b48 ) + 8000b3e: f001 f8ea bl 8001d16 + /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 1 */ + + /* USER CODE END USB_LP_CAN1_RX0_IRQn 1 */ +} + 8000b42: bf00 nop + 8000b44: bd80 pop {r7, pc} + 8000b46: bf00 nop + 8000b48: 2000058c .word 0x2000058c + +08000b4c : + +/** + * @brief This function handles EXTI line[9:5] interrupts. + */ +void EXTI9_5_IRQHandler(void) +{ + 8000b4c: b580 push {r7, lr} + 8000b4e: af00 add r7, sp, #0 + /* USER CODE BEGIN EXTI9_5_IRQn 0 */ + + /* USER CODE END EXTI9_5_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_8) != RESET) + 8000b50: f44f 7080 mov.w r0, #256 ; 0x100 + 8000b54: f7ff ff98 bl 8000a88 + 8000b58: 4603 mov r3, r0 + 8000b5a: 2b00 cmp r3, #0 + 8000b5c: d005 beq.n 8000b6a + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_8); + 8000b5e: f44f 7080 mov.w r0, #256 ; 0x100 + 8000b62: f7ff ffa7 bl 8000ab4 + /* USER CODE BEGIN LL_EXTI_LINE_8 */ + APIntProc(); + 8000b66: f006 fbf9 bl 800735c + /* USER CODE END LL_EXTI_LINE_8 */ + } + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_9) != RESET) + 8000b6a: f44f 7000 mov.w r0, #512 ; 0x200 + 8000b6e: f7ff ff8b bl 8000a88 + 8000b72: 4603 mov r3, r0 + 8000b74: 2b00 cmp r3, #0 + 8000b76: d005 beq.n 8000b84 + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_9); + 8000b78: f44f 7000 mov.w r0, #512 ; 0x200 + 8000b7c: f7ff ff9a bl 8000ab4 + /* USER CODE BEGIN LL_EXTI_LINE_9 */ + BPIntProc(); + 8000b80: f006 fcf6 bl 8007570 + /* USER CODE END LL_EXTI_LINE_9 */ + } + /* USER CODE BEGIN EXTI9_5_IRQn 1 */ + + /* USER CODE END EXTI9_5_IRQn 1 */ +} + 8000b84: bf00 nop + 8000b86: bd80 pop {r7, pc} + +08000b88 : + +/** + * @brief This function handles TIM1 break interrupt. + */ +void TIM1_BRK_IRQHandler(void) +{ + 8000b88: b580 push {r7, lr} + 8000b8a: af00 add r7, sp, #0 + /* USER CODE BEGIN TIM1_BRK_IRQn 0 */ + SoftPwmIntProc(); + 8000b8c: f005 ff98 bl 8006ac0 + /* USER CODE END TIM1_BRK_IRQn 0 */ + /* USER CODE BEGIN TIM1_BRK_IRQn 1 */ + + /* USER CODE END TIM1_BRK_IRQn 1 */ +} + 8000b90: bf00 nop + 8000b92: bd80 pop {r7, pc} + +08000b94 : + +/** + * @brief This function handles USART1 global interrupt. + */ +void USART1_IRQHandler(void) +{ + 8000b94: b580 push {r7, lr} + 8000b96: af00 add r7, sp, #0 + /* USER CODE BEGIN USART1_IRQn 0 */ +#ifdef COMM_USART1 + USART1IntProc(); + 8000b98: f002 ff8e bl 8003ab8 +#endif + /* USER CODE END USART1_IRQn 0 */ + /* USER CODE BEGIN USART1_IRQn 1 */ + + /* USER CODE END USART1_IRQn 1 */ +} + 8000b9c: bf00 nop + 8000b9e: bd80 pop {r7, pc} + +08000ba0 : + +/** + * @brief This function handles USART2 global interrupt. + */ +void USART2_IRQHandler(void) +{ + 8000ba0: b580 push {r7, lr} + 8000ba2: af00 add r7, sp, #0 + /* USER CODE BEGIN USART2_IRQn 0 */ +#ifdef COMM_USART2 + USART2IntProc(); + 8000ba4: f003 f9dc bl 8003f60 +#endif + /* USER CODE END USART2_IRQn 0 */ + /* USER CODE BEGIN USART2_IRQn 1 */ + + /* USER CODE END USART2_IRQn 1 */ +} + 8000ba8: bf00 nop + 8000baa: bd80 pop {r7, pc} + +08000bac : + +/** + * @brief This function handles USART3 global interrupt. + */ +void USART3_IRQHandler(void) +{ + 8000bac: b580 push {r7, lr} + 8000bae: af00 add r7, sp, #0 + /* USER CODE BEGIN USART3_IRQn 0 */ +#ifdef COMM_USART3 + USART3IntProc(); + 8000bb0: f003 fbcc bl 800434c +#endif + /* USER CODE END USART3_IRQn 0 */ + /* USER CODE BEGIN USART3_IRQn 1 */ + + /* USER CODE END USART3_IRQn 1 */ +} + 8000bb4: bf00 nop + 8000bb6: bd80 pop {r7, pc} + +08000bb8 : + +/** + * @brief This function handles EXTI line[15:10] interrupts. + */ +void EXTI15_10_IRQHandler(void) +{ + 8000bb8: b580 push {r7, lr} + 8000bba: af00 add r7, sp, #0 + /* USER CODE BEGIN EXTI15_10_IRQn 0 */ + + /* USER CODE END EXTI15_10_IRQn 0 */ + if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_10) != RESET) + 8000bbc: f44f 6080 mov.w r0, #1024 ; 0x400 + 8000bc0: f7ff ff62 bl 8000a88 + 8000bc4: 4603 mov r3, r0 + 8000bc6: 2b00 cmp r3, #0 + 8000bc8: d005 beq.n 8000bd6 + { + LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_10); + 8000bca: f44f 6080 mov.w r0, #1024 ; 0x400 + 8000bce: f7ff ff71 bl 8000ab4 + /* USER CODE BEGIN LL_EXTI_LINE_10 */ + ZPIntProc(); + 8000bd2: f006 fcdd bl 8007590 + /* USER CODE END LL_EXTI_LINE_10 */ + } + /* USER CODE BEGIN EXTI15_10_IRQn 1 */ + + /* USER CODE END EXTI15_10_IRQn 1 */ +} + 8000bd6: bf00 nop + 8000bd8: bd80 pop {r7, pc} + +08000bda <_close>: + } + return len; +} + +int _close(int file) +{ + 8000bda: b480 push {r7} + 8000bdc: b083 sub sp, #12 + 8000bde: af00 add r7, sp, #0 + 8000be0: 6078 str r0, [r7, #4] + return -1; + 8000be2: f04f 33ff mov.w r3, #4294967295 +} + 8000be6: 4618 mov r0, r3 + 8000be8: 370c adds r7, #12 + 8000bea: 46bd mov sp, r7 + 8000bec: bc80 pop {r7} + 8000bee: 4770 bx lr + +08000bf0 <_fstat>: + + +int _fstat(int file, struct stat *st) +{ + 8000bf0: b480 push {r7} + 8000bf2: b083 sub sp, #12 + 8000bf4: af00 add r7, sp, #0 + 8000bf6: 6078 str r0, [r7, #4] + 8000bf8: 6039 str r1, [r7, #0] + st->st_mode = S_IFCHR; + 8000bfa: 683b ldr r3, [r7, #0] + 8000bfc: f44f 5200 mov.w r2, #8192 ; 0x2000 + 8000c00: 605a str r2, [r3, #4] + return 0; + 8000c02: 2300 movs r3, #0 +} + 8000c04: 4618 mov r0, r3 + 8000c06: 370c adds r7, #12 + 8000c08: 46bd mov sp, r7 + 8000c0a: bc80 pop {r7} + 8000c0c: 4770 bx lr + +08000c0e <_isatty>: + +int _isatty(int file) +{ + 8000c0e: b480 push {r7} + 8000c10: b083 sub sp, #12 + 8000c12: af00 add r7, sp, #0 + 8000c14: 6078 str r0, [r7, #4] + return 1; + 8000c16: 2301 movs r3, #1 +} + 8000c18: 4618 mov r0, r3 + 8000c1a: 370c adds r7, #12 + 8000c1c: 46bd mov sp, r7 + 8000c1e: bc80 pop {r7} + 8000c20: 4770 bx lr + +08000c22 <_lseek>: + +int _lseek(int file, int ptr, int dir) +{ + 8000c22: b480 push {r7} + 8000c24: b085 sub sp, #20 + 8000c26: af00 add r7, sp, #0 + 8000c28: 60f8 str r0, [r7, #12] + 8000c2a: 60b9 str r1, [r7, #8] + 8000c2c: 607a str r2, [r7, #4] + return 0; + 8000c2e: 2300 movs r3, #0 +} + 8000c30: 4618 mov r0, r3 + 8000c32: 3714 adds r7, #20 + 8000c34: 46bd mov sp, r7 + 8000c36: bc80 pop {r7} + 8000c38: 4770 bx lr + ... + +08000c3c <_sbrk>: + * + * @param incr Memory size + * @return Pointer to allocated memory + */ +void *_sbrk(ptrdiff_t incr) +{ + 8000c3c: b580 push {r7, lr} + 8000c3e: b086 sub sp, #24 + 8000c40: af00 add r7, sp, #0 + 8000c42: 6078 str r0, [r7, #4] + extern uint8_t _end; /* Symbol defined in the linker script */ + extern uint8_t _estack; /* Symbol defined in the linker script */ + extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */ + const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size; + 8000c44: 4a14 ldr r2, [pc, #80] ; (8000c98 <_sbrk+0x5c>) + 8000c46: 4b15 ldr r3, [pc, #84] ; (8000c9c <_sbrk+0x60>) + 8000c48: 1ad3 subs r3, r2, r3 + 8000c4a: 617b str r3, [r7, #20] + const uint8_t *max_heap = (uint8_t *)stack_limit; + 8000c4c: 697b ldr r3, [r7, #20] + 8000c4e: 613b str r3, [r7, #16] + uint8_t *prev_heap_end; + + /* Initialize heap end at first call */ + if (NULL == __sbrk_heap_end) + 8000c50: 4b13 ldr r3, [pc, #76] ; (8000ca0 <_sbrk+0x64>) + 8000c52: 681b ldr r3, [r3, #0] + 8000c54: 2b00 cmp r3, #0 + 8000c56: d102 bne.n 8000c5e <_sbrk+0x22> + { + __sbrk_heap_end = &_end; + 8000c58: 4b11 ldr r3, [pc, #68] ; (8000ca0 <_sbrk+0x64>) + 8000c5a: 4a12 ldr r2, [pc, #72] ; (8000ca4 <_sbrk+0x68>) + 8000c5c: 601a str r2, [r3, #0] + } + + /* Protect heap from growing into the reserved MSP stack */ + if (__sbrk_heap_end + incr > max_heap) + 8000c5e: 4b10 ldr r3, [pc, #64] ; (8000ca0 <_sbrk+0x64>) + 8000c60: 681a ldr r2, [r3, #0] + 8000c62: 687b ldr r3, [r7, #4] + 8000c64: 4413 add r3, r2 + 8000c66: 693a ldr r2, [r7, #16] + 8000c68: 429a cmp r2, r3 + 8000c6a: d207 bcs.n 8000c7c <_sbrk+0x40> + { + errno = ENOMEM; + 8000c6c: f008 fe10 bl 8009890 <__errno> + 8000c70: 4602 mov r2, r0 + 8000c72: 230c movs r3, #12 + 8000c74: 6013 str r3, [r2, #0] + return (void *)-1; + 8000c76: f04f 33ff mov.w r3, #4294967295 + 8000c7a: e009 b.n 8000c90 <_sbrk+0x54> + } + + prev_heap_end = __sbrk_heap_end; + 8000c7c: 4b08 ldr r3, [pc, #32] ; (8000ca0 <_sbrk+0x64>) + 8000c7e: 681b ldr r3, [r3, #0] + 8000c80: 60fb str r3, [r7, #12] + __sbrk_heap_end += incr; + 8000c82: 4b07 ldr r3, [pc, #28] ; (8000ca0 <_sbrk+0x64>) + 8000c84: 681a ldr r2, [r3, #0] + 8000c86: 687b ldr r3, [r7, #4] + 8000c88: 4413 add r3, r2 + 8000c8a: 4a05 ldr r2, [pc, #20] ; (8000ca0 <_sbrk+0x64>) + 8000c8c: 6013 str r3, [r2, #0] + + return (void *)prev_heap_end; + 8000c8e: 68fb ldr r3, [r7, #12] +} + 8000c90: 4618 mov r0, r3 + 8000c92: 3718 adds r7, #24 + 8000c94: 46bd mov sp, r7 + 8000c96: bd80 pop {r7, pc} + 8000c98: 2000c000 .word 0x2000c000 + 8000c9c: 00000400 .word 0x00000400 + 8000ca0: 20000558 .word 0x20000558 + 8000ca4: 20003d30 .word 0x20003d30 + +08000ca8 : + * @note This function should be used only after reset. + * @param None + * @retval None + */ +void SystemInit (void) +{ + 8000ca8: b480 push {r7} + 8000caa: af00 add r7, sp, #0 + + /* Configure the Vector Table location -------------------------------------*/ +#if defined(USER_VECT_TAB_ADDRESS) + SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */ +#endif /* USER_VECT_TAB_ADDRESS */ +} + 8000cac: bf00 nop + 8000cae: 46bd mov sp, r7 + 8000cb0: bc80 pop {r7} + 8000cb2: 4770 bx lr + +08000cb4 <__NVIC_GetPriorityGrouping>: +{ + 8000cb4: b480 push {r7} + 8000cb6: af00 add r7, sp, #0 + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); + 8000cb8: 4b04 ldr r3, [pc, #16] ; (8000ccc <__NVIC_GetPriorityGrouping+0x18>) + 8000cba: 68db ldr r3, [r3, #12] + 8000cbc: 0a1b lsrs r3, r3, #8 + 8000cbe: f003 0307 and.w r3, r3, #7 +} + 8000cc2: 4618 mov r0, r3 + 8000cc4: 46bd mov sp, r7 + 8000cc6: bc80 pop {r7} + 8000cc8: 4770 bx lr + 8000cca: bf00 nop + 8000ccc: e000ed00 .word 0xe000ed00 + +08000cd0 <__NVIC_EnableIRQ>: +{ + 8000cd0: b480 push {r7} + 8000cd2: b083 sub sp, #12 + 8000cd4: af00 add r7, sp, #0 + 8000cd6: 4603 mov r3, r0 + 8000cd8: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8000cda: f997 3007 ldrsb.w r3, [r7, #7] + 8000cde: 2b00 cmp r3, #0 + 8000ce0: db0b blt.n 8000cfa <__NVIC_EnableIRQ+0x2a> + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + 8000ce2: 79fb ldrb r3, [r7, #7] + 8000ce4: f003 021f and.w r2, r3, #31 + 8000ce8: 4906 ldr r1, [pc, #24] ; (8000d04 <__NVIC_EnableIRQ+0x34>) + 8000cea: f997 3007 ldrsb.w r3, [r7, #7] + 8000cee: 095b lsrs r3, r3, #5 + 8000cf0: 2001 movs r0, #1 + 8000cf2: fa00 f202 lsl.w r2, r0, r2 + 8000cf6: f841 2023 str.w r2, [r1, r3, lsl #2] +} + 8000cfa: bf00 nop + 8000cfc: 370c adds r7, #12 + 8000cfe: 46bd mov sp, r7 + 8000d00: bc80 pop {r7} + 8000d02: 4770 bx lr + 8000d04: e000e100 .word 0xe000e100 + +08000d08 <__NVIC_SetPriority>: +{ + 8000d08: b480 push {r7} + 8000d0a: b083 sub sp, #12 + 8000d0c: af00 add r7, sp, #0 + 8000d0e: 4603 mov r3, r0 + 8000d10: 6039 str r1, [r7, #0] + 8000d12: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8000d14: f997 3007 ldrsb.w r3, [r7, #7] + 8000d18: 2b00 cmp r3, #0 + 8000d1a: db0a blt.n 8000d32 <__NVIC_SetPriority+0x2a> + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 8000d1c: 683b ldr r3, [r7, #0] + 8000d1e: b2da uxtb r2, r3 + 8000d20: 490c ldr r1, [pc, #48] ; (8000d54 <__NVIC_SetPriority+0x4c>) + 8000d22: f997 3007 ldrsb.w r3, [r7, #7] + 8000d26: 0112 lsls r2, r2, #4 + 8000d28: b2d2 uxtb r2, r2 + 8000d2a: 440b add r3, r1 + 8000d2c: f883 2300 strb.w r2, [r3, #768] ; 0x300 +} + 8000d30: e00a b.n 8000d48 <__NVIC_SetPriority+0x40> + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 8000d32: 683b ldr r3, [r7, #0] + 8000d34: b2da uxtb r2, r3 + 8000d36: 4908 ldr r1, [pc, #32] ; (8000d58 <__NVIC_SetPriority+0x50>) + 8000d38: 79fb ldrb r3, [r7, #7] + 8000d3a: f003 030f and.w r3, r3, #15 + 8000d3e: 3b04 subs r3, #4 + 8000d40: 0112 lsls r2, r2, #4 + 8000d42: b2d2 uxtb r2, r2 + 8000d44: 440b add r3, r1 + 8000d46: 761a strb r2, [r3, #24] +} + 8000d48: bf00 nop + 8000d4a: 370c adds r7, #12 + 8000d4c: 46bd mov sp, r7 + 8000d4e: bc80 pop {r7} + 8000d50: 4770 bx lr + 8000d52: bf00 nop + 8000d54: e000e100 .word 0xe000e100 + 8000d58: e000ed00 .word 0xe000ed00 + +08000d5c : +{ + 8000d5c: b480 push {r7} + 8000d5e: b089 sub sp, #36 ; 0x24 + 8000d60: af00 add r7, sp, #0 + 8000d62: 60f8 str r0, [r7, #12] + 8000d64: 60b9 str r1, [r7, #8] + 8000d66: 607a str r2, [r7, #4] + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + 8000d68: 68fb ldr r3, [r7, #12] + 8000d6a: f003 0307 and.w r3, r3, #7 + 8000d6e: 61fb str r3, [r7, #28] + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + 8000d70: 69fb ldr r3, [r7, #28] + 8000d72: f1c3 0307 rsb r3, r3, #7 + 8000d76: 2b04 cmp r3, #4 + 8000d78: bf28 it cs + 8000d7a: 2304 movcs r3, #4 + 8000d7c: 61bb str r3, [r7, #24] + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + 8000d7e: 69fb ldr r3, [r7, #28] + 8000d80: 3304 adds r3, #4 + 8000d82: 2b06 cmp r3, #6 + 8000d84: d902 bls.n 8000d8c + 8000d86: 69fb ldr r3, [r7, #28] + 8000d88: 3b03 subs r3, #3 + 8000d8a: e000 b.n 8000d8e + 8000d8c: 2300 movs r3, #0 + 8000d8e: 617b str r3, [r7, #20] + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8000d90: f04f 32ff mov.w r2, #4294967295 + 8000d94: 69bb ldr r3, [r7, #24] + 8000d96: fa02 f303 lsl.w r3, r2, r3 + 8000d9a: 43da mvns r2, r3 + 8000d9c: 68bb ldr r3, [r7, #8] + 8000d9e: 401a ands r2, r3 + 8000da0: 697b ldr r3, [r7, #20] + 8000da2: 409a lsls r2, r3 + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + 8000da4: f04f 31ff mov.w r1, #4294967295 + 8000da8: 697b ldr r3, [r7, #20] + 8000daa: fa01 f303 lsl.w r3, r1, r3 + 8000dae: 43d9 mvns r1, r3 + 8000db0: 687b ldr r3, [r7, #4] + 8000db2: 400b ands r3, r1 + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8000db4: 4313 orrs r3, r2 +} + 8000db6: 4618 mov r0, r3 + 8000db8: 3724 adds r7, #36 ; 0x24 + 8000dba: 46bd mov sp, r7 + 8000dbc: bc80 pop {r7} + 8000dbe: 4770 bx lr + +08000dc0 : +{ + 8000dc0: b480 push {r7} + 8000dc2: b085 sub sp, #20 + 8000dc4: af00 add r7, sp, #0 + 8000dc6: 6078 str r0, [r7, #4] + SET_BIT(RCC->APB2ENR, Periphs); + 8000dc8: 4b08 ldr r3, [pc, #32] ; (8000dec ) + 8000dca: 699a ldr r2, [r3, #24] + 8000dcc: 4907 ldr r1, [pc, #28] ; (8000dec ) + 8000dce: 687b ldr r3, [r7, #4] + 8000dd0: 4313 orrs r3, r2 + 8000dd2: 618b str r3, [r1, #24] + tmpreg = READ_BIT(RCC->APB2ENR, Periphs); + 8000dd4: 4b05 ldr r3, [pc, #20] ; (8000dec ) + 8000dd6: 699a ldr r2, [r3, #24] + 8000dd8: 687b ldr r3, [r7, #4] + 8000dda: 4013 ands r3, r2 + 8000ddc: 60fb str r3, [r7, #12] + (void)tmpreg; + 8000dde: 68fb ldr r3, [r7, #12] +} + 8000de0: bf00 nop + 8000de2: 3714 adds r7, #20 + 8000de4: 46bd mov sp, r7 + 8000de6: bc80 pop {r7} + 8000de8: 4770 bx lr + 8000dea: bf00 nop + 8000dec: 40021000 .word 0x40021000 + +08000df0 : + * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx) +{ + 8000df0: b480 push {r7} + 8000df2: b083 sub sp, #12 + 8000df4: af00 add r7, sp, #0 + 8000df6: 6078 str r0, [r7, #4] + SET_BIT(TIMx->CR1, TIM_CR1_ARPE); + 8000df8: 687b ldr r3, [r7, #4] + 8000dfa: 681b ldr r3, [r3, #0] + 8000dfc: f043 0280 orr.w r2, r3, #128 ; 0x80 + 8000e00: 687b ldr r3, [r7, #4] + 8000e02: 601a str r2, [r3, #0] +} + 8000e04: bf00 nop + 8000e06: 370c adds r7, #12 + 8000e08: 46bd mov sp, r7 + 8000e0a: bc80 pop {r7} + 8000e0c: 4770 bx lr + +08000e0e : + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1 + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource) +{ + 8000e0e: b480 push {r7} + 8000e10: b083 sub sp, #12 + 8000e12: af00 add r7, sp, #0 + 8000e14: 6078 str r0, [r7, #4] + 8000e16: 6039 str r1, [r7, #0] + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); + 8000e18: 687b ldr r3, [r7, #4] + 8000e1a: 689b ldr r3, [r3, #8] + 8000e1c: f423 4380 bic.w r3, r3, #16384 ; 0x4000 + 8000e20: f023 0307 bic.w r3, r3, #7 + 8000e24: 683a ldr r2, [r7, #0] + 8000e26: 431a orrs r2, r3 + 8000e28: 687b ldr r3, [r7, #4] + 8000e2a: 609a str r2, [r3, #8] +} + 8000e2c: bf00 nop + 8000e2e: 370c adds r7, #12 + 8000e30: 46bd mov sp, r7 + 8000e32: bc80 pop {r7} + 8000e34: 4770 bx lr + +08000e36 : + * @arg @ref LL_TIM_TRGO_OC3REF + * @arg @ref LL_TIM_TRGO_OC4REF + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization) +{ + 8000e36: b480 push {r7} + 8000e38: b083 sub sp, #12 + 8000e3a: af00 add r7, sp, #0 + 8000e3c: 6078 str r0, [r7, #4] + 8000e3e: 6039 str r1, [r7, #0] + MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); + 8000e40: 687b ldr r3, [r7, #4] + 8000e42: 685b ldr r3, [r3, #4] + 8000e44: f023 0270 bic.w r2, r3, #112 ; 0x70 + 8000e48: 683b ldr r3, [r7, #0] + 8000e4a: 431a orrs r2, r3 + 8000e4c: 687b ldr r3, [r7, #4] + 8000e4e: 605a str r2, [r3, #4] +} + 8000e50: bf00 nop + 8000e52: 370c adds r7, #12 + 8000e54: 46bd mov sp, r7 + 8000e56: bc80 pop {r7} + 8000e58: 4770 bx lr + +08000e5a : + * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx) +{ + 8000e5a: b480 push {r7} + 8000e5c: b083 sub sp, #12 + 8000e5e: af00 add r7, sp, #0 + 8000e60: 6078 str r0, [r7, #4] + CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); + 8000e62: 687b ldr r3, [r7, #4] + 8000e64: 689b ldr r3, [r3, #8] + 8000e66: f023 0280 bic.w r2, r3, #128 ; 0x80 + 8000e6a: 687b ldr r3, [r7, #4] + 8000e6c: 609a str r2, [r3, #8] +} + 8000e6e: bf00 nop + 8000e70: 370c adds r7, #12 + 8000e72: 46bd mov sp, r7 + 8000e74: bc80 pop {r7} + 8000e76: 4770 bx lr + +08000e78 : + +/* USER CODE END 0 */ + +/* TIM1 init function */ +void MX_TIM1_Init(void) +{ + 8000e78: b580 push {r7, lr} + 8000e7a: b086 sub sp, #24 + 8000e7c: af00 add r7, sp, #0 + LL_TIM_InitTypeDef TIM_InitStruct = {0}; + 8000e7e: 1d3b adds r3, r7, #4 + 8000e80: 2200 movs r2, #0 + 8000e82: 601a str r2, [r3, #0] + 8000e84: 605a str r2, [r3, #4] + 8000e86: 609a str r2, [r3, #8] + 8000e88: 60da str r2, [r3, #12] + 8000e8a: 611a str r2, [r3, #16] + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1); + 8000e8c: f44f 6000 mov.w r0, #2048 ; 0x800 + 8000e90: f7ff ff96 bl 8000dc0 + + /* TIM1 interrupt Init */ + NVIC_SetPriority(TIM1_BRK_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 8000e94: f7ff ff0e bl 8000cb4 <__NVIC_GetPriorityGrouping> + 8000e98: 4603 mov r3, r0 + 8000e9a: 2200 movs r2, #0 + 8000e9c: 2100 movs r1, #0 + 8000e9e: 4618 mov r0, r3 + 8000ea0: f7ff ff5c bl 8000d5c + 8000ea4: 4603 mov r3, r0 + 8000ea6: 4619 mov r1, r3 + 8000ea8: 2018 movs r0, #24 + 8000eaa: f7ff ff2d bl 8000d08 <__NVIC_SetPriority> + NVIC_EnableIRQ(TIM1_BRK_IRQn); + 8000eae: 2018 movs r0, #24 + 8000eb0: f7ff ff0e bl 8000cd0 <__NVIC_EnableIRQ> + + TIM_InitStruct.Prescaler = 71; + 8000eb4: 2347 movs r3, #71 ; 0x47 + 8000eb6: 80bb strh r3, [r7, #4] + TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; + 8000eb8: 2300 movs r3, #0 + 8000eba: 60bb str r3, [r7, #8] + TIM_InitStruct.Autoreload = 33; + 8000ebc: 2321 movs r3, #33 ; 0x21 + 8000ebe: 60fb str r3, [r7, #12] + TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + 8000ec0: 2300 movs r3, #0 + 8000ec2: 613b str r3, [r7, #16] + TIM_InitStruct.RepetitionCounter = 0; + 8000ec4: 2300 movs r3, #0 + 8000ec6: 617b str r3, [r7, #20] + LL_TIM_Init(TIM1, &TIM_InitStruct); + 8000ec8: 1d3b adds r3, r7, #4 + 8000eca: 4619 mov r1, r3 + 8000ecc: 480a ldr r0, [pc, #40] ; (8000ef8 ) + 8000ece: f001 fef7 bl 8002cc0 + LL_TIM_EnableARRPreload(TIM1); + 8000ed2: 4809 ldr r0, [pc, #36] ; (8000ef8 ) + 8000ed4: f7ff ff8c bl 8000df0 + LL_TIM_SetClockSource(TIM1, LL_TIM_CLOCKSOURCE_INTERNAL); + 8000ed8: 2100 movs r1, #0 + 8000eda: 4807 ldr r0, [pc, #28] ; (8000ef8 ) + 8000edc: f7ff ff97 bl 8000e0e + LL_TIM_SetTriggerOutput(TIM1, LL_TIM_TRGO_RESET); + 8000ee0: 2100 movs r1, #0 + 8000ee2: 4805 ldr r0, [pc, #20] ; (8000ef8 ) + 8000ee4: f7ff ffa7 bl 8000e36 + LL_TIM_DisableMasterSlaveMode(TIM1); + 8000ee8: 4803 ldr r0, [pc, #12] ; (8000ef8 ) + 8000eea: f7ff ffb6 bl 8000e5a + +} + 8000eee: bf00 nop + 8000ef0: 3718 adds r7, #24 + 8000ef2: 46bd mov sp, r7 + 8000ef4: bd80 pop {r7, pc} + 8000ef6: bf00 nop + 8000ef8: 40012c00 .word 0x40012c00 + +08000efc <__NVIC_GetPriorityGrouping>: +{ + 8000efc: b480 push {r7} + 8000efe: af00 add r7, sp, #0 + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); + 8000f00: 4b04 ldr r3, [pc, #16] ; (8000f14 <__NVIC_GetPriorityGrouping+0x18>) + 8000f02: 68db ldr r3, [r3, #12] + 8000f04: 0a1b lsrs r3, r3, #8 + 8000f06: f003 0307 and.w r3, r3, #7 +} + 8000f0a: 4618 mov r0, r3 + 8000f0c: 46bd mov sp, r7 + 8000f0e: bc80 pop {r7} + 8000f10: 4770 bx lr + 8000f12: bf00 nop + 8000f14: e000ed00 .word 0xe000ed00 + +08000f18 <__NVIC_EnableIRQ>: +{ + 8000f18: b480 push {r7} + 8000f1a: b083 sub sp, #12 + 8000f1c: af00 add r7, sp, #0 + 8000f1e: 4603 mov r3, r0 + 8000f20: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8000f22: f997 3007 ldrsb.w r3, [r7, #7] + 8000f26: 2b00 cmp r3, #0 + 8000f28: db0b blt.n 8000f42 <__NVIC_EnableIRQ+0x2a> + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + 8000f2a: 79fb ldrb r3, [r7, #7] + 8000f2c: f003 021f and.w r2, r3, #31 + 8000f30: 4906 ldr r1, [pc, #24] ; (8000f4c <__NVIC_EnableIRQ+0x34>) + 8000f32: f997 3007 ldrsb.w r3, [r7, #7] + 8000f36: 095b lsrs r3, r3, #5 + 8000f38: 2001 movs r0, #1 + 8000f3a: fa00 f202 lsl.w r2, r0, r2 + 8000f3e: f841 2023 str.w r2, [r1, r3, lsl #2] +} + 8000f42: bf00 nop + 8000f44: 370c adds r7, #12 + 8000f46: 46bd mov sp, r7 + 8000f48: bc80 pop {r7} + 8000f4a: 4770 bx lr + 8000f4c: e000e100 .word 0xe000e100 + +08000f50 <__NVIC_SetPriority>: +{ + 8000f50: b480 push {r7} + 8000f52: b083 sub sp, #12 + 8000f54: af00 add r7, sp, #0 + 8000f56: 4603 mov r3, r0 + 8000f58: 6039 str r1, [r7, #0] + 8000f5a: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8000f5c: f997 3007 ldrsb.w r3, [r7, #7] + 8000f60: 2b00 cmp r3, #0 + 8000f62: db0a blt.n 8000f7a <__NVIC_SetPriority+0x2a> + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 8000f64: 683b ldr r3, [r7, #0] + 8000f66: b2da uxtb r2, r3 + 8000f68: 490c ldr r1, [pc, #48] ; (8000f9c <__NVIC_SetPriority+0x4c>) + 8000f6a: f997 3007 ldrsb.w r3, [r7, #7] + 8000f6e: 0112 lsls r2, r2, #4 + 8000f70: b2d2 uxtb r2, r2 + 8000f72: 440b add r3, r1 + 8000f74: f883 2300 strb.w r2, [r3, #768] ; 0x300 +} + 8000f78: e00a b.n 8000f90 <__NVIC_SetPriority+0x40> + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 8000f7a: 683b ldr r3, [r7, #0] + 8000f7c: b2da uxtb r2, r3 + 8000f7e: 4908 ldr r1, [pc, #32] ; (8000fa0 <__NVIC_SetPriority+0x50>) + 8000f80: 79fb ldrb r3, [r7, #7] + 8000f82: f003 030f and.w r3, r3, #15 + 8000f86: 3b04 subs r3, #4 + 8000f88: 0112 lsls r2, r2, #4 + 8000f8a: b2d2 uxtb r2, r2 + 8000f8c: 440b add r3, r1 + 8000f8e: 761a strb r2, [r3, #24] +} + 8000f90: bf00 nop + 8000f92: 370c adds r7, #12 + 8000f94: 46bd mov sp, r7 + 8000f96: bc80 pop {r7} + 8000f98: 4770 bx lr + 8000f9a: bf00 nop + 8000f9c: e000e100 .word 0xe000e100 + 8000fa0: e000ed00 .word 0xe000ed00 + +08000fa4 : +{ + 8000fa4: b480 push {r7} + 8000fa6: b089 sub sp, #36 ; 0x24 + 8000fa8: af00 add r7, sp, #0 + 8000faa: 60f8 str r0, [r7, #12] + 8000fac: 60b9 str r1, [r7, #8] + 8000fae: 607a str r2, [r7, #4] + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + 8000fb0: 68fb ldr r3, [r7, #12] + 8000fb2: f003 0307 and.w r3, r3, #7 + 8000fb6: 61fb str r3, [r7, #28] + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + 8000fb8: 69fb ldr r3, [r7, #28] + 8000fba: f1c3 0307 rsb r3, r3, #7 + 8000fbe: 2b04 cmp r3, #4 + 8000fc0: bf28 it cs + 8000fc2: 2304 movcs r3, #4 + 8000fc4: 61bb str r3, [r7, #24] + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + 8000fc6: 69fb ldr r3, [r7, #28] + 8000fc8: 3304 adds r3, #4 + 8000fca: 2b06 cmp r3, #6 + 8000fcc: d902 bls.n 8000fd4 + 8000fce: 69fb ldr r3, [r7, #28] + 8000fd0: 3b03 subs r3, #3 + 8000fd2: e000 b.n 8000fd6 + 8000fd4: 2300 movs r3, #0 + 8000fd6: 617b str r3, [r7, #20] + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8000fd8: f04f 32ff mov.w r2, #4294967295 + 8000fdc: 69bb ldr r3, [r7, #24] + 8000fde: fa02 f303 lsl.w r3, r2, r3 + 8000fe2: 43da mvns r2, r3 + 8000fe4: 68bb ldr r3, [r7, #8] + 8000fe6: 401a ands r2, r3 + 8000fe8: 697b ldr r3, [r7, #20] + 8000fea: 409a lsls r2, r3 + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + 8000fec: f04f 31ff mov.w r1, #4294967295 + 8000ff0: 697b ldr r3, [r7, #20] + 8000ff2: fa01 f303 lsl.w r3, r1, r3 + 8000ff6: 43d9 mvns r1, r3 + 8000ff8: 687b ldr r3, [r7, #4] + 8000ffa: 400b ands r3, r1 + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8000ffc: 4313 orrs r3, r2 +} + 8000ffe: 4618 mov r0, r3 + 8001000: 3724 adds r7, #36 ; 0x24 + 8001002: 46bd mov sp, r7 + 8001004: bc80 pop {r7} + 8001006: 4770 bx lr + +08001008 : +{ + 8001008: b480 push {r7} + 800100a: b085 sub sp, #20 + 800100c: af00 add r7, sp, #0 + 800100e: 6078 str r0, [r7, #4] + SET_BIT(RCC->APB1ENR, Periphs); + 8001010: 4b08 ldr r3, [pc, #32] ; (8001034 ) + 8001012: 69da ldr r2, [r3, #28] + 8001014: 4907 ldr r1, [pc, #28] ; (8001034 ) + 8001016: 687b ldr r3, [r7, #4] + 8001018: 4313 orrs r3, r2 + 800101a: 61cb str r3, [r1, #28] + tmpreg = READ_BIT(RCC->APB1ENR, Periphs); + 800101c: 4b05 ldr r3, [pc, #20] ; (8001034 ) + 800101e: 69da ldr r2, [r3, #28] + 8001020: 687b ldr r3, [r7, #4] + 8001022: 4013 ands r3, r2 + 8001024: 60fb str r3, [r7, #12] + (void)tmpreg; + 8001026: 68fb ldr r3, [r7, #12] +} + 8001028: bf00 nop + 800102a: 3714 adds r7, #20 + 800102c: 46bd mov sp, r7 + 800102e: bc80 pop {r7} + 8001030: 4770 bx lr + 8001032: bf00 nop + 8001034: 40021000 .word 0x40021000 + +08001038 : +{ + 8001038: b480 push {r7} + 800103a: b085 sub sp, #20 + 800103c: af00 add r7, sp, #0 + 800103e: 6078 str r0, [r7, #4] + SET_BIT(RCC->APB2ENR, Periphs); + 8001040: 4b08 ldr r3, [pc, #32] ; (8001064 ) + 8001042: 699a ldr r2, [r3, #24] + 8001044: 4907 ldr r1, [pc, #28] ; (8001064 ) + 8001046: 687b ldr r3, [r7, #4] + 8001048: 4313 orrs r3, r2 + 800104a: 618b str r3, [r1, #24] + tmpreg = READ_BIT(RCC->APB2ENR, Periphs); + 800104c: 4b05 ldr r3, [pc, #20] ; (8001064 ) + 800104e: 699a ldr r2, [r3, #24] + 8001050: 687b ldr r3, [r7, #4] + 8001052: 4013 ands r3, r2 + 8001054: 60fb str r3, [r7, #12] + (void)tmpreg; + 8001056: 68fb ldr r3, [r7, #12] +} + 8001058: bf00 nop + 800105a: 3714 adds r7, #20 + 800105c: 46bd mov sp, r7 + 800105e: bc80 pop {r7} + 8001060: 4770 bx lr + 8001062: bf00 nop + 8001064: 40021000 .word 0x40021000 + +08001068 : + * @rmtoll CR1 UE LL_USART_Enable + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx) +{ + 8001068: b480 push {r7} + 800106a: b083 sub sp, #12 + 800106c: af00 add r7, sp, #0 + 800106e: 6078 str r0, [r7, #4] + SET_BIT(USARTx->CR1, USART_CR1_UE); + 8001070: 687b ldr r3, [r7, #4] + 8001072: 68db ldr r3, [r3, #12] + 8001074: f443 5200 orr.w r2, r3, #8192 ; 0x2000 + 8001078: 687b ldr r3, [r7, #4] + 800107a: 60da str r2, [r3, #12] +} + 800107c: bf00 nop + 800107e: 370c adds r7, #12 + 8001080: 46bd mov sp, r7 + 8001082: bc80 pop {r7} + 8001084: 4770 bx lr + +08001086 : + * CR3 HDSEL LL_USART_ConfigAsyncMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx) +{ + 8001086: b480 push {r7} + 8001088: b083 sub sp, #12 + 800108a: af00 add r7, sp, #0 + 800108c: 6078 str r0, [r7, #4] + /* In Asynchronous mode, the following bits must be kept cleared: + - LINEN, CLKEN bits in the USART_CR2 register, + - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + 800108e: 687b ldr r3, [r7, #4] + 8001090: 691b ldr r3, [r3, #16] + 8001092: f423 4290 bic.w r2, r3, #18432 ; 0x4800 + 8001096: 687b ldr r3, [r7, #4] + 8001098: 611a str r2, [r3, #16] + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); + 800109a: 687b ldr r3, [r7, #4] + 800109c: 695b ldr r3, [r3, #20] + 800109e: f023 022a bic.w r2, r3, #42 ; 0x2a + 80010a2: 687b ldr r3, [r7, #4] + 80010a4: 615a str r2, [r3, #20] +} + 80010a6: bf00 nop + 80010a8: 370c adds r7, #12 + 80010aa: 46bd mov sp, r7 + 80010ac: bc80 pop {r7} + 80010ae: 4770 bx lr + +080010b0 : +{ + 80010b0: b480 push {r7} + 80010b2: af00 add r7, sp, #0 + SET_BIT(AFIO->MAPR, AFIO_MAPR_USART1_REMAP | AFIO_MAPR_SWJ_CFG); + 80010b4: 4b05 ldr r3, [pc, #20] ; (80010cc ) + 80010b6: 685b ldr r3, [r3, #4] + 80010b8: 4a04 ldr r2, [pc, #16] ; (80010cc ) + 80010ba: f043 63e0 orr.w r3, r3, #117440512 ; 0x7000000 + 80010be: f043 0304 orr.w r3, r3, #4 + 80010c2: 6053 str r3, [r2, #4] +} + 80010c4: bf00 nop + 80010c6: 46bd mov sp, r7 + 80010c8: bc80 pop {r7} + 80010ca: 4770 bx lr + 80010cc: 40010000 .word 0x40010000 + +080010d0 : +/* USER CODE END 0 */ + +/* USART1 init function */ + +void MX_USART1_UART_Init(void) +{ + 80010d0: b580 push {r7, lr} + 80010d2: b08c sub sp, #48 ; 0x30 + 80010d4: af00 add r7, sp, #0 + LL_USART_InitTypeDef USART_InitStruct = {0}; + 80010d6: f107 0314 add.w r3, r7, #20 + 80010da: 2200 movs r2, #0 + 80010dc: 601a str r2, [r3, #0] + 80010de: 605a str r2, [r3, #4] + 80010e0: 609a str r2, [r3, #8] + 80010e2: 60da str r2, [r3, #12] + 80010e4: 611a str r2, [r3, #16] + 80010e6: 615a str r2, [r3, #20] + 80010e8: 619a str r2, [r3, #24] + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + 80010ea: 463b mov r3, r7 + 80010ec: 2200 movs r2, #0 + 80010ee: 601a str r2, [r3, #0] + 80010f0: 605a str r2, [r3, #4] + 80010f2: 609a str r2, [r3, #8] + 80010f4: 60da str r2, [r3, #12] + 80010f6: 611a str r2, [r3, #16] + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); + 80010f8: f44f 4080 mov.w r0, #16384 ; 0x4000 + 80010fc: f7ff ff9c bl 8001038 + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + 8001100: 2008 movs r0, #8 + 8001102: f7ff ff99 bl 8001038 + /**USART1 GPIO Configuration + PB6 ------> USART1_TX + PB7 ------> USART1_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_6; + 8001106: f244 0340 movw r3, #16448 ; 0x4040 + 800110a: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + 800110c: 2309 movs r3, #9 + 800110e: 607b str r3, [r7, #4] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 8001110: 2303 movs r3, #3 + 8001112: 60bb str r3, [r7, #8] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 8001114: 2300 movs r3, #0 + 8001116: 60fb str r3, [r7, #12] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 8001118: 463b mov r3, r7 + 800111a: 4619 mov r1, r3 + 800111c: 481e ldr r0, [pc, #120] ; (8001198 ) + 800111e: f001 fc27 bl 8002970 + + GPIO_InitStruct.Pin = LL_GPIO_PIN_7; + 8001122: f248 0380 movw r3, #32896 ; 0x8080 + 8001126: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 8001128: 2304 movs r3, #4 + 800112a: 607b str r3, [r7, #4] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 800112c: 463b mov r3, r7 + 800112e: 4619 mov r1, r3 + 8001130: 4819 ldr r0, [pc, #100] ; (8001198 ) + 8001132: f001 fc1d bl 8002970 + + LL_GPIO_AF_EnableRemap_USART1(); + 8001136: f7ff ffbb bl 80010b0 + + /* USART1 interrupt Init */ + NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 800113a: f7ff fedf bl 8000efc <__NVIC_GetPriorityGrouping> + 800113e: 4603 mov r3, r0 + 8001140: 2200 movs r2, #0 + 8001142: 2100 movs r1, #0 + 8001144: 4618 mov r0, r3 + 8001146: f7ff ff2d bl 8000fa4 + 800114a: 4603 mov r3, r0 + 800114c: 4619 mov r1, r3 + 800114e: 2025 movs r0, #37 ; 0x25 + 8001150: f7ff fefe bl 8000f50 <__NVIC_SetPriority> + NVIC_EnableIRQ(USART1_IRQn); + 8001154: 2025 movs r0, #37 ; 0x25 + 8001156: f7ff fedf bl 8000f18 <__NVIC_EnableIRQ> + + USART_InitStruct.BaudRate = 115200; + 800115a: f44f 33e1 mov.w r3, #115200 ; 0x1c200 + 800115e: 617b str r3, [r7, #20] + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + 8001160: 2300 movs r3, #0 + 8001162: 61bb str r3, [r7, #24] + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + 8001164: 2300 movs r3, #0 + 8001166: 61fb str r3, [r7, #28] + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + 8001168: 2300 movs r3, #0 + 800116a: 623b str r3, [r7, #32] + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + 800116c: 230c movs r3, #12 + 800116e: 627b str r3, [r7, #36] ; 0x24 + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + 8001170: 2300 movs r3, #0 + 8001172: 62bb str r3, [r7, #40] ; 0x28 + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + 8001174: 2300 movs r3, #0 + 8001176: 62fb str r3, [r7, #44] ; 0x2c + LL_USART_Init(USART1, &USART_InitStruct); + 8001178: f107 0314 add.w r3, r7, #20 + 800117c: 4619 mov r1, r3 + 800117e: 4807 ldr r0, [pc, #28] ; (800119c ) + 8001180: f001 feaa bl 8002ed8 + LL_USART_ConfigAsyncMode(USART1); + 8001184: 4805 ldr r0, [pc, #20] ; (800119c ) + 8001186: f7ff ff7e bl 8001086 + LL_USART_Enable(USART1); + 800118a: 4804 ldr r0, [pc, #16] ; (800119c ) + 800118c: f7ff ff6c bl 8001068 + +} + 8001190: bf00 nop + 8001192: 3730 adds r7, #48 ; 0x30 + 8001194: 46bd mov sp, r7 + 8001196: bd80 pop {r7, pc} + 8001198: 40010c00 .word 0x40010c00 + 800119c: 40013800 .word 0x40013800 + +080011a0 : +/* USART2 init function */ + +void MX_USART2_UART_Init(void) +{ + 80011a0: b580 push {r7, lr} + 80011a2: b08c sub sp, #48 ; 0x30 + 80011a4: af00 add r7, sp, #0 + LL_USART_InitTypeDef USART_InitStruct = {0}; + 80011a6: f107 0314 add.w r3, r7, #20 + 80011aa: 2200 movs r2, #0 + 80011ac: 601a str r2, [r3, #0] + 80011ae: 605a str r2, [r3, #4] + 80011b0: 609a str r2, [r3, #8] + 80011b2: 60da str r2, [r3, #12] + 80011b4: 611a str r2, [r3, #16] + 80011b6: 615a str r2, [r3, #20] + 80011b8: 619a str r2, [r3, #24] + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + 80011ba: 463b mov r3, r7 + 80011bc: 2200 movs r2, #0 + 80011be: 601a str r2, [r3, #0] + 80011c0: 605a str r2, [r3, #4] + 80011c2: 609a str r2, [r3, #8] + 80011c4: 60da str r2, [r3, #12] + 80011c6: 611a str r2, [r3, #16] + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2); + 80011c8: f44f 3000 mov.w r0, #131072 ; 0x20000 + 80011cc: f7ff ff1c bl 8001008 + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); + 80011d0: 2004 movs r0, #4 + 80011d2: f7ff ff31 bl 8001038 + /**USART2 GPIO Configuration + PA2 ------> USART2_TX + PA3 ------> USART2_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_2; + 80011d6: f240 4304 movw r3, #1028 ; 0x404 + 80011da: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + 80011dc: 2309 movs r3, #9 + 80011de: 607b str r3, [r7, #4] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 80011e0: 2303 movs r3, #3 + 80011e2: 60bb str r3, [r7, #8] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 80011e4: 2300 movs r3, #0 + 80011e6: 60fb str r3, [r7, #12] + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + 80011e8: 463b mov r3, r7 + 80011ea: 4619 mov r1, r3 + 80011ec: 481d ldr r0, [pc, #116] ; (8001264 ) + 80011ee: f001 fbbf bl 8002970 + + GPIO_InitStruct.Pin = LL_GPIO_PIN_3; + 80011f2: f640 0308 movw r3, #2056 ; 0x808 + 80011f6: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 80011f8: 2304 movs r3, #4 + 80011fa: 607b str r3, [r7, #4] + LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + 80011fc: 463b mov r3, r7 + 80011fe: 4619 mov r1, r3 + 8001200: 4818 ldr r0, [pc, #96] ; (8001264 ) + 8001202: f001 fbb5 bl 8002970 + + /* USART2 interrupt Init */ + NVIC_SetPriority(USART2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 8001206: f7ff fe79 bl 8000efc <__NVIC_GetPriorityGrouping> + 800120a: 4603 mov r3, r0 + 800120c: 2200 movs r2, #0 + 800120e: 2100 movs r1, #0 + 8001210: 4618 mov r0, r3 + 8001212: f7ff fec7 bl 8000fa4 + 8001216: 4603 mov r3, r0 + 8001218: 4619 mov r1, r3 + 800121a: 2026 movs r0, #38 ; 0x26 + 800121c: f7ff fe98 bl 8000f50 <__NVIC_SetPriority> + NVIC_EnableIRQ(USART2_IRQn); + 8001220: 2026 movs r0, #38 ; 0x26 + 8001222: f7ff fe79 bl 8000f18 <__NVIC_EnableIRQ> + + USART_InitStruct.BaudRate = 115200; + 8001226: f44f 33e1 mov.w r3, #115200 ; 0x1c200 + 800122a: 617b str r3, [r7, #20] + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + 800122c: 2300 movs r3, #0 + 800122e: 61bb str r3, [r7, #24] + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + 8001230: 2300 movs r3, #0 + 8001232: 61fb str r3, [r7, #28] + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + 8001234: 2300 movs r3, #0 + 8001236: 623b str r3, [r7, #32] + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + 8001238: 230c movs r3, #12 + 800123a: 627b str r3, [r7, #36] ; 0x24 + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + 800123c: 2300 movs r3, #0 + 800123e: 62bb str r3, [r7, #40] ; 0x28 + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + 8001240: 2300 movs r3, #0 + 8001242: 62fb str r3, [r7, #44] ; 0x2c + LL_USART_Init(USART2, &USART_InitStruct); + 8001244: f107 0314 add.w r3, r7, #20 + 8001248: 4619 mov r1, r3 + 800124a: 4807 ldr r0, [pc, #28] ; (8001268 ) + 800124c: f001 fe44 bl 8002ed8 + LL_USART_ConfigAsyncMode(USART2); + 8001250: 4805 ldr r0, [pc, #20] ; (8001268 ) + 8001252: f7ff ff18 bl 8001086 + LL_USART_Enable(USART2); + 8001256: 4804 ldr r0, [pc, #16] ; (8001268 ) + 8001258: f7ff ff06 bl 8001068 + +} + 800125c: bf00 nop + 800125e: 3730 adds r7, #48 ; 0x30 + 8001260: 46bd mov sp, r7 + 8001262: bd80 pop {r7, pc} + 8001264: 40010800 .word 0x40010800 + 8001268: 40004400 .word 0x40004400 + +0800126c : +/* USART3 init function */ + +void MX_USART3_UART_Init(void) +{ + 800126c: b580 push {r7, lr} + 800126e: b08c sub sp, #48 ; 0x30 + 8001270: af00 add r7, sp, #0 + LL_USART_InitTypeDef USART_InitStruct = {0}; + 8001272: f107 0314 add.w r3, r7, #20 + 8001276: 2200 movs r2, #0 + 8001278: 601a str r2, [r3, #0] + 800127a: 605a str r2, [r3, #4] + 800127c: 609a str r2, [r3, #8] + 800127e: 60da str r2, [r3, #12] + 8001280: 611a str r2, [r3, #16] + 8001282: 615a str r2, [r3, #20] + 8001284: 619a str r2, [r3, #24] + + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + 8001286: 463b mov r3, r7 + 8001288: 2200 movs r2, #0 + 800128a: 601a str r2, [r3, #0] + 800128c: 605a str r2, [r3, #4] + 800128e: 609a str r2, [r3, #8] + 8001290: 60da str r2, [r3, #12] + 8001292: 611a str r2, [r3, #16] + + /* Peripheral clock enable */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3); + 8001294: f44f 2080 mov.w r0, #262144 ; 0x40000 + 8001298: f7ff feb6 bl 8001008 + + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + 800129c: 2008 movs r0, #8 + 800129e: f7ff fecb bl 8001038 + /**USART3 GPIO Configuration + PB10 ------> USART3_TX + PB11 ------> USART3_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_10; + 80012a2: 4b22 ldr r3, [pc, #136] ; (800132c ) + 80012a4: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + 80012a6: 2309 movs r3, #9 + 80012a8: 607b str r3, [r7, #4] + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; + 80012aa: 2303 movs r3, #3 + 80012ac: 60bb str r3, [r7, #8] + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + 80012ae: 2300 movs r3, #0 + 80012b0: 60fb str r3, [r7, #12] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 80012b2: 463b mov r3, r7 + 80012b4: 4619 mov r1, r3 + 80012b6: 481e ldr r0, [pc, #120] ; (8001330 ) + 80012b8: f001 fb5a bl 8002970 + + GPIO_InitStruct.Pin = LL_GPIO_PIN_11; + 80012bc: 4b1d ldr r3, [pc, #116] ; (8001334 ) + 80012be: 603b str r3, [r7, #0] + GPIO_InitStruct.Mode = LL_GPIO_MODE_FLOATING; + 80012c0: 2304 movs r3, #4 + 80012c2: 607b str r3, [r7, #4] + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + 80012c4: 463b mov r3, r7 + 80012c6: 4619 mov r1, r3 + 80012c8: 4819 ldr r0, [pc, #100] ; (8001330 ) + 80012ca: f001 fb51 bl 8002970 + + /* USART3 interrupt Init */ + NVIC_SetPriority(USART3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); + 80012ce: f7ff fe15 bl 8000efc <__NVIC_GetPriorityGrouping> + 80012d2: 4603 mov r3, r0 + 80012d4: 2200 movs r2, #0 + 80012d6: 2100 movs r1, #0 + 80012d8: 4618 mov r0, r3 + 80012da: f7ff fe63 bl 8000fa4 + 80012de: 4603 mov r3, r0 + 80012e0: 4619 mov r1, r3 + 80012e2: 2027 movs r0, #39 ; 0x27 + 80012e4: f7ff fe34 bl 8000f50 <__NVIC_SetPriority> + NVIC_EnableIRQ(USART3_IRQn); + 80012e8: 2027 movs r0, #39 ; 0x27 + 80012ea: f7ff fe15 bl 8000f18 <__NVIC_EnableIRQ> + + USART_InitStruct.BaudRate = 115200; + 80012ee: f44f 33e1 mov.w r3, #115200 ; 0x1c200 + 80012f2: 617b str r3, [r7, #20] + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + 80012f4: 2300 movs r3, #0 + 80012f6: 61bb str r3, [r7, #24] + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + 80012f8: 2300 movs r3, #0 + 80012fa: 61fb str r3, [r7, #28] + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + 80012fc: 2300 movs r3, #0 + 80012fe: 623b str r3, [r7, #32] + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; + 8001300: 230c movs r3, #12 + 8001302: 627b str r3, [r7, #36] ; 0x24 + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + 8001304: 2300 movs r3, #0 + 8001306: 62bb str r3, [r7, #40] ; 0x28 + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + 8001308: 2300 movs r3, #0 + 800130a: 62fb str r3, [r7, #44] ; 0x2c + LL_USART_Init(USART3, &USART_InitStruct); + 800130c: f107 0314 add.w r3, r7, #20 + 8001310: 4619 mov r1, r3 + 8001312: 4809 ldr r0, [pc, #36] ; (8001338 ) + 8001314: f001 fde0 bl 8002ed8 + LL_USART_ConfigAsyncMode(USART3); + 8001318: 4807 ldr r0, [pc, #28] ; (8001338 ) + 800131a: f7ff feb4 bl 8001086 + LL_USART_Enable(USART3); + 800131e: 4806 ldr r0, [pc, #24] ; (8001338 ) + 8001320: f7ff fea2 bl 8001068 + +} + 8001324: bf00 nop + 8001326: 3730 adds r7, #48 ; 0x30 + 8001328: 46bd mov sp, r7 + 800132a: bd80 pop {r7, pc} + 800132c: 04040004 .word 0x04040004 + 8001330: 40010c00 .word 0x40010c00 + 8001334: 04080008 .word 0x04080008 + 8001338: 40004800 .word 0x40004800 + +0800133c : + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + +/* Copy the data segment initializers from flash to SRAM */ + ldr r0, =_sdata + 800133c: 480c ldr r0, [pc, #48] ; (8001370 ) + ldr r1, =_edata + 800133e: 490d ldr r1, [pc, #52] ; (8001374 ) + ldr r2, =_sidata + 8001340: 4a0d ldr r2, [pc, #52] ; (8001378 ) + movs r3, #0 + 8001342: 2300 movs r3, #0 + b LoopCopyDataInit + 8001344: e002 b.n 800134c + +08001346 : + +CopyDataInit: + ldr r4, [r2, r3] + 8001346: 58d4 ldr r4, [r2, r3] + str r4, [r0, r3] + 8001348: 50c4 str r4, [r0, r3] + adds r3, r3, #4 + 800134a: 3304 adds r3, #4 + +0800134c : + +LoopCopyDataInit: + adds r4, r0, r3 + 800134c: 18c4 adds r4, r0, r3 + cmp r4, r1 + 800134e: 428c cmp r4, r1 + bcc CopyDataInit + 8001350: d3f9 bcc.n 8001346 + +/* Zero fill the bss segment. */ + ldr r2, =_sbss + 8001352: 4a0a ldr r2, [pc, #40] ; (800137c ) + ldr r4, =_ebss + 8001354: 4c0a ldr r4, [pc, #40] ; (8001380 ) + movs r3, #0 + 8001356: 2300 movs r3, #0 + b LoopFillZerobss + 8001358: e001 b.n 800135e + +0800135a : + +FillZerobss: + str r3, [r2] + 800135a: 6013 str r3, [r2, #0] + adds r2, r2, #4 + 800135c: 3204 adds r2, #4 + +0800135e : + +LoopFillZerobss: + cmp r2, r4 + 800135e: 42a2 cmp r2, r4 + bcc FillZerobss + 8001360: d3fb bcc.n 800135a + +/* Call the clock system intitialization function.*/ + bl SystemInit + 8001362: f7ff fca1 bl 8000ca8 +/* Call static constructors */ + bl __libc_init_array + 8001366: f008 fa99 bl 800989c <__libc_init_array> +/* Call the application's entry point.*/ + bl main + 800136a: f7ff fafd bl 8000968
+ bx lr + 800136e: 4770 bx lr + ldr r0, =_sdata + 8001370: 20000000 .word 0x20000000 + ldr r1, =_edata + 8001374: 2000053c .word 0x2000053c + ldr r2, =_sidata + 8001378: 0800b094 .word 0x0800b094 + ldr r2, =_sbss + 800137c: 2000053c .word 0x2000053c + ldr r4, =_ebss + 8001380: 20003d30 .word 0x20003d30 + +08001384 : + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + 8001384: e7fe b.n 8001384 + ... + +08001388 : + * need to ensure that the SysTick time base is always set to 1 millisecond + * to have correct HAL operation. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_Init(void) +{ + 8001388: b580 push {r7, lr} + 800138a: af00 add r7, sp, #0 + defined(STM32F102x6) || defined(STM32F102xB) || \ + defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || \ + defined(STM32F105xC) || defined(STM32F107xC) + + /* Prefetch buffer is not available on value line devices */ + __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); + 800138c: 4b08 ldr r3, [pc, #32] ; (80013b0 ) + 800138e: 681b ldr r3, [r3, #0] + 8001390: 4a07 ldr r2, [pc, #28] ; (80013b0 ) + 8001392: f043 0310 orr.w r3, r3, #16 + 8001396: 6013 str r3, [r2, #0] +#endif +#endif /* PREFETCH_ENABLE */ + + /* Set Interrupt Group Priority */ + HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); + 8001398: 2003 movs r0, #3 + 800139a: f000 ff79 bl 8002290 + + /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */ + HAL_InitTick(TICK_INT_PRIORITY); + 800139e: 2000 movs r0, #0 + 80013a0: f000 f808 bl 80013b4 + + /* Init the low level hardware */ + HAL_MspInit(); + 80013a4: f7ff fb3e bl 8000a24 + + /* Return function status */ + return HAL_OK; + 80013a8: 2300 movs r3, #0 +} + 80013aa: 4618 mov r0, r3 + 80013ac: bd80 pop {r7, pc} + 80013ae: bf00 nop + 80013b0: 40022000 .word 0x40022000 + +080013b4 : + * implementation in user file. + * @param TickPriority Tick interrupt priority. + * @retval HAL status + */ +__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) +{ + 80013b4: b580 push {r7, lr} + 80013b6: b082 sub sp, #8 + 80013b8: af00 add r7, sp, #0 + 80013ba: 6078 str r0, [r7, #4] + /* Configure the SysTick to have interrupt in 1ms time basis*/ + if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U) + 80013bc: 4b12 ldr r3, [pc, #72] ; (8001408 ) + 80013be: 681a ldr r2, [r3, #0] + 80013c0: 4b12 ldr r3, [pc, #72] ; (800140c ) + 80013c2: 781b ldrb r3, [r3, #0] + 80013c4: 4619 mov r1, r3 + 80013c6: f44f 737a mov.w r3, #1000 ; 0x3e8 + 80013ca: fbb3 f3f1 udiv r3, r3, r1 + 80013ce: fbb2 f3f3 udiv r3, r2, r3 + 80013d2: 4618 mov r0, r3 + 80013d4: f000 ff91 bl 80022fa + 80013d8: 4603 mov r3, r0 + 80013da: 2b00 cmp r3, #0 + 80013dc: d001 beq.n 80013e2 + { + return HAL_ERROR; + 80013de: 2301 movs r3, #1 + 80013e0: e00e b.n 8001400 + } + + /* Configure the SysTick IRQ priority */ + if (TickPriority < (1UL << __NVIC_PRIO_BITS)) + 80013e2: 687b ldr r3, [r7, #4] + 80013e4: 2b0f cmp r3, #15 + 80013e6: d80a bhi.n 80013fe + { + HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U); + 80013e8: 2200 movs r2, #0 + 80013ea: 6879 ldr r1, [r7, #4] + 80013ec: f04f 30ff mov.w r0, #4294967295 + 80013f0: f000 ff59 bl 80022a6 + uwTickPrio = TickPriority; + 80013f4: 4a06 ldr r2, [pc, #24] ; (8001410 ) + 80013f6: 687b ldr r3, [r7, #4] + 80013f8: 6013 str r3, [r2, #0] + { + return HAL_ERROR; + } + + /* Return function status */ + return HAL_OK; + 80013fa: 2300 movs r3, #0 + 80013fc: e000 b.n 8001400 + return HAL_ERROR; + 80013fe: 2301 movs r3, #1 +} + 8001400: 4618 mov r0, r3 + 8001402: 3708 adds r7, #8 + 8001404: 46bd mov sp, r7 + 8001406: bd80 pop {r7, pc} + 8001408: 20000000 .word 0x20000000 + 800140c: 20000008 .word 0x20000008 + 8001410: 20000004 .word 0x20000004 + +08001414 : + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_IncTick(void) +{ + 8001414: b480 push {r7} + 8001416: af00 add r7, sp, #0 + uwTick += uwTickFreq; + 8001418: 4b05 ldr r3, [pc, #20] ; (8001430 ) + 800141a: 781b ldrb r3, [r3, #0] + 800141c: 461a mov r2, r3 + 800141e: 4b05 ldr r3, [pc, #20] ; (8001434 ) + 8001420: 681b ldr r3, [r3, #0] + 8001422: 4413 add r3, r2 + 8001424: 4a03 ldr r2, [pc, #12] ; (8001434 ) + 8001426: 6013 str r3, [r2, #0] +} + 8001428: bf00 nop + 800142a: 46bd mov sp, r7 + 800142c: bc80 pop {r7} + 800142e: 4770 bx lr + 8001430: 20000008 .word 0x20000008 + 8001434: 200005b4 .word 0x200005b4 + +08001438 : + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval tick value + */ +__weak uint32_t HAL_GetTick(void) +{ + 8001438: b480 push {r7} + 800143a: af00 add r7, sp, #0 + return uwTick; + 800143c: 4b02 ldr r3, [pc, #8] ; (8001448 ) + 800143e: 681b ldr r3, [r3, #0] +} + 8001440: 4618 mov r0, r3 + 8001442: 46bd mov sp, r7 + 8001444: bc80 pop {r7} + 8001446: 4770 bx lr + 8001448: 200005b4 .word 0x200005b4 + +0800144c : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan) +{ + 800144c: b580 push {r7, lr} + 800144e: b084 sub sp, #16 + 8001450: af00 add r7, sp, #0 + 8001452: 6078 str r0, [r7, #4] + uint32_t tickstart; + + /* Check CAN handle */ + if (hcan == NULL) + 8001454: 687b ldr r3, [r7, #4] + 8001456: 2b00 cmp r3, #0 + 8001458: d101 bne.n 800145e + { + return HAL_ERROR; + 800145a: 2301 movs r3, #1 + 800145c: e0ed b.n 800163a + /* Init the low level hardware: CLOCK, NVIC */ + hcan->MspInitCallback(hcan); + } + +#else + if (hcan->State == HAL_CAN_STATE_RESET) + 800145e: 687b ldr r3, [r7, #4] + 8001460: f893 3020 ldrb.w r3, [r3, #32] + 8001464: b2db uxtb r3, r3 + 8001466: 2b00 cmp r3, #0 + 8001468: d102 bne.n 8001470 + { + /* Init the low level hardware: CLOCK, NVIC */ + HAL_CAN_MspInit(hcan); + 800146a: 6878 ldr r0, [r7, #4] + 800146c: f7fe ff1a bl 80002a4 + } +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ + + /* Request initialisation */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + 8001470: 687b ldr r3, [r7, #4] + 8001472: 681b ldr r3, [r3, #0] + 8001474: 681a ldr r2, [r3, #0] + 8001476: 687b ldr r3, [r7, #4] + 8001478: 681b ldr r3, [r3, #0] + 800147a: f042 0201 orr.w r2, r2, #1 + 800147e: 601a str r2, [r3, #0] + + /* Get tick */ + tickstart = HAL_GetTick(); + 8001480: f7ff ffda bl 8001438 + 8001484: 60f8 str r0, [r7, #12] + + /* Wait initialisation acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + 8001486: e012 b.n 80014ae + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + 8001488: f7ff ffd6 bl 8001438 + 800148c: 4602 mov r2, r0 + 800148e: 68fb ldr r3, [r7, #12] + 8001490: 1ad3 subs r3, r2, r3 + 8001492: 2b0a cmp r3, #10 + 8001494: d90b bls.n 80014ae + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + 8001496: 687b ldr r3, [r7, #4] + 8001498: 6a5b ldr r3, [r3, #36] ; 0x24 + 800149a: f443 3200 orr.w r2, r3, #131072 ; 0x20000 + 800149e: 687b ldr r3, [r7, #4] + 80014a0: 625a str r2, [r3, #36] ; 0x24 + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + 80014a2: 687b ldr r3, [r7, #4] + 80014a4: 2205 movs r2, #5 + 80014a6: f883 2020 strb.w r2, [r3, #32] + + return HAL_ERROR; + 80014aa: 2301 movs r3, #1 + 80014ac: e0c5 b.n 800163a + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + 80014ae: 687b ldr r3, [r7, #4] + 80014b0: 681b ldr r3, [r3, #0] + 80014b2: 685b ldr r3, [r3, #4] + 80014b4: f003 0301 and.w r3, r3, #1 + 80014b8: 2b00 cmp r3, #0 + 80014ba: d0e5 beq.n 8001488 + } + } + + /* Exit from sleep mode */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + 80014bc: 687b ldr r3, [r7, #4] + 80014be: 681b ldr r3, [r3, #0] + 80014c0: 681a ldr r2, [r3, #0] + 80014c2: 687b ldr r3, [r7, #4] + 80014c4: 681b ldr r3, [r3, #0] + 80014c6: f022 0202 bic.w r2, r2, #2 + 80014ca: 601a str r2, [r3, #0] + + /* Get tick */ + tickstart = HAL_GetTick(); + 80014cc: f7ff ffb4 bl 8001438 + 80014d0: 60f8 str r0, [r7, #12] + + /* Check Sleep mode leave acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + 80014d2: e012 b.n 80014fa + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + 80014d4: f7ff ffb0 bl 8001438 + 80014d8: 4602 mov r2, r0 + 80014da: 68fb ldr r3, [r7, #12] + 80014dc: 1ad3 subs r3, r2, r3 + 80014de: 2b0a cmp r3, #10 + 80014e0: d90b bls.n 80014fa + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + 80014e2: 687b ldr r3, [r7, #4] + 80014e4: 6a5b ldr r3, [r3, #36] ; 0x24 + 80014e6: f443 3200 orr.w r2, r3, #131072 ; 0x20000 + 80014ea: 687b ldr r3, [r7, #4] + 80014ec: 625a str r2, [r3, #36] ; 0x24 + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + 80014ee: 687b ldr r3, [r7, #4] + 80014f0: 2205 movs r2, #5 + 80014f2: f883 2020 strb.w r2, [r3, #32] + + return HAL_ERROR; + 80014f6: 2301 movs r3, #1 + 80014f8: e09f b.n 800163a + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + 80014fa: 687b ldr r3, [r7, #4] + 80014fc: 681b ldr r3, [r3, #0] + 80014fe: 685b ldr r3, [r3, #4] + 8001500: f003 0302 and.w r3, r3, #2 + 8001504: 2b00 cmp r3, #0 + 8001506: d1e5 bne.n 80014d4 + } + } + + /* Set the time triggered communication mode */ + if (hcan->Init.TimeTriggeredMode == ENABLE) + 8001508: 687b ldr r3, [r7, #4] + 800150a: 7e1b ldrb r3, [r3, #24] + 800150c: 2b01 cmp r3, #1 + 800150e: d108 bne.n 8001522 + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + 8001510: 687b ldr r3, [r7, #4] + 8001512: 681b ldr r3, [r3, #0] + 8001514: 681a ldr r2, [r3, #0] + 8001516: 687b ldr r3, [r7, #4] + 8001518: 681b ldr r3, [r3, #0] + 800151a: f042 0280 orr.w r2, r2, #128 ; 0x80 + 800151e: 601a str r2, [r3, #0] + 8001520: e007 b.n 8001532 + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + 8001522: 687b ldr r3, [r7, #4] + 8001524: 681b ldr r3, [r3, #0] + 8001526: 681a ldr r2, [r3, #0] + 8001528: 687b ldr r3, [r7, #4] + 800152a: 681b ldr r3, [r3, #0] + 800152c: f022 0280 bic.w r2, r2, #128 ; 0x80 + 8001530: 601a str r2, [r3, #0] + } + + /* Set the automatic bus-off management */ + if (hcan->Init.AutoBusOff == ENABLE) + 8001532: 687b ldr r3, [r7, #4] + 8001534: 7e5b ldrb r3, [r3, #25] + 8001536: 2b01 cmp r3, #1 + 8001538: d108 bne.n 800154c + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + 800153a: 687b ldr r3, [r7, #4] + 800153c: 681b ldr r3, [r3, #0] + 800153e: 681a ldr r2, [r3, #0] + 8001540: 687b ldr r3, [r7, #4] + 8001542: 681b ldr r3, [r3, #0] + 8001544: f042 0240 orr.w r2, r2, #64 ; 0x40 + 8001548: 601a str r2, [r3, #0] + 800154a: e007 b.n 800155c + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + 800154c: 687b ldr r3, [r7, #4] + 800154e: 681b ldr r3, [r3, #0] + 8001550: 681a ldr r2, [r3, #0] + 8001552: 687b ldr r3, [r7, #4] + 8001554: 681b ldr r3, [r3, #0] + 8001556: f022 0240 bic.w r2, r2, #64 ; 0x40 + 800155a: 601a str r2, [r3, #0] + } + + /* Set the automatic wake-up mode */ + if (hcan->Init.AutoWakeUp == ENABLE) + 800155c: 687b ldr r3, [r7, #4] + 800155e: 7e9b ldrb r3, [r3, #26] + 8001560: 2b01 cmp r3, #1 + 8001562: d108 bne.n 8001576 + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + 8001564: 687b ldr r3, [r7, #4] + 8001566: 681b ldr r3, [r3, #0] + 8001568: 681a ldr r2, [r3, #0] + 800156a: 687b ldr r3, [r7, #4] + 800156c: 681b ldr r3, [r3, #0] + 800156e: f042 0220 orr.w r2, r2, #32 + 8001572: 601a str r2, [r3, #0] + 8001574: e007 b.n 8001586 + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + 8001576: 687b ldr r3, [r7, #4] + 8001578: 681b ldr r3, [r3, #0] + 800157a: 681a ldr r2, [r3, #0] + 800157c: 687b ldr r3, [r7, #4] + 800157e: 681b ldr r3, [r3, #0] + 8001580: f022 0220 bic.w r2, r2, #32 + 8001584: 601a str r2, [r3, #0] + } + + /* Set the automatic retransmission */ + if (hcan->Init.AutoRetransmission == ENABLE) + 8001586: 687b ldr r3, [r7, #4] + 8001588: 7edb ldrb r3, [r3, #27] + 800158a: 2b01 cmp r3, #1 + 800158c: d108 bne.n 80015a0 + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_NART); + 800158e: 687b ldr r3, [r7, #4] + 8001590: 681b ldr r3, [r3, #0] + 8001592: 681a ldr r2, [r3, #0] + 8001594: 687b ldr r3, [r7, #4] + 8001596: 681b ldr r3, [r3, #0] + 8001598: f022 0210 bic.w r2, r2, #16 + 800159c: 601a str r2, [r3, #0] + 800159e: e007 b.n 80015b0 + } + else + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_NART); + 80015a0: 687b ldr r3, [r7, #4] + 80015a2: 681b ldr r3, [r3, #0] + 80015a4: 681a ldr r2, [r3, #0] + 80015a6: 687b ldr r3, [r7, #4] + 80015a8: 681b ldr r3, [r3, #0] + 80015aa: f042 0210 orr.w r2, r2, #16 + 80015ae: 601a str r2, [r3, #0] + } + + /* Set the receive FIFO locked mode */ + if (hcan->Init.ReceiveFifoLocked == ENABLE) + 80015b0: 687b ldr r3, [r7, #4] + 80015b2: 7f1b ldrb r3, [r3, #28] + 80015b4: 2b01 cmp r3, #1 + 80015b6: d108 bne.n 80015ca + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + 80015b8: 687b ldr r3, [r7, #4] + 80015ba: 681b ldr r3, [r3, #0] + 80015bc: 681a ldr r2, [r3, #0] + 80015be: 687b ldr r3, [r7, #4] + 80015c0: 681b ldr r3, [r3, #0] + 80015c2: f042 0208 orr.w r2, r2, #8 + 80015c6: 601a str r2, [r3, #0] + 80015c8: e007 b.n 80015da + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + 80015ca: 687b ldr r3, [r7, #4] + 80015cc: 681b ldr r3, [r3, #0] + 80015ce: 681a ldr r2, [r3, #0] + 80015d0: 687b ldr r3, [r7, #4] + 80015d2: 681b ldr r3, [r3, #0] + 80015d4: f022 0208 bic.w r2, r2, #8 + 80015d8: 601a str r2, [r3, #0] + } + + /* Set the transmit FIFO priority */ + if (hcan->Init.TransmitFifoPriority == ENABLE) + 80015da: 687b ldr r3, [r7, #4] + 80015dc: 7f5b ldrb r3, [r3, #29] + 80015de: 2b01 cmp r3, #1 + 80015e0: d108 bne.n 80015f4 + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + 80015e2: 687b ldr r3, [r7, #4] + 80015e4: 681b ldr r3, [r3, #0] + 80015e6: 681a ldr r2, [r3, #0] + 80015e8: 687b ldr r3, [r7, #4] + 80015ea: 681b ldr r3, [r3, #0] + 80015ec: f042 0204 orr.w r2, r2, #4 + 80015f0: 601a str r2, [r3, #0] + 80015f2: e007 b.n 8001604 + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + 80015f4: 687b ldr r3, [r7, #4] + 80015f6: 681b ldr r3, [r3, #0] + 80015f8: 681a ldr r2, [r3, #0] + 80015fa: 687b ldr r3, [r7, #4] + 80015fc: 681b ldr r3, [r3, #0] + 80015fe: f022 0204 bic.w r2, r2, #4 + 8001602: 601a str r2, [r3, #0] + } + + /* Set the bit timing register */ + WRITE_REG(hcan->Instance->BTR, (uint32_t)(hcan->Init.Mode | + 8001604: 687b ldr r3, [r7, #4] + 8001606: 689a ldr r2, [r3, #8] + 8001608: 687b ldr r3, [r7, #4] + 800160a: 68db ldr r3, [r3, #12] + 800160c: 431a orrs r2, r3 + 800160e: 687b ldr r3, [r7, #4] + 8001610: 691b ldr r3, [r3, #16] + 8001612: 431a orrs r2, r3 + 8001614: 687b ldr r3, [r7, #4] + 8001616: 695b ldr r3, [r3, #20] + 8001618: ea42 0103 orr.w r1, r2, r3 + 800161c: 687b ldr r3, [r7, #4] + 800161e: 685b ldr r3, [r3, #4] + 8001620: 1e5a subs r2, r3, #1 + 8001622: 687b ldr r3, [r7, #4] + 8001624: 681b ldr r3, [r3, #0] + 8001626: 430a orrs r2, r1 + 8001628: 61da str r2, [r3, #28] + hcan->Init.TimeSeg1 | + hcan->Init.TimeSeg2 | + (hcan->Init.Prescaler - 1U))); + + /* Initialize the error code */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + 800162a: 687b ldr r3, [r7, #4] + 800162c: 2200 movs r2, #0 + 800162e: 625a str r2, [r3, #36] ; 0x24 + + /* Initialize the CAN state */ + hcan->State = HAL_CAN_STATE_READY; + 8001630: 687b ldr r3, [r7, #4] + 8001632: 2201 movs r2, #1 + 8001634: f883 2020 strb.w r2, [r3, #32] + + /* Return function status */ + return HAL_OK; + 8001638: 2300 movs r3, #0 +} + 800163a: 4618 mov r0, r3 + 800163c: 3710 adds r7, #16 + 800163e: 46bd mov sp, r7 + 8001640: bd80 pop {r7, pc} + +08001642 : + * @param sFilterConfig pointer to a CAN_FilterTypeDef structure that + * contains the filter configuration information. + * @retval None + */ +HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig) +{ + 8001642: b480 push {r7} + 8001644: b087 sub sp, #28 + 8001646: af00 add r7, sp, #0 + 8001648: 6078 str r0, [r7, #4] + 800164a: 6039 str r1, [r7, #0] + uint32_t filternbrbitpos; + CAN_TypeDef *can_ip = hcan->Instance; + 800164c: 687b ldr r3, [r7, #4] + 800164e: 681b ldr r3, [r3, #0] + 8001650: 617b str r3, [r7, #20] + HAL_CAN_StateTypeDef state = hcan->State; + 8001652: 687b ldr r3, [r7, #4] + 8001654: f893 3020 ldrb.w r3, [r3, #32] + 8001658: 74fb strb r3, [r7, #19] + + if ((state == HAL_CAN_STATE_READY) || + 800165a: 7cfb ldrb r3, [r7, #19] + 800165c: 2b01 cmp r3, #1 + 800165e: d003 beq.n 8001668 + 8001660: 7cfb ldrb r3, [r7, #19] + 8001662: 2b02 cmp r3, #2 + 8001664: f040 80aa bne.w 80017bc + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_SINGLE(sFilterConfig->FilterBank)); +#endif + + /* Initialisation mode for the filter */ + SET_BIT(can_ip->FMR, CAN_FMR_FINIT); + 8001668: 697b ldr r3, [r7, #20] + 800166a: f8d3 3200 ldr.w r3, [r3, #512] ; 0x200 + 800166e: f043 0201 orr.w r2, r3, #1 + 8001672: 697b ldr r3, [r7, #20] + 8001674: f8c3 2200 str.w r2, [r3, #512] ; 0x200 + CLEAR_BIT(can_ip->FMR, CAN_FMR_CAN2SB); + SET_BIT(can_ip->FMR, sFilterConfig->SlaveStartFilterBank << CAN_FMR_CAN2SB_Pos); + +#endif + /* Convert filter number into bit position */ + filternbrbitpos = (uint32_t)1 << (sFilterConfig->FilterBank & 0x1FU); + 8001678: 683b ldr r3, [r7, #0] + 800167a: 695b ldr r3, [r3, #20] + 800167c: f003 031f and.w r3, r3, #31 + 8001680: 2201 movs r2, #1 + 8001682: fa02 f303 lsl.w r3, r2, r3 + 8001686: 60fb str r3, [r7, #12] + + /* Filter Deactivation */ + CLEAR_BIT(can_ip->FA1R, filternbrbitpos); + 8001688: 697b ldr r3, [r7, #20] + 800168a: f8d3 221c ldr.w r2, [r3, #540] ; 0x21c + 800168e: 68fb ldr r3, [r7, #12] + 8001690: 43db mvns r3, r3 + 8001692: 401a ands r2, r3 + 8001694: 697b ldr r3, [r7, #20] + 8001696: f8c3 221c str.w r2, [r3, #540] ; 0x21c + + /* Filter Scale */ + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_16BIT) + 800169a: 683b ldr r3, [r7, #0] + 800169c: 69db ldr r3, [r3, #28] + 800169e: 2b00 cmp r3, #0 + 80016a0: d123 bne.n 80016ea + { + /* 16-bit scale for the filter */ + CLEAR_BIT(can_ip->FS1R, filternbrbitpos); + 80016a2: 697b ldr r3, [r7, #20] + 80016a4: f8d3 220c ldr.w r2, [r3, #524] ; 0x20c + 80016a8: 68fb ldr r3, [r7, #12] + 80016aa: 43db mvns r3, r3 + 80016ac: 401a ands r2, r3 + 80016ae: 697b ldr r3, [r7, #20] + 80016b0: f8c3 220c str.w r2, [r3, #524] ; 0x20c + + /* First 16-bit identifier and First 16-bit mask */ + /* Or First 16-bit identifier and Second 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow) << 16U) | + 80016b4: 683b ldr r3, [r7, #0] + 80016b6: 68db ldr r3, [r3, #12] + 80016b8: 0419 lsls r1, r3, #16 + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + 80016ba: 683b ldr r3, [r7, #0] + 80016bc: 685b ldr r3, [r3, #4] + 80016be: b29b uxth r3, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + 80016c0: 683a ldr r2, [r7, #0] + 80016c2: 6952 ldr r2, [r2, #20] + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow) << 16U) | + 80016c4: 4319 orrs r1, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + 80016c6: 697b ldr r3, [r7, #20] + 80016c8: 3248 adds r2, #72 ; 0x48 + 80016ca: f843 1032 str.w r1, [r3, r2, lsl #3] + + /* Second 16-bit identifier and Second 16-bit mask */ + /* Or Third 16-bit identifier and Fourth 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + 80016ce: 683b ldr r3, [r7, #0] + 80016d0: 689b ldr r3, [r3, #8] + 80016d2: 0419 lsls r1, r3, #16 + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh); + 80016d4: 683b ldr r3, [r7, #0] + 80016d6: 681b ldr r3, [r3, #0] + 80016d8: b29a uxth r2, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + 80016da: 683b ldr r3, [r7, #0] + 80016dc: 695b ldr r3, [r3, #20] + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + 80016de: 430a orrs r2, r1 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + 80016e0: 6979 ldr r1, [r7, #20] + 80016e2: 3348 adds r3, #72 ; 0x48 + 80016e4: 00db lsls r3, r3, #3 + 80016e6: 440b add r3, r1 + 80016e8: 605a str r2, [r3, #4] + } + + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_32BIT) + 80016ea: 683b ldr r3, [r7, #0] + 80016ec: 69db ldr r3, [r3, #28] + 80016ee: 2b01 cmp r3, #1 + 80016f0: d122 bne.n 8001738 + { + /* 32-bit scale for the filter */ + SET_BIT(can_ip->FS1R, filternbrbitpos); + 80016f2: 697b ldr r3, [r7, #20] + 80016f4: f8d3 220c ldr.w r2, [r3, #524] ; 0x20c + 80016f8: 68fb ldr r3, [r7, #12] + 80016fa: 431a orrs r2, r3 + 80016fc: 697b ldr r3, [r7, #20] + 80016fe: f8c3 220c str.w r2, [r3, #524] ; 0x20c + + /* 32-bit identifier or First 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh) << 16U) | + 8001702: 683b ldr r3, [r7, #0] + 8001704: 681b ldr r3, [r3, #0] + 8001706: 0419 lsls r1, r3, #16 + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + 8001708: 683b ldr r3, [r7, #0] + 800170a: 685b ldr r3, [r3, #4] + 800170c: b29b uxth r3, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + 800170e: 683a ldr r2, [r7, #0] + 8001710: 6952 ldr r2, [r2, #20] + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh) << 16U) | + 8001712: 4319 orrs r1, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + 8001714: 697b ldr r3, [r7, #20] + 8001716: 3248 adds r2, #72 ; 0x48 + 8001718: f843 1032 str.w r1, [r3, r2, lsl #3] + + /* 32-bit mask or Second 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + 800171c: 683b ldr r3, [r7, #0] + 800171e: 689b ldr r3, [r3, #8] + 8001720: 0419 lsls r1, r3, #16 + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow); + 8001722: 683b ldr r3, [r7, #0] + 8001724: 68db ldr r3, [r3, #12] + 8001726: b29a uxth r2, r3 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + 8001728: 683b ldr r3, [r7, #0] + 800172a: 695b ldr r3, [r3, #20] + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + 800172c: 430a orrs r2, r1 + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + 800172e: 6979 ldr r1, [r7, #20] + 8001730: 3348 adds r3, #72 ; 0x48 + 8001732: 00db lsls r3, r3, #3 + 8001734: 440b add r3, r1 + 8001736: 605a str r2, [r3, #4] + } + + /* Filter Mode */ + if (sFilterConfig->FilterMode == CAN_FILTERMODE_IDMASK) + 8001738: 683b ldr r3, [r7, #0] + 800173a: 699b ldr r3, [r3, #24] + 800173c: 2b00 cmp r3, #0 + 800173e: d109 bne.n 8001754 + { + /* Id/Mask mode for the filter*/ + CLEAR_BIT(can_ip->FM1R, filternbrbitpos); + 8001740: 697b ldr r3, [r7, #20] + 8001742: f8d3 2204 ldr.w r2, [r3, #516] ; 0x204 + 8001746: 68fb ldr r3, [r7, #12] + 8001748: 43db mvns r3, r3 + 800174a: 401a ands r2, r3 + 800174c: 697b ldr r3, [r7, #20] + 800174e: f8c3 2204 str.w r2, [r3, #516] ; 0x204 + 8001752: e007 b.n 8001764 + } + else /* CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdList */ + { + /* Identifier list mode for the filter*/ + SET_BIT(can_ip->FM1R, filternbrbitpos); + 8001754: 697b ldr r3, [r7, #20] + 8001756: f8d3 2204 ldr.w r2, [r3, #516] ; 0x204 + 800175a: 68fb ldr r3, [r7, #12] + 800175c: 431a orrs r2, r3 + 800175e: 697b ldr r3, [r7, #20] + 8001760: f8c3 2204 str.w r2, [r3, #516] ; 0x204 + } + + /* Filter FIFO assignment */ + if (sFilterConfig->FilterFIFOAssignment == CAN_FILTER_FIFO0) + 8001764: 683b ldr r3, [r7, #0] + 8001766: 691b ldr r3, [r3, #16] + 8001768: 2b00 cmp r3, #0 + 800176a: d109 bne.n 8001780 + { + /* FIFO 0 assignation for the filter */ + CLEAR_BIT(can_ip->FFA1R, filternbrbitpos); + 800176c: 697b ldr r3, [r7, #20] + 800176e: f8d3 2214 ldr.w r2, [r3, #532] ; 0x214 + 8001772: 68fb ldr r3, [r7, #12] + 8001774: 43db mvns r3, r3 + 8001776: 401a ands r2, r3 + 8001778: 697b ldr r3, [r7, #20] + 800177a: f8c3 2214 str.w r2, [r3, #532] ; 0x214 + 800177e: e007 b.n 8001790 + } + else + { + /* FIFO 1 assignation for the filter */ + SET_BIT(can_ip->FFA1R, filternbrbitpos); + 8001780: 697b ldr r3, [r7, #20] + 8001782: f8d3 2214 ldr.w r2, [r3, #532] ; 0x214 + 8001786: 68fb ldr r3, [r7, #12] + 8001788: 431a orrs r2, r3 + 800178a: 697b ldr r3, [r7, #20] + 800178c: f8c3 2214 str.w r2, [r3, #532] ; 0x214 + } + + /* Filter activation */ + if (sFilterConfig->FilterActivation == CAN_FILTER_ENABLE) + 8001790: 683b ldr r3, [r7, #0] + 8001792: 6a1b ldr r3, [r3, #32] + 8001794: 2b01 cmp r3, #1 + 8001796: d107 bne.n 80017a8 + { + SET_BIT(can_ip->FA1R, filternbrbitpos); + 8001798: 697b ldr r3, [r7, #20] + 800179a: f8d3 221c ldr.w r2, [r3, #540] ; 0x21c + 800179e: 68fb ldr r3, [r7, #12] + 80017a0: 431a orrs r2, r3 + 80017a2: 697b ldr r3, [r7, #20] + 80017a4: f8c3 221c str.w r2, [r3, #540] ; 0x21c + } + + /* Leave the initialisation mode for the filter */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_FINIT); + 80017a8: 697b ldr r3, [r7, #20] + 80017aa: f8d3 3200 ldr.w r3, [r3, #512] ; 0x200 + 80017ae: f023 0201 bic.w r2, r3, #1 + 80017b2: 697b ldr r3, [r7, #20] + 80017b4: f8c3 2200 str.w r2, [r3, #512] ; 0x200 + + /* Return function status */ + return HAL_OK; + 80017b8: 2300 movs r3, #0 + 80017ba: e006 b.n 80017ca + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + 80017bc: 687b ldr r3, [r7, #4] + 80017be: 6a5b ldr r3, [r3, #36] ; 0x24 + 80017c0: f443 2280 orr.w r2, r3, #262144 ; 0x40000 + 80017c4: 687b ldr r3, [r7, #4] + 80017c6: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 80017c8: 2301 movs r3, #1 + } +} + 80017ca: 4618 mov r0, r3 + 80017cc: 371c adds r7, #28 + 80017ce: 46bd mov sp, r7 + 80017d0: bc80 pop {r7} + 80017d2: 4770 bx lr + +080017d4 : + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan) +{ + 80017d4: b580 push {r7, lr} + 80017d6: b084 sub sp, #16 + 80017d8: af00 add r7, sp, #0 + 80017da: 6078 str r0, [r7, #4] + uint32_t tickstart; + + if (hcan->State == HAL_CAN_STATE_READY) + 80017dc: 687b ldr r3, [r7, #4] + 80017de: f893 3020 ldrb.w r3, [r3, #32] + 80017e2: b2db uxtb r3, r3 + 80017e4: 2b01 cmp r3, #1 + 80017e6: d12e bne.n 8001846 + { + /* Change CAN peripheral state */ + hcan->State = HAL_CAN_STATE_LISTENING; + 80017e8: 687b ldr r3, [r7, #4] + 80017ea: 2202 movs r2, #2 + 80017ec: f883 2020 strb.w r2, [r3, #32] + + /* Request leave initialisation */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + 80017f0: 687b ldr r3, [r7, #4] + 80017f2: 681b ldr r3, [r3, #0] + 80017f4: 681a ldr r2, [r3, #0] + 80017f6: 687b ldr r3, [r7, #4] + 80017f8: 681b ldr r3, [r3, #0] + 80017fa: f022 0201 bic.w r2, r2, #1 + 80017fe: 601a str r2, [r3, #0] + + /* Get tick */ + tickstart = HAL_GetTick(); + 8001800: f7ff fe1a bl 8001438 + 8001804: 60f8 str r0, [r7, #12] + + /* Wait the acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) != 0U) + 8001806: e012 b.n 800182e + { + /* Check for the Timeout */ + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + 8001808: f7ff fe16 bl 8001438 + 800180c: 4602 mov r2, r0 + 800180e: 68fb ldr r3, [r7, #12] + 8001810: 1ad3 subs r3, r2, r3 + 8001812: 2b0a cmp r3, #10 + 8001814: d90b bls.n 800182e + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + 8001816: 687b ldr r3, [r7, #4] + 8001818: 6a5b ldr r3, [r3, #36] ; 0x24 + 800181a: f443 3200 orr.w r2, r3, #131072 ; 0x20000 + 800181e: 687b ldr r3, [r7, #4] + 8001820: 625a str r2, [r3, #36] ; 0x24 + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + 8001822: 687b ldr r3, [r7, #4] + 8001824: 2205 movs r2, #5 + 8001826: f883 2020 strb.w r2, [r3, #32] + + return HAL_ERROR; + 800182a: 2301 movs r3, #1 + 800182c: e012 b.n 8001854 + while ((hcan->Instance->MSR & CAN_MSR_INAK) != 0U) + 800182e: 687b ldr r3, [r7, #4] + 8001830: 681b ldr r3, [r3, #0] + 8001832: 685b ldr r3, [r3, #4] + 8001834: f003 0301 and.w r3, r3, #1 + 8001838: 2b00 cmp r3, #0 + 800183a: d1e5 bne.n 8001808 + } + } + + /* Reset the CAN ErrorCode */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + 800183c: 687b ldr r3, [r7, #4] + 800183e: 2200 movs r2, #0 + 8001840: 625a str r2, [r3, #36] ; 0x24 + + /* Return function status */ + return HAL_OK; + 8001842: 2300 movs r3, #0 + 8001844: e006 b.n 8001854 + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_READY; + 8001846: 687b ldr r3, [r7, #4] + 8001848: 6a5b ldr r3, [r3, #36] ; 0x24 + 800184a: f443 2200 orr.w r2, r3, #524288 ; 0x80000 + 800184e: 687b ldr r3, [r7, #4] + 8001850: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001852: 2301 movs r3, #1 + } +} + 8001854: 4618 mov r0, r3 + 8001856: 3710 adds r7, #16 + 8001858: 46bd mov sp, r7 + 800185a: bd80 pop {r7, pc} + +0800185c : + * the TxMailbox used to store the Tx message. + * This parameter can be a value of @arg CAN_Tx_Mailboxes. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox) +{ + 800185c: b480 push {r7} + 800185e: b089 sub sp, #36 ; 0x24 + 8001860: af00 add r7, sp, #0 + 8001862: 60f8 str r0, [r7, #12] + 8001864: 60b9 str r1, [r7, #8] + 8001866: 607a str r2, [r7, #4] + 8001868: 603b str r3, [r7, #0] + uint32_t transmitmailbox; + HAL_CAN_StateTypeDef state = hcan->State; + 800186a: 68fb ldr r3, [r7, #12] + 800186c: f893 3020 ldrb.w r3, [r3, #32] + 8001870: 77fb strb r3, [r7, #31] + uint32_t tsr = READ_REG(hcan->Instance->TSR); + 8001872: 68fb ldr r3, [r7, #12] + 8001874: 681b ldr r3, [r3, #0] + 8001876: 689b ldr r3, [r3, #8] + 8001878: 61bb str r3, [r7, #24] + { + assert_param(IS_CAN_EXTID(pHeader->ExtId)); + } + assert_param(IS_FUNCTIONAL_STATE(pHeader->TransmitGlobalTime)); + + if ((state == HAL_CAN_STATE_READY) || + 800187a: 7ffb ldrb r3, [r7, #31] + 800187c: 2b01 cmp r3, #1 + 800187e: d003 beq.n 8001888 + 8001880: 7ffb ldrb r3, [r7, #31] + 8001882: 2b02 cmp r3, #2 + 8001884: f040 80b8 bne.w 80019f8 + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check that all the Tx mailboxes are not full */ + if (((tsr & CAN_TSR_TME0) != 0U) || + 8001888: 69bb ldr r3, [r7, #24] + 800188a: f003 6380 and.w r3, r3, #67108864 ; 0x4000000 + 800188e: 2b00 cmp r3, #0 + 8001890: d10a bne.n 80018a8 + ((tsr & CAN_TSR_TME1) != 0U) || + 8001892: 69bb ldr r3, [r7, #24] + 8001894: f003 6300 and.w r3, r3, #134217728 ; 0x8000000 + if (((tsr & CAN_TSR_TME0) != 0U) || + 8001898: 2b00 cmp r3, #0 + 800189a: d105 bne.n 80018a8 + ((tsr & CAN_TSR_TME2) != 0U)) + 800189c: 69bb ldr r3, [r7, #24] + 800189e: f003 5380 and.w r3, r3, #268435456 ; 0x10000000 + ((tsr & CAN_TSR_TME1) != 0U) || + 80018a2: 2b00 cmp r3, #0 + 80018a4: f000 80a0 beq.w 80019e8 + { + /* Select an empty transmit mailbox */ + transmitmailbox = (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos; + 80018a8: 69bb ldr r3, [r7, #24] + 80018aa: 0e1b lsrs r3, r3, #24 + 80018ac: f003 0303 and.w r3, r3, #3 + 80018b0: 617b str r3, [r7, #20] + + /* Check transmit mailbox value */ + if (transmitmailbox > 2U) + 80018b2: 697b ldr r3, [r7, #20] + 80018b4: 2b02 cmp r3, #2 + 80018b6: d907 bls.n 80018c8 + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INTERNAL; + 80018b8: 68fb ldr r3, [r7, #12] + 80018ba: 6a5b ldr r3, [r3, #36] ; 0x24 + 80018bc: f443 0200 orr.w r2, r3, #8388608 ; 0x800000 + 80018c0: 68fb ldr r3, [r7, #12] + 80018c2: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 80018c4: 2301 movs r3, #1 + 80018c6: e09e b.n 8001a06 + } + + /* Store the Tx mailbox */ + *pTxMailbox = (uint32_t)1 << transmitmailbox; + 80018c8: 2201 movs r2, #1 + 80018ca: 697b ldr r3, [r7, #20] + 80018cc: 409a lsls r2, r3 + 80018ce: 683b ldr r3, [r7, #0] + 80018d0: 601a str r2, [r3, #0] + + /* Set up the Id */ + if (pHeader->IDE == CAN_ID_STD) + 80018d2: 68bb ldr r3, [r7, #8] + 80018d4: 689b ldr r3, [r3, #8] + 80018d6: 2b00 cmp r3, #0 + 80018d8: d10d bne.n 80018f6 + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->StdId << CAN_TI0R_STID_Pos) | + 80018da: 68bb ldr r3, [r7, #8] + 80018dc: 681b ldr r3, [r3, #0] + 80018de: 055a lsls r2, r3, #21 + pHeader->RTR); + 80018e0: 68bb ldr r3, [r7, #8] + 80018e2: 68db ldr r3, [r3, #12] + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->StdId << CAN_TI0R_STID_Pos) | + 80018e4: 68f9 ldr r1, [r7, #12] + 80018e6: 6809 ldr r1, [r1, #0] + 80018e8: 431a orrs r2, r3 + 80018ea: 697b ldr r3, [r7, #20] + 80018ec: 3318 adds r3, #24 + 80018ee: 011b lsls r3, r3, #4 + 80018f0: 440b add r3, r1 + 80018f2: 601a str r2, [r3, #0] + 80018f4: e00f b.n 8001916 + } + else + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + 80018f6: 68bb ldr r3, [r7, #8] + 80018f8: 685b ldr r3, [r3, #4] + 80018fa: 00da lsls r2, r3, #3 + pHeader->IDE | + 80018fc: 68bb ldr r3, [r7, #8] + 80018fe: 689b ldr r3, [r3, #8] + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + 8001900: 431a orrs r2, r3 + pHeader->RTR); + 8001902: 68bb ldr r3, [r7, #8] + 8001904: 68db ldr r3, [r3, #12] + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + 8001906: 68f9 ldr r1, [r7, #12] + 8001908: 6809 ldr r1, [r1, #0] + pHeader->IDE | + 800190a: 431a orrs r2, r3 + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + 800190c: 697b ldr r3, [r7, #20] + 800190e: 3318 adds r3, #24 + 8001910: 011b lsls r3, r3, #4 + 8001912: 440b add r3, r1 + 8001914: 601a str r2, [r3, #0] + } + + /* Set up the DLC */ + hcan->Instance->sTxMailBox[transmitmailbox].TDTR = (pHeader->DLC); + 8001916: 68fb ldr r3, [r7, #12] + 8001918: 6819 ldr r1, [r3, #0] + 800191a: 68bb ldr r3, [r7, #8] + 800191c: 691a ldr r2, [r3, #16] + 800191e: 697b ldr r3, [r7, #20] + 8001920: 3318 adds r3, #24 + 8001922: 011b lsls r3, r3, #4 + 8001924: 440b add r3, r1 + 8001926: 3304 adds r3, #4 + 8001928: 601a str r2, [r3, #0] + + /* Set up the Transmit Global Time mode */ + if (pHeader->TransmitGlobalTime == ENABLE) + 800192a: 68bb ldr r3, [r7, #8] + 800192c: 7d1b ldrb r3, [r3, #20] + 800192e: 2b01 cmp r3, #1 + 8001930: d111 bne.n 8001956 + { + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TDTR, CAN_TDT0R_TGT); + 8001932: 68fb ldr r3, [r7, #12] + 8001934: 681a ldr r2, [r3, #0] + 8001936: 697b ldr r3, [r7, #20] + 8001938: 3318 adds r3, #24 + 800193a: 011b lsls r3, r3, #4 + 800193c: 4413 add r3, r2 + 800193e: 3304 adds r3, #4 + 8001940: 681b ldr r3, [r3, #0] + 8001942: 68fa ldr r2, [r7, #12] + 8001944: 6811 ldr r1, [r2, #0] + 8001946: f443 7280 orr.w r2, r3, #256 ; 0x100 + 800194a: 697b ldr r3, [r7, #20] + 800194c: 3318 adds r3, #24 + 800194e: 011b lsls r3, r3, #4 + 8001950: 440b add r3, r1 + 8001952: 3304 adds r3, #4 + 8001954: 601a str r2, [r3, #0] + } + + /* Set up the data field */ + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDHR, + 8001956: 687b ldr r3, [r7, #4] + 8001958: 3307 adds r3, #7 + 800195a: 781b ldrb r3, [r3, #0] + 800195c: 061a lsls r2, r3, #24 + 800195e: 687b ldr r3, [r7, #4] + 8001960: 3306 adds r3, #6 + 8001962: 781b ldrb r3, [r3, #0] + 8001964: 041b lsls r3, r3, #16 + 8001966: 431a orrs r2, r3 + 8001968: 687b ldr r3, [r7, #4] + 800196a: 3305 adds r3, #5 + 800196c: 781b ldrb r3, [r3, #0] + 800196e: 021b lsls r3, r3, #8 + 8001970: 4313 orrs r3, r2 + 8001972: 687a ldr r2, [r7, #4] + 8001974: 3204 adds r2, #4 + 8001976: 7812 ldrb r2, [r2, #0] + 8001978: 4610 mov r0, r2 + 800197a: 68fa ldr r2, [r7, #12] + 800197c: 6811 ldr r1, [r2, #0] + 800197e: ea43 0200 orr.w r2, r3, r0 + 8001982: 697b ldr r3, [r7, #20] + 8001984: 011b lsls r3, r3, #4 + 8001986: 440b add r3, r1 + 8001988: f503 73c6 add.w r3, r3, #396 ; 0x18c + 800198c: 601a str r2, [r3, #0] + ((uint32_t)aData[7] << CAN_TDH0R_DATA7_Pos) | + ((uint32_t)aData[6] << CAN_TDH0R_DATA6_Pos) | + ((uint32_t)aData[5] << CAN_TDH0R_DATA5_Pos) | + ((uint32_t)aData[4] << CAN_TDH0R_DATA4_Pos)); + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDLR, + 800198e: 687b ldr r3, [r7, #4] + 8001990: 3303 adds r3, #3 + 8001992: 781b ldrb r3, [r3, #0] + 8001994: 061a lsls r2, r3, #24 + 8001996: 687b ldr r3, [r7, #4] + 8001998: 3302 adds r3, #2 + 800199a: 781b ldrb r3, [r3, #0] + 800199c: 041b lsls r3, r3, #16 + 800199e: 431a orrs r2, r3 + 80019a0: 687b ldr r3, [r7, #4] + 80019a2: 3301 adds r3, #1 + 80019a4: 781b ldrb r3, [r3, #0] + 80019a6: 021b lsls r3, r3, #8 + 80019a8: 4313 orrs r3, r2 + 80019aa: 687a ldr r2, [r7, #4] + 80019ac: 7812 ldrb r2, [r2, #0] + 80019ae: 4610 mov r0, r2 + 80019b0: 68fa ldr r2, [r7, #12] + 80019b2: 6811 ldr r1, [r2, #0] + 80019b4: ea43 0200 orr.w r2, r3, r0 + 80019b8: 697b ldr r3, [r7, #20] + 80019ba: 011b lsls r3, r3, #4 + 80019bc: 440b add r3, r1 + 80019be: f503 73c4 add.w r3, r3, #392 ; 0x188 + 80019c2: 601a str r2, [r3, #0] + ((uint32_t)aData[2] << CAN_TDL0R_DATA2_Pos) | + ((uint32_t)aData[1] << CAN_TDL0R_DATA1_Pos) | + ((uint32_t)aData[0] << CAN_TDL0R_DATA0_Pos)); + + /* Request transmission */ + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TIR, CAN_TI0R_TXRQ); + 80019c4: 68fb ldr r3, [r7, #12] + 80019c6: 681a ldr r2, [r3, #0] + 80019c8: 697b ldr r3, [r7, #20] + 80019ca: 3318 adds r3, #24 + 80019cc: 011b lsls r3, r3, #4 + 80019ce: 4413 add r3, r2 + 80019d0: 681b ldr r3, [r3, #0] + 80019d2: 68fa ldr r2, [r7, #12] + 80019d4: 6811 ldr r1, [r2, #0] + 80019d6: f043 0201 orr.w r2, r3, #1 + 80019da: 697b ldr r3, [r7, #20] + 80019dc: 3318 adds r3, #24 + 80019de: 011b lsls r3, r3, #4 + 80019e0: 440b add r3, r1 + 80019e2: 601a str r2, [r3, #0] + + /* Return function status */ + return HAL_OK; + 80019e4: 2300 movs r3, #0 + 80019e6: e00e b.n 8001a06 + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + 80019e8: 68fb ldr r3, [r7, #12] + 80019ea: 6a5b ldr r3, [r3, #36] ; 0x24 + 80019ec: f443 1200 orr.w r2, r3, #2097152 ; 0x200000 + 80019f0: 68fb ldr r3, [r7, #12] + 80019f2: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 80019f4: 2301 movs r3, #1 + 80019f6: e006 b.n 8001a06 + } + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + 80019f8: 68fb ldr r3, [r7, #12] + 80019fa: 6a5b ldr r3, [r3, #36] ; 0x24 + 80019fc: f443 2280 orr.w r2, r3, #262144 ; 0x40000 + 8001a00: 68fb ldr r3, [r7, #12] + 8001a02: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001a04: 2301 movs r3, #1 + } +} + 8001a06: 4618 mov r0, r3 + 8001a08: 3724 adds r7, #36 ; 0x24 + 8001a0a: 46bd mov sp, r7 + 8001a0c: bc80 pop {r7} + 8001a0e: 4770 bx lr + +08001a10 : + * of the Rx frame will be stored. + * @param aData array where the payload of the Rx frame will be stored. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]) +{ + 8001a10: b480 push {r7} + 8001a12: b087 sub sp, #28 + 8001a14: af00 add r7, sp, #0 + 8001a16: 60f8 str r0, [r7, #12] + 8001a18: 60b9 str r1, [r7, #8] + 8001a1a: 607a str r2, [r7, #4] + 8001a1c: 603b str r3, [r7, #0] + HAL_CAN_StateTypeDef state = hcan->State; + 8001a1e: 68fb ldr r3, [r7, #12] + 8001a20: f893 3020 ldrb.w r3, [r3, #32] + 8001a24: 75fb strb r3, [r7, #23] + + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + 8001a26: 7dfb ldrb r3, [r7, #23] + 8001a28: 2b01 cmp r3, #1 + 8001a2a: d003 beq.n 8001a34 + 8001a2c: 7dfb ldrb r3, [r7, #23] + 8001a2e: 2b02 cmp r3, #2 + 8001a30: f040 80f3 bne.w 8001c1a + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check the Rx FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + 8001a34: 68bb ldr r3, [r7, #8] + 8001a36: 2b00 cmp r3, #0 + 8001a38: d10e bne.n 8001a58 + { + /* Check that the Rx FIFO 0 is not empty */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) == 0U) + 8001a3a: 68fb ldr r3, [r7, #12] + 8001a3c: 681b ldr r3, [r3, #0] + 8001a3e: 68db ldr r3, [r3, #12] + 8001a40: f003 0303 and.w r3, r3, #3 + 8001a44: 2b00 cmp r3, #0 + 8001a46: d116 bne.n 8001a76 + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + 8001a48: 68fb ldr r3, [r7, #12] + 8001a4a: 6a5b ldr r3, [r3, #36] ; 0x24 + 8001a4c: f443 1200 orr.w r2, r3, #2097152 ; 0x200000 + 8001a50: 68fb ldr r3, [r7, #12] + 8001a52: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001a54: 2301 movs r3, #1 + 8001a56: e0e7 b.n 8001c28 + } + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Check that the Rx FIFO 1 is not empty */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) == 0U) + 8001a58: 68fb ldr r3, [r7, #12] + 8001a5a: 681b ldr r3, [r3, #0] + 8001a5c: 691b ldr r3, [r3, #16] + 8001a5e: f003 0303 and.w r3, r3, #3 + 8001a62: 2b00 cmp r3, #0 + 8001a64: d107 bne.n 8001a76 + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + 8001a66: 68fb ldr r3, [r7, #12] + 8001a68: 6a5b ldr r3, [r3, #36] ; 0x24 + 8001a6a: f443 1200 orr.w r2, r3, #2097152 ; 0x200000 + 8001a6e: 68fb ldr r3, [r7, #12] + 8001a70: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001a72: 2301 movs r3, #1 + 8001a74: e0d8 b.n 8001c28 + } + } + + /* Get the header */ + pHeader->IDE = CAN_RI0R_IDE & hcan->Instance->sFIFOMailBox[RxFifo].RIR; + 8001a76: 68fb ldr r3, [r7, #12] + 8001a78: 681a ldr r2, [r3, #0] + 8001a7a: 68bb ldr r3, [r7, #8] + 8001a7c: 331b adds r3, #27 + 8001a7e: 011b lsls r3, r3, #4 + 8001a80: 4413 add r3, r2 + 8001a82: 681b ldr r3, [r3, #0] + 8001a84: f003 0204 and.w r2, r3, #4 + 8001a88: 687b ldr r3, [r7, #4] + 8001a8a: 609a str r2, [r3, #8] + if (pHeader->IDE == CAN_ID_STD) + 8001a8c: 687b ldr r3, [r7, #4] + 8001a8e: 689b ldr r3, [r3, #8] + 8001a90: 2b00 cmp r3, #0 + 8001a92: d10c bne.n 8001aae + { + pHeader->StdId = (CAN_RI0R_STID & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_TI0R_STID_Pos; + 8001a94: 68fb ldr r3, [r7, #12] + 8001a96: 681a ldr r2, [r3, #0] + 8001a98: 68bb ldr r3, [r7, #8] + 8001a9a: 331b adds r3, #27 + 8001a9c: 011b lsls r3, r3, #4 + 8001a9e: 4413 add r3, r2 + 8001aa0: 681b ldr r3, [r3, #0] + 8001aa2: 0d5b lsrs r3, r3, #21 + 8001aa4: f3c3 020a ubfx r2, r3, #0, #11 + 8001aa8: 687b ldr r3, [r7, #4] + 8001aaa: 601a str r2, [r3, #0] + 8001aac: e00b b.n 8001ac6 + } + else + { + pHeader->ExtId = ((CAN_RI0R_EXID | CAN_RI0R_STID) & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_EXID_Pos; + 8001aae: 68fb ldr r3, [r7, #12] + 8001ab0: 681a ldr r2, [r3, #0] + 8001ab2: 68bb ldr r3, [r7, #8] + 8001ab4: 331b adds r3, #27 + 8001ab6: 011b lsls r3, r3, #4 + 8001ab8: 4413 add r3, r2 + 8001aba: 681b ldr r3, [r3, #0] + 8001abc: 08db lsrs r3, r3, #3 + 8001abe: f023 4260 bic.w r2, r3, #3758096384 ; 0xe0000000 + 8001ac2: 687b ldr r3, [r7, #4] + 8001ac4: 605a str r2, [r3, #4] + } + pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR); + 8001ac6: 68fb ldr r3, [r7, #12] + 8001ac8: 681a ldr r2, [r3, #0] + 8001aca: 68bb ldr r3, [r7, #8] + 8001acc: 331b adds r3, #27 + 8001ace: 011b lsls r3, r3, #4 + 8001ad0: 4413 add r3, r2 + 8001ad2: 681b ldr r3, [r3, #0] + 8001ad4: f003 0202 and.w r2, r3, #2 + 8001ad8: 687b ldr r3, [r7, #4] + 8001ada: 60da str r2, [r3, #12] + pHeader->DLC = (CAN_RDT0R_DLC & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_DLC_Pos; + 8001adc: 68fb ldr r3, [r7, #12] + 8001ade: 681a ldr r2, [r3, #0] + 8001ae0: 68bb ldr r3, [r7, #8] + 8001ae2: 331b adds r3, #27 + 8001ae4: 011b lsls r3, r3, #4 + 8001ae6: 4413 add r3, r2 + 8001ae8: 3304 adds r3, #4 + 8001aea: 681b ldr r3, [r3, #0] + 8001aec: f003 020f and.w r2, r3, #15 + 8001af0: 687b ldr r3, [r7, #4] + 8001af2: 611a str r2, [r3, #16] + pHeader->FilterMatchIndex = (CAN_RDT0R_FMI & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_FMI_Pos; + 8001af4: 68fb ldr r3, [r7, #12] + 8001af6: 681a ldr r2, [r3, #0] + 8001af8: 68bb ldr r3, [r7, #8] + 8001afa: 331b adds r3, #27 + 8001afc: 011b lsls r3, r3, #4 + 8001afe: 4413 add r3, r2 + 8001b00: 3304 adds r3, #4 + 8001b02: 681b ldr r3, [r3, #0] + 8001b04: 0a1b lsrs r3, r3, #8 + 8001b06: b2da uxtb r2, r3 + 8001b08: 687b ldr r3, [r7, #4] + 8001b0a: 619a str r2, [r3, #24] + pHeader->Timestamp = (CAN_RDT0R_TIME & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_TIME_Pos; + 8001b0c: 68fb ldr r3, [r7, #12] + 8001b0e: 681a ldr r2, [r3, #0] + 8001b10: 68bb ldr r3, [r7, #8] + 8001b12: 331b adds r3, #27 + 8001b14: 011b lsls r3, r3, #4 + 8001b16: 4413 add r3, r2 + 8001b18: 3304 adds r3, #4 + 8001b1a: 681b ldr r3, [r3, #0] + 8001b1c: 0c1b lsrs r3, r3, #16 + 8001b1e: b29a uxth r2, r3 + 8001b20: 687b ldr r3, [r7, #4] + 8001b22: 615a str r2, [r3, #20] + + /* Get the data */ + aData[0] = (uint8_t)((CAN_RDL0R_DATA0 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA0_Pos); + 8001b24: 68fb ldr r3, [r7, #12] + 8001b26: 681a ldr r2, [r3, #0] + 8001b28: 68bb ldr r3, [r7, #8] + 8001b2a: 011b lsls r3, r3, #4 + 8001b2c: 4413 add r3, r2 + 8001b2e: f503 73dc add.w r3, r3, #440 ; 0x1b8 + 8001b32: 681b ldr r3, [r3, #0] + 8001b34: b2da uxtb r2, r3 + 8001b36: 683b ldr r3, [r7, #0] + 8001b38: 701a strb r2, [r3, #0] + aData[1] = (uint8_t)((CAN_RDL0R_DATA1 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA1_Pos); + 8001b3a: 68fb ldr r3, [r7, #12] + 8001b3c: 681a ldr r2, [r3, #0] + 8001b3e: 68bb ldr r3, [r7, #8] + 8001b40: 011b lsls r3, r3, #4 + 8001b42: 4413 add r3, r2 + 8001b44: f503 73dc add.w r3, r3, #440 ; 0x1b8 + 8001b48: 681b ldr r3, [r3, #0] + 8001b4a: 0a1a lsrs r2, r3, #8 + 8001b4c: 683b ldr r3, [r7, #0] + 8001b4e: 3301 adds r3, #1 + 8001b50: b2d2 uxtb r2, r2 + 8001b52: 701a strb r2, [r3, #0] + aData[2] = (uint8_t)((CAN_RDL0R_DATA2 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA2_Pos); + 8001b54: 68fb ldr r3, [r7, #12] + 8001b56: 681a ldr r2, [r3, #0] + 8001b58: 68bb ldr r3, [r7, #8] + 8001b5a: 011b lsls r3, r3, #4 + 8001b5c: 4413 add r3, r2 + 8001b5e: f503 73dc add.w r3, r3, #440 ; 0x1b8 + 8001b62: 681b ldr r3, [r3, #0] + 8001b64: 0c1a lsrs r2, r3, #16 + 8001b66: 683b ldr r3, [r7, #0] + 8001b68: 3302 adds r3, #2 + 8001b6a: b2d2 uxtb r2, r2 + 8001b6c: 701a strb r2, [r3, #0] + aData[3] = (uint8_t)((CAN_RDL0R_DATA3 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA3_Pos); + 8001b6e: 68fb ldr r3, [r7, #12] + 8001b70: 681a ldr r2, [r3, #0] + 8001b72: 68bb ldr r3, [r7, #8] + 8001b74: 011b lsls r3, r3, #4 + 8001b76: 4413 add r3, r2 + 8001b78: f503 73dc add.w r3, r3, #440 ; 0x1b8 + 8001b7c: 681b ldr r3, [r3, #0] + 8001b7e: 0e1a lsrs r2, r3, #24 + 8001b80: 683b ldr r3, [r7, #0] + 8001b82: 3303 adds r3, #3 + 8001b84: b2d2 uxtb r2, r2 + 8001b86: 701a strb r2, [r3, #0] + aData[4] = (uint8_t)((CAN_RDH0R_DATA4 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA4_Pos); + 8001b88: 68fb ldr r3, [r7, #12] + 8001b8a: 681a ldr r2, [r3, #0] + 8001b8c: 68bb ldr r3, [r7, #8] + 8001b8e: 011b lsls r3, r3, #4 + 8001b90: 4413 add r3, r2 + 8001b92: f503 73de add.w r3, r3, #444 ; 0x1bc + 8001b96: 681a ldr r2, [r3, #0] + 8001b98: 683b ldr r3, [r7, #0] + 8001b9a: 3304 adds r3, #4 + 8001b9c: b2d2 uxtb r2, r2 + 8001b9e: 701a strb r2, [r3, #0] + aData[5] = (uint8_t)((CAN_RDH0R_DATA5 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA5_Pos); + 8001ba0: 68fb ldr r3, [r7, #12] + 8001ba2: 681a ldr r2, [r3, #0] + 8001ba4: 68bb ldr r3, [r7, #8] + 8001ba6: 011b lsls r3, r3, #4 + 8001ba8: 4413 add r3, r2 + 8001baa: f503 73de add.w r3, r3, #444 ; 0x1bc + 8001bae: 681b ldr r3, [r3, #0] + 8001bb0: 0a1a lsrs r2, r3, #8 + 8001bb2: 683b ldr r3, [r7, #0] + 8001bb4: 3305 adds r3, #5 + 8001bb6: b2d2 uxtb r2, r2 + 8001bb8: 701a strb r2, [r3, #0] + aData[6] = (uint8_t)((CAN_RDH0R_DATA6 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA6_Pos); + 8001bba: 68fb ldr r3, [r7, #12] + 8001bbc: 681a ldr r2, [r3, #0] + 8001bbe: 68bb ldr r3, [r7, #8] + 8001bc0: 011b lsls r3, r3, #4 + 8001bc2: 4413 add r3, r2 + 8001bc4: f503 73de add.w r3, r3, #444 ; 0x1bc + 8001bc8: 681b ldr r3, [r3, #0] + 8001bca: 0c1a lsrs r2, r3, #16 + 8001bcc: 683b ldr r3, [r7, #0] + 8001bce: 3306 adds r3, #6 + 8001bd0: b2d2 uxtb r2, r2 + 8001bd2: 701a strb r2, [r3, #0] + aData[7] = (uint8_t)((CAN_RDH0R_DATA7 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA7_Pos); + 8001bd4: 68fb ldr r3, [r7, #12] + 8001bd6: 681a ldr r2, [r3, #0] + 8001bd8: 68bb ldr r3, [r7, #8] + 8001bda: 011b lsls r3, r3, #4 + 8001bdc: 4413 add r3, r2 + 8001bde: f503 73de add.w r3, r3, #444 ; 0x1bc + 8001be2: 681b ldr r3, [r3, #0] + 8001be4: 0e1a lsrs r2, r3, #24 + 8001be6: 683b ldr r3, [r7, #0] + 8001be8: 3307 adds r3, #7 + 8001bea: b2d2 uxtb r2, r2 + 8001bec: 701a strb r2, [r3, #0] + + /* Release the FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + 8001bee: 68bb ldr r3, [r7, #8] + 8001bf0: 2b00 cmp r3, #0 + 8001bf2: d108 bne.n 8001c06 + { + /* Release RX FIFO 0 */ + SET_BIT(hcan->Instance->RF0R, CAN_RF0R_RFOM0); + 8001bf4: 68fb ldr r3, [r7, #12] + 8001bf6: 681b ldr r3, [r3, #0] + 8001bf8: 68da ldr r2, [r3, #12] + 8001bfa: 68fb ldr r3, [r7, #12] + 8001bfc: 681b ldr r3, [r3, #0] + 8001bfe: f042 0220 orr.w r2, r2, #32 + 8001c02: 60da str r2, [r3, #12] + 8001c04: e007 b.n 8001c16 + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Release RX FIFO 1 */ + SET_BIT(hcan->Instance->RF1R, CAN_RF1R_RFOM1); + 8001c06: 68fb ldr r3, [r7, #12] + 8001c08: 681b ldr r3, [r3, #0] + 8001c0a: 691a ldr r2, [r3, #16] + 8001c0c: 68fb ldr r3, [r7, #12] + 8001c0e: 681b ldr r3, [r3, #0] + 8001c10: f042 0220 orr.w r2, r2, #32 + 8001c14: 611a str r2, [r3, #16] + } + + /* Return function status */ + return HAL_OK; + 8001c16: 2300 movs r3, #0 + 8001c18: e006 b.n 8001c28 + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + 8001c1a: 68fb ldr r3, [r7, #12] + 8001c1c: 6a5b ldr r3, [r3, #36] ; 0x24 + 8001c1e: f443 2280 orr.w r2, r3, #262144 ; 0x40000 + 8001c22: 68fb ldr r3, [r7, #12] + 8001c24: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001c26: 2301 movs r3, #1 + } +} + 8001c28: 4618 mov r0, r3 + 8001c2a: 371c adds r7, #28 + 8001c2c: 46bd mov sp, r7 + 8001c2e: bc80 pop {r7} + 8001c30: 4770 bx lr + +08001c32 : + * @param RxFifo Rx FIFO. + * This parameter can be a value of @arg CAN_receive_FIFO_number. + * @retval Number of messages available in Rx FIFO. + */ +uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo) +{ + 8001c32: b480 push {r7} + 8001c34: b085 sub sp, #20 + 8001c36: af00 add r7, sp, #0 + 8001c38: 6078 str r0, [r7, #4] + 8001c3a: 6039 str r1, [r7, #0] + uint32_t filllevel = 0U; + 8001c3c: 2300 movs r3, #0 + 8001c3e: 60fb str r3, [r7, #12] + HAL_CAN_StateTypeDef state = hcan->State; + 8001c40: 687b ldr r3, [r7, #4] + 8001c42: f893 3020 ldrb.w r3, [r3, #32] + 8001c46: 72fb strb r3, [r7, #11] + + /* Check function parameters */ + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + 8001c48: 7afb ldrb r3, [r7, #11] + 8001c4a: 2b01 cmp r3, #1 + 8001c4c: d002 beq.n 8001c54 + 8001c4e: 7afb ldrb r3, [r7, #11] + 8001c50: 2b02 cmp r3, #2 + 8001c52: d10f bne.n 8001c74 + (state == HAL_CAN_STATE_LISTENING)) + { + if (RxFifo == CAN_RX_FIFO0) + 8001c54: 683b ldr r3, [r7, #0] + 8001c56: 2b00 cmp r3, #0 + 8001c58: d106 bne.n 8001c68 + { + filllevel = hcan->Instance->RF0R & CAN_RF0R_FMP0; + 8001c5a: 687b ldr r3, [r7, #4] + 8001c5c: 681b ldr r3, [r3, #0] + 8001c5e: 68db ldr r3, [r3, #12] + 8001c60: f003 0303 and.w r3, r3, #3 + 8001c64: 60fb str r3, [r7, #12] + 8001c66: e005 b.n 8001c74 + } + else /* RxFifo == CAN_RX_FIFO1 */ + { + filllevel = hcan->Instance->RF1R & CAN_RF1R_FMP1; + 8001c68: 687b ldr r3, [r7, #4] + 8001c6a: 681b ldr r3, [r3, #0] + 8001c6c: 691b ldr r3, [r3, #16] + 8001c6e: f003 0303 and.w r3, r3, #3 + 8001c72: 60fb str r3, [r7, #12] + } + } + + /* Return Rx FIFO fill level */ + return filllevel; + 8001c74: 68fb ldr r3, [r7, #12] +} + 8001c76: 4618 mov r0, r3 + 8001c78: 3714 adds r7, #20 + 8001c7a: 46bd mov sp, r7 + 8001c7c: bc80 pop {r7} + 8001c7e: 4770 bx lr + +08001c80 : + * @param ActiveITs indicates which interrupts will be enabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs) +{ + 8001c80: b480 push {r7} + 8001c82: b085 sub sp, #20 + 8001c84: af00 add r7, sp, #0 + 8001c86: 6078 str r0, [r7, #4] + 8001c88: 6039 str r1, [r7, #0] + HAL_CAN_StateTypeDef state = hcan->State; + 8001c8a: 687b ldr r3, [r7, #4] + 8001c8c: f893 3020 ldrb.w r3, [r3, #32] + 8001c90: 73fb strb r3, [r7, #15] + + /* Check function parameters */ + assert_param(IS_CAN_IT(ActiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + 8001c92: 7bfb ldrb r3, [r7, #15] + 8001c94: 2b01 cmp r3, #1 + 8001c96: d002 beq.n 8001c9e + 8001c98: 7bfb ldrb r3, [r7, #15] + 8001c9a: 2b02 cmp r3, #2 + 8001c9c: d109 bne.n 8001cb2 + (state == HAL_CAN_STATE_LISTENING)) + { + /* Enable the selected interrupts */ + __HAL_CAN_ENABLE_IT(hcan, ActiveITs); + 8001c9e: 687b ldr r3, [r7, #4] + 8001ca0: 681b ldr r3, [r3, #0] + 8001ca2: 6959 ldr r1, [r3, #20] + 8001ca4: 687b ldr r3, [r7, #4] + 8001ca6: 681b ldr r3, [r3, #0] + 8001ca8: 683a ldr r2, [r7, #0] + 8001caa: 430a orrs r2, r1 + 8001cac: 615a str r2, [r3, #20] + + /* Return function status */ + return HAL_OK; + 8001cae: 2300 movs r3, #0 + 8001cb0: e006 b.n 8001cc0 + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + 8001cb2: 687b ldr r3, [r7, #4] + 8001cb4: 6a5b ldr r3, [r3, #36] ; 0x24 + 8001cb6: f443 2280 orr.w r2, r3, #262144 ; 0x40000 + 8001cba: 687b ldr r3, [r7, #4] + 8001cbc: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001cbe: 2301 movs r3, #1 + } +} + 8001cc0: 4618 mov r0, r3 + 8001cc2: 3714 adds r7, #20 + 8001cc4: 46bd mov sp, r7 + 8001cc6: bc80 pop {r7} + 8001cc8: 4770 bx lr + +08001cca : + * @param InactiveITs indicates which interrupts will be disabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs) +{ + 8001cca: b480 push {r7} + 8001ccc: b085 sub sp, #20 + 8001cce: af00 add r7, sp, #0 + 8001cd0: 6078 str r0, [r7, #4] + 8001cd2: 6039 str r1, [r7, #0] + HAL_CAN_StateTypeDef state = hcan->State; + 8001cd4: 687b ldr r3, [r7, #4] + 8001cd6: f893 3020 ldrb.w r3, [r3, #32] + 8001cda: 73fb strb r3, [r7, #15] + + /* Check function parameters */ + assert_param(IS_CAN_IT(InactiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + 8001cdc: 7bfb ldrb r3, [r7, #15] + 8001cde: 2b01 cmp r3, #1 + 8001ce0: d002 beq.n 8001ce8 + 8001ce2: 7bfb ldrb r3, [r7, #15] + 8001ce4: 2b02 cmp r3, #2 + 8001ce6: d10a bne.n 8001cfe + (state == HAL_CAN_STATE_LISTENING)) + { + /* Disable the selected interrupts */ + __HAL_CAN_DISABLE_IT(hcan, InactiveITs); + 8001ce8: 687b ldr r3, [r7, #4] + 8001cea: 681b ldr r3, [r3, #0] + 8001cec: 6959 ldr r1, [r3, #20] + 8001cee: 683b ldr r3, [r7, #0] + 8001cf0: 43da mvns r2, r3 + 8001cf2: 687b ldr r3, [r7, #4] + 8001cf4: 681b ldr r3, [r3, #0] + 8001cf6: 400a ands r2, r1 + 8001cf8: 615a str r2, [r3, #20] + + /* Return function status */ + return HAL_OK; + 8001cfa: 2300 movs r3, #0 + 8001cfc: e006 b.n 8001d0c + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + 8001cfe: 687b ldr r3, [r7, #4] + 8001d00: 6a5b ldr r3, [r3, #36] ; 0x24 + 8001d02: f443 2280 orr.w r2, r3, #262144 ; 0x40000 + 8001d06: 687b ldr r3, [r7, #4] + 8001d08: 625a str r2, [r3, #36] ; 0x24 + + return HAL_ERROR; + 8001d0a: 2301 movs r3, #1 + } +} + 8001d0c: 4618 mov r0, r3 + 8001d0e: 3714 adds r7, #20 + 8001d10: 46bd mov sp, r7 + 8001d12: bc80 pop {r7} + 8001d14: 4770 bx lr + +08001d16 : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan) +{ + 8001d16: b580 push {r7, lr} + 8001d18: b08a sub sp, #40 ; 0x28 + 8001d1a: af00 add r7, sp, #0 + 8001d1c: 6078 str r0, [r7, #4] + uint32_t errorcode = HAL_CAN_ERROR_NONE; + 8001d1e: 2300 movs r3, #0 + 8001d20: 627b str r3, [r7, #36] ; 0x24 + uint32_t interrupts = READ_REG(hcan->Instance->IER); + 8001d22: 687b ldr r3, [r7, #4] + 8001d24: 681b ldr r3, [r3, #0] + 8001d26: 695b ldr r3, [r3, #20] + 8001d28: 623b str r3, [r7, #32] + uint32_t msrflags = READ_REG(hcan->Instance->MSR); + 8001d2a: 687b ldr r3, [r7, #4] + 8001d2c: 681b ldr r3, [r3, #0] + 8001d2e: 685b ldr r3, [r3, #4] + 8001d30: 61fb str r3, [r7, #28] + uint32_t tsrflags = READ_REG(hcan->Instance->TSR); + 8001d32: 687b ldr r3, [r7, #4] + 8001d34: 681b ldr r3, [r3, #0] + 8001d36: 689b ldr r3, [r3, #8] + 8001d38: 61bb str r3, [r7, #24] + uint32_t rf0rflags = READ_REG(hcan->Instance->RF0R); + 8001d3a: 687b ldr r3, [r7, #4] + 8001d3c: 681b ldr r3, [r3, #0] + 8001d3e: 68db ldr r3, [r3, #12] + 8001d40: 617b str r3, [r7, #20] + uint32_t rf1rflags = READ_REG(hcan->Instance->RF1R); + 8001d42: 687b ldr r3, [r7, #4] + 8001d44: 681b ldr r3, [r3, #0] + 8001d46: 691b ldr r3, [r3, #16] + 8001d48: 613b str r3, [r7, #16] + uint32_t esrflags = READ_REG(hcan->Instance->ESR); + 8001d4a: 687b ldr r3, [r7, #4] + 8001d4c: 681b ldr r3, [r3, #0] + 8001d4e: 699b ldr r3, [r3, #24] + 8001d50: 60fb str r3, [r7, #12] + + /* Transmit Mailbox empty interrupt management *****************************/ + if ((interrupts & CAN_IT_TX_MAILBOX_EMPTY) != 0U) + 8001d52: 6a3b ldr r3, [r7, #32] + 8001d54: f003 0301 and.w r3, r3, #1 + 8001d58: 2b00 cmp r3, #0 + 8001d5a: d07c beq.n 8001e56 + { + /* Transmit Mailbox 0 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP0) != 0U) + 8001d5c: 69bb ldr r3, [r7, #24] + 8001d5e: f003 0301 and.w r3, r3, #1 + 8001d62: 2b00 cmp r3, #0 + 8001d64: d023 beq.n 8001dae + { + /* Clear the Transmission Complete flag (and TXOK0,ALST0,TERR0 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP0); + 8001d66: 687b ldr r3, [r7, #4] + 8001d68: 681b ldr r3, [r3, #0] + 8001d6a: 2201 movs r2, #1 + 8001d6c: 609a str r2, [r3, #8] + + if ((tsrflags & CAN_TSR_TXOK0) != 0U) + 8001d6e: 69bb ldr r3, [r7, #24] + 8001d70: f003 0302 and.w r3, r3, #2 + 8001d74: 2b00 cmp r3, #0 + 8001d76: d003 beq.n 8001d80 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0CompleteCallback(hcan); + 8001d78: 6878 ldr r0, [r7, #4] + 8001d7a: f001 fb7b bl 8003474 + 8001d7e: e016 b.n 8001dae +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST0) != 0U) + 8001d80: 69bb ldr r3, [r7, #24] + 8001d82: f003 0304 and.w r3, r3, #4 + 8001d86: 2b00 cmp r3, #0 + 8001d88: d004 beq.n 8001d94 + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST0; + 8001d8a: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001d8c: f443 6300 orr.w r3, r3, #2048 ; 0x800 + 8001d90: 627b str r3, [r7, #36] ; 0x24 + 8001d92: e00c b.n 8001dae + } + else if ((tsrflags & CAN_TSR_TERR0) != 0U) + 8001d94: 69bb ldr r3, [r7, #24] + 8001d96: f003 0308 and.w r3, r3, #8 + 8001d9a: 2b00 cmp r3, #0 + 8001d9c: d004 beq.n 8001da8 + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR0; + 8001d9e: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001da0: f443 5380 orr.w r3, r3, #4096 ; 0x1000 + 8001da4: 627b str r3, [r7, #36] ; 0x24 + 8001da6: e002 b.n 8001dae +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0AbortCallback(hcan); + 8001da8: 6878 ldr r0, [r7, #4] + 8001daa: f000 f965 bl 8002078 + } + } + } + + /* Transmit Mailbox 1 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP1) != 0U) + 8001dae: 69bb ldr r3, [r7, #24] + 8001db0: f403 7380 and.w r3, r3, #256 ; 0x100 + 8001db4: 2b00 cmp r3, #0 + 8001db6: d024 beq.n 8001e02 + { + /* Clear the Transmission Complete flag (and TXOK1,ALST1,TERR1 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP1); + 8001db8: 687b ldr r3, [r7, #4] + 8001dba: 681b ldr r3, [r3, #0] + 8001dbc: f44f 7280 mov.w r2, #256 ; 0x100 + 8001dc0: 609a str r2, [r3, #8] + + if ((tsrflags & CAN_TSR_TXOK1) != 0U) + 8001dc2: 69bb ldr r3, [r7, #24] + 8001dc4: f403 7300 and.w r3, r3, #512 ; 0x200 + 8001dc8: 2b00 cmp r3, #0 + 8001dca: d003 beq.n 8001dd4 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1CompleteCallback(hcan); + 8001dcc: 6878 ldr r0, [r7, #4] + 8001dce: f001 fb5b bl 8003488 + 8001dd2: e016 b.n 8001e02 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST1) != 0U) + 8001dd4: 69bb ldr r3, [r7, #24] + 8001dd6: f403 6380 and.w r3, r3, #1024 ; 0x400 + 8001dda: 2b00 cmp r3, #0 + 8001ddc: d004 beq.n 8001de8 + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST1; + 8001dde: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001de0: f443 5300 orr.w r3, r3, #8192 ; 0x2000 + 8001de4: 627b str r3, [r7, #36] ; 0x24 + 8001de6: e00c b.n 8001e02 + } + else if ((tsrflags & CAN_TSR_TERR1) != 0U) + 8001de8: 69bb ldr r3, [r7, #24] + 8001dea: f403 6300 and.w r3, r3, #2048 ; 0x800 + 8001dee: 2b00 cmp r3, #0 + 8001df0: d004 beq.n 8001dfc + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR1; + 8001df2: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001df4: f443 4380 orr.w r3, r3, #16384 ; 0x4000 + 8001df8: 627b str r3, [r7, #36] ; 0x24 + 8001dfa: e002 b.n 8001e02 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1AbortCallback(hcan); + 8001dfc: 6878 ldr r0, [r7, #4] + 8001dfe: f000 f944 bl 800208a + } + } + } + + /* Transmit Mailbox 2 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP2) != 0U) + 8001e02: 69bb ldr r3, [r7, #24] + 8001e04: f403 3380 and.w r3, r3, #65536 ; 0x10000 + 8001e08: 2b00 cmp r3, #0 + 8001e0a: d024 beq.n 8001e56 + { + /* Clear the Transmission Complete flag (and TXOK2,ALST2,TERR2 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP2); + 8001e0c: 687b ldr r3, [r7, #4] + 8001e0e: 681b ldr r3, [r3, #0] + 8001e10: f44f 3280 mov.w r2, #65536 ; 0x10000 + 8001e14: 609a str r2, [r3, #8] + + if ((tsrflags & CAN_TSR_TXOK2) != 0U) + 8001e16: 69bb ldr r3, [r7, #24] + 8001e18: f403 3300 and.w r3, r3, #131072 ; 0x20000 + 8001e1c: 2b00 cmp r3, #0 + 8001e1e: d003 beq.n 8001e28 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2CompleteCallback(hcan); + 8001e20: 6878 ldr r0, [r7, #4] + 8001e22: f001 fb3b bl 800349c + 8001e26: e016 b.n 8001e56 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST2) != 0U) + 8001e28: 69bb ldr r3, [r7, #24] + 8001e2a: f403 2380 and.w r3, r3, #262144 ; 0x40000 + 8001e2e: 2b00 cmp r3, #0 + 8001e30: d004 beq.n 8001e3c + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST2; + 8001e32: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001e34: f443 4300 orr.w r3, r3, #32768 ; 0x8000 + 8001e38: 627b str r3, [r7, #36] ; 0x24 + 8001e3a: e00c b.n 8001e56 + } + else if ((tsrflags & CAN_TSR_TERR2) != 0U) + 8001e3c: 69bb ldr r3, [r7, #24] + 8001e3e: f403 2300 and.w r3, r3, #524288 ; 0x80000 + 8001e42: 2b00 cmp r3, #0 + 8001e44: d004 beq.n 8001e50 + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR2; + 8001e46: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001e48: f443 3380 orr.w r3, r3, #65536 ; 0x10000 + 8001e4c: 627b str r3, [r7, #36] ; 0x24 + 8001e4e: e002 b.n 8001e56 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2AbortCallback(hcan); + 8001e50: 6878 ldr r0, [r7, #4] + 8001e52: f000 f923 bl 800209c + } + } + } + + /* Receive FIFO 0 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO0_OVERRUN) != 0U) + 8001e56: 6a3b ldr r3, [r7, #32] + 8001e58: f003 0308 and.w r3, r3, #8 + 8001e5c: 2b00 cmp r3, #0 + 8001e5e: d00c beq.n 8001e7a + { + if ((rf0rflags & CAN_RF0R_FOVR0) != 0U) + 8001e60: 697b ldr r3, [r7, #20] + 8001e62: f003 0310 and.w r3, r3, #16 + 8001e66: 2b00 cmp r3, #0 + 8001e68: d007 beq.n 8001e7a + { + /* Set CAN error code to Rx Fifo 0 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV0; + 8001e6a: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001e6c: f443 7300 orr.w r3, r3, #512 ; 0x200 + 8001e70: 627b str r3, [r7, #36] ; 0x24 + + /* Clear FIFO0 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV0); + 8001e72: 687b ldr r3, [r7, #4] + 8001e74: 681b ldr r3, [r3, #0] + 8001e76: 2210 movs r2, #16 + 8001e78: 60da str r2, [r3, #12] + } + } + + /* Receive FIFO 0 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO0_FULL) != 0U) + 8001e7a: 6a3b ldr r3, [r7, #32] + 8001e7c: f003 0304 and.w r3, r3, #4 + 8001e80: 2b00 cmp r3, #0 + 8001e82: d00b beq.n 8001e9c + { + if ((rf0rflags & CAN_RF0R_FULL0) != 0U) + 8001e84: 697b ldr r3, [r7, #20] + 8001e86: f003 0308 and.w r3, r3, #8 + 8001e8a: 2b00 cmp r3, #0 + 8001e8c: d006 beq.n 8001e9c + { + /* Clear FIFO 0 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF0); + 8001e8e: 687b ldr r3, [r7, #4] + 8001e90: 681b ldr r3, [r3, #0] + 8001e92: 2208 movs r2, #8 + 8001e94: 60da str r2, [r3, #12] +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0FullCallback(hcan); + 8001e96: 6878 ldr r0, [r7, #4] + 8001e98: f001 fb14 bl 80034c4 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 0 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO0_MSG_PENDING) != 0U) + 8001e9c: 6a3b ldr r3, [r7, #32] + 8001e9e: f003 0302 and.w r3, r3, #2 + 8001ea2: 2b00 cmp r3, #0 + 8001ea4: d009 beq.n 8001eba + { + /* Check if message is still pending */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) != 0U) + 8001ea6: 687b ldr r3, [r7, #4] + 8001ea8: 681b ldr r3, [r3, #0] + 8001eaa: 68db ldr r3, [r3, #12] + 8001eac: f003 0303 and.w r3, r3, #3 + 8001eb0: 2b00 cmp r3, #0 + 8001eb2: d002 beq.n 8001eba +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0MsgPendingCallback(hcan); + 8001eb4: 6878 ldr r0, [r7, #4] + 8001eb6: f001 fafb bl 80034b0 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO1_OVERRUN) != 0U) + 8001eba: 6a3b ldr r3, [r7, #32] + 8001ebc: f003 0340 and.w r3, r3, #64 ; 0x40 + 8001ec0: 2b00 cmp r3, #0 + 8001ec2: d00c beq.n 8001ede + { + if ((rf1rflags & CAN_RF1R_FOVR1) != 0U) + 8001ec4: 693b ldr r3, [r7, #16] + 8001ec6: f003 0310 and.w r3, r3, #16 + 8001eca: 2b00 cmp r3, #0 + 8001ecc: d007 beq.n 8001ede + { + /* Set CAN error code to Rx Fifo 1 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV1; + 8001ece: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001ed0: f443 6380 orr.w r3, r3, #1024 ; 0x400 + 8001ed4: 627b str r3, [r7, #36] ; 0x24 + + /* Clear FIFO1 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV1); + 8001ed6: 687b ldr r3, [r7, #4] + 8001ed8: 681b ldr r3, [r3, #0] + 8001eda: 2210 movs r2, #16 + 8001edc: 611a str r2, [r3, #16] + } + } + + /* Receive FIFO 1 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO1_FULL) != 0U) + 8001ede: 6a3b ldr r3, [r7, #32] + 8001ee0: f003 0320 and.w r3, r3, #32 + 8001ee4: 2b00 cmp r3, #0 + 8001ee6: d00b beq.n 8001f00 + { + if ((rf1rflags & CAN_RF1R_FULL1) != 0U) + 8001ee8: 693b ldr r3, [r7, #16] + 8001eea: f003 0308 and.w r3, r3, #8 + 8001eee: 2b00 cmp r3, #0 + 8001ef0: d006 beq.n 8001f00 + { + /* Clear FIFO 1 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF1); + 8001ef2: 687b ldr r3, [r7, #4] + 8001ef4: 681b ldr r3, [r3, #0] + 8001ef6: 2208 movs r2, #8 + 8001ef8: 611a str r2, [r3, #16] +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1FullCallback(hcan); + 8001efa: 6878 ldr r0, [r7, #4] + 8001efc: f000 f8e0 bl 80020c0 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO1_MSG_PENDING) != 0U) + 8001f00: 6a3b ldr r3, [r7, #32] + 8001f02: f003 0310 and.w r3, r3, #16 + 8001f06: 2b00 cmp r3, #0 + 8001f08: d009 beq.n 8001f1e + { + /* Check if message is still pending */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) != 0U) + 8001f0a: 687b ldr r3, [r7, #4] + 8001f0c: 681b ldr r3, [r3, #0] + 8001f0e: 691b ldr r3, [r3, #16] + 8001f10: f003 0303 and.w r3, r3, #3 + 8001f14: 2b00 cmp r3, #0 + 8001f16: d002 beq.n 8001f1e +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1MsgPendingCallback(hcan); + 8001f18: 6878 ldr r0, [r7, #4] + 8001f1a: f000 f8c8 bl 80020ae +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Sleep interrupt management *********************************************/ + if ((interrupts & CAN_IT_SLEEP_ACK) != 0U) + 8001f1e: 6a3b ldr r3, [r7, #32] + 8001f20: f403 3300 and.w r3, r3, #131072 ; 0x20000 + 8001f24: 2b00 cmp r3, #0 + 8001f26: d00b beq.n 8001f40 + { + if ((msrflags & CAN_MSR_SLAKI) != 0U) + 8001f28: 69fb ldr r3, [r7, #28] + 8001f2a: f003 0310 and.w r3, r3, #16 + 8001f2e: 2b00 cmp r3, #0 + 8001f30: d006 beq.n 8001f40 + { + /* Clear Sleep interrupt Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_SLAKI); + 8001f32: 687b ldr r3, [r7, #4] + 8001f34: 681b ldr r3, [r3, #0] + 8001f36: 2210 movs r2, #16 + 8001f38: 605a str r2, [r3, #4] +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->SleepCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_SleepCallback(hcan); + 8001f3a: 6878 ldr r0, [r7, #4] + 8001f3c: f000 f8c9 bl 80020d2 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* WakeUp interrupt management *********************************************/ + if ((interrupts & CAN_IT_WAKEUP) != 0U) + 8001f40: 6a3b ldr r3, [r7, #32] + 8001f42: f403 3380 and.w r3, r3, #65536 ; 0x10000 + 8001f46: 2b00 cmp r3, #0 + 8001f48: d00b beq.n 8001f62 + { + if ((msrflags & CAN_MSR_WKUI) != 0U) + 8001f4a: 69fb ldr r3, [r7, #28] + 8001f4c: f003 0308 and.w r3, r3, #8 + 8001f50: 2b00 cmp r3, #0 + 8001f52: d006 beq.n 8001f62 + { + /* Clear WakeUp Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_WKU); + 8001f54: 687b ldr r3, [r7, #4] + 8001f56: 681b ldr r3, [r3, #0] + 8001f58: 2208 movs r2, #8 + 8001f5a: 605a str r2, [r3, #4] +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->WakeUpFromRxMsgCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_WakeUpFromRxMsgCallback(hcan); + 8001f5c: 6878 ldr r0, [r7, #4] + 8001f5e: f000 f8c1 bl 80020e4 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Error interrupts management *********************************************/ + if ((interrupts & CAN_IT_ERROR) != 0U) + 8001f62: 6a3b ldr r3, [r7, #32] + 8001f64: f403 4300 and.w r3, r3, #32768 ; 0x8000 + 8001f68: 2b00 cmp r3, #0 + 8001f6a: d075 beq.n 8002058 + { + if ((msrflags & CAN_MSR_ERRI) != 0U) + 8001f6c: 69fb ldr r3, [r7, #28] + 8001f6e: f003 0304 and.w r3, r3, #4 + 8001f72: 2b00 cmp r3, #0 + 8001f74: d06c beq.n 8002050 + { + /* Check Error Warning Flag */ + if (((interrupts & CAN_IT_ERROR_WARNING) != 0U) && + 8001f76: 6a3b ldr r3, [r7, #32] + 8001f78: f403 7380 and.w r3, r3, #256 ; 0x100 + 8001f7c: 2b00 cmp r3, #0 + 8001f7e: d008 beq.n 8001f92 + ((esrflags & CAN_ESR_EWGF) != 0U)) + 8001f80: 68fb ldr r3, [r7, #12] + 8001f82: f003 0301 and.w r3, r3, #1 + if (((interrupts & CAN_IT_ERROR_WARNING) != 0U) && + 8001f86: 2b00 cmp r3, #0 + 8001f88: d003 beq.n 8001f92 + { + /* Set CAN error code to Error Warning */ + errorcode |= HAL_CAN_ERROR_EWG; + 8001f8a: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001f8c: f043 0301 orr.w r3, r3, #1 + 8001f90: 627b str r3, [r7, #36] ; 0x24 + + /* No need for clear of Error Warning Flag as read-only */ + } + + /* Check Error Passive Flag */ + if (((interrupts & CAN_IT_ERROR_PASSIVE) != 0U) && + 8001f92: 6a3b ldr r3, [r7, #32] + 8001f94: f403 7300 and.w r3, r3, #512 ; 0x200 + 8001f98: 2b00 cmp r3, #0 + 8001f9a: d008 beq.n 8001fae + ((esrflags & CAN_ESR_EPVF) != 0U)) + 8001f9c: 68fb ldr r3, [r7, #12] + 8001f9e: f003 0302 and.w r3, r3, #2 + if (((interrupts & CAN_IT_ERROR_PASSIVE) != 0U) && + 8001fa2: 2b00 cmp r3, #0 + 8001fa4: d003 beq.n 8001fae + { + /* Set CAN error code to Error Passive */ + errorcode |= HAL_CAN_ERROR_EPV; + 8001fa6: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001fa8: f043 0302 orr.w r3, r3, #2 + 8001fac: 627b str r3, [r7, #36] ; 0x24 + + /* No need for clear of Error Passive Flag as read-only */ + } + + /* Check Bus-off Flag */ + if (((interrupts & CAN_IT_BUSOFF) != 0U) && + 8001fae: 6a3b ldr r3, [r7, #32] + 8001fb0: f403 6380 and.w r3, r3, #1024 ; 0x400 + 8001fb4: 2b00 cmp r3, #0 + 8001fb6: d008 beq.n 8001fca + ((esrflags & CAN_ESR_BOFF) != 0U)) + 8001fb8: 68fb ldr r3, [r7, #12] + 8001fba: f003 0304 and.w r3, r3, #4 + if (((interrupts & CAN_IT_BUSOFF) != 0U) && + 8001fbe: 2b00 cmp r3, #0 + 8001fc0: d003 beq.n 8001fca + { + /* Set CAN error code to Bus-Off */ + errorcode |= HAL_CAN_ERROR_BOF; + 8001fc2: 6a7b ldr r3, [r7, #36] ; 0x24 + 8001fc4: f043 0304 orr.w r3, r3, #4 + 8001fc8: 627b str r3, [r7, #36] ; 0x24 + + /* No need for clear of Error Bus-Off as read-only */ + } + + /* Check Last Error Code Flag */ + if (((interrupts & CAN_IT_LAST_ERROR_CODE) != 0U) && + 8001fca: 6a3b ldr r3, [r7, #32] + 8001fcc: f403 6300 and.w r3, r3, #2048 ; 0x800 + 8001fd0: 2b00 cmp r3, #0 + 8001fd2: d03d beq.n 8002050 + ((esrflags & CAN_ESR_LEC) != 0U)) + 8001fd4: 68fb ldr r3, [r7, #12] + 8001fd6: f003 0370 and.w r3, r3, #112 ; 0x70 + if (((interrupts & CAN_IT_LAST_ERROR_CODE) != 0U) && + 8001fda: 2b00 cmp r3, #0 + 8001fdc: d038 beq.n 8002050 + { + switch (esrflags & CAN_ESR_LEC) + 8001fde: 68fb ldr r3, [r7, #12] + 8001fe0: f003 0370 and.w r3, r3, #112 ; 0x70 + 8001fe4: 2b30 cmp r3, #48 ; 0x30 + 8001fe6: d017 beq.n 8002018 + 8001fe8: 2b30 cmp r3, #48 ; 0x30 + 8001fea: d804 bhi.n 8001ff6 + 8001fec: 2b10 cmp r3, #16 + 8001fee: d009 beq.n 8002004 + 8001ff0: 2b20 cmp r3, #32 + 8001ff2: d00c beq.n 800200e + case (CAN_ESR_LEC_2 | CAN_ESR_LEC_1): + /* Set CAN error code to CRC error */ + errorcode |= HAL_CAN_ERROR_CRC; + break; + default: + break; + 8001ff4: e024 b.n 8002040 + switch (esrflags & CAN_ESR_LEC) + 8001ff6: 2b50 cmp r3, #80 ; 0x50 + 8001ff8: d018 beq.n 800202c + 8001ffa: 2b60 cmp r3, #96 ; 0x60 + 8001ffc: d01b beq.n 8002036 + 8001ffe: 2b40 cmp r3, #64 ; 0x40 + 8002000: d00f beq.n 8002022 + break; + 8002002: e01d b.n 8002040 + errorcode |= HAL_CAN_ERROR_STF; + 8002004: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002006: f043 0308 orr.w r3, r3, #8 + 800200a: 627b str r3, [r7, #36] ; 0x24 + break; + 800200c: e018 b.n 8002040 + errorcode |= HAL_CAN_ERROR_FOR; + 800200e: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002010: f043 0310 orr.w r3, r3, #16 + 8002014: 627b str r3, [r7, #36] ; 0x24 + break; + 8002016: e013 b.n 8002040 + errorcode |= HAL_CAN_ERROR_ACK; + 8002018: 6a7b ldr r3, [r7, #36] ; 0x24 + 800201a: f043 0320 orr.w r3, r3, #32 + 800201e: 627b str r3, [r7, #36] ; 0x24 + break; + 8002020: e00e b.n 8002040 + errorcode |= HAL_CAN_ERROR_BR; + 8002022: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002024: f043 0340 orr.w r3, r3, #64 ; 0x40 + 8002028: 627b str r3, [r7, #36] ; 0x24 + break; + 800202a: e009 b.n 8002040 + errorcode |= HAL_CAN_ERROR_BD; + 800202c: 6a7b ldr r3, [r7, #36] ; 0x24 + 800202e: f043 0380 orr.w r3, r3, #128 ; 0x80 + 8002032: 627b str r3, [r7, #36] ; 0x24 + break; + 8002034: e004 b.n 8002040 + errorcode |= HAL_CAN_ERROR_CRC; + 8002036: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002038: f443 7380 orr.w r3, r3, #256 ; 0x100 + 800203c: 627b str r3, [r7, #36] ; 0x24 + break; + 800203e: bf00 nop + } + + /* Clear Last error code Flag */ + CLEAR_BIT(hcan->Instance->ESR, CAN_ESR_LEC); + 8002040: 687b ldr r3, [r7, #4] + 8002042: 681b ldr r3, [r3, #0] + 8002044: 699a ldr r2, [r3, #24] + 8002046: 687b ldr r3, [r7, #4] + 8002048: 681b ldr r3, [r3, #0] + 800204a: f022 0270 bic.w r2, r2, #112 ; 0x70 + 800204e: 619a str r2, [r3, #24] + } + } + + /* Clear ERRI Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_ERRI); + 8002050: 687b ldr r3, [r7, #4] + 8002052: 681b ldr r3, [r3, #0] + 8002054: 2204 movs r2, #4 + 8002056: 605a str r2, [r3, #4] + } + + /* Call the Error call Back in case of Errors */ + if (errorcode != HAL_CAN_ERROR_NONE) + 8002058: 6a7b ldr r3, [r7, #36] ; 0x24 + 800205a: 2b00 cmp r3, #0 + 800205c: d008 beq.n 8002070 + { + /* Update error code in handle */ + hcan->ErrorCode |= errorcode; + 800205e: 687b ldr r3, [r7, #4] + 8002060: 6a5a ldr r2, [r3, #36] ; 0x24 + 8002062: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002064: 431a orrs r2, r3 + 8002066: 687b ldr r3, [r7, #4] + 8002068: 625a str r2, [r3, #36] ; 0x24 +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->ErrorCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_ErrorCallback(hcan); + 800206a: 6878 ldr r0, [r7, #4] + 800206c: f001 fa38 bl 80034e0 +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } +} + 8002070: bf00 nop + 8002072: 3728 adds r7, #40 ; 0x28 + 8002074: 46bd mov sp, r7 + 8002076: bd80 pop {r7, pc} + +08002078 : + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan) +{ + 8002078: b480 push {r7} + 800207a: b083 sub sp, #12 + 800207c: af00 add r7, sp, #0 + 800207e: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox0AbortCallback could be implemented in the + user file + */ +} + 8002080: bf00 nop + 8002082: 370c adds r7, #12 + 8002084: 46bd mov sp, r7 + 8002086: bc80 pop {r7} + 8002088: 4770 bx lr + +0800208a : + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan) +{ + 800208a: b480 push {r7} + 800208c: b083 sub sp, #12 + 800208e: af00 add r7, sp, #0 + 8002090: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox1AbortCallback could be implemented in the + user file + */ +} + 8002092: bf00 nop + 8002094: 370c adds r7, #12 + 8002096: 46bd mov sp, r7 + 8002098: bc80 pop {r7} + 800209a: 4770 bx lr + +0800209c : + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan) +{ + 800209c: b480 push {r7} + 800209e: b083 sub sp, #12 + 80020a0: af00 add r7, sp, #0 + 80020a2: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox2AbortCallback could be implemented in the + user file + */ +} + 80020a4: bf00 nop + 80020a6: 370c adds r7, #12 + 80020a8: 46bd mov sp, r7 + 80020aa: bc80 pop {r7} + 80020ac: 4770 bx lr + +080020ae : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan) +{ + 80020ae: b480 push {r7} + 80020b0: b083 sub sp, #12 + 80020b2: af00 add r7, sp, #0 + 80020b4: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1MsgPendingCallback could be implemented in the + user file + */ +} + 80020b6: bf00 nop + 80020b8: 370c adds r7, #12 + 80020ba: 46bd mov sp, r7 + 80020bc: bc80 pop {r7} + 80020be: 4770 bx lr + +080020c0 : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan) +{ + 80020c0: b480 push {r7} + 80020c2: b083 sub sp, #12 + 80020c4: af00 add r7, sp, #0 + 80020c6: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1FullCallback could be implemented in the user + file + */ +} + 80020c8: bf00 nop + 80020ca: 370c adds r7, #12 + 80020cc: 46bd mov sp, r7 + 80020ce: bc80 pop {r7} + 80020d0: 4770 bx lr + +080020d2 : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan) +{ + 80020d2: b480 push {r7} + 80020d4: b083 sub sp, #12 + 80020d6: af00 add r7, sp, #0 + 80020d8: 6078 str r0, [r7, #4] + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_SleepCallback could be implemented in the user file + */ +} + 80020da: bf00 nop + 80020dc: 370c adds r7, #12 + 80020de: 46bd mov sp, r7 + 80020e0: bc80 pop {r7} + 80020e2: 4770 bx lr + +080020e4 : + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan) +{ + 80020e4: b480 push {r7} + 80020e6: b083 sub sp, #12 + 80020e8: af00 add r7, sp, #0 + 80020ea: 6078 str r0, [r7, #4] + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_WakeUpFromRxMsgCallback could be implemented in the + user file + */ +} + 80020ec: bf00 nop + 80020ee: 370c adds r7, #12 + 80020f0: 46bd mov sp, r7 + 80020f2: bc80 pop {r7} + 80020f4: 4770 bx lr + ... + +080020f8 <__NVIC_SetPriorityGrouping>: +{ + 80020f8: b480 push {r7} + 80020fa: b085 sub sp, #20 + 80020fc: af00 add r7, sp, #0 + 80020fe: 6078 str r0, [r7, #4] + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + 8002100: 687b ldr r3, [r7, #4] + 8002102: f003 0307 and.w r3, r3, #7 + 8002106: 60fb str r3, [r7, #12] + reg_value = SCB->AIRCR; /* read old register configuration */ + 8002108: 4b0c ldr r3, [pc, #48] ; (800213c <__NVIC_SetPriorityGrouping+0x44>) + 800210a: 68db ldr r3, [r3, #12] + 800210c: 60bb str r3, [r7, #8] + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + 800210e: 68ba ldr r2, [r7, #8] + 8002110: f64f 03ff movw r3, #63743 ; 0xf8ff + 8002114: 4013 ands r3, r2 + 8002116: 60bb str r3, [r7, #8] + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + 8002118: 68fb ldr r3, [r7, #12] + 800211a: 021a lsls r2, r3, #8 + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + 800211c: 68bb ldr r3, [r7, #8] + 800211e: 4313 orrs r3, r2 + reg_value = (reg_value | + 8002120: f043 63bf orr.w r3, r3, #100139008 ; 0x5f80000 + 8002124: f443 3300 orr.w r3, r3, #131072 ; 0x20000 + 8002128: 60bb str r3, [r7, #8] + SCB->AIRCR = reg_value; + 800212a: 4a04 ldr r2, [pc, #16] ; (800213c <__NVIC_SetPriorityGrouping+0x44>) + 800212c: 68bb ldr r3, [r7, #8] + 800212e: 60d3 str r3, [r2, #12] +} + 8002130: bf00 nop + 8002132: 3714 adds r7, #20 + 8002134: 46bd mov sp, r7 + 8002136: bc80 pop {r7} + 8002138: 4770 bx lr + 800213a: bf00 nop + 800213c: e000ed00 .word 0xe000ed00 + +08002140 <__NVIC_GetPriorityGrouping>: +{ + 8002140: b480 push {r7} + 8002142: af00 add r7, sp, #0 + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); + 8002144: 4b04 ldr r3, [pc, #16] ; (8002158 <__NVIC_GetPriorityGrouping+0x18>) + 8002146: 68db ldr r3, [r3, #12] + 8002148: 0a1b lsrs r3, r3, #8 + 800214a: f003 0307 and.w r3, r3, #7 +} + 800214e: 4618 mov r0, r3 + 8002150: 46bd mov sp, r7 + 8002152: bc80 pop {r7} + 8002154: 4770 bx lr + 8002156: bf00 nop + 8002158: e000ed00 .word 0xe000ed00 + +0800215c <__NVIC_EnableIRQ>: +{ + 800215c: b480 push {r7} + 800215e: b083 sub sp, #12 + 8002160: af00 add r7, sp, #0 + 8002162: 4603 mov r3, r0 + 8002164: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 8002166: f997 3007 ldrsb.w r3, [r7, #7] + 800216a: 2b00 cmp r3, #0 + 800216c: db0b blt.n 8002186 <__NVIC_EnableIRQ+0x2a> + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + 800216e: 79fb ldrb r3, [r7, #7] + 8002170: f003 021f and.w r2, r3, #31 + 8002174: 4906 ldr r1, [pc, #24] ; (8002190 <__NVIC_EnableIRQ+0x34>) + 8002176: f997 3007 ldrsb.w r3, [r7, #7] + 800217a: 095b lsrs r3, r3, #5 + 800217c: 2001 movs r0, #1 + 800217e: fa00 f202 lsl.w r2, r0, r2 + 8002182: f841 2023 str.w r2, [r1, r3, lsl #2] +} + 8002186: bf00 nop + 8002188: 370c adds r7, #12 + 800218a: 46bd mov sp, r7 + 800218c: bc80 pop {r7} + 800218e: 4770 bx lr + 8002190: e000e100 .word 0xe000e100 + +08002194 <__NVIC_SetPriority>: +{ + 8002194: b480 push {r7} + 8002196: b083 sub sp, #12 + 8002198: af00 add r7, sp, #0 + 800219a: 4603 mov r3, r0 + 800219c: 6039 str r1, [r7, #0] + 800219e: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 80021a0: f997 3007 ldrsb.w r3, [r7, #7] + 80021a4: 2b00 cmp r3, #0 + 80021a6: db0a blt.n 80021be <__NVIC_SetPriority+0x2a> + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80021a8: 683b ldr r3, [r7, #0] + 80021aa: b2da uxtb r2, r3 + 80021ac: 490c ldr r1, [pc, #48] ; (80021e0 <__NVIC_SetPriority+0x4c>) + 80021ae: f997 3007 ldrsb.w r3, [r7, #7] + 80021b2: 0112 lsls r2, r2, #4 + 80021b4: b2d2 uxtb r2, r2 + 80021b6: 440b add r3, r1 + 80021b8: f883 2300 strb.w r2, [r3, #768] ; 0x300 +} + 80021bc: e00a b.n 80021d4 <__NVIC_SetPriority+0x40> + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80021be: 683b ldr r3, [r7, #0] + 80021c0: b2da uxtb r2, r3 + 80021c2: 4908 ldr r1, [pc, #32] ; (80021e4 <__NVIC_SetPriority+0x50>) + 80021c4: 79fb ldrb r3, [r7, #7] + 80021c6: f003 030f and.w r3, r3, #15 + 80021ca: 3b04 subs r3, #4 + 80021cc: 0112 lsls r2, r2, #4 + 80021ce: b2d2 uxtb r2, r2 + 80021d0: 440b add r3, r1 + 80021d2: 761a strb r2, [r3, #24] +} + 80021d4: bf00 nop + 80021d6: 370c adds r7, #12 + 80021d8: 46bd mov sp, r7 + 80021da: bc80 pop {r7} + 80021dc: 4770 bx lr + 80021de: bf00 nop + 80021e0: e000e100 .word 0xe000e100 + 80021e4: e000ed00 .word 0xe000ed00 + +080021e8 : +{ + 80021e8: b480 push {r7} + 80021ea: b089 sub sp, #36 ; 0x24 + 80021ec: af00 add r7, sp, #0 + 80021ee: 60f8 str r0, [r7, #12] + 80021f0: 60b9 str r1, [r7, #8] + 80021f2: 607a str r2, [r7, #4] + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + 80021f4: 68fb ldr r3, [r7, #12] + 80021f6: f003 0307 and.w r3, r3, #7 + 80021fa: 61fb str r3, [r7, #28] + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + 80021fc: 69fb ldr r3, [r7, #28] + 80021fe: f1c3 0307 rsb r3, r3, #7 + 8002202: 2b04 cmp r3, #4 + 8002204: bf28 it cs + 8002206: 2304 movcs r3, #4 + 8002208: 61bb str r3, [r7, #24] + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + 800220a: 69fb ldr r3, [r7, #28] + 800220c: 3304 adds r3, #4 + 800220e: 2b06 cmp r3, #6 + 8002210: d902 bls.n 8002218 + 8002212: 69fb ldr r3, [r7, #28] + 8002214: 3b03 subs r3, #3 + 8002216: e000 b.n 800221a + 8002218: 2300 movs r3, #0 + 800221a: 617b str r3, [r7, #20] + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 800221c: f04f 32ff mov.w r2, #4294967295 + 8002220: 69bb ldr r3, [r7, #24] + 8002222: fa02 f303 lsl.w r3, r2, r3 + 8002226: 43da mvns r2, r3 + 8002228: 68bb ldr r3, [r7, #8] + 800222a: 401a ands r2, r3 + 800222c: 697b ldr r3, [r7, #20] + 800222e: 409a lsls r2, r3 + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + 8002230: f04f 31ff mov.w r1, #4294967295 + 8002234: 697b ldr r3, [r7, #20] + 8002236: fa01 f303 lsl.w r3, r1, r3 + 800223a: 43d9 mvns r1, r3 + 800223c: 687b ldr r3, [r7, #4] + 800223e: 400b ands r3, r1 + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + 8002240: 4313 orrs r3, r2 +} + 8002242: 4618 mov r0, r3 + 8002244: 3724 adds r7, #36 ; 0x24 + 8002246: 46bd mov sp, r7 + 8002248: bc80 pop {r7} + 800224a: 4770 bx lr + +0800224c : + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + 800224c: b580 push {r7, lr} + 800224e: b082 sub sp, #8 + 8002250: af00 add r7, sp, #0 + 8002252: 6078 str r0, [r7, #4] + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + 8002254: 687b ldr r3, [r7, #4] + 8002256: 3b01 subs r3, #1 + 8002258: f1b3 7f80 cmp.w r3, #16777216 ; 0x1000000 + 800225c: d301 bcc.n 8002262 + { + return (1UL); /* Reload value impossible */ + 800225e: 2301 movs r3, #1 + 8002260: e00f b.n 8002282 + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + 8002262: 4a0a ldr r2, [pc, #40] ; (800228c ) + 8002264: 687b ldr r3, [r7, #4] + 8002266: 3b01 subs r3, #1 + 8002268: 6053 str r3, [r2, #4] + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + 800226a: 210f movs r1, #15 + 800226c: f04f 30ff mov.w r0, #4294967295 + 8002270: f7ff ff90 bl 8002194 <__NVIC_SetPriority> + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + 8002274: 4b05 ldr r3, [pc, #20] ; (800228c ) + 8002276: 2200 movs r2, #0 + 8002278: 609a str r2, [r3, #8] + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + 800227a: 4b04 ldr r3, [pc, #16] ; (800228c ) + 800227c: 2207 movs r2, #7 + 800227e: 601a str r2, [r3, #0] + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ + 8002280: 2300 movs r3, #0 +} + 8002282: 4618 mov r0, r3 + 8002284: 3708 adds r7, #8 + 8002286: 46bd mov sp, r7 + 8002288: bd80 pop {r7, pc} + 800228a: bf00 nop + 800228c: e000e010 .word 0xe000e010 + +08002290 : + * @note When the NVIC_PriorityGroup_0 is selected, IRQ preemption is no more possible. + * The pending IRQ priority will be managed only by the subpriority. + * @retval None + */ +void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + 8002290: b580 push {r7, lr} + 8002292: b082 sub sp, #8 + 8002294: af00 add r7, sp, #0 + 8002296: 6078 str r0, [r7, #4] + /* Check the parameters */ + assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup)); + + /* Set the PRIGROUP[10:8] bits according to the PriorityGroup parameter value */ + NVIC_SetPriorityGrouping(PriorityGroup); + 8002298: 6878 ldr r0, [r7, #4] + 800229a: f7ff ff2d bl 80020f8 <__NVIC_SetPriorityGrouping> +} + 800229e: bf00 nop + 80022a0: 3708 adds r7, #8 + 80022a2: 46bd mov sp, r7 + 80022a4: bd80 pop {r7, pc} + +080022a6 : + * This parameter can be a value between 0 and 15 + * A lower priority value indicates a higher priority. + * @retval None + */ +void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority) +{ + 80022a6: b580 push {r7, lr} + 80022a8: b086 sub sp, #24 + 80022aa: af00 add r7, sp, #0 + 80022ac: 4603 mov r3, r0 + 80022ae: 60b9 str r1, [r7, #8] + 80022b0: 607a str r2, [r7, #4] + 80022b2: 73fb strb r3, [r7, #15] + uint32_t prioritygroup = 0x00U; + 80022b4: 2300 movs r3, #0 + 80022b6: 617b str r3, [r7, #20] + + /* Check the parameters */ + assert_param(IS_NVIC_SUB_PRIORITY(SubPriority)); + assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority)); + + prioritygroup = NVIC_GetPriorityGrouping(); + 80022b8: f7ff ff42 bl 8002140 <__NVIC_GetPriorityGrouping> + 80022bc: 6178 str r0, [r7, #20] + + NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority)); + 80022be: 687a ldr r2, [r7, #4] + 80022c0: 68b9 ldr r1, [r7, #8] + 80022c2: 6978 ldr r0, [r7, #20] + 80022c4: f7ff ff90 bl 80021e8 + 80022c8: 4602 mov r2, r0 + 80022ca: f997 300f ldrsb.w r3, [r7, #15] + 80022ce: 4611 mov r1, r2 + 80022d0: 4618 mov r0, r3 + 80022d2: f7ff ff5f bl 8002194 <__NVIC_SetPriority> +} + 80022d6: bf00 nop + 80022d8: 3718 adds r7, #24 + 80022da: 46bd mov sp, r7 + 80022dc: bd80 pop {r7, pc} + +080022de : + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval None + */ +void HAL_NVIC_EnableIRQ(IRQn_Type IRQn) +{ + 80022de: b580 push {r7, lr} + 80022e0: b082 sub sp, #8 + 80022e2: af00 add r7, sp, #0 + 80022e4: 4603 mov r3, r0 + 80022e6: 71fb strb r3, [r7, #7] + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Enable interrupt */ + NVIC_EnableIRQ(IRQn); + 80022e8: f997 3007 ldrsb.w r3, [r7, #7] + 80022ec: 4618 mov r0, r3 + 80022ee: f7ff ff35 bl 800215c <__NVIC_EnableIRQ> +} + 80022f2: bf00 nop + 80022f4: 3708 adds r7, #8 + 80022f6: 46bd mov sp, r7 + 80022f8: bd80 pop {r7, pc} + +080022fa : + * @param TicksNumb: Specifies the ticks Number of ticks between two interrupts. + * @retval status: - 0 Function succeeded. + * - 1 Function failed. + */ +uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb) +{ + 80022fa: b580 push {r7, lr} + 80022fc: b082 sub sp, #8 + 80022fe: af00 add r7, sp, #0 + 8002300: 6078 str r0, [r7, #4] + return SysTick_Config(TicksNumb); + 8002302: 6878 ldr r0, [r7, #4] + 8002304: f7ff ffa2 bl 800224c + 8002308: 4603 mov r3, r0 +} + 800230a: 4618 mov r0, r3 + 800230c: 3708 adds r7, #8 + 800230e: 46bd mov sp, r7 + 8002310: bd80 pop {r7, pc} + ... + +08002314 : + * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains + * the configuration information for the specified GPIO peripheral. + * @retval None + */ +void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) +{ + 8002314: b480 push {r7} + 8002316: b08b sub sp, #44 ; 0x2c + 8002318: af00 add r7, sp, #0 + 800231a: 6078 str r0, [r7, #4] + 800231c: 6039 str r1, [r7, #0] + uint32_t position = 0x00u; + 800231e: 2300 movs r3, #0 + 8002320: 627b str r3, [r7, #36] ; 0x24 + uint32_t ioposition; + uint32_t iocurrent; + uint32_t temp; + uint32_t config = 0x00u; + 8002322: 2300 movs r3, #0 + 8002324: 623b str r3, [r7, #32] + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_GPIO_PIN(GPIO_Init->Pin)); + assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); + + /* Configure the port pins */ + while (((GPIO_Init->Pin) >> position) != 0x00u) + 8002326: e133 b.n 8002590 + { + /* Get the IO position */ + ioposition = (0x01uL << position); + 8002328: 2201 movs r2, #1 + 800232a: 6a7b ldr r3, [r7, #36] ; 0x24 + 800232c: fa02 f303 lsl.w r3, r2, r3 + 8002330: 61fb str r3, [r7, #28] + + /* Get the current IO position */ + iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition; + 8002332: 683b ldr r3, [r7, #0] + 8002334: 681b ldr r3, [r3, #0] + 8002336: 69fa ldr r2, [r7, #28] + 8002338: 4013 ands r3, r2 + 800233a: 61bb str r3, [r7, #24] + + if (iocurrent == ioposition) + 800233c: 69ba ldr r2, [r7, #24] + 800233e: 69fb ldr r3, [r7, #28] + 8002340: 429a cmp r2, r3 + 8002342: f040 8122 bne.w 800258a + { + /* Check the Alternate function parameters */ + assert_param(IS_GPIO_AF_INSTANCE(GPIOx)); + + /* Based on the required mode, filling config variable with MODEy[1:0] and CNFy[3:2] corresponding bits */ + switch (GPIO_Init->Mode) + 8002346: 683b ldr r3, [r7, #0] + 8002348: 685b ldr r3, [r3, #4] + 800234a: 2b12 cmp r3, #18 + 800234c: d034 beq.n 80023b8 + 800234e: 2b12 cmp r3, #18 + 8002350: d80d bhi.n 800236e + 8002352: 2b02 cmp r3, #2 + 8002354: d02b beq.n 80023ae + 8002356: 2b02 cmp r3, #2 + 8002358: d804 bhi.n 8002364 + 800235a: 2b00 cmp r3, #0 + 800235c: d031 beq.n 80023c2 + 800235e: 2b01 cmp r3, #1 + 8002360: d01c beq.n 800239c + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_ANALOG; + break; + + /* Parameters are checked with assert_param */ + default: + break; + 8002362: e048 b.n 80023f6 + switch (GPIO_Init->Mode) + 8002364: 2b03 cmp r3, #3 + 8002366: d043 beq.n 80023f0 + 8002368: 2b11 cmp r3, #17 + 800236a: d01b beq.n 80023a4 + break; + 800236c: e043 b.n 80023f6 + switch (GPIO_Init->Mode) + 800236e: 4a8f ldr r2, [pc, #572] ; (80025ac ) + 8002370: 4293 cmp r3, r2 + 8002372: d026 beq.n 80023c2 + 8002374: 4a8d ldr r2, [pc, #564] ; (80025ac ) + 8002376: 4293 cmp r3, r2 + 8002378: d806 bhi.n 8002388 + 800237a: 4a8d ldr r2, [pc, #564] ; (80025b0 ) + 800237c: 4293 cmp r3, r2 + 800237e: d020 beq.n 80023c2 + 8002380: 4a8c ldr r2, [pc, #560] ; (80025b4 ) + 8002382: 4293 cmp r3, r2 + 8002384: d01d beq.n 80023c2 + break; + 8002386: e036 b.n 80023f6 + switch (GPIO_Init->Mode) + 8002388: 4a8b ldr r2, [pc, #556] ; (80025b8 ) + 800238a: 4293 cmp r3, r2 + 800238c: d019 beq.n 80023c2 + 800238e: 4a8b ldr r2, [pc, #556] ; (80025bc ) + 8002390: 4293 cmp r3, r2 + 8002392: d016 beq.n 80023c2 + 8002394: 4a8a ldr r2, [pc, #552] ; (80025c0 ) + 8002396: 4293 cmp r3, r2 + 8002398: d013 beq.n 80023c2 + break; + 800239a: e02c b.n 80023f6 + config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_PP; + 800239c: 683b ldr r3, [r7, #0] + 800239e: 68db ldr r3, [r3, #12] + 80023a0: 623b str r3, [r7, #32] + break; + 80023a2: e028 b.n 80023f6 + config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_OD; + 80023a4: 683b ldr r3, [r7, #0] + 80023a6: 68db ldr r3, [r3, #12] + 80023a8: 3304 adds r3, #4 + 80023aa: 623b str r3, [r7, #32] + break; + 80023ac: e023 b.n 80023f6 + config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_PP; + 80023ae: 683b ldr r3, [r7, #0] + 80023b0: 68db ldr r3, [r3, #12] + 80023b2: 3308 adds r3, #8 + 80023b4: 623b str r3, [r7, #32] + break; + 80023b6: e01e b.n 80023f6 + config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_OD; + 80023b8: 683b ldr r3, [r7, #0] + 80023ba: 68db ldr r3, [r3, #12] + 80023bc: 330c adds r3, #12 + 80023be: 623b str r3, [r7, #32] + break; + 80023c0: e019 b.n 80023f6 + if (GPIO_Init->Pull == GPIO_NOPULL) + 80023c2: 683b ldr r3, [r7, #0] + 80023c4: 689b ldr r3, [r3, #8] + 80023c6: 2b00 cmp r3, #0 + 80023c8: d102 bne.n 80023d0 + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_FLOATING; + 80023ca: 2304 movs r3, #4 + 80023cc: 623b str r3, [r7, #32] + break; + 80023ce: e012 b.n 80023f6 + else if (GPIO_Init->Pull == GPIO_PULLUP) + 80023d0: 683b ldr r3, [r7, #0] + 80023d2: 689b ldr r3, [r3, #8] + 80023d4: 2b01 cmp r3, #1 + 80023d6: d105 bne.n 80023e4 + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD; + 80023d8: 2308 movs r3, #8 + 80023da: 623b str r3, [r7, #32] + GPIOx->BSRR = ioposition; + 80023dc: 687b ldr r3, [r7, #4] + 80023de: 69fa ldr r2, [r7, #28] + 80023e0: 611a str r2, [r3, #16] + break; + 80023e2: e008 b.n 80023f6 + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD; + 80023e4: 2308 movs r3, #8 + 80023e6: 623b str r3, [r7, #32] + GPIOx->BRR = ioposition; + 80023e8: 687b ldr r3, [r7, #4] + 80023ea: 69fa ldr r2, [r7, #28] + 80023ec: 615a str r2, [r3, #20] + break; + 80023ee: e002 b.n 80023f6 + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_ANALOG; + 80023f0: 2300 movs r3, #0 + 80023f2: 623b str r3, [r7, #32] + break; + 80023f4: bf00 nop + } + + /* Check if the current bit belongs to first half or last half of the pin count number + in order to address CRH or CRL register*/ + configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL : &GPIOx->CRH; + 80023f6: 69bb ldr r3, [r7, #24] + 80023f8: 2bff cmp r3, #255 ; 0xff + 80023fa: d801 bhi.n 8002400 + 80023fc: 687b ldr r3, [r7, #4] + 80023fe: e001 b.n 8002404 + 8002400: 687b ldr r3, [r7, #4] + 8002402: 3304 adds r3, #4 + 8002404: 617b str r3, [r7, #20] + registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2u) : ((position - 8u) << 2u); + 8002406: 69bb ldr r3, [r7, #24] + 8002408: 2bff cmp r3, #255 ; 0xff + 800240a: d802 bhi.n 8002412 + 800240c: 6a7b ldr r3, [r7, #36] ; 0x24 + 800240e: 009b lsls r3, r3, #2 + 8002410: e002 b.n 8002418 + 8002412: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002414: 3b08 subs r3, #8 + 8002416: 009b lsls r3, r3, #2 + 8002418: 613b str r3, [r7, #16] + + /* Apply the new configuration of the pin to the register */ + MODIFY_REG((*configregister), ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset), (config << registeroffset)); + 800241a: 697b ldr r3, [r7, #20] + 800241c: 681a ldr r2, [r3, #0] + 800241e: 210f movs r1, #15 + 8002420: 693b ldr r3, [r7, #16] + 8002422: fa01 f303 lsl.w r3, r1, r3 + 8002426: 43db mvns r3, r3 + 8002428: 401a ands r2, r3 + 800242a: 6a39 ldr r1, [r7, #32] + 800242c: 693b ldr r3, [r7, #16] + 800242e: fa01 f303 lsl.w r3, r1, r3 + 8002432: 431a orrs r2, r3 + 8002434: 697b ldr r3, [r7, #20] + 8002436: 601a str r2, [r3, #0] + + /*--------------------- EXTI Mode Configuration ------------------------*/ + /* Configure the External Interrupt or event for the current IO */ + if ((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) + 8002438: 683b ldr r3, [r7, #0] + 800243a: 685b ldr r3, [r3, #4] + 800243c: f003 5380 and.w r3, r3, #268435456 ; 0x10000000 + 8002440: 2b00 cmp r3, #0 + 8002442: f000 80a2 beq.w 800258a + { + /* Enable AFIO Clock */ + __HAL_RCC_AFIO_CLK_ENABLE(); + 8002446: 4b5f ldr r3, [pc, #380] ; (80025c4 ) + 8002448: 699b ldr r3, [r3, #24] + 800244a: 4a5e ldr r2, [pc, #376] ; (80025c4 ) + 800244c: f043 0301 orr.w r3, r3, #1 + 8002450: 6193 str r3, [r2, #24] + 8002452: 4b5c ldr r3, [pc, #368] ; (80025c4 ) + 8002454: 699b ldr r3, [r3, #24] + 8002456: f003 0301 and.w r3, r3, #1 + 800245a: 60bb str r3, [r7, #8] + 800245c: 68bb ldr r3, [r7, #8] + temp = AFIO->EXTICR[position >> 2u]; + 800245e: 4a5a ldr r2, [pc, #360] ; (80025c8 ) + 8002460: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002462: 089b lsrs r3, r3, #2 + 8002464: 3302 adds r3, #2 + 8002466: f852 3023 ldr.w r3, [r2, r3, lsl #2] + 800246a: 60fb str r3, [r7, #12] + CLEAR_BIT(temp, (0x0Fu) << (4u * (position & 0x03u))); + 800246c: 6a7b ldr r3, [r7, #36] ; 0x24 + 800246e: f003 0303 and.w r3, r3, #3 + 8002472: 009b lsls r3, r3, #2 + 8002474: 220f movs r2, #15 + 8002476: fa02 f303 lsl.w r3, r2, r3 + 800247a: 43db mvns r3, r3 + 800247c: 68fa ldr r2, [r7, #12] + 800247e: 4013 ands r3, r2 + 8002480: 60fb str r3, [r7, #12] + SET_BIT(temp, (GPIO_GET_INDEX(GPIOx)) << (4u * (position & 0x03u))); + 8002482: 687b ldr r3, [r7, #4] + 8002484: 4a51 ldr r2, [pc, #324] ; (80025cc ) + 8002486: 4293 cmp r3, r2 + 8002488: d01f beq.n 80024ca + 800248a: 687b ldr r3, [r7, #4] + 800248c: 4a50 ldr r2, [pc, #320] ; (80025d0 ) + 800248e: 4293 cmp r3, r2 + 8002490: d019 beq.n 80024c6 + 8002492: 687b ldr r3, [r7, #4] + 8002494: 4a4f ldr r2, [pc, #316] ; (80025d4 ) + 8002496: 4293 cmp r3, r2 + 8002498: d013 beq.n 80024c2 + 800249a: 687b ldr r3, [r7, #4] + 800249c: 4a4e ldr r2, [pc, #312] ; (80025d8 ) + 800249e: 4293 cmp r3, r2 + 80024a0: d00d beq.n 80024be + 80024a2: 687b ldr r3, [r7, #4] + 80024a4: 4a4d ldr r2, [pc, #308] ; (80025dc ) + 80024a6: 4293 cmp r3, r2 + 80024a8: d007 beq.n 80024ba + 80024aa: 687b ldr r3, [r7, #4] + 80024ac: 4a4c ldr r2, [pc, #304] ; (80025e0 ) + 80024ae: 4293 cmp r3, r2 + 80024b0: d101 bne.n 80024b6 + 80024b2: 2305 movs r3, #5 + 80024b4: e00a b.n 80024cc + 80024b6: 2306 movs r3, #6 + 80024b8: e008 b.n 80024cc + 80024ba: 2304 movs r3, #4 + 80024bc: e006 b.n 80024cc + 80024be: 2303 movs r3, #3 + 80024c0: e004 b.n 80024cc + 80024c2: 2302 movs r3, #2 + 80024c4: e002 b.n 80024cc + 80024c6: 2301 movs r3, #1 + 80024c8: e000 b.n 80024cc + 80024ca: 2300 movs r3, #0 + 80024cc: 6a7a ldr r2, [r7, #36] ; 0x24 + 80024ce: f002 0203 and.w r2, r2, #3 + 80024d2: 0092 lsls r2, r2, #2 + 80024d4: 4093 lsls r3, r2 + 80024d6: 68fa ldr r2, [r7, #12] + 80024d8: 4313 orrs r3, r2 + 80024da: 60fb str r3, [r7, #12] + AFIO->EXTICR[position >> 2u] = temp; + 80024dc: 493a ldr r1, [pc, #232] ; (80025c8 ) + 80024de: 6a7b ldr r3, [r7, #36] ; 0x24 + 80024e0: 089b lsrs r3, r3, #2 + 80024e2: 3302 adds r3, #2 + 80024e4: 68fa ldr r2, [r7, #12] + 80024e6: f841 2023 str.w r2, [r1, r3, lsl #2] + + + /* Configure the interrupt mask */ + if ((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) + 80024ea: 683b ldr r3, [r7, #0] + 80024ec: 685b ldr r3, [r3, #4] + 80024ee: f403 3380 and.w r3, r3, #65536 ; 0x10000 + 80024f2: 2b00 cmp r3, #0 + 80024f4: d006 beq.n 8002504 + { + SET_BIT(EXTI->IMR, iocurrent); + 80024f6: 4b3b ldr r3, [pc, #236] ; (80025e4 ) + 80024f8: 681a ldr r2, [r3, #0] + 80024fa: 493a ldr r1, [pc, #232] ; (80025e4 ) + 80024fc: 69bb ldr r3, [r7, #24] + 80024fe: 4313 orrs r3, r2 + 8002500: 600b str r3, [r1, #0] + 8002502: e006 b.n 8002512 + } + else + { + CLEAR_BIT(EXTI->IMR, iocurrent); + 8002504: 4b37 ldr r3, [pc, #220] ; (80025e4 ) + 8002506: 681a ldr r2, [r3, #0] + 8002508: 69bb ldr r3, [r7, #24] + 800250a: 43db mvns r3, r3 + 800250c: 4935 ldr r1, [pc, #212] ; (80025e4 ) + 800250e: 4013 ands r3, r2 + 8002510: 600b str r3, [r1, #0] + } + + /* Configure the event mask */ + if ((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) + 8002512: 683b ldr r3, [r7, #0] + 8002514: 685b ldr r3, [r3, #4] + 8002516: f403 3300 and.w r3, r3, #131072 ; 0x20000 + 800251a: 2b00 cmp r3, #0 + 800251c: d006 beq.n 800252c + { + SET_BIT(EXTI->EMR, iocurrent); + 800251e: 4b31 ldr r3, [pc, #196] ; (80025e4 ) + 8002520: 685a ldr r2, [r3, #4] + 8002522: 4930 ldr r1, [pc, #192] ; (80025e4 ) + 8002524: 69bb ldr r3, [r7, #24] + 8002526: 4313 orrs r3, r2 + 8002528: 604b str r3, [r1, #4] + 800252a: e006 b.n 800253a + } + else + { + CLEAR_BIT(EXTI->EMR, iocurrent); + 800252c: 4b2d ldr r3, [pc, #180] ; (80025e4 ) + 800252e: 685a ldr r2, [r3, #4] + 8002530: 69bb ldr r3, [r7, #24] + 8002532: 43db mvns r3, r3 + 8002534: 492b ldr r1, [pc, #172] ; (80025e4 ) + 8002536: 4013 ands r3, r2 + 8002538: 604b str r3, [r1, #4] + } + + /* Enable or disable the rising trigger */ + if ((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) + 800253a: 683b ldr r3, [r7, #0] + 800253c: 685b ldr r3, [r3, #4] + 800253e: f403 1380 and.w r3, r3, #1048576 ; 0x100000 + 8002542: 2b00 cmp r3, #0 + 8002544: d006 beq.n 8002554 + { + SET_BIT(EXTI->RTSR, iocurrent); + 8002546: 4b27 ldr r3, [pc, #156] ; (80025e4 ) + 8002548: 689a ldr r2, [r3, #8] + 800254a: 4926 ldr r1, [pc, #152] ; (80025e4 ) + 800254c: 69bb ldr r3, [r7, #24] + 800254e: 4313 orrs r3, r2 + 8002550: 608b str r3, [r1, #8] + 8002552: e006 b.n 8002562 + } + else + { + CLEAR_BIT(EXTI->RTSR, iocurrent); + 8002554: 4b23 ldr r3, [pc, #140] ; (80025e4 ) + 8002556: 689a ldr r2, [r3, #8] + 8002558: 69bb ldr r3, [r7, #24] + 800255a: 43db mvns r3, r3 + 800255c: 4921 ldr r1, [pc, #132] ; (80025e4 ) + 800255e: 4013 ands r3, r2 + 8002560: 608b str r3, [r1, #8] + } + + /* Enable or disable the falling trigger */ + if ((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) + 8002562: 683b ldr r3, [r7, #0] + 8002564: 685b ldr r3, [r3, #4] + 8002566: f403 1300 and.w r3, r3, #2097152 ; 0x200000 + 800256a: 2b00 cmp r3, #0 + 800256c: d006 beq.n 800257c + { + SET_BIT(EXTI->FTSR, iocurrent); + 800256e: 4b1d ldr r3, [pc, #116] ; (80025e4 ) + 8002570: 68da ldr r2, [r3, #12] + 8002572: 491c ldr r1, [pc, #112] ; (80025e4 ) + 8002574: 69bb ldr r3, [r7, #24] + 8002576: 4313 orrs r3, r2 + 8002578: 60cb str r3, [r1, #12] + 800257a: e006 b.n 800258a + } + else + { + CLEAR_BIT(EXTI->FTSR, iocurrent); + 800257c: 4b19 ldr r3, [pc, #100] ; (80025e4 ) + 800257e: 68da ldr r2, [r3, #12] + 8002580: 69bb ldr r3, [r7, #24] + 8002582: 43db mvns r3, r3 + 8002584: 4917 ldr r1, [pc, #92] ; (80025e4 ) + 8002586: 4013 ands r3, r2 + 8002588: 60cb str r3, [r1, #12] + } + } + } + + position++; + 800258a: 6a7b ldr r3, [r7, #36] ; 0x24 + 800258c: 3301 adds r3, #1 + 800258e: 627b str r3, [r7, #36] ; 0x24 + while (((GPIO_Init->Pin) >> position) != 0x00u) + 8002590: 683b ldr r3, [r7, #0] + 8002592: 681a ldr r2, [r3, #0] + 8002594: 6a7b ldr r3, [r7, #36] ; 0x24 + 8002596: fa22 f303 lsr.w r3, r2, r3 + 800259a: 2b00 cmp r3, #0 + 800259c: f47f aec4 bne.w 8002328 + } +} + 80025a0: bf00 nop + 80025a2: 372c adds r7, #44 ; 0x2c + 80025a4: 46bd mov sp, r7 + 80025a6: bc80 pop {r7} + 80025a8: 4770 bx lr + 80025aa: bf00 nop + 80025ac: 10210000 .word 0x10210000 + 80025b0: 10110000 .word 0x10110000 + 80025b4: 10120000 .word 0x10120000 + 80025b8: 10310000 .word 0x10310000 + 80025bc: 10320000 .word 0x10320000 + 80025c0: 10220000 .word 0x10220000 + 80025c4: 40021000 .word 0x40021000 + 80025c8: 40010000 .word 0x40010000 + 80025cc: 40010800 .word 0x40010800 + 80025d0: 40010c00 .word 0x40010c00 + 80025d4: 40011000 .word 0x40011000 + 80025d8: 40011400 .word 0x40011400 + 80025dc: 40011800 .word 0x40011800 + 80025e0: 40011c00 .word 0x40011c00 + 80025e4: 40010400 .word 0x40010400 + +080025e8 : +{ + 80025e8: b480 push {r7} + 80025ea: b083 sub sp, #12 + 80025ec: af00 add r7, sp, #0 + 80025ee: 6078 str r0, [r7, #4] + SET_BIT(EXTI->IMR, ExtiLine); + 80025f0: 4b05 ldr r3, [pc, #20] ; (8002608 ) + 80025f2: 681a ldr r2, [r3, #0] + 80025f4: 4904 ldr r1, [pc, #16] ; (8002608 ) + 80025f6: 687b ldr r3, [r7, #4] + 80025f8: 4313 orrs r3, r2 + 80025fa: 600b str r3, [r1, #0] +} + 80025fc: bf00 nop + 80025fe: 370c adds r7, #12 + 8002600: 46bd mov sp, r7 + 8002602: bc80 pop {r7} + 8002604: 4770 bx lr + 8002606: bf00 nop + 8002608: 40010400 .word 0x40010400 + +0800260c : +{ + 800260c: b480 push {r7} + 800260e: b083 sub sp, #12 + 8002610: af00 add r7, sp, #0 + 8002612: 6078 str r0, [r7, #4] + CLEAR_BIT(EXTI->IMR, ExtiLine); + 8002614: 4b05 ldr r3, [pc, #20] ; (800262c ) + 8002616: 681a ldr r2, [r3, #0] + 8002618: 687b ldr r3, [r7, #4] + 800261a: 43db mvns r3, r3 + 800261c: 4903 ldr r1, [pc, #12] ; (800262c ) + 800261e: 4013 ands r3, r2 + 8002620: 600b str r3, [r1, #0] +} + 8002622: bf00 nop + 8002624: 370c adds r7, #12 + 8002626: 46bd mov sp, r7 + 8002628: bc80 pop {r7} + 800262a: 4770 bx lr + 800262c: 40010400 .word 0x40010400 + +08002630 : +{ + 8002630: b480 push {r7} + 8002632: b083 sub sp, #12 + 8002634: af00 add r7, sp, #0 + 8002636: 6078 str r0, [r7, #4] + SET_BIT(EXTI->EMR, ExtiLine); + 8002638: 4b05 ldr r3, [pc, #20] ; (8002650 ) + 800263a: 685a ldr r2, [r3, #4] + 800263c: 4904 ldr r1, [pc, #16] ; (8002650 ) + 800263e: 687b ldr r3, [r7, #4] + 8002640: 4313 orrs r3, r2 + 8002642: 604b str r3, [r1, #4] +} + 8002644: bf00 nop + 8002646: 370c adds r7, #12 + 8002648: 46bd mov sp, r7 + 800264a: bc80 pop {r7} + 800264c: 4770 bx lr + 800264e: bf00 nop + 8002650: 40010400 .word 0x40010400 + +08002654 : +{ + 8002654: b480 push {r7} + 8002656: b083 sub sp, #12 + 8002658: af00 add r7, sp, #0 + 800265a: 6078 str r0, [r7, #4] + CLEAR_BIT(EXTI->EMR, ExtiLine); + 800265c: 4b05 ldr r3, [pc, #20] ; (8002674 ) + 800265e: 685a ldr r2, [r3, #4] + 8002660: 687b ldr r3, [r7, #4] + 8002662: 43db mvns r3, r3 + 8002664: 4903 ldr r1, [pc, #12] ; (8002674 ) + 8002666: 4013 ands r3, r2 + 8002668: 604b str r3, [r1, #4] +} + 800266a: bf00 nop + 800266c: 370c adds r7, #12 + 800266e: 46bd mov sp, r7 + 8002670: bc80 pop {r7} + 8002672: 4770 bx lr + 8002674: 40010400 .word 0x40010400 + +08002678 : +{ + 8002678: b480 push {r7} + 800267a: b083 sub sp, #12 + 800267c: af00 add r7, sp, #0 + 800267e: 6078 str r0, [r7, #4] + SET_BIT(EXTI->RTSR, ExtiLine); + 8002680: 4b05 ldr r3, [pc, #20] ; (8002698 ) + 8002682: 689a ldr r2, [r3, #8] + 8002684: 4904 ldr r1, [pc, #16] ; (8002698 ) + 8002686: 687b ldr r3, [r7, #4] + 8002688: 4313 orrs r3, r2 + 800268a: 608b str r3, [r1, #8] +} + 800268c: bf00 nop + 800268e: 370c adds r7, #12 + 8002690: 46bd mov sp, r7 + 8002692: bc80 pop {r7} + 8002694: 4770 bx lr + 8002696: bf00 nop + 8002698: 40010400 .word 0x40010400 + +0800269c : +{ + 800269c: b480 push {r7} + 800269e: b083 sub sp, #12 + 80026a0: af00 add r7, sp, #0 + 80026a2: 6078 str r0, [r7, #4] + CLEAR_BIT(EXTI->RTSR, ExtiLine); + 80026a4: 4b05 ldr r3, [pc, #20] ; (80026bc ) + 80026a6: 689a ldr r2, [r3, #8] + 80026a8: 687b ldr r3, [r7, #4] + 80026aa: 43db mvns r3, r3 + 80026ac: 4903 ldr r1, [pc, #12] ; (80026bc ) + 80026ae: 4013 ands r3, r2 + 80026b0: 608b str r3, [r1, #8] +} + 80026b2: bf00 nop + 80026b4: 370c adds r7, #12 + 80026b6: 46bd mov sp, r7 + 80026b8: bc80 pop {r7} + 80026ba: 4770 bx lr + 80026bc: 40010400 .word 0x40010400 + +080026c0 : +{ + 80026c0: b480 push {r7} + 80026c2: b083 sub sp, #12 + 80026c4: af00 add r7, sp, #0 + 80026c6: 6078 str r0, [r7, #4] + SET_BIT(EXTI->FTSR, ExtiLine); + 80026c8: 4b05 ldr r3, [pc, #20] ; (80026e0 ) + 80026ca: 68da ldr r2, [r3, #12] + 80026cc: 4904 ldr r1, [pc, #16] ; (80026e0 ) + 80026ce: 687b ldr r3, [r7, #4] + 80026d0: 4313 orrs r3, r2 + 80026d2: 60cb str r3, [r1, #12] +} + 80026d4: bf00 nop + 80026d6: 370c adds r7, #12 + 80026d8: 46bd mov sp, r7 + 80026da: bc80 pop {r7} + 80026dc: 4770 bx lr + 80026de: bf00 nop + 80026e0: 40010400 .word 0x40010400 + +080026e4 : +{ + 80026e4: b480 push {r7} + 80026e6: b083 sub sp, #12 + 80026e8: af00 add r7, sp, #0 + 80026ea: 6078 str r0, [r7, #4] + CLEAR_BIT(EXTI->FTSR, ExtiLine); + 80026ec: 4b05 ldr r3, [pc, #20] ; (8002704 ) + 80026ee: 68da ldr r2, [r3, #12] + 80026f0: 687b ldr r3, [r7, #4] + 80026f2: 43db mvns r3, r3 + 80026f4: 4903 ldr r1, [pc, #12] ; (8002704 ) + 80026f6: 4013 ands r3, r2 + 80026f8: 60cb str r3, [r1, #12] +} + 80026fa: bf00 nop + 80026fc: 370c adds r7, #12 + 80026fe: 46bd mov sp, r7 + 8002700: bc80 pop {r7} + 8002702: 4770 bx lr + 8002704: 40010400 .word 0x40010400 + +08002708 : + * @retval An ErrorStatus enumeration value: + * - SUCCESS: EXTI registers are initialized + * - ERROR: not applicable + */ +uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct) +{ + 8002708: b580 push {r7, lr} + 800270a: b084 sub sp, #16 + 800270c: af00 add r7, sp, #0 + 800270e: 6078 str r0, [r7, #4] + ErrorStatus status = SUCCESS; + 8002710: 2300 movs r3, #0 + 8002712: 73fb strb r3, [r7, #15] + assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31)); + assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand)); + assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode)); + + /* ENABLE LineCommand */ + if (EXTI_InitStruct->LineCommand != DISABLE) + 8002714: 687b ldr r3, [r7, #4] + 8002716: 791b ldrb r3, [r3, #4] + 8002718: 2b00 cmp r3, #0 + 800271a: d060 beq.n 80027de + { + assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger)); + + /* Configure EXTI Lines in range from 0 to 31 */ + if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE) + 800271c: 687b ldr r3, [r7, #4] + 800271e: 681b ldr r3, [r3, #0] + 8002720: 2b00 cmp r3, #0 + 8002722: d067 beq.n 80027f4 + { + switch (EXTI_InitStruct->Mode) + 8002724: 687b ldr r3, [r7, #4] + 8002726: 795b ldrb r3, [r3, #5] + 8002728: 2b01 cmp r3, #1 + 800272a: d00e beq.n 800274a + 800272c: 2b02 cmp r3, #2 + 800272e: d017 beq.n 8002760 + 8002730: 2b00 cmp r3, #0 + 8002732: d120 bne.n 8002776 + { + case LL_EXTI_MODE_IT: + /* First Disable Event on provided Lines */ + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + 8002734: 687b ldr r3, [r7, #4] + 8002736: 681b ldr r3, [r3, #0] + 8002738: 4618 mov r0, r3 + 800273a: f7ff ff8b bl 8002654 + /* Then Enable IT on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + 800273e: 687b ldr r3, [r7, #4] + 8002740: 681b ldr r3, [r3, #0] + 8002742: 4618 mov r0, r3 + 8002744: f7ff ff50 bl 80025e8 + break; + 8002748: e018 b.n 800277c + case LL_EXTI_MODE_EVENT: + /* First Disable IT on provided Lines */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + 800274a: 687b ldr r3, [r7, #4] + 800274c: 681b ldr r3, [r3, #0] + 800274e: 4618 mov r0, r3 + 8002750: f7ff ff5c bl 800260c + /* Then Enable Event on provided Lines */ + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + 8002754: 687b ldr r3, [r7, #4] + 8002756: 681b ldr r3, [r3, #0] + 8002758: 4618 mov r0, r3 + 800275a: f7ff ff69 bl 8002630 + break; + 800275e: e00d b.n 800277c + case LL_EXTI_MODE_IT_EVENT: + /* Directly Enable IT & Event on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + 8002760: 687b ldr r3, [r7, #4] + 8002762: 681b ldr r3, [r3, #0] + 8002764: 4618 mov r0, r3 + 8002766: f7ff ff3f bl 80025e8 + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + 800276a: 687b ldr r3, [r7, #4] + 800276c: 681b ldr r3, [r3, #0] + 800276e: 4618 mov r0, r3 + 8002770: f7ff ff5e bl 8002630 + break; + 8002774: e002 b.n 800277c + default: + status = ERROR; + 8002776: 2301 movs r3, #1 + 8002778: 73fb strb r3, [r7, #15] + break; + 800277a: bf00 nop + } + if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE) + 800277c: 687b ldr r3, [r7, #4] + 800277e: 799b ldrb r3, [r3, #6] + 8002780: 2b00 cmp r3, #0 + 8002782: d037 beq.n 80027f4 + { + switch (EXTI_InitStruct->Trigger) + 8002784: 687b ldr r3, [r7, #4] + 8002786: 799b ldrb r3, [r3, #6] + 8002788: 2b02 cmp r3, #2 + 800278a: d00e beq.n 80027aa + 800278c: 2b03 cmp r3, #3 + 800278e: d017 beq.n 80027c0 + 8002790: 2b01 cmp r3, #1 + 8002792: d120 bne.n 80027d6 + { + case LL_EXTI_TRIGGER_RISING: + /* First Disable Falling Trigger on provided Lines */ + LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + 8002794: 687b ldr r3, [r7, #4] + 8002796: 681b ldr r3, [r3, #0] + 8002798: 4618 mov r0, r3 + 800279a: f7ff ffa3 bl 80026e4 + /* Then Enable Rising Trigger on provided Lines */ + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + 800279e: 687b ldr r3, [r7, #4] + 80027a0: 681b ldr r3, [r3, #0] + 80027a2: 4618 mov r0, r3 + 80027a4: f7ff ff68 bl 8002678 + break; + 80027a8: e025 b.n 80027f6 + case LL_EXTI_TRIGGER_FALLING: + /* First Disable Rising Trigger on provided Lines */ + LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + 80027aa: 687b ldr r3, [r7, #4] + 80027ac: 681b ldr r3, [r3, #0] + 80027ae: 4618 mov r0, r3 + 80027b0: f7ff ff74 bl 800269c + /* Then Enable Falling Trigger on provided Lines */ + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + 80027b4: 687b ldr r3, [r7, #4] + 80027b6: 681b ldr r3, [r3, #0] + 80027b8: 4618 mov r0, r3 + 80027ba: f7ff ff81 bl 80026c0 + break; + 80027be: e01a b.n 80027f6 + case LL_EXTI_TRIGGER_RISING_FALLING: + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + 80027c0: 687b ldr r3, [r7, #4] + 80027c2: 681b ldr r3, [r3, #0] + 80027c4: 4618 mov r0, r3 + 80027c6: f7ff ff57 bl 8002678 + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + 80027ca: 687b ldr r3, [r7, #4] + 80027cc: 681b ldr r3, [r3, #0] + 80027ce: 4618 mov r0, r3 + 80027d0: f7ff ff76 bl 80026c0 + break; + 80027d4: e00f b.n 80027f6 + default: + status = ERROR; + 80027d6: 2301 movs r3, #1 + 80027d8: 73fb strb r3, [r7, #15] + break; + 80027da: bf00 nop + 80027dc: e00b b.n 80027f6 + } + /* DISABLE LineCommand */ + else + { + /* De-configure EXTI Lines in range from 0 to 31 */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + 80027de: 687b ldr r3, [r7, #4] + 80027e0: 681b ldr r3, [r3, #0] + 80027e2: 4618 mov r0, r3 + 80027e4: f7ff ff12 bl 800260c + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + 80027e8: 687b ldr r3, [r7, #4] + 80027ea: 681b ldr r3, [r3, #0] + 80027ec: 4618 mov r0, r3 + 80027ee: f7ff ff31 bl 8002654 + 80027f2: e000 b.n 80027f6 + } + 80027f4: bf00 nop + } + return status; + 80027f6: 7bfb ldrb r3, [r7, #15] +} + 80027f8: 4618 mov r0, r3 + 80027fa: 3710 adds r7, #16 + 80027fc: 46bd mov sp, r7 + 80027fe: bd80 pop {r7, pc} + +08002800 : +{ + 8002800: b490 push {r4, r7} + 8002802: b088 sub sp, #32 + 8002804: af00 add r7, sp, #0 + 8002806: 60f8 str r0, [r7, #12] + 8002808: 60b9 str r1, [r7, #8] + 800280a: 607a str r2, [r7, #4] + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + 800280c: 68fb ldr r3, [r7, #12] + 800280e: 461a mov r2, r3 + 8002810: 68bb ldr r3, [r7, #8] + 8002812: 0e1b lsrs r3, r3, #24 + 8002814: 4413 add r3, r2 + 8002816: 461c mov r4, r3 + MODIFY_REG(*pReg, ((GPIO_CRL_CNF0 | GPIO_CRL_MODE0) << (POSITION_VAL(Pin) * 4U)), (Mode << (POSITION_VAL(Pin) * 4U))); + 8002818: 6822 ldr r2, [r4, #0] + 800281a: 68bb ldr r3, [r7, #8] + 800281c: 617b str r3, [r7, #20] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 800281e: 697b ldr r3, [r7, #20] + 8002820: fa93 f3a3 rbit r3, r3 + 8002824: 613b str r3, [r7, #16] + return result; + 8002826: 693b ldr r3, [r7, #16] + 8002828: fab3 f383 clz r3, r3 + 800282c: b2db uxtb r3, r3 + 800282e: 009b lsls r3, r3, #2 + 8002830: 210f movs r1, #15 + 8002832: fa01 f303 lsl.w r3, r1, r3 + 8002836: 43db mvns r3, r3 + 8002838: 401a ands r2, r3 + 800283a: 68bb ldr r3, [r7, #8] + 800283c: 61fb str r3, [r7, #28] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 800283e: 69fb ldr r3, [r7, #28] + 8002840: fa93 f3a3 rbit r3, r3 + 8002844: 61bb str r3, [r7, #24] + return result; + 8002846: 69bb ldr r3, [r7, #24] + 8002848: fab3 f383 clz r3, r3 + 800284c: b2db uxtb r3, r3 + 800284e: 009b lsls r3, r3, #2 + 8002850: 6879 ldr r1, [r7, #4] + 8002852: fa01 f303 lsl.w r3, r1, r3 + 8002856: 4313 orrs r3, r2 + 8002858: 6023 str r3, [r4, #0] +} + 800285a: bf00 nop + 800285c: 3720 adds r7, #32 + 800285e: 46bd mov sp, r7 + 8002860: bc90 pop {r4, r7} + 8002862: 4770 bx lr + +08002864 : +{ + 8002864: b490 push {r4, r7} + 8002866: b088 sub sp, #32 + 8002868: af00 add r7, sp, #0 + 800286a: 60f8 str r0, [r7, #12] + 800286c: 60b9 str r1, [r7, #8] + 800286e: 607a str r2, [r7, #4] + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + 8002870: 68fb ldr r3, [r7, #12] + 8002872: 461a mov r2, r3 + 8002874: 68bb ldr r3, [r7, #8] + 8002876: 0e1b lsrs r3, r3, #24 + 8002878: 4413 add r3, r2 + 800287a: 461c mov r4, r3 + MODIFY_REG(*pReg, (GPIO_CRL_MODE0 << (POSITION_VAL(Pin) * 4U)), + 800287c: 6822 ldr r2, [r4, #0] + 800287e: 68bb ldr r3, [r7, #8] + 8002880: 617b str r3, [r7, #20] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 8002882: 697b ldr r3, [r7, #20] + 8002884: fa93 f3a3 rbit r3, r3 + 8002888: 613b str r3, [r7, #16] + return result; + 800288a: 693b ldr r3, [r7, #16] + 800288c: fab3 f383 clz r3, r3 + 8002890: b2db uxtb r3, r3 + 8002892: 009b lsls r3, r3, #2 + 8002894: 2103 movs r1, #3 + 8002896: fa01 f303 lsl.w r3, r1, r3 + 800289a: 43db mvns r3, r3 + 800289c: 401a ands r2, r3 + 800289e: 68bb ldr r3, [r7, #8] + 80028a0: 61fb str r3, [r7, #28] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 80028a2: 69fb ldr r3, [r7, #28] + 80028a4: fa93 f3a3 rbit r3, r3 + 80028a8: 61bb str r3, [r7, #24] + return result; + 80028aa: 69bb ldr r3, [r7, #24] + 80028ac: fab3 f383 clz r3, r3 + 80028b0: b2db uxtb r3, r3 + 80028b2: 009b lsls r3, r3, #2 + 80028b4: 6879 ldr r1, [r7, #4] + 80028b6: fa01 f303 lsl.w r3, r1, r3 + 80028ba: 4313 orrs r3, r2 + 80028bc: 6023 str r3, [r4, #0] +} + 80028be: bf00 nop + 80028c0: 3720 adds r7, #32 + 80028c2: 46bd mov sp, r7 + 80028c4: bc90 pop {r4, r7} + 80028c6: 4770 bx lr + +080028c8 : +{ + 80028c8: b490 push {r4, r7} + 80028ca: b088 sub sp, #32 + 80028cc: af00 add r7, sp, #0 + 80028ce: 60f8 str r0, [r7, #12] + 80028d0: 60b9 str r1, [r7, #8] + 80028d2: 607a str r2, [r7, #4] + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + 80028d4: 68fb ldr r3, [r7, #12] + 80028d6: 461a mov r2, r3 + 80028d8: 68bb ldr r3, [r7, #8] + 80028da: 0e1b lsrs r3, r3, #24 + 80028dc: 4413 add r3, r2 + 80028de: 461c mov r4, r3 + MODIFY_REG(*pReg, (GPIO_CRL_CNF0_0 << (POSITION_VAL(Pin) * 4U)), + 80028e0: 6822 ldr r2, [r4, #0] + 80028e2: 68bb ldr r3, [r7, #8] + 80028e4: 617b str r3, [r7, #20] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 80028e6: 697b ldr r3, [r7, #20] + 80028e8: fa93 f3a3 rbit r3, r3 + 80028ec: 613b str r3, [r7, #16] + return result; + 80028ee: 693b ldr r3, [r7, #16] + 80028f0: fab3 f383 clz r3, r3 + 80028f4: b2db uxtb r3, r3 + 80028f6: 009b lsls r3, r3, #2 + 80028f8: 2104 movs r1, #4 + 80028fa: fa01 f303 lsl.w r3, r1, r3 + 80028fe: 43db mvns r3, r3 + 8002900: 401a ands r2, r3 + 8002902: 68bb ldr r3, [r7, #8] + 8002904: 61fb str r3, [r7, #28] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 8002906: 69fb ldr r3, [r7, #28] + 8002908: fa93 f3a3 rbit r3, r3 + 800290c: 61bb str r3, [r7, #24] + return result; + 800290e: 69bb ldr r3, [r7, #24] + 8002910: fab3 f383 clz r3, r3 + 8002914: b2db uxtb r3, r3 + 8002916: 009b lsls r3, r3, #2 + 8002918: 6879 ldr r1, [r7, #4] + 800291a: fa01 f303 lsl.w r3, r1, r3 + 800291e: 4313 orrs r3, r2 + 8002920: 6023 str r3, [r4, #0] +} + 8002922: bf00 nop + 8002924: 3720 adds r7, #32 + 8002926: 46bd mov sp, r7 + 8002928: bc90 pop {r4, r7} + 800292a: 4770 bx lr + +0800292c : +{ + 800292c: b480 push {r7} + 800292e: b087 sub sp, #28 + 8002930: af00 add r7, sp, #0 + 8002932: 60f8 str r0, [r7, #12] + 8002934: 60b9 str r1, [r7, #8] + 8002936: 607a str r2, [r7, #4] + MODIFY_REG(GPIOx->ODR, (Pin >> GPIO_PIN_MASK_POS), Pull << (POSITION_VAL(Pin >> GPIO_PIN_MASK_POS))); + 8002938: 68fb ldr r3, [r7, #12] + 800293a: 68da ldr r2, [r3, #12] + 800293c: 68bb ldr r3, [r7, #8] + 800293e: 0a1b lsrs r3, r3, #8 + 8002940: 43db mvns r3, r3 + 8002942: 401a ands r2, r3 + 8002944: 68bb ldr r3, [r7, #8] + 8002946: 0a1b lsrs r3, r3, #8 + 8002948: 617b str r3, [r7, #20] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 800294a: 697b ldr r3, [r7, #20] + 800294c: fa93 f3a3 rbit r3, r3 + 8002950: 613b str r3, [r7, #16] + return result; + 8002952: 693b ldr r3, [r7, #16] + 8002954: fab3 f383 clz r3, r3 + 8002958: b2db uxtb r3, r3 + 800295a: 4619 mov r1, r3 + 800295c: 687b ldr r3, [r7, #4] + 800295e: 408b lsls r3, r1 + 8002960: 431a orrs r2, r3 + 8002962: 68fb ldr r3, [r7, #12] + 8002964: 60da str r2, [r3, #12] +} + 8002966: bf00 nop + 8002968: 371c adds r7, #28 + 800296a: 46bd mov sp, r7 + 800296c: bc80 pop {r7} + 800296e: 4770 bx lr + +08002970 : + * @retval An ErrorStatus enumeration value: + * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content + * - ERROR: Not applicable + */ +ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) +{ + 8002970: b580 push {r7, lr} + 8002972: b088 sub sp, #32 + 8002974: af00 add r7, sp, #0 + 8002976: 6078 str r0, [r7, #4] + 8002978: 6039 str r1, [r7, #0] + assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); + + /* ------------------------- Configure the port pins ---------------- */ + /* Initialize pinpos on first pin set */ + + pinmask = ((GPIO_InitStruct->Pin) << GPIO_PIN_MASK_POS) >> GPIO_PIN_NB; + 800297a: 683b ldr r3, [r7, #0] + 800297c: 681b ldr r3, [r3, #0] + 800297e: 021b lsls r3, r3, #8 + 8002980: 0c1b lsrs r3, r3, #16 + 8002982: 617b str r3, [r7, #20] + 8002984: 697b ldr r3, [r7, #20] + 8002986: 613b str r3, [r7, #16] + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + 8002988: 693b ldr r3, [r7, #16] + 800298a: fa93 f3a3 rbit r3, r3 + 800298e: 60fb str r3, [r7, #12] + return result; + 8002990: 68fb ldr r3, [r7, #12] + pinpos = POSITION_VAL(pinmask); + 8002992: fab3 f383 clz r3, r3 + 8002996: b2db uxtb r3, r3 + 8002998: 61fb str r3, [r7, #28] + + /* Configure the port pins */ + while ((pinmask >> pinpos) != 0u) + 800299a: e044 b.n 8002a26 + { + /* skip if bit is not set */ + if ((pinmask & (1u << pinpos)) != 0u) + 800299c: 2201 movs r2, #1 + 800299e: 69fb ldr r3, [r7, #28] + 80029a0: 409a lsls r2, r3 + 80029a2: 697b ldr r3, [r7, #20] + 80029a4: 4013 ands r3, r2 + 80029a6: 2b00 cmp r3, #0 + 80029a8: d03a beq.n 8002a20 + { + /* Get current io position */ + if (pinpos < GPIO_PIN_MASK_POS) + 80029aa: 69fb ldr r3, [r7, #28] + 80029ac: 2b07 cmp r3, #7 + 80029ae: d806 bhi.n 80029be + { + currentpin = (0x00000101uL << pinpos); + 80029b0: f240 1201 movw r2, #257 ; 0x101 + 80029b4: 69fb ldr r3, [r7, #28] + 80029b6: fa02 f303 lsl.w r3, r2, r3 + 80029ba: 61bb str r3, [r7, #24] + 80029bc: e008 b.n 80029d0 + } + else + { + currentpin = ((0x00010001u << (pinpos - GPIO_PIN_MASK_POS)) | 0x04000000u); + 80029be: 69fb ldr r3, [r7, #28] + 80029c0: 3b08 subs r3, #8 + 80029c2: f04f 1201 mov.w r2, #65537 ; 0x10001 + 80029c6: fa02 f303 lsl.w r3, r2, r3 + 80029ca: f043 6380 orr.w r3, r3, #67108864 ; 0x4000000 + 80029ce: 61bb str r3, [r7, #24] + } + + if (GPIO_InitStruct->Mode == LL_GPIO_MODE_INPUT) + 80029d0: 683b ldr r3, [r7, #0] + 80029d2: 685b ldr r3, [r3, #4] + 80029d4: 2b08 cmp r3, #8 + 80029d6: d106 bne.n 80029e6 + { + /* Check The Pull parameter */ + assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); + + /* Pull-up Pull-down resistor configuration*/ + LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); + 80029d8: 683b ldr r3, [r7, #0] + 80029da: 691b ldr r3, [r3, #16] + 80029dc: 461a mov r2, r3 + 80029de: 69b9 ldr r1, [r7, #24] + 80029e0: 6878 ldr r0, [r7, #4] + 80029e2: f7ff ffa3 bl 800292c + + /* Check Pin Mode parameters */ + assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); + + /* Pin Mode configuration */ + LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); + 80029e6: 683b ldr r3, [r7, #0] + 80029e8: 685b ldr r3, [r3, #4] + 80029ea: 461a mov r2, r3 + 80029ec: 69b9 ldr r1, [r7, #24] + 80029ee: 6878 ldr r0, [r7, #4] + 80029f0: f7ff ff06 bl 8002800 + + if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) + 80029f4: 683b ldr r3, [r7, #0] + 80029f6: 685b ldr r3, [r3, #4] + 80029f8: 2b01 cmp r3, #1 + 80029fa: d003 beq.n 8002a04 + 80029fc: 683b ldr r3, [r7, #0] + 80029fe: 685b ldr r3, [r3, #4] + 8002a00: 2b09 cmp r3, #9 + 8002a02: d10d bne.n 8002a20 + /* Check speed and Output mode parameters */ + assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); + assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); + + /* Speed mode configuration */ + LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); + 8002a04: 683b ldr r3, [r7, #0] + 8002a06: 689b ldr r3, [r3, #8] + 8002a08: 461a mov r2, r3 + 8002a0a: 69b9 ldr r1, [r7, #24] + 8002a0c: 6878 ldr r0, [r7, #4] + 8002a0e: f7ff ff29 bl 8002864 + + /* Output mode configuration*/ + LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType); + 8002a12: 683b ldr r3, [r7, #0] + 8002a14: 68db ldr r3, [r3, #12] + 8002a16: 461a mov r2, r3 + 8002a18: 69b9 ldr r1, [r7, #24] + 8002a1a: 6878 ldr r0, [r7, #4] + 8002a1c: f7ff ff54 bl 80028c8 + } + } + pinpos++; + 8002a20: 69fb ldr r3, [r7, #28] + 8002a22: 3301 adds r3, #1 + 8002a24: 61fb str r3, [r7, #28] + while ((pinmask >> pinpos) != 0u) + 8002a26: 697a ldr r2, [r7, #20] + 8002a28: 69fb ldr r3, [r7, #28] + 8002a2a: fa22 f303 lsr.w r3, r2, r3 + 8002a2e: 2b00 cmp r3, #0 + 8002a30: d1b4 bne.n 800299c + } + return (SUCCESS); + 8002a32: 2300 movs r3, #0 +} + 8002a34: 4618 mov r0, r3 + 8002a36: 3720 adds r7, #32 + 8002a38: 46bd mov sp, r7 + 8002a3a: bd80 pop {r7, pc} + +08002a3c : +{ + 8002a3c: b480 push {r7} + 8002a3e: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS)); + 8002a40: 4b03 ldr r3, [pc, #12] ; (8002a50 ) + 8002a42: 685b ldr r3, [r3, #4] + 8002a44: f003 030c and.w r3, r3, #12 +} + 8002a48: 4618 mov r0, r3 + 8002a4a: 46bd mov sp, r7 + 8002a4c: bc80 pop {r7} + 8002a4e: 4770 bx lr + 8002a50: 40021000 .word 0x40021000 + +08002a54 : +{ + 8002a54: b480 push {r7} + 8002a56: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE)); + 8002a58: 4b03 ldr r3, [pc, #12] ; (8002a68 ) + 8002a5a: 685b ldr r3, [r3, #4] + 8002a5c: f003 03f0 and.w r3, r3, #240 ; 0xf0 +} + 8002a60: 4618 mov r0, r3 + 8002a62: 46bd mov sp, r7 + 8002a64: bc80 pop {r7} + 8002a66: 4770 bx lr + 8002a68: 40021000 .word 0x40021000 + +08002a6c : +{ + 8002a6c: b480 push {r7} + 8002a6e: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE1)); + 8002a70: 4b03 ldr r3, [pc, #12] ; (8002a80 ) + 8002a72: 685b ldr r3, [r3, #4] + 8002a74: f403 63e0 and.w r3, r3, #1792 ; 0x700 +} + 8002a78: 4618 mov r0, r3 + 8002a7a: 46bd mov sp, r7 + 8002a7c: bc80 pop {r7} + 8002a7e: 4770 bx lr + 8002a80: 40021000 .word 0x40021000 + +08002a84 : +{ + 8002a84: b480 push {r7} + 8002a86: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE2)); + 8002a88: 4b03 ldr r3, [pc, #12] ; (8002a98 ) + 8002a8a: 685b ldr r3, [r3, #4] + 8002a8c: f403 5360 and.w r3, r3, #14336 ; 0x3800 +} + 8002a90: 4618 mov r0, r3 + 8002a92: 46bd mov sp, r7 + 8002a94: bc80 pop {r7} + 8002a96: 4770 bx lr + 8002a98: 40021000 .word 0x40021000 + +08002a9c : + * @arg @ref LL_RCC_PLLSOURCE_PLL2 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void) +{ + 8002a9c: b480 push {r7} + 8002a9e: af00 add r7, sp, #0 +#if defined(RCC_CFGR2_PREDIV1SRC) + uint32_t pllsrc = READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC); + uint32_t predivsrc = (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC) << 4U); + return (uint32_t)(pllsrc | predivsrc); +#else + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC)); + 8002aa0: 4b03 ldr r3, [pc, #12] ; (8002ab0 ) + 8002aa2: 685b ldr r3, [r3, #4] + 8002aa4: f403 3380 and.w r3, r3, #65536 ; 0x10000 +#endif /*RCC_CFGR2_PREDIV1SRC*/ +} + 8002aa8: 4618 mov r0, r3 + 8002aaa: 46bd mov sp, r7 + 8002aac: bc80 pop {r7} + 8002aae: 4770 bx lr + 8002ab0: 40021000 .word 0x40021000 + +08002ab4 : + * @arg @ref LL_RCC_PLL_MUL_16 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetMultiplicator(void) +{ + 8002ab4: b480 push {r7} + 8002ab6: af00 add r7, sp, #0 + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLMULL)); + 8002ab8: 4b03 ldr r3, [pc, #12] ; (8002ac8 ) + 8002aba: 685b ldr r3, [r3, #4] + 8002abc: f403 1370 and.w r3, r3, #3932160 ; 0x3c0000 +} + 8002ac0: 4618 mov r0, r3 + 8002ac2: 46bd mov sp, r7 + 8002ac4: bc80 pop {r7} + 8002ac6: 4770 bx lr + 8002ac8: 40021000 .word 0x40021000 + +08002acc : + * @arg @ref LL_RCC_PREDIV_DIV_16 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetPrediv(void) +{ + 8002acc: b480 push {r7} + 8002ace: af00 add r7, sp, #0 +#if defined(RCC_CFGR2_PREDIV1) + return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1)); +#else + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLXTPRE) >> RCC_CFGR_PLLXTPRE_Pos); + 8002ad0: 4b04 ldr r3, [pc, #16] ; (8002ae4 ) + 8002ad2: 685b ldr r3, [r3, #4] + 8002ad4: 0c5b lsrs r3, r3, #17 + 8002ad6: f003 0301 and.w r3, r3, #1 +#endif /*RCC_CFGR2_PREDIV1*/ +} + 8002ada: 4618 mov r0, r3 + 8002adc: 46bd mov sp, r7 + 8002ade: bc80 pop {r7} + 8002ae0: 4770 bx lr + 8002ae2: bf00 nop + 8002ae4: 40021000 .word 0x40021000 + +08002ae8 : + * configuration based on this function will be incorrect. + * @param RCC_Clocks pointer to a @ref LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies + * @retval None + */ +void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks) +{ + 8002ae8: b580 push {r7, lr} + 8002aea: b082 sub sp, #8 + 8002aec: af00 add r7, sp, #0 + 8002aee: 6078 str r0, [r7, #4] + /* Get SYSCLK frequency */ + RCC_Clocks->SYSCLK_Frequency = RCC_GetSystemClockFreq(); + 8002af0: f000 f820 bl 8002b34 + 8002af4: 4602 mov r2, r0 + 8002af6: 687b ldr r3, [r7, #4] + 8002af8: 601a str r2, [r3, #0] + + /* HCLK clock frequency */ + RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency); + 8002afa: 687b ldr r3, [r7, #4] + 8002afc: 681b ldr r3, [r3, #0] + 8002afe: 4618 mov r0, r3 + 8002b00: f000 f83a bl 8002b78 + 8002b04: 4602 mov r2, r0 + 8002b06: 687b ldr r3, [r7, #4] + 8002b08: 605a str r2, [r3, #4] + + /* PCLK1 clock frequency */ + RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency); + 8002b0a: 687b ldr r3, [r7, #4] + 8002b0c: 685b ldr r3, [r3, #4] + 8002b0e: 4618 mov r0, r3 + 8002b10: f000 f848 bl 8002ba4 + 8002b14: 4602 mov r2, r0 + 8002b16: 687b ldr r3, [r7, #4] + 8002b18: 609a str r2, [r3, #8] + + /* PCLK2 clock frequency */ + RCC_Clocks->PCLK2_Frequency = RCC_GetPCLK2ClockFreq(RCC_Clocks->HCLK_Frequency); + 8002b1a: 687b ldr r3, [r7, #4] + 8002b1c: 685b ldr r3, [r3, #4] + 8002b1e: 4618 mov r0, r3 + 8002b20: f000 f854 bl 8002bcc + 8002b24: 4602 mov r2, r0 + 8002b26: 687b ldr r3, [r7, #4] + 8002b28: 60da str r2, [r3, #12] +} + 8002b2a: bf00 nop + 8002b2c: 3708 adds r7, #8 + 8002b2e: 46bd mov sp, r7 + 8002b30: bd80 pop {r7, pc} + ... + +08002b34 : +/** + * @brief Return SYSTEM clock frequency + * @retval SYSTEM clock frequency (in Hz) + */ +uint32_t RCC_GetSystemClockFreq(void) +{ + 8002b34: b580 push {r7, lr} + 8002b36: b082 sub sp, #8 + 8002b38: af00 add r7, sp, #0 + uint32_t frequency = 0U; + 8002b3a: 2300 movs r3, #0 + 8002b3c: 607b str r3, [r7, #4] + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (LL_RCC_GetSysClkSource()) + 8002b3e: f7ff ff7d bl 8002a3c + 8002b42: 4603 mov r3, r0 + 8002b44: 2b04 cmp r3, #4 + 8002b46: d006 beq.n 8002b56 + 8002b48: 2b08 cmp r3, #8 + 8002b4a: d007 beq.n 8002b5c + 8002b4c: 2b00 cmp r3, #0 + 8002b4e: d109 bne.n 8002b64 + { + case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: /* HSI used as system clock source */ + frequency = HSI_VALUE; + 8002b50: 4b08 ldr r3, [pc, #32] ; (8002b74 ) + 8002b52: 607b str r3, [r7, #4] + break; + 8002b54: e009 b.n 8002b6a + + case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: /* HSE used as system clock source */ + frequency = HSE_VALUE; + 8002b56: 4b07 ldr r3, [pc, #28] ; (8002b74 ) + 8002b58: 607b str r3, [r7, #4] + break; + 8002b5a: e006 b.n 8002b6a + + case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: /* PLL used as system clock source */ + frequency = RCC_PLL_GetFreqDomain_SYS(); + 8002b5c: f000 f84a bl 8002bf4 + 8002b60: 6078 str r0, [r7, #4] + break; + 8002b62: e002 b.n 8002b6a + + default: + frequency = HSI_VALUE; + 8002b64: 4b03 ldr r3, [pc, #12] ; (8002b74 ) + 8002b66: 607b str r3, [r7, #4] + break; + 8002b68: bf00 nop + } + + return frequency; + 8002b6a: 687b ldr r3, [r7, #4] +} + 8002b6c: 4618 mov r0, r3 + 8002b6e: 3708 adds r7, #8 + 8002b70: 46bd mov sp, r7 + 8002b72: bd80 pop {r7, pc} + 8002b74: 007a1200 .word 0x007a1200 + +08002b78 : + * @brief Return HCLK clock frequency + * @param SYSCLK_Frequency SYSCLK clock frequency + * @retval HCLK clock frequency (in Hz) + */ +uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency) +{ + 8002b78: b580 push {r7, lr} + 8002b7a: b082 sub sp, #8 + 8002b7c: af00 add r7, sp, #0 + 8002b7e: 6078 str r0, [r7, #4] + /* HCLK clock frequency */ + return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler()); + 8002b80: f7ff ff68 bl 8002a54 + 8002b84: 4603 mov r3, r0 + 8002b86: 091b lsrs r3, r3, #4 + 8002b88: f003 030f and.w r3, r3, #15 + 8002b8c: 4a04 ldr r2, [pc, #16] ; (8002ba0 ) + 8002b8e: 5cd3 ldrb r3, [r2, r3] + 8002b90: 461a mov r2, r3 + 8002b92: 687b ldr r3, [r7, #4] + 8002b94: 40d3 lsrs r3, r2 +} + 8002b96: 4618 mov r0, r3 + 8002b98: 3708 adds r7, #8 + 8002b9a: 46bd mov sp, r7 + 8002b9c: bd80 pop {r7, pc} + 8002b9e: bf00 nop + 8002ba0: 0800aed0 .word 0x0800aed0 + +08002ba4 : + * @brief Return PCLK1 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK1 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency) +{ + 8002ba4: b580 push {r7, lr} + 8002ba6: b082 sub sp, #8 + 8002ba8: af00 add r7, sp, #0 + 8002baa: 6078 str r0, [r7, #4] + /* PCLK1 clock frequency */ + return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler()); + 8002bac: f7ff ff5e bl 8002a6c + 8002bb0: 4603 mov r3, r0 + 8002bb2: 0a1b lsrs r3, r3, #8 + 8002bb4: 4a04 ldr r2, [pc, #16] ; (8002bc8 ) + 8002bb6: 5cd3 ldrb r3, [r2, r3] + 8002bb8: 461a mov r2, r3 + 8002bba: 687b ldr r3, [r7, #4] + 8002bbc: 40d3 lsrs r3, r2 +} + 8002bbe: 4618 mov r0, r3 + 8002bc0: 3708 adds r7, #8 + 8002bc2: 46bd mov sp, r7 + 8002bc4: bd80 pop {r7, pc} + 8002bc6: bf00 nop + 8002bc8: 0800aee0 .word 0x0800aee0 + +08002bcc : + * @brief Return PCLK2 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK2 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency) +{ + 8002bcc: b580 push {r7, lr} + 8002bce: b082 sub sp, #8 + 8002bd0: af00 add r7, sp, #0 + 8002bd2: 6078 str r0, [r7, #4] + /* PCLK2 clock frequency */ + return __LL_RCC_CALC_PCLK2_FREQ(HCLK_Frequency, LL_RCC_GetAPB2Prescaler()); + 8002bd4: f7ff ff56 bl 8002a84 + 8002bd8: 4603 mov r3, r0 + 8002bda: 0adb lsrs r3, r3, #11 + 8002bdc: 4a04 ldr r2, [pc, #16] ; (8002bf0 ) + 8002bde: 5cd3 ldrb r3, [r2, r3] + 8002be0: 461a mov r2, r3 + 8002be2: 687b ldr r3, [r7, #4] + 8002be4: 40d3 lsrs r3, r2 +} + 8002be6: 4618 mov r0, r3 + 8002be8: 3708 adds r7, #8 + 8002bea: 46bd mov sp, r7 + 8002bec: bd80 pop {r7, pc} + 8002bee: bf00 nop + 8002bf0: 0800aee0 .word 0x0800aee0 + +08002bf4 : +/** + * @brief Return PLL clock frequency used for system domain + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_SYS(void) +{ + 8002bf4: b580 push {r7, lr} + 8002bf6: b082 sub sp, #8 + 8002bf8: af00 add r7, sp, #0 + uint32_t pllinputfreq = 0U, pllsource = 0U; + 8002bfa: 2300 movs r3, #0 + 8002bfc: 607b str r3, [r7, #4] + 8002bfe: 2300 movs r3, #0 + 8002c00: 603b str r3, [r7, #0] + + /* PLL_VCO = (HSE_VALUE, HSI_VALUE or PLL2 / PLL Predivider) * PLL Multiplicator */ + + /* Get PLL source */ + pllsource = LL_RCC_PLL_GetMainSource(); + 8002c02: f7ff ff4b bl 8002a9c + 8002c06: 6038 str r0, [r7, #0] + + switch (pllsource) + 8002c08: 683b ldr r3, [r7, #0] + 8002c0a: 2b00 cmp r3, #0 + 8002c0c: d003 beq.n 8002c16 + 8002c0e: f5b3 3f80 cmp.w r3, #65536 ; 0x10000 + 8002c12: d003 beq.n 8002c1c + 8002c14: e00b b.n 8002c2e + { + case LL_RCC_PLLSOURCE_HSI_DIV_2: /* HSI used as PLL clock source */ + pllinputfreq = HSI_VALUE / 2U; + 8002c16: 4b0d ldr r3, [pc, #52] ; (8002c4c ) + 8002c18: 607b str r3, [r7, #4] + break; + 8002c1a: e00b b.n 8002c34 + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE / (LL_RCC_PLL_GetPrediv() + 1U); + 8002c1c: f7ff ff56 bl 8002acc + 8002c20: 4603 mov r3, r0 + 8002c22: 3301 adds r3, #1 + 8002c24: 4a0a ldr r2, [pc, #40] ; (8002c50 ) + 8002c26: fbb2 f3f3 udiv r3, r2, r3 + 8002c2a: 607b str r3, [r7, #4] + break; + 8002c2c: e002 b.n 8002c34 + pllinputfreq = RCC_PLL2_GetFreqClockFreq() / (LL_RCC_PLL_GetPrediv() + 1U); + break; +#endif /* RCC_PLL2_SUPPORT */ + + default: + pllinputfreq = HSI_VALUE / 2U; + 8002c2e: 4b07 ldr r3, [pc, #28] ; (8002c4c ) + 8002c30: 607b str r3, [r7, #4] + break; + 8002c32: bf00 nop + } + return __LL_RCC_CALC_PLLCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetMultiplicator()); + 8002c34: f7ff ff3e bl 8002ab4 + 8002c38: 4603 mov r3, r0 + 8002c3a: 0c9b lsrs r3, r3, #18 + 8002c3c: 3302 adds r3, #2 + 8002c3e: 687a ldr r2, [r7, #4] + 8002c40: fb02 f303 mul.w r3, r2, r3 +} + 8002c44: 4618 mov r0, r3 + 8002c46: 3708 adds r7, #8 + 8002c48: 46bd mov sp, r7 + 8002c4a: bd80 pop {r7, pc} + 8002c4c: 003d0900 .word 0x003d0900 + 8002c50: 007a1200 .word 0x007a1200 + +08002c54 : +{ + 8002c54: b480 push {r7} + 8002c56: b083 sub sp, #12 + 8002c58: af00 add r7, sp, #0 + 8002c5a: 6078 str r0, [r7, #4] + 8002c5c: 6039 str r1, [r7, #0] + WRITE_REG(TIMx->PSC, Prescaler); + 8002c5e: 687b ldr r3, [r7, #4] + 8002c60: 683a ldr r2, [r7, #0] + 8002c62: 629a str r2, [r3, #40] ; 0x28 +} + 8002c64: bf00 nop + 8002c66: 370c adds r7, #12 + 8002c68: 46bd mov sp, r7 + 8002c6a: bc80 pop {r7} + 8002c6c: 4770 bx lr + +08002c6e : +{ + 8002c6e: b480 push {r7} + 8002c70: b083 sub sp, #12 + 8002c72: af00 add r7, sp, #0 + 8002c74: 6078 str r0, [r7, #4] + 8002c76: 6039 str r1, [r7, #0] + WRITE_REG(TIMx->ARR, AutoReload); + 8002c78: 687b ldr r3, [r7, #4] + 8002c7a: 683a ldr r2, [r7, #0] + 8002c7c: 62da str r2, [r3, #44] ; 0x2c +} + 8002c7e: bf00 nop + 8002c80: 370c adds r7, #12 + 8002c82: 46bd mov sp, r7 + 8002c84: bc80 pop {r7} + 8002c86: 4770 bx lr + +08002c88 : +{ + 8002c88: b480 push {r7} + 8002c8a: b083 sub sp, #12 + 8002c8c: af00 add r7, sp, #0 + 8002c8e: 6078 str r0, [r7, #4] + 8002c90: 6039 str r1, [r7, #0] + WRITE_REG(TIMx->RCR, RepetitionCounter); + 8002c92: 687b ldr r3, [r7, #4] + 8002c94: 683a ldr r2, [r7, #0] + 8002c96: 631a str r2, [r3, #48] ; 0x30 +} + 8002c98: bf00 nop + 8002c9a: 370c adds r7, #12 + 8002c9c: 46bd mov sp, r7 + 8002c9e: bc80 pop {r7} + 8002ca0: 4770 bx lr + +08002ca2 : + * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx) +{ + 8002ca2: b480 push {r7} + 8002ca4: b083 sub sp, #12 + 8002ca6: af00 add r7, sp, #0 + 8002ca8: 6078 str r0, [r7, #4] + SET_BIT(TIMx->EGR, TIM_EGR_UG); + 8002caa: 687b ldr r3, [r7, #4] + 8002cac: 695b ldr r3, [r3, #20] + 8002cae: f043 0201 orr.w r2, r3, #1 + 8002cb2: 687b ldr r3, [r7, #4] + 8002cb4: 615a str r2, [r3, #20] +} + 8002cb6: bf00 nop + 8002cb8: 370c adds r7, #12 + 8002cba: 46bd mov sp, r7 + 8002cbc: bc80 pop {r7} + 8002cbe: 4770 bx lr + +08002cc0 : + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct) +{ + 8002cc0: b580 push {r7, lr} + 8002cc2: b084 sub sp, #16 + 8002cc4: af00 add r7, sp, #0 + 8002cc6: 6078 str r0, [r7, #4] + 8002cc8: 6039 str r1, [r7, #0] + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode)); + assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision)); + + tmpcr1 = LL_TIM_ReadReg(TIMx, CR1); + 8002cca: 687b ldr r3, [r7, #4] + 8002ccc: 681b ldr r3, [r3, #0] + 8002cce: 60fb str r3, [r7, #12] + + if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) + 8002cd0: 687b ldr r3, [r7, #4] + 8002cd2: 4a31 ldr r2, [pc, #196] ; (8002d98 ) + 8002cd4: 4293 cmp r3, r2 + 8002cd6: d013 beq.n 8002d00 + 8002cd8: 687b ldr r3, [r7, #4] + 8002cda: 4a30 ldr r2, [pc, #192] ; (8002d9c ) + 8002cdc: 4293 cmp r3, r2 + 8002cde: d00f beq.n 8002d00 + 8002ce0: 687b ldr r3, [r7, #4] + 8002ce2: f1b3 4f80 cmp.w r3, #1073741824 ; 0x40000000 + 8002ce6: d00b beq.n 8002d00 + 8002ce8: 687b ldr r3, [r7, #4] + 8002cea: 4a2d ldr r2, [pc, #180] ; (8002da0 ) + 8002cec: 4293 cmp r3, r2 + 8002cee: d007 beq.n 8002d00 + 8002cf0: 687b ldr r3, [r7, #4] + 8002cf2: 4a2c ldr r2, [pc, #176] ; (8002da4 ) + 8002cf4: 4293 cmp r3, r2 + 8002cf6: d003 beq.n 8002d00 + 8002cf8: 687b ldr r3, [r7, #4] + 8002cfa: 4a2b ldr r2, [pc, #172] ; (8002da8 ) + 8002cfc: 4293 cmp r3, r2 + 8002cfe: d106 bne.n 8002d0e + { + /* Select the Counter Mode */ + MODIFY_REG(tmpcr1, (TIM_CR1_DIR | TIM_CR1_CMS), TIM_InitStruct->CounterMode); + 8002d00: 68fb ldr r3, [r7, #12] + 8002d02: f023 0270 bic.w r2, r3, #112 ; 0x70 + 8002d06: 683b ldr r3, [r7, #0] + 8002d08: 685b ldr r3, [r3, #4] + 8002d0a: 4313 orrs r3, r2 + 8002d0c: 60fb str r3, [r7, #12] + } + + if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) + 8002d0e: 687b ldr r3, [r7, #4] + 8002d10: 4a21 ldr r2, [pc, #132] ; (8002d98 ) + 8002d12: 4293 cmp r3, r2 + 8002d14: d013 beq.n 8002d3e + 8002d16: 687b ldr r3, [r7, #4] + 8002d18: 4a20 ldr r2, [pc, #128] ; (8002d9c ) + 8002d1a: 4293 cmp r3, r2 + 8002d1c: d00f beq.n 8002d3e + 8002d1e: 687b ldr r3, [r7, #4] + 8002d20: f1b3 4f80 cmp.w r3, #1073741824 ; 0x40000000 + 8002d24: d00b beq.n 8002d3e + 8002d26: 687b ldr r3, [r7, #4] + 8002d28: 4a1d ldr r2, [pc, #116] ; (8002da0 ) + 8002d2a: 4293 cmp r3, r2 + 8002d2c: d007 beq.n 8002d3e + 8002d2e: 687b ldr r3, [r7, #4] + 8002d30: 4a1c ldr r2, [pc, #112] ; (8002da4 ) + 8002d32: 4293 cmp r3, r2 + 8002d34: d003 beq.n 8002d3e + 8002d36: 687b ldr r3, [r7, #4] + 8002d38: 4a1b ldr r2, [pc, #108] ; (8002da8 ) + 8002d3a: 4293 cmp r3, r2 + 8002d3c: d106 bne.n 8002d4c + { + /* Set the clock division */ + MODIFY_REG(tmpcr1, TIM_CR1_CKD, TIM_InitStruct->ClockDivision); + 8002d3e: 68fb ldr r3, [r7, #12] + 8002d40: f423 7240 bic.w r2, r3, #768 ; 0x300 + 8002d44: 683b ldr r3, [r7, #0] + 8002d46: 68db ldr r3, [r3, #12] + 8002d48: 4313 orrs r3, r2 + 8002d4a: 60fb str r3, [r7, #12] + } + + /* Write to TIMx CR1 */ + LL_TIM_WriteReg(TIMx, CR1, tmpcr1); + 8002d4c: 687b ldr r3, [r7, #4] + 8002d4e: 68fa ldr r2, [r7, #12] + 8002d50: 601a str r2, [r3, #0] + + /* Set the Autoreload value */ + LL_TIM_SetAutoReload(TIMx, TIM_InitStruct->Autoreload); + 8002d52: 683b ldr r3, [r7, #0] + 8002d54: 689b ldr r3, [r3, #8] + 8002d56: 4619 mov r1, r3 + 8002d58: 6878 ldr r0, [r7, #4] + 8002d5a: f7ff ff88 bl 8002c6e + + /* Set the Prescaler value */ + LL_TIM_SetPrescaler(TIMx, TIM_InitStruct->Prescaler); + 8002d5e: 683b ldr r3, [r7, #0] + 8002d60: 881b ldrh r3, [r3, #0] + 8002d62: 4619 mov r1, r3 + 8002d64: 6878 ldr r0, [r7, #4] + 8002d66: f7ff ff75 bl 8002c54 + + if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) + 8002d6a: 687b ldr r3, [r7, #4] + 8002d6c: 4a0a ldr r2, [pc, #40] ; (8002d98 ) + 8002d6e: 4293 cmp r3, r2 + 8002d70: d003 beq.n 8002d7a + 8002d72: 687b ldr r3, [r7, #4] + 8002d74: 4a09 ldr r2, [pc, #36] ; (8002d9c ) + 8002d76: 4293 cmp r3, r2 + 8002d78: d105 bne.n 8002d86 + { + /* Set the Repetition Counter value */ + LL_TIM_SetRepetitionCounter(TIMx, TIM_InitStruct->RepetitionCounter); + 8002d7a: 683b ldr r3, [r7, #0] + 8002d7c: 691b ldr r3, [r3, #16] + 8002d7e: 4619 mov r1, r3 + 8002d80: 6878 ldr r0, [r7, #4] + 8002d82: f7ff ff81 bl 8002c88 + } + + /* Generate an update event to reload the Prescaler + and the repetition counter value (if applicable) immediately */ + LL_TIM_GenerateEvent_UPDATE(TIMx); + 8002d86: 6878 ldr r0, [r7, #4] + 8002d88: f7ff ff8b bl 8002ca2 + + return SUCCESS; + 8002d8c: 2300 movs r3, #0 +} + 8002d8e: 4618 mov r0, r3 + 8002d90: 3710 adds r7, #16 + 8002d92: 46bd mov sp, r7 + 8002d94: bd80 pop {r7, pc} + 8002d96: bf00 nop + 8002d98: 40012c00 .word 0x40012c00 + 8002d9c: 40013400 .word 0x40013400 + 8002da0: 40000400 .word 0x40000400 + 8002da4: 40000800 .word 0x40000800 + 8002da8: 40000c00 .word 0x40000c00 + +08002dac : +{ + 8002dac: b480 push {r7} + 8002dae: b083 sub sp, #12 + 8002db0: af00 add r7, sp, #0 + 8002db2: 6078 str r0, [r7, #4] + return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)); + 8002db4: 687b ldr r3, [r7, #4] + 8002db6: 68db ldr r3, [r3, #12] + 8002db8: f403 5300 and.w r3, r3, #8192 ; 0x2000 + 8002dbc: f5b3 5f00 cmp.w r3, #8192 ; 0x2000 + 8002dc0: bf0c ite eq + 8002dc2: 2301 moveq r3, #1 + 8002dc4: 2300 movne r3, #0 + 8002dc6: b2db uxtb r3, r3 +} + 8002dc8: 4618 mov r0, r3 + 8002dca: 370c adds r7, #12 + 8002dcc: 46bd mov sp, r7 + 8002dce: bc80 pop {r7} + 8002dd0: 4770 bx lr + +08002dd2 : +{ + 8002dd2: b480 push {r7} + 8002dd4: b083 sub sp, #12 + 8002dd6: af00 add r7, sp, #0 + 8002dd8: 6078 str r0, [r7, #4] + 8002dda: 6039 str r1, [r7, #0] + MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); + 8002ddc: 687b ldr r3, [r7, #4] + 8002dde: 691b ldr r3, [r3, #16] + 8002de0: f423 5240 bic.w r2, r3, #12288 ; 0x3000 + 8002de4: 683b ldr r3, [r7, #0] + 8002de6: 431a orrs r2, r3 + 8002de8: 687b ldr r3, [r7, #4] + 8002dea: 611a str r2, [r3, #16] +} + 8002dec: bf00 nop + 8002dee: 370c adds r7, #12 + 8002df0: 46bd mov sp, r7 + 8002df2: bc80 pop {r7} + 8002df4: 4770 bx lr + +08002df6 : +{ + 8002df6: b480 push {r7} + 8002df8: b083 sub sp, #12 + 8002dfa: af00 add r7, sp, #0 + 8002dfc: 6078 str r0, [r7, #4] + 8002dfe: 6039 str r1, [r7, #0] + MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); + 8002e00: 687b ldr r3, [r7, #4] + 8002e02: 695b ldr r3, [r3, #20] + 8002e04: f423 7240 bic.w r2, r3, #768 ; 0x300 + 8002e08: 683b ldr r3, [r7, #0] + 8002e0a: 431a orrs r2, r3 + 8002e0c: 687b ldr r3, [r7, #4] + 8002e0e: 615a str r2, [r3, #20] +} + 8002e10: bf00 nop + 8002e12: 370c adds r7, #12 + 8002e14: 46bd mov sp, r7 + 8002e16: bc80 pop {r7} + 8002e18: 4770 bx lr + ... + +08002e1c : +{ + 8002e1c: b480 push {r7} + 8002e1e: b085 sub sp, #20 + 8002e20: af00 add r7, sp, #0 + 8002e22: 60f8 str r0, [r7, #12] + 8002e24: 60b9 str r1, [r7, #8] + 8002e26: 607a str r2, [r7, #4] + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); + 8002e28: 68ba ldr r2, [r7, #8] + 8002e2a: 4613 mov r3, r2 + 8002e2c: 009b lsls r3, r3, #2 + 8002e2e: 4413 add r3, r2 + 8002e30: 009a lsls r2, r3, #2 + 8002e32: 441a add r2, r3 + 8002e34: 687b ldr r3, [r7, #4] + 8002e36: 009b lsls r3, r3, #2 + 8002e38: fbb2 f3f3 udiv r3, r2, r3 + 8002e3c: 4a25 ldr r2, [pc, #148] ; (8002ed4 ) + 8002e3e: fba2 2303 umull r2, r3, r2, r3 + 8002e42: 095b lsrs r3, r3, #5 + 8002e44: b29b uxth r3, r3 + 8002e46: 011b lsls r3, r3, #4 + 8002e48: b299 uxth r1, r3 + 8002e4a: 68ba ldr r2, [r7, #8] + 8002e4c: 4613 mov r3, r2 + 8002e4e: 009b lsls r3, r3, #2 + 8002e50: 4413 add r3, r2 + 8002e52: 009a lsls r2, r3, #2 + 8002e54: 441a add r2, r3 + 8002e56: 687b ldr r3, [r7, #4] + 8002e58: 009b lsls r3, r3, #2 + 8002e5a: fbb2 f2f3 udiv r2, r2, r3 + 8002e5e: 4b1d ldr r3, [pc, #116] ; (8002ed4 ) + 8002e60: fba3 0302 umull r0, r3, r3, r2 + 8002e64: 095b lsrs r3, r3, #5 + 8002e66: 2064 movs r0, #100 ; 0x64 + 8002e68: fb00 f303 mul.w r3, r0, r3 + 8002e6c: 1ad3 subs r3, r2, r3 + 8002e6e: 011b lsls r3, r3, #4 + 8002e70: 3332 adds r3, #50 ; 0x32 + 8002e72: 4a18 ldr r2, [pc, #96] ; (8002ed4 ) + 8002e74: fba2 2303 umull r2, r3, r2, r3 + 8002e78: 095b lsrs r3, r3, #5 + 8002e7a: b29b uxth r3, r3 + 8002e7c: f003 03f0 and.w r3, r3, #240 ; 0xf0 + 8002e80: b29b uxth r3, r3 + 8002e82: 440b add r3, r1 + 8002e84: b299 uxth r1, r3 + 8002e86: 68ba ldr r2, [r7, #8] + 8002e88: 4613 mov r3, r2 + 8002e8a: 009b lsls r3, r3, #2 + 8002e8c: 4413 add r3, r2 + 8002e8e: 009a lsls r2, r3, #2 + 8002e90: 441a add r2, r3 + 8002e92: 687b ldr r3, [r7, #4] + 8002e94: 009b lsls r3, r3, #2 + 8002e96: fbb2 f2f3 udiv r2, r2, r3 + 8002e9a: 4b0e ldr r3, [pc, #56] ; (8002ed4 ) + 8002e9c: fba3 0302 umull r0, r3, r3, r2 + 8002ea0: 095b lsrs r3, r3, #5 + 8002ea2: 2064 movs r0, #100 ; 0x64 + 8002ea4: fb00 f303 mul.w r3, r0, r3 + 8002ea8: 1ad3 subs r3, r2, r3 + 8002eaa: 011b lsls r3, r3, #4 + 8002eac: 3332 adds r3, #50 ; 0x32 + 8002eae: 4a09 ldr r2, [pc, #36] ; (8002ed4 ) + 8002eb0: fba2 2303 umull r2, r3, r2, r3 + 8002eb4: 095b lsrs r3, r3, #5 + 8002eb6: b29b uxth r3, r3 + 8002eb8: f003 030f and.w r3, r3, #15 + 8002ebc: b29b uxth r3, r3 + 8002ebe: 440b add r3, r1 + 8002ec0: b29b uxth r3, r3 + 8002ec2: 461a mov r2, r3 + 8002ec4: 68fb ldr r3, [r7, #12] + 8002ec6: 609a str r2, [r3, #8] +} + 8002ec8: bf00 nop + 8002eca: 3714 adds r7, #20 + 8002ecc: 46bd mov sp, r7 + 8002ece: bc80 pop {r7} + 8002ed0: 4770 bx lr + 8002ed2: bf00 nop + 8002ed4: 51eb851f .word 0x51eb851f + +08002ed8 : + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers are initialized according to USART_InitStruct content + * - ERROR: Problem occurred during USART Registers initialization + */ +ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct) +{ + 8002ed8: b580 push {r7, lr} + 8002eda: b088 sub sp, #32 + 8002edc: af00 add r7, sp, #0 + 8002ede: 6078 str r0, [r7, #4] + 8002ee0: 6039 str r1, [r7, #0] + ErrorStatus status = ERROR; + 8002ee2: 2301 movs r3, #1 + 8002ee4: 77fb strb r3, [r7, #31] + uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO; + 8002ee6: 2300 movs r3, #0 + 8002ee8: 61bb str r3, [r7, #24] + assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling)); +#endif /* USART_OverSampling_Feature */ + + /* USART needs to be in disabled state, in order to be able to configure some bits in + CRx registers */ + if (LL_USART_IsEnabled(USARTx) == 0U) + 8002eea: 6878 ldr r0, [r7, #4] + 8002eec: f7ff ff5e bl 8002dac + 8002ef0: 4603 mov r3, r0 + 8002ef2: 2b00 cmp r3, #0 + 8002ef4: d153 bne.n 8002f9e + (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | + USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8), + (USART_InitStruct->DataWidth | USART_InitStruct->Parity | + USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling)); +#else + MODIFY_REG(USARTx->CR1, + 8002ef6: 687b ldr r3, [r7, #4] + 8002ef8: 68db ldr r3, [r3, #12] + 8002efa: f423 53b0 bic.w r3, r3, #5632 ; 0x1600 + 8002efe: f023 030c bic.w r3, r3, #12 + 8002f02: 683a ldr r2, [r7, #0] + 8002f04: 6851 ldr r1, [r2, #4] + 8002f06: 683a ldr r2, [r7, #0] + 8002f08: 68d2 ldr r2, [r2, #12] + 8002f0a: 4311 orrs r1, r2 + 8002f0c: 683a ldr r2, [r7, #0] + 8002f0e: 6912 ldr r2, [r2, #16] + 8002f10: 430a orrs r2, r1 + 8002f12: 431a orrs r2, r3 + 8002f14: 687b ldr r3, [r7, #4] + 8002f16: 60da str r2, [r3, #12] + /*---------------------------- USART CR2 Configuration ----------------------- + * Configure USARTx CR2 (Stop bits) with parameters: + * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value. + * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit(). + */ + LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits); + 8002f18: 683b ldr r3, [r7, #0] + 8002f1a: 689b ldr r3, [r3, #8] + 8002f1c: 4619 mov r1, r3 + 8002f1e: 6878 ldr r0, [r7, #4] + 8002f20: f7ff ff57 bl 8002dd2 + + /*---------------------------- USART CR3 Configuration ----------------------- + * Configure USARTx CR3 (Hardware Flow Control) with parameters: + * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to USART_InitStruct->HardwareFlowControl value. + */ + LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl); + 8002f24: 683b ldr r3, [r7, #0] + 8002f26: 695b ldr r3, [r3, #20] + 8002f28: 4619 mov r1, r3 + 8002f2a: 6878 ldr r0, [r7, #4] + 8002f2c: f7ff ff63 bl 8002df6 + + /*---------------------------- USART BRR Configuration ----------------------- + * Retrieve Clock frequency used for USART Peripheral + */ + LL_RCC_GetSystemClocksFreq(&rcc_clocks); + 8002f30: f107 0308 add.w r3, r7, #8 + 8002f34: 4618 mov r0, r3 + 8002f36: f7ff fdd7 bl 8002ae8 + if (USARTx == USART1) + 8002f3a: 687b ldr r3, [r7, #4] + 8002f3c: 4a1a ldr r2, [pc, #104] ; (8002fa8 ) + 8002f3e: 4293 cmp r3, r2 + 8002f40: d102 bne.n 8002f48 + { + periphclk = rcc_clocks.PCLK2_Frequency; + 8002f42: 697b ldr r3, [r7, #20] + 8002f44: 61bb str r3, [r7, #24] + 8002f46: e01a b.n 8002f7e + } + else if (USARTx == USART2) + 8002f48: 687b ldr r3, [r7, #4] + 8002f4a: 4a18 ldr r2, [pc, #96] ; (8002fac ) + 8002f4c: 4293 cmp r3, r2 + 8002f4e: d102 bne.n 8002f56 + { + periphclk = rcc_clocks.PCLK1_Frequency; + 8002f50: 693b ldr r3, [r7, #16] + 8002f52: 61bb str r3, [r7, #24] + 8002f54: e013 b.n 8002f7e + } +#if defined(USART3) + else if (USARTx == USART3) + 8002f56: 687b ldr r3, [r7, #4] + 8002f58: 4a15 ldr r2, [pc, #84] ; (8002fb0 ) + 8002f5a: 4293 cmp r3, r2 + 8002f5c: d102 bne.n 8002f64 + { + periphclk = rcc_clocks.PCLK1_Frequency; + 8002f5e: 693b ldr r3, [r7, #16] + 8002f60: 61bb str r3, [r7, #24] + 8002f62: e00c b.n 8002f7e + } +#endif /* USART3 */ +#if defined(UART4) + else if (USARTx == UART4) + 8002f64: 687b ldr r3, [r7, #4] + 8002f66: 4a13 ldr r2, [pc, #76] ; (8002fb4 ) + 8002f68: 4293 cmp r3, r2 + 8002f6a: d102 bne.n 8002f72 + { + periphclk = rcc_clocks.PCLK1_Frequency; + 8002f6c: 693b ldr r3, [r7, #16] + 8002f6e: 61bb str r3, [r7, #24] + 8002f70: e005 b.n 8002f7e + } +#endif /* UART4 */ +#if defined(UART5) + else if (USARTx == UART5) + 8002f72: 687b ldr r3, [r7, #4] + 8002f74: 4a10 ldr r2, [pc, #64] ; (8002fb8 ) + 8002f76: 4293 cmp r3, r2 + 8002f78: d101 bne.n 8002f7e + { + periphclk = rcc_clocks.PCLK1_Frequency; + 8002f7a: 693b ldr r3, [r7, #16] + 8002f7c: 61bb str r3, [r7, #24] + + /* Configure the USART Baud Rate : + - valid baud rate value (different from 0) is required + - Peripheral clock as returned by RCC service, should be valid (different from 0). + */ + if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO) + 8002f7e: 69bb ldr r3, [r7, #24] + 8002f80: 2b00 cmp r3, #0 + 8002f82: d00c beq.n 8002f9e + && (USART_InitStruct->BaudRate != 0U)) + 8002f84: 683b ldr r3, [r7, #0] + 8002f86: 681b ldr r3, [r3, #0] + 8002f88: 2b00 cmp r3, #0 + 8002f8a: d008 beq.n 8002f9e + { + status = SUCCESS; + 8002f8c: 2300 movs r3, #0 + 8002f8e: 77fb strb r3, [r7, #31] + LL_USART_SetBaudRate(USARTx, + periphclk, + USART_InitStruct->OverSampling, + USART_InitStruct->BaudRate); +#else + LL_USART_SetBaudRate(USARTx, + 8002f90: 683b ldr r3, [r7, #0] + 8002f92: 681b ldr r3, [r3, #0] + 8002f94: 461a mov r2, r3 + 8002f96: 69b9 ldr r1, [r7, #24] + 8002f98: 6878 ldr r0, [r7, #4] + 8002f9a: f7ff ff3f bl 8002e1c + assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR)); + } + } + /* Endif (=> USART not in Disabled state => return ERROR) */ + + return (status); + 8002f9e: 7ffb ldrb r3, [r7, #31] +} + 8002fa0: 4618 mov r0, r3 + 8002fa2: 3720 adds r7, #32 + 8002fa4: 46bd mov sp, r7 + 8002fa6: bd80 pop {r7, pc} + 8002fa8: 40013800 .word 0x40013800 + 8002fac: 40004400 .word 0x40004400 + 8002fb0: 40004800 .word 0x40004800 + 8002fb4: 40004c00 .word 0x40004c00 + 8002fb8: 40005000 .word 0x40005000 + +08002fbc : + * @note Variable can be calculated also through SystemCoreClockUpdate function. + * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) + * @retval None + */ +void LL_SetSystemCoreClock(uint32_t HCLKFrequency) +{ + 8002fbc: b480 push {r7} + 8002fbe: b083 sub sp, #12 + 8002fc0: af00 add r7, sp, #0 + 8002fc2: 6078 str r0, [r7, #4] + /* HCLK clock frequency */ + SystemCoreClock = HCLKFrequency; + 8002fc4: 4a03 ldr r2, [pc, #12] ; (8002fd4 ) + 8002fc6: 687b ldr r3, [r7, #4] + 8002fc8: 6013 str r3, [r2, #0] +} + 8002fca: bf00 nop + 8002fcc: 370c adds r7, #12 + 8002fce: 46bd mov sp, r7 + 8002fd0: bc80 pop {r7} + 8002fd2: 4770 bx lr + 8002fd4: 20000000 .word 0x20000000 + +08002fd8 : +void InitCanFilter(void); + +//------------------------------------------------------------------------ +// ĬϹݰ +void DefaultCanFilter(u8 fifo) +{ + 8002fd8: b580 push {r7, lr} + 8002fda: b08e sub sp, #56 ; 0x38 + 8002fdc: af00 add r7, sp, #0 + 8002fde: 4603 mov r3, r0 + 8002fe0: 71fb strb r3, [r7, #7] + HAL_StatusTypeDef halsta; + + CAN_FilterTypeDef hFilterConfig; + hFilterConfig.FilterBank = 0; // ʼĹΪ0--13 , 14--27 + 8002fe2: 2300 movs r3, #0 + 8002fe4: 623b str r3, [r7, #32] + hFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK; // ڱʶλģʽ + 8002fe6: 2300 movs r3, #0 + 8002fe8: 627b str r3, [r7, #36] ; 0x24 + hFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + 8002fea: 2301 movs r3, #1 + 8002fec: 62bb str r3, [r7, #40] ; 0x28 + hFilterConfig.FilterIdHigh = 0x0000; // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + 8002fee: 2300 movs r3, #0 + 8002ff0: 60fb str r3, [r7, #12] + hFilterConfig.FilterIdLow = 0x0000; // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + 8002ff2: 2300 movs r3, #0 + 8002ff4: 613b str r3, [r7, #16] + hFilterConfig.FilterMaskIdHigh = 0x0000; // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + 8002ff6: 2300 movs r3, #0 + 8002ff8: 617b str r3, [r7, #20] + hFilterConfig.FilterMaskIdLow = 0x0000; // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + 8002ffa: 2300 movs r3, #0 + 8002ffc: 61bb str r3, [r7, #24] + hFilterConfig.FilterFIFOAssignment = fifo; // FIFO + 8002ffe: 79fb ldrb r3, [r7, #7] + 8003000: 61fb str r3, [r7, #28] + hFilterConfig.SlaveStartFilterBank = 14; // ӽڵCANCAN壩˫CANϵͳ + 8003002: 230e movs r3, #14 + 8003004: 633b str r3, [r7, #48] ; 0x30 + hFilterConfig.FilterActivation = CAN_FILTER_ENABLE; // ʹܹ + 8003006: 2301 movs r3, #1 + 8003008: 62fb str r3, [r7, #44] ; 0x2c + + halsta = HAL_CAN_ConfigFilter(&HCAN, &hFilterConfig); + 800300a: f107 030c add.w r3, r7, #12 + 800300e: 4619 mov r1, r3 + 8003010: 4808 ldr r0, [pc, #32] ; (8003034 ) + 8003012: f7fe fb16 bl 8001642 + 8003016: 4603 mov r3, r0 + 8003018: f887 3037 strb.w r3, [r7, #55] ; 0x37 + + printf("DefaultCanFilter at fifo%d, halsta=%d\r\n", fifo, halsta); + 800301c: 79fb ldrb r3, [r7, #7] + 800301e: f897 2037 ldrb.w r2, [r7, #55] ; 0x37 + 8003022: 4619 mov r1, r3 + 8003024: 4804 ldr r0, [pc, #16] ; (8003038 ) + 8003026: f006 fc71 bl 800990c +} + 800302a: bf00 nop + 800302c: 3738 adds r7, #56 ; 0x38 + 800302e: 46bd mov sp, r7 + 8003030: bd80 pop {r7, pc} + 8003032: bf00 nop + 8003034: 2000058c .word 0x2000058c + 8003038: 0800a940 .word 0x0800a940 + +0800303c : + + +void (*SetCanFilter)(u8) = DefaultCanFilter; + +void RegistFilter(void*func) +{ + 800303c: b480 push {r7} + 800303e: b083 sub sp, #12 + 8003040: af00 add r7, sp, #0 + 8003042: 6078 str r0, [r7, #4] + SetCanFilter = (void (*)(u8))func; + 8003044: 687b ldr r3, [r7, #4] + 8003046: 4a03 ldr r2, [pc, #12] ; (8003054 ) + 8003048: 6013 str r3, [r2, #0] +} + 800304a: bf00 nop + 800304c: 370c adds r7, #12 + 800304e: 46bd mov sp, r7 + 8003050: bc80 pop {r7} + 8003052: 4770 bx lr + 8003054: 2000000c .word 0x2000000c + +08003058 : + +//------------------------------------------------------------------------ + +void InitCanCtrl(void) +{ + 8003058: b580 push {r7, lr} + 800305a: b082 sub sp, #8 + 800305c: af00 add r7, sp, #0 + HAL_StatusTypeDef halsta; // ״̬ + + InitCanMsgList(); // ݽṹʼ + 800305e: f000 f847 bl 80030f0 + + if (SetCanFilter != NULL) // ʼ + 8003062: 4b1d ldr r3, [pc, #116] ; (80030d8 ) + 8003064: 681b ldr r3, [r3, #0] + 8003066: 2b00 cmp r3, #0 + 8003068: d003 beq.n 8003072 + { + SetCanFilter(CAN_FILTER_FIFO0); + 800306a: 4b1b ldr r3, [pc, #108] ; (80030d8 ) + 800306c: 681b ldr r3, [r3, #0] + 800306e: 2000 movs r0, #0 + 8003070: 4798 blx r3 + } + + halsta = HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_MSG_PENDING); // CANж + 8003072: 2102 movs r1, #2 + 8003074: 4819 ldr r0, [pc, #100] ; (80030dc ) + 8003076: f7fe fe03 bl 8001c80 + 800307a: 4603 mov r3, r0 + 800307c: 71fb strb r3, [r7, #7] + if (halsta != HAL_OK) + 800307e: 79fb ldrb r3, [r7, #7] + 8003080: 2b00 cmp r3, #0 + 8003082: d002 beq.n 800308a + { + printf("HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_MSG_PENDING) failed\r\n"); + 8003084: 4816 ldr r0, [pc, #88] ; (80030e0 ) + 8003086: f006 fcb5 bl 80099f4 + } + + halsta = HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_FULL); // CANж + 800308a: 2104 movs r1, #4 + 800308c: 4813 ldr r0, [pc, #76] ; (80030dc ) + 800308e: f7fe fdf7 bl 8001c80 + 8003092: 4603 mov r3, r0 + 8003094: 71fb strb r3, [r7, #7] + if (halsta != HAL_OK) + 8003096: 79fb ldrb r3, [r7, #7] + 8003098: 2b00 cmp r3, #0 + 800309a: d002 beq.n 80030a2 + { + printf("HAL_CAN_ActivateNotification(&HCAN, CAN_IT_RX_FIFO0_FULL) failed\r\n"); + 800309c: 4811 ldr r0, [pc, #68] ; (80030e4 ) + 800309e: f006 fca9 bl 80099f4 + } + + halsta = HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // رշж + 80030a2: 2101 movs r1, #1 + 80030a4: 480d ldr r0, [pc, #52] ; (80030dc ) + 80030a6: f7fe fe10 bl 8001cca + 80030aa: 4603 mov r3, r0 + 80030ac: 71fb strb r3, [r7, #7] + if (halsta != HAL_OK) + 80030ae: 79fb ldrb r3, [r7, #7] + 80030b0: 2b00 cmp r3, #0 + 80030b2: d002 beq.n 80030ba + { + printf("HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY) failed\r\n"); + 80030b4: 480c ldr r0, [pc, #48] ; (80030e8 ) + 80030b6: f006 fc9d bl 80099f4 + } + + halsta = HAL_CAN_Start(&HCAN); // CANģ + 80030ba: 4808 ldr r0, [pc, #32] ; (80030dc ) + 80030bc: f7fe fb8a bl 80017d4 + 80030c0: 4603 mov r3, r0 + 80030c2: 71fb strb r3, [r7, #7] + if (halsta != HAL_OK) + 80030c4: 79fb ldrb r3, [r7, #7] + 80030c6: 2b00 cmp r3, #0 + 80030c8: d002 beq.n 80030d0 + { + printf("HAL_CAN_Start failed\r\n"); + 80030ca: 4808 ldr r0, [pc, #32] ; (80030ec ) + 80030cc: f006 fc92 bl 80099f4 + } +} + 80030d0: bf00 nop + 80030d2: 3708 adds r7, #8 + 80030d4: 46bd mov sp, r7 + 80030d6: bd80 pop {r7, pc} + 80030d8: 2000000c .word 0x2000000c + 80030dc: 2000058c .word 0x2000058c + 80030e0: 0800a968 .word 0x0800a968 + 80030e4: 0800a9b4 .word 0x0800a9b4 + 80030e8: 0800a9f8 .word 0x0800a9f8 + 80030ec: 0800aa40 .word 0x0800aa40 + +080030f0 : + +// ʼƽṹ +void InitCanMsgList(void) +{ + 80030f0: b580 push {r7, lr} + 80030f2: af00 add r7, sp, #0 + memset(&g_canTxCtrl, 0, sizeof(CanTxCtrl)); + 80030f4: f44f 7204 mov.w r2, #528 ; 0x210 + 80030f8: 2100 movs r1, #0 + 80030fa: 4813 ldr r0, [pc, #76] ; (8003148 ) + 80030fc: f006 fbfd bl 80098fa + memset(&g_canRxCtrl, 0, sizeof(CanRxCtrl)); + 8003100: f44f 7213 mov.w r2, #588 ; 0x24c + 8003104: 2100 movs r1, #0 + 8003106: 4811 ldr r0, [pc, #68] ; (800314c ) + 8003108: f006 fbf7 bl 80098fa + + g_canTxCtrl.pktTxListHead = g_canTxCtrl.pktTxList; // ͷָ + 800310c: 4b0e ldr r3, [pc, #56] ; (8003148 ) + 800310e: 4a0e ldr r2, [pc, #56] ; (8003148 ) + 8003110: f8c3 2200 str.w r2, [r3, #512] ; 0x200 + g_canTxCtrl.pktTxListTail = g_canTxCtrl.pktTxList; // βָ + 8003114: 4b0c ldr r3, [pc, #48] ; (8003148 ) + 8003116: 4a0c ldr r2, [pc, #48] ; (8003148 ) + 8003118: f8c3 2204 str.w r2, [r3, #516] ; 0x204 + g_canTxCtrl.pktTxNumber = 0; // Ч + 800311c: 4b0a ldr r3, [pc, #40] ; (8003148 ) + 800311e: 2200 movs r2, #0 + 8003120: f8c3 2208 str.w r2, [r3, #520] ; 0x208 + g_canTxCtrl.sendingFlag = 0; + 8003124: 4b08 ldr r3, [pc, #32] ; (8003148 ) + 8003126: 2200 movs r2, #0 + 8003128: f8c3 220c str.w r2, [r3, #524] ; 0x20c + + g_canRxCtrl.pktRxListHead = g_canRxCtrl.pktRxList; // ͷָ + 800312c: 4b07 ldr r3, [pc, #28] ; (800314c ) + 800312e: 4a07 ldr r2, [pc, #28] ; (800314c ) + 8003130: f8c3 2240 str.w r2, [r3, #576] ; 0x240 + g_canRxCtrl.pktRxListTail = g_canRxCtrl.pktRxList; // βָ + 8003134: 4b05 ldr r3, [pc, #20] ; (800314c ) + 8003136: 4a05 ldr r2, [pc, #20] ; (800314c ) + 8003138: f8c3 2244 str.w r2, [r3, #580] ; 0x244 + g_canRxCtrl.pktRxNumber = 0; // Ч + 800313c: 4b03 ldr r3, [pc, #12] ; (800314c ) + 800313e: 2200 movs r2, #0 + 8003140: f8c3 2248 str.w r2, [r3, #584] ; 0x248 +} + 8003144: bf00 nop + 8003146: bd80 pop {r7, pc} + 8003148: 200005b8 .word 0x200005b8 + 800314c: 200007c8 .word 0x200007c8 + +08003150 : + HAL_BUSY = 0x02U, + HAL_TIMEOUT = 0x03U, + */ +// ݵ +int TransCanDataToBus(void) +{ + 8003150: b580 push {r7, lr} + 8003152: b082 sub sp, #8 + 8003154: af00 add r7, sp, #0 + u32 tsmBox; // + +// printf("TransCanDataToBus\r\n"); + + // Ӷȡһݰ + if (g_canTxCtrl.pktTxNumber <= 0) + 8003156: 4b20 ldr r3, [pc, #128] ; (80031d8 ) + 8003158: f8d3 3208 ldr.w r3, [r3, #520] ; 0x208 + 800315c: 2b00 cmp r3, #0 + 800315e: dc01 bgt.n 8003164 + { + //printf("pktTxNumber=%d\r\n", g_canTxCtrl.pktTxNumber); + return 1; + 8003160: 2301 movs r3, #1 + 8003162: e035 b.n 80031d0 + } + + halsta = HAL_CAN_AddTxMessage(&HCAN, &(g_canTxCtrl.pktTxListTail->canTxhead) , g_canTxCtrl.pktTxListTail->data, &tsmBox); + 8003164: 4b1c ldr r3, [pc, #112] ; (80031d8 ) + 8003166: f8d3 3204 ldr.w r3, [r3, #516] ; 0x204 + 800316a: 4619 mov r1, r3 + 800316c: 4b1a ldr r3, [pc, #104] ; (80031d8 ) + 800316e: f8d3 3204 ldr.w r3, [r3, #516] ; 0x204 + 8003172: f103 0218 add.w r2, r3, #24 + 8003176: 463b mov r3, r7 + 8003178: 4818 ldr r0, [pc, #96] ; (80031dc ) + 800317a: f7fe fb6f bl 800185c + 800317e: 4603 mov r3, r0 + 8003180: 71fb strb r3, [r7, #7] + //printf("exid=0x%x,tsmBox=%d,halsta=%d\r\n", g_canTxCtrl.pktTxListTail->canTxhead.ExtId, tsmBox,halsta); + if (halsta == HAL_OK) + 8003182: 79fb ldrb r3, [r7, #7] + 8003184: 2b00 cmp r3, #0 + 8003186: d11d bne.n 80031c4 + { + EnterCritical(); + 8003188: f000 fa1e bl 80035c8 + g_canTxCtrl.pktTxNumber--; + 800318c: 4b12 ldr r3, [pc, #72] ; (80031d8 ) + 800318e: f8d3 3208 ldr.w r3, [r3, #520] ; 0x208 + 8003192: 3b01 subs r3, #1 + 8003194: 4a10 ldr r2, [pc, #64] ; (80031d8 ) + 8003196: f8c2 3208 str.w r3, [r2, #520] ; 0x208 + g_canTxCtrl.pktTxListTail++; + 800319a: 4b0f ldr r3, [pc, #60] ; (80031d8 ) + 800319c: f8d3 3204 ldr.w r3, [r3, #516] ; 0x204 + 80031a0: 3320 adds r3, #32 + 80031a2: 4a0d ldr r2, [pc, #52] ; (80031d8 ) + 80031a4: f8c2 3204 str.w r3, [r2, #516] ; 0x204 + if (g_canTxCtrl.pktTxListTail > &(g_canTxCtrl.pktTxList[TRANS_PKT_LIST_NUM-1])) + 80031a8: 4b0b ldr r3, [pc, #44] ; (80031d8 ) + 80031aa: f8d3 3204 ldr.w r3, [r3, #516] ; 0x204 + 80031ae: 4a0c ldr r2, [pc, #48] ; (80031e0 ) + 80031b0: 4293 cmp r3, r2 + 80031b2: d903 bls.n 80031bc + { + g_canTxCtrl.pktTxListTail = &(g_canTxCtrl.pktTxList[0]); + 80031b4: 4b08 ldr r3, [pc, #32] ; (80031d8 ) + 80031b6: 4a08 ldr r2, [pc, #32] ; (80031d8 ) + 80031b8: f8c3 2204 str.w r2, [r3, #516] ; 0x204 + } + ExitCritical(); + 80031bc: f000 fa16 bl 80035ec + +// printf("HAL_OK, g_canTxCtrl.pktTxNumber=%d\r\n", num); + + return 0; + 80031c0: 2300 movs r3, #0 + 80031c2: e005 b.n 80031d0 + } + else + { + printf("TransCanDataToBus:other sta, halsta=%d\r\n", halsta); + 80031c4: 79fb ldrb r3, [r7, #7] + 80031c6: 4619 mov r1, r3 + 80031c8: 4806 ldr r0, [pc, #24] ; (80031e4 ) + 80031ca: f006 fb9f bl 800990c + return 2; + 80031ce: 2302 movs r3, #2 + } +} + 80031d0: 4618 mov r0, r3 + 80031d2: 3708 adds r7, #8 + 80031d4: 46bd mov sp, r7 + 80031d6: bd80 pop {r7, pc} + 80031d8: 200005b8 .word 0x200005b8 + 80031dc: 2000058c .word 0x2000058c + 80031e0: 20000798 .word 0x20000798 + 80031e4: 0800aa58 .word 0x0800aa58 + +080031e8 : + +// Ͻ +int ResvCanDataFromBus(void) +{ + 80031e8: b580 push {r7, lr} + 80031ea: b08a sub sp, #40 ; 0x28 + 80031ec: af00 add r7, sp, #0 + HAL_StatusTypeDef halsta; + CanRxMsg rxMsg; + + halsta = HAL_CAN_GetRxMessage(&HCAN, CAN_RX_FIFO0, &(rxMsg.canRxhead), rxMsg.data); // ȡ + 80031ee: 463b mov r3, r7 + 80031f0: 331c adds r3, #28 + 80031f2: 463a mov r2, r7 + 80031f4: 2100 movs r1, #0 + 80031f6: 4820 ldr r0, [pc, #128] ; (8003278 ) + 80031f8: f7fe fc0a bl 8001a10 + 80031fc: 4603 mov r3, r0 + 80031fe: f887 3027 strb.w r3, [r7, #39] ; 0x27 + if (halsta == HAL_OK) + 8003202: f897 3027 ldrb.w r3, [r7, #39] ; 0x27 + 8003206: 2b00 cmp r3, #0 + 8003208: d12a bne.n 8003260 + { + //printf("get a can packet:\r\n"); + //printf("exid=0x%x\r\n", rxMsg.canRxhead.ExtId); + if (g_canRxCtrl.pktRxNumber < RESV_PKT_LIST_NUM-1) // ӵ + 800320a: 4b1c ldr r3, [pc, #112] ; (800327c ) + 800320c: f8d3 3248 ldr.w r3, [r3, #584] ; 0x248 + 8003210: 2b0e cmp r3, #14 + 8003212: dc21 bgt.n 8003258 + { + // printf("add to rxlist, add=0x%x\r\n", g_canRxCtrl.pktRxListHead); + memcpy(g_canRxCtrl.pktRxListHead, &rxMsg, sizeof(CanRxMsg)); + 8003214: 4b19 ldr r3, [pc, #100] ; (800327c ) + 8003216: f8d3 3240 ldr.w r3, [r3, #576] ; 0x240 + 800321a: 4639 mov r1, r7 + 800321c: 2224 movs r2, #36 ; 0x24 + 800321e: 4618 mov r0, r3 + 8003220: f006 fb60 bl 80098e4 + + g_canRxCtrl.pktRxNumber++; + 8003224: 4b15 ldr r3, [pc, #84] ; (800327c ) + 8003226: f8d3 3248 ldr.w r3, [r3, #584] ; 0x248 + 800322a: 3301 adds r3, #1 + 800322c: 4a13 ldr r2, [pc, #76] ; (800327c ) + 800322e: f8c2 3248 str.w r3, [r2, #584] ; 0x248 + g_canRxCtrl.pktRxListHead++; + 8003232: 4b12 ldr r3, [pc, #72] ; (800327c ) + 8003234: f8d3 3240 ldr.w r3, [r3, #576] ; 0x240 + 8003238: 3324 adds r3, #36 ; 0x24 + 800323a: 4a10 ldr r2, [pc, #64] ; (800327c ) + 800323c: f8c2 3240 str.w r3, [r2, #576] ; 0x240 + if (g_canRxCtrl.pktRxListHead > &(g_canRxCtrl.pktRxList[RESV_PKT_LIST_NUM-1])) + 8003240: 4b0e ldr r3, [pc, #56] ; (800327c ) + 8003242: f8d3 3240 ldr.w r3, [r3, #576] ; 0x240 + 8003246: 4a0e ldr r2, [pc, #56] ; (8003280 ) + 8003248: 4293 cmp r3, r2 + 800324a: d903 bls.n 8003254 + { + g_canRxCtrl.pktRxListHead = &(g_canRxCtrl.pktRxList[0]); + 800324c: 4b0b ldr r3, [pc, #44] ; (800327c ) + 800324e: 4a0b ldr r2, [pc, #44] ; (800327c ) + 8003250: f8c3 2240 str.w r2, [r3, #576] ; 0x240 + } + //printf("resv RxNum=%d\r\n", g_canRxCtrl.pktRxNumber); + return 0; + 8003254: 2300 movs r3, #0 + 8003256: e00a b.n 800326e + } + else + { + printf("can receive buff is full\r\n"); + 8003258: 480a ldr r0, [pc, #40] ; (8003284 ) + 800325a: f006 fbcb bl 80099f4 + 800325e: e005 b.n 800326c + } + } + else + { + printf("ResvCanDataFromBus:other sta, halsta=%d\r\n", halsta); + 8003260: f897 3027 ldrb.w r3, [r7, #39] ; 0x27 + 8003264: 4619 mov r1, r3 + 8003266: 4808 ldr r0, [pc, #32] ; (8003288 ) + 8003268: f006 fb50 bl 800990c + } + return 1; + 800326c: 2301 movs r3, #1 +} + 800326e: 4618 mov r0, r3 + 8003270: 3728 adds r7, #40 ; 0x28 + 8003272: 46bd mov sp, r7 + 8003274: bd80 pop {r7, pc} + 8003276: bf00 nop + 8003278: 2000058c .word 0x2000058c + 800327c: 200007c8 .word 0x200007c8 + 8003280: 200009e4 .word 0x200009e4 + 8003284: 0800aa84 .word 0x0800aa84 + 8003288: 0800aaa0 .word 0x0800aaa0 + +0800328c : + +//--------------------------------------------------------- + +// ӷݵ +int SendACANDataPacket(CanTxMsg * pMsg) +{ + 800328c: b580 push {r7, lr} + 800328e: b084 sub sp, #16 + 8003290: af00 add r7, sp, #0 + 8003292: 6078 str r0, [r7, #4] + int rslt; + if (pMsg == NULL) + 8003294: 687b ldr r3, [r7, #4] + 8003296: 2b00 cmp r3, #0 + 8003298: d105 bne.n 80032a6 + { + printf("SendACANDataPacket:para error\r\n"); + 800329a: 4832 ldr r0, [pc, #200] ; (8003364 ) + 800329c: f006 fbaa bl 80099f4 + return -1; + 80032a0: f04f 33ff mov.w r3, #4294967295 + 80032a4: e059 b.n 800335a + } + + if (g_canTxCtrl.pktTxNumber < TRANS_PKT_LIST_NUM) + 80032a6: 4b30 ldr r3, [pc, #192] ; (8003368 ) + 80032a8: f8d3 3208 ldr.w r3, [r3, #520] ; 0x208 + 80032ac: 2b0f cmp r3, #15 + 80032ae: dc4e bgt.n 800334e + { + // һݰͶ + memcpy(g_canTxCtrl.pktTxListHead, pMsg, sizeof(CanTxMsg)); // + 80032b0: 4b2d ldr r3, [pc, #180] ; (8003368 ) + 80032b2: f8d3 3200 ldr.w r3, [r3, #512] ; 0x200 + 80032b6: 2220 movs r2, #32 + 80032b8: 6879 ldr r1, [r7, #4] + 80032ba: 4618 mov r0, r3 + 80032bc: f006 fb12 bl 80098e4 + + EnterCritical(); + 80032c0: f000 f982 bl 80035c8 + g_canTxCtrl.pktTxNumber++; + 80032c4: 4b28 ldr r3, [pc, #160] ; (8003368 ) + 80032c6: f8d3 3208 ldr.w r3, [r3, #520] ; 0x208 + 80032ca: 3301 adds r3, #1 + 80032cc: 4a26 ldr r2, [pc, #152] ; (8003368 ) + 80032ce: f8c2 3208 str.w r3, [r2, #520] ; 0x208 + g_canTxCtrl.pktTxListHead++; + 80032d2: 4b25 ldr r3, [pc, #148] ; (8003368 ) + 80032d4: f8d3 3200 ldr.w r3, [r3, #512] ; 0x200 + 80032d8: 3320 adds r3, #32 + 80032da: 4a23 ldr r2, [pc, #140] ; (8003368 ) + 80032dc: f8c2 3200 str.w r3, [r2, #512] ; 0x200 + if (g_canTxCtrl.pktTxListHead > &(g_canTxCtrl.pktTxList[TRANS_PKT_LIST_NUM-1])) + 80032e0: 4b21 ldr r3, [pc, #132] ; (8003368 ) + 80032e2: f8d3 3200 ldr.w r3, [r3, #512] ; 0x200 + 80032e6: 4a21 ldr r2, [pc, #132] ; (800336c ) + 80032e8: 4293 cmp r3, r2 + 80032ea: d903 bls.n 80032f4 + { + g_canTxCtrl.pktTxListHead = &(g_canTxCtrl.pktTxList[0]); + 80032ec: 4b1e ldr r3, [pc, #120] ; (8003368 ) + 80032ee: 4a1e ldr r2, [pc, #120] ; (8003368 ) + 80032f0: f8c3 2200 str.w r2, [r3, #512] ; 0x200 + } + ExitCritical(); + 80032f4: f000 f97a bl 80035ec + + if (g_canTxCtrl.sendingFlag == 0) // ûз + 80032f8: 4b1b ldr r3, [pc, #108] ; (8003368 ) + 80032fa: f8d3 320c ldr.w r3, [r3, #524] ; 0x20c + 80032fe: 2b00 cmp r3, #0 + 8003300: d11e bne.n 8003340 + { + rslt = TransCanDataToBus(); // Ͷݵ + 8003302: f7ff ff25 bl 8003150 + 8003306: 60f8 str r0, [r7, #12] + + if (rslt == 0) // ӵгɹ + 8003308: 68fb ldr r3, [r7, #12] + 800330a: 2b00 cmp r3, #0 + 800330c: d108 bne.n 8003320 + { + //printf("send a can packet in app\r\n"); + g_canTxCtrl.sendingFlag = 1; // ñ־ + 800330e: 4b16 ldr r3, [pc, #88] ; (8003368 ) + 8003310: 2201 movs r2, #1 + 8003312: f8c3 220c str.w r2, [r3, #524] ; 0x20c + HAL_CAN_ActivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ж + 8003316: 2101 movs r1, #1 + 8003318: 4815 ldr r0, [pc, #84] ; (8003370 ) + 800331a: f7fe fcb1 bl 8001c80 + 800331e: e013 b.n 8003348 + } + else if (rslt == 1) // ûҪ + 8003320: 68fb ldr r3, [r7, #12] + 8003322: 2b01 cmp r3, #1 + 8003324: d108 bne.n 8003338 + { + //printf("send list empty in app\r\n"); + g_canTxCtrl.sendingFlag = 0; + 8003326: 4b10 ldr r3, [pc, #64] ; (8003368 ) + 8003328: 2200 movs r2, #0 + 800332a: f8c3 220c str.w r2, [r3, #524] ; 0x20c + HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ûݷͣرж + 800332e: 2101 movs r1, #1 + 8003330: 480f ldr r0, [pc, #60] ; (8003370 ) + 8003332: f7fe fcca bl 8001cca + 8003336: e007 b.n 8003348 + } + else // ûкʵ + { + printf("no mail box in app, start later\r\n"); + 8003338: 480e ldr r0, [pc, #56] ; (8003374 ) + 800333a: f006 fb5b bl 80099f4 + 800333e: e003 b.n 8003348 + } + } + else + { + //printf("sendingFlag=1\r\n"); + HAL_CAN_ActivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ж + 8003340: 2101 movs r1, #1 + 8003342: 480b ldr r0, [pc, #44] ; (8003370 ) + 8003344: f7fe fc9c bl 8001c80 + } + rslt = 0; + 8003348: 2300 movs r3, #0 + 800334a: 60fb str r3, [r7, #12] + 800334c: e004 b.n 8003358 + } + else + { + printf("can send buff is full\r\n"); + 800334e: 480a ldr r0, [pc, #40] ; (8003378 ) + 8003350: f006 fb50 bl 80099f4 + rslt = 1; + 8003354: 2301 movs r3, #1 + 8003356: 60fb str r3, [r7, #12] + } + + return rslt; + 8003358: 68fb ldr r3, [r7, #12] +} + 800335a: 4618 mov r0, r3 + 800335c: 3710 adds r7, #16 + 800335e: 46bd mov sp, r7 + 8003360: bd80 pop {r7, pc} + 8003362: bf00 nop + 8003364: 0800aacc .word 0x0800aacc + 8003368: 200005b8 .word 0x200005b8 + 800336c: 20000798 .word 0x20000798 + 8003370: 2000058c .word 0x2000058c + 8003374: 0800aaec .word 0x0800aaec + 8003378: 0800ab10 .word 0x0800ab10 + +0800337c : + + +// Ӷжȡ +int GetACanDataPacket(CanRxMsg * pMsg) +{ + 800337c: b580 push {r7, lr} + 800337e: b084 sub sp, #16 + 8003380: af00 add r7, sp, #0 + 8003382: 6078 str r0, [r7, #4] + int rslt; + if (pMsg == NULL) + 8003384: 687b ldr r3, [r7, #4] + 8003386: 2b00 cmp r3, #0 + 8003388: d102 bne.n 8003390 + { + return -1; + 800338a: f04f 33ff mov.w r3, #4294967295 + 800338e: e02e b.n 80033ee + } + + if (g_canRxCtrl.pktRxNumber > 0) + 8003390: 4b19 ldr r3, [pc, #100] ; (80033f8 ) + 8003392: f8d3 3248 ldr.w r3, [r3, #584] ; 0x248 + 8003396: 2b00 cmp r3, #0 + 8003398: dd26 ble.n 80033e8 + { + memcpy(pMsg, g_canRxCtrl.pktRxListTail, sizeof(CanRxMsg)); + 800339a: 4b17 ldr r3, [pc, #92] ; (80033f8 ) + 800339c: f8d3 3244 ldr.w r3, [r3, #580] ; 0x244 + 80033a0: 2224 movs r2, #36 ; 0x24 + 80033a2: 4619 mov r1, r3 + 80033a4: 6878 ldr r0, [r7, #4] + 80033a6: f006 fa9d bl 80098e4 + + EnterCritical(); + 80033aa: f000 f90d bl 80035c8 + g_canRxCtrl.pktRxNumber--; + 80033ae: 4b12 ldr r3, [pc, #72] ; (80033f8 ) + 80033b0: f8d3 3248 ldr.w r3, [r3, #584] ; 0x248 + 80033b4: 3b01 subs r3, #1 + 80033b6: 4a10 ldr r2, [pc, #64] ; (80033f8 ) + 80033b8: f8c2 3248 str.w r3, [r2, #584] ; 0x248 + //printf("2.RxNum=%d\r\n", g_canRxCtrl.pktRxNumber); + g_canRxCtrl.pktRxListTail++; + 80033bc: 4b0e ldr r3, [pc, #56] ; (80033f8 ) + 80033be: f8d3 3244 ldr.w r3, [r3, #580] ; 0x244 + 80033c2: 3324 adds r3, #36 ; 0x24 + 80033c4: 4a0c ldr r2, [pc, #48] ; (80033f8 ) + 80033c6: f8c2 3244 str.w r3, [r2, #580] ; 0x244 + if (g_canRxCtrl.pktRxListTail > &(g_canRxCtrl.pktRxList[RESV_PKT_LIST_NUM-1])) + 80033ca: 4b0b ldr r3, [pc, #44] ; (80033f8 ) + 80033cc: f8d3 3244 ldr.w r3, [r3, #580] ; 0x244 + 80033d0: 4a0a ldr r2, [pc, #40] ; (80033fc ) + 80033d2: 4293 cmp r3, r2 + 80033d4: d903 bls.n 80033de + { + g_canRxCtrl.pktRxListTail = &(g_canRxCtrl.pktRxList[0]); + 80033d6: 4b08 ldr r3, [pc, #32] ; (80033f8 ) + 80033d8: 4a07 ldr r2, [pc, #28] ; (80033f8 ) + 80033da: f8c3 2244 str.w r2, [r3, #580] ; 0x244 + } + ExitCritical(); + 80033de: f000 f905 bl 80035ec + + rslt = 0; + 80033e2: 2300 movs r3, #0 + 80033e4: 60fb str r3, [r7, #12] + 80033e6: e001 b.n 80033ec + } + else + { + rslt = 1; + 80033e8: 2301 movs r3, #1 + 80033ea: 60fb str r3, [r7, #12] + } + + return rslt; + 80033ec: 68fb ldr r3, [r7, #12] +} + 80033ee: 4618 mov r0, r3 + 80033f0: 3710 adds r7, #16 + 80033f2: 46bd mov sp, r7 + 80033f4: bd80 pop {r7, pc} + 80033f6: bf00 nop + 80033f8: 200007c8 .word 0x200007c8 + 80033fc: 200009e4 .word 0x200009e4 + +08003400 : + +//--------------------------------------------------------- + +void CanTransIntProc(void) +{ + 8003400: b580 push {r7, lr} + 8003402: b082 sub sp, #8 + 8003404: af00 add r7, sp, #0 + int rslt; + + rslt = TransCanDataToBus(); + 8003406: f7ff fea3 bl 8003150 + 800340a: 6078 str r0, [r7, #4] + + if (rslt == 0) // ҷͳɹ + 800340c: 687b ldr r3, [r7, #4] + 800340e: 2b00 cmp r3, #0 + 8003410: d00e beq.n 8003430 + { + //printf("send a can packet in int\r\n"); + } + else if (rslt == 1) // ûҪ + 8003412: 687b ldr r3, [r7, #4] + 8003414: 2b01 cmp r3, #1 + 8003416: d108 bne.n 800342a + { + // printf("send list empty in int, close int\r\n"); + g_canTxCtrl.sendingFlag = 0; + 8003418: 4b07 ldr r3, [pc, #28] ; (8003438 ) + 800341a: 2200 movs r2, #0 + 800341c: f8c3 220c str.w r2, [r3, #524] ; 0x20c + HAL_CAN_DeactivateNotification(&HCAN, CAN_IT_TX_MAILBOX_EMPTY); // ûݷͣرж + 8003420: 2101 movs r1, #1 + 8003422: 4806 ldr r0, [pc, #24] ; (800343c ) + 8003424: f7fe fc51 bl 8001cca + } + else // û + { + printf("no mail box in int\r\n"); + } +} + 8003428: e002 b.n 8003430 + printf("no mail box in int\r\n"); + 800342a: 4805 ldr r0, [pc, #20] ; (8003440 ) + 800342c: f006 fae2 bl 80099f4 +} + 8003430: bf00 nop + 8003432: 3708 adds r7, #8 + 8003434: 46bd mov sp, r7 + 8003436: bd80 pop {r7, pc} + 8003438: 200005b8 .word 0x200005b8 + 800343c: 2000058c .word 0x2000058c + 8003440: 0800ab28 .word 0x0800ab28 + +08003444 : + +void CanResvIntProc(void) +{ + 8003444: b580 push {r7, lr} + 8003446: b082 sub sp, #8 + 8003448: af00 add r7, sp, #0 + u32 len; + len = HAL_CAN_GetRxFifoFillLevel(&HCAN, CAN_RX_FIFO0); // + 800344a: 2100 movs r1, #0 + 800344c: 4808 ldr r0, [pc, #32] ; (8003470 ) + 800344e: f7fe fbf0 bl 8001c32 + 8003452: 6078 str r0, [r7, #4] + while(len != 0) + 8003454: e004 b.n 8003460 + { + //printf("get a can packet:\r\n"); + ResvCanDataFromBus(); // ȡݣӵ + 8003456: f7ff fec7 bl 80031e8 + len--; + 800345a: 687b ldr r3, [r7, #4] + 800345c: 3b01 subs r3, #1 + 800345e: 607b str r3, [r7, #4] + while(len != 0) + 8003460: 687b ldr r3, [r7, #4] + 8003462: 2b00 cmp r3, #0 + 8003464: d1f7 bne.n 8003456 + } +} + 8003466: bf00 nop + 8003468: 3708 adds r7, #8 + 800346a: 46bd mov sp, r7 + 800346c: bd80 pop {r7, pc} + 800346e: bf00 nop + 8003470: 2000058c .word 0x2000058c + +08003474 : + +//--------------------------------------------------------- + +// CAN0жϵĻص +void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *pcan) +{ + 8003474: b580 push {r7, lr} + 8003476: b082 sub sp, #8 + 8003478: af00 add r7, sp, #0 + 800347a: 6078 str r0, [r7, #4] +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + 800347c: f7ff ffc0 bl 8003400 + } +} + 8003480: bf00 nop + 8003482: 3708 adds r7, #8 + 8003484: 46bd mov sp, r7 + 8003486: bd80 pop {r7, pc} + +08003488 : + +// CAN1жϵĻص +void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *pcan) +{ + 8003488: b580 push {r7, lr} + 800348a: b082 sub sp, #8 + 800348c: af00 add r7, sp, #0 + 800348e: 6078 str r0, [r7, #4] +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + 8003490: f7ff ffb6 bl 8003400 + } +} + 8003494: bf00 nop + 8003496: 3708 adds r7, #8 + 8003498: 46bd mov sp, r7 + 800349a: bd80 pop {r7, pc} + +0800349c : + +// CAN2жϵĻص +void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *pcan) +{ + 800349c: b580 push {r7, lr} + 800349e: b082 sub sp, #8 + 80034a0: af00 add r7, sp, #0 + 80034a2: 6078 str r0, [r7, #4] +// if (pcan->Instance == CAN1) + { + CanTransIntProc(); + 80034a4: f7ff ffac bl 8003400 + } +} + 80034a8: bf00 nop + 80034aa: 3708 adds r7, #8 + 80034ac: 46bd mov sp, r7 + 80034ae: bd80 pop {r7, pc} + +080034b0 : + +// CAN0жϻص +void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *pcan) +{ + 80034b0: b580 push {r7, lr} + 80034b2: b082 sub sp, #8 + 80034b4: af00 add r7, sp, #0 + 80034b6: 6078 str r0, [r7, #4] +// if (pcan->Instance == CAN1) + { + //printf("rx fifo 0\r\n"); + CanResvIntProc(); + 80034b8: f7ff ffc4 bl 8003444 + } +} + 80034bc: bf00 nop + 80034be: 3708 adds r7, #8 + 80034c0: 46bd mov sp, r7 + 80034c2: bd80 pop {r7, pc} + +080034c4 : + +void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *pcan) +{ + 80034c4: b580 push {r7, lr} + 80034c6: b082 sub sp, #8 + 80034c8: af00 add r7, sp, #0 + 80034ca: 6078 str r0, [r7, #4] + printf("can rx fifo0 full\r\n"); + 80034cc: 4803 ldr r0, [pc, #12] ; (80034dc ) + 80034ce: f006 fa91 bl 80099f4 +} + 80034d2: bf00 nop + 80034d4: 3708 adds r7, #8 + 80034d6: 46bd mov sp, r7 + 80034d8: bd80 pop {r7, pc} + 80034da: bf00 nop + 80034dc: 0800ab3c .word 0x0800ab3c + +080034e0 : + +void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) +{ + 80034e0: b580 push {r7, lr} + 80034e2: b082 sub sp, #8 + 80034e4: af00 add r7, sp, #0 + 80034e6: 6078 str r0, [r7, #4] + printf("can error\r\n"); + 80034e8: 4803 ldr r0, [pc, #12] ; (80034f8 ) + 80034ea: f006 fa83 bl 80099f4 +} + 80034ee: bf00 nop + 80034f0: 3708 adds r7, #8 + 80034f2: 46bd mov sp, r7 + 80034f4: bd80 pop {r7, pc} + 80034f6: bf00 nop + 80034f8: 0800ab50 .word 0x0800ab50 + +080034fc : +} + +//--------------------------------------------------------------------------------------------- + +int SendData(u8 * pDatBuf, int len) +{ + 80034fc: b580 push {r7, lr} + 80034fe: b082 sub sp, #8 + 8003500: af00 add r7, sp, #0 + 8003502: 6078 str r0, [r7, #4] + 8003504: 6039 str r1, [r7, #0] + if (g_useQueue == 1) + 8003506: 4b09 ldr r3, [pc, #36] ; (800352c ) + 8003508: 681b ldr r3, [r3, #0] + 800350a: 2b01 cmp r3, #1 + 800350c: d105 bne.n 800351a + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1SendData(pDatBuf, len); + 800350e: 6839 ldr r1, [r7, #0] + 8003510: 6878 ldr r0, [r7, #4] + 8003512: f000 f9cb bl 80038ac + 8003516: 4603 mov r3, r0 + 8003518: e004 b.n 8003524 +#endif + } + else + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1SendDataSync(pDatBuf, len); + 800351a: 6839 ldr r1, [r7, #0] + 800351c: 6878 ldr r0, [r7, #4] + 800351e: f000 fb5d bl 8003bdc + 8003522: 4603 mov r3, r0 + return Usart6SendDataSync(pDatBuf, len); +#else + return 0; +#endif + } +} + 8003524: 4618 mov r0, r3 + 8003526: 3708 adds r7, #8 + 8003528: 46bd mov sp, r7 + 800352a: bd80 pop {r7, pc} + 800352c: 20000010 .word 0x20000010 + +08003530 : + +int ResvData(u8 * pDat, int expectLen) +{ + 8003530: b580 push {r7, lr} + 8003532: b082 sub sp, #8 + 8003534: af00 add r7, sp, #0 + 8003536: 6078 str r0, [r7, #4] + 8003538: 6039 str r1, [r7, #0] + if (g_useQueue == 1) + 800353a: 4b09 ldr r3, [pc, #36] ; (8003560 ) + 800353c: 681b ldr r3, [r3, #0] + 800353e: 2b01 cmp r3, #1 + 8003540: d105 bne.n 800354e + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1GetData(pDat, expectLen); + 8003542: 6839 ldr r1, [r7, #0] + 8003544: 6878 ldr r0, [r7, #4] + 8003546: f000 fa27 bl 8003998 + 800354a: 4603 mov r3, r0 + 800354c: e004 b.n 8003558 +#endif + } + else + { +#if (CONSOLE_PORT == COMM_USART1) + return Usart1GetDataSync(pDat, expectLen); + 800354e: 6839 ldr r1, [r7, #0] + 8003550: 6878 ldr r0, [r7, #4] + 8003552: f000 fb6f bl 8003c34 + 8003556: 4603 mov r3, r0 + return Usart6GetDataSync(pDat, expectLen); +#else + return 0; +#endif + } +} + 8003558: 4618 mov r0, r3 + 800355a: 3708 adds r7, #8 + 800355c: 46bd mov sp, r7 + 800355e: bd80 pop {r7, pc} + 8003560: 20000010 .word 0x20000010 + +08003564 <_read>: + } + return 0; +} + +int _read(int file, char *ptr, int len) +{ + 8003564: b580 push {r7, lr} + 8003566: b086 sub sp, #24 + 8003568: af00 add r7, sp, #0 + 800356a: 60f8 str r0, [r7, #12] + 800356c: 60b9 str r1, [r7, #8] + 800356e: 607a str r2, [r7, #4] + int rslt; + rslt = ResvData((u8*)ptr, len); + 8003570: 6879 ldr r1, [r7, #4] + 8003572: 68b8 ldr r0, [r7, #8] + 8003574: f7ff ffdc bl 8003530 + 8003578: 6178 str r0, [r7, #20] + return rslt; + 800357a: 697b ldr r3, [r7, #20] +} + 800357c: 4618 mov r0, r3 + 800357e: 3718 adds r7, #24 + 8003580: 46bd mov sp, r7 + 8003582: bd80 pop {r7, pc} + +08003584 <_write>: + +int _write(int file, char *ptr, int len) +{ + 8003584: b580 push {r7, lr} + 8003586: b084 sub sp, #16 + 8003588: af00 add r7, sp, #0 + 800358a: 60f8 str r0, [r7, #12] + 800358c: 60b9 str r1, [r7, #8] + 800358e: 607a str r2, [r7, #4] + SendData((u8*)ptr, len); + 8003590: 6879 ldr r1, [r7, #4] + 8003592: 68b8 ldr r0, [r7, #8] + 8003594: f7ff ffb2 bl 80034fc + return len; + 8003598: 687b ldr r3, [r7, #4] +} + 800359a: 4618 mov r0, r3 + 800359c: 3710 adds r7, #16 + 800359e: 46bd mov sp, r7 + 80035a0: bd80 pop {r7, pc} + ... + +080035a4 : + } +} + + +int IsConsoleCancel(void) +{ + 80035a4: b480 push {r7} + 80035a6: b083 sub sp, #12 + 80035a8: af00 add r7, sp, #0 + int rslt = g_cmdLine.cancel; + 80035aa: 4b06 ldr r3, [pc, #24] ; (80035c4 ) + 80035ac: 68db ldr r3, [r3, #12] + 80035ae: 607b str r3, [r7, #4] + g_cmdLine.cancel = 0; + 80035b0: 4b04 ldr r3, [pc, #16] ; (80035c4 ) + 80035b2: 2200 movs r2, #0 + 80035b4: 60da str r2, [r3, #12] + return rslt; + 80035b6: 687b ldr r3, [r7, #4] +} + 80035b8: 4618 mov r0, r3 + 80035ba: 370c adds r7, #12 + 80035bc: 46bd mov sp, r7 + 80035be: bc80 pop {r7} + 80035c0: 4770 bx lr + 80035c2: bf00 nop + 80035c4: 20000c08 .word 0x20000c08 + +080035c8 : +//---------------------------------- + +static int g_cricount = 0; + +void EnterCritical(void) +{ + 80035c8: b480 push {r7} + 80035ca: af00 add r7, sp, #0 + if (g_cricount == 0) + 80035cc: 4b06 ldr r3, [pc, #24] ; (80035e8 ) + 80035ce: 681b ldr r3, [r3, #0] + 80035d0: 2b00 cmp r3, #0 + 80035d2: d100 bne.n 80035d6 + __ASM volatile ("cpsid i" : : : "memory"); + 80035d4: b672 cpsid i + { + __disable_irq(); + } + g_cricount++; + 80035d6: 4b04 ldr r3, [pc, #16] ; (80035e8 ) + 80035d8: 681b ldr r3, [r3, #0] + 80035da: 3301 adds r3, #1 + 80035dc: 4a02 ldr r2, [pc, #8] ; (80035e8 ) + 80035de: 6013 str r3, [r2, #0] +} + 80035e0: bf00 nop + 80035e2: 46bd mov sp, r7 + 80035e4: bc80 pop {r7} + 80035e6: 4770 bx lr + 80035e8: 2000055c .word 0x2000055c + +080035ec : + +void ExitCritical(void) +{ + 80035ec: b480 push {r7} + 80035ee: af00 add r7, sp, #0 + if (g_cricount != 0) + 80035f0: 4b08 ldr r3, [pc, #32] ; (8003614 ) + 80035f2: 681b ldr r3, [r3, #0] + 80035f4: 2b00 cmp r3, #0 + 80035f6: d004 beq.n 8003602 + { + g_cricount--; + 80035f8: 4b06 ldr r3, [pc, #24] ; (8003614 ) + 80035fa: 681b ldr r3, [r3, #0] + 80035fc: 3b01 subs r3, #1 + 80035fe: 4a05 ldr r2, [pc, #20] ; (8003614 ) + 8003600: 6013 str r3, [r2, #0] + } + + if (g_cricount == 0) + 8003602: 4b04 ldr r3, [pc, #16] ; (8003614 ) + 8003604: 681b ldr r3, [r3, #0] + 8003606: 2b00 cmp r3, #0 + 8003608: d100 bne.n 800360c + __ASM volatile ("cpsie i" : : : "memory"); + 800360a: b662 cpsie i + { + __enable_irq(); + } +} + 800360c: bf00 nop + 800360e: 46bd mov sp, r7 + 8003610: bc80 pop {r7} + 8003612: 4770 bx lr + 8003614: 2000055c .word 0x2000055c + +08003618 : + }while(1); +} + + +void DelayUs(u32 us) +{ + 8003618: b580 push {r7, lr} + 800361a: b084 sub sp, #16 + 800361c: af00 add r7, sp, #0 + 800361e: 6078 str r0, [r7, #4] + u32 bus, tmpus; + bus = GetUsSoftTimer(); + 8003620: f001 f8ec bl 80047fc + 8003624: 60f8 str r0, [r7, #12] + do + { + tmpus = GetUsSoftTimer(); + 8003626: f001 f8e9 bl 80047fc + 800362a: 60b8 str r0, [r7, #8] + if (tmpus - bus > us) + 800362c: 68ba ldr r2, [r7, #8] + 800362e: 68fb ldr r3, [r7, #12] + 8003630: 1ad3 subs r3, r2, r3 + 8003632: 687a ldr r2, [r7, #4] + 8003634: 429a cmp r2, r3 + 8003636: d300 bcc.n 800363a + tmpus = GetUsSoftTimer(); + 8003638: e7f5 b.n 8003626 + { + break; + 800363a: bf00 nop + } + }while(1); +} + 800363c: bf00 nop + 800363e: 3710 adds r7, #16 + 8003640: 46bd mov sp, r7 + 8003642: bd80 pop {r7, pc} + +08003644 : + +void DelayMs(u32 ms) +{ + 8003644: b580 push {r7, lr} + 8003646: b086 sub sp, #24 + 8003648: af00 add r7, sp, #0 + 800364a: 6078 str r0, [r7, #4] + u32 bus, msus, tmpus; + bus = GetUsSoftTimer(); + 800364c: f001 f8d6 bl 80047fc + 8003650: 6178 str r0, [r7, #20] + msus = ms * 1000; + 8003652: 687b ldr r3, [r7, #4] + 8003654: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8003658: fb02 f303 mul.w r3, r2, r3 + 800365c: 613b str r3, [r7, #16] + do + { + tmpus = GetUsSoftTimer(); + 800365e: f001 f8cd bl 80047fc + 8003662: 60f8 str r0, [r7, #12] + if (tmpus - bus > msus) + 8003664: 68fa ldr r2, [r7, #12] + 8003666: 697b ldr r3, [r7, #20] + 8003668: 1ad3 subs r3, r2, r3 + 800366a: 693a ldr r2, [r7, #16] + 800366c: 429a cmp r2, r3 + 800366e: d300 bcc.n 8003672 + tmpus = GetUsSoftTimer(); + 8003670: e7f5 b.n 800365e + { + break; + 8003672: bf00 nop + } + }while(1); +} + 8003674: bf00 nop + 8003676: 3718 adds r7, #24 + 8003678: 46bd mov sp, r7 + 800367a: bd80 pop {r7, pc} + +0800367c : +#endif + +//------------------------------------------------------------------------------- + +void InitIWDog(u16 ms) +{ + 800367c: b480 push {r7} + 800367e: b083 sub sp, #12 + 8003680: af00 add r7, sp, #0 + 8003682: 4603 mov r3, r0 + 8003684: 80fb strh r3, [r7, #6] + if (ms < MAX_IWD_MS) + 8003686: 88fb ldrh r3, [r7, #6] + 8003688: f641 1298 movw r2, #6552 ; 0x1998 + 800368c: 4293 cmp r3, r2 + 800368e: d806 bhi.n 800369e + { + ms *= 10; + 8003690: 88fb ldrh r3, [r7, #6] + 8003692: 461a mov r2, r3 + 8003694: 0092 lsls r2, r2, #2 + 8003696: 4413 add r3, r2 + 8003698: 005b lsls r3, r3, #1 + 800369a: 80fb strh r3, [r7, #6] + + LL_IWDG_Enable(IWDG); // Ź +#endif +#endif + +} + 800369c: e002 b.n 80036a4 + ms = 65535; + 800369e: f64f 73ff movw r3, #65535 ; 0xffff + 80036a2: 80fb strh r3, [r7, #6] +} + 80036a4: bf00 nop + 80036a6: 370c adds r7, #12 + 80036a8: 46bd mov sp, r7 + 80036aa: bc80 pop {r7} + 80036ac: 4770 bx lr + +080036ae : + +void FeedIWDog(void) +{ + 80036ae: b480 push {r7} + 80036b0: af00 add r7, sp, #0 + +#ifdef USE_FULL_LL_DRIVER + LL_IWDG_ReloadCounter(IWDG); +#endif +#endif +} + 80036b2: bf00 nop + 80036b4: 46bd mov sp, r7 + 80036b6: bc80 pop {r7} + 80036b8: 4770 bx lr + +080036ba : +{ + 80036ba: b480 push {r7} + 80036bc: b083 sub sp, #12 + 80036be: af00 add r7, sp, #0 + 80036c0: 6078 str r0, [r7, #4] + SET_BIT(USARTx->CR1, USART_CR1_UE); + 80036c2: 687b ldr r3, [r7, #4] + 80036c4: 68db ldr r3, [r3, #12] + 80036c6: f443 5200 orr.w r2, r3, #8192 ; 0x2000 + 80036ca: 687b ldr r3, [r7, #4] + 80036cc: 60da str r2, [r3, #12] +} + 80036ce: bf00 nop + 80036d0: 370c adds r7, #12 + 80036d2: 46bd mov sp, r7 + 80036d4: bc80 pop {r7} + 80036d6: 4770 bx lr + +080036d8 : + * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx) +{ + 80036d8: b480 push {r7} + 80036da: b083 sub sp, #12 + 80036dc: af00 add r7, sp, #0 + 80036de: 6078 str r0, [r7, #4] + return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE)); + 80036e0: 687b ldr r3, [r7, #4] + 80036e2: 681b ldr r3, [r3, #0] + 80036e4: f003 0320 and.w r3, r3, #32 + 80036e8: 2b20 cmp r3, #32 + 80036ea: bf0c ite eq + 80036ec: 2301 moveq r3, #1 + 80036ee: 2300 movne r3, #0 + 80036f0: b2db uxtb r3, r3 +} + 80036f2: 4618 mov r0, r3 + 80036f4: 370c adds r7, #12 + 80036f6: 46bd mov sp, r7 + 80036f8: bc80 pop {r7} + 80036fa: 4770 bx lr + +080036fc : + * @rmtoll SR TC LL_USART_IsActiveFlag_TC + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx) +{ + 80036fc: b480 push {r7} + 80036fe: b083 sub sp, #12 + 8003700: af00 add r7, sp, #0 + 8003702: 6078 str r0, [r7, #4] + return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC)); + 8003704: 687b ldr r3, [r7, #4] + 8003706: 681b ldr r3, [r3, #0] + 8003708: f003 0340 and.w r3, r3, #64 ; 0x40 + 800370c: 2b40 cmp r3, #64 ; 0x40 + 800370e: bf0c ite eq + 8003710: 2301 moveq r3, #1 + 8003712: 2300 movne r3, #0 + 8003714: b2db uxtb r3, r3 +} + 8003716: 4618 mov r0, r3 + 8003718: 370c adds r7, #12 + 800371a: 46bd mov sp, r7 + 800371c: bc80 pop {r7} + 800371e: 4770 bx lr + +08003720 : + * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx) +{ + 8003720: b480 push {r7} + 8003722: b083 sub sp, #12 + 8003724: af00 add r7, sp, #0 + 8003726: 6078 str r0, [r7, #4] + return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE)); + 8003728: 687b ldr r3, [r7, #4] + 800372a: 681b ldr r3, [r3, #0] + 800372c: f003 0380 and.w r3, r3, #128 ; 0x80 + 8003730: 2b80 cmp r3, #128 ; 0x80 + 8003732: bf0c ite eq + 8003734: 2301 moveq r3, #1 + 8003736: 2300 movne r3, #0 + 8003738: b2db uxtb r3, r3 +} + 800373a: 4618 mov r0, r3 + 800373c: 370c adds r7, #12 + 800373e: 46bd mov sp, r7 + 8003740: bc80 pop {r7} + 8003742: 4770 bx lr + +08003744 : + * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx) +{ + 8003744: b480 push {r7} + 8003746: b083 sub sp, #12 + 8003748: af00 add r7, sp, #0 + 800374a: 6078 str r0, [r7, #4] + SET_BIT(USARTx->CR1, USART_CR1_RXNEIE); + 800374c: 687b ldr r3, [r7, #4] + 800374e: 68db ldr r3, [r3, #12] + 8003750: f043 0220 orr.w r2, r3, #32 + 8003754: 687b ldr r3, [r7, #4] + 8003756: 60da str r2, [r3, #12] +} + 8003758: bf00 nop + 800375a: 370c adds r7, #12 + 800375c: 46bd mov sp, r7 + 800375e: bc80 pop {r7} + 8003760: 4770 bx lr + +08003762 : + * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx) +{ + 8003762: b480 push {r7} + 8003764: b083 sub sp, #12 + 8003766: af00 add r7, sp, #0 + 8003768: 6078 str r0, [r7, #4] + SET_BIT(USARTx->CR1, USART_CR1_TXEIE); + 800376a: 687b ldr r3, [r7, #4] + 800376c: 68db ldr r3, [r3, #12] + 800376e: f043 0280 orr.w r2, r3, #128 ; 0x80 + 8003772: 687b ldr r3, [r7, #4] + 8003774: 60da str r2, [r3, #12] +} + 8003776: bf00 nop + 8003778: 370c adds r7, #12 + 800377a: 46bd mov sp, r7 + 800377c: bc80 pop {r7} + 800377e: 4770 bx lr + +08003780 : + * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx) +{ + 8003780: b480 push {r7} + 8003782: b083 sub sp, #12 + 8003784: af00 add r7, sp, #0 + 8003786: 6078 str r0, [r7, #4] + CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE); + 8003788: 687b ldr r3, [r7, #4] + 800378a: 68db ldr r3, [r3, #12] + 800378c: f023 0220 bic.w r2, r3, #32 + 8003790: 687b ldr r3, [r7, #4] + 8003792: 60da str r2, [r3, #12] +} + 8003794: bf00 nop + 8003796: 370c adds r7, #12 + 8003798: 46bd mov sp, r7 + 800379a: bc80 pop {r7} + 800379c: 4770 bx lr + +0800379e : + * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx) +{ + 800379e: b480 push {r7} + 80037a0: b083 sub sp, #12 + 80037a2: af00 add r7, sp, #0 + 80037a4: 6078 str r0, [r7, #4] + CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE); + 80037a6: 687b ldr r3, [r7, #4] + 80037a8: 68db ldr r3, [r3, #12] + 80037aa: f023 0280 bic.w r2, r3, #128 ; 0x80 + 80037ae: 687b ldr r3, [r7, #4] + 80037b0: 60da str r2, [r3, #12] +} + 80037b2: bf00 nop + 80037b4: 370c adds r7, #12 + 80037b6: 46bd mov sp, r7 + 80037b8: bc80 pop {r7} + 80037ba: 4770 bx lr + +080037bc : + * @rmtoll DR DR LL_USART_ReceiveData8 + * @param USARTx USART Instance + * @retval Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx) +{ + 80037bc: b480 push {r7} + 80037be: b083 sub sp, #12 + 80037c0: af00 add r7, sp, #0 + 80037c2: 6078 str r0, [r7, #4] + return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR)); + 80037c4: 687b ldr r3, [r7, #4] + 80037c6: 685b ldr r3, [r3, #4] + 80037c8: b2db uxtb r3, r3 +} + 80037ca: 4618 mov r0, r3 + 80037cc: 370c adds r7, #12 + 80037ce: 46bd mov sp, r7 + 80037d0: bc80 pop {r7} + 80037d2: 4770 bx lr + +080037d4 : + * @param USARTx USART Instance + * @param Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value) +{ + 80037d4: b480 push {r7} + 80037d6: b083 sub sp, #12 + 80037d8: af00 add r7, sp, #0 + 80037da: 6078 str r0, [r7, #4] + 80037dc: 460b mov r3, r1 + 80037de: 70fb strb r3, [r7, #3] + USARTx->DR = Value; + 80037e0: 78fa ldrb r2, [r7, #3] + 80037e2: 687b ldr r3, [r7, #4] + 80037e4: 605a str r2, [r3, #4] +} + 80037e6: bf00 nop + 80037e8: 370c adds r7, #12 + 80037ea: 46bd mov sp, r7 + 80037ec: bc80 pop {r7} + 80037ee: 4770 bx lr + +080037f0 : + return count; \ +}\ +/*------------------------------------------------------------------------------------------*/ + +#ifdef COMM_USART1 +USART_PROC(1); + 80037f0: b580 push {r7, lr} + 80037f2: b082 sub sp, #8 + 80037f4: af00 add r7, sp, #0 + 80037f6: 6078 str r0, [r7, #4] + 80037f8: 4608 mov r0, r1 + 80037fa: 4611 mov r1, r2 + 80037fc: 461a mov r2, r3 + 80037fe: 4603 mov r3, r0 + 8003800: 70fb strb r3, [r7, #3] + 8003802: 460b mov r3, r1 + 8003804: 70bb strb r3, [r7, #2] + 8003806: 4613 mov r3, r2 + 8003808: 707b strb r3, [r7, #1] + 800380a: 2238 movs r2, #56 ; 0x38 + 800380c: 2100 movs r1, #0 + 800380e: 4823 ldr r0, [pc, #140] ; (800389c ) + 8003810: f006 f873 bl 80098fa + 8003814: 4b21 ldr r3, [pc, #132] ; (800389c ) + 8003816: 4a22 ldr r2, [pc, #136] ; (80038a0 ) + 8003818: 611a str r2, [r3, #16] + 800381a: 4b20 ldr r3, [pc, #128] ; (800389c ) + 800381c: 2280 movs r2, #128 ; 0x80 + 800381e: 60da str r2, [r3, #12] + 8003820: 4b1e ldr r3, [pc, #120] ; (800389c ) + 8003822: 4a20 ldr r2, [pc, #128] ; (80038a4 ) + 8003824: 625a str r2, [r3, #36] ; 0x24 + 8003826: 4b1d ldr r3, [pc, #116] ; (800389c ) + 8003828: 2280 movs r2, #128 ; 0x80 + 800382a: 621a str r2, [r3, #32] + 800382c: 4b1b ldr r3, [pc, #108] ; (800389c ) + 800382e: 4a1e ldr r2, [pc, #120] ; (80038a8 ) + 8003830: 605a str r2, [r3, #4] + 8003832: 4a1a ldr r2, [pc, #104] ; (800389c ) + 8003834: 687b ldr r3, [r7, #4] + 8003836: 6093 str r3, [r2, #8] + 8003838: 4b18 ldr r3, [pc, #96] ; (800389c ) + 800383a: 691b ldr r3, [r3, #16] + 800383c: 4a17 ldr r2, [pc, #92] ; (800389c ) + 800383e: 6153 str r3, [r2, #20] + 8003840: 4b16 ldr r3, [pc, #88] ; (800389c ) + 8003842: 695b ldr r3, [r3, #20] + 8003844: 4a15 ldr r2, [pc, #84] ; (800389c ) + 8003846: 6193 str r3, [r2, #24] + 8003848: 4b14 ldr r3, [pc, #80] ; (800389c ) + 800384a: 2200 movs r2, #0 + 800384c: 839a strh r2, [r3, #28] + 800384e: 4b13 ldr r3, [pc, #76] ; (800389c ) + 8003850: 2200 movs r2, #0 + 8003852: 83da strh r2, [r3, #30] + 8003854: 4b11 ldr r3, [pc, #68] ; (800389c ) + 8003856: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003858: 4a10 ldr r2, [pc, #64] ; (800389c ) + 800385a: 6293 str r3, [r2, #40] ; 0x28 + 800385c: 4b0f ldr r3, [pc, #60] ; (800389c ) + 800385e: 6a9b ldr r3, [r3, #40] ; 0x28 + 8003860: 4a0e ldr r2, [pc, #56] ; (800389c ) + 8003862: 62d3 str r3, [r2, #44] ; 0x2c + 8003864: 4b0d ldr r3, [pc, #52] ; (800389c ) + 8003866: 2200 movs r2, #0 + 8003868: 861a strh r2, [r3, #48] ; 0x30 + 800386a: 4b0c ldr r3, [pc, #48] ; (800389c ) + 800386c: 2201 movs r2, #1 + 800386e: 865a strh r2, [r3, #50] ; 0x32 + 8003870: 4b0a ldr r3, [pc, #40] ; (800389c ) + 8003872: f245 52aa movw r2, #21930 ; 0x55aa + 8003876: 801a strh r2, [r3, #0] + 8003878: 4b08 ldr r3, [pc, #32] ; (800389c ) + 800387a: 2200 movs r2, #0 + 800387c: 635a str r2, [r3, #52] ; 0x34 + 800387e: 480a ldr r0, [pc, #40] ; (80038a8 ) + 8003880: f7ff ff9c bl 80037bc + 8003884: 4808 ldr r0, [pc, #32] ; (80038a8 ) + 8003886: f7ff ff5d bl 8003744 + 800388a: 4807 ldr r0, [pc, #28] ; (80038a8 ) + 800388c: f7ff ff15 bl 80036ba + 8003890: 2300 movs r3, #0 + 8003892: 4618 mov r0, r3 + 8003894: 3708 adds r7, #8 + 8003896: 46bd mov sp, r7 + 8003898: bd80 pop {r7, pc} + 800389a: bf00 nop + 800389c: 20000f44 .word 0x20000f44 + 80038a0: 20000d44 .word 0x20000d44 + 80038a4: 20000ec4 .word 0x20000ec4 + 80038a8: 40013800 .word 0x40013800 + +080038ac : + 80038ac: b580 push {r7, lr} + 80038ae: b084 sub sp, #16 + 80038b0: af00 add r7, sp, #0 + 80038b2: 6078 str r0, [r7, #4] + 80038b4: 6039 str r1, [r7, #0] + 80038b6: 687b ldr r3, [r7, #4] + 80038b8: 2b00 cmp r3, #0 + 80038ba: d002 beq.n 80038c2 + 80038bc: 683b ldr r3, [r7, #0] + 80038be: 2b00 cmp r3, #0 + 80038c0: da02 bge.n 80038c8 + 80038c2: f04f 33ff mov.w r3, #4294967295 + 80038c6: e061 b.n 800398c + 80038c8: 4b32 ldr r3, [pc, #200] ; (8003994 ) + 80038ca: 881b ldrh r3, [r3, #0] + 80038cc: f245 52aa movw r2, #21930 ; 0x55aa + 80038d0: 4293 cmp r3, r2 + 80038d2: d002 beq.n 80038da + 80038d4: f06f 0301 mvn.w r3, #1 + 80038d8: e058 b.n 800398c + 80038da: f7ff fe75 bl 80035c8 + 80038de: 4b2d ldr r3, [pc, #180] ; (8003994 ) + 80038e0: 8b9b ldrh r3, [r3, #28] + 80038e2: 461a mov r2, r3 + 80038e4: 683b ldr r3, [r7, #0] + 80038e6: 441a add r2, r3 + 80038e8: 4b2a ldr r3, [pc, #168] ; (8003994 ) + 80038ea: 68db ldr r3, [r3, #12] + 80038ec: 429a cmp r2, r3 + 80038ee: dd01 ble.n 80038f4 + 80038f0: 2300 movs r3, #0 + 80038f2: 603b str r3, [r7, #0] + 80038f4: 4b27 ldr r3, [pc, #156] ; (8003994 ) + 80038f6: 699b ldr r3, [r3, #24] + 80038f8: 60bb str r3, [r7, #8] + 80038fa: f7ff fe77 bl 80035ec + 80038fe: 683b ldr r3, [r7, #0] + 8003900: 2b00 cmp r3, #0 + 8003902: da02 bge.n 800390a + 8003904: f06f 0302 mvn.w r3, #2 + 8003908: e040 b.n 800398c + 800390a: 2300 movs r3, #0 + 800390c: 60fb str r3, [r7, #12] + 800390e: e016 b.n 800393e + 8003910: 687a ldr r2, [r7, #4] + 8003912: 1c53 adds r3, r2, #1 + 8003914: 607b str r3, [r7, #4] + 8003916: 68bb ldr r3, [r7, #8] + 8003918: 1c59 adds r1, r3, #1 + 800391a: 60b9 str r1, [r7, #8] + 800391c: 7812 ldrb r2, [r2, #0] + 800391e: 701a strb r2, [r3, #0] + 8003920: 4b1c ldr r3, [pc, #112] ; (8003994 ) + 8003922: 691a ldr r2, [r3, #16] + 8003924: 4b1b ldr r3, [pc, #108] ; (8003994 ) + 8003926: 68db ldr r3, [r3, #12] + 8003928: 3b01 subs r3, #1 + 800392a: 4413 add r3, r2 + 800392c: 68ba ldr r2, [r7, #8] + 800392e: 429a cmp r2, r3 + 8003930: d902 bls.n 8003938 + 8003932: 4b18 ldr r3, [pc, #96] ; (8003994 ) + 8003934: 691b ldr r3, [r3, #16] + 8003936: 60bb str r3, [r7, #8] + 8003938: 68fb ldr r3, [r7, #12] + 800393a: 3301 adds r3, #1 + 800393c: 60fb str r3, [r7, #12] + 800393e: 68fa ldr r2, [r7, #12] + 8003940: 683b ldr r3, [r7, #0] + 8003942: 429a cmp r2, r3 + 8003944: dbe4 blt.n 8003910 + 8003946: 683b ldr r3, [r7, #0] + 8003948: 2b00 cmp r3, #0 + 800394a: d01e beq.n 800398a + 800394c: f7ff fe3c bl 80035c8 + 8003950: 4a10 ldr r2, [pc, #64] ; (8003994 ) + 8003952: 68bb ldr r3, [r7, #8] + 8003954: 6193 str r3, [r2, #24] + 8003956: 4b0f ldr r3, [pc, #60] ; (8003994 ) + 8003958: 8b9a ldrh r2, [r3, #28] + 800395a: 683b ldr r3, [r7, #0] + 800395c: b29b uxth r3, r3 + 800395e: 4413 add r3, r2 + 8003960: b29a uxth r2, r3 + 8003962: 4b0c ldr r3, [pc, #48] ; (8003994 ) + 8003964: 839a strh r2, [r3, #28] + 8003966: 4b0b ldr r3, [pc, #44] ; (8003994 ) + 8003968: 8bdb ldrh r3, [r3, #30] + 800396a: 2b01 cmp r3, #1 + 800396c: d00b beq.n 8003986 + 800396e: 4b09 ldr r3, [pc, #36] ; (8003994 ) + 8003970: 8b9b ldrh r3, [r3, #28] + 8003972: 2b00 cmp r3, #0 + 8003974: d007 beq.n 8003986 + 8003976: 4b07 ldr r3, [pc, #28] ; (8003994 ) + 8003978: 2201 movs r2, #1 + 800397a: 83da strh r2, [r3, #30] + 800397c: 4b05 ldr r3, [pc, #20] ; (8003994 ) + 800397e: 685b ldr r3, [r3, #4] + 8003980: 4618 mov r0, r3 + 8003982: f7ff feee bl 8003762 + 8003986: f7ff fe31 bl 80035ec + 800398a: 683b ldr r3, [r7, #0] + 800398c: 4618 mov r0, r3 + 800398e: 3710 adds r7, #16 + 8003990: 46bd mov sp, r7 + 8003992: bd80 pop {r7, pc} + 8003994: 20000f44 .word 0x20000f44 + +08003998 : + 8003998: b580 push {r7, lr} + 800399a: b086 sub sp, #24 + 800399c: af00 add r7, sp, #0 + 800399e: 6078 str r0, [r7, #4] + 80039a0: 6039 str r1, [r7, #0] + 80039a2: 687b ldr r3, [r7, #4] + 80039a4: 2b00 cmp r3, #0 + 80039a6: d002 beq.n 80039ae + 80039a8: 683b ldr r3, [r7, #0] + 80039aa: 2b00 cmp r3, #0 + 80039ac: da02 bge.n 80039b4 + 80039ae: f04f 33ff mov.w r3, #4294967295 + 80039b2: e04d b.n 8003a50 + 80039b4: 4b28 ldr r3, [pc, #160] ; (8003a58 ) + 80039b6: 881b ldrh r3, [r3, #0] + 80039b8: f245 52aa movw r2, #21930 ; 0x55aa + 80039bc: 4293 cmp r3, r2 + 80039be: d002 beq.n 80039c6 + 80039c0: f06f 0301 mvn.w r3, #1 + 80039c4: e044 b.n 8003a50 + 80039c6: f7ff fdff bl 80035c8 + 80039ca: 4b23 ldr r3, [pc, #140] ; (8003a58 ) + 80039cc: 6a9b ldr r3, [r3, #40] ; 0x28 + 80039ce: 613b str r3, [r7, #16] + 80039d0: 4b21 ldr r3, [pc, #132] ; (8003a58 ) + 80039d2: 8e1b ldrh r3, [r3, #48] ; 0x30 + 80039d4: 60fb str r3, [r7, #12] + 80039d6: f7ff fe09 bl 80035ec + 80039da: 68fb ldr r3, [r7, #12] + 80039dc: 2b00 cmp r3, #0 + 80039de: da02 bge.n 80039e6 + 80039e0: f06f 0302 mvn.w r3, #2 + 80039e4: e034 b.n 8003a50 + 80039e6: 683a ldr r2, [r7, #0] + 80039e8: 68fb ldr r3, [r7, #12] + 80039ea: 429a cmp r2, r3 + 80039ec: dd01 ble.n 80039f2 + 80039ee: 2300 movs r3, #0 + 80039f0: e02e b.n 8003a50 + 80039f2: 2300 movs r3, #0 + 80039f4: 617b str r3, [r7, #20] + 80039f6: e017 b.n 8003a28 + 80039f8: 687b ldr r3, [r7, #4] + 80039fa: 1c5a adds r2, r3, #1 + 80039fc: 607a str r2, [r7, #4] + 80039fe: 693a ldr r2, [r7, #16] + 8003a00: 7812 ldrb r2, [r2, #0] + 8003a02: 701a strb r2, [r3, #0] + 8003a04: 693b ldr r3, [r7, #16] + 8003a06: 3301 adds r3, #1 + 8003a08: 613b str r3, [r7, #16] + 8003a0a: 4b13 ldr r3, [pc, #76] ; (8003a58 ) + 8003a0c: 6a5a ldr r2, [r3, #36] ; 0x24 + 8003a0e: 4b12 ldr r3, [pc, #72] ; (8003a58 ) + 8003a10: 6a1b ldr r3, [r3, #32] + 8003a12: 3b01 subs r3, #1 + 8003a14: 4413 add r3, r2 + 8003a16: 693a ldr r2, [r7, #16] + 8003a18: 429a cmp r2, r3 + 8003a1a: d902 bls.n 8003a22 + 8003a1c: 4b0e ldr r3, [pc, #56] ; (8003a58 ) + 8003a1e: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003a20: 613b str r3, [r7, #16] + 8003a22: 697b ldr r3, [r7, #20] + 8003a24: 3301 adds r3, #1 + 8003a26: 617b str r3, [r7, #20] + 8003a28: 697a ldr r2, [r7, #20] + 8003a2a: 683b ldr r3, [r7, #0] + 8003a2c: 429a cmp r2, r3 + 8003a2e: dbe3 blt.n 80039f8 + 8003a30: f7ff fdca bl 80035c8 + 8003a34: 4a08 ldr r2, [pc, #32] ; (8003a58 ) + 8003a36: 693b ldr r3, [r7, #16] + 8003a38: 6293 str r3, [r2, #40] ; 0x28 + 8003a3a: 4b07 ldr r3, [pc, #28] ; (8003a58 ) + 8003a3c: 8e1a ldrh r2, [r3, #48] ; 0x30 + 8003a3e: 683b ldr r3, [r7, #0] + 8003a40: b29b uxth r3, r3 + 8003a42: 1ad3 subs r3, r2, r3 + 8003a44: b29a uxth r2, r3 + 8003a46: 4b04 ldr r3, [pc, #16] ; (8003a58 ) + 8003a48: 861a strh r2, [r3, #48] ; 0x30 + 8003a4a: f7ff fdcf bl 80035ec + 8003a4e: 683b ldr r3, [r7, #0] + 8003a50: 4618 mov r0, r3 + 8003a52: 3718 adds r7, #24 + 8003a54: 46bd mov sp, r7 + 8003a56: bd80 pop {r7, pc} + 8003a58: 20000f44 .word 0x20000f44 + +08003a5c : + 8003a5c: b580 push {r7, lr} + 8003a5e: b082 sub sp, #8 + 8003a60: af00 add r7, sp, #0 + 8003a62: f7ff fdb1 bl 80035c8 + 8003a66: 4b08 ldr r3, [pc, #32] ; (8003a88 ) + 8003a68: 6adb ldr r3, [r3, #44] ; 0x2c + 8003a6a: 4a07 ldr r2, [pc, #28] ; (8003a88 ) + 8003a6c: 6293 str r3, [r2, #40] ; 0x28 + 8003a6e: 4b06 ldr r3, [pc, #24] ; (8003a88 ) + 8003a70: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003a72: 607b str r3, [r7, #4] + 8003a74: 4b04 ldr r3, [pc, #16] ; (8003a88 ) + 8003a76: 2200 movs r2, #0 + 8003a78: 861a strh r2, [r3, #48] ; 0x30 + 8003a7a: f7ff fdb7 bl 80035ec + 8003a7e: 687b ldr r3, [r7, #4] + 8003a80: 4618 mov r0, r3 + 8003a82: 3708 adds r7, #8 + 8003a84: 46bd mov sp, r7 + 8003a86: bd80 pop {r7, pc} + 8003a88: 20000f44 .word 0x20000f44 + +08003a8c : + 8003a8c: b580 push {r7, lr} + 8003a8e: b082 sub sp, #8 + 8003a90: af00 add r7, sp, #0 + 8003a92: f7ff fd99 bl 80035c8 + 8003a96: 4b07 ldr r3, [pc, #28] ; (8003ab4 ) + 8003a98: 8bdb ldrh r3, [r3, #30] + 8003a9a: 607b str r3, [r7, #4] + 8003a9c: f7ff fda6 bl 80035ec + 8003aa0: 687b ldr r3, [r7, #4] + 8003aa2: 2b01 cmp r3, #1 + 8003aa4: d101 bne.n 8003aaa + 8003aa6: 2300 movs r3, #0 + 8003aa8: e000 b.n 8003aac + 8003aaa: 2301 movs r3, #1 + 8003aac: 4618 mov r0, r3 + 8003aae: 3708 adds r7, #8 + 8003ab0: 46bd mov sp, r7 + 8003ab2: bd80 pop {r7, pc} + 8003ab4: 20000f44 .word 0x20000f44 + +08003ab8 : + 8003ab8: b580 push {r7, lr} + 8003aba: b082 sub sp, #8 + 8003abc: af00 add r7, sp, #0 + 8003abe: 4b46 ldr r3, [pc, #280] ; (8003bd8 ) + 8003ac0: 685b ldr r3, [r3, #4] + 8003ac2: 4618 mov r0, r3 + 8003ac4: f7ff fe08 bl 80036d8 + 8003ac8: 4603 mov r3, r0 + 8003aca: 2b00 cmp r3, #0 + 8003acc: d039 beq.n 8003b42 + 8003ace: 4b42 ldr r3, [pc, #264] ; (8003bd8 ) + 8003ad0: 685b ldr r3, [r3, #4] + 8003ad2: 4618 mov r0, r3 + 8003ad4: f7ff fe72 bl 80037bc + 8003ad8: 4603 mov r3, r0 + 8003ada: 71fb strb r3, [r7, #7] + 8003adc: 4b3e ldr r3, [pc, #248] ; (8003bd8 ) + 8003ade: 881b ldrh r3, [r3, #0] + 8003ae0: f245 52aa movw r2, #21930 ; 0x55aa + 8003ae4: 4293 cmp r3, r2 + 8003ae6: d173 bne.n 8003bd0 + 8003ae8: 4b3b ldr r3, [pc, #236] ; (8003bd8 ) + 8003aea: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003aec: 461a mov r2, r3 + 8003aee: 4b3a ldr r3, [pc, #232] ; (8003bd8 ) + 8003af0: 6a1b ldr r3, [r3, #32] + 8003af2: 429a cmp r2, r3 + 8003af4: da1c bge.n 8003b30 + 8003af6: 4b38 ldr r3, [pc, #224] ; (8003bd8 ) + 8003af8: 6adb ldr r3, [r3, #44] ; 0x2c + 8003afa: 79fa ldrb r2, [r7, #7] + 8003afc: 701a strb r2, [r3, #0] + 8003afe: 4b36 ldr r3, [pc, #216] ; (8003bd8 ) + 8003b00: 6adb ldr r3, [r3, #44] ; 0x2c + 8003b02: 3301 adds r3, #1 + 8003b04: 4a34 ldr r2, [pc, #208] ; (8003bd8 ) + 8003b06: 62d3 str r3, [r2, #44] ; 0x2c + 8003b08: 4b33 ldr r3, [pc, #204] ; (8003bd8 ) + 8003b0a: 6ada ldr r2, [r3, #44] ; 0x2c + 8003b0c: 4b32 ldr r3, [pc, #200] ; (8003bd8 ) + 8003b0e: 6a59 ldr r1, [r3, #36] ; 0x24 + 8003b10: 4b31 ldr r3, [pc, #196] ; (8003bd8 ) + 8003b12: 6a1b ldr r3, [r3, #32] + 8003b14: 3b01 subs r3, #1 + 8003b16: 440b add r3, r1 + 8003b18: 429a cmp r2, r3 + 8003b1a: d903 bls.n 8003b24 + 8003b1c: 4b2e ldr r3, [pc, #184] ; (8003bd8 ) + 8003b1e: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003b20: 4a2d ldr r2, [pc, #180] ; (8003bd8 ) + 8003b22: 62d3 str r3, [r2, #44] ; 0x2c + 8003b24: 4b2c ldr r3, [pc, #176] ; (8003bd8 ) + 8003b26: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003b28: 3301 adds r3, #1 + 8003b2a: b29a uxth r2, r3 + 8003b2c: 4b2a ldr r3, [pc, #168] ; (8003bd8 ) + 8003b2e: 861a strh r2, [r3, #48] ; 0x30 + 8003b30: 4b29 ldr r3, [pc, #164] ; (8003bd8 ) + 8003b32: 6b5b ldr r3, [r3, #52] ; 0x34 + 8003b34: 2b00 cmp r3, #0 + 8003b36: d004 beq.n 8003b42 + 8003b38: 4b27 ldr r3, [pc, #156] ; (8003bd8 ) + 8003b3a: 6b5b ldr r3, [r3, #52] ; 0x34 + 8003b3c: 79fa ldrb r2, [r7, #7] + 8003b3e: 4610 mov r0, r2 + 8003b40: 4798 blx r3 + 8003b42: 4b25 ldr r3, [pc, #148] ; (8003bd8 ) + 8003b44: 685b ldr r3, [r3, #4] + 8003b46: 4618 mov r0, r3 + 8003b48: f7ff fdea bl 8003720 + 8003b4c: 4603 mov r3, r0 + 8003b4e: 2b00 cmp r3, #0 + 8003b50: d03f beq.n 8003bd2 + 8003b52: 4b21 ldr r3, [pc, #132] ; (8003bd8 ) + 8003b54: 881b ldrh r3, [r3, #0] + 8003b56: f245 52aa movw r2, #21930 ; 0x55aa + 8003b5a: 4293 cmp r3, r2 + 8003b5c: d005 beq.n 8003b6a + 8003b5e: 4b1e ldr r3, [pc, #120] ; (8003bd8 ) + 8003b60: 685b ldr r3, [r3, #4] + 8003b62: 4618 mov r0, r3 + 8003b64: f7ff fe1b bl 800379e + 8003b68: e033 b.n 8003bd2 + 8003b6a: 4b1b ldr r3, [pc, #108] ; (8003bd8 ) + 8003b6c: 8b9b ldrh r3, [r3, #28] + 8003b6e: 2b00 cmp r3, #0 + 8003b70: d025 beq.n 8003bbe + 8003b72: 4b19 ldr r3, [pc, #100] ; (8003bd8 ) + 8003b74: 685a ldr r2, [r3, #4] + 8003b76: 4b18 ldr r3, [pc, #96] ; (8003bd8 ) + 8003b78: 695b ldr r3, [r3, #20] + 8003b7a: 781b ldrb r3, [r3, #0] + 8003b7c: 4619 mov r1, r3 + 8003b7e: 4610 mov r0, r2 + 8003b80: f7ff fe28 bl 80037d4 + 8003b84: 4b14 ldr r3, [pc, #80] ; (8003bd8 ) + 8003b86: 695b ldr r3, [r3, #20] + 8003b88: 3301 adds r3, #1 + 8003b8a: 4a13 ldr r2, [pc, #76] ; (8003bd8 ) + 8003b8c: 6153 str r3, [r2, #20] + 8003b8e: 4b12 ldr r3, [pc, #72] ; (8003bd8 ) + 8003b90: 695a ldr r2, [r3, #20] + 8003b92: 4b11 ldr r3, [pc, #68] ; (8003bd8 ) + 8003b94: 6919 ldr r1, [r3, #16] + 8003b96: 4b10 ldr r3, [pc, #64] ; (8003bd8 ) + 8003b98: 68db ldr r3, [r3, #12] + 8003b9a: 3b01 subs r3, #1 + 8003b9c: 440b add r3, r1 + 8003b9e: 429a cmp r2, r3 + 8003ba0: d903 bls.n 8003baa + 8003ba2: 4b0d ldr r3, [pc, #52] ; (8003bd8 ) + 8003ba4: 691b ldr r3, [r3, #16] + 8003ba6: 4a0c ldr r2, [pc, #48] ; (8003bd8 ) + 8003ba8: 6153 str r3, [r2, #20] + 8003baa: 4b0b ldr r3, [pc, #44] ; (8003bd8 ) + 8003bac: 8b9b ldrh r3, [r3, #28] + 8003bae: 3b01 subs r3, #1 + 8003bb0: b29a uxth r2, r3 + 8003bb2: 4b09 ldr r3, [pc, #36] ; (8003bd8 ) + 8003bb4: 839a strh r2, [r3, #28] + 8003bb6: 4b08 ldr r3, [pc, #32] ; (8003bd8 ) + 8003bb8: 2201 movs r2, #1 + 8003bba: 83da strh r2, [r3, #30] + 8003bbc: e009 b.n 8003bd2 + 8003bbe: 4b06 ldr r3, [pc, #24] ; (8003bd8 ) + 8003bc0: 2200 movs r2, #0 + 8003bc2: 83da strh r2, [r3, #30] + 8003bc4: 4b04 ldr r3, [pc, #16] ; (8003bd8 ) + 8003bc6: 685b ldr r3, [r3, #4] + 8003bc8: 4618 mov r0, r3 + 8003bca: f7ff fde8 bl 800379e + 8003bce: e000 b.n 8003bd2 + 8003bd0: bf00 nop + 8003bd2: 3708 adds r7, #8 + 8003bd4: 46bd mov sp, r7 + 8003bd6: bd80 pop {r7, pc} + 8003bd8: 20000f44 .word 0x20000f44 + +08003bdc : + 8003bdc: b580 push {r7, lr} + 8003bde: b082 sub sp, #8 + 8003be0: af00 add r7, sp, #0 + 8003be2: 6078 str r0, [r7, #4] + 8003be4: 6039 str r1, [r7, #0] + 8003be6: 4b12 ldr r3, [pc, #72] ; (8003c30 ) + 8003be8: 685b ldr r3, [r3, #4] + 8003bea: 4618 mov r0, r3 + 8003bec: f7ff fdd7 bl 800379e + 8003bf0: e016 b.n 8003c20 + 8003bf2: bf00 nop + 8003bf4: 4b0e ldr r3, [pc, #56] ; (8003c30 ) + 8003bf6: 685b ldr r3, [r3, #4] + 8003bf8: 4618 mov r0, r3 + 8003bfa: f7ff fd7f bl 80036fc + 8003bfe: 4603 mov r3, r0 + 8003c00: 2b00 cmp r3, #0 + 8003c02: d0f7 beq.n 8003bf4 + 8003c04: 4b0a ldr r3, [pc, #40] ; (8003c30 ) + 8003c06: 685a ldr r2, [r3, #4] + 8003c08: 687b ldr r3, [r7, #4] + 8003c0a: 781b ldrb r3, [r3, #0] + 8003c0c: 4619 mov r1, r3 + 8003c0e: 4610 mov r0, r2 + 8003c10: f7ff fde0 bl 80037d4 + 8003c14: 687b ldr r3, [r7, #4] + 8003c16: 3301 adds r3, #1 + 8003c18: 607b str r3, [r7, #4] + 8003c1a: 683b ldr r3, [r7, #0] + 8003c1c: 3b01 subs r3, #1 + 8003c1e: 603b str r3, [r7, #0] + 8003c20: 683b ldr r3, [r7, #0] + 8003c22: 2b00 cmp r3, #0 + 8003c24: d1e5 bne.n 8003bf2 + 8003c26: 683b ldr r3, [r7, #0] + 8003c28: 4618 mov r0, r3 + 8003c2a: 3708 adds r7, #8 + 8003c2c: 46bd mov sp, r7 + 8003c2e: bd80 pop {r7, pc} + 8003c30: 20000f44 .word 0x20000f44 + +08003c34 : + 8003c34: b580 push {r7, lr} + 8003c36: b084 sub sp, #16 + 8003c38: af00 add r7, sp, #0 + 8003c3a: 6078 str r0, [r7, #4] + 8003c3c: 6039 str r1, [r7, #0] + 8003c3e: 2300 movs r3, #0 + 8003c40: 60fb str r3, [r7, #12] + 8003c42: 4b14 ldr r3, [pc, #80] ; (8003c94 ) + 8003c44: 685b ldr r3, [r3, #4] + 8003c46: 4618 mov r0, r3 + 8003c48: f7ff fd9a bl 8003780 + 8003c4c: e01a b.n 8003c84 + 8003c4e: bf00 nop + 8003c50: 4b10 ldr r3, [pc, #64] ; (8003c94 ) + 8003c52: 685b ldr r3, [r3, #4] + 8003c54: 4618 mov r0, r3 + 8003c56: f7ff fd51 bl 80036fc + 8003c5a: 4603 mov r3, r0 + 8003c5c: 2b00 cmp r3, #0 + 8003c5e: d0f7 beq.n 8003c50 + 8003c60: 4b0c ldr r3, [pc, #48] ; (8003c94 ) + 8003c62: 685b ldr r3, [r3, #4] + 8003c64: 4618 mov r0, r3 + 8003c66: f7ff fda9 bl 80037bc + 8003c6a: 4603 mov r3, r0 + 8003c6c: 461a mov r2, r3 + 8003c6e: 687b ldr r3, [r7, #4] + 8003c70: 701a strb r2, [r3, #0] + 8003c72: 687b ldr r3, [r7, #4] + 8003c74: 3301 adds r3, #1 + 8003c76: 607b str r3, [r7, #4] + 8003c78: 683b ldr r3, [r7, #0] + 8003c7a: 3b01 subs r3, #1 + 8003c7c: 603b str r3, [r7, #0] + 8003c7e: 68fb ldr r3, [r7, #12] + 8003c80: 3301 adds r3, #1 + 8003c82: 60fb str r3, [r7, #12] + 8003c84: 683b ldr r3, [r7, #0] + 8003c86: 2b00 cmp r3, #0 + 8003c88: d1e1 bne.n 8003c4e + 8003c8a: 68fb ldr r3, [r7, #12] + 8003c8c: 4618 mov r0, r3 + 8003c8e: 3710 adds r7, #16 + 8003c90: 46bd mov sp, r7 + 8003c92: bd80 pop {r7, pc} + 8003c94: 20000f44 .word 0x20000f44 + +08003c98 : +#endif + +#ifdef COMM_USART2 +USART_PROC(2); + 8003c98: b580 push {r7, lr} + 8003c9a: b082 sub sp, #8 + 8003c9c: af00 add r7, sp, #0 + 8003c9e: 6078 str r0, [r7, #4] + 8003ca0: 4608 mov r0, r1 + 8003ca2: 4611 mov r1, r2 + 8003ca4: 461a mov r2, r3 + 8003ca6: 4603 mov r3, r0 + 8003ca8: 70fb strb r3, [r7, #3] + 8003caa: 460b mov r3, r1 + 8003cac: 70bb strb r3, [r7, #2] + 8003cae: 4613 mov r3, r2 + 8003cb0: 707b strb r3, [r7, #1] + 8003cb2: 2238 movs r2, #56 ; 0x38 + 8003cb4: 2100 movs r1, #0 + 8003cb6: 4823 ldr r0, [pc, #140] ; (8003d44 ) + 8003cb8: f005 fe1f bl 80098fa + 8003cbc: 4b21 ldr r3, [pc, #132] ; (8003d44 ) + 8003cbe: 4a22 ldr r2, [pc, #136] ; (8003d48 ) + 8003cc0: 611a str r2, [r3, #16] + 8003cc2: 4b20 ldr r3, [pc, #128] ; (8003d44 ) + 8003cc4: 2280 movs r2, #128 ; 0x80 + 8003cc6: 60da str r2, [r3, #12] + 8003cc8: 4b1e ldr r3, [pc, #120] ; (8003d44 ) + 8003cca: 4a20 ldr r2, [pc, #128] ; (8003d4c ) + 8003ccc: 625a str r2, [r3, #36] ; 0x24 + 8003cce: 4b1d ldr r3, [pc, #116] ; (8003d44 ) + 8003cd0: 2280 movs r2, #128 ; 0x80 + 8003cd2: 621a str r2, [r3, #32] + 8003cd4: 4b1b ldr r3, [pc, #108] ; (8003d44 ) + 8003cd6: 4a1e ldr r2, [pc, #120] ; (8003d50 ) + 8003cd8: 605a str r2, [r3, #4] + 8003cda: 4a1a ldr r2, [pc, #104] ; (8003d44 ) + 8003cdc: 687b ldr r3, [r7, #4] + 8003cde: 6093 str r3, [r2, #8] + 8003ce0: 4b18 ldr r3, [pc, #96] ; (8003d44 ) + 8003ce2: 691b ldr r3, [r3, #16] + 8003ce4: 4a17 ldr r2, [pc, #92] ; (8003d44 ) + 8003ce6: 6153 str r3, [r2, #20] + 8003ce8: 4b16 ldr r3, [pc, #88] ; (8003d44 ) + 8003cea: 695b ldr r3, [r3, #20] + 8003cec: 4a15 ldr r2, [pc, #84] ; (8003d44 ) + 8003cee: 6193 str r3, [r2, #24] + 8003cf0: 4b14 ldr r3, [pc, #80] ; (8003d44 ) + 8003cf2: 2200 movs r2, #0 + 8003cf4: 839a strh r2, [r3, #28] + 8003cf6: 4b13 ldr r3, [pc, #76] ; (8003d44 ) + 8003cf8: 2200 movs r2, #0 + 8003cfa: 83da strh r2, [r3, #30] + 8003cfc: 4b11 ldr r3, [pc, #68] ; (8003d44 ) + 8003cfe: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003d00: 4a10 ldr r2, [pc, #64] ; (8003d44 ) + 8003d02: 6293 str r3, [r2, #40] ; 0x28 + 8003d04: 4b0f ldr r3, [pc, #60] ; (8003d44 ) + 8003d06: 6a9b ldr r3, [r3, #40] ; 0x28 + 8003d08: 4a0e ldr r2, [pc, #56] ; (8003d44 ) + 8003d0a: 62d3 str r3, [r2, #44] ; 0x2c + 8003d0c: 4b0d ldr r3, [pc, #52] ; (8003d44 ) + 8003d0e: 2200 movs r2, #0 + 8003d10: 861a strh r2, [r3, #48] ; 0x30 + 8003d12: 4b0c ldr r3, [pc, #48] ; (8003d44 ) + 8003d14: 2201 movs r2, #1 + 8003d16: 865a strh r2, [r3, #50] ; 0x32 + 8003d18: 4b0a ldr r3, [pc, #40] ; (8003d44 ) + 8003d1a: f245 52aa movw r2, #21930 ; 0x55aa + 8003d1e: 801a strh r2, [r3, #0] + 8003d20: 4b08 ldr r3, [pc, #32] ; (8003d44 ) + 8003d22: 2200 movs r2, #0 + 8003d24: 635a str r2, [r3, #52] ; 0x34 + 8003d26: 480a ldr r0, [pc, #40] ; (8003d50 ) + 8003d28: f7ff fd48 bl 80037bc + 8003d2c: 4808 ldr r0, [pc, #32] ; (8003d50 ) + 8003d2e: f7ff fd09 bl 8003744 + 8003d32: 4807 ldr r0, [pc, #28] ; (8003d50 ) + 8003d34: f7ff fcc1 bl 80036ba + 8003d38: 2300 movs r3, #0 + 8003d3a: 4618 mov r0, r3 + 8003d3c: 3708 adds r7, #8 + 8003d3e: 46bd mov sp, r7 + 8003d40: bd80 pop {r7, pc} + 8003d42: bf00 nop + 8003d44: 20000c8c .word 0x20000c8c + 8003d48: 20000fb4 .word 0x20000fb4 + 8003d4c: 20000dc4 .word 0x20000dc4 + 8003d50: 40004400 .word 0x40004400 + +08003d54 : + 8003d54: b580 push {r7, lr} + 8003d56: b084 sub sp, #16 + 8003d58: af00 add r7, sp, #0 + 8003d5a: 6078 str r0, [r7, #4] + 8003d5c: 6039 str r1, [r7, #0] + 8003d5e: 687b ldr r3, [r7, #4] + 8003d60: 2b00 cmp r3, #0 + 8003d62: d002 beq.n 8003d6a + 8003d64: 683b ldr r3, [r7, #0] + 8003d66: 2b00 cmp r3, #0 + 8003d68: da02 bge.n 8003d70 + 8003d6a: f04f 33ff mov.w r3, #4294967295 + 8003d6e: e061 b.n 8003e34 + 8003d70: 4b32 ldr r3, [pc, #200] ; (8003e3c ) + 8003d72: 881b ldrh r3, [r3, #0] + 8003d74: f245 52aa movw r2, #21930 ; 0x55aa + 8003d78: 4293 cmp r3, r2 + 8003d7a: d002 beq.n 8003d82 + 8003d7c: f06f 0301 mvn.w r3, #1 + 8003d80: e058 b.n 8003e34 + 8003d82: f7ff fc21 bl 80035c8 + 8003d86: 4b2d ldr r3, [pc, #180] ; (8003e3c ) + 8003d88: 8b9b ldrh r3, [r3, #28] + 8003d8a: 461a mov r2, r3 + 8003d8c: 683b ldr r3, [r7, #0] + 8003d8e: 441a add r2, r3 + 8003d90: 4b2a ldr r3, [pc, #168] ; (8003e3c ) + 8003d92: 68db ldr r3, [r3, #12] + 8003d94: 429a cmp r2, r3 + 8003d96: dd01 ble.n 8003d9c + 8003d98: 2300 movs r3, #0 + 8003d9a: 603b str r3, [r7, #0] + 8003d9c: 4b27 ldr r3, [pc, #156] ; (8003e3c ) + 8003d9e: 699b ldr r3, [r3, #24] + 8003da0: 60bb str r3, [r7, #8] + 8003da2: f7ff fc23 bl 80035ec + 8003da6: 683b ldr r3, [r7, #0] + 8003da8: 2b00 cmp r3, #0 + 8003daa: da02 bge.n 8003db2 + 8003dac: f06f 0302 mvn.w r3, #2 + 8003db0: e040 b.n 8003e34 + 8003db2: 2300 movs r3, #0 + 8003db4: 60fb str r3, [r7, #12] + 8003db6: e016 b.n 8003de6 + 8003db8: 687a ldr r2, [r7, #4] + 8003dba: 1c53 adds r3, r2, #1 + 8003dbc: 607b str r3, [r7, #4] + 8003dbe: 68bb ldr r3, [r7, #8] + 8003dc0: 1c59 adds r1, r3, #1 + 8003dc2: 60b9 str r1, [r7, #8] + 8003dc4: 7812 ldrb r2, [r2, #0] + 8003dc6: 701a strb r2, [r3, #0] + 8003dc8: 4b1c ldr r3, [pc, #112] ; (8003e3c ) + 8003dca: 691a ldr r2, [r3, #16] + 8003dcc: 4b1b ldr r3, [pc, #108] ; (8003e3c ) + 8003dce: 68db ldr r3, [r3, #12] + 8003dd0: 3b01 subs r3, #1 + 8003dd2: 4413 add r3, r2 + 8003dd4: 68ba ldr r2, [r7, #8] + 8003dd6: 429a cmp r2, r3 + 8003dd8: d902 bls.n 8003de0 + 8003dda: 4b18 ldr r3, [pc, #96] ; (8003e3c ) + 8003ddc: 691b ldr r3, [r3, #16] + 8003dde: 60bb str r3, [r7, #8] + 8003de0: 68fb ldr r3, [r7, #12] + 8003de2: 3301 adds r3, #1 + 8003de4: 60fb str r3, [r7, #12] + 8003de6: 68fa ldr r2, [r7, #12] + 8003de8: 683b ldr r3, [r7, #0] + 8003dea: 429a cmp r2, r3 + 8003dec: dbe4 blt.n 8003db8 + 8003dee: 683b ldr r3, [r7, #0] + 8003df0: 2b00 cmp r3, #0 + 8003df2: d01e beq.n 8003e32 + 8003df4: f7ff fbe8 bl 80035c8 + 8003df8: 4a10 ldr r2, [pc, #64] ; (8003e3c ) + 8003dfa: 68bb ldr r3, [r7, #8] + 8003dfc: 6193 str r3, [r2, #24] + 8003dfe: 4b0f ldr r3, [pc, #60] ; (8003e3c ) + 8003e00: 8b9a ldrh r2, [r3, #28] + 8003e02: 683b ldr r3, [r7, #0] + 8003e04: b29b uxth r3, r3 + 8003e06: 4413 add r3, r2 + 8003e08: b29a uxth r2, r3 + 8003e0a: 4b0c ldr r3, [pc, #48] ; (8003e3c ) + 8003e0c: 839a strh r2, [r3, #28] + 8003e0e: 4b0b ldr r3, [pc, #44] ; (8003e3c ) + 8003e10: 8bdb ldrh r3, [r3, #30] + 8003e12: 2b01 cmp r3, #1 + 8003e14: d00b beq.n 8003e2e + 8003e16: 4b09 ldr r3, [pc, #36] ; (8003e3c ) + 8003e18: 8b9b ldrh r3, [r3, #28] + 8003e1a: 2b00 cmp r3, #0 + 8003e1c: d007 beq.n 8003e2e + 8003e1e: 4b07 ldr r3, [pc, #28] ; (8003e3c ) + 8003e20: 2201 movs r2, #1 + 8003e22: 83da strh r2, [r3, #30] + 8003e24: 4b05 ldr r3, [pc, #20] ; (8003e3c ) + 8003e26: 685b ldr r3, [r3, #4] + 8003e28: 4618 mov r0, r3 + 8003e2a: f7ff fc9a bl 8003762 + 8003e2e: f7ff fbdd bl 80035ec + 8003e32: 683b ldr r3, [r7, #0] + 8003e34: 4618 mov r0, r3 + 8003e36: 3710 adds r7, #16 + 8003e38: 46bd mov sp, r7 + 8003e3a: bd80 pop {r7, pc} + 8003e3c: 20000c8c .word 0x20000c8c + +08003e40 : + 8003e40: b580 push {r7, lr} + 8003e42: b086 sub sp, #24 + 8003e44: af00 add r7, sp, #0 + 8003e46: 6078 str r0, [r7, #4] + 8003e48: 6039 str r1, [r7, #0] + 8003e4a: 687b ldr r3, [r7, #4] + 8003e4c: 2b00 cmp r3, #0 + 8003e4e: d002 beq.n 8003e56 + 8003e50: 683b ldr r3, [r7, #0] + 8003e52: 2b00 cmp r3, #0 + 8003e54: da02 bge.n 8003e5c + 8003e56: f04f 33ff mov.w r3, #4294967295 + 8003e5a: e04d b.n 8003ef8 + 8003e5c: 4b28 ldr r3, [pc, #160] ; (8003f00 ) + 8003e5e: 881b ldrh r3, [r3, #0] + 8003e60: f245 52aa movw r2, #21930 ; 0x55aa + 8003e64: 4293 cmp r3, r2 + 8003e66: d002 beq.n 8003e6e + 8003e68: f06f 0301 mvn.w r3, #1 + 8003e6c: e044 b.n 8003ef8 + 8003e6e: f7ff fbab bl 80035c8 + 8003e72: 4b23 ldr r3, [pc, #140] ; (8003f00 ) + 8003e74: 6a9b ldr r3, [r3, #40] ; 0x28 + 8003e76: 613b str r3, [r7, #16] + 8003e78: 4b21 ldr r3, [pc, #132] ; (8003f00 ) + 8003e7a: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003e7c: 60fb str r3, [r7, #12] + 8003e7e: f7ff fbb5 bl 80035ec + 8003e82: 68fb ldr r3, [r7, #12] + 8003e84: 2b00 cmp r3, #0 + 8003e86: da02 bge.n 8003e8e + 8003e88: f06f 0302 mvn.w r3, #2 + 8003e8c: e034 b.n 8003ef8 + 8003e8e: 683a ldr r2, [r7, #0] + 8003e90: 68fb ldr r3, [r7, #12] + 8003e92: 429a cmp r2, r3 + 8003e94: dd01 ble.n 8003e9a + 8003e96: 2300 movs r3, #0 + 8003e98: e02e b.n 8003ef8 + 8003e9a: 2300 movs r3, #0 + 8003e9c: 617b str r3, [r7, #20] + 8003e9e: e017 b.n 8003ed0 + 8003ea0: 687b ldr r3, [r7, #4] + 8003ea2: 1c5a adds r2, r3, #1 + 8003ea4: 607a str r2, [r7, #4] + 8003ea6: 693a ldr r2, [r7, #16] + 8003ea8: 7812 ldrb r2, [r2, #0] + 8003eaa: 701a strb r2, [r3, #0] + 8003eac: 693b ldr r3, [r7, #16] + 8003eae: 3301 adds r3, #1 + 8003eb0: 613b str r3, [r7, #16] + 8003eb2: 4b13 ldr r3, [pc, #76] ; (8003f00 ) + 8003eb4: 6a5a ldr r2, [r3, #36] ; 0x24 + 8003eb6: 4b12 ldr r3, [pc, #72] ; (8003f00 ) + 8003eb8: 6a1b ldr r3, [r3, #32] + 8003eba: 3b01 subs r3, #1 + 8003ebc: 4413 add r3, r2 + 8003ebe: 693a ldr r2, [r7, #16] + 8003ec0: 429a cmp r2, r3 + 8003ec2: d902 bls.n 8003eca + 8003ec4: 4b0e ldr r3, [pc, #56] ; (8003f00 ) + 8003ec6: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003ec8: 613b str r3, [r7, #16] + 8003eca: 697b ldr r3, [r7, #20] + 8003ecc: 3301 adds r3, #1 + 8003ece: 617b str r3, [r7, #20] + 8003ed0: 697a ldr r2, [r7, #20] + 8003ed2: 683b ldr r3, [r7, #0] + 8003ed4: 429a cmp r2, r3 + 8003ed6: dbe3 blt.n 8003ea0 + 8003ed8: f7ff fb76 bl 80035c8 + 8003edc: 4a08 ldr r2, [pc, #32] ; (8003f00 ) + 8003ede: 693b ldr r3, [r7, #16] + 8003ee0: 6293 str r3, [r2, #40] ; 0x28 + 8003ee2: 4b07 ldr r3, [pc, #28] ; (8003f00 ) + 8003ee4: 8e1a ldrh r2, [r3, #48] ; 0x30 + 8003ee6: 683b ldr r3, [r7, #0] + 8003ee8: b29b uxth r3, r3 + 8003eea: 1ad3 subs r3, r2, r3 + 8003eec: b29a uxth r2, r3 + 8003eee: 4b04 ldr r3, [pc, #16] ; (8003f00 ) + 8003ef0: 861a strh r2, [r3, #48] ; 0x30 + 8003ef2: f7ff fb7b bl 80035ec + 8003ef6: 683b ldr r3, [r7, #0] + 8003ef8: 4618 mov r0, r3 + 8003efa: 3718 adds r7, #24 + 8003efc: 46bd mov sp, r7 + 8003efe: bd80 pop {r7, pc} + 8003f00: 20000c8c .word 0x20000c8c + +08003f04 : + 8003f04: b580 push {r7, lr} + 8003f06: b082 sub sp, #8 + 8003f08: af00 add r7, sp, #0 + 8003f0a: f7ff fb5d bl 80035c8 + 8003f0e: 4b08 ldr r3, [pc, #32] ; (8003f30 ) + 8003f10: 6adb ldr r3, [r3, #44] ; 0x2c + 8003f12: 4a07 ldr r2, [pc, #28] ; (8003f30 ) + 8003f14: 6293 str r3, [r2, #40] ; 0x28 + 8003f16: 4b06 ldr r3, [pc, #24] ; (8003f30 ) + 8003f18: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003f1a: 607b str r3, [r7, #4] + 8003f1c: 4b04 ldr r3, [pc, #16] ; (8003f30 ) + 8003f1e: 2200 movs r2, #0 + 8003f20: 861a strh r2, [r3, #48] ; 0x30 + 8003f22: f7ff fb63 bl 80035ec + 8003f26: 687b ldr r3, [r7, #4] + 8003f28: 4618 mov r0, r3 + 8003f2a: 3708 adds r7, #8 + 8003f2c: 46bd mov sp, r7 + 8003f2e: bd80 pop {r7, pc} + 8003f30: 20000c8c .word 0x20000c8c + +08003f34 : + 8003f34: b580 push {r7, lr} + 8003f36: b082 sub sp, #8 + 8003f38: af00 add r7, sp, #0 + 8003f3a: f7ff fb45 bl 80035c8 + 8003f3e: 4b07 ldr r3, [pc, #28] ; (8003f5c ) + 8003f40: 8bdb ldrh r3, [r3, #30] + 8003f42: 607b str r3, [r7, #4] + 8003f44: f7ff fb52 bl 80035ec + 8003f48: 687b ldr r3, [r7, #4] + 8003f4a: 2b01 cmp r3, #1 + 8003f4c: d101 bne.n 8003f52 + 8003f4e: 2300 movs r3, #0 + 8003f50: e000 b.n 8003f54 + 8003f52: 2301 movs r3, #1 + 8003f54: 4618 mov r0, r3 + 8003f56: 3708 adds r7, #8 + 8003f58: 46bd mov sp, r7 + 8003f5a: bd80 pop {r7, pc} + 8003f5c: 20000c8c .word 0x20000c8c + +08003f60 : + 8003f60: b580 push {r7, lr} + 8003f62: b082 sub sp, #8 + 8003f64: af00 add r7, sp, #0 + 8003f66: 4b46 ldr r3, [pc, #280] ; (8004080 ) + 8003f68: 685b ldr r3, [r3, #4] + 8003f6a: 4618 mov r0, r3 + 8003f6c: f7ff fbb4 bl 80036d8 + 8003f70: 4603 mov r3, r0 + 8003f72: 2b00 cmp r3, #0 + 8003f74: d039 beq.n 8003fea + 8003f76: 4b42 ldr r3, [pc, #264] ; (8004080 ) + 8003f78: 685b ldr r3, [r3, #4] + 8003f7a: 4618 mov r0, r3 + 8003f7c: f7ff fc1e bl 80037bc + 8003f80: 4603 mov r3, r0 + 8003f82: 71fb strb r3, [r7, #7] + 8003f84: 4b3e ldr r3, [pc, #248] ; (8004080 ) + 8003f86: 881b ldrh r3, [r3, #0] + 8003f88: f245 52aa movw r2, #21930 ; 0x55aa + 8003f8c: 4293 cmp r3, r2 + 8003f8e: d173 bne.n 8004078 + 8003f90: 4b3b ldr r3, [pc, #236] ; (8004080 ) + 8003f92: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003f94: 461a mov r2, r3 + 8003f96: 4b3a ldr r3, [pc, #232] ; (8004080 ) + 8003f98: 6a1b ldr r3, [r3, #32] + 8003f9a: 429a cmp r2, r3 + 8003f9c: da1c bge.n 8003fd8 + 8003f9e: 4b38 ldr r3, [pc, #224] ; (8004080 ) + 8003fa0: 6adb ldr r3, [r3, #44] ; 0x2c + 8003fa2: 79fa ldrb r2, [r7, #7] + 8003fa4: 701a strb r2, [r3, #0] + 8003fa6: 4b36 ldr r3, [pc, #216] ; (8004080 ) + 8003fa8: 6adb ldr r3, [r3, #44] ; 0x2c + 8003faa: 3301 adds r3, #1 + 8003fac: 4a34 ldr r2, [pc, #208] ; (8004080 ) + 8003fae: 62d3 str r3, [r2, #44] ; 0x2c + 8003fb0: 4b33 ldr r3, [pc, #204] ; (8004080 ) + 8003fb2: 6ada ldr r2, [r3, #44] ; 0x2c + 8003fb4: 4b32 ldr r3, [pc, #200] ; (8004080 ) + 8003fb6: 6a59 ldr r1, [r3, #36] ; 0x24 + 8003fb8: 4b31 ldr r3, [pc, #196] ; (8004080 ) + 8003fba: 6a1b ldr r3, [r3, #32] + 8003fbc: 3b01 subs r3, #1 + 8003fbe: 440b add r3, r1 + 8003fc0: 429a cmp r2, r3 + 8003fc2: d903 bls.n 8003fcc + 8003fc4: 4b2e ldr r3, [pc, #184] ; (8004080 ) + 8003fc6: 6a5b ldr r3, [r3, #36] ; 0x24 + 8003fc8: 4a2d ldr r2, [pc, #180] ; (8004080 ) + 8003fca: 62d3 str r3, [r2, #44] ; 0x2c + 8003fcc: 4b2c ldr r3, [pc, #176] ; (8004080 ) + 8003fce: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8003fd0: 3301 adds r3, #1 + 8003fd2: b29a uxth r2, r3 + 8003fd4: 4b2a ldr r3, [pc, #168] ; (8004080 ) + 8003fd6: 861a strh r2, [r3, #48] ; 0x30 + 8003fd8: 4b29 ldr r3, [pc, #164] ; (8004080 ) + 8003fda: 6b5b ldr r3, [r3, #52] ; 0x34 + 8003fdc: 2b00 cmp r3, #0 + 8003fde: d004 beq.n 8003fea + 8003fe0: 4b27 ldr r3, [pc, #156] ; (8004080 ) + 8003fe2: 6b5b ldr r3, [r3, #52] ; 0x34 + 8003fe4: 79fa ldrb r2, [r7, #7] + 8003fe6: 4610 mov r0, r2 + 8003fe8: 4798 blx r3 + 8003fea: 4b25 ldr r3, [pc, #148] ; (8004080 ) + 8003fec: 685b ldr r3, [r3, #4] + 8003fee: 4618 mov r0, r3 + 8003ff0: f7ff fb96 bl 8003720 + 8003ff4: 4603 mov r3, r0 + 8003ff6: 2b00 cmp r3, #0 + 8003ff8: d03f beq.n 800407a + 8003ffa: 4b21 ldr r3, [pc, #132] ; (8004080 ) + 8003ffc: 881b ldrh r3, [r3, #0] + 8003ffe: f245 52aa movw r2, #21930 ; 0x55aa + 8004002: 4293 cmp r3, r2 + 8004004: d005 beq.n 8004012 + 8004006: 4b1e ldr r3, [pc, #120] ; (8004080 ) + 8004008: 685b ldr r3, [r3, #4] + 800400a: 4618 mov r0, r3 + 800400c: f7ff fbc7 bl 800379e + 8004010: e033 b.n 800407a + 8004012: 4b1b ldr r3, [pc, #108] ; (8004080 ) + 8004014: 8b9b ldrh r3, [r3, #28] + 8004016: 2b00 cmp r3, #0 + 8004018: d025 beq.n 8004066 + 800401a: 4b19 ldr r3, [pc, #100] ; (8004080 ) + 800401c: 685a ldr r2, [r3, #4] + 800401e: 4b18 ldr r3, [pc, #96] ; (8004080 ) + 8004020: 695b ldr r3, [r3, #20] + 8004022: 781b ldrb r3, [r3, #0] + 8004024: 4619 mov r1, r3 + 8004026: 4610 mov r0, r2 + 8004028: f7ff fbd4 bl 80037d4 + 800402c: 4b14 ldr r3, [pc, #80] ; (8004080 ) + 800402e: 695b ldr r3, [r3, #20] + 8004030: 3301 adds r3, #1 + 8004032: 4a13 ldr r2, [pc, #76] ; (8004080 ) + 8004034: 6153 str r3, [r2, #20] + 8004036: 4b12 ldr r3, [pc, #72] ; (8004080 ) + 8004038: 695a ldr r2, [r3, #20] + 800403a: 4b11 ldr r3, [pc, #68] ; (8004080 ) + 800403c: 6919 ldr r1, [r3, #16] + 800403e: 4b10 ldr r3, [pc, #64] ; (8004080 ) + 8004040: 68db ldr r3, [r3, #12] + 8004042: 3b01 subs r3, #1 + 8004044: 440b add r3, r1 + 8004046: 429a cmp r2, r3 + 8004048: d903 bls.n 8004052 + 800404a: 4b0d ldr r3, [pc, #52] ; (8004080 ) + 800404c: 691b ldr r3, [r3, #16] + 800404e: 4a0c ldr r2, [pc, #48] ; (8004080 ) + 8004050: 6153 str r3, [r2, #20] + 8004052: 4b0b ldr r3, [pc, #44] ; (8004080 ) + 8004054: 8b9b ldrh r3, [r3, #28] + 8004056: 3b01 subs r3, #1 + 8004058: b29a uxth r2, r3 + 800405a: 4b09 ldr r3, [pc, #36] ; (8004080 ) + 800405c: 839a strh r2, [r3, #28] + 800405e: 4b08 ldr r3, [pc, #32] ; (8004080 ) + 8004060: 2201 movs r2, #1 + 8004062: 83da strh r2, [r3, #30] + 8004064: e009 b.n 800407a + 8004066: 4b06 ldr r3, [pc, #24] ; (8004080 ) + 8004068: 2200 movs r2, #0 + 800406a: 83da strh r2, [r3, #30] + 800406c: 4b04 ldr r3, [pc, #16] ; (8004080 ) + 800406e: 685b ldr r3, [r3, #4] + 8004070: 4618 mov r0, r3 + 8004072: f7ff fb94 bl 800379e + 8004076: e000 b.n 800407a + 8004078: bf00 nop + 800407a: 3708 adds r7, #8 + 800407c: 46bd mov sp, r7 + 800407e: bd80 pop {r7, pc} + 8004080: 20000c8c .word 0x20000c8c + +08004084 : +#endif + +#ifdef COMM_USART3 +USART_PROC(3); + 8004084: b580 push {r7, lr} + 8004086: b082 sub sp, #8 + 8004088: af00 add r7, sp, #0 + 800408a: 6078 str r0, [r7, #4] + 800408c: 4608 mov r0, r1 + 800408e: 4611 mov r1, r2 + 8004090: 461a mov r2, r3 + 8004092: 4603 mov r3, r0 + 8004094: 70fb strb r3, [r7, #3] + 8004096: 460b mov r3, r1 + 8004098: 70bb strb r3, [r7, #2] + 800409a: 4613 mov r3, r2 + 800409c: 707b strb r3, [r7, #1] + 800409e: 2238 movs r2, #56 ; 0x38 + 80040a0: 2100 movs r1, #0 + 80040a2: 4823 ldr r0, [pc, #140] ; (8004130 ) + 80040a4: f005 fc29 bl 80098fa + 80040a8: 4b21 ldr r3, [pc, #132] ; (8004130 ) + 80040aa: 4a22 ldr r2, [pc, #136] ; (8004134 ) + 80040ac: 611a str r2, [r3, #16] + 80040ae: 4b20 ldr r3, [pc, #128] ; (8004130 ) + 80040b0: 2280 movs r2, #128 ; 0x80 + 80040b2: 60da str r2, [r3, #12] + 80040b4: 4b1e ldr r3, [pc, #120] ; (8004130 ) + 80040b6: 4a20 ldr r2, [pc, #128] ; (8004138 ) + 80040b8: 625a str r2, [r3, #36] ; 0x24 + 80040ba: 4b1d ldr r3, [pc, #116] ; (8004130 ) + 80040bc: 2280 movs r2, #128 ; 0x80 + 80040be: 621a str r2, [r3, #32] + 80040c0: 4b1b ldr r3, [pc, #108] ; (8004130 ) + 80040c2: 4a1e ldr r2, [pc, #120] ; (800413c ) + 80040c4: 605a str r2, [r3, #4] + 80040c6: 4a1a ldr r2, [pc, #104] ; (8004130 ) + 80040c8: 687b ldr r3, [r7, #4] + 80040ca: 6093 str r3, [r2, #8] + 80040cc: 4b18 ldr r3, [pc, #96] ; (8004130 ) + 80040ce: 691b ldr r3, [r3, #16] + 80040d0: 4a17 ldr r2, [pc, #92] ; (8004130 ) + 80040d2: 6153 str r3, [r2, #20] + 80040d4: 4b16 ldr r3, [pc, #88] ; (8004130 ) + 80040d6: 695b ldr r3, [r3, #20] + 80040d8: 4a15 ldr r2, [pc, #84] ; (8004130 ) + 80040da: 6193 str r3, [r2, #24] + 80040dc: 4b14 ldr r3, [pc, #80] ; (8004130 ) + 80040de: 2200 movs r2, #0 + 80040e0: 839a strh r2, [r3, #28] + 80040e2: 4b13 ldr r3, [pc, #76] ; (8004130 ) + 80040e4: 2200 movs r2, #0 + 80040e6: 83da strh r2, [r3, #30] + 80040e8: 4b11 ldr r3, [pc, #68] ; (8004130 ) + 80040ea: 6a5b ldr r3, [r3, #36] ; 0x24 + 80040ec: 4a10 ldr r2, [pc, #64] ; (8004130 ) + 80040ee: 6293 str r3, [r2, #40] ; 0x28 + 80040f0: 4b0f ldr r3, [pc, #60] ; (8004130 ) + 80040f2: 6a9b ldr r3, [r3, #40] ; 0x28 + 80040f4: 4a0e ldr r2, [pc, #56] ; (8004130 ) + 80040f6: 62d3 str r3, [r2, #44] ; 0x2c + 80040f8: 4b0d ldr r3, [pc, #52] ; (8004130 ) + 80040fa: 2200 movs r2, #0 + 80040fc: 861a strh r2, [r3, #48] ; 0x30 + 80040fe: 4b0c ldr r3, [pc, #48] ; (8004130 ) + 8004100: 2201 movs r2, #1 + 8004102: 865a strh r2, [r3, #50] ; 0x32 + 8004104: 4b0a ldr r3, [pc, #40] ; (8004130 ) + 8004106: f245 52aa movw r2, #21930 ; 0x55aa + 800410a: 801a strh r2, [r3, #0] + 800410c: 4b08 ldr r3, [pc, #32] ; (8004130 ) + 800410e: 2200 movs r2, #0 + 8004110: 635a str r2, [r3, #52] ; 0x34 + 8004112: 480a ldr r0, [pc, #40] ; (800413c ) + 8004114: f7ff fb52 bl 80037bc + 8004118: 4808 ldr r0, [pc, #32] ; (800413c ) + 800411a: f7ff fb13 bl 8003744 + 800411e: 4807 ldr r0, [pc, #28] ; (800413c ) + 8004120: f7ff facb bl 80036ba + 8004124: 2300 movs r3, #0 + 8004126: 4618 mov r0, r3 + 8004128: 3708 adds r7, #8 + 800412a: 46bd mov sp, r7 + 800412c: bd80 pop {r7, pc} + 800412e: bf00 nop + 8004130: 20000f7c .word 0x20000f7c + 8004134: 20000e44 .word 0x20000e44 + 8004138: 20000cc4 .word 0x20000cc4 + 800413c: 40004800 .word 0x40004800 + +08004140 : + 8004140: b580 push {r7, lr} + 8004142: b084 sub sp, #16 + 8004144: af00 add r7, sp, #0 + 8004146: 6078 str r0, [r7, #4] + 8004148: 6039 str r1, [r7, #0] + 800414a: 687b ldr r3, [r7, #4] + 800414c: 2b00 cmp r3, #0 + 800414e: d002 beq.n 8004156 + 8004150: 683b ldr r3, [r7, #0] + 8004152: 2b00 cmp r3, #0 + 8004154: da02 bge.n 800415c + 8004156: f04f 33ff mov.w r3, #4294967295 + 800415a: e061 b.n 8004220 + 800415c: 4b32 ldr r3, [pc, #200] ; (8004228 ) + 800415e: 881b ldrh r3, [r3, #0] + 8004160: f245 52aa movw r2, #21930 ; 0x55aa + 8004164: 4293 cmp r3, r2 + 8004166: d002 beq.n 800416e + 8004168: f06f 0301 mvn.w r3, #1 + 800416c: e058 b.n 8004220 + 800416e: f7ff fa2b bl 80035c8 + 8004172: 4b2d ldr r3, [pc, #180] ; (8004228 ) + 8004174: 8b9b ldrh r3, [r3, #28] + 8004176: 461a mov r2, r3 + 8004178: 683b ldr r3, [r7, #0] + 800417a: 441a add r2, r3 + 800417c: 4b2a ldr r3, [pc, #168] ; (8004228 ) + 800417e: 68db ldr r3, [r3, #12] + 8004180: 429a cmp r2, r3 + 8004182: dd01 ble.n 8004188 + 8004184: 2300 movs r3, #0 + 8004186: 603b str r3, [r7, #0] + 8004188: 4b27 ldr r3, [pc, #156] ; (8004228 ) + 800418a: 699b ldr r3, [r3, #24] + 800418c: 60bb str r3, [r7, #8] + 800418e: f7ff fa2d bl 80035ec + 8004192: 683b ldr r3, [r7, #0] + 8004194: 2b00 cmp r3, #0 + 8004196: da02 bge.n 800419e + 8004198: f06f 0302 mvn.w r3, #2 + 800419c: e040 b.n 8004220 + 800419e: 2300 movs r3, #0 + 80041a0: 60fb str r3, [r7, #12] + 80041a2: e016 b.n 80041d2 + 80041a4: 687a ldr r2, [r7, #4] + 80041a6: 1c53 adds r3, r2, #1 + 80041a8: 607b str r3, [r7, #4] + 80041aa: 68bb ldr r3, [r7, #8] + 80041ac: 1c59 adds r1, r3, #1 + 80041ae: 60b9 str r1, [r7, #8] + 80041b0: 7812 ldrb r2, [r2, #0] + 80041b2: 701a strb r2, [r3, #0] + 80041b4: 4b1c ldr r3, [pc, #112] ; (8004228 ) + 80041b6: 691a ldr r2, [r3, #16] + 80041b8: 4b1b ldr r3, [pc, #108] ; (8004228 ) + 80041ba: 68db ldr r3, [r3, #12] + 80041bc: 3b01 subs r3, #1 + 80041be: 4413 add r3, r2 + 80041c0: 68ba ldr r2, [r7, #8] + 80041c2: 429a cmp r2, r3 + 80041c4: d902 bls.n 80041cc + 80041c6: 4b18 ldr r3, [pc, #96] ; (8004228 ) + 80041c8: 691b ldr r3, [r3, #16] + 80041ca: 60bb str r3, [r7, #8] + 80041cc: 68fb ldr r3, [r7, #12] + 80041ce: 3301 adds r3, #1 + 80041d0: 60fb str r3, [r7, #12] + 80041d2: 68fa ldr r2, [r7, #12] + 80041d4: 683b ldr r3, [r7, #0] + 80041d6: 429a cmp r2, r3 + 80041d8: dbe4 blt.n 80041a4 + 80041da: 683b ldr r3, [r7, #0] + 80041dc: 2b00 cmp r3, #0 + 80041de: d01e beq.n 800421e + 80041e0: f7ff f9f2 bl 80035c8 + 80041e4: 4a10 ldr r2, [pc, #64] ; (8004228 ) + 80041e6: 68bb ldr r3, [r7, #8] + 80041e8: 6193 str r3, [r2, #24] + 80041ea: 4b0f ldr r3, [pc, #60] ; (8004228 ) + 80041ec: 8b9a ldrh r2, [r3, #28] + 80041ee: 683b ldr r3, [r7, #0] + 80041f0: b29b uxth r3, r3 + 80041f2: 4413 add r3, r2 + 80041f4: b29a uxth r2, r3 + 80041f6: 4b0c ldr r3, [pc, #48] ; (8004228 ) + 80041f8: 839a strh r2, [r3, #28] + 80041fa: 4b0b ldr r3, [pc, #44] ; (8004228 ) + 80041fc: 8bdb ldrh r3, [r3, #30] + 80041fe: 2b01 cmp r3, #1 + 8004200: d00b beq.n 800421a + 8004202: 4b09 ldr r3, [pc, #36] ; (8004228 ) + 8004204: 8b9b ldrh r3, [r3, #28] + 8004206: 2b00 cmp r3, #0 + 8004208: d007 beq.n 800421a + 800420a: 4b07 ldr r3, [pc, #28] ; (8004228 ) + 800420c: 2201 movs r2, #1 + 800420e: 83da strh r2, [r3, #30] + 8004210: 4b05 ldr r3, [pc, #20] ; (8004228 ) + 8004212: 685b ldr r3, [r3, #4] + 8004214: 4618 mov r0, r3 + 8004216: f7ff faa4 bl 8003762 + 800421a: f7ff f9e7 bl 80035ec + 800421e: 683b ldr r3, [r7, #0] + 8004220: 4618 mov r0, r3 + 8004222: 3710 adds r7, #16 + 8004224: 46bd mov sp, r7 + 8004226: bd80 pop {r7, pc} + 8004228: 20000f7c .word 0x20000f7c + +0800422c : + 800422c: b580 push {r7, lr} + 800422e: b086 sub sp, #24 + 8004230: af00 add r7, sp, #0 + 8004232: 6078 str r0, [r7, #4] + 8004234: 6039 str r1, [r7, #0] + 8004236: 687b ldr r3, [r7, #4] + 8004238: 2b00 cmp r3, #0 + 800423a: d002 beq.n 8004242 + 800423c: 683b ldr r3, [r7, #0] + 800423e: 2b00 cmp r3, #0 + 8004240: da02 bge.n 8004248 + 8004242: f04f 33ff mov.w r3, #4294967295 + 8004246: e04d b.n 80042e4 + 8004248: 4b28 ldr r3, [pc, #160] ; (80042ec ) + 800424a: 881b ldrh r3, [r3, #0] + 800424c: f245 52aa movw r2, #21930 ; 0x55aa + 8004250: 4293 cmp r3, r2 + 8004252: d002 beq.n 800425a + 8004254: f06f 0301 mvn.w r3, #1 + 8004258: e044 b.n 80042e4 + 800425a: f7ff f9b5 bl 80035c8 + 800425e: 4b23 ldr r3, [pc, #140] ; (80042ec ) + 8004260: 6a9b ldr r3, [r3, #40] ; 0x28 + 8004262: 613b str r3, [r7, #16] + 8004264: 4b21 ldr r3, [pc, #132] ; (80042ec ) + 8004266: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8004268: 60fb str r3, [r7, #12] + 800426a: f7ff f9bf bl 80035ec + 800426e: 68fb ldr r3, [r7, #12] + 8004270: 2b00 cmp r3, #0 + 8004272: da02 bge.n 800427a + 8004274: f06f 0302 mvn.w r3, #2 + 8004278: e034 b.n 80042e4 + 800427a: 683a ldr r2, [r7, #0] + 800427c: 68fb ldr r3, [r7, #12] + 800427e: 429a cmp r2, r3 + 8004280: dd01 ble.n 8004286 + 8004282: 2300 movs r3, #0 + 8004284: e02e b.n 80042e4 + 8004286: 2300 movs r3, #0 + 8004288: 617b str r3, [r7, #20] + 800428a: e017 b.n 80042bc + 800428c: 687b ldr r3, [r7, #4] + 800428e: 1c5a adds r2, r3, #1 + 8004290: 607a str r2, [r7, #4] + 8004292: 693a ldr r2, [r7, #16] + 8004294: 7812 ldrb r2, [r2, #0] + 8004296: 701a strb r2, [r3, #0] + 8004298: 693b ldr r3, [r7, #16] + 800429a: 3301 adds r3, #1 + 800429c: 613b str r3, [r7, #16] + 800429e: 4b13 ldr r3, [pc, #76] ; (80042ec ) + 80042a0: 6a5a ldr r2, [r3, #36] ; 0x24 + 80042a2: 4b12 ldr r3, [pc, #72] ; (80042ec ) + 80042a4: 6a1b ldr r3, [r3, #32] + 80042a6: 3b01 subs r3, #1 + 80042a8: 4413 add r3, r2 + 80042aa: 693a ldr r2, [r7, #16] + 80042ac: 429a cmp r2, r3 + 80042ae: d902 bls.n 80042b6 + 80042b0: 4b0e ldr r3, [pc, #56] ; (80042ec ) + 80042b2: 6a5b ldr r3, [r3, #36] ; 0x24 + 80042b4: 613b str r3, [r7, #16] + 80042b6: 697b ldr r3, [r7, #20] + 80042b8: 3301 adds r3, #1 + 80042ba: 617b str r3, [r7, #20] + 80042bc: 697a ldr r2, [r7, #20] + 80042be: 683b ldr r3, [r7, #0] + 80042c0: 429a cmp r2, r3 + 80042c2: dbe3 blt.n 800428c + 80042c4: f7ff f980 bl 80035c8 + 80042c8: 4a08 ldr r2, [pc, #32] ; (80042ec ) + 80042ca: 693b ldr r3, [r7, #16] + 80042cc: 6293 str r3, [r2, #40] ; 0x28 + 80042ce: 4b07 ldr r3, [pc, #28] ; (80042ec ) + 80042d0: 8e1a ldrh r2, [r3, #48] ; 0x30 + 80042d2: 683b ldr r3, [r7, #0] + 80042d4: b29b uxth r3, r3 + 80042d6: 1ad3 subs r3, r2, r3 + 80042d8: b29a uxth r2, r3 + 80042da: 4b04 ldr r3, [pc, #16] ; (80042ec ) + 80042dc: 861a strh r2, [r3, #48] ; 0x30 + 80042de: f7ff f985 bl 80035ec + 80042e2: 683b ldr r3, [r7, #0] + 80042e4: 4618 mov r0, r3 + 80042e6: 3718 adds r7, #24 + 80042e8: 46bd mov sp, r7 + 80042ea: bd80 pop {r7, pc} + 80042ec: 20000f7c .word 0x20000f7c + +080042f0 : + 80042f0: b580 push {r7, lr} + 80042f2: b082 sub sp, #8 + 80042f4: af00 add r7, sp, #0 + 80042f6: f7ff f967 bl 80035c8 + 80042fa: 4b08 ldr r3, [pc, #32] ; (800431c ) + 80042fc: 6adb ldr r3, [r3, #44] ; 0x2c + 80042fe: 4a07 ldr r2, [pc, #28] ; (800431c ) + 8004300: 6293 str r3, [r2, #40] ; 0x28 + 8004302: 4b06 ldr r3, [pc, #24] ; (800431c ) + 8004304: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8004306: 607b str r3, [r7, #4] + 8004308: 4b04 ldr r3, [pc, #16] ; (800431c ) + 800430a: 2200 movs r2, #0 + 800430c: 861a strh r2, [r3, #48] ; 0x30 + 800430e: f7ff f96d bl 80035ec + 8004312: 687b ldr r3, [r7, #4] + 8004314: 4618 mov r0, r3 + 8004316: 3708 adds r7, #8 + 8004318: 46bd mov sp, r7 + 800431a: bd80 pop {r7, pc} + 800431c: 20000f7c .word 0x20000f7c + +08004320 : + 8004320: b580 push {r7, lr} + 8004322: b082 sub sp, #8 + 8004324: af00 add r7, sp, #0 + 8004326: f7ff f94f bl 80035c8 + 800432a: 4b07 ldr r3, [pc, #28] ; (8004348 ) + 800432c: 8bdb ldrh r3, [r3, #30] + 800432e: 607b str r3, [r7, #4] + 8004330: f7ff f95c bl 80035ec + 8004334: 687b ldr r3, [r7, #4] + 8004336: 2b01 cmp r3, #1 + 8004338: d101 bne.n 800433e + 800433a: 2300 movs r3, #0 + 800433c: e000 b.n 8004340 + 800433e: 2301 movs r3, #1 + 8004340: 4618 mov r0, r3 + 8004342: 3708 adds r7, #8 + 8004344: 46bd mov sp, r7 + 8004346: bd80 pop {r7, pc} + 8004348: 20000f7c .word 0x20000f7c + +0800434c : + 800434c: b580 push {r7, lr} + 800434e: b082 sub sp, #8 + 8004350: af00 add r7, sp, #0 + 8004352: 4b46 ldr r3, [pc, #280] ; (800446c ) + 8004354: 685b ldr r3, [r3, #4] + 8004356: 4618 mov r0, r3 + 8004358: f7ff f9be bl 80036d8 + 800435c: 4603 mov r3, r0 + 800435e: 2b00 cmp r3, #0 + 8004360: d039 beq.n 80043d6 + 8004362: 4b42 ldr r3, [pc, #264] ; (800446c ) + 8004364: 685b ldr r3, [r3, #4] + 8004366: 4618 mov r0, r3 + 8004368: f7ff fa28 bl 80037bc + 800436c: 4603 mov r3, r0 + 800436e: 71fb strb r3, [r7, #7] + 8004370: 4b3e ldr r3, [pc, #248] ; (800446c ) + 8004372: 881b ldrh r3, [r3, #0] + 8004374: f245 52aa movw r2, #21930 ; 0x55aa + 8004378: 4293 cmp r3, r2 + 800437a: d173 bne.n 8004464 + 800437c: 4b3b ldr r3, [pc, #236] ; (800446c ) + 800437e: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8004380: 461a mov r2, r3 + 8004382: 4b3a ldr r3, [pc, #232] ; (800446c ) + 8004384: 6a1b ldr r3, [r3, #32] + 8004386: 429a cmp r2, r3 + 8004388: da1c bge.n 80043c4 + 800438a: 4b38 ldr r3, [pc, #224] ; (800446c ) + 800438c: 6adb ldr r3, [r3, #44] ; 0x2c + 800438e: 79fa ldrb r2, [r7, #7] + 8004390: 701a strb r2, [r3, #0] + 8004392: 4b36 ldr r3, [pc, #216] ; (800446c ) + 8004394: 6adb ldr r3, [r3, #44] ; 0x2c + 8004396: 3301 adds r3, #1 + 8004398: 4a34 ldr r2, [pc, #208] ; (800446c ) + 800439a: 62d3 str r3, [r2, #44] ; 0x2c + 800439c: 4b33 ldr r3, [pc, #204] ; (800446c ) + 800439e: 6ada ldr r2, [r3, #44] ; 0x2c + 80043a0: 4b32 ldr r3, [pc, #200] ; (800446c ) + 80043a2: 6a59 ldr r1, [r3, #36] ; 0x24 + 80043a4: 4b31 ldr r3, [pc, #196] ; (800446c ) + 80043a6: 6a1b ldr r3, [r3, #32] + 80043a8: 3b01 subs r3, #1 + 80043aa: 440b add r3, r1 + 80043ac: 429a cmp r2, r3 + 80043ae: d903 bls.n 80043b8 + 80043b0: 4b2e ldr r3, [pc, #184] ; (800446c ) + 80043b2: 6a5b ldr r3, [r3, #36] ; 0x24 + 80043b4: 4a2d ldr r2, [pc, #180] ; (800446c ) + 80043b6: 62d3 str r3, [r2, #44] ; 0x2c + 80043b8: 4b2c ldr r3, [pc, #176] ; (800446c ) + 80043ba: 8e1b ldrh r3, [r3, #48] ; 0x30 + 80043bc: 3301 adds r3, #1 + 80043be: b29a uxth r2, r3 + 80043c0: 4b2a ldr r3, [pc, #168] ; (800446c ) + 80043c2: 861a strh r2, [r3, #48] ; 0x30 + 80043c4: 4b29 ldr r3, [pc, #164] ; (800446c ) + 80043c6: 6b5b ldr r3, [r3, #52] ; 0x34 + 80043c8: 2b00 cmp r3, #0 + 80043ca: d004 beq.n 80043d6 + 80043cc: 4b27 ldr r3, [pc, #156] ; (800446c ) + 80043ce: 6b5b ldr r3, [r3, #52] ; 0x34 + 80043d0: 79fa ldrb r2, [r7, #7] + 80043d2: 4610 mov r0, r2 + 80043d4: 4798 blx r3 + 80043d6: 4b25 ldr r3, [pc, #148] ; (800446c ) + 80043d8: 685b ldr r3, [r3, #4] + 80043da: 4618 mov r0, r3 + 80043dc: f7ff f9a0 bl 8003720 + 80043e0: 4603 mov r3, r0 + 80043e2: 2b00 cmp r3, #0 + 80043e4: d03f beq.n 8004466 + 80043e6: 4b21 ldr r3, [pc, #132] ; (800446c ) + 80043e8: 881b ldrh r3, [r3, #0] + 80043ea: f245 52aa movw r2, #21930 ; 0x55aa + 80043ee: 4293 cmp r3, r2 + 80043f0: d005 beq.n 80043fe + 80043f2: 4b1e ldr r3, [pc, #120] ; (800446c ) + 80043f4: 685b ldr r3, [r3, #4] + 80043f6: 4618 mov r0, r3 + 80043f8: f7ff f9d1 bl 800379e + 80043fc: e033 b.n 8004466 + 80043fe: 4b1b ldr r3, [pc, #108] ; (800446c ) + 8004400: 8b9b ldrh r3, [r3, #28] + 8004402: 2b00 cmp r3, #0 + 8004404: d025 beq.n 8004452 + 8004406: 4b19 ldr r3, [pc, #100] ; (800446c ) + 8004408: 685a ldr r2, [r3, #4] + 800440a: 4b18 ldr r3, [pc, #96] ; (800446c ) + 800440c: 695b ldr r3, [r3, #20] + 800440e: 781b ldrb r3, [r3, #0] + 8004410: 4619 mov r1, r3 + 8004412: 4610 mov r0, r2 + 8004414: f7ff f9de bl 80037d4 + 8004418: 4b14 ldr r3, [pc, #80] ; (800446c ) + 800441a: 695b ldr r3, [r3, #20] + 800441c: 3301 adds r3, #1 + 800441e: 4a13 ldr r2, [pc, #76] ; (800446c ) + 8004420: 6153 str r3, [r2, #20] + 8004422: 4b12 ldr r3, [pc, #72] ; (800446c ) + 8004424: 695a ldr r2, [r3, #20] + 8004426: 4b11 ldr r3, [pc, #68] ; (800446c ) + 8004428: 6919 ldr r1, [r3, #16] + 800442a: 4b10 ldr r3, [pc, #64] ; (800446c ) + 800442c: 68db ldr r3, [r3, #12] + 800442e: 3b01 subs r3, #1 + 8004430: 440b add r3, r1 + 8004432: 429a cmp r2, r3 + 8004434: d903 bls.n 800443e + 8004436: 4b0d ldr r3, [pc, #52] ; (800446c ) + 8004438: 691b ldr r3, [r3, #16] + 800443a: 4a0c ldr r2, [pc, #48] ; (800446c ) + 800443c: 6153 str r3, [r2, #20] + 800443e: 4b0b ldr r3, [pc, #44] ; (800446c ) + 8004440: 8b9b ldrh r3, [r3, #28] + 8004442: 3b01 subs r3, #1 + 8004444: b29a uxth r2, r3 + 8004446: 4b09 ldr r3, [pc, #36] ; (800446c ) + 8004448: 839a strh r2, [r3, #28] + 800444a: 4b08 ldr r3, [pc, #32] ; (800446c ) + 800444c: 2201 movs r2, #1 + 800444e: 83da strh r2, [r3, #30] + 8004450: e009 b.n 8004466 + 8004452: 4b06 ldr r3, [pc, #24] ; (800446c ) + 8004454: 2200 movs r2, #0 + 8004456: 83da strh r2, [r3, #30] + 8004458: 4b04 ldr r3, [pc, #16] ; (800446c ) + 800445a: 685b ldr r3, [r3, #4] + 800445c: 4618 mov r0, r3 + 800445e: f7ff f99e bl 800379e + 8004462: e000 b.n 8004466 + 8004464: bf00 nop + 8004466: 3708 adds r7, #8 + 8004468: 46bd mov sp, r7 + 800446a: bd80 pop {r7, pc} + 800446c: 20000f7c .word 0x20000f7c + +08004470 : +int g_cmdNum = 0; + +//------------------------------------------------------------------------- + +void ChangeToUper(char * str) +{ + 8004470: b480 push {r7} + 8004472: b085 sub sp, #20 + 8004474: af00 add r7, sp, #0 + 8004476: 6078 str r0, [r7, #4] + char tmp; + while (str != NULL) + 8004478: e014 b.n 80044a4 + { + tmp = *str; + 800447a: 687b ldr r3, [r7, #4] + 800447c: 781b ldrb r3, [r3, #0] + 800447e: 73fb strb r3, [r7, #15] + if (tmp == 0) + 8004480: 7bfb ldrb r3, [r7, #15] + 8004482: 2b00 cmp r3, #0 + 8004484: d012 beq.n 80044ac + { + break; + } + + if (tmp >= 'a' && tmp <= 'z') + 8004486: 7bfb ldrb r3, [r7, #15] + 8004488: 2b60 cmp r3, #96 ; 0x60 + 800448a: d908 bls.n 800449e + 800448c: 7bfb ldrb r3, [r7, #15] + 800448e: 2b7a cmp r3, #122 ; 0x7a + 8004490: d805 bhi.n 800449e + { + tmp -= ('a'-'A'); + 8004492: 7bfb ldrb r3, [r7, #15] + 8004494: 3b20 subs r3, #32 + 8004496: 73fb strb r3, [r7, #15] + *str = tmp; + 8004498: 687b ldr r3, [r7, #4] + 800449a: 7bfa ldrb r2, [r7, #15] + 800449c: 701a strb r2, [r3, #0] + } + str++; + 800449e: 687b ldr r3, [r7, #4] + 80044a0: 3301 adds r3, #1 + 80044a2: 607b str r3, [r7, #4] + while (str != NULL) + 80044a4: 687b ldr r3, [r7, #4] + 80044a6: 2b00 cmp r3, #0 + 80044a8: d1e7 bne.n 800447a + } +} + 80044aa: e000 b.n 80044ae + break; + 80044ac: bf00 nop +} + 80044ae: bf00 nop + 80044b0: 3714 adds r7, #20 + 80044b2: 46bd mov sp, r7 + 80044b4: bc80 pop {r7} + 80044b6: 4770 bx lr + +080044b8 : + +int AddShellCmd(const char*pCmd, const char*pHelp, ShellFunc func) +{ + 80044b8: b580 push {r7, lr} + 80044ba: b084 sub sp, #16 + 80044bc: af00 add r7, sp, #0 + 80044be: 60f8 str r0, [r7, #12] + 80044c0: 60b9 str r1, [r7, #8] + 80044c2: 607a str r2, [r7, #4] + if (g_cmdNum < MAX_CMD_NUM) + 80044c4: 4b31 ldr r3, [pc, #196] ; (800458c ) + 80044c6: 681b ldr r3, [r3, #0] + 80044c8: 2b1f cmp r3, #31 + 80044ca: dc53 bgt.n 8004574 + { + if ((strlen(pCmd) >= MAX_CMD_STR)) + 80044cc: 68f8 ldr r0, [r7, #12] + 80044ce: f7fb fea9 bl 8000224 + 80044d2: 4603 mov r3, r0 + 80044d4: 2b0b cmp r3, #11 + 80044d6: d918 bls.n 800450a + { + memcpy(g_cmdList[g_cmdNum].cmdstr, pCmd, MAX_CMD_STR-1); + 80044d8: 4b2c ldr r3, [pc, #176] ; (800458c ) + 80044da: 681a ldr r2, [r3, #0] + 80044dc: 4613 mov r3, r2 + 80044de: 009b lsls r3, r3, #2 + 80044e0: 4413 add r3, r2 + 80044e2: 009b lsls r3, r3, #2 + 80044e4: 4a2a ldr r2, [pc, #168] ; (8004590 ) + 80044e6: 4413 add r3, r2 + 80044e8: 220b movs r2, #11 + 80044ea: 68f9 ldr r1, [r7, #12] + 80044ec: 4618 mov r0, r3 + 80044ee: f005 f9f9 bl 80098e4 + g_cmdList[g_cmdNum].cmdstr[MAX_CMD_STR-1] = 0; + 80044f2: 4b26 ldr r3, [pc, #152] ; (800458c ) + 80044f4: 681a ldr r2, [r3, #0] + 80044f6: 4926 ldr r1, [pc, #152] ; (8004590 ) + 80044f8: 4613 mov r3, r2 + 80044fa: 009b lsls r3, r3, #2 + 80044fc: 4413 add r3, r2 + 80044fe: 009b lsls r3, r3, #2 + 8004500: 440b add r3, r1 + 8004502: 330b adds r3, #11 + 8004504: 2200 movs r2, #0 + 8004506: 701a strb r2, [r3, #0] + 8004508: e00b b.n 8004522 + } + else + { + strcpy(g_cmdList[g_cmdNum].cmdstr, pCmd); + 800450a: 4b20 ldr r3, [pc, #128] ; (800458c ) + 800450c: 681a ldr r2, [r3, #0] + 800450e: 4613 mov r3, r2 + 8004510: 009b lsls r3, r3, #2 + 8004512: 4413 add r3, r2 + 8004514: 009b lsls r3, r3, #2 + 8004516: 4a1e ldr r2, [pc, #120] ; (8004590 ) + 8004518: 4413 add r3, r2 + 800451a: 68f9 ldr r1, [r7, #12] + 800451c: 4618 mov r0, r3 + 800451e: f005 fa71 bl 8009a04 + } + + ChangeToUper(g_cmdList[g_cmdNum].cmdstr); + 8004522: 4b1a ldr r3, [pc, #104] ; (800458c ) + 8004524: 681a ldr r2, [r3, #0] + 8004526: 4613 mov r3, r2 + 8004528: 009b lsls r3, r3, #2 + 800452a: 4413 add r3, r2 + 800452c: 009b lsls r3, r3, #2 + 800452e: 4a18 ldr r2, [pc, #96] ; (8004590 ) + 8004530: 4413 add r3, r2 + 8004532: 4618 mov r0, r3 + 8004534: f7ff ff9c bl 8004470 +#if (1) // Ϊָ + g_cmdList[g_cmdNum].helpstr = pHelp; + 8004538: 4b14 ldr r3, [pc, #80] ; (800458c ) + 800453a: 681a ldr r2, [r3, #0] + 800453c: 4914 ldr r1, [pc, #80] ; (8004590 ) + 800453e: 4613 mov r3, r2 + 8004540: 009b lsls r3, r3, #2 + 8004542: 4413 add r3, r2 + 8004544: 009b lsls r3, r3, #2 + 8004546: 440b add r3, r1 + 8004548: 330c adds r3, #12 + 800454a: 68ba ldr r2, [r7, #8] + 800454c: 601a str r2, [r3, #0] + else + { + strcpy(g_cmdList[g_cmdNum].helpstr, pHelp); + } +#endif + g_cmdList[g_cmdNum].shellfunc = func; + 800454e: 4b0f ldr r3, [pc, #60] ; (800458c ) + 8004550: 681a ldr r2, [r3, #0] + 8004552: 490f ldr r1, [pc, #60] ; (8004590 ) + 8004554: 4613 mov r3, r2 + 8004556: 009b lsls r3, r3, #2 + 8004558: 4413 add r3, r2 + 800455a: 009b lsls r3, r3, #2 + 800455c: 440b add r3, r1 + 800455e: 3310 adds r3, #16 + 8004560: 687a ldr r2, [r7, #4] + 8004562: 601a str r2, [r3, #0] + g_cmdNum++; + 8004564: 4b09 ldr r3, [pc, #36] ; (800458c ) + 8004566: 681b ldr r3, [r3, #0] + 8004568: 3301 adds r3, #1 + 800456a: 4a08 ldr r2, [pc, #32] ; (800458c ) + 800456c: 6013 str r3, [r2, #0] + return g_cmdNum; + 800456e: 4b07 ldr r3, [pc, #28] ; (800458c ) + 8004570: 681b ldr r3, [r3, #0] + 8004572: e007 b.n 8004584 + } + else + { + printf("AddShellCmd failed, g_cmdNum=%d\r\n", g_cmdNum); + 8004574: 4b05 ldr r3, [pc, #20] ; (800458c ) + 8004576: 681b ldr r3, [r3, #0] + 8004578: 4619 mov r1, r3 + 800457a: 4806 ldr r0, [pc, #24] ; (8004594 ) + 800457c: f005 f9c6 bl 800990c + return -1; + 8004580: f04f 33ff mov.w r3, #4294967295 + } +} + 8004584: 4618 mov r0, r3 + 8004586: 3710 adds r7, #16 + 8004588: 46bd mov sp, r7 + 800458a: bd80 pop {r7, pc} + 800458c: 20000560 .word 0x20000560 + 8004590: 20001034 .word 0x20001034 + 8004594: 0800ab5c .word 0x0800ab5c + +08004598 <__NVIC_SetPriority>: +{ + 8004598: b480 push {r7} + 800459a: b083 sub sp, #12 + 800459c: af00 add r7, sp, #0 + 800459e: 4603 mov r3, r0 + 80045a0: 6039 str r1, [r7, #0] + 80045a2: 71fb strb r3, [r7, #7] + if ((int32_t)(IRQn) >= 0) + 80045a4: f997 3007 ldrsb.w r3, [r7, #7] + 80045a8: 2b00 cmp r3, #0 + 80045aa: db0a blt.n 80045c2 <__NVIC_SetPriority+0x2a> + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80045ac: 683b ldr r3, [r7, #0] + 80045ae: b2da uxtb r2, r3 + 80045b0: 490c ldr r1, [pc, #48] ; (80045e4 <__NVIC_SetPriority+0x4c>) + 80045b2: f997 3007 ldrsb.w r3, [r7, #7] + 80045b6: 0112 lsls r2, r2, #4 + 80045b8: b2d2 uxtb r2, r2 + 80045ba: 440b add r3, r1 + 80045bc: f883 2300 strb.w r2, [r3, #768] ; 0x300 +} + 80045c0: e00a b.n 80045d8 <__NVIC_SetPriority+0x40> + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + 80045c2: 683b ldr r3, [r7, #0] + 80045c4: b2da uxtb r2, r3 + 80045c6: 4908 ldr r1, [pc, #32] ; (80045e8 <__NVIC_SetPriority+0x50>) + 80045c8: 79fb ldrb r3, [r7, #7] + 80045ca: f003 030f and.w r3, r3, #15 + 80045ce: 3b04 subs r3, #4 + 80045d0: 0112 lsls r2, r2, #4 + 80045d2: b2d2 uxtb r2, r2 + 80045d4: 440b add r3, r1 + 80045d6: 761a strb r2, [r3, #24] +} + 80045d8: bf00 nop + 80045da: 370c adds r7, #12 + 80045dc: 46bd mov sp, r7 + 80045de: bc80 pop {r7} + 80045e0: 4770 bx lr + 80045e2: bf00 nop + 80045e4: e000e100 .word 0xe000e100 + 80045e8: e000ed00 .word 0xe000ed00 + +080045ec : +{ + 80045ec: b580 push {r7, lr} + 80045ee: b082 sub sp, #8 + 80045f0: af00 add r7, sp, #0 + 80045f2: 6078 str r0, [r7, #4] + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + 80045f4: 687b ldr r3, [r7, #4] + 80045f6: 3b01 subs r3, #1 + 80045f8: f1b3 7f80 cmp.w r3, #16777216 ; 0x1000000 + 80045fc: d301 bcc.n 8004602 + return (1UL); /* Reload value impossible */ + 80045fe: 2301 movs r3, #1 + 8004600: e00f b.n 8004622 + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + 8004602: 4a0a ldr r2, [pc, #40] ; (800462c ) + 8004604: 687b ldr r3, [r7, #4] + 8004606: 3b01 subs r3, #1 + 8004608: 6053 str r3, [r2, #4] + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + 800460a: 210f movs r1, #15 + 800460c: f04f 30ff mov.w r0, #4294967295 + 8004610: f7ff ffc2 bl 8004598 <__NVIC_SetPriority> + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + 8004614: 4b05 ldr r3, [pc, #20] ; (800462c ) + 8004616: 2200 movs r2, #0 + 8004618: 609a str r2, [r3, #8] + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + 800461a: 4b04 ldr r3, [pc, #16] ; (800462c ) + 800461c: 2207 movs r2, #7 + 800461e: 601a str r2, [r3, #0] + return (0UL); /* Function successful */ + 8004620: 2300 movs r3, #0 +} + 8004622: 4618 mov r0, r3 + 8004624: 3708 adds r7, #8 + 8004626: 46bd mov sp, r7 + 8004628: bd80 pop {r7, pc} + 800462a: bf00 nop + 800462c: e000e010 .word 0xe000e010 + +08004630 : +int g_triggerInited = 0; + +//------------------------------------------------------- + +void InitTrigger(void) +{ + 8004630: b580 push {r7, lr} + 8004632: af00 add r7, sp, #0 + if (g_triggerInited == 0) + 8004634: 4b12 ldr r3, [pc, #72] ; (8004680 ) + 8004636: 681b ldr r3, [r3, #0] + 8004638: 2b00 cmp r3, #0 + 800463a: d11f bne.n 800467c + { + SysTick_Config(MS_SYS_TICK); // ϵͳʱӲ1msж + 800463c: 4811 ldr r0, [pc, #68] ; (8004684 ) + 800463e: f7ff ffd5 bl 80045ec + NVIC_SetPriority(SysTick_IRQn, 0); + 8004642: 2100 movs r1, #0 + 8004644: f04f 30ff mov.w r0, #4294967295 + 8004648: f7ff ffa6 bl 8004598 <__NVIC_SetPriority> + + g_mstimer = 0; + 800464c: 4b0e ldr r3, [pc, #56] ; (8004688 ) + 800464e: 2200 movs r2, #0 + 8004650: 601a str r2, [r3, #0] + + // + g_triggerListNum = 0; + 8004652: 4b0e ldr r3, [pc, #56] ; (800468c ) + 8004654: 2200 movs r2, #0 + 8004656: 601a str r2, [r3, #0] + memset(&g_triggerCtrlList, 0, sizeof(TriggerCtrl)*MAX_TRIGGER_TASK); + 8004658: 22a0 movs r2, #160 ; 0xa0 + 800465a: 2100 movs r1, #0 + 800465c: 480c ldr r0, [pc, #48] ; (8004690 ) + 800465e: f005 f94c bl 80098fa + + g_triggerTimer = 0; + 8004662: 4b0c ldr r3, [pc, #48] ; (8004694 ) + 8004664: 2200 movs r2, #0 + 8004666: 601a str r2, [r3, #0] + g_triggerTask = 0; + 8004668: 4b0b ldr r3, [pc, #44] ; (8004698 ) + 800466a: 2200 movs r2, #0 + 800466c: 601a str r2, [r3, #0] + g_triggerInited = 1; + 800466e: 4b04 ldr r3, [pc, #16] ; (8004680 ) + 8004670: 2201 movs r2, #1 + 8004672: 601a str r2, [r3, #0] + + InitIWDog(1000); // 1븴λŹ + 8004674: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8004678: f7ff f800 bl 800367c + } +} + 800467c: bf00 nop + 800467e: bd80 pop {r7, pc} + 8004680: 20000574 .word 0x20000574 + 8004684: 00011940 .word 0x00011940 + 8004688: 20000564 .word 0x20000564 + 800468c: 20000568 .word 0x20000568 + 8004690: 200012b4 .word 0x200012b4 + 8004694: 2000056c .word 0x2000056c + 8004698: 20000570 .word 0x20000570 + +0800469c : + + return rslt; +} + +void TriggerExTask(void) +{ + 800469c: b580 push {r7, lr} + 800469e: b082 sub sp, #8 + 80046a0: af00 add r7, sp, #0 + int i; + if (g_triggerInited != 0) + 80046a2: 4b21 ldr r3, [pc, #132] ; (8004728 ) + 80046a4: 681b ldr r3, [r3, #0] + 80046a6: 2b00 cmp r3, #0 + 80046a8: d03a beq.n 8004720 + { + for (i = 0; i < g_triggerListNum; i++) + 80046aa: 2300 movs r3, #0 + 80046ac: 607b str r3, [r7, #4] + 80046ae: e032 b.n 8004716 + { + if ((g_mstimer % g_triggerCtrlList[i].triggerTimer) == 0) + 80046b0: 4b1e ldr r3, [pc, #120] ; (800472c ) + 80046b2: 681b ldr r3, [r3, #0] + 80046b4: 461a mov r2, r3 + 80046b6: 491e ldr r1, [pc, #120] ; (8004730 ) + 80046b8: 687b ldr r3, [r7, #4] + 80046ba: 011b lsls r3, r3, #4 + 80046bc: 440b add r3, r1 + 80046be: 681b ldr r3, [r3, #0] + 80046c0: fbb2 f1f3 udiv r1, r2, r3 + 80046c4: fb03 f301 mul.w r3, r3, r1 + 80046c8: 1ad3 subs r3, r2, r3 + 80046ca: 2b00 cmp r3, #0 + 80046cc: d120 bne.n 8004710 + { + if (g_triggerCtrlList[i].triggerExFunc != NULL) + 80046ce: 4a18 ldr r2, [pc, #96] ; (8004730 ) + 80046d0: 687b ldr r3, [r7, #4] + 80046d2: 011b lsls r3, r3, #4 + 80046d4: 4413 add r3, r2 + 80046d6: 3304 adds r3, #4 + 80046d8: 681b ldr r3, [r3, #0] + 80046da: 2b00 cmp r3, #0 + 80046dc: d006 beq.n 80046ec + { + g_triggerCtrlList[i].triggerExFunc(); + 80046de: 4a14 ldr r2, [pc, #80] ; (8004730 ) + 80046e0: 687b ldr r3, [r7, #4] + 80046e2: 011b lsls r3, r3, #4 + 80046e4: 4413 add r3, r2 + 80046e6: 3304 adds r3, #4 + 80046e8: 681b ldr r3, [r3, #0] + 80046ea: 4798 blx r3 + } + if (g_triggerCtrlList[i].triggerTaskFunc != NULL) + 80046ec: 4a10 ldr r2, [pc, #64] ; (8004730 ) + 80046ee: 687b ldr r3, [r7, #4] + 80046f0: 011b lsls r3, r3, #4 + 80046f2: 4413 add r3, r2 + 80046f4: 330c adds r3, #12 + 80046f6: 681b ldr r3, [r3, #0] + 80046f8: 2b00 cmp r3, #0 + 80046fa: d009 beq.n 8004710 + { + g_triggerCtrlList[i].triggerTask = 1; + 80046fc: 4a0c ldr r2, [pc, #48] ; (8004730 ) + 80046fe: 687b ldr r3, [r7, #4] + 8004700: 011b lsls r3, r3, #4 + 8004702: 4413 add r3, r2 + 8004704: 3308 adds r3, #8 + 8004706: 2201 movs r2, #1 + 8004708: 601a str r2, [r3, #0] + g_triggerTask = 1; + 800470a: 4b0a ldr r3, [pc, #40] ; (8004734 ) + 800470c: 2201 movs r2, #1 + 800470e: 601a str r2, [r3, #0] + for (i = 0; i < g_triggerListNum; i++) + 8004710: 687b ldr r3, [r7, #4] + 8004712: 3301 adds r3, #1 + 8004714: 607b str r3, [r7, #4] + 8004716: 4b08 ldr r3, [pc, #32] ; (8004738 ) + 8004718: 681b ldr r3, [r3, #0] + 800471a: 687a ldr r2, [r7, #4] + 800471c: 429a cmp r2, r3 + 800471e: dbc7 blt.n 80046b0 + } + } + } + } +} + 8004720: bf00 nop + 8004722: 3708 adds r7, #8 + 8004724: 46bd mov sp, r7 + 8004726: bd80 pop {r7, pc} + 8004728: 20000574 .word 0x20000574 + 800472c: 20000564 .word 0x20000564 + 8004730: 200012b4 .word 0x200012b4 + 8004734: 20000570 .word 0x20000570 + 8004738: 20000568 .word 0x20000568 + +0800473c : + } +} +#else +// ʱ +void TriggerTask(void) +{ + 800473c: b580 push {r7, lr} + 800473e: b082 sub sp, #8 + 8004740: af00 add r7, sp, #0 + int i; + if (g_triggerInited != 0 && g_triggerTask != 0) + 8004742: 4b16 ldr r3, [pc, #88] ; (800479c ) + 8004744: 681b ldr r3, [r3, #0] + 8004746: 2b00 cmp r3, #0 + 8004748: d024 beq.n 8004794 + 800474a: 4b15 ldr r3, [pc, #84] ; (80047a0 ) + 800474c: 681b ldr r3, [r3, #0] + 800474e: 2b00 cmp r3, #0 + 8004750: d020 beq.n 8004794 + { + for (i = 0; i < g_triggerListNum; i++) + 8004752: 2300 movs r3, #0 + 8004754: 607b str r3, [r7, #4] + 8004756: e018 b.n 800478a + { + if (g_triggerCtrlList[i].triggerTask != 0) + 8004758: 4a12 ldr r2, [pc, #72] ; (80047a4 ) + 800475a: 687b ldr r3, [r7, #4] + 800475c: 011b lsls r3, r3, #4 + 800475e: 4413 add r3, r2 + 8004760: 3308 adds r3, #8 + 8004762: 681b ldr r3, [r3, #0] + 8004764: 2b00 cmp r3, #0 + 8004766: d00d beq.n 8004784 + { + g_triggerCtrlList[i].triggerTask = 0; + 8004768: 4a0e ldr r2, [pc, #56] ; (80047a4 ) + 800476a: 687b ldr r3, [r7, #4] + 800476c: 011b lsls r3, r3, #4 + 800476e: 4413 add r3, r2 + 8004770: 3308 adds r3, #8 + 8004772: 2200 movs r2, #0 + 8004774: 601a str r2, [r3, #0] + g_triggerCtrlList[i].triggerTaskFunc(); + 8004776: 4a0b ldr r2, [pc, #44] ; (80047a4 ) + 8004778: 687b ldr r3, [r7, #4] + 800477a: 011b lsls r3, r3, #4 + 800477c: 4413 add r3, r2 + 800477e: 330c adds r3, #12 + 8004780: 681b ldr r3, [r3, #0] + 8004782: 4798 blx r3 + for (i = 0; i < g_triggerListNum; i++) + 8004784: 687b ldr r3, [r7, #4] + 8004786: 3301 adds r3, #1 + 8004788: 607b str r3, [r7, #4] + 800478a: 4b07 ldr r3, [pc, #28] ; (80047a8 ) + 800478c: 681b ldr r3, [r3, #0] + 800478e: 687a ldr r2, [r7, #4] + 8004790: 429a cmp r2, r3 + 8004792: dbe1 blt.n 8004758 + } + } + } +} + 8004794: bf00 nop + 8004796: 3708 adds r7, #8 + 8004798: 46bd mov sp, r7 + 800479a: bd80 pop {r7, pc} + 800479c: 20000574 .word 0x20000574 + 80047a0: 20000570 .word 0x20000570 + 80047a4: 200012b4 .word 0x200012b4 + 80047a8: 20000568 .word 0x20000568 + +080047ac : +#endif + +// 1ms ж +void TriggerIntProc(void) +{ + 80047ac: b580 push {r7, lr} + 80047ae: af00 add r7, sp, #0 + g_mstimer++; + 80047b0: 4b0f ldr r3, [pc, #60] ; (80047f0 ) + 80047b2: 681b ldr r3, [r3, #0] + 80047b4: 3301 adds r3, #1 + 80047b6: 4a0e ldr r2, [pc, #56] ; (80047f0 ) + 80047b8: 6013 str r3, [r2, #0] + TriggerExTask(); + 80047ba: f7ff ff6f bl 800469c + if ((g_mstimer%TRIGGER_TIME) == 0) // ÿ10msִһ + 80047be: 4b0c ldr r3, [pc, #48] ; (80047f0 ) + 80047c0: 6819 ldr r1, [r3, #0] + 80047c2: 4b0c ldr r3, [pc, #48] ; (80047f4 ) + 80047c4: fb83 2301 smull r2, r3, r3, r1 + 80047c8: 109a asrs r2, r3, #2 + 80047ca: 17cb asrs r3, r1, #31 + 80047cc: 1ad2 subs r2, r2, r3 + 80047ce: 4613 mov r3, r2 + 80047d0: 009b lsls r3, r3, #2 + 80047d2: 4413 add r3, r2 + 80047d4: 005b lsls r3, r3, #1 + 80047d6: 1aca subs r2, r1, r3 + 80047d8: 2a00 cmp r2, #0 + 80047da: d106 bne.n 80047ea + { + g_triggerTimer++; + 80047dc: 4b06 ldr r3, [pc, #24] ; (80047f8 ) + 80047de: 681b ldr r3, [r3, #0] + 80047e0: 3301 adds r3, #1 + 80047e2: 4a05 ldr r2, [pc, #20] ; (80047f8 ) + 80047e4: 6013 str r3, [r2, #0] + FeedIWDog(); // ιŹ + 80047e6: f7fe ff62 bl 80036ae + } +} + 80047ea: bf00 nop + 80047ec: bd80 pop {r7, pc} + 80047ee: bf00 nop + 80047f0: 20000564 .word 0x20000564 + 80047f4: 66666667 .word 0x66666667 + 80047f8: 2000056c .word 0x2000056c + +080047fc : + return (stim + 1) * 10000 - ((val+1) / NS100_SYS_TICK); +} + +// õʱ, λ1us +u32 GetUsSoftTimer(void) +{ + 80047fc: b480 push {r7} + 80047fe: b085 sub sp, #20 + 8004800: af00 add r7, sp, #0 + u32 volatile val, stim, stim2; + stim = g_mstimer; // ȡ + 8004802: 4b12 ldr r3, [pc, #72] ; (800484c ) + 8004804: 681b ldr r3, [r3, #0] + 8004806: 60bb str r3, [r7, #8] + val = SysTick->VAL; + 8004808: 4b11 ldr r3, [pc, #68] ; (8004850 ) + 800480a: 689b ldr r3, [r3, #8] + 800480c: 60fb str r3, [r7, #12] + stim2 = g_mstimer; // ٴζȡ + 800480e: 4b0f ldr r3, [pc, #60] ; (800484c ) + 8004810: 681b ldr r3, [r3, #0] + 8004812: 607b str r3, [r7, #4] + if (stim != stim2) // ͬ, ˵мж + 8004814: 68ba ldr r2, [r7, #8] + 8004816: 687b ldr r3, [r7, #4] + 8004818: 429a cmp r2, r3 + 800481a: d004 beq.n 8004826 + { + val = SysTick->VAL; // ¶ȡ + 800481c: 4b0c ldr r3, [pc, #48] ; (8004850 ) + 800481e: 689b ldr r3, [r3, #8] + 8004820: 60fb str r3, [r7, #12] + stim = stim2; + 8004822: 687b ldr r3, [r7, #4] + 8004824: 60bb str r3, [r7, #8] + } + + return (stim + 1) * 1000 - ((val+1) / US_SYS_TICK); + 8004826: 68bb ldr r3, [r7, #8] + 8004828: 3301 adds r3, #1 + 800482a: f44f 727a mov.w r2, #1000 ; 0x3e8 + 800482e: fb02 f203 mul.w r2, r2, r3 + 8004832: 68fb ldr r3, [r7, #12] + 8004834: 3301 adds r3, #1 + 8004836: 4907 ldr r1, [pc, #28] ; (8004854 ) + 8004838: fba1 1303 umull r1, r3, r1, r3 + 800483c: 091b lsrs r3, r3, #4 + 800483e: 1ad3 subs r3, r2, r3 +} + 8004840: 4618 mov r0, r3 + 8004842: 3714 adds r7, #20 + 8004844: 46bd mov sp, r7 + 8004846: bc80 pop {r7} + 8004848: 4770 bx lr + 800484a: bf00 nop + 800484c: 20000564 .word 0x20000564 + 8004850: e000e010 .word 0xe000e010 + 8004854: 38e38e39 .word 0x38e38e39 + +08004858 : + return g_mstimer; +} + +// õʱ, λ:1ms :10ms +u32 GetMsSoftTimer10(void) +{ + 8004858: b480 push {r7} + 800485a: af00 add r7, sp, #0 + return g_mstimer; + 800485c: 4b02 ldr r3, [pc, #8] ; (8004868 ) + 800485e: 681b ldr r3, [r3, #0] +// return g_triggerTimer*TRIGGER_TIME; +} + 8004860: 4618 mov r0, r3 + 8004862: 46bd mov sp, r7 + 8004864: bc80 pop {r7} + 8004866: 4770 bx lr + 8004868: 20000564 .word 0x20000564 + +0800486c : + +#include "sewhdcontrol.h" + +#if (CONTROL_BUS == COMM_CAN) +void InitSewHeadControl(SewHeadControl * pCtrl) +{ + 800486c: b580 push {r7, lr} + 800486e: b082 sub sp, #8 + 8004870: af00 add r7, sp, #0 + 8004872: 6078 str r0, [r7, #4] + if (pCtrl != NULL) + 8004874: 687b ldr r3, [r7, #4] + 8004876: 2b00 cmp r3, #0 + 8004878: d004 beq.n 8004884 + { + memset(pCtrl, 0, sizeof(SewHeadControl)); + 800487a: 228c movs r2, #140 ; 0x8c + 800487c: 2100 movs r1, #0 + 800487e: 6878 ldr r0, [r7, #4] + 8004880: f005 f83b bl 80098fa + } +} + 8004884: bf00 nop + 8004886: 3708 adds r7, #8 + 8004888: 46bd mov sp, r7 + 800488a: bd80 pop {r7, pc} + +0800488c : + +#include "modbus_def.h" + +// עmodbusͨѶ +void RegisterModbusCommFunc(ModbusCtrl* pCtrl, UsartSendData send, UsartGetData get, UsartCleanRsBuf clean, IsUsartSendOver sdover, OnOffFunc outen, OnOffFunc outdis) +{ + 800488c: b480 push {r7} + 800488e: b085 sub sp, #20 + 8004890: af00 add r7, sp, #0 + 8004892: 60f8 str r0, [r7, #12] + 8004894: 60b9 str r1, [r7, #8] + 8004896: 607a str r2, [r7, #4] + 8004898: 603b str r3, [r7, #0] + pCtrl->ModBusCommSend = send; + 800489a: 68fb ldr r3, [r7, #12] + 800489c: 68ba ldr r2, [r7, #8] + 800489e: 60da str r2, [r3, #12] + pCtrl->ModBusCommReceive = get; + 80048a0: 68fb ldr r3, [r7, #12] + 80048a2: 687a ldr r2, [r7, #4] + 80048a4: 611a str r2, [r3, #16] + pCtrl->ModBusCommCleanRsBuf = clean; + 80048a6: 68fb ldr r3, [r7, #12] + 80048a8: 683a ldr r2, [r7, #0] + 80048aa: 615a str r2, [r3, #20] + pCtrl->IsModBusCommSendOver = sdover; + 80048ac: 68fb ldr r3, [r7, #12] + 80048ae: 69ba ldr r2, [r7, #24] + 80048b0: 619a str r2, [r3, #24] + + pCtrl->CommOutEn = outen; + 80048b2: 68fb ldr r3, [r7, #12] + 80048b4: 69fa ldr r2, [r7, #28] + 80048b6: 61da str r2, [r3, #28] + pCtrl->CommOutDis = outdis; + 80048b8: 68fb ldr r3, [r7, #12] + 80048ba: 6a3a ldr r2, [r7, #32] + 80048bc: 621a str r2, [r3, #32] +} + 80048be: bf00 nop + 80048c0: 3714 adds r7, #20 + 80048c2: 46bd mov sp, r7 + 80048c4: bc80 pop {r7} + 80048c6: 4770 bx lr + +080048c8 : + +//----------------------------------------------------------------- +// ĬϺ +int DefSendData(u8 * pDatBuf, int len) +{ + 80048c8: b480 push {r7} + 80048ca: b083 sub sp, #12 + 80048cc: af00 add r7, sp, #0 + 80048ce: 6078 str r0, [r7, #4] + 80048d0: 6039 str r1, [r7, #0] + return 0; + 80048d2: 2300 movs r3, #0 +} + 80048d4: 4618 mov r0, r3 + 80048d6: 370c adds r7, #12 + 80048d8: 46bd mov sp, r7 + 80048da: bc80 pop {r7} + 80048dc: 4770 bx lr + +080048de : + +int DefGetData(u8 * pDat, int expectLen) +{ + 80048de: b480 push {r7} + 80048e0: b083 sub sp, #12 + 80048e2: af00 add r7, sp, #0 + 80048e4: 6078 str r0, [r7, #4] + 80048e6: 6039 str r1, [r7, #0] + return 0; + 80048e8: 2300 movs r3, #0 +} + 80048ea: 4618 mov r0, r3 + 80048ec: 370c adds r7, #12 + 80048ee: 46bd mov sp, r7 + 80048f0: bc80 pop {r7} + 80048f2: 4770 bx lr + +080048f4 : + +int DefCleanRsBuf(void) +{ + 80048f4: b480 push {r7} + 80048f6: af00 add r7, sp, #0 + return 0; + 80048f8: 2300 movs r3, #0 +} + 80048fa: 4618 mov r0, r3 + 80048fc: 46bd mov sp, r7 + 80048fe: bc80 pop {r7} + 8004900: 4770 bx lr + +08004902 : + +int DefIsSendOver(void) +{ + 8004902: b480 push {r7} + 8004904: af00 add r7, sp, #0 + return 0; + 8004906: 2300 movs r3, #0 +} + 8004908: 4618 mov r0, r3 + 800490a: 46bd mov sp, r7 + 800490c: bc80 pop {r7} + 800490e: 4770 bx lr + +08004910 : + +void DefOutEn(void) +{ + 8004910: b480 push {r7} + 8004912: af00 add r7, sp, #0 +} + 8004914: bf00 nop + 8004916: 46bd mov sp, r7 + 8004918: bc80 pop {r7} + 800491a: 4770 bx lr + +0800491c : + +void DefOutDis(void) +{ + 800491c: b480 push {r7} + 800491e: af00 add r7, sp, #0 +} + 8004920: bf00 nop + 8004922: 46bd mov sp, r7 + 8004924: bc80 pop {r7} + 8004926: 4770 bx lr + +08004928 : +// ASCIIģʽ +//----------------------------------------------------------------- +// :ASCII -> RTU + +u8 AsciiToRtu(u8 ascii) +{ + 8004928: b480 push {r7} + 800492a: b083 sub sp, #12 + 800492c: af00 add r7, sp, #0 + 800492e: 4603 mov r3, r0 + 8004930: 71fb strb r3, [r7, #7] + if ((ascii >= '0') && (ascii <= '9')) + 8004932: 79fb ldrb r3, [r7, #7] + 8004934: 2b2f cmp r3, #47 ; 0x2f + 8004936: d906 bls.n 8004946 + 8004938: 79fb ldrb r3, [r7, #7] + 800493a: 2b39 cmp r3, #57 ; 0x39 + 800493c: d803 bhi.n 8004946 + { + return ascii - '0'; + 800493e: 79fb ldrb r3, [r7, #7] + 8004940: 3b30 subs r3, #48 ; 0x30 + 8004942: b2db uxtb r3, r3 + 8004944: e014 b.n 8004970 + } + else if ((ascii >= 'A') && (ascii <= 'F')) + 8004946: 79fb ldrb r3, [r7, #7] + 8004948: 2b40 cmp r3, #64 ; 0x40 + 800494a: d906 bls.n 800495a + 800494c: 79fb ldrb r3, [r7, #7] + 800494e: 2b46 cmp r3, #70 ; 0x46 + 8004950: d803 bhi.n 800495a + { + return ascii - 'A' + 10; + 8004952: 79fb ldrb r3, [r7, #7] + 8004954: 3b37 subs r3, #55 ; 0x37 + 8004956: b2db uxtb r3, r3 + 8004958: e00a b.n 8004970 + } + else if ((ascii >= 'a') && (ascii <= 'f')) + 800495a: 79fb ldrb r3, [r7, #7] + 800495c: 2b60 cmp r3, #96 ; 0x60 + 800495e: d906 bls.n 800496e + 8004960: 79fb ldrb r3, [r7, #7] + 8004962: 2b66 cmp r3, #102 ; 0x66 + 8004964: d803 bhi.n 800496e + { + return ascii - 'a' + 10; + 8004966: 79fb ldrb r3, [r7, #7] + 8004968: 3b57 subs r3, #87 ; 0x57 + 800496a: b2db uxtb r3, r3 + 800496c: e000 b.n 8004970 + } + else + { + return 0; + 800496e: 2300 movs r3, #0 + } +} + 8004970: 4618 mov r0, r3 + 8004972: 370c adds r7, #12 + 8004974: 46bd mov sp, r7 + 8004976: bc80 pop {r7} + 8004978: 4770 bx lr + +0800497a : +//----------------------------------------------------------------- +// :RTU -> ASCII + +u8 RtuToAscii(u8 rtu) +{ + 800497a: b480 push {r7} + 800497c: b083 sub sp, #12 + 800497e: af00 add r7, sp, #0 + 8004980: 4603 mov r3, r0 + 8004982: 71fb strb r3, [r7, #7] + if (rtu < 10) + 8004984: 79fb ldrb r3, [r7, #7] + 8004986: 2b09 cmp r3, #9 + 8004988: d803 bhi.n 8004992 + { + return rtu + '0'; + 800498a: 79fb ldrb r3, [r7, #7] + 800498c: 3330 adds r3, #48 ; 0x30 + 800498e: b2db uxtb r3, r3 + 8004990: e007 b.n 80049a2 + } + else if (rtu < 16) + 8004992: 79fb ldrb r3, [r7, #7] + 8004994: 2b0f cmp r3, #15 + 8004996: d803 bhi.n 80049a0 + { + return rtu + 'A' - 10; + 8004998: 79fb ldrb r3, [r7, #7] + 800499a: 3337 adds r3, #55 ; 0x37 + 800499c: b2db uxtb r3, r3 + 800499e: e000 b.n 80049a2 + } + else + { + return rtu; + 80049a0: 79fb ldrb r3, [r7, #7] + } +} + 80049a2: 4618 mov r0, r3 + 80049a4: 370c adds r7, #12 + 80049a6: 46bd mov sp, r7 + 80049a8: bc80 pop {r7} + 80049aa: 4770 bx lr + +080049ac : + 0x43,0x83,0x41,0x81,0x80,0x40 +}; + +//һcrcУֵ +void ModbusAddCrc16(u8 Data, u8 * pcrch, u8 * pcrcl) +{ + 80049ac: b480 push {r7} + 80049ae: b087 sub sp, #28 + 80049b0: af00 add r7, sp, #0 + 80049b2: 4603 mov r3, r0 + 80049b4: 60b9 str r1, [r7, #8] + 80049b6: 607a str r2, [r7, #4] + 80049b8: 73fb strb r3, [r7, #15] + int idx; + idx = *pcrch ^ Data; /*CRC*/ + 80049ba: 68bb ldr r3, [r7, #8] + 80049bc: 781a ldrb r2, [r3, #0] + 80049be: 7bfb ldrb r3, [r7, #15] + 80049c0: 4053 eors r3, r2 + 80049c2: b2db uxtb r3, r3 + 80049c4: 617b str r3, [r7, #20] + *pcrch = *pcrcl ^ auchCRCHi[idx]; + 80049c6: 687b ldr r3, [r7, #4] + 80049c8: 781a ldrb r2, [r3, #0] + 80049ca: 4909 ldr r1, [pc, #36] ; (80049f0 ) + 80049cc: 697b ldr r3, [r7, #20] + 80049ce: 440b add r3, r1 + 80049d0: 781b ldrb r3, [r3, #0] + 80049d2: 4053 eors r3, r2 + 80049d4: b2da uxtb r2, r3 + 80049d6: 68bb ldr r3, [r7, #8] + 80049d8: 701a strb r2, [r3, #0] + *pcrcl = auchCRCLo[idx]; + 80049da: 4a06 ldr r2, [pc, #24] ; (80049f4 ) + 80049dc: 697b ldr r3, [r7, #20] + 80049de: 4413 add r3, r2 + 80049e0: 781a ldrb r2, [r3, #0] + 80049e2: 687b ldr r3, [r7, #4] + 80049e4: 701a strb r2, [r3, #0] +} + 80049e6: bf00 nop + 80049e8: 371c adds r7, #28 + 80049ea: 46bd mov sp, r7 + 80049ec: bc80 pop {r7} + 80049ee: 4770 bx lr + 80049f0: 20000014 .word 0x20000014 + 80049f4: 20000114 .word 0x20000114 + +080049f8 : + +//----------------------------------------------------- +// u8 *puchMsg; //ҪCRCУϢ +// u16 usDataLen;// Ϣֽ +u16 ModbusCrc16(u8 *puchMsg, u16 usDataLen) +{ + 80049f8: b580 push {r7, lr} + 80049fa: b084 sub sp, #16 + 80049fc: af00 add r7, sp, #0 + 80049fe: 6078 str r0, [r7, #4] + 8004a00: 460b mov r3, r1 + 8004a02: 807b strh r3, [r7, #2] + u8 crch, crcl; + crch = 0xff; + 8004a04: 23ff movs r3, #255 ; 0xff + 8004a06: 73fb strb r3, [r7, #15] + crcl = 0xff; + 8004a08: 23ff movs r3, #255 ; 0xff + 8004a0a: 73bb strb r3, [r7, #14] + + while(usDataLen) /// Ϣ + 8004a0c: e00e b.n 8004a2c + { + ModbusAddCrc16(*puchMsg, &crch, &crcl); + 8004a0e: 687b ldr r3, [r7, #4] + 8004a10: 781b ldrb r3, [r3, #0] + 8004a12: f107 020e add.w r2, r7, #14 + 8004a16: f107 010f add.w r1, r7, #15 + 8004a1a: 4618 mov r0, r3 + 8004a1c: f7ff ffc6 bl 80049ac + usDataLen--; + 8004a20: 887b ldrh r3, [r7, #2] + 8004a22: 3b01 subs r3, #1 + 8004a24: 807b strh r3, [r7, #2] + puchMsg++; + 8004a26: 687b ldr r3, [r7, #4] + 8004a28: 3301 adds r3, #1 + 8004a2a: 607b str r3, [r7, #4] + while(usDataLen) /// Ϣ + 8004a2c: 887b ldrh r3, [r7, #2] + 8004a2e: 2b00 cmp r3, #0 + 8004a30: d1ed bne.n 8004a0e + } + + return((crch<<8)|crcl); + 8004a32: 7bfb ldrb r3, [r7, #15] + 8004a34: 021b lsls r3, r3, #8 + 8004a36: b21a sxth r2, r3 + 8004a38: 7bbb ldrb r3, [r7, #14] + 8004a3a: b21b sxth r3, r3 + 8004a3c: 4313 orrs r3, r2 + 8004a3e: b21b sxth r3, r3 + 8004a40: b29b uxth r3, r3 +} + 8004a42: 4618 mov r0, r3 + 8004a44: 3710 adds r7, #16 + 8004a46: 46bd mov sp, r7 + 8004a48: bd80 pop {r7, pc} + ... + +08004a4c : +stop: ֹͣλ +mode: ģʽ +*/ + +void InitModbus_m(int midx, int usart, BAUD_TypeDef baud, char dat, char parity, char stop, char mode) +{ + 8004a4c: b580 push {r7, lr} + 8004a4e: b088 sub sp, #32 + 8004a50: af04 add r7, sp, #16 + 8004a52: 60f8 str r0, [r7, #12] + 8004a54: 60b9 str r1, [r7, #8] + 8004a56: 607a str r2, [r7, #4] + 8004a58: 70fb strb r3, [r7, #3] + if (midx < 0 || midx >= MODBUS_M_NUM) + 8004a5a: 68fb ldr r3, [r7, #12] + 8004a5c: 2b00 cmp r3, #0 + 8004a5e: db02 blt.n 8004a66 + 8004a60: 68fb ldr r3, [r7, #12] + 8004a62: 2b00 cmp r3, #0 + 8004a64: dd03 ble.n 8004a6e + { + printf("init modbus_m, idx error\r\n"); + 8004a66: 48a2 ldr r0, [pc, #648] ; (8004cf0 ) + 8004a68: f004 ffc4 bl 80099f4 + return; + 8004a6c: e185 b.n 8004d7a + } + + memset(&g_modBusMCtrl[midx], 0, sizeof(ModbusCtrl)); + 8004a6e: 68fa ldr r2, [r7, #12] + 8004a70: 4613 mov r3, r2 + 8004a72: 00db lsls r3, r3, #3 + 8004a74: 4413 add r3, r2 + 8004a76: 009b lsls r3, r3, #2 + 8004a78: 4a9e ldr r2, [pc, #632] ; (8004cf4 ) + 8004a7a: 4413 add r3, r2 + 8004a7c: 2224 movs r2, #36 ; 0x24 + 8004a7e: 2100 movs r1, #0 + 8004a80: 4618 mov r0, r3 + 8004a82: f004 ff3a bl 80098fa + + if (mode == 'A' || mode == 'a') + 8004a86: f897 3020 ldrb.w r3, [r7, #32] + 8004a8a: 2b41 cmp r3, #65 ; 0x41 + 8004a8c: d003 beq.n 8004a96 + 8004a8e: f897 3020 ldrb.w r3, [r7, #32] + 8004a92: 2b61 cmp r3, #97 ; 0x61 + 8004a94: d109 bne.n 8004aaa + { + g_modBusMCtrl[midx].modBusMode = 1; + 8004a96: 4997 ldr r1, [pc, #604] ; (8004cf4 ) + 8004a98: 68fa ldr r2, [r7, #12] + 8004a9a: 4613 mov r3, r2 + 8004a9c: 00db lsls r3, r3, #3 + 8004a9e: 4413 add r3, r2 + 8004aa0: 009b lsls r3, r3, #2 + 8004aa2: 440b add r3, r1 + 8004aa4: 2201 movs r2, #1 + 8004aa6: 601a str r2, [r3, #0] + 8004aa8: e008 b.n 8004abc + } + else + { + g_modBusMCtrl[midx].modBusMode = 0; + 8004aaa: 4992 ldr r1, [pc, #584] ; (8004cf4 ) + 8004aac: 68fa ldr r2, [r7, #12] + 8004aae: 4613 mov r3, r2 + 8004ab0: 00db lsls r3, r3, #3 + 8004ab2: 4413 add r3, r2 + 8004ab4: 009b lsls r3, r3, #2 + 8004ab6: 440b add r3, r1 + 8004ab8: 2200 movs r2, #0 + 8004aba: 601a str r2, [r3, #0] + } + + // ʱ + switch(baud) + 8004abc: 687b ldr r3, [r7, #4] + 8004abe: f5b3 4f16 cmp.w r3, #38400 ; 0x9600 + 8004ac2: d057 beq.n 8004b74 + 8004ac4: f5b3 4f16 cmp.w r3, #38400 ; 0x9600 + 8004ac8: d810 bhi.n 8004aec + 8004aca: f5b3 5f16 cmp.w r3, #9600 ; 0x2580 + 8004ace: d02d beq.n 8004b2c + 8004ad0: f5b3 5f16 cmp.w r3, #9600 ; 0x2580 + 8004ad4: d803 bhi.n 8004ade + 8004ad6: f5b3 5f96 cmp.w r3, #4800 ; 0x12c0 + 8004ada: d01b beq.n 8004b14 + 8004adc: e08d b.n 8004bfa + 8004ade: f5b3 5f61 cmp.w r3, #14400 ; 0x3840 + 8004ae2: d02f beq.n 8004b44 + 8004ae4: f5b3 4f96 cmp.w r3, #19200 ; 0x4b00 + 8004ae8: d038 beq.n 8004b5c + 8004aea: e086 b.n 8004bfa + 8004aec: f5b3 3f61 cmp.w r3, #230400 ; 0x38400 + 8004af0: d062 beq.n 8004bb8 + 8004af2: f5b3 3f61 cmp.w r3, #230400 ; 0x38400 + 8004af6: d806 bhi.n 8004b06 + 8004af8: f5b3 4f61 cmp.w r3, #57600 ; 0xe100 + 8004afc: d046 beq.n 8004b8c + 8004afe: f5b3 3fe1 cmp.w r3, #115200 ; 0x1c200 + 8004b02: d04e beq.n 8004ba2 + 8004b04: e079 b.n 8004bfa + 8004b06: f5b3 2fe1 cmp.w r3, #460800 ; 0x70800 + 8004b0a: d060 beq.n 8004bce + 8004b0c: f5b3 2f61 cmp.w r3, #921600 ; 0xe1000 + 8004b10: d068 beq.n 8004be4 + 8004b12: e072 b.n 8004bfa + { + // λ + 1ʼλ + żУλ(Уû) + ֹͣλ + // ݲ ͨѶʱ, λus = 10000000 / baud(һֽ10λ, 8 N 1) + case B4800: + { + g_modBusMCtrl[midx].modBusWait = 2200; + 8004b14: 4977 ldr r1, [pc, #476] ; (8004cf4 ) + 8004b16: 68fa ldr r2, [r7, #12] + 8004b18: 4613 mov r3, r2 + 8004b1a: 00db lsls r3, r3, #3 + 8004b1c: 4413 add r3, r2 + 8004b1e: 009b lsls r3, r3, #2 + 8004b20: 440b add r3, r1 + 8004b22: 3308 adds r3, #8 + 8004b24: f640 0298 movw r2, #2200 ; 0x898 + 8004b28: 601a str r2, [r3, #0] + break; + 8004b2a: e070 b.n 8004c0e + } + case B9600: + { + g_modBusMCtrl[midx].modBusWait = 1100; + 8004b2c: 4971 ldr r1, [pc, #452] ; (8004cf4 ) + 8004b2e: 68fa ldr r2, [r7, #12] + 8004b30: 4613 mov r3, r2 + 8004b32: 00db lsls r3, r3, #3 + 8004b34: 4413 add r3, r2 + 8004b36: 009b lsls r3, r3, #2 + 8004b38: 440b add r3, r1 + 8004b3a: 3308 adds r3, #8 + 8004b3c: f240 424c movw r2, #1100 ; 0x44c + 8004b40: 601a str r2, [r3, #0] + break; + 8004b42: e064 b.n 8004c0e + } + case B14400: + { + g_modBusMCtrl[midx].modBusWait = 750; + 8004b44: 496b ldr r1, [pc, #428] ; (8004cf4 ) + 8004b46: 68fa ldr r2, [r7, #12] + 8004b48: 4613 mov r3, r2 + 8004b4a: 00db lsls r3, r3, #3 + 8004b4c: 4413 add r3, r2 + 8004b4e: 009b lsls r3, r3, #2 + 8004b50: 440b add r3, r1 + 8004b52: 3308 adds r3, #8 + 8004b54: f240 22ee movw r2, #750 ; 0x2ee + 8004b58: 601a str r2, [r3, #0] + break; + 8004b5a: e058 b.n 8004c0e + } + case B19200: + { + g_modBusMCtrl[midx].modBusWait = 600; + 8004b5c: 4965 ldr r1, [pc, #404] ; (8004cf4 ) + 8004b5e: 68fa ldr r2, [r7, #12] + 8004b60: 4613 mov r3, r2 + 8004b62: 00db lsls r3, r3, #3 + 8004b64: 4413 add r3, r2 + 8004b66: 009b lsls r3, r3, #2 + 8004b68: 440b add r3, r1 + 8004b6a: 3308 adds r3, #8 + 8004b6c: f44f 7216 mov.w r2, #600 ; 0x258 + 8004b70: 601a str r2, [r3, #0] + break; + 8004b72: e04c b.n 8004c0e + } + case B38400: + { + g_modBusMCtrl[midx].modBusWait = 300; + 8004b74: 495f ldr r1, [pc, #380] ; (8004cf4 ) + 8004b76: 68fa ldr r2, [r7, #12] + 8004b78: 4613 mov r3, r2 + 8004b7a: 00db lsls r3, r3, #3 + 8004b7c: 4413 add r3, r2 + 8004b7e: 009b lsls r3, r3, #2 + 8004b80: 440b add r3, r1 + 8004b82: 3308 adds r3, #8 + 8004b84: f44f 7296 mov.w r2, #300 ; 0x12c + 8004b88: 601a str r2, [r3, #0] + break; + 8004b8a: e040 b.n 8004c0e + } + case B57600: + { + g_modBusMCtrl[midx].modBusWait = 200; + 8004b8c: 4959 ldr r1, [pc, #356] ; (8004cf4 ) + 8004b8e: 68fa ldr r2, [r7, #12] + 8004b90: 4613 mov r3, r2 + 8004b92: 00db lsls r3, r3, #3 + 8004b94: 4413 add r3, r2 + 8004b96: 009b lsls r3, r3, #2 + 8004b98: 440b add r3, r1 + 8004b9a: 3308 adds r3, #8 + 8004b9c: 22c8 movs r2, #200 ; 0xc8 + 8004b9e: 601a str r2, [r3, #0] + break; + 8004ba0: e035 b.n 8004c0e + } + case B115200: + { + g_modBusMCtrl[midx].modBusWait = 100; + 8004ba2: 4954 ldr r1, [pc, #336] ; (8004cf4 ) + 8004ba4: 68fa ldr r2, [r7, #12] + 8004ba6: 4613 mov r3, r2 + 8004ba8: 00db lsls r3, r3, #3 + 8004baa: 4413 add r3, r2 + 8004bac: 009b lsls r3, r3, #2 + 8004bae: 440b add r3, r1 + 8004bb0: 3308 adds r3, #8 + 8004bb2: 2264 movs r2, #100 ; 0x64 + 8004bb4: 601a str r2, [r3, #0] + break; + 8004bb6: e02a b.n 8004c0e + } + case B230400: + { + g_modBusMCtrl[midx].modBusWait = 50; + 8004bb8: 494e ldr r1, [pc, #312] ; (8004cf4 ) + 8004bba: 68fa ldr r2, [r7, #12] + 8004bbc: 4613 mov r3, r2 + 8004bbe: 00db lsls r3, r3, #3 + 8004bc0: 4413 add r3, r2 + 8004bc2: 009b lsls r3, r3, #2 + 8004bc4: 440b add r3, r1 + 8004bc6: 3308 adds r3, #8 + 8004bc8: 2232 movs r2, #50 ; 0x32 + 8004bca: 601a str r2, [r3, #0] + break; + 8004bcc: e01f b.n 8004c0e + } + case B460800: + { + g_modBusMCtrl[midx].modBusWait = 25; + 8004bce: 4949 ldr r1, [pc, #292] ; (8004cf4 ) + 8004bd0: 68fa ldr r2, [r7, #12] + 8004bd2: 4613 mov r3, r2 + 8004bd4: 00db lsls r3, r3, #3 + 8004bd6: 4413 add r3, r2 + 8004bd8: 009b lsls r3, r3, #2 + 8004bda: 440b add r3, r1 + 8004bdc: 3308 adds r3, #8 + 8004bde: 2219 movs r2, #25 + 8004be0: 601a str r2, [r3, #0] + break; + 8004be2: e014 b.n 8004c0e + } + case B921600: + { + g_modBusMCtrl[midx].modBusWait = 13; + 8004be4: 4943 ldr r1, [pc, #268] ; (8004cf4 ) + 8004be6: 68fa ldr r2, [r7, #12] + 8004be8: 4613 mov r3, r2 + 8004bea: 00db lsls r3, r3, #3 + 8004bec: 4413 add r3, r2 + 8004bee: 009b lsls r3, r3, #2 + 8004bf0: 440b add r3, r1 + 8004bf2: 3308 adds r3, #8 + 8004bf4: 220d movs r2, #13 + 8004bf6: 601a str r2, [r3, #0] + break; + 8004bf8: e009 b.n 8004c0e + } + default: + { + g_modBusMCtrl[midx].modBusWait = 0; + 8004bfa: 493e ldr r1, [pc, #248] ; (8004cf4 ) + 8004bfc: 68fa ldr r2, [r7, #12] + 8004bfe: 4613 mov r3, r2 + 8004c00: 00db lsls r3, r3, #3 + 8004c02: 4413 add r3, r2 + 8004c04: 009b lsls r3, r3, #2 + 8004c06: 440b add r3, r1 + 8004c08: 3308 adds r3, #8 + 8004c0a: 2200 movs r2, #0 + 8004c0c: 601a str r2, [r3, #0] + } + } + if ((dat == '8') && (parity != 'N') && (parity != 'n')) // 7λݹУλ + 8004c0e: 78fb ldrb r3, [r7, #3] + 8004c10: 2b38 cmp r3, #56 ; 0x38 + 8004c12: d110 bne.n 8004c36 + 8004c14: 7e3b ldrb r3, [r7, #24] + 8004c16: 2b4e cmp r3, #78 ; 0x4e + 8004c18: d00d beq.n 8004c36 + 8004c1a: 7e3b ldrb r3, [r7, #24] + 8004c1c: 2b6e cmp r3, #110 ; 0x6e + 8004c1e: d00a beq.n 8004c36 + { + g_modBusMCtrl[midx].filterChk = 1; + 8004c20: 4934 ldr r1, [pc, #208] ; (8004cf4 ) + 8004c22: 68fa ldr r2, [r7, #12] + 8004c24: 4613 mov r3, r2 + 8004c26: 00db lsls r3, r3, #3 + 8004c28: 4413 add r3, r2 + 8004c2a: 009b lsls r3, r3, #2 + 8004c2c: 440b add r3, r1 + 8004c2e: 3304 adds r3, #4 + 8004c30: 2201 movs r2, #1 + 8004c32: 601a str r2, [r3, #0] + 8004c34: e009 b.n 8004c4a + } + else + { + g_modBusMCtrl[midx].filterChk = 0; + 8004c36: 492f ldr r1, [pc, #188] ; (8004cf4 ) + 8004c38: 68fa ldr r2, [r7, #12] + 8004c3a: 4613 mov r3, r2 + 8004c3c: 00db lsls r3, r3, #3 + 8004c3e: 4413 add r3, r2 + 8004c40: 009b lsls r3, r3, #2 + 8004c42: 440b add r3, r1 + 8004c44: 3304 adds r3, #4 + 8004c46: 2200 movs r2, #0 + 8004c48: 601a str r2, [r3, #0] +#ifndef USART6_485OutDis +#define USART6_485OutDis DefOutDis +#endif + + // ʼ + switch(usart) + 8004c4a: 68bb ldr r3, [r7, #8] + 8004c4c: 2b02 cmp r3, #2 + 8004c4e: d01c beq.n 8004c8a + 8004c50: 2b03 cmp r3, #3 + 8004c52: d033 beq.n 8004cbc + 8004c54: 2b01 cmp r3, #1 + 8004c56: d173 bne.n 8004d40 + { +#ifdef COMM_USART1 + case COMM_USART1: + { + InitUsart1(baud, dat, parity, stop); // 1 + 8004c58: 7f3b ldrb r3, [r7, #28] + 8004c5a: 7e3a ldrb r2, [r7, #24] + 8004c5c: 78f9 ldrb r1, [r7, #3] + 8004c5e: 6878 ldr r0, [r7, #4] + 8004c60: f7fe fdc6 bl 80037f0 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart1SendData, Usart1GetData, Usart1CleanRsBuf, IsUsart1SendOver, USART1_485OutEn, USART1_485OutDis); + 8004c64: 68fa ldr r2, [r7, #12] + 8004c66: 4613 mov r3, r2 + 8004c68: 00db lsls r3, r3, #3 + 8004c6a: 4413 add r3, r2 + 8004c6c: 009b lsls r3, r3, #2 + 8004c6e: 4a21 ldr r2, [pc, #132] ; (8004cf4 ) + 8004c70: 1898 adds r0, r3, r2 + 8004c72: 4b21 ldr r3, [pc, #132] ; (8004cf8 ) + 8004c74: 9302 str r3, [sp, #8] + 8004c76: 4b21 ldr r3, [pc, #132] ; (8004cfc ) + 8004c78: 9301 str r3, [sp, #4] + 8004c7a: 4b21 ldr r3, [pc, #132] ; (8004d00 ) + 8004c7c: 9300 str r3, [sp, #0] + 8004c7e: 4b21 ldr r3, [pc, #132] ; (8004d04 ) + 8004c80: 4a21 ldr r2, [pc, #132] ; (8004d08 ) + 8004c82: 4922 ldr r1, [pc, #136] ; (8004d0c ) + 8004c84: f7ff fe02 bl 800488c + break; + 8004c88: e06d b.n 8004d66 + } +#endif +#ifdef COMM_USART2 + case COMM_USART2: + { + InitUsart2(baud, dat, parity, stop); // 2 + 8004c8a: 7f3b ldrb r3, [r7, #28] + 8004c8c: 7e3a ldrb r2, [r7, #24] + 8004c8e: 78f9 ldrb r1, [r7, #3] + 8004c90: 6878 ldr r0, [r7, #4] + 8004c92: f7ff f801 bl 8003c98 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart2SendData, Usart2GetData, Usart2CleanRsBuf, IsUsart2SendOver, USART2_485OutEn, USART2_485OutDis); + 8004c96: 68fa ldr r2, [r7, #12] + 8004c98: 4613 mov r3, r2 + 8004c9a: 00db lsls r3, r3, #3 + 8004c9c: 4413 add r3, r2 + 8004c9e: 009b lsls r3, r3, #2 + 8004ca0: 4a14 ldr r2, [pc, #80] ; (8004cf4 ) + 8004ca2: 1898 adds r0, r3, r2 + 8004ca4: 4b1a ldr r3, [pc, #104] ; (8004d10 ) + 8004ca6: 9302 str r3, [sp, #8] + 8004ca8: 4b1a ldr r3, [pc, #104] ; (8004d14 ) + 8004caa: 9301 str r3, [sp, #4] + 8004cac: 4b1a ldr r3, [pc, #104] ; (8004d18 ) + 8004cae: 9300 str r3, [sp, #0] + 8004cb0: 4b1a ldr r3, [pc, #104] ; (8004d1c ) + 8004cb2: 4a1b ldr r2, [pc, #108] ; (8004d20 ) + 8004cb4: 491b ldr r1, [pc, #108] ; (8004d24 ) + 8004cb6: f7ff fde9 bl 800488c + break; + 8004cba: e054 b.n 8004d66 + } +#endif +#ifdef COMM_USART3 + case COMM_USART3: + { + InitUsart3(baud, dat, parity, stop); // 3 + 8004cbc: 7f3b ldrb r3, [r7, #28] + 8004cbe: 7e3a ldrb r2, [r7, #24] + 8004cc0: 78f9 ldrb r1, [r7, #3] + 8004cc2: 6878 ldr r0, [r7, #4] + 8004cc4: f7ff f9de bl 8004084 + RegisterModbusCommFunc(&g_modBusMCtrl[midx], Usart3SendData, Usart3GetData, Usart3CleanRsBuf, IsUsart3SendOver, USART3_485OutEn, USART3_485OutDis); + 8004cc8: 68fa ldr r2, [r7, #12] + 8004cca: 4613 mov r3, r2 + 8004ccc: 00db lsls r3, r3, #3 + 8004cce: 4413 add r3, r2 + 8004cd0: 009b lsls r3, r3, #2 + 8004cd2: 4a08 ldr r2, [pc, #32] ; (8004cf4 ) + 8004cd4: 1898 adds r0, r3, r2 + 8004cd6: 4b14 ldr r3, [pc, #80] ; (8004d28 ) + 8004cd8: 9302 str r3, [sp, #8] + 8004cda: 4b14 ldr r3, [pc, #80] ; (8004d2c ) + 8004cdc: 9301 str r3, [sp, #4] + 8004cde: 4b14 ldr r3, [pc, #80] ; (8004d30 ) + 8004ce0: 9300 str r3, [sp, #0] + 8004ce2: 4b14 ldr r3, [pc, #80] ; (8004d34 ) + 8004ce4: 4a14 ldr r2, [pc, #80] ; (8004d38 ) + 8004ce6: 4915 ldr r1, [pc, #84] ; (8004d3c ) + 8004ce8: f7ff fdd0 bl 800488c + break; + 8004cec: e03b b.n 8004d66 + 8004cee: bf00 nop + 8004cf0: 0800ac28 .word 0x0800ac28 + 8004cf4: 20001354 .word 0x20001354 + 8004cf8: 0800491d .word 0x0800491d + 8004cfc: 08004911 .word 0x08004911 + 8004d00: 08003a8d .word 0x08003a8d + 8004d04: 08003a5d .word 0x08003a5d + 8004d08: 08003999 .word 0x08003999 + 8004d0c: 080038ad .word 0x080038ad + 8004d10: 0800901d .word 0x0800901d + 8004d14: 08009035 .word 0x08009035 + 8004d18: 08003f35 .word 0x08003f35 + 8004d1c: 08003f05 .word 0x08003f05 + 8004d20: 08003e41 .word 0x08003e41 + 8004d24: 08003d55 .word 0x08003d55 + 8004d28: 0800904d .word 0x0800904d + 8004d2c: 08009065 .word 0x08009065 + 8004d30: 08004321 .word 0x08004321 + 8004d34: 080042f1 .word 0x080042f1 + 8004d38: 0800422d .word 0x0800422d + 8004d3c: 08004141 .word 0x08004141 + break; + } +#endif + default: + { + RegisterModbusCommFunc(&g_modBusMCtrl[midx], DefSendData, DefGetData, DefCleanRsBuf, DefIsSendOver, DefOutEn, DefOutDis); + 8004d40: 68fa ldr r2, [r7, #12] + 8004d42: 4613 mov r3, r2 + 8004d44: 00db lsls r3, r3, #3 + 8004d46: 4413 add r3, r2 + 8004d48: 009b lsls r3, r3, #2 + 8004d4a: 4a0d ldr r2, [pc, #52] ; (8004d80 ) + 8004d4c: 1898 adds r0, r3, r2 + 8004d4e: 4b0d ldr r3, [pc, #52] ; (8004d84 ) + 8004d50: 9302 str r3, [sp, #8] + 8004d52: 4b0d ldr r3, [pc, #52] ; (8004d88 ) + 8004d54: 9301 str r3, [sp, #4] + 8004d56: 4b0d ldr r3, [pc, #52] ; (8004d8c ) + 8004d58: 9300 str r3, [sp, #0] + 8004d5a: 4b0d ldr r3, [pc, #52] ; (8004d90 ) + 8004d5c: 4a0d ldr r2, [pc, #52] ; (8004d94 ) + 8004d5e: 490e ldr r1, [pc, #56] ; (8004d98 ) + 8004d60: f7ff fd94 bl 800488c + break; + 8004d64: bf00 nop + } + + } + + g_modBusMCtrl[midx].CommOutDis(); // رշ + 8004d66: 4906 ldr r1, [pc, #24] ; (8004d80 ) + 8004d68: 68fa ldr r2, [r7, #12] + 8004d6a: 4613 mov r3, r2 + 8004d6c: 00db lsls r3, r3, #3 + 8004d6e: 4413 add r3, r2 + 8004d70: 009b lsls r3, r3, #2 + 8004d72: 440b add r3, r1 + 8004d74: 3320 adds r3, #32 + 8004d76: 681b ldr r3, [r3, #0] + 8004d78: 4798 blx r3 +} + 8004d7a: 3710 adds r7, #16 + 8004d7c: 46bd mov sp, r7 + 8004d7e: bd80 pop {r7, pc} + 8004d80: 20001354 .word 0x20001354 + 8004d84: 0800491d .word 0x0800491d + 8004d88: 08004911 .word 0x08004911 + 8004d8c: 08004903 .word 0x08004903 + 8004d90: 080048f5 .word 0x080048f5 + 8004d94: 080048df .word 0x080048df + 8004d98: 080048c9 .word 0x080048c9 + +08004d9c : + * 2:ݷ + * 3:ȴ + * 4:رշ + */ +int ModbusTx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps) +{ + 8004d9c: b590 push {r4, r7, lr} + 8004d9e: b0c1 sub sp, #260 ; 0x104 + 8004da0: af00 add r7, sp, #0 + 8004da2: 6078 str r0, [r7, #4] + 8004da4: 4608 mov r0, r1 + 8004da6: 4611 mov r1, r2 + 8004da8: 461a mov r2, r3 + 8004daa: 4603 mov r3, r0 + 8004dac: 70fb strb r3, [r7, #3] + 8004dae: 460b mov r3, r1 + 8004db0: 70bb strb r3, [r7, #2] + 8004db2: 463b mov r3, r7 + 8004db4: 801a strh r2, [r3, #0] + u8 checksum, temp; // У(ASCII) + u16 checkcrc; // CRC У(RTU) + u16 data; + u8 pSDat[MDBSRXLEN_MAX]; // + + if ((cmd != MODBUS_RD) && (cmd != MODBUS_WR) && (cmd != MODBUS_WR_MULTI)) + 8004db6: 78bb ldrb r3, [r7, #2] + 8004db8: 2b03 cmp r3, #3 + 8004dba: d00d beq.n 8004dd8 + 8004dbc: 78bb ldrb r3, [r7, #2] + 8004dbe: 2b06 cmp r3, #6 + 8004dc0: d00a beq.n 8004dd8 + 8004dc2: 78bb ldrb r3, [r7, #2] + 8004dc4: 2b10 cmp r3, #16 + 8004dc6: d007 beq.n 8004dd8 + { + result = -1; + 8004dc8: f04f 33ff mov.w r3, #4294967295 + 8004dcc: f8c7 30f0 str.w r3, [r7, #240] ; 0xf0 + return result; + 8004dd0: f8d7 30f0 ldr.w r3, [r7, #240] ; 0xf0 + 8004dd4: f000 bc05 b.w 80055e2 + } + + if (pData == NULL || len == 0) + 8004dd8: f8d7 3110 ldr.w r3, [r7, #272] ; 0x110 + 8004ddc: 2b00 cmp r3, #0 + 8004dde: d003 beq.n 8004de8 + 8004de0: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8004de4: 2b00 cmp r3, #0 + 8004de6: d106 bne.n 8004df6 + { + result = -1; + 8004de8: f04f 33ff mov.w r3, #4294967295 + 8004dec: f8c7 30f0 str.w r3, [r7, #240] ; 0xf0 + return result; + 8004df0: f8d7 30f0 ldr.w r3, [r7, #240] ; 0xf0 + 8004df4: e3f5 b.n 80055e2 + } + + if (midx < 0 || midx >= MODBUS_M_NUM) + 8004df6: 687b ldr r3, [r7, #4] + 8004df8: 2b00 cmp r3, #0 + 8004dfa: db02 blt.n 8004e02 + 8004dfc: 687b ldr r3, [r7, #4] + 8004dfe: 2b00 cmp r3, #0 + 8004e00: dd06 ble.n 8004e10 + { + result = -1; + 8004e02: f04f 33ff mov.w r3, #4294967295 + 8004e06: f8c7 30f0 str.w r3, [r7, #240] ; 0xf0 + return result; + 8004e0a: f8d7 30f0 ldr.w r3, [r7, #240] ; 0xf0 + 8004e0e: e3e8 b.n 80055e2 + } + + if (steps == 1 || steps == -1) + 8004e10: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8004e14: 2b01 cmp r3, #1 + 8004e16: d004 beq.n 8004e22 + 8004e18: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8004e1c: f1b3 3fff cmp.w r3, #4294967295 + 8004e20: d111 bne.n 8004e46 + { + g_modBusMCtrl[midx].CommOutEn(); // 򿪷 + 8004e22: 49e6 ldr r1, [pc, #920] ; (80051bc ) + 8004e24: 687a ldr r2, [r7, #4] + 8004e26: 4613 mov r3, r2 + 8004e28: 00db lsls r3, r3, #3 + 8004e2a: 4413 add r3, r2 + 8004e2c: 009b lsls r3, r3, #2 + 8004e2e: 440b add r3, r1 + 8004e30: 331c adds r3, #28 + 8004e32: 681b ldr r3, [r3, #0] + 8004e34: 4798 blx r3 + + if (steps == -1) + 8004e36: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8004e3a: f1b3 3fff cmp.w r3, #4294967295 + 8004e3e: d102 bne.n 8004e46 + { + DelayUs(100); + 8004e40: 2064 movs r0, #100 ; 0x64 + 8004e42: f7fe fbe9 bl 8003618 + } + } + + if (steps == 2 || steps == -1) + 8004e46: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8004e4a: 2b02 cmp r3, #2 + 8004e4c: d005 beq.n 8004e5a + 8004e4e: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8004e52: f1b3 3fff cmp.w r3, #4294967295 + 8004e56: f040 834a bne.w 80054ee + { + i = 0; + 8004e5a: 2300 movs r3, #0 + 8004e5c: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + result = 0; + 8004e60: 2300 movs r3, #0 + 8004e62: f8c7 30f0 str.w r3, [r7, #240] ; 0xf0 + + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + 8004e66: 49d5 ldr r1, [pc, #852] ; (80051bc ) + 8004e68: 687a ldr r2, [r7, #4] + 8004e6a: 4613 mov r3, r2 + 8004e6c: 00db lsls r3, r3, #3 + 8004e6e: 4413 add r3, r2 + 8004e70: 009b lsls r3, r3, #2 + 8004e72: 440b add r3, r1 + 8004e74: 681b ldr r3, [r3, #0] + 8004e76: 2b00 cmp r3, #0 + 8004e78: f000 826e beq.w 8005358 + { + checksum = 0; + 8004e7c: 2300 movs r3, #0 + 8004e7e: f887 30ef strb.w r3, [r7, #239] ; 0xef + pSDat[i++] = ':'; //':' + 8004e82: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8004e86: 1c5a adds r2, r3, #1 + 8004e88: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8004e8c: f507 7280 add.w r2, r7, #256 ; 0x100 + 8004e90: 4413 add r3, r2 + 8004e92: 223a movs r2, #58 ; 0x3a + 8004e94: f803 2cf4 strb.w r2, [r3, #-244] + + temp = HIHFBYTE(index); + 8004e98: 78fb ldrb r3, [r7, #3] + 8004e9a: 091b lsrs r3, r3, #4 + 8004e9c: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // IDX_H + 8004ea0: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004ea4: 1c63 adds r3, r4, #1 + 8004ea6: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004eaa: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004eae: 4618 mov r0, r3 + 8004eb0: f7ff fd63 bl 800497a + 8004eb4: 4603 mov r3, r0 + 8004eb6: 461a mov r2, r3 + 8004eb8: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004ebc: 4423 add r3, r4 + 8004ebe: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(index); + 8004ec2: 78fb ldrb r3, [r7, #3] + 8004ec4: f003 030f and.w r3, r3, #15 + 8004ec8: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // IDX_L + 8004ecc: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004ed0: 1c63 adds r3, r4, #1 + 8004ed2: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004ed6: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004eda: 4618 mov r0, r3 + 8004edc: f7ff fd4d bl 800497a + 8004ee0: 4603 mov r3, r0 + 8004ee2: 461a mov r2, r3 + 8004ee4: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004ee8: 4423 add r3, r4 + 8004eea: f803 2cf4 strb.w r2, [r3, #-244] + checksum += index; + 8004eee: f897 20ef ldrb.w r2, [r7, #239] ; 0xef + 8004ef2: 78fb ldrb r3, [r7, #3] + 8004ef4: 4413 add r3, r2 + 8004ef6: f887 30ef strb.w r3, [r7, #239] ; 0xef + + temp = HIHFBYTE(cmd); + 8004efa: 78bb ldrb r3, [r7, #2] + 8004efc: 091b lsrs r3, r3, #4 + 8004efe: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // CMD_H + 8004f02: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004f06: 1c63 adds r3, r4, #1 + 8004f08: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004f0c: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004f10: 4618 mov r0, r3 + 8004f12: f7ff fd32 bl 800497a + 8004f16: 4603 mov r3, r0 + 8004f18: 461a mov r2, r3 + 8004f1a: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004f1e: 4423 add r3, r4 + 8004f20: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(cmd); + 8004f24: 78bb ldrb r3, [r7, #2] + 8004f26: f003 030f and.w r3, r3, #15 + 8004f2a: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // CMD_L + 8004f2e: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004f32: 1c63 adds r3, r4, #1 + 8004f34: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004f38: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004f3c: 4618 mov r0, r3 + 8004f3e: f7ff fd1c bl 800497a + 8004f42: 4603 mov r3, r0 + 8004f44: 461a mov r2, r3 + 8004f46: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004f4a: 4423 add r3, r4 + 8004f4c: f803 2cf4 strb.w r2, [r3, #-244] + checksum += cmd; + 8004f50: f897 20ef ldrb.w r2, [r7, #239] ; 0xef + 8004f54: 78bb ldrb r3, [r7, #2] + 8004f56: 4413 add r3, r2 + 8004f58: f887 30ef strb.w r3, [r7, #239] ; 0xef + + temp = HIHFBYTE(HIBYTE(addr)); + 8004f5c: 463b mov r3, r7 + 8004f5e: 881b ldrh r3, [r3, #0] + 8004f60: 0a1b lsrs r3, r3, #8 + 8004f62: b29b uxth r3, r3 + 8004f64: b2db uxtb r3, r3 + 8004f66: 091b lsrs r3, r3, #4 + 8004f68: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // ADDR_HH + 8004f6c: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004f70: 1c63 adds r3, r4, #1 + 8004f72: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004f76: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004f7a: 4618 mov r0, r3 + 8004f7c: f7ff fcfd bl 800497a + 8004f80: 4603 mov r3, r0 + 8004f82: 461a mov r2, r3 + 8004f84: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004f88: 4423 add r3, r4 + 8004f8a: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(HIBYTE(addr)); + 8004f8e: 463b mov r3, r7 + 8004f90: 881b ldrh r3, [r3, #0] + 8004f92: 0a1b lsrs r3, r3, #8 + 8004f94: b29b uxth r3, r3 + 8004f96: b2db uxtb r3, r3 + 8004f98: f003 030f and.w r3, r3, #15 + 8004f9c: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // ADDR_HL + 8004fa0: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004fa4: 1c63 adds r3, r4, #1 + 8004fa6: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004faa: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004fae: 4618 mov r0, r3 + 8004fb0: f7ff fce3 bl 800497a + 8004fb4: 4603 mov r3, r0 + 8004fb6: 461a mov r2, r3 + 8004fb8: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004fbc: 4423 add r3, r4 + 8004fbe: f803 2cf4 strb.w r2, [r3, #-244] + checksum += HIBYTE(addr); + 8004fc2: 463b mov r3, r7 + 8004fc4: 881b ldrh r3, [r3, #0] + 8004fc6: 0a1b lsrs r3, r3, #8 + 8004fc8: b29b uxth r3, r3 + 8004fca: b2da uxtb r2, r3 + 8004fcc: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8004fd0: 4413 add r3, r2 + 8004fd2: f887 30ef strb.w r3, [r7, #239] ; 0xef + + temp = HIHFBYTE(LOBYTE(addr)); + 8004fd6: 463b mov r3, r7 + 8004fd8: 881b ldrh r3, [r3, #0] + 8004fda: b2db uxtb r3, r3 + 8004fdc: 091b lsrs r3, r3, #4 + 8004fde: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // ADDR_LH + 8004fe2: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8004fe6: 1c63 adds r3, r4, #1 + 8004fe8: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8004fec: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8004ff0: 4618 mov r0, r3 + 8004ff2: f7ff fcc2 bl 800497a + 8004ff6: 4603 mov r3, r0 + 8004ff8: 461a mov r2, r3 + 8004ffa: f507 7380 add.w r3, r7, #256 ; 0x100 + 8004ffe: 4423 add r3, r4 + 8005000: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(LOBYTE(addr)); + 8005004: 463b mov r3, r7 + 8005006: 881b ldrh r3, [r3, #0] + 8005008: b2db uxtb r3, r3 + 800500a: f003 030f and.w r3, r3, #15 + 800500e: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // ADDR_LL + 8005012: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005016: 1c63 adds r3, r4, #1 + 8005018: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 800501c: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005020: 4618 mov r0, r3 + 8005022: f7ff fcaa bl 800497a + 8005026: 4603 mov r3, r0 + 8005028: 461a mov r2, r3 + 800502a: f507 7380 add.w r3, r7, #256 ; 0x100 + 800502e: 4423 add r3, r4 + 8005030: f803 2cf4 strb.w r2, [r3, #-244] + checksum += LOBYTE(addr); + 8005034: 463b mov r3, r7 + 8005036: 881b ldrh r3, [r3, #0] + 8005038: b2da uxtb r2, r3 + 800503a: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 800503e: 4413 add r3, r2 + 8005040: f887 30ef strb.w r3, [r7, #239] ; 0xef + + if (cmd == MODBUS_WR_MULTI) + 8005044: 78bb ldrb r3, [r7, #2] + 8005046: 2b10 cmp r3, #16 + 8005048: f040 80b3 bne.w 80051b2 + {// + // ݸ,λ + temp = HIHFBYTE(HIBYTE(len)); + 800504c: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8005050: 0a1b lsrs r3, r3, #8 + 8005052: b29b uxth r3, r3 + 8005054: b2db uxtb r3, r3 + 8005056: 091b lsrs r3, r3, #4 + 8005058: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_HH + 800505c: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005060: 1c63 adds r3, r4, #1 + 8005062: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005066: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 800506a: 4618 mov r0, r3 + 800506c: f7ff fc85 bl 800497a + 8005070: 4603 mov r3, r0 + 8005072: 461a mov r2, r3 + 8005074: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005078: 4423 add r3, r4 + 800507a: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(HIBYTE(len)); + 800507e: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8005082: 0a1b lsrs r3, r3, #8 + 8005084: b29b uxth r3, r3 + 8005086: b2db uxtb r3, r3 + 8005088: f003 030f and.w r3, r3, #15 + 800508c: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_HL + 8005090: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005094: 1c63 adds r3, r4, #1 + 8005096: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 800509a: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 800509e: 4618 mov r0, r3 + 80050a0: f7ff fc6b bl 800497a + 80050a4: 4603 mov r3, r0 + 80050a6: 461a mov r2, r3 + 80050a8: f507 7380 add.w r3, r7, #256 ; 0x100 + 80050ac: 4423 add r3, r4 + 80050ae: f803 2cf4 strb.w r2, [r3, #-244] + checksum += HIBYTE(len); + 80050b2: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80050b6: 0a1b lsrs r3, r3, #8 + 80050b8: b29b uxth r3, r3 + 80050ba: b2da uxtb r2, r3 + 80050bc: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80050c0: 4413 add r3, r2 + 80050c2: f887 30ef strb.w r3, [r7, #239] ; 0xef + + temp = HIHFBYTE(LOBYTE(len)); + 80050c6: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80050ca: b2db uxtb r3, r3 + 80050cc: 091b lsrs r3, r3, #4 + 80050ce: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_LH + 80050d2: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 80050d6: 1c63 adds r3, r4, #1 + 80050d8: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 80050dc: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 80050e0: 4618 mov r0, r3 + 80050e2: f7ff fc4a bl 800497a + 80050e6: 4603 mov r3, r0 + 80050e8: 461a mov r2, r3 + 80050ea: f507 7380 add.w r3, r7, #256 ; 0x100 + 80050ee: 4423 add r3, r4 + 80050f0: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(LOBYTE(len)); + 80050f4: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80050f8: b2db uxtb r3, r3 + 80050fa: f003 030f and.w r3, r3, #15 + 80050fe: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_LL + 8005102: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005106: 1c63 adds r3, r4, #1 + 8005108: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 800510c: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005110: 4618 mov r0, r3 + 8005112: f7ff fc32 bl 800497a + 8005116: 4603 mov r3, r0 + 8005118: 461a mov r2, r3 + 800511a: f507 7380 add.w r3, r7, #256 ; 0x100 + 800511e: 4423 add r3, r4 + 8005120: f803 2cf4 strb.w r2, [r3, #-244] + checksum += LOBYTE(len); + 8005124: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8005128: b2da uxtb r2, r3 + 800512a: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 800512e: 4413 add r3, r2 + 8005130: f887 30ef strb.w r3, [r7, #239] ; 0xef + + // ֽ + temp = HIHFBYTE(LOBYTE(len)<<1); + 8005134: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8005138: b2db uxtb r3, r3 + 800513a: 005b lsls r3, r3, #1 + 800513c: 111b asrs r3, r3, #4 + 800513e: b2db uxtb r3, r3 + 8005140: f003 030f and.w r3, r3, #15 + 8005144: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_H + 8005148: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 800514c: 1c63 adds r3, r4, #1 + 800514e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005152: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005156: 4618 mov r0, r3 + 8005158: f7ff fc0f bl 800497a + 800515c: 4603 mov r3, r0 + 800515e: 461a mov r2, r3 + 8005160: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005164: 4423 add r3, r4 + 8005166: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(LOBYTE(len)<<1); + 800516a: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 800516e: b2db uxtb r3, r3 + 8005170: 005b lsls r3, r3, #1 + 8005172: b2db uxtb r3, r3 + 8005174: f003 030f and.w r3, r3, #15 + 8005178: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // LEN_L + 800517c: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005180: 1c63 adds r3, r4, #1 + 8005182: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005186: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 800518a: 4618 mov r0, r3 + 800518c: f7ff fbf5 bl 800497a + 8005190: 4603 mov r3, r0 + 8005192: 461a mov r2, r3 + 8005194: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005198: 4423 add r3, r4 + 800519a: f803 2cf4 strb.w r2, [r3, #-244] + checksum += LOBYTE(len<<1); + 800519e: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80051a2: 005b lsls r3, r3, #1 + 80051a4: b29b uxth r3, r3 + 80051a6: b2da uxtb r2, r3 + 80051a8: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80051ac: 4413 add r3, r2 + 80051ae: f887 30ef strb.w r3, [r7, #239] ; 0xef + } + + for (j = 0; j < len; j++) + 80051b2: 2300 movs r3, #0 + 80051b4: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80051b8: e084 b.n 80052c4 + 80051ba: bf00 nop + 80051bc: 20001354 .word 0x20001354 + { + data = pData[j]; + 80051c0: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 80051c4: 005b lsls r3, r3, #1 + 80051c6: f8d7 2110 ldr.w r2, [r7, #272] ; 0x110 + 80051ca: 4413 add r3, r2 + 80051cc: 881b ldrh r3, [r3, #0] + 80051ce: f8a7 30ea strh.w r3, [r7, #234] ; 0xea + temp = HIHFBYTE(HIBYTE(data)); + 80051d2: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 80051d6: 0a1b lsrs r3, r3, #8 + 80051d8: b29b uxth r3, r3 + 80051da: b2db uxtb r3, r3 + 80051dc: 091b lsrs r3, r3, #4 + 80051de: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // DATA_HH + 80051e2: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 80051e6: 1c63 adds r3, r4, #1 + 80051e8: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 80051ec: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 80051f0: 4618 mov r0, r3 + 80051f2: f7ff fbc2 bl 800497a + 80051f6: 4603 mov r3, r0 + 80051f8: 461a mov r2, r3 + 80051fa: f507 7380 add.w r3, r7, #256 ; 0x100 + 80051fe: 4423 add r3, r4 + 8005200: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(HIBYTE(data)); + 8005204: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 8005208: 0a1b lsrs r3, r3, #8 + 800520a: b29b uxth r3, r3 + 800520c: b2db uxtb r3, r3 + 800520e: f003 030f and.w r3, r3, #15 + 8005212: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // DATA_HL + 8005216: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 800521a: 1c63 adds r3, r4, #1 + 800521c: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005220: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005224: 4618 mov r0, r3 + 8005226: f7ff fba8 bl 800497a + 800522a: 4603 mov r3, r0 + 800522c: 461a mov r2, r3 + 800522e: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005232: 4423 add r3, r4 + 8005234: f803 2cf4 strb.w r2, [r3, #-244] + checksum += HIBYTE(data); + 8005238: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 800523c: 0a1b lsrs r3, r3, #8 + 800523e: b29b uxth r3, r3 + 8005240: b2da uxtb r2, r3 + 8005242: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005246: 4413 add r3, r2 + 8005248: f887 30ef strb.w r3, [r7, #239] ; 0xef + + temp = HIHFBYTE(LOBYTE(data)); + 800524c: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 8005250: b2db uxtb r3, r3 + 8005252: 091b lsrs r3, r3, #4 + 8005254: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // DATA_LH + 8005258: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 800525c: 1c63 adds r3, r4, #1 + 800525e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005262: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005266: 4618 mov r0, r3 + 8005268: f7ff fb87 bl 800497a + 800526c: 4603 mov r3, r0 + 800526e: 461a mov r2, r3 + 8005270: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005274: 4423 add r3, r4 + 8005276: f803 2cf4 strb.w r2, [r3, #-244] + temp = LOHFBYTE(LOBYTE(data)); + 800527a: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 800527e: b2db uxtb r3, r3 + 8005280: f003 030f and.w r3, r3, #15 + 8005284: f887 30e9 strb.w r3, [r7, #233] ; 0xe9 + pSDat[i++] = RtuToAscii(temp); // DATA_LL + 8005288: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 800528c: 1c63 adds r3, r4, #1 + 800528e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005292: f897 30e9 ldrb.w r3, [r7, #233] ; 0xe9 + 8005296: 4618 mov r0, r3 + 8005298: f7ff fb6f bl 800497a + 800529c: 4603 mov r3, r0 + 800529e: 461a mov r2, r3 + 80052a0: f507 7380 add.w r3, r7, #256 ; 0x100 + 80052a4: 4423 add r3, r4 + 80052a6: f803 2cf4 strb.w r2, [r3, #-244] + + checksum += LOBYTE(data); + 80052aa: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 80052ae: b2da uxtb r2, r3 + 80052b0: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80052b4: 4413 add r3, r2 + 80052b6: f887 30ef strb.w r3, [r7, #239] ; 0xef + for (j = 0; j < len; j++) + 80052ba: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 80052be: 3301 adds r3, #1 + 80052c0: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80052c4: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80052c8: f8d7 20f8 ldr.w r2, [r7, #248] ; 0xf8 + 80052cc: 429a cmp r2, r3 + 80052ce: f6ff af77 blt.w 80051c0 + } + + checksum = ~checksum + 1; + 80052d2: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80052d6: 425b negs r3, r3 + 80052d8: f887 30ef strb.w r3, [r7, #239] ; 0xef + pSDat[i++] = RtuToAscii(HIHFBYTE(checksum)); // LRC_H + 80052dc: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80052e0: 091b lsrs r3, r3, #4 + 80052e2: b2da uxtb r2, r3 + 80052e4: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 80052e8: 1c63 adds r3, r4, #1 + 80052ea: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 80052ee: 4610 mov r0, r2 + 80052f0: f7ff fb43 bl 800497a + 80052f4: 4603 mov r3, r0 + 80052f6: 461a mov r2, r3 + 80052f8: f507 7380 add.w r3, r7, #256 ; 0x100 + 80052fc: 4423 add r3, r4 + 80052fe: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = RtuToAscii(LOHFBYTE(checksum)); // LRC_L + 8005302: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005306: f003 030f and.w r3, r3, #15 + 800530a: b2da uxtb r2, r3 + 800530c: f8d7 40fc ldr.w r4, [r7, #252] ; 0xfc + 8005310: 1c63 adds r3, r4, #1 + 8005312: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + 8005316: 4610 mov r0, r2 + 8005318: f7ff fb2f bl 800497a + 800531c: 4603 mov r3, r0 + 800531e: 461a mov r2, r3 + 8005320: f507 7380 add.w r3, r7, #256 ; 0x100 + 8005324: 4423 add r3, r4 + 8005326: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = '\r'; // CR + 800532a: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800532e: 1c5a adds r2, r3, #1 + 8005330: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8005334: f507 7280 add.w r2, r7, #256 ; 0x100 + 8005338: 4413 add r3, r2 + 800533a: 220d movs r2, #13 + 800533c: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = '\n'; // LF + 8005340: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005344: 1c5a adds r2, r3, #1 + 8005346: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 800534a: f507 7280 add.w r2, r7, #256 ; 0x100 + 800534e: 4413 add r3, r2 + 8005350: 220a movs r2, #10 + 8005352: f803 2cf4 strb.w r2, [r3, #-244] + 8005356: e0bb b.n 80054d0 + } + else // RTUģʽ + { + pSDat[i++] = index; // IDX + 8005358: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800535c: 1c5a adds r2, r3, #1 + 800535e: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8005362: f507 7280 add.w r2, r7, #256 ; 0x100 + 8005366: 4413 add r3, r2 + 8005368: 78fa ldrb r2, [r7, #3] + 800536a: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = cmd; // CMD + 800536e: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005372: 1c5a adds r2, r3, #1 + 8005374: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8005378: f507 7280 add.w r2, r7, #256 ; 0x100 + 800537c: 4413 add r3, r2 + 800537e: 78ba ldrb r2, [r7, #2] + 8005380: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = HIBYTE(addr); // ADDR_H + 8005384: 463b mov r3, r7 + 8005386: 881b ldrh r3, [r3, #0] + 8005388: 0a1b lsrs r3, r3, #8 + 800538a: b299 uxth r1, r3 + 800538c: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005390: 1c5a adds r2, r3, #1 + 8005392: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8005396: b2ca uxtb r2, r1 + 8005398: f507 7180 add.w r1, r7, #256 ; 0x100 + 800539c: 440b add r3, r1 + 800539e: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = LOBYTE(addr); // ADDR_L + 80053a2: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80053a6: 1c5a adds r2, r3, #1 + 80053a8: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 80053ac: 463a mov r2, r7 + 80053ae: 8812 ldrh r2, [r2, #0] + 80053b0: b2d2 uxtb r2, r2 + 80053b2: f507 7180 add.w r1, r7, #256 ; 0x100 + 80053b6: 440b add r3, r1 + 80053b8: f803 2cf4 strb.w r2, [r3, #-244] + + if (cmd == MODBUS_WR_MULTI) + 80053bc: 78bb ldrb r3, [r7, #2] + 80053be: 2b10 cmp r3, #16 + 80053c0: d12a bne.n 8005418 + {// + // ݸ,λ + pSDat[i++] = HIBYTE(len); // LEN_H + 80053c2: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80053c6: 0a1b lsrs r3, r3, #8 + 80053c8: b299 uxth r1, r3 + 80053ca: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80053ce: 1c5a adds r2, r3, #1 + 80053d0: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 80053d4: b2ca uxtb r2, r1 + 80053d6: f507 7180 add.w r1, r7, #256 ; 0x100 + 80053da: 440b add r3, r1 + 80053dc: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = LOBYTE(len); // LEN_L + 80053e0: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80053e4: 1c5a adds r2, r3, #1 + 80053e6: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 80053ea: f8b7 2114 ldrh.w r2, [r7, #276] ; 0x114 + 80053ee: b2d2 uxtb r2, r2 + 80053f0: f507 7180 add.w r1, r7, #256 ; 0x100 + 80053f4: 440b add r3, r1 + 80053f6: f803 2cf4 strb.w r2, [r3, #-244] + + // ֽ + pSDat[i++] = LOBYTE(len)<<1; // LEN_L * 2 + 80053fa: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 80053fe: b2da uxtb r2, r3 + 8005400: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005404: 1c59 adds r1, r3, #1 + 8005406: f8c7 10fc str.w r1, [r7, #252] ; 0xfc + 800540a: 0052 lsls r2, r2, #1 + 800540c: b2d2 uxtb r2, r2 + 800540e: f507 7180 add.w r1, r7, #256 ; 0x100 + 8005412: 440b add r3, r1 + 8005414: f803 2cf4 strb.w r2, [r3, #-244] + } + + for (j = 0; j < len; j++) + 8005418: 2300 movs r3, #0 + 800541a: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 800541e: e029 b.n 8005474 + { + data = pData[j]; + 8005420: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 8005424: 005b lsls r3, r3, #1 + 8005426: f8d7 2110 ldr.w r2, [r7, #272] ; 0x110 + 800542a: 4413 add r3, r2 + 800542c: 881b ldrh r3, [r3, #0] + 800542e: f8a7 30ea strh.w r3, [r7, #234] ; 0xea + + pSDat[i++] = HIBYTE(data); // DATA_H + 8005432: f8b7 30ea ldrh.w r3, [r7, #234] ; 0xea + 8005436: 0a1b lsrs r3, r3, #8 + 8005438: b299 uxth r1, r3 + 800543a: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800543e: 1c5a adds r2, r3, #1 + 8005440: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 8005444: b2ca uxtb r2, r1 + 8005446: f507 7180 add.w r1, r7, #256 ; 0x100 + 800544a: 440b add r3, r1 + 800544c: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = LOBYTE(data); // DATA_L + 8005450: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005454: 1c5a adds r2, r3, #1 + 8005456: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 800545a: f8b7 20ea ldrh.w r2, [r7, #234] ; 0xea + 800545e: b2d2 uxtb r2, r2 + 8005460: f507 7180 add.w r1, r7, #256 ; 0x100 + 8005464: 440b add r3, r1 + 8005466: f803 2cf4 strb.w r2, [r3, #-244] + for (j = 0; j < len; j++) + 800546a: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 800546e: 3301 adds r3, #1 + 8005470: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 8005474: f8b7 3114 ldrh.w r3, [r7, #276] ; 0x114 + 8005478: f8d7 20f8 ldr.w r2, [r7, #248] ; 0xf8 + 800547c: 429a cmp r2, r3 + 800547e: dbcf blt.n 8005420 + } + + checkcrc = ModbusCrc16(&pSDat[0], i); + 8005480: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005484: b29a uxth r2, r3 + 8005486: f107 030c add.w r3, r7, #12 + 800548a: 4611 mov r1, r2 + 800548c: 4618 mov r0, r3 + 800548e: f7ff fab3 bl 80049f8 + 8005492: 4603 mov r3, r0 + 8005494: f8a7 30ec strh.w r3, [r7, #236] ; 0xec + + pSDat[i++] = HIBYTE(checkcrc); // CRC_H + 8005498: f8b7 30ec ldrh.w r3, [r7, #236] ; 0xec + 800549c: 0a1b lsrs r3, r3, #8 + 800549e: b299 uxth r1, r3 + 80054a0: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80054a4: 1c5a adds r2, r3, #1 + 80054a6: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 80054aa: b2ca uxtb r2, r1 + 80054ac: f507 7180 add.w r1, r7, #256 ; 0x100 + 80054b0: 440b add r3, r1 + 80054b2: f803 2cf4 strb.w r2, [r3, #-244] + pSDat[i++] = LOBYTE(checkcrc); // CRC_L + 80054b6: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80054ba: 1c5a adds r2, r3, #1 + 80054bc: f8c7 20fc str.w r2, [r7, #252] ; 0xfc + 80054c0: f8b7 20ec ldrh.w r2, [r7, #236] ; 0xec + 80054c4: b2d2 uxtb r2, r2 + 80054c6: f507 7180 add.w r1, r7, #256 ; 0x100 + 80054ca: 440b add r3, r1 + 80054cc: f803 2cf4 strb.w r2, [r3, #-244] + } + + g_modBusMCtrl[midx].ModBusCommSend(pSDat, i); + 80054d0: 4946 ldr r1, [pc, #280] ; (80055ec ) + 80054d2: 687a ldr r2, [r7, #4] + 80054d4: 4613 mov r3, r2 + 80054d6: 00db lsls r3, r3, #3 + 80054d8: 4413 add r3, r2 + 80054da: 009b lsls r3, r3, #2 + 80054dc: 440b add r3, r1 + 80054de: 330c adds r3, #12 + 80054e0: 681b ldr r3, [r3, #0] + 80054e2: f107 020c add.w r2, r7, #12 + 80054e6: f8d7 10fc ldr.w r1, [r7, #252] ; 0xfc + 80054ea: 4610 mov r0, r2 + 80054ec: 4798 blx r3 + } + + if (steps == 3) + 80054ee: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 80054f2: 2b03 cmp r3, #3 + 80054f4: d10e bne.n 8005514 + { + if (g_modBusMCtrl[midx].IsModBusCommSendOver() != TRUE) + 80054f6: 493d ldr r1, [pc, #244] ; (80055ec ) + 80054f8: 687a ldr r2, [r7, #4] + 80054fa: 4613 mov r3, r2 + 80054fc: 00db lsls r3, r3, #3 + 80054fe: 4413 add r3, r2 + 8005500: 009b lsls r3, r3, #2 + 8005502: 440b add r3, r1 + 8005504: 3318 adds r3, #24 + 8005506: 681b ldr r3, [r3, #0] + 8005508: 4798 blx r3 + 800550a: 4603 mov r3, r0 + 800550c: 2b01 cmp r3, #1 + 800550e: d041 beq.n 8005594 + { + return 0; + 8005510: 2300 movs r3, #0 + 8005512: e066 b.n 80055e2 + } + } + else if (steps == -1) // ͬ + 8005514: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8005518: f1b3 3fff cmp.w r3, #4294967295 + 800551c: d13a bne.n 8005594 + { + timeout = (i*2 + 4) * g_modBusMCtrl[midx].modBusWait; // ʱʱ,λus((ֽ*2 + 4) * ÿֽڷʱ) + 800551e: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005522: 3302 adds r3, #2 + 8005524: 4618 mov r0, r3 + 8005526: 4931 ldr r1, [pc, #196] ; (80055ec ) + 8005528: 687a ldr r2, [r7, #4] + 800552a: 4613 mov r3, r2 + 800552c: 00db lsls r3, r3, #3 + 800552e: 4413 add r3, r2 + 8005530: 009b lsls r3, r3, #2 + 8005532: 440b add r3, r1 + 8005534: 3308 adds r3, #8 + 8005536: 681b ldr r3, [r3, #0] + 8005538: fb03 f300 mul.w r3, r3, r0 + 800553c: 005b lsls r3, r3, #1 + 800553e: f8c7 30f4 str.w r3, [r7, #244] ; 0xf4 + + do //ȴ + { + if (g_modBusMCtrl[midx].IsModBusCommSendOver() == TRUE) + 8005542: 492a ldr r1, [pc, #168] ; (80055ec ) + 8005544: 687a ldr r2, [r7, #4] + 8005546: 4613 mov r3, r2 + 8005548: 00db lsls r3, r3, #3 + 800554a: 4413 add r3, r2 + 800554c: 009b lsls r3, r3, #2 + 800554e: 440b add r3, r1 + 8005550: 3318 adds r3, #24 + 8005552: 681b ldr r3, [r3, #0] + 8005554: 4798 blx r3 + 8005556: 4603 mov r3, r0 + 8005558: 2b01 cmp r3, #1 + 800555a: d00e beq.n 800557a + { + break; + } + + DelayUs(1); + 800555c: 2001 movs r0, #1 + 800555e: f7fe f85b bl 8003618 + + if (timeout-- <= 0) + 8005562: f8d7 30f4 ldr.w r3, [r7, #244] ; 0xf4 + 8005566: 1e5a subs r2, r3, #1 + 8005568: f8c7 20f4 str.w r2, [r7, #244] ; 0xf4 + 800556c: 2b00 cmp r3, #0 + 800556e: dce8 bgt.n 8005542 + { + result = -2; + 8005570: f06f 0301 mvn.w r3, #1 + 8005574: f8c7 30f0 str.w r3, [r7, #240] ; 0xf0 + break; + 8005578: e000 b.n 800557c + break; + 800557a: bf00 nop + } + }while(1); + + DelayUs(g_modBusMCtrl[midx].modBusWait); // ȴһֽڷ + 800557c: 491b ldr r1, [pc, #108] ; (80055ec ) + 800557e: 687a ldr r2, [r7, #4] + 8005580: 4613 mov r3, r2 + 8005582: 00db lsls r3, r3, #3 + 8005584: 4413 add r3, r2 + 8005586: 009b lsls r3, r3, #2 + 8005588: 440b add r3, r1 + 800558a: 3308 adds r3, #8 + 800558c: 681b ldr r3, [r3, #0] + 800558e: 4618 mov r0, r3 + 8005590: f7fe f842 bl 8003618 + } + + if (steps == 4 || steps == -1) + 8005594: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 8005598: 2b04 cmp r3, #4 + 800559a: d004 beq.n 80055a6 + 800559c: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 80055a0: f1b3 3fff cmp.w r3, #4294967295 + 80055a4: d113 bne.n 80055ce + { + g_modBusMCtrl[midx].ModBusCommCleanRsBuf(); // ѽյ + 80055a6: 4911 ldr r1, [pc, #68] ; (80055ec ) + 80055a8: 687a ldr r2, [r7, #4] + 80055aa: 4613 mov r3, r2 + 80055ac: 00db lsls r3, r3, #3 + 80055ae: 4413 add r3, r2 + 80055b0: 009b lsls r3, r3, #2 + 80055b2: 440b add r3, r1 + 80055b4: 3314 adds r3, #20 + 80055b6: 681b ldr r3, [r3, #0] + 80055b8: 4798 blx r3 + g_modBusMCtrl[midx].CommOutDis(); // رշ + 80055ba: 490c ldr r1, [pc, #48] ; (80055ec ) + 80055bc: 687a ldr r2, [r7, #4] + 80055be: 4613 mov r3, r2 + 80055c0: 00db lsls r3, r3, #3 + 80055c2: 4413 add r3, r2 + 80055c4: 009b lsls r3, r3, #2 + 80055c6: 440b add r3, r1 + 80055c8: 3320 adds r3, #32 + 80055ca: 681b ldr r3, [r3, #0] + 80055cc: 4798 blx r3 + } + + if (steps != -1) + 80055ce: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 80055d2: f1b3 3fff cmp.w r3, #4294967295 + 80055d6: d002 beq.n 80055de + { + return steps; + 80055d8: f8d7 3118 ldr.w r3, [r7, #280] ; 0x118 + 80055dc: e001 b.n 80055e2 + } + + return result; + 80055de: f8d7 30f0 ldr.w r3, [r7, #240] ; 0xf0 +} + 80055e2: 4618 mov r0, r3 + 80055e4: f507 7782 add.w r7, r7, #260 ; 0x104 + 80055e8: 46bd mov sp, r7 + 80055ea: bd90 pop {r4, r7, pc} + 80055ec: 20001354 .word 0x20001354 + +080055f0 : +// Էֲ +// steps == -1, ͬãֱյݻʱ +// steps == 1, 첽ñ־ȷõݽΪ len, 0ΪûݣΪ + +int ModbusRx(int midx, u8 index, u8 cmd, u16 addr, u16 * pData, u16 len, int steps) +{ + 80055f0: b590 push {r4, r7, lr} + 80055f2: b0c3 sub sp, #268 ; 0x10c + 80055f4: af00 add r7, sp, #0 + 80055f6: 1d3c adds r4, r7, #4 + 80055f8: 6020 str r0, [r4, #0] + 80055fa: 460c mov r4, r1 + 80055fc: 4610 mov r0, r2 + 80055fe: 4619 mov r1, r3 + 8005600: 1cfb adds r3, r7, #3 + 8005602: 4622 mov r2, r4 + 8005604: 701a strb r2, [r3, #0] + 8005606: 1cbb adds r3, r7, #2 + 8005608: 4602 mov r2, r0 + 800560a: 701a strb r2, [r3, #0] + 800560c: 463b mov r3, r7 + 800560e: 460a mov r2, r1 + 8005610: 801a strh r2, [r3, #0] + u8 pRDat[MDBSRXLEN_MAX]; // ݻ + u16 checkcrc; // crcУ(RTU) + u8 checksum; // У(ASCII) + u8 temp_h, temp_l, tempH, tempL; // + + if ((cmd != MODBUS_RD) && (cmd != MODBUS_WR) && (cmd != MODBUS_WR_MULTI)) + 8005612: 1cbb adds r3, r7, #2 + 8005614: 781b ldrb r3, [r3, #0] + 8005616: 2b03 cmp r3, #3 + 8005618: d00b beq.n 8005632 + 800561a: 1cbb adds r3, r7, #2 + 800561c: 781b ldrb r3, [r3, #0] + 800561e: 2b06 cmp r3, #6 + 8005620: d007 beq.n 8005632 + 8005622: 1cbb adds r3, r7, #2 + 8005624: 781b ldrb r3, [r3, #0] + 8005626: 2b10 cmp r3, #16 + 8005628: d003 beq.n 8005632 + { + return -1; // + 800562a: f04f 33ff mov.w r3, #4294967295 + 800562e: f000 bf74 b.w 800651a + } + + if ((len > MODBUS_LENMAX) || (len == 0)) + 8005632: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005636: 2b32 cmp r3, #50 ; 0x32 + 8005638: d803 bhi.n 8005642 + 800563a: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 800563e: 2b00 cmp r3, #0 + 8005640: d103 bne.n 800564a + { + return -1; // + 8005642: f04f 33ff mov.w r3, #4294967295 + 8005646: f000 bf68 b.w 800651a + } + + if (midx < 0 || midx >= MODBUS_M_NUM) + 800564a: 1d3b adds r3, r7, #4 + 800564c: 681b ldr r3, [r3, #0] + 800564e: 2b00 cmp r3, #0 + 8005650: db03 blt.n 800565a + 8005652: 1d3b adds r3, r7, #4 + 8005654: 681b ldr r3, [r3, #0] + 8005656: 2b00 cmp r3, #0 + 8005658: dd07 ble.n 800566a + { + result = -1; + 800565a: f04f 33ff mov.w r3, #4294967295 + 800565e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + return result; + 8005662: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8005666: f000 bf58 b.w 800651a + } + + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + 800566a: 49b9 ldr r1, [pc, #740] ; (8005950 ) + 800566c: 1d3b adds r3, r7, #4 + 800566e: 681a ldr r2, [r3, #0] + 8005670: 4613 mov r3, r2 + 8005672: 00db lsls r3, r3, #3 + 8005674: 4413 add r3, r2 + 8005676: 009b lsls r3, r3, #2 + 8005678: 440b add r3, r1 + 800567a: 681b ldr r3, [r3, #0] + 800567c: 2b00 cmp r3, #0 + 800567e: d023 beq.n 80056c8 + { + if (cmd == MODBUS_RD) // + 8005680: 1cbb adds r3, r7, #2 + 8005682: 781b ldrb r3, [r3, #0] + 8005684: 2b03 cmp r3, #3 + 8005686: d106 bne.n 8005696 + { + exlen = len * 4 + 11; // + 8005688: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 800568c: 009b lsls r3, r3, #2 + 800568e: 330b adds r3, #11 + 8005690: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 8005694: e012 b.n 80056bc + } + else if (cmd == MODBUS_WR) // д + 8005696: 1cbb adds r3, r7, #2 + 8005698: 781b ldrb r3, [r3, #0] + 800569a: 2b06 cmp r3, #6 + 800569c: d103 bne.n 80056a6 + { + exlen = 17; // + 800569e: 2311 movs r3, #17 + 80056a0: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056a4: e00a b.n 80056bc + } + else if (cmd == MODBUS_WR_MULTI) // д + 80056a6: 1cbb adds r3, r7, #2 + 80056a8: 781b ldrb r3, [r3, #0] + 80056aa: 2b10 cmp r3, #16 + 80056ac: d103 bne.n 80056b6 + { + exlen = 17; // + 80056ae: 2311 movs r3, #17 + 80056b0: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056b4: e002 b.n 80056bc + } + else + { + exlen = 17; // + 80056b6: 2311 movs r3, #17 + 80056b8: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + } + + exlen -= 1; // ȥʼ : + 80056bc: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 80056c0: 3b01 subs r3, #1 + 80056c2: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056c6: e01d b.n 8005704 + } + else // RTU ģʽ + { + if (cmd == MODBUS_RD) // + 80056c8: 1cbb adds r3, r7, #2 + 80056ca: 781b ldrb r3, [r3, #0] + 80056cc: 2b03 cmp r3, #3 + 80056ce: d106 bne.n 80056de + { + exlen = len * 2 + 5; // + 80056d0: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 80056d4: 005b lsls r3, r3, #1 + 80056d6: 3305 adds r3, #5 + 80056d8: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056dc: e012 b.n 8005704 + } + else if (cmd == MODBUS_WR) // д + 80056de: 1cbb adds r3, r7, #2 + 80056e0: 781b ldrb r3, [r3, #0] + 80056e2: 2b06 cmp r3, #6 + 80056e4: d103 bne.n 80056ee + { + exlen = 8; // + 80056e6: 2308 movs r3, #8 + 80056e8: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056ec: e00a b.n 8005704 + } + else if (cmd == MODBUS_WR_MULTI) // д + 80056ee: 1cbb adds r3, r7, #2 + 80056f0: 781b ldrb r3, [r3, #0] + 80056f2: 2b10 cmp r3, #16 + 80056f4: d103 bne.n 80056fe + { + exlen = 8; // + 80056f6: 2308 movs r3, #8 + 80056f8: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + 80056fc: e002 b.n 8005704 + } + else + { + exlen = 8; // + 80056fe: 2308 movs r3, #8 + 8005700: f8c7 30f8 str.w r3, [r7, #248] ; 0xf8 + } + } + + if (steps == 1 || steps == -1) + 8005704: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005708: 2b01 cmp r3, #1 + 800570a: d004 beq.n 8005716 + 800570c: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005710: f1b3 3fff cmp.w r3, #4294967295 + 8005714: d163 bne.n 80057de + { + memset(pRDat, 0, MDBSRXLEN_MAX); + 8005716: f107 030c add.w r3, r7, #12 + 800571a: 22dd movs r2, #221 ; 0xdd + 800571c: 2100 movs r1, #0 + 800571e: 4618 mov r0, r3 + 8005720: f004 f8eb bl 80098fa + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + 8005724: 498a ldr r1, [pc, #552] ; (8005950 ) + 8005726: 1d3b adds r3, r7, #4 + 8005728: 681a ldr r2, [r3, #0] + 800572a: 4613 mov r3, r2 + 800572c: 00db lsls r3, r3, #3 + 800572e: 4413 add r3, r2 + 8005730: 009b lsls r3, r3, #2 + 8005732: 440b add r3, r1 + 8005734: 681b ldr r3, [r3, #0] + 8005736: 2b00 cmp r3, #0 + 8005738: d051 beq.n 80057de + { + timeout = exlen*2 + 400; // ʱʱ + 800573a: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 800573e: 33c8 adds r3, #200 ; 0xc8 + 8005740: 005b lsls r3, r3, #1 + 8005742: f8c7 30f4 str.w r3, [r7, #244] ; 0xf4 + do + { + result = g_modBusMCtrl[midx].ModBusCommReceive(pRDat, 1); // ӻȡ + 8005746: 4982 ldr r1, [pc, #520] ; (8005950 ) + 8005748: 1d3b adds r3, r7, #4 + 800574a: 681a ldr r2, [r3, #0] + 800574c: 4613 mov r3, r2 + 800574e: 00db lsls r3, r3, #3 + 8005750: 4413 add r3, r2 + 8005752: 009b lsls r3, r3, #2 + 8005754: 440b add r3, r1 + 8005756: 3310 adds r3, #16 + 8005758: 681b ldr r3, [r3, #0] + 800575a: f107 020c add.w r2, r7, #12 + 800575e: 2101 movs r1, #1 + 8005760: 4610 mov r0, r2 + 8005762: 4798 blx r3 + 8005764: f8c7 00fc str.w r0, [r7, #252] ; 0xfc + + if (result == 1) + 8005768: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800576c: 2b01 cmp r3, #1 + 800576e: d10e bne.n 800578e + { + if (pRDat[0] == ':') // ҵʼ־ + 8005770: 7b3b ldrb r3, [r7, #12] + 8005772: 2b3a cmp r3, #58 ; 0x3a + 8005774: d103 bne.n 800577e + { + result = 0; + 8005776: 2300 movs r3, #0 + 8005778: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800577c: e027 b.n 80057ce + } + else + { + if (steps == 1) + 800577e: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005782: 2b01 cmp r3, #1 + 8005784: d103 bne.n 800578e + { + result = 1; // 첽,ִв + 8005786: 2301 movs r3, #1 + 8005788: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800578c: e01f b.n 80057ce + } + } + } + + if (steps == -1) + 800578e: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005792: f1b3 3fff cmp.w r3, #4294967295 + 8005796: d1d6 bne.n 8005746 + { + DelayUs(g_modBusMCtrl[midx].modBusWait); + 8005798: 496d ldr r1, [pc, #436] ; (8005950 ) + 800579a: 1d3b adds r3, r7, #4 + 800579c: 681a ldr r2, [r3, #0] + 800579e: 4613 mov r3, r2 + 80057a0: 00db lsls r3, r3, #3 + 80057a2: 4413 add r3, r2 + 80057a4: 009b lsls r3, r3, #2 + 80057a6: 440b add r3, r1 + 80057a8: 3308 adds r3, #8 + 80057aa: 681b ldr r3, [r3, #0] + 80057ac: 4618 mov r0, r3 + 80057ae: f7fd ff33 bl 8003618 + + if (timeout-- <= 0) + 80057b2: f8d7 30f4 ldr.w r3, [r7, #244] ; 0xf4 + 80057b6: 1e5a subs r2, r3, #1 + 80057b8: f8c7 20f4 str.w r2, [r7, #244] ; 0xf4 + 80057bc: 2b00 cmp r3, #0 + 80057be: dcc2 bgt.n 8005746 + { + printf("1. call ModbusRx timeout\r\n"); + 80057c0: 4864 ldr r0, [pc, #400] ; (8005954 ) + 80057c2: f004 f917 bl 80099f4 + result = -2; //ճʱ + 80057c6: f06f 0301 mvn.w r3, #1 + 80057ca: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + } + } + }while(1); + + if (result != 0) + 80057ce: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80057d2: 2b00 cmp r3, #0 + 80057d4: d003 beq.n 80057de + { + return result; + 80057d6: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80057da: f000 be9e b.w 800651a + } + } + } + + if (steps != -1 && g_modBusMCtrl[midx].modBusMode == 0) // RTU ģʽ + 80057de: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 80057e2: f1b3 3fff cmp.w r3, #4294967295 + 80057e6: d00d beq.n 8005804 + 80057e8: 4959 ldr r1, [pc, #356] ; (8005950 ) + 80057ea: 1d3b adds r3, r7, #4 + 80057ec: 681a ldr r2, [r3, #0] + 80057ee: 4613 mov r3, r2 + 80057f0: 00db lsls r3, r3, #3 + 80057f2: 4413 add r3, r2 + 80057f4: 009b lsls r3, r3, #2 + 80057f6: 440b add r3, r1 + 80057f8: 681b ldr r3, [r3, #0] + 80057fa: 2b00 cmp r3, #0 + 80057fc: d102 bne.n 8005804 + { + steps = 2; + 80057fe: 2302 movs r3, #2 + 8005800: f8c7 3120 str.w r3, [r7, #288] ; 0x120 + } + + if (steps == 2 || steps == -1) + 8005804: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005808: 2b02 cmp r3, #2 + 800580a: d005 beq.n 8005818 + 800580c: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 8005810: f1b3 3fff cmp.w r3, #4294967295 + 8005814: f040 8674 bne.w 8006500 + { + timeout = exlen*2 + 400; // ʱʱ + 8005818: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 800581c: 33c8 adds r3, #200 ; 0xc8 + 800581e: 005b lsls r3, r3, #1 + 8005820: f8c7 30f4 str.w r3, [r7, #244] ; 0xf4 + + do + { + result = g_modBusMCtrl[midx].ModBusCommReceive(pRDat, exlen); // ӻȡ + 8005824: 494a ldr r1, [pc, #296] ; (8005950 ) + 8005826: 1d3b adds r3, r7, #4 + 8005828: 681a ldr r2, [r3, #0] + 800582a: 4613 mov r3, r2 + 800582c: 00db lsls r3, r3, #3 + 800582e: 4413 add r3, r2 + 8005830: 009b lsls r3, r3, #2 + 8005832: 440b add r3, r1 + 8005834: 3310 adds r3, #16 + 8005836: 681b ldr r3, [r3, #0] + 8005838: f107 020c add.w r2, r7, #12 + 800583c: f8d7 10f8 ldr.w r1, [r7, #248] ; 0xf8 + 8005840: 4610 mov r0, r2 + 8005842: 4798 blx r3 + 8005844: f8c7 00fc str.w r0, [r7, #252] ; 0xfc + if (result >= exlen) + 8005848: f8d7 20fc ldr.w r2, [r7, #252] ; 0xfc + 800584c: f8d7 30f8 ldr.w r3, [r7, #248] ; 0xf8 + 8005850: 429a cmp r2, r3 + 8005852: f2c0 85f6 blt.w 8006442 + { + if (g_modBusMCtrl[midx].modBusMode != 0) // ASCIIģʽ + 8005856: 493e ldr r1, [pc, #248] ; (8005950 ) + 8005858: 1d3b adds r3, r7, #4 + 800585a: 681a ldr r2, [r3, #0] + 800585c: 4613 mov r3, r2 + 800585e: 00db lsls r3, r3, #3 + 8005860: 4413 add r3, r2 + 8005862: 009b lsls r3, r3, #2 + 8005864: 440b add r3, r1 + 8005866: 681b ldr r3, [r3, #0] + 8005868: 2b00 cmp r3, #0 + 800586a: f000 84a7 beq.w 80061bc + { + if (g_modBusMCtrl[midx].filterChk != 0) // 7λݹУλ + 800586e: 4938 ldr r1, [pc, #224] ; (8005950 ) + 8005870: 1d3b adds r3, r7, #4 + 8005872: 681a ldr r2, [r3, #0] + 8005874: 4613 mov r3, r2 + 8005876: 00db lsls r3, r3, #3 + 8005878: 4413 add r3, r2 + 800587a: 009b lsls r3, r3, #2 + 800587c: 440b add r3, r1 + 800587e: 3304 adds r3, #4 + 8005880: 681b ldr r3, [r3, #0] + 8005882: 2b00 cmp r3, #0 + 8005884: d01e beq.n 80058c4 + { + for (i = 0; i < result; i++) + 8005886: 2300 movs r3, #0 + 8005888: f8c7 3104 str.w r3, [r7, #260] ; 0x104 + 800588c: e014 b.n 80058b8 + { + pRDat[i] &= 0x7F; + 800588e: f107 020c add.w r2, r7, #12 + 8005892: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005896: 4413 add r3, r2 + 8005898: 781b ldrb r3, [r3, #0] + 800589a: f003 037f and.w r3, r3, #127 ; 0x7f + 800589e: b2d9 uxtb r1, r3 + 80058a0: f107 020c add.w r2, r7, #12 + 80058a4: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80058a8: 4413 add r3, r2 + 80058aa: 460a mov r2, r1 + 80058ac: 701a strb r2, [r3, #0] + for (i = 0; i < result; i++) + 80058ae: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80058b2: 3301 adds r3, #1 + 80058b4: f8c7 3104 str.w r3, [r7, #260] ; 0x104 + 80058b8: f8d7 2104 ldr.w r2, [r7, #260] ; 0x104 + 80058bc: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80058c0: 429a cmp r2, r3 + 80058c2: dbe4 blt.n 800588e + } + } + + // ݰ + result = 0; + 80058c4: 2300 movs r3, #0 + 80058c6: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + i = 0; + 80058ca: 2300 movs r3, #0 + 80058cc: f8c7 3104 str.w r3, [r7, #260] ; 0x104 + checksum = 0; + 80058d0: 2300 movs r3, #0 + 80058d2: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(index))) // INDEX_H + 80058d6: f107 020c add.w r2, r7, #12 + 80058da: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80058de: 4413 add r3, r2 + 80058e0: 781c ldrb r4, [r3, #0] + 80058e2: 1cfb adds r3, r7, #3 + 80058e4: 781b ldrb r3, [r3, #0] + 80058e6: 091b lsrs r3, r3, #4 + 80058e8: b2db uxtb r3, r3 + 80058ea: 4618 mov r0, r3 + 80058ec: f7ff f845 bl 800497a + 80058f0: 4603 mov r3, r0 + 80058f2: 429c cmp r4, r3 + 80058f4: d005 beq.n 8005902 + { + result = -3; // մ + 80058f6: f06f 0302 mvn.w r3, #2 + 80058fa: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80058fe: f000 bdff b.w 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005902: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005906: 1c5a adds r2, r3, #1 + 8005908: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800590c: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005910: 4413 add r3, r2 + 8005912: f813 3cfc ldrb.w r3, [r3, #-252] + 8005916: 4618 mov r0, r3 + 8005918: f7ff f806 bl 8004928 + 800591c: 4603 mov r3, r0 + 800591e: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(index))) // INDEX_L + 8005922: f107 020c add.w r2, r7, #12 + 8005926: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 800592a: 4413 add r3, r2 + 800592c: 781c ldrb r4, [r3, #0] + 800592e: 1cfb adds r3, r7, #3 + 8005930: 781b ldrb r3, [r3, #0] + 8005932: f003 030f and.w r3, r3, #15 + 8005936: b2db uxtb r3, r3 + 8005938: 4618 mov r0, r3 + 800593a: f7ff f81e bl 800497a + 800593e: 4603 mov r3, r0 + 8005940: 429c cmp r4, r3 + 8005942: d009 beq.n 8005958 + { + result = -3; // մ + 8005944: f06f 0302 mvn.w r3, #2 + 8005948: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800594c: f000 bdd8 b.w 8006500 + 8005950: 20001354 .word 0x20001354 + 8005954: 0800ac44 .word 0x0800ac44 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005958: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 800595c: 1c5a adds r2, r3, #1 + 800595e: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005962: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005966: 4413 add r3, r2 + 8005968: f813 3cfc ldrb.w r3, [r3, #-252] + 800596c: 4618 mov r0, r3 + 800596e: f7fe ffdb bl 8004928 + 8005972: 4603 mov r3, r0 + 8005974: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005978: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 800597c: f003 030f and.w r3, r3, #15 + 8005980: b25a sxtb r2, r3 + 8005982: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005986: 011b lsls r3, r3, #4 + 8005988: b2db uxtb r3, r3 + 800598a: b25b sxtb r3, r3 + 800598c: 4313 orrs r3, r2 + 800598e: b25b sxtb r3, r3 + 8005990: b2da uxtb r2, r3 + 8005992: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005996: 4413 add r3, r2 + 8005998: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(cmd))) // CMD_H + 800599c: f107 020c add.w r2, r7, #12 + 80059a0: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80059a4: 4413 add r3, r2 + 80059a6: 781c ldrb r4, [r3, #0] + 80059a8: 1cbb adds r3, r7, #2 + 80059aa: 781b ldrb r3, [r3, #0] + 80059ac: 091b lsrs r3, r3, #4 + 80059ae: b2db uxtb r3, r3 + 80059b0: 4618 mov r0, r3 + 80059b2: f7fe ffe2 bl 800497a + 80059b6: 4603 mov r3, r0 + 80059b8: 429c cmp r4, r3 + 80059ba: d005 beq.n 80059c8 + { + result = -3; // մ + 80059bc: f06f 0302 mvn.w r3, #2 + 80059c0: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80059c4: f000 bd9c b.w 8006500 + } + + temp_h = AsciiToRtu(pRDat[i++]); + 80059c8: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80059cc: 1c5a adds r2, r3, #1 + 80059ce: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80059d2: f507 7284 add.w r2, r7, #264 ; 0x108 + 80059d6: 4413 add r3, r2 + 80059d8: f813 3cfc ldrb.w r3, [r3, #-252] + 80059dc: 4618 mov r0, r3 + 80059de: f7fe ffa3 bl 8004928 + 80059e2: 4603 mov r3, r0 + 80059e4: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(cmd))) // CMD_L + 80059e8: f107 020c add.w r2, r7, #12 + 80059ec: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80059f0: 4413 add r3, r2 + 80059f2: 781c ldrb r4, [r3, #0] + 80059f4: 1cbb adds r3, r7, #2 + 80059f6: 781b ldrb r3, [r3, #0] + 80059f8: f003 030f and.w r3, r3, #15 + 80059fc: b2db uxtb r3, r3 + 80059fe: 4618 mov r0, r3 + 8005a00: f7fe ffbb bl 800497a + 8005a04: 4603 mov r3, r0 + 8005a06: 429c cmp r4, r3 + 8005a08: d005 beq.n 8005a16 + { + result = -3; // մ + 8005a0a: f06f 0302 mvn.w r3, #2 + 8005a0e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005a12: f000 bd75 b.w 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005a16: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005a1a: 1c5a adds r2, r3, #1 + 8005a1c: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005a20: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005a24: 4413 add r3, r2 + 8005a26: f813 3cfc ldrb.w r3, [r3, #-252] + 8005a2a: 4618 mov r0, r3 + 8005a2c: f7fe ff7c bl 8004928 + 8005a30: 4603 mov r3, r0 + 8005a32: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005a36: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005a3a: f003 030f and.w r3, r3, #15 + 8005a3e: b25a sxtb r2, r3 + 8005a40: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005a44: 011b lsls r3, r3, #4 + 8005a46: b2db uxtb r3, r3 + 8005a48: b25b sxtb r3, r3 + 8005a4a: 4313 orrs r3, r2 + 8005a4c: b25b sxtb r3, r3 + 8005a4e: b2da uxtb r2, r3 + 8005a50: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005a54: 4413 add r3, r2 + 8005a56: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (cmd == MODBUS_RD) // + 8005a5a: 1cbb adds r3, r7, #2 + 8005a5c: 781b ldrb r3, [r3, #0] + 8005a5e: 2b03 cmp r3, #3 + 8005a60: d167 bne.n 8005b32 + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(len) << 1))) // LEN_H + 8005a62: f107 020c add.w r2, r7, #12 + 8005a66: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005a6a: 4413 add r3, r2 + 8005a6c: 781c ldrb r4, [r3, #0] + 8005a6e: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005a72: b2db uxtb r3, r3 + 8005a74: 005b lsls r3, r3, #1 + 8005a76: 111b asrs r3, r3, #4 + 8005a78: b2db uxtb r3, r3 + 8005a7a: f003 030f and.w r3, r3, #15 + 8005a7e: b2db uxtb r3, r3 + 8005a80: 4618 mov r0, r3 + 8005a82: f7fe ff7a bl 800497a + 8005a86: 4603 mov r3, r0 + 8005a88: 429c cmp r4, r3 + 8005a8a: d005 beq.n 8005a98 + { + result = -3; // մ + 8005a8c: f06f 0302 mvn.w r3, #2 + 8005a90: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005a94: f000 bd34 b.w 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005a98: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005a9c: 1c5a adds r2, r3, #1 + 8005a9e: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005aa2: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005aa6: 4413 add r3, r2 + 8005aa8: f813 3cfc ldrb.w r3, [r3, #-252] + 8005aac: 4618 mov r0, r3 + 8005aae: f7fe ff3b bl 8004928 + 8005ab2: 4603 mov r3, r0 + 8005ab4: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(len) << 1))) // LEN_L + 8005ab8: f107 020c add.w r2, r7, #12 + 8005abc: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005ac0: 4413 add r3, r2 + 8005ac2: 781c ldrb r4, [r3, #0] + 8005ac4: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005ac8: b2db uxtb r3, r3 + 8005aca: 005b lsls r3, r3, #1 + 8005acc: b2db uxtb r3, r3 + 8005ace: f003 030f and.w r3, r3, #15 + 8005ad2: b2db uxtb r3, r3 + 8005ad4: 4618 mov r0, r3 + 8005ad6: f7fe ff50 bl 800497a + 8005ada: 4603 mov r3, r0 + 8005adc: 429c cmp r4, r3 + 8005ade: d005 beq.n 8005aec + { + result = -3; // մ + 8005ae0: f06f 0302 mvn.w r3, #2 + 8005ae4: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005ae8: f000 bd0a b.w 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005aec: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005af0: 1c5a adds r2, r3, #1 + 8005af2: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005af6: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005afa: 4413 add r3, r2 + 8005afc: f813 3cfc ldrb.w r3, [r3, #-252] + 8005b00: 4618 mov r0, r3 + 8005b02: f7fe ff11 bl 8004928 + 8005b06: 4603 mov r3, r0 + 8005b08: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005b0c: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005b10: f003 030f and.w r3, r3, #15 + 8005b14: b25a sxtb r2, r3 + 8005b16: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005b1a: 011b lsls r3, r3, #4 + 8005b1c: b2db uxtb r3, r3 + 8005b1e: b25b sxtb r3, r3 + 8005b20: 4313 orrs r3, r2 + 8005b22: b25b sxtb r3, r3 + 8005b24: b2da uxtb r2, r3 + 8005b26: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005b2a: 4413 add r3, r2 + 8005b2c: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + 8005b30: e254 b.n 8005fdc + } + else if (cmd == MODBUS_WR) // д + 8005b32: 1cbb adds r3, r7, #2 + 8005b34: 781b ldrb r3, [r3, #0] + 8005b36: 2b06 cmp r3, #6 + 8005b38: f040 80c7 bne.w 8005cca + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(addr)))) // ADDR_HH + 8005b3c: f107 020c add.w r2, r7, #12 + 8005b40: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005b44: 4413 add r3, r2 + 8005b46: 781c ldrb r4, [r3, #0] + 8005b48: 463b mov r3, r7 + 8005b4a: 881b ldrh r3, [r3, #0] + 8005b4c: 0a1b lsrs r3, r3, #8 + 8005b4e: b29b uxth r3, r3 + 8005b50: b2db uxtb r3, r3 + 8005b52: 091b lsrs r3, r3, #4 + 8005b54: b2db uxtb r3, r3 + 8005b56: 4618 mov r0, r3 + 8005b58: f7fe ff0f bl 800497a + 8005b5c: 4603 mov r3, r0 + 8005b5e: 429c cmp r4, r3 + 8005b60: d005 beq.n 8005b6e + { + result = -3; //մ + 8005b62: f06f 0302 mvn.w r3, #2 + 8005b66: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005b6a: f000 bcc9 b.w 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005b6e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005b72: 1c5a adds r2, r3, #1 + 8005b74: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005b78: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005b7c: 4413 add r3, r2 + 8005b7e: f813 3cfc ldrb.w r3, [r3, #-252] + 8005b82: 4618 mov r0, r3 + 8005b84: f7fe fed0 bl 8004928 + 8005b88: 4603 mov r3, r0 + 8005b8a: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(addr)))) // ADDR_HL + 8005b8e: f107 020c add.w r2, r7, #12 + 8005b92: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005b96: 4413 add r3, r2 + 8005b98: 781c ldrb r4, [r3, #0] + 8005b9a: 463b mov r3, r7 + 8005b9c: 881b ldrh r3, [r3, #0] + 8005b9e: 0a1b lsrs r3, r3, #8 + 8005ba0: b29b uxth r3, r3 + 8005ba2: b2db uxtb r3, r3 + 8005ba4: f003 030f and.w r3, r3, #15 + 8005ba8: b2db uxtb r3, r3 + 8005baa: 4618 mov r0, r3 + 8005bac: f7fe fee5 bl 800497a + 8005bb0: 4603 mov r3, r0 + 8005bb2: 429c cmp r4, r3 + 8005bb4: d005 beq.n 8005bc2 + { + result = -3; //մ + 8005bb6: f06f 0302 mvn.w r3, #2 + 8005bba: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005bbe: f000 bc9f b.w 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005bc2: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005bc6: 1c5a adds r2, r3, #1 + 8005bc8: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005bcc: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005bd0: 4413 add r3, r2 + 8005bd2: f813 3cfc ldrb.w r3, [r3, #-252] + 8005bd6: 4618 mov r0, r3 + 8005bd8: f7fe fea6 bl 8004928 + 8005bdc: 4603 mov r3, r0 + 8005bde: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005be2: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005be6: f003 030f and.w r3, r3, #15 + 8005bea: b25a sxtb r2, r3 + 8005bec: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005bf0: 011b lsls r3, r3, #4 + 8005bf2: b2db uxtb r3, r3 + 8005bf4: b25b sxtb r3, r3 + 8005bf6: 4313 orrs r3, r2 + 8005bf8: b25b sxtb r3, r3 + 8005bfa: b2da uxtb r2, r3 + 8005bfc: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005c00: 4413 add r3, r2 + 8005c02: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(addr)))) // ADDR_LH + 8005c06: f107 020c add.w r2, r7, #12 + 8005c0a: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005c0e: 4413 add r3, r2 + 8005c10: 781c ldrb r4, [r3, #0] + 8005c12: 463b mov r3, r7 + 8005c14: 881b ldrh r3, [r3, #0] + 8005c16: b2db uxtb r3, r3 + 8005c18: 091b lsrs r3, r3, #4 + 8005c1a: b2db uxtb r3, r3 + 8005c1c: 4618 mov r0, r3 + 8005c1e: f7fe feac bl 800497a + 8005c22: 4603 mov r3, r0 + 8005c24: 429c cmp r4, r3 + 8005c26: d005 beq.n 8005c34 + { + result = -3; //մ + 8005c28: f06f 0302 mvn.w r3, #2 + 8005c2c: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005c30: f000 bc66 b.w 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005c34: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005c38: 1c5a adds r2, r3, #1 + 8005c3a: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005c3e: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005c42: 4413 add r3, r2 + 8005c44: f813 3cfc ldrb.w r3, [r3, #-252] + 8005c48: 4618 mov r0, r3 + 8005c4a: f7fe fe6d bl 8004928 + 8005c4e: 4603 mov r3, r0 + 8005c50: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(addr)))) // ADDR_LL + 8005c54: f107 020c add.w r2, r7, #12 + 8005c58: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005c5c: 4413 add r3, r2 + 8005c5e: 781c ldrb r4, [r3, #0] + 8005c60: 463b mov r3, r7 + 8005c62: 881b ldrh r3, [r3, #0] + 8005c64: b2db uxtb r3, r3 + 8005c66: f003 030f and.w r3, r3, #15 + 8005c6a: b2db uxtb r3, r3 + 8005c6c: 4618 mov r0, r3 + 8005c6e: f7fe fe84 bl 800497a + 8005c72: 4603 mov r3, r0 + 8005c74: 429c cmp r4, r3 + 8005c76: d005 beq.n 8005c84 + { + result = -3; //մ + 8005c78: f06f 0302 mvn.w r3, #2 + 8005c7c: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005c80: f000 bc3e b.w 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005c84: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005c88: 1c5a adds r2, r3, #1 + 8005c8a: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005c8e: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005c92: 4413 add r3, r2 + 8005c94: f813 3cfc ldrb.w r3, [r3, #-252] + 8005c98: 4618 mov r0, r3 + 8005c9a: f7fe fe45 bl 8004928 + 8005c9e: 4603 mov r3, r0 + 8005ca0: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005ca4: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005ca8: f003 030f and.w r3, r3, #15 + 8005cac: b25a sxtb r2, r3 + 8005cae: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005cb2: 011b lsls r3, r3, #4 + 8005cb4: b2db uxtb r3, r3 + 8005cb6: b25b sxtb r3, r3 + 8005cb8: 4313 orrs r3, r2 + 8005cba: b25b sxtb r3, r3 + 8005cbc: b2da uxtb r2, r3 + 8005cbe: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005cc2: 4413 add r3, r2 + 8005cc4: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + 8005cc8: e188 b.n 8005fdc + } + else if (cmd == MODBUS_WR_MULTI) // д + 8005cca: 1cbb adds r3, r7, #2 + 8005ccc: 781b ldrb r3, [r3, #0] + 8005cce: 2b10 cmp r3, #16 + 8005cd0: f040 8184 bne.w 8005fdc + { + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(addr)))) // ADDR_HH + 8005cd4: f107 020c add.w r2, r7, #12 + 8005cd8: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005cdc: 4413 add r3, r2 + 8005cde: 781c ldrb r4, [r3, #0] + 8005ce0: 463b mov r3, r7 + 8005ce2: 881b ldrh r3, [r3, #0] + 8005ce4: 0a1b lsrs r3, r3, #8 + 8005ce6: b29b uxth r3, r3 + 8005ce8: b2db uxtb r3, r3 + 8005cea: 091b lsrs r3, r3, #4 + 8005cec: b2db uxtb r3, r3 + 8005cee: 4618 mov r0, r3 + 8005cf0: f7fe fe43 bl 800497a + 8005cf4: 4603 mov r3, r0 + 8005cf6: 429c cmp r4, r3 + 8005cf8: d004 beq.n 8005d04 + { + result = -3; //մ + 8005cfa: f06f 0302 mvn.w r3, #2 + 8005cfe: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005d02: e3fd b.n 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005d04: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005d08: 1c5a adds r2, r3, #1 + 8005d0a: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005d0e: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005d12: 4413 add r3, r2 + 8005d14: f813 3cfc ldrb.w r3, [r3, #-252] + 8005d18: 4618 mov r0, r3 + 8005d1a: f7fe fe05 bl 8004928 + 8005d1e: 4603 mov r3, r0 + 8005d20: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(addr)))) // ADDR_HL + 8005d24: f107 020c add.w r2, r7, #12 + 8005d28: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005d2c: 4413 add r3, r2 + 8005d2e: 781c ldrb r4, [r3, #0] + 8005d30: 463b mov r3, r7 + 8005d32: 881b ldrh r3, [r3, #0] + 8005d34: 0a1b lsrs r3, r3, #8 + 8005d36: b29b uxth r3, r3 + 8005d38: b2db uxtb r3, r3 + 8005d3a: f003 030f and.w r3, r3, #15 + 8005d3e: b2db uxtb r3, r3 + 8005d40: 4618 mov r0, r3 + 8005d42: f7fe fe1a bl 800497a + 8005d46: 4603 mov r3, r0 + 8005d48: 429c cmp r4, r3 + 8005d4a: d004 beq.n 8005d56 + { + result = -3; //մ + 8005d4c: f06f 0302 mvn.w r3, #2 + 8005d50: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005d54: e3d4 b.n 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005d56: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005d5a: 1c5a adds r2, r3, #1 + 8005d5c: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005d60: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005d64: 4413 add r3, r2 + 8005d66: f813 3cfc ldrb.w r3, [r3, #-252] + 8005d6a: 4618 mov r0, r3 + 8005d6c: f7fe fddc bl 8004928 + 8005d70: 4603 mov r3, r0 + 8005d72: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005d76: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005d7a: f003 030f and.w r3, r3, #15 + 8005d7e: b25a sxtb r2, r3 + 8005d80: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005d84: 011b lsls r3, r3, #4 + 8005d86: b2db uxtb r3, r3 + 8005d88: b25b sxtb r3, r3 + 8005d8a: 4313 orrs r3, r2 + 8005d8c: b25b sxtb r3, r3 + 8005d8e: b2da uxtb r2, r3 + 8005d90: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005d94: 4413 add r3, r2 + 8005d96: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(addr)))) // ADDR_LH + 8005d9a: f107 020c add.w r2, r7, #12 + 8005d9e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005da2: 4413 add r3, r2 + 8005da4: 781c ldrb r4, [r3, #0] + 8005da6: 463b mov r3, r7 + 8005da8: 881b ldrh r3, [r3, #0] + 8005daa: b2db uxtb r3, r3 + 8005dac: 091b lsrs r3, r3, #4 + 8005dae: b2db uxtb r3, r3 + 8005db0: 4618 mov r0, r3 + 8005db2: f7fe fde2 bl 800497a + 8005db6: 4603 mov r3, r0 + 8005db8: 429c cmp r4, r3 + 8005dba: d004 beq.n 8005dc6 + { + result = -3; //մ + 8005dbc: f06f 0302 mvn.w r3, #2 + 8005dc0: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005dc4: e39c b.n 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005dc6: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005dca: 1c5a adds r2, r3, #1 + 8005dcc: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005dd0: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005dd4: 4413 add r3, r2 + 8005dd6: f813 3cfc ldrb.w r3, [r3, #-252] + 8005dda: 4618 mov r0, r3 + 8005ddc: f7fe fda4 bl 8004928 + 8005de0: 4603 mov r3, r0 + 8005de2: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(addr)))) // ADDR_LL + 8005de6: f107 020c add.w r2, r7, #12 + 8005dea: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005dee: 4413 add r3, r2 + 8005df0: 781c ldrb r4, [r3, #0] + 8005df2: 463b mov r3, r7 + 8005df4: 881b ldrh r3, [r3, #0] + 8005df6: b2db uxtb r3, r3 + 8005df8: f003 030f and.w r3, r3, #15 + 8005dfc: b2db uxtb r3, r3 + 8005dfe: 4618 mov r0, r3 + 8005e00: f7fe fdbb bl 800497a + 8005e04: 4603 mov r3, r0 + 8005e06: 429c cmp r4, r3 + 8005e08: d004 beq.n 8005e14 + { + result = -3; //մ + 8005e0a: f06f 0302 mvn.w r3, #2 + 8005e0e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005e12: e375 b.n 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005e14: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005e18: 1c5a adds r2, r3, #1 + 8005e1a: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005e1e: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005e22: 4413 add r3, r2 + 8005e24: f813 3cfc ldrb.w r3, [r3, #-252] + 8005e28: 4618 mov r0, r3 + 8005e2a: f7fe fd7d bl 8004928 + 8005e2e: 4603 mov r3, r0 + 8005e30: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005e34: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005e38: f003 030f and.w r3, r3, #15 + 8005e3c: b25a sxtb r2, r3 + 8005e3e: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005e42: 011b lsls r3, r3, #4 + 8005e44: b2db uxtb r3, r3 + 8005e46: b25b sxtb r3, r3 + 8005e48: 4313 orrs r3, r2 + 8005e4a: b25b sxtb r3, r3 + 8005e4c: b2da uxtb r2, r3 + 8005e4e: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005e52: 4413 add r3, r2 + 8005e54: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(HIBYTE(len)))) // LEN_HH + 8005e58: f107 020c add.w r2, r7, #12 + 8005e5c: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005e60: 4413 add r3, r2 + 8005e62: 781c ldrb r4, [r3, #0] + 8005e64: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005e68: 0a1b lsrs r3, r3, #8 + 8005e6a: b29b uxth r3, r3 + 8005e6c: b2db uxtb r3, r3 + 8005e6e: 091b lsrs r3, r3, #4 + 8005e70: b2db uxtb r3, r3 + 8005e72: 4618 mov r0, r3 + 8005e74: f7fe fd81 bl 800497a + 8005e78: 4603 mov r3, r0 + 8005e7a: 429c cmp r4, r3 + 8005e7c: d004 beq.n 8005e88 + { + result = -3; //մ + 8005e7e: f06f 0302 mvn.w r3, #2 + 8005e82: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005e86: e33b b.n 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005e88: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005e8c: 1c5a adds r2, r3, #1 + 8005e8e: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005e92: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005e96: 4413 add r3, r2 + 8005e98: f813 3cfc ldrb.w r3, [r3, #-252] + 8005e9c: 4618 mov r0, r3 + 8005e9e: f7fe fd43 bl 8004928 + 8005ea2: 4603 mov r3, r0 + 8005ea4: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(HIBYTE(len)))) // LEN_HL + 8005ea8: f107 020c add.w r2, r7, #12 + 8005eac: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005eb0: 4413 add r3, r2 + 8005eb2: 781c ldrb r4, [r3, #0] + 8005eb4: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005eb8: 0a1b lsrs r3, r3, #8 + 8005eba: b29b uxth r3, r3 + 8005ebc: b2db uxtb r3, r3 + 8005ebe: f003 030f and.w r3, r3, #15 + 8005ec2: b2db uxtb r3, r3 + 8005ec4: 4618 mov r0, r3 + 8005ec6: f7fe fd58 bl 800497a + 8005eca: 4603 mov r3, r0 + 8005ecc: 429c cmp r4, r3 + 8005ece: d004 beq.n 8005eda + { + result = -3; //մ + 8005ed0: f06f 0302 mvn.w r3, #2 + 8005ed4: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005ed8: e312 b.n 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005eda: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005ede: 1c5a adds r2, r3, #1 + 8005ee0: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005ee4: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005ee8: 4413 add r3, r2 + 8005eea: f813 3cfc ldrb.w r3, [r3, #-252] + 8005eee: 4618 mov r0, r3 + 8005ef0: f7fe fd1a bl 8004928 + 8005ef4: 4603 mov r3, r0 + 8005ef6: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005efa: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005efe: f003 030f and.w r3, r3, #15 + 8005f02: b25a sxtb r2, r3 + 8005f04: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005f08: 011b lsls r3, r3, #4 + 8005f0a: b2db uxtb r3, r3 + 8005f0c: b25b sxtb r3, r3 + 8005f0e: 4313 orrs r3, r2 + 8005f10: b25b sxtb r3, r3 + 8005f12: b2da uxtb r2, r3 + 8005f14: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005f18: 4413 add r3, r2 + 8005f1a: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i] != RtuToAscii(HIHFBYTE(LOBYTE(len)))) // LEN_LH + 8005f1e: f107 020c add.w r2, r7, #12 + 8005f22: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005f26: 4413 add r3, r2 + 8005f28: 781c ldrb r4, [r3, #0] + 8005f2a: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005f2e: b2db uxtb r3, r3 + 8005f30: 091b lsrs r3, r3, #4 + 8005f32: b2db uxtb r3, r3 + 8005f34: 4618 mov r0, r3 + 8005f36: f7fe fd20 bl 800497a + 8005f3a: 4603 mov r3, r0 + 8005f3c: 429c cmp r4, r3 + 8005f3e: d004 beq.n 8005f4a + { + result = -3; //մ + 8005f40: f06f 0302 mvn.w r3, #2 + 8005f44: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005f48: e2da b.n 8006500 + } + temp_h = AsciiToRtu(pRDat[i++]); + 8005f4a: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005f4e: 1c5a adds r2, r3, #1 + 8005f50: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005f54: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005f58: 4413 add r3, r2 + 8005f5a: f813 3cfc ldrb.w r3, [r3, #-252] + 8005f5e: 4618 mov r0, r3 + 8005f60: f7fe fce2 bl 8004928 + 8005f64: 4603 mov r3, r0 + 8005f66: f887 30ef strb.w r3, [r7, #239] ; 0xef + if (pRDat[i] != RtuToAscii(LOHFBYTE(LOBYTE(len)))) // LEN_LL + 8005f6a: f107 020c add.w r2, r7, #12 + 8005f6e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005f72: 4413 add r3, r2 + 8005f74: 781c ldrb r4, [r3, #0] + 8005f76: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8005f7a: b2db uxtb r3, r3 + 8005f7c: f003 030f and.w r3, r3, #15 + 8005f80: b2db uxtb r3, r3 + 8005f82: 4618 mov r0, r3 + 8005f84: f7fe fcf9 bl 800497a + 8005f88: 4603 mov r3, r0 + 8005f8a: 429c cmp r4, r3 + 8005f8c: d004 beq.n 8005f98 + { + result = -3; //մ + 8005f8e: f06f 0302 mvn.w r3, #2 + 8005f92: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8005f96: e2b3 b.n 8006500 + } + temp_l = AsciiToRtu(pRDat[i++]); + 8005f98: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005f9c: 1c5a adds r2, r3, #1 + 8005f9e: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8005fa2: f507 7284 add.w r2, r7, #264 ; 0x108 + 8005fa6: 4413 add r3, r2 + 8005fa8: f813 3cfc ldrb.w r3, [r3, #-252] + 8005fac: 4618 mov r0, r3 + 8005fae: f7fe fcbb bl 8004928 + 8005fb2: 4603 mov r3, r0 + 8005fb4: f887 30ee strb.w r3, [r7, #238] ; 0xee + checksum += MAKEBYTE(temp_l,temp_h); + 8005fb8: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 8005fbc: f003 030f and.w r3, r3, #15 + 8005fc0: b25a sxtb r2, r3 + 8005fc2: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8005fc6: 011b lsls r3, r3, #4 + 8005fc8: b2db uxtb r3, r3 + 8005fca: b25b sxtb r3, r3 + 8005fcc: 4313 orrs r3, r2 + 8005fce: b25b sxtb r3, r3 + 8005fd0: b2da uxtb r2, r3 + 8005fd2: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8005fd6: 4413 add r3, r2 + 8005fd8: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + } + + if (cmd == MODBUS_RD || // + 8005fdc: 1cbb adds r3, r7, #2 + 8005fde: 781b ldrb r3, [r3, #0] + 8005fe0: 2b03 cmp r3, #3 + 8005fe2: d004 beq.n 8005fee + cmd == MODBUS_WR || // д + 8005fe4: 1cbb adds r3, r7, #2 + 8005fe6: 781b ldrb r3, [r3, #0] + 8005fe8: 2b06 cmp r3, #6 + 8005fea: f040 808b bne.w 8006104 + 0) + { + for (j = 0; j < len; j++) + 8005fee: 2300 movs r3, #0 + 8005ff0: f8c7 3100 str.w r3, [r7, #256] ; 0x100 + 8005ff4: e07f b.n 80060f6 + { + temp_h = AsciiToRtu(pRDat[i++]); + 8005ff6: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8005ffa: 1c5a adds r2, r3, #1 + 8005ffc: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006000: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006004: 4413 add r3, r2 + 8006006: f813 3cfc ldrb.w r3, [r3, #-252] + 800600a: 4618 mov r0, r3 + 800600c: f7fe fc8c bl 8004928 + 8006010: 4603 mov r3, r0 + 8006012: f887 30ef strb.w r3, [r7, #239] ; 0xef + temp_l = AsciiToRtu(pRDat[i++]); + 8006016: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 800601a: 1c5a adds r2, r3, #1 + 800601c: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006020: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006024: 4413 add r3, r2 + 8006026: f813 3cfc ldrb.w r3, [r3, #-252] + 800602a: 4618 mov r0, r3 + 800602c: f7fe fc7c bl 8004928 + 8006030: 4603 mov r3, r0 + 8006032: f887 30ee strb.w r3, [r7, #238] ; 0xee + tempH = MAKEBYTE(temp_l, temp_h); + 8006036: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 800603a: f003 030f and.w r3, r3, #15 + 800603e: b25a sxtb r2, r3 + 8006040: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 8006044: 011b lsls r3, r3, #4 + 8006046: b2db uxtb r3, r3 + 8006048: b25b sxtb r3, r3 + 800604a: 4313 orrs r3, r2 + 800604c: b25b sxtb r3, r3 + 800604e: f887 30ed strb.w r3, [r7, #237] ; 0xed + checksum += tempH; + 8006052: f897 20f3 ldrb.w r2, [r7, #243] ; 0xf3 + 8006056: f897 30ed ldrb.w r3, [r7, #237] ; 0xed + 800605a: 4413 add r3, r2 + 800605c: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + temp_h = AsciiToRtu(pRDat[i++]); + 8006060: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006064: 1c5a adds r2, r3, #1 + 8006066: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800606a: f507 7284 add.w r2, r7, #264 ; 0x108 + 800606e: 4413 add r3, r2 + 8006070: f813 3cfc ldrb.w r3, [r3, #-252] + 8006074: 4618 mov r0, r3 + 8006076: f7fe fc57 bl 8004928 + 800607a: 4603 mov r3, r0 + 800607c: f887 30ef strb.w r3, [r7, #239] ; 0xef + temp_l = AsciiToRtu(pRDat[i++]); + 8006080: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006084: 1c5a adds r2, r3, #1 + 8006086: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800608a: f507 7284 add.w r2, r7, #264 ; 0x108 + 800608e: 4413 add r3, r2 + 8006090: f813 3cfc ldrb.w r3, [r3, #-252] + 8006094: 4618 mov r0, r3 + 8006096: f7fe fc47 bl 8004928 + 800609a: 4603 mov r3, r0 + 800609c: f887 30ee strb.w r3, [r7, #238] ; 0xee + tempL = MAKEBYTE(temp_l, temp_h); + 80060a0: f997 30ee ldrsb.w r3, [r7, #238] ; 0xee + 80060a4: f003 030f and.w r3, r3, #15 + 80060a8: b25a sxtb r2, r3 + 80060aa: f897 30ef ldrb.w r3, [r7, #239] ; 0xef + 80060ae: 011b lsls r3, r3, #4 + 80060b0: b2db uxtb r3, r3 + 80060b2: b25b sxtb r3, r3 + 80060b4: 4313 orrs r3, r2 + 80060b6: b25b sxtb r3, r3 + 80060b8: f887 30ec strb.w r3, [r7, #236] ; 0xec + + checksum += tempL; + 80060bc: f897 20f3 ldrb.w r2, [r7, #243] ; 0xf3 + 80060c0: f897 30ec ldrb.w r3, [r7, #236] ; 0xec + 80060c4: 4413 add r3, r2 + 80060c6: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + pData[j] = MAKEWORD(tempL, tempH); + 80060ca: f897 30ec ldrb.w r3, [r7, #236] ; 0xec + 80060ce: b21a sxth r2, r3 + 80060d0: f897 30ed ldrb.w r3, [r7, #237] ; 0xed + 80060d4: 021b lsls r3, r3, #8 + 80060d6: b21b sxth r3, r3 + 80060d8: 4313 orrs r3, r2 + 80060da: b219 sxth r1, r3 + 80060dc: f8d7 3100 ldr.w r3, [r7, #256] ; 0x100 + 80060e0: 005b lsls r3, r3, #1 + 80060e2: f8d7 2118 ldr.w r2, [r7, #280] ; 0x118 + 80060e6: 4413 add r3, r2 + 80060e8: b28a uxth r2, r1 + 80060ea: 801a strh r2, [r3, #0] + for (j = 0; j < len; j++) + 80060ec: f8d7 3100 ldr.w r3, [r7, #256] ; 0x100 + 80060f0: 3301 adds r3, #1 + 80060f2: f8c7 3100 str.w r3, [r7, #256] ; 0x100 + 80060f6: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 80060fa: f8d7 2100 ldr.w r2, [r7, #256] ; 0x100 + 80060fe: 429a cmp r2, r3 + 8006100: f6ff af79 blt.w 8005ff6 + } + } + + checksum = ~checksum + 1; + 8006104: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8006108: 425b negs r3, r3 + 800610a: f887 30f3 strb.w r3, [r7, #243] ; 0xf3 + + if (pRDat[i++] != RtuToAscii(HIHFBYTE(checksum))) // LRC_H + 800610e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006112: 1c5a adds r2, r3, #1 + 8006114: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006118: f507 7284 add.w r2, r7, #264 ; 0x108 + 800611c: 4413 add r3, r2 + 800611e: f813 4cfc ldrb.w r4, [r3, #-252] + 8006122: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8006126: 091b lsrs r3, r3, #4 + 8006128: b2db uxtb r3, r3 + 800612a: 4618 mov r0, r3 + 800612c: f7fe fc25 bl 800497a + 8006130: 4603 mov r3, r0 + 8006132: 429c cmp r4, r3 + 8006134: d004 beq.n 8006140 + { + result = -3; //մ + 8006136: f06f 0302 mvn.w r3, #2 + 800613a: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800613e: e1df b.n 8006500 + } + if (pRDat[i++] != RtuToAscii(LOHFBYTE(checksum))) // LRC_L + 8006140: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006144: 1c5a adds r2, r3, #1 + 8006146: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800614a: f507 7284 add.w r2, r7, #264 ; 0x108 + 800614e: 4413 add r3, r2 + 8006150: f813 4cfc ldrb.w r4, [r3, #-252] + 8006154: f897 30f3 ldrb.w r3, [r7, #243] ; 0xf3 + 8006158: f003 030f and.w r3, r3, #15 + 800615c: b2db uxtb r3, r3 + 800615e: 4618 mov r0, r3 + 8006160: f7fe fc0b bl 800497a + 8006164: 4603 mov r3, r0 + 8006166: 429c cmp r4, r3 + 8006168: d004 beq.n 8006174 + { + result = -3; //մ + 800616a: f06f 0302 mvn.w r3, #2 + 800616e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006172: e1c5 b.n 8006500 + } + if (pRDat[i++] != '\r') // CR + 8006174: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006178: 1c5a adds r2, r3, #1 + 800617a: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800617e: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006182: 4413 add r3, r2 + 8006184: f813 3cfc ldrb.w r3, [r3, #-252] + 8006188: 2b0d cmp r3, #13 + 800618a: f040 81b2 bne.w 80064f2 + { + // result = -3; //մ + break; + } + if (pRDat[i++] != '\n') // LF + 800618e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006192: 1c5a adds r2, r3, #1 + 8006194: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006198: f507 7284 add.w r2, r7, #264 ; 0x108 + 800619c: 4413 add r3, r2 + 800619e: f813 3cfc ldrb.w r3, [r3, #-252] + 80061a2: 2b0a cmp r3, #10 + 80061a4: f040 81a7 bne.w 80064f6 + { + //result = -3; //մ + break; + } + + if (result == 0) + 80061a8: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 80061ac: 2b00 cmp r3, #0 + 80061ae: f040 81a4 bne.w 80064fa + { + result = len; + 80061b2: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 80061b6: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + } + break; + 80061ba: e19e b.n 80064fa + } + else // RTU ģʽ + { + // ݰ + result = 0; + 80061bc: 2300 movs r3, #0 + 80061be: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + i = 0; + 80061c2: 2300 movs r3, #0 + 80061c4: f8c7 3104 str.w r3, [r7, #260] ; 0x104 + + if (pRDat[i++] != index) // վַ + 80061c8: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80061cc: 1c5a adds r2, r3, #1 + 80061ce: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80061d2: f507 7284 add.w r2, r7, #264 ; 0x108 + 80061d6: 4413 add r3, r2 + 80061d8: f813 3cfc ldrb.w r3, [r3, #-252] + 80061dc: 1cfa adds r2, r7, #3 + 80061de: 7812 ldrb r2, [r2, #0] + 80061e0: 429a cmp r2, r3 + 80061e2: d004 beq.n 80061ee + { + result = -3; // մ + 80061e4: f06f 0302 mvn.w r3, #2 + 80061e8: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80061ec: e188 b.n 8006500 + } + + if (pRDat[i++] != cmd) + 80061ee: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80061f2: 1c5a adds r2, r3, #1 + 80061f4: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80061f8: f507 7284 add.w r2, r7, #264 ; 0x108 + 80061fc: 4413 add r3, r2 + 80061fe: f813 3cfc ldrb.w r3, [r3, #-252] + 8006202: 1cba adds r2, r7, #2 + 8006204: 7812 ldrb r2, [r2, #0] + 8006206: 429a cmp r2, r3 + 8006208: d004 beq.n 8006214 + { + result = -3; // մ + 800620a: f06f 0302 mvn.w r3, #2 + 800620e: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006212: e175 b.n 8006500 + } + + if (cmd == MODBUS_RD) // + 8006214: 1cbb adds r3, r7, #2 + 8006216: 781b ldrb r3, [r3, #0] + 8006218: 2b03 cmp r3, #3 + 800621a: d116 bne.n 800624a + { + if (pRDat[i++] != (LOBYTE(len) << 1)) // LEN + 800621c: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006220: 1c5a adds r2, r3, #1 + 8006222: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006226: f507 7284 add.w r2, r7, #264 ; 0x108 + 800622a: 4413 add r3, r2 + 800622c: f813 3cfc ldrb.w r3, [r3, #-252] + 8006230: 461a mov r2, r3 + 8006232: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8006236: b2db uxtb r3, r3 + 8006238: 005b lsls r3, r3, #1 + 800623a: 429a cmp r2, r3 + 800623c: f000 808b beq.w 8006356 + { + result = -3; // մ + 8006240: f06f 0302 mvn.w r3, #2 + 8006244: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006248: e15a b.n 8006500 + } + } + else if (cmd == MODBUS_WR) // д + 800624a: 1cbb adds r3, r7, #2 + 800624c: 781b ldrb r3, [r3, #0] + 800624e: 2b06 cmp r3, #6 + 8006250: d129 bne.n 80062a6 + { + if (pRDat[i++] != HIBYTE(addr)) // ADDR_H + 8006252: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006256: 1c5a adds r2, r3, #1 + 8006258: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800625c: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006260: 4413 add r3, r2 + 8006262: f813 2cfc ldrb.w r2, [r3, #-252] + 8006266: 463b mov r3, r7 + 8006268: 881b ldrh r3, [r3, #0] + 800626a: 0a1b lsrs r3, r3, #8 + 800626c: b29b uxth r3, r3 + 800626e: b2db uxtb r3, r3 + 8006270: 429a cmp r2, r3 + 8006272: d004 beq.n 800627e + { + result = -3; // մ + 8006274: f06f 0302 mvn.w r3, #2 + 8006278: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800627c: e140 b.n 8006500 + } + + if (pRDat[i++] != LOBYTE(addr)) // ADDR_L + 800627e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006282: 1c5a adds r2, r3, #1 + 8006284: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006288: f507 7284 add.w r2, r7, #264 ; 0x108 + 800628c: 4413 add r3, r2 + 800628e: f813 2cfc ldrb.w r2, [r3, #-252] + 8006292: 463b mov r3, r7 + 8006294: 881b ldrh r3, [r3, #0] + 8006296: b2db uxtb r3, r3 + 8006298: 429a cmp r2, r3 + 800629a: d05c beq.n 8006356 + { + result = -3; // մ + 800629c: f06f 0302 mvn.w r3, #2 + 80062a0: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80062a4: e12c b.n 8006500 + } + } + else if (cmd == MODBUS_WR_MULTI) // д + 80062a6: 1cbb adds r3, r7, #2 + 80062a8: 781b ldrb r3, [r3, #0] + 80062aa: 2b10 cmp r3, #16 + 80062ac: d153 bne.n 8006356 + { + if (pRDat[i++] != HIBYTE(addr)) // ADDR_H + 80062ae: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80062b2: 1c5a adds r2, r3, #1 + 80062b4: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80062b8: f507 7284 add.w r2, r7, #264 ; 0x108 + 80062bc: 4413 add r3, r2 + 80062be: f813 2cfc ldrb.w r2, [r3, #-252] + 80062c2: 463b mov r3, r7 + 80062c4: 881b ldrh r3, [r3, #0] + 80062c6: 0a1b lsrs r3, r3, #8 + 80062c8: b29b uxth r3, r3 + 80062ca: b2db uxtb r3, r3 + 80062cc: 429a cmp r2, r3 + 80062ce: d004 beq.n 80062da + { + result = -3; // մ + 80062d0: f06f 0302 mvn.w r3, #2 + 80062d4: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80062d8: e112 b.n 8006500 + } + + if (pRDat[i++] != LOBYTE(addr)) // ADDR_L + 80062da: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80062de: 1c5a adds r2, r3, #1 + 80062e0: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80062e4: f507 7284 add.w r2, r7, #264 ; 0x108 + 80062e8: 4413 add r3, r2 + 80062ea: f813 2cfc ldrb.w r2, [r3, #-252] + 80062ee: 463b mov r3, r7 + 80062f0: 881b ldrh r3, [r3, #0] + 80062f2: b2db uxtb r3, r3 + 80062f4: 429a cmp r2, r3 + 80062f6: d004 beq.n 8006302 + { + result = -3; // մ + 80062f8: f06f 0302 mvn.w r3, #2 + 80062fc: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006300: e0fe b.n 8006500 + } + + if (pRDat[i++] != HIBYTE(len)) // LEN_H + 8006302: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006306: 1c5a adds r2, r3, #1 + 8006308: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 800630c: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006310: 4413 add r3, r2 + 8006312: f813 2cfc ldrb.w r2, [r3, #-252] + 8006316: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 800631a: 0a1b lsrs r3, r3, #8 + 800631c: b29b uxth r3, r3 + 800631e: b2db uxtb r3, r3 + 8006320: 429a cmp r2, r3 + 8006322: d004 beq.n 800632e + { + result = -3; // մ + 8006324: f06f 0302 mvn.w r3, #2 + 8006328: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800632c: e0e8 b.n 8006500 + } + + if (pRDat[i++] != LOBYTE(len)) // LEN_L + 800632e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006332: 1c5a adds r2, r3, #1 + 8006334: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006338: f507 7284 add.w r2, r7, #264 ; 0x108 + 800633c: 4413 add r3, r2 + 800633e: f813 2cfc ldrb.w r2, [r3, #-252] + 8006342: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 8006346: b2db uxtb r3, r3 + 8006348: 429a cmp r2, r3 + 800634a: d004 beq.n 8006356 + { + result = -3; // մ + 800634c: f06f 0302 mvn.w r3, #2 + 8006350: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006354: e0d4 b.n 8006500 + } + } + + if (cmd == MODBUS_RD || // + 8006356: 1cbb adds r3, r7, #2 + 8006358: 781b ldrb r3, [r3, #0] + 800635a: 2b03 cmp r3, #3 + 800635c: d003 beq.n 8006366 + cmd == MODBUS_WR || // д + 800635e: 1cbb adds r3, r7, #2 + 8006360: 781b ldrb r3, [r3, #0] + 8006362: 2b06 cmp r3, #6 + 8006364: d12e bne.n 80063c4 + 0) + { + for (j = 0; j < len; j++) + 8006366: 2300 movs r3, #0 + 8006368: f8c7 3100 str.w r3, [r7, #256] ; 0x100 + 800636c: e024 b.n 80063b8 + { + pData[j] = MAKEWORD(pRDat[i+1], pRDat[i]); + 800636e: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006372: 3301 adds r3, #1 + 8006374: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006378: 4413 add r3, r2 + 800637a: f813 3cfc ldrb.w r3, [r3, #-252] + 800637e: b21a sxth r2, r3 + 8006380: f107 010c add.w r1, r7, #12 + 8006384: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 8006388: 440b add r3, r1 + 800638a: 781b ldrb r3, [r3, #0] + 800638c: 021b lsls r3, r3, #8 + 800638e: b21b sxth r3, r3 + 8006390: 4313 orrs r3, r2 + 8006392: b219 sxth r1, r3 + 8006394: f8d7 3100 ldr.w r3, [r7, #256] ; 0x100 + 8006398: 005b lsls r3, r3, #1 + 800639a: f8d7 2118 ldr.w r2, [r7, #280] ; 0x118 + 800639e: 4413 add r3, r2 + 80063a0: b28a uxth r2, r1 + 80063a2: 801a strh r2, [r3, #0] + i += 2; + 80063a4: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80063a8: 3302 adds r3, #2 + 80063aa: f8c7 3104 str.w r3, [r7, #260] ; 0x104 + for (j = 0; j < len; j++) + 80063ae: f8d7 3100 ldr.w r3, [r7, #256] ; 0x100 + 80063b2: 3301 adds r3, #1 + 80063b4: f8c7 3100 str.w r3, [r7, #256] ; 0x100 + 80063b8: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 80063bc: f8d7 2100 ldr.w r2, [r7, #256] ; 0x100 + 80063c0: 429a cmp r2, r3 + 80063c2: dbd4 blt.n 800636e + } + } + + checkcrc = ModbusCrc16(&pRDat[0], i); + 80063c4: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80063c8: b29a uxth r2, r3 + 80063ca: f107 030c add.w r3, r7, #12 + 80063ce: 4611 mov r1, r2 + 80063d0: 4618 mov r0, r3 + 80063d2: f7fe fb11 bl 80049f8 + 80063d6: 4603 mov r3, r0 + 80063d8: f8a7 30f0 strh.w r3, [r7, #240] ; 0xf0 + + if (pRDat[i++] != HIBYTE(checkcrc)) // LRC_H + 80063dc: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 80063e0: 1c5a adds r2, r3, #1 + 80063e2: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 80063e6: f507 7284 add.w r2, r7, #264 ; 0x108 + 80063ea: 4413 add r3, r2 + 80063ec: f813 2cfc ldrb.w r2, [r3, #-252] + 80063f0: f8b7 30f0 ldrh.w r3, [r7, #240] ; 0xf0 + 80063f4: 0a1b lsrs r3, r3, #8 + 80063f6: b29b uxth r3, r3 + 80063f8: b2db uxtb r3, r3 + 80063fa: 429a cmp r2, r3 + 80063fc: d004 beq.n 8006408 + { + result = -3; // մ + 80063fe: f06f 0302 mvn.w r3, #2 + 8006402: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006406: e07b b.n 8006500 + } + + if (pRDat[i++] != LOBYTE(checkcrc)) // LRC_L + 8006408: f8d7 3104 ldr.w r3, [r7, #260] ; 0x104 + 800640c: 1c5a adds r2, r3, #1 + 800640e: f8c7 2104 str.w r2, [r7, #260] ; 0x104 + 8006412: f507 7284 add.w r2, r7, #264 ; 0x108 + 8006416: 4413 add r3, r2 + 8006418: f813 2cfc ldrb.w r2, [r3, #-252] + 800641c: f8b7 30f0 ldrh.w r3, [r7, #240] ; 0xf0 + 8006420: b2db uxtb r3, r3 + 8006422: 429a cmp r2, r3 + 8006424: d004 beq.n 8006430 + { + result = -3; // մ + 8006426: f06f 0302 mvn.w r3, #2 + 800642a: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800642e: e067 b.n 8006500 + } + + if (result == 0) + 8006430: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8006434: 2b00 cmp r3, #0 + 8006436: d162 bne.n 80064fe + { + result = len; + 8006438: f8b7 311c ldrh.w r3, [r7, #284] ; 0x11c + 800643c: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + } + break; + 8006440: e05d b.n 80064fe + } + } + else if (result < 0) + 8006442: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8006446: 2b00 cmp r3, #0 + 8006448: da1e bge.n 8006488 + { + if (result == -1) // + 800644a: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800644e: f1b3 3fff cmp.w r3, #4294967295 + 8006452: d103 bne.n 800645c + { + printf("para error\r\n"); + 8006454: 4833 ldr r0, [pc, #204] ; (8006524 ) + 8006456: f003 facd bl 80099f4 + 800645a: e010 b.n 800647e + } + else if (result == -2) // ûгʼ + 800645c: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8006460: f113 0f02 cmn.w r3, #2 + 8006464: d103 bne.n 800646e + { + printf("usart is not inited\r\n"); + 8006466: 4830 ldr r0, [pc, #192] ; (8006528 ) + 8006468: f003 fac4 bl 80099f4 + 800646c: e007 b.n 800647e + } + else if (result == -3) // ջƴ + 800646e: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8006472: f113 0f03 cmn.w r3, #3 + 8006476: d102 bne.n 800647e + { + printf("usart receive buf ctrl error\r\n"); + 8006478: 482c ldr r0, [pc, #176] ; (800652c ) + 800647a: f003 fabb bl 80099f4 + } + else + { + } + result = -4; + 800647e: f06f 0303 mvn.w r3, #3 + 8006482: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 8006486: e03b b.n 8006500 + } + else if (result > 0) + 8006488: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 800648c: 2b00 cmp r3, #0 + 800648e: dd07 ble.n 80064a0 + { + printf("receive data len error\r\n"); + 8006490: 4827 ldr r0, [pc, #156] ; (8006530 ) + 8006492: f003 faaf bl 80099f4 + result = -3; + 8006496: f06f 0302 mvn.w r3, #2 + 800649a: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 800649e: e02f b.n 8006500 + } + else // result == 0 + { + } + + if (steps == -1) + 80064a0: f8d7 3120 ldr.w r3, [r7, #288] ; 0x120 + 80064a4: f1b3 3fff cmp.w r3, #4294967295 + 80064a8: d11f bne.n 80064ea + { + // ȴ + DelayUs(g_modBusMCtrl[midx].modBusWait); + 80064aa: 4922 ldr r1, [pc, #136] ; (8006534 ) + 80064ac: 1d3b adds r3, r7, #4 + 80064ae: 681a ldr r2, [r3, #0] + 80064b0: 4613 mov r3, r2 + 80064b2: 00db lsls r3, r3, #3 + 80064b4: 4413 add r3, r2 + 80064b6: 009b lsls r3, r3, #2 + 80064b8: 440b add r3, r1 + 80064ba: 3308 adds r3, #8 + 80064bc: 681b ldr r3, [r3, #0] + 80064be: 4618 mov r0, r3 + 80064c0: f7fd f8aa bl 8003618 + + if (timeout-- <= 0) + 80064c4: f8d7 30f4 ldr.w r3, [r7, #244] ; 0xf4 + 80064c8: 1e5a subs r2, r3, #1 + 80064ca: f8c7 20f4 str.w r2, [r7, #244] ; 0xf4 + 80064ce: 2b00 cmp r3, #0 + 80064d0: f73f a9a8 bgt.w 8005824 + { + printf("2. call ModbusRx timeout, index=%d\r\n", index); + 80064d4: 1cfb adds r3, r7, #3 + 80064d6: 781b ldrb r3, [r3, #0] + 80064d8: 4619 mov r1, r3 + 80064da: 4817 ldr r0, [pc, #92] ; (8006538 ) + 80064dc: f003 fa16 bl 800990c + result = -2; //ճʱ + 80064e0: f06f 0301 mvn.w r3, #1 + 80064e4: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80064e8: e00a b.n 8006500 + } + } + else + { + result = 0; + 80064ea: 2300 movs r3, #0 + 80064ec: f8c7 30fc str.w r3, [r7, #252] ; 0xfc + break; + 80064f0: e006 b.n 8006500 + break; + 80064f2: bf00 nop + 80064f4: e004 b.n 8006500 + break; + 80064f6: bf00 nop + 80064f8: e002 b.n 8006500 + break; + 80064fa: bf00 nop + 80064fc: e000 b.n 8006500 + break; + 80064fe: bf00 nop + } + + }while(1); + } + + if (result == -3) // մ + 8006500: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc + 8006504: f113 0f03 cmn.w r3, #3 + 8006508: d105 bne.n 8006516 + { + printf("Rx data error, index=%d\r\n", index); + 800650a: 1cfb adds r3, r7, #3 + 800650c: 781b ldrb r3, [r3, #0] + 800650e: 4619 mov r1, r3 + 8006510: 480a ldr r0, [pc, #40] ; (800653c ) + 8006512: f003 f9fb bl 800990c + } + + return result; + 8006516: f8d7 30fc ldr.w r3, [r7, #252] ; 0xfc +} + 800651a: 4618 mov r0, r3 + 800651c: f507 7786 add.w r7, r7, #268 ; 0x10c + 8006520: 46bd mov sp, r7 + 8006522: bd90 pop {r4, r7, pc} + 8006524: 0800ac60 .word 0x0800ac60 + 8006528: 0800ac6c .word 0x0800ac6c + 800652c: 0800ac84 .word 0x0800ac84 + 8006530: 0800aca4 .word 0x0800aca4 + 8006534: 20001354 .word 0x20001354 + 8006538: 0800acbc .word 0x0800acbc + 800653c: 0800ace4 .word 0x0800ace4 + +08006540 : +//----------------------------------------------------------------- + +Rs485Ctrl g_rs485Ctrl; + +void InitRs485Ctrl(int rsvtimout) +{ + 8006540: b580 push {r7, lr} + 8006542: b082 sub sp, #8 + 8006544: af00 add r7, sp, #0 + 8006546: 6078 str r0, [r7, #4] + memset(&g_rs485Ctrl, 0, sizeof(Rs485Ctrl)); + 8006548: f240 5204 movw r2, #1284 ; 0x504 + 800654c: 2100 movs r1, #0 + 800654e: 480e ldr r0, [pc, #56] ; (8006588 ) + 8006550: f003 f9d3 bl 80098fa + + // ȡʱʱ + if (rsvtimout < 50) + 8006554: 687b ldr r3, [r7, #4] + 8006556: 2b31 cmp r3, #49 ; 0x31 + 8006558: dc04 bgt.n 8006564 + { + g_rs485Ctrl.modrsvTimout = 50; + 800655a: 4b0b ldr r3, [pc, #44] ; (8006588 ) + 800655c: 2232 movs r2, #50 ; 0x32 + 800655e: f8c3 2500 str.w r2, [r3, #1280] ; 0x500 + } + else + { + g_rs485Ctrl.modrsvTimout = rsvtimout; + } +} + 8006562: e00d b.n 8006580 + else if (rsvtimout > 500) + 8006564: 687b ldr r3, [r7, #4] + 8006566: f5b3 7ffa cmp.w r3, #500 ; 0x1f4 + 800656a: dd05 ble.n 8006578 + g_rs485Ctrl.modrsvTimout = 500; + 800656c: 4b06 ldr r3, [pc, #24] ; (8006588 ) + 800656e: f44f 72fa mov.w r2, #500 ; 0x1f4 + 8006572: f8c3 2500 str.w r2, [r3, #1280] ; 0x500 +} + 8006576: e003 b.n 8006580 + g_rs485Ctrl.modrsvTimout = rsvtimout; + 8006578: 4a03 ldr r2, [pc, #12] ; (8006588 ) + 800657a: 687b ldr r3, [r7, #4] + 800657c: f8c2 3500 str.w r3, [r2, #1280] ; 0x500 +} + 8006580: bf00 nop + 8006582: 3708 adds r7, #8 + 8006584: 46bd mov sp, r7 + 8006586: bd80 pop {r7, pc} + 8006588: 20001378 .word 0x20001378 + +0800658c : + +void RegRsCmdProc(Resv485ExProc proc) +{ + 800658c: b480 push {r7} + 800658e: b083 sub sp, #12 + 8006590: af00 add r7, sp, #0 + 8006592: 6078 str r0, [r7, #4] + g_rs485Ctrl.resv485exproc = proc; + 8006594: 4a04 ldr r2, [pc, #16] ; (80065a8 ) + 8006596: 687b ldr r3, [r7, #4] + 8006598: f8c2 34fc str.w r3, [r2, #1276] ; 0x4fc +} + 800659c: bf00 nop + 800659e: 370c adds r7, #12 + 80065a0: 46bd mov sp, r7 + 80065a2: bc80 pop {r7} + 80065a4: 4770 bx lr + 80065a6: bf00 nop + 80065a8: 20001378 .word 0x20001378 + +080065ac : + +int AddRs485Cmd(Rs485Cmd * pCmd) +{ + 80065ac: b580 push {r7, lr} + 80065ae: b084 sub sp, #16 + 80065b0: af00 add r7, sp, #0 + 80065b2: 6078 str r0, [r7, #4] + Rs485Ctrl * p485Ctrl = &g_rs485Ctrl; + 80065b4: 4b22 ldr r3, [pc, #136] ; (8006640 ) + 80065b6: 60fb str r3, [r7, #12] + + if (p485Ctrl != NULL && pCmd != NULL) + 80065b8: 68fb ldr r3, [r7, #12] + 80065ba: 2b00 cmp r3, #0 + 80065bc: d039 beq.n 8006632 + 80065be: 687b ldr r3, [r7, #4] + 80065c0: 2b00 cmp r3, #0 + 80065c2: d036 beq.n 8006632 + { + if (p485Ctrl->bufCmdNum < MAX_485CMD && p485Ctrl->bufTail < MAX_485CMD) + 80065c4: 68fb ldr r3, [r7, #12] + 80065c6: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + 80065ca: 2b13 cmp r3, #19 + 80065cc: dc2e bgt.n 800662c + 80065ce: 68fb ldr r3, [r7, #12] + 80065d0: f8d3 34f0 ldr.w r3, [r3, #1264] ; 0x4f0 + 80065d4: 2b13 cmp r3, #19 + 80065d6: dc29 bgt.n 800662c + { + memcpy(&(p485Ctrl->cmdbuf[p485Ctrl->bufTail]), pCmd, sizeof(Rs485Cmd)); + 80065d8: 68fb ldr r3, [r7, #12] + 80065da: f8d3 34f0 ldr.w r3, [r3, #1264] ; 0x4f0 + 80065de: 2232 movs r2, #50 ; 0x32 + 80065e0: fb02 f303 mul.w r3, r2, r3 + 80065e4: 33f8 adds r3, #248 ; 0xf8 + 80065e6: 68fa ldr r2, [r7, #12] + 80065e8: 4413 add r3, r2 + 80065ea: 3304 adds r3, #4 + 80065ec: 2232 movs r2, #50 ; 0x32 + 80065ee: 6879 ldr r1, [r7, #4] + 80065f0: 4618 mov r0, r3 + 80065f2: f003 f977 bl 80098e4 + p485Ctrl->bufTail++; + 80065f6: 68fb ldr r3, [r7, #12] + 80065f8: f8d3 34f0 ldr.w r3, [r3, #1264] ; 0x4f0 + 80065fc: 1c5a adds r2, r3, #1 + 80065fe: 68fb ldr r3, [r7, #12] + 8006600: f8c3 24f0 str.w r2, [r3, #1264] ; 0x4f0 + if (p485Ctrl->bufTail >= MAX_485CMD) + 8006604: 68fb ldr r3, [r7, #12] + 8006606: f8d3 34f0 ldr.w r3, [r3, #1264] ; 0x4f0 + 800660a: 2b13 cmp r3, #19 + 800660c: dd03 ble.n 8006616 + { + p485Ctrl->bufTail = 0; + 800660e: 68fb ldr r3, [r7, #12] + 8006610: 2200 movs r2, #0 + 8006612: f8c3 24f0 str.w r2, [r3, #1264] ; 0x4f0 + } + p485Ctrl->bufCmdNum++; + 8006616: 68fb ldr r3, [r7, #12] + 8006618: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + 800661c: 1c5a adds r2, r3, #1 + 800661e: 68fb ldr r3, [r7, #12] + 8006620: f8c3 24e8 str.w r2, [r3, #1256] ; 0x4e8 + return p485Ctrl->bufCmdNum; + 8006624: 68fb ldr r3, [r7, #12] + 8006626: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + 800662a: e004 b.n 8006636 + } + return -2; + 800662c: f06f 0301 mvn.w r3, #1 + 8006630: e001 b.n 8006636 + } + + return -1; + 8006632: f04f 33ff mov.w r3, #4294967295 +} + 8006636: 4618 mov r0, r3 + 8006638: 3710 adds r7, #16 + 800663a: 46bd mov sp, r7 + 800663c: bd80 pop {r7, pc} + 800663e: bf00 nop + 8006640: 20001378 .word 0x20001378 + +08006644 : +{ + return g_rs485Ctrl.bufCmdNum; +} + +int Rs485Task(void) +{ + 8006644: b5f0 push {r4, r5, r6, r7, lr} + 8006646: b089 sub sp, #36 ; 0x24 + 8006648: af04 add r7, sp, #16 + int rslt; + u32 curIime; + + Rs485Cmd *pCmd; + + Rs485Ctrl * p485Ctrl = &g_rs485Ctrl; + 800664a: 4ba6 ldr r3, [pc, #664] ; (80068e4 ) + 800664c: 60bb str r3, [r7, #8] + + if (p485Ctrl == NULL) + 800664e: 68bb ldr r3, [r7, #8] + 8006650: 2b00 cmp r3, #0 + 8006652: d102 bne.n 800665a + { + return -1; + 8006654: f04f 33ff mov.w r3, #4294967295 + 8006658: e140 b.n 80068dc + } + + pCmd = &(p485Ctrl->cmdbuf[p485Ctrl->bufHead]); + 800665a: 68bb ldr r3, [r7, #8] + 800665c: f8d3 34ec ldr.w r3, [r3, #1260] ; 0x4ec + 8006660: 2232 movs r2, #50 ; 0x32 + 8006662: fb02 f303 mul.w r3, r2, r3 + 8006666: 33f8 adds r3, #248 ; 0xf8 + 8006668: 68ba ldr r2, [r7, #8] + 800666a: 4413 add r3, r2 + 800666c: 3304 adds r3, #4 + 800666e: 607b str r3, [r7, #4] + + // ȡǰʱ + curIime = GetUsSoftTimer(); + 8006670: f7fe f8c4 bl 80047fc + 8006674: 6038 str r0, [r7, #0] + + if ((curIime - p485Ctrl->stepTime) > g_modBusMCtrl[pCmd->midx].modBusWait) + 8006676: 68bb ldr r3, [r7, #8] + 8006678: f8d3 34f8 ldr.w r3, [r3, #1272] ; 0x4f8 + 800667c: 683a ldr r2, [r7, #0] + 800667e: 1ad2 subs r2, r2, r3 + 8006680: 687b ldr r3, [r7, #4] + 8006682: 781b ldrb r3, [r3, #0] + 8006684: 4618 mov r0, r3 + 8006686: 4998 ldr r1, [pc, #608] ; (80068e8 ) + 8006688: 4603 mov r3, r0 + 800668a: 00db lsls r3, r3, #3 + 800668c: 4403 add r3, r0 + 800668e: 009b lsls r3, r3, #2 + 8006690: 440b add r3, r1 + 8006692: 3308 adds r3, #8 + 8006694: 681b ldr r3, [r3, #0] + 8006696: 429a cmp r2, r3 + 8006698: f240 811d bls.w 80068d6 + { + p485Ctrl->stepTime = curIime; + 800669c: 68bb ldr r3, [r7, #8] + 800669e: 683a ldr r2, [r7, #0] + 80066a0: f8c3 24f8 str.w r2, [r3, #1272] ; 0x4f8 + + if (p485Ctrl->working == 0 && + 80066a4: 68bb ldr r3, [r7, #8] + 80066a6: f8d3 34e4 ldr.w r3, [r3, #1252] ; 0x4e4 + 80066aa: 2b00 cmp r3, #0 + 80066ac: d111 bne.n 80066d2 + p485Ctrl->bufCmdNum > 0 && + 80066ae: 68bb ldr r3, [r7, #8] + 80066b0: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + if (p485Ctrl->working == 0 && + 80066b4: 2b00 cmp r3, #0 + 80066b6: dd0c ble.n 80066d2 + p485Ctrl->steps == 0) + 80066b8: 68bb ldr r3, [r7, #8] + 80066ba: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + p485Ctrl->bufCmdNum > 0 && + 80066be: 2b00 cmp r3, #0 + 80066c0: d107 bne.n 80066d2 + { + p485Ctrl->working = 1; + 80066c2: 68bb ldr r3, [r7, #8] + 80066c4: 2201 movs r2, #1 + 80066c6: f8c3 24e4 str.w r2, [r3, #1252] ; 0x4e4 + p485Ctrl->steps = 1; + 80066ca: 68bb ldr r3, [r7, #8] + 80066cc: 2201 movs r2, #1 + 80066ce: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + } + + if (p485Ctrl->working == 0) + 80066d2: 68bb ldr r3, [r7, #8] + 80066d4: f8d3 34e4 ldr.w r3, [r3, #1252] ; 0x4e4 + 80066d8: 2b00 cmp r3, #0 + 80066da: d105 bne.n 80066e8 + { + p485Ctrl->steps = 0; + 80066dc: 68bb ldr r3, [r7, #8] + 80066de: 2200 movs r2, #0 + 80066e0: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + return 0; + 80066e4: 2300 movs r3, #0 + 80066e6: e0f9 b.n 80068dc + } + + if (p485Ctrl->steps > 0 && p485Ctrl->steps < 5) + 80066e8: 68bb ldr r3, [r7, #8] + 80066ea: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 80066ee: 2b00 cmp r3, #0 + 80066f0: dd4a ble.n 8006788 + 80066f2: 68bb ldr r3, [r7, #8] + 80066f4: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 80066f8: 2b04 cmp r3, #4 + 80066fa: dc45 bgt.n 8006788 + { + if (pCmd->cmd == MODBUS_RD) + 80066fc: 687b ldr r3, [r7, #4] + 80066fe: 789b ldrb r3, [r3, #2] + 8006700: 2b03 cmp r3, #3 + 8006702: d118 bne.n 8006736 + { + rslt = ModbusTx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, &(pCmd->rlen), 1, p485Ctrl->steps); + 8006704: 687b ldr r3, [r7, #4] + 8006706: 781b ldrb r3, [r3, #0] + 8006708: 461d mov r5, r3 + 800670a: 687b ldr r3, [r7, #4] + 800670c: 7859 ldrb r1, [r3, #1] + 800670e: 687b ldr r3, [r7, #4] + 8006710: 7898 ldrb r0, [r3, #2] + 8006712: 687b ldr r3, [r7, #4] + 8006714: 889c ldrh r4, [r3, #4] + 8006716: 687b ldr r3, [r7, #4] + 8006718: 3330 adds r3, #48 ; 0x30 + 800671a: 68ba ldr r2, [r7, #8] + 800671c: f8d2 24f4 ldr.w r2, [r2, #1268] ; 0x4f4 + 8006720: 9202 str r2, [sp, #8] + 8006722: 2201 movs r2, #1 + 8006724: 9201 str r2, [sp, #4] + 8006726: 9300 str r3, [sp, #0] + 8006728: 4623 mov r3, r4 + 800672a: 4602 mov r2, r0 + 800672c: 4628 mov r0, r5 + 800672e: f7fe fb35 bl 8004d9c + 8006732: 60f8 str r0, [r7, #12] + 8006734: e019 b.n 800676a + } + else + { + rslt = ModbusTx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->wrdat, pCmd->wlen, p485Ctrl->steps); + 8006736: 687b ldr r3, [r7, #4] + 8006738: 781b ldrb r3, [r3, #0] + 800673a: 461e mov r6, r3 + 800673c: 687b ldr r3, [r7, #4] + 800673e: 7858 ldrb r0, [r3, #1] + 8006740: 687b ldr r3, [r7, #4] + 8006742: 789c ldrb r4, [r3, #2] + 8006744: 687b ldr r3, [r7, #4] + 8006746: 889d ldrh r5, [r3, #4] + 8006748: 687b ldr r3, [r7, #4] + 800674a: 3306 adds r3, #6 + 800674c: 687a ldr r2, [r7, #4] + 800674e: 8b52 ldrh r2, [r2, #26] + 8006750: 68b9 ldr r1, [r7, #8] + 8006752: f8d1 14f4 ldr.w r1, [r1, #1268] ; 0x4f4 + 8006756: 9102 str r1, [sp, #8] + 8006758: 9201 str r2, [sp, #4] + 800675a: 9300 str r3, [sp, #0] + 800675c: 462b mov r3, r5 + 800675e: 4622 mov r2, r4 + 8006760: 4601 mov r1, r0 + 8006762: 4630 mov r0, r6 + 8006764: f7fe fb1a bl 8004d9c + 8006768: 60f8 str r0, [r7, #12] + } + + if (rslt == p485Ctrl->steps) + 800676a: 68bb ldr r3, [r7, #8] + 800676c: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 8006770: 68fa ldr r2, [r7, #12] + 8006772: 429a cmp r2, r3 + 8006774: f040 8083 bne.w 800687e + { + p485Ctrl->steps++; + 8006778: 68bb ldr r3, [r7, #8] + 800677a: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 800677e: 1c5a adds r2, r3, #1 + 8006780: 68bb ldr r3, [r7, #8] + 8006782: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + if (rslt == p485Ctrl->steps) + 8006786: e07a b.n 800687e + } + } + else if (p485Ctrl->steps >= 5 && p485Ctrl->steps < p485Ctrl->modrsvTimout) + 8006788: 68bb ldr r3, [r7, #8] + 800678a: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 800678e: 2b04 cmp r3, #4 + 8006790: dd6e ble.n 8006870 + 8006792: 68bb ldr r3, [r7, #8] + 8006794: f8d3 24f4 ldr.w r2, [r3, #1268] ; 0x4f4 + 8006798: 68bb ldr r3, [r7, #8] + 800679a: f8d3 3500 ldr.w r3, [r3, #1280] ; 0x500 + 800679e: 429a cmp r2, r3 + 80067a0: da66 bge.n 8006870 + { + // ȴذ + if (pCmd->index != 0 && + 80067a2: 687b ldr r3, [r7, #4] + 80067a4: 785b ldrb r3, [r3, #1] + 80067a6: 2b00 cmp r3, #0 + 80067a8: d05a beq.n 8006860 + ((pCmd->index & 0x80) == 0 || pCmd->cmd == MODBUS_RD) && + 80067aa: 687b ldr r3, [r7, #4] + 80067ac: 785b ldrb r3, [r3, #1] + 80067ae: b25b sxtb r3, r3 + 80067b0: 2b00 cmp r3, #0 + 80067b2: da03 bge.n 80067bc + 80067b4: 687b ldr r3, [r7, #4] + 80067b6: 789b ldrb r3, [r3, #2] + 80067b8: 2b03 cmp r3, #3 + 80067ba: d151 bne.n 8006860 + 1) + { + if (pCmd->cmd == MODBUS_RD) + 80067bc: 687b ldr r3, [r7, #4] + 80067be: 789b ldrb r3, [r3, #2] + 80067c0: 2b03 cmp r3, #3 + 80067c2: d118 bne.n 80067f6 + { + rslt = ModbusRx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->rddat, pCmd->rlen, 1); + 80067c4: 687b ldr r3, [r7, #4] + 80067c6: 781b ldrb r3, [r3, #0] + 80067c8: 461e mov r6, r3 + 80067ca: 687b ldr r3, [r7, #4] + 80067cc: 7858 ldrb r0, [r3, #1] + 80067ce: 687b ldr r3, [r7, #4] + 80067d0: 789c ldrb r4, [r3, #2] + 80067d2: 687b ldr r3, [r7, #4] + 80067d4: 889d ldrh r5, [r3, #4] + 80067d6: 687b ldr r3, [r7, #4] + 80067d8: 331c adds r3, #28 + 80067da: 687a ldr r2, [r7, #4] + 80067dc: 8e12 ldrh r2, [r2, #48] ; 0x30 + 80067de: 2101 movs r1, #1 + 80067e0: 9102 str r1, [sp, #8] + 80067e2: 9201 str r2, [sp, #4] + 80067e4: 9300 str r3, [sp, #0] + 80067e6: 462b mov r3, r5 + 80067e8: 4622 mov r2, r4 + 80067ea: 4601 mov r1, r0 + 80067ec: 4630 mov r0, r6 + 80067ee: f7fe feff bl 80055f0 + 80067f2: 60f8 str r0, [r7, #12] + 80067f4: e015 b.n 8006822 + } + else + { + rslt = ModbusRx(pCmd->midx, pCmd->index, pCmd->cmd, pCmd->addr, pCmd->rddat, 1, 1); + 80067f6: 687b ldr r3, [r7, #4] + 80067f8: 781b ldrb r3, [r3, #0] + 80067fa: 461d mov r5, r3 + 80067fc: 687b ldr r3, [r7, #4] + 80067fe: 7859 ldrb r1, [r3, #1] + 8006800: 687b ldr r3, [r7, #4] + 8006802: 7898 ldrb r0, [r3, #2] + 8006804: 687b ldr r3, [r7, #4] + 8006806: 889c ldrh r4, [r3, #4] + 8006808: 687b ldr r3, [r7, #4] + 800680a: 331c adds r3, #28 + 800680c: 2201 movs r2, #1 + 800680e: 9202 str r2, [sp, #8] + 8006810: 2201 movs r2, #1 + 8006812: 9201 str r2, [sp, #4] + 8006814: 9300 str r3, [sp, #0] + 8006816: 4623 mov r3, r4 + 8006818: 4602 mov r2, r0 + 800681a: 4628 mov r0, r5 + 800681c: f7fe fee8 bl 80055f0 + 8006820: 60f8 str r0, [r7, #12] + } + if (rslt == pCmd->rlen) // ȷ + 8006822: 687b ldr r3, [r7, #4] + 8006824: 8e1b ldrh r3, [r3, #48] ; 0x30 + 8006826: 461a mov r2, r3 + 8006828: 68fb ldr r3, [r7, #12] + 800682a: 4293 cmp r3, r2 + 800682c: d110 bne.n 8006850 + { + // ִжݺ + if (p485Ctrl->resv485exproc != NULL) + 800682e: 68bb ldr r3, [r7, #8] + 8006830: f8d3 34fc ldr.w r3, [r3, #1276] ; 0x4fc + 8006834: 2b00 cmp r3, #0 + 8006836: d004 beq.n 8006842 + { + p485Ctrl->resv485exproc(pCmd); + 8006838: 68bb ldr r3, [r7, #8] + 800683a: f8d3 34fc ldr.w r3, [r3, #1276] ; 0x4fc + 800683e: 6878 ldr r0, [r7, #4] + 8006840: 4798 blx r3 + } + p485Ctrl->steps = p485Ctrl->modrsvTimout; + 8006842: 68bb ldr r3, [r7, #8] + 8006844: f8d3 2500 ldr.w r2, [r3, #1280] ; 0x500 + 8006848: 68bb ldr r3, [r7, #8] + 800684a: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + if (rslt == pCmd->rlen) // ȷ + 800684e: e00e b.n 800686e + } + else + { + p485Ctrl->steps++; + 8006850: 68bb ldr r3, [r7, #8] + 8006852: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 8006856: 1c5a adds r2, r3, #1 + 8006858: 68bb ldr r3, [r7, #8] + 800685a: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + if (rslt == pCmd->rlen) // ȷ + 800685e: e006 b.n 800686e + } + } + else + { + p485Ctrl->steps = p485Ctrl->modrsvTimout; + 8006860: 68bb ldr r3, [r7, #8] + 8006862: f8d3 2500 ldr.w r2, [r3, #1280] ; 0x500 + 8006866: 68bb ldr r3, [r7, #8] + 8006868: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + if (pCmd->index != 0 && + 800686c: e007 b.n 800687e + 800686e: e006 b.n 800687e + } + } + else + { + p485Ctrl->steps++; + 8006870: 68bb ldr r3, [r7, #8] + 8006872: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 + 8006876: 1c5a adds r2, r3, #1 + 8006878: 68bb ldr r3, [r7, #8] + 800687a: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + } + + if (p485Ctrl->steps >= p485Ctrl->modrsvTimout) + 800687e: 68bb ldr r3, [r7, #8] + 8006880: f8d3 24f4 ldr.w r2, [r3, #1268] ; 0x4f4 + 8006884: 68bb ldr r3, [r7, #8] + 8006886: f8d3 3500 ldr.w r3, [r3, #1280] ; 0x500 + 800688a: 429a cmp r2, r3 + 800688c: db23 blt.n 80068d6 + { + if (p485Ctrl->bufCmdNum > 0) + 800688e: 68bb ldr r3, [r7, #8] + 8006890: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + 8006894: 2b00 cmp r3, #0 + 8006896: dd06 ble.n 80068a6 + { + p485Ctrl->bufCmdNum--; + 8006898: 68bb ldr r3, [r7, #8] + 800689a: f8d3 34e8 ldr.w r3, [r3, #1256] ; 0x4e8 + 800689e: 1e5a subs r2, r3, #1 + 80068a0: 68bb ldr r3, [r7, #8] + 80068a2: f8c3 24e8 str.w r2, [r3, #1256] ; 0x4e8 + } + p485Ctrl->steps = 0; + 80068a6: 68bb ldr r3, [r7, #8] + 80068a8: 2200 movs r2, #0 + 80068aa: f8c3 24f4 str.w r2, [r3, #1268] ; 0x4f4 + p485Ctrl->working = 0; + 80068ae: 68bb ldr r3, [r7, #8] + 80068b0: 2200 movs r2, #0 + 80068b2: f8c3 24e4 str.w r2, [r3, #1252] ; 0x4e4 + p485Ctrl->bufHead++; + 80068b6: 68bb ldr r3, [r7, #8] + 80068b8: f8d3 34ec ldr.w r3, [r3, #1260] ; 0x4ec + 80068bc: 1c5a adds r2, r3, #1 + 80068be: 68bb ldr r3, [r7, #8] + 80068c0: f8c3 24ec str.w r2, [r3, #1260] ; 0x4ec + if (p485Ctrl->bufHead >= MAX_485CMD) + 80068c4: 68bb ldr r3, [r7, #8] + 80068c6: f8d3 34ec ldr.w r3, [r3, #1260] ; 0x4ec + 80068ca: 2b13 cmp r3, #19 + 80068cc: dd03 ble.n 80068d6 + { + p485Ctrl->bufHead = 0; + 80068ce: 68bb ldr r3, [r7, #8] + 80068d0: 2200 movs r2, #0 + 80068d2: f8c3 24ec str.w r2, [r3, #1260] ; 0x4ec + } + } + } + return p485Ctrl->steps; + 80068d6: 68bb ldr r3, [r7, #8] + 80068d8: f8d3 34f4 ldr.w r3, [r3, #1268] ; 0x4f4 +} + 80068dc: 4618 mov r0, r3 + 80068de: 3714 adds r7, #20 + 80068e0: 46bd mov sp, r7 + 80068e2: bdf0 pop {r4, r5, r6, r7, pc} + 80068e4: 20001378 .word 0x20001378 + 80068e8: 20001354 .word 0x20001354 + +080068ec : + +#include "trigger.h" +#include "workctrl.h" + +void AppMainTask(void) +{ + 80068ec: b580 push {r7, lr} + 80068ee: af00 add r7, sp, #0 + InitTrigger(); // ʼʱ + 80068f0: f7fd fe9e bl 8004630 + + InitWorkCtrl(); // ʼ + 80068f4: f002 fb14 bl 8008f20 + + do + { + TriggerTask(); // + 80068f8: f7fd ff20 bl 800473c + + + WorkCtrlTask(); + 80068fc: f002 fb3c bl 8008f78 + TriggerTask(); // + 8006900: e7fa b.n 80068f8 + +08006902 : +{ + 8006902: b480 push {r7} + 8006904: b083 sub sp, #12 + 8006906: af00 add r7, sp, #0 + 8006908: 6078 str r0, [r7, #4] + SET_BIT(TIMx->CR1, TIM_CR1_CEN); + 800690a: 687b ldr r3, [r7, #4] + 800690c: 681b ldr r3, [r3, #0] + 800690e: f043 0201 orr.w r2, r3, #1 + 8006912: 687b ldr r3, [r7, #4] + 8006914: 601a str r2, [r3, #0] +} + 8006916: bf00 nop + 8006918: 370c adds r7, #12 + 800691a: 46bd mov sp, r7 + 800691c: bc80 pop {r7} + 800691e: 4770 bx lr + +08006920 : +{ + 8006920: b480 push {r7} + 8006922: b083 sub sp, #12 + 8006924: af00 add r7, sp, #0 + 8006926: 6078 str r0, [r7, #4] + CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN); + 8006928: 687b ldr r3, [r7, #4] + 800692a: 681b ldr r3, [r3, #0] + 800692c: f023 0201 bic.w r2, r3, #1 + 8006930: 687b ldr r3, [r7, #4] + 8006932: 601a str r2, [r3, #0] +} + 8006934: bf00 nop + 8006936: 370c adds r7, #12 + 8006938: 46bd mov sp, r7 + 800693a: bc80 pop {r7} + 800693c: 4770 bx lr + +0800693e : +{ + 800693e: b480 push {r7} + 8006940: b083 sub sp, #12 + 8006942: af00 add r7, sp, #0 + 8006944: 6078 str r0, [r7, #4] + SET_BIT(TIMx->DIER, TIM_DIER_UIE); + 8006946: 687b ldr r3, [r7, #4] + 8006948: 68db ldr r3, [r3, #12] + 800694a: f043 0201 orr.w r2, r3, #1 + 800694e: 687b ldr r3, [r7, #4] + 8006950: 60da str r2, [r3, #12] +} + 8006952: bf00 nop + 8006954: 370c adds r7, #12 + 8006956: 46bd mov sp, r7 + 8006958: bc80 pop {r7} + 800695a: 4770 bx lr + +0800695c : + +HeadCtrl g_headCtrl; + +//------------------------------------------------------------------------------- +u8 GetBoardSwitchValue(void) +{ + 800695c: b580 push {r7, lr} + 800695e: b082 sub sp, #8 + 8006960: af00 add r7, sp, #0 + u8 val = 0; + 8006962: 2300 movs r3, #0 + 8006964: 71fb strb r3, [r7, #7] + if(GetSwitch1Status() == SENSOR_ON) + 8006966: f002 fdbd bl 80094e4 + 800696a: 4603 mov r3, r0 + 800696c: 2b00 cmp r3, #0 + 800696e: d103 bne.n 8006978 + { + val |= 0x01; + 8006970: 79fb ldrb r3, [r7, #7] + 8006972: f043 0301 orr.w r3, r3, #1 + 8006976: 71fb strb r3, [r7, #7] + } + if(GetSwitch2Status() == SENSOR_ON) + 8006978: f002 fdc2 bl 8009500 + 800697c: 4603 mov r3, r0 + 800697e: 2b00 cmp r3, #0 + 8006980: d103 bne.n 800698a + { + val |= 0x02; + 8006982: 79fb ldrb r3, [r7, #7] + 8006984: f043 0302 orr.w r3, r3, #2 + 8006988: 71fb strb r3, [r7, #7] + } + if(GetSwitch3Status() == SENSOR_ON) + 800698a: f002 fdc7 bl 800951c + 800698e: 4603 mov r3, r0 + 8006990: 2b00 cmp r3, #0 + 8006992: d103 bne.n 800699c + { + val |= 0x04; + 8006994: 79fb ldrb r3, [r7, #7] + 8006996: f043 0304 orr.w r3, r3, #4 + 800699a: 71fb strb r3, [r7, #7] + } + if(GetSwitch4Status() == SENSOR_ON) + 800699c: f002 fdcc bl 8009538 + 80069a0: 4603 mov r3, r0 + 80069a2: 2b00 cmp r3, #0 + 80069a4: d103 bne.n 80069ae + { + val |= 0x08; + 80069a6: 79fb ldrb r3, [r7, #7] + 80069a8: f043 0308 orr.w r3, r3, #8 + 80069ac: 71fb strb r3, [r7, #7] + } + return val; + 80069ae: 79fb ldrb r3, [r7, #7] +} + 80069b0: 4618 mov r0, r3 + 80069b2: 3708 adds r7, #8 + 80069b4: 46bd mov sp, r7 + 80069b6: bd80 pop {r7, pc} + +080069b8 : + +// ʼ +void InitSewHeadBoard(void) +{ + 80069b8: b580 push {r7, lr} + 80069ba: b084 sub sp, #16 + 80069bc: af04 add r7, sp, #16 + memset(&g_headCtrl, 0, sizeof(HeadCtrl)); + 80069be: f242 4218 movw r2, #9240 ; 0x2418 + 80069c2: 2100 movs r1, #0 + 80069c4: 4833 ldr r0, [pc, #204] ; (8006a94 ) + 80069c6: f002 ff98 bl 80098fa + g_headCtrl.boardId = GetBoardSwitchValue(); + 80069ca: f7ff ffc7 bl 800695c + 80069ce: 4603 mov r3, r0 + 80069d0: 461a mov r2, r3 + 80069d2: 4b30 ldr r3, [pc, #192] ; (8006a94 ) + 80069d4: 701a strb r2, [r3, #0] + + if((g_headCtrl.boardId & 0x04) == 0) + 80069d6: 4b2f ldr r3, [pc, #188] ; (8006a94 ) + 80069d8: 781b ldrb r3, [r3, #0] + 80069da: f003 0304 and.w r3, r3, #4 + 80069de: 2b00 cmp r3, #0 + 80069e0: d108 bne.n 80069f4 + { + InitSoftPwmCtrl(PwmCtrlTask); + 80069e2: 482d ldr r0, [pc, #180] ; (8006a98 ) + 80069e4: f000 f87a bl 8006adc +#if(PWM_TIMER_CTRL == 1) + g_headCtrl.pwmOutputFlag = 1; + 80069e8: 4b2a ldr r3, [pc, #168] ; (8006a94 ) + 80069ea: 2201 movs r2, #1 + 80069ec: 711a strb r2, [r3, #4] +#endif + printf("initsoftpwmctrl."); + 80069ee: 482b ldr r0, [pc, #172] ; (8006a9c ) + 80069f0: f002 ff8c bl 800990c + InitModbusSCtrl(D29_BOARD_ID,30); // modbus(հʱʱ:2ms) + + RegModbusSCmdProc(ModBusCmdProcTask); // ⲿ + +#endif + InitModbus_m(0,COMM_USART3, B115200, '8', 'N', '1','R'); // ʼ485 + 80069f4: 2352 movs r3, #82 ; 0x52 + 80069f6: 9302 str r3, [sp, #8] + 80069f8: 2331 movs r3, #49 ; 0x31 + 80069fa: 9301 str r3, [sp, #4] + 80069fc: 234e movs r3, #78 ; 0x4e + 80069fe: 9300 str r3, [sp, #0] + 8006a00: 2338 movs r3, #56 ; 0x38 + 8006a02: f44f 32e1 mov.w r2, #115200 ; 0x1c200 + 8006a06: 2103 movs r1, #3 + 8006a08: 2000 movs r0, #0 + 8006a0a: f7fe f81f bl 8004a4c + InitRs485Ctrl(MODRSV_TIMEOUT); + 8006a0e: f44f 704d mov.w r0, #820 ; 0x334 + 8006a12: f7ff fd95 bl 8006540 + RegRsCmdProc(ModBusReceiveProc); + 8006a16: 4822 ldr r0, [pc, #136] ; (8006aa0 ) + 8006a18: f7ff fdb8 bl 800658c + + CheckParasValue(); + 8006a1c: f000 fab4 bl 8006f88 + g_headCtrl.pfootFlLowPos = g_headCtrl.pfootRunLowPos; + 8006a20: 4b1c ldr r3, [pc, #112] ; (8006a94 ) + 8006a22: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006a26: 331c adds r3, #28 + 8006a28: 681a ldr r2, [r3, #0] + 8006a2a: 4b1a ldr r3, [pc, #104] ; (8006a94 ) + 8006a2c: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006a30: 3314 adds r3, #20 + 8006a32: 601a str r2, [r3, #0] + g_headCtrl.enflag = EN_FALG; + 8006a34: 4b17 ldr r3, [pc, #92] ; (8006a94 ) + 8006a36: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8006a3a: 3330 adds r3, #48 ; 0x30 + 8006a3c: f245 52aa movw r2, #21930 ; 0x55aa + 8006a40: 601a str r2, [r3, #0] + g_headCtrl.FollowMotoPulseOn = FollowEcdOutPulseOn; + 8006a42: 4b14 ldr r3, [pc, #80] ; (8006a94 ) + 8006a44: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006a48: 332c adds r3, #44 ; 0x2c + 8006a4a: 4a16 ldr r2, [pc, #88] ; (8006aa4 ) + 8006a4c: 601a str r2, [r3, #0] + g_headCtrl.FollowMotoPulseOff = FollowEcdOutPulseOff; + 8006a4e: 4b11 ldr r3, [pc, #68] ; (8006a94 ) + 8006a50: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006a54: 3330 adds r3, #48 ; 0x30 + 8006a56: 4a14 ldr r2, [pc, #80] ; (8006aa8 ) + 8006a58: 601a str r2, [r3, #0] + g_headCtrl.FollowMotoSignOn = FollowEcdOutDirOn; + 8006a5a: 4b0e ldr r3, [pc, #56] ; (8006a94 ) + 8006a5c: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006a60: 3334 adds r3, #52 ; 0x34 + 8006a62: 4a12 ldr r2, [pc, #72] ; (8006aac ) + 8006a64: 601a str r2, [r3, #0] + g_headCtrl.FollowMotoSignOff = FollowEcdOutDirOff; + 8006a66: 4b0b ldr r3, [pc, #44] ; (8006a94 ) + 8006a68: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006a6c: 3338 adds r3, #56 ; 0x38 + 8006a6e: 4a10 ldr r2, [pc, #64] ; (8006ab0 ) + 8006a70: 601a str r2, [r3, #0] + DelayRef(500); + 8006a72: f44f 70fa mov.w r0, #500 ; 0x1f4 + 8006a76: f002 fa6b bl 8008f50 + FootMotoToZero(); + 8006a7a: f000 f901 bl 8006c80 + SetEn485OutOff(); + 8006a7e: f002 fad9 bl 8009034 + + AddShellCmd("KEY", "test action", TestAction); + 8006a82: 4a0c ldr r2, [pc, #48] ; (8006ab4 ) + 8006a84: 490c ldr r1, [pc, #48] ; (8006ab8 ) + 8006a86: 480d ldr r0, [pc, #52] ; (8006abc ) + 8006a88: f7fd fd16 bl 80044b8 +} + 8006a8c: bf00 nop + 8006a8e: 46bd mov sp, r7 + 8006a90: bd80 pop {r7, pc} + 8006a92: bf00 nop + 8006a94: 2000187c .word 0x2000187c + 8006a98: 08006b11 .word 0x08006b11 + 8006a9c: 0800ad00 .word 0x0800ad00 + 8006aa0: 08006c0d .word 0x08006c0d + 8006aa4: 08006d6d .word 0x08006d6d + 8006aa8: 08006ed1 .word 0x08006ed1 + 8006aac: 08006f21 .word 0x08006f21 + 8006ab0: 08006f55 .word 0x08006f55 + 8006ab4: 080075c1 .word 0x080075c1 + 8006ab8: 0800ad14 .word 0x0800ad14 + 8006abc: 0800ad20 .word 0x0800ad20 + +08006ac0 : + +#endif +} + +void SoftPwmIntProc(void) +{ + 8006ac0: b580 push {r7, lr} + 8006ac2: af00 add r7, sp, #0 +#if(PWM_TIMER_CTRL == 1) + if (D29PwmProc != NULL) + 8006ac4: 4b04 ldr r3, [pc, #16] ; (8006ad8 ) + 8006ac6: 681b ldr r3, [r3, #0] + 8006ac8: 2b00 cmp r3, #0 + 8006aca: d002 beq.n 8006ad2 + { + D29PwmProc(); + 8006acc: 4b02 ldr r3, [pc, #8] ; (8006ad8 ) + 8006ace: 681b ldr r3, [r3, #0] + 8006ad0: 4798 blx r3 + { + D29PwmProc(); + } + } +#endif +} + 8006ad2: bf00 nop + 8006ad4: bd80 pop {r7, pc} + 8006ad6: bf00 nop + 8006ad8: 20000578 .word 0x20000578 + +08006adc : + +void InitSoftPwmCtrl(PwmFunc proc) +{ + 8006adc: b480 push {r7} + 8006ade: b083 sub sp, #12 + 8006ae0: af00 add r7, sp, #0 + 8006ae2: 6078 str r0, [r7, #4] +// InitSTM32PwmTimer(); +#if(PWM_TIMER_CTRL == 1) +// Tim1IntProc = SoftPwmIntProc; + D29PwmProc = proc; + 8006ae4: 4a08 ldr r2, [pc, #32] ; (8006b08 ) + 8006ae6: 687b ldr r3, [r7, #4] + 8006ae8: 6013 str r3, [r2, #0] + g_headCtrl.pwmFreq = 100; + 8006aea: 4b08 ldr r3, [pc, #32] ; (8006b0c ) + 8006aec: 2264 movs r2, #100 ; 0x64 + 8006aee: 811a strh r2, [r3, #8] + g_headCtrl.pwmCount = 0; + 8006af0: 4b06 ldr r3, [pc, #24] ; (8006b0c ) + 8006af2: 2200 movs r2, #0 + 8006af4: 815a strh r2, [r3, #10] + g_headCtrl.pwmCtrl = 0; // ʼռձΪ0 + 8006af6: 4b05 ldr r3, [pc, #20] ; (8006b0c ) + 8006af8: 2200 movs r2, #0 + 8006afa: 80da strh r2, [r3, #6] + Tim3IntProc = SoftPwmIntProc; + D29PwmProc = proc; + g_headCtrl.pwmCtrl = 0; + g_headCtrl.pwmFreq = 3334; +#endif +} + 8006afc: bf00 nop + 8006afe: 370c adds r7, #12 + 8006b00: 46bd mov sp, r7 + 8006b02: bc80 pop {r7} + 8006b04: 4770 bx lr + 8006b06: bf00 nop + 8006b08: 20000578 .word 0x20000578 + 8006b0c: 2000187c .word 0x2000187c + +08006b10 : + +void PwmCtrlTask(void) +{ + 8006b10: b580 push {r7, lr} + 8006b12: af00 add r7, sp, #0 +#if(PWM_TIMER_CTRL == 1) + if(g_headCtrl.pwmCount < g_headCtrl.pwmCtrl) + 8006b14: 4b24 ldr r3, [pc, #144] ; (8006ba8 ) + 8006b16: 895a ldrh r2, [r3, #10] + 8006b18: 4b23 ldr r3, [pc, #140] ; (8006ba8 ) + 8006b1a: 88db ldrh r3, [r3, #6] + 8006b1c: 429a cmp r2, r3 + 8006b1e: d20a bcs.n 8006b36 + { + g_headCtrl.pwmCount ++; + 8006b20: 4b21 ldr r3, [pc, #132] ; (8006ba8 ) + 8006b22: 895b ldrh r3, [r3, #10] + 8006b24: 3301 adds r3, #1 + 8006b26: b29a uxth r2, r3 + 8006b28: 4b1f ldr r3, [pc, #124] ; (8006ba8 ) + 8006b2a: 815a strh r2, [r3, #10] +// if((g_headCtrl.pwmIOSta & 0x20) != 0) + { + SetOutputPWM1On(); + 8006b2c: f002 fb0a bl 8009144 + SetOutputPWM2On(); + 8006b30: f002 fb20 bl 8009174 +// g_headCtrl.timeCount = 0; +// +// printf("timer 1s,time:%d,pwmƵ = %dHz,pwmռձ %d.\r\n",ntime,1000000/g_headCtrl.pwmFreq,g_headCtrl.pwmCtrl); +// } +#endif +} + 8006b34: e035 b.n 8006ba2 + else if(g_headCtrl.pwmCount < g_headCtrl.pwmFreq) + 8006b36: 4b1c ldr r3, [pc, #112] ; (8006ba8 ) + 8006b38: 895a ldrh r2, [r3, #10] + 8006b3a: 4b1b ldr r3, [pc, #108] ; (8006ba8 ) + 8006b3c: 891b ldrh r3, [r3, #8] + 8006b3e: 429a cmp r2, r3 + 8006b40: d22c bcs.n 8006b9c + g_headCtrl.pwmCount ++; + 8006b42: 4b19 ldr r3, [pc, #100] ; (8006ba8 ) + 8006b44: 895b ldrh r3, [r3, #10] + 8006b46: 3301 adds r3, #1 + 8006b48: b29a uxth r2, r3 + 8006b4a: 4b17 ldr r3, [pc, #92] ; (8006ba8 ) + 8006b4c: 815a strh r2, [r3, #10] + if(g_headCtrl.pwmCount >= g_headCtrl.pwmFreq) + 8006b4e: 4b16 ldr r3, [pc, #88] ; (8006ba8 ) + 8006b50: 895a ldrh r2, [r3, #10] + 8006b52: 4b15 ldr r3, [pc, #84] ; (8006ba8 ) + 8006b54: 891b ldrh r3, [r3, #8] + 8006b56: 429a cmp r2, r3 + 8006b58: d31b bcc.n 8006b92 + g_headCtrl.pwmCount = 0; + 8006b5a: 4b13 ldr r3, [pc, #76] ; (8006ba8 ) + 8006b5c: 2200 movs r2, #0 + 8006b5e: 815a strh r2, [r3, #10] + if(g_headCtrl.timeCount != 0) + 8006b60: 4b11 ldr r3, [pc, #68] ; (8006ba8 ) + 8006b62: 68db ldr r3, [r3, #12] + 8006b64: 2b00 cmp r3, #0 + 8006b66: d014 beq.n 8006b92 + if(g_headCtrl.timeCount == 1) + 8006b68: 4b0f ldr r3, [pc, #60] ; (8006ba8 ) + 8006b6a: 68db ldr r3, [r3, #12] + 8006b6c: 2b01 cmp r3, #1 + 8006b6e: d104 bne.n 8006b7a + g_headCtrl.pwmPulsTime = GetUsSoftTimer(); + 8006b70: f7fd fe44 bl 80047fc + 8006b74: 4602 mov r2, r0 + 8006b76: 4b0c ldr r3, [pc, #48] ; (8006ba8 ) + 8006b78: 611a str r2, [r3, #16] + g_headCtrl.timeCount ++; + 8006b7a: 4b0b ldr r3, [pc, #44] ; (8006ba8 ) + 8006b7c: 68db ldr r3, [r3, #12] + 8006b7e: 3301 adds r3, #1 + 8006b80: 4a09 ldr r2, [pc, #36] ; (8006ba8 ) + 8006b82: 60d3 str r3, [r2, #12] + if(g_headCtrl.timeCount >= 11) + 8006b84: 4b08 ldr r3, [pc, #32] ; (8006ba8 ) + 8006b86: 68db ldr r3, [r3, #12] + 8006b88: 2b0a cmp r3, #10 + 8006b8a: d902 bls.n 8006b92 + g_headCtrl.timeCount = 0; + 8006b8c: 4b06 ldr r3, [pc, #24] ; (8006ba8 ) + 8006b8e: 2200 movs r2, #0 + 8006b90: 60da str r2, [r3, #12] + SetOutputPWM1Off(); + 8006b92: f002 fae3 bl 800915c + SetOutputPWM2Off(); + 8006b96: f002 faf9 bl 800918c +} + 8006b9a: e002 b.n 8006ba2 + g_headCtrl.pwmCount = 0; + 8006b9c: 4b02 ldr r3, [pc, #8] ; (8006ba8 ) + 8006b9e: 2200 movs r2, #0 + 8006ba0: 815a strh r2, [r3, #10] +} + 8006ba2: bf00 nop + 8006ba4: bd80 pop {r7, pc} + 8006ba6: bf00 nop + 8006ba8: 2000187c .word 0x2000187c + +08006bac : + + +void SysLedTask(void) +{ + 8006bac: b580 push {r7, lr} + 8006bae: af00 add r7, sp, #0 + static u32 ledsta = 0; + static u32 ledtime = 0; + if(GetMsSoftTimer10() - ledtime >= 1000) + 8006bb0: f7fd fe52 bl 8004858 + 8006bb4: 4602 mov r2, r0 + 8006bb6: 4b0e ldr r3, [pc, #56] ; (8006bf0 ) + 8006bb8: 681b ldr r3, [r3, #0] + 8006bba: 1ad3 subs r3, r2, r3 + 8006bbc: f5b3 7f7a cmp.w r3, #1000 ; 0x3e8 + 8006bc0: d313 bcc.n 8006bea + { + if(ledsta == 0) + 8006bc2: 4b0c ldr r3, [pc, #48] ; (8006bf4 ) + 8006bc4: 681b ldr r3, [r3, #0] + 8006bc6: 2b00 cmp r3, #0 + 8006bc8: d105 bne.n 8006bd6 + { + SetSysLedOn(); + 8006bca: f002 faa3 bl 8009114 + ledsta = 1; + 8006bce: 4b09 ldr r3, [pc, #36] ; (8006bf4 ) + 8006bd0: 2201 movs r2, #1 + 8006bd2: 601a str r2, [r3, #0] + 8006bd4: e004 b.n 8006be0 + } + else + { + SetSysLedOff(); + 8006bd6: f002 faa9 bl 800912c + ledsta = 0; + 8006bda: 4b06 ldr r3, [pc, #24] ; (8006bf4 ) + 8006bdc: 2200 movs r2, #0 + 8006bde: 601a str r2, [r3, #0] + } + ledtime = GetMsSoftTimer10(); + 8006be0: f7fd fe3a bl 8004858 + 8006be4: 4602 mov r2, r0 + 8006be6: 4b02 ldr r3, [pc, #8] ; (8006bf0 ) + 8006be8: 601a str r2, [r3, #0] + } +} + 8006bea: bf00 nop + 8006bec: bd80 pop {r7, pc} + 8006bee: bf00 nop + 8006bf0: 2000057c .word 0x2000057c + 8006bf4: 20000580 .word 0x20000580 + +08006bf8 : + + +void SewHeadBoardTask(void) +{ + 8006bf8: b580 push {r7, lr} + 8006bfa: af00 add r7, sp, #0 + //SetParasTask(); + Rs485Task(); + 8006bfc: f7ff fd22 bl 8006644 +#if(CONTROL_BUS == COMM_485) + ModbusSTask(); +#endif + InOutStaRefreshTask(); + 8006c00: f000 fafe bl 8007200 + SysLedTask(); + 8006c04: f7ff ffd2 bl 8006bac +} + 8006c08: bf00 nop + 8006c0a: bd80 pop {r7, pc} + +08006c0c : + +void ModBusReceiveProc(Rs485Cmd *cmd) +{ + 8006c0c: b580 push {r7, lr} + 8006c0e: b082 sub sp, #8 + 8006c10: af00 add r7, sp, #0 + 8006c12: 6078 str r0, [r7, #4] + if (cmd == NULL) + 8006c14: 687b ldr r3, [r7, #4] + 8006c16: 2b00 cmp r3, #0 + 8006c18: d007 beq.n 8006c2a + { + return; + } + + memcpy(g_headCtrl.mtWkSta,cmd->rddat,16); + 8006c1a: 687b ldr r3, [r7, #4] + 8006c1c: 331c adds r3, #28 + 8006c1e: 2210 movs r2, #16 + 8006c20: 4619 mov r1, r3 + 8006c22: 4804 ldr r0, [pc, #16] ; (8006c34 ) + 8006c24: f002 fe5e bl 80098e4 + 8006c28: e000 b.n 8006c2c + return; + 8006c2a: bf00 nop + +} + 8006c2c: 3708 adds r7, #8 + 8006c2e: 46bd mov sp, r7 + 8006c30: bd80 pop {r7, pc} + 8006c32: bf00 nop + 8006c34: 20003bd6 .word 0x20003bd6 + +08006c38 : + +void SendMotoCtrlCmd(u16 cmd,u16 act) +{ + 8006c38: b580 push {r7, lr} + 8006c3a: b090 sub sp, #64 ; 0x40 + 8006c3c: af00 add r7, sp, #0 + 8006c3e: 4603 mov r3, r0 + 8006c40: 460a mov r2, r1 + 8006c42: 80fb strh r3, [r7, #6] + 8006c44: 4613 mov r3, r2 + 8006c46: 80bb strh r3, [r7, #4] + Rs485Cmd ccmd; + memset(&ccmd,0,sizeof(Rs485Cmd)); + 8006c48: f107 030c add.w r3, r7, #12 + 8006c4c: 2232 movs r2, #50 ; 0x32 + 8006c4e: 2100 movs r1, #0 + 8006c50: 4618 mov r0, r3 + 8006c52: f002 fe52 bl 80098fa + + ccmd.index = 10; + 8006c56: 230a movs r3, #10 + 8006c58: 737b strb r3, [r7, #13] + ccmd.cmd = MODBUS_WR; + 8006c5a: 2306 movs r3, #6 + 8006c5c: 73bb strb r3, [r7, #14] + ccmd.addr = cmd; + 8006c5e: 88fb ldrh r3, [r7, #6] + 8006c60: 823b strh r3, [r7, #16] + ccmd.wrdat[0] = act; + 8006c62: 88bb ldrh r3, [r7, #4] + 8006c64: 827b strh r3, [r7, #18] + ccmd.wlen = 1; + 8006c66: 2301 movs r3, #1 + 8006c68: 84fb strh r3, [r7, #38] ; 0x26 + ccmd.rlen = 0; + 8006c6a: 2300 movs r3, #0 + 8006c6c: 87bb strh r3, [r7, #60] ; 0x3c + + AddRs485Cmd(&ccmd); + 8006c6e: f107 030c add.w r3, r7, #12 + 8006c72: 4618 mov r0, r3 + 8006c74: f7ff fc9a bl 80065ac +} + 8006c78: bf00 nop + 8006c7a: 3740 adds r7, #64 ; 0x40 + 8006c7c: 46bd mov sp, r7 + 8006c7e: bd80 pop {r7, pc} + +08006c80 : +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_CMD_RST); +} + +void FootMotoToZero(void) +{ + 8006c80: b580 push {r7, lr} + 8006c82: af00 add r7, sp, #0 + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_TO_ZERO); + 8006c84: 2101 movs r1, #1 + 8006c86: f44f 5010 mov.w r0, #9216 ; 0x2400 + 8006c8a: f7ff ffd5 bl 8006c38 +// SetSTM32Moto1RealPos(0); +} + 8006c8e: bf00 nop + 8006c90: bd80 pop {r7, pc} + ... + +08006c94 : +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_RESET); +} + +void OutputStepOn(void) +{ + 8006c94: b580 push {r7, lr} + 8006c96: af00 add r7, sp, #0 + if(g_headCtrl.followEcdDir == 1) + 8006c98: 4b10 ldr r3, [pc, #64] ; (8006cdc ) + 8006c9a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006c9e: 3330 adds r3, #48 ; 0x30 + 8006ca0: 681b ldr r3, [r3, #0] + 8006ca2: 2b01 cmp r3, #1 + 8006ca4: d10b bne.n 8006cbe + { + g_headCtrl.footMtPos ++; + 8006ca6: 4b0d ldr r3, [pc, #52] ; (8006cdc ) + 8006ca8: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8006cac: 333c adds r3, #60 ; 0x3c + 8006cae: 681b ldr r3, [r3, #0] + 8006cb0: 1c5a adds r2, r3, #1 + 8006cb2: 4b0a ldr r3, [pc, #40] ; (8006cdc ) + 8006cb4: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8006cb8: 333c adds r3, #60 ; 0x3c + 8006cba: 601a str r2, [r3, #0] + 8006cbc: e00a b.n 8006cd4 + } + else + { + g_headCtrl.footMtPos --; + 8006cbe: 4b07 ldr r3, [pc, #28] ; (8006cdc ) + 8006cc0: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8006cc4: 333c adds r3, #60 ; 0x3c + 8006cc6: 681b ldr r3, [r3, #0] + 8006cc8: 1e5a subs r2, r3, #1 + 8006cca: 4b04 ldr r3, [pc, #16] ; (8006cdc ) + 8006ccc: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8006cd0: 333c adds r3, #60 ; 0x3c + 8006cd2: 601a str r2, [r3, #0] + } + SetMoto1StepOn(); + 8006cd4: f002 f9d2 bl 800907c +} + 8006cd8: bf00 nop + 8006cda: bd80 pop {r7, pc} + 8006cdc: 2000187c .word 0x2000187c + +08006ce0 : + 6, + 3, +}; + +void GetFollowTableValue(u32 angle,u32 puls) +{ + 8006ce0: b480 push {r7} + 8006ce2: b089 sub sp, #36 ; 0x24 + 8006ce4: af00 add r7, sp, #0 + 8006ce6: 6078 str r0, [r7, #4] + 8006ce8: 6039 str r1, [r7, #0] + int i, temp,value,followec,sum = 0; + 8006cea: 2300 movs r3, #0 + 8006cec: 61bb str r3, [r7, #24] + followec = angle*1000/360; + 8006cee: 687b ldr r3, [r7, #4] + 8006cf0: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8006cf4: fb02 f303 mul.w r3, r2, r3 + 8006cf8: 08db lsrs r3, r3, #3 + 8006cfa: 4a1a ldr r2, [pc, #104] ; (8006d64 ) + 8006cfc: fba2 2303 umull r2, r3, r2, r3 + 8006d00: 089b lsrs r3, r3, #2 + 8006d02: 617b str r3, [r7, #20] + value = followec/puls; + 8006d04: 697a ldr r2, [r7, #20] + 8006d06: 683b ldr r3, [r7, #0] + 8006d08: fbb2 f3f3 udiv r3, r2, r3 + 8006d0c: 613b str r3, [r7, #16] + + for(i = 0; i + { + FOLLOW_TABLE[i] = value + (4*(FOLLOW_TAB_NUM -2 - i)); + 8006d14: 69fb ldr r3, [r7, #28] + 8006d16: f1c3 0304 rsb r3, r3, #4 + 8006d1a: 009a lsls r2, r3, #2 + 8006d1c: 693b ldr r3, [r7, #16] + 8006d1e: 441a add r2, r3 + 8006d20: 4911 ldr r1, [pc, #68] ; (8006d68 ) + 8006d22: 69fb ldr r3, [r7, #28] + 8006d24: f841 2023 str.w r2, [r1, r3, lsl #2] + sum += FOLLOW_TABLE[i]; + 8006d28: 4a0f ldr r2, [pc, #60] ; (8006d68 ) + 8006d2a: 69fb ldr r3, [r7, #28] + 8006d2c: f852 3023 ldr.w r3, [r2, r3, lsl #2] + 8006d30: 69ba ldr r2, [r7, #24] + 8006d32: 4413 add r3, r2 + 8006d34: 61bb str r3, [r7, #24] + for(i = 0; i + } + temp = puls-((FOLLOW_TAB_NUM-1)*2); + 8006d42: 683b ldr r3, [r7, #0] + 8006d44: 3b0a subs r3, #10 + 8006d46: 60fb str r3, [r7, #12] + FOLLOW_TABLE[FOLLOW_TAB_NUM-1] = (followec - sum*2)/temp; + 8006d48: 69bb ldr r3, [r7, #24] + 8006d4a: 005b lsls r3, r3, #1 + 8006d4c: 697a ldr r2, [r7, #20] + 8006d4e: 1ad2 subs r2, r2, r3 + 8006d50: 68fb ldr r3, [r7, #12] + 8006d52: fb92 f3f3 sdiv r3, r2, r3 + 8006d56: 4a04 ldr r2, [pc, #16] ; (8006d68 ) + 8006d58: 6153 str r3, [r2, #20] +} + 8006d5a: bf00 nop + 8006d5c: 3724 adds r7, #36 ; 0x24 + 8006d5e: 46bd mov sp, r7 + 8006d60: bc80 pop {r7} + 8006d62: 4770 bx lr + 8006d64: 16c16c17 .word 0x16c16c17 + 8006d68: 20000214 .word 0x20000214 + +08006d6c : + +void FollowEcdOutPulseOn(void) +{ + 8006d6c: b580 push {r7, lr} + 8006d6e: af00 add r7, sp, #0 + if (g_headCtrl.followEcdEn != 0) + 8006d70: 4b55 ldr r3, [pc, #340] ; (8006ec8 ) + 8006d72: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006d76: 3318 adds r3, #24 + 8006d78: 681b ldr r3, [r3, #0] + 8006d7a: 2b00 cmp r3, #0 + 8006d7c: f000 80a2 beq.w 8006ec4 + { + g_headCtrl.followCountr++; + 8006d80: 4b51 ldr r3, [pc, #324] ; (8006ec8 ) + 8006d82: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006d86: 331c adds r3, #28 + 8006d88: 681b ldr r3, [r3, #0] + 8006d8a: 1c5a adds r2, r3, #1 + 8006d8c: 4b4e ldr r3, [pc, #312] ; (8006ec8 ) + 8006d8e: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006d92: 331c adds r3, #28 + 8006d94: 601a str r2, [r3, #0] + + if (g_headCtrl.followCountr >= g_headCtrl.followStepNum) + 8006d96: 4b4c ldr r3, [pc, #304] ; (8006ec8 ) + 8006d98: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006d9c: 331c adds r3, #28 + 8006d9e: 681a ldr r2, [r3, #0] + 8006da0: 4b49 ldr r3, [pc, #292] ; (8006ec8 ) + 8006da2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006da6: 3320 adds r3, #32 + 8006da8: 681b ldr r3, [r3, #0] + 8006daa: 429a cmp r2, r3 + 8006dac: f0c0 808a bcc.w 8006ec4 + { + if(g_headCtrl.followNumHigh > g_headCtrl.followRunNum) + 8006db0: 4b45 ldr r3, [pc, #276] ; (8006ec8 ) + 8006db2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006db6: 3328 adds r3, #40 ; 0x28 + 8006db8: 681a ldr r2, [r3, #0] + 8006dba: 4b43 ldr r3, [pc, #268] ; (8006ec8 ) + 8006dbc: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006dc0: 681b ldr r3, [r3, #0] + 8006dc2: 429a cmp r2, r3 + 8006dc4: d912 bls.n 8006dec + { + g_headCtrl.followNumHigh = 0; + 8006dc6: 4b40 ldr r3, [pc, #256] ; (8006ec8 ) + 8006dc8: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006dcc: 3328 adds r3, #40 ; 0x28 + 8006dce: 2200 movs r2, #0 + 8006dd0: 601a str r2, [r3, #0] + g_headCtrl.followNumLow = 0; + 8006dd2: 4b3d ldr r3, [pc, #244] ; (8006ec8 ) + 8006dd4: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006dd8: 3324 adds r3, #36 ; 0x24 + 8006dda: 2200 movs r2, #0 + 8006ddc: 601a str r2, [r3, #0] + g_headCtrl.followEcdEn = 0; + 8006dde: 4b3a ldr r3, [pc, #232] ; (8006ec8 ) + 8006de0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006de4: 3318 adds r3, #24 + 8006de6: 2200 movs r2, #0 + 8006de8: 601a str r2, [r3, #0] + return; + 8006dea: e06b b.n 8006ec4 + } + + OutputStepOn(); + 8006dec: f7ff ff52 bl 8006c94 + g_headCtrl.followCountr = 0; + 8006df0: 4b35 ldr r3, [pc, #212] ; (8006ec8 ) + 8006df2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006df6: 331c adds r3, #28 + 8006df8: 2200 movs r2, #0 + 8006dfa: 601a str r2, [r3, #0] + g_headCtrl.followNumHigh++; + 8006dfc: 4b32 ldr r3, [pc, #200] ; (8006ec8 ) + 8006dfe: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e02: 3328 adds r3, #40 ; 0x28 + 8006e04: 681b ldr r3, [r3, #0] + 8006e06: 1c5a adds r2, r3, #1 + 8006e08: 4b2f ldr r3, [pc, #188] ; (8006ec8 ) + 8006e0a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e0e: 3328 adds r3, #40 ; 0x28 + 8006e10: 601a str r2, [r3, #0] + + // + if (g_headCtrl.followTableIdx < FOLLOW_TAB_NUM && g_headCtrl.followNumHigh < FOLLOW_TAB_NUM) + 8006e12: 4b2d ldr r3, [pc, #180] ; (8006ec8 ) + 8006e14: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e18: 332c adds r3, #44 ; 0x2c + 8006e1a: 681b ldr r3, [r3, #0] + 8006e1c: 2b05 cmp r3, #5 + 8006e1e: dc1f bgt.n 8006e60 + 8006e20: 4b29 ldr r3, [pc, #164] ; (8006ec8 ) + 8006e22: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e26: 3328 adds r3, #40 ; 0x28 + 8006e28: 681b ldr r3, [r3, #0] + 8006e2a: 2b05 cmp r3, #5 + 8006e2c: d818 bhi.n 8006e60 + { + g_headCtrl.followTableIdx++; // ˶ + 8006e2e: 4b26 ldr r3, [pc, #152] ; (8006ec8 ) + 8006e30: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e34: 332c adds r3, #44 ; 0x2c + 8006e36: 681b ldr r3, [r3, #0] + 8006e38: 1c5a adds r2, r3, #1 + 8006e3a: 4b23 ldr r3, [pc, #140] ; (8006ec8 ) + 8006e3c: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e40: 332c adds r3, #44 ; 0x2c + 8006e42: 601a str r2, [r3, #0] + g_headCtrl.followStepNum = FOLLOW_TABLE[g_headCtrl.followTableIdx]; // װµֵ + 8006e44: 4b20 ldr r3, [pc, #128] ; (8006ec8 ) + 8006e46: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e4a: 332c adds r3, #44 ; 0x2c + 8006e4c: 681b ldr r3, [r3, #0] + 8006e4e: 4a1f ldr r2, [pc, #124] ; (8006ecc ) + 8006e50: f852 3023 ldr.w r3, [r2, r3, lsl #2] + 8006e54: 461a mov r2, r3 + 8006e56: 4b1c ldr r3, [pc, #112] ; (8006ec8 ) + 8006e58: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e5c: 3320 adds r3, #32 + 8006e5e: 601a str r2, [r3, #0] + } + + // + if(g_headCtrl.followNumHigh >= g_headCtrl.followRunNum - FOLLOW_TAB_NUM) + 8006e60: 4b19 ldr r3, [pc, #100] ; (8006ec8 ) + 8006e62: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e66: 3328 adds r3, #40 ; 0x28 + 8006e68: 681a ldr r2, [r3, #0] + 8006e6a: 4b17 ldr r3, [pc, #92] ; (8006ec8 ) + 8006e6c: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e70: 681b ldr r3, [r3, #0] + 8006e72: 3b06 subs r3, #6 + 8006e74: 429a cmp r2, r3 + 8006e76: d325 bcc.n 8006ec4 + { + if(g_headCtrl.followTableIdx <= 0) + 8006e78: 4b13 ldr r3, [pc, #76] ; (8006ec8 ) + 8006e7a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e7e: 332c adds r3, #44 ; 0x2c + 8006e80: 681b ldr r3, [r3, #0] + 8006e82: 2b00 cmp r3, #0 + 8006e84: dc05 bgt.n 8006e92 + { + g_headCtrl.followTableIdx = 0; + 8006e86: 4b10 ldr r3, [pc, #64] ; (8006ec8 ) + 8006e88: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e8c: 332c adds r3, #44 ; 0x2c + 8006e8e: 2200 movs r2, #0 + 8006e90: 601a str r2, [r3, #0] + } + g_headCtrl.followStepNum = FOLLOW_TABLE[g_headCtrl.followTableIdx]; // װµֵ + 8006e92: 4b0d ldr r3, [pc, #52] ; (8006ec8 ) + 8006e94: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006e98: 332c adds r3, #44 ; 0x2c + 8006e9a: 681b ldr r3, [r3, #0] + 8006e9c: 4a0b ldr r2, [pc, #44] ; (8006ecc ) + 8006e9e: f852 3023 ldr.w r3, [r2, r3, lsl #2] + 8006ea2: 461a mov r2, r3 + 8006ea4: 4b08 ldr r3, [pc, #32] ; (8006ec8 ) + 8006ea6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006eaa: 3320 adds r3, #32 + 8006eac: 601a str r2, [r3, #0] + g_headCtrl.followTableIdx--; // ˶ + 8006eae: 4b06 ldr r3, [pc, #24] ; (8006ec8 ) + 8006eb0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006eb4: 332c adds r3, #44 ; 0x2c + 8006eb6: 681b ldr r3, [r3, #0] + 8006eb8: 1e5a subs r2, r3, #1 + 8006eba: 4b03 ldr r3, [pc, #12] ; (8006ec8 ) + 8006ebc: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006ec0: 332c adds r3, #44 ; 0x2c + 8006ec2: 601a str r2, [r3, #0] + } + } + } +} + 8006ec4: bd80 pop {r7, pc} + 8006ec6: bf00 nop + 8006ec8: 2000187c .word 0x2000187c + 8006ecc: 20000214 .word 0x20000214 + +08006ed0 : + +void FollowEcdOutPulseOff(void) +{ + 8006ed0: b580 push {r7, lr} + 8006ed2: af00 add r7, sp, #0 + if (g_headCtrl.followEcdEn != 0) + 8006ed4: 4b11 ldr r3, [pc, #68] ; (8006f1c ) + 8006ed6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006eda: 3318 adds r3, #24 + 8006edc: 681b ldr r3, [r3, #0] + 8006ede: 2b00 cmp r3, #0 + 8006ee0: d01a beq.n 8006f18 + { + if (g_headCtrl.followCountr * 2 + 1 >= g_headCtrl.followStepNum) + 8006ee2: 4b0e ldr r3, [pc, #56] ; (8006f1c ) + 8006ee4: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006ee8: 331c adds r3, #28 + 8006eea: 681b ldr r3, [r3, #0] + 8006eec: 005b lsls r3, r3, #1 + 8006eee: 1c5a adds r2, r3, #1 + 8006ef0: 4b0a ldr r3, [pc, #40] ; (8006f1c ) + 8006ef2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006ef6: 3320 adds r3, #32 + 8006ef8: 681b ldr r3, [r3, #0] + 8006efa: 429a cmp r2, r3 + 8006efc: d30c bcc.n 8006f18 + { + OutputStepOff(); + 8006efe: f002 f8c9 bl 8009094 + g_headCtrl.followNumLow++; + 8006f02: 4b06 ldr r3, [pc, #24] ; (8006f1c ) + 8006f04: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f08: 3324 adds r3, #36 ; 0x24 + 8006f0a: 681b ldr r3, [r3, #0] + 8006f0c: 1c5a adds r2, r3, #1 + 8006f0e: 4b03 ldr r3, [pc, #12] ; (8006f1c ) + 8006f10: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f14: 3324 adds r3, #36 ; 0x24 + 8006f16: 601a str r2, [r3, #0] + } + } +} + 8006f18: bf00 nop + 8006f1a: bd80 pop {r7, pc} + 8006f1c: 2000187c .word 0x2000187c + +08006f20 : + +void FollowEcdOutDirOn(void) +{ + 8006f20: b580 push {r7, lr} + 8006f22: af00 add r7, sp, #0 + if (g_headCtrl.followEcdCheck != 0) + 8006f24: 4b0a ldr r3, [pc, #40] ; (8006f50 ) + 8006f26: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f2a: 3334 adds r3, #52 ; 0x34 + 8006f2c: 681b ldr r3, [r3, #0] + 8006f2e: 2b00 cmp r3, #0 + 8006f30: d00b beq.n 8006f4a + { + if (g_headCtrl.followEcdDir == 1) + 8006f32: 4b07 ldr r3, [pc, #28] ; (8006f50 ) + 8006f34: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f38: 3330 adds r3, #48 ; 0x30 + 8006f3a: 681b ldr r3, [r3, #0] + 8006f3c: 2b01 cmp r3, #1 + 8006f3e: d102 bne.n 8006f46 + { + OutputDirOn(); + 8006f40: f002 f8b4 bl 80090ac + else + { + OutputDirOff(); + } + } +} + 8006f44: e001 b.n 8006f4a + OutputDirOff(); + 8006f46: f002 f8bd bl 80090c4 +} + 8006f4a: bf00 nop + 8006f4c: bd80 pop {r7, pc} + 8006f4e: bf00 nop + 8006f50: 2000187c .word 0x2000187c + +08006f54 : +void FollowEcdOutDirOff(void) +{ + 8006f54: b580 push {r7, lr} + 8006f56: af00 add r7, sp, #0 + if (g_headCtrl.followEcdCheck != 0) + 8006f58: 4b0a ldr r3, [pc, #40] ; (8006f84 ) + 8006f5a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f5e: 3334 adds r3, #52 ; 0x34 + 8006f60: 681b ldr r3, [r3, #0] + 8006f62: 2b00 cmp r3, #0 + 8006f64: d00b beq.n 8006f7e + { + if (g_headCtrl.followEcdDir == 1) + 8006f66: 4b07 ldr r3, [pc, #28] ; (8006f84 ) + 8006f68: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f6c: 3330 adds r3, #48 ; 0x30 + 8006f6e: 681b ldr r3, [r3, #0] + 8006f70: 2b01 cmp r3, #1 + 8006f72: d102 bne.n 8006f7a + { + OutputDirOff(); + 8006f74: f002 f8a6 bl 80090c4 + else + { + OutputDirOn(); + } + } +} + 8006f78: e001 b.n 8006f7e + OutputDirOn(); + 8006f7a: f002 f897 bl 80090ac +} + 8006f7e: bf00 nop + 8006f80: bd80 pop {r7, pc} + 8006f82: bf00 nop + 8006f84: 2000187c .word 0x2000187c + +08006f88 : + +void CheckParasValue(void) +{ + 8006f88: b580 push {r7, lr} + 8006f8a: af00 add r7, sp, #0 + g_headCtrl.followRunNum = g_headCtrl.pfootFlowPuls; + 8006f8c: 4b9a ldr r3, [pc, #616] ; (80071f8 ) + 8006f8e: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006f92: 3318 adds r3, #24 + 8006f94: 681a ldr r2, [r3, #0] + 8006f96: 4b98 ldr r3, [pc, #608] ; (80071f8 ) + 8006f98: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006f9c: 601a str r2, [r3, #0] + if(g_headCtrl.followRunNum == 0) + 8006f9e: 4b96 ldr r3, [pc, #600] ; (80071f8 ) + 8006fa0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006fa4: 681b ldr r3, [r3, #0] + 8006fa6: 2b00 cmp r3, #0 + 8006fa8: d104 bne.n 8006fb4 + { + g_headCtrl.followRunNum = 40; + 8006faa: 4b93 ldr r3, [pc, #588] ; (80071f8 ) + 8006fac: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006fb0: 2228 movs r2, #40 ; 0x28 + 8006fb2: 601a str r2, [r3, #0] + } + g_headCtrl.followStepNum = 3; + 8006fb4: 4b90 ldr r3, [pc, #576] ; (80071f8 ) + 8006fb6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006fba: 3320 adds r3, #32 + 8006fbc: 2203 movs r2, #3 + 8006fbe: 601a str r2, [r3, #0] + g_headCtrl.followStartPPos = g_headCtrl.pfootFlowPAng*1000/360 + g_headCtrl.ecOfstValue; + 8006fc0: 4b8d ldr r3, [pc, #564] ; (80071f8 ) + 8006fc2: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006fc6: 3310 adds r3, #16 + 8006fc8: 681b ldr r3, [r3, #0] + 8006fca: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8006fce: fb02 f303 mul.w r3, r2, r3 + 8006fd2: 08db lsrs r3, r3, #3 + 8006fd4: 4a89 ldr r2, [pc, #548] ; (80071fc ) + 8006fd6: fba2 2303 umull r2, r3, r2, r3 + 8006fda: 089a lsrs r2, r3, #2 + 8006fdc: 4b86 ldr r3, [pc, #536] ; (80071f8 ) + 8006fde: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8006fe2: 3324 adds r3, #36 ; 0x24 + 8006fe4: 681b ldr r3, [r3, #0] + 8006fe6: 4413 add r3, r2 + 8006fe8: 461a mov r2, r3 + 8006fea: 4b83 ldr r3, [pc, #524] ; (80071f8 ) + 8006fec: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006ff0: 3304 adds r3, #4 + 8006ff2: 601a str r2, [r3, #0] + if(g_headCtrl.followStartPPos >= 1000) + 8006ff4: 4b80 ldr r3, [pc, #512] ; (80071f8 ) + 8006ff6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8006ffa: 3304 adds r3, #4 + 8006ffc: 681b ldr r3, [r3, #0] + 8006ffe: f5b3 7f7a cmp.w r3, #1000 ; 0x3e8 + 8007002: db0b blt.n 800701c + { + g_headCtrl.followStartPPos -= 1000; + 8007004: 4b7c ldr r3, [pc, #496] ; (80071f8 ) + 8007006: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800700a: 3304 adds r3, #4 + 800700c: 681b ldr r3, [r3, #0] + 800700e: f5a3 727a sub.w r2, r3, #1000 ; 0x3e8 + 8007012: 4b79 ldr r3, [pc, #484] ; (80071f8 ) + 8007014: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007018: 3304 adds r3, #4 + 800701a: 601a str r2, [r3, #0] + } + if(g_headCtrl.followStartPPos < 0) + 800701c: 4b76 ldr r3, [pc, #472] ; (80071f8 ) + 800701e: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007022: 3304 adds r3, #4 + 8007024: 681b ldr r3, [r3, #0] + 8007026: 2b00 cmp r3, #0 + 8007028: da0b bge.n 8007042 + { + g_headCtrl.followStartPPos += 1000; + 800702a: 4b73 ldr r3, [pc, #460] ; (80071f8 ) + 800702c: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007030: 3304 adds r3, #4 + 8007032: 681b ldr r3, [r3, #0] + 8007034: f503 727a add.w r2, r3, #1000 ; 0x3e8 + 8007038: 4b6f ldr r3, [pc, #444] ; (80071f8 ) + 800703a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800703e: 3304 adds r3, #4 + 8007040: 601a str r2, [r3, #0] + } + if(g_headCtrl.followStartPPos == 0) + 8007042: 4b6d ldr r3, [pc, #436] ; (80071f8 ) + 8007044: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007048: 3304 adds r3, #4 + 800704a: 681b ldr r3, [r3, #0] + 800704c: 2b00 cmp r3, #0 + 800704e: d105 bne.n 800705c + { + g_headCtrl.followStartPPos = 100; + 8007050: 4b69 ldr r3, [pc, #420] ; (80071f8 ) + 8007052: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007056: 3304 adds r3, #4 + 8007058: 2264 movs r2, #100 ; 0x64 + 800705a: 601a str r2, [r3, #0] + } + g_headCtrl.followStartNPos = g_headCtrl.pfootFlowNAng*1000/360 + g_headCtrl.ecOfstValue; + 800705c: 4b66 ldr r3, [pc, #408] ; (80071f8 ) + 800705e: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007062: 3314 adds r3, #20 + 8007064: 681b ldr r3, [r3, #0] + 8007066: f44f 727a mov.w r2, #1000 ; 0x3e8 + 800706a: fb02 f303 mul.w r3, r2, r3 + 800706e: 08db lsrs r3, r3, #3 + 8007070: 4a62 ldr r2, [pc, #392] ; (80071fc ) + 8007072: fba2 2303 umull r2, r3, r2, r3 + 8007076: 089a lsrs r2, r3, #2 + 8007078: 4b5f ldr r3, [pc, #380] ; (80071f8 ) + 800707a: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800707e: 3324 adds r3, #36 ; 0x24 + 8007080: 681b ldr r3, [r3, #0] + 8007082: 4413 add r3, r2 + 8007084: 461a mov r2, r3 + 8007086: 4b5c ldr r3, [pc, #368] ; (80071f8 ) + 8007088: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800708c: 3308 adds r3, #8 + 800708e: 601a str r2, [r3, #0] + if(g_headCtrl.followStartNPos >= 1000) + 8007090: 4b59 ldr r3, [pc, #356] ; (80071f8 ) + 8007092: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007096: 3308 adds r3, #8 + 8007098: 681b ldr r3, [r3, #0] + 800709a: f5b3 7f7a cmp.w r3, #1000 ; 0x3e8 + 800709e: db0b blt.n 80070b8 + { + g_headCtrl.followStartNPos -= 1000; + 80070a0: 4b55 ldr r3, [pc, #340] ; (80071f8 ) + 80070a2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070a6: 3308 adds r3, #8 + 80070a8: 681b ldr r3, [r3, #0] + 80070aa: f5a3 727a sub.w r2, r3, #1000 ; 0x3e8 + 80070ae: 4b52 ldr r3, [pc, #328] ; (80071f8 ) + 80070b0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070b4: 3308 adds r3, #8 + 80070b6: 601a str r2, [r3, #0] + } + if(g_headCtrl.followStartNPos < 0) + 80070b8: 4b4f ldr r3, [pc, #316] ; (80071f8 ) + 80070ba: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070be: 3308 adds r3, #8 + 80070c0: 681b ldr r3, [r3, #0] + 80070c2: 2b00 cmp r3, #0 + 80070c4: da0b bge.n 80070de + { + g_headCtrl.followStartNPos += 1000; + 80070c6: 4b4c ldr r3, [pc, #304] ; (80071f8 ) + 80070c8: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070cc: 3308 adds r3, #8 + 80070ce: 681b ldr r3, [r3, #0] + 80070d0: f503 727a add.w r2, r3, #1000 ; 0x3e8 + 80070d4: 4b48 ldr r3, [pc, #288] ; (80071f8 ) + 80070d6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070da: 3308 adds r3, #8 + 80070dc: 601a str r2, [r3, #0] + } + if(g_headCtrl.followStartNPos == 0) + 80070de: 4b46 ldr r3, [pc, #280] ; (80071f8 ) + 80070e0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070e4: 3308 adds r3, #8 + 80070e6: 681b ldr r3, [r3, #0] + 80070e8: 2b00 cmp r3, #0 + 80070ea: d106 bne.n 80070fa + { + g_headCtrl.followStartNPos = 600; + 80070ec: 4b42 ldr r3, [pc, #264] ; (80071f8 ) + 80070ee: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80070f2: 3308 adds r3, #8 + 80070f4: f44f 7216 mov.w r2, #600 ; 0x258 + 80070f8: 601a str r2, [r3, #0] + } + g_headCtrl.pfootRunLowPos = g_headCtrl.pfootRunLowPos; + 80070fa: 4b3f ldr r3, [pc, #252] ; (80071f8 ) + 80070fc: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007100: 331c adds r3, #28 + 8007102: 681a ldr r2, [r3, #0] + 8007104: 4b3c ldr r3, [pc, #240] ; (80071f8 ) + 8007106: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800710a: 331c adds r3, #28 + 800710c: 601a str r2, [r3, #0] + if(g_headCtrl.pfootRunLowPos == 0) + 800710e: 4b3a ldr r3, [pc, #232] ; (80071f8 ) + 8007110: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007114: 331c adds r3, #28 + 8007116: 681b ldr r3, [r3, #0] + 8007118: 2b00 cmp r3, #0 + 800711a: d105 bne.n 8007128 + { + g_headCtrl.pfootRunLowPos = 10; + 800711c: 4b36 ldr r3, [pc, #216] ; (80071f8 ) + 800711e: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007122: 331c adds r3, #28 + 8007124: 220a movs r2, #10 + 8007126: 601a str r2, [r3, #0] + } + g_headCtrl.pfootRunBackPos = g_headCtrl.pfootRunBackPos; + 8007128: 4b33 ldr r3, [pc, #204] ; (80071f8 ) + 800712a: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800712e: 3320 adds r3, #32 + 8007130: 681a ldr r2, [r3, #0] + 8007132: 4b31 ldr r3, [pc, #196] ; (80071f8 ) + 8007134: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007138: 3320 adds r3, #32 + 800713a: 601a str r2, [r3, #0] + if(g_headCtrl.pfootRunBackPos == 0) + 800713c: 4b2e ldr r3, [pc, #184] ; (80071f8 ) + 800713e: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007142: 3320 adds r3, #32 + 8007144: 681b ldr r3, [r3, #0] + 8007146: 2b00 cmp r3, #0 + 8007148: d105 bne.n 8007156 + { + g_headCtrl.pfootRunBackPos = 10; + 800714a: 4b2b ldr r3, [pc, #172] ; (80071f8 ) + 800714c: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007150: 3320 adds r3, #32 + 8007152: 220a movs r2, #10 + 8007154: 601a str r2, [r3, #0] + } + g_headCtrl.pfootRunHighPos = g_headCtrl.pfootRunLowPos + g_headCtrl.followRunNum; + 8007156: 4b28 ldr r3, [pc, #160] ; (80071f8 ) + 8007158: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800715c: 331c adds r3, #28 + 800715e: 681a ldr r2, [r3, #0] + 8007160: 4b25 ldr r3, [pc, #148] ; (80071f8 ) + 8007162: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007166: 681b ldr r3, [r3, #0] + 8007168: 441a add r2, r3 + 800716a: 4b23 ldr r3, [pc, #140] ; (80071f8 ) + 800716c: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007170: 330c adds r3, #12 + 8007172: 601a str r2, [r3, #0] + if(g_headCtrl.pfootRunHighPos == 0) + 8007174: 4b20 ldr r3, [pc, #128] ; (80071f8 ) + 8007176: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800717a: 330c adds r3, #12 + 800717c: 681b ldr r3, [r3, #0] + 800717e: 2b00 cmp r3, #0 + 8007180: d105 bne.n 800718e + { + g_headCtrl.pfootRunHighPos = 50; + 8007182: 4b1d ldr r3, [pc, #116] ; (80071f8 ) + 8007184: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007188: 330c adds r3, #12 + 800718a: 2232 movs r2, #50 ; 0x32 + 800718c: 601a str r2, [r3, #0] + } + + g_headCtrl.followConPAng = g_headCtrl.pfootRunConAng; + 800718e: 4b1a ldr r3, [pc, #104] ; (80071f8 ) + 8007190: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007194: 3328 adds r3, #40 ; 0x28 + 8007196: 681a ldr r2, [r3, #0] + 8007198: 4b17 ldr r3, [pc, #92] ; (80071f8 ) + 800719a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800719e: 330c adds r3, #12 + 80071a0: 601a str r2, [r3, #0] + if(g_headCtrl.followConPAng == 0) + 80071a2: 4b15 ldr r3, [pc, #84] ; (80071f8 ) + 80071a4: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071a8: 330c adds r3, #12 + 80071aa: 681b ldr r3, [r3, #0] + 80071ac: 2b00 cmp r3, #0 + 80071ae: d106 bne.n 80071be + { + g_headCtrl.followConPAng = 140; + 80071b0: 4b11 ldr r3, [pc, #68] ; (80071f8 ) + 80071b2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071b6: 330c adds r3, #12 + 80071b8: 228c movs r2, #140 ; 0x8c + 80071ba: 601a str r2, [r3, #0] + 80071bc: e00c b.n 80071d8 + } + else if(g_headCtrl.followConPAng >160) + 80071be: 4b0e ldr r3, [pc, #56] ; (80071f8 ) + 80071c0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071c4: 330c adds r3, #12 + 80071c6: 681b ldr r3, [r3, #0] + 80071c8: 2ba0 cmp r3, #160 ; 0xa0 + 80071ca: d905 bls.n 80071d8 + { + g_headCtrl.followConPAng = 160; + 80071cc: 4b0a ldr r3, [pc, #40] ; (80071f8 ) + 80071ce: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071d2: 330c adds r3, #12 + 80071d4: 22a0 movs r2, #160 ; 0xa0 + 80071d6: 601a str r2, [r3, #0] + } + + GetFollowTableValue(g_headCtrl.followConPAng,g_headCtrl.followRunNum); + 80071d8: 4b07 ldr r3, [pc, #28] ; (80071f8 ) + 80071da: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071de: 330c adds r3, #12 + 80071e0: 681a ldr r2, [r3, #0] + 80071e2: 4b05 ldr r3, [pc, #20] ; (80071f8 ) + 80071e4: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80071e8: 681b ldr r3, [r3, #0] + 80071ea: 4619 mov r1, r3 + 80071ec: 4610 mov r0, r2 + 80071ee: f7ff fd77 bl 8006ce0 + //GetFollowTableValue(g_headCtrl.followConNAng,g_headCtrl.followRunNum); +} + 80071f2: bf00 nop + 80071f4: bd80 pop {r7, pc} + 80071f6: bf00 nop + 80071f8: 2000187c .word 0x2000187c + 80071fc: 16c16c17 .word 0x16c16c17 + +08007200 : + } +} + +// ˢ״̬ +void InOutStaRefreshTask(void) +{ + 8007200: b580 push {r7, lr} + 8007202: af00 add r7, sp, #0 + if(GetInput1Status() == SENSOR_ON) + 8007204: f002 f8fe bl 8009404 + 8007208: 4603 mov r3, r0 + 800720a: 2b00 cmp r3, #0 + 800720c: d107 bne.n 800721e + { + g_headCtrl.inputSta |= 0x01; + 800720e: 4b52 ldr r3, [pc, #328] ; (8007358 ) + 8007210: 789b ldrb r3, [r3, #2] + 8007212: f043 0301 orr.w r3, r3, #1 + 8007216: b2da uxtb r2, r3 + 8007218: 4b4f ldr r3, [pc, #316] ; (8007358 ) + 800721a: 709a strb r2, [r3, #2] + 800721c: e006 b.n 800722c + } + else + { + g_headCtrl.inputSta &= ~0x01; + 800721e: 4b4e ldr r3, [pc, #312] ; (8007358 ) + 8007220: 789b ldrb r3, [r3, #2] + 8007222: f023 0301 bic.w r3, r3, #1 + 8007226: b2da uxtb r2, r3 + 8007228: 4b4b ldr r3, [pc, #300] ; (8007358 ) + 800722a: 709a strb r2, [r3, #2] + } + + if(GetInput2Status() == SENSOR_ON) + 800722c: f002 f8f8 bl 8009420 + 8007230: 4603 mov r3, r0 + 8007232: 2b00 cmp r3, #0 + 8007234: d107 bne.n 8007246 + { + g_headCtrl.inputSta |= 0x02; + 8007236: 4b48 ldr r3, [pc, #288] ; (8007358 ) + 8007238: 789b ldrb r3, [r3, #2] + 800723a: f043 0302 orr.w r3, r3, #2 + 800723e: b2da uxtb r2, r3 + 8007240: 4b45 ldr r3, [pc, #276] ; (8007358 ) + 8007242: 709a strb r2, [r3, #2] + 8007244: e006 b.n 8007254 + } + else + { + g_headCtrl.inputSta &= ~0x02; + 8007246: 4b44 ldr r3, [pc, #272] ; (8007358 ) + 8007248: 789b ldrb r3, [r3, #2] + 800724a: f023 0302 bic.w r3, r3, #2 + 800724e: b2da uxtb r2, r3 + 8007250: 4b41 ldr r3, [pc, #260] ; (8007358 ) + 8007252: 709a strb r2, [r3, #2] + } + + if(GetInput3Status() == SENSOR_ON) + 8007254: f002 f8f2 bl 800943c + 8007258: 4603 mov r3, r0 + 800725a: 2b00 cmp r3, #0 + 800725c: d107 bne.n 800726e + { + g_headCtrl.inputSta |= 0x04; + 800725e: 4b3e ldr r3, [pc, #248] ; (8007358 ) + 8007260: 789b ldrb r3, [r3, #2] + 8007262: f043 0304 orr.w r3, r3, #4 + 8007266: b2da uxtb r2, r3 + 8007268: 4b3b ldr r3, [pc, #236] ; (8007358 ) + 800726a: 709a strb r2, [r3, #2] + 800726c: e006 b.n 800727c + } + else + { + g_headCtrl.inputSta &= ~0x04; + 800726e: 4b3a ldr r3, [pc, #232] ; (8007358 ) + 8007270: 789b ldrb r3, [r3, #2] + 8007272: f023 0304 bic.w r3, r3, #4 + 8007276: b2da uxtb r2, r3 + 8007278: 4b37 ldr r3, [pc, #220] ; (8007358 ) + 800727a: 709a strb r2, [r3, #2] + } + + if(GetInput4Status() == SENSOR_ON) + 800727c: f002 f8ec bl 8009458 + 8007280: 4603 mov r3, r0 + 8007282: 2b00 cmp r3, #0 + 8007284: d107 bne.n 8007296 + { + g_headCtrl.inputSta |= 0x08; + 8007286: 4b34 ldr r3, [pc, #208] ; (8007358 ) + 8007288: 789b ldrb r3, [r3, #2] + 800728a: f043 0308 orr.w r3, r3, #8 + 800728e: b2da uxtb r2, r3 + 8007290: 4b31 ldr r3, [pc, #196] ; (8007358 ) + 8007292: 709a strb r2, [r3, #2] + 8007294: e006 b.n 80072a4 + } + else + { + g_headCtrl.inputSta &= ~0x08; + 8007296: 4b30 ldr r3, [pc, #192] ; (8007358 ) + 8007298: 789b ldrb r3, [r3, #2] + 800729a: f023 0308 bic.w r3, r3, #8 + 800729e: b2da uxtb r2, r3 + 80072a0: 4b2d ldr r3, [pc, #180] ; (8007358 ) + 80072a2: 709a strb r2, [r3, #2] + } + + if(GetInput5Status() == SENSOR_ON) + 80072a4: f002 f8e6 bl 8009474 + 80072a8: 4603 mov r3, r0 + 80072aa: 2b00 cmp r3, #0 + 80072ac: d107 bne.n 80072be + { + g_headCtrl.inputSta |= 0x10; + 80072ae: 4b2a ldr r3, [pc, #168] ; (8007358 ) + 80072b0: 789b ldrb r3, [r3, #2] + 80072b2: f043 0310 orr.w r3, r3, #16 + 80072b6: b2da uxtb r2, r3 + 80072b8: 4b27 ldr r3, [pc, #156] ; (8007358 ) + 80072ba: 709a strb r2, [r3, #2] + 80072bc: e006 b.n 80072cc + } + else + { + g_headCtrl.inputSta &= ~0x10; + 80072be: 4b26 ldr r3, [pc, #152] ; (8007358 ) + 80072c0: 789b ldrb r3, [r3, #2] + 80072c2: f023 0310 bic.w r3, r3, #16 + 80072c6: b2da uxtb r2, r3 + 80072c8: 4b23 ldr r3, [pc, #140] ; (8007358 ) + 80072ca: 709a strb r2, [r3, #2] + } + + if(GetInput6Status() == SENSOR_ON) + 80072cc: f002 f8e0 bl 8009490 + 80072d0: 4603 mov r3, r0 + 80072d2: 2b00 cmp r3, #0 + 80072d4: d107 bne.n 80072e6 + { + g_headCtrl.inputSta |= 0x20; + 80072d6: 4b20 ldr r3, [pc, #128] ; (8007358 ) + 80072d8: 789b ldrb r3, [r3, #2] + 80072da: f043 0320 orr.w r3, r3, #32 + 80072de: b2da uxtb r2, r3 + 80072e0: 4b1d ldr r3, [pc, #116] ; (8007358 ) + 80072e2: 709a strb r2, [r3, #2] + 80072e4: e006 b.n 80072f4 + } + else + { + g_headCtrl.inputSta &= ~0x20; + 80072e6: 4b1c ldr r3, [pc, #112] ; (8007358 ) + 80072e8: 789b ldrb r3, [r3, #2] + 80072ea: f023 0320 bic.w r3, r3, #32 + 80072ee: b2da uxtb r2, r3 + 80072f0: 4b19 ldr r3, [pc, #100] ; (8007358 ) + 80072f2: 709a strb r2, [r3, #2] + } + + if(GetInput7Status() == SENSOR_ON) + 80072f4: f002 f8da bl 80094ac + 80072f8: 4603 mov r3, r0 + 80072fa: 2b00 cmp r3, #0 + 80072fc: d107 bne.n 800730e + { + g_headCtrl.inputSta |= 0x40; + 80072fe: 4b16 ldr r3, [pc, #88] ; (8007358 ) + 8007300: 789b ldrb r3, [r3, #2] + 8007302: f043 0340 orr.w r3, r3, #64 ; 0x40 + 8007306: b2da uxtb r2, r3 + 8007308: 4b13 ldr r3, [pc, #76] ; (8007358 ) + 800730a: 709a strb r2, [r3, #2] + 800730c: e006 b.n 800731c + } + else + { + g_headCtrl.inputSta &= ~0x40; + 800730e: 4b12 ldr r3, [pc, #72] ; (8007358 ) + 8007310: 789b ldrb r3, [r3, #2] + 8007312: f023 0340 bic.w r3, r3, #64 ; 0x40 + 8007316: b2da uxtb r2, r3 + 8007318: 4b0f ldr r3, [pc, #60] ; (8007358 ) + 800731a: 709a strb r2, [r3, #2] + } + + if(GetInput8Status() == SENSOR_ON) + 800731c: f002 f8d4 bl 80094c8 + 8007320: 4603 mov r3, r0 + 8007322: 2b00 cmp r3, #0 + 8007324: d107 bne.n 8007336 + { + g_headCtrl.inputSta |= 0x80; + 8007326: 4b0c ldr r3, [pc, #48] ; (8007358 ) + 8007328: 789b ldrb r3, [r3, #2] + 800732a: f063 037f orn r3, r3, #127 ; 0x7f + 800732e: b2da uxtb r2, r3 + 8007330: 4b09 ldr r3, [pc, #36] ; (8007358 ) + 8007332: 709a strb r2, [r3, #2] + 8007334: e006 b.n 8007344 + } + else + { + g_headCtrl.inputSta &= ~0x80; + 8007336: 4b08 ldr r3, [pc, #32] ; (8007358 ) + 8007338: 789b ldrb r3, [r3, #2] + 800733a: f003 037f and.w r3, r3, #127 ; 0x7f + 800733e: b2da uxtb r2, r3 + 8007340: 4b05 ldr r3, [pc, #20] ; (8007358 ) + 8007342: 709a strb r2, [r3, #2] + } + g_headCtrl.headCmdReg[0] = g_headCtrl.inputSta; + 8007344: 4b04 ldr r3, [pc, #16] ; (8007358 ) + 8007346: 789b ldrb r3, [r3, #2] + 8007348: b29a uxth r2, r3 + 800734a: 4b03 ldr r3, [pc, #12] ; (8007358 ) + 800734c: f503 5310 add.w r3, r3, #9216 ; 0x2400 + 8007350: 3304 adds r3, #4 + 8007352: 801a strh r2, [r3, #0] +} + 8007354: bf00 nop + 8007356: bd80 pop {r7, pc} + 8007358: 2000187c .word 0x2000187c + +0800735c : +} + +//------------------------------------------------------------------------------- +// APж +void APIntProc(void) +{ + 800735c: b580 push {r7, lr} + 800735e: af00 add r7, sp, #0 + if (g_headCtrl.enflag != EN_FALG) + 8007360: 4b81 ldr r3, [pc, #516] ; (8007568 ) + 8007362: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8007366: 3330 adds r3, #48 ; 0x30 + 8007368: 681b ldr r3, [r3, #0] + 800736a: f245 52aa movw r2, #21930 ; 0x55aa + 800736e: 4293 cmp r3, r2 + 8007370: f040 80f7 bne.w 8007562 + { + return; + } +#if (TRIGGER_TYPE == TRG_ECD_AP || TRIGGER_TYPE == TRG_ECD_AB2) + if (GetInputAPStatus() == SENSOR_ON) // ½ش + 8007374: f001 feb2 bl 80090dc + 8007378: 4603 mov r3, r0 + 800737a: 2b00 cmp r3, #0 + 800737c: f040 80ea bne.w 8007554 + { + if (GetInputBPStatus() == SENSOR_OFF) + 8007380: f001 feba bl 80090f8 + 8007384: 4603 mov r3, r0 + 8007386: 2b01 cmp r3, #1 + 8007388: f040 80cc bne.w 8007524 + { + g_headCtrl.encoderValue++; + 800738c: 4b76 ldr r3, [pc, #472] ; (8007568 ) + 800738e: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8007392: 3338 adds r3, #56 ; 0x38 + 8007394: 681b ldr r3, [r3, #0] + 8007396: 1c5a adds r2, r3, #1 + 8007398: 4b73 ldr r3, [pc, #460] ; (8007568 ) + 800739a: f503 530d add.w r3, r3, #9024 ; 0x2340 + 800739e: 3338 adds r3, #56 ; 0x38 + 80073a0: 601a str r2, [r3, #0] + if(g_headCtrl.followEcdCheck == 1) + 80073a2: 4b71 ldr r3, [pc, #452] ; (8007568 ) + 80073a4: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80073a8: 3334 adds r3, #52 ; 0x34 + 80073aa: 681b ldr r3, [r3, #0] + 80073ac: 2b01 cmp r3, #1 + 80073ae: f040 80b2 bne.w 8007516 + { + if(g_headCtrl.encoderValue == g_headCtrl.followStartPPos) // + 80073b2: 4b6d ldr r3, [pc, #436] ; (8007568 ) + 80073b4: f503 530d add.w r3, r3, #9024 ; 0x2340 + 80073b8: 3338 adds r3, #56 ; 0x38 + 80073ba: 681a ldr r2, [r3, #0] + 80073bc: 4b6a ldr r3, [pc, #424] ; (8007568 ) + 80073be: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80073c2: 3304 adds r3, #4 + 80073c4: 681b ldr r3, [r3, #0] + 80073c6: 429a cmp r2, r3 + 80073c8: d13b bne.n 8007442 + { + if(g_headCtrl.pfootSta == 2 || g_headCtrl.pfootSta == 3) + 80073ca: 4b67 ldr r3, [pc, #412] ; (8007568 ) + 80073cc: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 80073d0: 3308 adds r3, #8 + 80073d2: 681b ldr r3, [r3, #0] + 80073d4: 2b02 cmp r3, #2 + 80073d6: d007 beq.n 80073e8 + 80073d8: 4b63 ldr r3, [pc, #396] ; (8007568 ) + 80073da: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 80073de: 3308 adds r3, #8 + 80073e0: 681b ldr r3, [r3, #0] + 80073e2: 2b03 cmp r3, #3 + 80073e4: f040 8097 bne.w 8007516 + { + g_headCtrl.pfootSta = 3; + 80073e8: 4b5f ldr r3, [pc, #380] ; (8007568 ) + 80073ea: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 80073ee: 3308 adds r3, #8 + 80073f0: 2203 movs r2, #3 + 80073f2: 601a str r2, [r3, #0] + g_headCtrl.followEcdDir = 1; + 80073f4: 4b5c ldr r3, [pc, #368] ; (8007568 ) + 80073f6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80073fa: 3330 adds r3, #48 ; 0x30 + 80073fc: 2201 movs r2, #1 + 80073fe: 601a str r2, [r3, #0] + g_headCtrl.followEcdEn = 1; + 8007400: 4b59 ldr r3, [pc, #356] ; (8007568 ) + 8007402: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007406: 3318 adds r3, #24 + 8007408: 2201 movs r2, #1 + 800740a: 601a str r2, [r3, #0] + g_headCtrl.followTableIdx = 0; + 800740c: 4b56 ldr r3, [pc, #344] ; (8007568 ) + 800740e: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007412: 332c adds r3, #44 ; 0x2c + 8007414: 2200 movs r2, #0 + 8007416: 601a str r2, [r3, #0] + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + 8007418: 4b54 ldr r3, [pc, #336] ; (800756c ) + 800741a: 681b ldr r3, [r3, #0] + 800741c: 461a mov r2, r3 + 800741e: 4b52 ldr r3, [pc, #328] ; (8007568 ) + 8007420: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007424: 3320 adds r3, #32 + 8007426: 601a str r2, [r3, #0] + g_headCtrl.followNumHigh = 0; + 8007428: 4b4f ldr r3, [pc, #316] ; (8007568 ) + 800742a: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800742e: 3328 adds r3, #40 ; 0x28 + 8007430: 2200 movs r2, #0 + 8007432: 601a str r2, [r3, #0] + g_headCtrl.followNumLow = 0; + 8007434: 4b4c ldr r3, [pc, #304] ; (8007568 ) + 8007436: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800743a: 3324 adds r3, #36 ; 0x24 + 800743c: 2200 movs r2, #0 + 800743e: 601a str r2, [r3, #0] + 8007440: e069 b.n 8007516 + } + } + else if(g_headCtrl.encoderValue == g_headCtrl.followStartNPos) // ½ + 8007442: 4b49 ldr r3, [pc, #292] ; (8007568 ) + 8007444: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8007448: 3338 adds r3, #56 ; 0x38 + 800744a: 681a ldr r2, [r3, #0] + 800744c: 4b46 ldr r3, [pc, #280] ; (8007568 ) + 800744e: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007452: 3308 adds r3, #8 + 8007454: 681b ldr r3, [r3, #0] + 8007456: 429a cmp r2, r3 + 8007458: d15d bne.n 8007516 + { + if(g_headCtrl.pfootSta == 1 || g_headCtrl.pfootSta == 3) + 800745a: 4b43 ldr r3, [pc, #268] ; (8007568 ) + 800745c: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007460: 3308 adds r3, #8 + 8007462: 681b ldr r3, [r3, #0] + 8007464: 2b01 cmp r3, #1 + 8007466: d006 beq.n 8007476 + 8007468: 4b3f ldr r3, [pc, #252] ; (8007568 ) + 800746a: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800746e: 3308 adds r3, #8 + 8007470: 681b ldr r3, [r3, #0] + 8007472: 2b03 cmp r3, #3 + 8007474: d14f bne.n 8007516 + { + g_headCtrl.pfootSta = 3; + 8007476: 4b3c ldr r3, [pc, #240] ; (8007568 ) + 8007478: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800747c: 3308 adds r3, #8 + 800747e: 2203 movs r2, #3 + 8007480: 601a str r2, [r3, #0] + g_headCtrl.followEcdDir = -1; + 8007482: 4b39 ldr r3, [pc, #228] ; (8007568 ) + 8007484: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007488: 3330 adds r3, #48 ; 0x30 + 800748a: f04f 32ff mov.w r2, #4294967295 + 800748e: 601a str r2, [r3, #0] + g_headCtrl.followEcdEn = 1; + 8007490: 4b35 ldr r3, [pc, #212] ; (8007568 ) + 8007492: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007496: 3318 adds r3, #24 + 8007498: 2201 movs r2, #1 + 800749a: 601a str r2, [r3, #0] + g_headCtrl.followTableIdx = 0; + 800749c: 4b32 ldr r3, [pc, #200] ; (8007568 ) + 800749e: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074a2: 332c adds r3, #44 ; 0x2c + 80074a4: 2200 movs r2, #0 + 80074a6: 601a str r2, [r3, #0] + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + 80074a8: 4b30 ldr r3, [pc, #192] ; (800756c ) + 80074aa: 681b ldr r3, [r3, #0] + 80074ac: 461a mov r2, r3 + 80074ae: 4b2e ldr r3, [pc, #184] ; (8007568 ) + 80074b0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074b4: 3320 adds r3, #32 + 80074b6: 601a str r2, [r3, #0] + g_headCtrl.followNumHigh = 0; + 80074b8: 4b2b ldr r3, [pc, #172] ; (8007568 ) + 80074ba: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074be: 3328 adds r3, #40 ; 0x28 + 80074c0: 2200 movs r2, #0 + 80074c2: 601a str r2, [r3, #0] + g_headCtrl.followNumLow = 0; + 80074c4: 4b28 ldr r3, [pc, #160] ; (8007568 ) + 80074c6: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074ca: 3324 adds r3, #36 ; 0x24 + 80074cc: 2200 movs r2, #0 + 80074ce: 601a str r2, [r3, #0] + if(g_headCtrl.followChangeFlag == 1) + 80074d0: 4b25 ldr r3, [pc, #148] ; (8007568 ) + 80074d2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074d6: 3338 adds r3, #56 ; 0x38 + 80074d8: 681b ldr r3, [r3, #0] + 80074da: 2b01 cmp r3, #1 + 80074dc: d11b bne.n 8007516 + { + g_headCtrl.followRunNum = g_headCtrl.followChangeNum; + 80074de: 4b22 ldr r3, [pc, #136] ; (8007568 ) + 80074e0: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074e4: 333c adds r3, #60 ; 0x3c + 80074e6: 681a ldr r2, [r3, #0] + 80074e8: 4b1f ldr r3, [pc, #124] ; (8007568 ) + 80074ea: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074ee: 601a str r2, [r3, #0] + g_headCtrl.followChangeFlag = 0; + 80074f0: 4b1d ldr r3, [pc, #116] ; (8007568 ) + 80074f2: f503 530e add.w r3, r3, #9088 ; 0x2380 + 80074f6: 3338 adds r3, #56 ; 0x38 + 80074f8: 2200 movs r2, #0 + 80074fa: 601a str r2, [r3, #0] + GetFollowTableValue(g_headCtrl.followConPAng,g_headCtrl.followRunNum); + 80074fc: 4b1a ldr r3, [pc, #104] ; (8007568 ) + 80074fe: f503 530e add.w r3, r3, #9088 ; 0x2380 + 8007502: 330c adds r3, #12 + 8007504: 681a ldr r2, [r3, #0] + 8007506: 4b18 ldr r3, [pc, #96] ; (8007568 ) + 8007508: f503 530e add.w r3, r3, #9088 ; 0x2380 + 800750c: 681b ldr r3, [r3, #0] + 800750e: 4619 mov r1, r3 + 8007510: 4610 mov r0, r2 + 8007512: f7ff fbe5 bl 8006ce0 + } + } + } + } + g_headCtrl.FollowMotoSignOn(); + 8007516: 4b14 ldr r3, [pc, #80] ; (8007568 ) + 8007518: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800751c: 3334 adds r3, #52 ; 0x34 + 800751e: 681b ldr r3, [r3, #0] + 8007520: 4798 blx r3 + 8007522: e010 b.n 8007546 + } + else + { + g_headCtrl.encoderValue--; + 8007524: 4b10 ldr r3, [pc, #64] ; (8007568 ) + 8007526: f503 530d add.w r3, r3, #9024 ; 0x2340 + 800752a: 3338 adds r3, #56 ; 0x38 + 800752c: 681b ldr r3, [r3, #0] + 800752e: 1e5a subs r2, r3, #1 + 8007530: 4b0d ldr r3, [pc, #52] ; (8007568 ) + 8007532: f503 530d add.w r3, r3, #9024 ; 0x2340 + 8007536: 3338 adds r3, #56 ; 0x38 + 8007538: 601a str r2, [r3, #0] + g_headCtrl.FollowMotoSignOff(); + 800753a: 4b0b ldr r3, [pc, #44] ; (8007568 ) + 800753c: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 8007540: 3338 adds r3, #56 ; 0x38 + 8007542: 681b ldr r3, [r3, #0] + 8007544: 4798 blx r3 + } + g_headCtrl.FollowMotoPulseOn(); + 8007546: 4b08 ldr r3, [pc, #32] ; (8007568 ) + 8007548: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800754c: 332c adds r3, #44 ; 0x2c + 800754e: 681b ldr r3, [r3, #0] + 8007550: 4798 blx r3 + 8007552: e007 b.n 8007564 + } + else + { + g_headCtrl.FollowMotoPulseOff(); + 8007554: 4b04 ldr r3, [pc, #16] ; (8007568 ) + 8007556: f503 530f add.w r3, r3, #9152 ; 0x23c0 + 800755a: 3330 adds r3, #48 ; 0x30 + 800755c: 681b ldr r3, [r3, #0] + 800755e: 4798 blx r3 + 8007560: e000 b.n 8007564 + return; + 8007562: bf00 nop + g_headCtrl.FollowMotoSignOff(); + } + g_headCtrl.FollowMotoPulseOn(); +#endif +// printf("AP, evalue=%d\r\n", g_headCtrl.encoderValue); +} + 8007564: bd80 pop {r7, pc} + 8007566: bf00 nop + 8007568: 2000187c .word 0x2000187c + 800756c: 20000214 .word 0x20000214 + +08007570 : + +void BPIntProc(void) +{ + 8007570: b480 push {r7} + 8007572: af00 add r7, sp, #0 + if (g_headCtrl.enflag != EN_FALG) + 8007574: 4b05 ldr r3, [pc, #20] ; (800758c ) + 8007576: f503 530d add.w r3, r3, #9024 ; 0x2340 + 800757a: 3330 adds r3, #48 ; 0x30 + 800757c: 681b ldr r3, [r3, #0] + 800757e: f245 52aa movw r2, #21930 ; 0x55aa + 8007582: 4293 cmp r3, r2 + g_headCtrl.FollowMotoPulseOff(); + +#endif + +// printf("BP\r\n"); +} + 8007584: 46bd mov sp, r7 + 8007586: bc80 pop {r7} + 8007588: 4770 bx lr + 800758a: bf00 nop + 800758c: 2000187c .word 0x2000187c + +08007590 : + +// ZPж +void ZPIntProc(void) +{ + 8007590: b480 push {r7} + 8007592: af00 add r7, sp, #0 + if (g_headCtrl.enflag != EN_FALG) + 8007594: 4b09 ldr r3, [pc, #36] ; (80075bc ) + 8007596: f503 530d add.w r3, r3, #9024 ; 0x2340 + 800759a: 3330 adds r3, #48 ; 0x30 + 800759c: 681b ldr r3, [r3, #0] + 800759e: f245 52aa movw r2, #21930 ; 0x55aa + 80075a2: 4293 cmp r3, r2 + 80075a4: d106 bne.n 80075b4 + { + return; + } +// printf("zp, evalue=%d\r\n", g_headCtrl.encoderValue); + g_headCtrl.encoderValue = 0; + 80075a6: 4b05 ldr r3, [pc, #20] ; (80075bc ) + 80075a8: f503 530d add.w r3, r3, #9024 ; 0x2340 + 80075ac: 3338 adds r3, #56 ; 0x38 + 80075ae: 2200 movs r2, #0 + 80075b0: 601a str r2, [r3, #0] + 80075b2: e000 b.n 80075b6 + return; + 80075b4: bf00 nop +} + 80075b6: 46bd mov sp, r7 + 80075b8: bc80 pop {r7} + 80075ba: 4770 bx lr + 80075bc: 2000187c .word 0x2000187c + +080075c0 : + + +void TestAction(char * para1, char * para2) +{ + 80075c0: b580 push {r7, lr} + 80075c2: b084 sub sp, #16 + 80075c4: af00 add r7, sp, #0 + 80075c6: 6078 str r0, [r7, #4] + 80075c8: 6039 str r1, [r7, #0] + int p1, p2; + + if (para1 == NULL || para2 == NULL) + 80075ca: 687b ldr r3, [r7, #4] + 80075cc: 2b00 cmp r3, #0 + 80075ce: f000 8092 beq.w 80076f6 + 80075d2: 683b ldr r3, [r7, #0] + 80075d4: 2b00 cmp r3, #0 + 80075d6: f000 808e beq.w 80076f6 + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + 80075da: 683a ldr r2, [r7, #0] + 80075dc: 6879 ldr r1, [r7, #4] + 80075de: 4849 ldr r0, [pc, #292] ; (8007704 ) + 80075e0: f002 f994 bl 800990c + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + 80075e4: 687b ldr r3, [r7, #4] + 80075e6: 781b ldrb r3, [r3, #0] + 80075e8: 2b00 cmp r3, #0 + 80075ea: f000 8086 beq.w 80076fa + 80075ee: 683b ldr r3, [r7, #0] + 80075f0: 781b ldrb r3, [r3, #0] + 80075f2: 2b00 cmp r3, #0 + 80075f4: f000 8081 beq.w 80076fa + { + return; + } + p1 = atoi(para1); + 80075f8: 6878 ldr r0, [r7, #4] + 80075fa: f002 f945 bl 8009888 + 80075fe: 60f8 str r0, [r7, #12] + p2 = atoi(para2); + 8007600: 6838 ldr r0, [r7, #0] + 8007602: f002 f941 bl 8009888 + 8007606: 60b8 str r0, [r7, #8] + + if (p1 == p2) + 8007608: 68fa ldr r2, [r7, #12] + 800760a: 68bb ldr r3, [r7, #8] + 800760c: 429a cmp r2, r3 + 800760e: d075 beq.n 80076fc + { + TIM_Cmd(TIM3, DISABLE); + } + } +#else + else if(p1 == 1) + 8007610: 68fb ldr r3, [r7, #12] + 8007612: 2b01 cmp r3, #1 + 8007614: d10d bne.n 8007632 + { + g_headCtrl.pwmCtrl = p2; + 8007616: 68bb ldr r3, [r7, #8] + 8007618: b29a uxth r2, r3 + 800761a: 4b3b ldr r3, [pc, #236] ; (8007708 ) + 800761c: 80da strh r2, [r3, #6] + LL_TIM_EnableCounter(TIM1); + 800761e: 483b ldr r0, [pc, #236] ; (800770c ) + 8007620: f7ff f96f bl 8006902 + printf("ռձȣ%d \r\n",g_headCtrl.pwmCtrl); + 8007624: 4b38 ldr r3, [pc, #224] ; (8007708 ) + 8007626: 88db ldrh r3, [r3, #6] + 8007628: 4619 mov r1, r3 + 800762a: 4839 ldr r0, [pc, #228] ; (8007710 ) + 800762c: f002 f96e bl 800990c + 8007630: e064 b.n 80076fc + } + else if(p1 == 2) + 8007632: 68fb ldr r3, [r7, #12] + 8007634: 2b02 cmp r3, #2 + 8007636: d10d bne.n 8007654 + { + LL_TIM_EnableIT_UPDATE(TIM1); /* ж */ + 8007638: 4834 ldr r0, [pc, #208] ; (800770c ) + 800763a: f7ff f980 bl 800693e + LL_TIM_DisableCounter(TIM1); // رնʱ + 800763e: 4833 ldr r0, [pc, #204] ; (800770c ) + 8007640: f7ff f96e bl 8006920 + printf("رնʱ \r\n"); + 8007644: 4833 ldr r0, [pc, #204] ; (8007714 ) + 8007646: f002 f9d5 bl 80099f4 + SetOutput7Off(); + 800764a: f001 fe9b bl 8009384 + SetOutput6Off(); + 800764e: f001 fe73 bl 8009338 + 8007652: e053 b.n 80076fc + } + else if(p1 == 3) + 8007654: 68fb ldr r3, [r7, #12] + 8007656: 2b03 cmp r3, #3 + 8007658: d104 bne.n 8007664 + { + g_headCtrl.pwmFreq = p2; + 800765a: 68bb ldr r3, [r7, #8] + 800765c: b29a uxth r2, r3 + 800765e: 4b2a ldr r3, [pc, #168] ; (8007708 ) + 8007660: 811a strh r2, [r3, #8] + 8007662: e04b b.n 80076fc + } + else if(p1 == 4) + 8007664: 68fb ldr r3, [r7, #12] + 8007666: 2b04 cmp r3, #4 + 8007668: d103 bne.n 8007672 + { + g_headCtrl.timeCount = 1; + 800766a: 4b27 ldr r3, [pc, #156] ; (8007708 ) + 800766c: 2201 movs r2, #1 + 800766e: 60da str r2, [r3, #12] + 8007670: e044 b.n 80076fc + } +#endif + else if(p1 == 11) + 8007672: 68fb ldr r3, [r7, #12] + 8007674: 2b0b cmp r3, #11 + 8007676: d11d bne.n 80076b4 + { + if(p2 == 1) + 8007678: 68bb ldr r3, [r7, #8] + 800767a: 2b01 cmp r3, #1 + 800767c: d102 bne.n 8007684 + { + SetOutput1On(); + 800767e: f001 fd91 bl 80091a4 + 8007682: e03b b.n 80076fc + } + else if(p2 == 2) + 8007684: 68bb ldr r3, [r7, #8] + 8007686: 2b02 cmp r3, #2 + 8007688: d102 bne.n 8007690 + { + SetOutput2On(); + 800768a: f001 fdb1 bl 80091f0 + 800768e: e035 b.n 80076fc + } + else if(p2 == 6) + 8007690: 68bb ldr r3, [r7, #8] + 8007692: 2b06 cmp r3, #6 + 8007694: d102 bne.n 800769c + { + SetOutput6On(); + 8007696: f001 fe43 bl 8009320 + 800769a: e02f b.n 80076fc + } + else if(p2 == 7) + 800769c: 68bb ldr r3, [r7, #8] + 800769e: 2b07 cmp r3, #7 + 80076a0: d102 bne.n 80076a8 + { + SetOutput7On(); + 80076a2: f001 fe63 bl 800936c + 80076a6: e029 b.n 80076fc + } + else if(p2 == 8) + 80076a8: 68bb ldr r3, [r7, #8] + 80076aa: 2b08 cmp r3, #8 + 80076ac: d126 bne.n 80076fc + { + SetOutput8On(); + 80076ae: f001 fe83 bl 80093b8 + 80076b2: e023 b.n 80076fc + } + } + else if(p1 == 12) + 80076b4: 68fb ldr r3, [r7, #12] + 80076b6: 2b0c cmp r3, #12 + 80076b8: d120 bne.n 80076fc + { + if(p2 == 1) + 80076ba: 68bb ldr r3, [r7, #8] + 80076bc: 2b01 cmp r3, #1 + 80076be: d102 bne.n 80076c6 + { + SetOutput1Off(); + 80076c0: f001 fd7c bl 80091bc + 80076c4: e01a b.n 80076fc + } + else if(p2 == 2) + 80076c6: 68bb ldr r3, [r7, #8] + 80076c8: 2b02 cmp r3, #2 + 80076ca: d102 bne.n 80076d2 + { + SetOutput2Off(); + 80076cc: f001 fd9c bl 8009208 + 80076d0: e014 b.n 80076fc + } + else if(p2 == 6) + 80076d2: 68bb ldr r3, [r7, #8] + 80076d4: 2b06 cmp r3, #6 + 80076d6: d102 bne.n 80076de + { + SetOutput6Off(); + 80076d8: f001 fe2e bl 8009338 + 80076dc: e00e b.n 80076fc + } + else if(p2 == 7) + 80076de: 68bb ldr r3, [r7, #8] + 80076e0: 2b07 cmp r3, #7 + 80076e2: d102 bne.n 80076ea + { + SetOutput7Off(); + 80076e4: f001 fe4e bl 8009384 + 80076e8: e008 b.n 80076fc + } + else if(p2 == 8) + 80076ea: 68bb ldr r3, [r7, #8] + 80076ec: 2b08 cmp r3, #8 + 80076ee: d105 bne.n 80076fc + { + SetOutput8Off(); + 80076f0: f001 fe6e bl 80093d0 + 80076f4: e002 b.n 80076fc + return; + 80076f6: bf00 nop + 80076f8: e000 b.n 80076fc + return; + 80076fa: bf00 nop + } + } +} + 80076fc: 3710 adds r7, #16 + 80076fe: 46bd mov sp, r7 + 8007700: bd80 pop {r7, pc} + 8007702: bf00 nop + 8007704: 0800ad70 .word 0x0800ad70 + 8007708: 2000187c .word 0x2000187c + 800770c: 40012c00 .word 0x40012c00 + 8007710: 0800ad88 .word 0x0800ad88 + 8007714: 0800ad98 .word 0x0800ad98 + +08007718 : +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- + +void InitDebug(void) +{ + 8007718: b580 push {r7, lr} + 800771a: af00 add r7, sp, #0 + AddShellCmd("INPUT", "input detect", TestInputs); + 800771c: 4a05 ldr r2, [pc, #20] ; (8007734 ) + 800771e: 4906 ldr r1, [pc, #24] ; (8007738 ) + 8007720: 4806 ldr r0, [pc, #24] ; (800773c ) + 8007722: f7fc fec9 bl 80044b8 + AddShellCmd("OUTPUT", "output control", TestOutput); + 8007726: 4a06 ldr r2, [pc, #24] ; (8007740 ) + 8007728: 4906 ldr r1, [pc, #24] ; (8007744 ) + 800772a: 4807 ldr r0, [pc, #28] ; (8007748 ) + 800772c: f7fc fec4 bl 80044b8 + do + { + TestOutput("1", "1000"); + }while(1); +#endif +} + 8007730: bf00 nop + 8007732: bd80 pop {r7, pc} + 8007734: 0800774d .word 0x0800774d + 8007738: 0800ada8 .word 0x0800ada8 + 800773c: 0800adb8 .word 0x0800adb8 + 8007740: 0800791d .word 0x0800791d + 8007744: 0800adc0 .word 0x0800adc0 + 8007748: 0800add0 .word 0x0800add0 + +0800774c : + }\ +}while(0) + + +void TestInputs(char * para1, char * para2) +{ + 800774c: b580 push {r7, lr} + 800774e: b088 sub sp, #32 + 8007750: af00 add r7, sp, #0 + 8007752: 6078 str r0, [r7, #4] + 8007754: 6039 str r1, [r7, #0] + int p1, p2; + + if (para1 == NULL || para2 == NULL) + 8007756: 687b ldr r3, [r7, #4] + 8007758: 2b00 cmp r3, #0 + 800775a: f000 80c6 beq.w 80078ea + 800775e: 683b ldr r3, [r7, #0] + 8007760: 2b00 cmp r3, #0 + 8007762: f000 80c2 beq.w 80078ea + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + 8007766: 683a ldr r2, [r7, #0] + 8007768: 6879 ldr r1, [r7, #4] + 800776a: 4862 ldr r0, [pc, #392] ; (80078f4 ) + 800776c: f002 f8ce bl 800990c + + p1 = 0; + 8007770: 2300 movs r3, #0 + 8007772: 61fb str r3, [r7, #28] + p2 = 0; + 8007774: 2300 movs r3, #0 + 8007776: 617b str r3, [r7, #20] + if (strcmp(para1, "") != 0) + 8007778: 687b ldr r3, [r7, #4] + 800777a: 781b ldrb r3, [r3, #0] + 800777c: 2b00 cmp r3, #0 + 800777e: d00b beq.n 8007798 + { + p1 = atoi(para1); + 8007780: 6878 ldr r0, [r7, #4] + 8007782: f002 f881 bl 8009888 + 8007786: 61f8 str r0, [r7, #28] + if (strcmp(para2, "") != 0) + 8007788: 683b ldr r3, [r7, #0] + 800778a: 781b ldrb r3, [r3, #0] + 800778c: 2b00 cmp r3, #0 + 800778e: d003 beq.n 8007798 + { + p2 = atoi(para2); + 8007790: 6838 ldr r0, [r7, #0] + 8007792: f002 f879 bl 8009888 + 8007796: 6178 str r0, [r7, #20] + { + } + + //-------------------------------- + { + int inidx = 0; + 8007798: 2300 movs r3, #0 + 800779a: 61bb str r3, [r7, #24] + u8 inputsta[INPUT_NUM]; + u8 temp; + memset(inputsta, 0xff, INPUT_NUM); + 800779c: f107 0308 add.w r3, r7, #8 + 80077a0: 2208 movs r2, #8 + 80077a2: 21ff movs r1, #255 ; 0xff + 80077a4: 4618 mov r0, r3 + 80077a6: f002 f8a8 bl 80098fa + + do + { + INPUT_OP(0, GetInput1Status); + 80077aa: f001 fe2b bl 8009404 + 80077ae: 4603 mov r3, r0 + 80077b0: 74fb strb r3, [r7, #19] + 80077b2: 7a3b ldrb r3, [r7, #8] + 80077b4: 7cfa ldrb r2, [r7, #19] + 80077b6: 429a cmp r2, r3 + 80077b8: d009 beq.n 80077ce + 80077ba: 7cfb ldrb r3, [r7, #19] + 80077bc: 723b strb r3, [r7, #8] + 80077be: 69b9 ldr r1, [r7, #24] + 80077c0: 1c4b adds r3, r1, #1 + 80077c2: 61bb str r3, [r7, #24] + 80077c4: 7cfb ldrb r3, [r7, #19] + 80077c6: 4a4c ldr r2, [pc, #304] ; (80078f8 ) + 80077c8: 484c ldr r0, [pc, #304] ; (80078fc ) + 80077ca: f002 f89f bl 800990c + INPUT_OP(1, GetInput2Status); + 80077ce: f001 fe27 bl 8009420 + 80077d2: 4603 mov r3, r0 + 80077d4: 74fb strb r3, [r7, #19] + 80077d6: 7a7b ldrb r3, [r7, #9] + 80077d8: 7cfa ldrb r2, [r7, #19] + 80077da: 429a cmp r2, r3 + 80077dc: d009 beq.n 80077f2 + 80077de: 7cfb ldrb r3, [r7, #19] + 80077e0: 727b strb r3, [r7, #9] + 80077e2: 69b9 ldr r1, [r7, #24] + 80077e4: 1c4b adds r3, r1, #1 + 80077e6: 61bb str r3, [r7, #24] + 80077e8: 7cfb ldrb r3, [r7, #19] + 80077ea: 4a45 ldr r2, [pc, #276] ; (8007900 ) + 80077ec: 4843 ldr r0, [pc, #268] ; (80078fc ) + 80077ee: f002 f88d bl 800990c + INPUT_OP(2, GetInput3Status); + 80077f2: f001 fe23 bl 800943c + 80077f6: 4603 mov r3, r0 + 80077f8: 74fb strb r3, [r7, #19] + 80077fa: 7abb ldrb r3, [r7, #10] + 80077fc: 7cfa ldrb r2, [r7, #19] + 80077fe: 429a cmp r2, r3 + 8007800: d009 beq.n 8007816 + 8007802: 7cfb ldrb r3, [r7, #19] + 8007804: 72bb strb r3, [r7, #10] + 8007806: 69b9 ldr r1, [r7, #24] + 8007808: 1c4b adds r3, r1, #1 + 800780a: 61bb str r3, [r7, #24] + 800780c: 7cfb ldrb r3, [r7, #19] + 800780e: 4a3d ldr r2, [pc, #244] ; (8007904 ) + 8007810: 483a ldr r0, [pc, #232] ; (80078fc ) + 8007812: f002 f87b bl 800990c + INPUT_OP(3, GetInput4Status); + 8007816: f001 fe1f bl 8009458 + 800781a: 4603 mov r3, r0 + 800781c: 74fb strb r3, [r7, #19] + 800781e: 7afb ldrb r3, [r7, #11] + 8007820: 7cfa ldrb r2, [r7, #19] + 8007822: 429a cmp r2, r3 + 8007824: d009 beq.n 800783a + 8007826: 7cfb ldrb r3, [r7, #19] + 8007828: 72fb strb r3, [r7, #11] + 800782a: 69b9 ldr r1, [r7, #24] + 800782c: 1c4b adds r3, r1, #1 + 800782e: 61bb str r3, [r7, #24] + 8007830: 7cfb ldrb r3, [r7, #19] + 8007832: 4a35 ldr r2, [pc, #212] ; (8007908 ) + 8007834: 4831 ldr r0, [pc, #196] ; (80078fc ) + 8007836: f002 f869 bl 800990c + INPUT_OP(4, GetInput5Status); + 800783a: f001 fe1b bl 8009474 + 800783e: 4603 mov r3, r0 + 8007840: 74fb strb r3, [r7, #19] + 8007842: 7b3b ldrb r3, [r7, #12] + 8007844: 7cfa ldrb r2, [r7, #19] + 8007846: 429a cmp r2, r3 + 8007848: d009 beq.n 800785e + 800784a: 7cfb ldrb r3, [r7, #19] + 800784c: 733b strb r3, [r7, #12] + 800784e: 69b9 ldr r1, [r7, #24] + 8007850: 1c4b adds r3, r1, #1 + 8007852: 61bb str r3, [r7, #24] + 8007854: 7cfb ldrb r3, [r7, #19] + 8007856: 4a2d ldr r2, [pc, #180] ; (800790c ) + 8007858: 4828 ldr r0, [pc, #160] ; (80078fc ) + 800785a: f002 f857 bl 800990c + INPUT_OP(5, GetInput6Status); + 800785e: f001 fe17 bl 8009490 + 8007862: 4603 mov r3, r0 + 8007864: 74fb strb r3, [r7, #19] + 8007866: 7b7b ldrb r3, [r7, #13] + 8007868: 7cfa ldrb r2, [r7, #19] + 800786a: 429a cmp r2, r3 + 800786c: d009 beq.n 8007882 + 800786e: 7cfb ldrb r3, [r7, #19] + 8007870: 737b strb r3, [r7, #13] + 8007872: 69b9 ldr r1, [r7, #24] + 8007874: 1c4b adds r3, r1, #1 + 8007876: 61bb str r3, [r7, #24] + 8007878: 7cfb ldrb r3, [r7, #19] + 800787a: 4a25 ldr r2, [pc, #148] ; (8007910 ) + 800787c: 481f ldr r0, [pc, #124] ; (80078fc ) + 800787e: f002 f845 bl 800990c + INPUT_OP(6, GetInput7Status); + 8007882: f001 fe13 bl 80094ac + 8007886: 4603 mov r3, r0 + 8007888: 74fb strb r3, [r7, #19] + 800788a: 7bbb ldrb r3, [r7, #14] + 800788c: 7cfa ldrb r2, [r7, #19] + 800788e: 429a cmp r2, r3 + 8007890: d009 beq.n 80078a6 + 8007892: 7cfb ldrb r3, [r7, #19] + 8007894: 73bb strb r3, [r7, #14] + 8007896: 69b9 ldr r1, [r7, #24] + 8007898: 1c4b adds r3, r1, #1 + 800789a: 61bb str r3, [r7, #24] + 800789c: 7cfb ldrb r3, [r7, #19] + 800789e: 4a1d ldr r2, [pc, #116] ; (8007914 ) + 80078a0: 4816 ldr r0, [pc, #88] ; (80078fc ) + 80078a2: f002 f833 bl 800990c + INPUT_OP(7, GetInput8Status); + 80078a6: f001 fe0f bl 80094c8 + 80078aa: 4603 mov r3, r0 + 80078ac: 74fb strb r3, [r7, #19] + 80078ae: 7bfb ldrb r3, [r7, #15] + 80078b0: 7cfa ldrb r2, [r7, #19] + 80078b2: 429a cmp r2, r3 + 80078b4: d009 beq.n 80078ca + 80078b6: 7cfb ldrb r3, [r7, #19] + 80078b8: 73fb strb r3, [r7, #15] + 80078ba: 69b9 ldr r1, [r7, #24] + 80078bc: 1c4b adds r3, r1, #1 + 80078be: 61bb str r3, [r7, #24] + 80078c0: 7cfb ldrb r3, [r7, #19] + 80078c2: 4a15 ldr r2, [pc, #84] ; (8007918 ) + 80078c4: 480d ldr r0, [pc, #52] ; (80078fc ) + 80078c6: f002 f821 bl 800990c + + DelayMs(10); + 80078ca: 200a movs r0, #10 + 80078cc: f7fb feba bl 8003644 + + if (IsConsoleCancel() != 0 || p1 == 0) // նֹͣ + 80078d0: f7fb fe68 bl 80035a4 + 80078d4: 4603 mov r3, r0 + 80078d6: 2b00 cmp r3, #0 + 80078d8: d108 bne.n 80078ec + 80078da: 69fb ldr r3, [r7, #28] + 80078dc: 2b00 cmp r3, #0 + 80078de: d005 beq.n 80078ec + { + break; + } + + }while(p1 != 0); + 80078e0: 69fb ldr r3, [r7, #28] + 80078e2: 2b00 cmp r3, #0 + 80078e4: f47f af61 bne.w 80077aa + 80078e8: e000 b.n 80078ec + return; + 80078ea: bf00 nop + } +} + 80078ec: 3720 adds r7, #32 + 80078ee: 46bd mov sp, r7 + 80078f0: bd80 pop {r7, pc} + 80078f2: bf00 nop + 80078f4: 0800add8 .word 0x0800add8 + 80078f8: 2000022c .word 0x2000022c + 80078fc: 0800adf0 .word 0x0800adf0 + 8007900: 20000240 .word 0x20000240 + 8007904: 20000254 .word 0x20000254 + 8007908: 20000268 .word 0x20000268 + 800790c: 2000027c .word 0x2000027c + 8007910: 20000290 .word 0x20000290 + 8007914: 200002a4 .word 0x200002a4 + 8007918: 200002b8 .word 0x200002b8 + +0800791c : + }\ +}while(0) + + +void TestOutput(char * para1, char * para2) +{ + 800791c: b580 push {r7, lr} + 800791e: b086 sub sp, #24 + 8007920: af00 add r7, sp, #0 + 8007922: 6078 str r0, [r7, #4] + 8007924: 6039 str r1, [r7, #0] + int p1, p2; + int count, delay; + + if (para1 == NULL || para2 == NULL) + 8007926: 687b ldr r3, [r7, #4] + 8007928: 2b00 cmp r3, #0 + 800792a: f001 82db beq.w 8008ee4 + 800792e: 683b ldr r3, [r7, #0] + 8007930: 2b00 cmp r3, #0 + 8007932: f001 82d7 beq.w 8008ee4 + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + 8007936: 683a ldr r2, [r7, #0] + 8007938: 6879 ldr r1, [r7, #4] + 800793a: 48b8 ldr r0, [pc, #736] ; (8007c1c ) + 800793c: f001 ffe6 bl 800990c + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + 8007940: 687b ldr r3, [r7, #4] + 8007942: 781b ldrb r3, [r3, #0] + 8007944: 2b00 cmp r3, #0 + 8007946: f001 82cf beq.w 8008ee8 + 800794a: 683b ldr r3, [r7, #0] + 800794c: 781b ldrb r3, [r3, #0] + 800794e: 2b00 cmp r3, #0 + 8007950: f001 82ca beq.w 8008ee8 + { + return; + } + p1 = atoi(para1); + 8007954: 6878 ldr r0, [r7, #4] + 8007956: f001 ff97 bl 8009888 + 800795a: 60f8 str r0, [r7, #12] + p2 = atoi(para2); + 800795c: 6838 ldr r0, [r7, #0] + 800795e: f001 ff93 bl 8009888 + 8007962: 60b8 str r0, [r7, #8] + if (p1 == p2) + { + } + + //-------------------------------- + if (p1 == 0) + 8007964: 68fb ldr r3, [r7, #12] + 8007966: 2b00 cmp r3, #0 + 8007968: f040 8543 bne.w 80083f2 + { + if (p2 == 0) + 800796c: 68bb ldr r3, [r7, #8] + 800796e: 2b00 cmp r3, #0 + 8007970: f041 82cd bne.w 8008f0e + { + TOUT_OP(0, Output1, 1000); + 8007974: 68bb ldr r3, [r7, #8] + 8007976: 2b00 cmp r3, #0 + 8007978: d10a bne.n 8007990 + 800797a: f001 fc1f bl 80091bc + 800797e: f001 fc29 bl 80091d4 + 8007982: 4603 mov r3, r0 + 8007984: 4aa6 ldr r2, [pc, #664] ; (8007c20 ) + 8007986: 2101 movs r1, #1 + 8007988: 48a6 ldr r0, [pc, #664] ; (8007c24 ) + 800798a: f001 ffbf bl 800990c + 800798e: e094 b.n 8007aba + 8007990: 68bb ldr r3, [r7, #8] + 8007992: 2b01 cmp r3, #1 + 8007994: d10a bne.n 80079ac + 8007996: f001 fc05 bl 80091a4 + 800799a: f001 fc1b bl 80091d4 + 800799e: 4603 mov r3, r0 + 80079a0: 4a9f ldr r2, [pc, #636] ; (8007c20 ) + 80079a2: 2101 movs r1, #1 + 80079a4: 489f ldr r0, [pc, #636] ; (8007c24 ) + 80079a6: f001 ffb1 bl 800990c + 80079aa: e086 b.n 8007aba + 80079ac: 68bb ldr r3, [r7, #8] + 80079ae: 2b02 cmp r3, #2 + 80079b0: d118 bne.n 80079e4 + 80079b2: f001 fbf7 bl 80091a4 + 80079b6: f001 fc0d bl 80091d4 + 80079ba: 4603 mov r3, r0 + 80079bc: 4a98 ldr r2, [pc, #608] ; (8007c20 ) + 80079be: 2101 movs r1, #1 + 80079c0: 4898 ldr r0, [pc, #608] ; (8007c24 ) + 80079c2: f001 ffa3 bl 800990c + 80079c6: f44f 707a mov.w r0, #1000 ; 0x3e8 + 80079ca: f7fb fe3b bl 8003644 + 80079ce: f001 fbf5 bl 80091bc + 80079d2: f001 fbff bl 80091d4 + 80079d6: 4603 mov r3, r0 + 80079d8: 4a91 ldr r2, [pc, #580] ; (8007c20 ) + 80079da: 2101 movs r1, #1 + 80079dc: 4891 ldr r0, [pc, #580] ; (8007c24 ) + 80079de: f001 ff95 bl 800990c + 80079e2: e06a b.n 8007aba + 80079e4: 68bb ldr r3, [r7, #8] + 80079e6: 2b00 cmp r3, #0 + 80079e8: dd67 ble.n 8007aba + 80079ea: 68bb ldr r3, [r7, #8] + 80079ec: f44f 727a mov.w r2, #1000 ; 0x3e8 + 80079f0: fb02 f303 mul.w r3, r2, r3 + 80079f4: 617b str r3, [r7, #20] + 80079f6: e051 b.n 8007a9c + 80079f8: 697b ldr r3, [r7, #20] + 80079fa: 3b01 subs r3, #1 + 80079fc: 617b str r3, [r7, #20] + 80079fe: f001 fbd1 bl 80091a4 + 8007a02: f001 fbe7 bl 80091d4 + 8007a06: 4603 mov r3, r0 + 8007a08: 4a85 ldr r2, [pc, #532] ; (8007c20 ) + 8007a0a: 2101 movs r1, #1 + 8007a0c: 4885 ldr r0, [pc, #532] ; (8007c24 ) + 8007a0e: f001 ff7d bl 800990c + 8007a12: 68bb ldr r3, [r7, #8] + 8007a14: 3309 adds r3, #9 + 8007a16: 4a84 ldr r2, [pc, #528] ; (8007c28 ) + 8007a18: fb82 1203 smull r1, r2, r2, r3 + 8007a1c: 1092 asrs r2, r2, #2 + 8007a1e: 17db asrs r3, r3, #31 + 8007a20: 1ad3 subs r3, r2, r3 + 8007a22: 613b str r3, [r7, #16] + 8007a24: 200a movs r0, #10 + 8007a26: f7fb fe0d bl 8003644 + 8007a2a: f7fb fdbb bl 80035a4 + 8007a2e: 4603 mov r3, r0 + 8007a30: 2b00 cmp r3, #0 + 8007a32: d106 bne.n 8007a42 + 8007a34: 693b ldr r3, [r7, #16] + 8007a36: 3b01 subs r3, #1 + 8007a38: 613b str r3, [r7, #16] + 8007a3a: 693b ldr r3, [r7, #16] + 8007a3c: 2b00 cmp r3, #0 + 8007a3e: d1f1 bne.n 8007a24 + 8007a40: e000 b.n 8007a44 + 8007a42: bf00 nop + 8007a44: 693b ldr r3, [r7, #16] + 8007a46: 2b00 cmp r3, #0 + 8007a48: d12c bne.n 8007aa4 + 8007a4a: f001 fbb7 bl 80091bc + 8007a4e: f001 fbc1 bl 80091d4 + 8007a52: 4603 mov r3, r0 + 8007a54: 4a72 ldr r2, [pc, #456] ; (8007c20 ) + 8007a56: 2101 movs r1, #1 + 8007a58: 4872 ldr r0, [pc, #456] ; (8007c24 ) + 8007a5a: f001 ff57 bl 800990c + 8007a5e: 68bb ldr r3, [r7, #8] + 8007a60: 3309 adds r3, #9 + 8007a62: 4a71 ldr r2, [pc, #452] ; (8007c28 ) + 8007a64: fb82 1203 smull r1, r2, r2, r3 + 8007a68: 1092 asrs r2, r2, #2 + 8007a6a: 17db asrs r3, r3, #31 + 8007a6c: 1ad3 subs r3, r2, r3 + 8007a6e: 613b str r3, [r7, #16] + 8007a70: 693b ldr r3, [r7, #16] + 8007a72: 009b lsls r3, r3, #2 + 8007a74: 613b str r3, [r7, #16] + 8007a76: 200a movs r0, #10 + 8007a78: f7fb fde4 bl 8003644 + 8007a7c: f7fb fd92 bl 80035a4 + 8007a80: 4603 mov r3, r0 + 8007a82: 2b00 cmp r3, #0 + 8007a84: d106 bne.n 8007a94 + 8007a86: 693b ldr r3, [r7, #16] + 8007a88: 3b01 subs r3, #1 + 8007a8a: 613b str r3, [r7, #16] + 8007a8c: 693b ldr r3, [r7, #16] + 8007a8e: 2b00 cmp r3, #0 + 8007a90: d1f1 bne.n 8007a76 + 8007a92: e000 b.n 8007a96 + 8007a94: bf00 nop + 8007a96: 693b ldr r3, [r7, #16] + 8007a98: 2b00 cmp r3, #0 + 8007a9a: d103 bne.n 8007aa4 + 8007a9c: 697b ldr r3, [r7, #20] + 8007a9e: 2b00 cmp r3, #0 + 8007aa0: dcaa bgt.n 80079f8 + 8007aa2: e000 b.n 8007aa6 + 8007aa4: bf00 nop + 8007aa6: f001 fb89 bl 80091bc + 8007aaa: f001 fb93 bl 80091d4 + 8007aae: 4603 mov r3, r0 + 8007ab0: 4a5b ldr r2, [pc, #364] ; (8007c20 ) + 8007ab2: 2101 movs r1, #1 + 8007ab4: 485b ldr r0, [pc, #364] ; (8007c24 ) + 8007ab6: f001 ff29 bl 800990c + TOUT_OP(1, Output2, 1000); + 8007aba: 68bb ldr r3, [r7, #8] + 8007abc: 2b00 cmp r3, #0 + 8007abe: d10a bne.n 8007ad6 + 8007ac0: f001 fba2 bl 8009208 + 8007ac4: f001 fbac bl 8009220 + 8007ac8: 4603 mov r3, r0 + 8007aca: 4a58 ldr r2, [pc, #352] ; (8007c2c ) + 8007acc: 2102 movs r1, #2 + 8007ace: 4855 ldr r0, [pc, #340] ; (8007c24 ) + 8007ad0: f001 ff1c bl 800990c + 8007ad4: e094 b.n 8007c00 + 8007ad6: 68bb ldr r3, [r7, #8] + 8007ad8: 2b01 cmp r3, #1 + 8007ada: d10a bne.n 8007af2 + 8007adc: f001 fb88 bl 80091f0 + 8007ae0: f001 fb9e bl 8009220 + 8007ae4: 4603 mov r3, r0 + 8007ae6: 4a51 ldr r2, [pc, #324] ; (8007c2c ) + 8007ae8: 2102 movs r1, #2 + 8007aea: 484e ldr r0, [pc, #312] ; (8007c24 ) + 8007aec: f001 ff0e bl 800990c + 8007af0: e086 b.n 8007c00 + 8007af2: 68bb ldr r3, [r7, #8] + 8007af4: 2b02 cmp r3, #2 + 8007af6: d118 bne.n 8007b2a + 8007af8: f001 fb7a bl 80091f0 + 8007afc: f001 fb90 bl 8009220 + 8007b00: 4603 mov r3, r0 + 8007b02: 4a4a ldr r2, [pc, #296] ; (8007c2c ) + 8007b04: 2102 movs r1, #2 + 8007b06: 4847 ldr r0, [pc, #284] ; (8007c24 ) + 8007b08: f001 ff00 bl 800990c + 8007b0c: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8007b10: f7fb fd98 bl 8003644 + 8007b14: f001 fb78 bl 8009208 + 8007b18: f001 fb82 bl 8009220 + 8007b1c: 4603 mov r3, r0 + 8007b1e: 4a43 ldr r2, [pc, #268] ; (8007c2c ) + 8007b20: 2102 movs r1, #2 + 8007b22: 4840 ldr r0, [pc, #256] ; (8007c24 ) + 8007b24: f001 fef2 bl 800990c + 8007b28: e06a b.n 8007c00 + 8007b2a: 68bb ldr r3, [r7, #8] + 8007b2c: 2b00 cmp r3, #0 + 8007b2e: dd67 ble.n 8007c00 + 8007b30: 68bb ldr r3, [r7, #8] + 8007b32: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8007b36: fb02 f303 mul.w r3, r2, r3 + 8007b3a: 617b str r3, [r7, #20] + 8007b3c: e051 b.n 8007be2 + 8007b3e: 697b ldr r3, [r7, #20] + 8007b40: 3b01 subs r3, #1 + 8007b42: 617b str r3, [r7, #20] + 8007b44: f001 fb54 bl 80091f0 + 8007b48: f001 fb6a bl 8009220 + 8007b4c: 4603 mov r3, r0 + 8007b4e: 4a37 ldr r2, [pc, #220] ; (8007c2c ) + 8007b50: 2102 movs r1, #2 + 8007b52: 4834 ldr r0, [pc, #208] ; (8007c24 ) + 8007b54: f001 feda bl 800990c + 8007b58: 68bb ldr r3, [r7, #8] + 8007b5a: 3309 adds r3, #9 + 8007b5c: 4a32 ldr r2, [pc, #200] ; (8007c28 ) + 8007b5e: fb82 1203 smull r1, r2, r2, r3 + 8007b62: 1092 asrs r2, r2, #2 + 8007b64: 17db asrs r3, r3, #31 + 8007b66: 1ad3 subs r3, r2, r3 + 8007b68: 613b str r3, [r7, #16] + 8007b6a: 200a movs r0, #10 + 8007b6c: f7fb fd6a bl 8003644 + 8007b70: f7fb fd18 bl 80035a4 + 8007b74: 4603 mov r3, r0 + 8007b76: 2b00 cmp r3, #0 + 8007b78: d106 bne.n 8007b88 + 8007b7a: 693b ldr r3, [r7, #16] + 8007b7c: 3b01 subs r3, #1 + 8007b7e: 613b str r3, [r7, #16] + 8007b80: 693b ldr r3, [r7, #16] + 8007b82: 2b00 cmp r3, #0 + 8007b84: d1f1 bne.n 8007b6a + 8007b86: e000 b.n 8007b8a + 8007b88: bf00 nop + 8007b8a: 693b ldr r3, [r7, #16] + 8007b8c: 2b00 cmp r3, #0 + 8007b8e: d12c bne.n 8007bea + 8007b90: f001 fb3a bl 8009208 + 8007b94: f001 fb44 bl 8009220 + 8007b98: 4603 mov r3, r0 + 8007b9a: 4a24 ldr r2, [pc, #144] ; (8007c2c ) + 8007b9c: 2102 movs r1, #2 + 8007b9e: 4821 ldr r0, [pc, #132] ; (8007c24 ) + 8007ba0: f001 feb4 bl 800990c + 8007ba4: 68bb ldr r3, [r7, #8] + 8007ba6: 3309 adds r3, #9 + 8007ba8: 4a1f ldr r2, [pc, #124] ; (8007c28 ) + 8007baa: fb82 1203 smull r1, r2, r2, r3 + 8007bae: 1092 asrs r2, r2, #2 + 8007bb0: 17db asrs r3, r3, #31 + 8007bb2: 1ad3 subs r3, r2, r3 + 8007bb4: 613b str r3, [r7, #16] + 8007bb6: 693b ldr r3, [r7, #16] + 8007bb8: 009b lsls r3, r3, #2 + 8007bba: 613b str r3, [r7, #16] + 8007bbc: 200a movs r0, #10 + 8007bbe: f7fb fd41 bl 8003644 + 8007bc2: f7fb fcef bl 80035a4 + 8007bc6: 4603 mov r3, r0 + 8007bc8: 2b00 cmp r3, #0 + 8007bca: d106 bne.n 8007bda + 8007bcc: 693b ldr r3, [r7, #16] + 8007bce: 3b01 subs r3, #1 + 8007bd0: 613b str r3, [r7, #16] + 8007bd2: 693b ldr r3, [r7, #16] + 8007bd4: 2b00 cmp r3, #0 + 8007bd6: d1f1 bne.n 8007bbc + 8007bd8: e000 b.n 8007bdc + 8007bda: bf00 nop + 8007bdc: 693b ldr r3, [r7, #16] + 8007bde: 2b00 cmp r3, #0 + 8007be0: d103 bne.n 8007bea + 8007be2: 697b ldr r3, [r7, #20] + 8007be4: 2b00 cmp r3, #0 + 8007be6: dcaa bgt.n 8007b3e + 8007be8: e000 b.n 8007bec + 8007bea: bf00 nop + 8007bec: f001 fb0c bl 8009208 + 8007bf0: f001 fb16 bl 8009220 + 8007bf4: 4603 mov r3, r0 + 8007bf6: 4a0d ldr r2, [pc, #52] ; (8007c2c ) + 8007bf8: 2102 movs r1, #2 + 8007bfa: 480a ldr r0, [pc, #40] ; (8007c24 ) + 8007bfc: f001 fe86 bl 800990c + TOUT_OP(2, Output3, 1000); + 8007c00: 68bb ldr r3, [r7, #8] + 8007c02: 2b00 cmp r3, #0 + 8007c04: d116 bne.n 8007c34 + 8007c06: f001 fb25 bl 8009254 + 8007c0a: f001 fb2f bl 800926c + 8007c0e: 4603 mov r3, r0 + 8007c10: 4a07 ldr r2, [pc, #28] ; (8007c30 ) + 8007c12: 2103 movs r1, #3 + 8007c14: 4803 ldr r0, [pc, #12] ; (8007c24 ) + 8007c16: f001 fe79 bl 800990c + 8007c1a: e0a0 b.n 8007d5e + 8007c1c: 0800add8 .word 0x0800add8 + 8007c20: 200002cc .word 0x200002cc + 8007c24: 0800adf0 .word 0x0800adf0 + 8007c28: 66666667 .word 0x66666667 + 8007c2c: 200002e0 .word 0x200002e0 + 8007c30: 200002f4 .word 0x200002f4 + 8007c34: 68bb ldr r3, [r7, #8] + 8007c36: 2b01 cmp r3, #1 + 8007c38: d10a bne.n 8007c50 + 8007c3a: f001 faff bl 800923c + 8007c3e: f001 fb15 bl 800926c + 8007c42: 4603 mov r3, r0 + 8007c44: 4ab8 ldr r2, [pc, #736] ; (8007f28 ) + 8007c46: 2103 movs r1, #3 + 8007c48: 48b8 ldr r0, [pc, #736] ; (8007f2c ) + 8007c4a: f001 fe5f bl 800990c + 8007c4e: e086 b.n 8007d5e + 8007c50: 68bb ldr r3, [r7, #8] + 8007c52: 2b02 cmp r3, #2 + 8007c54: d118 bne.n 8007c88 + 8007c56: f001 faf1 bl 800923c + 8007c5a: f001 fb07 bl 800926c + 8007c5e: 4603 mov r3, r0 + 8007c60: 4ab1 ldr r2, [pc, #708] ; (8007f28 ) + 8007c62: 2103 movs r1, #3 + 8007c64: 48b1 ldr r0, [pc, #708] ; (8007f2c ) + 8007c66: f001 fe51 bl 800990c + 8007c6a: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8007c6e: f7fb fce9 bl 8003644 + 8007c72: f001 faef bl 8009254 + 8007c76: f001 faf9 bl 800926c + 8007c7a: 4603 mov r3, r0 + 8007c7c: 4aaa ldr r2, [pc, #680] ; (8007f28 ) + 8007c7e: 2103 movs r1, #3 + 8007c80: 48aa ldr r0, [pc, #680] ; (8007f2c ) + 8007c82: f001 fe43 bl 800990c + 8007c86: e06a b.n 8007d5e + 8007c88: 68bb ldr r3, [r7, #8] + 8007c8a: 2b00 cmp r3, #0 + 8007c8c: dd67 ble.n 8007d5e + 8007c8e: 68bb ldr r3, [r7, #8] + 8007c90: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8007c94: fb02 f303 mul.w r3, r2, r3 + 8007c98: 617b str r3, [r7, #20] + 8007c9a: e051 b.n 8007d40 + 8007c9c: 697b ldr r3, [r7, #20] + 8007c9e: 3b01 subs r3, #1 + 8007ca0: 617b str r3, [r7, #20] + 8007ca2: f001 facb bl 800923c + 8007ca6: f001 fae1 bl 800926c + 8007caa: 4603 mov r3, r0 + 8007cac: 4a9e ldr r2, [pc, #632] ; (8007f28 ) + 8007cae: 2103 movs r1, #3 + 8007cb0: 489e ldr r0, [pc, #632] ; (8007f2c ) + 8007cb2: f001 fe2b bl 800990c + 8007cb6: 68bb ldr r3, [r7, #8] + 8007cb8: 3309 adds r3, #9 + 8007cba: 4a9d ldr r2, [pc, #628] ; (8007f30 ) + 8007cbc: fb82 1203 smull r1, r2, r2, r3 + 8007cc0: 1092 asrs r2, r2, #2 + 8007cc2: 17db asrs r3, r3, #31 + 8007cc4: 1ad3 subs r3, r2, r3 + 8007cc6: 613b str r3, [r7, #16] + 8007cc8: 200a movs r0, #10 + 8007cca: f7fb fcbb bl 8003644 + 8007cce: f7fb fc69 bl 80035a4 + 8007cd2: 4603 mov r3, r0 + 8007cd4: 2b00 cmp r3, #0 + 8007cd6: d106 bne.n 8007ce6 + 8007cd8: 693b ldr r3, [r7, #16] + 8007cda: 3b01 subs r3, #1 + 8007cdc: 613b str r3, [r7, #16] + 8007cde: 693b ldr r3, [r7, #16] + 8007ce0: 2b00 cmp r3, #0 + 8007ce2: d1f1 bne.n 8007cc8 + 8007ce4: e000 b.n 8007ce8 + 8007ce6: bf00 nop + 8007ce8: 693b ldr r3, [r7, #16] + 8007cea: 2b00 cmp r3, #0 + 8007cec: d12c bne.n 8007d48 + 8007cee: f001 fab1 bl 8009254 + 8007cf2: f001 fabb bl 800926c + 8007cf6: 4603 mov r3, r0 + 8007cf8: 4a8b ldr r2, [pc, #556] ; (8007f28 ) + 8007cfa: 2103 movs r1, #3 + 8007cfc: 488b ldr r0, [pc, #556] ; (8007f2c ) + 8007cfe: f001 fe05 bl 800990c + 8007d02: 68bb ldr r3, [r7, #8] + 8007d04: 3309 adds r3, #9 + 8007d06: 4a8a ldr r2, [pc, #552] ; (8007f30 ) + 8007d08: fb82 1203 smull r1, r2, r2, r3 + 8007d0c: 1092 asrs r2, r2, #2 + 8007d0e: 17db asrs r3, r3, #31 + 8007d10: 1ad3 subs r3, r2, r3 + 8007d12: 613b str r3, [r7, #16] + 8007d14: 693b ldr r3, [r7, #16] + 8007d16: 009b lsls r3, r3, #2 + 8007d18: 613b str r3, [r7, #16] + 8007d1a: 200a movs r0, #10 + 8007d1c: f7fb fc92 bl 8003644 + 8007d20: f7fb fc40 bl 80035a4 + 8007d24: 4603 mov r3, r0 + 8007d26: 2b00 cmp r3, #0 + 8007d28: d106 bne.n 8007d38 + 8007d2a: 693b ldr r3, [r7, #16] + 8007d2c: 3b01 subs r3, #1 + 8007d2e: 613b str r3, [r7, #16] + 8007d30: 693b ldr r3, [r7, #16] + 8007d32: 2b00 cmp r3, #0 + 8007d34: d1f1 bne.n 8007d1a + 8007d36: e000 b.n 8007d3a + 8007d38: bf00 nop + 8007d3a: 693b ldr r3, [r7, #16] + 8007d3c: 2b00 cmp r3, #0 + 8007d3e: d103 bne.n 8007d48 + 8007d40: 697b ldr r3, [r7, #20] + 8007d42: 2b00 cmp r3, #0 + 8007d44: dcaa bgt.n 8007c9c + 8007d46: e000 b.n 8007d4a + 8007d48: bf00 nop + 8007d4a: f001 fa83 bl 8009254 + 8007d4e: f001 fa8d bl 800926c + 8007d52: 4603 mov r3, r0 + 8007d54: 4a74 ldr r2, [pc, #464] ; (8007f28 ) + 8007d56: 2103 movs r1, #3 + 8007d58: 4874 ldr r0, [pc, #464] ; (8007f2c ) + 8007d5a: f001 fdd7 bl 800990c + TOUT_OP(3, Output4, 1000); + 8007d5e: 68bb ldr r3, [r7, #8] + 8007d60: 2b00 cmp r3, #0 + 8007d62: d10a bne.n 8007d7a + 8007d64: f001 fa9c bl 80092a0 + 8007d68: f001 faa6 bl 80092b8 + 8007d6c: 4603 mov r3, r0 + 8007d6e: 4a71 ldr r2, [pc, #452] ; (8007f34 ) + 8007d70: 2104 movs r1, #4 + 8007d72: 486e ldr r0, [pc, #440] ; (8007f2c ) + 8007d74: f001 fdca bl 800990c + 8007d78: e094 b.n 8007ea4 + 8007d7a: 68bb ldr r3, [r7, #8] + 8007d7c: 2b01 cmp r3, #1 + 8007d7e: d10a bne.n 8007d96 + 8007d80: f001 fa82 bl 8009288 + 8007d84: f001 fa98 bl 80092b8 + 8007d88: 4603 mov r3, r0 + 8007d8a: 4a6a ldr r2, [pc, #424] ; (8007f34 ) + 8007d8c: 2104 movs r1, #4 + 8007d8e: 4867 ldr r0, [pc, #412] ; (8007f2c ) + 8007d90: f001 fdbc bl 800990c + 8007d94: e086 b.n 8007ea4 + 8007d96: 68bb ldr r3, [r7, #8] + 8007d98: 2b02 cmp r3, #2 + 8007d9a: d118 bne.n 8007dce + 8007d9c: f001 fa74 bl 8009288 + 8007da0: f001 fa8a bl 80092b8 + 8007da4: 4603 mov r3, r0 + 8007da6: 4a63 ldr r2, [pc, #396] ; (8007f34 ) + 8007da8: 2104 movs r1, #4 + 8007daa: 4860 ldr r0, [pc, #384] ; (8007f2c ) + 8007dac: f001 fdae bl 800990c + 8007db0: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8007db4: f7fb fc46 bl 8003644 + 8007db8: f001 fa72 bl 80092a0 + 8007dbc: f001 fa7c bl 80092b8 + 8007dc0: 4603 mov r3, r0 + 8007dc2: 4a5c ldr r2, [pc, #368] ; (8007f34 ) + 8007dc4: 2104 movs r1, #4 + 8007dc6: 4859 ldr r0, [pc, #356] ; (8007f2c ) + 8007dc8: f001 fda0 bl 800990c + 8007dcc: e06a b.n 8007ea4 + 8007dce: 68bb ldr r3, [r7, #8] + 8007dd0: 2b00 cmp r3, #0 + 8007dd2: dd67 ble.n 8007ea4 + 8007dd4: 68bb ldr r3, [r7, #8] + 8007dd6: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8007dda: fb02 f303 mul.w r3, r2, r3 + 8007dde: 617b str r3, [r7, #20] + 8007de0: e051 b.n 8007e86 + 8007de2: 697b ldr r3, [r7, #20] + 8007de4: 3b01 subs r3, #1 + 8007de6: 617b str r3, [r7, #20] + 8007de8: f001 fa4e bl 8009288 + 8007dec: f001 fa64 bl 80092b8 + 8007df0: 4603 mov r3, r0 + 8007df2: 4a50 ldr r2, [pc, #320] ; (8007f34 ) + 8007df4: 2104 movs r1, #4 + 8007df6: 484d ldr r0, [pc, #308] ; (8007f2c ) + 8007df8: f001 fd88 bl 800990c + 8007dfc: 68bb ldr r3, [r7, #8] + 8007dfe: 3309 adds r3, #9 + 8007e00: 4a4b ldr r2, [pc, #300] ; (8007f30 ) + 8007e02: fb82 1203 smull r1, r2, r2, r3 + 8007e06: 1092 asrs r2, r2, #2 + 8007e08: 17db asrs r3, r3, #31 + 8007e0a: 1ad3 subs r3, r2, r3 + 8007e0c: 613b str r3, [r7, #16] + 8007e0e: 200a movs r0, #10 + 8007e10: f7fb fc18 bl 8003644 + 8007e14: f7fb fbc6 bl 80035a4 + 8007e18: 4603 mov r3, r0 + 8007e1a: 2b00 cmp r3, #0 + 8007e1c: d106 bne.n 8007e2c + 8007e1e: 693b ldr r3, [r7, #16] + 8007e20: 3b01 subs r3, #1 + 8007e22: 613b str r3, [r7, #16] + 8007e24: 693b ldr r3, [r7, #16] + 8007e26: 2b00 cmp r3, #0 + 8007e28: d1f1 bne.n 8007e0e + 8007e2a: e000 b.n 8007e2e + 8007e2c: bf00 nop + 8007e2e: 693b ldr r3, [r7, #16] + 8007e30: 2b00 cmp r3, #0 + 8007e32: d12c bne.n 8007e8e + 8007e34: f001 fa34 bl 80092a0 + 8007e38: f001 fa3e bl 80092b8 + 8007e3c: 4603 mov r3, r0 + 8007e3e: 4a3d ldr r2, [pc, #244] ; (8007f34 ) + 8007e40: 2104 movs r1, #4 + 8007e42: 483a ldr r0, [pc, #232] ; (8007f2c ) + 8007e44: f001 fd62 bl 800990c + 8007e48: 68bb ldr r3, [r7, #8] + 8007e4a: 3309 adds r3, #9 + 8007e4c: 4a38 ldr r2, [pc, #224] ; (8007f30 ) + 8007e4e: fb82 1203 smull r1, r2, r2, r3 + 8007e52: 1092 asrs r2, r2, #2 + 8007e54: 17db asrs r3, r3, #31 + 8007e56: 1ad3 subs r3, r2, r3 + 8007e58: 613b str r3, [r7, #16] + 8007e5a: 693b ldr r3, [r7, #16] + 8007e5c: 009b lsls r3, r3, #2 + 8007e5e: 613b str r3, [r7, #16] + 8007e60: 200a movs r0, #10 + 8007e62: f7fb fbef bl 8003644 + 8007e66: f7fb fb9d bl 80035a4 + 8007e6a: 4603 mov r3, r0 + 8007e6c: 2b00 cmp r3, #0 + 8007e6e: d106 bne.n 8007e7e + 8007e70: 693b ldr r3, [r7, #16] + 8007e72: 3b01 subs r3, #1 + 8007e74: 613b str r3, [r7, #16] + 8007e76: 693b ldr r3, [r7, #16] + 8007e78: 2b00 cmp r3, #0 + 8007e7a: d1f1 bne.n 8007e60 + 8007e7c: e000 b.n 8007e80 + 8007e7e: bf00 nop + 8007e80: 693b ldr r3, [r7, #16] + 8007e82: 2b00 cmp r3, #0 + 8007e84: d103 bne.n 8007e8e + 8007e86: 697b ldr r3, [r7, #20] + 8007e88: 2b00 cmp r3, #0 + 8007e8a: dcaa bgt.n 8007de2 + 8007e8c: e000 b.n 8007e90 + 8007e8e: bf00 nop + 8007e90: f001 fa06 bl 80092a0 + 8007e94: f001 fa10 bl 80092b8 + 8007e98: 4603 mov r3, r0 + 8007e9a: 4a26 ldr r2, [pc, #152] ; (8007f34 ) + 8007e9c: 2104 movs r1, #4 + 8007e9e: 4823 ldr r0, [pc, #140] ; (8007f2c ) + 8007ea0: f001 fd34 bl 800990c + TOUT_OP(4, Output5, 1000); + 8007ea4: 68bb ldr r3, [r7, #8] + 8007ea6: 2b00 cmp r3, #0 + 8007ea8: d10a bne.n 8007ec0 + 8007eaa: f001 fa1f bl 80092ec + 8007eae: f001 fa29 bl 8009304 + 8007eb2: 4603 mov r3, r0 + 8007eb4: 4a20 ldr r2, [pc, #128] ; (8007f38 ) + 8007eb6: 2105 movs r1, #5 + 8007eb8: 481c ldr r0, [pc, #112] ; (8007f2c ) + 8007eba: f001 fd27 bl 800990c + 8007ebe: e09e b.n 8007ffe + 8007ec0: 68bb ldr r3, [r7, #8] + 8007ec2: 2b01 cmp r3, #1 + 8007ec4: d10a bne.n 8007edc + 8007ec6: f001 fa05 bl 80092d4 + 8007eca: f001 fa1b bl 8009304 + 8007ece: 4603 mov r3, r0 + 8007ed0: 4a19 ldr r2, [pc, #100] ; (8007f38 ) + 8007ed2: 2105 movs r1, #5 + 8007ed4: 4815 ldr r0, [pc, #84] ; (8007f2c ) + 8007ed6: f001 fd19 bl 800990c + 8007eda: e090 b.n 8007ffe + 8007edc: 68bb ldr r3, [r7, #8] + 8007ede: 2b02 cmp r3, #2 + 8007ee0: d118 bne.n 8007f14 + 8007ee2: f001 f9f7 bl 80092d4 + 8007ee6: f001 fa0d bl 8009304 + 8007eea: 4603 mov r3, r0 + 8007eec: 4a12 ldr r2, [pc, #72] ; (8007f38 ) + 8007eee: 2105 movs r1, #5 + 8007ef0: 480e ldr r0, [pc, #56] ; (8007f2c ) + 8007ef2: f001 fd0b bl 800990c + 8007ef6: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8007efa: f7fb fba3 bl 8003644 + 8007efe: f001 f9f5 bl 80092ec + 8007f02: f001 f9ff bl 8009304 + 8007f06: 4603 mov r3, r0 + 8007f08: 4a0b ldr r2, [pc, #44] ; (8007f38 ) + 8007f0a: 2105 movs r1, #5 + 8007f0c: 4807 ldr r0, [pc, #28] ; (8007f2c ) + 8007f0e: f001 fcfd bl 800990c + 8007f12: e074 b.n 8007ffe + 8007f14: 68bb ldr r3, [r7, #8] + 8007f16: 2b00 cmp r3, #0 + 8007f18: dd71 ble.n 8007ffe + 8007f1a: 68bb ldr r3, [r7, #8] + 8007f1c: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8007f20: fb02 f303 mul.w r3, r2, r3 + 8007f24: 617b str r3, [r7, #20] + 8007f26: e05b b.n 8007fe0 + 8007f28: 200002f4 .word 0x200002f4 + 8007f2c: 0800adf0 .word 0x0800adf0 + 8007f30: 66666667 .word 0x66666667 + 8007f34: 20000308 .word 0x20000308 + 8007f38: 2000031c .word 0x2000031c + 8007f3c: 697b ldr r3, [r7, #20] + 8007f3e: 3b01 subs r3, #1 + 8007f40: 617b str r3, [r7, #20] + 8007f42: f001 f9c7 bl 80092d4 + 8007f46: f001 f9dd bl 8009304 + 8007f4a: 4603 mov r3, r0 + 8007f4c: 4ab1 ldr r2, [pc, #708] ; (8008214 ) + 8007f4e: 2105 movs r1, #5 + 8007f50: 48b1 ldr r0, [pc, #708] ; (8008218 ) + 8007f52: f001 fcdb bl 800990c + 8007f56: 68bb ldr r3, [r7, #8] + 8007f58: 3309 adds r3, #9 + 8007f5a: 4ab0 ldr r2, [pc, #704] ; (800821c ) + 8007f5c: fb82 1203 smull r1, r2, r2, r3 + 8007f60: 1092 asrs r2, r2, #2 + 8007f62: 17db asrs r3, r3, #31 + 8007f64: 1ad3 subs r3, r2, r3 + 8007f66: 613b str r3, [r7, #16] + 8007f68: 200a movs r0, #10 + 8007f6a: f7fb fb6b bl 8003644 + 8007f6e: f7fb fb19 bl 80035a4 + 8007f72: 4603 mov r3, r0 + 8007f74: 2b00 cmp r3, #0 + 8007f76: d106 bne.n 8007f86 + 8007f78: 693b ldr r3, [r7, #16] + 8007f7a: 3b01 subs r3, #1 + 8007f7c: 613b str r3, [r7, #16] + 8007f7e: 693b ldr r3, [r7, #16] + 8007f80: 2b00 cmp r3, #0 + 8007f82: d1f1 bne.n 8007f68 + 8007f84: e000 b.n 8007f88 + 8007f86: bf00 nop + 8007f88: 693b ldr r3, [r7, #16] + 8007f8a: 2b00 cmp r3, #0 + 8007f8c: d12c bne.n 8007fe8 + 8007f8e: f001 f9ad bl 80092ec + 8007f92: f001 f9b7 bl 8009304 + 8007f96: 4603 mov r3, r0 + 8007f98: 4a9e ldr r2, [pc, #632] ; (8008214 ) + 8007f9a: 2105 movs r1, #5 + 8007f9c: 489e ldr r0, [pc, #632] ; (8008218 ) + 8007f9e: f001 fcb5 bl 800990c + 8007fa2: 68bb ldr r3, [r7, #8] + 8007fa4: 3309 adds r3, #9 + 8007fa6: 4a9d ldr r2, [pc, #628] ; (800821c ) + 8007fa8: fb82 1203 smull r1, r2, r2, r3 + 8007fac: 1092 asrs r2, r2, #2 + 8007fae: 17db asrs r3, r3, #31 + 8007fb0: 1ad3 subs r3, r2, r3 + 8007fb2: 613b str r3, [r7, #16] + 8007fb4: 693b ldr r3, [r7, #16] + 8007fb6: 009b lsls r3, r3, #2 + 8007fb8: 613b str r3, [r7, #16] + 8007fba: 200a movs r0, #10 + 8007fbc: f7fb fb42 bl 8003644 + 8007fc0: f7fb faf0 bl 80035a4 + 8007fc4: 4603 mov r3, r0 + 8007fc6: 2b00 cmp r3, #0 + 8007fc8: d106 bne.n 8007fd8 + 8007fca: 693b ldr r3, [r7, #16] + 8007fcc: 3b01 subs r3, #1 + 8007fce: 613b str r3, [r7, #16] + 8007fd0: 693b ldr r3, [r7, #16] + 8007fd2: 2b00 cmp r3, #0 + 8007fd4: d1f1 bne.n 8007fba + 8007fd6: e000 b.n 8007fda + 8007fd8: bf00 nop + 8007fda: 693b ldr r3, [r7, #16] + 8007fdc: 2b00 cmp r3, #0 + 8007fde: d103 bne.n 8007fe8 + 8007fe0: 697b ldr r3, [r7, #20] + 8007fe2: 2b00 cmp r3, #0 + 8007fe4: dcaa bgt.n 8007f3c + 8007fe6: e000 b.n 8007fea + 8007fe8: bf00 nop + 8007fea: f001 f97f bl 80092ec + 8007fee: f001 f989 bl 8009304 + 8007ff2: 4603 mov r3, r0 + 8007ff4: 4a87 ldr r2, [pc, #540] ; (8008214 ) + 8007ff6: 2105 movs r1, #5 + 8007ff8: 4887 ldr r0, [pc, #540] ; (8008218 ) + 8007ffa: f001 fc87 bl 800990c + TOUT_OP(5, Output6, 1000); + 8007ffe: 68bb ldr r3, [r7, #8] + 8008000: 2b00 cmp r3, #0 + 8008002: d10a bne.n 800801a + 8008004: f001 f998 bl 8009338 + 8008008: f001 f9a2 bl 8009350 + 800800c: 4603 mov r3, r0 + 800800e: 4a84 ldr r2, [pc, #528] ; (8008220 ) + 8008010: 2106 movs r1, #6 + 8008012: 4881 ldr r0, [pc, #516] ; (8008218 ) + 8008014: f001 fc7a bl 800990c + 8008018: e094 b.n 8008144 + 800801a: 68bb ldr r3, [r7, #8] + 800801c: 2b01 cmp r3, #1 + 800801e: d10a bne.n 8008036 + 8008020: f001 f97e bl 8009320 + 8008024: f001 f994 bl 8009350 + 8008028: 4603 mov r3, r0 + 800802a: 4a7d ldr r2, [pc, #500] ; (8008220 ) + 800802c: 2106 movs r1, #6 + 800802e: 487a ldr r0, [pc, #488] ; (8008218 ) + 8008030: f001 fc6c bl 800990c + 8008034: e086 b.n 8008144 + 8008036: 68bb ldr r3, [r7, #8] + 8008038: 2b02 cmp r3, #2 + 800803a: d118 bne.n 800806e + 800803c: f001 f970 bl 8009320 + 8008040: f001 f986 bl 8009350 + 8008044: 4603 mov r3, r0 + 8008046: 4a76 ldr r2, [pc, #472] ; (8008220 ) + 8008048: 2106 movs r1, #6 + 800804a: 4873 ldr r0, [pc, #460] ; (8008218 ) + 800804c: f001 fc5e bl 800990c + 8008050: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008054: f7fb faf6 bl 8003644 + 8008058: f001 f96e bl 8009338 + 800805c: f001 f978 bl 8009350 + 8008060: 4603 mov r3, r0 + 8008062: 4a6f ldr r2, [pc, #444] ; (8008220 ) + 8008064: 2106 movs r1, #6 + 8008066: 486c ldr r0, [pc, #432] ; (8008218 ) + 8008068: f001 fc50 bl 800990c + 800806c: e06a b.n 8008144 + 800806e: 68bb ldr r3, [r7, #8] + 8008070: 2b00 cmp r3, #0 + 8008072: dd67 ble.n 8008144 + 8008074: 68bb ldr r3, [r7, #8] + 8008076: f44f 727a mov.w r2, #1000 ; 0x3e8 + 800807a: fb02 f303 mul.w r3, r2, r3 + 800807e: 617b str r3, [r7, #20] + 8008080: e051 b.n 8008126 + 8008082: 697b ldr r3, [r7, #20] + 8008084: 3b01 subs r3, #1 + 8008086: 617b str r3, [r7, #20] + 8008088: f001 f94a bl 8009320 + 800808c: f001 f960 bl 8009350 + 8008090: 4603 mov r3, r0 + 8008092: 4a63 ldr r2, [pc, #396] ; (8008220 ) + 8008094: 2106 movs r1, #6 + 8008096: 4860 ldr r0, [pc, #384] ; (8008218 ) + 8008098: f001 fc38 bl 800990c + 800809c: 68bb ldr r3, [r7, #8] + 800809e: 3309 adds r3, #9 + 80080a0: 4a5e ldr r2, [pc, #376] ; (800821c ) + 80080a2: fb82 1203 smull r1, r2, r2, r3 + 80080a6: 1092 asrs r2, r2, #2 + 80080a8: 17db asrs r3, r3, #31 + 80080aa: 1ad3 subs r3, r2, r3 + 80080ac: 613b str r3, [r7, #16] + 80080ae: 200a movs r0, #10 + 80080b0: f7fb fac8 bl 8003644 + 80080b4: f7fb fa76 bl 80035a4 + 80080b8: 4603 mov r3, r0 + 80080ba: 2b00 cmp r3, #0 + 80080bc: d106 bne.n 80080cc + 80080be: 693b ldr r3, [r7, #16] + 80080c0: 3b01 subs r3, #1 + 80080c2: 613b str r3, [r7, #16] + 80080c4: 693b ldr r3, [r7, #16] + 80080c6: 2b00 cmp r3, #0 + 80080c8: d1f1 bne.n 80080ae + 80080ca: e000 b.n 80080ce + 80080cc: bf00 nop + 80080ce: 693b ldr r3, [r7, #16] + 80080d0: 2b00 cmp r3, #0 + 80080d2: d12c bne.n 800812e + 80080d4: f001 f930 bl 8009338 + 80080d8: f001 f93a bl 8009350 + 80080dc: 4603 mov r3, r0 + 80080de: 4a50 ldr r2, [pc, #320] ; (8008220 ) + 80080e0: 2106 movs r1, #6 + 80080e2: 484d ldr r0, [pc, #308] ; (8008218 ) + 80080e4: f001 fc12 bl 800990c + 80080e8: 68bb ldr r3, [r7, #8] + 80080ea: 3309 adds r3, #9 + 80080ec: 4a4b ldr r2, [pc, #300] ; (800821c ) + 80080ee: fb82 1203 smull r1, r2, r2, r3 + 80080f2: 1092 asrs r2, r2, #2 + 80080f4: 17db asrs r3, r3, #31 + 80080f6: 1ad3 subs r3, r2, r3 + 80080f8: 613b str r3, [r7, #16] + 80080fa: 693b ldr r3, [r7, #16] + 80080fc: 009b lsls r3, r3, #2 + 80080fe: 613b str r3, [r7, #16] + 8008100: 200a movs r0, #10 + 8008102: f7fb fa9f bl 8003644 + 8008106: f7fb fa4d bl 80035a4 + 800810a: 4603 mov r3, r0 + 800810c: 2b00 cmp r3, #0 + 800810e: d106 bne.n 800811e + 8008110: 693b ldr r3, [r7, #16] + 8008112: 3b01 subs r3, #1 + 8008114: 613b str r3, [r7, #16] + 8008116: 693b ldr r3, [r7, #16] + 8008118: 2b00 cmp r3, #0 + 800811a: d1f1 bne.n 8008100 + 800811c: e000 b.n 8008120 + 800811e: bf00 nop + 8008120: 693b ldr r3, [r7, #16] + 8008122: 2b00 cmp r3, #0 + 8008124: d103 bne.n 800812e + 8008126: 697b ldr r3, [r7, #20] + 8008128: 2b00 cmp r3, #0 + 800812a: dcaa bgt.n 8008082 + 800812c: e000 b.n 8008130 + 800812e: bf00 nop + 8008130: f001 f902 bl 8009338 + 8008134: f001 f90c bl 8009350 + 8008138: 4603 mov r3, r0 + 800813a: 4a39 ldr r2, [pc, #228] ; (8008220 ) + 800813c: 2106 movs r1, #6 + 800813e: 4836 ldr r0, [pc, #216] ; (8008218 ) + 8008140: f001 fbe4 bl 800990c + TOUT_OP(6, Output7, 1000); + 8008144: 68bb ldr r3, [r7, #8] + 8008146: 2b00 cmp r3, #0 + 8008148: d10a bne.n 8008160 + 800814a: f001 f91b bl 8009384 + 800814e: f001 f925 bl 800939c + 8008152: 4603 mov r3, r0 + 8008154: 4a33 ldr r2, [pc, #204] ; (8008224 ) + 8008156: 2107 movs r1, #7 + 8008158: 482f ldr r0, [pc, #188] ; (8008218 ) + 800815a: f001 fbd7 bl 800990c + 800815e: e09f b.n 80082a0 + 8008160: 68bb ldr r3, [r7, #8] + 8008162: 2b01 cmp r3, #1 + 8008164: d10a bne.n 800817c + 8008166: f001 f901 bl 800936c + 800816a: f001 f917 bl 800939c + 800816e: 4603 mov r3, r0 + 8008170: 4a2c ldr r2, [pc, #176] ; (8008224 ) + 8008172: 2107 movs r1, #7 + 8008174: 4828 ldr r0, [pc, #160] ; (8008218 ) + 8008176: f001 fbc9 bl 800990c + 800817a: e091 b.n 80082a0 + 800817c: 68bb ldr r3, [r7, #8] + 800817e: 2b02 cmp r3, #2 + 8008180: d118 bne.n 80081b4 + 8008182: f001 f8f3 bl 800936c + 8008186: f001 f909 bl 800939c + 800818a: 4603 mov r3, r0 + 800818c: 4a25 ldr r2, [pc, #148] ; (8008224 ) + 800818e: 2107 movs r1, #7 + 8008190: 4821 ldr r0, [pc, #132] ; (8008218 ) + 8008192: f001 fbbb bl 800990c + 8008196: f44f 707a mov.w r0, #1000 ; 0x3e8 + 800819a: f7fb fa53 bl 8003644 + 800819e: f001 f8f1 bl 8009384 + 80081a2: f001 f8fb bl 800939c + 80081a6: 4603 mov r3, r0 + 80081a8: 4a1e ldr r2, [pc, #120] ; (8008224 ) + 80081aa: 2107 movs r1, #7 + 80081ac: 481a ldr r0, [pc, #104] ; (8008218 ) + 80081ae: f001 fbad bl 800990c + 80081b2: e075 b.n 80082a0 + 80081b4: 68bb ldr r3, [r7, #8] + 80081b6: 2b00 cmp r3, #0 + 80081b8: dd72 ble.n 80082a0 + 80081ba: 68bb ldr r3, [r7, #8] + 80081bc: f44f 727a mov.w r2, #1000 ; 0x3e8 + 80081c0: fb02 f303 mul.w r3, r2, r3 + 80081c4: 617b str r3, [r7, #20] + 80081c6: e05c b.n 8008282 + 80081c8: 697b ldr r3, [r7, #20] + 80081ca: 3b01 subs r3, #1 + 80081cc: 617b str r3, [r7, #20] + 80081ce: f001 f8cd bl 800936c + 80081d2: f001 f8e3 bl 800939c + 80081d6: 4603 mov r3, r0 + 80081d8: 4a12 ldr r2, [pc, #72] ; (8008224 ) + 80081da: 2107 movs r1, #7 + 80081dc: 480e ldr r0, [pc, #56] ; (8008218 ) + 80081de: f001 fb95 bl 800990c + 80081e2: 68bb ldr r3, [r7, #8] + 80081e4: 3309 adds r3, #9 + 80081e6: 4a0d ldr r2, [pc, #52] ; (800821c ) + 80081e8: fb82 1203 smull r1, r2, r2, r3 + 80081ec: 1092 asrs r2, r2, #2 + 80081ee: 17db asrs r3, r3, #31 + 80081f0: 1ad3 subs r3, r2, r3 + 80081f2: 613b str r3, [r7, #16] + 80081f4: 200a movs r0, #10 + 80081f6: f7fb fa25 bl 8003644 + 80081fa: f7fb f9d3 bl 80035a4 + 80081fe: 4603 mov r3, r0 + 8008200: 2b00 cmp r3, #0 + 8008202: d111 bne.n 8008228 + 8008204: 693b ldr r3, [r7, #16] + 8008206: 3b01 subs r3, #1 + 8008208: 613b str r3, [r7, #16] + 800820a: 693b ldr r3, [r7, #16] + 800820c: 2b00 cmp r3, #0 + 800820e: d1f1 bne.n 80081f4 + 8008210: e00b b.n 800822a + 8008212: bf00 nop + 8008214: 2000031c .word 0x2000031c + 8008218: 0800adf0 .word 0x0800adf0 + 800821c: 66666667 .word 0x66666667 + 8008220: 20000330 .word 0x20000330 + 8008224: 20000344 .word 0x20000344 + 8008228: bf00 nop + 800822a: 693b ldr r3, [r7, #16] + 800822c: 2b00 cmp r3, #0 + 800822e: d12c bne.n 800828a + 8008230: f001 f8a8 bl 8009384 + 8008234: f001 f8b2 bl 800939c + 8008238: 4603 mov r3, r0 + 800823a: 4ab2 ldr r2, [pc, #712] ; (8008504 ) + 800823c: 2107 movs r1, #7 + 800823e: 48b2 ldr r0, [pc, #712] ; (8008508 ) + 8008240: f001 fb64 bl 800990c + 8008244: 68bb ldr r3, [r7, #8] + 8008246: 3309 adds r3, #9 + 8008248: 4ab0 ldr r2, [pc, #704] ; (800850c ) + 800824a: fb82 1203 smull r1, r2, r2, r3 + 800824e: 1092 asrs r2, r2, #2 + 8008250: 17db asrs r3, r3, #31 + 8008252: 1ad3 subs r3, r2, r3 + 8008254: 613b str r3, [r7, #16] + 8008256: 693b ldr r3, [r7, #16] + 8008258: 009b lsls r3, r3, #2 + 800825a: 613b str r3, [r7, #16] + 800825c: 200a movs r0, #10 + 800825e: f7fb f9f1 bl 8003644 + 8008262: f7fb f99f bl 80035a4 + 8008266: 4603 mov r3, r0 + 8008268: 2b00 cmp r3, #0 + 800826a: d106 bne.n 800827a + 800826c: 693b ldr r3, [r7, #16] + 800826e: 3b01 subs r3, #1 + 8008270: 613b str r3, [r7, #16] + 8008272: 693b ldr r3, [r7, #16] + 8008274: 2b00 cmp r3, #0 + 8008276: d1f1 bne.n 800825c + 8008278: e000 b.n 800827c + 800827a: bf00 nop + 800827c: 693b ldr r3, [r7, #16] + 800827e: 2b00 cmp r3, #0 + 8008280: d103 bne.n 800828a + 8008282: 697b ldr r3, [r7, #20] + 8008284: 2b00 cmp r3, #0 + 8008286: dc9f bgt.n 80081c8 + 8008288: e000 b.n 800828c + 800828a: bf00 nop + 800828c: f001 f87a bl 8009384 + 8008290: f001 f884 bl 800939c + 8008294: 4603 mov r3, r0 + 8008296: 4a9b ldr r2, [pc, #620] ; (8008504 ) + 8008298: 2107 movs r1, #7 + 800829a: 489b ldr r0, [pc, #620] ; (8008508 ) + 800829c: f001 fb36 bl 800990c + TOUT_OP(7, Output8, 1000); + 80082a0: 68bb ldr r3, [r7, #8] + 80082a2: 2b00 cmp r3, #0 + 80082a4: d10b bne.n 80082be + 80082a6: f001 f893 bl 80093d0 + 80082aa: f001 f89d bl 80093e8 + 80082ae: 4603 mov r3, r0 + 80082b0: 4a97 ldr r2, [pc, #604] ; (8008510 ) + 80082b2: 2108 movs r1, #8 + 80082b4: 4894 ldr r0, [pc, #592] ; (8008508 ) + 80082b6: f001 fb29 bl 800990c + 80082ba: f000 be28 b.w 8008f0e + 80082be: 68bb ldr r3, [r7, #8] + 80082c0: 2b01 cmp r3, #1 + 80082c2: d10b bne.n 80082dc + 80082c4: f001 f878 bl 80093b8 + 80082c8: f001 f88e bl 80093e8 + 80082cc: 4603 mov r3, r0 + 80082ce: 4a90 ldr r2, [pc, #576] ; (8008510 ) + 80082d0: 2108 movs r1, #8 + 80082d2: 488d ldr r0, [pc, #564] ; (8008508 ) + 80082d4: f001 fb1a bl 800990c + 80082d8: f000 be19 b.w 8008f0e + 80082dc: 68bb ldr r3, [r7, #8] + 80082de: 2b02 cmp r3, #2 + 80082e0: d119 bne.n 8008316 + 80082e2: f001 f869 bl 80093b8 + 80082e6: f001 f87f bl 80093e8 + 80082ea: 4603 mov r3, r0 + 80082ec: 4a88 ldr r2, [pc, #544] ; (8008510 ) + 80082ee: 2108 movs r1, #8 + 80082f0: 4885 ldr r0, [pc, #532] ; (8008508 ) + 80082f2: f001 fb0b bl 800990c + 80082f6: f44f 707a mov.w r0, #1000 ; 0x3e8 + 80082fa: f7fb f9a3 bl 8003644 + 80082fe: f001 f867 bl 80093d0 + 8008302: f001 f871 bl 80093e8 + 8008306: 4603 mov r3, r0 + 8008308: 4a81 ldr r2, [pc, #516] ; (8008510 ) + 800830a: 2108 movs r1, #8 + 800830c: 487e ldr r0, [pc, #504] ; (8008508 ) + 800830e: f001 fafd bl 800990c + 8008312: f000 bdfc b.w 8008f0e + 8008316: 68bb ldr r3, [r7, #8] + 8008318: 2b00 cmp r3, #0 + 800831a: f340 85f8 ble.w 8008f0e + 800831e: 68bb ldr r3, [r7, #8] + 8008320: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008324: fb02 f303 mul.w r3, r2, r3 + 8008328: 617b str r3, [r7, #20] + 800832a: e051 b.n 80083d0 + 800832c: 697b ldr r3, [r7, #20] + 800832e: 3b01 subs r3, #1 + 8008330: 617b str r3, [r7, #20] + 8008332: f001 f841 bl 80093b8 + 8008336: f001 f857 bl 80093e8 + 800833a: 4603 mov r3, r0 + 800833c: 4a74 ldr r2, [pc, #464] ; (8008510 ) + 800833e: 2108 movs r1, #8 + 8008340: 4871 ldr r0, [pc, #452] ; (8008508 ) + 8008342: f001 fae3 bl 800990c + 8008346: 68bb ldr r3, [r7, #8] + 8008348: 3309 adds r3, #9 + 800834a: 4a70 ldr r2, [pc, #448] ; (800850c ) + 800834c: fb82 1203 smull r1, r2, r2, r3 + 8008350: 1092 asrs r2, r2, #2 + 8008352: 17db asrs r3, r3, #31 + 8008354: 1ad3 subs r3, r2, r3 + 8008356: 613b str r3, [r7, #16] + 8008358: 200a movs r0, #10 + 800835a: f7fb f973 bl 8003644 + 800835e: f7fb f921 bl 80035a4 + 8008362: 4603 mov r3, r0 + 8008364: 2b00 cmp r3, #0 + 8008366: d106 bne.n 8008376 + 8008368: 693b ldr r3, [r7, #16] + 800836a: 3b01 subs r3, #1 + 800836c: 613b str r3, [r7, #16] + 800836e: 693b ldr r3, [r7, #16] + 8008370: 2b00 cmp r3, #0 + 8008372: d1f1 bne.n 8008358 + 8008374: e000 b.n 8008378 + 8008376: bf00 nop + 8008378: 693b ldr r3, [r7, #16] + 800837a: 2b00 cmp r3, #0 + 800837c: d12c bne.n 80083d8 + 800837e: f001 f827 bl 80093d0 + 8008382: f001 f831 bl 80093e8 + 8008386: 4603 mov r3, r0 + 8008388: 4a61 ldr r2, [pc, #388] ; (8008510 ) + 800838a: 2108 movs r1, #8 + 800838c: 485e ldr r0, [pc, #376] ; (8008508 ) + 800838e: f001 fabd bl 800990c + 8008392: 68bb ldr r3, [r7, #8] + 8008394: 3309 adds r3, #9 + 8008396: 4a5d ldr r2, [pc, #372] ; (800850c ) + 8008398: fb82 1203 smull r1, r2, r2, r3 + 800839c: 1092 asrs r2, r2, #2 + 800839e: 17db asrs r3, r3, #31 + 80083a0: 1ad3 subs r3, r2, r3 + 80083a2: 613b str r3, [r7, #16] + 80083a4: 693b ldr r3, [r7, #16] + 80083a6: 009b lsls r3, r3, #2 + 80083a8: 613b str r3, [r7, #16] + 80083aa: 200a movs r0, #10 + 80083ac: f7fb f94a bl 8003644 + 80083b0: f7fb f8f8 bl 80035a4 + 80083b4: 4603 mov r3, r0 + 80083b6: 2b00 cmp r3, #0 + 80083b8: d106 bne.n 80083c8 + 80083ba: 693b ldr r3, [r7, #16] + 80083bc: 3b01 subs r3, #1 + 80083be: 613b str r3, [r7, #16] + 80083c0: 693b ldr r3, [r7, #16] + 80083c2: 2b00 cmp r3, #0 + 80083c4: d1f1 bne.n 80083aa + 80083c6: e000 b.n 80083ca + 80083c8: bf00 nop + 80083ca: 693b ldr r3, [r7, #16] + 80083cc: 2b00 cmp r3, #0 + 80083ce: d103 bne.n 80083d8 + 80083d0: 697b ldr r3, [r7, #20] + 80083d2: 2b00 cmp r3, #0 + 80083d4: dcaa bgt.n 800832c + 80083d6: e000 b.n 80083da + 80083d8: bf00 nop + 80083da: f000 fff9 bl 80093d0 + 80083de: f001 f803 bl 80093e8 + 80083e2: 4603 mov r3, r0 + 80083e4: 4a4a ldr r2, [pc, #296] ; (8008510 ) + 80083e6: 2108 movs r1, #8 + 80083e8: 4847 ldr r0, [pc, #284] ; (8008508 ) + 80083ea: f001 fa8f bl 800990c + 80083ee: f000 bd8e b.w 8008f0e + else if (p2 == 1) + { + + } + } + else if (p1 < 100) + 80083f2: 68fb ldr r3, [r7, #12] + 80083f4: 2b63 cmp r3, #99 ; 0x63 + 80083f6: f300 858a bgt.w 8008f0e + { + switch(p1) + 80083fa: 68fb ldr r3, [r7, #12] + 80083fc: 3b01 subs r3, #1 + 80083fe: 2b07 cmp r3, #7 + 8008400: f200 8574 bhi.w 8008eec + 8008404: a201 add r2, pc, #4 ; (adr r2, 800840c ) + 8008406: f852 f023 ldr.w pc, [r2, r3, lsl #2] + 800840a: bf00 nop + 800840c: 0800842d .word 0x0800842d + 8008410: 08008595 .word 0x08008595 + 8008414: 080086e7 .word 0x080086e7 + 8008418: 08008845 .word 0x08008845 + 800841c: 0800898f .word 0x0800898f + 8008420: 08008ad9 .word 0x08008ad9 + 8008424: 08008c3b .word 0x08008c3b + 8008428: 08008d85 .word 0x08008d85 + { + case 1: + TOUT_OP(0, Output1, 1000); + 800842c: 68bb ldr r3, [r7, #8] + 800842e: 2b00 cmp r3, #0 + 8008430: d10b bne.n 800844a + 8008432: f000 fec3 bl 80091bc + 8008436: f000 fecd bl 80091d4 + 800843a: 4603 mov r3, r0 + 800843c: 4a35 ldr r2, [pc, #212] ; (8008514 ) + 800843e: 2101 movs r1, #1 + 8008440: 4831 ldr r0, [pc, #196] ; (8008508 ) + 8008442: f001 fa63 bl 800990c + break; + 8008446: f000 bd53 b.w 8008ef0 + TOUT_OP(0, Output1, 1000); + 800844a: 68bb ldr r3, [r7, #8] + 800844c: 2b01 cmp r3, #1 + 800844e: d10b bne.n 8008468 + 8008450: f000 fea8 bl 80091a4 + 8008454: f000 febe bl 80091d4 + 8008458: 4603 mov r3, r0 + 800845a: 4a2e ldr r2, [pc, #184] ; (8008514 ) + 800845c: 2101 movs r1, #1 + 800845e: 482a ldr r0, [pc, #168] ; (8008508 ) + 8008460: f001 fa54 bl 800990c + break; + 8008464: f000 bd44 b.w 8008ef0 + TOUT_OP(0, Output1, 1000); + 8008468: 68bb ldr r3, [r7, #8] + 800846a: 2b02 cmp r3, #2 + 800846c: d119 bne.n 80084a2 + 800846e: f000 fe99 bl 80091a4 + 8008472: f000 feaf bl 80091d4 + 8008476: 4603 mov r3, r0 + 8008478: 4a26 ldr r2, [pc, #152] ; (8008514 ) + 800847a: 2101 movs r1, #1 + 800847c: 4822 ldr r0, [pc, #136] ; (8008508 ) + 800847e: f001 fa45 bl 800990c + 8008482: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008486: f7fb f8dd bl 8003644 + 800848a: f000 fe97 bl 80091bc + 800848e: f000 fea1 bl 80091d4 + 8008492: 4603 mov r3, r0 + 8008494: 4a1f ldr r2, [pc, #124] ; (8008514 ) + 8008496: 2101 movs r1, #1 + 8008498: 481b ldr r0, [pc, #108] ; (8008508 ) + 800849a: f001 fa37 bl 800990c + break; + 800849e: f000 bd27 b.w 8008ef0 + TOUT_OP(0, Output1, 1000); + 80084a2: 68bb ldr r3, [r7, #8] + 80084a4: 2b00 cmp r3, #0 + 80084a6: f340 8523 ble.w 8008ef0 + 80084aa: 68bb ldr r3, [r7, #8] + 80084ac: f44f 727a mov.w r2, #1000 ; 0x3e8 + 80084b0: fb02 f303 mul.w r3, r2, r3 + 80084b4: 617b str r3, [r7, #20] + 80084b6: e05c b.n 8008572 + 80084b8: 697b ldr r3, [r7, #20] + 80084ba: 3b01 subs r3, #1 + 80084bc: 617b str r3, [r7, #20] + 80084be: f000 fe71 bl 80091a4 + 80084c2: f000 fe87 bl 80091d4 + 80084c6: 4603 mov r3, r0 + 80084c8: 4a12 ldr r2, [pc, #72] ; (8008514 ) + 80084ca: 2101 movs r1, #1 + 80084cc: 480e ldr r0, [pc, #56] ; (8008508 ) + 80084ce: f001 fa1d bl 800990c + 80084d2: 68bb ldr r3, [r7, #8] + 80084d4: 3309 adds r3, #9 + 80084d6: 4a0d ldr r2, [pc, #52] ; (800850c ) + 80084d8: fb82 1203 smull r1, r2, r2, r3 + 80084dc: 1092 asrs r2, r2, #2 + 80084de: 17db asrs r3, r3, #31 + 80084e0: 1ad3 subs r3, r2, r3 + 80084e2: 613b str r3, [r7, #16] + 80084e4: 200a movs r0, #10 + 80084e6: f7fb f8ad bl 8003644 + 80084ea: f7fb f85b bl 80035a4 + 80084ee: 4603 mov r3, r0 + 80084f0: 2b00 cmp r3, #0 + 80084f2: d111 bne.n 8008518 + 80084f4: 693b ldr r3, [r7, #16] + 80084f6: 3b01 subs r3, #1 + 80084f8: 613b str r3, [r7, #16] + 80084fa: 693b ldr r3, [r7, #16] + 80084fc: 2b00 cmp r3, #0 + 80084fe: d1f1 bne.n 80084e4 + 8008500: e00b b.n 800851a + 8008502: bf00 nop + 8008504: 20000344 .word 0x20000344 + 8008508: 0800adf0 .word 0x0800adf0 + 800850c: 66666667 .word 0x66666667 + 8008510: 20000358 .word 0x20000358 + 8008514: 200002cc .word 0x200002cc + 8008518: bf00 nop + 800851a: 693b ldr r3, [r7, #16] + 800851c: 2b00 cmp r3, #0 + 800851e: d12c bne.n 800857a + 8008520: f000 fe4c bl 80091bc + 8008524: f000 fe56 bl 80091d4 + 8008528: 4603 mov r3, r0 + 800852a: 4abb ldr r2, [pc, #748] ; (8008818 ) + 800852c: 2101 movs r1, #1 + 800852e: 48bb ldr r0, [pc, #748] ; (800881c ) + 8008530: f001 f9ec bl 800990c + 8008534: 68bb ldr r3, [r7, #8] + 8008536: 3309 adds r3, #9 + 8008538: 4ab9 ldr r2, [pc, #740] ; (8008820 ) + 800853a: fb82 1203 smull r1, r2, r2, r3 + 800853e: 1092 asrs r2, r2, #2 + 8008540: 17db asrs r3, r3, #31 + 8008542: 1ad3 subs r3, r2, r3 + 8008544: 613b str r3, [r7, #16] + 8008546: 693b ldr r3, [r7, #16] + 8008548: 009b lsls r3, r3, #2 + 800854a: 613b str r3, [r7, #16] + 800854c: 200a movs r0, #10 + 800854e: f7fb f879 bl 8003644 + 8008552: f7fb f827 bl 80035a4 + 8008556: 4603 mov r3, r0 + 8008558: 2b00 cmp r3, #0 + 800855a: d106 bne.n 800856a + 800855c: 693b ldr r3, [r7, #16] + 800855e: 3b01 subs r3, #1 + 8008560: 613b str r3, [r7, #16] + 8008562: 693b ldr r3, [r7, #16] + 8008564: 2b00 cmp r3, #0 + 8008566: d1f1 bne.n 800854c + 8008568: e000 b.n 800856c + 800856a: bf00 nop + 800856c: 693b ldr r3, [r7, #16] + 800856e: 2b00 cmp r3, #0 + 8008570: d103 bne.n 800857a + 8008572: 697b ldr r3, [r7, #20] + 8008574: 2b00 cmp r3, #0 + 8008576: dc9f bgt.n 80084b8 + 8008578: e000 b.n 800857c + 800857a: bf00 nop + 800857c: f000 fe1e bl 80091bc + 8008580: f000 fe28 bl 80091d4 + 8008584: 4603 mov r3, r0 + 8008586: 4aa4 ldr r2, [pc, #656] ; (8008818 ) + 8008588: 2101 movs r1, #1 + 800858a: 48a4 ldr r0, [pc, #656] ; (800881c ) + 800858c: f001 f9be bl 800990c + break; + 8008590: f000 bcae b.w 8008ef0 + case 2: + TOUT_OP(1, Output2, 1000); + 8008594: 68bb ldr r3, [r7, #8] + 8008596: 2b00 cmp r3, #0 + 8008598: d10b bne.n 80085b2 + 800859a: f000 fe35 bl 8009208 + 800859e: f000 fe3f bl 8009220 + 80085a2: 4603 mov r3, r0 + 80085a4: 4a9f ldr r2, [pc, #636] ; (8008824 ) + 80085a6: 2102 movs r1, #2 + 80085a8: 489c ldr r0, [pc, #624] ; (800881c ) + 80085aa: f001 f9af bl 800990c + break; + 80085ae: f000 bca1 b.w 8008ef4 + TOUT_OP(1, Output2, 1000); + 80085b2: 68bb ldr r3, [r7, #8] + 80085b4: 2b01 cmp r3, #1 + 80085b6: d10b bne.n 80085d0 + 80085b8: f000 fe1a bl 80091f0 + 80085bc: f000 fe30 bl 8009220 + 80085c0: 4603 mov r3, r0 + 80085c2: 4a98 ldr r2, [pc, #608] ; (8008824 ) + 80085c4: 2102 movs r1, #2 + 80085c6: 4895 ldr r0, [pc, #596] ; (800881c ) + 80085c8: f001 f9a0 bl 800990c + break; + 80085cc: f000 bc92 b.w 8008ef4 + TOUT_OP(1, Output2, 1000); + 80085d0: 68bb ldr r3, [r7, #8] + 80085d2: 2b02 cmp r3, #2 + 80085d4: d119 bne.n 800860a + 80085d6: f000 fe0b bl 80091f0 + 80085da: f000 fe21 bl 8009220 + 80085de: 4603 mov r3, r0 + 80085e0: 4a90 ldr r2, [pc, #576] ; (8008824 ) + 80085e2: 2102 movs r1, #2 + 80085e4: 488d ldr r0, [pc, #564] ; (800881c ) + 80085e6: f001 f991 bl 800990c + 80085ea: f44f 707a mov.w r0, #1000 ; 0x3e8 + 80085ee: f7fb f829 bl 8003644 + 80085f2: f000 fe09 bl 8009208 + 80085f6: f000 fe13 bl 8009220 + 80085fa: 4603 mov r3, r0 + 80085fc: 4a89 ldr r2, [pc, #548] ; (8008824 ) + 80085fe: 2102 movs r1, #2 + 8008600: 4886 ldr r0, [pc, #536] ; (800881c ) + 8008602: f001 f983 bl 800990c + break; + 8008606: f000 bc75 b.w 8008ef4 + TOUT_OP(1, Output2, 1000); + 800860a: 68bb ldr r3, [r7, #8] + 800860c: 2b00 cmp r3, #0 + 800860e: f340 8471 ble.w 8008ef4 + 8008612: 68bb ldr r3, [r7, #8] + 8008614: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008618: fb02 f303 mul.w r3, r2, r3 + 800861c: 617b str r3, [r7, #20] + 800861e: e051 b.n 80086c4 + 8008620: 697b ldr r3, [r7, #20] + 8008622: 3b01 subs r3, #1 + 8008624: 617b str r3, [r7, #20] + 8008626: f000 fde3 bl 80091f0 + 800862a: f000 fdf9 bl 8009220 + 800862e: 4603 mov r3, r0 + 8008630: 4a7c ldr r2, [pc, #496] ; (8008824 ) + 8008632: 2102 movs r1, #2 + 8008634: 4879 ldr r0, [pc, #484] ; (800881c ) + 8008636: f001 f969 bl 800990c + 800863a: 68bb ldr r3, [r7, #8] + 800863c: 3309 adds r3, #9 + 800863e: 4a78 ldr r2, [pc, #480] ; (8008820 ) + 8008640: fb82 1203 smull r1, r2, r2, r3 + 8008644: 1092 asrs r2, r2, #2 + 8008646: 17db asrs r3, r3, #31 + 8008648: 1ad3 subs r3, r2, r3 + 800864a: 613b str r3, [r7, #16] + 800864c: 200a movs r0, #10 + 800864e: f7fa fff9 bl 8003644 + 8008652: f7fa ffa7 bl 80035a4 + 8008656: 4603 mov r3, r0 + 8008658: 2b00 cmp r3, #0 + 800865a: d106 bne.n 800866a + 800865c: 693b ldr r3, [r7, #16] + 800865e: 3b01 subs r3, #1 + 8008660: 613b str r3, [r7, #16] + 8008662: 693b ldr r3, [r7, #16] + 8008664: 2b00 cmp r3, #0 + 8008666: d1f1 bne.n 800864c + 8008668: e000 b.n 800866c + 800866a: bf00 nop + 800866c: 693b ldr r3, [r7, #16] + 800866e: 2b00 cmp r3, #0 + 8008670: d12c bne.n 80086cc + 8008672: f000 fdc9 bl 8009208 + 8008676: f000 fdd3 bl 8009220 + 800867a: 4603 mov r3, r0 + 800867c: 4a69 ldr r2, [pc, #420] ; (8008824 ) + 800867e: 2102 movs r1, #2 + 8008680: 4866 ldr r0, [pc, #408] ; (800881c ) + 8008682: f001 f943 bl 800990c + 8008686: 68bb ldr r3, [r7, #8] + 8008688: 3309 adds r3, #9 + 800868a: 4a65 ldr r2, [pc, #404] ; (8008820 ) + 800868c: fb82 1203 smull r1, r2, r2, r3 + 8008690: 1092 asrs r2, r2, #2 + 8008692: 17db asrs r3, r3, #31 + 8008694: 1ad3 subs r3, r2, r3 + 8008696: 613b str r3, [r7, #16] + 8008698: 693b ldr r3, [r7, #16] + 800869a: 009b lsls r3, r3, #2 + 800869c: 613b str r3, [r7, #16] + 800869e: 200a movs r0, #10 + 80086a0: f7fa ffd0 bl 8003644 + 80086a4: f7fa ff7e bl 80035a4 + 80086a8: 4603 mov r3, r0 + 80086aa: 2b00 cmp r3, #0 + 80086ac: d106 bne.n 80086bc + 80086ae: 693b ldr r3, [r7, #16] + 80086b0: 3b01 subs r3, #1 + 80086b2: 613b str r3, [r7, #16] + 80086b4: 693b ldr r3, [r7, #16] + 80086b6: 2b00 cmp r3, #0 + 80086b8: d1f1 bne.n 800869e + 80086ba: e000 b.n 80086be + 80086bc: bf00 nop + 80086be: 693b ldr r3, [r7, #16] + 80086c0: 2b00 cmp r3, #0 + 80086c2: d103 bne.n 80086cc + 80086c4: 697b ldr r3, [r7, #20] + 80086c6: 2b00 cmp r3, #0 + 80086c8: dcaa bgt.n 8008620 + 80086ca: e000 b.n 80086ce + 80086cc: bf00 nop + 80086ce: f000 fd9b bl 8009208 + 80086d2: f000 fda5 bl 8009220 + 80086d6: 4603 mov r3, r0 + 80086d8: 4a52 ldr r2, [pc, #328] ; (8008824 ) + 80086da: 2102 movs r1, #2 + 80086dc: 484f ldr r0, [pc, #316] ; (800881c ) + 80086de: f001 f915 bl 800990c + break; + 80086e2: f000 bc07 b.w 8008ef4 + case 3: + TOUT_OP(2, Output3, 1000); + 80086e6: 68bb ldr r3, [r7, #8] + 80086e8: 2b00 cmp r3, #0 + 80086ea: d10a bne.n 8008702 + 80086ec: f000 fdb2 bl 8009254 + 80086f0: f000 fdbc bl 800926c + 80086f4: 4603 mov r3, r0 + 80086f6: 4a4c ldr r2, [pc, #304] ; (8008828 ) + 80086f8: 2103 movs r1, #3 + 80086fa: 4848 ldr r0, [pc, #288] ; (800881c ) + 80086fc: f001 f906 bl 800990c + break; + 8008700: e3fa b.n 8008ef8 + TOUT_OP(2, Output3, 1000); + 8008702: 68bb ldr r3, [r7, #8] + 8008704: 2b01 cmp r3, #1 + 8008706: d10a bne.n 800871e + 8008708: f000 fd98 bl 800923c + 800870c: f000 fdae bl 800926c + 8008710: 4603 mov r3, r0 + 8008712: 4a45 ldr r2, [pc, #276] ; (8008828 ) + 8008714: 2103 movs r1, #3 + 8008716: 4841 ldr r0, [pc, #260] ; (800881c ) + 8008718: f001 f8f8 bl 800990c + break; + 800871c: e3ec b.n 8008ef8 + TOUT_OP(2, Output3, 1000); + 800871e: 68bb ldr r3, [r7, #8] + 8008720: 2b02 cmp r3, #2 + 8008722: d118 bne.n 8008756 + 8008724: f000 fd8a bl 800923c + 8008728: f000 fda0 bl 800926c + 800872c: 4603 mov r3, r0 + 800872e: 4a3e ldr r2, [pc, #248] ; (8008828 ) + 8008730: 2103 movs r1, #3 + 8008732: 483a ldr r0, [pc, #232] ; (800881c ) + 8008734: f001 f8ea bl 800990c + 8008738: f44f 707a mov.w r0, #1000 ; 0x3e8 + 800873c: f7fa ff82 bl 8003644 + 8008740: f000 fd88 bl 8009254 + 8008744: f000 fd92 bl 800926c + 8008748: 4603 mov r3, r0 + 800874a: 4a37 ldr r2, [pc, #220] ; (8008828 ) + 800874c: 2103 movs r1, #3 + 800874e: 4833 ldr r0, [pc, #204] ; (800881c ) + 8008750: f001 f8dc bl 800990c + break; + 8008754: e3d0 b.n 8008ef8 + TOUT_OP(2, Output3, 1000); + 8008756: 68bb ldr r3, [r7, #8] + 8008758: 2b00 cmp r3, #0 + 800875a: f340 83cd ble.w 8008ef8 + 800875e: 68bb ldr r3, [r7, #8] + 8008760: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008764: fb02 f303 mul.w r3, r2, r3 + 8008768: 617b str r3, [r7, #20] + 800876a: e051 b.n 8008810 + 800876c: 697b ldr r3, [r7, #20] + 800876e: 3b01 subs r3, #1 + 8008770: 617b str r3, [r7, #20] + 8008772: f000 fd63 bl 800923c + 8008776: f000 fd79 bl 800926c + 800877a: 4603 mov r3, r0 + 800877c: 4a2a ldr r2, [pc, #168] ; (8008828 ) + 800877e: 2103 movs r1, #3 + 8008780: 4826 ldr r0, [pc, #152] ; (800881c ) + 8008782: f001 f8c3 bl 800990c + 8008786: 68bb ldr r3, [r7, #8] + 8008788: 3309 adds r3, #9 + 800878a: 4a25 ldr r2, [pc, #148] ; (8008820 ) + 800878c: fb82 1203 smull r1, r2, r2, r3 + 8008790: 1092 asrs r2, r2, #2 + 8008792: 17db asrs r3, r3, #31 + 8008794: 1ad3 subs r3, r2, r3 + 8008796: 613b str r3, [r7, #16] + 8008798: 200a movs r0, #10 + 800879a: f7fa ff53 bl 8003644 + 800879e: f7fa ff01 bl 80035a4 + 80087a2: 4603 mov r3, r0 + 80087a4: 2b00 cmp r3, #0 + 80087a6: d106 bne.n 80087b6 + 80087a8: 693b ldr r3, [r7, #16] + 80087aa: 3b01 subs r3, #1 + 80087ac: 613b str r3, [r7, #16] + 80087ae: 693b ldr r3, [r7, #16] + 80087b0: 2b00 cmp r3, #0 + 80087b2: d1f1 bne.n 8008798 + 80087b4: e000 b.n 80087b8 + 80087b6: bf00 nop + 80087b8: 693b ldr r3, [r7, #16] + 80087ba: 2b00 cmp r3, #0 + 80087bc: d136 bne.n 800882c + 80087be: f000 fd49 bl 8009254 + 80087c2: f000 fd53 bl 800926c + 80087c6: 4603 mov r3, r0 + 80087c8: 4a17 ldr r2, [pc, #92] ; (8008828 ) + 80087ca: 2103 movs r1, #3 + 80087cc: 4813 ldr r0, [pc, #76] ; (800881c ) + 80087ce: f001 f89d bl 800990c + 80087d2: 68bb ldr r3, [r7, #8] + 80087d4: 3309 adds r3, #9 + 80087d6: 4a12 ldr r2, [pc, #72] ; (8008820 ) + 80087d8: fb82 1203 smull r1, r2, r2, r3 + 80087dc: 1092 asrs r2, r2, #2 + 80087de: 17db asrs r3, r3, #31 + 80087e0: 1ad3 subs r3, r2, r3 + 80087e2: 613b str r3, [r7, #16] + 80087e4: 693b ldr r3, [r7, #16] + 80087e6: 009b lsls r3, r3, #2 + 80087e8: 613b str r3, [r7, #16] + 80087ea: 200a movs r0, #10 + 80087ec: f7fa ff2a bl 8003644 + 80087f0: f7fa fed8 bl 80035a4 + 80087f4: 4603 mov r3, r0 + 80087f6: 2b00 cmp r3, #0 + 80087f8: d106 bne.n 8008808 + 80087fa: 693b ldr r3, [r7, #16] + 80087fc: 3b01 subs r3, #1 + 80087fe: 613b str r3, [r7, #16] + 8008800: 693b ldr r3, [r7, #16] + 8008802: 2b00 cmp r3, #0 + 8008804: d1f1 bne.n 80087ea + 8008806: e000 b.n 800880a + 8008808: bf00 nop + 800880a: 693b ldr r3, [r7, #16] + 800880c: 2b00 cmp r3, #0 + 800880e: d10d bne.n 800882c + 8008810: 697b ldr r3, [r7, #20] + 8008812: 2b00 cmp r3, #0 + 8008814: dcaa bgt.n 800876c + 8008816: e00a b.n 800882e + 8008818: 200002cc .word 0x200002cc + 800881c: 0800adf0 .word 0x0800adf0 + 8008820: 66666667 .word 0x66666667 + 8008824: 200002e0 .word 0x200002e0 + 8008828: 200002f4 .word 0x200002f4 + 800882c: bf00 nop + 800882e: f000 fd11 bl 8009254 + 8008832: f000 fd1b bl 800926c + 8008836: 4603 mov r3, r0 + 8008838: 4ab5 ldr r2, [pc, #724] ; (8008b10 ) + 800883a: 2103 movs r1, #3 + 800883c: 48b5 ldr r0, [pc, #724] ; (8008b14 ) + 800883e: f001 f865 bl 800990c + break; + 8008842: e359 b.n 8008ef8 + case 4: + TOUT_OP(3, Output4, 1000); + 8008844: 68bb ldr r3, [r7, #8] + 8008846: 2b00 cmp r3, #0 + 8008848: d10a bne.n 8008860 + 800884a: f000 fd29 bl 80092a0 + 800884e: f000 fd33 bl 80092b8 + 8008852: 4603 mov r3, r0 + 8008854: 4ab0 ldr r2, [pc, #704] ; (8008b18 ) + 8008856: 2104 movs r1, #4 + 8008858: 48ae ldr r0, [pc, #696] ; (8008b14 ) + 800885a: f001 f857 bl 800990c + break; + 800885e: e34d b.n 8008efc + TOUT_OP(3, Output4, 1000); + 8008860: 68bb ldr r3, [r7, #8] + 8008862: 2b01 cmp r3, #1 + 8008864: d10a bne.n 800887c + 8008866: f000 fd0f bl 8009288 + 800886a: f000 fd25 bl 80092b8 + 800886e: 4603 mov r3, r0 + 8008870: 4aa9 ldr r2, [pc, #676] ; (8008b18 ) + 8008872: 2104 movs r1, #4 + 8008874: 48a7 ldr r0, [pc, #668] ; (8008b14 ) + 8008876: f001 f849 bl 800990c + break; + 800887a: e33f b.n 8008efc + TOUT_OP(3, Output4, 1000); + 800887c: 68bb ldr r3, [r7, #8] + 800887e: 2b02 cmp r3, #2 + 8008880: d118 bne.n 80088b4 + 8008882: f000 fd01 bl 8009288 + 8008886: f000 fd17 bl 80092b8 + 800888a: 4603 mov r3, r0 + 800888c: 4aa2 ldr r2, [pc, #648] ; (8008b18 ) + 800888e: 2104 movs r1, #4 + 8008890: 48a0 ldr r0, [pc, #640] ; (8008b14 ) + 8008892: f001 f83b bl 800990c + 8008896: f44f 707a mov.w r0, #1000 ; 0x3e8 + 800889a: f7fa fed3 bl 8003644 + 800889e: f000 fcff bl 80092a0 + 80088a2: f000 fd09 bl 80092b8 + 80088a6: 4603 mov r3, r0 + 80088a8: 4a9b ldr r2, [pc, #620] ; (8008b18 ) + 80088aa: 2104 movs r1, #4 + 80088ac: 4899 ldr r0, [pc, #612] ; (8008b14 ) + 80088ae: f001 f82d bl 800990c + break; + 80088b2: e323 b.n 8008efc + TOUT_OP(3, Output4, 1000); + 80088b4: 68bb ldr r3, [r7, #8] + 80088b6: 2b00 cmp r3, #0 + 80088b8: f340 8320 ble.w 8008efc + 80088bc: 68bb ldr r3, [r7, #8] + 80088be: f44f 727a mov.w r2, #1000 ; 0x3e8 + 80088c2: fb02 f303 mul.w r3, r2, r3 + 80088c6: 617b str r3, [r7, #20] + 80088c8: e051 b.n 800896e + 80088ca: 697b ldr r3, [r7, #20] + 80088cc: 3b01 subs r3, #1 + 80088ce: 617b str r3, [r7, #20] + 80088d0: f000 fcda bl 8009288 + 80088d4: f000 fcf0 bl 80092b8 + 80088d8: 4603 mov r3, r0 + 80088da: 4a8f ldr r2, [pc, #572] ; (8008b18 ) + 80088dc: 2104 movs r1, #4 + 80088de: 488d ldr r0, [pc, #564] ; (8008b14 ) + 80088e0: f001 f814 bl 800990c + 80088e4: 68bb ldr r3, [r7, #8] + 80088e6: 3309 adds r3, #9 + 80088e8: 4a8c ldr r2, [pc, #560] ; (8008b1c ) + 80088ea: fb82 1203 smull r1, r2, r2, r3 + 80088ee: 1092 asrs r2, r2, #2 + 80088f0: 17db asrs r3, r3, #31 + 80088f2: 1ad3 subs r3, r2, r3 + 80088f4: 613b str r3, [r7, #16] + 80088f6: 200a movs r0, #10 + 80088f8: f7fa fea4 bl 8003644 + 80088fc: f7fa fe52 bl 80035a4 + 8008900: 4603 mov r3, r0 + 8008902: 2b00 cmp r3, #0 + 8008904: d106 bne.n 8008914 + 8008906: 693b ldr r3, [r7, #16] + 8008908: 3b01 subs r3, #1 + 800890a: 613b str r3, [r7, #16] + 800890c: 693b ldr r3, [r7, #16] + 800890e: 2b00 cmp r3, #0 + 8008910: d1f1 bne.n 80088f6 + 8008912: e000 b.n 8008916 + 8008914: bf00 nop + 8008916: 693b ldr r3, [r7, #16] + 8008918: 2b00 cmp r3, #0 + 800891a: d12c bne.n 8008976 + 800891c: f000 fcc0 bl 80092a0 + 8008920: f000 fcca bl 80092b8 + 8008924: 4603 mov r3, r0 + 8008926: 4a7c ldr r2, [pc, #496] ; (8008b18 ) + 8008928: 2104 movs r1, #4 + 800892a: 487a ldr r0, [pc, #488] ; (8008b14 ) + 800892c: f000 ffee bl 800990c + 8008930: 68bb ldr r3, [r7, #8] + 8008932: 3309 adds r3, #9 + 8008934: 4a79 ldr r2, [pc, #484] ; (8008b1c ) + 8008936: fb82 1203 smull r1, r2, r2, r3 + 800893a: 1092 asrs r2, r2, #2 + 800893c: 17db asrs r3, r3, #31 + 800893e: 1ad3 subs r3, r2, r3 + 8008940: 613b str r3, [r7, #16] + 8008942: 693b ldr r3, [r7, #16] + 8008944: 009b lsls r3, r3, #2 + 8008946: 613b str r3, [r7, #16] + 8008948: 200a movs r0, #10 + 800894a: f7fa fe7b bl 8003644 + 800894e: f7fa fe29 bl 80035a4 + 8008952: 4603 mov r3, r0 + 8008954: 2b00 cmp r3, #0 + 8008956: d106 bne.n 8008966 + 8008958: 693b ldr r3, [r7, #16] + 800895a: 3b01 subs r3, #1 + 800895c: 613b str r3, [r7, #16] + 800895e: 693b ldr r3, [r7, #16] + 8008960: 2b00 cmp r3, #0 + 8008962: d1f1 bne.n 8008948 + 8008964: e000 b.n 8008968 + 8008966: bf00 nop + 8008968: 693b ldr r3, [r7, #16] + 800896a: 2b00 cmp r3, #0 + 800896c: d103 bne.n 8008976 + 800896e: 697b ldr r3, [r7, #20] + 8008970: 2b00 cmp r3, #0 + 8008972: dcaa bgt.n 80088ca + 8008974: e000 b.n 8008978 + 8008976: bf00 nop + 8008978: f000 fc92 bl 80092a0 + 800897c: f000 fc9c bl 80092b8 + 8008980: 4603 mov r3, r0 + 8008982: 4a65 ldr r2, [pc, #404] ; (8008b18 ) + 8008984: 2104 movs r1, #4 + 8008986: 4863 ldr r0, [pc, #396] ; (8008b14 ) + 8008988: f000 ffc0 bl 800990c + break; + 800898c: e2b6 b.n 8008efc + case 5: + TOUT_OP(4, Output5, 1000); + 800898e: 68bb ldr r3, [r7, #8] + 8008990: 2b00 cmp r3, #0 + 8008992: d10a bne.n 80089aa + 8008994: f000 fcaa bl 80092ec + 8008998: f000 fcb4 bl 8009304 + 800899c: 4603 mov r3, r0 + 800899e: 4a60 ldr r2, [pc, #384] ; (8008b20 ) + 80089a0: 2105 movs r1, #5 + 80089a2: 485c ldr r0, [pc, #368] ; (8008b14 ) + 80089a4: f000 ffb2 bl 800990c + break; + 80089a8: e2aa b.n 8008f00 + TOUT_OP(4, Output5, 1000); + 80089aa: 68bb ldr r3, [r7, #8] + 80089ac: 2b01 cmp r3, #1 + 80089ae: d10a bne.n 80089c6 + 80089b0: f000 fc90 bl 80092d4 + 80089b4: f000 fca6 bl 8009304 + 80089b8: 4603 mov r3, r0 + 80089ba: 4a59 ldr r2, [pc, #356] ; (8008b20 ) + 80089bc: 2105 movs r1, #5 + 80089be: 4855 ldr r0, [pc, #340] ; (8008b14 ) + 80089c0: f000 ffa4 bl 800990c + break; + 80089c4: e29c b.n 8008f00 + TOUT_OP(4, Output5, 1000); + 80089c6: 68bb ldr r3, [r7, #8] + 80089c8: 2b02 cmp r3, #2 + 80089ca: d118 bne.n 80089fe + 80089cc: f000 fc82 bl 80092d4 + 80089d0: f000 fc98 bl 8009304 + 80089d4: 4603 mov r3, r0 + 80089d6: 4a52 ldr r2, [pc, #328] ; (8008b20 ) + 80089d8: 2105 movs r1, #5 + 80089da: 484e ldr r0, [pc, #312] ; (8008b14 ) + 80089dc: f000 ff96 bl 800990c + 80089e0: f44f 707a mov.w r0, #1000 ; 0x3e8 + 80089e4: f7fa fe2e bl 8003644 + 80089e8: f000 fc80 bl 80092ec + 80089ec: f000 fc8a bl 8009304 + 80089f0: 4603 mov r3, r0 + 80089f2: 4a4b ldr r2, [pc, #300] ; (8008b20 ) + 80089f4: 2105 movs r1, #5 + 80089f6: 4847 ldr r0, [pc, #284] ; (8008b14 ) + 80089f8: f000 ff88 bl 800990c + break; + 80089fc: e280 b.n 8008f00 + TOUT_OP(4, Output5, 1000); + 80089fe: 68bb ldr r3, [r7, #8] + 8008a00: 2b00 cmp r3, #0 + 8008a02: f340 827d ble.w 8008f00 + 8008a06: 68bb ldr r3, [r7, #8] + 8008a08: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008a0c: fb02 f303 mul.w r3, r2, r3 + 8008a10: 617b str r3, [r7, #20] + 8008a12: e051 b.n 8008ab8 + 8008a14: 697b ldr r3, [r7, #20] + 8008a16: 3b01 subs r3, #1 + 8008a18: 617b str r3, [r7, #20] + 8008a1a: f000 fc5b bl 80092d4 + 8008a1e: f000 fc71 bl 8009304 + 8008a22: 4603 mov r3, r0 + 8008a24: 4a3e ldr r2, [pc, #248] ; (8008b20 ) + 8008a26: 2105 movs r1, #5 + 8008a28: 483a ldr r0, [pc, #232] ; (8008b14 ) + 8008a2a: f000 ff6f bl 800990c + 8008a2e: 68bb ldr r3, [r7, #8] + 8008a30: 3309 adds r3, #9 + 8008a32: 4a3a ldr r2, [pc, #232] ; (8008b1c ) + 8008a34: fb82 1203 smull r1, r2, r2, r3 + 8008a38: 1092 asrs r2, r2, #2 + 8008a3a: 17db asrs r3, r3, #31 + 8008a3c: 1ad3 subs r3, r2, r3 + 8008a3e: 613b str r3, [r7, #16] + 8008a40: 200a movs r0, #10 + 8008a42: f7fa fdff bl 8003644 + 8008a46: f7fa fdad bl 80035a4 + 8008a4a: 4603 mov r3, r0 + 8008a4c: 2b00 cmp r3, #0 + 8008a4e: d106 bne.n 8008a5e + 8008a50: 693b ldr r3, [r7, #16] + 8008a52: 3b01 subs r3, #1 + 8008a54: 613b str r3, [r7, #16] + 8008a56: 693b ldr r3, [r7, #16] + 8008a58: 2b00 cmp r3, #0 + 8008a5a: d1f1 bne.n 8008a40 + 8008a5c: e000 b.n 8008a60 + 8008a5e: bf00 nop + 8008a60: 693b ldr r3, [r7, #16] + 8008a62: 2b00 cmp r3, #0 + 8008a64: d12c bne.n 8008ac0 + 8008a66: f000 fc41 bl 80092ec + 8008a6a: f000 fc4b bl 8009304 + 8008a6e: 4603 mov r3, r0 + 8008a70: 4a2b ldr r2, [pc, #172] ; (8008b20 ) + 8008a72: 2105 movs r1, #5 + 8008a74: 4827 ldr r0, [pc, #156] ; (8008b14 ) + 8008a76: f000 ff49 bl 800990c + 8008a7a: 68bb ldr r3, [r7, #8] + 8008a7c: 3309 adds r3, #9 + 8008a7e: 4a27 ldr r2, [pc, #156] ; (8008b1c ) + 8008a80: fb82 1203 smull r1, r2, r2, r3 + 8008a84: 1092 asrs r2, r2, #2 + 8008a86: 17db asrs r3, r3, #31 + 8008a88: 1ad3 subs r3, r2, r3 + 8008a8a: 613b str r3, [r7, #16] + 8008a8c: 693b ldr r3, [r7, #16] + 8008a8e: 009b lsls r3, r3, #2 + 8008a90: 613b str r3, [r7, #16] + 8008a92: 200a movs r0, #10 + 8008a94: f7fa fdd6 bl 8003644 + 8008a98: f7fa fd84 bl 80035a4 + 8008a9c: 4603 mov r3, r0 + 8008a9e: 2b00 cmp r3, #0 + 8008aa0: d106 bne.n 8008ab0 + 8008aa2: 693b ldr r3, [r7, #16] + 8008aa4: 3b01 subs r3, #1 + 8008aa6: 613b str r3, [r7, #16] + 8008aa8: 693b ldr r3, [r7, #16] + 8008aaa: 2b00 cmp r3, #0 + 8008aac: d1f1 bne.n 8008a92 + 8008aae: e000 b.n 8008ab2 + 8008ab0: bf00 nop + 8008ab2: 693b ldr r3, [r7, #16] + 8008ab4: 2b00 cmp r3, #0 + 8008ab6: d103 bne.n 8008ac0 + 8008ab8: 697b ldr r3, [r7, #20] + 8008aba: 2b00 cmp r3, #0 + 8008abc: dcaa bgt.n 8008a14 + 8008abe: e000 b.n 8008ac2 + 8008ac0: bf00 nop + 8008ac2: f000 fc13 bl 80092ec + 8008ac6: f000 fc1d bl 8009304 + 8008aca: 4603 mov r3, r0 + 8008acc: 4a14 ldr r2, [pc, #80] ; (8008b20 ) + 8008ace: 2105 movs r1, #5 + 8008ad0: 4810 ldr r0, [pc, #64] ; (8008b14 ) + 8008ad2: f000 ff1b bl 800990c + break; + 8008ad6: e213 b.n 8008f00 + case 6: + TOUT_OP(5, Output6, 1000); + 8008ad8: 68bb ldr r3, [r7, #8] + 8008ada: 2b00 cmp r3, #0 + 8008adc: d10a bne.n 8008af4 + 8008ade: f000 fc2b bl 8009338 + 8008ae2: f000 fc35 bl 8009350 + 8008ae6: 4603 mov r3, r0 + 8008ae8: 4a0e ldr r2, [pc, #56] ; (8008b24 ) + 8008aea: 2106 movs r1, #6 + 8008aec: 4809 ldr r0, [pc, #36] ; (8008b14 ) + 8008aee: f000 ff0d bl 800990c + break; + 8008af2: e207 b.n 8008f04 + TOUT_OP(5, Output6, 1000); + 8008af4: 68bb ldr r3, [r7, #8] + 8008af6: 2b01 cmp r3, #1 + 8008af8: d116 bne.n 8008b28 + 8008afa: f000 fc11 bl 8009320 + 8008afe: f000 fc27 bl 8009350 + 8008b02: 4603 mov r3, r0 + 8008b04: 4a07 ldr r2, [pc, #28] ; (8008b24 ) + 8008b06: 2106 movs r1, #6 + 8008b08: 4802 ldr r0, [pc, #8] ; (8008b14 ) + 8008b0a: f000 feff bl 800990c + break; + 8008b0e: e1f9 b.n 8008f04 + 8008b10: 200002f4 .word 0x200002f4 + 8008b14: 0800adf0 .word 0x0800adf0 + 8008b18: 20000308 .word 0x20000308 + 8008b1c: 66666667 .word 0x66666667 + 8008b20: 2000031c .word 0x2000031c + 8008b24: 20000330 .word 0x20000330 + TOUT_OP(5, Output6, 1000); + 8008b28: 68bb ldr r3, [r7, #8] + 8008b2a: 2b02 cmp r3, #2 + 8008b2c: d118 bne.n 8008b60 + 8008b2e: f000 fbf7 bl 8009320 + 8008b32: f000 fc0d bl 8009350 + 8008b36: 4603 mov r3, r0 + 8008b38: 4ab4 ldr r2, [pc, #720] ; (8008e0c ) + 8008b3a: 2106 movs r1, #6 + 8008b3c: 48b4 ldr r0, [pc, #720] ; (8008e10 ) + 8008b3e: f000 fee5 bl 800990c + 8008b42: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008b46: f7fa fd7d bl 8003644 + 8008b4a: f000 fbf5 bl 8009338 + 8008b4e: f000 fbff bl 8009350 + 8008b52: 4603 mov r3, r0 + 8008b54: 4aad ldr r2, [pc, #692] ; (8008e0c ) + 8008b56: 2106 movs r1, #6 + 8008b58: 48ad ldr r0, [pc, #692] ; (8008e10 ) + 8008b5a: f000 fed7 bl 800990c + break; + 8008b5e: e1d1 b.n 8008f04 + TOUT_OP(5, Output6, 1000); + 8008b60: 68bb ldr r3, [r7, #8] + 8008b62: 2b00 cmp r3, #0 + 8008b64: f340 81ce ble.w 8008f04 + 8008b68: 68bb ldr r3, [r7, #8] + 8008b6a: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008b6e: fb02 f303 mul.w r3, r2, r3 + 8008b72: 617b str r3, [r7, #20] + 8008b74: e051 b.n 8008c1a + 8008b76: 697b ldr r3, [r7, #20] + 8008b78: 3b01 subs r3, #1 + 8008b7a: 617b str r3, [r7, #20] + 8008b7c: f000 fbd0 bl 8009320 + 8008b80: f000 fbe6 bl 8009350 + 8008b84: 4603 mov r3, r0 + 8008b86: 4aa1 ldr r2, [pc, #644] ; (8008e0c ) + 8008b88: 2106 movs r1, #6 + 8008b8a: 48a1 ldr r0, [pc, #644] ; (8008e10 ) + 8008b8c: f000 febe bl 800990c + 8008b90: 68bb ldr r3, [r7, #8] + 8008b92: 3309 adds r3, #9 + 8008b94: 4a9f ldr r2, [pc, #636] ; (8008e14 ) + 8008b96: fb82 1203 smull r1, r2, r2, r3 + 8008b9a: 1092 asrs r2, r2, #2 + 8008b9c: 17db asrs r3, r3, #31 + 8008b9e: 1ad3 subs r3, r2, r3 + 8008ba0: 613b str r3, [r7, #16] + 8008ba2: 200a movs r0, #10 + 8008ba4: f7fa fd4e bl 8003644 + 8008ba8: f7fa fcfc bl 80035a4 + 8008bac: 4603 mov r3, r0 + 8008bae: 2b00 cmp r3, #0 + 8008bb0: d106 bne.n 8008bc0 + 8008bb2: 693b ldr r3, [r7, #16] + 8008bb4: 3b01 subs r3, #1 + 8008bb6: 613b str r3, [r7, #16] + 8008bb8: 693b ldr r3, [r7, #16] + 8008bba: 2b00 cmp r3, #0 + 8008bbc: d1f1 bne.n 8008ba2 + 8008bbe: e000 b.n 8008bc2 + 8008bc0: bf00 nop + 8008bc2: 693b ldr r3, [r7, #16] + 8008bc4: 2b00 cmp r3, #0 + 8008bc6: d12c bne.n 8008c22 + 8008bc8: f000 fbb6 bl 8009338 + 8008bcc: f000 fbc0 bl 8009350 + 8008bd0: 4603 mov r3, r0 + 8008bd2: 4a8e ldr r2, [pc, #568] ; (8008e0c ) + 8008bd4: 2106 movs r1, #6 + 8008bd6: 488e ldr r0, [pc, #568] ; (8008e10 ) + 8008bd8: f000 fe98 bl 800990c + 8008bdc: 68bb ldr r3, [r7, #8] + 8008bde: 3309 adds r3, #9 + 8008be0: 4a8c ldr r2, [pc, #560] ; (8008e14 ) + 8008be2: fb82 1203 smull r1, r2, r2, r3 + 8008be6: 1092 asrs r2, r2, #2 + 8008be8: 17db asrs r3, r3, #31 + 8008bea: 1ad3 subs r3, r2, r3 + 8008bec: 613b str r3, [r7, #16] + 8008bee: 693b ldr r3, [r7, #16] + 8008bf0: 009b lsls r3, r3, #2 + 8008bf2: 613b str r3, [r7, #16] + 8008bf4: 200a movs r0, #10 + 8008bf6: f7fa fd25 bl 8003644 + 8008bfa: f7fa fcd3 bl 80035a4 + 8008bfe: 4603 mov r3, r0 + 8008c00: 2b00 cmp r3, #0 + 8008c02: d106 bne.n 8008c12 + 8008c04: 693b ldr r3, [r7, #16] + 8008c06: 3b01 subs r3, #1 + 8008c08: 613b str r3, [r7, #16] + 8008c0a: 693b ldr r3, [r7, #16] + 8008c0c: 2b00 cmp r3, #0 + 8008c0e: d1f1 bne.n 8008bf4 + 8008c10: e000 b.n 8008c14 + 8008c12: bf00 nop + 8008c14: 693b ldr r3, [r7, #16] + 8008c16: 2b00 cmp r3, #0 + 8008c18: d103 bne.n 8008c22 + 8008c1a: 697b ldr r3, [r7, #20] + 8008c1c: 2b00 cmp r3, #0 + 8008c1e: dcaa bgt.n 8008b76 + 8008c20: e000 b.n 8008c24 + 8008c22: bf00 nop + 8008c24: f000 fb88 bl 8009338 + 8008c28: f000 fb92 bl 8009350 + 8008c2c: 4603 mov r3, r0 + 8008c2e: 4a77 ldr r2, [pc, #476] ; (8008e0c ) + 8008c30: 2106 movs r1, #6 + 8008c32: 4877 ldr r0, [pc, #476] ; (8008e10 ) + 8008c34: f000 fe6a bl 800990c + break; + 8008c38: e164 b.n 8008f04 + case 7: + TOUT_OP(6, Output7, 1000); + 8008c3a: 68bb ldr r3, [r7, #8] + 8008c3c: 2b00 cmp r3, #0 + 8008c3e: d10a bne.n 8008c56 + 8008c40: f000 fba0 bl 8009384 + 8008c44: f000 fbaa bl 800939c + 8008c48: 4603 mov r3, r0 + 8008c4a: 4a73 ldr r2, [pc, #460] ; (8008e18 ) + 8008c4c: 2107 movs r1, #7 + 8008c4e: 4870 ldr r0, [pc, #448] ; (8008e10 ) + 8008c50: f000 fe5c bl 800990c + break; + 8008c54: e158 b.n 8008f08 + TOUT_OP(6, Output7, 1000); + 8008c56: 68bb ldr r3, [r7, #8] + 8008c58: 2b01 cmp r3, #1 + 8008c5a: d10a bne.n 8008c72 + 8008c5c: f000 fb86 bl 800936c + 8008c60: f000 fb9c bl 800939c + 8008c64: 4603 mov r3, r0 + 8008c66: 4a6c ldr r2, [pc, #432] ; (8008e18 ) + 8008c68: 2107 movs r1, #7 + 8008c6a: 4869 ldr r0, [pc, #420] ; (8008e10 ) + 8008c6c: f000 fe4e bl 800990c + break; + 8008c70: e14a b.n 8008f08 + TOUT_OP(6, Output7, 1000); + 8008c72: 68bb ldr r3, [r7, #8] + 8008c74: 2b02 cmp r3, #2 + 8008c76: d118 bne.n 8008caa + 8008c78: f000 fb78 bl 800936c + 8008c7c: f000 fb8e bl 800939c + 8008c80: 4603 mov r3, r0 + 8008c82: 4a65 ldr r2, [pc, #404] ; (8008e18 ) + 8008c84: 2107 movs r1, #7 + 8008c86: 4862 ldr r0, [pc, #392] ; (8008e10 ) + 8008c88: f000 fe40 bl 800990c + 8008c8c: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008c90: f7fa fcd8 bl 8003644 + 8008c94: f000 fb76 bl 8009384 + 8008c98: f000 fb80 bl 800939c + 8008c9c: 4603 mov r3, r0 + 8008c9e: 4a5e ldr r2, [pc, #376] ; (8008e18 ) + 8008ca0: 2107 movs r1, #7 + 8008ca2: 485b ldr r0, [pc, #364] ; (8008e10 ) + 8008ca4: f000 fe32 bl 800990c + break; + 8008ca8: e12e b.n 8008f08 + TOUT_OP(6, Output7, 1000); + 8008caa: 68bb ldr r3, [r7, #8] + 8008cac: 2b00 cmp r3, #0 + 8008cae: f340 812b ble.w 8008f08 + 8008cb2: 68bb ldr r3, [r7, #8] + 8008cb4: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008cb8: fb02 f303 mul.w r3, r2, r3 + 8008cbc: 617b str r3, [r7, #20] + 8008cbe: e051 b.n 8008d64 + 8008cc0: 697b ldr r3, [r7, #20] + 8008cc2: 3b01 subs r3, #1 + 8008cc4: 617b str r3, [r7, #20] + 8008cc6: f000 fb51 bl 800936c + 8008cca: f000 fb67 bl 800939c + 8008cce: 4603 mov r3, r0 + 8008cd0: 4a51 ldr r2, [pc, #324] ; (8008e18 ) + 8008cd2: 2107 movs r1, #7 + 8008cd4: 484e ldr r0, [pc, #312] ; (8008e10 ) + 8008cd6: f000 fe19 bl 800990c + 8008cda: 68bb ldr r3, [r7, #8] + 8008cdc: 3309 adds r3, #9 + 8008cde: 4a4d ldr r2, [pc, #308] ; (8008e14 ) + 8008ce0: fb82 1203 smull r1, r2, r2, r3 + 8008ce4: 1092 asrs r2, r2, #2 + 8008ce6: 17db asrs r3, r3, #31 + 8008ce8: 1ad3 subs r3, r2, r3 + 8008cea: 613b str r3, [r7, #16] + 8008cec: 200a movs r0, #10 + 8008cee: f7fa fca9 bl 8003644 + 8008cf2: f7fa fc57 bl 80035a4 + 8008cf6: 4603 mov r3, r0 + 8008cf8: 2b00 cmp r3, #0 + 8008cfa: d106 bne.n 8008d0a + 8008cfc: 693b ldr r3, [r7, #16] + 8008cfe: 3b01 subs r3, #1 + 8008d00: 613b str r3, [r7, #16] + 8008d02: 693b ldr r3, [r7, #16] + 8008d04: 2b00 cmp r3, #0 + 8008d06: d1f1 bne.n 8008cec + 8008d08: e000 b.n 8008d0c + 8008d0a: bf00 nop + 8008d0c: 693b ldr r3, [r7, #16] + 8008d0e: 2b00 cmp r3, #0 + 8008d10: d12c bne.n 8008d6c + 8008d12: f000 fb37 bl 8009384 + 8008d16: f000 fb41 bl 800939c + 8008d1a: 4603 mov r3, r0 + 8008d1c: 4a3e ldr r2, [pc, #248] ; (8008e18 ) + 8008d1e: 2107 movs r1, #7 + 8008d20: 483b ldr r0, [pc, #236] ; (8008e10 ) + 8008d22: f000 fdf3 bl 800990c + 8008d26: 68bb ldr r3, [r7, #8] + 8008d28: 3309 adds r3, #9 + 8008d2a: 4a3a ldr r2, [pc, #232] ; (8008e14 ) + 8008d2c: fb82 1203 smull r1, r2, r2, r3 + 8008d30: 1092 asrs r2, r2, #2 + 8008d32: 17db asrs r3, r3, #31 + 8008d34: 1ad3 subs r3, r2, r3 + 8008d36: 613b str r3, [r7, #16] + 8008d38: 693b ldr r3, [r7, #16] + 8008d3a: 009b lsls r3, r3, #2 + 8008d3c: 613b str r3, [r7, #16] + 8008d3e: 200a movs r0, #10 + 8008d40: f7fa fc80 bl 8003644 + 8008d44: f7fa fc2e bl 80035a4 + 8008d48: 4603 mov r3, r0 + 8008d4a: 2b00 cmp r3, #0 + 8008d4c: d106 bne.n 8008d5c + 8008d4e: 693b ldr r3, [r7, #16] + 8008d50: 3b01 subs r3, #1 + 8008d52: 613b str r3, [r7, #16] + 8008d54: 693b ldr r3, [r7, #16] + 8008d56: 2b00 cmp r3, #0 + 8008d58: d1f1 bne.n 8008d3e + 8008d5a: e000 b.n 8008d5e + 8008d5c: bf00 nop + 8008d5e: 693b ldr r3, [r7, #16] + 8008d60: 2b00 cmp r3, #0 + 8008d62: d103 bne.n 8008d6c + 8008d64: 697b ldr r3, [r7, #20] + 8008d66: 2b00 cmp r3, #0 + 8008d68: dcaa bgt.n 8008cc0 + 8008d6a: e000 b.n 8008d6e + 8008d6c: bf00 nop + 8008d6e: f000 fb09 bl 8009384 + 8008d72: f000 fb13 bl 800939c + 8008d76: 4603 mov r3, r0 + 8008d78: 4a27 ldr r2, [pc, #156] ; (8008e18 ) + 8008d7a: 2107 movs r1, #7 + 8008d7c: 4824 ldr r0, [pc, #144] ; (8008e10 ) + 8008d7e: f000 fdc5 bl 800990c + break; + 8008d82: e0c1 b.n 8008f08 + case 8: + TOUT_OP(7, Output8, 1000); + 8008d84: 68bb ldr r3, [r7, #8] + 8008d86: 2b00 cmp r3, #0 + 8008d88: d10a bne.n 8008da0 + 8008d8a: f000 fb21 bl 80093d0 + 8008d8e: f000 fb2b bl 80093e8 + 8008d92: 4603 mov r3, r0 + 8008d94: 4a21 ldr r2, [pc, #132] ; (8008e1c ) + 8008d96: 2108 movs r1, #8 + 8008d98: 481d ldr r0, [pc, #116] ; (8008e10 ) + 8008d9a: f000 fdb7 bl 800990c + break; + 8008d9e: e0b5 b.n 8008f0c + TOUT_OP(7, Output8, 1000); + 8008da0: 68bb ldr r3, [r7, #8] + 8008da2: 2b01 cmp r3, #1 + 8008da4: d10a bne.n 8008dbc + 8008da6: f000 fb07 bl 80093b8 + 8008daa: f000 fb1d bl 80093e8 + 8008dae: 4603 mov r3, r0 + 8008db0: 4a1a ldr r2, [pc, #104] ; (8008e1c ) + 8008db2: 2108 movs r1, #8 + 8008db4: 4816 ldr r0, [pc, #88] ; (8008e10 ) + 8008db6: f000 fda9 bl 800990c + break; + 8008dba: e0a7 b.n 8008f0c + TOUT_OP(7, Output8, 1000); + 8008dbc: 68bb ldr r3, [r7, #8] + 8008dbe: 2b02 cmp r3, #2 + 8008dc0: d118 bne.n 8008df4 + 8008dc2: f000 faf9 bl 80093b8 + 8008dc6: f000 fb0f bl 80093e8 + 8008dca: 4603 mov r3, r0 + 8008dcc: 4a13 ldr r2, [pc, #76] ; (8008e1c ) + 8008dce: 2108 movs r1, #8 + 8008dd0: 480f ldr r0, [pc, #60] ; (8008e10 ) + 8008dd2: f000 fd9b bl 800990c + 8008dd6: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008dda: f7fa fc33 bl 8003644 + 8008dde: f000 faf7 bl 80093d0 + 8008de2: f000 fb01 bl 80093e8 + 8008de6: 4603 mov r3, r0 + 8008de8: 4a0c ldr r2, [pc, #48] ; (8008e1c ) + 8008dea: 2108 movs r1, #8 + 8008dec: 4808 ldr r0, [pc, #32] ; (8008e10 ) + 8008dee: f000 fd8d bl 800990c + break; + 8008df2: e08b b.n 8008f0c + TOUT_OP(7, Output8, 1000); + 8008df4: 68bb ldr r3, [r7, #8] + 8008df6: 2b00 cmp r3, #0 + 8008df8: f340 8088 ble.w 8008f0c + 8008dfc: 68bb ldr r3, [r7, #8] + 8008dfe: f44f 727a mov.w r2, #1000 ; 0x3e8 + 8008e02: fb02 f303 mul.w r3, r2, r3 + 8008e06: 617b str r3, [r7, #20] + 8008e08: e05c b.n 8008ec4 + 8008e0a: bf00 nop + 8008e0c: 20000330 .word 0x20000330 + 8008e10: 0800adf0 .word 0x0800adf0 + 8008e14: 66666667 .word 0x66666667 + 8008e18: 20000344 .word 0x20000344 + 8008e1c: 20000358 .word 0x20000358 + 8008e20: 697b ldr r3, [r7, #20] + 8008e22: 3b01 subs r3, #1 + 8008e24: 617b str r3, [r7, #20] + 8008e26: f000 fac7 bl 80093b8 + 8008e2a: f000 fadd bl 80093e8 + 8008e2e: 4603 mov r3, r0 + 8008e30: 4a38 ldr r2, [pc, #224] ; (8008f14 ) + 8008e32: 2108 movs r1, #8 + 8008e34: 4838 ldr r0, [pc, #224] ; (8008f18 ) + 8008e36: f000 fd69 bl 800990c + 8008e3a: 68bb ldr r3, [r7, #8] + 8008e3c: 3309 adds r3, #9 + 8008e3e: 4a37 ldr r2, [pc, #220] ; (8008f1c ) + 8008e40: fb82 1203 smull r1, r2, r2, r3 + 8008e44: 1092 asrs r2, r2, #2 + 8008e46: 17db asrs r3, r3, #31 + 8008e48: 1ad3 subs r3, r2, r3 + 8008e4a: 613b str r3, [r7, #16] + 8008e4c: 200a movs r0, #10 + 8008e4e: f7fa fbf9 bl 8003644 + 8008e52: f7fa fba7 bl 80035a4 + 8008e56: 4603 mov r3, r0 + 8008e58: 2b00 cmp r3, #0 + 8008e5a: d106 bne.n 8008e6a + 8008e5c: 693b ldr r3, [r7, #16] + 8008e5e: 3b01 subs r3, #1 + 8008e60: 613b str r3, [r7, #16] + 8008e62: 693b ldr r3, [r7, #16] + 8008e64: 2b00 cmp r3, #0 + 8008e66: d1f1 bne.n 8008e4c + 8008e68: e000 b.n 8008e6c + 8008e6a: bf00 nop + 8008e6c: 693b ldr r3, [r7, #16] + 8008e6e: 2b00 cmp r3, #0 + 8008e70: d12c bne.n 8008ecc + 8008e72: f000 faad bl 80093d0 + 8008e76: f000 fab7 bl 80093e8 + 8008e7a: 4603 mov r3, r0 + 8008e7c: 4a25 ldr r2, [pc, #148] ; (8008f14 ) + 8008e7e: 2108 movs r1, #8 + 8008e80: 4825 ldr r0, [pc, #148] ; (8008f18 ) + 8008e82: f000 fd43 bl 800990c + 8008e86: 68bb ldr r3, [r7, #8] + 8008e88: 3309 adds r3, #9 + 8008e8a: 4a24 ldr r2, [pc, #144] ; (8008f1c ) + 8008e8c: fb82 1203 smull r1, r2, r2, r3 + 8008e90: 1092 asrs r2, r2, #2 + 8008e92: 17db asrs r3, r3, #31 + 8008e94: 1ad3 subs r3, r2, r3 + 8008e96: 613b str r3, [r7, #16] + 8008e98: 693b ldr r3, [r7, #16] + 8008e9a: 009b lsls r3, r3, #2 + 8008e9c: 613b str r3, [r7, #16] + 8008e9e: 200a movs r0, #10 + 8008ea0: f7fa fbd0 bl 8003644 + 8008ea4: f7fa fb7e bl 80035a4 + 8008ea8: 4603 mov r3, r0 + 8008eaa: 2b00 cmp r3, #0 + 8008eac: d106 bne.n 8008ebc + 8008eae: 693b ldr r3, [r7, #16] + 8008eb0: 3b01 subs r3, #1 + 8008eb2: 613b str r3, [r7, #16] + 8008eb4: 693b ldr r3, [r7, #16] + 8008eb6: 2b00 cmp r3, #0 + 8008eb8: d1f1 bne.n 8008e9e + 8008eba: e000 b.n 8008ebe + 8008ebc: bf00 nop + 8008ebe: 693b ldr r3, [r7, #16] + 8008ec0: 2b00 cmp r3, #0 + 8008ec2: d103 bne.n 8008ecc + 8008ec4: 697b ldr r3, [r7, #20] + 8008ec6: 2b00 cmp r3, #0 + 8008ec8: dcaa bgt.n 8008e20 + 8008eca: e000 b.n 8008ece + 8008ecc: bf00 nop + 8008ece: f000 fa7f bl 80093d0 + 8008ed2: f000 fa89 bl 80093e8 + 8008ed6: 4603 mov r3, r0 + 8008ed8: 4a0e ldr r2, [pc, #56] ; (8008f14 ) + 8008eda: 2108 movs r1, #8 + 8008edc: 480e ldr r0, [pc, #56] ; (8008f18 ) + 8008ede: f000 fd15 bl 800990c + break; + 8008ee2: e013 b.n 8008f0c + return; + 8008ee4: bf00 nop + 8008ee6: e012 b.n 8008f0e + return; + 8008ee8: bf00 nop + 8008eea: e010 b.n 8008f0e + default: + break; + 8008eec: bf00 nop + 8008eee: e00e b.n 8008f0e + break; + 8008ef0: bf00 nop + 8008ef2: e00c b.n 8008f0e + break; + 8008ef4: bf00 nop + 8008ef6: e00a b.n 8008f0e + break; + 8008ef8: bf00 nop + 8008efa: e008 b.n 8008f0e + break; + 8008efc: bf00 nop + 8008efe: e006 b.n 8008f0e + break; + 8008f00: bf00 nop + 8008f02: e004 b.n 8008f0e + break; + 8008f04: bf00 nop + 8008f06: e002 b.n 8008f0e + break; + 8008f08: bf00 nop + 8008f0a: e000 b.n 8008f0e + break; + 8008f0c: bf00 nop + } + } +} + 8008f0e: 3718 adds r7, #24 + 8008f10: 46bd mov sp, r7 + 8008f12: bd80 pop {r7, pc} + 8008f14: 20000358 .word 0x20000358 + 8008f18: 0800adf0 .word 0x0800adf0 + 8008f1c: 66666667 .word 0x66666667 + +08008f20 : + + +//------------------------------------------------------------------------------- + +void InitWorkCtrl(void) +{ + 8008f20: b580 push {r7, lr} + 8008f22: af00 add r7, sp, #0 + DelayMs(1000); + 8008f24: f44f 707a mov.w r0, #1000 ; 0x3e8 + 8008f28: f7fa fb8c bl 8003644 + + memset(&g_workCtrl, 0, sizeof(WorkCtrl)); + 8008f2c: 2298 movs r2, #152 ; 0x98 + 8008f2e: 2100 movs r1, #0 + 8008f30: 4806 ldr r0, [pc, #24] ; (8008f4c ) + 8008f32: f000 fce2 bl 80098fa + g_workCtrl.workSta = 1; + 8008f36: 4b05 ldr r3, [pc, #20] ; (8008f4c ) + 8008f38: 2201 movs r2, #1 + 8008f3a: 601a str r2, [r3, #0] + +#if (BOARD_USE_FOR == SEW_HEAD) + InitSewHeadBoard(); + 8008f3c: f7fd fd3c bl 80069b8 +#endif + +#if (CONTROL_BUS == COMM_CAN) + InitCAN(); + 8008f40: f000 fb08 bl 8009554 +#endif + InitDebug(); + 8008f44: f7fe fbe8 bl 8007718 + //printf("Init work finish.\r\n"); + +} + 8008f48: bf00 nop + 8008f4a: bd80 pop {r7, pc} + 8008f4c: 20003c94 .word 0x20003c94 + +08008f50 : + +//------------------------------------------------------------------------------- + +void DelayRef(u32 ms) +{ + 8008f50: b580 push {r7, lr} + 8008f52: b082 sub sp, #8 + 8008f54: af00 add r7, sp, #0 + 8008f56: 6078 str r0, [r7, #4] + while(ms != 0) + 8008f58: e007 b.n 8008f6a + { + TriggerTask(); // ʱִУTCP ӣ + 8008f5a: f7fb fbef bl 800473c + //CanBusTask(); // ִ + DelayMs(1); + 8008f5e: 2001 movs r0, #1 + 8008f60: f7fa fb70 bl 8003644 + ms--; + 8008f64: 687b ldr r3, [r7, #4] + 8008f66: 3b01 subs r3, #1 + 8008f68: 607b str r3, [r7, #4] + while(ms != 0) + 8008f6a: 687b ldr r3, [r7, #4] + 8008f6c: 2b00 cmp r3, #0 + 8008f6e: d1f4 bne.n 8008f5a + } +} + 8008f70: bf00 nop + 8008f72: 3708 adds r7, #8 + 8008f74: 46bd mov sp, r7 + 8008f76: bd80 pop {r7, pc} + +08008f78 : + +//------------------------------------------------------------------------------- + +void WorkCtrlTask(void) +{ + 8008f78: b580 push {r7, lr} + 8008f7a: af00 add r7, sp, #0 +#if (BOARD_USE_FOR == SEW_HEAD) + SewHeadBoardTask(); + 8008f7c: f7fd fe3c bl 8006bf8 +#endif +#if (CONTROL_BUS == COMM_CAN) + CanBusTask(); + 8008f80: f000 fba4 bl 80096cc +#endif +} + 8008f84: bf00 nop + 8008f86: bd80 pop {r7, pc} + +08008f88 : +{ + 8008f88: b480 push {r7} + 8008f8a: b083 sub sp, #12 + 8008f8c: af00 add r7, sp, #0 + 8008f8e: 6078 str r0, [r7, #4] + 8008f90: 6039 str r1, [r7, #0] + return (READ_BIT(GPIOx->IDR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU) == ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); + 8008f92: 687b ldr r3, [r7, #4] + 8008f94: 689b ldr r3, [r3, #8] + 8008f96: 43da mvns r2, r3 + 8008f98: 683b ldr r3, [r7, #0] + 8008f9a: 0a1b lsrs r3, r3, #8 + 8008f9c: 4013 ands r3, r2 + 8008f9e: b29b uxth r3, r3 + 8008fa0: 2b00 cmp r3, #0 + 8008fa2: bf0c ite eq + 8008fa4: 2301 moveq r3, #1 + 8008fa6: 2300 movne r3, #0 + 8008fa8: b2db uxtb r3, r3 +} + 8008faa: 4618 mov r0, r3 + 8008fac: 370c adds r7, #12 + 8008fae: 46bd mov sp, r7 + 8008fb0: bc80 pop {r7} + 8008fb2: 4770 bx lr + +08008fb4 : +{ + 8008fb4: b480 push {r7} + 8008fb6: b083 sub sp, #12 + 8008fb8: af00 add r7, sp, #0 + 8008fba: 6078 str r0, [r7, #4] + 8008fbc: 6039 str r1, [r7, #0] + return (READ_BIT(GPIOx->ODR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU) == ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); + 8008fbe: 687b ldr r3, [r7, #4] + 8008fc0: 68db ldr r3, [r3, #12] + 8008fc2: 43da mvns r2, r3 + 8008fc4: 683b ldr r3, [r7, #0] + 8008fc6: 0a1b lsrs r3, r3, #8 + 8008fc8: 4013 ands r3, r2 + 8008fca: b29b uxth r3, r3 + 8008fcc: 2b00 cmp r3, #0 + 8008fce: bf0c ite eq + 8008fd0: 2301 moveq r3, #1 + 8008fd2: 2300 movne r3, #0 + 8008fd4: b2db uxtb r3, r3 +} + 8008fd6: 4618 mov r0, r3 + 8008fd8: 370c adds r7, #12 + 8008fda: 46bd mov sp, r7 + 8008fdc: bc80 pop {r7} + 8008fde: 4770 bx lr + +08008fe0 : +{ + 8008fe0: b480 push {r7} + 8008fe2: b083 sub sp, #12 + 8008fe4: af00 add r7, sp, #0 + 8008fe6: 6078 str r0, [r7, #4] + 8008fe8: 6039 str r1, [r7, #0] + WRITE_REG(GPIOx->BSRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); + 8008fea: 683b ldr r3, [r7, #0] + 8008fec: 0a1b lsrs r3, r3, #8 + 8008fee: b29a uxth r2, r3 + 8008ff0: 687b ldr r3, [r7, #4] + 8008ff2: 611a str r2, [r3, #16] +} + 8008ff4: bf00 nop + 8008ff6: 370c adds r7, #12 + 8008ff8: 46bd mov sp, r7 + 8008ffa: bc80 pop {r7} + 8008ffc: 4770 bx lr + +08008ffe : +{ + 8008ffe: b480 push {r7} + 8009000: b083 sub sp, #12 + 8009002: af00 add r7, sp, #0 + 8009004: 6078 str r0, [r7, #4] + 8009006: 6039 str r1, [r7, #0] + WRITE_REG(GPIOx->BRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); + 8009008: 683b ldr r3, [r7, #0] + 800900a: 0a1b lsrs r3, r3, #8 + 800900c: b29a uxth r2, r3 + 800900e: 687b ldr r3, [r7, #4] + 8009010: 615a str r2, [r3, #20] +} + 8009012: bf00 nop + 8009014: 370c adds r7, #12 + 8009016: 46bd mov sp, r7 + 8009018: bc80 pop {r7} + 800901a: 4770 bx lr + +0800901c : + +#include "inout.h" +#include "funcs.h" + +//-------------ͨѶ------------------------- +OUTPUT_FUNCS(En485Out, RS485_EN); // 485 + 800901c: b580 push {r7, lr} + 800901e: af00 add r7, sp, #0 + 8009020: f240 2102 movw r1, #514 ; 0x202 + 8009024: 4802 ldr r0, [pc, #8] ; (8009030 ) + 8009026: f7ff ffea bl 8008ffe + 800902a: bf00 nop + 800902c: bd80 pop {r7, pc} + 800902e: bf00 nop + 8009030: 40010c00 .word 0x40010c00 + +08009034 : + 8009034: b580 push {r7, lr} + 8009036: af00 add r7, sp, #0 + 8009038: f240 2102 movw r1, #514 ; 0x202 + 800903c: 4802 ldr r0, [pc, #8] ; (8009048 ) + 800903e: f7ff ffcf bl 8008fe0 + 8009042: bf00 nop + 8009044: bd80 pop {r7, pc} + 8009046: bf00 nop + 8009048: 40010c00 .word 0x40010c00 + +0800904c : +OUTPUT_FUNCS(En485_2_Out, RS485_2_EN); // 485 + 800904c: b580 push {r7, lr} + 800904e: af00 add r7, sp, #0 + 8009050: f240 2102 movw r1, #514 ; 0x202 + 8009054: 4802 ldr r0, [pc, #8] ; (8009060 ) + 8009056: f7ff ffd2 bl 8008ffe + 800905a: bf00 nop + 800905c: bd80 pop {r7, pc} + 800905e: bf00 nop + 8009060: 40010800 .word 0x40010800 + +08009064 : + 8009064: b580 push {r7, lr} + 8009066: af00 add r7, sp, #0 + 8009068: f240 2102 movw r1, #514 ; 0x202 + 800906c: 4802 ldr r0, [pc, #8] ; (8009078 ) + 800906e: f7ff ffb7 bl 8008fe0 + 8009072: bf00 nop + 8009074: bd80 pop {r7, pc} + 8009076: bf00 nop + 8009078: 40010800 .word 0x40010800 + +0800907c : + +//-----------------ź--------------------- +// Moto1 +OUTPUT_FUNCS(Moto1Step, MT_STEP); + 800907c: b580 push {r7, lr} + 800907e: af00 add r7, sp, #0 + 8009080: f242 0120 movw r1, #8224 ; 0x2020 + 8009084: 4802 ldr r0, [pc, #8] ; (8009090 ) + 8009086: f7ff ffba bl 8008ffe + 800908a: bf00 nop + 800908c: bd80 pop {r7, pc} + 800908e: bf00 nop + 8009090: 40010800 .word 0x40010800 + +08009094 : + 8009094: b580 push {r7, lr} + 8009096: af00 add r7, sp, #0 + 8009098: f242 0120 movw r1, #8224 ; 0x2020 + 800909c: 4802 ldr r0, [pc, #8] ; (80090a8 ) + 800909e: f7ff ff9f bl 8008fe0 + 80090a2: bf00 nop + 80090a4: bd80 pop {r7, pc} + 80090a6: bf00 nop + 80090a8: 40010800 .word 0x40010800 + +080090ac : +OUTPUT_FUNCS(Moto1Dir, MT_DIR); + 80090ac: b580 push {r7, lr} + 80090ae: af00 add r7, sp, #0 + 80090b0: f241 0110 movw r1, #4112 ; 0x1010 + 80090b4: 4802 ldr r0, [pc, #8] ; (80090c0 ) + 80090b6: f7ff ffa2 bl 8008ffe + 80090ba: bf00 nop + 80090bc: bd80 pop {r7, pc} + 80090be: bf00 nop + 80090c0: 40010800 .word 0x40010800 + +080090c4 : + 80090c4: b580 push {r7, lr} + 80090c6: af00 add r7, sp, #0 + 80090c8: f241 0110 movw r1, #4112 ; 0x1010 + 80090cc: 4802 ldr r0, [pc, #8] ; (80090d8 ) + 80090ce: f7ff ff87 bl 8008fe0 + 80090d2: bf00 nop + 80090d4: bd80 pop {r7, pc} + 80090d6: bf00 nop + 80090d8: 40010800 .word 0x40010800 + +080090dc : +OUTPUT_FUNCS(Moto1En, MT_SON); + + +//----------------------------------------- +INPUT_FUNCS(InputAP,AP); + 80090dc: b580 push {r7, lr} + 80090de: af00 add r7, sp, #0 + 80090e0: 4903 ldr r1, [pc, #12] ; (80090f0 ) + 80090e2: 4804 ldr r0, [pc, #16] ; (80090f4 ) + 80090e4: f7ff ff50 bl 8008f88 + 80090e8: 4603 mov r3, r0 + 80090ea: b2db uxtb r3, r3 + 80090ec: 4618 mov r0, r3 + 80090ee: bd80 pop {r7, pc} + 80090f0: 04010001 .word 0x04010001 + 80090f4: 40010800 .word 0x40010800 + +080090f8 : +INPUT_FUNCS(InputBP,BP); + 80090f8: b580 push {r7, lr} + 80090fa: af00 add r7, sp, #0 + 80090fc: 4903 ldr r1, [pc, #12] ; (800910c ) + 80090fe: 4804 ldr r0, [pc, #16] ; (8009110 ) + 8009100: f7ff ff42 bl 8008f88 + 8009104: 4603 mov r3, r0 + 8009106: b2db uxtb r3, r3 + 8009108: 4618 mov r0, r3 + 800910a: bd80 pop {r7, pc} + 800910c: 04020002 .word 0x04020002 + 8009110: 40010800 .word 0x40010800 + +08009114 : +INPUT_FUNCS(InputZP,ZP); + +//-----------------ź--------------------- +OUTPUT_FUNCS(SysLed, SYS_LED); + 8009114: b580 push {r7, lr} + 8009116: af00 add r7, sp, #0 + 8009118: 4902 ldr r1, [pc, #8] ; (8009124 ) + 800911a: 4803 ldr r0, [pc, #12] ; (8009128 ) + 800911c: f7ff ff6f bl 8008ffe + 8009120: bf00 nop + 8009122: bd80 pop {r7, pc} + 8009124: 04400040 .word 0x04400040 + 8009128: 40011000 .word 0x40011000 + +0800912c : + 800912c: b580 push {r7, lr} + 800912e: af00 add r7, sp, #0 + 8009130: 4902 ldr r1, [pc, #8] ; (800913c ) + 8009132: 4803 ldr r0, [pc, #12] ; (8009140 ) + 8009134: f7ff ff54 bl 8008fe0 + 8009138: bf00 nop + 800913a: bd80 pop {r7, pc} + 800913c: 04400040 .word 0x04400040 + 8009140: 40011000 .word 0x40011000 + +08009144 : +OUTPUT_FUNCS(ErrLed, ERR_LED); + +OUTPUT_FUNCS(OutputPWM1, OUTPWM1); + 8009144: b580 push {r7, lr} + 8009146: af00 add r7, sp, #0 + 8009148: f244 0140 movw r1, #16448 ; 0x4040 + 800914c: 4802 ldr r0, [pc, #8] ; (8009158 ) + 800914e: f7ff ff56 bl 8008ffe + 8009152: bf00 nop + 8009154: bd80 pop {r7, pc} + 8009156: bf00 nop + 8009158: 40011000 .word 0x40011000 + +0800915c : + 800915c: b580 push {r7, lr} + 800915e: af00 add r7, sp, #0 + 8009160: f244 0140 movw r1, #16448 ; 0x4040 + 8009164: 4802 ldr r0, [pc, #8] ; (8009170 ) + 8009166: f7ff ff3b bl 8008fe0 + 800916a: bf00 nop + 800916c: bd80 pop {r7, pc} + 800916e: bf00 nop + 8009170: 40011000 .word 0x40011000 + +08009174 : +OUTPUT_FUNCS(OutputPWM2, OUTPWM2); + 8009174: b580 push {r7, lr} + 8009176: af00 add r7, sp, #0 + 8009178: f240 1101 movw r1, #257 ; 0x101 + 800917c: 4802 ldr r0, [pc, #8] ; (8009188 ) + 800917e: f7ff ff3e bl 8008ffe + 8009182: bf00 nop + 8009184: bd80 pop {r7, pc} + 8009186: bf00 nop + 8009188: 40010800 .word 0x40010800 + +0800918c : + 800918c: b580 push {r7, lr} + 800918e: af00 add r7, sp, #0 + 8009190: f240 1101 movw r1, #257 ; 0x101 + 8009194: 4802 ldr r0, [pc, #8] ; (80091a0 ) + 8009196: f7ff ff23 bl 8008fe0 + 800919a: bf00 nop + 800919c: bd80 pop {r7, pc} + 800919e: bf00 nop + 80091a0: 40010800 .word 0x40010800 + +080091a4 : + +OUTPUT_FUNCS(Output1, OUTPUT1); + 80091a4: b580 push {r7, lr} + 80091a6: af00 add r7, sp, #0 + 80091a8: f248 0180 movw r1, #32896 ; 0x8080 + 80091ac: 4802 ldr r0, [pc, #8] ; (80091b8 ) + 80091ae: f7ff ff26 bl 8008ffe + 80091b2: bf00 nop + 80091b4: bd80 pop {r7, pc} + 80091b6: bf00 nop + 80091b8: 40010800 .word 0x40010800 + +080091bc : + 80091bc: b580 push {r7, lr} + 80091be: af00 add r7, sp, #0 + 80091c0: f248 0180 movw r1, #32896 ; 0x8080 + 80091c4: 4802 ldr r0, [pc, #8] ; (80091d0 ) + 80091c6: f7ff ff0b bl 8008fe0 + 80091ca: bf00 nop + 80091cc: bd80 pop {r7, pc} + 80091ce: bf00 nop + 80091d0: 40010800 .word 0x40010800 + +080091d4 : + 80091d4: b580 push {r7, lr} + 80091d6: af00 add r7, sp, #0 + 80091d8: f248 0180 movw r1, #32896 ; 0x8080 + 80091dc: 4803 ldr r0, [pc, #12] ; (80091ec ) + 80091de: f7ff fee9 bl 8008fb4 + 80091e2: 4603 mov r3, r0 + 80091e4: b2db uxtb r3, r3 + 80091e6: 4618 mov r0, r3 + 80091e8: bd80 pop {r7, pc} + 80091ea: bf00 nop + 80091ec: 40010800 .word 0x40010800 + +080091f0 : +OUTPUT_FUNCS(Output2, OUTPUT2); + 80091f0: b580 push {r7, lr} + 80091f2: af00 add r7, sp, #0 + 80091f4: f241 0110 movw r1, #4112 ; 0x1010 + 80091f8: 4802 ldr r0, [pc, #8] ; (8009204 ) + 80091fa: f7ff ff00 bl 8008ffe + 80091fe: bf00 nop + 8009200: bd80 pop {r7, pc} + 8009202: bf00 nop + 8009204: 40011000 .word 0x40011000 + +08009208 : + 8009208: b580 push {r7, lr} + 800920a: af00 add r7, sp, #0 + 800920c: f241 0110 movw r1, #4112 ; 0x1010 + 8009210: 4802 ldr r0, [pc, #8] ; (800921c ) + 8009212: f7ff fee5 bl 8008fe0 + 8009216: bf00 nop + 8009218: bd80 pop {r7, pc} + 800921a: bf00 nop + 800921c: 40011000 .word 0x40011000 + +08009220 : + 8009220: b580 push {r7, lr} + 8009222: af00 add r7, sp, #0 + 8009224: f241 0110 movw r1, #4112 ; 0x1010 + 8009228: 4803 ldr r0, [pc, #12] ; (8009238 ) + 800922a: f7ff fec3 bl 8008fb4 + 800922e: 4603 mov r3, r0 + 8009230: b2db uxtb r3, r3 + 8009232: 4618 mov r0, r3 + 8009234: bd80 pop {r7, pc} + 8009236: bf00 nop + 8009238: 40011000 .word 0x40011000 + +0800923c : +OUTPUT_FUNCS(Output3, OUTPUT3); + 800923c: b580 push {r7, lr} + 800923e: af00 add r7, sp, #0 + 8009240: f242 0120 movw r1, #8224 ; 0x2020 + 8009244: 4802 ldr r0, [pc, #8] ; (8009250 ) + 8009246: f7ff feda bl 8008ffe + 800924a: bf00 nop + 800924c: bd80 pop {r7, pc} + 800924e: bf00 nop + 8009250: 40011000 .word 0x40011000 + +08009254 : + 8009254: b580 push {r7, lr} + 8009256: af00 add r7, sp, #0 + 8009258: f242 0120 movw r1, #8224 ; 0x2020 + 800925c: 4802 ldr r0, [pc, #8] ; (8009268 ) + 800925e: f7ff febf bl 8008fe0 + 8009262: bf00 nop + 8009264: bd80 pop {r7, pc} + 8009266: bf00 nop + 8009268: 40011000 .word 0x40011000 + +0800926c : + 800926c: b580 push {r7, lr} + 800926e: af00 add r7, sp, #0 + 8009270: f242 0120 movw r1, #8224 ; 0x2020 + 8009274: 4803 ldr r0, [pc, #12] ; (8009284 ) + 8009276: f7ff fe9d bl 8008fb4 + 800927a: 4603 mov r3, r0 + 800927c: b2db uxtb r3, r3 + 800927e: 4618 mov r0, r3 + 8009280: bd80 pop {r7, pc} + 8009282: bf00 nop + 8009284: 40011000 .word 0x40011000 + +08009288 : +OUTPUT_FUNCS(Output4, OUTPUT4); + 8009288: b580 push {r7, lr} + 800928a: af00 add r7, sp, #0 + 800928c: f240 1101 movw r1, #257 ; 0x101 + 8009290: 4802 ldr r0, [pc, #8] ; (800929c ) + 8009292: f7ff feb4 bl 8008ffe + 8009296: bf00 nop + 8009298: bd80 pop {r7, pc} + 800929a: bf00 nop + 800929c: 40010c00 .word 0x40010c00 + +080092a0 : + 80092a0: b580 push {r7, lr} + 80092a2: af00 add r7, sp, #0 + 80092a4: f240 1101 movw r1, #257 ; 0x101 + 80092a8: 4802 ldr r0, [pc, #8] ; (80092b4 ) + 80092aa: f7ff fe99 bl 8008fe0 + 80092ae: bf00 nop + 80092b0: bd80 pop {r7, pc} + 80092b2: bf00 nop + 80092b4: 40010c00 .word 0x40010c00 + +080092b8 : + 80092b8: b580 push {r7, lr} + 80092ba: af00 add r7, sp, #0 + 80092bc: f240 1101 movw r1, #257 ; 0x101 + 80092c0: 4803 ldr r0, [pc, #12] ; (80092d0 ) + 80092c2: f7ff fe77 bl 8008fb4 + 80092c6: 4603 mov r3, r0 + 80092c8: b2db uxtb r3, r3 + 80092ca: 4618 mov r0, r3 + 80092cc: bd80 pop {r7, pc} + 80092ce: bf00 nop + 80092d0: 40010c00 .word 0x40010c00 + +080092d4 : +OUTPUT_FUNCS(Output5, OUTPUT5); + 80092d4: b580 push {r7, lr} + 80092d6: af00 add r7, sp, #0 + 80092d8: 4902 ldr r1, [pc, #8] ; (80092e4 ) + 80092da: 4803 ldr r0, [pc, #12] ; (80092e8 ) + 80092dc: f7ff fe8f bl 8008ffe + 80092e0: bf00 nop + 80092e2: bd80 pop {r7, pc} + 80092e4: 04100010 .word 0x04100010 + 80092e8: 40010c00 .word 0x40010c00 + +080092ec : + 80092ec: b580 push {r7, lr} + 80092ee: af00 add r7, sp, #0 + 80092f0: 4902 ldr r1, [pc, #8] ; (80092fc ) + 80092f2: 4803 ldr r0, [pc, #12] ; (8009300 ) + 80092f4: f7ff fe74 bl 8008fe0 + 80092f8: bf00 nop + 80092fa: bd80 pop {r7, pc} + 80092fc: 04100010 .word 0x04100010 + 8009300: 40010c00 .word 0x40010c00 + +08009304 : + 8009304: b580 push {r7, lr} + 8009306: af00 add r7, sp, #0 + 8009308: 4903 ldr r1, [pc, #12] ; (8009318 ) + 800930a: 4804 ldr r0, [pc, #16] ; (800931c ) + 800930c: f7ff fe52 bl 8008fb4 + 8009310: 4603 mov r3, r0 + 8009312: b2db uxtb r3, r3 + 8009314: 4618 mov r0, r3 + 8009316: bd80 pop {r7, pc} + 8009318: 04100010 .word 0x04100010 + 800931c: 40010c00 .word 0x40010c00 + +08009320 : +OUTPUT_FUNCS(Output6, OUTPUT6); + 8009320: b580 push {r7, lr} + 8009322: af00 add r7, sp, #0 + 8009324: 4902 ldr r1, [pc, #8] ; (8009330 ) + 8009326: 4803 ldr r0, [pc, #12] ; (8009334 ) + 8009328: f7ff fe69 bl 8008ffe + 800932c: bf00 nop + 800932e: bd80 pop {r7, pc} + 8009330: 04200020 .word 0x04200020 + 8009334: 40010c00 .word 0x40010c00 + +08009338 : + 8009338: b580 push {r7, lr} + 800933a: af00 add r7, sp, #0 + 800933c: 4902 ldr r1, [pc, #8] ; (8009348 ) + 800933e: 4803 ldr r0, [pc, #12] ; (800934c ) + 8009340: f7ff fe4e bl 8008fe0 + 8009344: bf00 nop + 8009346: bd80 pop {r7, pc} + 8009348: 04200020 .word 0x04200020 + 800934c: 40010c00 .word 0x40010c00 + +08009350 : + 8009350: b580 push {r7, lr} + 8009352: af00 add r7, sp, #0 + 8009354: 4903 ldr r1, [pc, #12] ; (8009364 ) + 8009356: 4804 ldr r0, [pc, #16] ; (8009368 ) + 8009358: f7ff fe2c bl 8008fb4 + 800935c: 4603 mov r3, r0 + 800935e: b2db uxtb r3, r3 + 8009360: 4618 mov r0, r3 + 8009362: bd80 pop {r7, pc} + 8009364: 04200020 .word 0x04200020 + 8009368: 40010c00 .word 0x40010c00 + +0800936c : +OUTPUT_FUNCS(Output7, OUTPUT7); + 800936c: b580 push {r7, lr} + 800936e: af00 add r7, sp, #0 + 8009370: 4902 ldr r1, [pc, #8] ; (800937c ) + 8009372: 4803 ldr r0, [pc, #12] ; (8009380 ) + 8009374: f7ff fe43 bl 8008ffe + 8009378: bf00 nop + 800937a: bd80 pop {r7, pc} + 800937c: 04400040 .word 0x04400040 + 8009380: 40010c00 .word 0x40010c00 + +08009384 : + 8009384: b580 push {r7, lr} + 8009386: af00 add r7, sp, #0 + 8009388: 4902 ldr r1, [pc, #8] ; (8009394 ) + 800938a: 4803 ldr r0, [pc, #12] ; (8009398 ) + 800938c: f7ff fe28 bl 8008fe0 + 8009390: bf00 nop + 8009392: bd80 pop {r7, pc} + 8009394: 04400040 .word 0x04400040 + 8009398: 40010c00 .word 0x40010c00 + +0800939c : + 800939c: b580 push {r7, lr} + 800939e: af00 add r7, sp, #0 + 80093a0: 4903 ldr r1, [pc, #12] ; (80093b0 ) + 80093a2: 4804 ldr r0, [pc, #16] ; (80093b4 ) + 80093a4: f7ff fe06 bl 8008fb4 + 80093a8: 4603 mov r3, r0 + 80093aa: b2db uxtb r3, r3 + 80093ac: 4618 mov r0, r3 + 80093ae: bd80 pop {r7, pc} + 80093b0: 04400040 .word 0x04400040 + 80093b4: 40010c00 .word 0x40010c00 + +080093b8 : +OUTPUT_FUNCS(Output8, OUTPUT8); + 80093b8: b580 push {r7, lr} + 80093ba: af00 add r7, sp, #0 + 80093bc: 4902 ldr r1, [pc, #8] ; (80093c8 ) + 80093be: 4803 ldr r0, [pc, #12] ; (80093cc ) + 80093c0: f7ff fe1d bl 8008ffe + 80093c4: bf00 nop + 80093c6: bd80 pop {r7, pc} + 80093c8: 04800080 .word 0x04800080 + 80093cc: 40010c00 .word 0x40010c00 + +080093d0 : + 80093d0: b580 push {r7, lr} + 80093d2: af00 add r7, sp, #0 + 80093d4: 4902 ldr r1, [pc, #8] ; (80093e0 ) + 80093d6: 4803 ldr r0, [pc, #12] ; (80093e4 ) + 80093d8: f7ff fe02 bl 8008fe0 + 80093dc: bf00 nop + 80093de: bd80 pop {r7, pc} + 80093e0: 04800080 .word 0x04800080 + 80093e4: 40010c00 .word 0x40010c00 + +080093e8 : + 80093e8: b580 push {r7, lr} + 80093ea: af00 add r7, sp, #0 + 80093ec: 4903 ldr r1, [pc, #12] ; (80093fc ) + 80093ee: 4804 ldr r0, [pc, #16] ; (8009400 ) + 80093f0: f7ff fde0 bl 8008fb4 + 80093f4: 4603 mov r3, r0 + 80093f6: b2db uxtb r3, r3 + 80093f8: 4618 mov r0, r3 + 80093fa: bd80 pop {r7, pc} + 80093fc: 04800080 .word 0x04800080 + 8009400: 40010c00 .word 0x40010c00 + +08009404 : + +//-----------------ź--------------------- +INPUT_FUNCS(Input1,INPUT1); + 8009404: b580 push {r7, lr} + 8009406: af00 add r7, sp, #0 + 8009408: f242 0120 movw r1, #8224 ; 0x2020 + 800940c: 4803 ldr r0, [pc, #12] ; (800941c ) + 800940e: f7ff fdbb bl 8008f88 + 8009412: 4603 mov r3, r0 + 8009414: b2db uxtb r3, r3 + 8009416: 4618 mov r0, r3 + 8009418: bd80 pop {r7, pc} + 800941a: bf00 nop + 800941c: 40010c00 .word 0x40010c00 + +08009420 : +INPUT_FUNCS(Input2,INPUT2); + 8009420: b580 push {r7, lr} + 8009422: af00 add r7, sp, #0 + 8009424: f241 0110 movw r1, #4112 ; 0x1010 + 8009428: 4803 ldr r0, [pc, #12] ; (8009438 ) + 800942a: f7ff fdad bl 8008f88 + 800942e: 4603 mov r3, r0 + 8009430: b2db uxtb r3, r3 + 8009432: 4618 mov r0, r3 + 8009434: bd80 pop {r7, pc} + 8009436: bf00 nop + 8009438: 40010c00 .word 0x40010c00 + +0800943c : +INPUT_FUNCS(Input3,INPUT3); + 800943c: b580 push {r7, lr} + 800943e: af00 add r7, sp, #0 + 8009440: f640 0108 movw r1, #2056 ; 0x808 + 8009444: 4803 ldr r0, [pc, #12] ; (8009454 ) + 8009446: f7ff fd9f bl 8008f88 + 800944a: 4603 mov r3, r0 + 800944c: b2db uxtb r3, r3 + 800944e: 4618 mov r0, r3 + 8009450: bd80 pop {r7, pc} + 8009452: bf00 nop + 8009454: 40010c00 .word 0x40010c00 + +08009458 : +INPUT_FUNCS(Input4,INPUT4); + 8009458: b580 push {r7, lr} + 800945a: af00 add r7, sp, #0 + 800945c: f240 4104 movw r1, #1028 ; 0x404 + 8009460: 4803 ldr r0, [pc, #12] ; (8009470 ) + 8009462: f7ff fd91 bl 8008f88 + 8009466: 4603 mov r3, r0 + 8009468: b2db uxtb r3, r3 + 800946a: 4618 mov r0, r3 + 800946c: bd80 pop {r7, pc} + 800946e: bf00 nop + 8009470: 40011400 .word 0x40011400 + +08009474 : +INPUT_FUNCS(Input5,INPUT5); + 8009474: b580 push {r7, lr} + 8009476: af00 add r7, sp, #0 + 8009478: 4903 ldr r1, [pc, #12] ; (8009488 ) + 800947a: 4804 ldr r0, [pc, #16] ; (800948c ) + 800947c: f7ff fd84 bl 8008f88 + 8009480: 4603 mov r3, r0 + 8009482: b2db uxtb r3, r3 + 8009484: 4618 mov r0, r3 + 8009486: bd80 pop {r7, pc} + 8009488: 04100010 .word 0x04100010 + 800948c: 40011000 .word 0x40011000 + +08009490 : +INPUT_FUNCS(Input6,INPUT6); + 8009490: b580 push {r7, lr} + 8009492: af00 add r7, sp, #0 + 8009494: 4903 ldr r1, [pc, #12] ; (80094a4 ) + 8009496: 4804 ldr r0, [pc, #16] ; (80094a8 ) + 8009498: f7ff fd76 bl 8008f88 + 800949c: 4603 mov r3, r0 + 800949e: b2db uxtb r3, r3 + 80094a0: 4618 mov r0, r3 + 80094a2: bd80 pop {r7, pc} + 80094a4: 04080008 .word 0x04080008 + 80094a8: 40011000 .word 0x40011000 + +080094ac : +INPUT_FUNCS(Input7,INPUT7); + 80094ac: b580 push {r7, lr} + 80094ae: af00 add r7, sp, #0 + 80094b0: 4903 ldr r1, [pc, #12] ; (80094c0 ) + 80094b2: 4804 ldr r0, [pc, #16] ; (80094c4 ) + 80094b4: f7ff fd68 bl 8008f88 + 80094b8: 4603 mov r3, r0 + 80094ba: b2db uxtb r3, r3 + 80094bc: 4618 mov r0, r3 + 80094be: bd80 pop {r7, pc} + 80094c0: 04040004 .word 0x04040004 + 80094c4: 40011000 .word 0x40011000 + +080094c8 : +INPUT_FUNCS(Input8,INPUT8); + 80094c8: b580 push {r7, lr} + 80094ca: af00 add r7, sp, #0 + 80094cc: 4903 ldr r1, [pc, #12] ; (80094dc ) + 80094ce: 4804 ldr r0, [pc, #16] ; (80094e0 ) + 80094d0: f7ff fd5a bl 8008f88 + 80094d4: 4603 mov r3, r0 + 80094d6: b2db uxtb r3, r3 + 80094d8: 4618 mov r0, r3 + 80094da: bd80 pop {r7, pc} + 80094dc: 04800080 .word 0x04800080 + 80094e0: 40010800 .word 0x40010800 + +080094e4 : + +//-----------------뿪--------------------- +INPUT_FUNCS(Switch1,SW1); + 80094e4: b580 push {r7, lr} + 80094e6: af00 add r7, sp, #0 + 80094e8: f248 0180 movw r1, #32896 ; 0x8080 + 80094ec: 4803 ldr r0, [pc, #12] ; (80094fc ) + 80094ee: f7ff fd4b bl 8008f88 + 80094f2: 4603 mov r3, r0 + 80094f4: b2db uxtb r3, r3 + 80094f6: 4618 mov r0, r3 + 80094f8: bd80 pop {r7, pc} + 80094fa: bf00 nop + 80094fc: 40011000 .word 0x40011000 + +08009500 : +INPUT_FUNCS(Switch2,SW2); + 8009500: b580 push {r7, lr} + 8009502: af00 add r7, sp, #0 + 8009504: 4903 ldr r1, [pc, #12] ; (8009514 ) + 8009506: 4804 ldr r0, [pc, #16] ; (8009518 ) + 8009508: f7ff fd3e bl 8008f88 + 800950c: 4603 mov r3, r0 + 800950e: b2db uxtb r3, r3 + 8009510: 4618 mov r0, r3 + 8009512: bd80 pop {r7, pc} + 8009514: 04010001 .word 0x04010001 + 8009518: 40011000 .word 0x40011000 + +0800951c : +INPUT_FUNCS(Switch3,SW3); + 800951c: b580 push {r7, lr} + 800951e: af00 add r7, sp, #0 + 8009520: 4903 ldr r1, [pc, #12] ; (8009530 ) + 8009522: 4804 ldr r0, [pc, #16] ; (8009534 ) + 8009524: f7ff fd30 bl 8008f88 + 8009528: 4603 mov r3, r0 + 800952a: b2db uxtb r3, r3 + 800952c: 4618 mov r0, r3 + 800952e: bd80 pop {r7, pc} + 8009530: 04020002 .word 0x04020002 + 8009534: 40011000 .word 0x40011000 + +08009538 : +INPUT_FUNCS(Switch4,SW4); + 8009538: b580 push {r7, lr} + 800953a: af00 add r7, sp, #0 + 800953c: 4903 ldr r1, [pc, #12] ; (800954c ) + 800953e: 4804 ldr r0, [pc, #16] ; (8009550 ) + 8009540: f7ff fd22 bl 8008f88 + 8009544: 4603 mov r3, r0 + 8009546: b2db uxtb r3, r3 + 8009548: 4618 mov r0, r3 + 800954a: bd80 pop {r7, pc} + 800954c: 04010001 .word 0x04010001 + 8009550: 40010c00 .word 0x40010c00 + +08009554 : +#if (CONTROL_BUS == COMM_CAN) + +void ExA1CanFilter(u8 fifo); + +void InitCAN(void) +{ + 8009554: b580 push {r7, lr} + 8009556: af00 add r7, sp, #0 + // CAN ڵ + g_workCtrl.hostId = 1; + 8009558: 4b0d ldr r3, [pc, #52] ; (8009590 ) + 800955a: 2201 movs r2, #1 + 800955c: 71da strb r2, [r3, #7] + + g_workCtrl.device = BN_DEVICE_EXA1; + 800955e: 4b0c ldr r3, [pc, #48] ; (8009590 ) + 8009560: 22a1 movs r2, #161 ; 0xa1 + 8009562: 711a strb r2, [r3, #4] + g_workCtrl.nodeId = CUR_EXA1_NODE_ID; + 8009564: 4b0a ldr r3, [pc, #40] ; (8009590 ) + 8009566: 2221 movs r2, #33 ; 0x21 + 8009568: 715a strb r2, [r3, #5] + + g_workCtrl.workSta = 2; + 800956a: 4b09 ldr r3, [pc, #36] ; (8009590 ) + 800956c: 2202 movs r2, #2 + 800956e: 601a str r2, [r3, #0] + + printf("g_workCtrl.nodeId is %d\r\n",g_workCtrl.nodeId); + 8009570: 4b07 ldr r3, [pc, #28] ; (8009590 ) + 8009572: 795b ldrb r3, [r3, #5] + 8009574: 4619 mov r1, r3 + 8009576: 4807 ldr r0, [pc, #28] ; (8009594 ) + 8009578: f000 f9c8 bl 800990c + + RegistFilter(ExA1CanFilter); + 800957c: 4806 ldr r0, [pc, #24] ; (8009598 ) + 800957e: f7f9 fd5d bl 800303c + + InitCanCtrl(); + 8009582: f7f9 fd69 bl 8003058 + InitSewHeadControl(&g_workCtrl.curBdCtrl); + 8009586: 4805 ldr r0, [pc, #20] ; (800959c ) + 8009588: f7fb f970 bl 800486c +} + 800958c: bf00 nop + 800958e: bd80 pop {r7, pc} + 8009590: 20003c94 .word 0x20003c94 + 8009594: 0800ae04 .word 0x0800ae04 + 8009598: 080095a1 .word 0x080095a1 + 800959c: 20003c9c .word 0x20003c9c + +080095a0 : + + +void ExA1CanFilter(u8 fifo) +{ + 80095a0: b580 push {r7, lr} + 80095a2: b08c sub sp, #48 ; 0x30 + 80095a4: af00 add r7, sp, #0 + 80095a6: 4603 mov r3, r0 + 80095a8: 71fb strb r3, [r7, #7] + CAN_FilterTypeDef CAN_FilterInitStructure; + + // 󱾽ڵ״̬仯Զ֡ͿƱڵ֡ + CAN_FilterInitStructure.FilterBank = 0; // ù0ΧΪ0~13 + 80095aa: 2300 movs r3, #0 + 80095ac: 61fb str r3, [r7, #28] + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 0Ϊʶбģʽ + 80095ae: 2301 movs r3, #1 + 80095b0: 623b str r3, [r7, #32] + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // 0λΪ32λ + 80095b2: 2301 movs r3, #1 + 80095b4: 627b str r3, [r7, #36] ; 0x24 + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_REMOTE)); // 趨һ16λ + 80095b6: 4b43 ldr r3, [pc, #268] ; (80096c4 ) + 80095b8: 791b ldrb r3, [r3, #4] + 80095ba: 061b lsls r3, r3, #24 + 80095bc: f003 52f8 and.w r2, r3, #520093696 ; 0x1f000000 + 80095c0: 4b40 ldr r3, [pc, #256] ; (80096c4 ) + 80095c2: 795b ldrb r3, [r3, #5] + 80095c4: 041b lsls r3, r3, #16 + 80095c6: 4313 orrs r3, r2 + 80095c8: 00db lsls r3, r3, #3 + 80095ca: 0c1b lsrs r3, r3, #16 + 80095cc: b29b uxth r3, r3 + 80095ce: 60bb str r3, [r7, #8] + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_REMOTE)); // 趨һ16λ + 80095d0: 2346 movs r3, #70 ; 0x46 + 80095d2: 60fb str r3, [r7, #12] + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ڶ16λ + 80095d4: 4b3b ldr r3, [pc, #236] ; (80096c4 ) + 80095d6: 791b ldrb r3, [r3, #4] + 80095d8: 061b lsls r3, r3, #24 + 80095da: f003 52f8 and.w r2, r3, #520093696 ; 0x1f000000 + 80095de: 4b39 ldr r3, [pc, #228] ; (80096c4 ) + 80095e0: 795b ldrb r3, [r3, #5] + 80095e2: 041b lsls r3, r3, #16 + 80095e4: 4313 orrs r3, r2 + 80095e6: 00db lsls r3, r3, #3 + 80095e8: 0c1b lsrs r3, r3, #16 + 80095ea: b29b uxth r3, r3 + 80095ec: 613b str r3, [r7, #16] + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ڶ16λ + 80095ee: 2344 movs r3, #68 ; 0x44 + 80095f0: 617b str r3, [r7, #20] + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + 80095f2: 79fb ldrb r3, [r7, #7] + 80095f4: 61bb str r3, [r7, #24] + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + 80095f6: 2301 movs r3, #1 + 80095f8: 62bb str r3, [r7, #40] ; 0x28 + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + 80095fa: f107 0308 add.w r3, r7, #8 + 80095fe: 4619 mov r1, r3 + 8009600: 4831 ldr r0, [pc, #196] ; (80096c8 ) + 8009602: f7f8 f81e bl 8001642 + + // 㲥Զ֡֡ + CAN_FilterInitStructure.FilterBank = 1; // ù1ΧΪ0~13 + 8009606: 2301 movs r3, #1 + 8009608: 61fb str r3, [r7, #28] + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 1Ϊʶбģʽ + 800960a: 2301 movs r3, #1 + 800960c: 623b str r3, [r7, #32] + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // 1λΪ32λ + 800960e: 2301 movs r3, #1 + 8009610: 627b str r3, [r7, #36] ; 0x24 + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(BROADCAST_EXID, CAN_RTR_REMOTE)); // 趨16λ + 8009612: 2300 movs r3, #0 + 8009614: 60bb str r3, [r7, #8] + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(BROADCAST_EXID, CAN_RTR_REMOTE)); // 趨16λ + 8009616: 2306 movs r3, #6 + 8009618: 60fb str r3, [r7, #12] + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT, CAN_RTR_DATA)); // 趨ĸ16λ + 800961a: f44f 4378 mov.w r3, #63488 ; 0xf800 + 800961e: 613b str r3, [r7, #16] + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT, CAN_RTR_DATA)); // 趨ĸ16λ + 8009620: 2304 movs r3, #4 + 8009622: 617b str r3, [r7, #20] + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + 8009624: 79fb ldrb r3, [r7, #7] + 8009626: 61bb str r3, [r7, #24] + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + 8009628: 2301 movs r3, #1 + 800962a: 62bb str r3, [r7, #40] ; 0x28 + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + 800962c: f107 0308 add.w r3, r7, #8 + 8009630: 4619 mov r1, r3 + 8009632: 4825 ldr r0, [pc, #148] ; (80096c8 ) + 8009634: f7f8 f805 bl 8001642 + + // Ա豸IDĹ㲥Զ֡֡ + CAN_FilterInitStructure.FilterBank = 2; // ù2ΧΪ0~13 + 8009638: 2302 movs r3, #2 + 800963a: 61fb str r3, [r7, #28] + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 2Ϊʶλģʽ + 800963c: 2301 movs r3, #1 + 800963e: 623b str r3, [r7, #32] + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + 8009640: 2301 movs r3, #1 + 8009642: 627b str r3, [r7, #36] ; 0x24 + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + 8009644: 4b1f ldr r3, [pc, #124] ; (80096c4 ) + 8009646: 791b ldrb r3, [r3, #4] + 8009648: 06db lsls r3, r3, #27 + 800964a: 0c1b lsrs r3, r3, #16 + 800964c: b29b uxth r3, r3 + 800964e: 60bb str r3, [r7, #8] + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + 8009650: 2304 movs r3, #4 + 8009652: 60fb str r3, [r7, #12] + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + 8009654: f64f 73f8 movw r3, #65528 ; 0xfff8 + 8009658: 613b str r3, [r7, #16] + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + 800965a: 2304 movs r3, #4 + 800965c: 617b str r3, [r7, #20] + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + 800965e: 79fb ldrb r3, [r7, #7] + 8009660: 61bb str r3, [r7, #24] + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + 8009662: 2301 movs r3, #1 + 8009664: 62bb str r3, [r7, #40] ; 0x28 + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + 8009666: f107 0308 add.w r3, r7, #8 + 800966a: 4619 mov r1, r3 + 800966c: 4816 ldr r0, [pc, #88] ; (80096c8 ) + 800966e: f7f7 ffe8 bl 8001642 + + // Ա豸ıڵƵԶ֡֡ + CAN_FilterInitStructure.FilterBank = 3; // ù2ΧΪ0~13 + 8009672: 2303 movs r3, #3 + 8009674: 61fb str r3, [r7, #28] + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 2Ϊʶλģʽ + 8009676: 2301 movs r3, #1 + 8009678: 623b str r3, [r7, #32] + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + 800967a: 2301 movs r3, #1 + 800967c: 627b str r3, [r7, #36] ; 0x24 + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, 0), 0)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + 800967e: 4b11 ldr r3, [pc, #68] ; (80096c4 ) + 8009680: 791b ldrb r3, [r3, #4] + 8009682: 061b lsls r3, r3, #24 + 8009684: f003 52f8 and.w r2, r3, #520093696 ; 0x1f000000 + 8009688: 4b0e ldr r3, [pc, #56] ; (80096c4 ) + 800968a: 795b ldrb r3, [r3, #5] + 800968c: 041b lsls r3, r3, #16 + 800968e: 4313 orrs r3, r2 + 8009690: 00db lsls r3, r3, #3 + 8009692: 0c1b lsrs r3, r3, #16 + 8009694: b29b uxth r3, r3 + 8009696: 60bb str r3, [r7, #8] + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, 0), 0)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + 8009698: 2304 movs r3, #4 + 800969a: 60fb str r3, [r7, #12] + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + 800969c: f64f 73f8 movw r3, #65528 ; 0xfff8 + 80096a0: 613b str r3, [r7, #16] + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + 80096a2: 2304 movs r3, #4 + 80096a4: 617b str r3, [r7, #20] + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + 80096a6: 79fb ldrb r3, [r7, #7] + 80096a8: 61bb str r3, [r7, #24] + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + 80096aa: 2301 movs r3, #1 + 80096ac: 62bb str r3, [r7, #40] ; 0x28 + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); + 80096ae: f107 0308 add.w r3, r7, #8 + 80096b2: 4619 mov r1, r3 + 80096b4: 4804 ldr r0, [pc, #16] ; (80096c8 ) + 80096b6: f7f7 ffc4 bl 8001642 +} + 80096ba: bf00 nop + 80096bc: 3730 adds r7, #48 ; 0x30 + 80096be: 46bd mov sp, r7 + 80096c0: bd80 pop {r7, pc} + 80096c2: bf00 nop + 80096c4: 20003c94 .word 0x20003c94 + 80096c8: 2000058c .word 0x2000058c + +080096cc : + +//------------------------------------------------------------------------------- + +void CanBusTask(void) +{ + 80096cc: b580 push {r7, lr} + 80096ce: b098 sub sp, #96 ; 0x60 + 80096d0: af00 add r7, sp, #0 + int sendflag; + CanRxMsg rxMsg; + CanTxMsg txMsg; + int dev, tid, sid, cmd; + + sendflag = 0; + 80096d2: 2300 movs r3, #0 + 80096d4: 65fb str r3, [r7, #92] ; 0x5c + + // CAN + rslt = GetACanDataPacket(&rxMsg); + 80096d6: f107 0324 add.w r3, r7, #36 ; 0x24 + 80096da: 4618 mov r0, r3 + 80096dc: f7f9 fe4e bl 800337c + 80096e0: 6578 str r0, [r7, #84] ; 0x54 + if (rslt == 0) + 80096e2: 6d7b ldr r3, [r7, #84] ; 0x54 + 80096e4: 2b00 cmp r3, #0 + 80096e6: d16c bne.n 80097c2 + { + dev = GET_PRT_FROM_EXID(rxMsg.canRxhead.ExtId); + 80096e8: 6abb ldr r3, [r7, #40] ; 0x28 + 80096ea: 0e1b lsrs r3, r3, #24 + 80096ec: b2db uxtb r3, r3 + 80096ee: f003 031f and.w r3, r3, #31 + 80096f2: 653b str r3, [r7, #80] ; 0x50 + tid = GET_TID_FROM_EXID(rxMsg.canRxhead.ExtId); + 80096f4: 6abb ldr r3, [r7, #40] ; 0x28 + 80096f6: 0c1b lsrs r3, r3, #16 + 80096f8: b2db uxtb r3, r3 + 80096fa: 64fb str r3, [r7, #76] ; 0x4c + sid = GET_SID_FROM_EXID(rxMsg.canRxhead.ExtId); + 80096fc: 6abb ldr r3, [r7, #40] ; 0x28 + 80096fe: 0a1b lsrs r3, r3, #8 + 8009700: b2db uxtb r3, r3 + 8009702: 65bb str r3, [r7, #88] ; 0x58 + cmd = GET_CMD_FROM_EXID(rxMsg.canRxhead.ExtId); + 8009704: 6abb ldr r3, [r7, #40] ; 0x28 + 8009706: b2db uxtb r3, r3 + 8009708: 64bb str r3, [r7, #72] ; 0x48 + + if (rxMsg.canRxhead.RTR == CAN_RTR_REMOTE) // Զ֡ + 800970a: 6b3b ldr r3, [r7, #48] ; 0x30 + 800970c: 2b02 cmp r3, #2 + 800970e: d125 bne.n 800975c + { + if ((dev == BN_PROTOCOL_ALL || dev == g_workCtrl.device) && // ȫ豸豸 + 8009710: 6d3b ldr r3, [r7, #80] ; 0x50 + 8009712: 2b00 cmp r3, #0 + 8009714: d005 beq.n 8009722 + 8009716: 4b53 ldr r3, [pc, #332] ; (8009864 ) + 8009718: 791b ldrb r3, [r3, #4] + 800971a: 461a mov r2, r3 + 800971c: 6d3b ldr r3, [r7, #80] ; 0x50 + 800971e: 4293 cmp r3, r2 + 8009720: d116 bne.n 8009750 + 8009722: 6cfb ldr r3, [r7, #76] ; 0x4c + 8009724: 2b00 cmp r3, #0 + 8009726: d005 beq.n 8009734 + (tid == BN_ID_BROADCAST || tid == g_workCtrl.nodeId) ) // ȫID򱾰 + 8009728: 4b4e ldr r3, [pc, #312] ; (8009864 ) + 800972a: 795b ldrb r3, [r3, #5] + 800972c: 461a mov r2, r3 + 800972e: 6cfb ldr r3, [r7, #76] ; 0x4c + 8009730: 4293 cmp r3, r2 + 8009732: d10d bne.n 8009750 + { + if (cmd == BN_CMD_EXSTA) // ״̬ + 8009734: 6cbb ldr r3, [r7, #72] ; 0x48 + 8009736: 2b08 cmp r3, #8 + 8009738: d105 bne.n 8009746 + { + sendflag = 1; // ״̬ + 800973a: 2301 movs r3, #1 + 800973c: 65fb str r3, [r7, #92] ; 0x5c + printf("receive sta request packet\r\n"); + 800973e: 484a ldr r0, [pc, #296] ; (8009868 ) + 8009740: f000 f958 bl 80099f4 + if (cmd == BN_CMD_EXSTA) // ״̬ + 8009744: e03d b.n 80097c2 + } + else + { + printf("other Remote cmd, cmd=0x%x\r\n", cmd); + 8009746: 6cb9 ldr r1, [r7, #72] ; 0x48 + 8009748: 4848 ldr r0, [pc, #288] ; (800986c ) + 800974a: f000 f8df bl 800990c + if (cmd == BN_CMD_EXSTA) // ״̬ + 800974e: e038 b.n 80097c2 + } + } + else + { + printf("other Remote packet, exid=0x%x\r\n", (int)rxMsg.canRxhead.ExtId); + 8009750: 6abb ldr r3, [r7, #40] ; 0x28 + 8009752: 4619 mov r1, r3 + 8009754: 4846 ldr r0, [pc, #280] ; (8009870 ) + 8009756: f000 f8d9 bl 800990c + 800975a: e032 b.n 80097c2 + } + } + else // if (rxMsg.canRxhead.RTR == CAN_RTR_DATA) // ֡ + { + if ((dev == BN_PROTOCOL_ALL ||dev == g_workCtrl.device) && // exa1 + 800975c: 6d3b ldr r3, [r7, #80] ; 0x50 + 800975e: 2b00 cmp r3, #0 + 8009760: d005 beq.n 800976e + 8009762: 4b40 ldr r3, [pc, #256] ; (8009864 ) + 8009764: 791b ldrb r3, [r3, #4] + 8009766: 461a mov r2, r3 + 8009768: 6d3b ldr r3, [r7, #80] ; 0x50 + 800976a: 4293 cmp r3, r2 + 800976c: d123 bne.n 80097b6 + 800976e: 6cfb ldr r3, [r7, #76] ; 0x4c + 8009770: 2b00 cmp r3, #0 + 8009772: d005 beq.n 8009780 + (tid == BN_ID_BROADCAST || tid == g_workCtrl.nodeId) ) // ȫID򱾰 + 8009774: 4b3b ldr r3, [pc, #236] ; (8009864 ) + 8009776: 795b ldrb r3, [r3, #5] + 8009778: 461a mov r2, r3 + 800977a: 6cfb ldr r3, [r7, #76] ; 0x4c + 800977c: 4293 cmp r3, r2 + 800977e: d11a bne.n 80097b6 + { + if (cmd == BN_CMD_EXCTRL || // + 8009780: 6cbb ldr r3, [r7, #72] ; 0x48 + 8009782: 2b07 cmp r3, #7 + 8009784: d002 beq.n 800978c + cmd == BN_CMD_TRAVERSE || // + 8009786: 6cbb ldr r3, [r7, #72] ; 0x48 + 8009788: 2b01 cmp r3, #1 + 800978a: d10f bne.n 80097ac + 0 ) + { + g_workCtrl.curBdCtrl.ctrlCmd.cancomm.exId.id = rxMsg.canRxhead.ExtId; + 800978c: 6abb ldr r3, [r7, #40] ; 0x28 + 800978e: 4a35 ldr r2, [pc, #212] ; (8009864 ) + 8009790: 60d3 str r3, [r2, #12] + memcpy(g_workCtrl.curBdCtrl.ctrlCmd.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); // ݳ + 8009792: 4b34 ldr r3, [pc, #208] ; (8009864 ) + 8009794: 3310 adds r3, #16 + 8009796: f107 0240 add.w r2, r7, #64 ; 0x40 + 800979a: e892 0003 ldmia.w r2, {r0, r1} + 800979e: e883 0003 stmia.w r3, {r0, r1} + g_workCtrl.curBdCtrl.cmdFlag = 1; // ־ + 80097a2: 4b30 ldr r3, [pc, #192] ; (8009864 ) + 80097a4: 2201 movs r2, #1 + 80097a6: f883 2084 strb.w r2, [r3, #132] ; 0x84 + if (cmd == BN_CMD_EXCTRL || // + 80097aa: e00a b.n 80097c2 + // printf("get ex ctrl cmd\r\n"); + } + else + { + printf("get other data cmd=0x%x\r\n", cmd); + 80097ac: 6cb9 ldr r1, [r7, #72] ; 0x48 + 80097ae: 4831 ldr r0, [pc, #196] ; (8009874 ) + 80097b0: f000 f8ac bl 800990c + if (cmd == BN_CMD_EXCTRL || // + 80097b4: e005 b.n 80097c2 + } + } + else + { + printf("other data packet, dev=0x%x, tid=%d, exid=0x%x\r\n", dev, (int)tid, (int)rxMsg.canRxhead.ExtId); + 80097b6: 6abb ldr r3, [r7, #40] ; 0x28 + 80097b8: 6cfa ldr r2, [r7, #76] ; 0x4c + 80097ba: 6d39 ldr r1, [r7, #80] ; 0x50 + 80097bc: 482e ldr r0, [pc, #184] ; (8009878 ) + 80097be: f000 f8a5 bl 800990c + } + } + } + + if (sendflag == 0) + 80097c2: 6dfb ldr r3, [r7, #92] ; 0x5c + 80097c4: 2b00 cmp r3, #0 + 80097c6: d102 bne.n 80097ce + { + sid = g_workCtrl.hostId; + 80097c8: 4b26 ldr r3, [pc, #152] ; (8009864 ) + 80097ca: 79db ldrb r3, [r3, #7] + 80097cc: 65bb str r3, [r7, #88] ; 0x58 + } + + // ״̬Ϣ + if (g_workCtrl.curBdCtrl.staFlag != 0) + 80097ce: 4b25 ldr r3, [pc, #148] ; (8009864 ) + 80097d0: f893 3085 ldrb.w r3, [r3, #133] ; 0x85 + 80097d4: 2b00 cmp r3, #0 + 80097d6: d005 beq.n 80097e4 + { + g_workCtrl.curBdCtrl.staFlag = 0; + 80097d8: 4b22 ldr r3, [pc, #136] ; (8009864 ) + 80097da: 2200 movs r2, #0 + 80097dc: f883 2085 strb.w r2, [r3, #133] ; 0x85 + sendflag = 1; // ״̬ + 80097e0: 2301 movs r3, #1 + 80097e2: 65fb str r3, [r7, #92] ; 0x5c + } + + if (sendflag == 1) + 80097e4: 6dfb ldr r3, [r7, #92] ; 0x5c + 80097e6: 2b01 cmp r3, #1 + 80097e8: d137 bne.n 800985a + { + if(g_workCtrl.workSta == 1) + 80097ea: 4b1e ldr r3, [pc, #120] ; (8009864 ) + 80097ec: 681b ldr r3, [r3, #0] + 80097ee: 2b01 cmp r3, #1 + 80097f0: d110 bne.n 8009814 + { + txMsg.canTxhead.ExtId = MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, sid, BN_CMD_TRAVERSE); // ״̬ + 80097f2: 4b1c ldr r3, [pc, #112] ; (8009864 ) + 80097f4: 791b ldrb r3, [r3, #4] + 80097f6: 061b lsls r3, r3, #24 + 80097f8: f003 52f8 and.w r2, r3, #520093696 ; 0x1f000000 + 80097fc: 4b19 ldr r3, [pc, #100] ; (8009864 ) + 80097fe: 795b ldrb r3, [r3, #5] + 8009800: 041b lsls r3, r3, #16 + 8009802: 431a orrs r2, r3 + 8009804: 6dbb ldr r3, [r7, #88] ; 0x58 + 8009806: 021b lsls r3, r3, #8 + 8009808: b29b uxth r3, r3 + 800980a: 4313 orrs r3, r2 + 800980c: f043 0301 orr.w r3, r3, #1 + 8009810: 60bb str r3, [r7, #8] + 8009812: e00f b.n 8009834 + } + else + { + txMsg.canTxhead.ExtId = MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, sid, BN_CMD_EXSTA); // ״̬ + 8009814: 4b13 ldr r3, [pc, #76] ; (8009864 ) + 8009816: 791b ldrb r3, [r3, #4] + 8009818: 061b lsls r3, r3, #24 + 800981a: f003 52f8 and.w r2, r3, #520093696 ; 0x1f000000 + 800981e: 4b11 ldr r3, [pc, #68] ; (8009864 ) + 8009820: 795b ldrb r3, [r3, #5] + 8009822: 041b lsls r3, r3, #16 + 8009824: 431a orrs r2, r3 + 8009826: 6dbb ldr r3, [r7, #88] ; 0x58 + 8009828: 021b lsls r3, r3, #8 + 800982a: b29b uxth r3, r3 + 800982c: 4313 orrs r3, r2 + 800982e: f043 0308 orr.w r3, r3, #8 + 8009832: 60bb str r3, [r7, #8] + } + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + 8009834: 2300 movs r3, #0 + 8009836: 613b str r3, [r7, #16] + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + 8009838: 2304 movs r3, #4 + 800983a: 60fb str r3, [r7, #12] + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + 800983c: 2308 movs r3, #8 + 800983e: 617b str r3, [r7, #20] + memcpy(txMsg.data, g_workCtrl.curBdCtrl.exbSta.cancomm.data.buff, CAN_DATA_LEN); // ݳ + 8009840: 4a08 ldr r2, [pc, #32] ; (8009864 ) + 8009842: f107 031c add.w r3, r7, #28 + 8009846: 3220 adds r2, #32 + 8009848: e892 0003 ldmia.w r2, {r0, r1} + 800984c: e883 0003 stmia.w r3, {r0, r1} + rslt = SendACANDataPacket(&txMsg); + 8009850: 1d3b adds r3, r7, #4 + 8009852: 4618 mov r0, r3 + 8009854: f7f9 fd1a bl 800328c + 8009858: 6578 str r0, [r7, #84] ; 0x54 + + //printf("send sta data by can, exid=0x%x\r\n", (int)txMsg.ExtId); + } +} + 800985a: bf00 nop + 800985c: 3760 adds r7, #96 ; 0x60 + 800985e: 46bd mov sp, r7 + 8009860: bd80 pop {r7, pc} + 8009862: bf00 nop + 8009864: 20003c94 .word 0x20003c94 + 8009868: 0800ae20 .word 0x0800ae20 + 800986c: 0800ae3c .word 0x0800ae3c + 8009870: 0800ae5c .word 0x0800ae5c + 8009874: 0800ae80 .word 0x0800ae80 + 8009878: 0800ae9c .word 0x0800ae9c + +0800987c : + SET_ALL_INT(); +#endif +} + +void MainTasks(void) +{ + 800987c: b580 push {r7, lr} + 800987e: af00 add r7, sp, #0 +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + BootMainTask(); // +#else + AppMainTask(); // Ӧô + 8009880: f7fd f834 bl 80068ec +#endif +} + 8009884: bf00 nop + 8009886: bd80 pop {r7, pc} + +08009888 : + 8009888: 220a movs r2, #10 + 800988a: 2100 movs r1, #0 + 800988c: f000 b93e b.w 8009b0c + +08009890 <__errno>: + 8009890: 4b01 ldr r3, [pc, #4] ; (8009898 <__errno+0x8>) + 8009892: 6818 ldr r0, [r3, #0] + 8009894: 4770 bx lr + 8009896: bf00 nop + 8009898: 2000036c .word 0x2000036c + +0800989c <__libc_init_array>: + 800989c: b570 push {r4, r5, r6, lr} + 800989e: 2500 movs r5, #0 + 80098a0: 4e0c ldr r6, [pc, #48] ; (80098d4 <__libc_init_array+0x38>) + 80098a2: 4c0d ldr r4, [pc, #52] ; (80098d8 <__libc_init_array+0x3c>) + 80098a4: 1ba4 subs r4, r4, r6 + 80098a6: 10a4 asrs r4, r4, #2 + 80098a8: 42a5 cmp r5, r4 + 80098aa: d109 bne.n 80098c0 <__libc_init_array+0x24> + 80098ac: f001 f83c bl 800a928 <_init> + 80098b0: 2500 movs r5, #0 + 80098b2: 4e0a ldr r6, [pc, #40] ; (80098dc <__libc_init_array+0x40>) + 80098b4: 4c0a ldr r4, [pc, #40] ; (80098e0 <__libc_init_array+0x44>) + 80098b6: 1ba4 subs r4, r4, r6 + 80098b8: 10a4 asrs r4, r4, #2 + 80098ba: 42a5 cmp r5, r4 + 80098bc: d105 bne.n 80098ca <__libc_init_array+0x2e> + 80098be: bd70 pop {r4, r5, r6, pc} + 80098c0: f856 3025 ldr.w r3, [r6, r5, lsl #2] + 80098c4: 4798 blx r3 + 80098c6: 3501 adds r5, #1 + 80098c8: e7ee b.n 80098a8 <__libc_init_array+0xc> + 80098ca: f856 3025 ldr.w r3, [r6, r5, lsl #2] + 80098ce: 4798 blx r3 + 80098d0: 3501 adds r5, #1 + 80098d2: e7f2 b.n 80098ba <__libc_init_array+0x1e> + 80098d4: 0800b08c .word 0x0800b08c + 80098d8: 0800b08c .word 0x0800b08c + 80098dc: 0800b08c .word 0x0800b08c + 80098e0: 0800b090 .word 0x0800b090 + +080098e4 : + 80098e4: b510 push {r4, lr} + 80098e6: 1e43 subs r3, r0, #1 + 80098e8: 440a add r2, r1 + 80098ea: 4291 cmp r1, r2 + 80098ec: d100 bne.n 80098f0 + 80098ee: bd10 pop {r4, pc} + 80098f0: f811 4b01 ldrb.w r4, [r1], #1 + 80098f4: f803 4f01 strb.w r4, [r3, #1]! + 80098f8: e7f7 b.n 80098ea + +080098fa : + 80098fa: 4603 mov r3, r0 + 80098fc: 4402 add r2, r0 + 80098fe: 4293 cmp r3, r2 + 8009900: d100 bne.n 8009904 + 8009902: 4770 bx lr + 8009904: f803 1b01 strb.w r1, [r3], #1 + 8009908: e7f9 b.n 80098fe + ... + +0800990c : + 800990c: b40f push {r0, r1, r2, r3} + 800990e: 4b0a ldr r3, [pc, #40] ; (8009938 ) + 8009910: b513 push {r0, r1, r4, lr} + 8009912: 681c ldr r4, [r3, #0] + 8009914: b124 cbz r4, 8009920 + 8009916: 69a3 ldr r3, [r4, #24] + 8009918: b913 cbnz r3, 8009920 + 800991a: 4620 mov r0, r4 + 800991c: f000 fabc bl 8009e98 <__sinit> + 8009920: ab05 add r3, sp, #20 + 8009922: 9a04 ldr r2, [sp, #16] + 8009924: 68a1 ldr r1, [r4, #8] + 8009926: 4620 mov r0, r4 + 8009928: 9301 str r3, [sp, #4] + 800992a: f000 fc87 bl 800a23c <_vfiprintf_r> + 800992e: b002 add sp, #8 + 8009930: e8bd 4010 ldmia.w sp!, {r4, lr} + 8009934: b004 add sp, #16 + 8009936: 4770 bx lr + 8009938: 2000036c .word 0x2000036c + +0800993c <_puts_r>: + 800993c: b570 push {r4, r5, r6, lr} + 800993e: 460e mov r6, r1 + 8009940: 4605 mov r5, r0 + 8009942: b118 cbz r0, 800994c <_puts_r+0x10> + 8009944: 6983 ldr r3, [r0, #24] + 8009946: b90b cbnz r3, 800994c <_puts_r+0x10> + 8009948: f000 faa6 bl 8009e98 <__sinit> + 800994c: 69ab ldr r3, [r5, #24] + 800994e: 68ac ldr r4, [r5, #8] + 8009950: b913 cbnz r3, 8009958 <_puts_r+0x1c> + 8009952: 4628 mov r0, r5 + 8009954: f000 faa0 bl 8009e98 <__sinit> + 8009958: 4b23 ldr r3, [pc, #140] ; (80099e8 <_puts_r+0xac>) + 800995a: 429c cmp r4, r3 + 800995c: d117 bne.n 800998e <_puts_r+0x52> + 800995e: 686c ldr r4, [r5, #4] + 8009960: 89a3 ldrh r3, [r4, #12] + 8009962: 071b lsls r3, r3, #28 + 8009964: d51d bpl.n 80099a2 <_puts_r+0x66> + 8009966: 6923 ldr r3, [r4, #16] + 8009968: b1db cbz r3, 80099a2 <_puts_r+0x66> + 800996a: 3e01 subs r6, #1 + 800996c: 68a3 ldr r3, [r4, #8] + 800996e: f816 1f01 ldrb.w r1, [r6, #1]! + 8009972: 3b01 subs r3, #1 + 8009974: 60a3 str r3, [r4, #8] + 8009976: b9e9 cbnz r1, 80099b4 <_puts_r+0x78> + 8009978: 2b00 cmp r3, #0 + 800997a: da2e bge.n 80099da <_puts_r+0x9e> + 800997c: 4622 mov r2, r4 + 800997e: 210a movs r1, #10 + 8009980: 4628 mov r0, r5 + 8009982: f000 f8d9 bl 8009b38 <__swbuf_r> + 8009986: 3001 adds r0, #1 + 8009988: d011 beq.n 80099ae <_puts_r+0x72> + 800998a: 200a movs r0, #10 + 800998c: e011 b.n 80099b2 <_puts_r+0x76> + 800998e: 4b17 ldr r3, [pc, #92] ; (80099ec <_puts_r+0xb0>) + 8009990: 429c cmp r4, r3 + 8009992: d101 bne.n 8009998 <_puts_r+0x5c> + 8009994: 68ac ldr r4, [r5, #8] + 8009996: e7e3 b.n 8009960 <_puts_r+0x24> + 8009998: 4b15 ldr r3, [pc, #84] ; (80099f0 <_puts_r+0xb4>) + 800999a: 429c cmp r4, r3 + 800999c: bf08 it eq + 800999e: 68ec ldreq r4, [r5, #12] + 80099a0: e7de b.n 8009960 <_puts_r+0x24> + 80099a2: 4621 mov r1, r4 + 80099a4: 4628 mov r0, r5 + 80099a6: f000 f919 bl 8009bdc <__swsetup_r> + 80099aa: 2800 cmp r0, #0 + 80099ac: d0dd beq.n 800996a <_puts_r+0x2e> + 80099ae: f04f 30ff mov.w r0, #4294967295 + 80099b2: bd70 pop {r4, r5, r6, pc} + 80099b4: 2b00 cmp r3, #0 + 80099b6: da04 bge.n 80099c2 <_puts_r+0x86> + 80099b8: 69a2 ldr r2, [r4, #24] + 80099ba: 429a cmp r2, r3 + 80099bc: dc06 bgt.n 80099cc <_puts_r+0x90> + 80099be: 290a cmp r1, #10 + 80099c0: d004 beq.n 80099cc <_puts_r+0x90> + 80099c2: 6823 ldr r3, [r4, #0] + 80099c4: 1c5a adds r2, r3, #1 + 80099c6: 6022 str r2, [r4, #0] + 80099c8: 7019 strb r1, [r3, #0] + 80099ca: e7cf b.n 800996c <_puts_r+0x30> + 80099cc: 4622 mov r2, r4 + 80099ce: 4628 mov r0, r5 + 80099d0: f000 f8b2 bl 8009b38 <__swbuf_r> + 80099d4: 3001 adds r0, #1 + 80099d6: d1c9 bne.n 800996c <_puts_r+0x30> + 80099d8: e7e9 b.n 80099ae <_puts_r+0x72> + 80099da: 200a movs r0, #10 + 80099dc: 6823 ldr r3, [r4, #0] + 80099de: 1c5a adds r2, r3, #1 + 80099e0: 6022 str r2, [r4, #0] + 80099e2: 7018 strb r0, [r3, #0] + 80099e4: e7e5 b.n 80099b2 <_puts_r+0x76> + 80099e6: bf00 nop + 80099e8: 0800af0c .word 0x0800af0c + 80099ec: 0800af2c .word 0x0800af2c + 80099f0: 0800aeec .word 0x0800aeec + +080099f4 : + 80099f4: 4b02 ldr r3, [pc, #8] ; (8009a00 ) + 80099f6: 4601 mov r1, r0 + 80099f8: 6818 ldr r0, [r3, #0] + 80099fa: f7ff bf9f b.w 800993c <_puts_r> + 80099fe: bf00 nop + 8009a00: 2000036c .word 0x2000036c + +08009a04 : + 8009a04: 4603 mov r3, r0 + 8009a06: f811 2b01 ldrb.w r2, [r1], #1 + 8009a0a: f803 2b01 strb.w r2, [r3], #1 + 8009a0e: 2a00 cmp r2, #0 + 8009a10: d1f9 bne.n 8009a06 + 8009a12: 4770 bx lr + +08009a14 <_strtol_l.isra.0>: + 8009a14: e92d 47f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, lr} + 8009a18: 4680 mov r8, r0 + 8009a1a: 4689 mov r9, r1 + 8009a1c: 4692 mov sl, r2 + 8009a1e: 461e mov r6, r3 + 8009a20: 460f mov r7, r1 + 8009a22: 463d mov r5, r7 + 8009a24: 9808 ldr r0, [sp, #32] + 8009a26: f815 4b01 ldrb.w r4, [r5], #1 + 8009a2a: f000 fabf bl 8009fac <__locale_ctype_ptr_l> + 8009a2e: 4420 add r0, r4 + 8009a30: 7843 ldrb r3, [r0, #1] + 8009a32: f013 0308 ands.w r3, r3, #8 + 8009a36: d132 bne.n 8009a9e <_strtol_l.isra.0+0x8a> + 8009a38: 2c2d cmp r4, #45 ; 0x2d + 8009a3a: d132 bne.n 8009aa2 <_strtol_l.isra.0+0x8e> + 8009a3c: 2201 movs r2, #1 + 8009a3e: 787c ldrb r4, [r7, #1] + 8009a40: 1cbd adds r5, r7, #2 + 8009a42: 2e00 cmp r6, #0 + 8009a44: d05d beq.n 8009b02 <_strtol_l.isra.0+0xee> + 8009a46: 2e10 cmp r6, #16 + 8009a48: d109 bne.n 8009a5e <_strtol_l.isra.0+0x4a> + 8009a4a: 2c30 cmp r4, #48 ; 0x30 + 8009a4c: d107 bne.n 8009a5e <_strtol_l.isra.0+0x4a> + 8009a4e: 782b ldrb r3, [r5, #0] + 8009a50: f003 03df and.w r3, r3, #223 ; 0xdf + 8009a54: 2b58 cmp r3, #88 ; 0x58 + 8009a56: d14f bne.n 8009af8 <_strtol_l.isra.0+0xe4> + 8009a58: 2610 movs r6, #16 + 8009a5a: 786c ldrb r4, [r5, #1] + 8009a5c: 3502 adds r5, #2 + 8009a5e: 2a00 cmp r2, #0 + 8009a60: bf14 ite ne + 8009a62: f04f 4100 movne.w r1, #2147483648 ; 0x80000000 + 8009a66: f06f 4100 mvneq.w r1, #2147483648 ; 0x80000000 + 8009a6a: 2700 movs r7, #0 + 8009a6c: fbb1 fcf6 udiv ip, r1, r6 + 8009a70: 4638 mov r0, r7 + 8009a72: fb06 1e1c mls lr, r6, ip, r1 + 8009a76: f1a4 0330 sub.w r3, r4, #48 ; 0x30 + 8009a7a: 2b09 cmp r3, #9 + 8009a7c: d817 bhi.n 8009aae <_strtol_l.isra.0+0x9a> + 8009a7e: 461c mov r4, r3 + 8009a80: 42a6 cmp r6, r4 + 8009a82: dd23 ble.n 8009acc <_strtol_l.isra.0+0xb8> + 8009a84: 1c7b adds r3, r7, #1 + 8009a86: d007 beq.n 8009a98 <_strtol_l.isra.0+0x84> + 8009a88: 4584 cmp ip, r0 + 8009a8a: d31c bcc.n 8009ac6 <_strtol_l.isra.0+0xb2> + 8009a8c: d101 bne.n 8009a92 <_strtol_l.isra.0+0x7e> + 8009a8e: 45a6 cmp lr, r4 + 8009a90: db19 blt.n 8009ac6 <_strtol_l.isra.0+0xb2> + 8009a92: 2701 movs r7, #1 + 8009a94: fb00 4006 mla r0, r0, r6, r4 + 8009a98: f815 4b01 ldrb.w r4, [r5], #1 + 8009a9c: e7eb b.n 8009a76 <_strtol_l.isra.0+0x62> + 8009a9e: 462f mov r7, r5 + 8009aa0: e7bf b.n 8009a22 <_strtol_l.isra.0+0xe> + 8009aa2: 2c2b cmp r4, #43 ; 0x2b + 8009aa4: bf04 itt eq + 8009aa6: 1cbd addeq r5, r7, #2 + 8009aa8: 787c ldrbeq r4, [r7, #1] + 8009aaa: 461a mov r2, r3 + 8009aac: e7c9 b.n 8009a42 <_strtol_l.isra.0+0x2e> + 8009aae: f1a4 0341 sub.w r3, r4, #65 ; 0x41 + 8009ab2: 2b19 cmp r3, #25 + 8009ab4: d801 bhi.n 8009aba <_strtol_l.isra.0+0xa6> + 8009ab6: 3c37 subs r4, #55 ; 0x37 + 8009ab8: e7e2 b.n 8009a80 <_strtol_l.isra.0+0x6c> + 8009aba: f1a4 0361 sub.w r3, r4, #97 ; 0x61 + 8009abe: 2b19 cmp r3, #25 + 8009ac0: d804 bhi.n 8009acc <_strtol_l.isra.0+0xb8> + 8009ac2: 3c57 subs r4, #87 ; 0x57 + 8009ac4: e7dc b.n 8009a80 <_strtol_l.isra.0+0x6c> + 8009ac6: f04f 37ff mov.w r7, #4294967295 + 8009aca: e7e5 b.n 8009a98 <_strtol_l.isra.0+0x84> + 8009acc: 1c7b adds r3, r7, #1 + 8009ace: d108 bne.n 8009ae2 <_strtol_l.isra.0+0xce> + 8009ad0: 2322 movs r3, #34 ; 0x22 + 8009ad2: 4608 mov r0, r1 + 8009ad4: f8c8 3000 str.w r3, [r8] + 8009ad8: f1ba 0f00 cmp.w sl, #0 + 8009adc: d107 bne.n 8009aee <_strtol_l.isra.0+0xda> + 8009ade: e8bd 87f0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, pc} + 8009ae2: b102 cbz r2, 8009ae6 <_strtol_l.isra.0+0xd2> + 8009ae4: 4240 negs r0, r0 + 8009ae6: f1ba 0f00 cmp.w sl, #0 + 8009aea: d0f8 beq.n 8009ade <_strtol_l.isra.0+0xca> + 8009aec: b10f cbz r7, 8009af2 <_strtol_l.isra.0+0xde> + 8009aee: f105 39ff add.w r9, r5, #4294967295 + 8009af2: f8ca 9000 str.w r9, [sl] + 8009af6: e7f2 b.n 8009ade <_strtol_l.isra.0+0xca> + 8009af8: 2430 movs r4, #48 ; 0x30 + 8009afa: 2e00 cmp r6, #0 + 8009afc: d1af bne.n 8009a5e <_strtol_l.isra.0+0x4a> + 8009afe: 2608 movs r6, #8 + 8009b00: e7ad b.n 8009a5e <_strtol_l.isra.0+0x4a> + 8009b02: 2c30 cmp r4, #48 ; 0x30 + 8009b04: d0a3 beq.n 8009a4e <_strtol_l.isra.0+0x3a> + 8009b06: 260a movs r6, #10 + 8009b08: e7a9 b.n 8009a5e <_strtol_l.isra.0+0x4a> + ... + +08009b0c : + 8009b0c: 4b08 ldr r3, [pc, #32] ; (8009b30 ) + 8009b0e: b537 push {r0, r1, r2, r4, r5, lr} + 8009b10: 681c ldr r4, [r3, #0] + 8009b12: 4d08 ldr r5, [pc, #32] ; (8009b34 ) + 8009b14: 6a23 ldr r3, [r4, #32] + 8009b16: 2b00 cmp r3, #0 + 8009b18: bf08 it eq + 8009b1a: 462b moveq r3, r5 + 8009b1c: 9300 str r3, [sp, #0] + 8009b1e: 4613 mov r3, r2 + 8009b20: 460a mov r2, r1 + 8009b22: 4601 mov r1, r0 + 8009b24: 4620 mov r0, r4 + 8009b26: f7ff ff75 bl 8009a14 <_strtol_l.isra.0> + 8009b2a: b003 add sp, #12 + 8009b2c: bd30 pop {r4, r5, pc} + 8009b2e: bf00 nop + 8009b30: 2000036c .word 0x2000036c + 8009b34: 200003d0 .word 0x200003d0 + +08009b38 <__swbuf_r>: + 8009b38: b5f8 push {r3, r4, r5, r6, r7, lr} + 8009b3a: 460e mov r6, r1 + 8009b3c: 4614 mov r4, r2 + 8009b3e: 4605 mov r5, r0 + 8009b40: b118 cbz r0, 8009b4a <__swbuf_r+0x12> + 8009b42: 6983 ldr r3, [r0, #24] + 8009b44: b90b cbnz r3, 8009b4a <__swbuf_r+0x12> + 8009b46: f000 f9a7 bl 8009e98 <__sinit> + 8009b4a: 4b21 ldr r3, [pc, #132] ; (8009bd0 <__swbuf_r+0x98>) + 8009b4c: 429c cmp r4, r3 + 8009b4e: d12a bne.n 8009ba6 <__swbuf_r+0x6e> + 8009b50: 686c ldr r4, [r5, #4] + 8009b52: 69a3 ldr r3, [r4, #24] + 8009b54: 60a3 str r3, [r4, #8] + 8009b56: 89a3 ldrh r3, [r4, #12] + 8009b58: 071a lsls r2, r3, #28 + 8009b5a: d52e bpl.n 8009bba <__swbuf_r+0x82> + 8009b5c: 6923 ldr r3, [r4, #16] + 8009b5e: b363 cbz r3, 8009bba <__swbuf_r+0x82> + 8009b60: 6923 ldr r3, [r4, #16] + 8009b62: 6820 ldr r0, [r4, #0] + 8009b64: b2f6 uxtb r6, r6 + 8009b66: 1ac0 subs r0, r0, r3 + 8009b68: 6963 ldr r3, [r4, #20] + 8009b6a: 4637 mov r7, r6 + 8009b6c: 4283 cmp r3, r0 + 8009b6e: dc04 bgt.n 8009b7a <__swbuf_r+0x42> + 8009b70: 4621 mov r1, r4 + 8009b72: 4628 mov r0, r5 + 8009b74: f000 f926 bl 8009dc4 <_fflush_r> + 8009b78: bb28 cbnz r0, 8009bc6 <__swbuf_r+0x8e> + 8009b7a: 68a3 ldr r3, [r4, #8] + 8009b7c: 3001 adds r0, #1 + 8009b7e: 3b01 subs r3, #1 + 8009b80: 60a3 str r3, [r4, #8] + 8009b82: 6823 ldr r3, [r4, #0] + 8009b84: 1c5a adds r2, r3, #1 + 8009b86: 6022 str r2, [r4, #0] + 8009b88: 701e strb r6, [r3, #0] + 8009b8a: 6963 ldr r3, [r4, #20] + 8009b8c: 4283 cmp r3, r0 + 8009b8e: d004 beq.n 8009b9a <__swbuf_r+0x62> + 8009b90: 89a3 ldrh r3, [r4, #12] + 8009b92: 07db lsls r3, r3, #31 + 8009b94: d519 bpl.n 8009bca <__swbuf_r+0x92> + 8009b96: 2e0a cmp r6, #10 + 8009b98: d117 bne.n 8009bca <__swbuf_r+0x92> + 8009b9a: 4621 mov r1, r4 + 8009b9c: 4628 mov r0, r5 + 8009b9e: f000 f911 bl 8009dc4 <_fflush_r> + 8009ba2: b190 cbz r0, 8009bca <__swbuf_r+0x92> + 8009ba4: e00f b.n 8009bc6 <__swbuf_r+0x8e> + 8009ba6: 4b0b ldr r3, [pc, #44] ; (8009bd4 <__swbuf_r+0x9c>) + 8009ba8: 429c cmp r4, r3 + 8009baa: d101 bne.n 8009bb0 <__swbuf_r+0x78> + 8009bac: 68ac ldr r4, [r5, #8] + 8009bae: e7d0 b.n 8009b52 <__swbuf_r+0x1a> + 8009bb0: 4b09 ldr r3, [pc, #36] ; (8009bd8 <__swbuf_r+0xa0>) + 8009bb2: 429c cmp r4, r3 + 8009bb4: bf08 it eq + 8009bb6: 68ec ldreq r4, [r5, #12] + 8009bb8: e7cb b.n 8009b52 <__swbuf_r+0x1a> + 8009bba: 4621 mov r1, r4 + 8009bbc: 4628 mov r0, r5 + 8009bbe: f000 f80d bl 8009bdc <__swsetup_r> + 8009bc2: 2800 cmp r0, #0 + 8009bc4: d0cc beq.n 8009b60 <__swbuf_r+0x28> + 8009bc6: f04f 37ff mov.w r7, #4294967295 + 8009bca: 4638 mov r0, r7 + 8009bcc: bdf8 pop {r3, r4, r5, r6, r7, pc} + 8009bce: bf00 nop + 8009bd0: 0800af0c .word 0x0800af0c + 8009bd4: 0800af2c .word 0x0800af2c + 8009bd8: 0800aeec .word 0x0800aeec + +08009bdc <__swsetup_r>: + 8009bdc: 4b32 ldr r3, [pc, #200] ; (8009ca8 <__swsetup_r+0xcc>) + 8009bde: b570 push {r4, r5, r6, lr} + 8009be0: 681d ldr r5, [r3, #0] + 8009be2: 4606 mov r6, r0 + 8009be4: 460c mov r4, r1 + 8009be6: b125 cbz r5, 8009bf2 <__swsetup_r+0x16> + 8009be8: 69ab ldr r3, [r5, #24] + 8009bea: b913 cbnz r3, 8009bf2 <__swsetup_r+0x16> + 8009bec: 4628 mov r0, r5 + 8009bee: f000 f953 bl 8009e98 <__sinit> + 8009bf2: 4b2e ldr r3, [pc, #184] ; (8009cac <__swsetup_r+0xd0>) + 8009bf4: 429c cmp r4, r3 + 8009bf6: d10f bne.n 8009c18 <__swsetup_r+0x3c> + 8009bf8: 686c ldr r4, [r5, #4] + 8009bfa: f9b4 300c ldrsh.w r3, [r4, #12] + 8009bfe: b29a uxth r2, r3 + 8009c00: 0715 lsls r5, r2, #28 + 8009c02: d42c bmi.n 8009c5e <__swsetup_r+0x82> + 8009c04: 06d0 lsls r0, r2, #27 + 8009c06: d411 bmi.n 8009c2c <__swsetup_r+0x50> + 8009c08: 2209 movs r2, #9 + 8009c0a: 6032 str r2, [r6, #0] + 8009c0c: f043 0340 orr.w r3, r3, #64 ; 0x40 + 8009c10: 81a3 strh r3, [r4, #12] + 8009c12: f04f 30ff mov.w r0, #4294967295 + 8009c16: e03e b.n 8009c96 <__swsetup_r+0xba> + 8009c18: 4b25 ldr r3, [pc, #148] ; (8009cb0 <__swsetup_r+0xd4>) + 8009c1a: 429c cmp r4, r3 + 8009c1c: d101 bne.n 8009c22 <__swsetup_r+0x46> + 8009c1e: 68ac ldr r4, [r5, #8] + 8009c20: e7eb b.n 8009bfa <__swsetup_r+0x1e> + 8009c22: 4b24 ldr r3, [pc, #144] ; (8009cb4 <__swsetup_r+0xd8>) + 8009c24: 429c cmp r4, r3 + 8009c26: bf08 it eq + 8009c28: 68ec ldreq r4, [r5, #12] + 8009c2a: e7e6 b.n 8009bfa <__swsetup_r+0x1e> + 8009c2c: 0751 lsls r1, r2, #29 + 8009c2e: d512 bpl.n 8009c56 <__swsetup_r+0x7a> + 8009c30: 6b61 ldr r1, [r4, #52] ; 0x34 + 8009c32: b141 cbz r1, 8009c46 <__swsetup_r+0x6a> + 8009c34: f104 0344 add.w r3, r4, #68 ; 0x44 + 8009c38: 4299 cmp r1, r3 + 8009c3a: d002 beq.n 8009c42 <__swsetup_r+0x66> + 8009c3c: 4630 mov r0, r6 + 8009c3e: f000 fa2f bl 800a0a0 <_free_r> + 8009c42: 2300 movs r3, #0 + 8009c44: 6363 str r3, [r4, #52] ; 0x34 + 8009c46: 89a3 ldrh r3, [r4, #12] + 8009c48: f023 0324 bic.w r3, r3, #36 ; 0x24 + 8009c4c: 81a3 strh r3, [r4, #12] + 8009c4e: 2300 movs r3, #0 + 8009c50: 6063 str r3, [r4, #4] + 8009c52: 6923 ldr r3, [r4, #16] + 8009c54: 6023 str r3, [r4, #0] + 8009c56: 89a3 ldrh r3, [r4, #12] + 8009c58: f043 0308 orr.w r3, r3, #8 + 8009c5c: 81a3 strh r3, [r4, #12] + 8009c5e: 6923 ldr r3, [r4, #16] + 8009c60: b94b cbnz r3, 8009c76 <__swsetup_r+0x9a> + 8009c62: 89a3 ldrh r3, [r4, #12] + 8009c64: f403 7320 and.w r3, r3, #640 ; 0x280 + 8009c68: f5b3 7f00 cmp.w r3, #512 ; 0x200 + 8009c6c: d003 beq.n 8009c76 <__swsetup_r+0x9a> + 8009c6e: 4621 mov r1, r4 + 8009c70: 4630 mov r0, r6 + 8009c72: f000 f9c3 bl 8009ffc <__smakebuf_r> + 8009c76: 89a2 ldrh r2, [r4, #12] + 8009c78: f012 0301 ands.w r3, r2, #1 + 8009c7c: d00c beq.n 8009c98 <__swsetup_r+0xbc> + 8009c7e: 2300 movs r3, #0 + 8009c80: 60a3 str r3, [r4, #8] + 8009c82: 6963 ldr r3, [r4, #20] + 8009c84: 425b negs r3, r3 + 8009c86: 61a3 str r3, [r4, #24] + 8009c88: 6923 ldr r3, [r4, #16] + 8009c8a: b953 cbnz r3, 8009ca2 <__swsetup_r+0xc6> + 8009c8c: f9b4 300c ldrsh.w r3, [r4, #12] + 8009c90: f013 0080 ands.w r0, r3, #128 ; 0x80 + 8009c94: d1ba bne.n 8009c0c <__swsetup_r+0x30> + 8009c96: bd70 pop {r4, r5, r6, pc} + 8009c98: 0792 lsls r2, r2, #30 + 8009c9a: bf58 it pl + 8009c9c: 6963 ldrpl r3, [r4, #20] + 8009c9e: 60a3 str r3, [r4, #8] + 8009ca0: e7f2 b.n 8009c88 <__swsetup_r+0xac> + 8009ca2: 2000 movs r0, #0 + 8009ca4: e7f7 b.n 8009c96 <__swsetup_r+0xba> + 8009ca6: bf00 nop + 8009ca8: 2000036c .word 0x2000036c + 8009cac: 0800af0c .word 0x0800af0c + 8009cb0: 0800af2c .word 0x0800af2c + 8009cb4: 0800aeec .word 0x0800aeec + +08009cb8 <__sflush_r>: + 8009cb8: 898a ldrh r2, [r1, #12] + 8009cba: e92d 41f0 stmdb sp!, {r4, r5, r6, r7, r8, lr} + 8009cbe: 4605 mov r5, r0 + 8009cc0: 0710 lsls r0, r2, #28 + 8009cc2: 460c mov r4, r1 + 8009cc4: d458 bmi.n 8009d78 <__sflush_r+0xc0> + 8009cc6: 684b ldr r3, [r1, #4] + 8009cc8: 2b00 cmp r3, #0 + 8009cca: dc05 bgt.n 8009cd8 <__sflush_r+0x20> + 8009ccc: 6c0b ldr r3, [r1, #64] ; 0x40 + 8009cce: 2b00 cmp r3, #0 + 8009cd0: dc02 bgt.n 8009cd8 <__sflush_r+0x20> + 8009cd2: 2000 movs r0, #0 + 8009cd4: e8bd 81f0 ldmia.w sp!, {r4, r5, r6, r7, r8, pc} + 8009cd8: 6ae6 ldr r6, [r4, #44] ; 0x2c + 8009cda: 2e00 cmp r6, #0 + 8009cdc: d0f9 beq.n 8009cd2 <__sflush_r+0x1a> + 8009cde: 2300 movs r3, #0 + 8009ce0: f412 5280 ands.w r2, r2, #4096 ; 0x1000 + 8009ce4: 682f ldr r7, [r5, #0] + 8009ce6: 6a21 ldr r1, [r4, #32] + 8009ce8: 602b str r3, [r5, #0] + 8009cea: d032 beq.n 8009d52 <__sflush_r+0x9a> + 8009cec: 6d60 ldr r0, [r4, #84] ; 0x54 + 8009cee: 89a3 ldrh r3, [r4, #12] + 8009cf0: 075a lsls r2, r3, #29 + 8009cf2: d505 bpl.n 8009d00 <__sflush_r+0x48> + 8009cf4: 6863 ldr r3, [r4, #4] + 8009cf6: 1ac0 subs r0, r0, r3 + 8009cf8: 6b63 ldr r3, [r4, #52] ; 0x34 + 8009cfa: b10b cbz r3, 8009d00 <__sflush_r+0x48> + 8009cfc: 6c23 ldr r3, [r4, #64] ; 0x40 + 8009cfe: 1ac0 subs r0, r0, r3 + 8009d00: 2300 movs r3, #0 + 8009d02: 4602 mov r2, r0 + 8009d04: 6ae6 ldr r6, [r4, #44] ; 0x2c + 8009d06: 6a21 ldr r1, [r4, #32] + 8009d08: 4628 mov r0, r5 + 8009d0a: 47b0 blx r6 + 8009d0c: 1c43 adds r3, r0, #1 + 8009d0e: 89a3 ldrh r3, [r4, #12] + 8009d10: d106 bne.n 8009d20 <__sflush_r+0x68> + 8009d12: 6829 ldr r1, [r5, #0] + 8009d14: 291d cmp r1, #29 + 8009d16: d848 bhi.n 8009daa <__sflush_r+0xf2> + 8009d18: 4a29 ldr r2, [pc, #164] ; (8009dc0 <__sflush_r+0x108>) + 8009d1a: 40ca lsrs r2, r1 + 8009d1c: 07d6 lsls r6, r2, #31 + 8009d1e: d544 bpl.n 8009daa <__sflush_r+0xf2> + 8009d20: 2200 movs r2, #0 + 8009d22: 6062 str r2, [r4, #4] + 8009d24: 6922 ldr r2, [r4, #16] + 8009d26: 04d9 lsls r1, r3, #19 + 8009d28: 6022 str r2, [r4, #0] + 8009d2a: d504 bpl.n 8009d36 <__sflush_r+0x7e> + 8009d2c: 1c42 adds r2, r0, #1 + 8009d2e: d101 bne.n 8009d34 <__sflush_r+0x7c> + 8009d30: 682b ldr r3, [r5, #0] + 8009d32: b903 cbnz r3, 8009d36 <__sflush_r+0x7e> + 8009d34: 6560 str r0, [r4, #84] ; 0x54 + 8009d36: 6b61 ldr r1, [r4, #52] ; 0x34 + 8009d38: 602f str r7, [r5, #0] + 8009d3a: 2900 cmp r1, #0 + 8009d3c: d0c9 beq.n 8009cd2 <__sflush_r+0x1a> + 8009d3e: f104 0344 add.w r3, r4, #68 ; 0x44 + 8009d42: 4299 cmp r1, r3 + 8009d44: d002 beq.n 8009d4c <__sflush_r+0x94> + 8009d46: 4628 mov r0, r5 + 8009d48: f000 f9aa bl 800a0a0 <_free_r> + 8009d4c: 2000 movs r0, #0 + 8009d4e: 6360 str r0, [r4, #52] ; 0x34 + 8009d50: e7c0 b.n 8009cd4 <__sflush_r+0x1c> + 8009d52: 2301 movs r3, #1 + 8009d54: 4628 mov r0, r5 + 8009d56: 47b0 blx r6 + 8009d58: 1c41 adds r1, r0, #1 + 8009d5a: d1c8 bne.n 8009cee <__sflush_r+0x36> + 8009d5c: 682b ldr r3, [r5, #0] + 8009d5e: 2b00 cmp r3, #0 + 8009d60: d0c5 beq.n 8009cee <__sflush_r+0x36> + 8009d62: 2b1d cmp r3, #29 + 8009d64: d001 beq.n 8009d6a <__sflush_r+0xb2> + 8009d66: 2b16 cmp r3, #22 + 8009d68: d101 bne.n 8009d6e <__sflush_r+0xb6> + 8009d6a: 602f str r7, [r5, #0] + 8009d6c: e7b1 b.n 8009cd2 <__sflush_r+0x1a> + 8009d6e: 89a3 ldrh r3, [r4, #12] + 8009d70: f043 0340 orr.w r3, r3, #64 ; 0x40 + 8009d74: 81a3 strh r3, [r4, #12] + 8009d76: e7ad b.n 8009cd4 <__sflush_r+0x1c> + 8009d78: 690f ldr r7, [r1, #16] + 8009d7a: 2f00 cmp r7, #0 + 8009d7c: d0a9 beq.n 8009cd2 <__sflush_r+0x1a> + 8009d7e: 0793 lsls r3, r2, #30 + 8009d80: bf18 it ne + 8009d82: 2300 movne r3, #0 + 8009d84: 680e ldr r6, [r1, #0] + 8009d86: bf08 it eq + 8009d88: 694b ldreq r3, [r1, #20] + 8009d8a: eba6 0807 sub.w r8, r6, r7 + 8009d8e: 600f str r7, [r1, #0] + 8009d90: 608b str r3, [r1, #8] + 8009d92: f1b8 0f00 cmp.w r8, #0 + 8009d96: dd9c ble.n 8009cd2 <__sflush_r+0x1a> + 8009d98: 4643 mov r3, r8 + 8009d9a: 463a mov r2, r7 + 8009d9c: 6a21 ldr r1, [r4, #32] + 8009d9e: 4628 mov r0, r5 + 8009da0: 6aa6 ldr r6, [r4, #40] ; 0x28 + 8009da2: 47b0 blx r6 + 8009da4: 2800 cmp r0, #0 + 8009da6: dc06 bgt.n 8009db6 <__sflush_r+0xfe> + 8009da8: 89a3 ldrh r3, [r4, #12] + 8009daa: f043 0340 orr.w r3, r3, #64 ; 0x40 + 8009dae: 81a3 strh r3, [r4, #12] + 8009db0: f04f 30ff mov.w r0, #4294967295 + 8009db4: e78e b.n 8009cd4 <__sflush_r+0x1c> + 8009db6: 4407 add r7, r0 + 8009db8: eba8 0800 sub.w r8, r8, r0 + 8009dbc: e7e9 b.n 8009d92 <__sflush_r+0xda> + 8009dbe: bf00 nop + 8009dc0: 20400001 .word 0x20400001 + +08009dc4 <_fflush_r>: + 8009dc4: b538 push {r3, r4, r5, lr} + 8009dc6: 690b ldr r3, [r1, #16] + 8009dc8: 4605 mov r5, r0 + 8009dca: 460c mov r4, r1 + 8009dcc: b1db cbz r3, 8009e06 <_fflush_r+0x42> + 8009dce: b118 cbz r0, 8009dd8 <_fflush_r+0x14> + 8009dd0: 6983 ldr r3, [r0, #24] + 8009dd2: b90b cbnz r3, 8009dd8 <_fflush_r+0x14> + 8009dd4: f000 f860 bl 8009e98 <__sinit> + 8009dd8: 4b0c ldr r3, [pc, #48] ; (8009e0c <_fflush_r+0x48>) + 8009dda: 429c cmp r4, r3 + 8009ddc: d109 bne.n 8009df2 <_fflush_r+0x2e> + 8009dde: 686c ldr r4, [r5, #4] + 8009de0: f9b4 300c ldrsh.w r3, [r4, #12] + 8009de4: b17b cbz r3, 8009e06 <_fflush_r+0x42> + 8009de6: 4621 mov r1, r4 + 8009de8: 4628 mov r0, r5 + 8009dea: e8bd 4038 ldmia.w sp!, {r3, r4, r5, lr} + 8009dee: f7ff bf63 b.w 8009cb8 <__sflush_r> + 8009df2: 4b07 ldr r3, [pc, #28] ; (8009e10 <_fflush_r+0x4c>) + 8009df4: 429c cmp r4, r3 + 8009df6: d101 bne.n 8009dfc <_fflush_r+0x38> + 8009df8: 68ac ldr r4, [r5, #8] + 8009dfa: e7f1 b.n 8009de0 <_fflush_r+0x1c> + 8009dfc: 4b05 ldr r3, [pc, #20] ; (8009e14 <_fflush_r+0x50>) + 8009dfe: 429c cmp r4, r3 + 8009e00: bf08 it eq + 8009e02: 68ec ldreq r4, [r5, #12] + 8009e04: e7ec b.n 8009de0 <_fflush_r+0x1c> + 8009e06: 2000 movs r0, #0 + 8009e08: bd38 pop {r3, r4, r5, pc} + 8009e0a: bf00 nop + 8009e0c: 0800af0c .word 0x0800af0c + 8009e10: 0800af2c .word 0x0800af2c + 8009e14: 0800aeec .word 0x0800aeec + +08009e18 : + 8009e18: 2300 movs r3, #0 + 8009e1a: b510 push {r4, lr} + 8009e1c: 4604 mov r4, r0 + 8009e1e: e9c0 3300 strd r3, r3, [r0] + 8009e22: 6083 str r3, [r0, #8] + 8009e24: 8181 strh r1, [r0, #12] + 8009e26: 6643 str r3, [r0, #100] ; 0x64 + 8009e28: 81c2 strh r2, [r0, #14] + 8009e2a: e9c0 3304 strd r3, r3, [r0, #16] + 8009e2e: 6183 str r3, [r0, #24] + 8009e30: 4619 mov r1, r3 + 8009e32: 2208 movs r2, #8 + 8009e34: 305c adds r0, #92 ; 0x5c + 8009e36: f7ff fd60 bl 80098fa + 8009e3a: 4b05 ldr r3, [pc, #20] ; (8009e50 ) + 8009e3c: 6224 str r4, [r4, #32] + 8009e3e: 6263 str r3, [r4, #36] ; 0x24 + 8009e40: 4b04 ldr r3, [pc, #16] ; (8009e54 ) + 8009e42: 62a3 str r3, [r4, #40] ; 0x28 + 8009e44: 4b04 ldr r3, [pc, #16] ; (8009e58 ) + 8009e46: 62e3 str r3, [r4, #44] ; 0x2c + 8009e48: 4b04 ldr r3, [pc, #16] ; (8009e5c ) + 8009e4a: 6323 str r3, [r4, #48] ; 0x30 + 8009e4c: bd10 pop {r4, pc} + 8009e4e: bf00 nop + 8009e50: 0800a799 .word 0x0800a799 + 8009e54: 0800a7bb .word 0x0800a7bb + 8009e58: 0800a7f3 .word 0x0800a7f3 + 8009e5c: 0800a817 .word 0x0800a817 + +08009e60 <_cleanup_r>: + 8009e60: 4901 ldr r1, [pc, #4] ; (8009e68 <_cleanup_r+0x8>) + 8009e62: f000 b885 b.w 8009f70 <_fwalk_reent> + 8009e66: bf00 nop + 8009e68: 08009dc5 .word 0x08009dc5 + +08009e6c <__sfmoreglue>: + 8009e6c: b570 push {r4, r5, r6, lr} + 8009e6e: 2568 movs r5, #104 ; 0x68 + 8009e70: 1e4a subs r2, r1, #1 + 8009e72: 4355 muls r5, r2 + 8009e74: 460e mov r6, r1 + 8009e76: f105 0174 add.w r1, r5, #116 ; 0x74 + 8009e7a: f000 f95d bl 800a138 <_malloc_r> + 8009e7e: 4604 mov r4, r0 + 8009e80: b140 cbz r0, 8009e94 <__sfmoreglue+0x28> + 8009e82: 2100 movs r1, #0 + 8009e84: e9c0 1600 strd r1, r6, [r0] + 8009e88: 300c adds r0, #12 + 8009e8a: 60a0 str r0, [r4, #8] + 8009e8c: f105 0268 add.w r2, r5, #104 ; 0x68 + 8009e90: f7ff fd33 bl 80098fa + 8009e94: 4620 mov r0, r4 + 8009e96: bd70 pop {r4, r5, r6, pc} + +08009e98 <__sinit>: + 8009e98: 6983 ldr r3, [r0, #24] + 8009e9a: b510 push {r4, lr} + 8009e9c: 4604 mov r4, r0 + 8009e9e: bb33 cbnz r3, 8009eee <__sinit+0x56> + 8009ea0: e9c0 3312 strd r3, r3, [r0, #72] ; 0x48 + 8009ea4: 6503 str r3, [r0, #80] ; 0x50 + 8009ea6: 4b12 ldr r3, [pc, #72] ; (8009ef0 <__sinit+0x58>) + 8009ea8: 4a12 ldr r2, [pc, #72] ; (8009ef4 <__sinit+0x5c>) + 8009eaa: 681b ldr r3, [r3, #0] + 8009eac: 6282 str r2, [r0, #40] ; 0x28 + 8009eae: 4298 cmp r0, r3 + 8009eb0: bf04 itt eq + 8009eb2: 2301 moveq r3, #1 + 8009eb4: 6183 streq r3, [r0, #24] + 8009eb6: f000 f81f bl 8009ef8 <__sfp> + 8009eba: 6060 str r0, [r4, #4] + 8009ebc: 4620 mov r0, r4 + 8009ebe: f000 f81b bl 8009ef8 <__sfp> + 8009ec2: 60a0 str r0, [r4, #8] + 8009ec4: 4620 mov r0, r4 + 8009ec6: f000 f817 bl 8009ef8 <__sfp> + 8009eca: 2200 movs r2, #0 + 8009ecc: 60e0 str r0, [r4, #12] + 8009ece: 2104 movs r1, #4 + 8009ed0: 6860 ldr r0, [r4, #4] + 8009ed2: f7ff ffa1 bl 8009e18 + 8009ed6: 2201 movs r2, #1 + 8009ed8: 2109 movs r1, #9 + 8009eda: 68a0 ldr r0, [r4, #8] + 8009edc: f7ff ff9c bl 8009e18 + 8009ee0: 2202 movs r2, #2 + 8009ee2: 2112 movs r1, #18 + 8009ee4: 68e0 ldr r0, [r4, #12] + 8009ee6: f7ff ff97 bl 8009e18 + 8009eea: 2301 movs r3, #1 + 8009eec: 61a3 str r3, [r4, #24] + 8009eee: bd10 pop {r4, pc} + 8009ef0: 0800aee8 .word 0x0800aee8 + 8009ef4: 08009e61 .word 0x08009e61 + +08009ef8 <__sfp>: + 8009ef8: b5f8 push {r3, r4, r5, r6, r7, lr} + 8009efa: 4b1b ldr r3, [pc, #108] ; (8009f68 <__sfp+0x70>) + 8009efc: 4607 mov r7, r0 + 8009efe: 681e ldr r6, [r3, #0] + 8009f00: 69b3 ldr r3, [r6, #24] + 8009f02: b913 cbnz r3, 8009f0a <__sfp+0x12> + 8009f04: 4630 mov r0, r6 + 8009f06: f7ff ffc7 bl 8009e98 <__sinit> + 8009f0a: 3648 adds r6, #72 ; 0x48 + 8009f0c: e9d6 3401 ldrd r3, r4, [r6, #4] + 8009f10: 3b01 subs r3, #1 + 8009f12: d503 bpl.n 8009f1c <__sfp+0x24> + 8009f14: 6833 ldr r3, [r6, #0] + 8009f16: b133 cbz r3, 8009f26 <__sfp+0x2e> + 8009f18: 6836 ldr r6, [r6, #0] + 8009f1a: e7f7 b.n 8009f0c <__sfp+0x14> + 8009f1c: f9b4 500c ldrsh.w r5, [r4, #12] + 8009f20: b16d cbz r5, 8009f3e <__sfp+0x46> + 8009f22: 3468 adds r4, #104 ; 0x68 + 8009f24: e7f4 b.n 8009f10 <__sfp+0x18> + 8009f26: 2104 movs r1, #4 + 8009f28: 4638 mov r0, r7 + 8009f2a: f7ff ff9f bl 8009e6c <__sfmoreglue> + 8009f2e: 6030 str r0, [r6, #0] + 8009f30: 2800 cmp r0, #0 + 8009f32: d1f1 bne.n 8009f18 <__sfp+0x20> + 8009f34: 230c movs r3, #12 + 8009f36: 4604 mov r4, r0 + 8009f38: 603b str r3, [r7, #0] + 8009f3a: 4620 mov r0, r4 + 8009f3c: bdf8 pop {r3, r4, r5, r6, r7, pc} + 8009f3e: 4b0b ldr r3, [pc, #44] ; (8009f6c <__sfp+0x74>) + 8009f40: 6665 str r5, [r4, #100] ; 0x64 + 8009f42: e9c4 5500 strd r5, r5, [r4] + 8009f46: 60a5 str r5, [r4, #8] + 8009f48: e9c4 3503 strd r3, r5, [r4, #12] + 8009f4c: e9c4 5505 strd r5, r5, [r4, #20] + 8009f50: 2208 movs r2, #8 + 8009f52: 4629 mov r1, r5 + 8009f54: f104 005c add.w r0, r4, #92 ; 0x5c + 8009f58: f7ff fccf bl 80098fa + 8009f5c: e9c4 550d strd r5, r5, [r4, #52] ; 0x34 + 8009f60: e9c4 5512 strd r5, r5, [r4, #72] ; 0x48 + 8009f64: e7e9 b.n 8009f3a <__sfp+0x42> + 8009f66: bf00 nop + 8009f68: 0800aee8 .word 0x0800aee8 + 8009f6c: ffff0001 .word 0xffff0001 + +08009f70 <_fwalk_reent>: + 8009f70: e92d 43f8 stmdb sp!, {r3, r4, r5, r6, r7, r8, r9, lr} + 8009f74: 4680 mov r8, r0 + 8009f76: 4689 mov r9, r1 + 8009f78: 2600 movs r6, #0 + 8009f7a: f100 0448 add.w r4, r0, #72 ; 0x48 + 8009f7e: b914 cbnz r4, 8009f86 <_fwalk_reent+0x16> + 8009f80: 4630 mov r0, r6 + 8009f82: e8bd 83f8 ldmia.w sp!, {r3, r4, r5, r6, r7, r8, r9, pc} + 8009f86: e9d4 7501 ldrd r7, r5, [r4, #4] + 8009f8a: 3f01 subs r7, #1 + 8009f8c: d501 bpl.n 8009f92 <_fwalk_reent+0x22> + 8009f8e: 6824 ldr r4, [r4, #0] + 8009f90: e7f5 b.n 8009f7e <_fwalk_reent+0xe> + 8009f92: 89ab ldrh r3, [r5, #12] + 8009f94: 2b01 cmp r3, #1 + 8009f96: d907 bls.n 8009fa8 <_fwalk_reent+0x38> + 8009f98: f9b5 300e ldrsh.w r3, [r5, #14] + 8009f9c: 3301 adds r3, #1 + 8009f9e: d003 beq.n 8009fa8 <_fwalk_reent+0x38> + 8009fa0: 4629 mov r1, r5 + 8009fa2: 4640 mov r0, r8 + 8009fa4: 47c8 blx r9 + 8009fa6: 4306 orrs r6, r0 + 8009fa8: 3568 adds r5, #104 ; 0x68 + 8009faa: e7ee b.n 8009f8a <_fwalk_reent+0x1a> + +08009fac <__locale_ctype_ptr_l>: + 8009fac: f8d0 00ec ldr.w r0, [r0, #236] ; 0xec + 8009fb0: 4770 bx lr + +08009fb2 <__swhatbuf_r>: + 8009fb2: b570 push {r4, r5, r6, lr} + 8009fb4: 460e mov r6, r1 + 8009fb6: f9b1 100e ldrsh.w r1, [r1, #14] + 8009fba: b096 sub sp, #88 ; 0x58 + 8009fbc: 2900 cmp r1, #0 + 8009fbe: 4614 mov r4, r2 + 8009fc0: 461d mov r5, r3 + 8009fc2: da07 bge.n 8009fd4 <__swhatbuf_r+0x22> + 8009fc4: 2300 movs r3, #0 + 8009fc6: 602b str r3, [r5, #0] + 8009fc8: 89b3 ldrh r3, [r6, #12] + 8009fca: 061a lsls r2, r3, #24 + 8009fcc: d410 bmi.n 8009ff0 <__swhatbuf_r+0x3e> + 8009fce: f44f 6380 mov.w r3, #1024 ; 0x400 + 8009fd2: e00e b.n 8009ff2 <__swhatbuf_r+0x40> + 8009fd4: 466a mov r2, sp + 8009fd6: f000 fc51 bl 800a87c <_fstat_r> + 8009fda: 2800 cmp r0, #0 + 8009fdc: dbf2 blt.n 8009fc4 <__swhatbuf_r+0x12> + 8009fde: 9a01 ldr r2, [sp, #4] + 8009fe0: f402 4270 and.w r2, r2, #61440 ; 0xf000 + 8009fe4: f5a2 5300 sub.w r3, r2, #8192 ; 0x2000 + 8009fe8: 425a negs r2, r3 + 8009fea: 415a adcs r2, r3 + 8009fec: 602a str r2, [r5, #0] + 8009fee: e7ee b.n 8009fce <__swhatbuf_r+0x1c> + 8009ff0: 2340 movs r3, #64 ; 0x40 + 8009ff2: 2000 movs r0, #0 + 8009ff4: 6023 str r3, [r4, #0] + 8009ff6: b016 add sp, #88 ; 0x58 + 8009ff8: bd70 pop {r4, r5, r6, pc} + ... + +08009ffc <__smakebuf_r>: + 8009ffc: 898b ldrh r3, [r1, #12] + 8009ffe: b573 push {r0, r1, r4, r5, r6, lr} + 800a000: 079d lsls r5, r3, #30 + 800a002: 4606 mov r6, r0 + 800a004: 460c mov r4, r1 + 800a006: d507 bpl.n 800a018 <__smakebuf_r+0x1c> + 800a008: f104 0347 add.w r3, r4, #71 ; 0x47 + 800a00c: 6023 str r3, [r4, #0] + 800a00e: 6123 str r3, [r4, #16] + 800a010: 2301 movs r3, #1 + 800a012: 6163 str r3, [r4, #20] + 800a014: b002 add sp, #8 + 800a016: bd70 pop {r4, r5, r6, pc} + 800a018: ab01 add r3, sp, #4 + 800a01a: 466a mov r2, sp + 800a01c: f7ff ffc9 bl 8009fb2 <__swhatbuf_r> + 800a020: 9900 ldr r1, [sp, #0] + 800a022: 4605 mov r5, r0 + 800a024: 4630 mov r0, r6 + 800a026: f000 f887 bl 800a138 <_malloc_r> + 800a02a: b948 cbnz r0, 800a040 <__smakebuf_r+0x44> + 800a02c: f9b4 300c ldrsh.w r3, [r4, #12] + 800a030: 059a lsls r2, r3, #22 + 800a032: d4ef bmi.n 800a014 <__smakebuf_r+0x18> + 800a034: f023 0303 bic.w r3, r3, #3 + 800a038: f043 0302 orr.w r3, r3, #2 + 800a03c: 81a3 strh r3, [r4, #12] + 800a03e: e7e3 b.n 800a008 <__smakebuf_r+0xc> + 800a040: 4b0d ldr r3, [pc, #52] ; (800a078 <__smakebuf_r+0x7c>) + 800a042: 62b3 str r3, [r6, #40] ; 0x28 + 800a044: 89a3 ldrh r3, [r4, #12] + 800a046: 6020 str r0, [r4, #0] + 800a048: f043 0380 orr.w r3, r3, #128 ; 0x80 + 800a04c: 81a3 strh r3, [r4, #12] + 800a04e: 9b00 ldr r3, [sp, #0] + 800a050: 6120 str r0, [r4, #16] + 800a052: 6163 str r3, [r4, #20] + 800a054: 9b01 ldr r3, [sp, #4] + 800a056: b15b cbz r3, 800a070 <__smakebuf_r+0x74> + 800a058: f9b4 100e ldrsh.w r1, [r4, #14] + 800a05c: 4630 mov r0, r6 + 800a05e: f000 fc1f bl 800a8a0 <_isatty_r> + 800a062: b128 cbz r0, 800a070 <__smakebuf_r+0x74> + 800a064: 89a3 ldrh r3, [r4, #12] + 800a066: f023 0303 bic.w r3, r3, #3 + 800a06a: f043 0301 orr.w r3, r3, #1 + 800a06e: 81a3 strh r3, [r4, #12] + 800a070: 89a3 ldrh r3, [r4, #12] + 800a072: 431d orrs r5, r3 + 800a074: 81a5 strh r5, [r4, #12] + 800a076: e7cd b.n 800a014 <__smakebuf_r+0x18> + 800a078: 08009e61 .word 0x08009e61 + +0800a07c <__ascii_mbtowc>: + 800a07c: b082 sub sp, #8 + 800a07e: b901 cbnz r1, 800a082 <__ascii_mbtowc+0x6> + 800a080: a901 add r1, sp, #4 + 800a082: b142 cbz r2, 800a096 <__ascii_mbtowc+0x1a> + 800a084: b14b cbz r3, 800a09a <__ascii_mbtowc+0x1e> + 800a086: 7813 ldrb r3, [r2, #0] + 800a088: 600b str r3, [r1, #0] + 800a08a: 7812 ldrb r2, [r2, #0] + 800a08c: 1c10 adds r0, r2, #0 + 800a08e: bf18 it ne + 800a090: 2001 movne r0, #1 + 800a092: b002 add sp, #8 + 800a094: 4770 bx lr + 800a096: 4610 mov r0, r2 + 800a098: e7fb b.n 800a092 <__ascii_mbtowc+0x16> + 800a09a: f06f 0001 mvn.w r0, #1 + 800a09e: e7f8 b.n 800a092 <__ascii_mbtowc+0x16> + +0800a0a0 <_free_r>: + 800a0a0: b538 push {r3, r4, r5, lr} + 800a0a2: 4605 mov r5, r0 + 800a0a4: 2900 cmp r1, #0 + 800a0a6: d043 beq.n 800a130 <_free_r+0x90> + 800a0a8: f851 3c04 ldr.w r3, [r1, #-4] + 800a0ac: 1f0c subs r4, r1, #4 + 800a0ae: 2b00 cmp r3, #0 + 800a0b0: bfb8 it lt + 800a0b2: 18e4 addlt r4, r4, r3 + 800a0b4: f000 fc24 bl 800a900 <__malloc_lock> + 800a0b8: 4a1e ldr r2, [pc, #120] ; (800a134 <_free_r+0x94>) + 800a0ba: 6813 ldr r3, [r2, #0] + 800a0bc: 4610 mov r0, r2 + 800a0be: b933 cbnz r3, 800a0ce <_free_r+0x2e> + 800a0c0: 6063 str r3, [r4, #4] + 800a0c2: 6014 str r4, [r2, #0] + 800a0c4: 4628 mov r0, r5 + 800a0c6: e8bd 4038 ldmia.w sp!, {r3, r4, r5, lr} + 800a0ca: f000 bc1a b.w 800a902 <__malloc_unlock> + 800a0ce: 42a3 cmp r3, r4 + 800a0d0: d90b bls.n 800a0ea <_free_r+0x4a> + 800a0d2: 6821 ldr r1, [r4, #0] + 800a0d4: 1862 adds r2, r4, r1 + 800a0d6: 4293 cmp r3, r2 + 800a0d8: bf01 itttt eq + 800a0da: 681a ldreq r2, [r3, #0] + 800a0dc: 685b ldreq r3, [r3, #4] + 800a0de: 1852 addeq r2, r2, r1 + 800a0e0: 6022 streq r2, [r4, #0] + 800a0e2: 6063 str r3, [r4, #4] + 800a0e4: 6004 str r4, [r0, #0] + 800a0e6: e7ed b.n 800a0c4 <_free_r+0x24> + 800a0e8: 4613 mov r3, r2 + 800a0ea: 685a ldr r2, [r3, #4] + 800a0ec: b10a cbz r2, 800a0f2 <_free_r+0x52> + 800a0ee: 42a2 cmp r2, r4 + 800a0f0: d9fa bls.n 800a0e8 <_free_r+0x48> + 800a0f2: 6819 ldr r1, [r3, #0] + 800a0f4: 1858 adds r0, r3, r1 + 800a0f6: 42a0 cmp r0, r4 + 800a0f8: d10b bne.n 800a112 <_free_r+0x72> + 800a0fa: 6820 ldr r0, [r4, #0] + 800a0fc: 4401 add r1, r0 + 800a0fe: 1858 adds r0, r3, r1 + 800a100: 4282 cmp r2, r0 + 800a102: 6019 str r1, [r3, #0] + 800a104: d1de bne.n 800a0c4 <_free_r+0x24> + 800a106: 6810 ldr r0, [r2, #0] + 800a108: 6852 ldr r2, [r2, #4] + 800a10a: 4401 add r1, r0 + 800a10c: 6019 str r1, [r3, #0] + 800a10e: 605a str r2, [r3, #4] + 800a110: e7d8 b.n 800a0c4 <_free_r+0x24> + 800a112: d902 bls.n 800a11a <_free_r+0x7a> + 800a114: 230c movs r3, #12 + 800a116: 602b str r3, [r5, #0] + 800a118: e7d4 b.n 800a0c4 <_free_r+0x24> + 800a11a: 6820 ldr r0, [r4, #0] + 800a11c: 1821 adds r1, r4, r0 + 800a11e: 428a cmp r2, r1 + 800a120: bf01 itttt eq + 800a122: 6811 ldreq r1, [r2, #0] + 800a124: 6852 ldreq r2, [r2, #4] + 800a126: 1809 addeq r1, r1, r0 + 800a128: 6021 streq r1, [r4, #0] + 800a12a: 6062 str r2, [r4, #4] + 800a12c: 605c str r4, [r3, #4] + 800a12e: e7c9 b.n 800a0c4 <_free_r+0x24> + 800a130: bd38 pop {r3, r4, r5, pc} + 800a132: bf00 nop + 800a134: 20000584 .word 0x20000584 + +0800a138 <_malloc_r>: + 800a138: b570 push {r4, r5, r6, lr} + 800a13a: 1ccd adds r5, r1, #3 + 800a13c: f025 0503 bic.w r5, r5, #3 + 800a140: 3508 adds r5, #8 + 800a142: 2d0c cmp r5, #12 + 800a144: bf38 it cc + 800a146: 250c movcc r5, #12 + 800a148: 2d00 cmp r5, #0 + 800a14a: 4606 mov r6, r0 + 800a14c: db01 blt.n 800a152 <_malloc_r+0x1a> + 800a14e: 42a9 cmp r1, r5 + 800a150: d903 bls.n 800a15a <_malloc_r+0x22> + 800a152: 230c movs r3, #12 + 800a154: 6033 str r3, [r6, #0] + 800a156: 2000 movs r0, #0 + 800a158: bd70 pop {r4, r5, r6, pc} + 800a15a: f000 fbd1 bl 800a900 <__malloc_lock> + 800a15e: 4a21 ldr r2, [pc, #132] ; (800a1e4 <_malloc_r+0xac>) + 800a160: 6814 ldr r4, [r2, #0] + 800a162: 4621 mov r1, r4 + 800a164: b991 cbnz r1, 800a18c <_malloc_r+0x54> + 800a166: 4c20 ldr r4, [pc, #128] ; (800a1e8 <_malloc_r+0xb0>) + 800a168: 6823 ldr r3, [r4, #0] + 800a16a: b91b cbnz r3, 800a174 <_malloc_r+0x3c> + 800a16c: 4630 mov r0, r6 + 800a16e: f000 fb03 bl 800a778 <_sbrk_r> + 800a172: 6020 str r0, [r4, #0] + 800a174: 4629 mov r1, r5 + 800a176: 4630 mov r0, r6 + 800a178: f000 fafe bl 800a778 <_sbrk_r> + 800a17c: 1c43 adds r3, r0, #1 + 800a17e: d124 bne.n 800a1ca <_malloc_r+0x92> + 800a180: 230c movs r3, #12 + 800a182: 4630 mov r0, r6 + 800a184: 6033 str r3, [r6, #0] + 800a186: f000 fbbc bl 800a902 <__malloc_unlock> + 800a18a: e7e4 b.n 800a156 <_malloc_r+0x1e> + 800a18c: 680b ldr r3, [r1, #0] + 800a18e: 1b5b subs r3, r3, r5 + 800a190: d418 bmi.n 800a1c4 <_malloc_r+0x8c> + 800a192: 2b0b cmp r3, #11 + 800a194: d90f bls.n 800a1b6 <_malloc_r+0x7e> + 800a196: 600b str r3, [r1, #0] + 800a198: 18cc adds r4, r1, r3 + 800a19a: 50cd str r5, [r1, r3] + 800a19c: 4630 mov r0, r6 + 800a19e: f000 fbb0 bl 800a902 <__malloc_unlock> + 800a1a2: f104 000b add.w r0, r4, #11 + 800a1a6: 1d23 adds r3, r4, #4 + 800a1a8: f020 0007 bic.w r0, r0, #7 + 800a1ac: 1ac3 subs r3, r0, r3 + 800a1ae: d0d3 beq.n 800a158 <_malloc_r+0x20> + 800a1b0: 425a negs r2, r3 + 800a1b2: 50e2 str r2, [r4, r3] + 800a1b4: e7d0 b.n 800a158 <_malloc_r+0x20> + 800a1b6: 684b ldr r3, [r1, #4] + 800a1b8: 428c cmp r4, r1 + 800a1ba: bf16 itet ne + 800a1bc: 6063 strne r3, [r4, #4] + 800a1be: 6013 streq r3, [r2, #0] + 800a1c0: 460c movne r4, r1 + 800a1c2: e7eb b.n 800a19c <_malloc_r+0x64> + 800a1c4: 460c mov r4, r1 + 800a1c6: 6849 ldr r1, [r1, #4] + 800a1c8: e7cc b.n 800a164 <_malloc_r+0x2c> + 800a1ca: 1cc4 adds r4, r0, #3 + 800a1cc: f024 0403 bic.w r4, r4, #3 + 800a1d0: 42a0 cmp r0, r4 + 800a1d2: d005 beq.n 800a1e0 <_malloc_r+0xa8> + 800a1d4: 1a21 subs r1, r4, r0 + 800a1d6: 4630 mov r0, r6 + 800a1d8: f000 face bl 800a778 <_sbrk_r> + 800a1dc: 3001 adds r0, #1 + 800a1de: d0cf beq.n 800a180 <_malloc_r+0x48> + 800a1e0: 6025 str r5, [r4, #0] + 800a1e2: e7db b.n 800a19c <_malloc_r+0x64> + 800a1e4: 20000584 .word 0x20000584 + 800a1e8: 20000588 .word 0x20000588 + +0800a1ec <__sfputc_r>: + 800a1ec: 6893 ldr r3, [r2, #8] + 800a1ee: b410 push {r4} + 800a1f0: 3b01 subs r3, #1 + 800a1f2: 2b00 cmp r3, #0 + 800a1f4: 6093 str r3, [r2, #8] + 800a1f6: da07 bge.n 800a208 <__sfputc_r+0x1c> + 800a1f8: 6994 ldr r4, [r2, #24] + 800a1fa: 42a3 cmp r3, r4 + 800a1fc: db01 blt.n 800a202 <__sfputc_r+0x16> + 800a1fe: 290a cmp r1, #10 + 800a200: d102 bne.n 800a208 <__sfputc_r+0x1c> + 800a202: bc10 pop {r4} + 800a204: f7ff bc98 b.w 8009b38 <__swbuf_r> + 800a208: 6813 ldr r3, [r2, #0] + 800a20a: 1c58 adds r0, r3, #1 + 800a20c: 6010 str r0, [r2, #0] + 800a20e: 7019 strb r1, [r3, #0] + 800a210: 4608 mov r0, r1 + 800a212: bc10 pop {r4} + 800a214: 4770 bx lr + +0800a216 <__sfputs_r>: + 800a216: b5f8 push {r3, r4, r5, r6, r7, lr} + 800a218: 4606 mov r6, r0 + 800a21a: 460f mov r7, r1 + 800a21c: 4614 mov r4, r2 + 800a21e: 18d5 adds r5, r2, r3 + 800a220: 42ac cmp r4, r5 + 800a222: d101 bne.n 800a228 <__sfputs_r+0x12> + 800a224: 2000 movs r0, #0 + 800a226: e007 b.n 800a238 <__sfputs_r+0x22> + 800a228: 463a mov r2, r7 + 800a22a: f814 1b01 ldrb.w r1, [r4], #1 + 800a22e: 4630 mov r0, r6 + 800a230: f7ff ffdc bl 800a1ec <__sfputc_r> + 800a234: 1c43 adds r3, r0, #1 + 800a236: d1f3 bne.n 800a220 <__sfputs_r+0xa> + 800a238: bdf8 pop {r3, r4, r5, r6, r7, pc} + ... + +0800a23c <_vfiprintf_r>: + 800a23c: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr} + 800a240: 460c mov r4, r1 + 800a242: b09d sub sp, #116 ; 0x74 + 800a244: 4617 mov r7, r2 + 800a246: 461d mov r5, r3 + 800a248: 4606 mov r6, r0 + 800a24a: b118 cbz r0, 800a254 <_vfiprintf_r+0x18> + 800a24c: 6983 ldr r3, [r0, #24] + 800a24e: b90b cbnz r3, 800a254 <_vfiprintf_r+0x18> + 800a250: f7ff fe22 bl 8009e98 <__sinit> + 800a254: 4b7c ldr r3, [pc, #496] ; (800a448 <_vfiprintf_r+0x20c>) + 800a256: 429c cmp r4, r3 + 800a258: d158 bne.n 800a30c <_vfiprintf_r+0xd0> + 800a25a: 6874 ldr r4, [r6, #4] + 800a25c: 89a3 ldrh r3, [r4, #12] + 800a25e: 0718 lsls r0, r3, #28 + 800a260: d55e bpl.n 800a320 <_vfiprintf_r+0xe4> + 800a262: 6923 ldr r3, [r4, #16] + 800a264: 2b00 cmp r3, #0 + 800a266: d05b beq.n 800a320 <_vfiprintf_r+0xe4> + 800a268: 2300 movs r3, #0 + 800a26a: 9309 str r3, [sp, #36] ; 0x24 + 800a26c: 2320 movs r3, #32 + 800a26e: f88d 3029 strb.w r3, [sp, #41] ; 0x29 + 800a272: 2330 movs r3, #48 ; 0x30 + 800a274: f04f 0b01 mov.w fp, #1 + 800a278: f88d 302a strb.w r3, [sp, #42] ; 0x2a + 800a27c: 9503 str r5, [sp, #12] + 800a27e: 46b8 mov r8, r7 + 800a280: 4645 mov r5, r8 + 800a282: f815 3b01 ldrb.w r3, [r5], #1 + 800a286: b10b cbz r3, 800a28c <_vfiprintf_r+0x50> + 800a288: 2b25 cmp r3, #37 ; 0x25 + 800a28a: d154 bne.n 800a336 <_vfiprintf_r+0xfa> + 800a28c: ebb8 0a07 subs.w sl, r8, r7 + 800a290: d00b beq.n 800a2aa <_vfiprintf_r+0x6e> + 800a292: 4653 mov r3, sl + 800a294: 463a mov r2, r7 + 800a296: 4621 mov r1, r4 + 800a298: 4630 mov r0, r6 + 800a29a: f7ff ffbc bl 800a216 <__sfputs_r> + 800a29e: 3001 adds r0, #1 + 800a2a0: f000 80c2 beq.w 800a428 <_vfiprintf_r+0x1ec> + 800a2a4: 9b09 ldr r3, [sp, #36] ; 0x24 + 800a2a6: 4453 add r3, sl + 800a2a8: 9309 str r3, [sp, #36] ; 0x24 + 800a2aa: f898 3000 ldrb.w r3, [r8] + 800a2ae: 2b00 cmp r3, #0 + 800a2b0: f000 80ba beq.w 800a428 <_vfiprintf_r+0x1ec> + 800a2b4: 2300 movs r3, #0 + 800a2b6: f04f 32ff mov.w r2, #4294967295 + 800a2ba: e9cd 2305 strd r2, r3, [sp, #20] + 800a2be: 9304 str r3, [sp, #16] + 800a2c0: 9307 str r3, [sp, #28] + 800a2c2: f88d 3053 strb.w r3, [sp, #83] ; 0x53 + 800a2c6: 931a str r3, [sp, #104] ; 0x68 + 800a2c8: 46a8 mov r8, r5 + 800a2ca: 2205 movs r2, #5 + 800a2cc: f818 1b01 ldrb.w r1, [r8], #1 + 800a2d0: 485e ldr r0, [pc, #376] ; (800a44c <_vfiprintf_r+0x210>) + 800a2d2: f000 fb07 bl 800a8e4 + 800a2d6: 9b04 ldr r3, [sp, #16] + 800a2d8: bb78 cbnz r0, 800a33a <_vfiprintf_r+0xfe> + 800a2da: 06d9 lsls r1, r3, #27 + 800a2dc: bf44 itt mi + 800a2de: 2220 movmi r2, #32 + 800a2e0: f88d 2053 strbmi.w r2, [sp, #83] ; 0x53 + 800a2e4: 071a lsls r2, r3, #28 + 800a2e6: bf44 itt mi + 800a2e8: 222b movmi r2, #43 ; 0x2b + 800a2ea: f88d 2053 strbmi.w r2, [sp, #83] ; 0x53 + 800a2ee: 782a ldrb r2, [r5, #0] + 800a2f0: 2a2a cmp r2, #42 ; 0x2a + 800a2f2: d02a beq.n 800a34a <_vfiprintf_r+0x10e> + 800a2f4: 46a8 mov r8, r5 + 800a2f6: 2000 movs r0, #0 + 800a2f8: 250a movs r5, #10 + 800a2fa: 9a07 ldr r2, [sp, #28] + 800a2fc: 4641 mov r1, r8 + 800a2fe: f811 3b01 ldrb.w r3, [r1], #1 + 800a302: 3b30 subs r3, #48 ; 0x30 + 800a304: 2b09 cmp r3, #9 + 800a306: d969 bls.n 800a3dc <_vfiprintf_r+0x1a0> + 800a308: b360 cbz r0, 800a364 <_vfiprintf_r+0x128> + 800a30a: e024 b.n 800a356 <_vfiprintf_r+0x11a> + 800a30c: 4b50 ldr r3, [pc, #320] ; (800a450 <_vfiprintf_r+0x214>) + 800a30e: 429c cmp r4, r3 + 800a310: d101 bne.n 800a316 <_vfiprintf_r+0xda> + 800a312: 68b4 ldr r4, [r6, #8] + 800a314: e7a2 b.n 800a25c <_vfiprintf_r+0x20> + 800a316: 4b4f ldr r3, [pc, #316] ; (800a454 <_vfiprintf_r+0x218>) + 800a318: 429c cmp r4, r3 + 800a31a: bf08 it eq + 800a31c: 68f4 ldreq r4, [r6, #12] + 800a31e: e79d b.n 800a25c <_vfiprintf_r+0x20> + 800a320: 4621 mov r1, r4 + 800a322: 4630 mov r0, r6 + 800a324: f7ff fc5a bl 8009bdc <__swsetup_r> + 800a328: 2800 cmp r0, #0 + 800a32a: d09d beq.n 800a268 <_vfiprintf_r+0x2c> + 800a32c: f04f 30ff mov.w r0, #4294967295 + 800a330: b01d add sp, #116 ; 0x74 + 800a332: e8bd 8ff0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc} + 800a336: 46a8 mov r8, r5 + 800a338: e7a2 b.n 800a280 <_vfiprintf_r+0x44> + 800a33a: 4a44 ldr r2, [pc, #272] ; (800a44c <_vfiprintf_r+0x210>) + 800a33c: 4645 mov r5, r8 + 800a33e: 1a80 subs r0, r0, r2 + 800a340: fa0b f000 lsl.w r0, fp, r0 + 800a344: 4318 orrs r0, r3 + 800a346: 9004 str r0, [sp, #16] + 800a348: e7be b.n 800a2c8 <_vfiprintf_r+0x8c> + 800a34a: 9a03 ldr r2, [sp, #12] + 800a34c: 1d11 adds r1, r2, #4 + 800a34e: 6812 ldr r2, [r2, #0] + 800a350: 9103 str r1, [sp, #12] + 800a352: 2a00 cmp r2, #0 + 800a354: db01 blt.n 800a35a <_vfiprintf_r+0x11e> + 800a356: 9207 str r2, [sp, #28] + 800a358: e004 b.n 800a364 <_vfiprintf_r+0x128> + 800a35a: 4252 negs r2, r2 + 800a35c: f043 0302 orr.w r3, r3, #2 + 800a360: 9207 str r2, [sp, #28] + 800a362: 9304 str r3, [sp, #16] + 800a364: f898 3000 ldrb.w r3, [r8] + 800a368: 2b2e cmp r3, #46 ; 0x2e + 800a36a: d10e bne.n 800a38a <_vfiprintf_r+0x14e> + 800a36c: f898 3001 ldrb.w r3, [r8, #1] + 800a370: 2b2a cmp r3, #42 ; 0x2a + 800a372: d138 bne.n 800a3e6 <_vfiprintf_r+0x1aa> + 800a374: 9b03 ldr r3, [sp, #12] + 800a376: f108 0802 add.w r8, r8, #2 + 800a37a: 1d1a adds r2, r3, #4 + 800a37c: 681b ldr r3, [r3, #0] + 800a37e: 9203 str r2, [sp, #12] + 800a380: 2b00 cmp r3, #0 + 800a382: bfb8 it lt + 800a384: f04f 33ff movlt.w r3, #4294967295 + 800a388: 9305 str r3, [sp, #20] + 800a38a: 4d33 ldr r5, [pc, #204] ; (800a458 <_vfiprintf_r+0x21c>) + 800a38c: 2203 movs r2, #3 + 800a38e: f898 1000 ldrb.w r1, [r8] + 800a392: 4628 mov r0, r5 + 800a394: f000 faa6 bl 800a8e4 + 800a398: b140 cbz r0, 800a3ac <_vfiprintf_r+0x170> + 800a39a: 2340 movs r3, #64 ; 0x40 + 800a39c: 1b40 subs r0, r0, r5 + 800a39e: fa03 f000 lsl.w r0, r3, r0 + 800a3a2: 9b04 ldr r3, [sp, #16] + 800a3a4: f108 0801 add.w r8, r8, #1 + 800a3a8: 4303 orrs r3, r0 + 800a3aa: 9304 str r3, [sp, #16] + 800a3ac: f898 1000 ldrb.w r1, [r8] + 800a3b0: 2206 movs r2, #6 + 800a3b2: 482a ldr r0, [pc, #168] ; (800a45c <_vfiprintf_r+0x220>) + 800a3b4: f108 0701 add.w r7, r8, #1 + 800a3b8: f88d 1028 strb.w r1, [sp, #40] ; 0x28 + 800a3bc: f000 fa92 bl 800a8e4 + 800a3c0: 2800 cmp r0, #0 + 800a3c2: d037 beq.n 800a434 <_vfiprintf_r+0x1f8> + 800a3c4: 4b26 ldr r3, [pc, #152] ; (800a460 <_vfiprintf_r+0x224>) + 800a3c6: bb1b cbnz r3, 800a410 <_vfiprintf_r+0x1d4> + 800a3c8: 9b03 ldr r3, [sp, #12] + 800a3ca: 3307 adds r3, #7 + 800a3cc: f023 0307 bic.w r3, r3, #7 + 800a3d0: 3308 adds r3, #8 + 800a3d2: 9303 str r3, [sp, #12] + 800a3d4: 9b09 ldr r3, [sp, #36] ; 0x24 + 800a3d6: 444b add r3, r9 + 800a3d8: 9309 str r3, [sp, #36] ; 0x24 + 800a3da: e750 b.n 800a27e <_vfiprintf_r+0x42> + 800a3dc: fb05 3202 mla r2, r5, r2, r3 + 800a3e0: 2001 movs r0, #1 + 800a3e2: 4688 mov r8, r1 + 800a3e4: e78a b.n 800a2fc <_vfiprintf_r+0xc0> + 800a3e6: 2300 movs r3, #0 + 800a3e8: 250a movs r5, #10 + 800a3ea: 4619 mov r1, r3 + 800a3ec: f108 0801 add.w r8, r8, #1 + 800a3f0: 9305 str r3, [sp, #20] + 800a3f2: 4640 mov r0, r8 + 800a3f4: f810 2b01 ldrb.w r2, [r0], #1 + 800a3f8: 3a30 subs r2, #48 ; 0x30 + 800a3fa: 2a09 cmp r2, #9 + 800a3fc: d903 bls.n 800a406 <_vfiprintf_r+0x1ca> + 800a3fe: 2b00 cmp r3, #0 + 800a400: d0c3 beq.n 800a38a <_vfiprintf_r+0x14e> + 800a402: 9105 str r1, [sp, #20] + 800a404: e7c1 b.n 800a38a <_vfiprintf_r+0x14e> + 800a406: fb05 2101 mla r1, r5, r1, r2 + 800a40a: 2301 movs r3, #1 + 800a40c: 4680 mov r8, r0 + 800a40e: e7f0 b.n 800a3f2 <_vfiprintf_r+0x1b6> + 800a410: ab03 add r3, sp, #12 + 800a412: 9300 str r3, [sp, #0] + 800a414: 4622 mov r2, r4 + 800a416: 4b13 ldr r3, [pc, #76] ; (800a464 <_vfiprintf_r+0x228>) + 800a418: a904 add r1, sp, #16 + 800a41a: 4630 mov r0, r6 + 800a41c: f3af 8000 nop.w + 800a420: f1b0 3fff cmp.w r0, #4294967295 + 800a424: 4681 mov r9, r0 + 800a426: d1d5 bne.n 800a3d4 <_vfiprintf_r+0x198> + 800a428: 89a3 ldrh r3, [r4, #12] + 800a42a: 065b lsls r3, r3, #25 + 800a42c: f53f af7e bmi.w 800a32c <_vfiprintf_r+0xf0> + 800a430: 9809 ldr r0, [sp, #36] ; 0x24 + 800a432: e77d b.n 800a330 <_vfiprintf_r+0xf4> + 800a434: ab03 add r3, sp, #12 + 800a436: 9300 str r3, [sp, #0] + 800a438: 4622 mov r2, r4 + 800a43a: 4b0a ldr r3, [pc, #40] ; (800a464 <_vfiprintf_r+0x228>) + 800a43c: a904 add r1, sp, #16 + 800a43e: 4630 mov r0, r6 + 800a440: f000 f888 bl 800a554 <_printf_i> + 800a444: e7ec b.n 800a420 <_vfiprintf_r+0x1e4> + 800a446: bf00 nop + 800a448: 0800af0c .word 0x0800af0c + 800a44c: 0800af56 .word 0x0800af56 + 800a450: 0800af2c .word 0x0800af2c + 800a454: 0800aeec .word 0x0800aeec + 800a458: 0800af5c .word 0x0800af5c + 800a45c: 0800af60 .word 0x0800af60 + 800a460: 00000000 .word 0x00000000 + 800a464: 0800a217 .word 0x0800a217 + +0800a468 <_printf_common>: + 800a468: e92d 47f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, lr} + 800a46c: 4691 mov r9, r2 + 800a46e: 461f mov r7, r3 + 800a470: 688a ldr r2, [r1, #8] + 800a472: 690b ldr r3, [r1, #16] + 800a474: 4606 mov r6, r0 + 800a476: 4293 cmp r3, r2 + 800a478: bfb8 it lt + 800a47a: 4613 movlt r3, r2 + 800a47c: f8c9 3000 str.w r3, [r9] + 800a480: f891 2043 ldrb.w r2, [r1, #67] ; 0x43 + 800a484: 460c mov r4, r1 + 800a486: f8dd 8020 ldr.w r8, [sp, #32] + 800a48a: b112 cbz r2, 800a492 <_printf_common+0x2a> + 800a48c: 3301 adds r3, #1 + 800a48e: f8c9 3000 str.w r3, [r9] + 800a492: 6823 ldr r3, [r4, #0] + 800a494: 0699 lsls r1, r3, #26 + 800a496: bf42 ittt mi + 800a498: f8d9 3000 ldrmi.w r3, [r9] + 800a49c: 3302 addmi r3, #2 + 800a49e: f8c9 3000 strmi.w r3, [r9] + 800a4a2: 6825 ldr r5, [r4, #0] + 800a4a4: f015 0506 ands.w r5, r5, #6 + 800a4a8: d107 bne.n 800a4ba <_printf_common+0x52> + 800a4aa: f104 0a19 add.w sl, r4, #25 + 800a4ae: 68e3 ldr r3, [r4, #12] + 800a4b0: f8d9 2000 ldr.w r2, [r9] + 800a4b4: 1a9b subs r3, r3, r2 + 800a4b6: 42ab cmp r3, r5 + 800a4b8: dc29 bgt.n 800a50e <_printf_common+0xa6> + 800a4ba: f894 3043 ldrb.w r3, [r4, #67] ; 0x43 + 800a4be: 6822 ldr r2, [r4, #0] + 800a4c0: 3300 adds r3, #0 + 800a4c2: bf18 it ne + 800a4c4: 2301 movne r3, #1 + 800a4c6: 0692 lsls r2, r2, #26 + 800a4c8: d42e bmi.n 800a528 <_printf_common+0xc0> + 800a4ca: f104 0243 add.w r2, r4, #67 ; 0x43 + 800a4ce: 4639 mov r1, r7 + 800a4d0: 4630 mov r0, r6 + 800a4d2: 47c0 blx r8 + 800a4d4: 3001 adds r0, #1 + 800a4d6: d021 beq.n 800a51c <_printf_common+0xb4> + 800a4d8: 6823 ldr r3, [r4, #0] + 800a4da: 68e5 ldr r5, [r4, #12] + 800a4dc: f003 0306 and.w r3, r3, #6 + 800a4e0: 2b04 cmp r3, #4 + 800a4e2: bf18 it ne + 800a4e4: 2500 movne r5, #0 + 800a4e6: f8d9 2000 ldr.w r2, [r9] + 800a4ea: f04f 0900 mov.w r9, #0 + 800a4ee: bf08 it eq + 800a4f0: 1aad subeq r5, r5, r2 + 800a4f2: 68a3 ldr r3, [r4, #8] + 800a4f4: 6922 ldr r2, [r4, #16] + 800a4f6: bf08 it eq + 800a4f8: ea25 75e5 biceq.w r5, r5, r5, asr #31 + 800a4fc: 4293 cmp r3, r2 + 800a4fe: bfc4 itt gt + 800a500: 1a9b subgt r3, r3, r2 + 800a502: 18ed addgt r5, r5, r3 + 800a504: 341a adds r4, #26 + 800a506: 454d cmp r5, r9 + 800a508: d11a bne.n 800a540 <_printf_common+0xd8> + 800a50a: 2000 movs r0, #0 + 800a50c: e008 b.n 800a520 <_printf_common+0xb8> + 800a50e: 2301 movs r3, #1 + 800a510: 4652 mov r2, sl + 800a512: 4639 mov r1, r7 + 800a514: 4630 mov r0, r6 + 800a516: 47c0 blx r8 + 800a518: 3001 adds r0, #1 + 800a51a: d103 bne.n 800a524 <_printf_common+0xbc> + 800a51c: f04f 30ff mov.w r0, #4294967295 + 800a520: e8bd 87f0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, pc} + 800a524: 3501 adds r5, #1 + 800a526: e7c2 b.n 800a4ae <_printf_common+0x46> + 800a528: 2030 movs r0, #48 ; 0x30 + 800a52a: 18e1 adds r1, r4, r3 + 800a52c: f881 0043 strb.w r0, [r1, #67] ; 0x43 + 800a530: 1c5a adds r2, r3, #1 + 800a532: f894 1045 ldrb.w r1, [r4, #69] ; 0x45 + 800a536: 4422 add r2, r4 + 800a538: 3302 adds r3, #2 + 800a53a: f882 1043 strb.w r1, [r2, #67] ; 0x43 + 800a53e: e7c4 b.n 800a4ca <_printf_common+0x62> + 800a540: 2301 movs r3, #1 + 800a542: 4622 mov r2, r4 + 800a544: 4639 mov r1, r7 + 800a546: 4630 mov r0, r6 + 800a548: 47c0 blx r8 + 800a54a: 3001 adds r0, #1 + 800a54c: d0e6 beq.n 800a51c <_printf_common+0xb4> + 800a54e: f109 0901 add.w r9, r9, #1 + 800a552: e7d8 b.n 800a506 <_printf_common+0x9e> + +0800a554 <_printf_i>: + 800a554: e92d 43f0 stmdb sp!, {r4, r5, r6, r7, r8, r9, lr} + 800a558: f101 0c43 add.w ip, r1, #67 ; 0x43 + 800a55c: 460c mov r4, r1 + 800a55e: 7e09 ldrb r1, [r1, #24] + 800a560: b085 sub sp, #20 + 800a562: 296e cmp r1, #110 ; 0x6e + 800a564: 4617 mov r7, r2 + 800a566: 4606 mov r6, r0 + 800a568: 4698 mov r8, r3 + 800a56a: 9a0c ldr r2, [sp, #48] ; 0x30 + 800a56c: f000 80b3 beq.w 800a6d6 <_printf_i+0x182> + 800a570: d822 bhi.n 800a5b8 <_printf_i+0x64> + 800a572: 2963 cmp r1, #99 ; 0x63 + 800a574: d036 beq.n 800a5e4 <_printf_i+0x90> + 800a576: d80a bhi.n 800a58e <_printf_i+0x3a> + 800a578: 2900 cmp r1, #0 + 800a57a: f000 80b9 beq.w 800a6f0 <_printf_i+0x19c> + 800a57e: 2958 cmp r1, #88 ; 0x58 + 800a580: f000 8083 beq.w 800a68a <_printf_i+0x136> + 800a584: f104 0542 add.w r5, r4, #66 ; 0x42 + 800a588: f884 1042 strb.w r1, [r4, #66] ; 0x42 + 800a58c: e032 b.n 800a5f4 <_printf_i+0xa0> + 800a58e: 2964 cmp r1, #100 ; 0x64 + 800a590: d001 beq.n 800a596 <_printf_i+0x42> + 800a592: 2969 cmp r1, #105 ; 0x69 + 800a594: d1f6 bne.n 800a584 <_printf_i+0x30> + 800a596: 6820 ldr r0, [r4, #0] + 800a598: 6813 ldr r3, [r2, #0] + 800a59a: 0605 lsls r5, r0, #24 + 800a59c: f103 0104 add.w r1, r3, #4 + 800a5a0: d52a bpl.n 800a5f8 <_printf_i+0xa4> + 800a5a2: 681b ldr r3, [r3, #0] + 800a5a4: 6011 str r1, [r2, #0] + 800a5a6: 2b00 cmp r3, #0 + 800a5a8: da03 bge.n 800a5b2 <_printf_i+0x5e> + 800a5aa: 222d movs r2, #45 ; 0x2d + 800a5ac: 425b negs r3, r3 + 800a5ae: f884 2043 strb.w r2, [r4, #67] ; 0x43 + 800a5b2: 486f ldr r0, [pc, #444] ; (800a770 <_printf_i+0x21c>) + 800a5b4: 220a movs r2, #10 + 800a5b6: e039 b.n 800a62c <_printf_i+0xd8> + 800a5b8: 2973 cmp r1, #115 ; 0x73 + 800a5ba: f000 809d beq.w 800a6f8 <_printf_i+0x1a4> + 800a5be: d808 bhi.n 800a5d2 <_printf_i+0x7e> + 800a5c0: 296f cmp r1, #111 ; 0x6f + 800a5c2: d020 beq.n 800a606 <_printf_i+0xb2> + 800a5c4: 2970 cmp r1, #112 ; 0x70 + 800a5c6: d1dd bne.n 800a584 <_printf_i+0x30> + 800a5c8: 6823 ldr r3, [r4, #0] + 800a5ca: f043 0320 orr.w r3, r3, #32 + 800a5ce: 6023 str r3, [r4, #0] + 800a5d0: e003 b.n 800a5da <_printf_i+0x86> + 800a5d2: 2975 cmp r1, #117 ; 0x75 + 800a5d4: d017 beq.n 800a606 <_printf_i+0xb2> + 800a5d6: 2978 cmp r1, #120 ; 0x78 + 800a5d8: d1d4 bne.n 800a584 <_printf_i+0x30> + 800a5da: 2378 movs r3, #120 ; 0x78 + 800a5dc: 4865 ldr r0, [pc, #404] ; (800a774 <_printf_i+0x220>) + 800a5de: f884 3045 strb.w r3, [r4, #69] ; 0x45 + 800a5e2: e055 b.n 800a690 <_printf_i+0x13c> + 800a5e4: 6813 ldr r3, [r2, #0] + 800a5e6: f104 0542 add.w r5, r4, #66 ; 0x42 + 800a5ea: 1d19 adds r1, r3, #4 + 800a5ec: 681b ldr r3, [r3, #0] + 800a5ee: 6011 str r1, [r2, #0] + 800a5f0: f884 3042 strb.w r3, [r4, #66] ; 0x42 + 800a5f4: 2301 movs r3, #1 + 800a5f6: e08c b.n 800a712 <_printf_i+0x1be> + 800a5f8: 681b ldr r3, [r3, #0] + 800a5fa: f010 0f40 tst.w r0, #64 ; 0x40 + 800a5fe: 6011 str r1, [r2, #0] + 800a600: bf18 it ne + 800a602: b21b sxthne r3, r3 + 800a604: e7cf b.n 800a5a6 <_printf_i+0x52> + 800a606: 6813 ldr r3, [r2, #0] + 800a608: 6825 ldr r5, [r4, #0] + 800a60a: 1d18 adds r0, r3, #4 + 800a60c: 6010 str r0, [r2, #0] + 800a60e: 0628 lsls r0, r5, #24 + 800a610: d501 bpl.n 800a616 <_printf_i+0xc2> + 800a612: 681b ldr r3, [r3, #0] + 800a614: e002 b.n 800a61c <_printf_i+0xc8> + 800a616: 0668 lsls r0, r5, #25 + 800a618: d5fb bpl.n 800a612 <_printf_i+0xbe> + 800a61a: 881b ldrh r3, [r3, #0] + 800a61c: 296f cmp r1, #111 ; 0x6f + 800a61e: bf14 ite ne + 800a620: 220a movne r2, #10 + 800a622: 2208 moveq r2, #8 + 800a624: 4852 ldr r0, [pc, #328] ; (800a770 <_printf_i+0x21c>) + 800a626: 2100 movs r1, #0 + 800a628: f884 1043 strb.w r1, [r4, #67] ; 0x43 + 800a62c: 6865 ldr r5, [r4, #4] + 800a62e: 2d00 cmp r5, #0 + 800a630: 60a5 str r5, [r4, #8] + 800a632: f2c0 8095 blt.w 800a760 <_printf_i+0x20c> + 800a636: 6821 ldr r1, [r4, #0] + 800a638: f021 0104 bic.w r1, r1, #4 + 800a63c: 6021 str r1, [r4, #0] + 800a63e: 2b00 cmp r3, #0 + 800a640: d13d bne.n 800a6be <_printf_i+0x16a> + 800a642: 2d00 cmp r5, #0 + 800a644: f040 808e bne.w 800a764 <_printf_i+0x210> + 800a648: 4665 mov r5, ip + 800a64a: 2a08 cmp r2, #8 + 800a64c: d10b bne.n 800a666 <_printf_i+0x112> + 800a64e: 6823 ldr r3, [r4, #0] + 800a650: 07db lsls r3, r3, #31 + 800a652: d508 bpl.n 800a666 <_printf_i+0x112> + 800a654: 6923 ldr r3, [r4, #16] + 800a656: 6862 ldr r2, [r4, #4] + 800a658: 429a cmp r2, r3 + 800a65a: bfde ittt le + 800a65c: 2330 movle r3, #48 ; 0x30 + 800a65e: f805 3c01 strble.w r3, [r5, #-1] + 800a662: f105 35ff addle.w r5, r5, #4294967295 + 800a666: ebac 0305 sub.w r3, ip, r5 + 800a66a: 6123 str r3, [r4, #16] + 800a66c: f8cd 8000 str.w r8, [sp] + 800a670: 463b mov r3, r7 + 800a672: aa03 add r2, sp, #12 + 800a674: 4621 mov r1, r4 + 800a676: 4630 mov r0, r6 + 800a678: f7ff fef6 bl 800a468 <_printf_common> + 800a67c: 3001 adds r0, #1 + 800a67e: d14d bne.n 800a71c <_printf_i+0x1c8> + 800a680: f04f 30ff mov.w r0, #4294967295 + 800a684: b005 add sp, #20 + 800a686: e8bd 83f0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, pc} + 800a68a: 4839 ldr r0, [pc, #228] ; (800a770 <_printf_i+0x21c>) + 800a68c: f884 1045 strb.w r1, [r4, #69] ; 0x45 + 800a690: 6813 ldr r3, [r2, #0] + 800a692: 6821 ldr r1, [r4, #0] + 800a694: 1d1d adds r5, r3, #4 + 800a696: 681b ldr r3, [r3, #0] + 800a698: 6015 str r5, [r2, #0] + 800a69a: 060a lsls r2, r1, #24 + 800a69c: d50b bpl.n 800a6b6 <_printf_i+0x162> + 800a69e: 07ca lsls r2, r1, #31 + 800a6a0: bf44 itt mi + 800a6a2: f041 0120 orrmi.w r1, r1, #32 + 800a6a6: 6021 strmi r1, [r4, #0] + 800a6a8: b91b cbnz r3, 800a6b2 <_printf_i+0x15e> + 800a6aa: 6822 ldr r2, [r4, #0] + 800a6ac: f022 0220 bic.w r2, r2, #32 + 800a6b0: 6022 str r2, [r4, #0] + 800a6b2: 2210 movs r2, #16 + 800a6b4: e7b7 b.n 800a626 <_printf_i+0xd2> + 800a6b6: 064d lsls r5, r1, #25 + 800a6b8: bf48 it mi + 800a6ba: b29b uxthmi r3, r3 + 800a6bc: e7ef b.n 800a69e <_printf_i+0x14a> + 800a6be: 4665 mov r5, ip + 800a6c0: fbb3 f1f2 udiv r1, r3, r2 + 800a6c4: fb02 3311 mls r3, r2, r1, r3 + 800a6c8: 5cc3 ldrb r3, [r0, r3] + 800a6ca: f805 3d01 strb.w r3, [r5, #-1]! + 800a6ce: 460b mov r3, r1 + 800a6d0: 2900 cmp r1, #0 + 800a6d2: d1f5 bne.n 800a6c0 <_printf_i+0x16c> + 800a6d4: e7b9 b.n 800a64a <_printf_i+0xf6> + 800a6d6: 6813 ldr r3, [r2, #0] + 800a6d8: 6825 ldr r5, [r4, #0] + 800a6da: 1d18 adds r0, r3, #4 + 800a6dc: 6961 ldr r1, [r4, #20] + 800a6de: 6010 str r0, [r2, #0] + 800a6e0: 0628 lsls r0, r5, #24 + 800a6e2: 681b ldr r3, [r3, #0] + 800a6e4: d501 bpl.n 800a6ea <_printf_i+0x196> + 800a6e6: 6019 str r1, [r3, #0] + 800a6e8: e002 b.n 800a6f0 <_printf_i+0x19c> + 800a6ea: 066a lsls r2, r5, #25 + 800a6ec: d5fb bpl.n 800a6e6 <_printf_i+0x192> + 800a6ee: 8019 strh r1, [r3, #0] + 800a6f0: 2300 movs r3, #0 + 800a6f2: 4665 mov r5, ip + 800a6f4: 6123 str r3, [r4, #16] + 800a6f6: e7b9 b.n 800a66c <_printf_i+0x118> + 800a6f8: 6813 ldr r3, [r2, #0] + 800a6fa: 1d19 adds r1, r3, #4 + 800a6fc: 6011 str r1, [r2, #0] + 800a6fe: 681d ldr r5, [r3, #0] + 800a700: 6862 ldr r2, [r4, #4] + 800a702: 2100 movs r1, #0 + 800a704: 4628 mov r0, r5 + 800a706: f000 f8ed bl 800a8e4 + 800a70a: b108 cbz r0, 800a710 <_printf_i+0x1bc> + 800a70c: 1b40 subs r0, r0, r5 + 800a70e: 6060 str r0, [r4, #4] + 800a710: 6863 ldr r3, [r4, #4] + 800a712: 6123 str r3, [r4, #16] + 800a714: 2300 movs r3, #0 + 800a716: f884 3043 strb.w r3, [r4, #67] ; 0x43 + 800a71a: e7a7 b.n 800a66c <_printf_i+0x118> + 800a71c: 6923 ldr r3, [r4, #16] + 800a71e: 462a mov r2, r5 + 800a720: 4639 mov r1, r7 + 800a722: 4630 mov r0, r6 + 800a724: 47c0 blx r8 + 800a726: 3001 adds r0, #1 + 800a728: d0aa beq.n 800a680 <_printf_i+0x12c> + 800a72a: 6823 ldr r3, [r4, #0] + 800a72c: 079b lsls r3, r3, #30 + 800a72e: d413 bmi.n 800a758 <_printf_i+0x204> + 800a730: 68e0 ldr r0, [r4, #12] + 800a732: 9b03 ldr r3, [sp, #12] + 800a734: 4298 cmp r0, r3 + 800a736: bfb8 it lt + 800a738: 4618 movlt r0, r3 + 800a73a: e7a3 b.n 800a684 <_printf_i+0x130> + 800a73c: 2301 movs r3, #1 + 800a73e: 464a mov r2, r9 + 800a740: 4639 mov r1, r7 + 800a742: 4630 mov r0, r6 + 800a744: 47c0 blx r8 + 800a746: 3001 adds r0, #1 + 800a748: d09a beq.n 800a680 <_printf_i+0x12c> + 800a74a: 3501 adds r5, #1 + 800a74c: 68e3 ldr r3, [r4, #12] + 800a74e: 9a03 ldr r2, [sp, #12] + 800a750: 1a9b subs r3, r3, r2 + 800a752: 42ab cmp r3, r5 + 800a754: dcf2 bgt.n 800a73c <_printf_i+0x1e8> + 800a756: e7eb b.n 800a730 <_printf_i+0x1dc> + 800a758: 2500 movs r5, #0 + 800a75a: f104 0919 add.w r9, r4, #25 + 800a75e: e7f5 b.n 800a74c <_printf_i+0x1f8> + 800a760: 2b00 cmp r3, #0 + 800a762: d1ac bne.n 800a6be <_printf_i+0x16a> + 800a764: 7803 ldrb r3, [r0, #0] + 800a766: f104 0542 add.w r5, r4, #66 ; 0x42 + 800a76a: f884 3042 strb.w r3, [r4, #66] ; 0x42 + 800a76e: e76c b.n 800a64a <_printf_i+0xf6> + 800a770: 0800af67 .word 0x0800af67 + 800a774: 0800af78 .word 0x0800af78 + +0800a778 <_sbrk_r>: + 800a778: b538 push {r3, r4, r5, lr} + 800a77a: 2300 movs r3, #0 + 800a77c: 4c05 ldr r4, [pc, #20] ; (800a794 <_sbrk_r+0x1c>) + 800a77e: 4605 mov r5, r0 + 800a780: 4608 mov r0, r1 + 800a782: 6023 str r3, [r4, #0] + 800a784: f7f6 fa5a bl 8000c3c <_sbrk> + 800a788: 1c43 adds r3, r0, #1 + 800a78a: d102 bne.n 800a792 <_sbrk_r+0x1a> + 800a78c: 6823 ldr r3, [r4, #0] + 800a78e: b103 cbz r3, 800a792 <_sbrk_r+0x1a> + 800a790: 602b str r3, [r5, #0] + 800a792: bd38 pop {r3, r4, r5, pc} + 800a794: 20003d2c .word 0x20003d2c + +0800a798 <__sread>: + 800a798: b510 push {r4, lr} + 800a79a: 460c mov r4, r1 + 800a79c: f9b1 100e ldrsh.w r1, [r1, #14] + 800a7a0: f000 f8b0 bl 800a904 <_read_r> + 800a7a4: 2800 cmp r0, #0 + 800a7a6: bfab itete ge + 800a7a8: 6d63 ldrge r3, [r4, #84] ; 0x54 + 800a7aa: 89a3 ldrhlt r3, [r4, #12] + 800a7ac: 181b addge r3, r3, r0 + 800a7ae: f423 5380 biclt.w r3, r3, #4096 ; 0x1000 + 800a7b2: bfac ite ge + 800a7b4: 6563 strge r3, [r4, #84] ; 0x54 + 800a7b6: 81a3 strhlt r3, [r4, #12] + 800a7b8: bd10 pop {r4, pc} + +0800a7ba <__swrite>: + 800a7ba: e92d 41f0 stmdb sp!, {r4, r5, r6, r7, r8, lr} + 800a7be: 461f mov r7, r3 + 800a7c0: 898b ldrh r3, [r1, #12] + 800a7c2: 4605 mov r5, r0 + 800a7c4: 05db lsls r3, r3, #23 + 800a7c6: 460c mov r4, r1 + 800a7c8: 4616 mov r6, r2 + 800a7ca: d505 bpl.n 800a7d8 <__swrite+0x1e> + 800a7cc: 2302 movs r3, #2 + 800a7ce: 2200 movs r2, #0 + 800a7d0: f9b1 100e ldrsh.w r1, [r1, #14] + 800a7d4: f000 f874 bl 800a8c0 <_lseek_r> + 800a7d8: 89a3 ldrh r3, [r4, #12] + 800a7da: 4632 mov r2, r6 + 800a7dc: f423 5380 bic.w r3, r3, #4096 ; 0x1000 + 800a7e0: 81a3 strh r3, [r4, #12] + 800a7e2: f9b4 100e ldrsh.w r1, [r4, #14] + 800a7e6: 463b mov r3, r7 + 800a7e8: 4628 mov r0, r5 + 800a7ea: e8bd 41f0 ldmia.w sp!, {r4, r5, r6, r7, r8, lr} + 800a7ee: f000 b823 b.w 800a838 <_write_r> + +0800a7f2 <__sseek>: + 800a7f2: b510 push {r4, lr} + 800a7f4: 460c mov r4, r1 + 800a7f6: f9b1 100e ldrsh.w r1, [r1, #14] + 800a7fa: f000 f861 bl 800a8c0 <_lseek_r> + 800a7fe: 1c43 adds r3, r0, #1 + 800a800: 89a3 ldrh r3, [r4, #12] + 800a802: bf15 itete ne + 800a804: 6560 strne r0, [r4, #84] ; 0x54 + 800a806: f423 5380 biceq.w r3, r3, #4096 ; 0x1000 + 800a80a: f443 5380 orrne.w r3, r3, #4096 ; 0x1000 + 800a80e: 81a3 strheq r3, [r4, #12] + 800a810: bf18 it ne + 800a812: 81a3 strhne r3, [r4, #12] + 800a814: bd10 pop {r4, pc} + +0800a816 <__sclose>: + 800a816: f9b1 100e ldrsh.w r1, [r1, #14] + 800a81a: f000 b81f b.w 800a85c <_close_r> + +0800a81e <__ascii_wctomb>: + 800a81e: b149 cbz r1, 800a834 <__ascii_wctomb+0x16> + 800a820: 2aff cmp r2, #255 ; 0xff + 800a822: bf8b itete hi + 800a824: 238a movhi r3, #138 ; 0x8a + 800a826: 700a strbls r2, [r1, #0] + 800a828: 6003 strhi r3, [r0, #0] + 800a82a: 2001 movls r0, #1 + 800a82c: bf88 it hi + 800a82e: f04f 30ff movhi.w r0, #4294967295 + 800a832: 4770 bx lr + 800a834: 4608 mov r0, r1 + 800a836: 4770 bx lr + +0800a838 <_write_r>: + 800a838: b538 push {r3, r4, r5, lr} + 800a83a: 4605 mov r5, r0 + 800a83c: 4608 mov r0, r1 + 800a83e: 4611 mov r1, r2 + 800a840: 2200 movs r2, #0 + 800a842: 4c05 ldr r4, [pc, #20] ; (800a858 <_write_r+0x20>) + 800a844: 6022 str r2, [r4, #0] + 800a846: 461a mov r2, r3 + 800a848: f7f8 fe9c bl 8003584 <_write> + 800a84c: 1c43 adds r3, r0, #1 + 800a84e: d102 bne.n 800a856 <_write_r+0x1e> + 800a850: 6823 ldr r3, [r4, #0] + 800a852: b103 cbz r3, 800a856 <_write_r+0x1e> + 800a854: 602b str r3, [r5, #0] + 800a856: bd38 pop {r3, r4, r5, pc} + 800a858: 20003d2c .word 0x20003d2c + +0800a85c <_close_r>: + 800a85c: b538 push {r3, r4, r5, lr} + 800a85e: 2300 movs r3, #0 + 800a860: 4c05 ldr r4, [pc, #20] ; (800a878 <_close_r+0x1c>) + 800a862: 4605 mov r5, r0 + 800a864: 4608 mov r0, r1 + 800a866: 6023 str r3, [r4, #0] + 800a868: f7f6 f9b7 bl 8000bda <_close> + 800a86c: 1c43 adds r3, r0, #1 + 800a86e: d102 bne.n 800a876 <_close_r+0x1a> + 800a870: 6823 ldr r3, [r4, #0] + 800a872: b103 cbz r3, 800a876 <_close_r+0x1a> + 800a874: 602b str r3, [r5, #0] + 800a876: bd38 pop {r3, r4, r5, pc} + 800a878: 20003d2c .word 0x20003d2c + +0800a87c <_fstat_r>: + 800a87c: b538 push {r3, r4, r5, lr} + 800a87e: 2300 movs r3, #0 + 800a880: 4c06 ldr r4, [pc, #24] ; (800a89c <_fstat_r+0x20>) + 800a882: 4605 mov r5, r0 + 800a884: 4608 mov r0, r1 + 800a886: 4611 mov r1, r2 + 800a888: 6023 str r3, [r4, #0] + 800a88a: f7f6 f9b1 bl 8000bf0 <_fstat> + 800a88e: 1c43 adds r3, r0, #1 + 800a890: d102 bne.n 800a898 <_fstat_r+0x1c> + 800a892: 6823 ldr r3, [r4, #0] + 800a894: b103 cbz r3, 800a898 <_fstat_r+0x1c> + 800a896: 602b str r3, [r5, #0] + 800a898: bd38 pop {r3, r4, r5, pc} + 800a89a: bf00 nop + 800a89c: 20003d2c .word 0x20003d2c + +0800a8a0 <_isatty_r>: + 800a8a0: b538 push {r3, r4, r5, lr} + 800a8a2: 2300 movs r3, #0 + 800a8a4: 4c05 ldr r4, [pc, #20] ; (800a8bc <_isatty_r+0x1c>) + 800a8a6: 4605 mov r5, r0 + 800a8a8: 4608 mov r0, r1 + 800a8aa: 6023 str r3, [r4, #0] + 800a8ac: f7f6 f9af bl 8000c0e <_isatty> + 800a8b0: 1c43 adds r3, r0, #1 + 800a8b2: d102 bne.n 800a8ba <_isatty_r+0x1a> + 800a8b4: 6823 ldr r3, [r4, #0] + 800a8b6: b103 cbz r3, 800a8ba <_isatty_r+0x1a> + 800a8b8: 602b str r3, [r5, #0] + 800a8ba: bd38 pop {r3, r4, r5, pc} + 800a8bc: 20003d2c .word 0x20003d2c + +0800a8c0 <_lseek_r>: + 800a8c0: b538 push {r3, r4, r5, lr} + 800a8c2: 4605 mov r5, r0 + 800a8c4: 4608 mov r0, r1 + 800a8c6: 4611 mov r1, r2 + 800a8c8: 2200 movs r2, #0 + 800a8ca: 4c05 ldr r4, [pc, #20] ; (800a8e0 <_lseek_r+0x20>) + 800a8cc: 6022 str r2, [r4, #0] + 800a8ce: 461a mov r2, r3 + 800a8d0: f7f6 f9a7 bl 8000c22 <_lseek> + 800a8d4: 1c43 adds r3, r0, #1 + 800a8d6: d102 bne.n 800a8de <_lseek_r+0x1e> + 800a8d8: 6823 ldr r3, [r4, #0] + 800a8da: b103 cbz r3, 800a8de <_lseek_r+0x1e> + 800a8dc: 602b str r3, [r5, #0] + 800a8de: bd38 pop {r3, r4, r5, pc} + 800a8e0: 20003d2c .word 0x20003d2c + +0800a8e4 : + 800a8e4: b510 push {r4, lr} + 800a8e6: b2c9 uxtb r1, r1 + 800a8e8: 4402 add r2, r0 + 800a8ea: 4290 cmp r0, r2 + 800a8ec: 4603 mov r3, r0 + 800a8ee: d101 bne.n 800a8f4 + 800a8f0: 2300 movs r3, #0 + 800a8f2: e003 b.n 800a8fc + 800a8f4: 781c ldrb r4, [r3, #0] + 800a8f6: 3001 adds r0, #1 + 800a8f8: 428c cmp r4, r1 + 800a8fa: d1f6 bne.n 800a8ea + 800a8fc: 4618 mov r0, r3 + 800a8fe: bd10 pop {r4, pc} + +0800a900 <__malloc_lock>: + 800a900: 4770 bx lr + +0800a902 <__malloc_unlock>: + 800a902: 4770 bx lr + +0800a904 <_read_r>: + 800a904: b538 push {r3, r4, r5, lr} + 800a906: 4605 mov r5, r0 + 800a908: 4608 mov r0, r1 + 800a90a: 4611 mov r1, r2 + 800a90c: 2200 movs r2, #0 + 800a90e: 4c05 ldr r4, [pc, #20] ; (800a924 <_read_r+0x20>) + 800a910: 6022 str r2, [r4, #0] + 800a912: 461a mov r2, r3 + 800a914: f7f8 fe26 bl 8003564 <_read> + 800a918: 1c43 adds r3, r0, #1 + 800a91a: d102 bne.n 800a922 <_read_r+0x1e> + 800a91c: 6823 ldr r3, [r4, #0] + 800a91e: b103 cbz r3, 800a922 <_read_r+0x1e> + 800a920: 602b str r3, [r5, #0] + 800a922: bd38 pop {r3, r4, r5, pc} + 800a924: 20003d2c .word 0x20003d2c + +0800a928 <_init>: + 800a928: b5f8 push {r3, r4, r5, r6, r7, lr} + 800a92a: bf00 nop + 800a92c: bcf8 pop {r3, r4, r5, r6, r7} + 800a92e: bc08 pop {r3} + 800a930: 469e mov lr, r3 + 800a932: 4770 bx lr + +0800a934 <_fini>: + 800a934: b5f8 push {r3, r4, r5, r6, r7, lr} + 800a936: bf00 nop + 800a938: bcf8 pop {r3, r4, r5, r6, r7} + 800a93a: bc08 pop {r3} + 800a93c: 469e mov lr, r3 + 800a93e: 4770 bx lr diff --git a/SEW-EXA1/Debug/SEW-EXA1.map b/SEW-EXA1/Debug/SEW-EXA1.map new file mode 100644 index 0000000..8e56778 --- /dev/null +++ b/SEW-EXA1/Debug/SEW-EXA1.map @@ -0,0 +1,14486 @@ +Archive member included to satisfy reference by file (symbol) + +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + NxFunc/stm32motos/stm32motos.o (atoi) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + Core/Src/syscalls.o (__errno) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o (exit) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) (_global_impure_ptr) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o (__libc_init_array) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + NxFunc/comm/comm.o (memcmp) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + NxBase/canctrl.o (memcpy) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o (memset) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + NxBase/buttons.o (printf) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + NxBase/console.o (putchar) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + NxBase/buttons.o (puts) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + Users/Config/config.o (sprintf) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + NxBase/console.o (strcmp) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + NxBase/console.o (strcpy) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strlen.o) + NxBase/shell.o (strlen) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + NxBase/console.o (strncpy) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) (_strtol_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) (__swbuf_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) (__swsetup_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) (_fflush_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) (__sinit) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) (_fwalk) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) (__locale_ctype_ptr_l) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) (__smakebuf_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) (__ascii_mbtowc) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) (_free_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) (_malloc_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) (_svfprintf_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) (_vfprintf_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) (_printf_i) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) (_putc_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) (_sbrk_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) (__sread) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) (__ascii_wctomb) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) (_write_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) (_close_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) (_ctype_) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) (_fstat_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) (__sfvwrite_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) (_isatty_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) (_lseek_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) (memchr) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) (memmove) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) (__malloc_lock) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) (_realloc_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) (_read_r) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) (errno) +c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) (_malloc_usable_size_r) + +Allocating common symbols +Common symbol size file + +g_buttonCtrl 0x10c NxBase/buttons.o +g_cmdHistory 0x1f4 NxBase/console.o +g_uCtrl2 0x38 NxBase/serial.o +g_usart3RBuff 0x80 NxBase/serial.o +g_cmdList 0x280 NxBase/shell.o +errno 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) +hcan 0x28 Core/Src/can.o +uwTick 0x4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o +g_usart1TBuff 0x80 NxBase/serial.o +pFlash 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o +g_one2onecommCtrl 0x10 NxFunc/modbus/one2onecomm.o +g_efCommCtrl 0x1c NxFunc/modbus/ef_a.o +g_headCtrl 0x2418 Users/App/sewhead/sewhead.o +g_usart2RBuff 0x80 NxBase/serial.o +g_modBusMCtrl 0x24 NxFunc/modbus/modbus_m.o +g_encryptList 0x80 NxBase/encrypt.o +g_usart3TBuff 0x80 NxBase/serial.o +g_canTxCtrl 0x210 NxBase/canctrl.o +g_workCtrl 0x98 Users/App/workctrl/workctrl.o +g_one2oneCtrl 0x1dc NxFunc/modbus/one2onecomm.o +g_usart1RBuff 0x80 NxBase/serial.o +g_mtCommCtrl 0x48 NxFunc/comm/mtcomm.o +g_uCtrl1 0x38 NxBase/serial.o +g_moto1TimerCtrl 0x80 NxFunc/stm32motos/stm32motos.o +g_uCtrl3 0x38 NxBase/serial.o +g_cmdLine 0x84 NxBase/console.o +g_rs485Ctrl 0x504 NxFunc/modbus/modbus_m.o +g_asyncefCtrl 0x278 NxFunc/modbus/ef_a.o +g_canRxCtrl 0x24c NxBase/canctrl.o +g_usart2TBuff 0x80 NxBase/serial.o +g_triggerCtrlList 0xa0 NxBase/trigger.o +g_wkPara 0x400 Users/App/workctrl/para.o + +Discarded input sections + + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + .data 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + .text 0x0000000000000000 0x74 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .ARM.extab 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .ARM.exidx 0x0000000000000000 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .ARM.attributes + 0x0000000000000000 0x1b c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/can.o + .text 0x0000000000000000 0x0 Core/Src/can.o + .data 0x0000000000000000 0x0 Core/Src/can.o + .bss 0x0000000000000000 0x0 Core/Src/can.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/can.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/can.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/can.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/can.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/can.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/can.o + .text.HAL_CAN_MspDeInit + 0x0000000000000000 0x48 Core/Src/can.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/gpio.o + .text 0x0000000000000000 0x0 Core/Src/gpio.o + .data 0x0000000000000000 0x0 Core/Src/gpio.o + .bss 0x0000000000000000 0x0 Core/Src/gpio.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/gpio.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/gpio.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/gpio.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/gpio.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/gpio.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x20f Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x2e Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x22 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x22 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x8e Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x51 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xef Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x6a Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1df Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1c Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x22 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x6d Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x174 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x5c Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x5be Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x114 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x27 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x144 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x30 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x3c Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x408 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x57 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x88 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x24f Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x141 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x2be Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x135 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x8d Core/Src/gpio.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x28 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x2a Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x90 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x287 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x57a Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x22a Core/Src/gpio.o + .debug_macro 0x0000000000000000 0x1be Core/Src/gpio.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/main.o + .text 0x0000000000000000 0x0 Core/Src/main.o + .data 0x0000000000000000 0x0 Core/Src/main.o + .bss 0x0000000000000000 0x0 Core/Src/main.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/main.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/main.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/main.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/main.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/main.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/main.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/main.o + .debug_macro 0x0000000000000000 0x20f Core/Src/main.o + .debug_macro 0x0000000000000000 0x2e Core/Src/main.o + .debug_macro 0x0000000000000000 0x22 Core/Src/main.o + .debug_macro 0x0000000000000000 0x22 Core/Src/main.o + .debug_macro 0x0000000000000000 0x8e Core/Src/main.o + .debug_macro 0x0000000000000000 0x51 Core/Src/main.o + .debug_macro 0x0000000000000000 0xef Core/Src/main.o + .debug_macro 0x0000000000000000 0x6a Core/Src/main.o + .debug_macro 0x0000000000000000 0x1df Core/Src/main.o + .debug_macro 0x0000000000000000 0x1c Core/Src/main.o + .debug_macro 0x0000000000000000 0x22 Core/Src/main.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/main.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/main.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/main.o + .debug_macro 0x0000000000000000 0x6d Core/Src/main.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/main.o + .debug_macro 0x0000000000000000 0x174 Core/Src/main.o + .debug_macro 0x0000000000000000 0x5c Core/Src/main.o + .debug_macro 0x0000000000000000 0x5be Core/Src/main.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/main.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/main.o + .debug_macro 0x0000000000000000 0x114 Core/Src/main.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/main.o + .debug_macro 0x0000000000000000 0x27 Core/Src/main.o + .debug_macro 0x0000000000000000 0x144 Core/Src/main.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/main.o + .debug_macro 0x0000000000000000 0x30 Core/Src/main.o + .debug_macro 0x0000000000000000 0x3c Core/Src/main.o + .debug_macro 0x0000000000000000 0x408 Core/Src/main.o + .debug_macro 0x0000000000000000 0x57 Core/Src/main.o + .debug_macro 0x0000000000000000 0x88 Core/Src/main.o + .debug_macro 0x0000000000000000 0x24f Core/Src/main.o + .debug_macro 0x0000000000000000 0x141 Core/Src/main.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/main.o + .debug_macro 0x0000000000000000 0x2be Core/Src/main.o + .debug_macro 0x0000000000000000 0x135 Core/Src/main.o + .debug_macro 0x0000000000000000 0x8d Core/Src/main.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/main.o + .debug_macro 0x0000000000000000 0x28 Core/Src/main.o + .debug_macro 0x0000000000000000 0x2a Core/Src/main.o + .debug_macro 0x0000000000000000 0x90 Core/Src/main.o + .debug_macro 0x0000000000000000 0x287 Core/Src/main.o + .debug_macro 0x0000000000000000 0x57a Core/Src/main.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/main.o + .debug_macro 0x0000000000000000 0x22a Core/Src/main.o + .debug_macro 0x0000000000000000 0x1be Core/Src/main.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_hal_msp.o + .text 0x0000000000000000 0x0 Core/Src/stm32f1xx_hal_msp.o + .data 0x0000000000000000 0x0 Core/Src/stm32f1xx_hal_msp.o + .bss 0x0000000000000000 0x0 Core/Src/stm32f1xx_hal_msp.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x20f Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x2e Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x8e Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x51 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xef Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x6a Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1df Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1c Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x6d Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x174 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x5c Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x5be Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x114 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x27 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x144 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x30 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x3c Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x408 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x57 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x88 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x24f Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x141 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x2be Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x135 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x8d Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x28 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x2a Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x90 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x287 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x57a Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x22a Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000000000 0x1be Core/Src/stm32f1xx_hal_msp.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/stm32f1xx_it.o + .text 0x0000000000000000 0x0 Core/Src/stm32f1xx_it.o + .data 0x0000000000000000 0x0 Core/Src/stm32f1xx_it.o + .bss 0x0000000000000000 0x0 Core/Src/stm32f1xx_it.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x20f Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x2e Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x8e Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x51 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xef Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x6a Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1df Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x22 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x6d Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x174 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x5c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x5be Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x114 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x27 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x144 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x30 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x3c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x408 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x57 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x88 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x24f Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x141 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x2be Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x135 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x8d Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x28 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x2a Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x90 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x287 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x57a Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x22a Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1be Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x46 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x18 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x3c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x34 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x16 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x35 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x32a Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x10 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x52 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1f Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x43 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x20 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1a3 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x10 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x52 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x40 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x10 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x40 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xd7 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1c Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x3d Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x16 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x145 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x16 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x16 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x29 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x16 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x20 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x1e1 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0x224 Core/Src/stm32f1xx_it.o + .debug_macro 0x0000000000000000 0xf2 Core/Src/stm32f1xx_it.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/syscalls.o + .text 0x0000000000000000 0x0 Core/Src/syscalls.o + .data 0x0000000000000000 0x0 Core/Src/syscalls.o + .bss 0x0000000000000000 0x0 Core/Src/syscalls.o + .bss.__env 0x0000000000000000 0x4 Core/Src/syscalls.o + .data.environ 0x0000000000000000 0x4 Core/Src/syscalls.o + .text.initialise_monitor_handles + 0x0000000000000000 0xc Core/Src/syscalls.o + .text._getpid 0x0000000000000000 0xe Core/Src/syscalls.o + .text._kill 0x0000000000000000 0x20 Core/Src/syscalls.o + .text._exit 0x0000000000000000 0x14 Core/Src/syscalls.o + .text._read 0x0000000000000000 0x3a Core/Src/syscalls.o + .text._write 0x0000000000000000 0x38 Core/Src/syscalls.o + .text._open 0x0000000000000000 0x1a Core/Src/syscalls.o + .text._wait 0x0000000000000000 0x1e Core/Src/syscalls.o + .text._unlink 0x0000000000000000 0x1e Core/Src/syscalls.o + .text._times 0x0000000000000000 0x16 Core/Src/syscalls.o + .text._stat 0x0000000000000000 0x1e Core/Src/syscalls.o + .text._link 0x0000000000000000 0x20 Core/Src/syscalls.o + .text._fork 0x0000000000000000 0x16 Core/Src/syscalls.o + .text._execve 0x0000000000000000 0x22 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x22 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x18 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x3c Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x34 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x174 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x52 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x1f Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x43 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x20 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x1a3 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x35 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x10 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x6a Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x1c Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x52 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x40 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x10 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x40 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0xd7 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x1c Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x3d Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x16 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x16 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x29 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x10 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x16 Core/Src/syscalls.o + .debug_macro 0x0000000000000000 0x145 Core/Src/syscalls.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/sysmem.o + .text 0x0000000000000000 0x0 Core/Src/sysmem.o + .data 0x0000000000000000 0x0 Core/Src/sysmem.o + .bss 0x0000000000000000 0x0 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x10 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x22 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x40 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x18 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x94 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x3c Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x34 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x174 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x57 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x52 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x1f Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x43 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x20 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x1a3 Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0xef Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x6a Core/Src/sysmem.o + .debug_macro 0x0000000000000000 0x1df Core/Src/sysmem.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/system_stm32f1xx.o + .text 0x0000000000000000 0x0 Core/Src/system_stm32f1xx.o + .data 0x0000000000000000 0x0 Core/Src/system_stm32f1xx.o + .bss 0x0000000000000000 0x0 Core/Src/system_stm32f1xx.o + .text.SystemCoreClockUpdate + 0x0000000000000000 0xd8 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x2e Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x22 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x22 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x8e Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x51 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xef Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x6a Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x1df Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x1c Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x22 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x6d Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x20f Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x174 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x5c Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x5be Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x114 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x27 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x144 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x30 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x3c Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x408 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x57 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x88 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x24f Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0x141 Core/Src/system_stm32f1xx.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/system_stm32f1xx.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/tim.o + .text 0x0000000000000000 0x0 Core/Src/tim.o + .data 0x0000000000000000 0x0 Core/Src/tim.o + .bss 0x0000000000000000 0x0 Core/Src/tim.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/tim.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/tim.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/tim.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/tim.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/tim.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x20f Core/Src/tim.o + .debug_macro 0x0000000000000000 0x2e Core/Src/tim.o + .debug_macro 0x0000000000000000 0x22 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x22 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x8e Core/Src/tim.o + .debug_macro 0x0000000000000000 0x51 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xef Core/Src/tim.o + .debug_macro 0x0000000000000000 0x6a Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1df Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1c Core/Src/tim.o + .debug_macro 0x0000000000000000 0x22 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/tim.o + .debug_macro 0x0000000000000000 0x6d Core/Src/tim.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x174 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x5c Core/Src/tim.o + .debug_macro 0x0000000000000000 0x5be Core/Src/tim.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/tim.o + .debug_macro 0x0000000000000000 0x114 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/tim.o + .debug_macro 0x0000000000000000 0x27 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x144 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/tim.o + .debug_macro 0x0000000000000000 0x30 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x3c Core/Src/tim.o + .debug_macro 0x0000000000000000 0x408 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x57 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x88 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x24f Core/Src/tim.o + .debug_macro 0x0000000000000000 0x141 Core/Src/tim.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x2be Core/Src/tim.o + .debug_macro 0x0000000000000000 0x135 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x8d Core/Src/tim.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x28 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x2a Core/Src/tim.o + .debug_macro 0x0000000000000000 0x90 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x287 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x57a Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/tim.o + .debug_macro 0x0000000000000000 0x22a Core/Src/tim.o + .debug_macro 0x0000000000000000 0x1be Core/Src/tim.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .group 0x0000000000000000 0xc Core/Src/usart.o + .text 0x0000000000000000 0x0 Core/Src/usart.o + .data 0x0000000000000000 0x0 Core/Src/usart.o + .bss 0x0000000000000000 0x0 Core/Src/usart.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Core/Src/usart.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Core/Src/usart.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Core/Src/usart.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Core/Src/usart.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Core/Src/usart.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xa60 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x20f Core/Src/usart.o + .debug_macro 0x0000000000000000 0x2e Core/Src/usart.o + .debug_macro 0x0000000000000000 0x22 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x22 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x8e Core/Src/usart.o + .debug_macro 0x0000000000000000 0x51 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xef Core/Src/usart.o + .debug_macro 0x0000000000000000 0x6a Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1df Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1c Core/Src/usart.o + .debug_macro 0x0000000000000000 0x22 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xc3 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xd23 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xfd8c Core/Src/usart.o + .debug_macro 0x0000000000000000 0x6d Core/Src/usart.o + .debug_macro 0x0000000000000000 0x3468 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x174 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x5c Core/Src/usart.o + .debug_macro 0x0000000000000000 0x5be Core/Src/usart.o + .debug_macro 0x0000000000000000 0x4d5 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1cb Core/Src/usart.o + .debug_macro 0x0000000000000000 0x114 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1ea Core/Src/usart.o + .debug_macro 0x0000000000000000 0x27 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x144 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1bc Core/Src/usart.o + .debug_macro 0x0000000000000000 0x30 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x3c Core/Src/usart.o + .debug_macro 0x0000000000000000 0x408 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x57 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x88 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x24f Core/Src/usart.o + .debug_macro 0x0000000000000000 0x141 Core/Src/usart.o + .debug_macro 0x0000000000000000 0xb5 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x2be Core/Src/usart.o + .debug_macro 0x0000000000000000 0x135 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x8d Core/Src/usart.o + .debug_macro 0x0000000000000000 0xd0 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x28 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x2a Core/Src/usart.o + .debug_macro 0x0000000000000000 0x90 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x287 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x57a Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1b4 Core/Src/usart.o + .debug_macro 0x0000000000000000 0x22a Core/Src/usart.o + .debug_macro 0x0000000000000000 0x1be Core/Src/usart.o + .text 0x0000000000000000 0x14 Core/Startup/startup_stm32f103rctx.o + .data 0x0000000000000000 0x0 Core/Startup/startup_stm32f103rctx.o + .bss 0x0000000000000000 0x0 Core/Startup/startup_stm32f103rctx.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DeInit + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_MspInit + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_MspDeInit + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetTickPrio + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_SetTickFreq + 0x0000000000000000 0x50 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetTickFreq + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_Delay + 0x0000000000000000 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_SuspendTick + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_ResumeTick + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetHalVersion + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetREVID + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetDEVID + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetUIDw0 + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetUIDw1 + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_GetUIDw2 + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_EnableDBGSleepMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_DisableDBGSleepMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_EnableDBGStopMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_DisableDBGStopMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_EnableDBGStandbyMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .text.HAL_DBGMCU_DisableDBGStandbyMode + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_DeInit + 0x0000000000000000 0x46 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_MspInit + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_MspDeInit + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_Stop + 0x0000000000000000 0x92 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_RequestSleep + 0x0000000000000000 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_WakeUp + 0x0000000000000000 0x80 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_IsSleepActive + 0x0000000000000000 0x3e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_AbortTxRequest + 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_GetTxMailboxesFreeLevel + 0x0000000000000000 0x68 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_IsTxMessagePending + 0x0000000000000000 0x46 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_GetTxTimestamp + 0x0000000000000000 0x5a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_TxMailbox0CompleteCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_TxMailbox1CompleteCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_TxMailbox2CompleteCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_RxFifo0MsgPendingCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_RxFifo0FullCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_ErrorCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_GetState + 0x0000000000000000 0x4e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_GetError + 0x0000000000000000 0x16 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .text.HAL_CAN_ResetError + 0x0000000000000000 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_DisableIRQ + 0x0000000000000000 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_GetPendingIRQ + 0x0000000000000000 0x40 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_SetPendingIRQ + 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_ClearPendingIRQ + 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_GetActive + 0x0000000000000000 0x40 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_GetPriority + 0x0000000000000000 0x4c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.NVIC_DecodePriority + 0x0000000000000000 0x6c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_SystemReset + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_DisableIRQ + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_SystemReset + 0x0000000000000000 0x8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_GetPriorityGrouping + 0x0000000000000000 0xe Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_GetPriority + 0x0000000000000000 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_SetPendingIRQ + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_GetPendingIRQ + 0x0000000000000000 0x1e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_ClearPendingIRQ + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_GetActive + 0x0000000000000000 0x1e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_SYSTICK_CLKSourceConfig + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_SYSTICK_IRQHandler + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_SYSTICK_Callback + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_Init + 0x0000000000000000 0xec Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_DeInit + 0x0000000000000000 0xf0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_Start + 0x0000000000000000 0x84 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_Start_IT + 0x0000000000000000 0xbe Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_Abort + 0x0000000000000000 0x74 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_Abort_IT + 0x0000000000000000 0x210 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_PollForTransfer + 0x0000000000000000 0x77c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_IRQHandler + 0x0000000000000000 0x478 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_RegisterCallback + 0x0000000000000000 0x90 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_UnRegisterCallback + 0x0000000000000000 0xac Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_GetState + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.HAL_DMA_GetError + 0x0000000000000000 0x16 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .text.DMA_SetConfig + 0x0000000000000000 0x5a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_info 0x0000000000000000 0x7b1 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_abbrev 0x0000000000000000 0x1fe Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_aranges + 0x0000000000000000 0x80 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_ranges 0x0000000000000000 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_line 0x0000000000000000 0xf07 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_str 0x0000000000000000 0x8b42c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .debug_frame 0x0000000000000000 0x20c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_SetConfigLine + 0x0000000000000000 0x14c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_GetConfigLine + 0x0000000000000000 0xf0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_ClearConfigLine + 0x0000000000000000 0xc0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_RegisterCallback + 0x0000000000000000 0x32 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_GetHandle + 0x0000000000000000 0x26 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_IRQHandler + 0x0000000000000000 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_GetPending + 0x0000000000000000 0x40 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_ClearPending + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .text.HAL_EXTI_GenerateSWI + 0x0000000000000000 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_info 0x0000000000000000 0x5d9 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_abbrev 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_aranges + 0x0000000000000000 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_ranges 0x0000000000000000 0x50 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_line 0x0000000000000000 0x740 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_str 0x0000000000000000 0x8b211 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .debug_frame 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_Program + 0x0000000000000000 0xe0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_Program_IT + 0x0000000000000000 0x90 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_IRQHandler + 0x0000000000000000 0x1cc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_EndOfOperationCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_OperationErrorCallback + 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_Unlock + 0x0000000000000000 0x4c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_Lock + 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_OB_Unlock + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_OB_Lock + 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_OB_Launch + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.HAL_FLASH_GetError + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.FLASH_Program_HalfWord + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.FLASH_WaitForLastOperation + 0x0000000000000000 0x8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .text.FLASH_SetErrorCode + 0x0000000000000000 0xa0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_info 0x0000000000000000 0x5a4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_abbrev 0x0000000000000000 0x210 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_aranges + 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_ranges 0x0000000000000000 0x78 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_line 0x0000000000000000 0x83b Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_str 0x0000000000000000 0x8b327 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .debug_frame 0x0000000000000000 0x214 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + COMMON 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_Erase + 0x0000000000000000 0xd8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_Erase_IT + 0x0000000000000000 0x84 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_OBErase + 0x0000000000000000 0x84 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_OBProgram + 0x0000000000000000 0xf8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_OBGetConfig + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.HAL_FLASHEx_OBGetUserData + 0x0000000000000000 0x40 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_MassErase + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_EnableWRP + 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_DisableWRP + 0x0000000000000000 0x140 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_RDP_LevelConfig + 0x0000000000000000 0xa0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_UserConfig + 0x0000000000000000 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_ProgramData + 0x0000000000000000 0x68 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_GetWRP + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_GetRDP + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_OB_GetUser + 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .text.FLASH_PageErase + 0x0000000000000000 0x40 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_info 0x0000000000000000 0x827 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_abbrev 0x0000000000000000 0x21b Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_aranges + 0x0000000000000000 0x98 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_ranges 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1a0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_line 0x0000000000000000 0x88c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_str 0x0000000000000000 0x8b4eb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .debug_frame 0x0000000000000000 0x258 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_DeInit + 0x0000000000000000 0x198 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_ReadPin + 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_WritePin + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_TogglePin + 0x0000000000000000 0x32 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_LockPin + 0x0000000000000000 0x4e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_EXTI_IRQHandler + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .text.HAL_GPIO_EXTI_Callback + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .text.HAL_GPIOEx_ConfigEventout + 0x0000000000000000 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .text.HAL_GPIOEx_EnableEventout + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .text.HAL_GPIOEx_DisableEventout + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_info 0x0000000000000000 0x22d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_abbrev 0x0000000000000000 0xfe Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_aranges + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_ranges 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_line 0x0000000000000000 0x67a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_str 0x0000000000000000 0x8b092 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .debug_frame 0x0000000000000000 0x78 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.PWR_OverloadWfe + 0x0000000000000000 0x10 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DeInit + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnableBkUpAccess + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DisableBkUpAccess + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_ConfigPVD + 0x0000000000000000 0xbc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnablePVD + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DisablePVD + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnableWakeUpPin + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DisableWakeUpPin + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnterSLEEPMode + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnterSTOPMode + 0x0000000000000000 0x64 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnterSTANDBYMode + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnableSleepOnExit + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DisableSleepOnExit + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_EnableSEVOnPend + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_DisableSEVOnPend + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_PVD_IRQHandler + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .text.HAL_PWR_PVDCallback + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_info 0x0000000000000000 0x6e2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_abbrev 0x0000000000000000 0x1f2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_aranges + 0x0000000000000000 0xa8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_ranges 0x0000000000000000 0x98 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1ee Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_line 0x0000000000000000 0x7c3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_str 0x0000000000000000 0x8b5b4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .debug_frame 0x0000000000000000 0x270 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_DeInit + 0x0000000000000000 0x134 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_OscConfig + 0x0000000000000000 0x500 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_ClockConfig + 0x0000000000000000 0x1d4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_MCOConfig + 0x0000000000000000 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_EnableCSS + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_DisableCSS + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .rodata 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetSysClockFreq + 0x0000000000000000 0xc4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetHCLKFreq + 0x0000000000000000 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetPCLK1Freq + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetPCLK2Freq + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetOscConfig + 0x0000000000000000 0x104 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_GetClockConfig + 0x0000000000000000 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_NMI_IRQHandler + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.RCC_Delay + 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .text.HAL_RCC_CSSCallback + 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_info 0x0000000000000000 0x80f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_abbrev 0x0000000000000000 0x243 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_aranges + 0x0000000000000000 0x90 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_ranges 0x0000000000000000 0x80 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1a0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_line 0x0000000000000000 0x8e0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_str 0x0000000000000000 0x8b44e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .debug_frame 0x0000000000000000 0x21c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .text.HAL_RCCEx_PeriphCLKConfig + 0x0000000000000000 0x16c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .text.HAL_RCCEx_GetPeriphCLKConfig + 0x0000000000000000 0x84 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .rodata 0x0000000000000000 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .text.HAL_RCCEx_GetPeriphCLKFreq + 0x0000000000000000 0x1d0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_info 0x0000000000000000 0x45e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_abbrev 0x0000000000000000 0x175 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_aranges + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_ranges 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_line 0x0000000000000000 0x704 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_str 0x0000000000000000 0x8b201 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .debug_frame 0x0000000000000000 0x84 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_info 0x0000000000000000 0x169 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_abbrev 0x0000000000000000 0x92 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_aranges + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x18f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_line 0x0000000000000000 0x640 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .debug_str 0x0000000000000000 0x8aff2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_info 0x0000000000000000 0x169 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_abbrev 0x0000000000000000 0x92 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_aranges + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_line 0x0000000000000000 0x643 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .debug_str 0x0000000000000000 0x8aff5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ConfigTransfer + 0x0000000000000000 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_SetDataLength + 0x0000000000000000 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_SetMemoryAddress + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_SetPeriphAddress + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI1 + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI2 + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI3 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI4 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI5 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI6 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_ClearFlag_GI7 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_DeInit + 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_Init + 0x0000000000000000 0x72 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .text.LL_DMA_StructInit + 0x0000000000000000 0x4e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_info 0x0000000000000000 0x5a6 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_abbrev 0x0000000000000000 0x193 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_aranges + 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_ranges 0x0000000000000000 0x78 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1e2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x281 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_macro 0x0000000000000000 0x135 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_line 0x0000000000000000 0x896 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_str 0x0000000000000000 0x8d716 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .comment 0x0000000000000000 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .debug_frame 0x0000000000000000 0x238 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .ARM.attributes + 0x0000000000000000 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_DeInit + 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_StructInit + 0x0000000000000000 0x2a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_APB2_GRP1_ForceReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_APB2_GRP1_ReleaseReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_DeInit + 0x0000000000000000 0xd4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_StructInit + 0x0000000000000000 0x32 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x0000000000000000 0x135 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_HSI_Enable + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_HSI_IsReady + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_HSI_SetCalibTrimming + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_SetSysClkSource + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetUSBClockSource + 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetADCClockSource + 0x0000000000000000 0x20 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_PLL_IsReady + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_ClearResetFlags + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_DeInit + 0x0000000000000000 0x6c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetUSBClockFreq + 0x0000000000000000 0x58 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetADCClockFreq + 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_SetCompareCH1 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_SetCompareCH2 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_SetCompareCH3 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_SetCompareCH4 + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_SetEncoderMode + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_APB1_GRP1_ForceReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_APB1_GRP1_ReleaseReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_APB2_GRP1_ForceReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_APB2_GRP1_ReleaseReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_DeInit + 0x0000000000000000 0xf0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_StructInit + 0x0000000000000000 0x32 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_StructInit + 0x0000000000000000 0x42 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_OC_Init + 0x0000000000000000 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_IC_StructInit + 0x0000000000000000 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_IC_Init + 0x0000000000000000 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_ENCODER_StructInit + 0x0000000000000000 0x4c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_ENCODER_Init + 0x0000000000000000 0xc2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_HALLSENSOR_StructInit + 0x0000000000000000 0x2a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_HALLSENSOR_Init + 0x0000000000000000 0xd6 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_BDTR_StructInit + 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_BDTR_Init + 0x0000000000000000 0x90 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.OC1Config + 0x0000000000000000 0xd8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.OC2Config + 0x0000000000000000 0xe0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.OC3Config + 0x0000000000000000 0xe0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.OC4Config + 0x0000000000000000 0xb0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.IC1Config + 0x0000000000000000 0x58 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.IC2Config + 0x0000000000000000 0x5a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.IC3Config + 0x0000000000000000 0x5a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.IC4Config + 0x0000000000000000 0x5a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x0000000000000000 0x135 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_DisableSCLKOutput + 0x0000000000000000 0x1e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_APB1_GRP1_ForceReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_APB1_GRP1_ReleaseReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_APB2_GRP1_ForceReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_APB2_GRP1_ReleaseReset + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_DeInit + 0x0000000000000000 0xb0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_StructInit + 0x0000000000000000 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_ClockInit + 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_ClockStructInit + 0x0000000000000000 0x2a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x2be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x0000000000000000 0x135 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .data 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .bss 0x0000000000000000 0x0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSE_EnableBypass + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSE_DisableBypass + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSE_Enable + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSE_IsReady + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSI_Enable + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_HSI_IsReady + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_SetSysClkSource + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_GetSysClkSource + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_SetAHBPrescaler + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_SetAPB1Prescaler + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_SetAPB2Prescaler + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_GetAHBPrescaler + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_PLL_Enable + 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_PLL_IsReady + 0x0000000000000000 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_RCC_PLL_ConfigDomain_SYS + 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_InitTick + 0x0000000000000000 0x34 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_FLASH_SetLatency + 0x0000000000000000 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_FLASH_GetLatency + 0x0000000000000000 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_Init1msTick + 0x0000000000000000 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_mDelay + 0x0000000000000000 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_SetFlashLatency + 0x0000000000000000 0x8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_PLL_ConfigSystemClock_HSI + 0x0000000000000000 0x74 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.LL_PLL_ConfigSystemClock_HSE + 0x0000000000000000 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.UTILS_GetPLLOutputFrequency + 0x0000000000000000 0x36 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.UTILS_PLL_HSE_ConfigSystemClock + 0x0000000000000000 0x56 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.UTILS_PLL_IsBusy + 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .text.UTILS_EnablePLLAndSwitchSystem + 0x0000000000000000 0xc4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xa60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x2e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x8e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x51 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xef Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x6a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x1df Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x22 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xc3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xd23 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xfd8c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x6d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x20f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x3468 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x174 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x5c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x5be Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x4d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x1cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x114 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x1ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x27 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x144 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x30 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x3c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x408 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x57 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x24f Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x141 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0xb5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x2b8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x2a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x0000000000000000 0x8d Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/buttons.o + .text 0x0000000000000000 0x0 NxBase/buttons.o + .data 0x0000000000000000 0x0 NxBase/buttons.o + .bss 0x0000000000000000 0x0 NxBase/buttons.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/buttons.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/buttons.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/buttons.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/buttons.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/buttons.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/buttons.o + .text.InitButtonCtrl + 0x0000000000000000 0x70 NxBase/buttons.o + .rodata 0x0000000000000000 0x37 NxBase/buttons.o + .text.AddButtonToList + 0x0000000000000000 0x114 NxBase/buttons.o + .text.ScanButtons + 0x0000000000000000 0x28c NxBase/buttons.o + .text.WaitAllButtonUp + 0x0000000000000000 0xc4 NxBase/buttons.o + .text.RegDelayFun + 0x0000000000000000 0x20 NxBase/buttons.o + .text.CleanButtonTask + 0x0000000000000000 0x24 NxBase/buttons.o + .text.ButtonsTask + 0x0000000000000000 0x160 NxBase/buttons.o + .debug_info 0x0000000000000000 0xd9a NxBase/buttons.o + .debug_abbrev 0x0000000000000000 0x2c3 NxBase/buttons.o + .debug_aranges + 0x0000000000000000 0x50 NxBase/buttons.o + .debug_ranges 0x0000000000000000 0x40 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x41c NxBase/buttons.o + .debug_macro 0x0000000000000000 0xa60 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x22 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x40 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x18 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x94 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x3c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x34 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x57 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x97 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x330 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xfd NxBase/buttons.o + .debug_macro 0x0000000000000000 0x10 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x52 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1f NxBase/buttons.o + .debug_macro 0x0000000000000000 0x43 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x20 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x10 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x6a NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x52 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x40 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x10 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x40 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xd7 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x3d NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x145 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x35 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x29 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x20 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x22a NxBase/buttons.o + .debug_macro 0x0000000000000000 0xf2 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x20f NxBase/buttons.o + .debug_macro 0x0000000000000000 0x2e NxBase/buttons.o + .debug_macro 0x0000000000000000 0x22 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xef NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1df NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x22 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xb7 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xd23 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x6d NxBase/buttons.o + .debug_macro 0x0000000000000000 0x3468 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x56 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x5be NxBase/buttons.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1cb NxBase/buttons.o + .debug_macro 0x0000000000000000 0x114 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1ea NxBase/buttons.o + .debug_macro 0x0000000000000000 0x27 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x144 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1bc NxBase/buttons.o + .debug_macro 0x0000000000000000 0x30 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x3c NxBase/buttons.o + .debug_macro 0x0000000000000000 0x408 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x57 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x88 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x24f NxBase/buttons.o + .debug_macro 0x0000000000000000 0x141 NxBase/buttons.o + .debug_macro 0x0000000000000000 0xb5 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x2be NxBase/buttons.o + .debug_macro 0x0000000000000000 0x135 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x8d NxBase/buttons.o + .debug_macro 0x0000000000000000 0xd0 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x28 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x2a NxBase/buttons.o + .debug_macro 0x0000000000000000 0x90 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x287 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x57a NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x22a NxBase/buttons.o + .debug_macro 0x0000000000000000 0x1be NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_macro 0x0000000000000000 0x16 NxBase/buttons.o + .debug_line 0x0000000000000000 0xb38 NxBase/buttons.o + .debug_str 0x0000000000000000 0x997a2 NxBase/buttons.o + .comment 0x0000000000000000 0x7c NxBase/buttons.o + .debug_frame 0x0000000000000000 0x110 NxBase/buttons.o + .ARM.attributes + 0x0000000000000000 0x33 NxBase/buttons.o + COMMON 0x0000000000000000 0x10c NxBase/buttons.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/canctrl.o + .text 0x0000000000000000 0x0 NxBase/canctrl.o + .data 0x0000000000000000 0x0 NxBase/canctrl.o + .bss 0x0000000000000000 0x0 NxBase/canctrl.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/canctrl.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/canctrl.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/canctrl.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/canctrl.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/canctrl.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xa60 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x22 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x40 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x18 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x94 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x3c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x34 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x57 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x97 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x330 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xfd NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x10 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x52 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1f NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x43 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x20 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x10 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x6a NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x52 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x40 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x10 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x40 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xd7 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x3d NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x145 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x35 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x29 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x20 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x22a NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xf2 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x20f NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x2e NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x22 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xef NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1df NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x22 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xb7 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xd23 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x6d NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x3468 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x56 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x5be NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1cb NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x114 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1ea NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x27 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x144 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1bc NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x30 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x3c NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x408 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x57 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x88 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x24f NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x141 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xb5 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x2be NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x135 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x8d NxBase/canctrl.o + .debug_macro 0x0000000000000000 0xd0 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x28 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x2a NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x90 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x287 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x57a NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x22a NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x1be NxBase/canctrl.o + .debug_macro 0x0000000000000000 0x16 NxBase/canctrl.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .group 0x0000000000000000 0xc NxBase/console.o + .text 0x0000000000000000 0x0 NxBase/console.o + .data 0x0000000000000000 0x0 NxBase/console.o + .bss 0x0000000000000000 0x0 NxBase/console.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/console.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/console.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/console.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/console.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/console.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/console.o + .bss.g_netDebugInfo + 0x0000000000000000 0x4 NxBase/console.o + .text.SetConsoleOutType + 0x0000000000000000 0x2c NxBase/console.o + .text.__io_putchar + 0x0000000000000000 0x24 NxBase/console.o + .text.__io_getchar + 0x0000000000000000 0x2a NxBase/console.o + .text.PutChar 0x0000000000000000 0x18 NxBase/console.o + .text.GetChar 0x0000000000000000 0xe NxBase/console.o + .text.IsNewCommand + 0x0000000000000000 0x14 NxBase/console.o + .text.LockExecAndGetCmdStr + 0x0000000000000000 0x40 NxBase/console.o + .text.UnlockExec + 0x0000000000000000 0x18 NxBase/console.o + .text.SetPauseStatus + 0x0000000000000000 0x2c NxBase/console.o + .bss.g_cmdHisIdx + 0x0000000000000000 0x4 NxBase/console.o + .bss.g_cmdHisNum + 0x0000000000000000 0x4 NxBase/console.o + .data.g_cmdHisSer + 0x0000000000000000 0x4 NxBase/console.o + .bss.g_cursorNum + 0x0000000000000000 0x4 NxBase/console.o + .text.InitHistory + 0x0000000000000000 0x44 NxBase/console.o + .text.AddNewCmdToHistory + 0x0000000000000000 0x18c NxBase/console.o + .text.UpCursorProc + 0x0000000000000000 0xf4 NxBase/console.o + .text.DownCursorProc + 0x0000000000000000 0x12c NxBase/console.o + .text.OutNewCmdLine + 0x0000000000000000 0x44 NxBase/console.o + .rodata 0x0000000000000000 0xb NxBase/console.o + .text.InitConsole + 0x0000000000000000 0x5c NxBase/console.o + .text.ConsoleCmdScan + 0x0000000000000000 0x624 NxBase/console.o + .text.GetHistoryCmd + 0x0000000000000000 0x48 NxBase/console.o + .text.GetHistoryNum + 0x0000000000000000 0x14 NxBase/console.o + .text.GetHistoryMaxNum + 0x0000000000000000 0xe NxBase/console.o + .text.GetHistoryIdx + 0x0000000000000000 0x14 NxBase/console.o + .debug_macro 0x0000000000000000 0xa60 NxBase/console.o + .debug_macro 0x0000000000000000 0x22 NxBase/console.o + .debug_macro 0x0000000000000000 0x40 NxBase/console.o + .debug_macro 0x0000000000000000 0x18 NxBase/console.o + .debug_macro 0x0000000000000000 0x94 NxBase/console.o + .debug_macro 0x0000000000000000 0x3c NxBase/console.o + .debug_macro 0x0000000000000000 0x34 NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x57 NxBase/console.o + .debug_macro 0x0000000000000000 0x97 NxBase/console.o + .debug_macro 0x0000000000000000 0x330 NxBase/console.o + .debug_macro 0x0000000000000000 0xfd NxBase/console.o + .debug_macro 0x0000000000000000 0x10 NxBase/console.o + .debug_macro 0x0000000000000000 0x52 NxBase/console.o + .debug_macro 0x0000000000000000 0x1f NxBase/console.o + .debug_macro 0x0000000000000000 0x43 NxBase/console.o + .debug_macro 0x0000000000000000 0x20 NxBase/console.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/console.o + .debug_macro 0x0000000000000000 0x10 NxBase/console.o + .debug_macro 0x0000000000000000 0x6a NxBase/console.o + .debug_macro 0x0000000000000000 0x1c NxBase/console.o + .debug_macro 0x0000000000000000 0x52 NxBase/console.o + .debug_macro 0x0000000000000000 0x40 NxBase/console.o + .debug_macro 0x0000000000000000 0x10 NxBase/console.o + .debug_macro 0x0000000000000000 0x40 NxBase/console.o + .debug_macro 0x0000000000000000 0xd7 NxBase/console.o + .debug_macro 0x0000000000000000 0x1c NxBase/console.o + .debug_macro 0x0000000000000000 0x3d NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x145 NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x35 NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x29 NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x20 NxBase/console.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/console.o + .debug_macro 0x0000000000000000 0x22a NxBase/console.o + .debug_macro 0x0000000000000000 0xf2 NxBase/console.o + .debug_macro 0x0000000000000000 0x20f NxBase/console.o + .debug_macro 0x0000000000000000 0x2e NxBase/console.o + .debug_macro 0x0000000000000000 0x22 NxBase/console.o + .debug_macro 0x0000000000000000 0xef NxBase/console.o + .debug_macro 0x0000000000000000 0x1df NxBase/console.o + .debug_macro 0x0000000000000000 0x1c NxBase/console.o + .debug_macro 0x0000000000000000 0x22 NxBase/console.o + .debug_macro 0x0000000000000000 0xb7 NxBase/console.o + .debug_macro 0x0000000000000000 0xd23 NxBase/console.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/console.o + .debug_macro 0x0000000000000000 0x6d NxBase/console.o + .debug_macro 0x0000000000000000 0x3468 NxBase/console.o + .debug_macro 0x0000000000000000 0x56 NxBase/console.o + .debug_macro 0x0000000000000000 0x5be NxBase/console.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/console.o + .debug_macro 0x0000000000000000 0x1cb NxBase/console.o + .debug_macro 0x0000000000000000 0x114 NxBase/console.o + .debug_macro 0x0000000000000000 0x1ea NxBase/console.o + .debug_macro 0x0000000000000000 0x27 NxBase/console.o + .debug_macro 0x0000000000000000 0x144 NxBase/console.o + .debug_macro 0x0000000000000000 0x1bc NxBase/console.o + .debug_macro 0x0000000000000000 0x30 NxBase/console.o + .debug_macro 0x0000000000000000 0x3c NxBase/console.o + .debug_macro 0x0000000000000000 0x408 NxBase/console.o + .debug_macro 0x0000000000000000 0x57 NxBase/console.o + .debug_macro 0x0000000000000000 0x88 NxBase/console.o + .debug_macro 0x0000000000000000 0x24f NxBase/console.o + .debug_macro 0x0000000000000000 0x141 NxBase/console.o + .debug_macro 0x0000000000000000 0xb5 NxBase/console.o + .debug_macro 0x0000000000000000 0x2be NxBase/console.o + .debug_macro 0x0000000000000000 0x135 NxBase/console.o + .debug_macro 0x0000000000000000 0x8d NxBase/console.o + .debug_macro 0x0000000000000000 0xd0 NxBase/console.o + .debug_macro 0x0000000000000000 0x28 NxBase/console.o + .debug_macro 0x0000000000000000 0x2a NxBase/console.o + .debug_macro 0x0000000000000000 0x90 NxBase/console.o + .debug_macro 0x0000000000000000 0x287 NxBase/console.o + .debug_macro 0x0000000000000000 0x57a NxBase/console.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/console.o + .debug_macro 0x0000000000000000 0x22a NxBase/console.o + .debug_macro 0x0000000000000000 0x1be NxBase/console.o + .debug_macro 0x0000000000000000 0x10 NxBase/console.o + .debug_macro 0x0000000000000000 0x16 NxBase/console.o + .debug_macro 0x0000000000000000 0x10 NxBase/console.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/cpuid.o + .text 0x0000000000000000 0x0 NxBase/cpuid.o + .data 0x0000000000000000 0x0 NxBase/cpuid.o + .bss 0x0000000000000000 0x0 NxBase/cpuid.o + .text.__NVIC_SystemReset + 0x0000000000000000 0x28 NxBase/cpuid.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/cpuid.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/cpuid.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/cpuid.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/cpuid.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/cpuid.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/cpuid.o + .data.g_cpuIDBeg + 0x0000000000000000 0x4 NxBase/cpuid.o + .text.InitCpuIDBase + 0x0000000000000000 0x1c NxBase/cpuid.o + .text.GetCpuID + 0x0000000000000000 0x188 NxBase/cpuid.o + .rodata 0x0000000000000000 0x14 NxBase/cpuid.o + .text.RestartMcu + 0x0000000000000000 0x14 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xa60 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x22 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x40 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x18 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x94 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x3c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x34 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x16 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x57 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x97 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x330 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xfd NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x10 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x52 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1f NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x43 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x20 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x10 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x6a NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x52 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x40 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x10 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x40 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xd7 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x3d NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x16 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x145 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x16 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x35 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x16 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x29 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x16 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x20 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x22a NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xf2 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x20f NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x2e NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x22 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xef NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1df NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x22 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xb7 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xd23 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x6d NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x3468 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x56 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x5be NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1cb NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x114 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1ea NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x27 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x144 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1bc NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x30 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x3c NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x408 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x57 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x88 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x24f NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x141 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xb5 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x2be NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x135 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x8d NxBase/cpuid.o + .debug_macro 0x0000000000000000 0xd0 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x28 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x2a NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x90 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x287 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x57a NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x22a NxBase/cpuid.o + .debug_macro 0x0000000000000000 0x1be NxBase/cpuid.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/delay.o + .text 0x0000000000000000 0x0 NxBase/delay.o + .data 0x0000000000000000 0x0 NxBase/delay.o + .bss 0x0000000000000000 0x0 NxBase/delay.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/delay.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/delay.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/delay.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/delay.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/delay.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/delay.o + .text.DelayNs 0x0000000000000000 0x3c NxBase/delay.o + .debug_macro 0x0000000000000000 0xa60 NxBase/delay.o + .debug_macro 0x0000000000000000 0x22 NxBase/delay.o + .debug_macro 0x0000000000000000 0x40 NxBase/delay.o + .debug_macro 0x0000000000000000 0x18 NxBase/delay.o + .debug_macro 0x0000000000000000 0x94 NxBase/delay.o + .debug_macro 0x0000000000000000 0x3c NxBase/delay.o + .debug_macro 0x0000000000000000 0x34 NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .debug_macro 0x0000000000000000 0x57 NxBase/delay.o + .debug_macro 0x0000000000000000 0x97 NxBase/delay.o + .debug_macro 0x0000000000000000 0x330 NxBase/delay.o + .debug_macro 0x0000000000000000 0xfd NxBase/delay.o + .debug_macro 0x0000000000000000 0x10 NxBase/delay.o + .debug_macro 0x0000000000000000 0x52 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1f NxBase/delay.o + .debug_macro 0x0000000000000000 0x43 NxBase/delay.o + .debug_macro 0x0000000000000000 0x20 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/delay.o + .debug_macro 0x0000000000000000 0x10 NxBase/delay.o + .debug_macro 0x0000000000000000 0x6a NxBase/delay.o + .debug_macro 0x0000000000000000 0x1c NxBase/delay.o + .debug_macro 0x0000000000000000 0x52 NxBase/delay.o + .debug_macro 0x0000000000000000 0x40 NxBase/delay.o + .debug_macro 0x0000000000000000 0x10 NxBase/delay.o + .debug_macro 0x0000000000000000 0x40 NxBase/delay.o + .debug_macro 0x0000000000000000 0xd7 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1c NxBase/delay.o + .debug_macro 0x0000000000000000 0x3d NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .debug_macro 0x0000000000000000 0x145 NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .debug_macro 0x0000000000000000 0x35 NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .debug_macro 0x0000000000000000 0x29 NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .debug_macro 0x0000000000000000 0x20 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/delay.o + .debug_macro 0x0000000000000000 0x22a NxBase/delay.o + .debug_macro 0x0000000000000000 0xf2 NxBase/delay.o + .debug_macro 0x0000000000000000 0x20f NxBase/delay.o + .debug_macro 0x0000000000000000 0x2e NxBase/delay.o + .debug_macro 0x0000000000000000 0x22 NxBase/delay.o + .debug_macro 0x0000000000000000 0xef NxBase/delay.o + .debug_macro 0x0000000000000000 0x1df NxBase/delay.o + .debug_macro 0x0000000000000000 0x1c NxBase/delay.o + .debug_macro 0x0000000000000000 0x22 NxBase/delay.o + .debug_macro 0x0000000000000000 0xb7 NxBase/delay.o + .debug_macro 0x0000000000000000 0xd23 NxBase/delay.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/delay.o + .debug_macro 0x0000000000000000 0x6d NxBase/delay.o + .debug_macro 0x0000000000000000 0x3468 NxBase/delay.o + .debug_macro 0x0000000000000000 0x56 NxBase/delay.o + .debug_macro 0x0000000000000000 0x5be NxBase/delay.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1cb NxBase/delay.o + .debug_macro 0x0000000000000000 0x114 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1ea NxBase/delay.o + .debug_macro 0x0000000000000000 0x27 NxBase/delay.o + .debug_macro 0x0000000000000000 0x144 NxBase/delay.o + .debug_macro 0x0000000000000000 0x1bc NxBase/delay.o + .debug_macro 0x0000000000000000 0x30 NxBase/delay.o + .debug_macro 0x0000000000000000 0x3c NxBase/delay.o + .debug_macro 0x0000000000000000 0x408 NxBase/delay.o + .debug_macro 0x0000000000000000 0x57 NxBase/delay.o + .debug_macro 0x0000000000000000 0x88 NxBase/delay.o + .debug_macro 0x0000000000000000 0x24f NxBase/delay.o + .debug_macro 0x0000000000000000 0x141 NxBase/delay.o + .debug_macro 0x0000000000000000 0xb5 NxBase/delay.o + .debug_macro 0x0000000000000000 0x2be NxBase/delay.o + .debug_macro 0x0000000000000000 0x135 NxBase/delay.o + .debug_macro 0x0000000000000000 0x8d NxBase/delay.o + .debug_macro 0x0000000000000000 0xd0 NxBase/delay.o + .debug_macro 0x0000000000000000 0x28 NxBase/delay.o + .debug_macro 0x0000000000000000 0x2a NxBase/delay.o + .debug_macro 0x0000000000000000 0x90 NxBase/delay.o + .debug_macro 0x0000000000000000 0x287 NxBase/delay.o + .debug_macro 0x0000000000000000 0x57a NxBase/delay.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/delay.o + .debug_macro 0x0000000000000000 0x22a NxBase/delay.o + .debug_macro 0x0000000000000000 0x1be NxBase/delay.o + .debug_macro 0x0000000000000000 0x16 NxBase/delay.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/encrypt.o + .text 0x0000000000000000 0x0 NxBase/encrypt.o + .data 0x0000000000000000 0x0 NxBase/encrypt.o + .bss 0x0000000000000000 0x0 NxBase/encrypt.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/encrypt.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/encrypt.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/encrypt.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/encrypt.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/encrypt.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/encrypt.o + .bss.g_encryptNum + 0x0000000000000000 0x4 NxBase/encrypt.o + .text.AddToEncrypt + 0x0000000000000000 0x3c NxBase/encrypt.o + .text.CheckEncrypt + 0x0000000000000000 0x90 NxBase/encrypt.o + .debug_info 0x0000000000000000 0xc30 NxBase/encrypt.o + .debug_abbrev 0x0000000000000000 0x20d NxBase/encrypt.o + .debug_aranges + 0x0000000000000000 0x28 NxBase/encrypt.o + .debug_ranges 0x0000000000000000 0x18 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x3ff NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xa60 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x22 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x40 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x18 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x94 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x3c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x34 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x16 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x57 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x97 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x330 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xfd NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x10 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x52 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1f NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x43 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x20 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x10 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x6a NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x52 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x40 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x10 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x40 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xd7 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x3d NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x16 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x145 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x16 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x35 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x16 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x29 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x16 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x20 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x22a NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xf2 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x20f NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x2e NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x22 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xef NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1df NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x22 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xb7 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xd23 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x6d NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x3468 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x56 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x5be NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1cb NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x114 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1ea NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x27 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x144 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1bc NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x30 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x3c NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x408 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x57 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x88 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x24f NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x141 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xb5 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x2be NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x135 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x8d NxBase/encrypt.o + .debug_macro 0x0000000000000000 0xd0 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x28 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x2a NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x90 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x287 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x57a NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x22a NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x1be NxBase/encrypt.o + .debug_macro 0x0000000000000000 0x10 NxBase/encrypt.o + .debug_line 0x0000000000000000 0x9f1 NxBase/encrypt.o + .debug_str 0x0000000000000000 0x99641 NxBase/encrypt.o + .comment 0x0000000000000000 0x7c NxBase/encrypt.o + .debug_frame 0x0000000000000000 0x5c NxBase/encrypt.o + .ARM.attributes + 0x0000000000000000 0x33 NxBase/encrypt.o + COMMON 0x0000000000000000 0x80 NxBase/encrypt.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/funcs.o + .text 0x0000000000000000 0x0 NxBase/funcs.o + .data 0x0000000000000000 0x0 NxBase/funcs.o + .bss 0x0000000000000000 0x0 NxBase/funcs.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/funcs.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/funcs.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/funcs.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/funcs.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/funcs.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/funcs.o + .debug_info 0x0000000000000000 0xa46 NxBase/funcs.o + .debug_abbrev 0x0000000000000000 0x1a4 NxBase/funcs.o + .debug_aranges + 0x0000000000000000 0x18 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x3f5 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xa60 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x22 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x40 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x18 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x94 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x3c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x34 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x16 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x57 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x97 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x330 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xfd NxBase/funcs.o + .debug_macro 0x0000000000000000 0x10 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x52 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1f NxBase/funcs.o + .debug_macro 0x0000000000000000 0x43 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x20 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x10 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x6a NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x52 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x40 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x10 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x40 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xd7 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x3d NxBase/funcs.o + .debug_macro 0x0000000000000000 0x16 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x145 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x16 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x35 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x16 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x29 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x16 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x20 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x22a NxBase/funcs.o + .debug_macro 0x0000000000000000 0xf2 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x20f NxBase/funcs.o + .debug_macro 0x0000000000000000 0x2e NxBase/funcs.o + .debug_macro 0x0000000000000000 0x22 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xef NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1df NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x22 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xb7 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xd23 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x6d NxBase/funcs.o + .debug_macro 0x0000000000000000 0x3468 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x56 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x5be NxBase/funcs.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1cb NxBase/funcs.o + .debug_macro 0x0000000000000000 0x114 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1ea NxBase/funcs.o + .debug_macro 0x0000000000000000 0x27 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x144 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1bc NxBase/funcs.o + .debug_macro 0x0000000000000000 0x30 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x3c NxBase/funcs.o + .debug_macro 0x0000000000000000 0x408 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x57 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x88 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x24f NxBase/funcs.o + .debug_macro 0x0000000000000000 0x141 NxBase/funcs.o + .debug_macro 0x0000000000000000 0xb5 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x2be NxBase/funcs.o + .debug_macro 0x0000000000000000 0x135 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x8d NxBase/funcs.o + .debug_macro 0x0000000000000000 0xd0 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x28 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x2a NxBase/funcs.o + .debug_macro 0x0000000000000000 0x90 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x287 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x57a NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/funcs.o + .debug_macro 0x0000000000000000 0x22a NxBase/funcs.o + .debug_macro 0x0000000000000000 0x1be NxBase/funcs.o + .debug_macro 0x0000000000000000 0x4c NxBase/funcs.o + .debug_line 0x0000000000000000 0x9a1 NxBase/funcs.o + .debug_str 0x0000000000000000 0x99b09 NxBase/funcs.o + .comment 0x0000000000000000 0x7c NxBase/funcs.o + .ARM.attributes + 0x0000000000000000 0x33 NxBase/funcs.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/i2crw.o + .text 0x0000000000000000 0x0 NxBase/i2crw.o + .data 0x0000000000000000 0x0 NxBase/i2crw.o + .bss 0x0000000000000000 0x0 NxBase/i2crw.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/i2crw.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/i2crw.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/i2crw.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/i2crw.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/i2crw.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/i2crw.o + .debug_info 0x0000000000000000 0xa46 NxBase/i2crw.o + .debug_abbrev 0x0000000000000000 0x1a4 NxBase/i2crw.o + .debug_aranges + 0x0000000000000000 0x18 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x3f6 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xa60 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x22 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x40 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x18 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x94 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x3c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x34 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x16 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x57 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x97 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x330 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xfd NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x10 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x52 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1f NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x43 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x20 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x10 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x6a NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x52 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x40 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x10 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x40 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xd7 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x3d NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x16 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x145 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x16 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x35 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x16 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x29 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x16 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x20 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x22a NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xf2 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x20f NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x2e NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x22 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xef NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1df NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x22 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xb7 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xd23 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x6d NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x3468 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x56 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x5be NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1cb NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x114 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1ea NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x27 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x144 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1bc NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x30 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x3c NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x408 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x57 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x88 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x24f NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x141 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xb5 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x2be NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x135 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x8d NxBase/i2crw.o + .debug_macro 0x0000000000000000 0xd0 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x28 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x2a NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x90 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x287 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x57a NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x22a NxBase/i2crw.o + .debug_macro 0x0000000000000000 0x1be NxBase/i2crw.o + .debug_line 0x0000000000000000 0x9a1 NxBase/i2crw.o + .debug_str 0x0000000000000000 0x9954c NxBase/i2crw.o + .comment 0x0000000000000000 0x7c NxBase/i2crw.o + .ARM.attributes + 0x0000000000000000 0x33 NxBase/i2crw.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/iwdog.o + .text 0x0000000000000000 0x0 NxBase/iwdog.o + .data 0x0000000000000000 0x0 NxBase/iwdog.o + .bss 0x0000000000000000 0x0 NxBase/iwdog.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/iwdog.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/iwdog.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/iwdog.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/iwdog.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/iwdog.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xa60 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x22 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x40 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x18 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x94 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x3c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x34 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x16 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x57 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x97 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x330 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xfd NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x10 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x52 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1f NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x43 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x20 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x10 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x6a NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x52 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x40 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x10 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x40 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xd7 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x3d NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x16 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x145 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x16 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x35 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x16 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x29 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x16 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x20 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x22a NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xf2 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x20f NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x2e NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x22 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xef NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1df NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x22 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xb7 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xd23 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x6d NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x3468 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x56 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x5be NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1cb NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x114 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1ea NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x27 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x144 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1bc NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x30 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x3c NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x408 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x57 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x88 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x24f NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x141 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xb5 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x2be NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x135 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x8d NxBase/iwdog.o + .debug_macro 0x0000000000000000 0xd0 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x28 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x2a NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x90 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x287 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x57a NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x22a NxBase/iwdog.o + .debug_macro 0x0000000000000000 0x1be NxBase/iwdog.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/serial.o + .text 0x0000000000000000 0x0 NxBase/serial.o + .data 0x0000000000000000 0x0 NxBase/serial.o + .bss 0x0000000000000000 0x0 NxBase/serial.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/serial.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/serial.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/serial.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/serial.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/serial.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/serial.o + .text.Usart1GetRsLen + 0x0000000000000000 0x24 NxBase/serial.o + .text.Usart1CleanSdBuf + 0x0000000000000000 0x30 NxBase/serial.o + .text.Usart1GetSdFreeLen + 0x0000000000000000 0x28 NxBase/serial.o + .text.IsUsart1SendBufEmpty + 0x0000000000000000 0x2c NxBase/serial.o + .text.RegUsart1ResvExFunc + 0x0000000000000000 0x1c NxBase/serial.o + .text.Usart2GetRsLen + 0x0000000000000000 0x24 NxBase/serial.o + .text.Usart2CleanSdBuf + 0x0000000000000000 0x30 NxBase/serial.o + .text.Usart2GetSdFreeLen + 0x0000000000000000 0x28 NxBase/serial.o + .text.IsUsart2SendBufEmpty + 0x0000000000000000 0x2c NxBase/serial.o + .text.RegUsart2ResvExFunc + 0x0000000000000000 0x1c NxBase/serial.o + .text.Usart2SendDataSync + 0x0000000000000000 0x58 NxBase/serial.o + .text.Usart2GetDataSync + 0x0000000000000000 0x64 NxBase/serial.o + .text.Usart3GetRsLen + 0x0000000000000000 0x24 NxBase/serial.o + .text.Usart3CleanSdBuf + 0x0000000000000000 0x30 NxBase/serial.o + .text.Usart3GetSdFreeLen + 0x0000000000000000 0x28 NxBase/serial.o + .text.IsUsart3SendBufEmpty + 0x0000000000000000 0x2c NxBase/serial.o + .text.RegUsart3ResvExFunc + 0x0000000000000000 0x1c NxBase/serial.o + .text.Usart3SendDataSync + 0x0000000000000000 0x58 NxBase/serial.o + .text.Usart3GetDataSync + 0x0000000000000000 0x64 NxBase/serial.o + .debug_macro 0x0000000000000000 0xa60 NxBase/serial.o + .debug_macro 0x0000000000000000 0x22 NxBase/serial.o + .debug_macro 0x0000000000000000 0x40 NxBase/serial.o + .debug_macro 0x0000000000000000 0x18 NxBase/serial.o + .debug_macro 0x0000000000000000 0x94 NxBase/serial.o + .debug_macro 0x0000000000000000 0x3c NxBase/serial.o + .debug_macro 0x0000000000000000 0x34 NxBase/serial.o + .debug_macro 0x0000000000000000 0x16 NxBase/serial.o + .debug_macro 0x0000000000000000 0x57 NxBase/serial.o + .debug_macro 0x0000000000000000 0x97 NxBase/serial.o + .debug_macro 0x0000000000000000 0x330 NxBase/serial.o + .debug_macro 0x0000000000000000 0xfd NxBase/serial.o + .debug_macro 0x0000000000000000 0x10 NxBase/serial.o + .debug_macro 0x0000000000000000 0x52 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1f NxBase/serial.o + .debug_macro 0x0000000000000000 0x43 NxBase/serial.o + .debug_macro 0x0000000000000000 0x20 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/serial.o + .debug_macro 0x0000000000000000 0x10 NxBase/serial.o + .debug_macro 0x0000000000000000 0x6a NxBase/serial.o + .debug_macro 0x0000000000000000 0x1c NxBase/serial.o + .debug_macro 0x0000000000000000 0x52 NxBase/serial.o + .debug_macro 0x0000000000000000 0x40 NxBase/serial.o + .debug_macro 0x0000000000000000 0x10 NxBase/serial.o + .debug_macro 0x0000000000000000 0x40 NxBase/serial.o + .debug_macro 0x0000000000000000 0xd7 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1c NxBase/serial.o + .debug_macro 0x0000000000000000 0x3d NxBase/serial.o + .debug_macro 0x0000000000000000 0x16 NxBase/serial.o + .debug_macro 0x0000000000000000 0x145 NxBase/serial.o + .debug_macro 0x0000000000000000 0x16 NxBase/serial.o + .debug_macro 0x0000000000000000 0x35 NxBase/serial.o + .debug_macro 0x0000000000000000 0x16 NxBase/serial.o + .debug_macro 0x0000000000000000 0x29 NxBase/serial.o + .debug_macro 0x0000000000000000 0x16 NxBase/serial.o + .debug_macro 0x0000000000000000 0x20 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/serial.o + .debug_macro 0x0000000000000000 0x22a NxBase/serial.o + .debug_macro 0x0000000000000000 0xf2 NxBase/serial.o + .debug_macro 0x0000000000000000 0x20f NxBase/serial.o + .debug_macro 0x0000000000000000 0x2e NxBase/serial.o + .debug_macro 0x0000000000000000 0x22 NxBase/serial.o + .debug_macro 0x0000000000000000 0xef NxBase/serial.o + .debug_macro 0x0000000000000000 0x1df NxBase/serial.o + .debug_macro 0x0000000000000000 0x1c NxBase/serial.o + .debug_macro 0x0000000000000000 0x22 NxBase/serial.o + .debug_macro 0x0000000000000000 0xb7 NxBase/serial.o + .debug_macro 0x0000000000000000 0xd23 NxBase/serial.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/serial.o + .debug_macro 0x0000000000000000 0x6d NxBase/serial.o + .debug_macro 0x0000000000000000 0x3468 NxBase/serial.o + .debug_macro 0x0000000000000000 0x56 NxBase/serial.o + .debug_macro 0x0000000000000000 0x5be NxBase/serial.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1cb NxBase/serial.o + .debug_macro 0x0000000000000000 0x114 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1ea NxBase/serial.o + .debug_macro 0x0000000000000000 0x27 NxBase/serial.o + .debug_macro 0x0000000000000000 0x144 NxBase/serial.o + .debug_macro 0x0000000000000000 0x1bc NxBase/serial.o + .debug_macro 0x0000000000000000 0x30 NxBase/serial.o + .debug_macro 0x0000000000000000 0x3c NxBase/serial.o + .debug_macro 0x0000000000000000 0x408 NxBase/serial.o + .debug_macro 0x0000000000000000 0x57 NxBase/serial.o + .debug_macro 0x0000000000000000 0x88 NxBase/serial.o + .debug_macro 0x0000000000000000 0x24f NxBase/serial.o + .debug_macro 0x0000000000000000 0x141 NxBase/serial.o + .debug_macro 0x0000000000000000 0xb5 NxBase/serial.o + .debug_macro 0x0000000000000000 0x2be NxBase/serial.o + .debug_macro 0x0000000000000000 0x135 NxBase/serial.o + .debug_macro 0x0000000000000000 0x8d NxBase/serial.o + .debug_macro 0x0000000000000000 0xd0 NxBase/serial.o + .debug_macro 0x0000000000000000 0x28 NxBase/serial.o + .debug_macro 0x0000000000000000 0x2a NxBase/serial.o + .debug_macro 0x0000000000000000 0x90 NxBase/serial.o + .debug_macro 0x0000000000000000 0x287 NxBase/serial.o + .debug_macro 0x0000000000000000 0x57a NxBase/serial.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/serial.o + .debug_macro 0x0000000000000000 0x22a NxBase/serial.o + .debug_macro 0x0000000000000000 0x1be NxBase/serial.o + .debug_macro 0x0000000000000000 0x10 NxBase/serial.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/shell.o + .text 0x0000000000000000 0x0 NxBase/shell.o + .data 0x0000000000000000 0x0 NxBase/shell.o + .bss 0x0000000000000000 0x0 NxBase/shell.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/shell.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/shell.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/shell.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/shell.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/shell.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/shell.o + .text.ShellTask + 0x0000000000000000 0x390 NxBase/shell.o + .text.VersionInfo + 0x0000000000000000 0x4c NxBase/shell.o + .text.HelpString + 0x0000000000000000 0x68 NxBase/shell.o + .text.CleanScreen + 0x0000000000000000 0x18 NxBase/shell.o + .text.Restart 0x0000000000000000 0x16 NxBase/shell.o + .text.ShowHistoryCmd + 0x0000000000000000 0x10c NxBase/shell.o + .text.InitShell + 0x0000000000000000 0x68 NxBase/shell.o + .debug_macro 0x0000000000000000 0xa60 NxBase/shell.o + .debug_macro 0x0000000000000000 0x22 NxBase/shell.o + .debug_macro 0x0000000000000000 0x40 NxBase/shell.o + .debug_macro 0x0000000000000000 0x18 NxBase/shell.o + .debug_macro 0x0000000000000000 0x94 NxBase/shell.o + .debug_macro 0x0000000000000000 0x3c NxBase/shell.o + .debug_macro 0x0000000000000000 0x34 NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x57 NxBase/shell.o + .debug_macro 0x0000000000000000 0x97 NxBase/shell.o + .debug_macro 0x0000000000000000 0x330 NxBase/shell.o + .debug_macro 0x0000000000000000 0xfd NxBase/shell.o + .debug_macro 0x0000000000000000 0x10 NxBase/shell.o + .debug_macro 0x0000000000000000 0x52 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1f NxBase/shell.o + .debug_macro 0x0000000000000000 0x43 NxBase/shell.o + .debug_macro 0x0000000000000000 0x20 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/shell.o + .debug_macro 0x0000000000000000 0x10 NxBase/shell.o + .debug_macro 0x0000000000000000 0x6a NxBase/shell.o + .debug_macro 0x0000000000000000 0x1c NxBase/shell.o + .debug_macro 0x0000000000000000 0x52 NxBase/shell.o + .debug_macro 0x0000000000000000 0x40 NxBase/shell.o + .debug_macro 0x0000000000000000 0x10 NxBase/shell.o + .debug_macro 0x0000000000000000 0x40 NxBase/shell.o + .debug_macro 0x0000000000000000 0xd7 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1c NxBase/shell.o + .debug_macro 0x0000000000000000 0x3d NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x145 NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x35 NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x29 NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x20 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/shell.o + .debug_macro 0x0000000000000000 0x22a NxBase/shell.o + .debug_macro 0x0000000000000000 0xf2 NxBase/shell.o + .debug_macro 0x0000000000000000 0x20f NxBase/shell.o + .debug_macro 0x0000000000000000 0x2e NxBase/shell.o + .debug_macro 0x0000000000000000 0x22 NxBase/shell.o + .debug_macro 0x0000000000000000 0xef NxBase/shell.o + .debug_macro 0x0000000000000000 0x1df NxBase/shell.o + .debug_macro 0x0000000000000000 0x1c NxBase/shell.o + .debug_macro 0x0000000000000000 0x22 NxBase/shell.o + .debug_macro 0x0000000000000000 0xb7 NxBase/shell.o + .debug_macro 0x0000000000000000 0xd23 NxBase/shell.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/shell.o + .debug_macro 0x0000000000000000 0x6d NxBase/shell.o + .debug_macro 0x0000000000000000 0x3468 NxBase/shell.o + .debug_macro 0x0000000000000000 0x56 NxBase/shell.o + .debug_macro 0x0000000000000000 0x5be NxBase/shell.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1cb NxBase/shell.o + .debug_macro 0x0000000000000000 0x114 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1ea NxBase/shell.o + .debug_macro 0x0000000000000000 0x27 NxBase/shell.o + .debug_macro 0x0000000000000000 0x144 NxBase/shell.o + .debug_macro 0x0000000000000000 0x1bc NxBase/shell.o + .debug_macro 0x0000000000000000 0x30 NxBase/shell.o + .debug_macro 0x0000000000000000 0x3c NxBase/shell.o + .debug_macro 0x0000000000000000 0x408 NxBase/shell.o + .debug_macro 0x0000000000000000 0x57 NxBase/shell.o + .debug_macro 0x0000000000000000 0x88 NxBase/shell.o + .debug_macro 0x0000000000000000 0x24f NxBase/shell.o + .debug_macro 0x0000000000000000 0x141 NxBase/shell.o + .debug_macro 0x0000000000000000 0xb5 NxBase/shell.o + .debug_macro 0x0000000000000000 0x2be NxBase/shell.o + .debug_macro 0x0000000000000000 0x135 NxBase/shell.o + .debug_macro 0x0000000000000000 0x8d NxBase/shell.o + .debug_macro 0x0000000000000000 0xd0 NxBase/shell.o + .debug_macro 0x0000000000000000 0x28 NxBase/shell.o + .debug_macro 0x0000000000000000 0x2a NxBase/shell.o + .debug_macro 0x0000000000000000 0x90 NxBase/shell.o + .debug_macro 0x0000000000000000 0x287 NxBase/shell.o + .debug_macro 0x0000000000000000 0x57a NxBase/shell.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/shell.o + .debug_macro 0x0000000000000000 0x22a NxBase/shell.o + .debug_macro 0x0000000000000000 0x1be NxBase/shell.o + .debug_macro 0x0000000000000000 0x16 NxBase/shell.o + .debug_macro 0x0000000000000000 0x10 NxBase/shell.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/spirw.o + .text 0x0000000000000000 0x0 NxBase/spirw.o + .data 0x0000000000000000 0x0 NxBase/spirw.o + .bss 0x0000000000000000 0x0 NxBase/spirw.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/spirw.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/spirw.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/spirw.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/spirw.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/spirw.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/spirw.o + .debug_info 0x0000000000000000 0xa46 NxBase/spirw.o + .debug_abbrev 0x0000000000000000 0x1a4 NxBase/spirw.o + .debug_aranges + 0x0000000000000000 0x18 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x41a NxBase/spirw.o + .debug_macro 0x0000000000000000 0xa60 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x22 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x40 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x18 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x94 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x3c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x34 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x16 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x57 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x97 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x330 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xfd NxBase/spirw.o + .debug_macro 0x0000000000000000 0x10 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x52 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1f NxBase/spirw.o + .debug_macro 0x0000000000000000 0x43 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x20 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x10 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x6a NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x52 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x40 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x10 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x40 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xd7 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x3d NxBase/spirw.o + .debug_macro 0x0000000000000000 0x16 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x145 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x16 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x35 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x16 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x29 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x16 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x20 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x22a NxBase/spirw.o + .debug_macro 0x0000000000000000 0xf2 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x20f NxBase/spirw.o + .debug_macro 0x0000000000000000 0x2e NxBase/spirw.o + .debug_macro 0x0000000000000000 0x22 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xef NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1df NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x22 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xb7 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xd23 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x6d NxBase/spirw.o + .debug_macro 0x0000000000000000 0x3468 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x56 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x5be NxBase/spirw.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1cb NxBase/spirw.o + .debug_macro 0x0000000000000000 0x114 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1ea NxBase/spirw.o + .debug_macro 0x0000000000000000 0x27 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x144 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1bc NxBase/spirw.o + .debug_macro 0x0000000000000000 0x30 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x3c NxBase/spirw.o + .debug_macro 0x0000000000000000 0x408 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x57 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x88 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x24f NxBase/spirw.o + .debug_macro 0x0000000000000000 0x141 NxBase/spirw.o + .debug_macro 0x0000000000000000 0xb5 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x2be NxBase/spirw.o + .debug_macro 0x0000000000000000 0x135 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x8d NxBase/spirw.o + .debug_macro 0x0000000000000000 0xd0 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x28 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x2a NxBase/spirw.o + .debug_macro 0x0000000000000000 0x90 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x287 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x57a NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/spirw.o + .debug_macro 0x0000000000000000 0x22a NxBase/spirw.o + .debug_macro 0x0000000000000000 0x1be NxBase/spirw.o + .debug_line 0x0000000000000000 0x9a1 NxBase/spirw.o + .debug_str 0x0000000000000000 0x99d74 NxBase/spirw.o + .comment 0x0000000000000000 0x7c NxBase/spirw.o + .ARM.attributes + 0x0000000000000000 0x33 NxBase/spirw.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .group 0x0000000000000000 0xc NxBase/trigger.o + .text 0x0000000000000000 0x0 NxBase/trigger.o + .data 0x0000000000000000 0x0 NxBase/trigger.o + .bss 0x0000000000000000 0x0 NxBase/trigger.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxBase/trigger.o + .rodata 0x0000000000000000 0x4d NxBase/trigger.o + .text.AddTriggerToList + 0x0000000000000000 0x9c NxBase/trigger.o + .text.GetTickTimer + 0x0000000000000000 0x14 NxBase/trigger.o + .text.Get100NsSoftTimer + 0x0000000000000000 0x60 NxBase/trigger.o + .text.Get100UsSoftTimer + 0x0000000000000000 0x5c NxBase/trigger.o + .text.GetMsSoftTimer + 0x0000000000000000 0x14 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xa60 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x22 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x40 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x18 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x94 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x3c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x34 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x16 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x57 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x97 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x330 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xfd NxBase/trigger.o + .debug_macro 0x0000000000000000 0x10 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x52 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1f NxBase/trigger.o + .debug_macro 0x0000000000000000 0x43 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x20 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1a3 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x10 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x6a NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x52 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x40 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x10 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x40 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xd7 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x3d NxBase/trigger.o + .debug_macro 0x0000000000000000 0x16 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x145 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x16 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x35 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x16 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x29 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x16 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x20 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1e1 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x22a NxBase/trigger.o + .debug_macro 0x0000000000000000 0xf2 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x20f NxBase/trigger.o + .debug_macro 0x0000000000000000 0x2e NxBase/trigger.o + .debug_macro 0x0000000000000000 0x22 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xef NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1df NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x22 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xb7 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xd23 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xfd8c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x6d NxBase/trigger.o + .debug_macro 0x0000000000000000 0x3468 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x56 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x5be NxBase/trigger.o + .debug_macro 0x0000000000000000 0x4d5 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1cb NxBase/trigger.o + .debug_macro 0x0000000000000000 0x114 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1ea NxBase/trigger.o + .debug_macro 0x0000000000000000 0x27 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x144 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1bc NxBase/trigger.o + .debug_macro 0x0000000000000000 0x30 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x3c NxBase/trigger.o + .debug_macro 0x0000000000000000 0x408 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x57 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x88 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x24f NxBase/trigger.o + .debug_macro 0x0000000000000000 0x141 NxBase/trigger.o + .debug_macro 0x0000000000000000 0xb5 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x2be NxBase/trigger.o + .debug_macro 0x0000000000000000 0x135 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x8d NxBase/trigger.o + .debug_macro 0x0000000000000000 0xd0 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x28 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x2a NxBase/trigger.o + .debug_macro 0x0000000000000000 0x90 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x287 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x57a NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1b4 NxBase/trigger.o + .debug_macro 0x0000000000000000 0x22a NxBase/trigger.o + .debug_macro 0x0000000000000000 0x1be NxBase/trigger.o + .debug_macro 0x0000000000000000 0x10 NxBase/trigger.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/comm.o + .text 0x0000000000000000 0x0 NxFunc/comm/comm.o + .data 0x0000000000000000 0x0 NxFunc/comm/comm.o + .bss 0x0000000000000000 0x0 NxFunc/comm/comm.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/comm/comm.o + .rodata.FLDP_SYNC + 0x0000000000000000 0x4 NxFunc/comm/comm.o + .rodata.VLDP_SYNC + 0x0000000000000000 0x4 NxFunc/comm/comm.o + .text.ReadBuffEmpty + 0x0000000000000000 0x56 NxFunc/comm/comm.o + .bss.g_gtpCtrl + 0x0000000000000000 0x5f0 NxFunc/comm/comm.o + .rodata 0x0000000000000000 0x11e NxFunc/comm/comm.o + .text.GetANormalPacket + 0x0000000000000000 0x390 NxFunc/comm/comm.o + .text.SendAPacket + 0x0000000000000000 0xe8 NxFunc/comm/comm.o + .text.PacketAFLDP + 0x0000000000000000 0x40 NxFunc/comm/comm.o + .text.PacketAVLDP + 0x0000000000000000 0x84 NxFunc/comm/comm.o + .debug_info 0x0000000000000000 0xf56 NxFunc/comm/comm.o + .debug_abbrev 0x0000000000000000 0x296 NxFunc/comm/comm.o + .debug_aranges + 0x0000000000000000 0x40 NxFunc/comm/comm.o + .debug_ranges 0x0000000000000000 0x30 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x416 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x18 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x94 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x34 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x97 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x330 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xfd NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1f NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x43 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x6a NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x3d NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x145 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x35 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x29 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x20f NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xef NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1df NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x6d NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x56 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x5be NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x114 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x27 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x144 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x30 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x408 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x88 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x24f NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x141 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x2be NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x135 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x8d NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x2a NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x90 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x287 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x57a NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1be NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/comm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/comm.o + .debug_line 0x0000000000000000 0xb04 NxFunc/comm/comm.o + .debug_str 0x0000000000000000 0x997c4 NxFunc/comm/comm.o + .comment 0x0000000000000000 0x7c NxFunc/comm/comm.o + .debug_frame 0x0000000000000000 0xc8 NxFunc/comm/comm.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/comm/comm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/mtcomm.o + .text 0x0000000000000000 0x0 NxFunc/comm/mtcomm.o + .data 0x0000000000000000 0x0 NxFunc/comm/mtcomm.o + .bss 0x0000000000000000 0x0 NxFunc/comm/mtcomm.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/comm/mtcomm.o + .rodata.MTCOMM_SYNC + 0x0000000000000000 0x1 NxFunc/comm/mtcomm.o + .text.InitMtComm + 0x0000000000000000 0x30 NxFunc/comm/mtcomm.o + .text.MtCommAsyncTask + 0x0000000000000000 0x22c NxFunc/comm/mtcomm.o + .text.PacketAMtComm + 0x0000000000000000 0x34 NxFunc/comm/mtcomm.o + .text.CheckAMtPacket + 0x0000000000000000 0x54 NxFunc/comm/mtcomm.o + .text.ReadMtCommBuffEmpty + 0x0000000000000000 0x5c NxFunc/comm/mtcomm.o + .text.SendAMtPacket + 0x0000000000000000 0x94 NxFunc/comm/mtcomm.o + .text.GetSendStatus + 0x0000000000000000 0x3c NxFunc/comm/mtcomm.o + .text.GetSendResult + 0x0000000000000000 0x2c NxFunc/comm/mtcomm.o + .rodata 0x0000000000000000 0x42 NxFunc/comm/mtcomm.o + .text.GetAMtPacket + 0x0000000000000000 0x148 NxFunc/comm/mtcomm.o + .debug_info 0x0000000000000000 0xee2 NxFunc/comm/mtcomm.o + .debug_abbrev 0x0000000000000000 0x2a3 NxFunc/comm/mtcomm.o + .debug_aranges + 0x0000000000000000 0x60 NxFunc/comm/mtcomm.o + .debug_ranges 0x0000000000000000 0xb0 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x415 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x18 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x94 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x34 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x97 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x330 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xfd NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1f NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x43 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x6a NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x3d NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x145 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x35 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x29 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x20f NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xef NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1df NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x6d NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x56 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x5be NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x114 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x27 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x144 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x30 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x408 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x88 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x24f NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x141 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x2be NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x135 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x8d NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x2a NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x90 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x287 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x57a NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x1be NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x7d NxFunc/comm/mtcomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/mtcomm.o + .debug_line 0x0000000000000000 0xb80 NxFunc/comm/mtcomm.o + .debug_str 0x0000000000000000 0x99950 NxFunc/comm/mtcomm.o + .comment 0x0000000000000000 0x7c NxFunc/comm/mtcomm.o + .debug_frame 0x0000000000000000 0x164 NxFunc/comm/mtcomm.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/comm/mtcomm.o + COMMON 0x0000000000000000 0x48 NxFunc/comm/mtcomm.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/ocom.o + .text 0x0000000000000000 0x0 NxFunc/comm/ocom.o + .data 0x0000000000000000 0x0 NxFunc/comm/ocom.o + .bss 0x0000000000000000 0x0 NxFunc/comm/ocom.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/comm/ocom.o + .rodata.OCOM_SYNC + 0x0000000000000000 0x3 NxFunc/comm/ocom.o + .text.ReadOComBuffEmpty + 0x0000000000000000 0x42 NxFunc/comm/ocom.o + .rodata 0x0000000000000000 0xa6 NxFunc/comm/ocom.o + .text.GetAOComPacket + 0x0000000000000000 0x128 NxFunc/comm/ocom.o + .text.GetOComExData + 0x0000000000000000 0xc8 NxFunc/comm/ocom.o + .text.SendAOComPacket + 0x0000000000000000 0x68 NxFunc/comm/ocom.o + .text.SendOComExData + 0x0000000000000000 0xa0 NxFunc/comm/ocom.o + .text.PacketAOCom + 0x0000000000000000 0x44 NxFunc/comm/ocom.o + .debug_info 0x0000000000000000 0xf2e NxFunc/comm/ocom.o + .debug_abbrev 0x0000000000000000 0x248 NxFunc/comm/ocom.o + .debug_aranges + 0x0000000000000000 0x48 NxFunc/comm/ocom.o + .debug_ranges 0x0000000000000000 0x38 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x40a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x18 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x94 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x34 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x97 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x330 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xfd NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1f NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x43 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x6a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x3d NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x145 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x35 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x29 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x20f NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xef NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1df NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x6d NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x56 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x5be NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x114 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x27 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x144 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x30 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x408 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x88 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x24f NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x141 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x2be NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x135 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x8d NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x2a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x90 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x287 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x57a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1be NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/ocom.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/ocom.o + .debug_line 0x0000000000000000 0xaf4 NxFunc/comm/ocom.o + .debug_str 0x0000000000000000 0x997a6 NxFunc/comm/ocom.o + .comment 0x0000000000000000 0x7c NxFunc/comm/ocom.o + .debug_frame 0x0000000000000000 0xe8 NxFunc/comm/ocom.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/comm/ocom.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/protocol.o + .text 0x0000000000000000 0x0 NxFunc/comm/protocol.o + .data 0x0000000000000000 0x0 NxFunc/comm/protocol.o + .bss 0x0000000000000000 0x0 NxFunc/comm/protocol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/comm/protocol.o + .debug_info 0x0000000000000000 0xa71 NxFunc/comm/protocol.o + .debug_abbrev 0x0000000000000000 0x1a4 NxFunc/comm/protocol.o + .debug_aranges + 0x0000000000000000 0x18 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x3ff NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xef NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/comm/protocol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/protocol.o + .debug_line 0x0000000000000000 0x9c8 NxFunc/comm/protocol.o + .debug_str 0x0000000000000000 0x995fd NxFunc/comm/protocol.o + .comment 0x0000000000000000 0x7c NxFunc/comm/protocol.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/comm/protocol.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .text 0x0000000000000000 0x0 NxFunc/comm/xmodem.o + .data 0x0000000000000000 0x0 NxFunc/comm/xmodem.o + .bss 0x0000000000000000 0x0 NxFunc/comm/xmodem.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/comm/xmodem.o + .text.OutDebugBufInfo + 0x0000000000000000 0xc NxFunc/comm/xmodem.o + .text.CalcXModemCrc + 0x0000000000000000 0x6e NxFunc/comm/xmodem.o + .text.CheckXModemDat + 0x0000000000000000 0x8e NxFunc/comm/xmodem.o + .text.XmodemReceive + 0x0000000000000000 0x400 NxFunc/comm/xmodem.o + .debug_info 0x0000000000000000 0xd7e NxFunc/comm/xmodem.o + .debug_abbrev 0x0000000000000000 0x24b NxFunc/comm/xmodem.o + .debug_aranges + 0x0000000000000000 0x38 NxFunc/comm/xmodem.o + .debug_ranges 0x0000000000000000 0x28 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x43c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x18 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x94 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x34 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x97 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x330 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xfd NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1f NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x43 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x6a NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x52 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x40 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x3d NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x145 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x35 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x29 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x20 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x20f NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x2e NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xef NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1df NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x22 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x6d NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x56 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x5be NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x114 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x27 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x144 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x30 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x3c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x408 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x57 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x88 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x24f NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x141 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x2be NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x135 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x8d NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x28 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x2a NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x90 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x287 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x57a NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x22a NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1be NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x64 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x10 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x1c NxFunc/comm/xmodem.o + .debug_macro 0x0000000000000000 0x16 NxFunc/comm/xmodem.o + .debug_line 0x0000000000000000 0xaf7 NxFunc/comm/xmodem.o + .debug_str 0x0000000000000000 0x99cad NxFunc/comm/xmodem.o + .comment 0x0000000000000000 0x7c NxFunc/comm/xmodem.o + .debug_frame 0x0000000000000000 0xa4 NxFunc/comm/xmodem.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/comm/xmodem.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/colorcontrol.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/colorcontrol.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/colorcontrol.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/colorcontrol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/colorcontrol.o + .text.InitColorControl + 0x0000000000000000 0x20 NxFunc/controlbus/colorcontrol.o + .text.SendColorCommand + 0x0000000000000000 0x32 NxFunc/controlbus/colorcontrol.o + .text.RequestColorStatus + 0x0000000000000000 0x1e NxFunc/controlbus/colorcontrol.o + .text.RequestColorVersion + 0x0000000000000000 0x1e NxFunc/controlbus/colorcontrol.o + .text.RequestColorNvPara + 0x0000000000000000 0x20 NxFunc/controlbus/colorcontrol.o + .debug_info 0x0000000000000000 0x1599 NxFunc/controlbus/colorcontrol.o + .debug_abbrev 0x0000000000000000 0x255 NxFunc/controlbus/colorcontrol.o + .debug_aranges + 0x0000000000000000 0x40 NxFunc/controlbus/colorcontrol.o + .debug_ranges 0x0000000000000000 0x30 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x421 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/colorcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/colorcontrol.o + .debug_line 0x0000000000000000 0xa52 NxFunc/controlbus/colorcontrol.o + .debug_str 0x0000000000000000 0x9a257 NxFunc/controlbus/colorcontrol.o + .comment 0x0000000000000000 0x7c NxFunc/controlbus/colorcontrol.o + .debug_frame 0x0000000000000000 0xd0 NxFunc/controlbus/colorcontrol.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/controlbus/colorcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/controlbus.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/controlbus.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/controlbus.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/controlbus.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/controlbus.o + .debug_info 0x0000000000000000 0xe02 NxFunc/controlbus/controlbus.o + .debug_abbrev 0x0000000000000000 0x1dc NxFunc/controlbus/controlbus.o + .debug_aranges + 0x0000000000000000 0x18 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x412 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/controlbus.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/controlbus.o + .debug_line 0x0000000000000000 0x9de NxFunc/controlbus/controlbus.o + .debug_str 0x0000000000000000 0x99dca NxFunc/controlbus/controlbus.o + .comment 0x0000000000000000 0x7c NxFunc/controlbus/controlbus.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/controlbus/controlbus.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/corecontrol.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/corecontrol.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/corecontrol.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/corecontrol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/corecontrol.o + .text.InitCoreControl + 0x0000000000000000 0x20 NxFunc/controlbus/corecontrol.o + .debug_info 0x0000000000000000 0xea8 NxFunc/controlbus/corecontrol.o + .debug_abbrev 0x0000000000000000 0x209 NxFunc/controlbus/corecontrol.o + .debug_aranges + 0x0000000000000000 0x20 NxFunc/controlbus/corecontrol.o + .debug_ranges 0x0000000000000000 0x10 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x421 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/corecontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/corecontrol.o + .debug_line 0x0000000000000000 0xa00 NxFunc/controlbus/corecontrol.o + .debug_str 0x0000000000000000 0x99e78 NxFunc/controlbus/corecontrol.o + .comment 0x0000000000000000 0x7c NxFunc/controlbus/corecontrol.o + .debug_frame 0x0000000000000000 0x34 NxFunc/controlbus/corecontrol.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/controlbus/corecontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/extiocontrol.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/extiocontrol.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/extiocontrol.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/extiocontrol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/extiocontrol.o + .text.InitExtIOControl + 0x0000000000000000 0x20 NxFunc/controlbus/extiocontrol.o + .text.SendExtIOCommand + 0x0000000000000000 0x34 NxFunc/controlbus/extiocontrol.o + .text.RequestExtIOStatus + 0x0000000000000000 0x20 NxFunc/controlbus/extiocontrol.o + .text.RequestExtIOVersion + 0x0000000000000000 0x20 NxFunc/controlbus/extiocontrol.o + .debug_info 0x0000000000000000 0x13e3 NxFunc/controlbus/extiocontrol.o + .debug_abbrev 0x0000000000000000 0x255 NxFunc/controlbus/extiocontrol.o + .debug_aranges + 0x0000000000000000 0x38 NxFunc/controlbus/extiocontrol.o + .debug_ranges 0x0000000000000000 0x28 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x421 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/extiocontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/extiocontrol.o + .debug_line 0x0000000000000000 0xa40 NxFunc/controlbus/extiocontrol.o + .debug_str 0x0000000000000000 0x9a0b2 NxFunc/controlbus/extiocontrol.o + .comment 0x0000000000000000 0x7c NxFunc/controlbus/extiocontrol.o + .debug_frame 0x0000000000000000 0xa8 NxFunc/controlbus/extiocontrol.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/controlbus/extiocontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/headcontrol.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/headcontrol.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/headcontrol.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/headcontrol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/headcontrol.o + .text.InitHeadControl + 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .text.SendHeadCommand + 0x0000000000000000 0x34 NxFunc/controlbus/headcontrol.o + .text.RequestHeadStatus + 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .text.RequestHeadVersion + 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .text.RequestHeadNvPara + 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .debug_info 0x0000000000000000 0x16d3 NxFunc/controlbus/headcontrol.o + .debug_abbrev 0x0000000000000000 0x255 NxFunc/controlbus/headcontrol.o + .debug_aranges + 0x0000000000000000 0x40 NxFunc/controlbus/headcontrol.o + .debug_ranges 0x0000000000000000 0x30 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x421 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/headcontrol.o + .debug_macro 0x0000000000000000 0x306 NxFunc/controlbus/headcontrol.o + .debug_line 0x0000000000000000 0xa52 NxFunc/controlbus/headcontrol.o + .debug_str 0x0000000000000000 0x9ade9 NxFunc/controlbus/headcontrol.o + .comment 0x0000000000000000 0x7c NxFunc/controlbus/headcontrol.o + .debug_frame 0x0000000000000000 0xd0 NxFunc/controlbus/headcontrol.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/controlbus/headcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/controlbus/sewhdcontrol.o + .text 0x0000000000000000 0x0 NxFunc/controlbus/sewhdcontrol.o + .data 0x0000000000000000 0x0 NxFunc/controlbus/sewhdcontrol.o + .bss 0x0000000000000000 0x0 NxFunc/controlbus/sewhdcontrol.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/controlbus/sewhdcontrol.o + .text.SendSewHeadCommand + 0x0000000000000000 0x34 NxFunc/controlbus/sewhdcontrol.o + .text.RequestSewHeadStatus + 0x0000000000000000 0x20 NxFunc/controlbus/sewhdcontrol.o + .text.RequestSewHeadVersion + 0x0000000000000000 0x20 NxFunc/controlbus/sewhdcontrol.o + .text.RequestSewHeadNvPara + 0x0000000000000000 0x20 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x18 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x94 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x34 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x97 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x330 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xfd NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1f NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x43 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x6a NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x52 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x10 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x40 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x3d NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x145 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x35 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x29 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x16 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x20 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x20f NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x2e NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xef NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1df NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x22 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x6d NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x56 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x5be NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x114 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x27 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x144 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x30 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x3c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x408 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x57 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x88 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x24f NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x141 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x2be NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x135 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x8d NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x28 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x2a NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x90 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x287 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x57a NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x22a NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1be NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x1c NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x0000000000000000 0x11e NxFunc/controlbus/sewhdcontrol.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc16.o + .text 0x0000000000000000 0x0 NxFunc/crc/crc16.o + .data 0x0000000000000000 0x0 NxFunc/crc/crc16.o + .bss 0x0000000000000000 0x0 NxFunc/crc/crc16.o + .rodata.CRC16_LIST + 0x0000000000000000 0x200 NxFunc/crc/crc16.o + .text.AddCrc16 + 0x0000000000000000 0x38 NxFunc/crc/crc16.o + .text.CalcCrc16 + 0x0000000000000000 0x42 NxFunc/crc/crc16.o + .text.CalcCheckSum + 0x0000000000000000 0x3e NxFunc/crc/crc16.o + .debug_info 0x0000000000000000 0xa23 NxFunc/crc/crc16.o + .debug_abbrev 0x0000000000000000 0x20f NxFunc/crc/crc16.o + .debug_aranges + 0x0000000000000000 0x30 NxFunc/crc/crc16.o + .debug_ranges 0x0000000000000000 0x20 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x22b NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x22 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x18 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x94 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x3c NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x34 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x57 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x97 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x330 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0xfd NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x1f NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x43 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x6a NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x3d NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x145 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x35 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x29 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x22a NxFunc/crc/crc16.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc16.o + .debug_line 0x0000000000000000 0x61f NxFunc/crc/crc16.o + .debug_str 0x0000000000000000 0x8a03 NxFunc/crc/crc16.o + .comment 0x0000000000000000 0x7c NxFunc/crc/crc16.o + .debug_frame 0x0000000000000000 0x84 NxFunc/crc/crc16.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/crc/crc16.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc32.o + .text 0x0000000000000000 0x0 NxFunc/crc/crc32.o + .data 0x0000000000000000 0x0 NxFunc/crc/crc32.o + .bss 0x0000000000000000 0x0 NxFunc/crc/crc32.o + .rodata.CRC32_LIST + 0x0000000000000000 0x400 NxFunc/crc/crc32.o + .text.AddCrc32 + 0x0000000000000000 0x30 NxFunc/crc/crc32.o + .text.CalcCrc32 + 0x0000000000000000 0x40 NxFunc/crc/crc32.o + .debug_info 0x0000000000000000 0x9b8 NxFunc/crc/crc32.o + .debug_abbrev 0x0000000000000000 0x1f3 NxFunc/crc/crc32.o + .debug_aranges + 0x0000000000000000 0x28 NxFunc/crc/crc32.o + .debug_ranges 0x0000000000000000 0x18 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x22c NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x22 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x18 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x94 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x3c NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x34 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x57 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x97 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x330 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0xfd NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x1f NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x43 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x6a NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x3d NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x145 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x35 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x29 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/crc/crc32.o + .debug_macro 0x0000000000000000 0x22a NxFunc/crc/crc32.o + .debug_line 0x0000000000000000 0x5f6 NxFunc/crc/crc32.o + .debug_str 0x0000000000000000 0x89c3 NxFunc/crc/crc32.o + .comment 0x0000000000000000 0x7c NxFunc/crc/crc32.o + .debug_frame 0x0000000000000000 0x5c NxFunc/crc/crc32.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/crc/crc32.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/crc/crc8.o + .text 0x0000000000000000 0x0 NxFunc/crc/crc8.o + .data 0x0000000000000000 0x0 NxFunc/crc/crc8.o + .bss 0x0000000000000000 0x0 NxFunc/crc/crc8.o + .rodata.CRC8_TABLE + 0x0000000000000000 0x100 NxFunc/crc/crc8.o + .text.CalcCrc8 + 0x0000000000000000 0x48 NxFunc/crc/crc8.o + .debug_info 0x0000000000000000 0x964 NxFunc/crc/crc8.o + .debug_abbrev 0x0000000000000000 0x1bb NxFunc/crc/crc8.o + .debug_aranges + 0x0000000000000000 0x20 NxFunc/crc/crc8.o + .debug_ranges 0x0000000000000000 0x10 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x22c NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x22 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x18 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x94 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x3c NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x34 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x57 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x97 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x330 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0xfd NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x1f NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x43 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x6a NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x52 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x10 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x40 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x1c NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x3d NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x145 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x35 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x29 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x16 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x20 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/crc/crc8.o + .debug_macro 0x0000000000000000 0x22a NxFunc/crc/crc8.o + .debug_line 0x0000000000000000 0x5d6 NxFunc/crc/crc8.o + .debug_str 0x0000000000000000 0x899d NxFunc/crc/crc8.o + .comment 0x0000000000000000 0x7c NxFunc/crc/crc8.o + .debug_frame 0x0000000000000000 0x38 NxFunc/crc/crc8.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/crc/crc8.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .text 0x0000000000000000 0x0 NxFunc/modbus/ef_a.o + .data 0x0000000000000000 0x0 NxFunc/modbus/ef_a.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/ef_a.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/ef_a.o + .text.EFDefOutEn + 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .text.EFDefOutDis + 0x0000000000000000 0xc NxFunc/modbus/ef_a.o + .text.RegisterEFCommFunc + 0x0000000000000000 0x3c NxFunc/modbus/ef_a.o + .text.InitEF 0x0000000000000000 0x284 NxFunc/modbus/ef_a.o + .text.EFTx 0x0000000000000000 0x1d0 NxFunc/modbus/ef_a.o + .rodata 0x0000000000000000 0x66 NxFunc/modbus/ef_a.o + .text.EFRx 0x0000000000000000 0x108 NxFunc/modbus/ef_a.o + .text.EFComm 0x0000000000000000 0x58 NxFunc/modbus/ef_a.o + .text.InitAsyncEFCtrl + 0x0000000000000000 0x84 NxFunc/modbus/ef_a.o + .text.RegEFCmdProc + 0x0000000000000000 0x30 NxFunc/modbus/ef_a.o + .text.AddEFCmd + 0x0000000000000000 0xb8 NxFunc/modbus/ef_a.o + .text.GetEFCmdBufLen + 0x0000000000000000 0x2c NxFunc/modbus/ef_a.o + .text.AsyncEFTask + 0x0000000000000000 0x1fc NxFunc/modbus/ef_a.o + .debug_info 0x0000000000000000 0x10b5 NxFunc/modbus/ef_a.o + .debug_abbrev 0x0000000000000000 0x329 NxFunc/modbus/ef_a.o + .debug_aranges + 0x0000000000000000 0x78 NxFunc/modbus/ef_a.o + .debug_ranges 0x0000000000000000 0x68 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x458 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/ef_a.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/ef_a.o + .debug_line 0x0000000000000000 0xc1f NxFunc/modbus/ef_a.o + .debug_str 0x0000000000000000 0x99bf4 NxFunc/modbus/ef_a.o + .comment 0x0000000000000000 0x7c NxFunc/modbus/ef_a.o + .debug_frame 0x0000000000000000 0x1c8 NxFunc/modbus/ef_a.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/modbus/ef_a.o + COMMON 0x0000000000000000 0x294 NxFunc/modbus/ef_a.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_def.o + .text 0x0000000000000000 0x0 NxFunc/modbus/modbus_def.o + .data 0x0000000000000000 0x0 NxFunc/modbus/modbus_def.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/modbus_def.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_def.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_m.o + .text 0x0000000000000000 0x0 NxFunc/modbus/modbus_m.o + .data 0x0000000000000000 0x0 NxFunc/modbus/modbus_m.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/modbus_m.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_m.o + .text.ModbusComm + 0x0000000000000000 0x136 NxFunc/modbus/modbus_m.o + .text.ModbusComm16 + 0x0000000000000000 0x68 NxFunc/modbus/modbus_m.o + .text.ModbusComm32 + 0x0000000000000000 0x72 NxFunc/modbus/modbus_m.o + .text.ModbusCommMulti + 0x0000000000000000 0x7a NxFunc/modbus/modbus_m.o + .text.GetRs485CmdBufLen + 0x0000000000000000 0x18 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x76 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_m.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_s.o + .text 0x0000000000000000 0x0 NxFunc/modbus/modbus_s.o + .data 0x0000000000000000 0x0 NxFunc/modbus/modbus_s.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/modbus_s.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_s.o + .debug_info 0x0000000000000000 0xa46 NxFunc/modbus/modbus_s.o + .debug_abbrev 0x0000000000000000 0x1a4 NxFunc/modbus/modbus_s.o + .debug_aranges + 0x0000000000000000 0x18 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x40d NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x76 NxFunc/modbus/modbus_s.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_s.o + .debug_line 0x0000000000000000 0x9dc NxFunc/modbus/modbus_s.o + .debug_str 0x0000000000000000 0x999f6 NxFunc/modbus/modbus_s.o + .comment 0x0000000000000000 0x7c NxFunc/modbus/modbus_s.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/modbus/modbus_s.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/modbus_tcp.o + .text 0x0000000000000000 0x0 NxFunc/modbus/modbus_tcp.o + .data 0x0000000000000000 0x0 NxFunc/modbus/modbus_tcp.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/modbus_tcp.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/modbus_tcp.o + .debug_info 0x0000000000000000 0xa46 NxFunc/modbus/modbus_tcp.o + .debug_abbrev 0x0000000000000000 0x1a4 NxFunc/modbus/modbus_tcp.o + .debug_aranges + 0x0000000000000000 0x18 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x3fe NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0xe3 NxFunc/modbus/modbus_tcp.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/modbus_tcp.o + .debug_line 0x0000000000000000 0x9d1 NxFunc/modbus/modbus_tcp.o + .debug_str 0x0000000000000000 0x998ba NxFunc/modbus/modbus_tcp.o + .comment 0x0000000000000000 0x7c NxFunc/modbus/modbus_tcp.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/modbus/modbus_tcp.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/modbus/one2onecomm.o + .text 0x0000000000000000 0x0 NxFunc/modbus/one2onecomm.o + .data 0x0000000000000000 0x0 NxFunc/modbus/one2onecomm.o + .bss 0x0000000000000000 0x0 NxFunc/modbus/one2onecomm.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/modbus/one2onecomm.o + .text.RegisterOne2OneCommFunc + 0x0000000000000000 0x2a NxFunc/modbus/one2onecomm.o + .text.InitOne2OneComm + 0x0000000000000000 0x160 NxFunc/modbus/one2onecomm.o + .text.One2OneCommTx + 0x0000000000000000 0x184 NxFunc/modbus/one2onecomm.o + .rodata 0x0000000000000000 0x74 NxFunc/modbus/one2onecomm.o + .text.One2OneCommRx + 0x0000000000000000 0x1e8 NxFunc/modbus/one2onecomm.o + .text.InitOne2OneCtrl + 0x0000000000000000 0x4c NxFunc/modbus/one2onecomm.o + .text.RegOne2OneCmdProc + 0x0000000000000000 0x20 NxFunc/modbus/one2onecomm.o + .text.AddOne2OneCmd + 0x0000000000000000 0xa4 NxFunc/modbus/one2onecomm.o + .text.One2OneTask + 0x0000000000000000 0x130 NxFunc/modbus/one2onecomm.o + .bss.timeBuf.10465 + 0x0000000000000000 0x4 NxFunc/modbus/one2onecomm.o + .bss.idx.10467 + 0x0000000000000000 0x1 NxFunc/modbus/one2onecomm.o + .bss.num.10468 + 0x0000000000000000 0x1 NxFunc/modbus/one2onecomm.o + .bss.rxDat.10466 + 0x0000000000000000 0x23 NxFunc/modbus/one2onecomm.o + .debug_info 0x0000000000000000 0x100a NxFunc/modbus/one2onecomm.o + .debug_abbrev 0x0000000000000000 0x2f3 NxFunc/modbus/one2onecomm.o + .debug_aranges + 0x0000000000000000 0x58 NxFunc/modbus/one2onecomm.o + .debug_ranges 0x0000000000000000 0x48 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x421 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x18 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x94 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x34 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x97 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x330 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xfd NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1f NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x43 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x6a NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x52 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x40 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x3d NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x145 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x35 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x29 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x20 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x20f NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x2e NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xef NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1df NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x22 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x6d NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x56 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x5be NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x114 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x27 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x144 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x30 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x3c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x408 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x57 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x88 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x24f NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x141 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x2be NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x135 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x8d NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x28 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x2a NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x90 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x287 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x57a NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x22a NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1be NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x10 NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x1c NxFunc/modbus/one2onecomm.o + .debug_macro 0x0000000000000000 0x16 NxFunc/modbus/one2onecomm.o + .debug_line 0x0000000000000000 0xbb1 NxFunc/modbus/one2onecomm.o + .debug_str 0x0000000000000000 0x99b25 NxFunc/modbus/one2onecomm.o + .comment 0x0000000000000000 0x7c NxFunc/modbus/one2onecomm.o + .debug_frame 0x0000000000000000 0x13c NxFunc/modbus/one2onecomm.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/modbus/one2onecomm.o + COMMON 0x0000000000000000 0x1ec NxFunc/modbus/one2onecomm.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stdebug/stdebug.o + .text 0x0000000000000000 0x0 NxFunc/stdebug/stdebug.o + .data 0x0000000000000000 0x0 NxFunc/stdebug/stdebug.o + .bss 0x0000000000000000 0x0 NxFunc/stdebug/stdebug.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/stdebug/stdebug.o + .rodata 0x0000000000000000 0x137 NxFunc/stdebug/stdebug.o + .text.OutStackInfo + 0x0000000000000000 0x120 NxFunc/stdebug/stdebug.o + .debug_info 0x0000000000000000 0xb1f NxFunc/stdebug/stdebug.o + .debug_abbrev 0x0000000000000000 0x1e7 NxFunc/stdebug/stdebug.o + .debug_aranges + 0x0000000000000000 0x20 NxFunc/stdebug/stdebug.o + .debug_ranges 0x0000000000000000 0x10 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x431 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x18 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x94 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x34 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x97 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x330 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xfd NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1f NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x43 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x6a NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x3d NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x145 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x35 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x29 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x20f NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x2e NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xef NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1df NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x6d NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x56 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x5be NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x114 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x27 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x144 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x30 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x408 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x88 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x24f NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x141 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x2be NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x135 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x8d NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x28 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x2a NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x90 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x287 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x57a NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1be NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stdebug/stdebug.o + .debug_line 0x0000000000000000 0xa59 NxFunc/stdebug/stdebug.o + .debug_str 0x0000000000000000 0x99723 NxFunc/stdebug/stdebug.o + .comment 0x0000000000000000 0x7c NxFunc/stdebug/stdebug.o + .debug_frame 0x0000000000000000 0x30 NxFunc/stdebug/stdebug.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/stdebug/stdebug.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stepdriver/tmc260.o + .text 0x0000000000000000 0x0 NxFunc/stepdriver/tmc260.o + .data 0x0000000000000000 0x0 NxFunc/stepdriver/tmc260.o + .bss 0x0000000000000000 0x0 NxFunc/stepdriver/tmc260.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/stepdriver/tmc260.o + .debug_info 0x0000000000000000 0xa46 NxFunc/stepdriver/tmc260.o + .debug_abbrev 0x0000000000000000 0x1a4 NxFunc/stepdriver/tmc260.o + .debug_aranges + 0x0000000000000000 0x18 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x405 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x18 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x94 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x34 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x97 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x330 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xfd NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1f NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x43 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x6a NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x3d NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x145 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x35 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x29 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x20f NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x2e NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xef NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1df NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x6d NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x56 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x5be NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x114 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x27 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x144 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x30 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x408 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x88 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x24f NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x141 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x2be NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x135 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x8d NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x28 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x2a NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x90 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x287 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x57a NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x1be NxFunc/stepdriver/tmc260.o + .debug_macro 0x0000000000000000 0x194 NxFunc/stepdriver/tmc260.o + .debug_line 0x0000000000000000 0x9e9 NxFunc/stepdriver/tmc260.o + .debug_str 0x0000000000000000 0x998d1 NxFunc/stepdriver/tmc260.o + .comment 0x0000000000000000 0x7c NxFunc/stepdriver/tmc260.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/stepdriver/tmc260.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc NxFunc/stm32motos/stm32motos.o + .text 0x0000000000000000 0x0 NxFunc/stm32motos/stm32motos.o + .data 0x0000000000000000 0x0 NxFunc/stm32motos/stm32motos.o + .bss 0x0000000000000000 0x0 NxFunc/stm32motos/stm32motos.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_EnableCounter + 0x0000000000000000 0x1e NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_DisableCounter + 0x0000000000000000 0x1e NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_SetAutoReload + 0x0000000000000000 0x1a NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_ClearFlag_UPDATE + 0x0000000000000000 0x1a NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_IsActiveFlag_UPDATE + 0x0000000000000000 0x24 NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_EnableIT_UPDATE + 0x0000000000000000 0x1e NxFunc/stm32motos/stm32motos.o + .text.LL_TIM_DisableIT_UPDATE + 0x0000000000000000 0x1e NxFunc/stm32motos/stm32motos.o + .data.SoftPwmProc + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto1PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto1PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto1SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto1SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto2PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto2PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto2SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto2SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto3PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto3PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto3SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto3SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto4PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto4PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto4SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto4SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto5PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto5PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto5SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto5SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto6PulseOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto6PulseOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto6SignOn + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .data.Moto6SignOff + 0x0000000000000000 0x4 NxFunc/stm32motos/stm32motos.o + .text.SetMotoPulseOn + 0x0000000000000000 0xac NxFunc/stm32motos/stm32motos.o + .text.SetMotoPulseOff + 0x0000000000000000 0xac NxFunc/stm32motos/stm32motos.o + .text.SetMotoSignOn + 0x0000000000000000 0xac NxFunc/stm32motos/stm32motos.o + .text.SetMotoSignOff + 0x0000000000000000 0xac NxFunc/stm32motos/stm32motos.o + .text.InitStm32Moto1OutFunc + 0x0000000000000000 0x40 NxFunc/stm32motos/stm32motos.o + .text.InitSTM32Moto1Ctrl + 0x0000000000000000 0x34 NxFunc/stm32motos/stm32motos.o + .text.STM32Moto1IntProc + 0x0000000000000000 0x154 NxFunc/stm32motos/stm32motos.o + .text.STM32Moto1Speed + 0x0000000000000000 0x23c NxFunc/stm32motos/stm32motos.o + .rodata 0x0000000000000000 0x5a NxFunc/stm32motos/stm32motos.o + .text.STM32Moto1Start + 0x0000000000000000 0x2bc NxFunc/stm32motos/stm32motos.o + .text.STM32Moto1Stop + 0x0000000000000000 0x38 NxFunc/stm32motos/stm32motos.o + .text.STM32Moto1Run + 0x0000000000000000 0xd8 NxFunc/stm32motos/stm32motos.o + .text.GetSTM32Moto1State + 0x0000000000000000 0x14 NxFunc/stm32motos/stm32motos.o + .text.GetSTM32Moto1RealPos + 0x0000000000000000 0x14 NxFunc/stm32motos/stm32motos.o + .text.SetSTM32Moto1RealPos + 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .text.SetSTM32Moto1Mode + 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .text.InitSTM32Speed + 0x0000000000000000 0x20 NxFunc/stm32motos/stm32motos.o + .text.STM32MotoSpeedIntProc + 0x0000000000000000 0x2c NxFunc/stm32motos/stm32motos.o + .text.InitSTM32SoftPwm + 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .text.InitSTM32Motos + 0x0000000000000000 0x10 NxFunc/stm32motos/stm32motos.o + .text.TestStm32Motos + 0x0000000000000000 0xf0 NxFunc/stm32motos/stm32motos.o + .debug_info 0x0000000000000000 0x13f5 NxFunc/stm32motos/stm32motos.o + .debug_abbrev 0x0000000000000000 0x30f NxFunc/stm32motos/stm32motos.o + .debug_aranges + 0x0000000000000000 0xf0 NxFunc/stm32motos/stm32motos.o + .debug_ranges 0x0000000000000000 0xe0 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x46c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xa60 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x18 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x94 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x34 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x97 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x330 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xfd NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1f NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x43 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1a3 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x6a NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x52 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x10 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xd7 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x3d NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x145 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x35 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x29 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x20 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1e1 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xf2 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x20f NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x2e NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xef NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1df NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x22 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xb7 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xd23 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xfd8c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x6d NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x3468 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x56 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x5be NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x4d5 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1cb NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x114 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1ea NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x27 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x144 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1bc NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x30 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x3c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x408 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x57 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x88 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x24f NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x141 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xb5 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x2be NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x135 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x8d NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0xd0 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x28 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x2a NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x90 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x287 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x57a NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1b4 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x22a NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1be NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x40 NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x1c NxFunc/stm32motos/stm32motos.o + .debug_macro 0x0000000000000000 0x16 NxFunc/stm32motos/stm32motos.o + .debug_line 0x0000000000000000 0xf9c NxFunc/stm32motos/stm32motos.o + .debug_str 0x0000000000000000 0x9cc04 NxFunc/stm32motos/stm32motos.o + .comment 0x0000000000000000 0x7c NxFunc/stm32motos/stm32motos.o + .debug_frame 0x0000000000000000 0x3cc NxFunc/stm32motos/stm32motos.o + .ARM.attributes + 0x0000000000000000 0x33 NxFunc/stm32motos/stm32motos.o + COMMON 0x0000000000000000 0x80 NxFunc/stm32motos/stm32motos.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/apptasks.o + .text 0x0000000000000000 0x0 Users/App/apptasks.o + .data 0x0000000000000000 0x0 Users/App/apptasks.o + .bss 0x0000000000000000 0x0 Users/App/apptasks.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/App/apptasks.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/App/apptasks.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/App/apptasks.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/App/apptasks.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/App/apptasks.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xa60 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x22 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x40 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x18 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x94 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x3c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x34 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x57 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x97 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x330 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xfd Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x10 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x52 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1f Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x43 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x20 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1a3 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x10 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x6a Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x52 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x40 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x10 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x40 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xd7 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x3d Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x145 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x35 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x29 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x20 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1e1 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x22a Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xf2 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x20f Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x2e Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x22 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xef Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1df Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x22 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xb7 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xd23 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xfd8c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x6d Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x3468 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x56 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x5be Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x4d5 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1cb Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x114 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1ea Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x27 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x144 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1bc Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x30 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x3c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x408 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x57 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x88 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x24f Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x141 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xb5 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x2be Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x135 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x8d Users/App/apptasks.o + .debug_macro 0x0000000000000000 0xd0 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x28 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x2a Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x90 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x287 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x57a Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1b4 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x22a Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1be Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x16 Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x1c Users/App/apptasks.o + .debug_macro 0x0000000000000000 0x8d Users/App/apptasks.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .text 0x0000000000000000 0x0 Users/App/sewhead/sewhead.o + .data 0x0000000000000000 0x0 Users/App/sewhead/sewhead.o + .bss 0x0000000000000000 0x0 Users/App/sewhead/sewhead.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/App/sewhead/sewhead.o + .text.InitSTM32PwmTimer + 0x0000000000000000 0xc Users/App/sewhead/sewhead.o + .text.FootMotoCmdRst + 0x0000000000000000 0x12 Users/App/sewhead/sewhead.o + .text.FootMotoDis + 0x0000000000000000 0x14 Users/App/sewhead/sewhead.o + .text.FootMotoEn + 0x0000000000000000 0x14 Users/App/sewhead/sewhead.o + .text.FootMotoReset + 0x0000000000000000 0x14 Users/App/sewhead/sewhead.o + .text.SetMotoPosValue + 0x0000000000000000 0x24 Users/App/sewhead/sewhead.o + .text.PFootCtrlUp + 0x0000000000000000 0x30 Users/App/sewhead/sewhead.o + .text.PFootCtrlDown + 0x0000000000000000 0x4c Users/App/sewhead/sewhead.o + .text.PFootCtrlBack + 0x0000000000000000 0x4c Users/App/sewhead/sewhead.o + .text.CanCmdProc + 0x0000000000000000 0x3ac Users/App/sewhead/sewhead.o + .text.GetAngleFromEncoder + 0x0000000000000000 0x70 Users/App/sewhead/sewhead.o + .text.RefreshOutputSta + 0x0000000000000000 0x14c Users/App/sewhead/sewhead.o + .text.OutputCtrl + 0x0000000000000000 0x198 Users/App/sewhead/sewhead.o + .text.TestOutputTask + 0x0000000000000000 0x8c Users/App/sewhead/sewhead.o + .bss.thistime.11214 + 0x0000000000000000 0x4 Users/App/sewhead/sewhead.o + .bss.outsta.11215 + 0x0000000000000000 0x4 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xa60 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x22 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x40 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x18 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x94 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x3c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x34 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x57 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x97 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x330 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xfd Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x10 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x52 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1f Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x43 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x20 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1a3 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x10 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x6a Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x52 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x40 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x10 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x40 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xd7 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x3d Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x145 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x35 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x29 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x20 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1e1 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x22a Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xf2 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x20f Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x2e Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x22 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xef Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1df Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x22 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xb7 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xd23 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xfd8c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x6d Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x3468 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x56 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x5be Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x4d5 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1cb Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x114 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1ea Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x27 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x144 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1bc Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x30 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x3c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x408 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x57 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x88 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x24f Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x141 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xb5 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x2be Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x135 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x8d Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0xd0 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x28 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x2a Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x90 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x287 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x57a Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1b4 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x22a Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1be Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x124 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x8d Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x16 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x10 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x76 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000000000 0x10 Users/App/sewhead/sewhead.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/debug.o + .text 0x0000000000000000 0x0 Users/App/workctrl/debug.o + .data 0x0000000000000000 0x0 Users/App/workctrl/debug.o + .bss 0x0000000000000000 0x0 Users/App/workctrl/debug.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/App/workctrl/debug.o + .text.SetInputNameString + 0x0000000000000000 0x24 Users/App/workctrl/debug.o + .text.SetOutputNameString + 0x0000000000000000 0x24 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xa60 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x18 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x94 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x34 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x97 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x330 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xfd Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1f Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x43 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1a3 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x6a Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xd7 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x3d Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x145 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x35 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x29 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1e1 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xf2 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x20f Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x2e Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xef Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1df Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xb7 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xd23 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xfd8c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x6d Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x3468 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x56 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x5be Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x4d5 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1cb Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x114 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1ea Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x27 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x144 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1bc Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x30 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x408 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x88 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x24f Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x141 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xb5 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x2be Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x135 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x8d Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0xd0 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x28 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x2a Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x90 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x287 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x57a Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1b4 Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1be Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/debug.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/debug.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/para.o + .text 0x0000000000000000 0x0 Users/App/workctrl/para.o + .data 0x0000000000000000 0x0 Users/App/workctrl/para.o + .bss 0x0000000000000000 0x0 Users/App/workctrl/para.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/App/workctrl/para.o + .data.g_pHeadPara + 0x0000000000000000 0x4 Users/App/workctrl/para.o + .debug_info 0x0000000000000000 0xb24 Users/App/workctrl/para.o + .debug_abbrev 0x0000000000000000 0x1c2 Users/App/workctrl/para.o + .debug_aranges + 0x0000000000000000 0x18 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x3fb Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xa60 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x18 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x94 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x34 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x97 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x330 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xfd Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1f Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x43 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1a3 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x6a Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xd7 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x3d Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x145 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x35 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x29 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1e1 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xf2 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x20f Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x2e Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xef Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1df Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xb7 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xd23 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xfd8c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x6d Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x3468 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x56 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x5be Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x4d5 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1cb Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x114 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1ea Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x27 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x144 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1bc Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x30 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x408 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x88 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x24f Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x141 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xb5 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x2be Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x135 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x8d Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0xd0 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x28 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x2a Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x90 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x287 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x57a Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1b4 Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x1be Users/App/workctrl/para.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/para.o + .debug_line 0x0000000000000000 0x9db Users/App/workctrl/para.o + .debug_str 0x0000000000000000 0x9960e Users/App/workctrl/para.o + .comment 0x0000000000000000 0x7c Users/App/workctrl/para.o + .ARM.attributes + 0x0000000000000000 0x33 Users/App/workctrl/para.o + COMMON 0x0000000000000000 0x400 Users/App/workctrl/para.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/App/workctrl/workctrl.o + .text 0x0000000000000000 0x0 Users/App/workctrl/workctrl.o + .data 0x0000000000000000 0x0 Users/App/workctrl/workctrl.o + .bss 0x0000000000000000 0x0 Users/App/workctrl/workctrl.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xa60 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x18 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x94 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x34 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x97 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x330 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xfd Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1f Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x43 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1a3 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x6a Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x52 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x10 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x40 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xd7 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x3d Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x145 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x35 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x29 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x20 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1e1 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xf2 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x20f Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x2e Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xef Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1df Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xb7 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xd23 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xfd8c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x6d Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x3468 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x56 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x5be Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x4d5 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1cb Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x114 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1ea Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x27 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x144 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1bc Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x30 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x3c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x408 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x57 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x88 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x24f Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x141 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xb5 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x2be Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x135 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x8d Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0xd0 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x28 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x2a Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x90 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x287 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x57a Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1b4 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22a Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1be Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x124 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x8d Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x1c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x16 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x10c Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000000000 0x22 Users/App/workctrl/workctrl.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Base/inout.o + .text 0x0000000000000000 0x0 Users/Base/inout.o + .data 0x0000000000000000 0x0 Users/Base/inout.o + .bss 0x0000000000000000 0x0 Users/Base/inout.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/Base/inout.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/Base/inout.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/Base/inout.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/Base/inout.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/Base/inout.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/Base/inout.o + .text.LL_GPIO_TogglePin + 0x0000000000000000 0x38 Users/Base/inout.o + .text.SetEn485OutToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetEn485OutStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetEn485_2_OutToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetEn485_2_OutStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetMoto1StepToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetMoto1StepStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetMoto1DirToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetMoto1DirStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetMoto1EnOn + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetMoto1EnOff + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetMoto1EnToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetMoto1EnStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.GetInputZPStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetSysLedToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetSysLedStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetErrLedOn + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetErrLedOff + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetErrLedToggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetErrLedStatus + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetOutputPWM1Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetOutputPWM1Status + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetOutputPWM2Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.GetOutputPWM2Status + 0x0000000000000000 0x1c Users/Base/inout.o + .text.SetOutput1Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput2Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput3Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput4Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput5Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput6Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput7Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutput8Toggle + 0x0000000000000000 0x18 Users/Base/inout.o + .text.SetOutputNull + 0x0000000000000000 0xc Users/Base/inout.o + .text.GetInputNullOn + 0x0000000000000000 0xe Users/Base/inout.o + .text.GetInputNullOff + 0x0000000000000000 0xe Users/Base/inout.o + .debug_macro 0x0000000000000000 0xa60 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x22 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x40 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x18 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x94 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x3c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x34 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x16 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x57 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x97 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x330 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xfd Users/Base/inout.o + .debug_macro 0x0000000000000000 0x10 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x52 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1f Users/Base/inout.o + .debug_macro 0x0000000000000000 0x43 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x20 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1a3 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x10 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x6a Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x52 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x40 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x10 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x40 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xd7 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x3d Users/Base/inout.o + .debug_macro 0x0000000000000000 0x16 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x145 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x16 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x35 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x16 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x29 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x16 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x20 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1e1 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x22a Users/Base/inout.o + .debug_macro 0x0000000000000000 0xf2 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x20f Users/Base/inout.o + .debug_macro 0x0000000000000000 0x2e Users/Base/inout.o + .debug_macro 0x0000000000000000 0x22 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xef Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1df Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x22 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xb7 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xd23 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xfd8c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x6d Users/Base/inout.o + .debug_macro 0x0000000000000000 0x3468 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x56 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x5be Users/Base/inout.o + .debug_macro 0x0000000000000000 0x4d5 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1cb Users/Base/inout.o + .debug_macro 0x0000000000000000 0x114 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1ea Users/Base/inout.o + .debug_macro 0x0000000000000000 0x27 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x144 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1bc Users/Base/inout.o + .debug_macro 0x0000000000000000 0x30 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x3c Users/Base/inout.o + .debug_macro 0x0000000000000000 0x408 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x57 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x88 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x24f Users/Base/inout.o + .debug_macro 0x0000000000000000 0x141 Users/Base/inout.o + .debug_macro 0x0000000000000000 0xb5 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x2be Users/Base/inout.o + .debug_macro 0x0000000000000000 0x135 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x8d Users/Base/inout.o + .debug_macro 0x0000000000000000 0xd0 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x28 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x2a Users/Base/inout.o + .debug_macro 0x0000000000000000 0x90 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x287 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x57a Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1b4 Users/Base/inout.o + .debug_macro 0x0000000000000000 0x22a Users/Base/inout.o + .debug_macro 0x0000000000000000 0x1be Users/Base/inout.o + .debug_macro 0x0000000000000000 0x52 Users/Base/inout.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .group 0x0000000000000000 0xc Users/Config/config.o + .text 0x0000000000000000 0x0 Users/Config/config.o + .data 0x0000000000000000 0x0 Users/Config/config.o + .bss 0x0000000000000000 0x0 Users/Config/config.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/Config/config.o + .rodata.VERSION_INFO + 0x0000000000000000 0x20 Users/Config/config.o + .rodata 0x0000000000000000 0xa3 Users/Config/config.o + .text.GetCompileDateTime + 0x0000000000000000 0x120 Users/Config/config.o + .text.GetVersionStr + 0x0000000000000000 0xd4 Users/Config/config.o + .text.GetBuildStr + 0x0000000000000000 0x28 Users/Config/config.o + .debug_info 0x0000000000000000 0xbb9 Users/Config/config.o + .debug_abbrev 0x0000000000000000 0x1f8 Users/Config/config.o + .debug_aranges + 0x0000000000000000 0x30 Users/Config/config.o + .debug_ranges 0x0000000000000000 0x20 Users/Config/config.o + .debug_macro 0x0000000000000000 0x3ec Users/Config/config.o + .debug_macro 0x0000000000000000 0xa60 Users/Config/config.o + .debug_macro 0x0000000000000000 0x22 Users/Config/config.o + .debug_macro 0x0000000000000000 0x40 Users/Config/config.o + .debug_macro 0x0000000000000000 0x18 Users/Config/config.o + .debug_macro 0x0000000000000000 0x94 Users/Config/config.o + .debug_macro 0x0000000000000000 0x3c Users/Config/config.o + .debug_macro 0x0000000000000000 0x34 Users/Config/config.o + .debug_macro 0x0000000000000000 0x16 Users/Config/config.o + .debug_macro 0x0000000000000000 0x57 Users/Config/config.o + .debug_macro 0x0000000000000000 0x97 Users/Config/config.o + .debug_macro 0x0000000000000000 0x330 Users/Config/config.o + .debug_macro 0x0000000000000000 0xfd Users/Config/config.o + .debug_macro 0x0000000000000000 0x10 Users/Config/config.o + .debug_macro 0x0000000000000000 0x52 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1f Users/Config/config.o + .debug_macro 0x0000000000000000 0x43 Users/Config/config.o + .debug_macro 0x0000000000000000 0x20 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1a3 Users/Config/config.o + .debug_macro 0x0000000000000000 0x10 Users/Config/config.o + .debug_macro 0x0000000000000000 0x6a Users/Config/config.o + .debug_macro 0x0000000000000000 0x1c Users/Config/config.o + .debug_macro 0x0000000000000000 0x52 Users/Config/config.o + .debug_macro 0x0000000000000000 0x40 Users/Config/config.o + .debug_macro 0x0000000000000000 0x10 Users/Config/config.o + .debug_macro 0x0000000000000000 0x40 Users/Config/config.o + .debug_macro 0x0000000000000000 0xd7 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1c Users/Config/config.o + .debug_macro 0x0000000000000000 0x3d Users/Config/config.o + .debug_macro 0x0000000000000000 0x16 Users/Config/config.o + .debug_macro 0x0000000000000000 0x145 Users/Config/config.o + .debug_macro 0x0000000000000000 0x16 Users/Config/config.o + .debug_macro 0x0000000000000000 0x35 Users/Config/config.o + .debug_macro 0x0000000000000000 0x16 Users/Config/config.o + .debug_macro 0x0000000000000000 0x29 Users/Config/config.o + .debug_macro 0x0000000000000000 0x16 Users/Config/config.o + .debug_macro 0x0000000000000000 0x20 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1e1 Users/Config/config.o + .debug_macro 0x0000000000000000 0x22a Users/Config/config.o + .debug_macro 0x0000000000000000 0xf2 Users/Config/config.o + .debug_macro 0x0000000000000000 0x20f Users/Config/config.o + .debug_macro 0x0000000000000000 0x2e Users/Config/config.o + .debug_macro 0x0000000000000000 0x22 Users/Config/config.o + .debug_macro 0x0000000000000000 0xef Users/Config/config.o + .debug_macro 0x0000000000000000 0x1df Users/Config/config.o + .debug_macro 0x0000000000000000 0x1c Users/Config/config.o + .debug_macro 0x0000000000000000 0x22 Users/Config/config.o + .debug_macro 0x0000000000000000 0xb7 Users/Config/config.o + .debug_macro 0x0000000000000000 0xd23 Users/Config/config.o + .debug_macro 0x0000000000000000 0xfd8c Users/Config/config.o + .debug_macro 0x0000000000000000 0x6d Users/Config/config.o + .debug_macro 0x0000000000000000 0x3468 Users/Config/config.o + .debug_macro 0x0000000000000000 0x56 Users/Config/config.o + .debug_macro 0x0000000000000000 0x5be Users/Config/config.o + .debug_macro 0x0000000000000000 0x4d5 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1cb Users/Config/config.o + .debug_macro 0x0000000000000000 0x114 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1ea Users/Config/config.o + .debug_macro 0x0000000000000000 0x27 Users/Config/config.o + .debug_macro 0x0000000000000000 0x144 Users/Config/config.o + .debug_macro 0x0000000000000000 0x1bc Users/Config/config.o + .debug_macro 0x0000000000000000 0x30 Users/Config/config.o + .debug_macro 0x0000000000000000 0x3c Users/Config/config.o + .debug_macro 0x0000000000000000 0x408 Users/Config/config.o + .debug_macro 0x0000000000000000 0x57 Users/Config/config.o + .debug_macro 0x0000000000000000 0x88 Users/Config/config.o + .debug_macro 0x0000000000000000 0x24f Users/Config/config.o + .debug_macro 0x0000000000000000 0x141 Users/Config/config.o + .debug_macro 0x0000000000000000 0xb5 Users/Config/config.o + .debug_macro 0x0000000000000000 0x2be Users/Config/config.o + .debug_macro 0x0000000000000000 0x135 Users/Config/config.o + .debug_macro 0x0000000000000000 0x8d Users/Config/config.o + .debug_macro 0x0000000000000000 0xd0 Users/Config/config.o + .debug_macro 0x0000000000000000 0x28 Users/Config/config.o + .debug_macro 0x0000000000000000 0x2a Users/Config/config.o + .debug_macro 0x0000000000000000 0x90 Users/Config/config.o + .debug_macro 0x0000000000000000 0x287 Users/Config/config.o + .debug_macro 0x0000000000000000 0x57a Users/Config/config.o + .debug_macro 0x0000000000000000 0x1b4 Users/Config/config.o + .debug_macro 0x0000000000000000 0x22a Users/Config/config.o + .debug_macro 0x0000000000000000 0x1be Users/Config/config.o + .debug_line 0x0000000000000000 0x9f9 Users/Config/config.o + .debug_str 0x0000000000000000 0x995b6 Users/Config/config.o + .comment 0x0000000000000000 0x7c Users/Config/config.o + .debug_frame 0x0000000000000000 0x88 Users/Config/config.o + .ARM.attributes + 0x0000000000000000 0x33 Users/Config/config.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/Func/canwork.o + .text 0x0000000000000000 0x0 Users/Func/canwork.o + .data 0x0000000000000000 0x0 Users/Func/canwork.o + .bss 0x0000000000000000 0x0 Users/Func/canwork.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/Func/canwork.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/Func/canwork.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/Func/canwork.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/Func/canwork.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/Func/canwork.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xa60 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x22 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x40 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x18 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x94 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x3c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x34 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x16 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x57 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x97 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x330 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xfd Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x10 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x52 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1f Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x43 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x20 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1a3 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x10 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x6a Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x52 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x40 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x10 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x40 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xd7 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x3d Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x16 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x145 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x16 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x35 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x16 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x29 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x16 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x20 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1e1 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x22a Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xf2 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x20f Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x2e Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x22 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xef Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1df Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x22 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xb7 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xd23 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xfd8c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x6d Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x3468 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x56 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x5be Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x4d5 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1cb Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x114 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1ea Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x27 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x144 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1bc Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x30 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x3c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x408 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x57 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x88 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x24f Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x141 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xb5 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x2be Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x135 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x8d Users/Func/canwork.o + .debug_macro 0x0000000000000000 0xd0 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x28 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x2a Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x90 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x287 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x57a Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1b4 Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x22a Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1be Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x1c Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x11e Users/Func/canwork.o + .debug_macro 0x0000000000000000 0x8d Users/Func/canwork.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .group 0x0000000000000000 0xc Users/tasks.o + .text 0x0000000000000000 0x0 Users/tasks.o + .data 0x0000000000000000 0x0 Users/tasks.o + .bss 0x0000000000000000 0x0 Users/tasks.o + .rodata.CHANNEL_OFFSET_TAB + 0x0000000000000000 0x7 Users/tasks.o + .rodata.OFFSET_TAB_CCMRx + 0x0000000000000000 0x7 Users/tasks.o + .rodata.SHIFT_TAB_OCxx + 0x0000000000000000 0x7 Users/tasks.o + .rodata.SHIFT_TAB_ICxx + 0x0000000000000000 0x7 Users/tasks.o + .rodata.SHIFT_TAB_CCxP + 0x0000000000000000 0x7 Users/tasks.o + .rodata.SHIFT_TAB_OISx + 0x0000000000000000 0x7 Users/tasks.o + .text.SetVectorTable + 0x0000000000000000 0x30 Users/tasks.o + .debug_macro 0x0000000000000000 0xa60 Users/tasks.o + .debug_macro 0x0000000000000000 0x22 Users/tasks.o + .debug_macro 0x0000000000000000 0x40 Users/tasks.o + .debug_macro 0x0000000000000000 0x18 Users/tasks.o + .debug_macro 0x0000000000000000 0x94 Users/tasks.o + .debug_macro 0x0000000000000000 0x3c Users/tasks.o + .debug_macro 0x0000000000000000 0x34 Users/tasks.o + .debug_macro 0x0000000000000000 0x16 Users/tasks.o + .debug_macro 0x0000000000000000 0x57 Users/tasks.o + .debug_macro 0x0000000000000000 0x97 Users/tasks.o + .debug_macro 0x0000000000000000 0x330 Users/tasks.o + .debug_macro 0x0000000000000000 0xfd Users/tasks.o + .debug_macro 0x0000000000000000 0x10 Users/tasks.o + .debug_macro 0x0000000000000000 0x52 Users/tasks.o + .debug_macro 0x0000000000000000 0x1f Users/tasks.o + .debug_macro 0x0000000000000000 0x43 Users/tasks.o + .debug_macro 0x0000000000000000 0x20 Users/tasks.o + .debug_macro 0x0000000000000000 0x1a3 Users/tasks.o + .debug_macro 0x0000000000000000 0x10 Users/tasks.o + .debug_macro 0x0000000000000000 0x6a Users/tasks.o + .debug_macro 0x0000000000000000 0x1c Users/tasks.o + .debug_macro 0x0000000000000000 0x52 Users/tasks.o + .debug_macro 0x0000000000000000 0x40 Users/tasks.o + .debug_macro 0x0000000000000000 0x10 Users/tasks.o + .debug_macro 0x0000000000000000 0x40 Users/tasks.o + .debug_macro 0x0000000000000000 0xd7 Users/tasks.o + .debug_macro 0x0000000000000000 0x1c Users/tasks.o + .debug_macro 0x0000000000000000 0x3d Users/tasks.o + .debug_macro 0x0000000000000000 0x16 Users/tasks.o + .debug_macro 0x0000000000000000 0x145 Users/tasks.o + .debug_macro 0x0000000000000000 0x16 Users/tasks.o + .debug_macro 0x0000000000000000 0x35 Users/tasks.o + .debug_macro 0x0000000000000000 0x16 Users/tasks.o + .debug_macro 0x0000000000000000 0x29 Users/tasks.o + .debug_macro 0x0000000000000000 0x16 Users/tasks.o + .debug_macro 0x0000000000000000 0x20 Users/tasks.o + .debug_macro 0x0000000000000000 0x1e1 Users/tasks.o + .debug_macro 0x0000000000000000 0x22a Users/tasks.o + .debug_macro 0x0000000000000000 0xf2 Users/tasks.o + .debug_macro 0x0000000000000000 0x20f Users/tasks.o + .debug_macro 0x0000000000000000 0x2e Users/tasks.o + .debug_macro 0x0000000000000000 0x22 Users/tasks.o + .debug_macro 0x0000000000000000 0xef Users/tasks.o + .debug_macro 0x0000000000000000 0x1df Users/tasks.o + .debug_macro 0x0000000000000000 0x1c Users/tasks.o + .debug_macro 0x0000000000000000 0x22 Users/tasks.o + .debug_macro 0x0000000000000000 0xb7 Users/tasks.o + .debug_macro 0x0000000000000000 0xd23 Users/tasks.o + .debug_macro 0x0000000000000000 0xfd8c Users/tasks.o + .debug_macro 0x0000000000000000 0x6d Users/tasks.o + .debug_macro 0x0000000000000000 0x3468 Users/tasks.o + .debug_macro 0x0000000000000000 0x56 Users/tasks.o + .debug_macro 0x0000000000000000 0x5be Users/tasks.o + .debug_macro 0x0000000000000000 0x4d5 Users/tasks.o + .debug_macro 0x0000000000000000 0x1cb Users/tasks.o + .debug_macro 0x0000000000000000 0x114 Users/tasks.o + .debug_macro 0x0000000000000000 0x1ea Users/tasks.o + .debug_macro 0x0000000000000000 0x27 Users/tasks.o + .debug_macro 0x0000000000000000 0x144 Users/tasks.o + .debug_macro 0x0000000000000000 0x1bc Users/tasks.o + .debug_macro 0x0000000000000000 0x30 Users/tasks.o + .debug_macro 0x0000000000000000 0x3c Users/tasks.o + .debug_macro 0x0000000000000000 0x408 Users/tasks.o + .debug_macro 0x0000000000000000 0x57 Users/tasks.o + .debug_macro 0x0000000000000000 0x88 Users/tasks.o + .debug_macro 0x0000000000000000 0x24f Users/tasks.o + .debug_macro 0x0000000000000000 0x141 Users/tasks.o + .debug_macro 0x0000000000000000 0xb5 Users/tasks.o + .debug_macro 0x0000000000000000 0x2be Users/tasks.o + .debug_macro 0x0000000000000000 0x135 Users/tasks.o + .debug_macro 0x0000000000000000 0x8d Users/tasks.o + .debug_macro 0x0000000000000000 0xd0 Users/tasks.o + .debug_macro 0x0000000000000000 0x28 Users/tasks.o + .debug_macro 0x0000000000000000 0x2a Users/tasks.o + .debug_macro 0x0000000000000000 0x90 Users/tasks.o + .debug_macro 0x0000000000000000 0x287 Users/tasks.o + .debug_macro 0x0000000000000000 0x57a Users/tasks.o + .debug_macro 0x0000000000000000 0x1b4 Users/tasks.o + .debug_macro 0x0000000000000000 0x22a Users/tasks.o + .debug_macro 0x0000000000000000 0x1be Users/tasks.o + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .text._atoi_r 0x0000000000000000 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .text.exit 0x0000000000000000 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .debug_frame 0x0000000000000000 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-exit.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .text.memcmp 0x0000000000000000 0x1e c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .debug_frame 0x0000000000000000 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcmp.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .text._printf_r + 0x0000000000000000 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .text._putchar_r + 0x0000000000000000 0x1e c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .text.putchar 0x0000000000000000 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .debug_frame 0x0000000000000000 0x58 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putchar.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .text._sprintf_r + 0x0000000000000000 0x38 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .text.sprintf 0x0000000000000000 0x40 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .debug_frame 0x0000000000000000 0x6c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sprintf.o) + .text 0x0000000000000000 0x14 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + .debug_frame 0x0000000000000000 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + .ARM.attributes + 0x0000000000000000 0x1b c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcmp.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strlen.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strlen.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .text.strncpy 0x0000000000000000 0x2a c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .debug_frame 0x0000000000000000 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strncpy.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .text._strtol_r + 0x0000000000000000 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .text.strtol_l + 0x0000000000000000 0x1c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .text.__swbuf 0x0000000000000000 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .text.fflush 0x0000000000000000 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__fp_lock + 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__fp_unlock + 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text._cleanup + 0x0000000000000000 0xc c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__sfp_lock_acquire + 0x0000000000000000 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__sfp_lock_release + 0x0000000000000000 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__sinit_lock_acquire + 0x0000000000000000 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__sinit_lock_release + 0x0000000000000000 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__fp_lock_all + 0x0000000000000000 0x14 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text.__fp_unlock_all + 0x0000000000000000 0x14 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .text._fwalk 0x0000000000000000 0x38 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .text._setlocale_r + 0x0000000000000000 0x38 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .text.__locale_mb_cur_max + 0x0000000000000000 0x1c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .text.__locale_ctype_ptr + 0x0000000000000000 0x1c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .text.setlocale + 0x0000000000000000 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .bss._PathLocale + 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .text._mbtowc_r + 0x0000000000000000 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .text.__ssputs_r + 0x0000000000000000 0xb4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .text.__ssprint_r + 0x0000000000000000 0xf0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .text._svfprintf_r + 0x0000000000000000 0x1f0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .rodata._svfprintf_r.str1.1 + 0x0000000000000000 0x11 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .debug_frame 0x0000000000000000 0x90 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-svfprintf.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .text.__sprint_r + 0x0000000000000000 0x1a c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .text.vfprintf + 0x0000000000000000 0x14 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .text._putc_r 0x0000000000000000 0x6c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .text.putc 0x0000000000000000 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .debug_frame 0x0000000000000000 0x48 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-putc.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .text.__seofread + 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .text._wctomb_r + 0x0000000000000000 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .text.__sfvwrite_r + 0x0000000000000000 0x29c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .debug_frame 0x0000000000000000 0x3c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fvwrite.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .text.memmove 0x0000000000000000 0x32 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .debug_frame 0x0000000000000000 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memmove.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .text._realloc_r + 0x0000000000000000 0x4c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .debug_frame 0x0000000000000000 0x3c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-reallocr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .text.cleanup_glue + 0x0000000000000000 0x1a c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .text._reclaim_reent + 0x0000000000000000 0xb8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .text._malloc_usable_size_r + 0x0000000000000000 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .debug_frame 0x0000000000000000 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-msizer.o) + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o + .eh_frame 0x0000000000000000 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o + .ARM.attributes + 0x0000000000000000 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o + .text 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + .data 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + .bss 0x0000000000000000 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + +Memory Configuration + +Name Origin Length Attributes +RAM 0x0000000020000000 0x000000000000c000 xrw +FLASH 0x0000000008000000 0x0000000000040000 xr +*default* 0x0000000000000000 0xffffffffffffffff + +Linker script and memory map + +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/crt0.o +LOAD Core/Src/can.o +LOAD Core/Src/gpio.o +LOAD Core/Src/main.o +LOAD Core/Src/stm32f1xx_hal_msp.o +LOAD Core/Src/stm32f1xx_it.o +LOAD Core/Src/syscalls.o +LOAD Core/Src/sysmem.o +LOAD Core/Src/system_stm32f1xx.o +LOAD Core/Src/tim.o +LOAD Core/Src/usart.o +LOAD Core/Startup/startup_stm32f103rctx.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o +LOAD Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o +LOAD NxBase/buttons.o +LOAD NxBase/canctrl.o +LOAD NxBase/console.o +LOAD NxBase/cpuid.o +LOAD NxBase/delay.o +LOAD NxBase/encrypt.o +LOAD NxBase/funcs.o +LOAD NxBase/i2crw.o +LOAD NxBase/iwdog.o +LOAD NxBase/serial.o +LOAD NxBase/shell.o +LOAD NxBase/spirw.o +LOAD NxBase/trigger.o +LOAD NxFunc/comm/comm.o +LOAD NxFunc/comm/mtcomm.o +LOAD NxFunc/comm/ocom.o +LOAD NxFunc/comm/protocol.o +LOAD NxFunc/comm/xmodem.o +LOAD NxFunc/controlbus/colorcontrol.o +LOAD NxFunc/controlbus/controlbus.o +LOAD NxFunc/controlbus/corecontrol.o +LOAD NxFunc/controlbus/extiocontrol.o +LOAD NxFunc/controlbus/headcontrol.o +LOAD NxFunc/controlbus/sewhdcontrol.o +LOAD NxFunc/crc/crc16.o +LOAD NxFunc/crc/crc32.o +LOAD NxFunc/crc/crc8.o +LOAD NxFunc/modbus/ef_a.o +LOAD NxFunc/modbus/modbus_def.o +LOAD NxFunc/modbus/modbus_m.o +LOAD NxFunc/modbus/modbus_s.o +LOAD NxFunc/modbus/modbus_tcp.o +LOAD NxFunc/modbus/one2onecomm.o +LOAD NxFunc/stdebug/stdebug.o +LOAD NxFunc/stepdriver/tmc260.o +LOAD NxFunc/stm32motos/stm32motos.o +LOAD Users/App/apptasks.o +LOAD Users/App/sewhead/sewhead.o +LOAD Users/App/workctrl/debug.o +LOAD Users/App/workctrl/para.o +LOAD Users/App/workctrl/workctrl.o +LOAD Users/Base/inout.o +LOAD Users/Config/config.o +LOAD Users/Func/canwork.o +LOAD Users/tasks.o +START GROUP +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libm.a +END GROUP +START GROUP +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m\libgcc.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a +END GROUP +START GROUP +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m\libgcc.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libnosys.a +END GROUP +START GROUP +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m\libgcc.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libnosys.a +END GROUP +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtend.o +LOAD c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + 0x000000002000c000 _estack = (ORIGIN (RAM) + LENGTH (RAM)) + 0x0000000000000200 _Min_Heap_Size = 0x200 + 0x0000000000000400 _Min_Stack_Size = 0x400 + +.isr_vector 0x0000000008000000 0x1e4 + 0x0000000008000000 . = ALIGN (0x4) + *(.isr_vector) + .isr_vector 0x0000000008000000 0x1e4 Core/Startup/startup_stm32f103rctx.o + 0x0000000008000000 g_pfnVectors + 0x00000000080001e4 . = ALIGN (0x4) + +.text 0x00000000080001e4 0xa75c + 0x00000000080001e4 . = ALIGN (0x4) + *(.text) + .text 0x00000000080001e4 0x40 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + .text 0x0000000008000224 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strlen.o) + 0x0000000008000224 strlen + *(.text*) + .text.MX_CAN_Init + 0x0000000008000234 0x70 Core/Src/can.o + 0x0000000008000234 MX_CAN_Init + .text.HAL_CAN_MspInit + 0x00000000080002a4 0xb8 Core/Src/can.o + 0x00000000080002a4 HAL_CAN_MspInit + .text.__NVIC_GetPriorityGrouping + 0x000000000800035c 0x1c Core/Src/gpio.o + .text.__NVIC_EnableIRQ + 0x0000000008000378 0x38 Core/Src/gpio.o + .text.__NVIC_SetPriority + 0x00000000080003b0 0x54 Core/Src/gpio.o + .text.NVIC_EncodePriority + 0x0000000008000404 0x64 Core/Src/gpio.o + .text.LL_APB2_GRP1_EnableClock + 0x0000000008000468 0x30 Core/Src/gpio.o + .text.LL_GPIO_SetPinMode + 0x0000000008000498 0x64 Core/Src/gpio.o + .text.LL_GPIO_SetOutputPin + 0x00000000080004fc 0x1e Core/Src/gpio.o + .text.LL_GPIO_ResetOutputPin + 0x000000000800051a 0x1e Core/Src/gpio.o + .text.LL_GPIO_AF_SetEXTISource + 0x0000000008000538 0x5c Core/Src/gpio.o + .text.MX_GPIO_Init + 0x0000000008000594 0x22c Core/Src/gpio.o + 0x0000000008000594 MX_GPIO_Init + .text.LL_RCC_HSE_Enable + 0x00000000080007c0 0x1c Core/Src/main.o + .text.LL_RCC_HSE_IsReady + 0x00000000080007dc 0x24 Core/Src/main.o + .text.LL_RCC_SetSysClkSource + 0x0000000008000800 0x28 Core/Src/main.o + .text.LL_RCC_GetSysClkSource + 0x0000000008000828 0x18 Core/Src/main.o + .text.LL_RCC_SetAHBPrescaler + 0x0000000008000840 0x28 Core/Src/main.o + .text.LL_RCC_SetAPB1Prescaler + 0x0000000008000868 0x28 Core/Src/main.o + .text.LL_RCC_SetAPB2Prescaler + 0x0000000008000890 0x28 Core/Src/main.o + .text.LL_RCC_PLL_Enable + 0x00000000080008b8 0x1c Core/Src/main.o + .text.LL_RCC_PLL_IsReady + 0x00000000080008d4 0x24 Core/Src/main.o + .text.LL_RCC_PLL_ConfigDomain_SYS + 0x00000000080008f8 0x30 Core/Src/main.o + .text.LL_FLASH_SetLatency + 0x0000000008000928 0x28 Core/Src/main.o + .text.LL_FLASH_GetLatency + 0x0000000008000950 0x18 Core/Src/main.o + .text.main 0x0000000008000968 0x2a Core/Src/main.o + 0x0000000008000968 main + *fill* 0x0000000008000992 0x2 + .text.SystemClock_Config + 0x0000000008000994 0x88 Core/Src/main.o + 0x0000000008000994 SystemClock_Config + .text.Error_Handler + 0x0000000008000a1c 0x8 Core/Src/main.o + 0x0000000008000a1c Error_Handler + .text.HAL_MspInit + 0x0000000008000a24 0x64 Core/Src/stm32f1xx_hal_msp.o + 0x0000000008000a24 HAL_MspInit + .text.LL_EXTI_IsActiveFlag_0_31 + 0x0000000008000a88 0x2c Core/Src/stm32f1xx_it.o + .text.LL_EXTI_ClearFlag_0_31 + 0x0000000008000ab4 0x1c Core/Src/stm32f1xx_it.o + .text.NMI_Handler + 0x0000000008000ad0 0x6 Core/Src/stm32f1xx_it.o + 0x0000000008000ad0 NMI_Handler + .text.HardFault_Handler + 0x0000000008000ad6 0x6 Core/Src/stm32f1xx_it.o + 0x0000000008000ad6 HardFault_Handler + .text.MemManage_Handler + 0x0000000008000adc 0x6 Core/Src/stm32f1xx_it.o + 0x0000000008000adc MemManage_Handler + .text.BusFault_Handler + 0x0000000008000ae2 0x6 Core/Src/stm32f1xx_it.o + 0x0000000008000ae2 BusFault_Handler + .text.UsageFault_Handler + 0x0000000008000ae8 0x6 Core/Src/stm32f1xx_it.o + 0x0000000008000ae8 UsageFault_Handler + .text.SVC_Handler + 0x0000000008000aee 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000aee SVC_Handler + .text.DebugMon_Handler + 0x0000000008000afa 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000afa DebugMon_Handler + .text.PendSV_Handler + 0x0000000008000b06 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000b06 PendSV_Handler + .text.SysTick_Handler + 0x0000000008000b12 0x10 Core/Src/stm32f1xx_it.o + 0x0000000008000b12 SysTick_Handler + *fill* 0x0000000008000b22 0x2 + .text.USB_HP_CAN1_TX_IRQHandler + 0x0000000008000b24 0x14 Core/Src/stm32f1xx_it.o + 0x0000000008000b24 USB_HP_CAN1_TX_IRQHandler + .text.USB_LP_CAN1_RX0_IRQHandler + 0x0000000008000b38 0x14 Core/Src/stm32f1xx_it.o + 0x0000000008000b38 USB_LP_CAN1_RX0_IRQHandler + .text.EXTI9_5_IRQHandler + 0x0000000008000b4c 0x3c Core/Src/stm32f1xx_it.o + 0x0000000008000b4c EXTI9_5_IRQHandler + .text.TIM1_BRK_IRQHandler + 0x0000000008000b88 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000b88 TIM1_BRK_IRQHandler + .text.USART1_IRQHandler + 0x0000000008000b94 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000b94 USART1_IRQHandler + .text.USART2_IRQHandler + 0x0000000008000ba0 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000ba0 USART2_IRQHandler + .text.USART3_IRQHandler + 0x0000000008000bac 0xc Core/Src/stm32f1xx_it.o + 0x0000000008000bac USART3_IRQHandler + .text.EXTI15_10_IRQHandler + 0x0000000008000bb8 0x22 Core/Src/stm32f1xx_it.o + 0x0000000008000bb8 EXTI15_10_IRQHandler + .text._close 0x0000000008000bda 0x16 Core/Src/syscalls.o + 0x0000000008000bda _close + .text._fstat 0x0000000008000bf0 0x1e Core/Src/syscalls.o + 0x0000000008000bf0 _fstat + .text._isatty 0x0000000008000c0e 0x14 Core/Src/syscalls.o + 0x0000000008000c0e _isatty + .text._lseek 0x0000000008000c22 0x18 Core/Src/syscalls.o + 0x0000000008000c22 _lseek + *fill* 0x0000000008000c3a 0x2 + .text._sbrk 0x0000000008000c3c 0x6c Core/Src/sysmem.o + 0x0000000008000c3c _sbrk + .text.SystemInit + 0x0000000008000ca8 0xc Core/Src/system_stm32f1xx.o + 0x0000000008000ca8 SystemInit + .text.__NVIC_GetPriorityGrouping + 0x0000000008000cb4 0x1c Core/Src/tim.o + .text.__NVIC_EnableIRQ + 0x0000000008000cd0 0x38 Core/Src/tim.o + .text.__NVIC_SetPriority + 0x0000000008000d08 0x54 Core/Src/tim.o + .text.NVIC_EncodePriority + 0x0000000008000d5c 0x64 Core/Src/tim.o + .text.LL_APB2_GRP1_EnableClock + 0x0000000008000dc0 0x30 Core/Src/tim.o + .text.LL_TIM_EnableARRPreload + 0x0000000008000df0 0x1e Core/Src/tim.o + .text.LL_TIM_SetClockSource + 0x0000000008000e0e 0x28 Core/Src/tim.o + .text.LL_TIM_SetTriggerOutput + 0x0000000008000e36 0x24 Core/Src/tim.o + .text.LL_TIM_DisableMasterSlaveMode + 0x0000000008000e5a 0x1e Core/Src/tim.o + .text.MX_TIM1_Init + 0x0000000008000e78 0x84 Core/Src/tim.o + 0x0000000008000e78 MX_TIM1_Init + .text.__NVIC_GetPriorityGrouping + 0x0000000008000efc 0x1c Core/Src/usart.o + .text.__NVIC_EnableIRQ + 0x0000000008000f18 0x38 Core/Src/usart.o + .text.__NVIC_SetPriority + 0x0000000008000f50 0x54 Core/Src/usart.o + .text.NVIC_EncodePriority + 0x0000000008000fa4 0x64 Core/Src/usart.o + .text.LL_APB1_GRP1_EnableClock + 0x0000000008001008 0x30 Core/Src/usart.o + .text.LL_APB2_GRP1_EnableClock + 0x0000000008001038 0x30 Core/Src/usart.o + .text.LL_USART_Enable + 0x0000000008001068 0x1e Core/Src/usart.o + .text.LL_USART_ConfigAsyncMode + 0x0000000008001086 0x2a Core/Src/usart.o + .text.LL_GPIO_AF_EnableRemap_USART1 + 0x00000000080010b0 0x20 Core/Src/usart.o + .text.MX_USART1_UART_Init + 0x00000000080010d0 0xd0 Core/Src/usart.o + 0x00000000080010d0 MX_USART1_UART_Init + .text.MX_USART2_UART_Init + 0x00000000080011a0 0xcc Core/Src/usart.o + 0x00000000080011a0 MX_USART2_UART_Init + .text.MX_USART3_UART_Init + 0x000000000800126c 0xd0 Core/Src/usart.o + 0x000000000800126c MX_USART3_UART_Init + .text.Reset_Handler + 0x000000000800133c 0x48 Core/Startup/startup_stm32f103rctx.o + 0x000000000800133c Reset_Handler + .text.Default_Handler + 0x0000000008001384 0x2 Core/Startup/startup_stm32f103rctx.o + 0x0000000008001384 RTC_Alarm_IRQHandler + 0x0000000008001384 EXTI2_IRQHandler + 0x0000000008001384 TIM8_TRG_COM_IRQHandler + 0x0000000008001384 TIM8_CC_IRQHandler + 0x0000000008001384 TIM1_CC_IRQHandler + 0x0000000008001384 TIM6_IRQHandler + 0x0000000008001384 PVD_IRQHandler + 0x0000000008001384 SDIO_IRQHandler + 0x0000000008001384 EXTI3_IRQHandler + 0x0000000008001384 EXTI0_IRQHandler + 0x0000000008001384 I2C2_EV_IRQHandler + 0x0000000008001384 ADC1_2_IRQHandler + 0x0000000008001384 SPI1_IRQHandler + 0x0000000008001384 TAMPER_IRQHandler + 0x0000000008001384 TIM8_UP_IRQHandler + 0x0000000008001384 DMA2_Channel2_IRQHandler + 0x0000000008001384 DMA1_Channel4_IRQHandler + 0x0000000008001384 RTC_IRQHandler + 0x0000000008001384 DMA1_Channel7_IRQHandler + 0x0000000008001384 CAN1_RX1_IRQHandler + 0x0000000008001384 UART5_IRQHandler + 0x0000000008001384 ADC3_IRQHandler + 0x0000000008001384 TIM4_IRQHandler + 0x0000000008001384 DMA2_Channel1_IRQHandler + 0x0000000008001384 I2C1_EV_IRQHandler + 0x0000000008001384 DMA1_Channel6_IRQHandler + 0x0000000008001384 UART4_IRQHandler + 0x0000000008001384 TIM3_IRQHandler + 0x0000000008001384 RCC_IRQHandler + 0x0000000008001384 TIM1_TRG_COM_IRQHandler + 0x0000000008001384 DMA1_Channel1_IRQHandler + 0x0000000008001384 Default_Handler + 0x0000000008001384 TIM7_IRQHandler + 0x0000000008001384 TIM5_IRQHandler + 0x0000000008001384 SPI2_IRQHandler + 0x0000000008001384 DMA1_Channel5_IRQHandler + 0x0000000008001384 EXTI4_IRQHandler + 0x0000000008001384 DMA1_Channel3_IRQHandler + 0x0000000008001384 FSMC_IRQHandler + 0x0000000008001384 TIM1_UP_IRQHandler + 0x0000000008001384 WWDG_IRQHandler + 0x0000000008001384 TIM2_IRQHandler + 0x0000000008001384 EXTI1_IRQHandler + 0x0000000008001384 DMA2_Channel4_5_IRQHandler + 0x0000000008001384 I2C2_ER_IRQHandler + 0x0000000008001384 DMA1_Channel2_IRQHandler + 0x0000000008001384 TIM8_BRK_IRQHandler + 0x0000000008001384 CAN1_SCE_IRQHandler + 0x0000000008001384 FLASH_IRQHandler + 0x0000000008001384 SPI3_IRQHandler + 0x0000000008001384 I2C1_ER_IRQHandler + 0x0000000008001384 USBWakeUp_IRQHandler + 0x0000000008001384 DMA2_Channel3_IRQHandler + *fill* 0x0000000008001386 0x2 + .text.HAL_Init + 0x0000000008001388 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x0000000008001388 HAL_Init + .text.HAL_InitTick + 0x00000000080013b4 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x00000000080013b4 HAL_InitTick + .text.HAL_IncTick + 0x0000000008001414 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x0000000008001414 HAL_IncTick + .text.HAL_GetTick + 0x0000000008001438 0x14 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x0000000008001438 HAL_GetTick + .text.HAL_CAN_Init + 0x000000000800144c 0x1f6 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x000000000800144c HAL_CAN_Init + .text.HAL_CAN_ConfigFilter + 0x0000000008001642 0x192 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001642 HAL_CAN_ConfigFilter + .text.HAL_CAN_Start + 0x00000000080017d4 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x00000000080017d4 HAL_CAN_Start + .text.HAL_CAN_AddTxMessage + 0x000000000800185c 0x1b4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x000000000800185c HAL_CAN_AddTxMessage + .text.HAL_CAN_GetRxMessage + 0x0000000008001a10 0x222 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001a10 HAL_CAN_GetRxMessage + .text.HAL_CAN_GetRxFifoFillLevel + 0x0000000008001c32 0x4e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001c32 HAL_CAN_GetRxFifoFillLevel + .text.HAL_CAN_ActivateNotification + 0x0000000008001c80 0x4a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001c80 HAL_CAN_ActivateNotification + .text.HAL_CAN_DeactivateNotification + 0x0000000008001cca 0x4c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001cca HAL_CAN_DeactivateNotification + .text.HAL_CAN_IRQHandler + 0x0000000008001d16 0x362 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008001d16 HAL_CAN_IRQHandler + .text.HAL_CAN_TxMailbox0AbortCallback + 0x0000000008002078 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x0000000008002078 HAL_CAN_TxMailbox0AbortCallback + .text.HAL_CAN_TxMailbox1AbortCallback + 0x000000000800208a 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x000000000800208a HAL_CAN_TxMailbox1AbortCallback + .text.HAL_CAN_TxMailbox2AbortCallback + 0x000000000800209c 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x000000000800209c HAL_CAN_TxMailbox2AbortCallback + .text.HAL_CAN_RxFifo1MsgPendingCallback + 0x00000000080020ae 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x00000000080020ae HAL_CAN_RxFifo1MsgPendingCallback + .text.HAL_CAN_RxFifo1FullCallback + 0x00000000080020c0 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x00000000080020c0 HAL_CAN_RxFifo1FullCallback + .text.HAL_CAN_SleepCallback + 0x00000000080020d2 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x00000000080020d2 HAL_CAN_SleepCallback + .text.HAL_CAN_WakeUpFromRxMsgCallback + 0x00000000080020e4 0x12 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x00000000080020e4 HAL_CAN_WakeUpFromRxMsgCallback + *fill* 0x00000000080020f6 0x2 + .text.__NVIC_SetPriorityGrouping + 0x00000000080020f8 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_GetPriorityGrouping + 0x0000000008002140 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_EnableIRQ + 0x000000000800215c 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.__NVIC_SetPriority + 0x0000000008002194 0x54 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.NVIC_EncodePriority + 0x00000000080021e8 0x64 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.SysTick_Config + 0x000000000800224c 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .text.HAL_NVIC_SetPriorityGrouping + 0x0000000008002290 0x16 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + 0x0000000008002290 HAL_NVIC_SetPriorityGrouping + .text.HAL_NVIC_SetPriority + 0x00000000080022a6 0x38 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + 0x00000000080022a6 HAL_NVIC_SetPriority + .text.HAL_NVIC_EnableIRQ + 0x00000000080022de 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + 0x00000000080022de HAL_NVIC_EnableIRQ + .text.HAL_SYSTICK_Config + 0x00000000080022fa 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + 0x00000000080022fa HAL_SYSTICK_Config + *fill* 0x0000000008002312 0x2 + .text.HAL_GPIO_Init + 0x0000000008002314 0x2d4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + 0x0000000008002314 HAL_GPIO_Init + .text.LL_EXTI_EnableIT_0_31 + 0x00000000080025e8 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_DisableIT_0_31 + 0x000000000800260c 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_EnableEvent_0_31 + 0x0000000008002630 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_DisableEvent_0_31 + 0x0000000008002654 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_EnableRisingTrig_0_31 + 0x0000000008002678 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_DisableRisingTrig_0_31 + 0x000000000800269c 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_EnableFallingTrig_0_31 + 0x00000000080026c0 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_DisableFallingTrig_0_31 + 0x00000000080026e4 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .text.LL_EXTI_Init + 0x0000000008002708 0xf8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + 0x0000000008002708 LL_EXTI_Init + .text.LL_GPIO_SetPinMode + 0x0000000008002800 0x64 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_SetPinSpeed + 0x0000000008002864 0x64 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_SetPinOutputType + 0x00000000080028c8 0x64 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_SetPinPull + 0x000000000800292c 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .text.LL_GPIO_Init + 0x0000000008002970 0xcc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + 0x0000000008002970 LL_GPIO_Init + .text.LL_RCC_GetSysClkSource + 0x0000000008002a3c 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetAHBPrescaler + 0x0000000008002a54 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetAPB1Prescaler + 0x0000000008002a6c 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetAPB2Prescaler + 0x0000000008002a84 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_PLL_GetMainSource + 0x0000000008002a9c 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_PLL_GetMultiplicator + 0x0000000008002ab4 0x18 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_PLL_GetPrediv + 0x0000000008002acc 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .text.LL_RCC_GetSystemClocksFreq + 0x0000000008002ae8 0x4a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002ae8 LL_RCC_GetSystemClocksFreq + *fill* 0x0000000008002b32 0x2 + .text.RCC_GetSystemClockFreq + 0x0000000008002b34 0x44 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002b34 RCC_GetSystemClockFreq + .text.RCC_GetHCLKClockFreq + 0x0000000008002b78 0x2c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002b78 RCC_GetHCLKClockFreq + .text.RCC_GetPCLK1ClockFreq + 0x0000000008002ba4 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002ba4 RCC_GetPCLK1ClockFreq + .text.RCC_GetPCLK2ClockFreq + 0x0000000008002bcc 0x28 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002bcc RCC_GetPCLK2ClockFreq + .text.RCC_PLL_GetFreqDomain_SYS + 0x0000000008002bf4 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x0000000008002bf4 RCC_PLL_GetFreqDomain_SYS + .text.LL_TIM_SetPrescaler + 0x0000000008002c54 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_SetAutoReload + 0x0000000008002c6e 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_SetRepetitionCounter + 0x0000000008002c88 0x1a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_GenerateEvent_UPDATE + 0x0000000008002ca2 0x1e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .text.LL_TIM_Init + 0x0000000008002cc0 0xec Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + 0x0000000008002cc0 LL_TIM_Init + .text.LL_USART_IsEnabled + 0x0000000008002dac 0x26 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_SetStopBitsLength + 0x0000000008002dd2 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_SetHWFlowCtrl + 0x0000000008002df6 0x24 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + *fill* 0x0000000008002e1a 0x2 + .text.LL_USART_SetBaudRate + 0x0000000008002e1c 0xbc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .text.LL_USART_Init + 0x0000000008002ed8 0xe4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + 0x0000000008002ed8 LL_USART_Init + .text.LL_SetSystemCoreClock + 0x0000000008002fbc 0x1c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + 0x0000000008002fbc LL_SetSystemCoreClock + .text.DefaultCanFilter + 0x0000000008002fd8 0x64 NxBase/canctrl.o + 0x0000000008002fd8 DefaultCanFilter + .text.RegistFilter + 0x000000000800303c 0x1c NxBase/canctrl.o + 0x000000000800303c RegistFilter + .text.InitCanCtrl + 0x0000000008003058 0x98 NxBase/canctrl.o + 0x0000000008003058 InitCanCtrl + .text.InitCanMsgList + 0x00000000080030f0 0x60 NxBase/canctrl.o + 0x00000000080030f0 InitCanMsgList + .text.TransCanDataToBus + 0x0000000008003150 0x98 NxBase/canctrl.o + 0x0000000008003150 TransCanDataToBus + .text.ResvCanDataFromBus + 0x00000000080031e8 0xa4 NxBase/canctrl.o + 0x00000000080031e8 ResvCanDataFromBus + .text.SendACANDataPacket + 0x000000000800328c 0xf0 NxBase/canctrl.o + 0x000000000800328c SendACANDataPacket + .text.GetACanDataPacket + 0x000000000800337c 0x84 NxBase/canctrl.o + 0x000000000800337c GetACanDataPacket + .text.CanTransIntProc + 0x0000000008003400 0x44 NxBase/canctrl.o + 0x0000000008003400 CanTransIntProc + .text.CanResvIntProc + 0x0000000008003444 0x30 NxBase/canctrl.o + 0x0000000008003444 CanResvIntProc + .text.HAL_CAN_TxMailbox0CompleteCallback + 0x0000000008003474 0x14 NxBase/canctrl.o + 0x0000000008003474 HAL_CAN_TxMailbox0CompleteCallback + .text.HAL_CAN_TxMailbox1CompleteCallback + 0x0000000008003488 0x14 NxBase/canctrl.o + 0x0000000008003488 HAL_CAN_TxMailbox1CompleteCallback + .text.HAL_CAN_TxMailbox2CompleteCallback + 0x000000000800349c 0x14 NxBase/canctrl.o + 0x000000000800349c HAL_CAN_TxMailbox2CompleteCallback + .text.HAL_CAN_RxFifo0MsgPendingCallback + 0x00000000080034b0 0x14 NxBase/canctrl.o + 0x00000000080034b0 HAL_CAN_RxFifo0MsgPendingCallback + .text.HAL_CAN_RxFifo0FullCallback + 0x00000000080034c4 0x1c NxBase/canctrl.o + 0x00000000080034c4 HAL_CAN_RxFifo0FullCallback + .text.HAL_CAN_ErrorCallback + 0x00000000080034e0 0x1c NxBase/canctrl.o + 0x00000000080034e0 HAL_CAN_ErrorCallback + .text.SendData + 0x00000000080034fc 0x34 NxBase/console.o + 0x00000000080034fc SendData + .text.ResvData + 0x0000000008003530 0x34 NxBase/console.o + 0x0000000008003530 ResvData + .text._read 0x0000000008003564 0x20 NxBase/console.o + 0x0000000008003564 _read + .text._write 0x0000000008003584 0x1e NxBase/console.o + 0x0000000008003584 _write + *fill* 0x00000000080035a2 0x2 + .text.IsConsoleCancel + 0x00000000080035a4 0x24 NxBase/console.o + 0x00000000080035a4 IsConsoleCancel + .text.EnterCritical + 0x00000000080035c8 0x24 NxBase/cpuid.o + 0x00000000080035c8 EnterCritical + .text.ExitCritical + 0x00000000080035ec 0x2c NxBase/cpuid.o + 0x00000000080035ec ExitCritical + .text.DelayUs 0x0000000008003618 0x2c NxBase/delay.o + 0x0000000008003618 DelayUs + .text.DelayMs 0x0000000008003644 0x38 NxBase/delay.o + 0x0000000008003644 DelayMs + .text.InitIWDog + 0x000000000800367c 0x32 NxBase/iwdog.o + 0x000000000800367c InitIWDog + .text.FeedIWDog + 0x00000000080036ae 0xc NxBase/iwdog.o + 0x00000000080036ae FeedIWDog + .text.LL_USART_Enable + 0x00000000080036ba 0x1e NxBase/serial.o + .text.LL_USART_IsActiveFlag_RXNE + 0x00000000080036d8 0x24 NxBase/serial.o + .text.LL_USART_IsActiveFlag_TC + 0x00000000080036fc 0x24 NxBase/serial.o + .text.LL_USART_IsActiveFlag_TXE + 0x0000000008003720 0x24 NxBase/serial.o + .text.LL_USART_EnableIT_RXNE + 0x0000000008003744 0x1e NxBase/serial.o + .text.LL_USART_EnableIT_TXE + 0x0000000008003762 0x1e NxBase/serial.o + .text.LL_USART_DisableIT_RXNE + 0x0000000008003780 0x1e NxBase/serial.o + .text.LL_USART_DisableIT_TXE + 0x000000000800379e 0x1e NxBase/serial.o + .text.LL_USART_ReceiveData8 + 0x00000000080037bc 0x18 NxBase/serial.o + .text.LL_USART_TransmitData8 + 0x00000000080037d4 0x1c NxBase/serial.o + .text.InitUsart1 + 0x00000000080037f0 0xbc NxBase/serial.o + 0x00000000080037f0 InitUsart1 + .text.Usart1SendData + 0x00000000080038ac 0xec NxBase/serial.o + 0x00000000080038ac Usart1SendData + .text.Usart1GetData + 0x0000000008003998 0xc4 NxBase/serial.o + 0x0000000008003998 Usart1GetData + .text.Usart1CleanRsBuf + 0x0000000008003a5c 0x30 NxBase/serial.o + 0x0000000008003a5c Usart1CleanRsBuf + .text.IsUsart1SendOver + 0x0000000008003a8c 0x2c NxBase/serial.o + 0x0000000008003a8c IsUsart1SendOver + .text.USART1IntProc + 0x0000000008003ab8 0x124 NxBase/serial.o + 0x0000000008003ab8 USART1IntProc + .text.Usart1SendDataSync + 0x0000000008003bdc 0x58 NxBase/serial.o + 0x0000000008003bdc Usart1SendDataSync + .text.Usart1GetDataSync + 0x0000000008003c34 0x64 NxBase/serial.o + 0x0000000008003c34 Usart1GetDataSync + .text.InitUsart2 + 0x0000000008003c98 0xbc NxBase/serial.o + 0x0000000008003c98 InitUsart2 + .text.Usart2SendData + 0x0000000008003d54 0xec NxBase/serial.o + 0x0000000008003d54 Usart2SendData + .text.Usart2GetData + 0x0000000008003e40 0xc4 NxBase/serial.o + 0x0000000008003e40 Usart2GetData + .text.Usart2CleanRsBuf + 0x0000000008003f04 0x30 NxBase/serial.o + 0x0000000008003f04 Usart2CleanRsBuf + .text.IsUsart2SendOver + 0x0000000008003f34 0x2c NxBase/serial.o + 0x0000000008003f34 IsUsart2SendOver + .text.USART2IntProc + 0x0000000008003f60 0x124 NxBase/serial.o + 0x0000000008003f60 USART2IntProc + .text.InitUsart3 + 0x0000000008004084 0xbc NxBase/serial.o + 0x0000000008004084 InitUsart3 + .text.Usart3SendData + 0x0000000008004140 0xec NxBase/serial.o + 0x0000000008004140 Usart3SendData + .text.Usart3GetData + 0x000000000800422c 0xc4 NxBase/serial.o + 0x000000000800422c Usart3GetData + .text.Usart3CleanRsBuf + 0x00000000080042f0 0x30 NxBase/serial.o + 0x00000000080042f0 Usart3CleanRsBuf + .text.IsUsart3SendOver + 0x0000000008004320 0x2c NxBase/serial.o + 0x0000000008004320 IsUsart3SendOver + .text.USART3IntProc + 0x000000000800434c 0x124 NxBase/serial.o + 0x000000000800434c USART3IntProc + .text.ChangeToUper + 0x0000000008004470 0x48 NxBase/shell.o + 0x0000000008004470 ChangeToUper + .text.AddShellCmd + 0x00000000080044b8 0xe0 NxBase/shell.o + 0x00000000080044b8 AddShellCmd + .text.__NVIC_SetPriority + 0x0000000008004598 0x54 NxBase/trigger.o + .text.SysTick_Config + 0x00000000080045ec 0x44 NxBase/trigger.o + .text.InitTrigger + 0x0000000008004630 0x6c NxBase/trigger.o + 0x0000000008004630 InitTrigger + .text.TriggerExTask + 0x000000000800469c 0xa0 NxBase/trigger.o + 0x000000000800469c TriggerExTask + .text.TriggerTask + 0x000000000800473c 0x70 NxBase/trigger.o + 0x000000000800473c TriggerTask + .text.TriggerIntProc + 0x00000000080047ac 0x50 NxBase/trigger.o + 0x00000000080047ac TriggerIntProc + .text.GetUsSoftTimer + 0x00000000080047fc 0x5c NxBase/trigger.o + 0x00000000080047fc GetUsSoftTimer + .text.GetMsSoftTimer10 + 0x0000000008004858 0x14 NxBase/trigger.o + 0x0000000008004858 GetMsSoftTimer10 + .text.InitSewHeadControl + 0x000000000800486c 0x20 NxFunc/controlbus/sewhdcontrol.o + 0x000000000800486c InitSewHeadControl + .text.RegisterModbusCommFunc + 0x000000000800488c 0x3c NxFunc/modbus/modbus_def.o + 0x000000000800488c RegisterModbusCommFunc + .text.DefSendData + 0x00000000080048c8 0x16 NxFunc/modbus/modbus_def.o + 0x00000000080048c8 DefSendData + .text.DefGetData + 0x00000000080048de 0x16 NxFunc/modbus/modbus_def.o + 0x00000000080048de DefGetData + .text.DefCleanRsBuf + 0x00000000080048f4 0xe NxFunc/modbus/modbus_def.o + 0x00000000080048f4 DefCleanRsBuf + .text.DefIsSendOver + 0x0000000008004902 0xe NxFunc/modbus/modbus_def.o + 0x0000000008004902 DefIsSendOver + .text.DefOutEn + 0x0000000008004910 0xc NxFunc/modbus/modbus_def.o + 0x0000000008004910 DefOutEn + .text.DefOutDis + 0x000000000800491c 0xc NxFunc/modbus/modbus_def.o + 0x000000000800491c DefOutDis + .text.AsciiToRtu + 0x0000000008004928 0x52 NxFunc/modbus/modbus_def.o + 0x0000000008004928 AsciiToRtu + .text.RtuToAscii + 0x000000000800497a 0x32 NxFunc/modbus/modbus_def.o + 0x000000000800497a RtuToAscii + .text.ModbusAddCrc16 + 0x00000000080049ac 0x4c NxFunc/modbus/modbus_def.o + 0x00000000080049ac ModbusAddCrc16 + .text.ModbusCrc16 + 0x00000000080049f8 0x52 NxFunc/modbus/modbus_def.o + 0x00000000080049f8 ModbusCrc16 + *fill* 0x0000000008004a4a 0x2 + .text.InitModbus_m + 0x0000000008004a4c 0x350 NxFunc/modbus/modbus_m.o + 0x0000000008004a4c InitModbus_m + .text.ModbusTx + 0x0000000008004d9c 0x854 NxFunc/modbus/modbus_m.o + 0x0000000008004d9c ModbusTx + .text.ModbusRx + 0x00000000080055f0 0xf50 NxFunc/modbus/modbus_m.o + 0x00000000080055f0 ModbusRx + .text.InitRs485Ctrl + 0x0000000008006540 0x4c NxFunc/modbus/modbus_m.o + 0x0000000008006540 InitRs485Ctrl + .text.RegRsCmdProc + 0x000000000800658c 0x20 NxFunc/modbus/modbus_m.o + 0x000000000800658c RegRsCmdProc + .text.AddRs485Cmd + 0x00000000080065ac 0x98 NxFunc/modbus/modbus_m.o + 0x00000000080065ac AddRs485Cmd + .text.Rs485Task + 0x0000000008006644 0x2a8 NxFunc/modbus/modbus_m.o + 0x0000000008006644 Rs485Task + .text.AppMainTask + 0x00000000080068ec 0x16 Users/App/apptasks.o + 0x00000000080068ec AppMainTask + .text.LL_TIM_EnableCounter + 0x0000000008006902 0x1e Users/App/sewhead/sewhead.o + .text.LL_TIM_DisableCounter + 0x0000000008006920 0x1e Users/App/sewhead/sewhead.o + .text.LL_TIM_EnableIT_UPDATE + 0x000000000800693e 0x1e Users/App/sewhead/sewhead.o + .text.GetBoardSwitchValue + 0x000000000800695c 0x5c Users/App/sewhead/sewhead.o + 0x000000000800695c GetBoardSwitchValue + .text.InitSewHeadBoard + 0x00000000080069b8 0x108 Users/App/sewhead/sewhead.o + 0x00000000080069b8 InitSewHeadBoard + .text.SoftPwmIntProc + 0x0000000008006ac0 0x1c Users/App/sewhead/sewhead.o + 0x0000000008006ac0 SoftPwmIntProc + .text.InitSoftPwmCtrl + 0x0000000008006adc 0x34 Users/App/sewhead/sewhead.o + 0x0000000008006adc InitSoftPwmCtrl + .text.PwmCtrlTask + 0x0000000008006b10 0x9c Users/App/sewhead/sewhead.o + 0x0000000008006b10 PwmCtrlTask + .text.SysLedTask + 0x0000000008006bac 0x4c Users/App/sewhead/sewhead.o + 0x0000000008006bac SysLedTask + .text.SewHeadBoardTask + 0x0000000008006bf8 0x14 Users/App/sewhead/sewhead.o + 0x0000000008006bf8 SewHeadBoardTask + .text.ModBusReceiveProc + 0x0000000008006c0c 0x2c Users/App/sewhead/sewhead.o + 0x0000000008006c0c ModBusReceiveProc + .text.SendMotoCtrlCmd + 0x0000000008006c38 0x48 Users/App/sewhead/sewhead.o + 0x0000000008006c38 SendMotoCtrlCmd + .text.FootMotoToZero + 0x0000000008006c80 0x12 Users/App/sewhead/sewhead.o + 0x0000000008006c80 FootMotoToZero + *fill* 0x0000000008006c92 0x2 + .text.OutputStepOn + 0x0000000008006c94 0x4c Users/App/sewhead/sewhead.o + 0x0000000008006c94 OutputStepOn + .text.GetFollowTableValue + 0x0000000008006ce0 0x8c Users/App/sewhead/sewhead.o + 0x0000000008006ce0 GetFollowTableValue + .text.FollowEcdOutPulseOn + 0x0000000008006d6c 0x164 Users/App/sewhead/sewhead.o + 0x0000000008006d6c FollowEcdOutPulseOn + .text.FollowEcdOutPulseOff + 0x0000000008006ed0 0x50 Users/App/sewhead/sewhead.o + 0x0000000008006ed0 FollowEcdOutPulseOff + .text.FollowEcdOutDirOn + 0x0000000008006f20 0x34 Users/App/sewhead/sewhead.o + 0x0000000008006f20 FollowEcdOutDirOn + .text.FollowEcdOutDirOff + 0x0000000008006f54 0x34 Users/App/sewhead/sewhead.o + 0x0000000008006f54 FollowEcdOutDirOff + .text.CheckParasValue + 0x0000000008006f88 0x278 Users/App/sewhead/sewhead.o + 0x0000000008006f88 CheckParasValue + .text.InOutStaRefreshTask + 0x0000000008007200 0x15c Users/App/sewhead/sewhead.o + 0x0000000008007200 InOutStaRefreshTask + .text.APIntProc + 0x000000000800735c 0x214 Users/App/sewhead/sewhead.o + 0x000000000800735c APIntProc + .text.BPIntProc + 0x0000000008007570 0x20 Users/App/sewhead/sewhead.o + 0x0000000008007570 BPIntProc + .text.ZPIntProc + 0x0000000008007590 0x30 Users/App/sewhead/sewhead.o + 0x0000000008007590 ZPIntProc + .text.TestAction + 0x00000000080075c0 0x158 Users/App/sewhead/sewhead.o + 0x00000000080075c0 TestAction + .text.InitDebug + 0x0000000008007718 0x34 Users/App/workctrl/debug.o + 0x0000000008007718 InitDebug + .text.TestInputs + 0x000000000800774c 0x1d0 Users/App/workctrl/debug.o + 0x000000000800774c TestInputs + .text.TestOutput + 0x000000000800791c 0x1604 Users/App/workctrl/debug.o + 0x000000000800791c TestOutput + .text.InitWorkCtrl + 0x0000000008008f20 0x30 Users/App/workctrl/workctrl.o + 0x0000000008008f20 InitWorkCtrl + .text.DelayRef + 0x0000000008008f50 0x28 Users/App/workctrl/workctrl.o + 0x0000000008008f50 DelayRef + .text.WorkCtrlTask + 0x0000000008008f78 0x10 Users/App/workctrl/workctrl.o + 0x0000000008008f78 WorkCtrlTask + .text.LL_GPIO_IsInputPinSet + 0x0000000008008f88 0x2c Users/Base/inout.o + .text.LL_GPIO_IsOutputPinSet + 0x0000000008008fb4 0x2c Users/Base/inout.o + .text.LL_GPIO_SetOutputPin + 0x0000000008008fe0 0x1e Users/Base/inout.o + .text.LL_GPIO_ResetOutputPin + 0x0000000008008ffe 0x1e Users/Base/inout.o + .text.SetEn485OutOn + 0x000000000800901c 0x18 Users/Base/inout.o + 0x000000000800901c SetEn485OutOn + .text.SetEn485OutOff + 0x0000000008009034 0x18 Users/Base/inout.o + 0x0000000008009034 SetEn485OutOff + .text.SetEn485_2_OutOn + 0x000000000800904c 0x18 Users/Base/inout.o + 0x000000000800904c SetEn485_2_OutOn + .text.SetEn485_2_OutOff + 0x0000000008009064 0x18 Users/Base/inout.o + 0x0000000008009064 SetEn485_2_OutOff + .text.SetMoto1StepOn + 0x000000000800907c 0x18 Users/Base/inout.o + 0x000000000800907c SetMoto1StepOn + .text.SetMoto1StepOff + 0x0000000008009094 0x18 Users/Base/inout.o + 0x0000000008009094 SetMoto1StepOff + .text.SetMoto1DirOn + 0x00000000080090ac 0x18 Users/Base/inout.o + 0x00000000080090ac SetMoto1DirOn + .text.SetMoto1DirOff + 0x00000000080090c4 0x18 Users/Base/inout.o + 0x00000000080090c4 SetMoto1DirOff + .text.GetInputAPStatus + 0x00000000080090dc 0x1c Users/Base/inout.o + 0x00000000080090dc GetInputAPStatus + .text.GetInputBPStatus + 0x00000000080090f8 0x1c Users/Base/inout.o + 0x00000000080090f8 GetInputBPStatus + .text.SetSysLedOn + 0x0000000008009114 0x18 Users/Base/inout.o + 0x0000000008009114 SetSysLedOn + .text.SetSysLedOff + 0x000000000800912c 0x18 Users/Base/inout.o + 0x000000000800912c SetSysLedOff + .text.SetOutputPWM1On + 0x0000000008009144 0x18 Users/Base/inout.o + 0x0000000008009144 SetOutputPWM1On + .text.SetOutputPWM1Off + 0x000000000800915c 0x18 Users/Base/inout.o + 0x000000000800915c SetOutputPWM1Off + .text.SetOutputPWM2On + 0x0000000008009174 0x18 Users/Base/inout.o + 0x0000000008009174 SetOutputPWM2On + .text.SetOutputPWM2Off + 0x000000000800918c 0x18 Users/Base/inout.o + 0x000000000800918c SetOutputPWM2Off + .text.SetOutput1On + 0x00000000080091a4 0x18 Users/Base/inout.o + 0x00000000080091a4 SetOutput1On + .text.SetOutput1Off + 0x00000000080091bc 0x18 Users/Base/inout.o + 0x00000000080091bc SetOutput1Off + .text.GetOutput1Status + 0x00000000080091d4 0x1c Users/Base/inout.o + 0x00000000080091d4 GetOutput1Status + .text.SetOutput2On + 0x00000000080091f0 0x18 Users/Base/inout.o + 0x00000000080091f0 SetOutput2On + .text.SetOutput2Off + 0x0000000008009208 0x18 Users/Base/inout.o + 0x0000000008009208 SetOutput2Off + .text.GetOutput2Status + 0x0000000008009220 0x1c Users/Base/inout.o + 0x0000000008009220 GetOutput2Status + .text.SetOutput3On + 0x000000000800923c 0x18 Users/Base/inout.o + 0x000000000800923c SetOutput3On + .text.SetOutput3Off + 0x0000000008009254 0x18 Users/Base/inout.o + 0x0000000008009254 SetOutput3Off + .text.GetOutput3Status + 0x000000000800926c 0x1c Users/Base/inout.o + 0x000000000800926c GetOutput3Status + .text.SetOutput4On + 0x0000000008009288 0x18 Users/Base/inout.o + 0x0000000008009288 SetOutput4On + .text.SetOutput4Off + 0x00000000080092a0 0x18 Users/Base/inout.o + 0x00000000080092a0 SetOutput4Off + .text.GetOutput4Status + 0x00000000080092b8 0x1c Users/Base/inout.o + 0x00000000080092b8 GetOutput4Status + .text.SetOutput5On + 0x00000000080092d4 0x18 Users/Base/inout.o + 0x00000000080092d4 SetOutput5On + .text.SetOutput5Off + 0x00000000080092ec 0x18 Users/Base/inout.o + 0x00000000080092ec SetOutput5Off + .text.GetOutput5Status + 0x0000000008009304 0x1c Users/Base/inout.o + 0x0000000008009304 GetOutput5Status + .text.SetOutput6On + 0x0000000008009320 0x18 Users/Base/inout.o + 0x0000000008009320 SetOutput6On + .text.SetOutput6Off + 0x0000000008009338 0x18 Users/Base/inout.o + 0x0000000008009338 SetOutput6Off + .text.GetOutput6Status + 0x0000000008009350 0x1c Users/Base/inout.o + 0x0000000008009350 GetOutput6Status + .text.SetOutput7On + 0x000000000800936c 0x18 Users/Base/inout.o + 0x000000000800936c SetOutput7On + .text.SetOutput7Off + 0x0000000008009384 0x18 Users/Base/inout.o + 0x0000000008009384 SetOutput7Off + .text.GetOutput7Status + 0x000000000800939c 0x1c Users/Base/inout.o + 0x000000000800939c GetOutput7Status + .text.SetOutput8On + 0x00000000080093b8 0x18 Users/Base/inout.o + 0x00000000080093b8 SetOutput8On + .text.SetOutput8Off + 0x00000000080093d0 0x18 Users/Base/inout.o + 0x00000000080093d0 SetOutput8Off + .text.GetOutput8Status + 0x00000000080093e8 0x1c Users/Base/inout.o + 0x00000000080093e8 GetOutput8Status + .text.GetInput1Status + 0x0000000008009404 0x1c Users/Base/inout.o + 0x0000000008009404 GetInput1Status + .text.GetInput2Status + 0x0000000008009420 0x1c Users/Base/inout.o + 0x0000000008009420 GetInput2Status + .text.GetInput3Status + 0x000000000800943c 0x1c Users/Base/inout.o + 0x000000000800943c GetInput3Status + .text.GetInput4Status + 0x0000000008009458 0x1c Users/Base/inout.o + 0x0000000008009458 GetInput4Status + .text.GetInput5Status + 0x0000000008009474 0x1c Users/Base/inout.o + 0x0000000008009474 GetInput5Status + .text.GetInput6Status + 0x0000000008009490 0x1c Users/Base/inout.o + 0x0000000008009490 GetInput6Status + .text.GetInput7Status + 0x00000000080094ac 0x1c Users/Base/inout.o + 0x00000000080094ac GetInput7Status + .text.GetInput8Status + 0x00000000080094c8 0x1c Users/Base/inout.o + 0x00000000080094c8 GetInput8Status + .text.GetSwitch1Status + 0x00000000080094e4 0x1c Users/Base/inout.o + 0x00000000080094e4 GetSwitch1Status + .text.GetSwitch2Status + 0x0000000008009500 0x1c Users/Base/inout.o + 0x0000000008009500 GetSwitch2Status + .text.GetSwitch3Status + 0x000000000800951c 0x1c Users/Base/inout.o + 0x000000000800951c GetSwitch3Status + .text.GetSwitch4Status + 0x0000000008009538 0x1c Users/Base/inout.o + 0x0000000008009538 GetSwitch4Status + .text.InitCAN 0x0000000008009554 0x4c Users/Func/canwork.o + 0x0000000008009554 InitCAN + .text.ExA1CanFilter + 0x00000000080095a0 0x12c Users/Func/canwork.o + 0x00000000080095a0 ExA1CanFilter + .text.CanBusTask + 0x00000000080096cc 0x1b0 Users/Func/canwork.o + 0x00000000080096cc CanBusTask + .text.MainTasks + 0x000000000800987c 0xc Users/tasks.o + 0x000000000800987c MainTasks + .text.atoi 0x0000000008009888 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + 0x0000000008009888 atoi + .text.__errno 0x0000000008009890 0xc c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + 0x0000000008009890 __errno + .text.__libc_init_array + 0x000000000800989c 0x48 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + 0x000000000800989c __libc_init_array + .text.memcpy 0x00000000080098e4 0x16 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + 0x00000000080098e4 memcpy + .text.memset 0x00000000080098fa 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + 0x00000000080098fa memset + *fill* 0x000000000800990a 0x2 + .text.printf 0x000000000800990c 0x30 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + 0x000000000800990c iprintf + 0x000000000800990c printf + .text._puts_r 0x000000000800993c 0xb8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + 0x000000000800993c _puts_r + .text.puts 0x00000000080099f4 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + 0x00000000080099f4 puts + .text.strcpy 0x0000000008009a04 0x10 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + 0x0000000008009a04 strcpy + .text._strtol_l.isra.0 + 0x0000000008009a14 0xf6 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + *fill* 0x0000000008009b0a 0x2 + .text.strtol 0x0000000008009b0c 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + 0x0000000008009b0c strtol + .text.__swbuf_r + 0x0000000008009b38 0xa4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + 0x0000000008009b38 __swbuf_r + .text.__swsetup_r + 0x0000000008009bdc 0xdc c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + 0x0000000008009bdc __swsetup_r + .text.__sflush_r + 0x0000000008009cb8 0x10c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + 0x0000000008009cb8 __sflush_r + .text._fflush_r + 0x0000000008009dc4 0x54 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + 0x0000000008009dc4 _fflush_r + .text.std 0x0000000008009e18 0x48 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .text._cleanup_r + 0x0000000008009e60 0xc c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x0000000008009e60 _cleanup_r + .text.__sfmoreglue + 0x0000000008009e6c 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x0000000008009e6c __sfmoreglue + .text.__sinit 0x0000000008009e98 0x60 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x0000000008009e98 __sinit + .text.__sfp 0x0000000008009ef8 0x78 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x0000000008009ef8 __sfp + .text._fwalk_reent + 0x0000000008009f70 0x3c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + 0x0000000008009f70 _fwalk_reent + .text.__locale_ctype_ptr_l + 0x0000000008009fac 0x6 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + 0x0000000008009fac __locale_ctype_ptr_l + .text.__swhatbuf_r + 0x0000000008009fb2 0x48 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + 0x0000000008009fb2 __swhatbuf_r + *fill* 0x0000000008009ffa 0x2 + .text.__smakebuf_r + 0x0000000008009ffc 0x80 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + 0x0000000008009ffc __smakebuf_r + .text.__ascii_mbtowc + 0x000000000800a07c 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + 0x000000000800a07c __ascii_mbtowc + .text._free_r 0x000000000800a0a0 0x98 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + 0x000000000800a0a0 _free_r + .text._malloc_r + 0x000000000800a138 0xb4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + 0x000000000800a138 _malloc_r + .text.__sfputc_r + 0x000000000800a1ec 0x2a c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .text.__sfputs_r + 0x000000000800a216 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + 0x000000000800a216 __sfputs_r + *fill* 0x000000000800a23a 0x2 + .text._vfprintf_r + 0x000000000800a23c 0x22c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + 0x000000000800a23c _vfprintf_r + 0x000000000800a23c _vfiprintf_r + .text._printf_common + 0x000000000800a468 0xec c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + 0x000000000800a468 _printf_common + .text._printf_i + 0x000000000800a554 0x224 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + 0x000000000800a554 _printf_i + .text._sbrk_r 0x000000000800a778 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + 0x000000000800a778 _sbrk_r + .text.__sread 0x000000000800a798 0x22 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + 0x000000000800a798 __sread + .text.__swrite + 0x000000000800a7ba 0x38 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + 0x000000000800a7ba __swrite + .text.__sseek 0x000000000800a7f2 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + 0x000000000800a7f2 __sseek + .text.__sclose + 0x000000000800a816 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + 0x000000000800a816 __sclose + .text.__ascii_wctomb + 0x000000000800a81e 0x1a c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + 0x000000000800a81e __ascii_wctomb + .text._write_r + 0x000000000800a838 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + 0x000000000800a838 _write_r + .text._close_r + 0x000000000800a85c 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + 0x000000000800a85c _close_r + .text._fstat_r + 0x000000000800a87c 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + 0x000000000800a87c _fstat_r + .text._isatty_r + 0x000000000800a8a0 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + 0x000000000800a8a0 _isatty_r + .text._lseek_r + 0x000000000800a8c0 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + 0x000000000800a8c0 _lseek_r + .text.memchr 0x000000000800a8e4 0x1c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + 0x000000000800a8e4 memchr + .text.__malloc_lock + 0x000000000800a900 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + 0x000000000800a900 __malloc_lock + .text.__malloc_unlock + 0x000000000800a902 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + 0x000000000800a902 __malloc_unlock + .text._read_r 0x000000000800a904 0x24 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + 0x000000000800a904 _read_r + *(.glue_7) + .glue_7 0x000000000800a928 0x0 linker stubs + *(.glue_7t) + .glue_7t 0x000000000800a928 0x0 linker stubs + *(.eh_frame) + .eh_frame 0x000000000800a928 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + *(.init) + .init 0x000000000800a928 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + 0x000000000800a928 _init + .init 0x000000000800a92c 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + *(.fini) + .fini 0x000000000800a934 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + 0x000000000800a934 _fini + .fini 0x000000000800a938 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o + 0x000000000800a940 . = ALIGN (0x4) + 0x000000000800a940 _etext = . + +.vfp11_veneer 0x000000000800a940 0x0 + .vfp11_veneer 0x000000000800a940 0x0 linker stubs + +.v4_bx 0x000000000800a940 0x0 + .v4_bx 0x000000000800a940 0x0 linker stubs + +.iplt 0x000000000800a940 0x0 + .iplt 0x000000000800a940 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + +.rodata 0x000000000800a940 0x74c + 0x000000000800a940 . = ALIGN (0x4) + *(.rodata) + .rodata 0x000000000800a940 0x21b NxBase/canctrl.o + *fill* 0x000000000800ab5b 0x1 + .rodata 0x000000000800ab5c 0xcb NxBase/shell.o + *fill* 0x000000000800ac27 0x1 + .rodata 0x000000000800ac28 0xd6 NxFunc/modbus/modbus_m.o + *fill* 0x000000000800acfe 0x2 + .rodata 0x000000000800ad00 0xa5 Users/App/sewhead/sewhead.o + *fill* 0x000000000800ada5 0x3 + .rodata 0x000000000800ada8 0x59 Users/App/workctrl/debug.o + *fill* 0x000000000800ae01 0x3 + .rodata 0x000000000800ae04 0xc9 Users/Func/canwork.o + *(.rodata*) + *fill* 0x000000000800aecd 0x3 + .rodata.AHBPrescTable + 0x000000000800aed0 0x10 Core/Src/system_stm32f1xx.o + 0x000000000800aed0 AHBPrescTable + .rodata.APBPrescTable + 0x000000000800aee0 0x8 Core/Src/system_stm32f1xx.o + 0x000000000800aee0 APBPrescTable + .rodata._global_impure_ptr + 0x000000000800aee8 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + 0x000000000800aee8 _global_impure_ptr + .rodata.__sf_fake_stderr + 0x000000000800aeec 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x000000000800aeec __sf_fake_stderr + .rodata.__sf_fake_stdin + 0x000000000800af0c 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x000000000800af0c __sf_fake_stdin + .rodata.__sf_fake_stdout + 0x000000000800af2c 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + 0x000000000800af2c __sf_fake_stdout + .rodata._setlocale_r.str1.1 + 0x000000000800af4c 0x8 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + 0x9 (size before relaxing) + .rodata.str1.1 + 0x000000000800af54 0x2 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .rodata._vfprintf_r.str1.1 + 0x000000000800af56 0x11 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .rodata._printf_i.str1.1 + 0x000000000800af67 0x22 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .rodata._ctype_ + 0x000000000800af89 0x101 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + 0x000000000800af89 _ctype_ + 0x000000000800b08c . = ALIGN (0x4) + *fill* 0x000000000800b08a 0x2 + +.rel.dyn 0x000000000800b08c 0x0 + .rel.iplt 0x000000000800b08c 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + +.ARM.extab 0x000000000800b08c 0x0 + 0x000000000800b08c . = ALIGN (0x4) + *(.ARM.extab* .gnu.linkonce.armextab.*) + 0x000000000800b08c . = ALIGN (0x4) + +.ARM 0x000000000800b08c 0x0 + 0x000000000800b08c . = ALIGN (0x4) + 0x000000000800b08c __exidx_start = . + *(.ARM.exidx*) + 0x000000000800b08c __exidx_end = . + 0x000000000800b08c . = ALIGN (0x4) + +.preinit_array 0x000000000800b08c 0x0 + 0x000000000800b08c . = ALIGN (0x4) + 0x000000000800b08c PROVIDE (__preinit_array_start = .) + *(.preinit_array*) + 0x000000000800b08c PROVIDE (__preinit_array_end = .) + 0x000000000800b08c . = ALIGN (0x4) + +.init_array 0x000000000800b08c 0x4 + 0x000000000800b08c . = ALIGN (0x4) + 0x000000000800b08c PROVIDE (__init_array_start = .) + *(SORT_BY_NAME(.init_array.*)) + *(.init_array*) + .init_array 0x000000000800b08c 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + 0x000000000800b090 PROVIDE (__init_array_end = .) + 0x000000000800b090 . = ALIGN (0x4) + +.fini_array 0x000000000800b090 0x4 + 0x000000000800b090 . = ALIGN (0x4) + [!provide] PROVIDE (__fini_array_start = .) + *(SORT_BY_NAME(.fini_array.*)) + *(.fini_array*) + .fini_array 0x000000000800b090 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + [!provide] PROVIDE (__fini_array_end = .) + 0x000000000800b094 . = ALIGN (0x4) + 0x000000000800b094 _sidata = LOADADDR (.data) + +.data 0x0000000020000000 0x53c load address 0x000000000800b094 + 0x0000000020000000 . = ALIGN (0x4) + 0x0000000020000000 _sdata = . + *(.data) + *(.data*) + .data.SystemCoreClock + 0x0000000020000000 0x4 Core/Src/system_stm32f1xx.o + 0x0000000020000000 SystemCoreClock + .data.uwTickPrio + 0x0000000020000004 0x4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x0000000020000004 uwTickPrio + .data.uwTickFreq + 0x0000000020000008 0x1 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x0000000020000008 uwTickFreq + *fill* 0x0000000020000009 0x3 + .data.SetCanFilter + 0x000000002000000c 0x4 NxBase/canctrl.o + 0x000000002000000c SetCanFilter + .data.g_useQueue + 0x0000000020000010 0x4 NxBase/console.o + 0x0000000020000010 g_useQueue + .data.auchCRCHi + 0x0000000020000014 0x100 NxFunc/modbus/modbus_def.o + .data.auchCRCLo + 0x0000000020000114 0x100 NxFunc/modbus/modbus_def.o + .data.FOLLOW_TABLE + 0x0000000020000214 0x18 Users/App/sewhead/sewhead.o + 0x0000000020000214 FOLLOW_TABLE + .data.g_inputName + 0x000000002000022c 0xa0 Users/App/workctrl/debug.o + 0x000000002000022c g_inputName + .data.g_outputName + 0x00000000200002cc 0xa0 Users/App/workctrl/debug.o + 0x00000000200002cc g_outputName + .data._impure_ptr + 0x000000002000036c 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + 0x000000002000036c _impure_ptr + .data.impure_data + 0x0000000020000370 0x60 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + .data.__global_locale + 0x00000000200003d0 0x16c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + 0x00000000200003d0 __global_locale + *(.RamFunc) + *(.RamFunc*) + 0x000000002000053c . = ALIGN (0x4) + 0x000000002000053c _edata = . + +.igot.plt 0x000000002000053c 0x0 load address 0x000000000800b5d0 + .igot.plt 0x000000002000053c 0x0 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + 0x000000002000053c . = ALIGN (0x4) + +.bss 0x000000002000053c 0x37f4 load address 0x000000000800b5d0 + 0x000000002000053c _sbss = . + 0x000000002000053c __bss_start__ = _sbss + *(.bss) + .bss 0x000000002000053c 0x1c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + *(.bss*) + .bss.__sbrk_heap_end + 0x0000000020000558 0x4 Core/Src/sysmem.o + .bss.g_cricount + 0x000000002000055c 0x4 NxBase/cpuid.o + .bss.g_cmdNum 0x0000000020000560 0x4 NxBase/shell.o + 0x0000000020000560 g_cmdNum + .bss.g_mstimer + 0x0000000020000564 0x4 NxBase/trigger.o + 0x0000000020000564 g_mstimer + .bss.g_triggerListNum + 0x0000000020000568 0x4 NxBase/trigger.o + 0x0000000020000568 g_triggerListNum + .bss.g_triggerTimer + 0x000000002000056c 0x4 NxBase/trigger.o + 0x000000002000056c g_triggerTimer + .bss.g_triggerTask + 0x0000000020000570 0x4 NxBase/trigger.o + 0x0000000020000570 g_triggerTask + .bss.g_triggerInited + 0x0000000020000574 0x4 NxBase/trigger.o + 0x0000000020000574 g_triggerInited + .bss.D29PwmProc + 0x0000000020000578 0x4 Users/App/sewhead/sewhead.o + 0x0000000020000578 D29PwmProc + .bss.ledtime.11089 + 0x000000002000057c 0x4 Users/App/sewhead/sewhead.o + .bss.ledsta.11088 + 0x0000000020000580 0x4 Users/App/sewhead/sewhead.o + .bss.__malloc_free_list + 0x0000000020000584 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + 0x0000000020000584 __malloc_free_list + .bss.__malloc_sbrk_start + 0x0000000020000588 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + 0x0000000020000588 __malloc_sbrk_start + *(COMMON) + COMMON 0x000000002000058c 0x28 Core/Src/can.o + 0x000000002000058c hcan + COMMON 0x00000000200005b4 0x4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x00000000200005b4 uwTick + COMMON 0x00000000200005b8 0x45c NxBase/canctrl.o + 0x00000000200005b8 g_canTxCtrl + 0x00000000200007c8 g_canRxCtrl + COMMON 0x0000000020000a14 0x278 NxBase/console.o + 0x0000000020000a14 g_cmdHistory + 0x0000000020000c08 g_cmdLine + COMMON 0x0000000020000c8c 0x3a8 NxBase/serial.o + 0x0000000020000c8c g_uCtrl2 + 0x0000000020000cc4 g_usart3RBuff + 0x0000000020000d44 g_usart1TBuff + 0x0000000020000dc4 g_usart2RBuff + 0x0000000020000e44 g_usart3TBuff + 0x0000000020000ec4 g_usart1RBuff + 0x0000000020000f44 g_uCtrl1 + 0x0000000020000f7c g_uCtrl3 + 0x0000000020000fb4 g_usart2TBuff + COMMON 0x0000000020001034 0x280 NxBase/shell.o + 0x0000000020001034 g_cmdList + COMMON 0x00000000200012b4 0xa0 NxBase/trigger.o + 0x00000000200012b4 g_triggerCtrlList + COMMON 0x0000000020001354 0x528 NxFunc/modbus/modbus_m.o + 0x0000000020001354 g_modBusMCtrl + 0x0000000020001378 g_rs485Ctrl + COMMON 0x000000002000187c 0x2418 Users/App/sewhead/sewhead.o + 0x000000002000187c g_headCtrl + COMMON 0x0000000020003c94 0x98 Users/App/workctrl/workctrl.o + 0x0000000020003c94 g_workCtrl + COMMON 0x0000000020003d2c 0x4 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + 0x0000000020003d2c errno + 0x0000000020003d30 . = ALIGN (0x4) + 0x0000000020003d30 _ebss = . + 0x0000000020003d30 __bss_end__ = _ebss + +._user_heap_stack + 0x0000000020003d30 0x600 load address 0x000000000800b5d0 + 0x0000000020003d30 . = ALIGN (0x8) + [!provide] PROVIDE (end = .) + 0x0000000020003d30 PROVIDE (_end = .) + 0x0000000020003f30 . = (. + _Min_Heap_Size) + *fill* 0x0000000020003d30 0x200 + 0x0000000020004330 . = (. + _Min_Stack_Size) + *fill* 0x0000000020003f30 0x400 + 0x0000000020004330 . = ALIGN (0x8) + +/DISCARD/ + libc.a(*) + libm.a(*) + libgcc.a(*) + +.ARM.attributes + 0x0000000000000000 0x29 + *(.ARM.attributes) + .ARM.attributes + 0x0000000000000000 0x1d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crti.o + .ARM.attributes + 0x000000000000001d 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtbegin.o + .ARM.attributes + 0x000000000000004a 0x33 Core/Src/can.o + .ARM.attributes + 0x000000000000007d 0x33 Core/Src/gpio.o + .ARM.attributes + 0x00000000000000b0 0x33 Core/Src/main.o + .ARM.attributes + 0x00000000000000e3 0x33 Core/Src/stm32f1xx_hal_msp.o + .ARM.attributes + 0x0000000000000116 0x33 Core/Src/stm32f1xx_it.o + .ARM.attributes + 0x0000000000000149 0x33 Core/Src/syscalls.o + .ARM.attributes + 0x000000000000017c 0x33 Core/Src/sysmem.o + .ARM.attributes + 0x00000000000001af 0x33 Core/Src/system_stm32f1xx.o + .ARM.attributes + 0x00000000000001e2 0x33 Core/Src/tim.o + .ARM.attributes + 0x0000000000000215 0x33 Core/Src/usart.o + .ARM.attributes + 0x0000000000000248 0x21 Core/Startup/startup_stm32f103rctx.o + .ARM.attributes + 0x0000000000000269 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .ARM.attributes + 0x000000000000029c 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .ARM.attributes + 0x00000000000002cf 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .ARM.attributes + 0x0000000000000302 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .ARM.attributes + 0x0000000000000335 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .ARM.attributes + 0x0000000000000368 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .ARM.attributes + 0x000000000000039b 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .ARM.attributes + 0x00000000000003ce 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .ARM.attributes + 0x0000000000000401 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .ARM.attributes + 0x0000000000000434 0x33 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .ARM.attributes + 0x0000000000000467 0x33 NxBase/canctrl.o + .ARM.attributes + 0x000000000000049a 0x33 NxBase/console.o + .ARM.attributes + 0x00000000000004cd 0x33 NxBase/cpuid.o + .ARM.attributes + 0x0000000000000500 0x33 NxBase/delay.o + .ARM.attributes + 0x0000000000000533 0x33 NxBase/iwdog.o + .ARM.attributes + 0x0000000000000566 0x33 NxBase/serial.o + .ARM.attributes + 0x0000000000000599 0x33 NxBase/shell.o + .ARM.attributes + 0x00000000000005cc 0x33 NxBase/trigger.o + .ARM.attributes + 0x00000000000005ff 0x33 NxFunc/controlbus/sewhdcontrol.o + .ARM.attributes + 0x0000000000000632 0x33 NxFunc/modbus/modbus_def.o + .ARM.attributes + 0x0000000000000665 0x33 NxFunc/modbus/modbus_m.o + .ARM.attributes + 0x0000000000000698 0x33 Users/App/apptasks.o + .ARM.attributes + 0x00000000000006cb 0x33 Users/App/sewhead/sewhead.o + .ARM.attributes + 0x00000000000006fe 0x33 Users/App/workctrl/debug.o + .ARM.attributes + 0x0000000000000731 0x33 Users/App/workctrl/workctrl.o + .ARM.attributes + 0x0000000000000764 0x33 Users/Base/inout.o + .ARM.attributes + 0x0000000000000797 0x33 Users/Func/canwork.o + .ARM.attributes + 0x00000000000007ca 0x33 Users/tasks.o + .ARM.attributes + 0x00000000000007fd 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .ARM.attributes + 0x000000000000082a 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + .ARM.attributes + 0x0000000000000857 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-impure.o) + .ARM.attributes + 0x0000000000000884 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + .ARM.attributes + 0x00000000000008b1 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + .ARM.attributes + 0x00000000000008de 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + .ARM.attributes + 0x000000000000090b 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .ARM.attributes + 0x0000000000000938 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + .ARM.attributes + 0x0000000000000965 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + .ARM.attributes + 0x0000000000000992 0x17 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strlen.o) + .ARM.attributes + 0x00000000000009a9 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .ARM.attributes + 0x00000000000009d6 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .ARM.attributes + 0x0000000000000a03 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + .ARM.attributes + 0x0000000000000a30 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .ARM.attributes + 0x0000000000000a5d 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .ARM.attributes + 0x0000000000000a8a 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .ARM.attributes + 0x0000000000000ab7 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .ARM.attributes + 0x0000000000000ae4 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + .ARM.attributes + 0x0000000000000b11 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .ARM.attributes + 0x0000000000000b3e 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + .ARM.attributes + 0x0000000000000b6b 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + .ARM.attributes + 0x0000000000000b98 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .ARM.attributes + 0x0000000000000bc5 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .ARM.attributes + 0x0000000000000bf2 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + .ARM.attributes + 0x0000000000000c1f 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .ARM.attributes + 0x0000000000000c4c 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .ARM.attributes + 0x0000000000000c79 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + .ARM.attributes + 0x0000000000000ca6 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + .ARM.attributes + 0x0000000000000cd3 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-ctype_.o) + .ARM.attributes + 0x0000000000000d00 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + .ARM.attributes + 0x0000000000000d2d 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + .ARM.attributes + 0x0000000000000d5a 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + .ARM.attributes + 0x0000000000000d87 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + .ARM.attributes + 0x0000000000000db4 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + .ARM.attributes + 0x0000000000000de1 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + .ARM.attributes + 0x0000000000000e0e 0x2d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) + .ARM.attributes + 0x0000000000000e3b 0x1d c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7-m/crtn.o +OUTPUT(SEW-EXA1.elf elf32-littlearm) + +.debug_info 0x0000000000000000 0x201e8 + .debug_info 0x0000000000000000 0x98a Core/Src/can.o + .debug_info 0x000000000000098a 0xb8c Core/Src/gpio.o + .debug_info 0x0000000000001516 0x1111 Core/Src/main.o + .debug_info 0x0000000000002627 0x351 Core/Src/stm32f1xx_hal_msp.o + .debug_info 0x0000000000002978 0xff9 Core/Src/stm32f1xx_it.o + .debug_info 0x0000000000003971 0xebd Core/Src/syscalls.o + .debug_info 0x000000000000482e 0x985 Core/Src/sysmem.o + .debug_info 0x00000000000051b3 0x29a Core/Src/system_stm32f1xx.o + .debug_info 0x000000000000544d 0xa87 Core/Src/tim.o + .debug_info 0x0000000000005ed4 0xb4f Core/Src/usart.o + .debug_info 0x0000000000006a23 0x22 Core/Startup/startup_stm32f103rctx.o + .debug_info 0x0000000000006a45 0x77a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_info 0x00000000000071bf 0xfbd Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_info 0x000000000000817c 0xbb7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_info 0x0000000000008d33 0x69b Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_info 0x00000000000093ce 0x403 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_info 0x00000000000097d1 0x6c9 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_info 0x0000000000009e9a 0x5ea Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_info 0x000000000000a484 0xe56 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_info 0x000000000000b2da 0x670 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_info 0x000000000000b94a 0x854 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_info 0x000000000000c19e 0x13a3 NxBase/canctrl.o + .debug_info 0x000000000000d541 0x105a NxBase/console.o + .debug_info 0x000000000000e59b 0xedc NxBase/cpuid.o + .debug_info 0x000000000000f477 0xb15 NxBase/delay.o + .debug_info 0x000000000000ff8c 0xa94 NxBase/iwdog.o + .debug_info 0x0000000000010a20 0x172d NxBase/serial.o + .debug_info 0x000000000001214d 0xe36 NxBase/shell.o + .debug_info 0x0000000000012f83 0x11fe NxBase/trigger.o + .debug_info 0x0000000000014181 0x156b NxFunc/controlbus/sewhdcontrol.o + .debug_info 0x00000000000156ec 0xdae NxFunc/modbus/modbus_def.o + .debug_info 0x000000000001649a 0x13b8 NxFunc/modbus/modbus_m.o + .debug_info 0x0000000000017852 0x139e Users/App/apptasks.o + .debug_info 0x0000000000018bf0 0x2197 Users/App/sewhead/sewhead.o + .debug_info 0x000000000001ad87 0xbed Users/App/workctrl/debug.o + .debug_info 0x000000000001b974 0x13e3 Users/App/workctrl/workctrl.o + .debug_info 0x000000000001cd57 0x122e Users/Base/inout.o + .debug_info 0x000000000001df85 0x1600 Users/Func/canwork.o + .debug_info 0x000000000001f585 0xc63 Users/tasks.o + +.debug_abbrev 0x0000000000000000 0x5523 + .debug_abbrev 0x0000000000000000 0x1b6 Core/Src/can.o + .debug_abbrev 0x00000000000001b6 0x245 Core/Src/gpio.o + .debug_abbrev 0x00000000000003fb 0x29f Core/Src/main.o + .debug_abbrev 0x000000000000069a 0x109 Core/Src/stm32f1xx_hal_msp.o + .debug_abbrev 0x00000000000007a3 0x270 Core/Src/stm32f1xx_it.o + .debug_abbrev 0x0000000000000a13 0x261 Core/Src/syscalls.o + .debug_abbrev 0x0000000000000c74 0x19b Core/Src/sysmem.o + .debug_abbrev 0x0000000000000e0f 0x134 Core/Src/system_stm32f1xx.o + .debug_abbrev 0x0000000000000f43 0x1c1 Core/Src/tim.o + .debug_abbrev 0x0000000000001104 0x1e6 Core/Src/usart.o + .debug_abbrev 0x00000000000012ea 0x12 Core/Startup/startup_stm32f103rctx.o + .debug_abbrev 0x00000000000012fc 0x1c7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_abbrev 0x00000000000014c3 0x22a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_abbrev 0x00000000000016ed 0x2d5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_abbrev 0x00000000000019c2 0x1c0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_abbrev 0x0000000000001b82 0x19e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_abbrev 0x0000000000001d20 0x210 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_abbrev 0x0000000000001f30 0x250 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_abbrev 0x0000000000002180 0x1ff Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_abbrev 0x000000000000237f 0x1b1 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_abbrev 0x0000000000002530 0x22b Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_abbrev 0x000000000000275b 0x2d4 NxBase/canctrl.o + .debug_abbrev 0x0000000000002a2f 0x35f NxBase/console.o + .debug_abbrev 0x0000000000002d8e 0x287 NxBase/cpuid.o + .debug_abbrev 0x0000000000003015 0x1f8 NxBase/delay.o + .debug_abbrev 0x000000000000320d 0x1e7 NxBase/iwdog.o + .debug_abbrev 0x00000000000033f4 0x2b5 NxBase/serial.o + .debug_abbrev 0x00000000000036a9 0x2a7 NxBase/shell.o + .debug_abbrev 0x0000000000003950 0x2ea NxBase/trigger.o + .debug_abbrev 0x0000000000003c3a 0x255 NxFunc/controlbus/sewhdcontrol.o + .debug_abbrev 0x0000000000003e8f 0x262 NxFunc/modbus/modbus_def.o + .debug_abbrev 0x00000000000040f1 0x2ea NxFunc/modbus/modbus_m.o + .debug_abbrev 0x00000000000043db 0x212 Users/App/apptasks.o + .debug_abbrev 0x00000000000045ed 0x3a4 Users/App/sewhead/sewhead.o + .debug_abbrev 0x0000000000004991 0x240 Users/App/workctrl/debug.o + .debug_abbrev 0x0000000000004bd1 0x24c Users/App/workctrl/workctrl.o + .debug_abbrev 0x0000000000004e1d 0x290 Users/Base/inout.o + .debug_abbrev 0x00000000000050ad 0x24a Users/Func/canwork.o + .debug_abbrev 0x00000000000052f7 0x22c Users/tasks.o + +.debug_aranges 0x0000000000000000 0x1698 + .debug_aranges + 0x0000000000000000 0x30 Core/Src/can.o + .debug_aranges + 0x0000000000000030 0x68 Core/Src/gpio.o + .debug_aranges + 0x0000000000000098 0x90 Core/Src/main.o + .debug_aranges + 0x0000000000000128 0x20 Core/Src/stm32f1xx_hal_msp.o + .debug_aranges + 0x0000000000000148 0xb0 Core/Src/stm32f1xx_it.o + .debug_aranges + 0x00000000000001f8 0xa8 Core/Src/syscalls.o + .debug_aranges + 0x00000000000002a0 0x20 Core/Src/sysmem.o + .debug_aranges + 0x00000000000002c0 0x28 Core/Src/system_stm32f1xx.o + .debug_aranges + 0x00000000000002e8 0x68 Core/Src/tim.o + .debug_aranges + 0x0000000000000350 0x78 Core/Src/usart.o + .debug_aranges + 0x00000000000003c8 0x28 Core/Startup/startup_stm32f103rctx.o + .debug_aranges + 0x00000000000003f0 0xe0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_aranges + 0x00000000000004d0 0x138 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_aranges + 0x0000000000000608 0x100 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_aranges + 0x0000000000000708 0x58 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_aranges + 0x0000000000000760 0x70 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_aranges + 0x00000000000007d0 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_aranges + 0x0000000000000830 0xd8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_aranges + 0x0000000000000908 0x128 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_aranges + 0x0000000000000a30 0x88 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_aranges + 0x0000000000000ab8 0xf8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_aranges + 0x0000000000000bb0 0x98 NxBase/canctrl.o + .debug_aranges + 0x0000000000000c48 0xe0 NxBase/console.o + .debug_aranges + 0x0000000000000d28 0x48 NxBase/cpuid.o + .debug_aranges + 0x0000000000000d70 0x30 NxBase/delay.o + .debug_aranges + 0x0000000000000da0 0x28 NxBase/iwdog.o + .debug_aranges + 0x0000000000000dc8 0x1a0 NxBase/serial.o + .debug_aranges + 0x0000000000000f68 0x60 NxBase/shell.o + .debug_aranges + 0x0000000000000fc8 0x80 NxBase/trigger.o + .debug_aranges + 0x0000000000001048 0x40 NxFunc/controlbus/sewhdcontrol.o + .debug_aranges + 0x0000000000001088 0x70 NxFunc/modbus/modbus_def.o + .debug_aranges + 0x00000000000010f8 0x78 NxFunc/modbus/modbus_m.o + .debug_aranges + 0x0000000000001170 0x20 Users/App/apptasks.o + .debug_aranges + 0x0000000000001190 0x150 Users/App/sewhead/sewhead.o + .debug_aranges + 0x00000000000012e0 0x40 Users/App/workctrl/debug.o + .debug_aranges + 0x0000000000001320 0x30 Users/App/workctrl/workctrl.o + .debug_aranges + 0x0000000000001350 0x2f0 Users/Base/inout.o + .debug_aranges + 0x0000000000001640 0x30 Users/Func/canwork.o + .debug_aranges + 0x0000000000001670 0x28 Users/tasks.o + +.debug_ranges 0x0000000000000000 0x1448 + .debug_ranges 0x0000000000000000 0x20 Core/Src/can.o + .debug_ranges 0x0000000000000020 0x58 Core/Src/gpio.o + .debug_ranges 0x0000000000000078 0x80 Core/Src/main.o + .debug_ranges 0x00000000000000f8 0x10 Core/Src/stm32f1xx_hal_msp.o + .debug_ranges 0x0000000000000108 0xa0 Core/Src/stm32f1xx_it.o + .debug_ranges 0x00000000000001a8 0x98 Core/Src/syscalls.o + .debug_ranges 0x0000000000000240 0x10 Core/Src/sysmem.o + .debug_ranges 0x0000000000000250 0x18 Core/Src/system_stm32f1xx.o + .debug_ranges 0x0000000000000268 0x58 Core/Src/tim.o + .debug_ranges 0x00000000000002c0 0x68 Core/Src/usart.o + .debug_ranges 0x0000000000000328 0x20 Core/Startup/startup_stm32f103rctx.o + .debug_ranges 0x0000000000000348 0xd0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_ranges 0x0000000000000418 0x128 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_ranges 0x0000000000000540 0xf0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_ranges 0x0000000000000630 0x48 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_ranges 0x0000000000000678 0x60 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_ranges 0x00000000000006d8 0x50 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_ranges 0x0000000000000728 0xc8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_ranges 0x00000000000007f0 0x118 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_ranges 0x0000000000000908 0x78 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_ranges 0x0000000000000980 0xe8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_ranges 0x0000000000000a68 0x88 NxBase/canctrl.o + .debug_ranges 0x0000000000000af0 0xd0 NxBase/console.o + .debug_ranges 0x0000000000000bc0 0x38 NxBase/cpuid.o + .debug_ranges 0x0000000000000bf8 0x20 NxBase/delay.o + .debug_ranges 0x0000000000000c18 0x18 NxBase/iwdog.o + .debug_ranges 0x0000000000000c30 0x190 NxBase/serial.o + .debug_ranges 0x0000000000000dc0 0x50 NxBase/shell.o + .debug_ranges 0x0000000000000e10 0x70 NxBase/trigger.o + .debug_ranges 0x0000000000000e80 0x30 NxFunc/controlbus/sewhdcontrol.o + .debug_ranges 0x0000000000000eb0 0x60 NxFunc/modbus/modbus_def.o + .debug_ranges 0x0000000000000f10 0x68 NxFunc/modbus/modbus_m.o + .debug_ranges 0x0000000000000f78 0x10 Users/App/apptasks.o + .debug_ranges 0x0000000000000f88 0x158 Users/App/sewhead/sewhead.o + .debug_ranges 0x00000000000010e0 0x30 Users/App/workctrl/debug.o + .debug_ranges 0x0000000000001110 0x20 Users/App/workctrl/workctrl.o + .debug_ranges 0x0000000000001130 0x2e0 Users/Base/inout.o + .debug_ranges 0x0000000000001410 0x20 Users/Func/canwork.o + .debug_ranges 0x0000000000001430 0x18 Users/tasks.o + +.debug_macro 0x0000000000000000 0x22708 + .debug_macro 0x0000000000000000 0x20a Core/Src/can.o + .debug_macro 0x000000000000020a 0xa60 Core/Src/can.o + .debug_macro 0x0000000000000c6a 0x20f Core/Src/can.o + .debug_macro 0x0000000000000e79 0x2e Core/Src/can.o + .debug_macro 0x0000000000000ea7 0x22 Core/Src/can.o + .debug_macro 0x0000000000000ec9 0x22 Core/Src/can.o + .debug_macro 0x0000000000000eeb 0x8e Core/Src/can.o + .debug_macro 0x0000000000000f79 0x51 Core/Src/can.o + .debug_macro 0x0000000000000fca 0xef Core/Src/can.o + .debug_macro 0x00000000000010b9 0x6a Core/Src/can.o + .debug_macro 0x0000000000001123 0x1df Core/Src/can.o + .debug_macro 0x0000000000001302 0x1c Core/Src/can.o + .debug_macro 0x000000000000131e 0x22 Core/Src/can.o + .debug_macro 0x0000000000001340 0xc3 Core/Src/can.o + .debug_macro 0x0000000000001403 0xd23 Core/Src/can.o + .debug_macro 0x0000000000002126 0xfd8c Core/Src/can.o + .debug_macro 0x0000000000011eb2 0x6d Core/Src/can.o + .debug_macro 0x0000000000011f1f 0x3468 Core/Src/can.o + .debug_macro 0x0000000000015387 0x174 Core/Src/can.o + .debug_macro 0x00000000000154fb 0x5c Core/Src/can.o + .debug_macro 0x0000000000015557 0x5be Core/Src/can.o + .debug_macro 0x0000000000015b15 0x4d5 Core/Src/can.o + .debug_macro 0x0000000000015fea 0x1cb Core/Src/can.o + .debug_macro 0x00000000000161b5 0x114 Core/Src/can.o + .debug_macro 0x00000000000162c9 0x1ea Core/Src/can.o + .debug_macro 0x00000000000164b3 0x27 Core/Src/can.o + .debug_macro 0x00000000000164da 0x144 Core/Src/can.o + .debug_macro 0x000000000001661e 0x1bc Core/Src/can.o + .debug_macro 0x00000000000167da 0x30 Core/Src/can.o + .debug_macro 0x000000000001680a 0x3c Core/Src/can.o + .debug_macro 0x0000000000016846 0x408 Core/Src/can.o + .debug_macro 0x0000000000016c4e 0x57 Core/Src/can.o + .debug_macro 0x0000000000016ca5 0x88 Core/Src/can.o + .debug_macro 0x0000000000016d2d 0x24f Core/Src/can.o + .debug_macro 0x0000000000016f7c 0x141 Core/Src/can.o + .debug_macro 0x00000000000170bd 0xb5 Core/Src/can.o + .debug_macro 0x0000000000017172 0x2be Core/Src/can.o + .debug_macro 0x0000000000017430 0x135 Core/Src/can.o + .debug_macro 0x0000000000017565 0x8d Core/Src/can.o + .debug_macro 0x00000000000175f2 0xd0 Core/Src/can.o + .debug_macro 0x00000000000176c2 0x28 Core/Src/can.o + .debug_macro 0x00000000000176ea 0x2a Core/Src/can.o + .debug_macro 0x0000000000017714 0x90 Core/Src/can.o + .debug_macro 0x00000000000177a4 0x287 Core/Src/can.o + .debug_macro 0x0000000000017a2b 0x57a Core/Src/can.o + .debug_macro 0x0000000000017fa5 0x1b4 Core/Src/can.o + .debug_macro 0x0000000000018159 0x22a Core/Src/can.o + .debug_macro 0x0000000000018383 0x1be Core/Src/can.o + .debug_macro 0x0000000000018541 0x20a Core/Src/gpio.o + .debug_macro 0x000000000001874b 0x421 Core/Src/main.o + .debug_macro 0x0000000000018b6c 0x46 Core/Src/main.o + .debug_macro 0x0000000000018bb2 0x18 Core/Src/main.o + .debug_macro 0x0000000000018bca 0x3c Core/Src/main.o + .debug_macro 0x0000000000018c06 0x34 Core/Src/main.o + .debug_macro 0x0000000000018c3a 0x16 Core/Src/main.o + .debug_macro 0x0000000000018c50 0x35 Core/Src/main.o + .debug_macro 0x0000000000018c85 0x32a Core/Src/main.o + .debug_macro 0x0000000000018faf 0x10 Core/Src/main.o + .debug_macro 0x0000000000018fbf 0x52 Core/Src/main.o + .debug_macro 0x0000000000019011 0x1f Core/Src/main.o + .debug_macro 0x0000000000019030 0x43 Core/Src/main.o + .debug_macro 0x0000000000019073 0x20 Core/Src/main.o + .debug_macro 0x0000000000019093 0x1a3 Core/Src/main.o + .debug_macro 0x0000000000019236 0x10 Core/Src/main.o + .debug_macro 0x0000000000019246 0x1c Core/Src/main.o + .debug_macro 0x0000000000019262 0x52 Core/Src/main.o + .debug_macro 0x00000000000192b4 0x40 Core/Src/main.o + .debug_macro 0x00000000000192f4 0x10 Core/Src/main.o + .debug_macro 0x0000000000019304 0x40 Core/Src/main.o + .debug_macro 0x0000000000019344 0xd7 Core/Src/main.o + .debug_macro 0x000000000001941b 0x1c Core/Src/main.o + .debug_macro 0x0000000000019437 0x3d Core/Src/main.o + .debug_macro 0x0000000000019474 0x16 Core/Src/main.o + .debug_macro 0x000000000001948a 0x145 Core/Src/main.o + .debug_macro 0x00000000000195cf 0x16 Core/Src/main.o + .debug_macro 0x00000000000195e5 0x16 Core/Src/main.o + .debug_macro 0x00000000000195fb 0x29 Core/Src/main.o + .debug_macro 0x0000000000019624 0x16 Core/Src/main.o + .debug_macro 0x000000000001963a 0x20 Core/Src/main.o + .debug_macro 0x000000000001965a 0x1e1 Core/Src/main.o + .debug_macro 0x000000000001983b 0x224 Core/Src/main.o + .debug_macro 0x0000000000019a5f 0xf2 Core/Src/main.o + .debug_macro 0x0000000000019b51 0x200 Core/Src/stm32f1xx_hal_msp.o + .debug_macro 0x0000000000019d51 0x416 Core/Src/stm32f1xx_it.o + .debug_macro 0x000000000001a167 0x10 Core/Src/stm32f1xx_it.o + .debug_macro 0x000000000001a177 0x10 Core/Src/stm32f1xx_it.o + .debug_macro 0x000000000001a187 0x10c Core/Src/stm32f1xx_it.o + .debug_macro 0x000000000001a293 0x243 Core/Src/syscalls.o + .debug_macro 0x000000000001a4d6 0x40 Core/Src/syscalls.o + .debug_macro 0x000000000001a516 0x94 Core/Src/syscalls.o + .debug_macro 0x000000000001a5aa 0x57 Core/Src/syscalls.o + .debug_macro 0x000000000001a601 0x330 Core/Src/syscalls.o + .debug_macro 0x000000000001a931 0x10 Core/Src/syscalls.o + .debug_macro 0x000000000001a941 0x10 Core/Src/syscalls.o + .debug_macro 0x000000000001a951 0x10 Core/Src/syscalls.o + .debug_macro 0x000000000001a961 0x35 Core/Src/syscalls.o + .debug_macro 0x000000000001a996 0x122 Core/Src/syscalls.o + .debug_macro 0x000000000001aab8 0x10 Core/Src/syscalls.o + .debug_macro 0x000000000001aac8 0x241 Core/Src/syscalls.o + .debug_macro 0x000000000001ad09 0x1c Core/Src/syscalls.o + .debug_macro 0x000000000001ad25 0x10 Core/Src/syscalls.o + .debug_macro 0x000000000001ad35 0x189 Core/Src/syscalls.o + .debug_macro 0x000000000001aebe 0x16 Core/Src/syscalls.o + .debug_macro 0x000000000001aed4 0x88 Core/Src/syscalls.o + .debug_macro 0x000000000001af5c 0xee Core/Src/sysmem.o + .debug_macro 0x000000000001b04a 0x23b Core/Src/sysmem.o + .debug_macro 0x000000000001b285 0x18e Core/Src/system_stm32f1xx.o + .debug_macro 0x000000000001b413 0x20a Core/Src/tim.o + .debug_macro 0x000000000001b61d 0x20a Core/Src/usart.o + .debug_macro 0x000000000001b827 0x1b2 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_macro 0x000000000001b9d9 0x196 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_macro 0x000000000001bb6f 0x18e Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_macro 0x000000000001bcfd 0x1f9 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_macro 0x000000000001bef6 0x1b5 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x000000000001c0ab 0xca Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_macro 0x000000000001c175 0x1ca Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x000000000001c33f 0x224 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_macro 0x000000000001c563 0x1af Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x000000000001c712 0x2b8 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_macro 0x000000000001c9ca 0x219 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x000000000001cbe3 0x574 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_macro 0x000000000001d157 0x1fd Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x000000000001d354 0x1ae Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_macro 0x000000000001d502 0x20c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_macro 0x000000000001d70e 0x415 NxBase/canctrl.o + .debug_macro 0x000000000001db23 0x1c NxBase/canctrl.o + .debug_macro 0x000000000001db3f 0x10 NxBase/canctrl.o + .debug_macro 0x000000000001db4f 0x431 NxBase/console.o + .debug_macro 0x000000000001df80 0x16 NxBase/console.o + .debug_macro 0x000000000001df96 0x417 NxBase/cpuid.o + .debug_macro 0x000000000001e3ad 0x10 NxBase/cpuid.o + .debug_macro 0x000000000001e3bd 0x3f9 NxBase/delay.o + .debug_macro 0x000000000001e7b6 0x3fc NxBase/iwdog.o + .debug_macro 0x000000000001ebb2 0x495 NxBase/serial.o + .debug_macro 0x000000000001f047 0x40d NxBase/shell.o + .debug_macro 0x000000000001f454 0x16 NxBase/shell.o + .debug_macro 0x000000000001f46a 0x423 NxBase/trigger.o + .debug_macro 0x000000000001f88d 0x421 NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x000000000001fcae 0x8d NxFunc/controlbus/sewhdcontrol.o + .debug_macro 0x000000000001fd3b 0x3fe NxFunc/modbus/modbus_def.o + .debug_macro 0x0000000000020139 0x76 NxFunc/modbus/modbus_def.o + .debug_macro 0x00000000000201af 0x461 NxFunc/modbus/modbus_m.o + .debug_macro 0x0000000000020610 0x44a Users/App/apptasks.o + .debug_macro 0x0000000000020a5a 0x124 Users/App/apptasks.o + .debug_macro 0x0000000000020b7e 0x4e7 Users/App/sewhead/sewhead.o + .debug_macro 0x0000000000021065 0x106 Users/App/sewhead/sewhead.o + .debug_macro 0x000000000002116b 0x22 Users/App/sewhead/sewhead.o + .debug_macro 0x000000000002118d 0x1c Users/App/sewhead/sewhead.o + .debug_macro 0x00000000000211a9 0x434 Users/App/workctrl/debug.o + .debug_macro 0x00000000000215dd 0x1c Users/App/workctrl/debug.o + .debug_macro 0x00000000000215f9 0x48d Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000021a86 0x52 Users/App/workctrl/workctrl.o + .debug_macro 0x0000000000021ad8 0x3f9 Users/Base/inout.o + .debug_macro 0x0000000000021ed1 0x43d Users/Func/canwork.o + .debug_macro 0x000000000002230e 0x3fa Users/tasks.o + +.debug_line 0x0000000000000000 0x18a2a + .debug_line 0x0000000000000000 0x77f Core/Src/can.o + .debug_line 0x000000000000077f 0x888 Core/Src/gpio.o + .debug_line 0x0000000000001007 0xb49 Core/Src/main.o + .debug_line 0x0000000000001b50 0x744 Core/Src/stm32f1xx_hal_msp.o + .debug_line 0x0000000000002294 0xb92 Core/Src/stm32f1xx_it.o + .debug_line 0x0000000000002e26 0x73e Core/Src/syscalls.o + .debug_line 0x0000000000003564 0x4c7 Core/Src/sysmem.o + .debug_line 0x0000000000003a2b 0x66d Core/Src/system_stm32f1xx.o + .debug_line 0x0000000000004098 0x823 Core/Src/tim.o + .debug_line 0x00000000000048bb 0x88b Core/Src/usart.o + .debug_line 0x0000000000005146 0x87 Core/Startup/startup_stm32f103rctx.o + .debug_line 0x00000000000051cd 0x820 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_line 0x00000000000059ed 0xaee Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_line 0x00000000000064db 0x8f7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_line 0x0000000000006dd2 0x844 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_line 0x0000000000007616 0x751 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_line 0x0000000000007d67 0x7ca Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_line 0x0000000000008531 0x873 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_line 0x0000000000008da4 0xa62 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_line 0x0000000000009806 0x7d9 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_line 0x0000000000009fdf 0x921 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_line 0x000000000000a900 0xb50 NxBase/canctrl.o + .debug_line 0x000000000000b450 0xda4 NxBase/console.o + .debug_line 0x000000000000c1f4 0xaea NxBase/cpuid.o + .debug_line 0x000000000000ccde 0x9ed NxBase/delay.o + .debug_line 0x000000000000d6cb 0x9cd NxBase/iwdog.o + .debug_line 0x000000000000e098 0x10fe NxBase/serial.o + .debug_line 0x000000000000f196 0xbbc NxBase/shell.o + .debug_line 0x000000000000fd52 0xb1c NxBase/trigger.o + .debug_line 0x000000000001086e 0xa54 NxFunc/controlbus/sewhdcontrol.o + .debug_line 0x00000000000112c2 0xab7 NxFunc/modbus/modbus_def.o + .debug_line 0x0000000000011d79 0xed8 NxFunc/modbus/modbus_m.o + .debug_line 0x0000000000012c51 0xa95 Users/App/apptasks.o + .debug_line 0x00000000000136e6 0x110f Users/App/sewhead/sewhead.o + .debug_line 0x00000000000147f5 0x119b Users/App/workctrl/debug.o + .debug_line 0x0000000000015990 0xb50 Users/App/workctrl/workctrl.o + .debug_line 0x00000000000164e0 0x1027 Users/Base/inout.o + .debug_line 0x0000000000017507 0xb16 Users/Func/canwork.o + .debug_line 0x000000000001801d 0xa0d Users/tasks.o + +.debug_str 0x0000000000000000 0xa45b6 + .debug_str 0x0000000000000000 0x93f55 Core/Src/can.o + 0x945b2 (size before relaxing) + .debug_str 0x0000000000093f55 0x220 Core/Src/gpio.o + 0x94573 (size before relaxing) + .debug_str 0x0000000000094175 0x5785 Core/Src/main.o + 0x999e3 (size before relaxing) + .debug_str 0x00000000000998fa 0x2c Core/Src/stm32f1xx_hal_msp.o + 0x93ee2 (size before relaxing) + .debug_str 0x0000000000099926 0x7e2 Core/Src/stm32f1xx_it.o + 0x99fea (size before relaxing) + .debug_str 0x000000000009a108 0x1100 Core/Src/syscalls.o + 0x8866 (size before relaxing) + .debug_str 0x000000000009b208 0x6b Core/Src/sysmem.o + 0x5f34 (size before relaxing) + .debug_str 0x000000000009b273 0x52 Core/Src/system_stm32f1xx.o + 0x8b051 (size before relaxing) + .debug_str 0x000000000009b2c5 0xf0 Core/Src/tim.o + 0x94553 (size before relaxing) + .debug_str 0x000000000009b3b5 0x13d Core/Src/usart.o + 0x945b0 (size before relaxing) + .debug_str 0x000000000009b4f2 0x36 Core/Startup/startup_stm32f103rctx.o + 0x4f (size before relaxing) + .debug_str 0x000000000009b528 0x2e4 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + 0x8b7c6 (size before relaxing) + .debug_str 0x000000000009b80c 0x567 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + 0x8b871 (size before relaxing) + .debug_str 0x000000000009bd73 0x1f3 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + 0x8b7ce (size before relaxing) + .debug_str 0x000000000009bf66 0x316 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + 0x8b415 (size before relaxing) + .debug_str 0x000000000009c27c 0x306 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + 0x8b784 (size before relaxing) + .debug_str 0x000000000009c582 0x3c7 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + 0x8cc0c (size before relaxing) + .debug_str 0x000000000009c949 0x368 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + 0x8c50d (size before relaxing) + .debug_str 0x000000000009ccb1 0x12cb Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + 0x8f951 (size before relaxing) + .debug_str 0x000000000009df7c 0x7dd Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + 0x8e00b (size before relaxing) + .debug_str 0x000000000009e759 0xa8a Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + 0x8d2d8 (size before relaxing) + .debug_str 0x000000000009f1e3 0x22f NxBase/canctrl.o + 0x99c31 (size before relaxing) + .debug_str 0x000000000009f412 0x3b2 NxBase/console.o + 0x99beb (size before relaxing) + .debug_str 0x000000000009f7c4 0x154 NxBase/cpuid.o + 0x9975e (size before relaxing) + .debug_str 0x000000000009f918 0x4f NxBase/delay.o + 0x9959d (size before relaxing) + .debug_str 0x000000000009f967 0x67 NxBase/iwdog.o + 0x99593 (size before relaxing) + .debug_str 0x000000000009f9ce 0x1d57 NxBase/serial.o + 0x9b614 (size before relaxing) + .debug_str 0x00000000000a1725 0x13a NxBase/shell.o + 0x99789 (size before relaxing) + .debug_str 0x00000000000a185f 0x1fc NxBase/trigger.o + 0x99c42 (size before relaxing) + .debug_str 0x00000000000a1a5b 0xb03 NxFunc/controlbus/sewhdcontrol.o + 0x9a3a6 (size before relaxing) + .debug_str 0x00000000000a255e 0x3be NxFunc/modbus/modbus_def.o + 0x99bba (size before relaxing) + .debug_str 0x00000000000a291c 0x2eb NxFunc/modbus/modbus_m.o + 0x99e75 (size before relaxing) + .debug_str 0x00000000000a2c07 0x96 Users/App/apptasks.o + 0x9a345 (size before relaxing) + .debug_str 0x00000000000a2c9d 0x751 Users/App/sewhead/sewhead.o + 0x9b578 (size before relaxing) + .debug_str 0x00000000000a33ee 0x5a4 Users/App/workctrl/debug.o + 0x99c78 (size before relaxing) + .debug_str 0x00000000000a3992 0x62c Users/App/workctrl/workctrl.o + 0x9ae86 (size before relaxing) + .debug_str 0x00000000000a3fbe 0x558 Users/Base/inout.o + 0x9a10d (size before relaxing) + .debug_str 0x00000000000a4516 0x60 Users/Func/canwork.o + 0x9a47c (size before relaxing) + .debug_str 0x00000000000a4576 0x40 Users/tasks.o + 0x995d3 (size before relaxing) + +.comment 0x0000000000000000 0x7b + .comment 0x0000000000000000 0x7b Core/Src/can.o + 0x7c (size before relaxing) + .comment 0x000000000000007b 0x7c Core/Src/gpio.o + .comment 0x000000000000007b 0x7c Core/Src/main.o + .comment 0x000000000000007b 0x7c Core/Src/stm32f1xx_hal_msp.o + .comment 0x000000000000007b 0x7c Core/Src/stm32f1xx_it.o + .comment 0x000000000000007b 0x7c Core/Src/syscalls.o + .comment 0x000000000000007b 0x7c Core/Src/sysmem.o + .comment 0x000000000000007b 0x7c Core/Src/system_stm32f1xx.o + .comment 0x000000000000007b 0x7c Core/Src/tim.o + .comment 0x000000000000007b 0x7c Core/Src/usart.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .comment 0x000000000000007b 0x7c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .comment 0x000000000000007b 0x7c NxBase/canctrl.o + .comment 0x000000000000007b 0x7c NxBase/console.o + .comment 0x000000000000007b 0x7c NxBase/cpuid.o + .comment 0x000000000000007b 0x7c NxBase/delay.o + .comment 0x000000000000007b 0x7c NxBase/iwdog.o + .comment 0x000000000000007b 0x7c NxBase/serial.o + .comment 0x000000000000007b 0x7c NxBase/shell.o + .comment 0x000000000000007b 0x7c NxBase/trigger.o + .comment 0x000000000000007b 0x7c NxFunc/controlbus/sewhdcontrol.o + .comment 0x000000000000007b 0x7c NxFunc/modbus/modbus_def.o + .comment 0x000000000000007b 0x7c NxFunc/modbus/modbus_m.o + .comment 0x000000000000007b 0x7c Users/App/apptasks.o + .comment 0x000000000000007b 0x7c Users/App/sewhead/sewhead.o + .comment 0x000000000000007b 0x7c Users/App/workctrl/debug.o + .comment 0x000000000000007b 0x7c Users/App/workctrl/workctrl.o + .comment 0x000000000000007b 0x7c Users/Base/inout.o + .comment 0x000000000000007b 0x7c Users/Func/canwork.o + .comment 0x000000000000007b 0x7c Users/tasks.o + +.debug_frame 0x0000000000000000 0x5e34 + .debug_frame 0x0000000000000000 0x74 Core/Src/can.o + .debug_frame 0x0000000000000074 0x194 Core/Src/gpio.o + .debug_frame 0x0000000000000208 0x210 Core/Src/main.o + .debug_frame 0x0000000000000418 0x38 Core/Src/stm32f1xx_hal_msp.o + .debug_frame 0x0000000000000450 0x234 Core/Src/stm32f1xx_it.o + .debug_frame 0x0000000000000684 0x2ac Core/Src/syscalls.o + .debug_frame 0x0000000000000930 0x34 Core/Src/sysmem.o + .debug_frame 0x0000000000000964 0x58 Core/Src/system_stm32f1xx.o + .debug_frame 0x00000000000009bc 0x194 Core/Src/tim.o + .debug_frame 0x0000000000000b50 0x1d4 Core/Src/usart.o + .debug_frame 0x0000000000000d24 0x334 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o + .debug_frame 0x0000000000001058 0x5a0 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o + .debug_frame 0x00000000000015f8 0x428 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o + .debug_frame 0x0000000000001a20 0x14c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o + .debug_frame 0x0000000000001b6c 0x1bc Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o + .debug_frame 0x0000000000001d28 0x170 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o + .debug_frame 0x0000000000001e98 0x34c Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o + .debug_frame 0x00000000000021e4 0x538 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o + .debug_frame 0x000000000000271c 0x234 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o + .debug_frame 0x0000000000002950 0x400 Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o + .debug_frame 0x0000000000002d50 0x24c NxBase/canctrl.o + .debug_frame 0x0000000000002f9c 0x370 NxBase/console.o + .debug_frame 0x000000000000330c 0xd4 NxBase/cpuid.o + .debug_frame 0x00000000000033e0 0x7c NxBase/delay.o + .debug_frame 0x000000000000345c 0x58 NxBase/iwdog.o + .debug_frame 0x00000000000034b4 0x728 NxBase/serial.o + .debug_frame 0x0000000000003bdc 0x154 NxBase/shell.o + .debug_frame 0x0000000000003d30 0x1d8 NxBase/trigger.o + .debug_frame 0x0000000000003f08 0xd0 NxFunc/controlbus/sewhdcontrol.o + .debug_frame 0x0000000000003fd8 0x1a4 NxFunc/modbus/modbus_def.o + .debug_frame 0x000000000000417c 0x1e0 NxFunc/modbus/modbus_m.o + .debug_frame 0x000000000000435c 0x2c Users/App/apptasks.o + .debug_frame 0x0000000000004388 0x4ec Users/App/sewhead/sewhead.o + .debug_frame 0x0000000000004874 0xc0 Users/App/workctrl/debug.o + .debug_frame 0x0000000000004934 0x6c Users/App/workctrl/workctrl.o + .debug_frame 0x00000000000049a0 0xa4c Users/Base/inout.o + .debug_frame 0x00000000000053ec 0x74 Users/Func/canwork.o + .debug_frame 0x0000000000005460 0x54 Users/tasks.o + .debug_frame 0x00000000000054b4 0x30 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-atoi.o) + .debug_frame 0x00000000000054e4 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-errno.o) + .debug_frame 0x0000000000005504 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-init.o) + .debug_frame 0x0000000000005530 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memcpy-stub.o) + .debug_frame 0x0000000000005558 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memset.o) + .debug_frame 0x0000000000005578 0x74 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-printf.o) + .debug_frame 0x00000000000055ec 0x3c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-puts.o) + .debug_frame 0x0000000000005628 0x20 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strcpy.o) + .debug_frame 0x0000000000005648 0x84 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-strtol.o) + .debug_frame 0x00000000000056cc 0x40 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wbuf.o) + .debug_frame 0x000000000000570c 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wsetup.o) + .debug_frame 0x0000000000005738 0x68 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fflush.o) + .debug_frame 0x00000000000057a0 0x11c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-findfp.o) + .debug_frame 0x00000000000058bc 0x54 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fwalk.o) + .debug_frame 0x0000000000005910 0x68 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-locale.o) + .debug_frame 0x0000000000005978 0x58 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-makebuf.o) + .debug_frame 0x00000000000059d0 0x48 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mbtowc_r.o) + .debug_frame 0x0000000000005a18 0x38 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-freer.o) + .debug_frame 0x0000000000005a50 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-mallocr.o) + .debug_frame 0x0000000000005a7c 0xac c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf.o) + .debug_frame 0x0000000000005b28 0x60 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-nano-vfprintf_i.o) + .debug_frame 0x0000000000005b88 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-sbrkr.o) + .debug_frame 0x0000000000005bb4 0x88 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-stdio.o) + .debug_frame 0x0000000000005c3c 0x3c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-wctomb_r.o) + .debug_frame 0x0000000000005c78 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-writer.o) + .debug_frame 0x0000000000005ca4 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-closer.o) + .debug_frame 0x0000000000005cd0 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-fstatr.o) + .debug_frame 0x0000000000005cfc 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-isattyr.o) + .debug_frame 0x0000000000005d28 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-lseekr.o) + .debug_frame 0x0000000000005d54 0x28 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-memchr-stub.o) + .debug_frame 0x0000000000005d7c 0x30 c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-mlock.o) + .debug_frame 0x0000000000005dac 0x2c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-readr.o) + .debug_frame 0x0000000000005dd8 0x5c c:/st/stm32cubeide_1.5.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc_nano.a(lib_a-reent.o) diff --git a/SEW-EXA1/Debug/Users/App/apptasks.d b/SEW-EXA1/Debug/Users/App/apptasks.d new file mode 100644 index 0000000..f817119 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/apptasks.d @@ -0,0 +1,137 @@ +Users/App/apptasks.o: ../Users/App/apptasks.c ../Users/App/apptasks.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/trigger.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h D:/GOAQUI/NxBase/canctrl.h \ + ../Core/Inc/can.h ../Core/Inc/main.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h + +../Users/App/apptasks.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h: + +D:/GOAQUI/NxBase/canctrl.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: diff --git a/SEW-EXA1/Debug/Users/App/apptasks.o b/SEW-EXA1/Debug/Users/App/apptasks.o new file mode 100644 index 0000000..7ec9c2c Binary files /dev/null and b/SEW-EXA1/Debug/Users/App/apptasks.o differ diff --git a/SEW-EXA1/Debug/Users/App/apptasks.su b/SEW-EXA1/Debug/Users/App/apptasks.su new file mode 100644 index 0000000..cffd1b5 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/apptasks.su @@ -0,0 +1 @@ +apptasks.c:22:6:AppMainTask 8 static diff --git a/SEW-EXA1/Debug/Users/App/sewhead/sewhead.d b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.d new file mode 100644 index 0000000..cdd0abb --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.d @@ -0,0 +1,167 @@ +Users/App/sewhead/sewhead.o: ../Users/App/sewhead/sewhead.c \ + ../Users/App/sewhead/sewhead.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/trigger.h D:/GOAQUI/SEW-EXA1/Users/Base/inout.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/debug.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h D:/GOAQUI/NxBase/canctrl.h \ + ../Core/Inc/can.h ../Core/Inc/main.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/shell.h \ + D:/GOAQUI/NxBase/console.h D:/GOAQUI/NxBase/delay.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_def.h D:/GOAQUI/NxBase/serial.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_s.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_def.h \ + D:/GOAQUI/NxFuncs/modbus/modbus_m.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/para.h + +../Users/App/sewhead/sewhead.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/debug.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h: + +D:/GOAQUI/NxBase/canctrl.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_def.h: + +D:/GOAQUI/NxBase/serial.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_s.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_def.h: + +D:/GOAQUI/NxFuncs/modbus/modbus_m.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/para.h: diff --git a/SEW-EXA1/Debug/Users/App/sewhead/sewhead.o b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.o new file mode 100644 index 0000000..7f711b8 Binary files /dev/null and b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.o differ diff --git a/SEW-EXA1/Debug/Users/App/sewhead/sewhead.su b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.su new file mode 100644 index 0000000..bbbe910 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/sewhead/sewhead.su @@ -0,0 +1,39 @@ +stm32f1xx_ll_tim.h:1063:22:LL_TIM_EnableCounter 16 static +stm32f1xx_ll_tim.h:1074:22:LL_TIM_DisableCounter 16 static +stm32f1xx_ll_tim.h:3267:22:LL_TIM_EnableIT_UPDATE 16 static +sewhead.c:159:4:GetBoardSwitchValue 16 static +sewhead.c:182:6:InitSewHeadBoard 24 static +sewhead.c:235:6:InitSTM32PwmTimer 4 static +sewhead.c:297:6:SoftPwmIntProc 8 static +sewhead.c:316:6:InitSoftPwmCtrl 16 static +sewhead.c:333:6:PwmCtrlTask 8 static +sewhead.c:399:6:SysLedTask 8 static +sewhead.c:420:6:SewHeadBoardTask 8 static +sewhead.c:431:6:ModBusReceiveProc 16 static +sewhead.c:442:6:SendMotoCtrlCmd 72 static +sewhead.c:457:6:FootMotoCmdRst 8 static +sewhead.c:462:6:FootMotoToZero 8 static +sewhead.c:468:6:FootMotoDis 8 static +sewhead.c:473:6:FootMotoEn 8 static +sewhead.c:478:6:FootMotoReset 8 static +sewhead.c:483:6:OutputStepOn 8 static +sewhead.c:508:6:GetFollowTableValue 40 static +sewhead.c:523:6:FollowEcdOutPulseOn 8 static +sewhead.c:564:6:FollowEcdOutPulseOff 8 static +sewhead.c:576:6:FollowEcdOutDirOn 8 static +sewhead.c:590:6:FollowEcdOutDirOff 8 static +sewhead.c:605:6:CheckParasValue 8 static +sewhead.c:669:6:SetMotoPosValue 16 static +sewhead.c:674:6:PFootCtrlUp 8 static +sewhead.c:682:6:PFootCtrlDown 8 static +sewhead.c:697:6:PFootCtrlBack 8 static +sewhead.c:904:6:CanCmdProc 48 static +sewhead.c:1216:5:GetAngleFromEncoder 16 static +sewhead.c:1491:6:RefreshOutputSta 8 static +sewhead.c:1567:6:InOutStaRefreshTask 8 static +sewhead.c:1644:6:OutputCtrl 16 static +sewhead.c:1825:6:TestOutputTask 8 static +sewhead.c:1870:6:APIntProc 8 static +sewhead.c:1946:6:BPIntProc 4 static +sewhead.c:1991:6:ZPIntProc 4 static +sewhead.c:2002:6:TestAction 24 static diff --git a/SEW-EXA1/Debug/Users/App/sewhead/subdir.mk b/SEW-EXA1/Debug/Users/App/sewhead/subdir.mk new file mode 100644 index 0000000..5a866f4 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/sewhead/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/App/sewhead/sewhead.c + +OBJS += \ +./Users/App/sewhead/sewhead.o + +C_DEPS += \ +./Users/App/sewhead/sewhead.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/App/sewhead/sewhead.o: ../Users/App/sewhead/sewhead.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/App/sewhead/sewhead.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/App/subdir.mk b/SEW-EXA1/Debug/Users/App/subdir.mk new file mode 100644 index 0000000..febdaf9 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/App/apptasks.c + +OBJS += \ +./Users/App/apptasks.o + +C_DEPS += \ +./Users/App/apptasks.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/App/apptasks.o: ../Users/App/apptasks.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/App/apptasks.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/App/workctrl/debug.d b/SEW-EXA1/Debug/Users/App/workctrl/debug.d new file mode 100644 index 0000000..4c21abe --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/debug.d @@ -0,0 +1,123 @@ +Users/App/workctrl/debug.o: ../Users/App/workctrl/debug.c \ + ../Users/App/workctrl/debug.h D:/GOAQUI/SEW-EXA1/Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/Base/inout.h D:/GOAQUI/NxBase/shell.h \ + D:/GOAQUI/NxBase/console.h D:/GOAQUI/NxBase/delay.h + +../Users/App/workctrl/debug.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/NxBase/delay.h: diff --git a/SEW-EXA1/Debug/Users/App/workctrl/debug.o b/SEW-EXA1/Debug/Users/App/workctrl/debug.o new file mode 100644 index 0000000..47a2518 Binary files /dev/null and b/SEW-EXA1/Debug/Users/App/workctrl/debug.o differ diff --git a/SEW-EXA1/Debug/Users/App/workctrl/debug.su b/SEW-EXA1/Debug/Users/App/workctrl/debug.su new file mode 100644 index 0000000..a677375 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/debug.su @@ -0,0 +1,5 @@ +debug.c:31:6:InitDebug 8 static +debug.c:76:6:TestInputs 40 static +debug.c:212:6:TestOutput 32 static +debug.c:290:6:SetInputNameString 16 static +debug.c:295:6:SetOutputNameString 16 static diff --git a/SEW-EXA1/Debug/Users/App/workctrl/para.d b/SEW-EXA1/Debug/Users/App/workctrl/para.d new file mode 100644 index 0000000..f2be705 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/para.d @@ -0,0 +1,113 @@ +Users/App/workctrl/para.o: ../Users/App/workctrl/para.c \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/para.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/para.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Users/App/workctrl/para.o b/SEW-EXA1/Debug/Users/App/workctrl/para.o new file mode 100644 index 0000000..f06c3d4 Binary files /dev/null and b/SEW-EXA1/Debug/Users/App/workctrl/para.o differ diff --git a/SEW-EXA1/Debug/Users/App/workctrl/para.su b/SEW-EXA1/Debug/Users/App/workctrl/para.su new file mode 100644 index 0000000..e69de29 diff --git a/SEW-EXA1/Debug/Users/App/workctrl/subdir.mk b/SEW-EXA1/Debug/Users/App/workctrl/subdir.mk new file mode 100644 index 0000000..d0af4ab --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/subdir.mk @@ -0,0 +1,29 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/App/workctrl/debug.c \ +../Users/App/workctrl/para.c \ +../Users/App/workctrl/workctrl.c + +OBJS += \ +./Users/App/workctrl/debug.o \ +./Users/App/workctrl/para.o \ +./Users/App/workctrl/workctrl.o + +C_DEPS += \ +./Users/App/workctrl/debug.d \ +./Users/App/workctrl/para.d \ +./Users/App/workctrl/workctrl.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/App/workctrl/debug.o: ../Users/App/workctrl/debug.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/App/workctrl/debug.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Users/App/workctrl/para.o: ../Users/App/workctrl/para.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/App/workctrl/para.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" +Users/App/workctrl/workctrl.o: ../Users/App/workctrl/workctrl.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/App/workctrl/workctrl.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/App/workctrl/workctrl.d b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.d new file mode 100644 index 0000000..39db051 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.d @@ -0,0 +1,156 @@ +Users/App/workctrl/workctrl.o: ../Users/App/workctrl/workctrl.c \ + ../Users/App/workctrl/workctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h \ + D:/GOAQUI/NxBase/canctrl.h ../Core/Inc/can.h ../Core/Inc/main.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h \ + D:/GOAQUI/SEW-EXA1/Users/Base/inout.h D:/GOAQUI/NxBase/shell.h \ + D:/GOAQUI/NxBase/console.h D:/GOAQUI/NxBase/delay.h \ + D:/GOAQUI/NxBase/trigger.h D:/GOAQUI/NxBase/funcs.h \ + D:/GOAQUI/SEW-EXA1/Users/App/sewhead/sewhead.h \ + ../Users/App/workctrl/debug.h + +../Users/App/workctrl/workctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h: + +D:/GOAQUI/NxBase/canctrl.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/SEW-EXA1/Users/Base/inout.h: + +D:/GOAQUI/NxBase/shell.h: + +D:/GOAQUI/NxBase/console.h: + +D:/GOAQUI/NxBase/delay.h: + +D:/GOAQUI/NxBase/trigger.h: + +D:/GOAQUI/NxBase/funcs.h: + +D:/GOAQUI/SEW-EXA1/Users/App/sewhead/sewhead.h: + +../Users/App/workctrl/debug.h: diff --git a/SEW-EXA1/Debug/Users/App/workctrl/workctrl.o b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.o new file mode 100644 index 0000000..013dea1 Binary files /dev/null and b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.o differ diff --git a/SEW-EXA1/Debug/Users/App/workctrl/workctrl.su b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.su new file mode 100644 index 0000000..5b690e3 --- /dev/null +++ b/SEW-EXA1/Debug/Users/App/workctrl/workctrl.su @@ -0,0 +1,3 @@ +workctrl.c:33:6:InitWorkCtrl 8 static +workctrl.c:54:6:DelayRef 16 static +workctrl.c:67:6:WorkCtrlTask 8 static diff --git a/SEW-EXA1/Debug/Users/Base/inout.d b/SEW-EXA1/Debug/Users/Base/inout.d new file mode 100644 index 0000000..2a90ba2 --- /dev/null +++ b/SEW-EXA1/Debug/Users/Base/inout.d @@ -0,0 +1,115 @@ +Users/Base/inout.o: ../Users/Base/inout.c ../Users/Base/inout.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/NxBase/funcs.h + +../Users/Base/inout.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/NxBase/funcs.h: diff --git a/SEW-EXA1/Debug/Users/Base/inout.o b/SEW-EXA1/Debug/Users/Base/inout.o new file mode 100644 index 0000000..2e98e93 Binary files /dev/null and b/SEW-EXA1/Debug/Users/Base/inout.o differ diff --git a/SEW-EXA1/Debug/Users/Base/inout.su b/SEW-EXA1/Debug/Users/Base/inout.su new file mode 100644 index 0000000..0a4395f --- /dev/null +++ b/SEW-EXA1/Debug/Users/Base/inout.su @@ -0,0 +1,91 @@ +stm32f1xx_ll_gpio.h:723:26:LL_GPIO_IsInputPinSet 16 static +stm32f1xx_ll_gpio.h:775:26:LL_GPIO_IsOutputPinSet 16 static +stm32f1xx_ll_gpio.h:804:22:LL_GPIO_SetOutputPin 16 static +stm32f1xx_ll_gpio.h:833:22:LL_GPIO_ResetOutputPin 16 static +stm32f1xx_ll_gpio.h:862:22:LL_GPIO_TogglePin 24 static +inout.c:19:1:SetEn485OutOn 8 static +inout.c:19:1:SetEn485OutOff 8 static +inout.c:19:1:SetEn485OutToggle 8 static +inout.c:19:1:GetEn485OutStatus 8 static +inout.c:20:1:SetEn485_2_OutOn 8 static +inout.c:20:1:SetEn485_2_OutOff 8 static +inout.c:20:1:SetEn485_2_OutToggle 8 static +inout.c:20:1:GetEn485_2_OutStatus 8 static +inout.c:24:1:SetMoto1StepOn 8 static +inout.c:24:1:SetMoto1StepOff 8 static +inout.c:24:1:SetMoto1StepToggle 8 static +inout.c:24:1:GetMoto1StepStatus 8 static +inout.c:25:1:SetMoto1DirOn 8 static +inout.c:25:1:SetMoto1DirOff 8 static +inout.c:25:1:SetMoto1DirToggle 8 static +inout.c:25:1:GetMoto1DirStatus 8 static +inout.c:26:1:SetMoto1EnOn 8 static +inout.c:26:1:SetMoto1EnOff 8 static +inout.c:26:1:SetMoto1EnToggle 8 static +inout.c:26:1:GetMoto1EnStatus 8 static +inout.c:30:1:GetInputAPStatus 8 static +inout.c:31:1:GetInputBPStatus 8 static +inout.c:32:1:GetInputZPStatus 8 static +inout.c:35:1:SetSysLedOn 8 static +inout.c:35:1:SetSysLedOff 8 static +inout.c:35:1:SetSysLedToggle 8 static +inout.c:35:1:GetSysLedStatus 8 static +inout.c:36:1:SetErrLedOn 8 static +inout.c:36:1:SetErrLedOff 8 static +inout.c:36:1:SetErrLedToggle 8 static +inout.c:36:1:GetErrLedStatus 8 static +inout.c:38:1:SetOutputPWM1On 8 static +inout.c:38:1:SetOutputPWM1Off 8 static +inout.c:38:1:SetOutputPWM1Toggle 8 static +inout.c:38:1:GetOutputPWM1Status 8 static +inout.c:39:1:SetOutputPWM2On 8 static +inout.c:39:1:SetOutputPWM2Off 8 static +inout.c:39:1:SetOutputPWM2Toggle 8 static +inout.c:39:1:GetOutputPWM2Status 8 static +inout.c:41:1:SetOutput1On 8 static +inout.c:41:1:SetOutput1Off 8 static +inout.c:41:1:SetOutput1Toggle 8 static +inout.c:41:1:GetOutput1Status 8 static +inout.c:42:1:SetOutput2On 8 static +inout.c:42:1:SetOutput2Off 8 static +inout.c:42:1:SetOutput2Toggle 8 static +inout.c:42:1:GetOutput2Status 8 static +inout.c:43:1:SetOutput3On 8 static +inout.c:43:1:SetOutput3Off 8 static +inout.c:43:1:SetOutput3Toggle 8 static +inout.c:43:1:GetOutput3Status 8 static +inout.c:44:1:SetOutput4On 8 static +inout.c:44:1:SetOutput4Off 8 static +inout.c:44:1:SetOutput4Toggle 8 static +inout.c:44:1:GetOutput4Status 8 static +inout.c:45:1:SetOutput5On 8 static +inout.c:45:1:SetOutput5Off 8 static +inout.c:45:1:SetOutput5Toggle 8 static +inout.c:45:1:GetOutput5Status 8 static +inout.c:46:1:SetOutput6On 8 static +inout.c:46:1:SetOutput6Off 8 static +inout.c:46:1:SetOutput6Toggle 8 static +inout.c:46:1:GetOutput6Status 8 static +inout.c:47:1:SetOutput7On 8 static +inout.c:47:1:SetOutput7Off 8 static +inout.c:47:1:SetOutput7Toggle 8 static +inout.c:47:1:GetOutput7Status 8 static +inout.c:48:1:SetOutput8On 8 static +inout.c:48:1:SetOutput8Off 8 static +inout.c:48:1:SetOutput8Toggle 8 static +inout.c:48:1:GetOutput8Status 8 static +inout.c:51:1:GetInput1Status 8 static +inout.c:52:1:GetInput2Status 8 static +inout.c:53:1:GetInput3Status 8 static +inout.c:54:1:GetInput4Status 8 static +inout.c:55:1:GetInput5Status 8 static +inout.c:56:1:GetInput6Status 8 static +inout.c:57:1:GetInput7Status 8 static +inout.c:58:1:GetInput8Status 8 static +inout.c:61:1:GetSwitch1Status 8 static +inout.c:62:1:GetSwitch2Status 8 static +inout.c:63:1:GetSwitch3Status 8 static +inout.c:64:1:GetSwitch4Status 8 static +inout.c:67:6:SetOutputNull 4 static +inout.c:72:4:GetInputNullOn 4 static +inout.c:78:4:GetInputNullOff 4 static diff --git a/SEW-EXA1/Debug/Users/Base/subdir.mk b/SEW-EXA1/Debug/Users/Base/subdir.mk new file mode 100644 index 0000000..ed7dc2c --- /dev/null +++ b/SEW-EXA1/Debug/Users/Base/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/Base/inout.c + +OBJS += \ +./Users/Base/inout.o + +C_DEPS += \ +./Users/Base/inout.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/Base/inout.o: ../Users/Base/inout.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/Base/inout.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/Config/config.d b/SEW-EXA1/Debug/Users/Config/config.d new file mode 100644 index 0000000..fb30e28 --- /dev/null +++ b/SEW-EXA1/Debug/Users/Config/config.d @@ -0,0 +1,110 @@ +Users/Config/config.o: ../Users/Config/config.c ../Users/Config/config.h \ + D:/GOAQUI/NxBase/afxdef.h ../Core/Inc/main.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h + +../Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: diff --git a/SEW-EXA1/Debug/Users/Config/config.o b/SEW-EXA1/Debug/Users/Config/config.o new file mode 100644 index 0000000..58da32a Binary files /dev/null and b/SEW-EXA1/Debug/Users/Config/config.o differ diff --git a/SEW-EXA1/Debug/Users/Config/config.su b/SEW-EXA1/Debug/Users/Config/config.su new file mode 100644 index 0000000..a3944c9 --- /dev/null +++ b/SEW-EXA1/Debug/Users/Config/config.su @@ -0,0 +1,3 @@ +config.c:41:6:GetCompileDateTime 144 static +config.c:73:6:GetVersionStr 32 static +config.c:113:6:GetBuildStr 16 static diff --git a/SEW-EXA1/Debug/Users/Config/subdir.mk b/SEW-EXA1/Debug/Users/Config/subdir.mk new file mode 100644 index 0000000..2f19cc0 --- /dev/null +++ b/SEW-EXA1/Debug/Users/Config/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/Config/config.c + +OBJS += \ +./Users/Config/config.o + +C_DEPS += \ +./Users/Config/config.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/Config/config.o: ../Users/Config/config.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/Config/config.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/Func/canwork.d b/SEW-EXA1/Debug/Users/Func/canwork.d new file mode 100644 index 0000000..b61905c --- /dev/null +++ b/SEW-EXA1/Debug/Users/Func/canwork.d @@ -0,0 +1,134 @@ +Users/Func/canwork.o: ../Users/Func/canwork.c ../Users/Func/canwork.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h \ + D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h \ + D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h D:/GOAQUI/NxBase/canctrl.h \ + ../Core/Inc/can.h ../Core/Inc/main.h \ + D:/GOAQUI/NxFuncs/controlbus/controlbus.h + +../Users/Func/canwork.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/App/workctrl/workctrl.h: + +D:/GOAQUI/SEW-EXA1/Users/Func/canwork.h: + +D:/GOAQUI/NxFuncs/controlbus/sewhdcontrol.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: + +D:/GOAQUI/NxBase/canctrl.h: + +../Core/Inc/can.h: + +../Core/Inc/main.h: + +D:/GOAQUI/NxFuncs/controlbus/controlbus.h: diff --git a/SEW-EXA1/Debug/Users/Func/canwork.o b/SEW-EXA1/Debug/Users/Func/canwork.o new file mode 100644 index 0000000..9b43e53 Binary files /dev/null and b/SEW-EXA1/Debug/Users/Func/canwork.o differ diff --git a/SEW-EXA1/Debug/Users/Func/canwork.su b/SEW-EXA1/Debug/Users/Func/canwork.su new file mode 100644 index 0000000..557188e --- /dev/null +++ b/SEW-EXA1/Debug/Users/Func/canwork.su @@ -0,0 +1,3 @@ +canwork.c:21:6:InitCAN 8 static +canwork.c:40:6:ExA1CanFilter 56 static +canwork.c:95:6:CanBusTask 104 static diff --git a/SEW-EXA1/Debug/Users/Func/subdir.mk b/SEW-EXA1/Debug/Users/Func/subdir.mk new file mode 100644 index 0000000..ef2dca0 --- /dev/null +++ b/SEW-EXA1/Debug/Users/Func/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/Func/canwork.c + +OBJS += \ +./Users/Func/canwork.o + +C_DEPS += \ +./Users/Func/canwork.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/Func/canwork.o: ../Users/Func/canwork.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/Func/canwork.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/subdir.mk b/SEW-EXA1/Debug/Users/subdir.mk new file mode 100644 index 0000000..137a07e --- /dev/null +++ b/SEW-EXA1/Debug/Users/subdir.mk @@ -0,0 +1,19 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Users/tasks.c + +OBJS += \ +./Users/tasks.o + +C_DEPS += \ +./Users/tasks.d + + +# Each subdirectory must supply rules for building sources it contributes +Users/tasks.o: ../Users/tasks.c + arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DDEBUG -c -I../Core/Inc -I"D:/GOAQUI/SEW-EXA1/Users/App" -I"D:/GOAQUI/NxBase" -I"D:/GOAQUI/NxFuncs" -I"D:/GOAQUI/NxFuncs/comm" -I"D:/GOAQUI/NxFuncs/crc" -I"D:/GOAQUI/NxFuncs/modbus" -I"D:/GOAQUI/NxFuncs/stepdriver" -I"D:/GOAQUI/NxFuncs/stm32motos" -I"D:/GOAQUI/SEW-EXA1/Users/Base" -I"D:/GOAQUI/SEW-EXA1/Users/Config" -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I"D:/GOAQUI/SEW-EXA1/Users/App/sewhead" -I"D:/GOAQUI/SEW-EXA1/Users/App/workctrl" -I"D:/GOAQUI/SEW-EXA1/Users/Func" -I"D:/GOAQUI/NxFuncs/controlbus" -I"D:/GOAQUI/SEW-EXA1/Users" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Users/tasks.d" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" + diff --git a/SEW-EXA1/Debug/Users/tasks.d b/SEW-EXA1/Debug/Users/tasks.d new file mode 100644 index 0000000..8888921 --- /dev/null +++ b/SEW-EXA1/Debug/Users/tasks.d @@ -0,0 +1,115 @@ +Users/tasks.o: ../Users/tasks.c ../Users/tasks.h \ + D:/GOAQUI/SEW-EXA1/Users/Config/config.h D:/GOAQUI/NxBase/afxdef.h \ + ../Core/Inc/main.h ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h \ + ../Core/Inc/stm32f1xx_hal_conf.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h \ + ../Drivers/CMSIS/Include/core_cm3.h \ + ../Drivers/CMSIS/Include/cmsis_version.h \ + ../Drivers/CMSIS/Include/cmsis_compiler.h \ + ../Drivers/CMSIS/Include/cmsis_gcc.h \ + ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h \ + ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h \ + D:/GOAQUI/SEW-EXA1/Users/App/apptasks.h + +../Users/tasks.h: + +D:/GOAQUI/SEW-EXA1/Users/Config/config.h: + +D:/GOAQUI/NxBase/afxdef.h: + +../Core/Inc/main.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h: + +../Core/Inc/stm32f1xx_hal_conf.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: + +../Drivers/CMSIS/Include/core_cm3.h: + +../Drivers/CMSIS/Include/cmsis_version.h: + +../Drivers/CMSIS/Include/cmsis_compiler.h: + +../Drivers/CMSIS/Include/cmsis_gcc.h: + +../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h: + +../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: + +D:/GOAQUI/SEW-EXA1/Users/App/apptasks.h: diff --git a/SEW-EXA1/Debug/Users/tasks.o b/SEW-EXA1/Debug/Users/tasks.o new file mode 100644 index 0000000..df7b77e Binary files /dev/null and b/SEW-EXA1/Debug/Users/tasks.o differ diff --git a/SEW-EXA1/Debug/Users/tasks.su b/SEW-EXA1/Debug/Users/tasks.su new file mode 100644 index 0000000..df8dfe6 --- /dev/null +++ b/SEW-EXA1/Debug/Users/tasks.su @@ -0,0 +1,2 @@ +tasks.c:23:6:SetVectorTable 16 static,ignoring_inline_asm +tasks.c:38:6:MainTasks 8 static diff --git a/SEW-EXA1/Debug/makefile b/SEW-EXA1/Debug/makefile new file mode 100644 index 0000000..0670327 --- /dev/null +++ b/SEW-EXA1/Debug/makefile @@ -0,0 +1,109 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include Users/Func/subdir.mk +-include Users/Config/subdir.mk +-include Users/Base/subdir.mk +-include Users/App/workctrl/subdir.mk +-include Users/App/sewhead/subdir.mk +-include Users/App/subdir.mk +-include Users/subdir.mk +-include NxFunc/stm32motos/subdir.mk +-include NxFunc/stepdriver/subdir.mk +-include NxFunc/stdebug/subdir.mk +-include NxFunc/modbus/subdir.mk +-include NxFunc/crc/subdir.mk +-include NxFunc/controlbus/subdir.mk +-include NxFunc/comm/subdir.mk +-include NxBase/subdir.mk +-include Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk +-include Core/Startup/subdir.mk +-include Core/Src/subdir.mk +-include subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(S_DEPS)),) +-include $(S_DEPS) +endif +ifneq ($(strip $(S_UPPER_DEPS)),) +-include $(S_UPPER_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +-include ../makefile.defs + +BUILD_ARTIFACT_NAME := SEW-EXA1 +BUILD_ARTIFACT_EXTENSION := elf +BUILD_ARTIFACT_PREFIX := +BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME).$(BUILD_ARTIFACT_EXTENSION) + +# Add inputs and outputs from these tool invocations to the build variables +EXECUTABLES += \ +SEW-EXA1.elf \ + +SIZE_OUTPUT += \ +default.size.stdout \ + +OBJDUMP_LIST += \ +SEW-EXA1.list \ + +OBJCOPY_BIN += \ +SEW-EXA1.bin \ + + +# All Target +all: main-build + +# Main-build Target +main-build: SEW-EXA1.elf secondary-outputs + +# Tool invocations +SEW-EXA1.elf: $(OBJS) $(USER_OBJS) D:\GOAQUI\SEW-EXA1\STM32F103RCTX_FLASH.ld + arm-none-eabi-gcc -o "SEW-EXA1.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m3 -T"D:\GOAQUI\SEW-EXA1\STM32F103RCTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="SEW-EXA1.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group + @echo 'Finished building target: $@' + @echo ' ' + +default.size.stdout: $(EXECUTABLES) + arm-none-eabi-size $(EXECUTABLES) + @echo 'Finished building: $@' + @echo ' ' + +SEW-EXA1.list: $(EXECUTABLES) + arm-none-eabi-objdump -h -S $(EXECUTABLES) > "SEW-EXA1.list" + @echo 'Finished building: $@' + @echo ' ' + +SEW-EXA1.bin: $(EXECUTABLES) + arm-none-eabi-objcopy -O binary $(EXECUTABLES) "SEW-EXA1.bin" + @echo 'Finished building: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) * + -@echo ' ' + +secondary-outputs: $(SIZE_OUTPUT) $(OBJDUMP_LIST) $(OBJCOPY_BIN) + +fail-specified-linker-script-missing: + @echo 'Error: Cannot find the specified linker script. Check the linker settings in the build configuration.' + @exit 2 + +warn-no-linker-script-specified: + @echo 'Warning: No linker script specified. Check the linker settings in the build configuration.' + +.PHONY: all clean dependents fail-specified-linker-script-missing warn-no-linker-script-specified +.SECONDARY: + +-include ../makefile.targets diff --git a/SEW-EXA1/Debug/objects.list b/SEW-EXA1/Debug/objects.list new file mode 100644 index 0000000..5a8da8b --- /dev/null +++ b/SEW-EXA1/Debug/objects.list @@ -0,0 +1,77 @@ +"Core/Src/can.o" +"Core/Src/gpio.o" +"Core/Src/main.o" +"Core/Src/stm32f1xx_hal_msp.o" +"Core/Src/stm32f1xx_it.o" +"Core/Src/syscalls.o" +"Core/Src/sysmem.o" +"Core/Src/system_stm32f1xx.o" +"Core/Src/tim.o" +"Core/Src/usart.o" +"Core/Startup/startup_stm32f103rctx.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.o" +"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.o" +"NxBase/buttons.o" +"NxBase/canctrl.o" +"NxBase/console.o" +"NxBase/cpuid.o" +"NxBase/delay.o" +"NxBase/encrypt.o" +"NxBase/funcs.o" +"NxBase/i2crw.o" +"NxBase/iwdog.o" +"NxBase/serial.o" +"NxBase/shell.o" +"NxBase/spirw.o" +"NxBase/trigger.o" +"NxFunc/comm/comm.o" +"NxFunc/comm/mtcomm.o" +"NxFunc/comm/ocom.o" +"NxFunc/comm/protocol.o" +"NxFunc/comm/xmodem.o" +"NxFunc/controlbus/colorcontrol.o" +"NxFunc/controlbus/controlbus.o" +"NxFunc/controlbus/corecontrol.o" +"NxFunc/controlbus/extiocontrol.o" +"NxFunc/controlbus/headcontrol.o" +"NxFunc/controlbus/sewhdcontrol.o" +"NxFunc/crc/crc16.o" +"NxFunc/crc/crc32.o" +"NxFunc/crc/crc8.o" +"NxFunc/modbus/ef_a.o" +"NxFunc/modbus/modbus_def.o" +"NxFunc/modbus/modbus_m.o" +"NxFunc/modbus/modbus_s.o" +"NxFunc/modbus/modbus_tcp.o" +"NxFunc/modbus/one2onecomm.o" +"NxFunc/stdebug/stdebug.o" +"NxFunc/stepdriver/tmc260.o" +"NxFunc/stm32motos/stm32motos.o" +"Users/App/apptasks.o" +"Users/App/sewhead/sewhead.o" +"Users/App/workctrl/debug.o" +"Users/App/workctrl/para.o" +"Users/App/workctrl/workctrl.o" +"Users/Base/inout.o" +"Users/Config/config.o" +"Users/Func/canwork.o" +"Users/tasks.o" diff --git a/SEW-EXA1/Debug/objects.mk b/SEW-EXA1/Debug/objects.mk new file mode 100644 index 0000000..742c2da --- /dev/null +++ b/SEW-EXA1/Debug/objects.mk @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := + diff --git a/SEW-EXA1/Debug/sources.mk b/SEW-EXA1/Debug/sources.mk new file mode 100644 index 0000000..08bf3d8 --- /dev/null +++ b/SEW-EXA1/Debug/sources.mk @@ -0,0 +1,40 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +ELF_SRCS := +OBJ_SRCS := +S_SRCS := +C_SRCS := +S_UPPER_SRCS := +O_SRCS := +SIZE_OUTPUT := +OBJDUMP_LIST := +EXECUTABLES := +OBJS := +S_DEPS := +S_UPPER_DEPS := +C_DEPS := +OBJCOPY_BIN := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +Core/Src \ +Core/Startup \ +Drivers/STM32F1xx_HAL_Driver/Src \ +NxBase \ +NxFunc/comm \ +NxFunc/controlbus \ +NxFunc/crc \ +NxFunc/modbus \ +NxFunc/stdebug \ +NxFunc/stepdriver \ +NxFunc/stm32motos \ +Users/App \ +Users/App/sewhead \ +Users/App/workctrl \ +Users/Base \ +Users/Config \ +Users/Func \ +Users \ + diff --git a/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h b/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h new file mode 100644 index 0000000..9725d78 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h @@ -0,0 +1,11769 @@ +/** + ****************************************************************************** + * @file stm32f103xe.h + * @author MCD Application Team + * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File. + * This file contains all the peripheral register's definitions, bits + * definitions and memory mapping for STM32F1xx devices. + * + * This file contains: + * - Data structures and the address mapping for all peripherals + * - Peripheral's registers declarations and bits definition + * - Macros to access peripherals registers hardware + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f103xe + * @{ + */ + +#ifndef __STM32F103xE_H +#define __STM32F103xE_H + +#ifdef __cplusplus + extern "C" { +#endif + +/** @addtogroup Configuration_section_for_CMSIS + * @{ + */ +/** + * @brief Configuration of the Cortex-M3 Processor and Core Peripherals + */ +#define __CM3_REV 0x0200U /*!< Core Revision r2p0 */ + #define __MPU_PRESENT 0U /*!< Other STM32 devices does not provide an MPU */ +#define __NVIC_PRIO_BITS 4U /*!< STM32 uses 4 Bits for the Priority Levels */ +#define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ + +/** + * @} + */ + +/** @addtogroup Peripheral_interrupt_number_definition + * @{ + */ + +/** + * @brief STM32F10x Interrupt Number Definition, according to the selected device + * in @ref Library_configuration_section + */ + + /*!< Interrupt Number Definition */ +typedef enum +{ +/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/ + NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ + HardFault_IRQn = -13, /*!< 3 Cortex-M3 Hard Fault Interrupt */ + MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */ + BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */ + UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */ + SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */ + DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */ + PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */ + SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */ + +/****** STM32 specific Interrupt Numbers *********************************************************/ + WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ + PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ + TAMPER_IRQn = 2, /*!< Tamper Interrupt */ + RTC_IRQn = 3, /*!< RTC global Interrupt */ + FLASH_IRQn = 4, /*!< FLASH global Interrupt */ + RCC_IRQn = 5, /*!< RCC global Interrupt */ + EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */ + EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */ + EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */ + EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */ + EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */ + DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 global Interrupt */ + DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 global Interrupt */ + DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 global Interrupt */ + DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 global Interrupt */ + DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 global Interrupt */ + DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 global Interrupt */ + DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 global Interrupt */ + ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */ + USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */ + USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */ + CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ + CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ + EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ + TIM1_BRK_IRQn = 24, /*!< TIM1 Break Interrupt */ + TIM1_UP_IRQn = 25, /*!< TIM1 Update Interrupt */ + TIM1_TRG_COM_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt */ + TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */ + TIM2_IRQn = 28, /*!< TIM2 global Interrupt */ + TIM3_IRQn = 29, /*!< TIM3 global Interrupt */ + TIM4_IRQn = 30, /*!< TIM4 global Interrupt */ + I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ + I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ + I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ + I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ + SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ + SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ + USART1_IRQn = 37, /*!< USART1 global Interrupt */ + USART2_IRQn = 38, /*!< USART2 global Interrupt */ + USART3_IRQn = 39, /*!< USART3 global Interrupt */ + EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ + RTC_Alarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */ + USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */ + TIM8_BRK_IRQn = 43, /*!< TIM8 Break Interrupt */ + TIM8_UP_IRQn = 44, /*!< TIM8 Update Interrupt */ + TIM8_TRG_COM_IRQn = 45, /*!< TIM8 Trigger and Commutation Interrupt */ + TIM8_CC_IRQn = 46, /*!< TIM8 Capture Compare Interrupt */ + ADC3_IRQn = 47, /*!< ADC3 global Interrupt */ + FSMC_IRQn = 48, /*!< FSMC global Interrupt */ + SDIO_IRQn = 49, /*!< SDIO global Interrupt */ + TIM5_IRQn = 50, /*!< TIM5 global Interrupt */ + SPI3_IRQn = 51, /*!< SPI3 global Interrupt */ + UART4_IRQn = 52, /*!< UART4 global Interrupt */ + UART5_IRQn = 53, /*!< UART5 global Interrupt */ + TIM6_IRQn = 54, /*!< TIM6 global Interrupt */ + TIM7_IRQn = 55, /*!< TIM7 global Interrupt */ + DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */ + DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */ + DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */ + DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */ +} IRQn_Type; + +/** + * @} + */ + +#include "core_cm3.h" +#include "system_stm32f1xx.h" +#include + +/** @addtogroup Peripheral_registers_structures + * @{ + */ + +/** + * @brief Analog to Digital Converter + */ + +typedef struct +{ + __IO uint32_t SR; + __IO uint32_t CR1; + __IO uint32_t CR2; + __IO uint32_t SMPR1; + __IO uint32_t SMPR2; + __IO uint32_t JOFR1; + __IO uint32_t JOFR2; + __IO uint32_t JOFR3; + __IO uint32_t JOFR4; + __IO uint32_t HTR; + __IO uint32_t LTR; + __IO uint32_t SQR1; + __IO uint32_t SQR2; + __IO uint32_t SQR3; + __IO uint32_t JSQR; + __IO uint32_t JDR1; + __IO uint32_t JDR2; + __IO uint32_t JDR3; + __IO uint32_t JDR4; + __IO uint32_t DR; +} ADC_TypeDef; + +typedef struct +{ + __IO uint32_t SR; /*!< ADC status register, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address */ + __IO uint32_t CR1; /*!< ADC control register 1, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x04 */ + __IO uint32_t CR2; /*!< ADC control register 2, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x08 */ + uint32_t RESERVED[16]; + __IO uint32_t DR; /*!< ADC data register, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x4C */ +} ADC_Common_TypeDef; + +/** + * @brief Backup Registers + */ + +typedef struct +{ + uint32_t RESERVED0; + __IO uint32_t DR1; + __IO uint32_t DR2; + __IO uint32_t DR3; + __IO uint32_t DR4; + __IO uint32_t DR5; + __IO uint32_t DR6; + __IO uint32_t DR7; + __IO uint32_t DR8; + __IO uint32_t DR9; + __IO uint32_t DR10; + __IO uint32_t RTCCR; + __IO uint32_t CR; + __IO uint32_t CSR; + uint32_t RESERVED13[2]; + __IO uint32_t DR11; + __IO uint32_t DR12; + __IO uint32_t DR13; + __IO uint32_t DR14; + __IO uint32_t DR15; + __IO uint32_t DR16; + __IO uint32_t DR17; + __IO uint32_t DR18; + __IO uint32_t DR19; + __IO uint32_t DR20; + __IO uint32_t DR21; + __IO uint32_t DR22; + __IO uint32_t DR23; + __IO uint32_t DR24; + __IO uint32_t DR25; + __IO uint32_t DR26; + __IO uint32_t DR27; + __IO uint32_t DR28; + __IO uint32_t DR29; + __IO uint32_t DR30; + __IO uint32_t DR31; + __IO uint32_t DR32; + __IO uint32_t DR33; + __IO uint32_t DR34; + __IO uint32_t DR35; + __IO uint32_t DR36; + __IO uint32_t DR37; + __IO uint32_t DR38; + __IO uint32_t DR39; + __IO uint32_t DR40; + __IO uint32_t DR41; + __IO uint32_t DR42; +} BKP_TypeDef; + +/** + * @brief Controller Area Network TxMailBox + */ + +typedef struct +{ + __IO uint32_t TIR; + __IO uint32_t TDTR; + __IO uint32_t TDLR; + __IO uint32_t TDHR; +} CAN_TxMailBox_TypeDef; + +/** + * @brief Controller Area Network FIFOMailBox + */ + +typedef struct +{ + __IO uint32_t RIR; + __IO uint32_t RDTR; + __IO uint32_t RDLR; + __IO uint32_t RDHR; +} CAN_FIFOMailBox_TypeDef; + +/** + * @brief Controller Area Network FilterRegister + */ + +typedef struct +{ + __IO uint32_t FR1; + __IO uint32_t FR2; +} CAN_FilterRegister_TypeDef; + +/** + * @brief Controller Area Network + */ + +typedef struct +{ + __IO uint32_t MCR; + __IO uint32_t MSR; + __IO uint32_t TSR; + __IO uint32_t RF0R; + __IO uint32_t RF1R; + __IO uint32_t IER; + __IO uint32_t ESR; + __IO uint32_t BTR; + uint32_t RESERVED0[88]; + CAN_TxMailBox_TypeDef sTxMailBox[3]; + CAN_FIFOMailBox_TypeDef sFIFOMailBox[2]; + uint32_t RESERVED1[12]; + __IO uint32_t FMR; + __IO uint32_t FM1R; + uint32_t RESERVED2; + __IO uint32_t FS1R; + uint32_t RESERVED3; + __IO uint32_t FFA1R; + uint32_t RESERVED4; + __IO uint32_t FA1R; + uint32_t RESERVED5[8]; + CAN_FilterRegister_TypeDef sFilterRegister[14]; +} CAN_TypeDef; + +/** + * @brief CRC calculation unit + */ + +typedef struct +{ + __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */ + __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */ + uint8_t RESERVED0; /*!< Reserved, Address offset: 0x05 */ + uint16_t RESERVED1; /*!< Reserved, Address offset: 0x06 */ + __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */ +} CRC_TypeDef; + +/** + * @brief Digital to Analog Converter + */ + +typedef struct +{ + __IO uint32_t CR; + __IO uint32_t SWTRIGR; + __IO uint32_t DHR12R1; + __IO uint32_t DHR12L1; + __IO uint32_t DHR8R1; + __IO uint32_t DHR12R2; + __IO uint32_t DHR12L2; + __IO uint32_t DHR8R2; + __IO uint32_t DHR12RD; + __IO uint32_t DHR12LD; + __IO uint32_t DHR8RD; + __IO uint32_t DOR1; + __IO uint32_t DOR2; +} DAC_TypeDef; + +/** + * @brief Debug MCU + */ + +typedef struct +{ + __IO uint32_t IDCODE; + __IO uint32_t CR; +}DBGMCU_TypeDef; + +/** + * @brief DMA Controller + */ + +typedef struct +{ + __IO uint32_t CCR; + __IO uint32_t CNDTR; + __IO uint32_t CPAR; + __IO uint32_t CMAR; +} DMA_Channel_TypeDef; + +typedef struct +{ + __IO uint32_t ISR; + __IO uint32_t IFCR; +} DMA_TypeDef; + + + +/** + * @brief External Interrupt/Event Controller + */ + +typedef struct +{ + __IO uint32_t IMR; + __IO uint32_t EMR; + __IO uint32_t RTSR; + __IO uint32_t FTSR; + __IO uint32_t SWIER; + __IO uint32_t PR; +} EXTI_TypeDef; + +/** + * @brief FLASH Registers + */ + +typedef struct +{ + __IO uint32_t ACR; + __IO uint32_t KEYR; + __IO uint32_t OPTKEYR; + __IO uint32_t SR; + __IO uint32_t CR; + __IO uint32_t AR; + __IO uint32_t RESERVED; + __IO uint32_t OBR; + __IO uint32_t WRPR; +} FLASH_TypeDef; + +/** + * @brief Option Bytes Registers + */ + +typedef struct +{ + __IO uint16_t RDP; + __IO uint16_t USER; + __IO uint16_t Data0; + __IO uint16_t Data1; + __IO uint16_t WRP0; + __IO uint16_t WRP1; + __IO uint16_t WRP2; + __IO uint16_t WRP3; +} OB_TypeDef; + +/** + * @brief Flexible Static Memory Controller + */ + +typedef struct +{ + __IO uint32_t BTCR[8]; +} FSMC_Bank1_TypeDef; + +/** + * @brief Flexible Static Memory Controller Bank1E + */ + +typedef struct +{ + __IO uint32_t BWTR[7]; +} FSMC_Bank1E_TypeDef; + +/** + * @brief Flexible Static Memory Controller Bank2 + */ + +typedef struct +{ + __IO uint32_t PCR2; /*!< NAND Flash control register 2, Address offset: 0x60 */ + __IO uint32_t SR2; /*!< NAND Flash FIFO status and interrupt register 2, Address offset: 0x64 */ + __IO uint32_t PMEM2; /*!< NAND Flash Common memory space timing register 2, Address offset: 0x68 */ + __IO uint32_t PATT2; /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */ + uint32_t RESERVED0; /*!< Reserved, 0x70 */ + __IO uint32_t ECCR2; /*!< NAND Flash ECC result registers 2, Address offset: 0x74 */ + uint32_t RESERVED1; /*!< Reserved, 0x78 */ + uint32_t RESERVED2; /*!< Reserved, 0x7C */ + __IO uint32_t PCR3; /*!< NAND Flash control register 3, Address offset: 0x80 */ + __IO uint32_t SR3; /*!< NAND Flash FIFO status and interrupt register 3, Address offset: 0x84 */ + __IO uint32_t PMEM3; /*!< NAND Flash Common memory space timing register 3, Address offset: 0x88 */ + __IO uint32_t PATT3; /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */ + uint32_t RESERVED3; /*!< Reserved, 0x90 */ + __IO uint32_t ECCR3; /*!< NAND Flash ECC result registers 3, Address offset: 0x94 */ +} FSMC_Bank2_3_TypeDef; + +/** + * @brief Flexible Static Memory Controller Bank4 + */ + +typedef struct +{ + __IO uint32_t PCR4; + __IO uint32_t SR4; + __IO uint32_t PMEM4; + __IO uint32_t PATT4; + __IO uint32_t PIO4; +} FSMC_Bank4_TypeDef; + +/** + * @brief General Purpose I/O + */ + +typedef struct +{ + __IO uint32_t CRL; + __IO uint32_t CRH; + __IO uint32_t IDR; + __IO uint32_t ODR; + __IO uint32_t BSRR; + __IO uint32_t BRR; + __IO uint32_t LCKR; +} GPIO_TypeDef; + +/** + * @brief Alternate Function I/O + */ + +typedef struct +{ + __IO uint32_t EVCR; + __IO uint32_t MAPR; + __IO uint32_t EXTICR[4]; + uint32_t RESERVED0; + __IO uint32_t MAPR2; +} AFIO_TypeDef; +/** + * @brief Inter Integrated Circuit Interface + */ + +typedef struct +{ + __IO uint32_t CR1; + __IO uint32_t CR2; + __IO uint32_t OAR1; + __IO uint32_t OAR2; + __IO uint32_t DR; + __IO uint32_t SR1; + __IO uint32_t SR2; + __IO uint32_t CCR; + __IO uint32_t TRISE; +} I2C_TypeDef; + +/** + * @brief Independent WATCHDOG + */ + +typedef struct +{ + __IO uint32_t KR; /*!< Key register, Address offset: 0x00 */ + __IO uint32_t PR; /*!< Prescaler register, Address offset: 0x04 */ + __IO uint32_t RLR; /*!< Reload register, Address offset: 0x08 */ + __IO uint32_t SR; /*!< Status register, Address offset: 0x0C */ +} IWDG_TypeDef; + +/** + * @brief Power Control + */ + +typedef struct +{ + __IO uint32_t CR; + __IO uint32_t CSR; +} PWR_TypeDef; + +/** + * @brief Reset and Clock Control + */ + +typedef struct +{ + __IO uint32_t CR; + __IO uint32_t CFGR; + __IO uint32_t CIR; + __IO uint32_t APB2RSTR; + __IO uint32_t APB1RSTR; + __IO uint32_t AHBENR; + __IO uint32_t APB2ENR; + __IO uint32_t APB1ENR; + __IO uint32_t BDCR; + __IO uint32_t CSR; + + +} RCC_TypeDef; + +/** + * @brief Real-Time Clock + */ + +typedef struct +{ + __IO uint32_t CRH; + __IO uint32_t CRL; + __IO uint32_t PRLH; + __IO uint32_t PRLL; + __IO uint32_t DIVH; + __IO uint32_t DIVL; + __IO uint32_t CNTH; + __IO uint32_t CNTL; + __IO uint32_t ALRH; + __IO uint32_t ALRL; +} RTC_TypeDef; + +/** + * @brief SD host Interface + */ + +typedef struct +{ + __IO uint32_t POWER; + __IO uint32_t CLKCR; + __IO uint32_t ARG; + __IO uint32_t CMD; + __I uint32_t RESPCMD; + __I uint32_t RESP1; + __I uint32_t RESP2; + __I uint32_t RESP3; + __I uint32_t RESP4; + __IO uint32_t DTIMER; + __IO uint32_t DLEN; + __IO uint32_t DCTRL; + __I uint32_t DCOUNT; + __I uint32_t STA; + __IO uint32_t ICR; + __IO uint32_t MASK; + uint32_t RESERVED0[2]; + __I uint32_t FIFOCNT; + uint32_t RESERVED1[13]; + __IO uint32_t FIFO; +} SDIO_TypeDef; + +/** + * @brief Serial Peripheral Interface + */ + +typedef struct +{ + __IO uint32_t CR1; + __IO uint32_t CR2; + __IO uint32_t SR; + __IO uint32_t DR; + __IO uint32_t CRCPR; + __IO uint32_t RXCRCR; + __IO uint32_t TXCRCR; + __IO uint32_t I2SCFGR; + __IO uint32_t I2SPR; +} SPI_TypeDef; + +/** + * @brief TIM Timers + */ +typedef struct +{ + __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */ + __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */ + __IO uint32_t SMCR; /*!< TIM slave Mode Control register, Address offset: 0x08 */ + __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */ + __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */ + __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */ + __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */ + __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */ + __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */ + __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */ + __IO uint32_t PSC; /*!< TIM prescaler register, Address offset: 0x28 */ + __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */ + __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */ + __IO uint32_t CCR1; /*!< TIM capture/compare register 1, Address offset: 0x34 */ + __IO uint32_t CCR2; /*!< TIM capture/compare register 2, Address offset: 0x38 */ + __IO uint32_t CCR3; /*!< TIM capture/compare register 3, Address offset: 0x3C */ + __IO uint32_t CCR4; /*!< TIM capture/compare register 4, Address offset: 0x40 */ + __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */ + __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */ + __IO uint32_t DMAR; /*!< TIM DMA address for full transfer register, Address offset: 0x4C */ + __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */ +}TIM_TypeDef; + + +/** + * @brief Universal Synchronous Asynchronous Receiver Transmitter + */ + +typedef struct +{ + __IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */ + __IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */ + __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */ + __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x0C */ + __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x10 */ + __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x14 */ + __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x18 */ +} USART_TypeDef; + +/** + * @brief Universal Serial Bus Full Speed Device + */ + +typedef struct +{ + __IO uint16_t EP0R; /*!< USB Endpoint 0 register, Address offset: 0x00 */ + __IO uint16_t RESERVED0; /*!< Reserved */ + __IO uint16_t EP1R; /*!< USB Endpoint 1 register, Address offset: 0x04 */ + __IO uint16_t RESERVED1; /*!< Reserved */ + __IO uint16_t EP2R; /*!< USB Endpoint 2 register, Address offset: 0x08 */ + __IO uint16_t RESERVED2; /*!< Reserved */ + __IO uint16_t EP3R; /*!< USB Endpoint 3 register, Address offset: 0x0C */ + __IO uint16_t RESERVED3; /*!< Reserved */ + __IO uint16_t EP4R; /*!< USB Endpoint 4 register, Address offset: 0x10 */ + __IO uint16_t RESERVED4; /*!< Reserved */ + __IO uint16_t EP5R; /*!< USB Endpoint 5 register, Address offset: 0x14 */ + __IO uint16_t RESERVED5; /*!< Reserved */ + __IO uint16_t EP6R; /*!< USB Endpoint 6 register, Address offset: 0x18 */ + __IO uint16_t RESERVED6; /*!< Reserved */ + __IO uint16_t EP7R; /*!< USB Endpoint 7 register, Address offset: 0x1C */ + __IO uint16_t RESERVED7[17]; /*!< Reserved */ + __IO uint16_t CNTR; /*!< Control register, Address offset: 0x40 */ + __IO uint16_t RESERVED8; /*!< Reserved */ + __IO uint16_t ISTR; /*!< Interrupt status register, Address offset: 0x44 */ + __IO uint16_t RESERVED9; /*!< Reserved */ + __IO uint16_t FNR; /*!< Frame number register, Address offset: 0x48 */ + __IO uint16_t RESERVEDA; /*!< Reserved */ + __IO uint16_t DADDR; /*!< Device address register, Address offset: 0x4C */ + __IO uint16_t RESERVEDB; /*!< Reserved */ + __IO uint16_t BTABLE; /*!< Buffer Table address register, Address offset: 0x50 */ + __IO uint16_t RESERVEDC; /*!< Reserved */ +} USB_TypeDef; + + +/** + * @brief Window WATCHDOG + */ + +typedef struct +{ + __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */ + __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */ + __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */ +} WWDG_TypeDef; + +/** + * @} + */ + +/** @addtogroup Peripheral_memory_map + * @{ + */ + + +#define FLASH_BASE 0x08000000UL /*!< FLASH base address in the alias region */ +#define FLASH_BANK1_END 0x0807FFFFUL /*!< FLASH END address of bank1 */ +#define SRAM_BASE 0x20000000UL /*!< SRAM base address in the alias region */ +#define PERIPH_BASE 0x40000000UL /*!< Peripheral base address in the alias region */ + +#define SRAM_BB_BASE 0x22000000UL /*!< SRAM base address in the bit-band region */ +#define PERIPH_BB_BASE 0x42000000UL /*!< Peripheral base address in the bit-band region */ + +#define FSMC_BASE 0x60000000UL /*!< FSMC base address */ +#define FSMC_R_BASE 0xA0000000UL /*!< FSMC registers base address */ + +/*!< Peripheral memory map */ +#define APB1PERIPH_BASE PERIPH_BASE +#define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000UL) +#define AHBPERIPH_BASE (PERIPH_BASE + 0x00020000UL) + +#define TIM2_BASE (APB1PERIPH_BASE + 0x00000000UL) +#define TIM3_BASE (APB1PERIPH_BASE + 0x00000400UL) +#define TIM4_BASE (APB1PERIPH_BASE + 0x00000800UL) +#define TIM5_BASE (APB1PERIPH_BASE + 0x00000C00UL) +#define TIM6_BASE (APB1PERIPH_BASE + 0x00001000UL) +#define TIM7_BASE (APB1PERIPH_BASE + 0x00001400UL) +#define RTC_BASE (APB1PERIPH_BASE + 0x00002800UL) +#define WWDG_BASE (APB1PERIPH_BASE + 0x00002C00UL) +#define IWDG_BASE (APB1PERIPH_BASE + 0x00003000UL) +#define SPI2_BASE (APB1PERIPH_BASE + 0x00003800UL) +#define SPI3_BASE (APB1PERIPH_BASE + 0x00003C00UL) +#define USART2_BASE (APB1PERIPH_BASE + 0x00004400UL) +#define USART3_BASE (APB1PERIPH_BASE + 0x00004800UL) +#define UART4_BASE (APB1PERIPH_BASE + 0x00004C00UL) +#define UART5_BASE (APB1PERIPH_BASE + 0x00005000UL) +#define I2C1_BASE (APB1PERIPH_BASE + 0x00005400UL) +#define I2C2_BASE (APB1PERIPH_BASE + 0x00005800UL) +#define CAN1_BASE (APB1PERIPH_BASE + 0x00006400UL) +#define BKP_BASE (APB1PERIPH_BASE + 0x00006C00UL) +#define PWR_BASE (APB1PERIPH_BASE + 0x00007000UL) +#define DAC_BASE (APB1PERIPH_BASE + 0x00007400UL) +#define AFIO_BASE (APB2PERIPH_BASE + 0x00000000UL) +#define EXTI_BASE (APB2PERIPH_BASE + 0x00000400UL) +#define GPIOA_BASE (APB2PERIPH_BASE + 0x00000800UL) +#define GPIOB_BASE (APB2PERIPH_BASE + 0x00000C00UL) +#define GPIOC_BASE (APB2PERIPH_BASE + 0x00001000UL) +#define GPIOD_BASE (APB2PERIPH_BASE + 0x00001400UL) +#define GPIOE_BASE (APB2PERIPH_BASE + 0x00001800UL) +#define GPIOF_BASE (APB2PERIPH_BASE + 0x00001C00UL) +#define GPIOG_BASE (APB2PERIPH_BASE + 0x00002000UL) +#define ADC1_BASE (APB2PERIPH_BASE + 0x00002400UL) +#define ADC2_BASE (APB2PERIPH_BASE + 0x00002800UL) +#define TIM1_BASE (APB2PERIPH_BASE + 0x00002C00UL) +#define SPI1_BASE (APB2PERIPH_BASE + 0x00003000UL) +#define TIM8_BASE (APB2PERIPH_BASE + 0x00003400UL) +#define USART1_BASE (APB2PERIPH_BASE + 0x00003800UL) +#define ADC3_BASE (APB2PERIPH_BASE + 0x00003C00UL) + +#define SDIO_BASE (PERIPH_BASE + 0x00018000UL) + +#define DMA1_BASE (AHBPERIPH_BASE + 0x00000000UL) +#define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x00000008UL) +#define DMA1_Channel2_BASE (AHBPERIPH_BASE + 0x0000001CUL) +#define DMA1_Channel3_BASE (AHBPERIPH_BASE + 0x00000030UL) +#define DMA1_Channel4_BASE (AHBPERIPH_BASE + 0x00000044UL) +#define DMA1_Channel5_BASE (AHBPERIPH_BASE + 0x00000058UL) +#define DMA1_Channel6_BASE (AHBPERIPH_BASE + 0x0000006CUL) +#define DMA1_Channel7_BASE (AHBPERIPH_BASE + 0x00000080UL) +#define DMA2_BASE (AHBPERIPH_BASE + 0x00000400UL) +#define DMA2_Channel1_BASE (AHBPERIPH_BASE + 0x00000408UL) +#define DMA2_Channel2_BASE (AHBPERIPH_BASE + 0x0000041CUL) +#define DMA2_Channel3_BASE (AHBPERIPH_BASE + 0x00000430UL) +#define DMA2_Channel4_BASE (AHBPERIPH_BASE + 0x00000444UL) +#define DMA2_Channel5_BASE (AHBPERIPH_BASE + 0x00000458UL) +#define RCC_BASE (AHBPERIPH_BASE + 0x00001000UL) +#define CRC_BASE (AHBPERIPH_BASE + 0x00003000UL) + +#define FLASH_R_BASE (AHBPERIPH_BASE + 0x00002000UL) /*!< Flash registers base address */ +#define FLASHSIZE_BASE 0x1FFFF7E0UL /*!< FLASH Size register base address */ +#define UID_BASE 0x1FFFF7E8UL /*!< Unique device ID register base address */ +#define OB_BASE 0x1FFFF800UL /*!< Flash Option Bytes base address */ + + +#define FSMC_BANK1 (FSMC_BASE) /*!< FSMC Bank1 base address */ +#define FSMC_BANK1_1 (FSMC_BANK1) /*!< FSMC Bank1_1 base address */ +#define FSMC_BANK1_2 (FSMC_BANK1 + 0x04000000UL) /*!< FSMC Bank1_2 base address */ +#define FSMC_BANK1_3 (FSMC_BANK1 + 0x08000000UL) /*!< FSMC Bank1_3 base address */ +#define FSMC_BANK1_4 (FSMC_BANK1 + 0x0C000000UL) /*!< FSMC Bank1_4 base address */ + +#define FSMC_BANK2 (FSMC_BASE + 0x10000000UL) /*!< FSMC Bank2 base address */ +#define FSMC_BANK3 (FSMC_BASE + 0x20000000UL) /*!< FSMC Bank3 base address */ +#define FSMC_BANK4 (FSMC_BASE + 0x30000000UL) /*!< FSMC Bank4 base address */ + +#define FSMC_BANK1_R_BASE (FSMC_R_BASE + 0x00000000UL) /*!< FSMC Bank1 registers base address */ +#define FSMC_BANK1E_R_BASE (FSMC_R_BASE + 0x00000104UL) /*!< FSMC Bank1E registers base address */ +#define FSMC_BANK2_3_R_BASE (FSMC_R_BASE + 0x00000060UL) /*!< FSMC Bank2/Bank3 registers base address */ +#define FSMC_BANK4_R_BASE (FSMC_R_BASE + 0x000000A0UL) /*!< FSMC Bank4 registers base address */ + +#define DBGMCU_BASE 0xE0042000UL /*!< Debug MCU registers base address */ + +/* USB device FS */ +#define USB_BASE (APB1PERIPH_BASE + 0x00005C00UL) /*!< USB_IP Peripheral Registers base address */ +#define USB_PMAADDR (APB1PERIPH_BASE + 0x00006000UL) /*!< USB_IP Packet Memory Area base address */ + + +/** + * @} + */ + +/** @addtogroup Peripheral_declaration + * @{ + */ + +#define TIM2 ((TIM_TypeDef *)TIM2_BASE) +#define TIM3 ((TIM_TypeDef *)TIM3_BASE) +#define TIM4 ((TIM_TypeDef *)TIM4_BASE) +#define TIM5 ((TIM_TypeDef *)TIM5_BASE) +#define TIM6 ((TIM_TypeDef *)TIM6_BASE) +#define TIM7 ((TIM_TypeDef *)TIM7_BASE) +#define RTC ((RTC_TypeDef *)RTC_BASE) +#define WWDG ((WWDG_TypeDef *)WWDG_BASE) +#define IWDG ((IWDG_TypeDef *)IWDG_BASE) +#define SPI2 ((SPI_TypeDef *)SPI2_BASE) +#define SPI3 ((SPI_TypeDef *)SPI3_BASE) +#define USART2 ((USART_TypeDef *)USART2_BASE) +#define USART3 ((USART_TypeDef *)USART3_BASE) +#define UART4 ((USART_TypeDef *)UART4_BASE) +#define UART5 ((USART_TypeDef *)UART5_BASE) +#define I2C1 ((I2C_TypeDef *)I2C1_BASE) +#define I2C2 ((I2C_TypeDef *)I2C2_BASE) +#define USB ((USB_TypeDef *)USB_BASE) +#define CAN1 ((CAN_TypeDef *)CAN1_BASE) +#define BKP ((BKP_TypeDef *)BKP_BASE) +#define PWR ((PWR_TypeDef *)PWR_BASE) +#define DAC1 ((DAC_TypeDef *)DAC_BASE) +#define DAC ((DAC_TypeDef *)DAC_BASE) /* Kept for legacy purpose */ +#define AFIO ((AFIO_TypeDef *)AFIO_BASE) +#define EXTI ((EXTI_TypeDef *)EXTI_BASE) +#define GPIOA ((GPIO_TypeDef *)GPIOA_BASE) +#define GPIOB ((GPIO_TypeDef *)GPIOB_BASE) +#define GPIOC ((GPIO_TypeDef *)GPIOC_BASE) +#define GPIOD ((GPIO_TypeDef *)GPIOD_BASE) +#define GPIOE ((GPIO_TypeDef *)GPIOE_BASE) +#define GPIOF ((GPIO_TypeDef *)GPIOF_BASE) +#define GPIOG ((GPIO_TypeDef *)GPIOG_BASE) +#define ADC1 ((ADC_TypeDef *)ADC1_BASE) +#define ADC2 ((ADC_TypeDef *)ADC2_BASE) +#define ADC3 ((ADC_TypeDef *)ADC3_BASE) +#define ADC12_COMMON ((ADC_Common_TypeDef *)ADC1_BASE) +#define TIM1 ((TIM_TypeDef *)TIM1_BASE) +#define SPI1 ((SPI_TypeDef *)SPI1_BASE) +#define TIM8 ((TIM_TypeDef *)TIM8_BASE) +#define USART1 ((USART_TypeDef *)USART1_BASE) +#define SDIO ((SDIO_TypeDef *)SDIO_BASE) +#define DMA1 ((DMA_TypeDef *)DMA1_BASE) +#define DMA2 ((DMA_TypeDef *)DMA2_BASE) +#define DMA1_Channel1 ((DMA_Channel_TypeDef *)DMA1_Channel1_BASE) +#define DMA1_Channel2 ((DMA_Channel_TypeDef *)DMA1_Channel2_BASE) +#define DMA1_Channel3 ((DMA_Channel_TypeDef *)DMA1_Channel3_BASE) +#define DMA1_Channel4 ((DMA_Channel_TypeDef *)DMA1_Channel4_BASE) +#define DMA1_Channel5 ((DMA_Channel_TypeDef *)DMA1_Channel5_BASE) +#define DMA1_Channel6 ((DMA_Channel_TypeDef *)DMA1_Channel6_BASE) +#define DMA1_Channel7 ((DMA_Channel_TypeDef *)DMA1_Channel7_BASE) +#define DMA2_Channel1 ((DMA_Channel_TypeDef *)DMA2_Channel1_BASE) +#define DMA2_Channel2 ((DMA_Channel_TypeDef *)DMA2_Channel2_BASE) +#define DMA2_Channel3 ((DMA_Channel_TypeDef *)DMA2_Channel3_BASE) +#define DMA2_Channel4 ((DMA_Channel_TypeDef *)DMA2_Channel4_BASE) +#define DMA2_Channel5 ((DMA_Channel_TypeDef *)DMA2_Channel5_BASE) +#define RCC ((RCC_TypeDef *)RCC_BASE) +#define CRC ((CRC_TypeDef *)CRC_BASE) +#define FLASH ((FLASH_TypeDef *)FLASH_R_BASE) +#define OB ((OB_TypeDef *)OB_BASE) +#define FSMC_Bank1 ((FSMC_Bank1_TypeDef *)FSMC_BANK1_R_BASE) +#define FSMC_Bank1E ((FSMC_Bank1E_TypeDef *)FSMC_BANK1E_R_BASE) +#define FSMC_Bank2_3 ((FSMC_Bank2_3_TypeDef *)FSMC_BANK2_3_R_BASE) +#define FSMC_Bank4 ((FSMC_Bank4_TypeDef *)FSMC_BANK4_R_BASE) +#define DBGMCU ((DBGMCU_TypeDef *)DBGMCU_BASE) + + +/** + * @} + */ + +/** @addtogroup Exported_constants + * @{ + */ + + /** @addtogroup Hardware_Constant_Definition + * @{ + */ +#define LSI_STARTUP_TIME 85U /*!< LSI Maximum startup time in us */ + /** + * @} + */ + + /** @addtogroup Peripheral_Registers_Bits_Definition + * @{ + */ + +/******************************************************************************/ +/* Peripheral Registers_Bits_Definition */ +/******************************************************************************/ + +/******************************************************************************/ +/* */ +/* CRC calculation unit (CRC) */ +/* */ +/******************************************************************************/ + +/******************* Bit definition for CRC_DR register *********************/ +#define CRC_DR_DR_Pos (0U) +#define CRC_DR_DR_Msk (0xFFFFFFFFUL << CRC_DR_DR_Pos) /*!< 0xFFFFFFFF */ +#define CRC_DR_DR CRC_DR_DR_Msk /*!< Data register bits */ + +/******************* Bit definition for CRC_IDR register ********************/ +#define CRC_IDR_IDR_Pos (0U) +#define CRC_IDR_IDR_Msk (0xFFUL << CRC_IDR_IDR_Pos) /*!< 0x000000FF */ +#define CRC_IDR_IDR CRC_IDR_IDR_Msk /*!< General-purpose 8-bit data register bits */ + +/******************** Bit definition for CRC_CR register ********************/ +#define CRC_CR_RESET_Pos (0U) +#define CRC_CR_RESET_Msk (0x1UL << CRC_CR_RESET_Pos) /*!< 0x00000001 */ +#define CRC_CR_RESET CRC_CR_RESET_Msk /*!< RESET bit */ + +/******************************************************************************/ +/* */ +/* Power Control */ +/* */ +/******************************************************************************/ + +/******************** Bit definition for PWR_CR register ********************/ +#define PWR_CR_LPDS_Pos (0U) +#define PWR_CR_LPDS_Msk (0x1UL << PWR_CR_LPDS_Pos) /*!< 0x00000001 */ +#define PWR_CR_LPDS PWR_CR_LPDS_Msk /*!< Low-Power Deepsleep */ +#define PWR_CR_PDDS_Pos (1U) +#define PWR_CR_PDDS_Msk (0x1UL << PWR_CR_PDDS_Pos) /*!< 0x00000002 */ +#define PWR_CR_PDDS PWR_CR_PDDS_Msk /*!< Power Down Deepsleep */ +#define PWR_CR_CWUF_Pos (2U) +#define PWR_CR_CWUF_Msk (0x1UL << PWR_CR_CWUF_Pos) /*!< 0x00000004 */ +#define PWR_CR_CWUF PWR_CR_CWUF_Msk /*!< Clear Wakeup Flag */ +#define PWR_CR_CSBF_Pos (3U) +#define PWR_CR_CSBF_Msk (0x1UL << PWR_CR_CSBF_Pos) /*!< 0x00000008 */ +#define PWR_CR_CSBF PWR_CR_CSBF_Msk /*!< Clear Standby Flag */ +#define PWR_CR_PVDE_Pos (4U) +#define PWR_CR_PVDE_Msk (0x1UL << PWR_CR_PVDE_Pos) /*!< 0x00000010 */ +#define PWR_CR_PVDE PWR_CR_PVDE_Msk /*!< Power Voltage Detector Enable */ + +#define PWR_CR_PLS_Pos (5U) +#define PWR_CR_PLS_Msk (0x7UL << PWR_CR_PLS_Pos) /*!< 0x000000E0 */ +#define PWR_CR_PLS PWR_CR_PLS_Msk /*!< PLS[2:0] bits (PVD Level Selection) */ +#define PWR_CR_PLS_0 (0x1UL << PWR_CR_PLS_Pos) /*!< 0x00000020 */ +#define PWR_CR_PLS_1 (0x2UL << PWR_CR_PLS_Pos) /*!< 0x00000040 */ +#define PWR_CR_PLS_2 (0x4UL << PWR_CR_PLS_Pos) /*!< 0x00000080 */ + +/*!< PVD level configuration */ +#define PWR_CR_PLS_LEV0 0x00000000U /*!< PVD level 2.2V */ +#define PWR_CR_PLS_LEV1 0x00000020U /*!< PVD level 2.3V */ +#define PWR_CR_PLS_LEV2 0x00000040U /*!< PVD level 2.4V */ +#define PWR_CR_PLS_LEV3 0x00000060U /*!< PVD level 2.5V */ +#define PWR_CR_PLS_LEV4 0x00000080U /*!< PVD level 2.6V */ +#define PWR_CR_PLS_LEV5 0x000000A0U /*!< PVD level 2.7V */ +#define PWR_CR_PLS_LEV6 0x000000C0U /*!< PVD level 2.8V */ +#define PWR_CR_PLS_LEV7 0x000000E0U /*!< PVD level 2.9V */ + +/* Legacy defines */ +#define PWR_CR_PLS_2V2 PWR_CR_PLS_LEV0 +#define PWR_CR_PLS_2V3 PWR_CR_PLS_LEV1 +#define PWR_CR_PLS_2V4 PWR_CR_PLS_LEV2 +#define PWR_CR_PLS_2V5 PWR_CR_PLS_LEV3 +#define PWR_CR_PLS_2V6 PWR_CR_PLS_LEV4 +#define PWR_CR_PLS_2V7 PWR_CR_PLS_LEV5 +#define PWR_CR_PLS_2V8 PWR_CR_PLS_LEV6 +#define PWR_CR_PLS_2V9 PWR_CR_PLS_LEV7 + +#define PWR_CR_DBP_Pos (8U) +#define PWR_CR_DBP_Msk (0x1UL << PWR_CR_DBP_Pos) /*!< 0x00000100 */ +#define PWR_CR_DBP PWR_CR_DBP_Msk /*!< Disable Backup Domain write protection */ + + +/******************* Bit definition for PWR_CSR register ********************/ +#define PWR_CSR_WUF_Pos (0U) +#define PWR_CSR_WUF_Msk (0x1UL << PWR_CSR_WUF_Pos) /*!< 0x00000001 */ +#define PWR_CSR_WUF PWR_CSR_WUF_Msk /*!< Wakeup Flag */ +#define PWR_CSR_SBF_Pos (1U) +#define PWR_CSR_SBF_Msk (0x1UL << PWR_CSR_SBF_Pos) /*!< 0x00000002 */ +#define PWR_CSR_SBF PWR_CSR_SBF_Msk /*!< Standby Flag */ +#define PWR_CSR_PVDO_Pos (2U) +#define PWR_CSR_PVDO_Msk (0x1UL << PWR_CSR_PVDO_Pos) /*!< 0x00000004 */ +#define PWR_CSR_PVDO PWR_CSR_PVDO_Msk /*!< PVD Output */ +#define PWR_CSR_EWUP_Pos (8U) +#define PWR_CSR_EWUP_Msk (0x1UL << PWR_CSR_EWUP_Pos) /*!< 0x00000100 */ +#define PWR_CSR_EWUP PWR_CSR_EWUP_Msk /*!< Enable WKUP pin */ + +/******************************************************************************/ +/* */ +/* Backup registers */ +/* */ +/******************************************************************************/ + +/******************* Bit definition for BKP_DR1 register ********************/ +#define BKP_DR1_D_Pos (0U) +#define BKP_DR1_D_Msk (0xFFFFUL << BKP_DR1_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR1_D BKP_DR1_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR2 register ********************/ +#define BKP_DR2_D_Pos (0U) +#define BKP_DR2_D_Msk (0xFFFFUL << BKP_DR2_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR2_D BKP_DR2_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR3 register ********************/ +#define BKP_DR3_D_Pos (0U) +#define BKP_DR3_D_Msk (0xFFFFUL << BKP_DR3_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR3_D BKP_DR3_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR4 register ********************/ +#define BKP_DR4_D_Pos (0U) +#define BKP_DR4_D_Msk (0xFFFFUL << BKP_DR4_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR4_D BKP_DR4_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR5 register ********************/ +#define BKP_DR5_D_Pos (0U) +#define BKP_DR5_D_Msk (0xFFFFUL << BKP_DR5_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR5_D BKP_DR5_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR6 register ********************/ +#define BKP_DR6_D_Pos (0U) +#define BKP_DR6_D_Msk (0xFFFFUL << BKP_DR6_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR6_D BKP_DR6_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR7 register ********************/ +#define BKP_DR7_D_Pos (0U) +#define BKP_DR7_D_Msk (0xFFFFUL << BKP_DR7_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR7_D BKP_DR7_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR8 register ********************/ +#define BKP_DR8_D_Pos (0U) +#define BKP_DR8_D_Msk (0xFFFFUL << BKP_DR8_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR8_D BKP_DR8_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR9 register ********************/ +#define BKP_DR9_D_Pos (0U) +#define BKP_DR9_D_Msk (0xFFFFUL << BKP_DR9_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR9_D BKP_DR9_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR10 register *******************/ +#define BKP_DR10_D_Pos (0U) +#define BKP_DR10_D_Msk (0xFFFFUL << BKP_DR10_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR10_D BKP_DR10_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR11 register *******************/ +#define BKP_DR11_D_Pos (0U) +#define BKP_DR11_D_Msk (0xFFFFUL << BKP_DR11_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR11_D BKP_DR11_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR12 register *******************/ +#define BKP_DR12_D_Pos (0U) +#define BKP_DR12_D_Msk (0xFFFFUL << BKP_DR12_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR12_D BKP_DR12_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR13 register *******************/ +#define BKP_DR13_D_Pos (0U) +#define BKP_DR13_D_Msk (0xFFFFUL << BKP_DR13_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR13_D BKP_DR13_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR14 register *******************/ +#define BKP_DR14_D_Pos (0U) +#define BKP_DR14_D_Msk (0xFFFFUL << BKP_DR14_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR14_D BKP_DR14_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR15 register *******************/ +#define BKP_DR15_D_Pos (0U) +#define BKP_DR15_D_Msk (0xFFFFUL << BKP_DR15_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR15_D BKP_DR15_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR16 register *******************/ +#define BKP_DR16_D_Pos (0U) +#define BKP_DR16_D_Msk (0xFFFFUL << BKP_DR16_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR16_D BKP_DR16_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR17 register *******************/ +#define BKP_DR17_D_Pos (0U) +#define BKP_DR17_D_Msk (0xFFFFUL << BKP_DR17_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR17_D BKP_DR17_D_Msk /*!< Backup data */ + +/****************** Bit definition for BKP_DR18 register ********************/ +#define BKP_DR18_D_Pos (0U) +#define BKP_DR18_D_Msk (0xFFFFUL << BKP_DR18_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR18_D BKP_DR18_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR19 register *******************/ +#define BKP_DR19_D_Pos (0U) +#define BKP_DR19_D_Msk (0xFFFFUL << BKP_DR19_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR19_D BKP_DR19_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR20 register *******************/ +#define BKP_DR20_D_Pos (0U) +#define BKP_DR20_D_Msk (0xFFFFUL << BKP_DR20_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR20_D BKP_DR20_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR21 register *******************/ +#define BKP_DR21_D_Pos (0U) +#define BKP_DR21_D_Msk (0xFFFFUL << BKP_DR21_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR21_D BKP_DR21_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR22 register *******************/ +#define BKP_DR22_D_Pos (0U) +#define BKP_DR22_D_Msk (0xFFFFUL << BKP_DR22_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR22_D BKP_DR22_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR23 register *******************/ +#define BKP_DR23_D_Pos (0U) +#define BKP_DR23_D_Msk (0xFFFFUL << BKP_DR23_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR23_D BKP_DR23_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR24 register *******************/ +#define BKP_DR24_D_Pos (0U) +#define BKP_DR24_D_Msk (0xFFFFUL << BKP_DR24_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR24_D BKP_DR24_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR25 register *******************/ +#define BKP_DR25_D_Pos (0U) +#define BKP_DR25_D_Msk (0xFFFFUL << BKP_DR25_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR25_D BKP_DR25_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR26 register *******************/ +#define BKP_DR26_D_Pos (0U) +#define BKP_DR26_D_Msk (0xFFFFUL << BKP_DR26_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR26_D BKP_DR26_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR27 register *******************/ +#define BKP_DR27_D_Pos (0U) +#define BKP_DR27_D_Msk (0xFFFFUL << BKP_DR27_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR27_D BKP_DR27_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR28 register *******************/ +#define BKP_DR28_D_Pos (0U) +#define BKP_DR28_D_Msk (0xFFFFUL << BKP_DR28_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR28_D BKP_DR28_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR29 register *******************/ +#define BKP_DR29_D_Pos (0U) +#define BKP_DR29_D_Msk (0xFFFFUL << BKP_DR29_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR29_D BKP_DR29_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR30 register *******************/ +#define BKP_DR30_D_Pos (0U) +#define BKP_DR30_D_Msk (0xFFFFUL << BKP_DR30_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR30_D BKP_DR30_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR31 register *******************/ +#define BKP_DR31_D_Pos (0U) +#define BKP_DR31_D_Msk (0xFFFFUL << BKP_DR31_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR31_D BKP_DR31_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR32 register *******************/ +#define BKP_DR32_D_Pos (0U) +#define BKP_DR32_D_Msk (0xFFFFUL << BKP_DR32_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR32_D BKP_DR32_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR33 register *******************/ +#define BKP_DR33_D_Pos (0U) +#define BKP_DR33_D_Msk (0xFFFFUL << BKP_DR33_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR33_D BKP_DR33_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR34 register *******************/ +#define BKP_DR34_D_Pos (0U) +#define BKP_DR34_D_Msk (0xFFFFUL << BKP_DR34_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR34_D BKP_DR34_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR35 register *******************/ +#define BKP_DR35_D_Pos (0U) +#define BKP_DR35_D_Msk (0xFFFFUL << BKP_DR35_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR35_D BKP_DR35_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR36 register *******************/ +#define BKP_DR36_D_Pos (0U) +#define BKP_DR36_D_Msk (0xFFFFUL << BKP_DR36_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR36_D BKP_DR36_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR37 register *******************/ +#define BKP_DR37_D_Pos (0U) +#define BKP_DR37_D_Msk (0xFFFFUL << BKP_DR37_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR37_D BKP_DR37_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR38 register *******************/ +#define BKP_DR38_D_Pos (0U) +#define BKP_DR38_D_Msk (0xFFFFUL << BKP_DR38_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR38_D BKP_DR38_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR39 register *******************/ +#define BKP_DR39_D_Pos (0U) +#define BKP_DR39_D_Msk (0xFFFFUL << BKP_DR39_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR39_D BKP_DR39_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR40 register *******************/ +#define BKP_DR40_D_Pos (0U) +#define BKP_DR40_D_Msk (0xFFFFUL << BKP_DR40_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR40_D BKP_DR40_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR41 register *******************/ +#define BKP_DR41_D_Pos (0U) +#define BKP_DR41_D_Msk (0xFFFFUL << BKP_DR41_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR41_D BKP_DR41_D_Msk /*!< Backup data */ + +/******************* Bit definition for BKP_DR42 register *******************/ +#define BKP_DR42_D_Pos (0U) +#define BKP_DR42_D_Msk (0xFFFFUL << BKP_DR42_D_Pos) /*!< 0x0000FFFF */ +#define BKP_DR42_D BKP_DR42_D_Msk /*!< Backup data */ + +#define RTC_BKP_NUMBER 42 + +/****************** Bit definition for BKP_RTCCR register *******************/ +#define BKP_RTCCR_CAL_Pos (0U) +#define BKP_RTCCR_CAL_Msk (0x7FUL << BKP_RTCCR_CAL_Pos) /*!< 0x0000007F */ +#define BKP_RTCCR_CAL BKP_RTCCR_CAL_Msk /*!< Calibration value */ +#define BKP_RTCCR_CCO_Pos (7U) +#define BKP_RTCCR_CCO_Msk (0x1UL << BKP_RTCCR_CCO_Pos) /*!< 0x00000080 */ +#define BKP_RTCCR_CCO BKP_RTCCR_CCO_Msk /*!< Calibration Clock Output */ +#define BKP_RTCCR_ASOE_Pos (8U) +#define BKP_RTCCR_ASOE_Msk (0x1UL << BKP_RTCCR_ASOE_Pos) /*!< 0x00000100 */ +#define BKP_RTCCR_ASOE BKP_RTCCR_ASOE_Msk /*!< Alarm or Second Output Enable */ +#define BKP_RTCCR_ASOS_Pos (9U) +#define BKP_RTCCR_ASOS_Msk (0x1UL << BKP_RTCCR_ASOS_Pos) /*!< 0x00000200 */ +#define BKP_RTCCR_ASOS BKP_RTCCR_ASOS_Msk /*!< Alarm or Second Output Selection */ + +/******************** Bit definition for BKP_CR register ********************/ +#define BKP_CR_TPE_Pos (0U) +#define BKP_CR_TPE_Msk (0x1UL << BKP_CR_TPE_Pos) /*!< 0x00000001 */ +#define BKP_CR_TPE BKP_CR_TPE_Msk /*!< TAMPER pin enable */ +#define BKP_CR_TPAL_Pos (1U) +#define BKP_CR_TPAL_Msk (0x1UL << BKP_CR_TPAL_Pos) /*!< 0x00000002 */ +#define BKP_CR_TPAL BKP_CR_TPAL_Msk /*!< TAMPER pin active level */ + +/******************* Bit definition for BKP_CSR register ********************/ +#define BKP_CSR_CTE_Pos (0U) +#define BKP_CSR_CTE_Msk (0x1UL << BKP_CSR_CTE_Pos) /*!< 0x00000001 */ +#define BKP_CSR_CTE BKP_CSR_CTE_Msk /*!< Clear Tamper event */ +#define BKP_CSR_CTI_Pos (1U) +#define BKP_CSR_CTI_Msk (0x1UL << BKP_CSR_CTI_Pos) /*!< 0x00000002 */ +#define BKP_CSR_CTI BKP_CSR_CTI_Msk /*!< Clear Tamper Interrupt */ +#define BKP_CSR_TPIE_Pos (2U) +#define BKP_CSR_TPIE_Msk (0x1UL << BKP_CSR_TPIE_Pos) /*!< 0x00000004 */ +#define BKP_CSR_TPIE BKP_CSR_TPIE_Msk /*!< TAMPER Pin interrupt enable */ +#define BKP_CSR_TEF_Pos (8U) +#define BKP_CSR_TEF_Msk (0x1UL << BKP_CSR_TEF_Pos) /*!< 0x00000100 */ +#define BKP_CSR_TEF BKP_CSR_TEF_Msk /*!< Tamper Event Flag */ +#define BKP_CSR_TIF_Pos (9U) +#define BKP_CSR_TIF_Msk (0x1UL << BKP_CSR_TIF_Pos) /*!< 0x00000200 */ +#define BKP_CSR_TIF BKP_CSR_TIF_Msk /*!< Tamper Interrupt Flag */ + +/******************************************************************************/ +/* */ +/* Reset and Clock Control */ +/* */ +/******************************************************************************/ + +/******************** Bit definition for RCC_CR register ********************/ +#define RCC_CR_HSION_Pos (0U) +#define RCC_CR_HSION_Msk (0x1UL << RCC_CR_HSION_Pos) /*!< 0x00000001 */ +#define RCC_CR_HSION RCC_CR_HSION_Msk /*!< Internal High Speed clock enable */ +#define RCC_CR_HSIRDY_Pos (1U) +#define RCC_CR_HSIRDY_Msk (0x1UL << RCC_CR_HSIRDY_Pos) /*!< 0x00000002 */ +#define RCC_CR_HSIRDY RCC_CR_HSIRDY_Msk /*!< Internal High Speed clock ready flag */ +#define RCC_CR_HSITRIM_Pos (3U) +#define RCC_CR_HSITRIM_Msk (0x1FUL << RCC_CR_HSITRIM_Pos) /*!< 0x000000F8 */ +#define RCC_CR_HSITRIM RCC_CR_HSITRIM_Msk /*!< Internal High Speed clock trimming */ +#define RCC_CR_HSICAL_Pos (8U) +#define RCC_CR_HSICAL_Msk (0xFFUL << RCC_CR_HSICAL_Pos) /*!< 0x0000FF00 */ +#define RCC_CR_HSICAL RCC_CR_HSICAL_Msk /*!< Internal High Speed clock Calibration */ +#define RCC_CR_HSEON_Pos (16U) +#define RCC_CR_HSEON_Msk (0x1UL << RCC_CR_HSEON_Pos) /*!< 0x00010000 */ +#define RCC_CR_HSEON RCC_CR_HSEON_Msk /*!< External High Speed clock enable */ +#define RCC_CR_HSERDY_Pos (17U) +#define RCC_CR_HSERDY_Msk (0x1UL << RCC_CR_HSERDY_Pos) /*!< 0x00020000 */ +#define RCC_CR_HSERDY RCC_CR_HSERDY_Msk /*!< External High Speed clock ready flag */ +#define RCC_CR_HSEBYP_Pos (18U) +#define RCC_CR_HSEBYP_Msk (0x1UL << RCC_CR_HSEBYP_Pos) /*!< 0x00040000 */ +#define RCC_CR_HSEBYP RCC_CR_HSEBYP_Msk /*!< External High Speed clock Bypass */ +#define RCC_CR_CSSON_Pos (19U) +#define RCC_CR_CSSON_Msk (0x1UL << RCC_CR_CSSON_Pos) /*!< 0x00080000 */ +#define RCC_CR_CSSON RCC_CR_CSSON_Msk /*!< Clock Security System enable */ +#define RCC_CR_PLLON_Pos (24U) +#define RCC_CR_PLLON_Msk (0x1UL << RCC_CR_PLLON_Pos) /*!< 0x01000000 */ +#define RCC_CR_PLLON RCC_CR_PLLON_Msk /*!< PLL enable */ +#define RCC_CR_PLLRDY_Pos (25U) +#define RCC_CR_PLLRDY_Msk (0x1UL << RCC_CR_PLLRDY_Pos) /*!< 0x02000000 */ +#define RCC_CR_PLLRDY RCC_CR_PLLRDY_Msk /*!< PLL clock ready flag */ + + +/******************* Bit definition for RCC_CFGR register *******************/ +/*!< SW configuration */ +#define RCC_CFGR_SW_Pos (0U) +#define RCC_CFGR_SW_Msk (0x3UL << RCC_CFGR_SW_Pos) /*!< 0x00000003 */ +#define RCC_CFGR_SW RCC_CFGR_SW_Msk /*!< SW[1:0] bits (System clock Switch) */ +#define RCC_CFGR_SW_0 (0x1UL << RCC_CFGR_SW_Pos) /*!< 0x00000001 */ +#define RCC_CFGR_SW_1 (0x2UL << RCC_CFGR_SW_Pos) /*!< 0x00000002 */ + +#define RCC_CFGR_SW_HSI 0x00000000U /*!< HSI selected as system clock */ +#define RCC_CFGR_SW_HSE 0x00000001U /*!< HSE selected as system clock */ +#define RCC_CFGR_SW_PLL 0x00000002U /*!< PLL selected as system clock */ + +/*!< SWS configuration */ +#define RCC_CFGR_SWS_Pos (2U) +#define RCC_CFGR_SWS_Msk (0x3UL << RCC_CFGR_SWS_Pos) /*!< 0x0000000C */ +#define RCC_CFGR_SWS RCC_CFGR_SWS_Msk /*!< SWS[1:0] bits (System Clock Switch Status) */ +#define RCC_CFGR_SWS_0 (0x1UL << RCC_CFGR_SWS_Pos) /*!< 0x00000004 */ +#define RCC_CFGR_SWS_1 (0x2UL << RCC_CFGR_SWS_Pos) /*!< 0x00000008 */ + +#define RCC_CFGR_SWS_HSI 0x00000000U /*!< HSI oscillator used as system clock */ +#define RCC_CFGR_SWS_HSE 0x00000004U /*!< HSE oscillator used as system clock */ +#define RCC_CFGR_SWS_PLL 0x00000008U /*!< PLL used as system clock */ + +/*!< HPRE configuration */ +#define RCC_CFGR_HPRE_Pos (4U) +#define RCC_CFGR_HPRE_Msk (0xFUL << RCC_CFGR_HPRE_Pos) /*!< 0x000000F0 */ +#define RCC_CFGR_HPRE RCC_CFGR_HPRE_Msk /*!< HPRE[3:0] bits (AHB prescaler) */ +#define RCC_CFGR_HPRE_0 (0x1UL << RCC_CFGR_HPRE_Pos) /*!< 0x00000010 */ +#define RCC_CFGR_HPRE_1 (0x2UL << RCC_CFGR_HPRE_Pos) /*!< 0x00000020 */ +#define RCC_CFGR_HPRE_2 (0x4UL << RCC_CFGR_HPRE_Pos) /*!< 0x00000040 */ +#define RCC_CFGR_HPRE_3 (0x8UL << RCC_CFGR_HPRE_Pos) /*!< 0x00000080 */ + +#define RCC_CFGR_HPRE_DIV1 0x00000000U /*!< SYSCLK not divided */ +#define RCC_CFGR_HPRE_DIV2 0x00000080U /*!< SYSCLK divided by 2 */ +#define RCC_CFGR_HPRE_DIV4 0x00000090U /*!< SYSCLK divided by 4 */ +#define RCC_CFGR_HPRE_DIV8 0x000000A0U /*!< SYSCLK divided by 8 */ +#define RCC_CFGR_HPRE_DIV16 0x000000B0U /*!< SYSCLK divided by 16 */ +#define RCC_CFGR_HPRE_DIV64 0x000000C0U /*!< SYSCLK divided by 64 */ +#define RCC_CFGR_HPRE_DIV128 0x000000D0U /*!< SYSCLK divided by 128 */ +#define RCC_CFGR_HPRE_DIV256 0x000000E0U /*!< SYSCLK divided by 256 */ +#define RCC_CFGR_HPRE_DIV512 0x000000F0U /*!< SYSCLK divided by 512 */ + +/*!< PPRE1 configuration */ +#define RCC_CFGR_PPRE1_Pos (8U) +#define RCC_CFGR_PPRE1_Msk (0x7UL << RCC_CFGR_PPRE1_Pos) /*!< 0x00000700 */ +#define RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_Msk /*!< PRE1[2:0] bits (APB1 prescaler) */ +#define RCC_CFGR_PPRE1_0 (0x1UL << RCC_CFGR_PPRE1_Pos) /*!< 0x00000100 */ +#define RCC_CFGR_PPRE1_1 (0x2UL << RCC_CFGR_PPRE1_Pos) /*!< 0x00000200 */ +#define RCC_CFGR_PPRE1_2 (0x4UL << RCC_CFGR_PPRE1_Pos) /*!< 0x00000400 */ + +#define RCC_CFGR_PPRE1_DIV1 0x00000000U /*!< HCLK not divided */ +#define RCC_CFGR_PPRE1_DIV2 0x00000400U /*!< HCLK divided by 2 */ +#define RCC_CFGR_PPRE1_DIV4 0x00000500U /*!< HCLK divided by 4 */ +#define RCC_CFGR_PPRE1_DIV8 0x00000600U /*!< HCLK divided by 8 */ +#define RCC_CFGR_PPRE1_DIV16 0x00000700U /*!< HCLK divided by 16 */ + +/*!< PPRE2 configuration */ +#define RCC_CFGR_PPRE2_Pos (11U) +#define RCC_CFGR_PPRE2_Msk (0x7UL << RCC_CFGR_PPRE2_Pos) /*!< 0x00003800 */ +#define RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_Msk /*!< PRE2[2:0] bits (APB2 prescaler) */ +#define RCC_CFGR_PPRE2_0 (0x1UL << RCC_CFGR_PPRE2_Pos) /*!< 0x00000800 */ +#define RCC_CFGR_PPRE2_1 (0x2UL << RCC_CFGR_PPRE2_Pos) /*!< 0x00001000 */ +#define RCC_CFGR_PPRE2_2 (0x4UL << RCC_CFGR_PPRE2_Pos) /*!< 0x00002000 */ + +#define RCC_CFGR_PPRE2_DIV1 0x00000000U /*!< HCLK not divided */ +#define RCC_CFGR_PPRE2_DIV2 0x00002000U /*!< HCLK divided by 2 */ +#define RCC_CFGR_PPRE2_DIV4 0x00002800U /*!< HCLK divided by 4 */ +#define RCC_CFGR_PPRE2_DIV8 0x00003000U /*!< HCLK divided by 8 */ +#define RCC_CFGR_PPRE2_DIV16 0x00003800U /*!< HCLK divided by 16 */ + +/*!< ADCPPRE configuration */ +#define RCC_CFGR_ADCPRE_Pos (14U) +#define RCC_CFGR_ADCPRE_Msk (0x3UL << RCC_CFGR_ADCPRE_Pos) /*!< 0x0000C000 */ +#define RCC_CFGR_ADCPRE RCC_CFGR_ADCPRE_Msk /*!< ADCPRE[1:0] bits (ADC prescaler) */ +#define RCC_CFGR_ADCPRE_0 (0x1UL << RCC_CFGR_ADCPRE_Pos) /*!< 0x00004000 */ +#define RCC_CFGR_ADCPRE_1 (0x2UL << RCC_CFGR_ADCPRE_Pos) /*!< 0x00008000 */ + +#define RCC_CFGR_ADCPRE_DIV2 0x00000000U /*!< PCLK2 divided by 2 */ +#define RCC_CFGR_ADCPRE_DIV4 0x00004000U /*!< PCLK2 divided by 4 */ +#define RCC_CFGR_ADCPRE_DIV6 0x00008000U /*!< PCLK2 divided by 6 */ +#define RCC_CFGR_ADCPRE_DIV8 0x0000C000U /*!< PCLK2 divided by 8 */ + +#define RCC_CFGR_PLLSRC_Pos (16U) +#define RCC_CFGR_PLLSRC_Msk (0x1UL << RCC_CFGR_PLLSRC_Pos) /*!< 0x00010000 */ +#define RCC_CFGR_PLLSRC RCC_CFGR_PLLSRC_Msk /*!< PLL entry clock source */ + +#define RCC_CFGR_PLLXTPRE_Pos (17U) +#define RCC_CFGR_PLLXTPRE_Msk (0x1UL << RCC_CFGR_PLLXTPRE_Pos) /*!< 0x00020000 */ +#define RCC_CFGR_PLLXTPRE RCC_CFGR_PLLXTPRE_Msk /*!< HSE divider for PLL entry */ + +/*!< PLLMUL configuration */ +#define RCC_CFGR_PLLMULL_Pos (18U) +#define RCC_CFGR_PLLMULL_Msk (0xFUL << RCC_CFGR_PLLMULL_Pos) /*!< 0x003C0000 */ +#define RCC_CFGR_PLLMULL RCC_CFGR_PLLMULL_Msk /*!< PLLMUL[3:0] bits (PLL multiplication factor) */ +#define RCC_CFGR_PLLMULL_0 (0x1UL << RCC_CFGR_PLLMULL_Pos) /*!< 0x00040000 */ +#define RCC_CFGR_PLLMULL_1 (0x2UL << RCC_CFGR_PLLMULL_Pos) /*!< 0x00080000 */ +#define RCC_CFGR_PLLMULL_2 (0x4UL << RCC_CFGR_PLLMULL_Pos) /*!< 0x00100000 */ +#define RCC_CFGR_PLLMULL_3 (0x8UL << RCC_CFGR_PLLMULL_Pos) /*!< 0x00200000 */ + +#define RCC_CFGR_PLLXTPRE_HSE 0x00000000U /*!< HSE clock not divided for PLL entry */ +#define RCC_CFGR_PLLXTPRE_HSE_DIV2 0x00020000U /*!< HSE clock divided by 2 for PLL entry */ + +#define RCC_CFGR_PLLMULL2 0x00000000U /*!< PLL input clock*2 */ +#define RCC_CFGR_PLLMULL3_Pos (18U) +#define RCC_CFGR_PLLMULL3_Msk (0x1UL << RCC_CFGR_PLLMULL3_Pos) /*!< 0x00040000 */ +#define RCC_CFGR_PLLMULL3 RCC_CFGR_PLLMULL3_Msk /*!< PLL input clock*3 */ +#define RCC_CFGR_PLLMULL4_Pos (19U) +#define RCC_CFGR_PLLMULL4_Msk (0x1UL << RCC_CFGR_PLLMULL4_Pos) /*!< 0x00080000 */ +#define RCC_CFGR_PLLMULL4 RCC_CFGR_PLLMULL4_Msk /*!< PLL input clock*4 */ +#define RCC_CFGR_PLLMULL5_Pos (18U) +#define RCC_CFGR_PLLMULL5_Msk (0x3UL << RCC_CFGR_PLLMULL5_Pos) /*!< 0x000C0000 */ +#define RCC_CFGR_PLLMULL5 RCC_CFGR_PLLMULL5_Msk /*!< PLL input clock*5 */ +#define RCC_CFGR_PLLMULL6_Pos (20U) +#define RCC_CFGR_PLLMULL6_Msk (0x1UL << RCC_CFGR_PLLMULL6_Pos) /*!< 0x00100000 */ +#define RCC_CFGR_PLLMULL6 RCC_CFGR_PLLMULL6_Msk /*!< PLL input clock*6 */ +#define RCC_CFGR_PLLMULL7_Pos (18U) +#define RCC_CFGR_PLLMULL7_Msk (0x5UL << RCC_CFGR_PLLMULL7_Pos) /*!< 0x00140000 */ +#define RCC_CFGR_PLLMULL7 RCC_CFGR_PLLMULL7_Msk /*!< PLL input clock*7 */ +#define RCC_CFGR_PLLMULL8_Pos (19U) +#define RCC_CFGR_PLLMULL8_Msk (0x3UL << RCC_CFGR_PLLMULL8_Pos) /*!< 0x00180000 */ +#define RCC_CFGR_PLLMULL8 RCC_CFGR_PLLMULL8_Msk /*!< PLL input clock*8 */ +#define RCC_CFGR_PLLMULL9_Pos (18U) +#define RCC_CFGR_PLLMULL9_Msk (0x7UL << RCC_CFGR_PLLMULL9_Pos) /*!< 0x001C0000 */ +#define RCC_CFGR_PLLMULL9 RCC_CFGR_PLLMULL9_Msk /*!< PLL input clock*9 */ +#define RCC_CFGR_PLLMULL10_Pos (21U) +#define RCC_CFGR_PLLMULL10_Msk (0x1UL << RCC_CFGR_PLLMULL10_Pos) /*!< 0x00200000 */ +#define RCC_CFGR_PLLMULL10 RCC_CFGR_PLLMULL10_Msk /*!< PLL input clock10 */ +#define RCC_CFGR_PLLMULL11_Pos (18U) +#define RCC_CFGR_PLLMULL11_Msk (0x9UL << RCC_CFGR_PLLMULL11_Pos) /*!< 0x00240000 */ +#define RCC_CFGR_PLLMULL11 RCC_CFGR_PLLMULL11_Msk /*!< PLL input clock*11 */ +#define RCC_CFGR_PLLMULL12_Pos (19U) +#define RCC_CFGR_PLLMULL12_Msk (0x5UL << RCC_CFGR_PLLMULL12_Pos) /*!< 0x00280000 */ +#define RCC_CFGR_PLLMULL12 RCC_CFGR_PLLMULL12_Msk /*!< PLL input clock*12 */ +#define RCC_CFGR_PLLMULL13_Pos (18U) +#define RCC_CFGR_PLLMULL13_Msk (0xBUL << RCC_CFGR_PLLMULL13_Pos) /*!< 0x002C0000 */ +#define RCC_CFGR_PLLMULL13 RCC_CFGR_PLLMULL13_Msk /*!< PLL input clock*13 */ +#define RCC_CFGR_PLLMULL14_Pos (20U) +#define RCC_CFGR_PLLMULL14_Msk (0x3UL << RCC_CFGR_PLLMULL14_Pos) /*!< 0x00300000 */ +#define RCC_CFGR_PLLMULL14 RCC_CFGR_PLLMULL14_Msk /*!< PLL input clock*14 */ +#define RCC_CFGR_PLLMULL15_Pos (18U) +#define RCC_CFGR_PLLMULL15_Msk (0xDUL << RCC_CFGR_PLLMULL15_Pos) /*!< 0x00340000 */ +#define RCC_CFGR_PLLMULL15 RCC_CFGR_PLLMULL15_Msk /*!< PLL input clock*15 */ +#define RCC_CFGR_PLLMULL16_Pos (19U) +#define RCC_CFGR_PLLMULL16_Msk (0x7UL << RCC_CFGR_PLLMULL16_Pos) /*!< 0x00380000 */ +#define RCC_CFGR_PLLMULL16 RCC_CFGR_PLLMULL16_Msk /*!< PLL input clock*16 */ +#define RCC_CFGR_USBPRE_Pos (22U) +#define RCC_CFGR_USBPRE_Msk (0x1UL << RCC_CFGR_USBPRE_Pos) /*!< 0x00400000 */ +#define RCC_CFGR_USBPRE RCC_CFGR_USBPRE_Msk /*!< USB Device prescaler */ + +/*!< MCO configuration */ +#define RCC_CFGR_MCO_Pos (24U) +#define RCC_CFGR_MCO_Msk (0x7UL << RCC_CFGR_MCO_Pos) /*!< 0x07000000 */ +#define RCC_CFGR_MCO RCC_CFGR_MCO_Msk /*!< MCO[2:0] bits (Microcontroller Clock Output) */ +#define RCC_CFGR_MCO_0 (0x1UL << RCC_CFGR_MCO_Pos) /*!< 0x01000000 */ +#define RCC_CFGR_MCO_1 (0x2UL << RCC_CFGR_MCO_Pos) /*!< 0x02000000 */ +#define RCC_CFGR_MCO_2 (0x4UL << RCC_CFGR_MCO_Pos) /*!< 0x04000000 */ + +#define RCC_CFGR_MCO_NOCLOCK 0x00000000U /*!< No clock */ +#define RCC_CFGR_MCO_SYSCLK 0x04000000U /*!< System clock selected as MCO source */ +#define RCC_CFGR_MCO_HSI 0x05000000U /*!< HSI clock selected as MCO source */ +#define RCC_CFGR_MCO_HSE 0x06000000U /*!< HSE clock selected as MCO source */ +#define RCC_CFGR_MCO_PLLCLK_DIV2 0x07000000U /*!< PLL clock divided by 2 selected as MCO source */ + + /* Reference defines */ + #define RCC_CFGR_MCOSEL RCC_CFGR_MCO + #define RCC_CFGR_MCOSEL_0 RCC_CFGR_MCO_0 + #define RCC_CFGR_MCOSEL_1 RCC_CFGR_MCO_1 + #define RCC_CFGR_MCOSEL_2 RCC_CFGR_MCO_2 + #define RCC_CFGR_MCOSEL_NOCLOCK RCC_CFGR_MCO_NOCLOCK + #define RCC_CFGR_MCOSEL_SYSCLK RCC_CFGR_MCO_SYSCLK + #define RCC_CFGR_MCOSEL_HSI RCC_CFGR_MCO_HSI + #define RCC_CFGR_MCOSEL_HSE RCC_CFGR_MCO_HSE + #define RCC_CFGR_MCOSEL_PLL_DIV2 RCC_CFGR_MCO_PLLCLK_DIV2 + +/*!<****************** Bit definition for RCC_CIR register ********************/ +#define RCC_CIR_LSIRDYF_Pos (0U) +#define RCC_CIR_LSIRDYF_Msk (0x1UL << RCC_CIR_LSIRDYF_Pos) /*!< 0x00000001 */ +#define RCC_CIR_LSIRDYF RCC_CIR_LSIRDYF_Msk /*!< LSI Ready Interrupt flag */ +#define RCC_CIR_LSERDYF_Pos (1U) +#define RCC_CIR_LSERDYF_Msk (0x1UL << RCC_CIR_LSERDYF_Pos) /*!< 0x00000002 */ +#define RCC_CIR_LSERDYF RCC_CIR_LSERDYF_Msk /*!< LSE Ready Interrupt flag */ +#define RCC_CIR_HSIRDYF_Pos (2U) +#define RCC_CIR_HSIRDYF_Msk (0x1UL << RCC_CIR_HSIRDYF_Pos) /*!< 0x00000004 */ +#define RCC_CIR_HSIRDYF RCC_CIR_HSIRDYF_Msk /*!< HSI Ready Interrupt flag */ +#define RCC_CIR_HSERDYF_Pos (3U) +#define RCC_CIR_HSERDYF_Msk (0x1UL << RCC_CIR_HSERDYF_Pos) /*!< 0x00000008 */ +#define RCC_CIR_HSERDYF RCC_CIR_HSERDYF_Msk /*!< HSE Ready Interrupt flag */ +#define RCC_CIR_PLLRDYF_Pos (4U) +#define RCC_CIR_PLLRDYF_Msk (0x1UL << RCC_CIR_PLLRDYF_Pos) /*!< 0x00000010 */ +#define RCC_CIR_PLLRDYF RCC_CIR_PLLRDYF_Msk /*!< PLL Ready Interrupt flag */ +#define RCC_CIR_CSSF_Pos (7U) +#define RCC_CIR_CSSF_Msk (0x1UL << RCC_CIR_CSSF_Pos) /*!< 0x00000080 */ +#define RCC_CIR_CSSF RCC_CIR_CSSF_Msk /*!< Clock Security System Interrupt flag */ +#define RCC_CIR_LSIRDYIE_Pos (8U) +#define RCC_CIR_LSIRDYIE_Msk (0x1UL << RCC_CIR_LSIRDYIE_Pos) /*!< 0x00000100 */ +#define RCC_CIR_LSIRDYIE RCC_CIR_LSIRDYIE_Msk /*!< LSI Ready Interrupt Enable */ +#define RCC_CIR_LSERDYIE_Pos (9U) +#define RCC_CIR_LSERDYIE_Msk (0x1UL << RCC_CIR_LSERDYIE_Pos) /*!< 0x00000200 */ +#define RCC_CIR_LSERDYIE RCC_CIR_LSERDYIE_Msk /*!< LSE Ready Interrupt Enable */ +#define RCC_CIR_HSIRDYIE_Pos (10U) +#define RCC_CIR_HSIRDYIE_Msk (0x1UL << RCC_CIR_HSIRDYIE_Pos) /*!< 0x00000400 */ +#define RCC_CIR_HSIRDYIE RCC_CIR_HSIRDYIE_Msk /*!< HSI Ready Interrupt Enable */ +#define RCC_CIR_HSERDYIE_Pos (11U) +#define RCC_CIR_HSERDYIE_Msk (0x1UL << RCC_CIR_HSERDYIE_Pos) /*!< 0x00000800 */ +#define RCC_CIR_HSERDYIE RCC_CIR_HSERDYIE_Msk /*!< HSE Ready Interrupt Enable */ +#define RCC_CIR_PLLRDYIE_Pos (12U) +#define RCC_CIR_PLLRDYIE_Msk (0x1UL << RCC_CIR_PLLRDYIE_Pos) /*!< 0x00001000 */ +#define RCC_CIR_PLLRDYIE RCC_CIR_PLLRDYIE_Msk /*!< PLL Ready Interrupt Enable */ +#define RCC_CIR_LSIRDYC_Pos (16U) +#define RCC_CIR_LSIRDYC_Msk (0x1UL << RCC_CIR_LSIRDYC_Pos) /*!< 0x00010000 */ +#define RCC_CIR_LSIRDYC RCC_CIR_LSIRDYC_Msk /*!< LSI Ready Interrupt Clear */ +#define RCC_CIR_LSERDYC_Pos (17U) +#define RCC_CIR_LSERDYC_Msk (0x1UL << RCC_CIR_LSERDYC_Pos) /*!< 0x00020000 */ +#define RCC_CIR_LSERDYC RCC_CIR_LSERDYC_Msk /*!< LSE Ready Interrupt Clear */ +#define RCC_CIR_HSIRDYC_Pos (18U) +#define RCC_CIR_HSIRDYC_Msk (0x1UL << RCC_CIR_HSIRDYC_Pos) /*!< 0x00040000 */ +#define RCC_CIR_HSIRDYC RCC_CIR_HSIRDYC_Msk /*!< HSI Ready Interrupt Clear */ +#define RCC_CIR_HSERDYC_Pos (19U) +#define RCC_CIR_HSERDYC_Msk (0x1UL << RCC_CIR_HSERDYC_Pos) /*!< 0x00080000 */ +#define RCC_CIR_HSERDYC RCC_CIR_HSERDYC_Msk /*!< HSE Ready Interrupt Clear */ +#define RCC_CIR_PLLRDYC_Pos (20U) +#define RCC_CIR_PLLRDYC_Msk (0x1UL << RCC_CIR_PLLRDYC_Pos) /*!< 0x00100000 */ +#define RCC_CIR_PLLRDYC RCC_CIR_PLLRDYC_Msk /*!< PLL Ready Interrupt Clear */ +#define RCC_CIR_CSSC_Pos (23U) +#define RCC_CIR_CSSC_Msk (0x1UL << RCC_CIR_CSSC_Pos) /*!< 0x00800000 */ +#define RCC_CIR_CSSC RCC_CIR_CSSC_Msk /*!< Clock Security System Interrupt Clear */ + + +/***************** Bit definition for RCC_APB2RSTR register *****************/ +#define RCC_APB2RSTR_AFIORST_Pos (0U) +#define RCC_APB2RSTR_AFIORST_Msk (0x1UL << RCC_APB2RSTR_AFIORST_Pos) /*!< 0x00000001 */ +#define RCC_APB2RSTR_AFIORST RCC_APB2RSTR_AFIORST_Msk /*!< Alternate Function I/O reset */ +#define RCC_APB2RSTR_IOPARST_Pos (2U) +#define RCC_APB2RSTR_IOPARST_Msk (0x1UL << RCC_APB2RSTR_IOPARST_Pos) /*!< 0x00000004 */ +#define RCC_APB2RSTR_IOPARST RCC_APB2RSTR_IOPARST_Msk /*!< I/O port A reset */ +#define RCC_APB2RSTR_IOPBRST_Pos (3U) +#define RCC_APB2RSTR_IOPBRST_Msk (0x1UL << RCC_APB2RSTR_IOPBRST_Pos) /*!< 0x00000008 */ +#define RCC_APB2RSTR_IOPBRST RCC_APB2RSTR_IOPBRST_Msk /*!< I/O port B reset */ +#define RCC_APB2RSTR_IOPCRST_Pos (4U) +#define RCC_APB2RSTR_IOPCRST_Msk (0x1UL << RCC_APB2RSTR_IOPCRST_Pos) /*!< 0x00000010 */ +#define RCC_APB2RSTR_IOPCRST RCC_APB2RSTR_IOPCRST_Msk /*!< I/O port C reset */ +#define RCC_APB2RSTR_IOPDRST_Pos (5U) +#define RCC_APB2RSTR_IOPDRST_Msk (0x1UL << RCC_APB2RSTR_IOPDRST_Pos) /*!< 0x00000020 */ +#define RCC_APB2RSTR_IOPDRST RCC_APB2RSTR_IOPDRST_Msk /*!< I/O port D reset */ +#define RCC_APB2RSTR_ADC1RST_Pos (9U) +#define RCC_APB2RSTR_ADC1RST_Msk (0x1UL << RCC_APB2RSTR_ADC1RST_Pos) /*!< 0x00000200 */ +#define RCC_APB2RSTR_ADC1RST RCC_APB2RSTR_ADC1RST_Msk /*!< ADC 1 interface reset */ + +#define RCC_APB2RSTR_ADC2RST_Pos (10U) +#define RCC_APB2RSTR_ADC2RST_Msk (0x1UL << RCC_APB2RSTR_ADC2RST_Pos) /*!< 0x00000400 */ +#define RCC_APB2RSTR_ADC2RST RCC_APB2RSTR_ADC2RST_Msk /*!< ADC 2 interface reset */ + +#define RCC_APB2RSTR_TIM1RST_Pos (11U) +#define RCC_APB2RSTR_TIM1RST_Msk (0x1UL << RCC_APB2RSTR_TIM1RST_Pos) /*!< 0x00000800 */ +#define RCC_APB2RSTR_TIM1RST RCC_APB2RSTR_TIM1RST_Msk /*!< TIM1 Timer reset */ +#define RCC_APB2RSTR_SPI1RST_Pos (12U) +#define RCC_APB2RSTR_SPI1RST_Msk (0x1UL << RCC_APB2RSTR_SPI1RST_Pos) /*!< 0x00001000 */ +#define RCC_APB2RSTR_SPI1RST RCC_APB2RSTR_SPI1RST_Msk /*!< SPI 1 reset */ +#define RCC_APB2RSTR_USART1RST_Pos (14U) +#define RCC_APB2RSTR_USART1RST_Msk (0x1UL << RCC_APB2RSTR_USART1RST_Pos) /*!< 0x00004000 */ +#define RCC_APB2RSTR_USART1RST RCC_APB2RSTR_USART1RST_Msk /*!< USART1 reset */ + + +#define RCC_APB2RSTR_IOPERST_Pos (6U) +#define RCC_APB2RSTR_IOPERST_Msk (0x1UL << RCC_APB2RSTR_IOPERST_Pos) /*!< 0x00000040 */ +#define RCC_APB2RSTR_IOPERST RCC_APB2RSTR_IOPERST_Msk /*!< I/O port E reset */ + +#define RCC_APB2RSTR_IOPFRST_Pos (7U) +#define RCC_APB2RSTR_IOPFRST_Msk (0x1UL << RCC_APB2RSTR_IOPFRST_Pos) /*!< 0x00000080 */ +#define RCC_APB2RSTR_IOPFRST RCC_APB2RSTR_IOPFRST_Msk /*!< I/O port F reset */ +#define RCC_APB2RSTR_IOPGRST_Pos (8U) +#define RCC_APB2RSTR_IOPGRST_Msk (0x1UL << RCC_APB2RSTR_IOPGRST_Pos) /*!< 0x00000100 */ +#define RCC_APB2RSTR_IOPGRST RCC_APB2RSTR_IOPGRST_Msk /*!< I/O port G reset */ +#define RCC_APB2RSTR_TIM8RST_Pos (13U) +#define RCC_APB2RSTR_TIM8RST_Msk (0x1UL << RCC_APB2RSTR_TIM8RST_Pos) /*!< 0x00002000 */ +#define RCC_APB2RSTR_TIM8RST RCC_APB2RSTR_TIM8RST_Msk /*!< TIM8 Timer reset */ +#define RCC_APB2RSTR_ADC3RST_Pos (15U) +#define RCC_APB2RSTR_ADC3RST_Msk (0x1UL << RCC_APB2RSTR_ADC3RST_Pos) /*!< 0x00008000 */ +#define RCC_APB2RSTR_ADC3RST RCC_APB2RSTR_ADC3RST_Msk /*!< ADC3 interface reset */ + + + +/***************** Bit definition for RCC_APB1RSTR register *****************/ +#define RCC_APB1RSTR_TIM2RST_Pos (0U) +#define RCC_APB1RSTR_TIM2RST_Msk (0x1UL << RCC_APB1RSTR_TIM2RST_Pos) /*!< 0x00000001 */ +#define RCC_APB1RSTR_TIM2RST RCC_APB1RSTR_TIM2RST_Msk /*!< Timer 2 reset */ +#define RCC_APB1RSTR_TIM3RST_Pos (1U) +#define RCC_APB1RSTR_TIM3RST_Msk (0x1UL << RCC_APB1RSTR_TIM3RST_Pos) /*!< 0x00000002 */ +#define RCC_APB1RSTR_TIM3RST RCC_APB1RSTR_TIM3RST_Msk /*!< Timer 3 reset */ +#define RCC_APB1RSTR_WWDGRST_Pos (11U) +#define RCC_APB1RSTR_WWDGRST_Msk (0x1UL << RCC_APB1RSTR_WWDGRST_Pos) /*!< 0x00000800 */ +#define RCC_APB1RSTR_WWDGRST RCC_APB1RSTR_WWDGRST_Msk /*!< Window Watchdog reset */ +#define RCC_APB1RSTR_USART2RST_Pos (17U) +#define RCC_APB1RSTR_USART2RST_Msk (0x1UL << RCC_APB1RSTR_USART2RST_Pos) /*!< 0x00020000 */ +#define RCC_APB1RSTR_USART2RST RCC_APB1RSTR_USART2RST_Msk /*!< USART 2 reset */ +#define RCC_APB1RSTR_I2C1RST_Pos (21U) +#define RCC_APB1RSTR_I2C1RST_Msk (0x1UL << RCC_APB1RSTR_I2C1RST_Pos) /*!< 0x00200000 */ +#define RCC_APB1RSTR_I2C1RST RCC_APB1RSTR_I2C1RST_Msk /*!< I2C 1 reset */ + +#define RCC_APB1RSTR_CAN1RST_Pos (25U) +#define RCC_APB1RSTR_CAN1RST_Msk (0x1UL << RCC_APB1RSTR_CAN1RST_Pos) /*!< 0x02000000 */ +#define RCC_APB1RSTR_CAN1RST RCC_APB1RSTR_CAN1RST_Msk /*!< CAN1 reset */ + +#define RCC_APB1RSTR_BKPRST_Pos (27U) +#define RCC_APB1RSTR_BKPRST_Msk (0x1UL << RCC_APB1RSTR_BKPRST_Pos) /*!< 0x08000000 */ +#define RCC_APB1RSTR_BKPRST RCC_APB1RSTR_BKPRST_Msk /*!< Backup interface reset */ +#define RCC_APB1RSTR_PWRRST_Pos (28U) +#define RCC_APB1RSTR_PWRRST_Msk (0x1UL << RCC_APB1RSTR_PWRRST_Pos) /*!< 0x10000000 */ +#define RCC_APB1RSTR_PWRRST RCC_APB1RSTR_PWRRST_Msk /*!< Power interface reset */ + +#define RCC_APB1RSTR_TIM4RST_Pos (2U) +#define RCC_APB1RSTR_TIM4RST_Msk (0x1UL << RCC_APB1RSTR_TIM4RST_Pos) /*!< 0x00000004 */ +#define RCC_APB1RSTR_TIM4RST RCC_APB1RSTR_TIM4RST_Msk /*!< Timer 4 reset */ +#define RCC_APB1RSTR_SPI2RST_Pos (14U) +#define RCC_APB1RSTR_SPI2RST_Msk (0x1UL << RCC_APB1RSTR_SPI2RST_Pos) /*!< 0x00004000 */ +#define RCC_APB1RSTR_SPI2RST RCC_APB1RSTR_SPI2RST_Msk /*!< SPI 2 reset */ +#define RCC_APB1RSTR_USART3RST_Pos (18U) +#define RCC_APB1RSTR_USART3RST_Msk (0x1UL << RCC_APB1RSTR_USART3RST_Pos) /*!< 0x00040000 */ +#define RCC_APB1RSTR_USART3RST RCC_APB1RSTR_USART3RST_Msk /*!< USART 3 reset */ +#define RCC_APB1RSTR_I2C2RST_Pos (22U) +#define RCC_APB1RSTR_I2C2RST_Msk (0x1UL << RCC_APB1RSTR_I2C2RST_Pos) /*!< 0x00400000 */ +#define RCC_APB1RSTR_I2C2RST RCC_APB1RSTR_I2C2RST_Msk /*!< I2C 2 reset */ + +#define RCC_APB1RSTR_USBRST_Pos (23U) +#define RCC_APB1RSTR_USBRST_Msk (0x1UL << RCC_APB1RSTR_USBRST_Pos) /*!< 0x00800000 */ +#define RCC_APB1RSTR_USBRST RCC_APB1RSTR_USBRST_Msk /*!< USB Device reset */ + +#define RCC_APB1RSTR_TIM5RST_Pos (3U) +#define RCC_APB1RSTR_TIM5RST_Msk (0x1UL << RCC_APB1RSTR_TIM5RST_Pos) /*!< 0x00000008 */ +#define RCC_APB1RSTR_TIM5RST RCC_APB1RSTR_TIM5RST_Msk /*!< Timer 5 reset */ +#define RCC_APB1RSTR_TIM6RST_Pos (4U) +#define RCC_APB1RSTR_TIM6RST_Msk (0x1UL << RCC_APB1RSTR_TIM6RST_Pos) /*!< 0x00000010 */ +#define RCC_APB1RSTR_TIM6RST RCC_APB1RSTR_TIM6RST_Msk /*!< Timer 6 reset */ +#define RCC_APB1RSTR_TIM7RST_Pos (5U) +#define RCC_APB1RSTR_TIM7RST_Msk (0x1UL << RCC_APB1RSTR_TIM7RST_Pos) /*!< 0x00000020 */ +#define RCC_APB1RSTR_TIM7RST RCC_APB1RSTR_TIM7RST_Msk /*!< Timer 7 reset */ +#define RCC_APB1RSTR_SPI3RST_Pos (15U) +#define RCC_APB1RSTR_SPI3RST_Msk (0x1UL << RCC_APB1RSTR_SPI3RST_Pos) /*!< 0x00008000 */ +#define RCC_APB1RSTR_SPI3RST RCC_APB1RSTR_SPI3RST_Msk /*!< SPI 3 reset */ +#define RCC_APB1RSTR_UART4RST_Pos (19U) +#define RCC_APB1RSTR_UART4RST_Msk (0x1UL << RCC_APB1RSTR_UART4RST_Pos) /*!< 0x00080000 */ +#define RCC_APB1RSTR_UART4RST RCC_APB1RSTR_UART4RST_Msk /*!< UART 4 reset */ +#define RCC_APB1RSTR_UART5RST_Pos (20U) +#define RCC_APB1RSTR_UART5RST_Msk (0x1UL << RCC_APB1RSTR_UART5RST_Pos) /*!< 0x00100000 */ +#define RCC_APB1RSTR_UART5RST RCC_APB1RSTR_UART5RST_Msk /*!< UART 5 reset */ + + + + +#define RCC_APB1RSTR_DACRST_Pos (29U) +#define RCC_APB1RSTR_DACRST_Msk (0x1UL << RCC_APB1RSTR_DACRST_Pos) /*!< 0x20000000 */ +#define RCC_APB1RSTR_DACRST RCC_APB1RSTR_DACRST_Msk /*!< DAC interface reset */ + +/****************** Bit definition for RCC_AHBENR register ******************/ +#define RCC_AHBENR_DMA1EN_Pos (0U) +#define RCC_AHBENR_DMA1EN_Msk (0x1UL << RCC_AHBENR_DMA1EN_Pos) /*!< 0x00000001 */ +#define RCC_AHBENR_DMA1EN RCC_AHBENR_DMA1EN_Msk /*!< DMA1 clock enable */ +#define RCC_AHBENR_SRAMEN_Pos (2U) +#define RCC_AHBENR_SRAMEN_Msk (0x1UL << RCC_AHBENR_SRAMEN_Pos) /*!< 0x00000004 */ +#define RCC_AHBENR_SRAMEN RCC_AHBENR_SRAMEN_Msk /*!< SRAM interface clock enable */ +#define RCC_AHBENR_FLITFEN_Pos (4U) +#define RCC_AHBENR_FLITFEN_Msk (0x1UL << RCC_AHBENR_FLITFEN_Pos) /*!< 0x00000010 */ +#define RCC_AHBENR_FLITFEN RCC_AHBENR_FLITFEN_Msk /*!< FLITF clock enable */ +#define RCC_AHBENR_CRCEN_Pos (6U) +#define RCC_AHBENR_CRCEN_Msk (0x1UL << RCC_AHBENR_CRCEN_Pos) /*!< 0x00000040 */ +#define RCC_AHBENR_CRCEN RCC_AHBENR_CRCEN_Msk /*!< CRC clock enable */ + +#define RCC_AHBENR_DMA2EN_Pos (1U) +#define RCC_AHBENR_DMA2EN_Msk (0x1UL << RCC_AHBENR_DMA2EN_Pos) /*!< 0x00000002 */ +#define RCC_AHBENR_DMA2EN RCC_AHBENR_DMA2EN_Msk /*!< DMA2 clock enable */ + +#define RCC_AHBENR_FSMCEN_Pos (8U) +#define RCC_AHBENR_FSMCEN_Msk (0x1UL << RCC_AHBENR_FSMCEN_Pos) /*!< 0x00000100 */ +#define RCC_AHBENR_FSMCEN RCC_AHBENR_FSMCEN_Msk /*!< FSMC clock enable */ +#define RCC_AHBENR_SDIOEN_Pos (10U) +#define RCC_AHBENR_SDIOEN_Msk (0x1UL << RCC_AHBENR_SDIOEN_Pos) /*!< 0x00000400 */ +#define RCC_AHBENR_SDIOEN RCC_AHBENR_SDIOEN_Msk /*!< SDIO clock enable */ + + +/****************** Bit definition for RCC_APB2ENR register *****************/ +#define RCC_APB2ENR_AFIOEN_Pos (0U) +#define RCC_APB2ENR_AFIOEN_Msk (0x1UL << RCC_APB2ENR_AFIOEN_Pos) /*!< 0x00000001 */ +#define RCC_APB2ENR_AFIOEN RCC_APB2ENR_AFIOEN_Msk /*!< Alternate Function I/O clock enable */ +#define RCC_APB2ENR_IOPAEN_Pos (2U) +#define RCC_APB2ENR_IOPAEN_Msk (0x1UL << RCC_APB2ENR_IOPAEN_Pos) /*!< 0x00000004 */ +#define RCC_APB2ENR_IOPAEN RCC_APB2ENR_IOPAEN_Msk /*!< I/O port A clock enable */ +#define RCC_APB2ENR_IOPBEN_Pos (3U) +#define RCC_APB2ENR_IOPBEN_Msk (0x1UL << RCC_APB2ENR_IOPBEN_Pos) /*!< 0x00000008 */ +#define RCC_APB2ENR_IOPBEN RCC_APB2ENR_IOPBEN_Msk /*!< I/O port B clock enable */ +#define RCC_APB2ENR_IOPCEN_Pos (4U) +#define RCC_APB2ENR_IOPCEN_Msk (0x1UL << RCC_APB2ENR_IOPCEN_Pos) /*!< 0x00000010 */ +#define RCC_APB2ENR_IOPCEN RCC_APB2ENR_IOPCEN_Msk /*!< I/O port C clock enable */ +#define RCC_APB2ENR_IOPDEN_Pos (5U) +#define RCC_APB2ENR_IOPDEN_Msk (0x1UL << RCC_APB2ENR_IOPDEN_Pos) /*!< 0x00000020 */ +#define RCC_APB2ENR_IOPDEN RCC_APB2ENR_IOPDEN_Msk /*!< I/O port D clock enable */ +#define RCC_APB2ENR_ADC1EN_Pos (9U) +#define RCC_APB2ENR_ADC1EN_Msk (0x1UL << RCC_APB2ENR_ADC1EN_Pos) /*!< 0x00000200 */ +#define RCC_APB2ENR_ADC1EN RCC_APB2ENR_ADC1EN_Msk /*!< ADC 1 interface clock enable */ + +#define RCC_APB2ENR_ADC2EN_Pos (10U) +#define RCC_APB2ENR_ADC2EN_Msk (0x1UL << RCC_APB2ENR_ADC2EN_Pos) /*!< 0x00000400 */ +#define RCC_APB2ENR_ADC2EN RCC_APB2ENR_ADC2EN_Msk /*!< ADC 2 interface clock enable */ + +#define RCC_APB2ENR_TIM1EN_Pos (11U) +#define RCC_APB2ENR_TIM1EN_Msk (0x1UL << RCC_APB2ENR_TIM1EN_Pos) /*!< 0x00000800 */ +#define RCC_APB2ENR_TIM1EN RCC_APB2ENR_TIM1EN_Msk /*!< TIM1 Timer clock enable */ +#define RCC_APB2ENR_SPI1EN_Pos (12U) +#define RCC_APB2ENR_SPI1EN_Msk (0x1UL << RCC_APB2ENR_SPI1EN_Pos) /*!< 0x00001000 */ +#define RCC_APB2ENR_SPI1EN RCC_APB2ENR_SPI1EN_Msk /*!< SPI 1 clock enable */ +#define RCC_APB2ENR_USART1EN_Pos (14U) +#define RCC_APB2ENR_USART1EN_Msk (0x1UL << RCC_APB2ENR_USART1EN_Pos) /*!< 0x00004000 */ +#define RCC_APB2ENR_USART1EN RCC_APB2ENR_USART1EN_Msk /*!< USART1 clock enable */ + + +#define RCC_APB2ENR_IOPEEN_Pos (6U) +#define RCC_APB2ENR_IOPEEN_Msk (0x1UL << RCC_APB2ENR_IOPEEN_Pos) /*!< 0x00000040 */ +#define RCC_APB2ENR_IOPEEN RCC_APB2ENR_IOPEEN_Msk /*!< I/O port E clock enable */ + +#define RCC_APB2ENR_IOPFEN_Pos (7U) +#define RCC_APB2ENR_IOPFEN_Msk (0x1UL << RCC_APB2ENR_IOPFEN_Pos) /*!< 0x00000080 */ +#define RCC_APB2ENR_IOPFEN RCC_APB2ENR_IOPFEN_Msk /*!< I/O port F clock enable */ +#define RCC_APB2ENR_IOPGEN_Pos (8U) +#define RCC_APB2ENR_IOPGEN_Msk (0x1UL << RCC_APB2ENR_IOPGEN_Pos) /*!< 0x00000100 */ +#define RCC_APB2ENR_IOPGEN RCC_APB2ENR_IOPGEN_Msk /*!< I/O port G clock enable */ +#define RCC_APB2ENR_TIM8EN_Pos (13U) +#define RCC_APB2ENR_TIM8EN_Msk (0x1UL << RCC_APB2ENR_TIM8EN_Pos) /*!< 0x00002000 */ +#define RCC_APB2ENR_TIM8EN RCC_APB2ENR_TIM8EN_Msk /*!< TIM8 Timer clock enable */ +#define RCC_APB2ENR_ADC3EN_Pos (15U) +#define RCC_APB2ENR_ADC3EN_Msk (0x1UL << RCC_APB2ENR_ADC3EN_Pos) /*!< 0x00008000 */ +#define RCC_APB2ENR_ADC3EN RCC_APB2ENR_ADC3EN_Msk /*!< DMA1 clock enable */ + + + +/***************** Bit definition for RCC_APB1ENR register ******************/ +#define RCC_APB1ENR_TIM2EN_Pos (0U) +#define RCC_APB1ENR_TIM2EN_Msk (0x1UL << RCC_APB1ENR_TIM2EN_Pos) /*!< 0x00000001 */ +#define RCC_APB1ENR_TIM2EN RCC_APB1ENR_TIM2EN_Msk /*!< Timer 2 clock enabled*/ +#define RCC_APB1ENR_TIM3EN_Pos (1U) +#define RCC_APB1ENR_TIM3EN_Msk (0x1UL << RCC_APB1ENR_TIM3EN_Pos) /*!< 0x00000002 */ +#define RCC_APB1ENR_TIM3EN RCC_APB1ENR_TIM3EN_Msk /*!< Timer 3 clock enable */ +#define RCC_APB1ENR_WWDGEN_Pos (11U) +#define RCC_APB1ENR_WWDGEN_Msk (0x1UL << RCC_APB1ENR_WWDGEN_Pos) /*!< 0x00000800 */ +#define RCC_APB1ENR_WWDGEN RCC_APB1ENR_WWDGEN_Msk /*!< Window Watchdog clock enable */ +#define RCC_APB1ENR_USART2EN_Pos (17U) +#define RCC_APB1ENR_USART2EN_Msk (0x1UL << RCC_APB1ENR_USART2EN_Pos) /*!< 0x00020000 */ +#define RCC_APB1ENR_USART2EN RCC_APB1ENR_USART2EN_Msk /*!< USART 2 clock enable */ +#define RCC_APB1ENR_I2C1EN_Pos (21U) +#define RCC_APB1ENR_I2C1EN_Msk (0x1UL << RCC_APB1ENR_I2C1EN_Pos) /*!< 0x00200000 */ +#define RCC_APB1ENR_I2C1EN RCC_APB1ENR_I2C1EN_Msk /*!< I2C 1 clock enable */ + +#define RCC_APB1ENR_CAN1EN_Pos (25U) +#define RCC_APB1ENR_CAN1EN_Msk (0x1UL << RCC_APB1ENR_CAN1EN_Pos) /*!< 0x02000000 */ +#define RCC_APB1ENR_CAN1EN RCC_APB1ENR_CAN1EN_Msk /*!< CAN1 clock enable */ + +#define RCC_APB1ENR_BKPEN_Pos (27U) +#define RCC_APB1ENR_BKPEN_Msk (0x1UL << RCC_APB1ENR_BKPEN_Pos) /*!< 0x08000000 */ +#define RCC_APB1ENR_BKPEN RCC_APB1ENR_BKPEN_Msk /*!< Backup interface clock enable */ +#define RCC_APB1ENR_PWREN_Pos (28U) +#define RCC_APB1ENR_PWREN_Msk (0x1UL << RCC_APB1ENR_PWREN_Pos) /*!< 0x10000000 */ +#define RCC_APB1ENR_PWREN RCC_APB1ENR_PWREN_Msk /*!< Power interface clock enable */ + +#define RCC_APB1ENR_TIM4EN_Pos (2U) +#define RCC_APB1ENR_TIM4EN_Msk (0x1UL << RCC_APB1ENR_TIM4EN_Pos) /*!< 0x00000004 */ +#define RCC_APB1ENR_TIM4EN RCC_APB1ENR_TIM4EN_Msk /*!< Timer 4 clock enable */ +#define RCC_APB1ENR_SPI2EN_Pos (14U) +#define RCC_APB1ENR_SPI2EN_Msk (0x1UL << RCC_APB1ENR_SPI2EN_Pos) /*!< 0x00004000 */ +#define RCC_APB1ENR_SPI2EN RCC_APB1ENR_SPI2EN_Msk /*!< SPI 2 clock enable */ +#define RCC_APB1ENR_USART3EN_Pos (18U) +#define RCC_APB1ENR_USART3EN_Msk (0x1UL << RCC_APB1ENR_USART3EN_Pos) /*!< 0x00040000 */ +#define RCC_APB1ENR_USART3EN RCC_APB1ENR_USART3EN_Msk /*!< USART 3 clock enable */ +#define RCC_APB1ENR_I2C2EN_Pos (22U) +#define RCC_APB1ENR_I2C2EN_Msk (0x1UL << RCC_APB1ENR_I2C2EN_Pos) /*!< 0x00400000 */ +#define RCC_APB1ENR_I2C2EN RCC_APB1ENR_I2C2EN_Msk /*!< I2C 2 clock enable */ + +#define RCC_APB1ENR_USBEN_Pos (23U) +#define RCC_APB1ENR_USBEN_Msk (0x1UL << RCC_APB1ENR_USBEN_Pos) /*!< 0x00800000 */ +#define RCC_APB1ENR_USBEN RCC_APB1ENR_USBEN_Msk /*!< USB Device clock enable */ + +#define RCC_APB1ENR_TIM5EN_Pos (3U) +#define RCC_APB1ENR_TIM5EN_Msk (0x1UL << RCC_APB1ENR_TIM5EN_Pos) /*!< 0x00000008 */ +#define RCC_APB1ENR_TIM5EN RCC_APB1ENR_TIM5EN_Msk /*!< Timer 5 clock enable */ +#define RCC_APB1ENR_TIM6EN_Pos (4U) +#define RCC_APB1ENR_TIM6EN_Msk (0x1UL << RCC_APB1ENR_TIM6EN_Pos) /*!< 0x00000010 */ +#define RCC_APB1ENR_TIM6EN RCC_APB1ENR_TIM6EN_Msk /*!< Timer 6 clock enable */ +#define RCC_APB1ENR_TIM7EN_Pos (5U) +#define RCC_APB1ENR_TIM7EN_Msk (0x1UL << RCC_APB1ENR_TIM7EN_Pos) /*!< 0x00000020 */ +#define RCC_APB1ENR_TIM7EN RCC_APB1ENR_TIM7EN_Msk /*!< Timer 7 clock enable */ +#define RCC_APB1ENR_SPI3EN_Pos (15U) +#define RCC_APB1ENR_SPI3EN_Msk (0x1UL << RCC_APB1ENR_SPI3EN_Pos) /*!< 0x00008000 */ +#define RCC_APB1ENR_SPI3EN RCC_APB1ENR_SPI3EN_Msk /*!< SPI 3 clock enable */ +#define RCC_APB1ENR_UART4EN_Pos (19U) +#define RCC_APB1ENR_UART4EN_Msk (0x1UL << RCC_APB1ENR_UART4EN_Pos) /*!< 0x00080000 */ +#define RCC_APB1ENR_UART4EN RCC_APB1ENR_UART4EN_Msk /*!< UART 4 clock enable */ +#define RCC_APB1ENR_UART5EN_Pos (20U) +#define RCC_APB1ENR_UART5EN_Msk (0x1UL << RCC_APB1ENR_UART5EN_Pos) /*!< 0x00100000 */ +#define RCC_APB1ENR_UART5EN RCC_APB1ENR_UART5EN_Msk /*!< UART 5 clock enable */ + + + + +#define RCC_APB1ENR_DACEN_Pos (29U) +#define RCC_APB1ENR_DACEN_Msk (0x1UL << RCC_APB1ENR_DACEN_Pos) /*!< 0x20000000 */ +#define RCC_APB1ENR_DACEN RCC_APB1ENR_DACEN_Msk /*!< DAC interface clock enable */ + +/******************* Bit definition for RCC_BDCR register *******************/ +#define RCC_BDCR_LSEON_Pos (0U) +#define RCC_BDCR_LSEON_Msk (0x1UL << RCC_BDCR_LSEON_Pos) /*!< 0x00000001 */ +#define RCC_BDCR_LSEON RCC_BDCR_LSEON_Msk /*!< External Low Speed oscillator enable */ +#define RCC_BDCR_LSERDY_Pos (1U) +#define RCC_BDCR_LSERDY_Msk (0x1UL << RCC_BDCR_LSERDY_Pos) /*!< 0x00000002 */ +#define RCC_BDCR_LSERDY RCC_BDCR_LSERDY_Msk /*!< External Low Speed oscillator Ready */ +#define RCC_BDCR_LSEBYP_Pos (2U) +#define RCC_BDCR_LSEBYP_Msk (0x1UL << RCC_BDCR_LSEBYP_Pos) /*!< 0x00000004 */ +#define RCC_BDCR_LSEBYP RCC_BDCR_LSEBYP_Msk /*!< External Low Speed oscillator Bypass */ + +#define RCC_BDCR_RTCSEL_Pos (8U) +#define RCC_BDCR_RTCSEL_Msk (0x3UL << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000300 */ +#define RCC_BDCR_RTCSEL RCC_BDCR_RTCSEL_Msk /*!< RTCSEL[1:0] bits (RTC clock source selection) */ +#define RCC_BDCR_RTCSEL_0 (0x1UL << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000100 */ +#define RCC_BDCR_RTCSEL_1 (0x2UL << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000200 */ + +/*!< RTC congiguration */ +#define RCC_BDCR_RTCSEL_NOCLOCK 0x00000000U /*!< No clock */ +#define RCC_BDCR_RTCSEL_LSE 0x00000100U /*!< LSE oscillator clock used as RTC clock */ +#define RCC_BDCR_RTCSEL_LSI 0x00000200U /*!< LSI oscillator clock used as RTC clock */ +#define RCC_BDCR_RTCSEL_HSE 0x00000300U /*!< HSE oscillator clock divided by 128 used as RTC clock */ + +#define RCC_BDCR_RTCEN_Pos (15U) +#define RCC_BDCR_RTCEN_Msk (0x1UL << RCC_BDCR_RTCEN_Pos) /*!< 0x00008000 */ +#define RCC_BDCR_RTCEN RCC_BDCR_RTCEN_Msk /*!< RTC clock enable */ +#define RCC_BDCR_BDRST_Pos (16U) +#define RCC_BDCR_BDRST_Msk (0x1UL << RCC_BDCR_BDRST_Pos) /*!< 0x00010000 */ +#define RCC_BDCR_BDRST RCC_BDCR_BDRST_Msk /*!< Backup domain software reset */ + +/******************* Bit definition for RCC_CSR register ********************/ +#define RCC_CSR_LSION_Pos (0U) +#define RCC_CSR_LSION_Msk (0x1UL << RCC_CSR_LSION_Pos) /*!< 0x00000001 */ +#define RCC_CSR_LSION RCC_CSR_LSION_Msk /*!< Internal Low Speed oscillator enable */ +#define RCC_CSR_LSIRDY_Pos (1U) +#define RCC_CSR_LSIRDY_Msk (0x1UL << RCC_CSR_LSIRDY_Pos) /*!< 0x00000002 */ +#define RCC_CSR_LSIRDY RCC_CSR_LSIRDY_Msk /*!< Internal Low Speed oscillator Ready */ +#define RCC_CSR_RMVF_Pos (24U) +#define RCC_CSR_RMVF_Msk (0x1UL << RCC_CSR_RMVF_Pos) /*!< 0x01000000 */ +#define RCC_CSR_RMVF RCC_CSR_RMVF_Msk /*!< Remove reset flag */ +#define RCC_CSR_PINRSTF_Pos (26U) +#define RCC_CSR_PINRSTF_Msk (0x1UL << RCC_CSR_PINRSTF_Pos) /*!< 0x04000000 */ +#define RCC_CSR_PINRSTF RCC_CSR_PINRSTF_Msk /*!< PIN reset flag */ +#define RCC_CSR_PORRSTF_Pos (27U) +#define RCC_CSR_PORRSTF_Msk (0x1UL << RCC_CSR_PORRSTF_Pos) /*!< 0x08000000 */ +#define RCC_CSR_PORRSTF RCC_CSR_PORRSTF_Msk /*!< POR/PDR reset flag */ +#define RCC_CSR_SFTRSTF_Pos (28U) +#define RCC_CSR_SFTRSTF_Msk (0x1UL << RCC_CSR_SFTRSTF_Pos) /*!< 0x10000000 */ +#define RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF_Msk /*!< Software Reset flag */ +#define RCC_CSR_IWDGRSTF_Pos (29U) +#define RCC_CSR_IWDGRSTF_Msk (0x1UL << RCC_CSR_IWDGRSTF_Pos) /*!< 0x20000000 */ +#define RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF_Msk /*!< Independent Watchdog reset flag */ +#define RCC_CSR_WWDGRSTF_Pos (30U) +#define RCC_CSR_WWDGRSTF_Msk (0x1UL << RCC_CSR_WWDGRSTF_Pos) /*!< 0x40000000 */ +#define RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF_Msk /*!< Window watchdog reset flag */ +#define RCC_CSR_LPWRRSTF_Pos (31U) +#define RCC_CSR_LPWRRSTF_Msk (0x1UL << RCC_CSR_LPWRRSTF_Pos) /*!< 0x80000000 */ +#define RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF_Msk /*!< Low-Power reset flag */ + + + +/******************************************************************************/ +/* */ +/* General Purpose and Alternate Function I/O */ +/* */ +/******************************************************************************/ + +/******************* Bit definition for GPIO_CRL register *******************/ +#define GPIO_CRL_MODE_Pos (0U) +#define GPIO_CRL_MODE_Msk (0x33333333UL << GPIO_CRL_MODE_Pos) /*!< 0x33333333 */ +#define GPIO_CRL_MODE GPIO_CRL_MODE_Msk /*!< Port x mode bits */ + +#define GPIO_CRL_MODE0_Pos (0U) +#define GPIO_CRL_MODE0_Msk (0x3UL << GPIO_CRL_MODE0_Pos) /*!< 0x00000003 */ +#define GPIO_CRL_MODE0 GPIO_CRL_MODE0_Msk /*!< MODE0[1:0] bits (Port x mode bits, pin 0) */ +#define GPIO_CRL_MODE0_0 (0x1UL << GPIO_CRL_MODE0_Pos) /*!< 0x00000001 */ +#define GPIO_CRL_MODE0_1 (0x2UL << GPIO_CRL_MODE0_Pos) /*!< 0x00000002 */ + +#define GPIO_CRL_MODE1_Pos (4U) +#define GPIO_CRL_MODE1_Msk (0x3UL << GPIO_CRL_MODE1_Pos) /*!< 0x00000030 */ +#define GPIO_CRL_MODE1 GPIO_CRL_MODE1_Msk /*!< MODE1[1:0] bits (Port x mode bits, pin 1) */ +#define GPIO_CRL_MODE1_0 (0x1UL << GPIO_CRL_MODE1_Pos) /*!< 0x00000010 */ +#define GPIO_CRL_MODE1_1 (0x2UL << GPIO_CRL_MODE1_Pos) /*!< 0x00000020 */ + +#define GPIO_CRL_MODE2_Pos (8U) +#define GPIO_CRL_MODE2_Msk (0x3UL << GPIO_CRL_MODE2_Pos) /*!< 0x00000300 */ +#define GPIO_CRL_MODE2 GPIO_CRL_MODE2_Msk /*!< MODE2[1:0] bits (Port x mode bits, pin 2) */ +#define GPIO_CRL_MODE2_0 (0x1UL << GPIO_CRL_MODE2_Pos) /*!< 0x00000100 */ +#define GPIO_CRL_MODE2_1 (0x2UL << GPIO_CRL_MODE2_Pos) /*!< 0x00000200 */ + +#define GPIO_CRL_MODE3_Pos (12U) +#define GPIO_CRL_MODE3_Msk (0x3UL << GPIO_CRL_MODE3_Pos) /*!< 0x00003000 */ +#define GPIO_CRL_MODE3 GPIO_CRL_MODE3_Msk /*!< MODE3[1:0] bits (Port x mode bits, pin 3) */ +#define GPIO_CRL_MODE3_0 (0x1UL << GPIO_CRL_MODE3_Pos) /*!< 0x00001000 */ +#define GPIO_CRL_MODE3_1 (0x2UL << GPIO_CRL_MODE3_Pos) /*!< 0x00002000 */ + +#define GPIO_CRL_MODE4_Pos (16U) +#define GPIO_CRL_MODE4_Msk (0x3UL << GPIO_CRL_MODE4_Pos) /*!< 0x00030000 */ +#define GPIO_CRL_MODE4 GPIO_CRL_MODE4_Msk /*!< MODE4[1:0] bits (Port x mode bits, pin 4) */ +#define GPIO_CRL_MODE4_0 (0x1UL << GPIO_CRL_MODE4_Pos) /*!< 0x00010000 */ +#define GPIO_CRL_MODE4_1 (0x2UL << GPIO_CRL_MODE4_Pos) /*!< 0x00020000 */ + +#define GPIO_CRL_MODE5_Pos (20U) +#define GPIO_CRL_MODE5_Msk (0x3UL << GPIO_CRL_MODE5_Pos) /*!< 0x00300000 */ +#define GPIO_CRL_MODE5 GPIO_CRL_MODE5_Msk /*!< MODE5[1:0] bits (Port x mode bits, pin 5) */ +#define GPIO_CRL_MODE5_0 (0x1UL << GPIO_CRL_MODE5_Pos) /*!< 0x00100000 */ +#define GPIO_CRL_MODE5_1 (0x2UL << GPIO_CRL_MODE5_Pos) /*!< 0x00200000 */ + +#define GPIO_CRL_MODE6_Pos (24U) +#define GPIO_CRL_MODE6_Msk (0x3UL << GPIO_CRL_MODE6_Pos) /*!< 0x03000000 */ +#define GPIO_CRL_MODE6 GPIO_CRL_MODE6_Msk /*!< MODE6[1:0] bits (Port x mode bits, pin 6) */ +#define GPIO_CRL_MODE6_0 (0x1UL << GPIO_CRL_MODE6_Pos) /*!< 0x01000000 */ +#define GPIO_CRL_MODE6_1 (0x2UL << GPIO_CRL_MODE6_Pos) /*!< 0x02000000 */ + +#define GPIO_CRL_MODE7_Pos (28U) +#define GPIO_CRL_MODE7_Msk (0x3UL << GPIO_CRL_MODE7_Pos) /*!< 0x30000000 */ +#define GPIO_CRL_MODE7 GPIO_CRL_MODE7_Msk /*!< MODE7[1:0] bits (Port x mode bits, pin 7) */ +#define GPIO_CRL_MODE7_0 (0x1UL << GPIO_CRL_MODE7_Pos) /*!< 0x10000000 */ +#define GPIO_CRL_MODE7_1 (0x2UL << GPIO_CRL_MODE7_Pos) /*!< 0x20000000 */ + +#define GPIO_CRL_CNF_Pos (2U) +#define GPIO_CRL_CNF_Msk (0x33333333UL << GPIO_CRL_CNF_Pos) /*!< 0xCCCCCCCC */ +#define GPIO_CRL_CNF GPIO_CRL_CNF_Msk /*!< Port x configuration bits */ + +#define GPIO_CRL_CNF0_Pos (2U) +#define GPIO_CRL_CNF0_Msk (0x3UL << GPIO_CRL_CNF0_Pos) /*!< 0x0000000C */ +#define GPIO_CRL_CNF0 GPIO_CRL_CNF0_Msk /*!< CNF0[1:0] bits (Port x configuration bits, pin 0) */ +#define GPIO_CRL_CNF0_0 (0x1UL << GPIO_CRL_CNF0_Pos) /*!< 0x00000004 */ +#define GPIO_CRL_CNF0_1 (0x2UL << GPIO_CRL_CNF0_Pos) /*!< 0x00000008 */ + +#define GPIO_CRL_CNF1_Pos (6U) +#define GPIO_CRL_CNF1_Msk (0x3UL << GPIO_CRL_CNF1_Pos) /*!< 0x000000C0 */ +#define GPIO_CRL_CNF1 GPIO_CRL_CNF1_Msk /*!< CNF1[1:0] bits (Port x configuration bits, pin 1) */ +#define GPIO_CRL_CNF1_0 (0x1UL << GPIO_CRL_CNF1_Pos) /*!< 0x00000040 */ +#define GPIO_CRL_CNF1_1 (0x2UL << GPIO_CRL_CNF1_Pos) /*!< 0x00000080 */ + +#define GPIO_CRL_CNF2_Pos (10U) +#define GPIO_CRL_CNF2_Msk (0x3UL << GPIO_CRL_CNF2_Pos) /*!< 0x00000C00 */ +#define GPIO_CRL_CNF2 GPIO_CRL_CNF2_Msk /*!< CNF2[1:0] bits (Port x configuration bits, pin 2) */ +#define GPIO_CRL_CNF2_0 (0x1UL << GPIO_CRL_CNF2_Pos) /*!< 0x00000400 */ +#define GPIO_CRL_CNF2_1 (0x2UL << GPIO_CRL_CNF2_Pos) /*!< 0x00000800 */ + +#define GPIO_CRL_CNF3_Pos (14U) +#define GPIO_CRL_CNF3_Msk (0x3UL << GPIO_CRL_CNF3_Pos) /*!< 0x0000C000 */ +#define GPIO_CRL_CNF3 GPIO_CRL_CNF3_Msk /*!< CNF3[1:0] bits (Port x configuration bits, pin 3) */ +#define GPIO_CRL_CNF3_0 (0x1UL << GPIO_CRL_CNF3_Pos) /*!< 0x00004000 */ +#define GPIO_CRL_CNF3_1 (0x2UL << GPIO_CRL_CNF3_Pos) /*!< 0x00008000 */ + +#define GPIO_CRL_CNF4_Pos (18U) +#define GPIO_CRL_CNF4_Msk (0x3UL << GPIO_CRL_CNF4_Pos) /*!< 0x000C0000 */ +#define GPIO_CRL_CNF4 GPIO_CRL_CNF4_Msk /*!< CNF4[1:0] bits (Port x configuration bits, pin 4) */ +#define GPIO_CRL_CNF4_0 (0x1UL << GPIO_CRL_CNF4_Pos) /*!< 0x00040000 */ +#define GPIO_CRL_CNF4_1 (0x2UL << GPIO_CRL_CNF4_Pos) /*!< 0x00080000 */ + +#define GPIO_CRL_CNF5_Pos (22U) +#define GPIO_CRL_CNF5_Msk (0x3UL << GPIO_CRL_CNF5_Pos) /*!< 0x00C00000 */ +#define GPIO_CRL_CNF5 GPIO_CRL_CNF5_Msk /*!< CNF5[1:0] bits (Port x configuration bits, pin 5) */ +#define GPIO_CRL_CNF5_0 (0x1UL << GPIO_CRL_CNF5_Pos) /*!< 0x00400000 */ +#define GPIO_CRL_CNF5_1 (0x2UL << GPIO_CRL_CNF5_Pos) /*!< 0x00800000 */ + +#define GPIO_CRL_CNF6_Pos (26U) +#define GPIO_CRL_CNF6_Msk (0x3UL << GPIO_CRL_CNF6_Pos) /*!< 0x0C000000 */ +#define GPIO_CRL_CNF6 GPIO_CRL_CNF6_Msk /*!< CNF6[1:0] bits (Port x configuration bits, pin 6) */ +#define GPIO_CRL_CNF6_0 (0x1UL << GPIO_CRL_CNF6_Pos) /*!< 0x04000000 */ +#define GPIO_CRL_CNF6_1 (0x2UL << GPIO_CRL_CNF6_Pos) /*!< 0x08000000 */ + +#define GPIO_CRL_CNF7_Pos (30U) +#define GPIO_CRL_CNF7_Msk (0x3UL << GPIO_CRL_CNF7_Pos) /*!< 0xC0000000 */ +#define GPIO_CRL_CNF7 GPIO_CRL_CNF7_Msk /*!< CNF7[1:0] bits (Port x configuration bits, pin 7) */ +#define GPIO_CRL_CNF7_0 (0x1UL << GPIO_CRL_CNF7_Pos) /*!< 0x40000000 */ +#define GPIO_CRL_CNF7_1 (0x2UL << GPIO_CRL_CNF7_Pos) /*!< 0x80000000 */ + +/******************* Bit definition for GPIO_CRH register *******************/ +#define GPIO_CRH_MODE_Pos (0U) +#define GPIO_CRH_MODE_Msk (0x33333333UL << GPIO_CRH_MODE_Pos) /*!< 0x33333333 */ +#define GPIO_CRH_MODE GPIO_CRH_MODE_Msk /*!< Port x mode bits */ + +#define GPIO_CRH_MODE8_Pos (0U) +#define GPIO_CRH_MODE8_Msk (0x3UL << GPIO_CRH_MODE8_Pos) /*!< 0x00000003 */ +#define GPIO_CRH_MODE8 GPIO_CRH_MODE8_Msk /*!< MODE8[1:0] bits (Port x mode bits, pin 8) */ +#define GPIO_CRH_MODE8_0 (0x1UL << GPIO_CRH_MODE8_Pos) /*!< 0x00000001 */ +#define GPIO_CRH_MODE8_1 (0x2UL << GPIO_CRH_MODE8_Pos) /*!< 0x00000002 */ + +#define GPIO_CRH_MODE9_Pos (4U) +#define GPIO_CRH_MODE9_Msk (0x3UL << GPIO_CRH_MODE9_Pos) /*!< 0x00000030 */ +#define GPIO_CRH_MODE9 GPIO_CRH_MODE9_Msk /*!< MODE9[1:0] bits (Port x mode bits, pin 9) */ +#define GPIO_CRH_MODE9_0 (0x1UL << GPIO_CRH_MODE9_Pos) /*!< 0x00000010 */ +#define GPIO_CRH_MODE9_1 (0x2UL << GPIO_CRH_MODE9_Pos) /*!< 0x00000020 */ + +#define GPIO_CRH_MODE10_Pos (8U) +#define GPIO_CRH_MODE10_Msk (0x3UL << GPIO_CRH_MODE10_Pos) /*!< 0x00000300 */ +#define GPIO_CRH_MODE10 GPIO_CRH_MODE10_Msk /*!< MODE10[1:0] bits (Port x mode bits, pin 10) */ +#define GPIO_CRH_MODE10_0 (0x1UL << GPIO_CRH_MODE10_Pos) /*!< 0x00000100 */ +#define GPIO_CRH_MODE10_1 (0x2UL << GPIO_CRH_MODE10_Pos) /*!< 0x00000200 */ + +#define GPIO_CRH_MODE11_Pos (12U) +#define GPIO_CRH_MODE11_Msk (0x3UL << GPIO_CRH_MODE11_Pos) /*!< 0x00003000 */ +#define GPIO_CRH_MODE11 GPIO_CRH_MODE11_Msk /*!< MODE11[1:0] bits (Port x mode bits, pin 11) */ +#define GPIO_CRH_MODE11_0 (0x1UL << GPIO_CRH_MODE11_Pos) /*!< 0x00001000 */ +#define GPIO_CRH_MODE11_1 (0x2UL << GPIO_CRH_MODE11_Pos) /*!< 0x00002000 */ + +#define GPIO_CRH_MODE12_Pos (16U) +#define GPIO_CRH_MODE12_Msk (0x3UL << GPIO_CRH_MODE12_Pos) /*!< 0x00030000 */ +#define GPIO_CRH_MODE12 GPIO_CRH_MODE12_Msk /*!< MODE12[1:0] bits (Port x mode bits, pin 12) */ +#define GPIO_CRH_MODE12_0 (0x1UL << GPIO_CRH_MODE12_Pos) /*!< 0x00010000 */ +#define GPIO_CRH_MODE12_1 (0x2UL << GPIO_CRH_MODE12_Pos) /*!< 0x00020000 */ + +#define GPIO_CRH_MODE13_Pos (20U) +#define GPIO_CRH_MODE13_Msk (0x3UL << GPIO_CRH_MODE13_Pos) /*!< 0x00300000 */ +#define GPIO_CRH_MODE13 GPIO_CRH_MODE13_Msk /*!< MODE13[1:0] bits (Port x mode bits, pin 13) */ +#define GPIO_CRH_MODE13_0 (0x1UL << GPIO_CRH_MODE13_Pos) /*!< 0x00100000 */ +#define GPIO_CRH_MODE13_1 (0x2UL << GPIO_CRH_MODE13_Pos) /*!< 0x00200000 */ + +#define GPIO_CRH_MODE14_Pos (24U) +#define GPIO_CRH_MODE14_Msk (0x3UL << GPIO_CRH_MODE14_Pos) /*!< 0x03000000 */ +#define GPIO_CRH_MODE14 GPIO_CRH_MODE14_Msk /*!< MODE14[1:0] bits (Port x mode bits, pin 14) */ +#define GPIO_CRH_MODE14_0 (0x1UL << GPIO_CRH_MODE14_Pos) /*!< 0x01000000 */ +#define GPIO_CRH_MODE14_1 (0x2UL << GPIO_CRH_MODE14_Pos) /*!< 0x02000000 */ + +#define GPIO_CRH_MODE15_Pos (28U) +#define GPIO_CRH_MODE15_Msk (0x3UL << GPIO_CRH_MODE15_Pos) /*!< 0x30000000 */ +#define GPIO_CRH_MODE15 GPIO_CRH_MODE15_Msk /*!< MODE15[1:0] bits (Port x mode bits, pin 15) */ +#define GPIO_CRH_MODE15_0 (0x1UL << GPIO_CRH_MODE15_Pos) /*!< 0x10000000 */ +#define GPIO_CRH_MODE15_1 (0x2UL << GPIO_CRH_MODE15_Pos) /*!< 0x20000000 */ + +#define GPIO_CRH_CNF_Pos (2U) +#define GPIO_CRH_CNF_Msk (0x33333333UL << GPIO_CRH_CNF_Pos) /*!< 0xCCCCCCCC */ +#define GPIO_CRH_CNF GPIO_CRH_CNF_Msk /*!< Port x configuration bits */ + +#define GPIO_CRH_CNF8_Pos (2U) +#define GPIO_CRH_CNF8_Msk (0x3UL << GPIO_CRH_CNF8_Pos) /*!< 0x0000000C */ +#define GPIO_CRH_CNF8 GPIO_CRH_CNF8_Msk /*!< CNF8[1:0] bits (Port x configuration bits, pin 8) */ +#define GPIO_CRH_CNF8_0 (0x1UL << GPIO_CRH_CNF8_Pos) /*!< 0x00000004 */ +#define GPIO_CRH_CNF8_1 (0x2UL << GPIO_CRH_CNF8_Pos) /*!< 0x00000008 */ + +#define GPIO_CRH_CNF9_Pos (6U) +#define GPIO_CRH_CNF9_Msk (0x3UL << GPIO_CRH_CNF9_Pos) /*!< 0x000000C0 */ +#define GPIO_CRH_CNF9 GPIO_CRH_CNF9_Msk /*!< CNF9[1:0] bits (Port x configuration bits, pin 9) */ +#define GPIO_CRH_CNF9_0 (0x1UL << GPIO_CRH_CNF9_Pos) /*!< 0x00000040 */ +#define GPIO_CRH_CNF9_1 (0x2UL << GPIO_CRH_CNF9_Pos) /*!< 0x00000080 */ + +#define GPIO_CRH_CNF10_Pos (10U) +#define GPIO_CRH_CNF10_Msk (0x3UL << GPIO_CRH_CNF10_Pos) /*!< 0x00000C00 */ +#define GPIO_CRH_CNF10 GPIO_CRH_CNF10_Msk /*!< CNF10[1:0] bits (Port x configuration bits, pin 10) */ +#define GPIO_CRH_CNF10_0 (0x1UL << GPIO_CRH_CNF10_Pos) /*!< 0x00000400 */ +#define GPIO_CRH_CNF10_1 (0x2UL << GPIO_CRH_CNF10_Pos) /*!< 0x00000800 */ + +#define GPIO_CRH_CNF11_Pos (14U) +#define GPIO_CRH_CNF11_Msk (0x3UL << GPIO_CRH_CNF11_Pos) /*!< 0x0000C000 */ +#define GPIO_CRH_CNF11 GPIO_CRH_CNF11_Msk /*!< CNF11[1:0] bits (Port x configuration bits, pin 11) */ +#define GPIO_CRH_CNF11_0 (0x1UL << GPIO_CRH_CNF11_Pos) /*!< 0x00004000 */ +#define GPIO_CRH_CNF11_1 (0x2UL << GPIO_CRH_CNF11_Pos) /*!< 0x00008000 */ + +#define GPIO_CRH_CNF12_Pos (18U) +#define GPIO_CRH_CNF12_Msk (0x3UL << GPIO_CRH_CNF12_Pos) /*!< 0x000C0000 */ +#define GPIO_CRH_CNF12 GPIO_CRH_CNF12_Msk /*!< CNF12[1:0] bits (Port x configuration bits, pin 12) */ +#define GPIO_CRH_CNF12_0 (0x1UL << GPIO_CRH_CNF12_Pos) /*!< 0x00040000 */ +#define GPIO_CRH_CNF12_1 (0x2UL << GPIO_CRH_CNF12_Pos) /*!< 0x00080000 */ + +#define GPIO_CRH_CNF13_Pos (22U) +#define GPIO_CRH_CNF13_Msk (0x3UL << GPIO_CRH_CNF13_Pos) /*!< 0x00C00000 */ +#define GPIO_CRH_CNF13 GPIO_CRH_CNF13_Msk /*!< CNF13[1:0] bits (Port x configuration bits, pin 13) */ +#define GPIO_CRH_CNF13_0 (0x1UL << GPIO_CRH_CNF13_Pos) /*!< 0x00400000 */ +#define GPIO_CRH_CNF13_1 (0x2UL << GPIO_CRH_CNF13_Pos) /*!< 0x00800000 */ + +#define GPIO_CRH_CNF14_Pos (26U) +#define GPIO_CRH_CNF14_Msk (0x3UL << GPIO_CRH_CNF14_Pos) /*!< 0x0C000000 */ +#define GPIO_CRH_CNF14 GPIO_CRH_CNF14_Msk /*!< CNF14[1:0] bits (Port x configuration bits, pin 14) */ +#define GPIO_CRH_CNF14_0 (0x1UL << GPIO_CRH_CNF14_Pos) /*!< 0x04000000 */ +#define GPIO_CRH_CNF14_1 (0x2UL << GPIO_CRH_CNF14_Pos) /*!< 0x08000000 */ + +#define GPIO_CRH_CNF15_Pos (30U) +#define GPIO_CRH_CNF15_Msk (0x3UL << GPIO_CRH_CNF15_Pos) /*!< 0xC0000000 */ +#define GPIO_CRH_CNF15 GPIO_CRH_CNF15_Msk /*!< CNF15[1:0] bits (Port x configuration bits, pin 15) */ +#define GPIO_CRH_CNF15_0 (0x1UL << GPIO_CRH_CNF15_Pos) /*!< 0x40000000 */ +#define GPIO_CRH_CNF15_1 (0x2UL << GPIO_CRH_CNF15_Pos) /*!< 0x80000000 */ + +/*!<****************** Bit definition for GPIO_IDR register *******************/ +#define GPIO_IDR_IDR0_Pos (0U) +#define GPIO_IDR_IDR0_Msk (0x1UL << GPIO_IDR_IDR0_Pos) /*!< 0x00000001 */ +#define GPIO_IDR_IDR0 GPIO_IDR_IDR0_Msk /*!< Port input data, bit 0 */ +#define GPIO_IDR_IDR1_Pos (1U) +#define GPIO_IDR_IDR1_Msk (0x1UL << GPIO_IDR_IDR1_Pos) /*!< 0x00000002 */ +#define GPIO_IDR_IDR1 GPIO_IDR_IDR1_Msk /*!< Port input data, bit 1 */ +#define GPIO_IDR_IDR2_Pos (2U) +#define GPIO_IDR_IDR2_Msk (0x1UL << GPIO_IDR_IDR2_Pos) /*!< 0x00000004 */ +#define GPIO_IDR_IDR2 GPIO_IDR_IDR2_Msk /*!< Port input data, bit 2 */ +#define GPIO_IDR_IDR3_Pos (3U) +#define GPIO_IDR_IDR3_Msk (0x1UL << GPIO_IDR_IDR3_Pos) /*!< 0x00000008 */ +#define GPIO_IDR_IDR3 GPIO_IDR_IDR3_Msk /*!< Port input data, bit 3 */ +#define GPIO_IDR_IDR4_Pos (4U) +#define GPIO_IDR_IDR4_Msk (0x1UL << GPIO_IDR_IDR4_Pos) /*!< 0x00000010 */ +#define GPIO_IDR_IDR4 GPIO_IDR_IDR4_Msk /*!< Port input data, bit 4 */ +#define GPIO_IDR_IDR5_Pos (5U) +#define GPIO_IDR_IDR5_Msk (0x1UL << GPIO_IDR_IDR5_Pos) /*!< 0x00000020 */ +#define GPIO_IDR_IDR5 GPIO_IDR_IDR5_Msk /*!< Port input data, bit 5 */ +#define GPIO_IDR_IDR6_Pos (6U) +#define GPIO_IDR_IDR6_Msk (0x1UL << GPIO_IDR_IDR6_Pos) /*!< 0x00000040 */ +#define GPIO_IDR_IDR6 GPIO_IDR_IDR6_Msk /*!< Port input data, bit 6 */ +#define GPIO_IDR_IDR7_Pos (7U) +#define GPIO_IDR_IDR7_Msk (0x1UL << GPIO_IDR_IDR7_Pos) /*!< 0x00000080 */ +#define GPIO_IDR_IDR7 GPIO_IDR_IDR7_Msk /*!< Port input data, bit 7 */ +#define GPIO_IDR_IDR8_Pos (8U) +#define GPIO_IDR_IDR8_Msk (0x1UL << GPIO_IDR_IDR8_Pos) /*!< 0x00000100 */ +#define GPIO_IDR_IDR8 GPIO_IDR_IDR8_Msk /*!< Port input data, bit 8 */ +#define GPIO_IDR_IDR9_Pos (9U) +#define GPIO_IDR_IDR9_Msk (0x1UL << GPIO_IDR_IDR9_Pos) /*!< 0x00000200 */ +#define GPIO_IDR_IDR9 GPIO_IDR_IDR9_Msk /*!< Port input data, bit 9 */ +#define GPIO_IDR_IDR10_Pos (10U) +#define GPIO_IDR_IDR10_Msk (0x1UL << GPIO_IDR_IDR10_Pos) /*!< 0x00000400 */ +#define GPIO_IDR_IDR10 GPIO_IDR_IDR10_Msk /*!< Port input data, bit 10 */ +#define GPIO_IDR_IDR11_Pos (11U) +#define GPIO_IDR_IDR11_Msk (0x1UL << GPIO_IDR_IDR11_Pos) /*!< 0x00000800 */ +#define GPIO_IDR_IDR11 GPIO_IDR_IDR11_Msk /*!< Port input data, bit 11 */ +#define GPIO_IDR_IDR12_Pos (12U) +#define GPIO_IDR_IDR12_Msk (0x1UL << GPIO_IDR_IDR12_Pos) /*!< 0x00001000 */ +#define GPIO_IDR_IDR12 GPIO_IDR_IDR12_Msk /*!< Port input data, bit 12 */ +#define GPIO_IDR_IDR13_Pos (13U) +#define GPIO_IDR_IDR13_Msk (0x1UL << GPIO_IDR_IDR13_Pos) /*!< 0x00002000 */ +#define GPIO_IDR_IDR13 GPIO_IDR_IDR13_Msk /*!< Port input data, bit 13 */ +#define GPIO_IDR_IDR14_Pos (14U) +#define GPIO_IDR_IDR14_Msk (0x1UL << GPIO_IDR_IDR14_Pos) /*!< 0x00004000 */ +#define GPIO_IDR_IDR14 GPIO_IDR_IDR14_Msk /*!< Port input data, bit 14 */ +#define GPIO_IDR_IDR15_Pos (15U) +#define GPIO_IDR_IDR15_Msk (0x1UL << GPIO_IDR_IDR15_Pos) /*!< 0x00008000 */ +#define GPIO_IDR_IDR15 GPIO_IDR_IDR15_Msk /*!< Port input data, bit 15 */ + +/******************* Bit definition for GPIO_ODR register *******************/ +#define GPIO_ODR_ODR0_Pos (0U) +#define GPIO_ODR_ODR0_Msk (0x1UL << GPIO_ODR_ODR0_Pos) /*!< 0x00000001 */ +#define GPIO_ODR_ODR0 GPIO_ODR_ODR0_Msk /*!< Port output data, bit 0 */ +#define GPIO_ODR_ODR1_Pos (1U) +#define GPIO_ODR_ODR1_Msk (0x1UL << GPIO_ODR_ODR1_Pos) /*!< 0x00000002 */ +#define GPIO_ODR_ODR1 GPIO_ODR_ODR1_Msk /*!< Port output data, bit 1 */ +#define GPIO_ODR_ODR2_Pos (2U) +#define GPIO_ODR_ODR2_Msk (0x1UL << GPIO_ODR_ODR2_Pos) /*!< 0x00000004 */ +#define GPIO_ODR_ODR2 GPIO_ODR_ODR2_Msk /*!< Port output data, bit 2 */ +#define GPIO_ODR_ODR3_Pos (3U) +#define GPIO_ODR_ODR3_Msk (0x1UL << GPIO_ODR_ODR3_Pos) /*!< 0x00000008 */ +#define GPIO_ODR_ODR3 GPIO_ODR_ODR3_Msk /*!< Port output data, bit 3 */ +#define GPIO_ODR_ODR4_Pos (4U) +#define GPIO_ODR_ODR4_Msk (0x1UL << GPIO_ODR_ODR4_Pos) /*!< 0x00000010 */ +#define GPIO_ODR_ODR4 GPIO_ODR_ODR4_Msk /*!< Port output data, bit 4 */ +#define GPIO_ODR_ODR5_Pos (5U) +#define GPIO_ODR_ODR5_Msk (0x1UL << GPIO_ODR_ODR5_Pos) /*!< 0x00000020 */ +#define GPIO_ODR_ODR5 GPIO_ODR_ODR5_Msk /*!< Port output data, bit 5 */ +#define GPIO_ODR_ODR6_Pos (6U) +#define GPIO_ODR_ODR6_Msk (0x1UL << GPIO_ODR_ODR6_Pos) /*!< 0x00000040 */ +#define GPIO_ODR_ODR6 GPIO_ODR_ODR6_Msk /*!< Port output data, bit 6 */ +#define GPIO_ODR_ODR7_Pos (7U) +#define GPIO_ODR_ODR7_Msk (0x1UL << GPIO_ODR_ODR7_Pos) /*!< 0x00000080 */ +#define GPIO_ODR_ODR7 GPIO_ODR_ODR7_Msk /*!< Port output data, bit 7 */ +#define GPIO_ODR_ODR8_Pos (8U) +#define GPIO_ODR_ODR8_Msk (0x1UL << GPIO_ODR_ODR8_Pos) /*!< 0x00000100 */ +#define GPIO_ODR_ODR8 GPIO_ODR_ODR8_Msk /*!< Port output data, bit 8 */ +#define GPIO_ODR_ODR9_Pos (9U) +#define GPIO_ODR_ODR9_Msk (0x1UL << GPIO_ODR_ODR9_Pos) /*!< 0x00000200 */ +#define GPIO_ODR_ODR9 GPIO_ODR_ODR9_Msk /*!< Port output data, bit 9 */ +#define GPIO_ODR_ODR10_Pos (10U) +#define GPIO_ODR_ODR10_Msk (0x1UL << GPIO_ODR_ODR10_Pos) /*!< 0x00000400 */ +#define GPIO_ODR_ODR10 GPIO_ODR_ODR10_Msk /*!< Port output data, bit 10 */ +#define GPIO_ODR_ODR11_Pos (11U) +#define GPIO_ODR_ODR11_Msk (0x1UL << GPIO_ODR_ODR11_Pos) /*!< 0x00000800 */ +#define GPIO_ODR_ODR11 GPIO_ODR_ODR11_Msk /*!< Port output data, bit 11 */ +#define GPIO_ODR_ODR12_Pos (12U) +#define GPIO_ODR_ODR12_Msk (0x1UL << GPIO_ODR_ODR12_Pos) /*!< 0x00001000 */ +#define GPIO_ODR_ODR12 GPIO_ODR_ODR12_Msk /*!< Port output data, bit 12 */ +#define GPIO_ODR_ODR13_Pos (13U) +#define GPIO_ODR_ODR13_Msk (0x1UL << GPIO_ODR_ODR13_Pos) /*!< 0x00002000 */ +#define GPIO_ODR_ODR13 GPIO_ODR_ODR13_Msk /*!< Port output data, bit 13 */ +#define GPIO_ODR_ODR14_Pos (14U) +#define GPIO_ODR_ODR14_Msk (0x1UL << GPIO_ODR_ODR14_Pos) /*!< 0x00004000 */ +#define GPIO_ODR_ODR14 GPIO_ODR_ODR14_Msk /*!< Port output data, bit 14 */ +#define GPIO_ODR_ODR15_Pos (15U) +#define GPIO_ODR_ODR15_Msk (0x1UL << GPIO_ODR_ODR15_Pos) /*!< 0x00008000 */ +#define GPIO_ODR_ODR15 GPIO_ODR_ODR15_Msk /*!< Port output data, bit 15 */ + +/****************** Bit definition for GPIO_BSRR register *******************/ +#define GPIO_BSRR_BS0_Pos (0U) +#define GPIO_BSRR_BS0_Msk (0x1UL << GPIO_BSRR_BS0_Pos) /*!< 0x00000001 */ +#define GPIO_BSRR_BS0 GPIO_BSRR_BS0_Msk /*!< Port x Set bit 0 */ +#define GPIO_BSRR_BS1_Pos (1U) +#define GPIO_BSRR_BS1_Msk (0x1UL << GPIO_BSRR_BS1_Pos) /*!< 0x00000002 */ +#define GPIO_BSRR_BS1 GPIO_BSRR_BS1_Msk /*!< Port x Set bit 1 */ +#define GPIO_BSRR_BS2_Pos (2U) +#define GPIO_BSRR_BS2_Msk (0x1UL << GPIO_BSRR_BS2_Pos) /*!< 0x00000004 */ +#define GPIO_BSRR_BS2 GPIO_BSRR_BS2_Msk /*!< Port x Set bit 2 */ +#define GPIO_BSRR_BS3_Pos (3U) +#define GPIO_BSRR_BS3_Msk (0x1UL << GPIO_BSRR_BS3_Pos) /*!< 0x00000008 */ +#define GPIO_BSRR_BS3 GPIO_BSRR_BS3_Msk /*!< Port x Set bit 3 */ +#define GPIO_BSRR_BS4_Pos (4U) +#define GPIO_BSRR_BS4_Msk (0x1UL << GPIO_BSRR_BS4_Pos) /*!< 0x00000010 */ +#define GPIO_BSRR_BS4 GPIO_BSRR_BS4_Msk /*!< Port x Set bit 4 */ +#define GPIO_BSRR_BS5_Pos (5U) +#define GPIO_BSRR_BS5_Msk (0x1UL << GPIO_BSRR_BS5_Pos) /*!< 0x00000020 */ +#define GPIO_BSRR_BS5 GPIO_BSRR_BS5_Msk /*!< Port x Set bit 5 */ +#define GPIO_BSRR_BS6_Pos (6U) +#define GPIO_BSRR_BS6_Msk (0x1UL << GPIO_BSRR_BS6_Pos) /*!< 0x00000040 */ +#define GPIO_BSRR_BS6 GPIO_BSRR_BS6_Msk /*!< Port x Set bit 6 */ +#define GPIO_BSRR_BS7_Pos (7U) +#define GPIO_BSRR_BS7_Msk (0x1UL << GPIO_BSRR_BS7_Pos) /*!< 0x00000080 */ +#define GPIO_BSRR_BS7 GPIO_BSRR_BS7_Msk /*!< Port x Set bit 7 */ +#define GPIO_BSRR_BS8_Pos (8U) +#define GPIO_BSRR_BS8_Msk (0x1UL << GPIO_BSRR_BS8_Pos) /*!< 0x00000100 */ +#define GPIO_BSRR_BS8 GPIO_BSRR_BS8_Msk /*!< Port x Set bit 8 */ +#define GPIO_BSRR_BS9_Pos (9U) +#define GPIO_BSRR_BS9_Msk (0x1UL << GPIO_BSRR_BS9_Pos) /*!< 0x00000200 */ +#define GPIO_BSRR_BS9 GPIO_BSRR_BS9_Msk /*!< Port x Set bit 9 */ +#define GPIO_BSRR_BS10_Pos (10U) +#define GPIO_BSRR_BS10_Msk (0x1UL << GPIO_BSRR_BS10_Pos) /*!< 0x00000400 */ +#define GPIO_BSRR_BS10 GPIO_BSRR_BS10_Msk /*!< Port x Set bit 10 */ +#define GPIO_BSRR_BS11_Pos (11U) +#define GPIO_BSRR_BS11_Msk (0x1UL << GPIO_BSRR_BS11_Pos) /*!< 0x00000800 */ +#define GPIO_BSRR_BS11 GPIO_BSRR_BS11_Msk /*!< Port x Set bit 11 */ +#define GPIO_BSRR_BS12_Pos (12U) +#define GPIO_BSRR_BS12_Msk (0x1UL << GPIO_BSRR_BS12_Pos) /*!< 0x00001000 */ +#define GPIO_BSRR_BS12 GPIO_BSRR_BS12_Msk /*!< Port x Set bit 12 */ +#define GPIO_BSRR_BS13_Pos (13U) +#define GPIO_BSRR_BS13_Msk (0x1UL << GPIO_BSRR_BS13_Pos) /*!< 0x00002000 */ +#define GPIO_BSRR_BS13 GPIO_BSRR_BS13_Msk /*!< Port x Set bit 13 */ +#define GPIO_BSRR_BS14_Pos (14U) +#define GPIO_BSRR_BS14_Msk (0x1UL << GPIO_BSRR_BS14_Pos) /*!< 0x00004000 */ +#define GPIO_BSRR_BS14 GPIO_BSRR_BS14_Msk /*!< Port x Set bit 14 */ +#define GPIO_BSRR_BS15_Pos (15U) +#define GPIO_BSRR_BS15_Msk (0x1UL << GPIO_BSRR_BS15_Pos) /*!< 0x00008000 */ +#define GPIO_BSRR_BS15 GPIO_BSRR_BS15_Msk /*!< Port x Set bit 15 */ + +#define GPIO_BSRR_BR0_Pos (16U) +#define GPIO_BSRR_BR0_Msk (0x1UL << GPIO_BSRR_BR0_Pos) /*!< 0x00010000 */ +#define GPIO_BSRR_BR0 GPIO_BSRR_BR0_Msk /*!< Port x Reset bit 0 */ +#define GPIO_BSRR_BR1_Pos (17U) +#define GPIO_BSRR_BR1_Msk (0x1UL << GPIO_BSRR_BR1_Pos) /*!< 0x00020000 */ +#define GPIO_BSRR_BR1 GPIO_BSRR_BR1_Msk /*!< Port x Reset bit 1 */ +#define GPIO_BSRR_BR2_Pos (18U) +#define GPIO_BSRR_BR2_Msk (0x1UL << GPIO_BSRR_BR2_Pos) /*!< 0x00040000 */ +#define GPIO_BSRR_BR2 GPIO_BSRR_BR2_Msk /*!< Port x Reset bit 2 */ +#define GPIO_BSRR_BR3_Pos (19U) +#define GPIO_BSRR_BR3_Msk (0x1UL << GPIO_BSRR_BR3_Pos) /*!< 0x00080000 */ +#define GPIO_BSRR_BR3 GPIO_BSRR_BR3_Msk /*!< Port x Reset bit 3 */ +#define GPIO_BSRR_BR4_Pos (20U) +#define GPIO_BSRR_BR4_Msk (0x1UL << GPIO_BSRR_BR4_Pos) /*!< 0x00100000 */ +#define GPIO_BSRR_BR4 GPIO_BSRR_BR4_Msk /*!< Port x Reset bit 4 */ +#define GPIO_BSRR_BR5_Pos (21U) +#define GPIO_BSRR_BR5_Msk (0x1UL << GPIO_BSRR_BR5_Pos) /*!< 0x00200000 */ +#define GPIO_BSRR_BR5 GPIO_BSRR_BR5_Msk /*!< Port x Reset bit 5 */ +#define GPIO_BSRR_BR6_Pos (22U) +#define GPIO_BSRR_BR6_Msk (0x1UL << GPIO_BSRR_BR6_Pos) /*!< 0x00400000 */ +#define GPIO_BSRR_BR6 GPIO_BSRR_BR6_Msk /*!< Port x Reset bit 6 */ +#define GPIO_BSRR_BR7_Pos (23U) +#define GPIO_BSRR_BR7_Msk (0x1UL << GPIO_BSRR_BR7_Pos) /*!< 0x00800000 */ +#define GPIO_BSRR_BR7 GPIO_BSRR_BR7_Msk /*!< Port x Reset bit 7 */ +#define GPIO_BSRR_BR8_Pos (24U) +#define GPIO_BSRR_BR8_Msk (0x1UL << GPIO_BSRR_BR8_Pos) /*!< 0x01000000 */ +#define GPIO_BSRR_BR8 GPIO_BSRR_BR8_Msk /*!< Port x Reset bit 8 */ +#define GPIO_BSRR_BR9_Pos (25U) +#define GPIO_BSRR_BR9_Msk (0x1UL << GPIO_BSRR_BR9_Pos) /*!< 0x02000000 */ +#define GPIO_BSRR_BR9 GPIO_BSRR_BR9_Msk /*!< Port x Reset bit 9 */ +#define GPIO_BSRR_BR10_Pos (26U) +#define GPIO_BSRR_BR10_Msk (0x1UL << GPIO_BSRR_BR10_Pos) /*!< 0x04000000 */ +#define GPIO_BSRR_BR10 GPIO_BSRR_BR10_Msk /*!< Port x Reset bit 10 */ +#define GPIO_BSRR_BR11_Pos (27U) +#define GPIO_BSRR_BR11_Msk (0x1UL << GPIO_BSRR_BR11_Pos) /*!< 0x08000000 */ +#define GPIO_BSRR_BR11 GPIO_BSRR_BR11_Msk /*!< Port x Reset bit 11 */ +#define GPIO_BSRR_BR12_Pos (28U) +#define GPIO_BSRR_BR12_Msk (0x1UL << GPIO_BSRR_BR12_Pos) /*!< 0x10000000 */ +#define GPIO_BSRR_BR12 GPIO_BSRR_BR12_Msk /*!< Port x Reset bit 12 */ +#define GPIO_BSRR_BR13_Pos (29U) +#define GPIO_BSRR_BR13_Msk (0x1UL << GPIO_BSRR_BR13_Pos) /*!< 0x20000000 */ +#define GPIO_BSRR_BR13 GPIO_BSRR_BR13_Msk /*!< Port x Reset bit 13 */ +#define GPIO_BSRR_BR14_Pos (30U) +#define GPIO_BSRR_BR14_Msk (0x1UL << GPIO_BSRR_BR14_Pos) /*!< 0x40000000 */ +#define GPIO_BSRR_BR14 GPIO_BSRR_BR14_Msk /*!< Port x Reset bit 14 */ +#define GPIO_BSRR_BR15_Pos (31U) +#define GPIO_BSRR_BR15_Msk (0x1UL << GPIO_BSRR_BR15_Pos) /*!< 0x80000000 */ +#define GPIO_BSRR_BR15 GPIO_BSRR_BR15_Msk /*!< Port x Reset bit 15 */ + +/******************* Bit definition for GPIO_BRR register *******************/ +#define GPIO_BRR_BR0_Pos (0U) +#define GPIO_BRR_BR0_Msk (0x1UL << GPIO_BRR_BR0_Pos) /*!< 0x00000001 */ +#define GPIO_BRR_BR0 GPIO_BRR_BR0_Msk /*!< Port x Reset bit 0 */ +#define GPIO_BRR_BR1_Pos (1U) +#define GPIO_BRR_BR1_Msk (0x1UL << GPIO_BRR_BR1_Pos) /*!< 0x00000002 */ +#define GPIO_BRR_BR1 GPIO_BRR_BR1_Msk /*!< Port x Reset bit 1 */ +#define GPIO_BRR_BR2_Pos (2U) +#define GPIO_BRR_BR2_Msk (0x1UL << GPIO_BRR_BR2_Pos) /*!< 0x00000004 */ +#define GPIO_BRR_BR2 GPIO_BRR_BR2_Msk /*!< Port x Reset bit 2 */ +#define GPIO_BRR_BR3_Pos (3U) +#define GPIO_BRR_BR3_Msk (0x1UL << GPIO_BRR_BR3_Pos) /*!< 0x00000008 */ +#define GPIO_BRR_BR3 GPIO_BRR_BR3_Msk /*!< Port x Reset bit 3 */ +#define GPIO_BRR_BR4_Pos (4U) +#define GPIO_BRR_BR4_Msk (0x1UL << GPIO_BRR_BR4_Pos) /*!< 0x00000010 */ +#define GPIO_BRR_BR4 GPIO_BRR_BR4_Msk /*!< Port x Reset bit 4 */ +#define GPIO_BRR_BR5_Pos (5U) +#define GPIO_BRR_BR5_Msk (0x1UL << GPIO_BRR_BR5_Pos) /*!< 0x00000020 */ +#define GPIO_BRR_BR5 GPIO_BRR_BR5_Msk /*!< Port x Reset bit 5 */ +#define GPIO_BRR_BR6_Pos (6U) +#define GPIO_BRR_BR6_Msk (0x1UL << GPIO_BRR_BR6_Pos) /*!< 0x00000040 */ +#define GPIO_BRR_BR6 GPIO_BRR_BR6_Msk /*!< Port x Reset bit 6 */ +#define GPIO_BRR_BR7_Pos (7U) +#define GPIO_BRR_BR7_Msk (0x1UL << GPIO_BRR_BR7_Pos) /*!< 0x00000080 */ +#define GPIO_BRR_BR7 GPIO_BRR_BR7_Msk /*!< Port x Reset bit 7 */ +#define GPIO_BRR_BR8_Pos (8U) +#define GPIO_BRR_BR8_Msk (0x1UL << GPIO_BRR_BR8_Pos) /*!< 0x00000100 */ +#define GPIO_BRR_BR8 GPIO_BRR_BR8_Msk /*!< Port x Reset bit 8 */ +#define GPIO_BRR_BR9_Pos (9U) +#define GPIO_BRR_BR9_Msk (0x1UL << GPIO_BRR_BR9_Pos) /*!< 0x00000200 */ +#define GPIO_BRR_BR9 GPIO_BRR_BR9_Msk /*!< Port x Reset bit 9 */ +#define GPIO_BRR_BR10_Pos (10U) +#define GPIO_BRR_BR10_Msk (0x1UL << GPIO_BRR_BR10_Pos) /*!< 0x00000400 */ +#define GPIO_BRR_BR10 GPIO_BRR_BR10_Msk /*!< Port x Reset bit 10 */ +#define GPIO_BRR_BR11_Pos (11U) +#define GPIO_BRR_BR11_Msk (0x1UL << GPIO_BRR_BR11_Pos) /*!< 0x00000800 */ +#define GPIO_BRR_BR11 GPIO_BRR_BR11_Msk /*!< Port x Reset bit 11 */ +#define GPIO_BRR_BR12_Pos (12U) +#define GPIO_BRR_BR12_Msk (0x1UL << GPIO_BRR_BR12_Pos) /*!< 0x00001000 */ +#define GPIO_BRR_BR12 GPIO_BRR_BR12_Msk /*!< Port x Reset bit 12 */ +#define GPIO_BRR_BR13_Pos (13U) +#define GPIO_BRR_BR13_Msk (0x1UL << GPIO_BRR_BR13_Pos) /*!< 0x00002000 */ +#define GPIO_BRR_BR13 GPIO_BRR_BR13_Msk /*!< Port x Reset bit 13 */ +#define GPIO_BRR_BR14_Pos (14U) +#define GPIO_BRR_BR14_Msk (0x1UL << GPIO_BRR_BR14_Pos) /*!< 0x00004000 */ +#define GPIO_BRR_BR14 GPIO_BRR_BR14_Msk /*!< Port x Reset bit 14 */ +#define GPIO_BRR_BR15_Pos (15U) +#define GPIO_BRR_BR15_Msk (0x1UL << GPIO_BRR_BR15_Pos) /*!< 0x00008000 */ +#define GPIO_BRR_BR15 GPIO_BRR_BR15_Msk /*!< Port x Reset bit 15 */ + +/****************** Bit definition for GPIO_LCKR register *******************/ +#define GPIO_LCKR_LCK0_Pos (0U) +#define GPIO_LCKR_LCK0_Msk (0x1UL << GPIO_LCKR_LCK0_Pos) /*!< 0x00000001 */ +#define GPIO_LCKR_LCK0 GPIO_LCKR_LCK0_Msk /*!< Port x Lock bit 0 */ +#define GPIO_LCKR_LCK1_Pos (1U) +#define GPIO_LCKR_LCK1_Msk (0x1UL << GPIO_LCKR_LCK1_Pos) /*!< 0x00000002 */ +#define GPIO_LCKR_LCK1 GPIO_LCKR_LCK1_Msk /*!< Port x Lock bit 1 */ +#define GPIO_LCKR_LCK2_Pos (2U) +#define GPIO_LCKR_LCK2_Msk (0x1UL << GPIO_LCKR_LCK2_Pos) /*!< 0x00000004 */ +#define GPIO_LCKR_LCK2 GPIO_LCKR_LCK2_Msk /*!< Port x Lock bit 2 */ +#define GPIO_LCKR_LCK3_Pos (3U) +#define GPIO_LCKR_LCK3_Msk (0x1UL << GPIO_LCKR_LCK3_Pos) /*!< 0x00000008 */ +#define GPIO_LCKR_LCK3 GPIO_LCKR_LCK3_Msk /*!< Port x Lock bit 3 */ +#define GPIO_LCKR_LCK4_Pos (4U) +#define GPIO_LCKR_LCK4_Msk (0x1UL << GPIO_LCKR_LCK4_Pos) /*!< 0x00000010 */ +#define GPIO_LCKR_LCK4 GPIO_LCKR_LCK4_Msk /*!< Port x Lock bit 4 */ +#define GPIO_LCKR_LCK5_Pos (5U) +#define GPIO_LCKR_LCK5_Msk (0x1UL << GPIO_LCKR_LCK5_Pos) /*!< 0x00000020 */ +#define GPIO_LCKR_LCK5 GPIO_LCKR_LCK5_Msk /*!< Port x Lock bit 5 */ +#define GPIO_LCKR_LCK6_Pos (6U) +#define GPIO_LCKR_LCK6_Msk (0x1UL << GPIO_LCKR_LCK6_Pos) /*!< 0x00000040 */ +#define GPIO_LCKR_LCK6 GPIO_LCKR_LCK6_Msk /*!< Port x Lock bit 6 */ +#define GPIO_LCKR_LCK7_Pos (7U) +#define GPIO_LCKR_LCK7_Msk (0x1UL << GPIO_LCKR_LCK7_Pos) /*!< 0x00000080 */ +#define GPIO_LCKR_LCK7 GPIO_LCKR_LCK7_Msk /*!< Port x Lock bit 7 */ +#define GPIO_LCKR_LCK8_Pos (8U) +#define GPIO_LCKR_LCK8_Msk (0x1UL << GPIO_LCKR_LCK8_Pos) /*!< 0x00000100 */ +#define GPIO_LCKR_LCK8 GPIO_LCKR_LCK8_Msk /*!< Port x Lock bit 8 */ +#define GPIO_LCKR_LCK9_Pos (9U) +#define GPIO_LCKR_LCK9_Msk (0x1UL << GPIO_LCKR_LCK9_Pos) /*!< 0x00000200 */ +#define GPIO_LCKR_LCK9 GPIO_LCKR_LCK9_Msk /*!< Port x Lock bit 9 */ +#define GPIO_LCKR_LCK10_Pos (10U) +#define GPIO_LCKR_LCK10_Msk (0x1UL << GPIO_LCKR_LCK10_Pos) /*!< 0x00000400 */ +#define GPIO_LCKR_LCK10 GPIO_LCKR_LCK10_Msk /*!< Port x Lock bit 10 */ +#define GPIO_LCKR_LCK11_Pos (11U) +#define GPIO_LCKR_LCK11_Msk (0x1UL << GPIO_LCKR_LCK11_Pos) /*!< 0x00000800 */ +#define GPIO_LCKR_LCK11 GPIO_LCKR_LCK11_Msk /*!< Port x Lock bit 11 */ +#define GPIO_LCKR_LCK12_Pos (12U) +#define GPIO_LCKR_LCK12_Msk (0x1UL << GPIO_LCKR_LCK12_Pos) /*!< 0x00001000 */ +#define GPIO_LCKR_LCK12 GPIO_LCKR_LCK12_Msk /*!< Port x Lock bit 12 */ +#define GPIO_LCKR_LCK13_Pos (13U) +#define GPIO_LCKR_LCK13_Msk (0x1UL << GPIO_LCKR_LCK13_Pos) /*!< 0x00002000 */ +#define GPIO_LCKR_LCK13 GPIO_LCKR_LCK13_Msk /*!< Port x Lock bit 13 */ +#define GPIO_LCKR_LCK14_Pos (14U) +#define GPIO_LCKR_LCK14_Msk (0x1UL << GPIO_LCKR_LCK14_Pos) /*!< 0x00004000 */ +#define GPIO_LCKR_LCK14 GPIO_LCKR_LCK14_Msk /*!< Port x Lock bit 14 */ +#define GPIO_LCKR_LCK15_Pos (15U) +#define GPIO_LCKR_LCK15_Msk (0x1UL << GPIO_LCKR_LCK15_Pos) /*!< 0x00008000 */ +#define GPIO_LCKR_LCK15 GPIO_LCKR_LCK15_Msk /*!< Port x Lock bit 15 */ +#define GPIO_LCKR_LCKK_Pos (16U) +#define GPIO_LCKR_LCKK_Msk (0x1UL << GPIO_LCKR_LCKK_Pos) /*!< 0x00010000 */ +#define GPIO_LCKR_LCKK GPIO_LCKR_LCKK_Msk /*!< Lock key */ + +/*----------------------------------------------------------------------------*/ + +/****************** Bit definition for AFIO_EVCR register *******************/ +#define AFIO_EVCR_PIN_Pos (0U) +#define AFIO_EVCR_PIN_Msk (0xFUL << AFIO_EVCR_PIN_Pos) /*!< 0x0000000F */ +#define AFIO_EVCR_PIN AFIO_EVCR_PIN_Msk /*!< PIN[3:0] bits (Pin selection) */ +#define AFIO_EVCR_PIN_0 (0x1UL << AFIO_EVCR_PIN_Pos) /*!< 0x00000001 */ +#define AFIO_EVCR_PIN_1 (0x2UL << AFIO_EVCR_PIN_Pos) /*!< 0x00000002 */ +#define AFIO_EVCR_PIN_2 (0x4UL << AFIO_EVCR_PIN_Pos) /*!< 0x00000004 */ +#define AFIO_EVCR_PIN_3 (0x8UL << AFIO_EVCR_PIN_Pos) /*!< 0x00000008 */ + +/*!< PIN configuration */ +#define AFIO_EVCR_PIN_PX0 0x00000000U /*!< Pin 0 selected */ +#define AFIO_EVCR_PIN_PX1_Pos (0U) +#define AFIO_EVCR_PIN_PX1_Msk (0x1UL << AFIO_EVCR_PIN_PX1_Pos) /*!< 0x00000001 */ +#define AFIO_EVCR_PIN_PX1 AFIO_EVCR_PIN_PX1_Msk /*!< Pin 1 selected */ +#define AFIO_EVCR_PIN_PX2_Pos (1U) +#define AFIO_EVCR_PIN_PX2_Msk (0x1UL << AFIO_EVCR_PIN_PX2_Pos) /*!< 0x00000002 */ +#define AFIO_EVCR_PIN_PX2 AFIO_EVCR_PIN_PX2_Msk /*!< Pin 2 selected */ +#define AFIO_EVCR_PIN_PX3_Pos (0U) +#define AFIO_EVCR_PIN_PX3_Msk (0x3UL << AFIO_EVCR_PIN_PX3_Pos) /*!< 0x00000003 */ +#define AFIO_EVCR_PIN_PX3 AFIO_EVCR_PIN_PX3_Msk /*!< Pin 3 selected */ +#define AFIO_EVCR_PIN_PX4_Pos (2U) +#define AFIO_EVCR_PIN_PX4_Msk (0x1UL << AFIO_EVCR_PIN_PX4_Pos) /*!< 0x00000004 */ +#define AFIO_EVCR_PIN_PX4 AFIO_EVCR_PIN_PX4_Msk /*!< Pin 4 selected */ +#define AFIO_EVCR_PIN_PX5_Pos (0U) +#define AFIO_EVCR_PIN_PX5_Msk (0x5UL << AFIO_EVCR_PIN_PX5_Pos) /*!< 0x00000005 */ +#define AFIO_EVCR_PIN_PX5 AFIO_EVCR_PIN_PX5_Msk /*!< Pin 5 selected */ +#define AFIO_EVCR_PIN_PX6_Pos (1U) +#define AFIO_EVCR_PIN_PX6_Msk (0x3UL << AFIO_EVCR_PIN_PX6_Pos) /*!< 0x00000006 */ +#define AFIO_EVCR_PIN_PX6 AFIO_EVCR_PIN_PX6_Msk /*!< Pin 6 selected */ +#define AFIO_EVCR_PIN_PX7_Pos (0U) +#define AFIO_EVCR_PIN_PX7_Msk (0x7UL << AFIO_EVCR_PIN_PX7_Pos) /*!< 0x00000007 */ +#define AFIO_EVCR_PIN_PX7 AFIO_EVCR_PIN_PX7_Msk /*!< Pin 7 selected */ +#define AFIO_EVCR_PIN_PX8_Pos (3U) +#define AFIO_EVCR_PIN_PX8_Msk (0x1UL << AFIO_EVCR_PIN_PX8_Pos) /*!< 0x00000008 */ +#define AFIO_EVCR_PIN_PX8 AFIO_EVCR_PIN_PX8_Msk /*!< Pin 8 selected */ +#define AFIO_EVCR_PIN_PX9_Pos (0U) +#define AFIO_EVCR_PIN_PX9_Msk (0x9UL << AFIO_EVCR_PIN_PX9_Pos) /*!< 0x00000009 */ +#define AFIO_EVCR_PIN_PX9 AFIO_EVCR_PIN_PX9_Msk /*!< Pin 9 selected */ +#define AFIO_EVCR_PIN_PX10_Pos (1U) +#define AFIO_EVCR_PIN_PX10_Msk (0x5UL << AFIO_EVCR_PIN_PX10_Pos) /*!< 0x0000000A */ +#define AFIO_EVCR_PIN_PX10 AFIO_EVCR_PIN_PX10_Msk /*!< Pin 10 selected */ +#define AFIO_EVCR_PIN_PX11_Pos (0U) +#define AFIO_EVCR_PIN_PX11_Msk (0xBUL << AFIO_EVCR_PIN_PX11_Pos) /*!< 0x0000000B */ +#define AFIO_EVCR_PIN_PX11 AFIO_EVCR_PIN_PX11_Msk /*!< Pin 11 selected */ +#define AFIO_EVCR_PIN_PX12_Pos (2U) +#define AFIO_EVCR_PIN_PX12_Msk (0x3UL << AFIO_EVCR_PIN_PX12_Pos) /*!< 0x0000000C */ +#define AFIO_EVCR_PIN_PX12 AFIO_EVCR_PIN_PX12_Msk /*!< Pin 12 selected */ +#define AFIO_EVCR_PIN_PX13_Pos (0U) +#define AFIO_EVCR_PIN_PX13_Msk (0xDUL << AFIO_EVCR_PIN_PX13_Pos) /*!< 0x0000000D */ +#define AFIO_EVCR_PIN_PX13 AFIO_EVCR_PIN_PX13_Msk /*!< Pin 13 selected */ +#define AFIO_EVCR_PIN_PX14_Pos (1U) +#define AFIO_EVCR_PIN_PX14_Msk (0x7UL << AFIO_EVCR_PIN_PX14_Pos) /*!< 0x0000000E */ +#define AFIO_EVCR_PIN_PX14 AFIO_EVCR_PIN_PX14_Msk /*!< Pin 14 selected */ +#define AFIO_EVCR_PIN_PX15_Pos (0U) +#define AFIO_EVCR_PIN_PX15_Msk (0xFUL << AFIO_EVCR_PIN_PX15_Pos) /*!< 0x0000000F */ +#define AFIO_EVCR_PIN_PX15 AFIO_EVCR_PIN_PX15_Msk /*!< Pin 15 selected */ + +#define AFIO_EVCR_PORT_Pos (4U) +#define AFIO_EVCR_PORT_Msk (0x7UL << AFIO_EVCR_PORT_Pos) /*!< 0x00000070 */ +#define AFIO_EVCR_PORT AFIO_EVCR_PORT_Msk /*!< PORT[2:0] bits (Port selection) */ +#define AFIO_EVCR_PORT_0 (0x1UL << AFIO_EVCR_PORT_Pos) /*!< 0x00000010 */ +#define AFIO_EVCR_PORT_1 (0x2UL << AFIO_EVCR_PORT_Pos) /*!< 0x00000020 */ +#define AFIO_EVCR_PORT_2 (0x4UL << AFIO_EVCR_PORT_Pos) /*!< 0x00000040 */ + +/*!< PORT configuration */ +#define AFIO_EVCR_PORT_PA 0x00000000 /*!< Port A selected */ +#define AFIO_EVCR_PORT_PB_Pos (4U) +#define AFIO_EVCR_PORT_PB_Msk (0x1UL << AFIO_EVCR_PORT_PB_Pos) /*!< 0x00000010 */ +#define AFIO_EVCR_PORT_PB AFIO_EVCR_PORT_PB_Msk /*!< Port B selected */ +#define AFIO_EVCR_PORT_PC_Pos (5U) +#define AFIO_EVCR_PORT_PC_Msk (0x1UL << AFIO_EVCR_PORT_PC_Pos) /*!< 0x00000020 */ +#define AFIO_EVCR_PORT_PC AFIO_EVCR_PORT_PC_Msk /*!< Port C selected */ +#define AFIO_EVCR_PORT_PD_Pos (4U) +#define AFIO_EVCR_PORT_PD_Msk (0x3UL << AFIO_EVCR_PORT_PD_Pos) /*!< 0x00000030 */ +#define AFIO_EVCR_PORT_PD AFIO_EVCR_PORT_PD_Msk /*!< Port D selected */ +#define AFIO_EVCR_PORT_PE_Pos (6U) +#define AFIO_EVCR_PORT_PE_Msk (0x1UL << AFIO_EVCR_PORT_PE_Pos) /*!< 0x00000040 */ +#define AFIO_EVCR_PORT_PE AFIO_EVCR_PORT_PE_Msk /*!< Port E selected */ + +#define AFIO_EVCR_EVOE_Pos (7U) +#define AFIO_EVCR_EVOE_Msk (0x1UL << AFIO_EVCR_EVOE_Pos) /*!< 0x00000080 */ +#define AFIO_EVCR_EVOE AFIO_EVCR_EVOE_Msk /*!< Event Output Enable */ + +/****************** Bit definition for AFIO_MAPR register *******************/ +#define AFIO_MAPR_SPI1_REMAP_Pos (0U) +#define AFIO_MAPR_SPI1_REMAP_Msk (0x1UL << AFIO_MAPR_SPI1_REMAP_Pos) /*!< 0x00000001 */ +#define AFIO_MAPR_SPI1_REMAP AFIO_MAPR_SPI1_REMAP_Msk /*!< SPI1 remapping */ +#define AFIO_MAPR_I2C1_REMAP_Pos (1U) +#define AFIO_MAPR_I2C1_REMAP_Msk (0x1UL << AFIO_MAPR_I2C1_REMAP_Pos) /*!< 0x00000002 */ +#define AFIO_MAPR_I2C1_REMAP AFIO_MAPR_I2C1_REMAP_Msk /*!< I2C1 remapping */ +#define AFIO_MAPR_USART1_REMAP_Pos (2U) +#define AFIO_MAPR_USART1_REMAP_Msk (0x1UL << AFIO_MAPR_USART1_REMAP_Pos) /*!< 0x00000004 */ +#define AFIO_MAPR_USART1_REMAP AFIO_MAPR_USART1_REMAP_Msk /*!< USART1 remapping */ +#define AFIO_MAPR_USART2_REMAP_Pos (3U) +#define AFIO_MAPR_USART2_REMAP_Msk (0x1UL << AFIO_MAPR_USART2_REMAP_Pos) /*!< 0x00000008 */ +#define AFIO_MAPR_USART2_REMAP AFIO_MAPR_USART2_REMAP_Msk /*!< USART2 remapping */ + +#define AFIO_MAPR_USART3_REMAP_Pos (4U) +#define AFIO_MAPR_USART3_REMAP_Msk (0x3UL << AFIO_MAPR_USART3_REMAP_Pos) /*!< 0x00000030 */ +#define AFIO_MAPR_USART3_REMAP AFIO_MAPR_USART3_REMAP_Msk /*!< USART3_REMAP[1:0] bits (USART3 remapping) */ +#define AFIO_MAPR_USART3_REMAP_0 (0x1UL << AFIO_MAPR_USART3_REMAP_Pos) /*!< 0x00000010 */ +#define AFIO_MAPR_USART3_REMAP_1 (0x2UL << AFIO_MAPR_USART3_REMAP_Pos) /*!< 0x00000020 */ + +/* USART3_REMAP configuration */ +#define AFIO_MAPR_USART3_REMAP_NOREMAP 0x00000000U /*!< No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14) */ +#define AFIO_MAPR_USART3_REMAP_PARTIALREMAP_Pos (4U) +#define AFIO_MAPR_USART3_REMAP_PARTIALREMAP_Msk (0x1UL << AFIO_MAPR_USART3_REMAP_PARTIALREMAP_Pos) /*!< 0x00000010 */ +#define AFIO_MAPR_USART3_REMAP_PARTIALREMAP AFIO_MAPR_USART3_REMAP_PARTIALREMAP_Msk /*!< Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14) */ +#define AFIO_MAPR_USART3_REMAP_FULLREMAP_Pos (4U) +#define AFIO_MAPR_USART3_REMAP_FULLREMAP_Msk (0x3UL << AFIO_MAPR_USART3_REMAP_FULLREMAP_Pos) /*!< 0x00000030 */ +#define AFIO_MAPR_USART3_REMAP_FULLREMAP AFIO_MAPR_USART3_REMAP_FULLREMAP_Msk /*!< Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12) */ + +#define AFIO_MAPR_TIM1_REMAP_Pos (6U) +#define AFIO_MAPR_TIM1_REMAP_Msk (0x3UL << AFIO_MAPR_TIM1_REMAP_Pos) /*!< 0x000000C0 */ +#define AFIO_MAPR_TIM1_REMAP AFIO_MAPR_TIM1_REMAP_Msk /*!< TIM1_REMAP[1:0] bits (TIM1 remapping) */ +#define AFIO_MAPR_TIM1_REMAP_0 (0x1UL << AFIO_MAPR_TIM1_REMAP_Pos) /*!< 0x00000040 */ +#define AFIO_MAPR_TIM1_REMAP_1 (0x2UL << AFIO_MAPR_TIM1_REMAP_Pos) /*!< 0x00000080 */ + +/*!< TIM1_REMAP configuration */ +#define AFIO_MAPR_TIM1_REMAP_NOREMAP 0x00000000U /*!< No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15) */ +#define AFIO_MAPR_TIM1_REMAP_PARTIALREMAP_Pos (6U) +#define AFIO_MAPR_TIM1_REMAP_PARTIALREMAP_Msk (0x1UL << AFIO_MAPR_TIM1_REMAP_PARTIALREMAP_Pos) /*!< 0x00000040 */ +#define AFIO_MAPR_TIM1_REMAP_PARTIALREMAP AFIO_MAPR_TIM1_REMAP_PARTIALREMAP_Msk /*!< Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1) */ +#define AFIO_MAPR_TIM1_REMAP_FULLREMAP_Pos (6U) +#define AFIO_MAPR_TIM1_REMAP_FULLREMAP_Msk (0x3UL << AFIO_MAPR_TIM1_REMAP_FULLREMAP_Pos) /*!< 0x000000C0 */ +#define AFIO_MAPR_TIM1_REMAP_FULLREMAP AFIO_MAPR_TIM1_REMAP_FULLREMAP_Msk /*!< Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12) */ + +#define AFIO_MAPR_TIM2_REMAP_Pos (8U) +#define AFIO_MAPR_TIM2_REMAP_Msk (0x3UL << AFIO_MAPR_TIM2_REMAP_Pos) /*!< 0x00000300 */ +#define AFIO_MAPR_TIM2_REMAP AFIO_MAPR_TIM2_REMAP_Msk /*!< TIM2_REMAP[1:0] bits (TIM2 remapping) */ +#define AFIO_MAPR_TIM2_REMAP_0 (0x1UL << AFIO_MAPR_TIM2_REMAP_Pos) /*!< 0x00000100 */ +#define AFIO_MAPR_TIM2_REMAP_1 (0x2UL << AFIO_MAPR_TIM2_REMAP_Pos) /*!< 0x00000200 */ + +/*!< TIM2_REMAP configuration */ +#define AFIO_MAPR_TIM2_REMAP_NOREMAP 0x00000000U /*!< No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3) */ +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1_Pos (8U) +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1_Msk (0x1UL << AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1_Pos) /*!< 0x00000100 */ +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1 AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1_Msk /*!< Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3) */ +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2_Pos (9U) +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2_Msk (0x1UL << AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2_Pos) /*!< 0x00000200 */ +#define AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2 AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2_Msk /*!< Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11) */ +#define AFIO_MAPR_TIM2_REMAP_FULLREMAP_Pos (8U) +#define AFIO_MAPR_TIM2_REMAP_FULLREMAP_Msk (0x3UL << AFIO_MAPR_TIM2_REMAP_FULLREMAP_Pos) /*!< 0x00000300 */ +#define AFIO_MAPR_TIM2_REMAP_FULLREMAP AFIO_MAPR_TIM2_REMAP_FULLREMAP_Msk /*!< Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11) */ + +#define AFIO_MAPR_TIM3_REMAP_Pos (10U) +#define AFIO_MAPR_TIM3_REMAP_Msk (0x3UL << AFIO_MAPR_TIM3_REMAP_Pos) /*!< 0x00000C00 */ +#define AFIO_MAPR_TIM3_REMAP AFIO_MAPR_TIM3_REMAP_Msk /*!< TIM3_REMAP[1:0] bits (TIM3 remapping) */ +#define AFIO_MAPR_TIM3_REMAP_0 (0x1UL << AFIO_MAPR_TIM3_REMAP_Pos) /*!< 0x00000400 */ +#define AFIO_MAPR_TIM3_REMAP_1 (0x2UL << AFIO_MAPR_TIM3_REMAP_Pos) /*!< 0x00000800 */ + +/*!< TIM3_REMAP configuration */ +#define AFIO_MAPR_TIM3_REMAP_NOREMAP 0x00000000U /*!< No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1) */ +#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP_Pos (11U) +#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP_Msk (0x1UL << AFIO_MAPR_TIM3_REMAP_PARTIALREMAP_Pos) /*!< 0x00000800 */ +#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP AFIO_MAPR_TIM3_REMAP_PARTIALREMAP_Msk /*!< Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1) */ +#define AFIO_MAPR_TIM3_REMAP_FULLREMAP_Pos (10U) +#define AFIO_MAPR_TIM3_REMAP_FULLREMAP_Msk (0x3UL << AFIO_MAPR_TIM3_REMAP_FULLREMAP_Pos) /*!< 0x00000C00 */ +#define AFIO_MAPR_TIM3_REMAP_FULLREMAP AFIO_MAPR_TIM3_REMAP_FULLREMAP_Msk /*!< Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9) */ + +#define AFIO_MAPR_TIM4_REMAP_Pos (12U) +#define AFIO_MAPR_TIM4_REMAP_Msk (0x1UL << AFIO_MAPR_TIM4_REMAP_Pos) /*!< 0x00001000 */ +#define AFIO_MAPR_TIM4_REMAP AFIO_MAPR_TIM4_REMAP_Msk /*!< TIM4_REMAP bit (TIM4 remapping) */ + +#define AFIO_MAPR_CAN_REMAP_Pos (13U) +#define AFIO_MAPR_CAN_REMAP_Msk (0x3UL << AFIO_MAPR_CAN_REMAP_Pos) /*!< 0x00006000 */ +#define AFIO_MAPR_CAN_REMAP AFIO_MAPR_CAN_REMAP_Msk /*!< CAN_REMAP[1:0] bits (CAN Alternate function remapping) */ +#define AFIO_MAPR_CAN_REMAP_0 (0x1UL << AFIO_MAPR_CAN_REMAP_Pos) /*!< 0x00002000 */ +#define AFIO_MAPR_CAN_REMAP_1 (0x2UL << AFIO_MAPR_CAN_REMAP_Pos) /*!< 0x00004000 */ + +/*!< CAN_REMAP configuration */ +#define AFIO_MAPR_CAN_REMAP_REMAP1 0x00000000U /*!< CANRX mapped to PA11, CANTX mapped to PA12 */ +#define AFIO_MAPR_CAN_REMAP_REMAP2_Pos (14U) +#define AFIO_MAPR_CAN_REMAP_REMAP2_Msk (0x1UL << AFIO_MAPR_CAN_REMAP_REMAP2_Pos) /*!< 0x00004000 */ +#define AFIO_MAPR_CAN_REMAP_REMAP2 AFIO_MAPR_CAN_REMAP_REMAP2_Msk /*!< CANRX mapped to PB8, CANTX mapped to PB9 */ +#define AFIO_MAPR_CAN_REMAP_REMAP3_Pos (13U) +#define AFIO_MAPR_CAN_REMAP_REMAP3_Msk (0x3UL << AFIO_MAPR_CAN_REMAP_REMAP3_Pos) /*!< 0x00006000 */ +#define AFIO_MAPR_CAN_REMAP_REMAP3 AFIO_MAPR_CAN_REMAP_REMAP3_Msk /*!< CANRX mapped to PD0, CANTX mapped to PD1 */ + +#define AFIO_MAPR_PD01_REMAP_Pos (15U) +#define AFIO_MAPR_PD01_REMAP_Msk (0x1UL << AFIO_MAPR_PD01_REMAP_Pos) /*!< 0x00008000 */ +#define AFIO_MAPR_PD01_REMAP AFIO_MAPR_PD01_REMAP_Msk /*!< Port D0/Port D1 mapping on OSC_IN/OSC_OUT */ +#define AFIO_MAPR_TIM5CH4_IREMAP_Pos (16U) +#define AFIO_MAPR_TIM5CH4_IREMAP_Msk (0x1UL << AFIO_MAPR_TIM5CH4_IREMAP_Pos) /*!< 0x00010000 */ +#define AFIO_MAPR_TIM5CH4_IREMAP AFIO_MAPR_TIM5CH4_IREMAP_Msk /*!< TIM5 Channel4 Internal Remap */ +#define AFIO_MAPR_ADC1_ETRGINJ_REMAP_Pos (17U) +#define AFIO_MAPR_ADC1_ETRGINJ_REMAP_Msk (0x1UL << AFIO_MAPR_ADC1_ETRGINJ_REMAP_Pos) /*!< 0x00020000 */ +#define AFIO_MAPR_ADC1_ETRGINJ_REMAP AFIO_MAPR_ADC1_ETRGINJ_REMAP_Msk /*!< ADC 1 External Trigger Injected Conversion remapping */ +#define AFIO_MAPR_ADC1_ETRGREG_REMAP_Pos (18U) +#define AFIO_MAPR_ADC1_ETRGREG_REMAP_Msk (0x1UL << AFIO_MAPR_ADC1_ETRGREG_REMAP_Pos) /*!< 0x00040000 */ +#define AFIO_MAPR_ADC1_ETRGREG_REMAP AFIO_MAPR_ADC1_ETRGREG_REMAP_Msk /*!< ADC 1 External Trigger Regular Conversion remapping */ +#define AFIO_MAPR_ADC2_ETRGINJ_REMAP_Pos (19U) +#define AFIO_MAPR_ADC2_ETRGINJ_REMAP_Msk (0x1UL << AFIO_MAPR_ADC2_ETRGINJ_REMAP_Pos) /*!< 0x00080000 */ +#define AFIO_MAPR_ADC2_ETRGINJ_REMAP AFIO_MAPR_ADC2_ETRGINJ_REMAP_Msk /*!< ADC 2 External Trigger Injected Conversion remapping */ +#define AFIO_MAPR_ADC2_ETRGREG_REMAP_Pos (20U) +#define AFIO_MAPR_ADC2_ETRGREG_REMAP_Msk (0x1UL << AFIO_MAPR_ADC2_ETRGREG_REMAP_Pos) /*!< 0x00100000 */ +#define AFIO_MAPR_ADC2_ETRGREG_REMAP AFIO_MAPR_ADC2_ETRGREG_REMAP_Msk /*!< ADC 2 External Trigger Regular Conversion remapping */ + +/*!< SWJ_CFG configuration */ +#define AFIO_MAPR_SWJ_CFG_Pos (24U) +#define AFIO_MAPR_SWJ_CFG_Msk (0x7UL << AFIO_MAPR_SWJ_CFG_Pos) /*!< 0x07000000 */ +#define AFIO_MAPR_SWJ_CFG AFIO_MAPR_SWJ_CFG_Msk /*!< SWJ_CFG[2:0] bits (Serial Wire JTAG configuration) */ +#define AFIO_MAPR_SWJ_CFG_0 (0x1UL << AFIO_MAPR_SWJ_CFG_Pos) /*!< 0x01000000 */ +#define AFIO_MAPR_SWJ_CFG_1 (0x2UL << AFIO_MAPR_SWJ_CFG_Pos) /*!< 0x02000000 */ +#define AFIO_MAPR_SWJ_CFG_2 (0x4UL << AFIO_MAPR_SWJ_CFG_Pos) /*!< 0x04000000 */ + +#define AFIO_MAPR_SWJ_CFG_RESET 0x00000000U /*!< Full SWJ (JTAG-DP + SW-DP) : Reset State */ +#define AFIO_MAPR_SWJ_CFG_NOJNTRST_Pos (24U) +#define AFIO_MAPR_SWJ_CFG_NOJNTRST_Msk (0x1UL << AFIO_MAPR_SWJ_CFG_NOJNTRST_Pos) /*!< 0x01000000 */ +#define AFIO_MAPR_SWJ_CFG_NOJNTRST AFIO_MAPR_SWJ_CFG_NOJNTRST_Msk /*!< Full SWJ (JTAG-DP + SW-DP) but without JNTRST */ +#define AFIO_MAPR_SWJ_CFG_JTAGDISABLE_Pos (25U) +#define AFIO_MAPR_SWJ_CFG_JTAGDISABLE_Msk (0x1UL << AFIO_MAPR_SWJ_CFG_JTAGDISABLE_Pos) /*!< 0x02000000 */ +#define AFIO_MAPR_SWJ_CFG_JTAGDISABLE AFIO_MAPR_SWJ_CFG_JTAGDISABLE_Msk /*!< JTAG-DP Disabled and SW-DP Enabled */ +#define AFIO_MAPR_SWJ_CFG_DISABLE_Pos (26U) +#define AFIO_MAPR_SWJ_CFG_DISABLE_Msk (0x1UL << AFIO_MAPR_SWJ_CFG_DISABLE_Pos) /*!< 0x04000000 */ +#define AFIO_MAPR_SWJ_CFG_DISABLE AFIO_MAPR_SWJ_CFG_DISABLE_Msk /*!< JTAG-DP Disabled and SW-DP Disabled */ + + +/***************** Bit definition for AFIO_EXTICR1 register *****************/ +#define AFIO_EXTICR1_EXTI0_Pos (0U) +#define AFIO_EXTICR1_EXTI0_Msk (0xFUL << AFIO_EXTICR1_EXTI0_Pos) /*!< 0x0000000F */ +#define AFIO_EXTICR1_EXTI0 AFIO_EXTICR1_EXTI0_Msk /*!< EXTI 0 configuration */ +#define AFIO_EXTICR1_EXTI1_Pos (4U) +#define AFIO_EXTICR1_EXTI1_Msk (0xFUL << AFIO_EXTICR1_EXTI1_Pos) /*!< 0x000000F0 */ +#define AFIO_EXTICR1_EXTI1 AFIO_EXTICR1_EXTI1_Msk /*!< EXTI 1 configuration */ +#define AFIO_EXTICR1_EXTI2_Pos (8U) +#define AFIO_EXTICR1_EXTI2_Msk (0xFUL << AFIO_EXTICR1_EXTI2_Pos) /*!< 0x00000F00 */ +#define AFIO_EXTICR1_EXTI2 AFIO_EXTICR1_EXTI2_Msk /*!< EXTI 2 configuration */ +#define AFIO_EXTICR1_EXTI3_Pos (12U) +#define AFIO_EXTICR1_EXTI3_Msk (0xFUL << AFIO_EXTICR1_EXTI3_Pos) /*!< 0x0000F000 */ +#define AFIO_EXTICR1_EXTI3 AFIO_EXTICR1_EXTI3_Msk /*!< EXTI 3 configuration */ + +/*!< EXTI0 configuration */ +#define AFIO_EXTICR1_EXTI0_PA 0x00000000U /*!< PA[0] pin */ +#define AFIO_EXTICR1_EXTI0_PB_Pos (0U) +#define AFIO_EXTICR1_EXTI0_PB_Msk (0x1UL << AFIO_EXTICR1_EXTI0_PB_Pos) /*!< 0x00000001 */ +#define AFIO_EXTICR1_EXTI0_PB AFIO_EXTICR1_EXTI0_PB_Msk /*!< PB[0] pin */ +#define AFIO_EXTICR1_EXTI0_PC_Pos (1U) +#define AFIO_EXTICR1_EXTI0_PC_Msk (0x1UL << AFIO_EXTICR1_EXTI0_PC_Pos) /*!< 0x00000002 */ +#define AFIO_EXTICR1_EXTI0_PC AFIO_EXTICR1_EXTI0_PC_Msk /*!< PC[0] pin */ +#define AFIO_EXTICR1_EXTI0_PD_Pos (0U) +#define AFIO_EXTICR1_EXTI0_PD_Msk (0x3UL << AFIO_EXTICR1_EXTI0_PD_Pos) /*!< 0x00000003 */ +#define AFIO_EXTICR1_EXTI0_PD AFIO_EXTICR1_EXTI0_PD_Msk /*!< PD[0] pin */ +#define AFIO_EXTICR1_EXTI0_PE_Pos (2U) +#define AFIO_EXTICR1_EXTI0_PE_Msk (0x1UL << AFIO_EXTICR1_EXTI0_PE_Pos) /*!< 0x00000004 */ +#define AFIO_EXTICR1_EXTI0_PE AFIO_EXTICR1_EXTI0_PE_Msk /*!< PE[0] pin */ +#define AFIO_EXTICR1_EXTI0_PF_Pos (0U) +#define AFIO_EXTICR1_EXTI0_PF_Msk (0x5UL << AFIO_EXTICR1_EXTI0_PF_Pos) /*!< 0x00000005 */ +#define AFIO_EXTICR1_EXTI0_PF AFIO_EXTICR1_EXTI0_PF_Msk /*!< PF[0] pin */ +#define AFIO_EXTICR1_EXTI0_PG_Pos (1U) +#define AFIO_EXTICR1_EXTI0_PG_Msk (0x3UL << AFIO_EXTICR1_EXTI0_PG_Pos) /*!< 0x00000006 */ +#define AFIO_EXTICR1_EXTI0_PG AFIO_EXTICR1_EXTI0_PG_Msk /*!< PG[0] pin */ + +/*!< EXTI1 configuration */ +#define AFIO_EXTICR1_EXTI1_PA 0x00000000U /*!< PA[1] pin */ +#define AFIO_EXTICR1_EXTI1_PB_Pos (4U) +#define AFIO_EXTICR1_EXTI1_PB_Msk (0x1UL << AFIO_EXTICR1_EXTI1_PB_Pos) /*!< 0x00000010 */ +#define AFIO_EXTICR1_EXTI1_PB AFIO_EXTICR1_EXTI1_PB_Msk /*!< PB[1] pin */ +#define AFIO_EXTICR1_EXTI1_PC_Pos (5U) +#define AFIO_EXTICR1_EXTI1_PC_Msk (0x1UL << AFIO_EXTICR1_EXTI1_PC_Pos) /*!< 0x00000020 */ +#define AFIO_EXTICR1_EXTI1_PC AFIO_EXTICR1_EXTI1_PC_Msk /*!< PC[1] pin */ +#define AFIO_EXTICR1_EXTI1_PD_Pos (4U) +#define AFIO_EXTICR1_EXTI1_PD_Msk (0x3UL << AFIO_EXTICR1_EXTI1_PD_Pos) /*!< 0x00000030 */ +#define AFIO_EXTICR1_EXTI1_PD AFIO_EXTICR1_EXTI1_PD_Msk /*!< PD[1] pin */ +#define AFIO_EXTICR1_EXTI1_PE_Pos (6U) +#define AFIO_EXTICR1_EXTI1_PE_Msk (0x1UL << AFIO_EXTICR1_EXTI1_PE_Pos) /*!< 0x00000040 */ +#define AFIO_EXTICR1_EXTI1_PE AFIO_EXTICR1_EXTI1_PE_Msk /*!< PE[1] pin */ +#define AFIO_EXTICR1_EXTI1_PF_Pos (4U) +#define AFIO_EXTICR1_EXTI1_PF_Msk (0x5UL << AFIO_EXTICR1_EXTI1_PF_Pos) /*!< 0x00000050 */ +#define AFIO_EXTICR1_EXTI1_PF AFIO_EXTICR1_EXTI1_PF_Msk /*!< PF[1] pin */ +#define AFIO_EXTICR1_EXTI1_PG_Pos (5U) +#define AFIO_EXTICR1_EXTI1_PG_Msk (0x3UL << AFIO_EXTICR1_EXTI1_PG_Pos) /*!< 0x00000060 */ +#define AFIO_EXTICR1_EXTI1_PG AFIO_EXTICR1_EXTI1_PG_Msk /*!< PG[1] pin */ + +/*!< EXTI2 configuration */ +#define AFIO_EXTICR1_EXTI2_PA 0x00000000U /*!< PA[2] pin */ +#define AFIO_EXTICR1_EXTI2_PB_Pos (8U) +#define AFIO_EXTICR1_EXTI2_PB_Msk (0x1UL << AFIO_EXTICR1_EXTI2_PB_Pos) /*!< 0x00000100 */ +#define AFIO_EXTICR1_EXTI2_PB AFIO_EXTICR1_EXTI2_PB_Msk /*!< PB[2] pin */ +#define AFIO_EXTICR1_EXTI2_PC_Pos (9U) +#define AFIO_EXTICR1_EXTI2_PC_Msk (0x1UL << AFIO_EXTICR1_EXTI2_PC_Pos) /*!< 0x00000200 */ +#define AFIO_EXTICR1_EXTI2_PC AFIO_EXTICR1_EXTI2_PC_Msk /*!< PC[2] pin */ +#define AFIO_EXTICR1_EXTI2_PD_Pos (8U) +#define AFIO_EXTICR1_EXTI2_PD_Msk (0x3UL << AFIO_EXTICR1_EXTI2_PD_Pos) /*!< 0x00000300 */ +#define AFIO_EXTICR1_EXTI2_PD AFIO_EXTICR1_EXTI2_PD_Msk /*!< PD[2] pin */ +#define AFIO_EXTICR1_EXTI2_PE_Pos (10U) +#define AFIO_EXTICR1_EXTI2_PE_Msk (0x1UL << AFIO_EXTICR1_EXTI2_PE_Pos) /*!< 0x00000400 */ +#define AFIO_EXTICR1_EXTI2_PE AFIO_EXTICR1_EXTI2_PE_Msk /*!< PE[2] pin */ +#define AFIO_EXTICR1_EXTI2_PF_Pos (8U) +#define AFIO_EXTICR1_EXTI2_PF_Msk (0x5UL << AFIO_EXTICR1_EXTI2_PF_Pos) /*!< 0x00000500 */ +#define AFIO_EXTICR1_EXTI2_PF AFIO_EXTICR1_EXTI2_PF_Msk /*!< PF[2] pin */ +#define AFIO_EXTICR1_EXTI2_PG_Pos (9U) +#define AFIO_EXTICR1_EXTI2_PG_Msk (0x3UL << AFIO_EXTICR1_EXTI2_PG_Pos) /*!< 0x00000600 */ +#define AFIO_EXTICR1_EXTI2_PG AFIO_EXTICR1_EXTI2_PG_Msk /*!< PG[2] pin */ + +/*!< EXTI3 configuration */ +#define AFIO_EXTICR1_EXTI3_PA 0x00000000U /*!< PA[3] pin */ +#define AFIO_EXTICR1_EXTI3_PB_Pos (12U) +#define AFIO_EXTICR1_EXTI3_PB_Msk (0x1UL << AFIO_EXTICR1_EXTI3_PB_Pos) /*!< 0x00001000 */ +#define AFIO_EXTICR1_EXTI3_PB AFIO_EXTICR1_EXTI3_PB_Msk /*!< PB[3] pin */ +#define AFIO_EXTICR1_EXTI3_PC_Pos (13U) +#define AFIO_EXTICR1_EXTI3_PC_Msk (0x1UL << AFIO_EXTICR1_EXTI3_PC_Pos) /*!< 0x00002000 */ +#define AFIO_EXTICR1_EXTI3_PC AFIO_EXTICR1_EXTI3_PC_Msk /*!< PC[3] pin */ +#define AFIO_EXTICR1_EXTI3_PD_Pos (12U) +#define AFIO_EXTICR1_EXTI3_PD_Msk (0x3UL << AFIO_EXTICR1_EXTI3_PD_Pos) /*!< 0x00003000 */ +#define AFIO_EXTICR1_EXTI3_PD AFIO_EXTICR1_EXTI3_PD_Msk /*!< PD[3] pin */ +#define AFIO_EXTICR1_EXTI3_PE_Pos (14U) +#define AFIO_EXTICR1_EXTI3_PE_Msk (0x1UL << AFIO_EXTICR1_EXTI3_PE_Pos) /*!< 0x00004000 */ +#define AFIO_EXTICR1_EXTI3_PE AFIO_EXTICR1_EXTI3_PE_Msk /*!< PE[3] pin */ +#define AFIO_EXTICR1_EXTI3_PF_Pos (12U) +#define AFIO_EXTICR1_EXTI3_PF_Msk (0x5UL << AFIO_EXTICR1_EXTI3_PF_Pos) /*!< 0x00005000 */ +#define AFIO_EXTICR1_EXTI3_PF AFIO_EXTICR1_EXTI3_PF_Msk /*!< PF[3] pin */ +#define AFIO_EXTICR1_EXTI3_PG_Pos (13U) +#define AFIO_EXTICR1_EXTI3_PG_Msk (0x3UL << AFIO_EXTICR1_EXTI3_PG_Pos) /*!< 0x00006000 */ +#define AFIO_EXTICR1_EXTI3_PG AFIO_EXTICR1_EXTI3_PG_Msk /*!< PG[3] pin */ + +/***************** Bit definition for AFIO_EXTICR2 register *****************/ +#define AFIO_EXTICR2_EXTI4_Pos (0U) +#define AFIO_EXTICR2_EXTI4_Msk (0xFUL << AFIO_EXTICR2_EXTI4_Pos) /*!< 0x0000000F */ +#define AFIO_EXTICR2_EXTI4 AFIO_EXTICR2_EXTI4_Msk /*!< EXTI 4 configuration */ +#define AFIO_EXTICR2_EXTI5_Pos (4U) +#define AFIO_EXTICR2_EXTI5_Msk (0xFUL << AFIO_EXTICR2_EXTI5_Pos) /*!< 0x000000F0 */ +#define AFIO_EXTICR2_EXTI5 AFIO_EXTICR2_EXTI5_Msk /*!< EXTI 5 configuration */ +#define AFIO_EXTICR2_EXTI6_Pos (8U) +#define AFIO_EXTICR2_EXTI6_Msk (0xFUL << AFIO_EXTICR2_EXTI6_Pos) /*!< 0x00000F00 */ +#define AFIO_EXTICR2_EXTI6 AFIO_EXTICR2_EXTI6_Msk /*!< EXTI 6 configuration */ +#define AFIO_EXTICR2_EXTI7_Pos (12U) +#define AFIO_EXTICR2_EXTI7_Msk (0xFUL << AFIO_EXTICR2_EXTI7_Pos) /*!< 0x0000F000 */ +#define AFIO_EXTICR2_EXTI7 AFIO_EXTICR2_EXTI7_Msk /*!< EXTI 7 configuration */ + +/*!< EXTI4 configuration */ +#define AFIO_EXTICR2_EXTI4_PA 0x00000000U /*!< PA[4] pin */ +#define AFIO_EXTICR2_EXTI4_PB_Pos (0U) +#define AFIO_EXTICR2_EXTI4_PB_Msk (0x1UL << AFIO_EXTICR2_EXTI4_PB_Pos) /*!< 0x00000001 */ +#define AFIO_EXTICR2_EXTI4_PB AFIO_EXTICR2_EXTI4_PB_Msk /*!< PB[4] pin */ +#define AFIO_EXTICR2_EXTI4_PC_Pos (1U) +#define AFIO_EXTICR2_EXTI4_PC_Msk (0x1UL << AFIO_EXTICR2_EXTI4_PC_Pos) /*!< 0x00000002 */ +#define AFIO_EXTICR2_EXTI4_PC AFIO_EXTICR2_EXTI4_PC_Msk /*!< PC[4] pin */ +#define AFIO_EXTICR2_EXTI4_PD_Pos (0U) +#define AFIO_EXTICR2_EXTI4_PD_Msk (0x3UL << AFIO_EXTICR2_EXTI4_PD_Pos) /*!< 0x00000003 */ +#define AFIO_EXTICR2_EXTI4_PD AFIO_EXTICR2_EXTI4_PD_Msk /*!< PD[4] pin */ +#define AFIO_EXTICR2_EXTI4_PE_Pos (2U) +#define AFIO_EXTICR2_EXTI4_PE_Msk (0x1UL << AFIO_EXTICR2_EXTI4_PE_Pos) /*!< 0x00000004 */ +#define AFIO_EXTICR2_EXTI4_PE AFIO_EXTICR2_EXTI4_PE_Msk /*!< PE[4] pin */ +#define AFIO_EXTICR2_EXTI4_PF_Pos (0U) +#define AFIO_EXTICR2_EXTI4_PF_Msk (0x5UL << AFIO_EXTICR2_EXTI4_PF_Pos) /*!< 0x00000005 */ +#define AFIO_EXTICR2_EXTI4_PF AFIO_EXTICR2_EXTI4_PF_Msk /*!< PF[4] pin */ +#define AFIO_EXTICR2_EXTI4_PG_Pos (1U) +#define AFIO_EXTICR2_EXTI4_PG_Msk (0x3UL << AFIO_EXTICR2_EXTI4_PG_Pos) /*!< 0x00000006 */ +#define AFIO_EXTICR2_EXTI4_PG AFIO_EXTICR2_EXTI4_PG_Msk /*!< PG[4] pin */ + +/* EXTI5 configuration */ +#define AFIO_EXTICR2_EXTI5_PA 0x00000000U /*!< PA[5] pin */ +#define AFIO_EXTICR2_EXTI5_PB_Pos (4U) +#define AFIO_EXTICR2_EXTI5_PB_Msk (0x1UL << AFIO_EXTICR2_EXTI5_PB_Pos) /*!< 0x00000010 */ +#define AFIO_EXTICR2_EXTI5_PB AFIO_EXTICR2_EXTI5_PB_Msk /*!< PB[5] pin */ +#define AFIO_EXTICR2_EXTI5_PC_Pos (5U) +#define AFIO_EXTICR2_EXTI5_PC_Msk (0x1UL << AFIO_EXTICR2_EXTI5_PC_Pos) /*!< 0x00000020 */ +#define AFIO_EXTICR2_EXTI5_PC AFIO_EXTICR2_EXTI5_PC_Msk /*!< PC[5] pin */ +#define AFIO_EXTICR2_EXTI5_PD_Pos (4U) +#define AFIO_EXTICR2_EXTI5_PD_Msk (0x3UL << AFIO_EXTICR2_EXTI5_PD_Pos) /*!< 0x00000030 */ +#define AFIO_EXTICR2_EXTI5_PD AFIO_EXTICR2_EXTI5_PD_Msk /*!< PD[5] pin */ +#define AFIO_EXTICR2_EXTI5_PE_Pos (6U) +#define AFIO_EXTICR2_EXTI5_PE_Msk (0x1UL << AFIO_EXTICR2_EXTI5_PE_Pos) /*!< 0x00000040 */ +#define AFIO_EXTICR2_EXTI5_PE AFIO_EXTICR2_EXTI5_PE_Msk /*!< PE[5] pin */ +#define AFIO_EXTICR2_EXTI5_PF_Pos (4U) +#define AFIO_EXTICR2_EXTI5_PF_Msk (0x5UL << AFIO_EXTICR2_EXTI5_PF_Pos) /*!< 0x00000050 */ +#define AFIO_EXTICR2_EXTI5_PF AFIO_EXTICR2_EXTI5_PF_Msk /*!< PF[5] pin */ +#define AFIO_EXTICR2_EXTI5_PG_Pos (5U) +#define AFIO_EXTICR2_EXTI5_PG_Msk (0x3UL << AFIO_EXTICR2_EXTI5_PG_Pos) /*!< 0x00000060 */ +#define AFIO_EXTICR2_EXTI5_PG AFIO_EXTICR2_EXTI5_PG_Msk /*!< PG[5] pin */ + +/*!< EXTI6 configuration */ +#define AFIO_EXTICR2_EXTI6_PA 0x00000000U /*!< PA[6] pin */ +#define AFIO_EXTICR2_EXTI6_PB_Pos (8U) +#define AFIO_EXTICR2_EXTI6_PB_Msk (0x1UL << AFIO_EXTICR2_EXTI6_PB_Pos) /*!< 0x00000100 */ +#define AFIO_EXTICR2_EXTI6_PB AFIO_EXTICR2_EXTI6_PB_Msk /*!< PB[6] pin */ +#define AFIO_EXTICR2_EXTI6_PC_Pos (9U) +#define AFIO_EXTICR2_EXTI6_PC_Msk (0x1UL << AFIO_EXTICR2_EXTI6_PC_Pos) /*!< 0x00000200 */ +#define AFIO_EXTICR2_EXTI6_PC AFIO_EXTICR2_EXTI6_PC_Msk /*!< PC[6] pin */ +#define AFIO_EXTICR2_EXTI6_PD_Pos (8U) +#define AFIO_EXTICR2_EXTI6_PD_Msk (0x3UL << AFIO_EXTICR2_EXTI6_PD_Pos) /*!< 0x00000300 */ +#define AFIO_EXTICR2_EXTI6_PD AFIO_EXTICR2_EXTI6_PD_Msk /*!< PD[6] pin */ +#define AFIO_EXTICR2_EXTI6_PE_Pos (10U) +#define AFIO_EXTICR2_EXTI6_PE_Msk (0x1UL << AFIO_EXTICR2_EXTI6_PE_Pos) /*!< 0x00000400 */ +#define AFIO_EXTICR2_EXTI6_PE AFIO_EXTICR2_EXTI6_PE_Msk /*!< PE[6] pin */ +#define AFIO_EXTICR2_EXTI6_PF_Pos (8U) +#define AFIO_EXTICR2_EXTI6_PF_Msk (0x5UL << AFIO_EXTICR2_EXTI6_PF_Pos) /*!< 0x00000500 */ +#define AFIO_EXTICR2_EXTI6_PF AFIO_EXTICR2_EXTI6_PF_Msk /*!< PF[6] pin */ +#define AFIO_EXTICR2_EXTI6_PG_Pos (9U) +#define AFIO_EXTICR2_EXTI6_PG_Msk (0x3UL << AFIO_EXTICR2_EXTI6_PG_Pos) /*!< 0x00000600 */ +#define AFIO_EXTICR2_EXTI6_PG AFIO_EXTICR2_EXTI6_PG_Msk /*!< PG[6] pin */ + +/*!< EXTI7 configuration */ +#define AFIO_EXTICR2_EXTI7_PA 0x00000000U /*!< PA[7] pin */ +#define AFIO_EXTICR2_EXTI7_PB_Pos (12U) +#define AFIO_EXTICR2_EXTI7_PB_Msk (0x1UL << AFIO_EXTICR2_EXTI7_PB_Pos) /*!< 0x00001000 */ +#define AFIO_EXTICR2_EXTI7_PB AFIO_EXTICR2_EXTI7_PB_Msk /*!< PB[7] pin */ +#define AFIO_EXTICR2_EXTI7_PC_Pos (13U) +#define AFIO_EXTICR2_EXTI7_PC_Msk (0x1UL << AFIO_EXTICR2_EXTI7_PC_Pos) /*!< 0x00002000 */ +#define AFIO_EXTICR2_EXTI7_PC AFIO_EXTICR2_EXTI7_PC_Msk /*!< PC[7] pin */ +#define AFIO_EXTICR2_EXTI7_PD_Pos (12U) +#define AFIO_EXTICR2_EXTI7_PD_Msk (0x3UL << AFIO_EXTICR2_EXTI7_PD_Pos) /*!< 0x00003000 */ +#define AFIO_EXTICR2_EXTI7_PD AFIO_EXTICR2_EXTI7_PD_Msk /*!< PD[7] pin */ +#define AFIO_EXTICR2_EXTI7_PE_Pos (14U) +#define AFIO_EXTICR2_EXTI7_PE_Msk (0x1UL << AFIO_EXTICR2_EXTI7_PE_Pos) /*!< 0x00004000 */ +#define AFIO_EXTICR2_EXTI7_PE AFIO_EXTICR2_EXTI7_PE_Msk /*!< PE[7] pin */ +#define AFIO_EXTICR2_EXTI7_PF_Pos (12U) +#define AFIO_EXTICR2_EXTI7_PF_Msk (0x5UL << AFIO_EXTICR2_EXTI7_PF_Pos) /*!< 0x00005000 */ +#define AFIO_EXTICR2_EXTI7_PF AFIO_EXTICR2_EXTI7_PF_Msk /*!< PF[7] pin */ +#define AFIO_EXTICR2_EXTI7_PG_Pos (13U) +#define AFIO_EXTICR2_EXTI7_PG_Msk (0x3UL << AFIO_EXTICR2_EXTI7_PG_Pos) /*!< 0x00006000 */ +#define AFIO_EXTICR2_EXTI7_PG AFIO_EXTICR2_EXTI7_PG_Msk /*!< PG[7] pin */ + +/***************** Bit definition for AFIO_EXTICR3 register *****************/ +#define AFIO_EXTICR3_EXTI8_Pos (0U) +#define AFIO_EXTICR3_EXTI8_Msk (0xFUL << AFIO_EXTICR3_EXTI8_Pos) /*!< 0x0000000F */ +#define AFIO_EXTICR3_EXTI8 AFIO_EXTICR3_EXTI8_Msk /*!< EXTI 8 configuration */ +#define AFIO_EXTICR3_EXTI9_Pos (4U) +#define AFIO_EXTICR3_EXTI9_Msk (0xFUL << AFIO_EXTICR3_EXTI9_Pos) /*!< 0x000000F0 */ +#define AFIO_EXTICR3_EXTI9 AFIO_EXTICR3_EXTI9_Msk /*!< EXTI 9 configuration */ +#define AFIO_EXTICR3_EXTI10_Pos (8U) +#define AFIO_EXTICR3_EXTI10_Msk (0xFUL << AFIO_EXTICR3_EXTI10_Pos) /*!< 0x00000F00 */ +#define AFIO_EXTICR3_EXTI10 AFIO_EXTICR3_EXTI10_Msk /*!< EXTI 10 configuration */ +#define AFIO_EXTICR3_EXTI11_Pos (12U) +#define AFIO_EXTICR3_EXTI11_Msk (0xFUL << AFIO_EXTICR3_EXTI11_Pos) /*!< 0x0000F000 */ +#define AFIO_EXTICR3_EXTI11 AFIO_EXTICR3_EXTI11_Msk /*!< EXTI 11 configuration */ + +/*!< EXTI8 configuration */ +#define AFIO_EXTICR3_EXTI8_PA 0x00000000U /*!< PA[8] pin */ +#define AFIO_EXTICR3_EXTI8_PB_Pos (0U) +#define AFIO_EXTICR3_EXTI8_PB_Msk (0x1UL << AFIO_EXTICR3_EXTI8_PB_Pos) /*!< 0x00000001 */ +#define AFIO_EXTICR3_EXTI8_PB AFIO_EXTICR3_EXTI8_PB_Msk /*!< PB[8] pin */ +#define AFIO_EXTICR3_EXTI8_PC_Pos (1U) +#define AFIO_EXTICR3_EXTI8_PC_Msk (0x1UL << AFIO_EXTICR3_EXTI8_PC_Pos) /*!< 0x00000002 */ +#define AFIO_EXTICR3_EXTI8_PC AFIO_EXTICR3_EXTI8_PC_Msk /*!< PC[8] pin */ +#define AFIO_EXTICR3_EXTI8_PD_Pos (0U) +#define AFIO_EXTICR3_EXTI8_PD_Msk (0x3UL << AFIO_EXTICR3_EXTI8_PD_Pos) /*!< 0x00000003 */ +#define AFIO_EXTICR3_EXTI8_PD AFIO_EXTICR3_EXTI8_PD_Msk /*!< PD[8] pin */ +#define AFIO_EXTICR3_EXTI8_PE_Pos (2U) +#define AFIO_EXTICR3_EXTI8_PE_Msk (0x1UL << AFIO_EXTICR3_EXTI8_PE_Pos) /*!< 0x00000004 */ +#define AFIO_EXTICR3_EXTI8_PE AFIO_EXTICR3_EXTI8_PE_Msk /*!< PE[8] pin */ +#define AFIO_EXTICR3_EXTI8_PF_Pos (0U) +#define AFIO_EXTICR3_EXTI8_PF_Msk (0x5UL << AFIO_EXTICR3_EXTI8_PF_Pos) /*!< 0x00000005 */ +#define AFIO_EXTICR3_EXTI8_PF AFIO_EXTICR3_EXTI8_PF_Msk /*!< PF[8] pin */ +#define AFIO_EXTICR3_EXTI8_PG_Pos (1U) +#define AFIO_EXTICR3_EXTI8_PG_Msk (0x3UL << AFIO_EXTICR3_EXTI8_PG_Pos) /*!< 0x00000006 */ +#define AFIO_EXTICR3_EXTI8_PG AFIO_EXTICR3_EXTI8_PG_Msk /*!< PG[8] pin */ + +/*!< EXTI9 configuration */ +#define AFIO_EXTICR3_EXTI9_PA 0x00000000U /*!< PA[9] pin */ +#define AFIO_EXTICR3_EXTI9_PB_Pos (4U) +#define AFIO_EXTICR3_EXTI9_PB_Msk (0x1UL << AFIO_EXTICR3_EXTI9_PB_Pos) /*!< 0x00000010 */ +#define AFIO_EXTICR3_EXTI9_PB AFIO_EXTICR3_EXTI9_PB_Msk /*!< PB[9] pin */ +#define AFIO_EXTICR3_EXTI9_PC_Pos (5U) +#define AFIO_EXTICR3_EXTI9_PC_Msk (0x1UL << AFIO_EXTICR3_EXTI9_PC_Pos) /*!< 0x00000020 */ +#define AFIO_EXTICR3_EXTI9_PC AFIO_EXTICR3_EXTI9_PC_Msk /*!< PC[9] pin */ +#define AFIO_EXTICR3_EXTI9_PD_Pos (4U) +#define AFIO_EXTICR3_EXTI9_PD_Msk (0x3UL << AFIO_EXTICR3_EXTI9_PD_Pos) /*!< 0x00000030 */ +#define AFIO_EXTICR3_EXTI9_PD AFIO_EXTICR3_EXTI9_PD_Msk /*!< PD[9] pin */ +#define AFIO_EXTICR3_EXTI9_PE_Pos (6U) +#define AFIO_EXTICR3_EXTI9_PE_Msk (0x1UL << AFIO_EXTICR3_EXTI9_PE_Pos) /*!< 0x00000040 */ +#define AFIO_EXTICR3_EXTI9_PE AFIO_EXTICR3_EXTI9_PE_Msk /*!< PE[9] pin */ +#define AFIO_EXTICR3_EXTI9_PF_Pos (4U) +#define AFIO_EXTICR3_EXTI9_PF_Msk (0x5UL << AFIO_EXTICR3_EXTI9_PF_Pos) /*!< 0x00000050 */ +#define AFIO_EXTICR3_EXTI9_PF AFIO_EXTICR3_EXTI9_PF_Msk /*!< PF[9] pin */ +#define AFIO_EXTICR3_EXTI9_PG_Pos (5U) +#define AFIO_EXTICR3_EXTI9_PG_Msk (0x3UL << AFIO_EXTICR3_EXTI9_PG_Pos) /*!< 0x00000060 */ +#define AFIO_EXTICR3_EXTI9_PG AFIO_EXTICR3_EXTI9_PG_Msk /*!< PG[9] pin */ + +/*!< EXTI10 configuration */ +#define AFIO_EXTICR3_EXTI10_PA 0x00000000U /*!< PA[10] pin */ +#define AFIO_EXTICR3_EXTI10_PB_Pos (8U) +#define AFIO_EXTICR3_EXTI10_PB_Msk (0x1UL << AFIO_EXTICR3_EXTI10_PB_Pos) /*!< 0x00000100 */ +#define AFIO_EXTICR3_EXTI10_PB AFIO_EXTICR3_EXTI10_PB_Msk /*!< PB[10] pin */ +#define AFIO_EXTICR3_EXTI10_PC_Pos (9U) +#define AFIO_EXTICR3_EXTI10_PC_Msk (0x1UL << AFIO_EXTICR3_EXTI10_PC_Pos) /*!< 0x00000200 */ +#define AFIO_EXTICR3_EXTI10_PC AFIO_EXTICR3_EXTI10_PC_Msk /*!< PC[10] pin */ +#define AFIO_EXTICR3_EXTI10_PD_Pos (8U) +#define AFIO_EXTICR3_EXTI10_PD_Msk (0x3UL << AFIO_EXTICR3_EXTI10_PD_Pos) /*!< 0x00000300 */ +#define AFIO_EXTICR3_EXTI10_PD AFIO_EXTICR3_EXTI10_PD_Msk /*!< PD[10] pin */ +#define AFIO_EXTICR3_EXTI10_PE_Pos (10U) +#define AFIO_EXTICR3_EXTI10_PE_Msk (0x1UL << AFIO_EXTICR3_EXTI10_PE_Pos) /*!< 0x00000400 */ +#define AFIO_EXTICR3_EXTI10_PE AFIO_EXTICR3_EXTI10_PE_Msk /*!< PE[10] pin */ +#define AFIO_EXTICR3_EXTI10_PF_Pos (8U) +#define AFIO_EXTICR3_EXTI10_PF_Msk (0x5UL << AFIO_EXTICR3_EXTI10_PF_Pos) /*!< 0x00000500 */ +#define AFIO_EXTICR3_EXTI10_PF AFIO_EXTICR3_EXTI10_PF_Msk /*!< PF[10] pin */ +#define AFIO_EXTICR3_EXTI10_PG_Pos (9U) +#define AFIO_EXTICR3_EXTI10_PG_Msk (0x3UL << AFIO_EXTICR3_EXTI10_PG_Pos) /*!< 0x00000600 */ +#define AFIO_EXTICR3_EXTI10_PG AFIO_EXTICR3_EXTI10_PG_Msk /*!< PG[10] pin */ + +/*!< EXTI11 configuration */ +#define AFIO_EXTICR3_EXTI11_PA 0x00000000U /*!< PA[11] pin */ +#define AFIO_EXTICR3_EXTI11_PB_Pos (12U) +#define AFIO_EXTICR3_EXTI11_PB_Msk (0x1UL << AFIO_EXTICR3_EXTI11_PB_Pos) /*!< 0x00001000 */ +#define AFIO_EXTICR3_EXTI11_PB AFIO_EXTICR3_EXTI11_PB_Msk /*!< PB[11] pin */ +#define AFIO_EXTICR3_EXTI11_PC_Pos (13U) +#define AFIO_EXTICR3_EXTI11_PC_Msk (0x1UL << AFIO_EXTICR3_EXTI11_PC_Pos) /*!< 0x00002000 */ +#define AFIO_EXTICR3_EXTI11_PC AFIO_EXTICR3_EXTI11_PC_Msk /*!< PC[11] pin */ +#define AFIO_EXTICR3_EXTI11_PD_Pos (12U) +#define AFIO_EXTICR3_EXTI11_PD_Msk (0x3UL << AFIO_EXTICR3_EXTI11_PD_Pos) /*!< 0x00003000 */ +#define AFIO_EXTICR3_EXTI11_PD AFIO_EXTICR3_EXTI11_PD_Msk /*!< PD[11] pin */ +#define AFIO_EXTICR3_EXTI11_PE_Pos (14U) +#define AFIO_EXTICR3_EXTI11_PE_Msk (0x1UL << AFIO_EXTICR3_EXTI11_PE_Pos) /*!< 0x00004000 */ +#define AFIO_EXTICR3_EXTI11_PE AFIO_EXTICR3_EXTI11_PE_Msk /*!< PE[11] pin */ +#define AFIO_EXTICR3_EXTI11_PF_Pos (12U) +#define AFIO_EXTICR3_EXTI11_PF_Msk (0x5UL << AFIO_EXTICR3_EXTI11_PF_Pos) /*!< 0x00005000 */ +#define AFIO_EXTICR3_EXTI11_PF AFIO_EXTICR3_EXTI11_PF_Msk /*!< PF[11] pin */ +#define AFIO_EXTICR3_EXTI11_PG_Pos (13U) +#define AFIO_EXTICR3_EXTI11_PG_Msk (0x3UL << AFIO_EXTICR3_EXTI11_PG_Pos) /*!< 0x00006000 */ +#define AFIO_EXTICR3_EXTI11_PG AFIO_EXTICR3_EXTI11_PG_Msk /*!< PG[11] pin */ + +/***************** Bit definition for AFIO_EXTICR4 register *****************/ +#define AFIO_EXTICR4_EXTI12_Pos (0U) +#define AFIO_EXTICR4_EXTI12_Msk (0xFUL << AFIO_EXTICR4_EXTI12_Pos) /*!< 0x0000000F */ +#define AFIO_EXTICR4_EXTI12 AFIO_EXTICR4_EXTI12_Msk /*!< EXTI 12 configuration */ +#define AFIO_EXTICR4_EXTI13_Pos (4U) +#define AFIO_EXTICR4_EXTI13_Msk (0xFUL << AFIO_EXTICR4_EXTI13_Pos) /*!< 0x000000F0 */ +#define AFIO_EXTICR4_EXTI13 AFIO_EXTICR4_EXTI13_Msk /*!< EXTI 13 configuration */ +#define AFIO_EXTICR4_EXTI14_Pos (8U) +#define AFIO_EXTICR4_EXTI14_Msk (0xFUL << AFIO_EXTICR4_EXTI14_Pos) /*!< 0x00000F00 */ +#define AFIO_EXTICR4_EXTI14 AFIO_EXTICR4_EXTI14_Msk /*!< EXTI 14 configuration */ +#define AFIO_EXTICR4_EXTI15_Pos (12U) +#define AFIO_EXTICR4_EXTI15_Msk (0xFUL << AFIO_EXTICR4_EXTI15_Pos) /*!< 0x0000F000 */ +#define AFIO_EXTICR4_EXTI15 AFIO_EXTICR4_EXTI15_Msk /*!< EXTI 15 configuration */ + +/* EXTI12 configuration */ +#define AFIO_EXTICR4_EXTI12_PA 0x00000000U /*!< PA[12] pin */ +#define AFIO_EXTICR4_EXTI12_PB_Pos (0U) +#define AFIO_EXTICR4_EXTI12_PB_Msk (0x1UL << AFIO_EXTICR4_EXTI12_PB_Pos) /*!< 0x00000001 */ +#define AFIO_EXTICR4_EXTI12_PB AFIO_EXTICR4_EXTI12_PB_Msk /*!< PB[12] pin */ +#define AFIO_EXTICR4_EXTI12_PC_Pos (1U) +#define AFIO_EXTICR4_EXTI12_PC_Msk (0x1UL << AFIO_EXTICR4_EXTI12_PC_Pos) /*!< 0x00000002 */ +#define AFIO_EXTICR4_EXTI12_PC AFIO_EXTICR4_EXTI12_PC_Msk /*!< PC[12] pin */ +#define AFIO_EXTICR4_EXTI12_PD_Pos (0U) +#define AFIO_EXTICR4_EXTI12_PD_Msk (0x3UL << AFIO_EXTICR4_EXTI12_PD_Pos) /*!< 0x00000003 */ +#define AFIO_EXTICR4_EXTI12_PD AFIO_EXTICR4_EXTI12_PD_Msk /*!< PD[12] pin */ +#define AFIO_EXTICR4_EXTI12_PE_Pos (2U) +#define AFIO_EXTICR4_EXTI12_PE_Msk (0x1UL << AFIO_EXTICR4_EXTI12_PE_Pos) /*!< 0x00000004 */ +#define AFIO_EXTICR4_EXTI12_PE AFIO_EXTICR4_EXTI12_PE_Msk /*!< PE[12] pin */ +#define AFIO_EXTICR4_EXTI12_PF_Pos (0U) +#define AFIO_EXTICR4_EXTI12_PF_Msk (0x5UL << AFIO_EXTICR4_EXTI12_PF_Pos) /*!< 0x00000005 */ +#define AFIO_EXTICR4_EXTI12_PF AFIO_EXTICR4_EXTI12_PF_Msk /*!< PF[12] pin */ +#define AFIO_EXTICR4_EXTI12_PG_Pos (1U) +#define AFIO_EXTICR4_EXTI12_PG_Msk (0x3UL << AFIO_EXTICR4_EXTI12_PG_Pos) /*!< 0x00000006 */ +#define AFIO_EXTICR4_EXTI12_PG AFIO_EXTICR4_EXTI12_PG_Msk /*!< PG[12] pin */ + +/* EXTI13 configuration */ +#define AFIO_EXTICR4_EXTI13_PA 0x00000000U /*!< PA[13] pin */ +#define AFIO_EXTICR4_EXTI13_PB_Pos (4U) +#define AFIO_EXTICR4_EXTI13_PB_Msk (0x1UL << AFIO_EXTICR4_EXTI13_PB_Pos) /*!< 0x00000010 */ +#define AFIO_EXTICR4_EXTI13_PB AFIO_EXTICR4_EXTI13_PB_Msk /*!< PB[13] pin */ +#define AFIO_EXTICR4_EXTI13_PC_Pos (5U) +#define AFIO_EXTICR4_EXTI13_PC_Msk (0x1UL << AFIO_EXTICR4_EXTI13_PC_Pos) /*!< 0x00000020 */ +#define AFIO_EXTICR4_EXTI13_PC AFIO_EXTICR4_EXTI13_PC_Msk /*!< PC[13] pin */ +#define AFIO_EXTICR4_EXTI13_PD_Pos (4U) +#define AFIO_EXTICR4_EXTI13_PD_Msk (0x3UL << AFIO_EXTICR4_EXTI13_PD_Pos) /*!< 0x00000030 */ +#define AFIO_EXTICR4_EXTI13_PD AFIO_EXTICR4_EXTI13_PD_Msk /*!< PD[13] pin */ +#define AFIO_EXTICR4_EXTI13_PE_Pos (6U) +#define AFIO_EXTICR4_EXTI13_PE_Msk (0x1UL << AFIO_EXTICR4_EXTI13_PE_Pos) /*!< 0x00000040 */ +#define AFIO_EXTICR4_EXTI13_PE AFIO_EXTICR4_EXTI13_PE_Msk /*!< PE[13] pin */ +#define AFIO_EXTICR4_EXTI13_PF_Pos (4U) +#define AFIO_EXTICR4_EXTI13_PF_Msk (0x5UL << AFIO_EXTICR4_EXTI13_PF_Pos) /*!< 0x00000050 */ +#define AFIO_EXTICR4_EXTI13_PF AFIO_EXTICR4_EXTI13_PF_Msk /*!< PF[13] pin */ +#define AFIO_EXTICR4_EXTI13_PG_Pos (5U) +#define AFIO_EXTICR4_EXTI13_PG_Msk (0x3UL << AFIO_EXTICR4_EXTI13_PG_Pos) /*!< 0x00000060 */ +#define AFIO_EXTICR4_EXTI13_PG AFIO_EXTICR4_EXTI13_PG_Msk /*!< PG[13] pin */ + +/*!< EXTI14 configuration */ +#define AFIO_EXTICR4_EXTI14_PA 0x00000000U /*!< PA[14] pin */ +#define AFIO_EXTICR4_EXTI14_PB_Pos (8U) +#define AFIO_EXTICR4_EXTI14_PB_Msk (0x1UL << AFIO_EXTICR4_EXTI14_PB_Pos) /*!< 0x00000100 */ +#define AFIO_EXTICR4_EXTI14_PB AFIO_EXTICR4_EXTI14_PB_Msk /*!< PB[14] pin */ +#define AFIO_EXTICR4_EXTI14_PC_Pos (9U) +#define AFIO_EXTICR4_EXTI14_PC_Msk (0x1UL << AFIO_EXTICR4_EXTI14_PC_Pos) /*!< 0x00000200 */ +#define AFIO_EXTICR4_EXTI14_PC AFIO_EXTICR4_EXTI14_PC_Msk /*!< PC[14] pin */ +#define AFIO_EXTICR4_EXTI14_PD_Pos (8U) +#define AFIO_EXTICR4_EXTI14_PD_Msk (0x3UL << AFIO_EXTICR4_EXTI14_PD_Pos) /*!< 0x00000300 */ +#define AFIO_EXTICR4_EXTI14_PD AFIO_EXTICR4_EXTI14_PD_Msk /*!< PD[14] pin */ +#define AFIO_EXTICR4_EXTI14_PE_Pos (10U) +#define AFIO_EXTICR4_EXTI14_PE_Msk (0x1UL << AFIO_EXTICR4_EXTI14_PE_Pos) /*!< 0x00000400 */ +#define AFIO_EXTICR4_EXTI14_PE AFIO_EXTICR4_EXTI14_PE_Msk /*!< PE[14] pin */ +#define AFIO_EXTICR4_EXTI14_PF_Pos (8U) +#define AFIO_EXTICR4_EXTI14_PF_Msk (0x5UL << AFIO_EXTICR4_EXTI14_PF_Pos) /*!< 0x00000500 */ +#define AFIO_EXTICR4_EXTI14_PF AFIO_EXTICR4_EXTI14_PF_Msk /*!< PF[14] pin */ +#define AFIO_EXTICR4_EXTI14_PG_Pos (9U) +#define AFIO_EXTICR4_EXTI14_PG_Msk (0x3UL << AFIO_EXTICR4_EXTI14_PG_Pos) /*!< 0x00000600 */ +#define AFIO_EXTICR4_EXTI14_PG AFIO_EXTICR4_EXTI14_PG_Msk /*!< PG[14] pin */ + +/*!< EXTI15 configuration */ +#define AFIO_EXTICR4_EXTI15_PA 0x00000000U /*!< PA[15] pin */ +#define AFIO_EXTICR4_EXTI15_PB_Pos (12U) +#define AFIO_EXTICR4_EXTI15_PB_Msk (0x1UL << AFIO_EXTICR4_EXTI15_PB_Pos) /*!< 0x00001000 */ +#define AFIO_EXTICR4_EXTI15_PB AFIO_EXTICR4_EXTI15_PB_Msk /*!< PB[15] pin */ +#define AFIO_EXTICR4_EXTI15_PC_Pos (13U) +#define AFIO_EXTICR4_EXTI15_PC_Msk (0x1UL << AFIO_EXTICR4_EXTI15_PC_Pos) /*!< 0x00002000 */ +#define AFIO_EXTICR4_EXTI15_PC AFIO_EXTICR4_EXTI15_PC_Msk /*!< PC[15] pin */ +#define AFIO_EXTICR4_EXTI15_PD_Pos (12U) +#define AFIO_EXTICR4_EXTI15_PD_Msk (0x3UL << AFIO_EXTICR4_EXTI15_PD_Pos) /*!< 0x00003000 */ +#define AFIO_EXTICR4_EXTI15_PD AFIO_EXTICR4_EXTI15_PD_Msk /*!< PD[15] pin */ +#define AFIO_EXTICR4_EXTI15_PE_Pos (14U) +#define AFIO_EXTICR4_EXTI15_PE_Msk (0x1UL << AFIO_EXTICR4_EXTI15_PE_Pos) /*!< 0x00004000 */ +#define AFIO_EXTICR4_EXTI15_PE AFIO_EXTICR4_EXTI15_PE_Msk /*!< PE[15] pin */ +#define AFIO_EXTICR4_EXTI15_PF_Pos (12U) +#define AFIO_EXTICR4_EXTI15_PF_Msk (0x5UL << AFIO_EXTICR4_EXTI15_PF_Pos) /*!< 0x00005000 */ +#define AFIO_EXTICR4_EXTI15_PF AFIO_EXTICR4_EXTI15_PF_Msk /*!< PF[15] pin */ +#define AFIO_EXTICR4_EXTI15_PG_Pos (13U) +#define AFIO_EXTICR4_EXTI15_PG_Msk (0x3UL << AFIO_EXTICR4_EXTI15_PG_Pos) /*!< 0x00006000 */ +#define AFIO_EXTICR4_EXTI15_PG AFIO_EXTICR4_EXTI15_PG_Msk /*!< PG[15] pin */ + +/****************** Bit definition for AFIO_MAPR2 register ******************/ + + +#define AFIO_MAPR2_FSMC_NADV_REMAP_Pos (10U) +#define AFIO_MAPR2_FSMC_NADV_REMAP_Msk (0x1UL << AFIO_MAPR2_FSMC_NADV_REMAP_Pos) /*!< 0x00000400 */ +#define AFIO_MAPR2_FSMC_NADV_REMAP AFIO_MAPR2_FSMC_NADV_REMAP_Msk /*!< FSMC NADV remapping */ + +/******************************************************************************/ +/* */ +/* External Interrupt/Event Controller */ +/* */ +/******************************************************************************/ + +/******************* Bit definition for EXTI_IMR register *******************/ +#define EXTI_IMR_MR0_Pos (0U) +#define EXTI_IMR_MR0_Msk (0x1UL << EXTI_IMR_MR0_Pos) /*!< 0x00000001 */ +#define EXTI_IMR_MR0 EXTI_IMR_MR0_Msk /*!< Interrupt Mask on line 0 */ +#define EXTI_IMR_MR1_Pos (1U) +#define EXTI_IMR_MR1_Msk (0x1UL << EXTI_IMR_MR1_Pos) /*!< 0x00000002 */ +#define EXTI_IMR_MR1 EXTI_IMR_MR1_Msk /*!< Interrupt Mask on line 1 */ +#define EXTI_IMR_MR2_Pos (2U) +#define EXTI_IMR_MR2_Msk (0x1UL << EXTI_IMR_MR2_Pos) /*!< 0x00000004 */ +#define EXTI_IMR_MR2 EXTI_IMR_MR2_Msk /*!< Interrupt Mask on line 2 */ +#define EXTI_IMR_MR3_Pos (3U) +#define EXTI_IMR_MR3_Msk (0x1UL << EXTI_IMR_MR3_Pos) /*!< 0x00000008 */ +#define EXTI_IMR_MR3 EXTI_IMR_MR3_Msk /*!< Interrupt Mask on line 3 */ +#define EXTI_IMR_MR4_Pos (4U) +#define EXTI_IMR_MR4_Msk (0x1UL << EXTI_IMR_MR4_Pos) /*!< 0x00000010 */ +#define EXTI_IMR_MR4 EXTI_IMR_MR4_Msk /*!< Interrupt Mask on line 4 */ +#define EXTI_IMR_MR5_Pos (5U) +#define EXTI_IMR_MR5_Msk (0x1UL << EXTI_IMR_MR5_Pos) /*!< 0x00000020 */ +#define EXTI_IMR_MR5 EXTI_IMR_MR5_Msk /*!< Interrupt Mask on line 5 */ +#define EXTI_IMR_MR6_Pos (6U) +#define EXTI_IMR_MR6_Msk (0x1UL << EXTI_IMR_MR6_Pos) /*!< 0x00000040 */ +#define EXTI_IMR_MR6 EXTI_IMR_MR6_Msk /*!< Interrupt Mask on line 6 */ +#define EXTI_IMR_MR7_Pos (7U) +#define EXTI_IMR_MR7_Msk (0x1UL << EXTI_IMR_MR7_Pos) /*!< 0x00000080 */ +#define EXTI_IMR_MR7 EXTI_IMR_MR7_Msk /*!< Interrupt Mask on line 7 */ +#define EXTI_IMR_MR8_Pos (8U) +#define EXTI_IMR_MR8_Msk (0x1UL << EXTI_IMR_MR8_Pos) /*!< 0x00000100 */ +#define EXTI_IMR_MR8 EXTI_IMR_MR8_Msk /*!< Interrupt Mask on line 8 */ +#define EXTI_IMR_MR9_Pos (9U) +#define EXTI_IMR_MR9_Msk (0x1UL << EXTI_IMR_MR9_Pos) /*!< 0x00000200 */ +#define EXTI_IMR_MR9 EXTI_IMR_MR9_Msk /*!< Interrupt Mask on line 9 */ +#define EXTI_IMR_MR10_Pos (10U) +#define EXTI_IMR_MR10_Msk (0x1UL << EXTI_IMR_MR10_Pos) /*!< 0x00000400 */ +#define EXTI_IMR_MR10 EXTI_IMR_MR10_Msk /*!< Interrupt Mask on line 10 */ +#define EXTI_IMR_MR11_Pos (11U) +#define EXTI_IMR_MR11_Msk (0x1UL << EXTI_IMR_MR11_Pos) /*!< 0x00000800 */ +#define EXTI_IMR_MR11 EXTI_IMR_MR11_Msk /*!< Interrupt Mask on line 11 */ +#define EXTI_IMR_MR12_Pos (12U) +#define EXTI_IMR_MR12_Msk (0x1UL << EXTI_IMR_MR12_Pos) /*!< 0x00001000 */ +#define EXTI_IMR_MR12 EXTI_IMR_MR12_Msk /*!< Interrupt Mask on line 12 */ +#define EXTI_IMR_MR13_Pos (13U) +#define EXTI_IMR_MR13_Msk (0x1UL << EXTI_IMR_MR13_Pos) /*!< 0x00002000 */ +#define EXTI_IMR_MR13 EXTI_IMR_MR13_Msk /*!< Interrupt Mask on line 13 */ +#define EXTI_IMR_MR14_Pos (14U) +#define EXTI_IMR_MR14_Msk (0x1UL << EXTI_IMR_MR14_Pos) /*!< 0x00004000 */ +#define EXTI_IMR_MR14 EXTI_IMR_MR14_Msk /*!< Interrupt Mask on line 14 */ +#define EXTI_IMR_MR15_Pos (15U) +#define EXTI_IMR_MR15_Msk (0x1UL << EXTI_IMR_MR15_Pos) /*!< 0x00008000 */ +#define EXTI_IMR_MR15 EXTI_IMR_MR15_Msk /*!< Interrupt Mask on line 15 */ +#define EXTI_IMR_MR16_Pos (16U) +#define EXTI_IMR_MR16_Msk (0x1UL << EXTI_IMR_MR16_Pos) /*!< 0x00010000 */ +#define EXTI_IMR_MR16 EXTI_IMR_MR16_Msk /*!< Interrupt Mask on line 16 */ +#define EXTI_IMR_MR17_Pos (17U) +#define EXTI_IMR_MR17_Msk (0x1UL << EXTI_IMR_MR17_Pos) /*!< 0x00020000 */ +#define EXTI_IMR_MR17 EXTI_IMR_MR17_Msk /*!< Interrupt Mask on line 17 */ +#define EXTI_IMR_MR18_Pos (18U) +#define EXTI_IMR_MR18_Msk (0x1UL << EXTI_IMR_MR18_Pos) /*!< 0x00040000 */ +#define EXTI_IMR_MR18 EXTI_IMR_MR18_Msk /*!< Interrupt Mask on line 18 */ + +/* References Defines */ +#define EXTI_IMR_IM0 EXTI_IMR_MR0 +#define EXTI_IMR_IM1 EXTI_IMR_MR1 +#define EXTI_IMR_IM2 EXTI_IMR_MR2 +#define EXTI_IMR_IM3 EXTI_IMR_MR3 +#define EXTI_IMR_IM4 EXTI_IMR_MR4 +#define EXTI_IMR_IM5 EXTI_IMR_MR5 +#define EXTI_IMR_IM6 EXTI_IMR_MR6 +#define EXTI_IMR_IM7 EXTI_IMR_MR7 +#define EXTI_IMR_IM8 EXTI_IMR_MR8 +#define EXTI_IMR_IM9 EXTI_IMR_MR9 +#define EXTI_IMR_IM10 EXTI_IMR_MR10 +#define EXTI_IMR_IM11 EXTI_IMR_MR11 +#define EXTI_IMR_IM12 EXTI_IMR_MR12 +#define EXTI_IMR_IM13 EXTI_IMR_MR13 +#define EXTI_IMR_IM14 EXTI_IMR_MR14 +#define EXTI_IMR_IM15 EXTI_IMR_MR15 +#define EXTI_IMR_IM16 EXTI_IMR_MR16 +#define EXTI_IMR_IM17 EXTI_IMR_MR17 +#define EXTI_IMR_IM18 EXTI_IMR_MR18 +#define EXTI_IMR_IM 0x0007FFFFU /*!< Interrupt Mask All */ + +/******************* Bit definition for EXTI_EMR register *******************/ +#define EXTI_EMR_MR0_Pos (0U) +#define EXTI_EMR_MR0_Msk (0x1UL << EXTI_EMR_MR0_Pos) /*!< 0x00000001 */ +#define EXTI_EMR_MR0 EXTI_EMR_MR0_Msk /*!< Event Mask on line 0 */ +#define EXTI_EMR_MR1_Pos (1U) +#define EXTI_EMR_MR1_Msk (0x1UL << EXTI_EMR_MR1_Pos) /*!< 0x00000002 */ +#define EXTI_EMR_MR1 EXTI_EMR_MR1_Msk /*!< Event Mask on line 1 */ +#define EXTI_EMR_MR2_Pos (2U) +#define EXTI_EMR_MR2_Msk (0x1UL << EXTI_EMR_MR2_Pos) /*!< 0x00000004 */ +#define EXTI_EMR_MR2 EXTI_EMR_MR2_Msk /*!< Event Mask on line 2 */ +#define EXTI_EMR_MR3_Pos (3U) +#define EXTI_EMR_MR3_Msk (0x1UL << EXTI_EMR_MR3_Pos) /*!< 0x00000008 */ +#define EXTI_EMR_MR3 EXTI_EMR_MR3_Msk /*!< Event Mask on line 3 */ +#define EXTI_EMR_MR4_Pos (4U) +#define EXTI_EMR_MR4_Msk (0x1UL << EXTI_EMR_MR4_Pos) /*!< 0x00000010 */ +#define EXTI_EMR_MR4 EXTI_EMR_MR4_Msk /*!< Event Mask on line 4 */ +#define EXTI_EMR_MR5_Pos (5U) +#define EXTI_EMR_MR5_Msk (0x1UL << EXTI_EMR_MR5_Pos) /*!< 0x00000020 */ +#define EXTI_EMR_MR5 EXTI_EMR_MR5_Msk /*!< Event Mask on line 5 */ +#define EXTI_EMR_MR6_Pos (6U) +#define EXTI_EMR_MR6_Msk (0x1UL << EXTI_EMR_MR6_Pos) /*!< 0x00000040 */ +#define EXTI_EMR_MR6 EXTI_EMR_MR6_Msk /*!< Event Mask on line 6 */ +#define EXTI_EMR_MR7_Pos (7U) +#define EXTI_EMR_MR7_Msk (0x1UL << EXTI_EMR_MR7_Pos) /*!< 0x00000080 */ +#define EXTI_EMR_MR7 EXTI_EMR_MR7_Msk /*!< Event Mask on line 7 */ +#define EXTI_EMR_MR8_Pos (8U) +#define EXTI_EMR_MR8_Msk (0x1UL << EXTI_EMR_MR8_Pos) /*!< 0x00000100 */ +#define EXTI_EMR_MR8 EXTI_EMR_MR8_Msk /*!< Event Mask on line 8 */ +#define EXTI_EMR_MR9_Pos (9U) +#define EXTI_EMR_MR9_Msk (0x1UL << EXTI_EMR_MR9_Pos) /*!< 0x00000200 */ +#define EXTI_EMR_MR9 EXTI_EMR_MR9_Msk /*!< Event Mask on line 9 */ +#define EXTI_EMR_MR10_Pos (10U) +#define EXTI_EMR_MR10_Msk (0x1UL << EXTI_EMR_MR10_Pos) /*!< 0x00000400 */ +#define EXTI_EMR_MR10 EXTI_EMR_MR10_Msk /*!< Event Mask on line 10 */ +#define EXTI_EMR_MR11_Pos (11U) +#define EXTI_EMR_MR11_Msk (0x1UL << EXTI_EMR_MR11_Pos) /*!< 0x00000800 */ +#define EXTI_EMR_MR11 EXTI_EMR_MR11_Msk /*!< Event Mask on line 11 */ +#define EXTI_EMR_MR12_Pos (12U) +#define EXTI_EMR_MR12_Msk (0x1UL << EXTI_EMR_MR12_Pos) /*!< 0x00001000 */ +#define EXTI_EMR_MR12 EXTI_EMR_MR12_Msk /*!< Event Mask on line 12 */ +#define EXTI_EMR_MR13_Pos (13U) +#define EXTI_EMR_MR13_Msk (0x1UL << EXTI_EMR_MR13_Pos) /*!< 0x00002000 */ +#define EXTI_EMR_MR13 EXTI_EMR_MR13_Msk /*!< Event Mask on line 13 */ +#define EXTI_EMR_MR14_Pos (14U) +#define EXTI_EMR_MR14_Msk (0x1UL << EXTI_EMR_MR14_Pos) /*!< 0x00004000 */ +#define EXTI_EMR_MR14 EXTI_EMR_MR14_Msk /*!< Event Mask on line 14 */ +#define EXTI_EMR_MR15_Pos (15U) +#define EXTI_EMR_MR15_Msk (0x1UL << EXTI_EMR_MR15_Pos) /*!< 0x00008000 */ +#define EXTI_EMR_MR15 EXTI_EMR_MR15_Msk /*!< Event Mask on line 15 */ +#define EXTI_EMR_MR16_Pos (16U) +#define EXTI_EMR_MR16_Msk (0x1UL << EXTI_EMR_MR16_Pos) /*!< 0x00010000 */ +#define EXTI_EMR_MR16 EXTI_EMR_MR16_Msk /*!< Event Mask on line 16 */ +#define EXTI_EMR_MR17_Pos (17U) +#define EXTI_EMR_MR17_Msk (0x1UL << EXTI_EMR_MR17_Pos) /*!< 0x00020000 */ +#define EXTI_EMR_MR17 EXTI_EMR_MR17_Msk /*!< Event Mask on line 17 */ +#define EXTI_EMR_MR18_Pos (18U) +#define EXTI_EMR_MR18_Msk (0x1UL << EXTI_EMR_MR18_Pos) /*!< 0x00040000 */ +#define EXTI_EMR_MR18 EXTI_EMR_MR18_Msk /*!< Event Mask on line 18 */ + +/* References Defines */ +#define EXTI_EMR_EM0 EXTI_EMR_MR0 +#define EXTI_EMR_EM1 EXTI_EMR_MR1 +#define EXTI_EMR_EM2 EXTI_EMR_MR2 +#define EXTI_EMR_EM3 EXTI_EMR_MR3 +#define EXTI_EMR_EM4 EXTI_EMR_MR4 +#define EXTI_EMR_EM5 EXTI_EMR_MR5 +#define EXTI_EMR_EM6 EXTI_EMR_MR6 +#define EXTI_EMR_EM7 EXTI_EMR_MR7 +#define EXTI_EMR_EM8 EXTI_EMR_MR8 +#define EXTI_EMR_EM9 EXTI_EMR_MR9 +#define EXTI_EMR_EM10 EXTI_EMR_MR10 +#define EXTI_EMR_EM11 EXTI_EMR_MR11 +#define EXTI_EMR_EM12 EXTI_EMR_MR12 +#define EXTI_EMR_EM13 EXTI_EMR_MR13 +#define EXTI_EMR_EM14 EXTI_EMR_MR14 +#define EXTI_EMR_EM15 EXTI_EMR_MR15 +#define EXTI_EMR_EM16 EXTI_EMR_MR16 +#define EXTI_EMR_EM17 EXTI_EMR_MR17 +#define EXTI_EMR_EM18 EXTI_EMR_MR18 + +/****************** Bit definition for EXTI_RTSR register *******************/ +#define EXTI_RTSR_TR0_Pos (0U) +#define EXTI_RTSR_TR0_Msk (0x1UL << EXTI_RTSR_TR0_Pos) /*!< 0x00000001 */ +#define EXTI_RTSR_TR0 EXTI_RTSR_TR0_Msk /*!< Rising trigger event configuration bit of line 0 */ +#define EXTI_RTSR_TR1_Pos (1U) +#define EXTI_RTSR_TR1_Msk (0x1UL << EXTI_RTSR_TR1_Pos) /*!< 0x00000002 */ +#define EXTI_RTSR_TR1 EXTI_RTSR_TR1_Msk /*!< Rising trigger event configuration bit of line 1 */ +#define EXTI_RTSR_TR2_Pos (2U) +#define EXTI_RTSR_TR2_Msk (0x1UL << EXTI_RTSR_TR2_Pos) /*!< 0x00000004 */ +#define EXTI_RTSR_TR2 EXTI_RTSR_TR2_Msk /*!< Rising trigger event configuration bit of line 2 */ +#define EXTI_RTSR_TR3_Pos (3U) +#define EXTI_RTSR_TR3_Msk (0x1UL << EXTI_RTSR_TR3_Pos) /*!< 0x00000008 */ +#define EXTI_RTSR_TR3 EXTI_RTSR_TR3_Msk /*!< Rising trigger event configuration bit of line 3 */ +#define EXTI_RTSR_TR4_Pos (4U) +#define EXTI_RTSR_TR4_Msk (0x1UL << EXTI_RTSR_TR4_Pos) /*!< 0x00000010 */ +#define EXTI_RTSR_TR4 EXTI_RTSR_TR4_Msk /*!< Rising trigger event configuration bit of line 4 */ +#define EXTI_RTSR_TR5_Pos (5U) +#define EXTI_RTSR_TR5_Msk (0x1UL << EXTI_RTSR_TR5_Pos) /*!< 0x00000020 */ +#define EXTI_RTSR_TR5 EXTI_RTSR_TR5_Msk /*!< Rising trigger event configuration bit of line 5 */ +#define EXTI_RTSR_TR6_Pos (6U) +#define EXTI_RTSR_TR6_Msk (0x1UL << EXTI_RTSR_TR6_Pos) /*!< 0x00000040 */ +#define EXTI_RTSR_TR6 EXTI_RTSR_TR6_Msk /*!< Rising trigger event configuration bit of line 6 */ +#define EXTI_RTSR_TR7_Pos (7U) +#define EXTI_RTSR_TR7_Msk (0x1UL << EXTI_RTSR_TR7_Pos) /*!< 0x00000080 */ +#define EXTI_RTSR_TR7 EXTI_RTSR_TR7_Msk /*!< Rising trigger event configuration bit of line 7 */ +#define EXTI_RTSR_TR8_Pos (8U) +#define EXTI_RTSR_TR8_Msk (0x1UL << EXTI_RTSR_TR8_Pos) /*!< 0x00000100 */ +#define EXTI_RTSR_TR8 EXTI_RTSR_TR8_Msk /*!< Rising trigger event configuration bit of line 8 */ +#define EXTI_RTSR_TR9_Pos (9U) +#define EXTI_RTSR_TR9_Msk (0x1UL << EXTI_RTSR_TR9_Pos) /*!< 0x00000200 */ +#define EXTI_RTSR_TR9 EXTI_RTSR_TR9_Msk /*!< Rising trigger event configuration bit of line 9 */ +#define EXTI_RTSR_TR10_Pos (10U) +#define EXTI_RTSR_TR10_Msk (0x1UL << EXTI_RTSR_TR10_Pos) /*!< 0x00000400 */ +#define EXTI_RTSR_TR10 EXTI_RTSR_TR10_Msk /*!< Rising trigger event configuration bit of line 10 */ +#define EXTI_RTSR_TR11_Pos (11U) +#define EXTI_RTSR_TR11_Msk (0x1UL << EXTI_RTSR_TR11_Pos) /*!< 0x00000800 */ +#define EXTI_RTSR_TR11 EXTI_RTSR_TR11_Msk /*!< Rising trigger event configuration bit of line 11 */ +#define EXTI_RTSR_TR12_Pos (12U) +#define EXTI_RTSR_TR12_Msk (0x1UL << EXTI_RTSR_TR12_Pos) /*!< 0x00001000 */ +#define EXTI_RTSR_TR12 EXTI_RTSR_TR12_Msk /*!< Rising trigger event configuration bit of line 12 */ +#define EXTI_RTSR_TR13_Pos (13U) +#define EXTI_RTSR_TR13_Msk (0x1UL << EXTI_RTSR_TR13_Pos) /*!< 0x00002000 */ +#define EXTI_RTSR_TR13 EXTI_RTSR_TR13_Msk /*!< Rising trigger event configuration bit of line 13 */ +#define EXTI_RTSR_TR14_Pos (14U) +#define EXTI_RTSR_TR14_Msk (0x1UL << EXTI_RTSR_TR14_Pos) /*!< 0x00004000 */ +#define EXTI_RTSR_TR14 EXTI_RTSR_TR14_Msk /*!< Rising trigger event configuration bit of line 14 */ +#define EXTI_RTSR_TR15_Pos (15U) +#define EXTI_RTSR_TR15_Msk (0x1UL << EXTI_RTSR_TR15_Pos) /*!< 0x00008000 */ +#define EXTI_RTSR_TR15 EXTI_RTSR_TR15_Msk /*!< Rising trigger event configuration bit of line 15 */ +#define EXTI_RTSR_TR16_Pos (16U) +#define EXTI_RTSR_TR16_Msk (0x1UL << EXTI_RTSR_TR16_Pos) /*!< 0x00010000 */ +#define EXTI_RTSR_TR16 EXTI_RTSR_TR16_Msk /*!< Rising trigger event configuration bit of line 16 */ +#define EXTI_RTSR_TR17_Pos (17U) +#define EXTI_RTSR_TR17_Msk (0x1UL << EXTI_RTSR_TR17_Pos) /*!< 0x00020000 */ +#define EXTI_RTSR_TR17 EXTI_RTSR_TR17_Msk /*!< Rising trigger event configuration bit of line 17 */ +#define EXTI_RTSR_TR18_Pos (18U) +#define EXTI_RTSR_TR18_Msk (0x1UL << EXTI_RTSR_TR18_Pos) /*!< 0x00040000 */ +#define EXTI_RTSR_TR18 EXTI_RTSR_TR18_Msk /*!< Rising trigger event configuration bit of line 18 */ + +/* References Defines */ +#define EXTI_RTSR_RT0 EXTI_RTSR_TR0 +#define EXTI_RTSR_RT1 EXTI_RTSR_TR1 +#define EXTI_RTSR_RT2 EXTI_RTSR_TR2 +#define EXTI_RTSR_RT3 EXTI_RTSR_TR3 +#define EXTI_RTSR_RT4 EXTI_RTSR_TR4 +#define EXTI_RTSR_RT5 EXTI_RTSR_TR5 +#define EXTI_RTSR_RT6 EXTI_RTSR_TR6 +#define EXTI_RTSR_RT7 EXTI_RTSR_TR7 +#define EXTI_RTSR_RT8 EXTI_RTSR_TR8 +#define EXTI_RTSR_RT9 EXTI_RTSR_TR9 +#define EXTI_RTSR_RT10 EXTI_RTSR_TR10 +#define EXTI_RTSR_RT11 EXTI_RTSR_TR11 +#define EXTI_RTSR_RT12 EXTI_RTSR_TR12 +#define EXTI_RTSR_RT13 EXTI_RTSR_TR13 +#define EXTI_RTSR_RT14 EXTI_RTSR_TR14 +#define EXTI_RTSR_RT15 EXTI_RTSR_TR15 +#define EXTI_RTSR_RT16 EXTI_RTSR_TR16 +#define EXTI_RTSR_RT17 EXTI_RTSR_TR17 +#define EXTI_RTSR_RT18 EXTI_RTSR_TR18 + +/****************** Bit definition for EXTI_FTSR register *******************/ +#define EXTI_FTSR_TR0_Pos (0U) +#define EXTI_FTSR_TR0_Msk (0x1UL << EXTI_FTSR_TR0_Pos) /*!< 0x00000001 */ +#define EXTI_FTSR_TR0 EXTI_FTSR_TR0_Msk /*!< Falling trigger event configuration bit of line 0 */ +#define EXTI_FTSR_TR1_Pos (1U) +#define EXTI_FTSR_TR1_Msk (0x1UL << EXTI_FTSR_TR1_Pos) /*!< 0x00000002 */ +#define EXTI_FTSR_TR1 EXTI_FTSR_TR1_Msk /*!< Falling trigger event configuration bit of line 1 */ +#define EXTI_FTSR_TR2_Pos (2U) +#define EXTI_FTSR_TR2_Msk (0x1UL << EXTI_FTSR_TR2_Pos) /*!< 0x00000004 */ +#define EXTI_FTSR_TR2 EXTI_FTSR_TR2_Msk /*!< Falling trigger event configuration bit of line 2 */ +#define EXTI_FTSR_TR3_Pos (3U) +#define EXTI_FTSR_TR3_Msk (0x1UL << EXTI_FTSR_TR3_Pos) /*!< 0x00000008 */ +#define EXTI_FTSR_TR3 EXTI_FTSR_TR3_Msk /*!< Falling trigger event configuration bit of line 3 */ +#define EXTI_FTSR_TR4_Pos (4U) +#define EXTI_FTSR_TR4_Msk (0x1UL << EXTI_FTSR_TR4_Pos) /*!< 0x00000010 */ +#define EXTI_FTSR_TR4 EXTI_FTSR_TR4_Msk /*!< Falling trigger event configuration bit of line 4 */ +#define EXTI_FTSR_TR5_Pos (5U) +#define EXTI_FTSR_TR5_Msk (0x1UL << EXTI_FTSR_TR5_Pos) /*!< 0x00000020 */ +#define EXTI_FTSR_TR5 EXTI_FTSR_TR5_Msk /*!< Falling trigger event configuration bit of line 5 */ +#define EXTI_FTSR_TR6_Pos (6U) +#define EXTI_FTSR_TR6_Msk (0x1UL << EXTI_FTSR_TR6_Pos) /*!< 0x00000040 */ +#define EXTI_FTSR_TR6 EXTI_FTSR_TR6_Msk /*!< Falling trigger event configuration bit of line 6 */ +#define EXTI_FTSR_TR7_Pos (7U) +#define EXTI_FTSR_TR7_Msk (0x1UL << EXTI_FTSR_TR7_Pos) /*!< 0x00000080 */ +#define EXTI_FTSR_TR7 EXTI_FTSR_TR7_Msk /*!< Falling trigger event configuration bit of line 7 */ +#define EXTI_FTSR_TR8_Pos (8U) +#define EXTI_FTSR_TR8_Msk (0x1UL << EXTI_FTSR_TR8_Pos) /*!< 0x00000100 */ +#define EXTI_FTSR_TR8 EXTI_FTSR_TR8_Msk /*!< Falling trigger event configuration bit of line 8 */ +#define EXTI_FTSR_TR9_Pos (9U) +#define EXTI_FTSR_TR9_Msk (0x1UL << EXTI_FTSR_TR9_Pos) /*!< 0x00000200 */ +#define EXTI_FTSR_TR9 EXTI_FTSR_TR9_Msk /*!< Falling trigger event configuration bit of line 9 */ +#define EXTI_FTSR_TR10_Pos (10U) +#define EXTI_FTSR_TR10_Msk (0x1UL << EXTI_FTSR_TR10_Pos) /*!< 0x00000400 */ +#define EXTI_FTSR_TR10 EXTI_FTSR_TR10_Msk /*!< Falling trigger event configuration bit of line 10 */ +#define EXTI_FTSR_TR11_Pos (11U) +#define EXTI_FTSR_TR11_Msk (0x1UL << EXTI_FTSR_TR11_Pos) /*!< 0x00000800 */ +#define EXTI_FTSR_TR11 EXTI_FTSR_TR11_Msk /*!< Falling trigger event configuration bit of line 11 */ +#define EXTI_FTSR_TR12_Pos (12U) +#define EXTI_FTSR_TR12_Msk (0x1UL << EXTI_FTSR_TR12_Pos) /*!< 0x00001000 */ +#define EXTI_FTSR_TR12 EXTI_FTSR_TR12_Msk /*!< Falling trigger event configuration bit of line 12 */ +#define EXTI_FTSR_TR13_Pos (13U) +#define EXTI_FTSR_TR13_Msk (0x1UL << EXTI_FTSR_TR13_Pos) /*!< 0x00002000 */ +#define EXTI_FTSR_TR13 EXTI_FTSR_TR13_Msk /*!< Falling trigger event configuration bit of line 13 */ +#define EXTI_FTSR_TR14_Pos (14U) +#define EXTI_FTSR_TR14_Msk (0x1UL << EXTI_FTSR_TR14_Pos) /*!< 0x00004000 */ +#define EXTI_FTSR_TR14 EXTI_FTSR_TR14_Msk /*!< Falling trigger event configuration bit of line 14 */ +#define EXTI_FTSR_TR15_Pos (15U) +#define EXTI_FTSR_TR15_Msk (0x1UL << EXTI_FTSR_TR15_Pos) /*!< 0x00008000 */ +#define EXTI_FTSR_TR15 EXTI_FTSR_TR15_Msk /*!< Falling trigger event configuration bit of line 15 */ +#define EXTI_FTSR_TR16_Pos (16U) +#define EXTI_FTSR_TR16_Msk (0x1UL << EXTI_FTSR_TR16_Pos) /*!< 0x00010000 */ +#define EXTI_FTSR_TR16 EXTI_FTSR_TR16_Msk /*!< Falling trigger event configuration bit of line 16 */ +#define EXTI_FTSR_TR17_Pos (17U) +#define EXTI_FTSR_TR17_Msk (0x1UL << EXTI_FTSR_TR17_Pos) /*!< 0x00020000 */ +#define EXTI_FTSR_TR17 EXTI_FTSR_TR17_Msk /*!< Falling trigger event configuration bit of line 17 */ +#define EXTI_FTSR_TR18_Pos (18U) +#define EXTI_FTSR_TR18_Msk (0x1UL << EXTI_FTSR_TR18_Pos) /*!< 0x00040000 */ +#define EXTI_FTSR_TR18 EXTI_FTSR_TR18_Msk /*!< Falling trigger event configuration bit of line 18 */ + +/* References Defines */ +#define EXTI_FTSR_FT0 EXTI_FTSR_TR0 +#define EXTI_FTSR_FT1 EXTI_FTSR_TR1 +#define EXTI_FTSR_FT2 EXTI_FTSR_TR2 +#define EXTI_FTSR_FT3 EXTI_FTSR_TR3 +#define EXTI_FTSR_FT4 EXTI_FTSR_TR4 +#define EXTI_FTSR_FT5 EXTI_FTSR_TR5 +#define EXTI_FTSR_FT6 EXTI_FTSR_TR6 +#define EXTI_FTSR_FT7 EXTI_FTSR_TR7 +#define EXTI_FTSR_FT8 EXTI_FTSR_TR8 +#define EXTI_FTSR_FT9 EXTI_FTSR_TR9 +#define EXTI_FTSR_FT10 EXTI_FTSR_TR10 +#define EXTI_FTSR_FT11 EXTI_FTSR_TR11 +#define EXTI_FTSR_FT12 EXTI_FTSR_TR12 +#define EXTI_FTSR_FT13 EXTI_FTSR_TR13 +#define EXTI_FTSR_FT14 EXTI_FTSR_TR14 +#define EXTI_FTSR_FT15 EXTI_FTSR_TR15 +#define EXTI_FTSR_FT16 EXTI_FTSR_TR16 +#define EXTI_FTSR_FT17 EXTI_FTSR_TR17 +#define EXTI_FTSR_FT18 EXTI_FTSR_TR18 + +/****************** Bit definition for EXTI_SWIER register ******************/ +#define EXTI_SWIER_SWIER0_Pos (0U) +#define EXTI_SWIER_SWIER0_Msk (0x1UL << EXTI_SWIER_SWIER0_Pos) /*!< 0x00000001 */ +#define EXTI_SWIER_SWIER0 EXTI_SWIER_SWIER0_Msk /*!< Software Interrupt on line 0 */ +#define EXTI_SWIER_SWIER1_Pos (1U) +#define EXTI_SWIER_SWIER1_Msk (0x1UL << EXTI_SWIER_SWIER1_Pos) /*!< 0x00000002 */ +#define EXTI_SWIER_SWIER1 EXTI_SWIER_SWIER1_Msk /*!< Software Interrupt on line 1 */ +#define EXTI_SWIER_SWIER2_Pos (2U) +#define EXTI_SWIER_SWIER2_Msk (0x1UL << EXTI_SWIER_SWIER2_Pos) /*!< 0x00000004 */ +#define EXTI_SWIER_SWIER2 EXTI_SWIER_SWIER2_Msk /*!< Software Interrupt on line 2 */ +#define EXTI_SWIER_SWIER3_Pos (3U) +#define EXTI_SWIER_SWIER3_Msk (0x1UL << EXTI_SWIER_SWIER3_Pos) /*!< 0x00000008 */ +#define EXTI_SWIER_SWIER3 EXTI_SWIER_SWIER3_Msk /*!< Software Interrupt on line 3 */ +#define EXTI_SWIER_SWIER4_Pos (4U) +#define EXTI_SWIER_SWIER4_Msk (0x1UL << EXTI_SWIER_SWIER4_Pos) /*!< 0x00000010 */ +#define EXTI_SWIER_SWIER4 EXTI_SWIER_SWIER4_Msk /*!< Software Interrupt on line 4 */ +#define EXTI_SWIER_SWIER5_Pos (5U) +#define EXTI_SWIER_SWIER5_Msk (0x1UL << EXTI_SWIER_SWIER5_Pos) /*!< 0x00000020 */ +#define EXTI_SWIER_SWIER5 EXTI_SWIER_SWIER5_Msk /*!< Software Interrupt on line 5 */ +#define EXTI_SWIER_SWIER6_Pos (6U) +#define EXTI_SWIER_SWIER6_Msk (0x1UL << EXTI_SWIER_SWIER6_Pos) /*!< 0x00000040 */ +#define EXTI_SWIER_SWIER6 EXTI_SWIER_SWIER6_Msk /*!< Software Interrupt on line 6 */ +#define EXTI_SWIER_SWIER7_Pos (7U) +#define EXTI_SWIER_SWIER7_Msk (0x1UL << EXTI_SWIER_SWIER7_Pos) /*!< 0x00000080 */ +#define EXTI_SWIER_SWIER7 EXTI_SWIER_SWIER7_Msk /*!< Software Interrupt on line 7 */ +#define EXTI_SWIER_SWIER8_Pos (8U) +#define EXTI_SWIER_SWIER8_Msk (0x1UL << EXTI_SWIER_SWIER8_Pos) /*!< 0x00000100 */ +#define EXTI_SWIER_SWIER8 EXTI_SWIER_SWIER8_Msk /*!< Software Interrupt on line 8 */ +#define EXTI_SWIER_SWIER9_Pos (9U) +#define EXTI_SWIER_SWIER9_Msk (0x1UL << EXTI_SWIER_SWIER9_Pos) /*!< 0x00000200 */ +#define EXTI_SWIER_SWIER9 EXTI_SWIER_SWIER9_Msk /*!< Software Interrupt on line 9 */ +#define EXTI_SWIER_SWIER10_Pos (10U) +#define EXTI_SWIER_SWIER10_Msk (0x1UL << EXTI_SWIER_SWIER10_Pos) /*!< 0x00000400 */ +#define EXTI_SWIER_SWIER10 EXTI_SWIER_SWIER10_Msk /*!< Software Interrupt on line 10 */ +#define EXTI_SWIER_SWIER11_Pos (11U) +#define EXTI_SWIER_SWIER11_Msk (0x1UL << EXTI_SWIER_SWIER11_Pos) /*!< 0x00000800 */ +#define EXTI_SWIER_SWIER11 EXTI_SWIER_SWIER11_Msk /*!< Software Interrupt on line 11 */ +#define EXTI_SWIER_SWIER12_Pos (12U) +#define EXTI_SWIER_SWIER12_Msk (0x1UL << EXTI_SWIER_SWIER12_Pos) /*!< 0x00001000 */ +#define EXTI_SWIER_SWIER12 EXTI_SWIER_SWIER12_Msk /*!< Software Interrupt on line 12 */ +#define EXTI_SWIER_SWIER13_Pos (13U) +#define EXTI_SWIER_SWIER13_Msk (0x1UL << EXTI_SWIER_SWIER13_Pos) /*!< 0x00002000 */ +#define EXTI_SWIER_SWIER13 EXTI_SWIER_SWIER13_Msk /*!< Software Interrupt on line 13 */ +#define EXTI_SWIER_SWIER14_Pos (14U) +#define EXTI_SWIER_SWIER14_Msk (0x1UL << EXTI_SWIER_SWIER14_Pos) /*!< 0x00004000 */ +#define EXTI_SWIER_SWIER14 EXTI_SWIER_SWIER14_Msk /*!< Software Interrupt on line 14 */ +#define EXTI_SWIER_SWIER15_Pos (15U) +#define EXTI_SWIER_SWIER15_Msk (0x1UL << EXTI_SWIER_SWIER15_Pos) /*!< 0x00008000 */ +#define EXTI_SWIER_SWIER15 EXTI_SWIER_SWIER15_Msk /*!< Software Interrupt on line 15 */ +#define EXTI_SWIER_SWIER16_Pos (16U) +#define EXTI_SWIER_SWIER16_Msk (0x1UL << EXTI_SWIER_SWIER16_Pos) /*!< 0x00010000 */ +#define EXTI_SWIER_SWIER16 EXTI_SWIER_SWIER16_Msk /*!< Software Interrupt on line 16 */ +#define EXTI_SWIER_SWIER17_Pos (17U) +#define EXTI_SWIER_SWIER17_Msk (0x1UL << EXTI_SWIER_SWIER17_Pos) /*!< 0x00020000 */ +#define EXTI_SWIER_SWIER17 EXTI_SWIER_SWIER17_Msk /*!< Software Interrupt on line 17 */ +#define EXTI_SWIER_SWIER18_Pos (18U) +#define EXTI_SWIER_SWIER18_Msk (0x1UL << EXTI_SWIER_SWIER18_Pos) /*!< 0x00040000 */ +#define EXTI_SWIER_SWIER18 EXTI_SWIER_SWIER18_Msk /*!< Software Interrupt on line 18 */ + +/* References Defines */ +#define EXTI_SWIER_SWI0 EXTI_SWIER_SWIER0 +#define EXTI_SWIER_SWI1 EXTI_SWIER_SWIER1 +#define EXTI_SWIER_SWI2 EXTI_SWIER_SWIER2 +#define EXTI_SWIER_SWI3 EXTI_SWIER_SWIER3 +#define EXTI_SWIER_SWI4 EXTI_SWIER_SWIER4 +#define EXTI_SWIER_SWI5 EXTI_SWIER_SWIER5 +#define EXTI_SWIER_SWI6 EXTI_SWIER_SWIER6 +#define EXTI_SWIER_SWI7 EXTI_SWIER_SWIER7 +#define EXTI_SWIER_SWI8 EXTI_SWIER_SWIER8 +#define EXTI_SWIER_SWI9 EXTI_SWIER_SWIER9 +#define EXTI_SWIER_SWI10 EXTI_SWIER_SWIER10 +#define EXTI_SWIER_SWI11 EXTI_SWIER_SWIER11 +#define EXTI_SWIER_SWI12 EXTI_SWIER_SWIER12 +#define EXTI_SWIER_SWI13 EXTI_SWIER_SWIER13 +#define EXTI_SWIER_SWI14 EXTI_SWIER_SWIER14 +#define EXTI_SWIER_SWI15 EXTI_SWIER_SWIER15 +#define EXTI_SWIER_SWI16 EXTI_SWIER_SWIER16 +#define EXTI_SWIER_SWI17 EXTI_SWIER_SWIER17 +#define EXTI_SWIER_SWI18 EXTI_SWIER_SWIER18 + +/******************* Bit definition for EXTI_PR register ********************/ +#define EXTI_PR_PR0_Pos (0U) +#define EXTI_PR_PR0_Msk (0x1UL << EXTI_PR_PR0_Pos) /*!< 0x00000001 */ +#define EXTI_PR_PR0 EXTI_PR_PR0_Msk /*!< Pending bit for line 0 */ +#define EXTI_PR_PR1_Pos (1U) +#define EXTI_PR_PR1_Msk (0x1UL << EXTI_PR_PR1_Pos) /*!< 0x00000002 */ +#define EXTI_PR_PR1 EXTI_PR_PR1_Msk /*!< Pending bit for line 1 */ +#define EXTI_PR_PR2_Pos (2U) +#define EXTI_PR_PR2_Msk (0x1UL << EXTI_PR_PR2_Pos) /*!< 0x00000004 */ +#define EXTI_PR_PR2 EXTI_PR_PR2_Msk /*!< Pending bit for line 2 */ +#define EXTI_PR_PR3_Pos (3U) +#define EXTI_PR_PR3_Msk (0x1UL << EXTI_PR_PR3_Pos) /*!< 0x00000008 */ +#define EXTI_PR_PR3 EXTI_PR_PR3_Msk /*!< Pending bit for line 3 */ +#define EXTI_PR_PR4_Pos (4U) +#define EXTI_PR_PR4_Msk (0x1UL << EXTI_PR_PR4_Pos) /*!< 0x00000010 */ +#define EXTI_PR_PR4 EXTI_PR_PR4_Msk /*!< Pending bit for line 4 */ +#define EXTI_PR_PR5_Pos (5U) +#define EXTI_PR_PR5_Msk (0x1UL << EXTI_PR_PR5_Pos) /*!< 0x00000020 */ +#define EXTI_PR_PR5 EXTI_PR_PR5_Msk /*!< Pending bit for line 5 */ +#define EXTI_PR_PR6_Pos (6U) +#define EXTI_PR_PR6_Msk (0x1UL << EXTI_PR_PR6_Pos) /*!< 0x00000040 */ +#define EXTI_PR_PR6 EXTI_PR_PR6_Msk /*!< Pending bit for line 6 */ +#define EXTI_PR_PR7_Pos (7U) +#define EXTI_PR_PR7_Msk (0x1UL << EXTI_PR_PR7_Pos) /*!< 0x00000080 */ +#define EXTI_PR_PR7 EXTI_PR_PR7_Msk /*!< Pending bit for line 7 */ +#define EXTI_PR_PR8_Pos (8U) +#define EXTI_PR_PR8_Msk (0x1UL << EXTI_PR_PR8_Pos) /*!< 0x00000100 */ +#define EXTI_PR_PR8 EXTI_PR_PR8_Msk /*!< Pending bit for line 8 */ +#define EXTI_PR_PR9_Pos (9U) +#define EXTI_PR_PR9_Msk (0x1UL << EXTI_PR_PR9_Pos) /*!< 0x00000200 */ +#define EXTI_PR_PR9 EXTI_PR_PR9_Msk /*!< Pending bit for line 9 */ +#define EXTI_PR_PR10_Pos (10U) +#define EXTI_PR_PR10_Msk (0x1UL << EXTI_PR_PR10_Pos) /*!< 0x00000400 */ +#define EXTI_PR_PR10 EXTI_PR_PR10_Msk /*!< Pending bit for line 10 */ +#define EXTI_PR_PR11_Pos (11U) +#define EXTI_PR_PR11_Msk (0x1UL << EXTI_PR_PR11_Pos) /*!< 0x00000800 */ +#define EXTI_PR_PR11 EXTI_PR_PR11_Msk /*!< Pending bit for line 11 */ +#define EXTI_PR_PR12_Pos (12U) +#define EXTI_PR_PR12_Msk (0x1UL << EXTI_PR_PR12_Pos) /*!< 0x00001000 */ +#define EXTI_PR_PR12 EXTI_PR_PR12_Msk /*!< Pending bit for line 12 */ +#define EXTI_PR_PR13_Pos (13U) +#define EXTI_PR_PR13_Msk (0x1UL << EXTI_PR_PR13_Pos) /*!< 0x00002000 */ +#define EXTI_PR_PR13 EXTI_PR_PR13_Msk /*!< Pending bit for line 13 */ +#define EXTI_PR_PR14_Pos (14U) +#define EXTI_PR_PR14_Msk (0x1UL << EXTI_PR_PR14_Pos) /*!< 0x00004000 */ +#define EXTI_PR_PR14 EXTI_PR_PR14_Msk /*!< Pending bit for line 14 */ +#define EXTI_PR_PR15_Pos (15U) +#define EXTI_PR_PR15_Msk (0x1UL << EXTI_PR_PR15_Pos) /*!< 0x00008000 */ +#define EXTI_PR_PR15 EXTI_PR_PR15_Msk /*!< Pending bit for line 15 */ +#define EXTI_PR_PR16_Pos (16U) +#define EXTI_PR_PR16_Msk (0x1UL << EXTI_PR_PR16_Pos) /*!< 0x00010000 */ +#define EXTI_PR_PR16 EXTI_PR_PR16_Msk /*!< Pending bit for line 16 */ +#define EXTI_PR_PR17_Pos (17U) +#define EXTI_PR_PR17_Msk (0x1UL << EXTI_PR_PR17_Pos) /*!< 0x00020000 */ +#define EXTI_PR_PR17 EXTI_PR_PR17_Msk /*!< Pending bit for line 17 */ +#define EXTI_PR_PR18_Pos (18U) +#define EXTI_PR_PR18_Msk (0x1UL << EXTI_PR_PR18_Pos) /*!< 0x00040000 */ +#define EXTI_PR_PR18 EXTI_PR_PR18_Msk /*!< Pending bit for line 18 */ + +/* References Defines */ +#define EXTI_PR_PIF0 EXTI_PR_PR0 +#define EXTI_PR_PIF1 EXTI_PR_PR1 +#define EXTI_PR_PIF2 EXTI_PR_PR2 +#define EXTI_PR_PIF3 EXTI_PR_PR3 +#define EXTI_PR_PIF4 EXTI_PR_PR4 +#define EXTI_PR_PIF5 EXTI_PR_PR5 +#define EXTI_PR_PIF6 EXTI_PR_PR6 +#define EXTI_PR_PIF7 EXTI_PR_PR7 +#define EXTI_PR_PIF8 EXTI_PR_PR8 +#define EXTI_PR_PIF9 EXTI_PR_PR9 +#define EXTI_PR_PIF10 EXTI_PR_PR10 +#define EXTI_PR_PIF11 EXTI_PR_PR11 +#define EXTI_PR_PIF12 EXTI_PR_PR12 +#define EXTI_PR_PIF13 EXTI_PR_PR13 +#define EXTI_PR_PIF14 EXTI_PR_PR14 +#define EXTI_PR_PIF15 EXTI_PR_PR15 +#define EXTI_PR_PIF16 EXTI_PR_PR16 +#define EXTI_PR_PIF17 EXTI_PR_PR17 +#define EXTI_PR_PIF18 EXTI_PR_PR18 + +/******************************************************************************/ +/* */ +/* DMA Controller */ +/* */ +/******************************************************************************/ + +/******************* Bit definition for DMA_ISR register ********************/ +#define DMA_ISR_GIF1_Pos (0U) +#define DMA_ISR_GIF1_Msk (0x1UL << DMA_ISR_GIF1_Pos) /*!< 0x00000001 */ +#define DMA_ISR_GIF1 DMA_ISR_GIF1_Msk /*!< Channel 1 Global interrupt flag */ +#define DMA_ISR_TCIF1_Pos (1U) +#define DMA_ISR_TCIF1_Msk (0x1UL << DMA_ISR_TCIF1_Pos) /*!< 0x00000002 */ +#define DMA_ISR_TCIF1 DMA_ISR_TCIF1_Msk /*!< Channel 1 Transfer Complete flag */ +#define DMA_ISR_HTIF1_Pos (2U) +#define DMA_ISR_HTIF1_Msk (0x1UL << DMA_ISR_HTIF1_Pos) /*!< 0x00000004 */ +#define DMA_ISR_HTIF1 DMA_ISR_HTIF1_Msk /*!< Channel 1 Half Transfer flag */ +#define DMA_ISR_TEIF1_Pos (3U) +#define DMA_ISR_TEIF1_Msk (0x1UL << DMA_ISR_TEIF1_Pos) /*!< 0x00000008 */ +#define DMA_ISR_TEIF1 DMA_ISR_TEIF1_Msk /*!< Channel 1 Transfer Error flag */ +#define DMA_ISR_GIF2_Pos (4U) +#define DMA_ISR_GIF2_Msk (0x1UL << DMA_ISR_GIF2_Pos) /*!< 0x00000010 */ +#define DMA_ISR_GIF2 DMA_ISR_GIF2_Msk /*!< Channel 2 Global interrupt flag */ +#define DMA_ISR_TCIF2_Pos (5U) +#define DMA_ISR_TCIF2_Msk (0x1UL << DMA_ISR_TCIF2_Pos) /*!< 0x00000020 */ +#define DMA_ISR_TCIF2 DMA_ISR_TCIF2_Msk /*!< Channel 2 Transfer Complete flag */ +#define DMA_ISR_HTIF2_Pos (6U) +#define DMA_ISR_HTIF2_Msk (0x1UL << DMA_ISR_HTIF2_Pos) /*!< 0x00000040 */ +#define DMA_ISR_HTIF2 DMA_ISR_HTIF2_Msk /*!< Channel 2 Half Transfer flag */ +#define DMA_ISR_TEIF2_Pos (7U) +#define DMA_ISR_TEIF2_Msk (0x1UL << DMA_ISR_TEIF2_Pos) /*!< 0x00000080 */ +#define DMA_ISR_TEIF2 DMA_ISR_TEIF2_Msk /*!< Channel 2 Transfer Error flag */ +#define DMA_ISR_GIF3_Pos (8U) +#define DMA_ISR_GIF3_Msk (0x1UL << DMA_ISR_GIF3_Pos) /*!< 0x00000100 */ +#define DMA_ISR_GIF3 DMA_ISR_GIF3_Msk /*!< Channel 3 Global interrupt flag */ +#define DMA_ISR_TCIF3_Pos (9U) +#define DMA_ISR_TCIF3_Msk (0x1UL << DMA_ISR_TCIF3_Pos) /*!< 0x00000200 */ +#define DMA_ISR_TCIF3 DMA_ISR_TCIF3_Msk /*!< Channel 3 Transfer Complete flag */ +#define DMA_ISR_HTIF3_Pos (10U) +#define DMA_ISR_HTIF3_Msk (0x1UL << DMA_ISR_HTIF3_Pos) /*!< 0x00000400 */ +#define DMA_ISR_HTIF3 DMA_ISR_HTIF3_Msk /*!< Channel 3 Half Transfer flag */ +#define DMA_ISR_TEIF3_Pos (11U) +#define DMA_ISR_TEIF3_Msk (0x1UL << DMA_ISR_TEIF3_Pos) /*!< 0x00000800 */ +#define DMA_ISR_TEIF3 DMA_ISR_TEIF3_Msk /*!< Channel 3 Transfer Error flag */ +#define DMA_ISR_GIF4_Pos (12U) +#define DMA_ISR_GIF4_Msk (0x1UL << DMA_ISR_GIF4_Pos) /*!< 0x00001000 */ +#define DMA_ISR_GIF4 DMA_ISR_GIF4_Msk /*!< Channel 4 Global interrupt flag */ +#define DMA_ISR_TCIF4_Pos (13U) +#define DMA_ISR_TCIF4_Msk (0x1UL << DMA_ISR_TCIF4_Pos) /*!< 0x00002000 */ +#define DMA_ISR_TCIF4 DMA_ISR_TCIF4_Msk /*!< Channel 4 Transfer Complete flag */ +#define DMA_ISR_HTIF4_Pos (14U) +#define DMA_ISR_HTIF4_Msk (0x1UL << DMA_ISR_HTIF4_Pos) /*!< 0x00004000 */ +#define DMA_ISR_HTIF4 DMA_ISR_HTIF4_Msk /*!< Channel 4 Half Transfer flag */ +#define DMA_ISR_TEIF4_Pos (15U) +#define DMA_ISR_TEIF4_Msk (0x1UL << DMA_ISR_TEIF4_Pos) /*!< 0x00008000 */ +#define DMA_ISR_TEIF4 DMA_ISR_TEIF4_Msk /*!< Channel 4 Transfer Error flag */ +#define DMA_ISR_GIF5_Pos (16U) +#define DMA_ISR_GIF5_Msk (0x1UL << DMA_ISR_GIF5_Pos) /*!< 0x00010000 */ +#define DMA_ISR_GIF5 DMA_ISR_GIF5_Msk /*!< Channel 5 Global interrupt flag */ +#define DMA_ISR_TCIF5_Pos (17U) +#define DMA_ISR_TCIF5_Msk (0x1UL << DMA_ISR_TCIF5_Pos) /*!< 0x00020000 */ +#define DMA_ISR_TCIF5 DMA_ISR_TCIF5_Msk /*!< Channel 5 Transfer Complete flag */ +#define DMA_ISR_HTIF5_Pos (18U) +#define DMA_ISR_HTIF5_Msk (0x1UL << DMA_ISR_HTIF5_Pos) /*!< 0x00040000 */ +#define DMA_ISR_HTIF5 DMA_ISR_HTIF5_Msk /*!< Channel 5 Half Transfer flag */ +#define DMA_ISR_TEIF5_Pos (19U) +#define DMA_ISR_TEIF5_Msk (0x1UL << DMA_ISR_TEIF5_Pos) /*!< 0x00080000 */ +#define DMA_ISR_TEIF5 DMA_ISR_TEIF5_Msk /*!< Channel 5 Transfer Error flag */ +#define DMA_ISR_GIF6_Pos (20U) +#define DMA_ISR_GIF6_Msk (0x1UL << DMA_ISR_GIF6_Pos) /*!< 0x00100000 */ +#define DMA_ISR_GIF6 DMA_ISR_GIF6_Msk /*!< Channel 6 Global interrupt flag */ +#define DMA_ISR_TCIF6_Pos (21U) +#define DMA_ISR_TCIF6_Msk (0x1UL << DMA_ISR_TCIF6_Pos) /*!< 0x00200000 */ +#define DMA_ISR_TCIF6 DMA_ISR_TCIF6_Msk /*!< Channel 6 Transfer Complete flag */ +#define DMA_ISR_HTIF6_Pos (22U) +#define DMA_ISR_HTIF6_Msk (0x1UL << DMA_ISR_HTIF6_Pos) /*!< 0x00400000 */ +#define DMA_ISR_HTIF6 DMA_ISR_HTIF6_Msk /*!< Channel 6 Half Transfer flag */ +#define DMA_ISR_TEIF6_Pos (23U) +#define DMA_ISR_TEIF6_Msk (0x1UL << DMA_ISR_TEIF6_Pos) /*!< 0x00800000 */ +#define DMA_ISR_TEIF6 DMA_ISR_TEIF6_Msk /*!< Channel 6 Transfer Error flag */ +#define DMA_ISR_GIF7_Pos (24U) +#define DMA_ISR_GIF7_Msk (0x1UL << DMA_ISR_GIF7_Pos) /*!< 0x01000000 */ +#define DMA_ISR_GIF7 DMA_ISR_GIF7_Msk /*!< Channel 7 Global interrupt flag */ +#define DMA_ISR_TCIF7_Pos (25U) +#define DMA_ISR_TCIF7_Msk (0x1UL << DMA_ISR_TCIF7_Pos) /*!< 0x02000000 */ +#define DMA_ISR_TCIF7 DMA_ISR_TCIF7_Msk /*!< Channel 7 Transfer Complete flag */ +#define DMA_ISR_HTIF7_Pos (26U) +#define DMA_ISR_HTIF7_Msk (0x1UL << DMA_ISR_HTIF7_Pos) /*!< 0x04000000 */ +#define DMA_ISR_HTIF7 DMA_ISR_HTIF7_Msk /*!< Channel 7 Half Transfer flag */ +#define DMA_ISR_TEIF7_Pos (27U) +#define DMA_ISR_TEIF7_Msk (0x1UL << DMA_ISR_TEIF7_Pos) /*!< 0x08000000 */ +#define DMA_ISR_TEIF7 DMA_ISR_TEIF7_Msk /*!< Channel 7 Transfer Error flag */ + +/******************* Bit definition for DMA_IFCR register *******************/ +#define DMA_IFCR_CGIF1_Pos (0U) +#define DMA_IFCR_CGIF1_Msk (0x1UL << DMA_IFCR_CGIF1_Pos) /*!< 0x00000001 */ +#define DMA_IFCR_CGIF1 DMA_IFCR_CGIF1_Msk /*!< Channel 1 Global interrupt clear */ +#define DMA_IFCR_CTCIF1_Pos (1U) +#define DMA_IFCR_CTCIF1_Msk (0x1UL << DMA_IFCR_CTCIF1_Pos) /*!< 0x00000002 */ +#define DMA_IFCR_CTCIF1 DMA_IFCR_CTCIF1_Msk /*!< Channel 1 Transfer Complete clear */ +#define DMA_IFCR_CHTIF1_Pos (2U) +#define DMA_IFCR_CHTIF1_Msk (0x1UL << DMA_IFCR_CHTIF1_Pos) /*!< 0x00000004 */ +#define DMA_IFCR_CHTIF1 DMA_IFCR_CHTIF1_Msk /*!< Channel 1 Half Transfer clear */ +#define DMA_IFCR_CTEIF1_Pos (3U) +#define DMA_IFCR_CTEIF1_Msk (0x1UL << DMA_IFCR_CTEIF1_Pos) /*!< 0x00000008 */ +#define DMA_IFCR_CTEIF1 DMA_IFCR_CTEIF1_Msk /*!< Channel 1 Transfer Error clear */ +#define DMA_IFCR_CGIF2_Pos (4U) +#define DMA_IFCR_CGIF2_Msk (0x1UL << DMA_IFCR_CGIF2_Pos) /*!< 0x00000010 */ +#define DMA_IFCR_CGIF2 DMA_IFCR_CGIF2_Msk /*!< Channel 2 Global interrupt clear */ +#define DMA_IFCR_CTCIF2_Pos (5U) +#define DMA_IFCR_CTCIF2_Msk (0x1UL << DMA_IFCR_CTCIF2_Pos) /*!< 0x00000020 */ +#define DMA_IFCR_CTCIF2 DMA_IFCR_CTCIF2_Msk /*!< Channel 2 Transfer Complete clear */ +#define DMA_IFCR_CHTIF2_Pos (6U) +#define DMA_IFCR_CHTIF2_Msk (0x1UL << DMA_IFCR_CHTIF2_Pos) /*!< 0x00000040 */ +#define DMA_IFCR_CHTIF2 DMA_IFCR_CHTIF2_Msk /*!< Channel 2 Half Transfer clear */ +#define DMA_IFCR_CTEIF2_Pos (7U) +#define DMA_IFCR_CTEIF2_Msk (0x1UL << DMA_IFCR_CTEIF2_Pos) /*!< 0x00000080 */ +#define DMA_IFCR_CTEIF2 DMA_IFCR_CTEIF2_Msk /*!< Channel 2 Transfer Error clear */ +#define DMA_IFCR_CGIF3_Pos (8U) +#define DMA_IFCR_CGIF3_Msk (0x1UL << DMA_IFCR_CGIF3_Pos) /*!< 0x00000100 */ +#define DMA_IFCR_CGIF3 DMA_IFCR_CGIF3_Msk /*!< Channel 3 Global interrupt clear */ +#define DMA_IFCR_CTCIF3_Pos (9U) +#define DMA_IFCR_CTCIF3_Msk (0x1UL << DMA_IFCR_CTCIF3_Pos) /*!< 0x00000200 */ +#define DMA_IFCR_CTCIF3 DMA_IFCR_CTCIF3_Msk /*!< Channel 3 Transfer Complete clear */ +#define DMA_IFCR_CHTIF3_Pos (10U) +#define DMA_IFCR_CHTIF3_Msk (0x1UL << DMA_IFCR_CHTIF3_Pos) /*!< 0x00000400 */ +#define DMA_IFCR_CHTIF3 DMA_IFCR_CHTIF3_Msk /*!< Channel 3 Half Transfer clear */ +#define DMA_IFCR_CTEIF3_Pos (11U) +#define DMA_IFCR_CTEIF3_Msk (0x1UL << DMA_IFCR_CTEIF3_Pos) /*!< 0x00000800 */ +#define DMA_IFCR_CTEIF3 DMA_IFCR_CTEIF3_Msk /*!< Channel 3 Transfer Error clear */ +#define DMA_IFCR_CGIF4_Pos (12U) +#define DMA_IFCR_CGIF4_Msk (0x1UL << DMA_IFCR_CGIF4_Pos) /*!< 0x00001000 */ +#define DMA_IFCR_CGIF4 DMA_IFCR_CGIF4_Msk /*!< Channel 4 Global interrupt clear */ +#define DMA_IFCR_CTCIF4_Pos (13U) +#define DMA_IFCR_CTCIF4_Msk (0x1UL << DMA_IFCR_CTCIF4_Pos) /*!< 0x00002000 */ +#define DMA_IFCR_CTCIF4 DMA_IFCR_CTCIF4_Msk /*!< Channel 4 Transfer Complete clear */ +#define DMA_IFCR_CHTIF4_Pos (14U) +#define DMA_IFCR_CHTIF4_Msk (0x1UL << DMA_IFCR_CHTIF4_Pos) /*!< 0x00004000 */ +#define DMA_IFCR_CHTIF4 DMA_IFCR_CHTIF4_Msk /*!< Channel 4 Half Transfer clear */ +#define DMA_IFCR_CTEIF4_Pos (15U) +#define DMA_IFCR_CTEIF4_Msk (0x1UL << DMA_IFCR_CTEIF4_Pos) /*!< 0x00008000 */ +#define DMA_IFCR_CTEIF4 DMA_IFCR_CTEIF4_Msk /*!< Channel 4 Transfer Error clear */ +#define DMA_IFCR_CGIF5_Pos (16U) +#define DMA_IFCR_CGIF5_Msk (0x1UL << DMA_IFCR_CGIF5_Pos) /*!< 0x00010000 */ +#define DMA_IFCR_CGIF5 DMA_IFCR_CGIF5_Msk /*!< Channel 5 Global interrupt clear */ +#define DMA_IFCR_CTCIF5_Pos (17U) +#define DMA_IFCR_CTCIF5_Msk (0x1UL << DMA_IFCR_CTCIF5_Pos) /*!< 0x00020000 */ +#define DMA_IFCR_CTCIF5 DMA_IFCR_CTCIF5_Msk /*!< Channel 5 Transfer Complete clear */ +#define DMA_IFCR_CHTIF5_Pos (18U) +#define DMA_IFCR_CHTIF5_Msk (0x1UL << DMA_IFCR_CHTIF5_Pos) /*!< 0x00040000 */ +#define DMA_IFCR_CHTIF5 DMA_IFCR_CHTIF5_Msk /*!< Channel 5 Half Transfer clear */ +#define DMA_IFCR_CTEIF5_Pos (19U) +#define DMA_IFCR_CTEIF5_Msk (0x1UL << DMA_IFCR_CTEIF5_Pos) /*!< 0x00080000 */ +#define DMA_IFCR_CTEIF5 DMA_IFCR_CTEIF5_Msk /*!< Channel 5 Transfer Error clear */ +#define DMA_IFCR_CGIF6_Pos (20U) +#define DMA_IFCR_CGIF6_Msk (0x1UL << DMA_IFCR_CGIF6_Pos) /*!< 0x00100000 */ +#define DMA_IFCR_CGIF6 DMA_IFCR_CGIF6_Msk /*!< Channel 6 Global interrupt clear */ +#define DMA_IFCR_CTCIF6_Pos (21U) +#define DMA_IFCR_CTCIF6_Msk (0x1UL << DMA_IFCR_CTCIF6_Pos) /*!< 0x00200000 */ +#define DMA_IFCR_CTCIF6 DMA_IFCR_CTCIF6_Msk /*!< Channel 6 Transfer Complete clear */ +#define DMA_IFCR_CHTIF6_Pos (22U) +#define DMA_IFCR_CHTIF6_Msk (0x1UL << DMA_IFCR_CHTIF6_Pos) /*!< 0x00400000 */ +#define DMA_IFCR_CHTIF6 DMA_IFCR_CHTIF6_Msk /*!< Channel 6 Half Transfer clear */ +#define DMA_IFCR_CTEIF6_Pos (23U) +#define DMA_IFCR_CTEIF6_Msk (0x1UL << DMA_IFCR_CTEIF6_Pos) /*!< 0x00800000 */ +#define DMA_IFCR_CTEIF6 DMA_IFCR_CTEIF6_Msk /*!< Channel 6 Transfer Error clear */ +#define DMA_IFCR_CGIF7_Pos (24U) +#define DMA_IFCR_CGIF7_Msk (0x1UL << DMA_IFCR_CGIF7_Pos) /*!< 0x01000000 */ +#define DMA_IFCR_CGIF7 DMA_IFCR_CGIF7_Msk /*!< Channel 7 Global interrupt clear */ +#define DMA_IFCR_CTCIF7_Pos (25U) +#define DMA_IFCR_CTCIF7_Msk (0x1UL << DMA_IFCR_CTCIF7_Pos) /*!< 0x02000000 */ +#define DMA_IFCR_CTCIF7 DMA_IFCR_CTCIF7_Msk /*!< Channel 7 Transfer Complete clear */ +#define DMA_IFCR_CHTIF7_Pos (26U) +#define DMA_IFCR_CHTIF7_Msk (0x1UL << DMA_IFCR_CHTIF7_Pos) /*!< 0x04000000 */ +#define DMA_IFCR_CHTIF7 DMA_IFCR_CHTIF7_Msk /*!< Channel 7 Half Transfer clear */ +#define DMA_IFCR_CTEIF7_Pos (27U) +#define DMA_IFCR_CTEIF7_Msk (0x1UL << DMA_IFCR_CTEIF7_Pos) /*!< 0x08000000 */ +#define DMA_IFCR_CTEIF7 DMA_IFCR_CTEIF7_Msk /*!< Channel 7 Transfer Error clear */ + +/******************* Bit definition for DMA_CCR register *******************/ +#define DMA_CCR_EN_Pos (0U) +#define DMA_CCR_EN_Msk (0x1UL << DMA_CCR_EN_Pos) /*!< 0x00000001 */ +#define DMA_CCR_EN DMA_CCR_EN_Msk /*!< Channel enable */ +#define DMA_CCR_TCIE_Pos (1U) +#define DMA_CCR_TCIE_Msk (0x1UL << DMA_CCR_TCIE_Pos) /*!< 0x00000002 */ +#define DMA_CCR_TCIE DMA_CCR_TCIE_Msk /*!< Transfer complete interrupt enable */ +#define DMA_CCR_HTIE_Pos (2U) +#define DMA_CCR_HTIE_Msk (0x1UL << DMA_CCR_HTIE_Pos) /*!< 0x00000004 */ +#define DMA_CCR_HTIE DMA_CCR_HTIE_Msk /*!< Half Transfer interrupt enable */ +#define DMA_CCR_TEIE_Pos (3U) +#define DMA_CCR_TEIE_Msk (0x1UL << DMA_CCR_TEIE_Pos) /*!< 0x00000008 */ +#define DMA_CCR_TEIE DMA_CCR_TEIE_Msk /*!< Transfer error interrupt enable */ +#define DMA_CCR_DIR_Pos (4U) +#define DMA_CCR_DIR_Msk (0x1UL << DMA_CCR_DIR_Pos) /*!< 0x00000010 */ +#define DMA_CCR_DIR DMA_CCR_DIR_Msk /*!< Data transfer direction */ +#define DMA_CCR_CIRC_Pos (5U) +#define DMA_CCR_CIRC_Msk (0x1UL << DMA_CCR_CIRC_Pos) /*!< 0x00000020 */ +#define DMA_CCR_CIRC DMA_CCR_CIRC_Msk /*!< Circular mode */ +#define DMA_CCR_PINC_Pos (6U) +#define DMA_CCR_PINC_Msk (0x1UL << DMA_CCR_PINC_Pos) /*!< 0x00000040 */ +#define DMA_CCR_PINC DMA_CCR_PINC_Msk /*!< Peripheral increment mode */ +#define DMA_CCR_MINC_Pos (7U) +#define DMA_CCR_MINC_Msk (0x1UL << DMA_CCR_MINC_Pos) /*!< 0x00000080 */ +#define DMA_CCR_MINC DMA_CCR_MINC_Msk /*!< Memory increment mode */ + +#define DMA_CCR_PSIZE_Pos (8U) +#define DMA_CCR_PSIZE_Msk (0x3UL << DMA_CCR_PSIZE_Pos) /*!< 0x00000300 */ +#define DMA_CCR_PSIZE DMA_CCR_PSIZE_Msk /*!< PSIZE[1:0] bits (Peripheral size) */ +#define DMA_CCR_PSIZE_0 (0x1UL << DMA_CCR_PSIZE_Pos) /*!< 0x00000100 */ +#define DMA_CCR_PSIZE_1 (0x2UL << DMA_CCR_PSIZE_Pos) /*!< 0x00000200 */ + +#define DMA_CCR_MSIZE_Pos (10U) +#define DMA_CCR_MSIZE_Msk (0x3UL << DMA_CCR_MSIZE_Pos) /*!< 0x00000C00 */ +#define DMA_CCR_MSIZE DMA_CCR_MSIZE_Msk /*!< MSIZE[1:0] bits (Memory size) */ +#define DMA_CCR_MSIZE_0 (0x1UL << DMA_CCR_MSIZE_Pos) /*!< 0x00000400 */ +#define DMA_CCR_MSIZE_1 (0x2UL << DMA_CCR_MSIZE_Pos) /*!< 0x00000800 */ + +#define DMA_CCR_PL_Pos (12U) +#define DMA_CCR_PL_Msk (0x3UL << DMA_CCR_PL_Pos) /*!< 0x00003000 */ +#define DMA_CCR_PL DMA_CCR_PL_Msk /*!< PL[1:0] bits(Channel Priority level) */ +#define DMA_CCR_PL_0 (0x1UL << DMA_CCR_PL_Pos) /*!< 0x00001000 */ +#define DMA_CCR_PL_1 (0x2UL << DMA_CCR_PL_Pos) /*!< 0x00002000 */ + +#define DMA_CCR_MEM2MEM_Pos (14U) +#define DMA_CCR_MEM2MEM_Msk (0x1UL << DMA_CCR_MEM2MEM_Pos) /*!< 0x00004000 */ +#define DMA_CCR_MEM2MEM DMA_CCR_MEM2MEM_Msk /*!< Memory to memory mode */ + +/****************** Bit definition for DMA_CNDTR register ******************/ +#define DMA_CNDTR_NDT_Pos (0U) +#define DMA_CNDTR_NDT_Msk (0xFFFFUL << DMA_CNDTR_NDT_Pos) /*!< 0x0000FFFF */ +#define DMA_CNDTR_NDT DMA_CNDTR_NDT_Msk /*!< Number of data to Transfer */ + +/****************** Bit definition for DMA_CPAR register *******************/ +#define DMA_CPAR_PA_Pos (0U) +#define DMA_CPAR_PA_Msk (0xFFFFFFFFUL << DMA_CPAR_PA_Pos) /*!< 0xFFFFFFFF */ +#define DMA_CPAR_PA DMA_CPAR_PA_Msk /*!< Peripheral Address */ + +/****************** Bit definition for DMA_CMAR register *******************/ +#define DMA_CMAR_MA_Pos (0U) +#define DMA_CMAR_MA_Msk (0xFFFFFFFFUL << DMA_CMAR_MA_Pos) /*!< 0xFFFFFFFF */ +#define DMA_CMAR_MA DMA_CMAR_MA_Msk /*!< Memory Address */ + +/******************************************************************************/ +/* */ +/* Analog to Digital Converter (ADC) */ +/* */ +/******************************************************************************/ + +/* + * @brief Specific device feature definitions (not present on all devices in the STM32F1 family) + */ +#define ADC_MULTIMODE_SUPPORT /*!< ADC feature available only on specific devices: multimode available on devices with several ADC instances */ + +/******************** Bit definition for ADC_SR register ********************/ +#define ADC_SR_AWD_Pos (0U) +#define ADC_SR_AWD_Msk (0x1UL << ADC_SR_AWD_Pos) /*!< 0x00000001 */ +#define ADC_SR_AWD ADC_SR_AWD_Msk /*!< ADC analog watchdog 1 flag */ +#define ADC_SR_EOS_Pos (1U) +#define ADC_SR_EOS_Msk (0x1UL << ADC_SR_EOS_Pos) /*!< 0x00000002 */ +#define ADC_SR_EOS ADC_SR_EOS_Msk /*!< ADC group regular end of sequence conversions flag */ +#define ADC_SR_JEOS_Pos (2U) +#define ADC_SR_JEOS_Msk (0x1UL << ADC_SR_JEOS_Pos) /*!< 0x00000004 */ +#define ADC_SR_JEOS ADC_SR_JEOS_Msk /*!< ADC group injected end of sequence conversions flag */ +#define ADC_SR_JSTRT_Pos (3U) +#define ADC_SR_JSTRT_Msk (0x1UL << ADC_SR_JSTRT_Pos) /*!< 0x00000008 */ +#define ADC_SR_JSTRT ADC_SR_JSTRT_Msk /*!< ADC group injected conversion start flag */ +#define ADC_SR_STRT_Pos (4U) +#define ADC_SR_STRT_Msk (0x1UL << ADC_SR_STRT_Pos) /*!< 0x00000010 */ +#define ADC_SR_STRT ADC_SR_STRT_Msk /*!< ADC group regular conversion start flag */ + +/* Legacy defines */ +#define ADC_SR_EOC (ADC_SR_EOS) +#define ADC_SR_JEOC (ADC_SR_JEOS) + +/******************* Bit definition for ADC_CR1 register ********************/ +#define ADC_CR1_AWDCH_Pos (0U) +#define ADC_CR1_AWDCH_Msk (0x1FUL << ADC_CR1_AWDCH_Pos) /*!< 0x0000001F */ +#define ADC_CR1_AWDCH ADC_CR1_AWDCH_Msk /*!< ADC analog watchdog 1 monitored channel selection */ +#define ADC_CR1_AWDCH_0 (0x01UL << ADC_CR1_AWDCH_Pos) /*!< 0x00000001 */ +#define ADC_CR1_AWDCH_1 (0x02UL << ADC_CR1_AWDCH_Pos) /*!< 0x00000002 */ +#define ADC_CR1_AWDCH_2 (0x04UL << ADC_CR1_AWDCH_Pos) /*!< 0x00000004 */ +#define ADC_CR1_AWDCH_3 (0x08UL << ADC_CR1_AWDCH_Pos) /*!< 0x00000008 */ +#define ADC_CR1_AWDCH_4 (0x10UL << ADC_CR1_AWDCH_Pos) /*!< 0x00000010 */ + +#define ADC_CR1_EOSIE_Pos (5U) +#define ADC_CR1_EOSIE_Msk (0x1UL << ADC_CR1_EOSIE_Pos) /*!< 0x00000020 */ +#define ADC_CR1_EOSIE ADC_CR1_EOSIE_Msk /*!< ADC group regular end of sequence conversions interrupt */ +#define ADC_CR1_AWDIE_Pos (6U) +#define ADC_CR1_AWDIE_Msk (0x1UL << ADC_CR1_AWDIE_Pos) /*!< 0x00000040 */ +#define ADC_CR1_AWDIE ADC_CR1_AWDIE_Msk /*!< ADC analog watchdog 1 interrupt */ +#define ADC_CR1_JEOSIE_Pos (7U) +#define ADC_CR1_JEOSIE_Msk (0x1UL << ADC_CR1_JEOSIE_Pos) /*!< 0x00000080 */ +#define ADC_CR1_JEOSIE ADC_CR1_JEOSIE_Msk /*!< ADC group injected end of sequence conversions interrupt */ +#define ADC_CR1_SCAN_Pos (8U) +#define ADC_CR1_SCAN_Msk (0x1UL << ADC_CR1_SCAN_Pos) /*!< 0x00000100 */ +#define ADC_CR1_SCAN ADC_CR1_SCAN_Msk /*!< ADC scan mode */ +#define ADC_CR1_AWDSGL_Pos (9U) +#define ADC_CR1_AWDSGL_Msk (0x1UL << ADC_CR1_AWDSGL_Pos) /*!< 0x00000200 */ +#define ADC_CR1_AWDSGL ADC_CR1_AWDSGL_Msk /*!< ADC analog watchdog 1 monitoring a single channel or all channels */ +#define ADC_CR1_JAUTO_Pos (10U) +#define ADC_CR1_JAUTO_Msk (0x1UL << ADC_CR1_JAUTO_Pos) /*!< 0x00000400 */ +#define ADC_CR1_JAUTO ADC_CR1_JAUTO_Msk /*!< ADC group injected automatic trigger mode */ +#define ADC_CR1_DISCEN_Pos (11U) +#define ADC_CR1_DISCEN_Msk (0x1UL << ADC_CR1_DISCEN_Pos) /*!< 0x00000800 */ +#define ADC_CR1_DISCEN ADC_CR1_DISCEN_Msk /*!< ADC group regular sequencer discontinuous mode */ +#define ADC_CR1_JDISCEN_Pos (12U) +#define ADC_CR1_JDISCEN_Msk (0x1UL << ADC_CR1_JDISCEN_Pos) /*!< 0x00001000 */ +#define ADC_CR1_JDISCEN ADC_CR1_JDISCEN_Msk /*!< ADC group injected sequencer discontinuous mode */ + +#define ADC_CR1_DISCNUM_Pos (13U) +#define ADC_CR1_DISCNUM_Msk (0x7UL << ADC_CR1_DISCNUM_Pos) /*!< 0x0000E000 */ +#define ADC_CR1_DISCNUM ADC_CR1_DISCNUM_Msk /*!< ADC group regular sequencer discontinuous number of ranks */ +#define ADC_CR1_DISCNUM_0 (0x1UL << ADC_CR1_DISCNUM_Pos) /*!< 0x00002000 */ +#define ADC_CR1_DISCNUM_1 (0x2UL << ADC_CR1_DISCNUM_Pos) /*!< 0x00004000 */ +#define ADC_CR1_DISCNUM_2 (0x4UL << ADC_CR1_DISCNUM_Pos) /*!< 0x00008000 */ + +#define ADC_CR1_DUALMOD_Pos (16U) +#define ADC_CR1_DUALMOD_Msk (0xFUL << ADC_CR1_DUALMOD_Pos) /*!< 0x000F0000 */ +#define ADC_CR1_DUALMOD ADC_CR1_DUALMOD_Msk /*!< ADC multimode mode selection */ +#define ADC_CR1_DUALMOD_0 (0x1UL << ADC_CR1_DUALMOD_Pos) /*!< 0x00010000 */ +#define ADC_CR1_DUALMOD_1 (0x2UL << ADC_CR1_DUALMOD_Pos) /*!< 0x00020000 */ +#define ADC_CR1_DUALMOD_2 (0x4UL << ADC_CR1_DUALMOD_Pos) /*!< 0x00040000 */ +#define ADC_CR1_DUALMOD_3 (0x8UL << ADC_CR1_DUALMOD_Pos) /*!< 0x00080000 */ + +#define ADC_CR1_JAWDEN_Pos (22U) +#define ADC_CR1_JAWDEN_Msk (0x1UL << ADC_CR1_JAWDEN_Pos) /*!< 0x00400000 */ +#define ADC_CR1_JAWDEN ADC_CR1_JAWDEN_Msk /*!< ADC analog watchdog 1 enable on scope ADC group injected */ +#define ADC_CR1_AWDEN_Pos (23U) +#define ADC_CR1_AWDEN_Msk (0x1UL << ADC_CR1_AWDEN_Pos) /*!< 0x00800000 */ +#define ADC_CR1_AWDEN ADC_CR1_AWDEN_Msk /*!< ADC analog watchdog 1 enable on scope ADC group regular */ + +/* Legacy defines */ +#define ADC_CR1_EOCIE (ADC_CR1_EOSIE) +#define ADC_CR1_JEOCIE (ADC_CR1_JEOSIE) + +/******************* Bit definition for ADC_CR2 register ********************/ +#define ADC_CR2_ADON_Pos (0U) +#define ADC_CR2_ADON_Msk (0x1UL << ADC_CR2_ADON_Pos) /*!< 0x00000001 */ +#define ADC_CR2_ADON ADC_CR2_ADON_Msk /*!< ADC enable */ +#define ADC_CR2_CONT_Pos (1U) +#define ADC_CR2_CONT_Msk (0x1UL << ADC_CR2_CONT_Pos) /*!< 0x00000002 */ +#define ADC_CR2_CONT ADC_CR2_CONT_Msk /*!< ADC group regular continuous conversion mode */ +#define ADC_CR2_CAL_Pos (2U) +#define ADC_CR2_CAL_Msk (0x1UL << ADC_CR2_CAL_Pos) /*!< 0x00000004 */ +#define ADC_CR2_CAL ADC_CR2_CAL_Msk /*!< ADC calibration start */ +#define ADC_CR2_RSTCAL_Pos (3U) +#define ADC_CR2_RSTCAL_Msk (0x1UL << ADC_CR2_RSTCAL_Pos) /*!< 0x00000008 */ +#define ADC_CR2_RSTCAL ADC_CR2_RSTCAL_Msk /*!< ADC calibration reset */ +#define ADC_CR2_DMA_Pos (8U) +#define ADC_CR2_DMA_Msk (0x1UL << ADC_CR2_DMA_Pos) /*!< 0x00000100 */ +#define ADC_CR2_DMA ADC_CR2_DMA_Msk /*!< ADC DMA transfer enable */ +#define ADC_CR2_ALIGN_Pos (11U) +#define ADC_CR2_ALIGN_Msk (0x1UL << ADC_CR2_ALIGN_Pos) /*!< 0x00000800 */ +#define ADC_CR2_ALIGN ADC_CR2_ALIGN_Msk /*!< ADC data alignement */ + +#define ADC_CR2_JEXTSEL_Pos (12U) +#define ADC_CR2_JEXTSEL_Msk (0x7UL << ADC_CR2_JEXTSEL_Pos) /*!< 0x00007000 */ +#define ADC_CR2_JEXTSEL ADC_CR2_JEXTSEL_Msk /*!< ADC group injected external trigger source */ +#define ADC_CR2_JEXTSEL_0 (0x1UL << ADC_CR2_JEXTSEL_Pos) /*!< 0x00001000 */ +#define ADC_CR2_JEXTSEL_1 (0x2UL << ADC_CR2_JEXTSEL_Pos) /*!< 0x00002000 */ +#define ADC_CR2_JEXTSEL_2 (0x4UL << ADC_CR2_JEXTSEL_Pos) /*!< 0x00004000 */ + +#define ADC_CR2_JEXTTRIG_Pos (15U) +#define ADC_CR2_JEXTTRIG_Msk (0x1UL << ADC_CR2_JEXTTRIG_Pos) /*!< 0x00008000 */ +#define ADC_CR2_JEXTTRIG ADC_CR2_JEXTTRIG_Msk /*!< ADC group injected external trigger enable */ + +#define ADC_CR2_EXTSEL_Pos (17U) +#define ADC_CR2_EXTSEL_Msk (0x7UL << ADC_CR2_EXTSEL_Pos) /*!< 0x000E0000 */ +#define ADC_CR2_EXTSEL ADC_CR2_EXTSEL_Msk /*!< ADC group regular external trigger source */ +#define ADC_CR2_EXTSEL_0 (0x1UL << ADC_CR2_EXTSEL_Pos) /*!< 0x00020000 */ +#define ADC_CR2_EXTSEL_1 (0x2UL << ADC_CR2_EXTSEL_Pos) /*!< 0x00040000 */ +#define ADC_CR2_EXTSEL_2 (0x4UL << ADC_CR2_EXTSEL_Pos) /*!< 0x00080000 */ + +#define ADC_CR2_EXTTRIG_Pos (20U) +#define ADC_CR2_EXTTRIG_Msk (0x1UL << ADC_CR2_EXTTRIG_Pos) /*!< 0x00100000 */ +#define ADC_CR2_EXTTRIG ADC_CR2_EXTTRIG_Msk /*!< ADC group regular external trigger enable */ +#define ADC_CR2_JSWSTART_Pos (21U) +#define ADC_CR2_JSWSTART_Msk (0x1UL << ADC_CR2_JSWSTART_Pos) /*!< 0x00200000 */ +#define ADC_CR2_JSWSTART ADC_CR2_JSWSTART_Msk /*!< ADC group injected conversion start */ +#define ADC_CR2_SWSTART_Pos (22U) +#define ADC_CR2_SWSTART_Msk (0x1UL << ADC_CR2_SWSTART_Pos) /*!< 0x00400000 */ +#define ADC_CR2_SWSTART ADC_CR2_SWSTART_Msk /*!< ADC group regular conversion start */ +#define ADC_CR2_TSVREFE_Pos (23U) +#define ADC_CR2_TSVREFE_Msk (0x1UL << ADC_CR2_TSVREFE_Pos) /*!< 0x00800000 */ +#define ADC_CR2_TSVREFE ADC_CR2_TSVREFE_Msk /*!< ADC internal path to VrefInt and temperature sensor enable */ + +/****************** Bit definition for ADC_SMPR1 register *******************/ +#define ADC_SMPR1_SMP10_Pos (0U) +#define ADC_SMPR1_SMP10_Msk (0x7UL << ADC_SMPR1_SMP10_Pos) /*!< 0x00000007 */ +#define ADC_SMPR1_SMP10 ADC_SMPR1_SMP10_Msk /*!< ADC channel 10 sampling time selection */ +#define ADC_SMPR1_SMP10_0 (0x1UL << ADC_SMPR1_SMP10_Pos) /*!< 0x00000001 */ +#define ADC_SMPR1_SMP10_1 (0x2UL << ADC_SMPR1_SMP10_Pos) /*!< 0x00000002 */ +#define ADC_SMPR1_SMP10_2 (0x4UL << ADC_SMPR1_SMP10_Pos) /*!< 0x00000004 */ + +#define ADC_SMPR1_SMP11_Pos (3U) +#define ADC_SMPR1_SMP11_Msk (0x7UL << ADC_SMPR1_SMP11_Pos) /*!< 0x00000038 */ +#define ADC_SMPR1_SMP11 ADC_SMPR1_SMP11_Msk /*!< ADC channel 11 sampling time selection */ +#define ADC_SMPR1_SMP11_0 (0x1UL << ADC_SMPR1_SMP11_Pos) /*!< 0x00000008 */ +#define ADC_SMPR1_SMP11_1 (0x2UL << ADC_SMPR1_SMP11_Pos) /*!< 0x00000010 */ +#define ADC_SMPR1_SMP11_2 (0x4UL << ADC_SMPR1_SMP11_Pos) /*!< 0x00000020 */ + +#define ADC_SMPR1_SMP12_Pos (6U) +#define ADC_SMPR1_SMP12_Msk (0x7UL << ADC_SMPR1_SMP12_Pos) /*!< 0x000001C0 */ +#define ADC_SMPR1_SMP12 ADC_SMPR1_SMP12_Msk /*!< ADC channel 12 sampling time selection */ +#define ADC_SMPR1_SMP12_0 (0x1UL << ADC_SMPR1_SMP12_Pos) /*!< 0x00000040 */ +#define ADC_SMPR1_SMP12_1 (0x2UL << ADC_SMPR1_SMP12_Pos) /*!< 0x00000080 */ +#define ADC_SMPR1_SMP12_2 (0x4UL << ADC_SMPR1_SMP12_Pos) /*!< 0x00000100 */ + +#define ADC_SMPR1_SMP13_Pos (9U) +#define ADC_SMPR1_SMP13_Msk (0x7UL << ADC_SMPR1_SMP13_Pos) /*!< 0x00000E00 */ +#define ADC_SMPR1_SMP13 ADC_SMPR1_SMP13_Msk /*!< ADC channel 13 sampling time selection */ +#define ADC_SMPR1_SMP13_0 (0x1UL << ADC_SMPR1_SMP13_Pos) /*!< 0x00000200 */ +#define ADC_SMPR1_SMP13_1 (0x2UL << ADC_SMPR1_SMP13_Pos) /*!< 0x00000400 */ +#define ADC_SMPR1_SMP13_2 (0x4UL << ADC_SMPR1_SMP13_Pos) /*!< 0x00000800 */ + +#define ADC_SMPR1_SMP14_Pos (12U) +#define ADC_SMPR1_SMP14_Msk (0x7UL << ADC_SMPR1_SMP14_Pos) /*!< 0x00007000 */ +#define ADC_SMPR1_SMP14 ADC_SMPR1_SMP14_Msk /*!< ADC channel 14 sampling time selection */ +#define ADC_SMPR1_SMP14_0 (0x1UL << ADC_SMPR1_SMP14_Pos) /*!< 0x00001000 */ +#define ADC_SMPR1_SMP14_1 (0x2UL << ADC_SMPR1_SMP14_Pos) /*!< 0x00002000 */ +#define ADC_SMPR1_SMP14_2 (0x4UL << ADC_SMPR1_SMP14_Pos) /*!< 0x00004000 */ + +#define ADC_SMPR1_SMP15_Pos (15U) +#define ADC_SMPR1_SMP15_Msk (0x7UL << ADC_SMPR1_SMP15_Pos) /*!< 0x00038000 */ +#define ADC_SMPR1_SMP15 ADC_SMPR1_SMP15_Msk /*!< ADC channel 15 sampling time selection */ +#define ADC_SMPR1_SMP15_0 (0x1UL << ADC_SMPR1_SMP15_Pos) /*!< 0x00008000 */ +#define ADC_SMPR1_SMP15_1 (0x2UL << ADC_SMPR1_SMP15_Pos) /*!< 0x00010000 */ +#define ADC_SMPR1_SMP15_2 (0x4UL << ADC_SMPR1_SMP15_Pos) /*!< 0x00020000 */ + +#define ADC_SMPR1_SMP16_Pos (18U) +#define ADC_SMPR1_SMP16_Msk (0x7UL << ADC_SMPR1_SMP16_Pos) /*!< 0x001C0000 */ +#define ADC_SMPR1_SMP16 ADC_SMPR1_SMP16_Msk /*!< ADC channel 16 sampling time selection */ +#define ADC_SMPR1_SMP16_0 (0x1UL << ADC_SMPR1_SMP16_Pos) /*!< 0x00040000 */ +#define ADC_SMPR1_SMP16_1 (0x2UL << ADC_SMPR1_SMP16_Pos) /*!< 0x00080000 */ +#define ADC_SMPR1_SMP16_2 (0x4UL << ADC_SMPR1_SMP16_Pos) /*!< 0x00100000 */ + +#define ADC_SMPR1_SMP17_Pos (21U) +#define ADC_SMPR1_SMP17_Msk (0x7UL << ADC_SMPR1_SMP17_Pos) /*!< 0x00E00000 */ +#define ADC_SMPR1_SMP17 ADC_SMPR1_SMP17_Msk /*!< ADC channel 17 sampling time selection */ +#define ADC_SMPR1_SMP17_0 (0x1UL << ADC_SMPR1_SMP17_Pos) /*!< 0x00200000 */ +#define ADC_SMPR1_SMP17_1 (0x2UL << ADC_SMPR1_SMP17_Pos) /*!< 0x00400000 */ +#define ADC_SMPR1_SMP17_2 (0x4UL << ADC_SMPR1_SMP17_Pos) /*!< 0x00800000 */ + +/****************** Bit definition for ADC_SMPR2 register *******************/ +#define ADC_SMPR2_SMP0_Pos (0U) +#define ADC_SMPR2_SMP0_Msk (0x7UL << ADC_SMPR2_SMP0_Pos) /*!< 0x00000007 */ +#define ADC_SMPR2_SMP0 ADC_SMPR2_SMP0_Msk /*!< ADC channel 0 sampling time selection */ +#define ADC_SMPR2_SMP0_0 (0x1UL << ADC_SMPR2_SMP0_Pos) /*!< 0x00000001 */ +#define ADC_SMPR2_SMP0_1 (0x2UL << ADC_SMPR2_SMP0_Pos) /*!< 0x00000002 */ +#define ADC_SMPR2_SMP0_2 (0x4UL << ADC_SMPR2_SMP0_Pos) /*!< 0x00000004 */ + +#define ADC_SMPR2_SMP1_Pos (3U) +#define ADC_SMPR2_SMP1_Msk (0x7UL << ADC_SMPR2_SMP1_Pos) /*!< 0x00000038 */ +#define ADC_SMPR2_SMP1 ADC_SMPR2_SMP1_Msk /*!< ADC channel 1 sampling time selection */ +#define ADC_SMPR2_SMP1_0 (0x1UL << ADC_SMPR2_SMP1_Pos) /*!< 0x00000008 */ +#define ADC_SMPR2_SMP1_1 (0x2UL << ADC_SMPR2_SMP1_Pos) /*!< 0x00000010 */ +#define ADC_SMPR2_SMP1_2 (0x4UL << ADC_SMPR2_SMP1_Pos) /*!< 0x00000020 */ + +#define ADC_SMPR2_SMP2_Pos (6U) +#define ADC_SMPR2_SMP2_Msk (0x7UL << ADC_SMPR2_SMP2_Pos) /*!< 0x000001C0 */ +#define ADC_SMPR2_SMP2 ADC_SMPR2_SMP2_Msk /*!< ADC channel 2 sampling time selection */ +#define ADC_SMPR2_SMP2_0 (0x1UL << ADC_SMPR2_SMP2_Pos) /*!< 0x00000040 */ +#define ADC_SMPR2_SMP2_1 (0x2UL << ADC_SMPR2_SMP2_Pos) /*!< 0x00000080 */ +#define ADC_SMPR2_SMP2_2 (0x4UL << ADC_SMPR2_SMP2_Pos) /*!< 0x00000100 */ + +#define ADC_SMPR2_SMP3_Pos (9U) +#define ADC_SMPR2_SMP3_Msk (0x7UL << ADC_SMPR2_SMP3_Pos) /*!< 0x00000E00 */ +#define ADC_SMPR2_SMP3 ADC_SMPR2_SMP3_Msk /*!< ADC channel 3 sampling time selection */ +#define ADC_SMPR2_SMP3_0 (0x1UL << ADC_SMPR2_SMP3_Pos) /*!< 0x00000200 */ +#define ADC_SMPR2_SMP3_1 (0x2UL << ADC_SMPR2_SMP3_Pos) /*!< 0x00000400 */ +#define ADC_SMPR2_SMP3_2 (0x4UL << ADC_SMPR2_SMP3_Pos) /*!< 0x00000800 */ + +#define ADC_SMPR2_SMP4_Pos (12U) +#define ADC_SMPR2_SMP4_Msk (0x7UL << ADC_SMPR2_SMP4_Pos) /*!< 0x00007000 */ +#define ADC_SMPR2_SMP4 ADC_SMPR2_SMP4_Msk /*!< ADC channel 4 sampling time selection */ +#define ADC_SMPR2_SMP4_0 (0x1UL << ADC_SMPR2_SMP4_Pos) /*!< 0x00001000 */ +#define ADC_SMPR2_SMP4_1 (0x2UL << ADC_SMPR2_SMP4_Pos) /*!< 0x00002000 */ +#define ADC_SMPR2_SMP4_2 (0x4UL << ADC_SMPR2_SMP4_Pos) /*!< 0x00004000 */ + +#define ADC_SMPR2_SMP5_Pos (15U) +#define ADC_SMPR2_SMP5_Msk (0x7UL << ADC_SMPR2_SMP5_Pos) /*!< 0x00038000 */ +#define ADC_SMPR2_SMP5 ADC_SMPR2_SMP5_Msk /*!< ADC channel 5 sampling time selection */ +#define ADC_SMPR2_SMP5_0 (0x1UL << ADC_SMPR2_SMP5_Pos) /*!< 0x00008000 */ +#define ADC_SMPR2_SMP5_1 (0x2UL << ADC_SMPR2_SMP5_Pos) /*!< 0x00010000 */ +#define ADC_SMPR2_SMP5_2 (0x4UL << ADC_SMPR2_SMP5_Pos) /*!< 0x00020000 */ + +#define ADC_SMPR2_SMP6_Pos (18U) +#define ADC_SMPR2_SMP6_Msk (0x7UL << ADC_SMPR2_SMP6_Pos) /*!< 0x001C0000 */ +#define ADC_SMPR2_SMP6 ADC_SMPR2_SMP6_Msk /*!< ADC channel 6 sampling time selection */ +#define ADC_SMPR2_SMP6_0 (0x1UL << ADC_SMPR2_SMP6_Pos) /*!< 0x00040000 */ +#define ADC_SMPR2_SMP6_1 (0x2UL << ADC_SMPR2_SMP6_Pos) /*!< 0x00080000 */ +#define ADC_SMPR2_SMP6_2 (0x4UL << ADC_SMPR2_SMP6_Pos) /*!< 0x00100000 */ + +#define ADC_SMPR2_SMP7_Pos (21U) +#define ADC_SMPR2_SMP7_Msk (0x7UL << ADC_SMPR2_SMP7_Pos) /*!< 0x00E00000 */ +#define ADC_SMPR2_SMP7 ADC_SMPR2_SMP7_Msk /*!< ADC channel 7 sampling time selection */ +#define ADC_SMPR2_SMP7_0 (0x1UL << ADC_SMPR2_SMP7_Pos) /*!< 0x00200000 */ +#define ADC_SMPR2_SMP7_1 (0x2UL << ADC_SMPR2_SMP7_Pos) /*!< 0x00400000 */ +#define ADC_SMPR2_SMP7_2 (0x4UL << ADC_SMPR2_SMP7_Pos) /*!< 0x00800000 */ + +#define ADC_SMPR2_SMP8_Pos (24U) +#define ADC_SMPR2_SMP8_Msk (0x7UL << ADC_SMPR2_SMP8_Pos) /*!< 0x07000000 */ +#define ADC_SMPR2_SMP8 ADC_SMPR2_SMP8_Msk /*!< ADC channel 8 sampling time selection */ +#define ADC_SMPR2_SMP8_0 (0x1UL << ADC_SMPR2_SMP8_Pos) /*!< 0x01000000 */ +#define ADC_SMPR2_SMP8_1 (0x2UL << ADC_SMPR2_SMP8_Pos) /*!< 0x02000000 */ +#define ADC_SMPR2_SMP8_2 (0x4UL << ADC_SMPR2_SMP8_Pos) /*!< 0x04000000 */ + +#define ADC_SMPR2_SMP9_Pos (27U) +#define ADC_SMPR2_SMP9_Msk (0x7UL << ADC_SMPR2_SMP9_Pos) /*!< 0x38000000 */ +#define ADC_SMPR2_SMP9 ADC_SMPR2_SMP9_Msk /*!< ADC channel 9 sampling time selection */ +#define ADC_SMPR2_SMP9_0 (0x1UL << ADC_SMPR2_SMP9_Pos) /*!< 0x08000000 */ +#define ADC_SMPR2_SMP9_1 (0x2UL << ADC_SMPR2_SMP9_Pos) /*!< 0x10000000 */ +#define ADC_SMPR2_SMP9_2 (0x4UL << ADC_SMPR2_SMP9_Pos) /*!< 0x20000000 */ + +/****************** Bit definition for ADC_JOFR1 register *******************/ +#define ADC_JOFR1_JOFFSET1_Pos (0U) +#define ADC_JOFR1_JOFFSET1_Msk (0xFFFUL << ADC_JOFR1_JOFFSET1_Pos) /*!< 0x00000FFF */ +#define ADC_JOFR1_JOFFSET1 ADC_JOFR1_JOFFSET1_Msk /*!< ADC group injected sequencer rank 1 offset value */ + +/****************** Bit definition for ADC_JOFR2 register *******************/ +#define ADC_JOFR2_JOFFSET2_Pos (0U) +#define ADC_JOFR2_JOFFSET2_Msk (0xFFFUL << ADC_JOFR2_JOFFSET2_Pos) /*!< 0x00000FFF */ +#define ADC_JOFR2_JOFFSET2 ADC_JOFR2_JOFFSET2_Msk /*!< ADC group injected sequencer rank 2 offset value */ + +/****************** Bit definition for ADC_JOFR3 register *******************/ +#define ADC_JOFR3_JOFFSET3_Pos (0U) +#define ADC_JOFR3_JOFFSET3_Msk (0xFFFUL << ADC_JOFR3_JOFFSET3_Pos) /*!< 0x00000FFF */ +#define ADC_JOFR3_JOFFSET3 ADC_JOFR3_JOFFSET3_Msk /*!< ADC group injected sequencer rank 3 offset value */ + +/****************** Bit definition for ADC_JOFR4 register *******************/ +#define ADC_JOFR4_JOFFSET4_Pos (0U) +#define ADC_JOFR4_JOFFSET4_Msk (0xFFFUL << ADC_JOFR4_JOFFSET4_Pos) /*!< 0x00000FFF */ +#define ADC_JOFR4_JOFFSET4 ADC_JOFR4_JOFFSET4_Msk /*!< ADC group injected sequencer rank 4 offset value */ + +/******************* Bit definition for ADC_HTR register ********************/ +#define ADC_HTR_HT_Pos (0U) +#define ADC_HTR_HT_Msk (0xFFFUL << ADC_HTR_HT_Pos) /*!< 0x00000FFF */ +#define ADC_HTR_HT ADC_HTR_HT_Msk /*!< ADC analog watchdog 1 threshold high */ + +/******************* Bit definition for ADC_LTR register ********************/ +#define ADC_LTR_LT_Pos (0U) +#define ADC_LTR_LT_Msk (0xFFFUL << ADC_LTR_LT_Pos) /*!< 0x00000FFF */ +#define ADC_LTR_LT ADC_LTR_LT_Msk /*!< ADC analog watchdog 1 threshold low */ + +/******************* Bit definition for ADC_SQR1 register *******************/ +#define ADC_SQR1_SQ13_Pos (0U) +#define ADC_SQR1_SQ13_Msk (0x1FUL << ADC_SQR1_SQ13_Pos) /*!< 0x0000001F */ +#define ADC_SQR1_SQ13 ADC_SQR1_SQ13_Msk /*!< ADC group regular sequencer rank 13 */ +#define ADC_SQR1_SQ13_0 (0x01UL << ADC_SQR1_SQ13_Pos) /*!< 0x00000001 */ +#define ADC_SQR1_SQ13_1 (0x02UL << ADC_SQR1_SQ13_Pos) /*!< 0x00000002 */ +#define ADC_SQR1_SQ13_2 (0x04UL << ADC_SQR1_SQ13_Pos) /*!< 0x00000004 */ +#define ADC_SQR1_SQ13_3 (0x08UL << ADC_SQR1_SQ13_Pos) /*!< 0x00000008 */ +#define ADC_SQR1_SQ13_4 (0x10UL << ADC_SQR1_SQ13_Pos) /*!< 0x00000010 */ + +#define ADC_SQR1_SQ14_Pos (5U) +#define ADC_SQR1_SQ14_Msk (0x1FUL << ADC_SQR1_SQ14_Pos) /*!< 0x000003E0 */ +#define ADC_SQR1_SQ14 ADC_SQR1_SQ14_Msk /*!< ADC group regular sequencer rank 14 */ +#define ADC_SQR1_SQ14_0 (0x01UL << ADC_SQR1_SQ14_Pos) /*!< 0x00000020 */ +#define ADC_SQR1_SQ14_1 (0x02UL << ADC_SQR1_SQ14_Pos) /*!< 0x00000040 */ +#define ADC_SQR1_SQ14_2 (0x04UL << ADC_SQR1_SQ14_Pos) /*!< 0x00000080 */ +#define ADC_SQR1_SQ14_3 (0x08UL << ADC_SQR1_SQ14_Pos) /*!< 0x00000100 */ +#define ADC_SQR1_SQ14_4 (0x10UL << ADC_SQR1_SQ14_Pos) /*!< 0x00000200 */ + +#define ADC_SQR1_SQ15_Pos (10U) +#define ADC_SQR1_SQ15_Msk (0x1FUL << ADC_SQR1_SQ15_Pos) /*!< 0x00007C00 */ +#define ADC_SQR1_SQ15 ADC_SQR1_SQ15_Msk /*!< ADC group regular sequencer rank 15 */ +#define ADC_SQR1_SQ15_0 (0x01UL << ADC_SQR1_SQ15_Pos) /*!< 0x00000400 */ +#define ADC_SQR1_SQ15_1 (0x02UL << ADC_SQR1_SQ15_Pos) /*!< 0x00000800 */ +#define ADC_SQR1_SQ15_2 (0x04UL << ADC_SQR1_SQ15_Pos) /*!< 0x00001000 */ +#define ADC_SQR1_SQ15_3 (0x08UL << ADC_SQR1_SQ15_Pos) /*!< 0x00002000 */ +#define ADC_SQR1_SQ15_4 (0x10UL << ADC_SQR1_SQ15_Pos) /*!< 0x00004000 */ + +#define ADC_SQR1_SQ16_Pos (15U) +#define ADC_SQR1_SQ16_Msk (0x1FUL << ADC_SQR1_SQ16_Pos) /*!< 0x000F8000 */ +#define ADC_SQR1_SQ16 ADC_SQR1_SQ16_Msk /*!< ADC group regular sequencer rank 16 */ +#define ADC_SQR1_SQ16_0 (0x01UL << ADC_SQR1_SQ16_Pos) /*!< 0x00008000 */ +#define ADC_SQR1_SQ16_1 (0x02UL << ADC_SQR1_SQ16_Pos) /*!< 0x00010000 */ +#define ADC_SQR1_SQ16_2 (0x04UL << ADC_SQR1_SQ16_Pos) /*!< 0x00020000 */ +#define ADC_SQR1_SQ16_3 (0x08UL << ADC_SQR1_SQ16_Pos) /*!< 0x00040000 */ +#define ADC_SQR1_SQ16_4 (0x10UL << ADC_SQR1_SQ16_Pos) /*!< 0x00080000 */ + +#define ADC_SQR1_L_Pos (20U) +#define ADC_SQR1_L_Msk (0xFUL << ADC_SQR1_L_Pos) /*!< 0x00F00000 */ +#define ADC_SQR1_L ADC_SQR1_L_Msk /*!< ADC group regular sequencer scan length */ +#define ADC_SQR1_L_0 (0x1UL << ADC_SQR1_L_Pos) /*!< 0x00100000 */ +#define ADC_SQR1_L_1 (0x2UL << ADC_SQR1_L_Pos) /*!< 0x00200000 */ +#define ADC_SQR1_L_2 (0x4UL << ADC_SQR1_L_Pos) /*!< 0x00400000 */ +#define ADC_SQR1_L_3 (0x8UL << ADC_SQR1_L_Pos) /*!< 0x00800000 */ + +/******************* Bit definition for ADC_SQR2 register *******************/ +#define ADC_SQR2_SQ7_Pos (0U) +#define ADC_SQR2_SQ7_Msk (0x1FUL << ADC_SQR2_SQ7_Pos) /*!< 0x0000001F */ +#define ADC_SQR2_SQ7 ADC_SQR2_SQ7_Msk /*!< ADC group regular sequencer rank 7 */ +#define ADC_SQR2_SQ7_0 (0x01UL << ADC_SQR2_SQ7_Pos) /*!< 0x00000001 */ +#define ADC_SQR2_SQ7_1 (0x02UL << ADC_SQR2_SQ7_Pos) /*!< 0x00000002 */ +#define ADC_SQR2_SQ7_2 (0x04UL << ADC_SQR2_SQ7_Pos) /*!< 0x00000004 */ +#define ADC_SQR2_SQ7_3 (0x08UL << ADC_SQR2_SQ7_Pos) /*!< 0x00000008 */ +#define ADC_SQR2_SQ7_4 (0x10UL << ADC_SQR2_SQ7_Pos) /*!< 0x00000010 */ + +#define ADC_SQR2_SQ8_Pos (5U) +#define ADC_SQR2_SQ8_Msk (0x1FUL << ADC_SQR2_SQ8_Pos) /*!< 0x000003E0 */ +#define ADC_SQR2_SQ8 ADC_SQR2_SQ8_Msk /*!< ADC group regular sequencer rank 8 */ +#define ADC_SQR2_SQ8_0 (0x01UL << ADC_SQR2_SQ8_Pos) /*!< 0x00000020 */ +#define ADC_SQR2_SQ8_1 (0x02UL << ADC_SQR2_SQ8_Pos) /*!< 0x00000040 */ +#define ADC_SQR2_SQ8_2 (0x04UL << ADC_SQR2_SQ8_Pos) /*!< 0x00000080 */ +#define ADC_SQR2_SQ8_3 (0x08UL << ADC_SQR2_SQ8_Pos) /*!< 0x00000100 */ +#define ADC_SQR2_SQ8_4 (0x10UL << ADC_SQR2_SQ8_Pos) /*!< 0x00000200 */ + +#define ADC_SQR2_SQ9_Pos (10U) +#define ADC_SQR2_SQ9_Msk (0x1FUL << ADC_SQR2_SQ9_Pos) /*!< 0x00007C00 */ +#define ADC_SQR2_SQ9 ADC_SQR2_SQ9_Msk /*!< ADC group regular sequencer rank 9 */ +#define ADC_SQR2_SQ9_0 (0x01UL << ADC_SQR2_SQ9_Pos) /*!< 0x00000400 */ +#define ADC_SQR2_SQ9_1 (0x02UL << ADC_SQR2_SQ9_Pos) /*!< 0x00000800 */ +#define ADC_SQR2_SQ9_2 (0x04UL << ADC_SQR2_SQ9_Pos) /*!< 0x00001000 */ +#define ADC_SQR2_SQ9_3 (0x08UL << ADC_SQR2_SQ9_Pos) /*!< 0x00002000 */ +#define ADC_SQR2_SQ9_4 (0x10UL << ADC_SQR2_SQ9_Pos) /*!< 0x00004000 */ + +#define ADC_SQR2_SQ10_Pos (15U) +#define ADC_SQR2_SQ10_Msk (0x1FUL << ADC_SQR2_SQ10_Pos) /*!< 0x000F8000 */ +#define ADC_SQR2_SQ10 ADC_SQR2_SQ10_Msk /*!< ADC group regular sequencer rank 10 */ +#define ADC_SQR2_SQ10_0 (0x01UL << ADC_SQR2_SQ10_Pos) /*!< 0x00008000 */ +#define ADC_SQR2_SQ10_1 (0x02UL << ADC_SQR2_SQ10_Pos) /*!< 0x00010000 */ +#define ADC_SQR2_SQ10_2 (0x04UL << ADC_SQR2_SQ10_Pos) /*!< 0x00020000 */ +#define ADC_SQR2_SQ10_3 (0x08UL << ADC_SQR2_SQ10_Pos) /*!< 0x00040000 */ +#define ADC_SQR2_SQ10_4 (0x10UL << ADC_SQR2_SQ10_Pos) /*!< 0x00080000 */ + +#define ADC_SQR2_SQ11_Pos (20U) +#define ADC_SQR2_SQ11_Msk (0x1FUL << ADC_SQR2_SQ11_Pos) /*!< 0x01F00000 */ +#define ADC_SQR2_SQ11 ADC_SQR2_SQ11_Msk /*!< ADC group regular sequencer rank 1 */ +#define ADC_SQR2_SQ11_0 (0x01UL << ADC_SQR2_SQ11_Pos) /*!< 0x00100000 */ +#define ADC_SQR2_SQ11_1 (0x02UL << ADC_SQR2_SQ11_Pos) /*!< 0x00200000 */ +#define ADC_SQR2_SQ11_2 (0x04UL << ADC_SQR2_SQ11_Pos) /*!< 0x00400000 */ +#define ADC_SQR2_SQ11_3 (0x08UL << ADC_SQR2_SQ11_Pos) /*!< 0x00800000 */ +#define ADC_SQR2_SQ11_4 (0x10UL << ADC_SQR2_SQ11_Pos) /*!< 0x01000000 */ + +#define ADC_SQR2_SQ12_Pos (25U) +#define ADC_SQR2_SQ12_Msk (0x1FUL << ADC_SQR2_SQ12_Pos) /*!< 0x3E000000 */ +#define ADC_SQR2_SQ12 ADC_SQR2_SQ12_Msk /*!< ADC group regular sequencer rank 12 */ +#define ADC_SQR2_SQ12_0 (0x01UL << ADC_SQR2_SQ12_Pos) /*!< 0x02000000 */ +#define ADC_SQR2_SQ12_1 (0x02UL << ADC_SQR2_SQ12_Pos) /*!< 0x04000000 */ +#define ADC_SQR2_SQ12_2 (0x04UL << ADC_SQR2_SQ12_Pos) /*!< 0x08000000 */ +#define ADC_SQR2_SQ12_3 (0x08UL << ADC_SQR2_SQ12_Pos) /*!< 0x10000000 */ +#define ADC_SQR2_SQ12_4 (0x10UL << ADC_SQR2_SQ12_Pos) /*!< 0x20000000 */ + +/******************* Bit definition for ADC_SQR3 register *******************/ +#define ADC_SQR3_SQ1_Pos (0U) +#define ADC_SQR3_SQ1_Msk (0x1FUL << ADC_SQR3_SQ1_Pos) /*!< 0x0000001F */ +#define ADC_SQR3_SQ1 ADC_SQR3_SQ1_Msk /*!< ADC group regular sequencer rank 1 */ +#define ADC_SQR3_SQ1_0 (0x01UL << ADC_SQR3_SQ1_Pos) /*!< 0x00000001 */ +#define ADC_SQR3_SQ1_1 (0x02UL << ADC_SQR3_SQ1_Pos) /*!< 0x00000002 */ +#define ADC_SQR3_SQ1_2 (0x04UL << ADC_SQR3_SQ1_Pos) /*!< 0x00000004 */ +#define ADC_SQR3_SQ1_3 (0x08UL << ADC_SQR3_SQ1_Pos) /*!< 0x00000008 */ +#define ADC_SQR3_SQ1_4 (0x10UL << ADC_SQR3_SQ1_Pos) /*!< 0x00000010 */ + +#define ADC_SQR3_SQ2_Pos (5U) +#define ADC_SQR3_SQ2_Msk (0x1FUL << ADC_SQR3_SQ2_Pos) /*!< 0x000003E0 */ +#define ADC_SQR3_SQ2 ADC_SQR3_SQ2_Msk /*!< ADC group regular sequencer rank 2 */ +#define ADC_SQR3_SQ2_0 (0x01UL << ADC_SQR3_SQ2_Pos) /*!< 0x00000020 */ +#define ADC_SQR3_SQ2_1 (0x02UL << ADC_SQR3_SQ2_Pos) /*!< 0x00000040 */ +#define ADC_SQR3_SQ2_2 (0x04UL << ADC_SQR3_SQ2_Pos) /*!< 0x00000080 */ +#define ADC_SQR3_SQ2_3 (0x08UL << ADC_SQR3_SQ2_Pos) /*!< 0x00000100 */ +#define ADC_SQR3_SQ2_4 (0x10UL << ADC_SQR3_SQ2_Pos) /*!< 0x00000200 */ + +#define ADC_SQR3_SQ3_Pos (10U) +#define ADC_SQR3_SQ3_Msk (0x1FUL << ADC_SQR3_SQ3_Pos) /*!< 0x00007C00 */ +#define ADC_SQR3_SQ3 ADC_SQR3_SQ3_Msk /*!< ADC group regular sequencer rank 3 */ +#define ADC_SQR3_SQ3_0 (0x01UL << ADC_SQR3_SQ3_Pos) /*!< 0x00000400 */ +#define ADC_SQR3_SQ3_1 (0x02UL << ADC_SQR3_SQ3_Pos) /*!< 0x00000800 */ +#define ADC_SQR3_SQ3_2 (0x04UL << ADC_SQR3_SQ3_Pos) /*!< 0x00001000 */ +#define ADC_SQR3_SQ3_3 (0x08UL << ADC_SQR3_SQ3_Pos) /*!< 0x00002000 */ +#define ADC_SQR3_SQ3_4 (0x10UL << ADC_SQR3_SQ3_Pos) /*!< 0x00004000 */ + +#define ADC_SQR3_SQ4_Pos (15U) +#define ADC_SQR3_SQ4_Msk (0x1FUL << ADC_SQR3_SQ4_Pos) /*!< 0x000F8000 */ +#define ADC_SQR3_SQ4 ADC_SQR3_SQ4_Msk /*!< ADC group regular sequencer rank 4 */ +#define ADC_SQR3_SQ4_0 (0x01UL << ADC_SQR3_SQ4_Pos) /*!< 0x00008000 */ +#define ADC_SQR3_SQ4_1 (0x02UL << ADC_SQR3_SQ4_Pos) /*!< 0x00010000 */ +#define ADC_SQR3_SQ4_2 (0x04UL << ADC_SQR3_SQ4_Pos) /*!< 0x00020000 */ +#define ADC_SQR3_SQ4_3 (0x08UL << ADC_SQR3_SQ4_Pos) /*!< 0x00040000 */ +#define ADC_SQR3_SQ4_4 (0x10UL << ADC_SQR3_SQ4_Pos) /*!< 0x00080000 */ + +#define ADC_SQR3_SQ5_Pos (20U) +#define ADC_SQR3_SQ5_Msk (0x1FUL << ADC_SQR3_SQ5_Pos) /*!< 0x01F00000 */ +#define ADC_SQR3_SQ5 ADC_SQR3_SQ5_Msk /*!< ADC group regular sequencer rank 5 */ +#define ADC_SQR3_SQ5_0 (0x01UL << ADC_SQR3_SQ5_Pos) /*!< 0x00100000 */ +#define ADC_SQR3_SQ5_1 (0x02UL << ADC_SQR3_SQ5_Pos) /*!< 0x00200000 */ +#define ADC_SQR3_SQ5_2 (0x04UL << ADC_SQR3_SQ5_Pos) /*!< 0x00400000 */ +#define ADC_SQR3_SQ5_3 (0x08UL << ADC_SQR3_SQ5_Pos) /*!< 0x00800000 */ +#define ADC_SQR3_SQ5_4 (0x10UL << ADC_SQR3_SQ5_Pos) /*!< 0x01000000 */ + +#define ADC_SQR3_SQ6_Pos (25U) +#define ADC_SQR3_SQ6_Msk (0x1FUL << ADC_SQR3_SQ6_Pos) /*!< 0x3E000000 */ +#define ADC_SQR3_SQ6 ADC_SQR3_SQ6_Msk /*!< ADC group regular sequencer rank 6 */ +#define ADC_SQR3_SQ6_0 (0x01UL << ADC_SQR3_SQ6_Pos) /*!< 0x02000000 */ +#define ADC_SQR3_SQ6_1 (0x02UL << ADC_SQR3_SQ6_Pos) /*!< 0x04000000 */ +#define ADC_SQR3_SQ6_2 (0x04UL << ADC_SQR3_SQ6_Pos) /*!< 0x08000000 */ +#define ADC_SQR3_SQ6_3 (0x08UL << ADC_SQR3_SQ6_Pos) /*!< 0x10000000 */ +#define ADC_SQR3_SQ6_4 (0x10UL << ADC_SQR3_SQ6_Pos) /*!< 0x20000000 */ + +/******************* Bit definition for ADC_JSQR register *******************/ +#define ADC_JSQR_JSQ1_Pos (0U) +#define ADC_JSQR_JSQ1_Msk (0x1FUL << ADC_JSQR_JSQ1_Pos) /*!< 0x0000001F */ +#define ADC_JSQR_JSQ1 ADC_JSQR_JSQ1_Msk /*!< ADC group injected sequencer rank 1 */ +#define ADC_JSQR_JSQ1_0 (0x01UL << ADC_JSQR_JSQ1_Pos) /*!< 0x00000001 */ +#define ADC_JSQR_JSQ1_1 (0x02UL << ADC_JSQR_JSQ1_Pos) /*!< 0x00000002 */ +#define ADC_JSQR_JSQ1_2 (0x04UL << ADC_JSQR_JSQ1_Pos) /*!< 0x00000004 */ +#define ADC_JSQR_JSQ1_3 (0x08UL << ADC_JSQR_JSQ1_Pos) /*!< 0x00000008 */ +#define ADC_JSQR_JSQ1_4 (0x10UL << ADC_JSQR_JSQ1_Pos) /*!< 0x00000010 */ + +#define ADC_JSQR_JSQ2_Pos (5U) +#define ADC_JSQR_JSQ2_Msk (0x1FUL << ADC_JSQR_JSQ2_Pos) /*!< 0x000003E0 */ +#define ADC_JSQR_JSQ2 ADC_JSQR_JSQ2_Msk /*!< ADC group injected sequencer rank 2 */ +#define ADC_JSQR_JSQ2_0 (0x01UL << ADC_JSQR_JSQ2_Pos) /*!< 0x00000020 */ +#define ADC_JSQR_JSQ2_1 (0x02UL << ADC_JSQR_JSQ2_Pos) /*!< 0x00000040 */ +#define ADC_JSQR_JSQ2_2 (0x04UL << ADC_JSQR_JSQ2_Pos) /*!< 0x00000080 */ +#define ADC_JSQR_JSQ2_3 (0x08UL << ADC_JSQR_JSQ2_Pos) /*!< 0x00000100 */ +#define ADC_JSQR_JSQ2_4 (0x10UL << ADC_JSQR_JSQ2_Pos) /*!< 0x00000200 */ + +#define ADC_JSQR_JSQ3_Pos (10U) +#define ADC_JSQR_JSQ3_Msk (0x1FUL << ADC_JSQR_JSQ3_Pos) /*!< 0x00007C00 */ +#define ADC_JSQR_JSQ3 ADC_JSQR_JSQ3_Msk /*!< ADC group injected sequencer rank 3 */ +#define ADC_JSQR_JSQ3_0 (0x01UL << ADC_JSQR_JSQ3_Pos) /*!< 0x00000400 */ +#define ADC_JSQR_JSQ3_1 (0x02UL << ADC_JSQR_JSQ3_Pos) /*!< 0x00000800 */ +#define ADC_JSQR_JSQ3_2 (0x04UL << ADC_JSQR_JSQ3_Pos) /*!< 0x00001000 */ +#define ADC_JSQR_JSQ3_3 (0x08UL << ADC_JSQR_JSQ3_Pos) /*!< 0x00002000 */ +#define ADC_JSQR_JSQ3_4 (0x10UL << ADC_JSQR_JSQ3_Pos) /*!< 0x00004000 */ + +#define ADC_JSQR_JSQ4_Pos (15U) +#define ADC_JSQR_JSQ4_Msk (0x1FUL << ADC_JSQR_JSQ4_Pos) /*!< 0x000F8000 */ +#define ADC_JSQR_JSQ4 ADC_JSQR_JSQ4_Msk /*!< ADC group injected sequencer rank 4 */ +#define ADC_JSQR_JSQ4_0 (0x01UL << ADC_JSQR_JSQ4_Pos) /*!< 0x00008000 */ +#define ADC_JSQR_JSQ4_1 (0x02UL << ADC_JSQR_JSQ4_Pos) /*!< 0x00010000 */ +#define ADC_JSQR_JSQ4_2 (0x04UL << ADC_JSQR_JSQ4_Pos) /*!< 0x00020000 */ +#define ADC_JSQR_JSQ4_3 (0x08UL << ADC_JSQR_JSQ4_Pos) /*!< 0x00040000 */ +#define ADC_JSQR_JSQ4_4 (0x10UL << ADC_JSQR_JSQ4_Pos) /*!< 0x00080000 */ + +#define ADC_JSQR_JL_Pos (20U) +#define ADC_JSQR_JL_Msk (0x3UL << ADC_JSQR_JL_Pos) /*!< 0x00300000 */ +#define ADC_JSQR_JL ADC_JSQR_JL_Msk /*!< ADC group injected sequencer scan length */ +#define ADC_JSQR_JL_0 (0x1UL << ADC_JSQR_JL_Pos) /*!< 0x00100000 */ +#define ADC_JSQR_JL_1 (0x2UL << ADC_JSQR_JL_Pos) /*!< 0x00200000 */ + +/******************* Bit definition for ADC_JDR1 register *******************/ +#define ADC_JDR1_JDATA_Pos (0U) +#define ADC_JDR1_JDATA_Msk (0xFFFFUL << ADC_JDR1_JDATA_Pos) /*!< 0x0000FFFF */ +#define ADC_JDR1_JDATA ADC_JDR1_JDATA_Msk /*!< ADC group injected sequencer rank 1 conversion data */ + +/******************* Bit definition for ADC_JDR2 register *******************/ +#define ADC_JDR2_JDATA_Pos (0U) +#define ADC_JDR2_JDATA_Msk (0xFFFFUL << ADC_JDR2_JDATA_Pos) /*!< 0x0000FFFF */ +#define ADC_JDR2_JDATA ADC_JDR2_JDATA_Msk /*!< ADC group injected sequencer rank 2 conversion data */ + +/******************* Bit definition for ADC_JDR3 register *******************/ +#define ADC_JDR3_JDATA_Pos (0U) +#define ADC_JDR3_JDATA_Msk (0xFFFFUL << ADC_JDR3_JDATA_Pos) /*!< 0x0000FFFF */ +#define ADC_JDR3_JDATA ADC_JDR3_JDATA_Msk /*!< ADC group injected sequencer rank 3 conversion data */ + +/******************* Bit definition for ADC_JDR4 register *******************/ +#define ADC_JDR4_JDATA_Pos (0U) +#define ADC_JDR4_JDATA_Msk (0xFFFFUL << ADC_JDR4_JDATA_Pos) /*!< 0x0000FFFF */ +#define ADC_JDR4_JDATA ADC_JDR4_JDATA_Msk /*!< ADC group injected sequencer rank 4 conversion data */ + +/******************** Bit definition for ADC_DR register ********************/ +#define ADC_DR_DATA_Pos (0U) +#define ADC_DR_DATA_Msk (0xFFFFUL << ADC_DR_DATA_Pos) /*!< 0x0000FFFF */ +#define ADC_DR_DATA ADC_DR_DATA_Msk /*!< ADC group regular conversion data */ +#define ADC_DR_ADC2DATA_Pos (16U) +#define ADC_DR_ADC2DATA_Msk (0xFFFFUL << ADC_DR_ADC2DATA_Pos) /*!< 0xFFFF0000 */ +#define ADC_DR_ADC2DATA ADC_DR_ADC2DATA_Msk /*!< ADC group regular conversion data for ADC slave, in multimode */ +/******************************************************************************/ +/* */ +/* Digital to Analog Converter */ +/* */ +/******************************************************************************/ + +/******************** Bit definition for DAC_CR register ********************/ +#define DAC_CR_EN1_Pos (0U) +#define DAC_CR_EN1_Msk (0x1UL << DAC_CR_EN1_Pos) /*!< 0x00000001 */ +#define DAC_CR_EN1 DAC_CR_EN1_Msk /*!< DAC channel1 enable */ +#define DAC_CR_BOFF1_Pos (1U) +#define DAC_CR_BOFF1_Msk (0x1UL << DAC_CR_BOFF1_Pos) /*!< 0x00000002 */ +#define DAC_CR_BOFF1 DAC_CR_BOFF1_Msk /*!< DAC channel1 output buffer disable */ +#define DAC_CR_TEN1_Pos (2U) +#define DAC_CR_TEN1_Msk (0x1UL << DAC_CR_TEN1_Pos) /*!< 0x00000004 */ +#define DAC_CR_TEN1 DAC_CR_TEN1_Msk /*!< DAC channel1 Trigger enable */ + +#define DAC_CR_TSEL1_Pos (3U) +#define DAC_CR_TSEL1_Msk (0x7UL << DAC_CR_TSEL1_Pos) /*!< 0x00000038 */ +#define DAC_CR_TSEL1 DAC_CR_TSEL1_Msk /*!< TSEL1[2:0] (DAC channel1 Trigger selection) */ +#define DAC_CR_TSEL1_0 (0x1UL << DAC_CR_TSEL1_Pos) /*!< 0x00000008 */ +#define DAC_CR_TSEL1_1 (0x2UL << DAC_CR_TSEL1_Pos) /*!< 0x00000010 */ +#define DAC_CR_TSEL1_2 (0x4UL << DAC_CR_TSEL1_Pos) /*!< 0x00000020 */ + +#define DAC_CR_WAVE1_Pos (6U) +#define DAC_CR_WAVE1_Msk (0x3UL << DAC_CR_WAVE1_Pos) /*!< 0x000000C0 */ +#define DAC_CR_WAVE1 DAC_CR_WAVE1_Msk /*!< WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */ +#define DAC_CR_WAVE1_0 (0x1UL << DAC_CR_WAVE1_Pos) /*!< 0x00000040 */ +#define DAC_CR_WAVE1_1 (0x2UL << DAC_CR_WAVE1_Pos) /*!< 0x00000080 */ + +#define DAC_CR_MAMP1_Pos (8U) +#define DAC_CR_MAMP1_Msk (0xFUL << DAC_CR_MAMP1_Pos) /*!< 0x00000F00 */ +#define DAC_CR_MAMP1 DAC_CR_MAMP1_Msk /*!< MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */ +#define DAC_CR_MAMP1_0 (0x1UL << DAC_CR_MAMP1_Pos) /*!< 0x00000100 */ +#define DAC_CR_MAMP1_1 (0x2UL << DAC_CR_MAMP1_Pos) /*!< 0x00000200 */ +#define DAC_CR_MAMP1_2 (0x4UL << DAC_CR_MAMP1_Pos) /*!< 0x00000400 */ +#define DAC_CR_MAMP1_3 (0x8UL << DAC_CR_MAMP1_Pos) /*!< 0x00000800 */ + +#define DAC_CR_DMAEN1_Pos (12U) +#define DAC_CR_DMAEN1_Msk (0x1UL << DAC_CR_DMAEN1_Pos) /*!< 0x00001000 */ +#define DAC_CR_DMAEN1 DAC_CR_DMAEN1_Msk /*!< DAC channel1 DMA enable */ +#define DAC_CR_EN2_Pos (16U) +#define DAC_CR_EN2_Msk (0x1UL << DAC_CR_EN2_Pos) /*!< 0x00010000 */ +#define DAC_CR_EN2 DAC_CR_EN2_Msk /*!< DAC channel2 enable */ +#define DAC_CR_BOFF2_Pos (17U) +#define DAC_CR_BOFF2_Msk (0x1UL << DAC_CR_BOFF2_Pos) /*!< 0x00020000 */ +#define DAC_CR_BOFF2 DAC_CR_BOFF2_Msk /*!< DAC channel2 output buffer disable */ +#define DAC_CR_TEN2_Pos (18U) +#define DAC_CR_TEN2_Msk (0x1UL << DAC_CR_TEN2_Pos) /*!< 0x00040000 */ +#define DAC_CR_TEN2 DAC_CR_TEN2_Msk /*!< DAC channel2 Trigger enable */ + +#define DAC_CR_TSEL2_Pos (19U) +#define DAC_CR_TSEL2_Msk (0x7UL << DAC_CR_TSEL2_Pos) /*!< 0x00380000 */ +#define DAC_CR_TSEL2 DAC_CR_TSEL2_Msk /*!< TSEL2[2:0] (DAC channel2 Trigger selection) */ +#define DAC_CR_TSEL2_0 (0x1UL << DAC_CR_TSEL2_Pos) /*!< 0x00080000 */ +#define DAC_CR_TSEL2_1 (0x2UL << DAC_CR_TSEL2_Pos) /*!< 0x00100000 */ +#define DAC_CR_TSEL2_2 (0x4UL << DAC_CR_TSEL2_Pos) /*!< 0x00200000 */ + +#define DAC_CR_WAVE2_Pos (22U) +#define DAC_CR_WAVE2_Msk (0x3UL << DAC_CR_WAVE2_Pos) /*!< 0x00C00000 */ +#define DAC_CR_WAVE2 DAC_CR_WAVE2_Msk /*!< WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */ +#define DAC_CR_WAVE2_0 (0x1UL << DAC_CR_WAVE2_Pos) /*!< 0x00400000 */ +#define DAC_CR_WAVE2_1 (0x2UL << DAC_CR_WAVE2_Pos) /*!< 0x00800000 */ + +#define DAC_CR_MAMP2_Pos (24U) +#define DAC_CR_MAMP2_Msk (0xFUL << DAC_CR_MAMP2_Pos) /*!< 0x0F000000 */ +#define DAC_CR_MAMP2 DAC_CR_MAMP2_Msk /*!< MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */ +#define DAC_CR_MAMP2_0 (0x1UL << DAC_CR_MAMP2_Pos) /*!< 0x01000000 */ +#define DAC_CR_MAMP2_1 (0x2UL << DAC_CR_MAMP2_Pos) /*!< 0x02000000 */ +#define DAC_CR_MAMP2_2 (0x4UL << DAC_CR_MAMP2_Pos) /*!< 0x04000000 */ +#define DAC_CR_MAMP2_3 (0x8UL << DAC_CR_MAMP2_Pos) /*!< 0x08000000 */ + +#define DAC_CR_DMAEN2_Pos (28U) +#define DAC_CR_DMAEN2_Msk (0x1UL << DAC_CR_DMAEN2_Pos) /*!< 0x10000000 */ +#define DAC_CR_DMAEN2 DAC_CR_DMAEN2_Msk /*!< DAC channel2 DMA enabled */ + + +/***************** Bit definition for DAC_SWTRIGR register ******************/ +#define DAC_SWTRIGR_SWTRIG1_Pos (0U) +#define DAC_SWTRIGR_SWTRIG1_Msk (0x1UL << DAC_SWTRIGR_SWTRIG1_Pos) /*!< 0x00000001 */ +#define DAC_SWTRIGR_SWTRIG1 DAC_SWTRIGR_SWTRIG1_Msk /*!< DAC channel1 software trigger */ +#define DAC_SWTRIGR_SWTRIG2_Pos (1U) +#define DAC_SWTRIGR_SWTRIG2_Msk (0x1UL << DAC_SWTRIGR_SWTRIG2_Pos) /*!< 0x00000002 */ +#define DAC_SWTRIGR_SWTRIG2 DAC_SWTRIGR_SWTRIG2_Msk /*!< DAC channel2 software trigger */ + +/***************** Bit definition for DAC_DHR12R1 register ******************/ +#define DAC_DHR12R1_DACC1DHR_Pos (0U) +#define DAC_DHR12R1_DACC1DHR_Msk (0xFFFUL << DAC_DHR12R1_DACC1DHR_Pos) /*!< 0x00000FFF */ +#define DAC_DHR12R1_DACC1DHR DAC_DHR12R1_DACC1DHR_Msk /*!< DAC channel1 12-bit Right aligned data */ + +/***************** Bit definition for DAC_DHR12L1 register ******************/ +#define DAC_DHR12L1_DACC1DHR_Pos (4U) +#define DAC_DHR12L1_DACC1DHR_Msk (0xFFFUL << DAC_DHR12L1_DACC1DHR_Pos) /*!< 0x0000FFF0 */ +#define DAC_DHR12L1_DACC1DHR DAC_DHR12L1_DACC1DHR_Msk /*!< DAC channel1 12-bit Left aligned data */ + +/****************** Bit definition for DAC_DHR8R1 register ******************/ +#define DAC_DHR8R1_DACC1DHR_Pos (0U) +#define DAC_DHR8R1_DACC1DHR_Msk (0xFFUL << DAC_DHR8R1_DACC1DHR_Pos) /*!< 0x000000FF */ +#define DAC_DHR8R1_DACC1DHR DAC_DHR8R1_DACC1DHR_Msk /*!< DAC channel1 8-bit Right aligned data */ + +/***************** Bit definition for DAC_DHR12R2 register ******************/ +#define DAC_DHR12R2_DACC2DHR_Pos (0U) +#define DAC_DHR12R2_DACC2DHR_Msk (0xFFFUL << DAC_DHR12R2_DACC2DHR_Pos) /*!< 0x00000FFF */ +#define DAC_DHR12R2_DACC2DHR DAC_DHR12R2_DACC2DHR_Msk /*!< DAC channel2 12-bit Right aligned data */ + +/***************** Bit definition for DAC_DHR12L2 register ******************/ +#define DAC_DHR12L2_DACC2DHR_Pos (4U) +#define DAC_DHR12L2_DACC2DHR_Msk (0xFFFUL << DAC_DHR12L2_DACC2DHR_Pos) /*!< 0x0000FFF0 */ +#define DAC_DHR12L2_DACC2DHR DAC_DHR12L2_DACC2DHR_Msk /*!< DAC channel2 12-bit Left aligned data */ + +/****************** Bit definition for DAC_DHR8R2 register ******************/ +#define DAC_DHR8R2_DACC2DHR_Pos (0U) +#define DAC_DHR8R2_DACC2DHR_Msk (0xFFUL << DAC_DHR8R2_DACC2DHR_Pos) /*!< 0x000000FF */ +#define DAC_DHR8R2_DACC2DHR DAC_DHR8R2_DACC2DHR_Msk /*!< DAC channel2 8-bit Right aligned data */ + +/***************** Bit definition for DAC_DHR12RD register ******************/ +#define DAC_DHR12RD_DACC1DHR_Pos (0U) +#define DAC_DHR12RD_DACC1DHR_Msk (0xFFFUL << DAC_DHR12RD_DACC1DHR_Pos) /*!< 0x00000FFF */ +#define DAC_DHR12RD_DACC1DHR DAC_DHR12RD_DACC1DHR_Msk /*!< DAC channel1 12-bit Right aligned data */ +#define DAC_DHR12RD_DACC2DHR_Pos (16U) +#define DAC_DHR12RD_DACC2DHR_Msk (0xFFFUL << DAC_DHR12RD_DACC2DHR_Pos) /*!< 0x0FFF0000 */ +#define DAC_DHR12RD_DACC2DHR DAC_DHR12RD_DACC2DHR_Msk /*!< DAC channel2 12-bit Right aligned data */ + +/***************** Bit definition for DAC_DHR12LD register ******************/ +#define DAC_DHR12LD_DACC1DHR_Pos (4U) +#define DAC_DHR12LD_DACC1DHR_Msk (0xFFFUL << DAC_DHR12LD_DACC1DHR_Pos) /*!< 0x0000FFF0 */ +#define DAC_DHR12LD_DACC1DHR DAC_DHR12LD_DACC1DHR_Msk /*!< DAC channel1 12-bit Left aligned data */ +#define DAC_DHR12LD_DACC2DHR_Pos (20U) +#define DAC_DHR12LD_DACC2DHR_Msk (0xFFFUL << DAC_DHR12LD_DACC2DHR_Pos) /*!< 0xFFF00000 */ +#define DAC_DHR12LD_DACC2DHR DAC_DHR12LD_DACC2DHR_Msk /*!< DAC channel2 12-bit Left aligned data */ + +/****************** Bit definition for DAC_DHR8RD register ******************/ +#define DAC_DHR8RD_DACC1DHR_Pos (0U) +#define DAC_DHR8RD_DACC1DHR_Msk (0xFFUL << DAC_DHR8RD_DACC1DHR_Pos) /*!< 0x000000FF */ +#define DAC_DHR8RD_DACC1DHR DAC_DHR8RD_DACC1DHR_Msk /*!< DAC channel1 8-bit Right aligned data */ +#define DAC_DHR8RD_DACC2DHR_Pos (8U) +#define DAC_DHR8RD_DACC2DHR_Msk (0xFFUL << DAC_DHR8RD_DACC2DHR_Pos) /*!< 0x0000FF00 */ +#define DAC_DHR8RD_DACC2DHR DAC_DHR8RD_DACC2DHR_Msk /*!< DAC channel2 8-bit Right aligned data */ + +/******************* Bit definition for DAC_DOR1 register *******************/ +#define DAC_DOR1_DACC1DOR_Pos (0U) +#define DAC_DOR1_DACC1DOR_Msk (0xFFFUL << DAC_DOR1_DACC1DOR_Pos) /*!< 0x00000FFF */ +#define DAC_DOR1_DACC1DOR DAC_DOR1_DACC1DOR_Msk /*!< DAC channel1 data output */ + +/******************* Bit definition for DAC_DOR2 register *******************/ +#define DAC_DOR2_DACC2DOR_Pos (0U) +#define DAC_DOR2_DACC2DOR_Msk (0xFFFUL << DAC_DOR2_DACC2DOR_Pos) /*!< 0x00000FFF */ +#define DAC_DOR2_DACC2DOR DAC_DOR2_DACC2DOR_Msk /*!< DAC channel2 data output */ + + + +/*****************************************************************************/ +/* */ +/* Timers (TIM) */ +/* */ +/*****************************************************************************/ +/******************* Bit definition for TIM_CR1 register *******************/ +#define TIM_CR1_CEN_Pos (0U) +#define TIM_CR1_CEN_Msk (0x1UL << TIM_CR1_CEN_Pos) /*!< 0x00000001 */ +#define TIM_CR1_CEN TIM_CR1_CEN_Msk /*!
© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.
+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f1xx + * @{ + */ + +#ifndef __STM32F1XX_H +#define __STM32F1XX_H + +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +/** @addtogroup Library_configuration_section + * @{ + */ + +/** + * @brief STM32 Family + */ +#if !defined (STM32F1) +#define STM32F1 +#endif /* STM32F1 */ + +/* Uncomment the line below according to the target STM32L device used in your + application + */ + +#if !defined (STM32F100xB) && !defined (STM32F100xE) && !defined (STM32F101x6) && \ + !defined (STM32F101xB) && !defined (STM32F101xE) && !defined (STM32F101xG) && !defined (STM32F102x6) && !defined (STM32F102xB) && !defined (STM32F103x6) && \ + !defined (STM32F103xB) && !defined (STM32F103xE) && !defined (STM32F103xG) && !defined (STM32F105xC) && !defined (STM32F107xC) + /* #define STM32F100xB */ /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */ + /* #define STM32F100xE */ /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */ + /* #define STM32F101x6 */ /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */ + /* #define STM32F101xB */ /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */ + /* #define STM32F101xE */ /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */ + /* #define STM32F101xG */ /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */ + /* #define STM32F102x6 */ /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */ + /* #define STM32F102xB */ /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */ + /* #define STM32F103x6 */ /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */ + /* #define STM32F103xB */ /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */ + /* #define STM32F103xE */ /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */ + /* #define STM32F103xG */ /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */ + /* #define STM32F105xC */ /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */ + /* #define STM32F107xC */ /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */ +#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 (USE_HAL_DRIVER) +/** + * @brief Comment the line below if you will not use the peripherals drivers. + In this case, these drivers will not be included and the application code will + be based on direct access to peripherals registers + */ + /*#define USE_HAL_DRIVER */ +#endif /* USE_HAL_DRIVER */ + +/** + * @brief CMSIS Device version number V4.3.3 + */ +#define __STM32F1_CMSIS_VERSION_MAIN (0x04) /*!< [31:24] main version */ +#define __STM32F1_CMSIS_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ +#define __STM32F1_CMSIS_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */ +#define __STM32F1_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ +#define __STM32F1_CMSIS_VERSION ((__STM32F1_CMSIS_VERSION_MAIN << 24)\ + |(__STM32F1_CMSIS_VERSION_SUB1 << 16)\ + |(__STM32F1_CMSIS_VERSION_SUB2 << 8 )\ + |(__STM32F1_CMSIS_VERSION_RC)) + +/** + * @} + */ + +/** @addtogroup Device_Included + * @{ + */ + +#if defined(STM32F100xB) + #include "stm32f100xb.h" +#elif defined(STM32F100xE) + #include "stm32f100xe.h" +#elif defined(STM32F101x6) + #include "stm32f101x6.h" +#elif defined(STM32F101xB) + #include "stm32f101xb.h" +#elif defined(STM32F101xE) + #include "stm32f101xe.h" +#elif defined(STM32F101xG) + #include "stm32f101xg.h" +#elif defined(STM32F102x6) + #include "stm32f102x6.h" +#elif defined(STM32F102xB) + #include "stm32f102xb.h" +#elif defined(STM32F103x6) + #include "stm32f103x6.h" +#elif defined(STM32F103xB) + #include "stm32f103xb.h" +#elif defined(STM32F103xE) + #include "stm32f103xe.h" +#elif defined(STM32F103xG) + #include "stm32f103xg.h" +#elif defined(STM32F105xC) + #include "stm32f105xc.h" +#elif defined(STM32F107xC) + #include "stm32f107xc.h" +#else + #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)" +#endif + +/** + * @} + */ + +/** @addtogroup Exported_types + * @{ + */ +typedef enum +{ + RESET = 0, + SET = !RESET +} FlagStatus, ITStatus; + +typedef enum +{ + DISABLE = 0, + ENABLE = !DISABLE +} FunctionalState; +#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) + +typedef enum +{ + SUCCESS = 0U, + ERROR = !SUCCESS +} ErrorStatus; + +/** + * @} + */ + + +/** @addtogroup Exported_macros + * @{ + */ +#define SET_BIT(REG, BIT) ((REG) |= (BIT)) + +#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) + +#define READ_BIT(REG, BIT) ((REG) & (BIT)) + +#define CLEAR_REG(REG) ((REG) = (0x0)) + +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) + +#define READ_REG(REG) ((REG)) + +#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) + +#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) + +/* Use of CMSIS compiler intrinsics for register exclusive access */ +/* Atomic 32-bit register access macro to set one or several bits */ +#define ATOMIC_SET_BIT(REG, BIT) \ + do { \ + uint32_t val; \ + do { \ + val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \ + } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ + } while(0) + +/* Atomic 32-bit register access macro to clear one or several bits */ +#define ATOMIC_CLEAR_BIT(REG, BIT) \ + do { \ + uint32_t val; \ + do { \ + val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \ + } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ + } while(0) + +/* Atomic 32-bit register access macro to clear and set one or several bits */ +#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \ + do { \ + uint32_t val; \ + do { \ + val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \ + } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ + } while(0) + +/* Atomic 16-bit register access macro to set one or several bits */ +#define ATOMIC_SETH_BIT(REG, BIT) \ + do { \ + uint16_t val; \ + do { \ + val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \ + } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ + } while(0) + +/* Atomic 16-bit register access macro to clear one or several bits */ +#define ATOMIC_CLEARH_BIT(REG, BIT) \ + do { \ + uint16_t val; \ + do { \ + val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \ + } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ + } while(0) + +/* Atomic 16-bit register access macro to clear and set one or several bits */ +#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \ + do { \ + uint16_t val; \ + do { \ + val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \ + } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ + } while(0) + + +/** + * @} + */ + +#if defined (USE_HAL_DRIVER) + #include "stm32f1xx_hal.h" +#endif /* USE_HAL_DRIVER */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __STM32F1xx_H */ +/** + * @} + */ + +/** + * @} + */ + + + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h b/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h new file mode 100644 index 0000000..187fdde --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h @@ -0,0 +1,98 @@ +/** + ****************************************************************************** + * @file system_stm32f10x.h + * @author MCD Application Team + * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f10x_system + * @{ + */ + +/** + * @brief Define to prevent recursive inclusion + */ +#ifndef __SYSTEM_STM32F10X_H +#define __SYSTEM_STM32F10X_H + +#ifdef __cplusplus + extern "C" { +#endif + +/** @addtogroup STM32F10x_System_Includes + * @{ + */ + +/** + * @} + */ + + +/** @addtogroup STM32F10x_System_Exported_types + * @{ + */ + +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ +extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ +extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ + +/** + * @} + */ + +/** @addtogroup STM32F10x_System_Exported_Constants + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F10x_System_Exported_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F10x_System_Exported_Functions + * @{ + */ + +extern void SystemInit(void); +extern void SystemCoreClockUpdate(void); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSTEM_STM32F10X_H */ + +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armcc.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armcc.h new file mode 100644 index 0000000..4d9d064 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armcc.h @@ -0,0 +1,865 @@ +/**************************************************************************//** + * @file cmsis_armcc.h + * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_ARMCC_H +#define __CMSIS_ARMCC_H + + +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677) + #error "Please use Arm Compiler Toolchain V4.0.677 or later!" +#endif + +/* CMSIS compiler control architecture macros */ +#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \ + (defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) ) + #define __ARM_ARCH_6M__ 1 +#endif + +#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1)) + #define __ARM_ARCH_7M__ 1 +#endif + +#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1)) + #define __ARM_ARCH_7EM__ 1 +#endif + + /* __ARM_ARCH_8M_BASE__ not applicable */ + /* __ARM_ARCH_8M_MAIN__ not applicable */ + + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE __inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static __inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE static __forceinline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __declspec(noreturn) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed)) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION __packed union +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x))) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr))) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr))) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __enable_irq(); */ + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __disable_irq(); */ + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_INLINE uint32_t __get_CONTROL(void) +{ + register uint32_t __regControl __ASM("control"); + return(__regControl); +} + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + register uint32_t __regControl __ASM("control"); + __regControl = control; +} + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_INLINE uint32_t __get_IPSR(void) +{ + register uint32_t __regIPSR __ASM("ipsr"); + return(__regIPSR); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_INLINE uint32_t __get_APSR(void) +{ + register uint32_t __regAPSR __ASM("apsr"); + return(__regAPSR); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_INLINE uint32_t __get_xPSR(void) +{ + register uint32_t __regXPSR __ASM("xpsr"); + return(__regXPSR); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + return(__regProcessStackPointer); +} + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + __regProcessStackPointer = topOfProcStack; +} + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + return(__regMainStackPointer); +} + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + __regMainStackPointer = topOfMainStack; +} + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + register uint32_t __regPriMask __ASM("primask"); + return(__regPriMask); +} + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (priMask); +} + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + register uint32_t __regBasePri __ASM("basepri"); + return(__regBasePri); +} + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + register uint32_t __regBasePri __ASM("basepri"); + __regBasePri = (basePri & 0xFFU); +} + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + register uint32_t __regBasePriMax __ASM("basepri_max"); + __regBasePriMax = (basePri & 0xFFU); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + return(__regFaultMask); +} + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + __regFaultMask = (faultMask & (uint32_t)1U); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + register uint32_t __regfpscr __ASM("fpscr"); + return(__regfpscr); +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + register uint32_t __regfpscr __ASM("fpscr"); + __regfpscr = (fpscr); +#else + (void)fpscr; +#endif +} + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __nop + + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI __wfi + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __wfe + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __sev + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +#define __ISB() do {\ + __schedule_barrier();\ + __isb(0xF);\ + __schedule_barrier();\ + } while (0U) + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() do {\ + __schedule_barrier();\ + __dsb(0xF);\ + __schedule_barrier();\ + } while (0U) + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() do {\ + __schedule_barrier();\ + __dmb(0xF);\ + __schedule_barrier();\ + } while (0U) + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV __rev + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) +{ + rev16 r0, r0 + bx lr +} +#endif + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value) +{ + revsh r0, r0 + bx lr +} +#endif + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +#define __ROR __ror + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __breakpoint(value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + #define __RBIT __rbit +#else +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value != 0U; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ + return result; +} +#endif + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) +#else + #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) +#else + #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) +#else + #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXB(value, ptr) __strex(value, ptr) +#else + #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXH(value, ptr) __strex(value, ptr) +#else + #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) + #define __STREXW(value, ptr) __strex(value, ptr) +#else + #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") +#endif + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +#define __CLREX __clrex + + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __ssat + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __usat + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) +{ + rrx r0, r0 + bx lr +} +#endif + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr)) + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr)) + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr)) + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRBT(value, ptr) __strt(value, ptr) + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRHT(value, ptr) __strt(value, ptr) + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRT(value, ptr) __strt(value, ptr) + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) + +#define __SADD8 __sadd8 +#define __QADD8 __qadd8 +#define __SHADD8 __shadd8 +#define __UADD8 __uadd8 +#define __UQADD8 __uqadd8 +#define __UHADD8 __uhadd8 +#define __SSUB8 __ssub8 +#define __QSUB8 __qsub8 +#define __SHSUB8 __shsub8 +#define __USUB8 __usub8 +#define __UQSUB8 __uqsub8 +#define __UHSUB8 __uhsub8 +#define __SADD16 __sadd16 +#define __QADD16 __qadd16 +#define __SHADD16 __shadd16 +#define __UADD16 __uadd16 +#define __UQADD16 __uqadd16 +#define __UHADD16 __uhadd16 +#define __SSUB16 __ssub16 +#define __QSUB16 __qsub16 +#define __SHSUB16 __shsub16 +#define __USUB16 __usub16 +#define __UQSUB16 __uqsub16 +#define __UHSUB16 __uhsub16 +#define __SASX __sasx +#define __QASX __qasx +#define __SHASX __shasx +#define __UASX __uasx +#define __UQASX __uqasx +#define __UHASX __uhasx +#define __SSAX __ssax +#define __QSAX __qsax +#define __SHSAX __shsax +#define __USAX __usax +#define __UQSAX __uqsax +#define __UHSAX __uhsax +#define __USAD8 __usad8 +#define __USADA8 __usada8 +#define __SSAT16 __ssat16 +#define __USAT16 __usat16 +#define __UXTB16 __uxtb16 +#define __UXTAB16 __uxtab16 +#define __SXTB16 __sxtb16 +#define __SXTAB16 __sxtab16 +#define __SMUAD __smuad +#define __SMUADX __smuadx +#define __SMLAD __smlad +#define __SMLADX __smladx +#define __SMLALD __smlald +#define __SMLALDX __smlaldx +#define __SMUSD __smusd +#define __SMUSDX __smusdx +#define __SMLSD __smlsd +#define __SMLSDX __smlsdx +#define __SMLSLD __smlsld +#define __SMLSLDX __smlsldx +#define __SEL __sel +#define __QADD __qadd +#define __QSUB __qsub + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ + ((int64_t)(ARG3) << 32U) ) >> 32U)) + +#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#endif /* __CMSIS_ARMCC_H */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armclang.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armclang.h new file mode 100644 index 0000000..162a400 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_armclang.h @@ -0,0 +1,1869 @@ +/**************************************************************************//** + * @file cmsis_armclang.h + * @brief CMSIS compiler armclang (Arm Compiler 6) header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */ + +#ifndef __CMSIS_ARMCLANG_H +#define __CMSIS_ARMCLANG_H + +#pragma clang system_header /* treat file as system include file */ + +#ifndef __ARM_COMPAT_H +#include /* Compatibility header for Arm Compiler 5 intrinsics */ +#endif + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE __inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static __inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((__noreturn__)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */ + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */ + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */ + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wpacked" +/*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #pragma clang diagnostic pop + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __enable_irq(); see arm_compat.h */ + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +/* intrinsic void __disable_irq(); see arm_compat.h */ + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_FORCEINLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Stack Pointer (non-secure) + \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state. + \return SP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, sp_ns" : "=r" (result) ); + return(result); +} + + +/** + \brief Set Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state. + \param [in] topOfStack Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack) +{ + __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq /* see arm_compat.h */ + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq /* see arm_compat.h */ + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return result; +#endif +} + +#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +#endif +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + return result; +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +#endif +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr +#else +#define __get_FPSCR() ((uint32_t)0U) +#endif + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#define __set_FPSCR __builtin_arm_set_fpscr +#else +#define __set_FPSCR(x) ((void)(x)) +#endif + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __builtin_arm_nop + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI __builtin_arm_wfi + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __builtin_arm_wfe + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __builtin_arm_sev + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +#define __ISB() __builtin_arm_isb(0xF); + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() __builtin_arm_dsb(0xF); + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() __builtin_arm_dmb(0xF); + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV(value) __builtin_bswap32(value) + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV16(value) __ROR(__REV(value), 16) + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +#define __REVSH(value) (int16_t)__builtin_bswap16(value) + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + op2 %= 32U; + if (op2 == 0U) + { + return op1; + } + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +#define __RBIT __builtin_arm_rbit + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ (uint8_t)__builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDREXB (uint8_t)__builtin_arm_ldrex + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDREXH (uint16_t)__builtin_arm_ldrex + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDREXW (uint32_t)__builtin_arm_ldrex + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXB (uint32_t)__builtin_arm_strex + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXH (uint32_t)__builtin_arm_strex + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXW (uint32_t)__builtin_arm_strex + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +#define __CLREX __builtin_arm_clrex + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __builtin_arm_ssat + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __builtin_arm_usat + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDAEXB (uint8_t)__builtin_arm_ldaex + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDAEXH (uint16_t)__builtin_arm_ldaex + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDAEX (uint32_t)__builtin_arm_ldaex + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEXB (uint32_t)__builtin_arm_stlex + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEXH (uint32_t)__builtin_arm_stlex + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STLEX (uint32_t)__builtin_arm_stlex + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + +__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#endif /* __CMSIS_ARMCLANG_H */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_compiler.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_compiler.h new file mode 100644 index 0000000..94212eb --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_compiler.h @@ -0,0 +1,266 @@ +/**************************************************************************//** + * @file cmsis_compiler.h + * @brief CMSIS compiler generic header file + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_COMPILER_H +#define __CMSIS_COMPILER_H + +#include + +/* + * Arm Compiler 4/5 + */ +#if defined ( __CC_ARM ) + #include "cmsis_armcc.h" + + +/* + * Arm Compiler 6 (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #include "cmsis_armclang.h" + + +/* + * GNU Compiler + */ +#elif defined ( __GNUC__ ) + #include "cmsis_gcc.h" + + +/* + * IAR Compiler + */ +#elif defined ( __ICCARM__ ) + #include + + +/* + * TI Arm Compiler + */ +#elif defined ( __TI_ARM__ ) + #include + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed)) + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed)) + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +/* + * TASKING Compiler + */ +#elif defined ( __TASKING__ ) + /* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __packed__ + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __packed__ + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __packed__ + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __packed__ T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __align(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +/* + * COSMIC Compiler + */ +#elif defined ( __CSMC__ ) + #include + + #ifndef __ASM + #define __ASM _asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + // NO RETURN is automatically detected hence no warning here + #define __NO_RETURN + #endif + #ifndef __USED + #warning No compiler specific solution for __USED. __USED is ignored. + #define __USED + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __PACKED + #define __PACKED @packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT @packed struct + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION @packed union + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + @packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + + +#else + #error Unknown compiler. +#endif + + +#endif /* __CMSIS_COMPILER_H */ + diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_gcc.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_gcc.h new file mode 100644 index 0000000..2d9db15 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_gcc.h @@ -0,0 +1,2085 @@ +/**************************************************************************//** + * @file cmsis_gcc.h + * @brief CMSIS compiler GCC header file + * @version V5.0.4 + * @date 09. April 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_GCC_H +#define __CMSIS_GCC_H + +/* ignore some GCC warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +/* Fallback for __has_builtin */ +#ifndef __has_builtin + #define __has_builtin(x) (0) +#endif + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((__noreturn__)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_FORCEINLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Stack Pointer (non-secure) + \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state. + \return SP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, sp_ns" : "=r" (result) ); + return(result); +} + + +/** + \brief Set Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state. + \param [in] topOfStack Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack) +{ + __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) :: "memory"); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) :: "memory"); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return result; +#endif +} + +#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +#endif +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + return result; +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +#endif +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__STATIC_FORCEINLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_get_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + return __builtin_arm_get_fpscr(); +#else + uint32_t result; + + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + return(result); +#endif +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_set_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + __builtin_arm_set_fpscr(fpscr); +#else + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory"); +#endif +#else + (void)fpscr; +#endif +} + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_RW_REG(r) "+l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_RW_REG(r) "+r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP() __ASM volatile ("nop") + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI() __ASM volatile ("wfi") + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE() __ASM volatile ("wfe") + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV() __ASM volatile ("sev") + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +__STATIC_FORCEINLINE void __ISB(void) +{ + __ASM volatile ("isb 0xF":::"memory"); +} + + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__STATIC_FORCEINLINE void __DSB(void) +{ + __ASM volatile ("dsb 0xF":::"memory"); +} + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__STATIC_FORCEINLINE void __DMB(void) +{ + __ASM volatile ("dmb 0xF":::"memory"); +} + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE int16_t __REVSH(int16_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (int16_t)__builtin_bswap16(value); +#else + int16_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + op2 %= 32U; + if (op2 == 0U) + { + return op1; + } + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); +#else + uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value != 0U; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return result; +} + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ (uint8_t)__builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +__STATIC_FORCEINLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +__extension__ \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ + __extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + +__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#pragma GCC diagnostic pop + +#endif /* __CMSIS_GCC_H */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_iccarm.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_iccarm.h new file mode 100644 index 0000000..11c4af0 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_iccarm.h @@ -0,0 +1,935 @@ +/**************************************************************************//** + * @file cmsis_iccarm.h + * @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file + * @version V5.0.7 + * @date 19. June 2018 + ******************************************************************************/ + +//------------------------------------------------------------------------------ +// +// Copyright (c) 2017-2018 IAR Systems +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//------------------------------------------------------------------------------ + + +#ifndef __CMSIS_ICCARM_H__ +#define __CMSIS_ICCARM_H__ + +#ifndef __ICCARM__ + #error This file should only be compiled by ICCARM +#endif + +#pragma system_include + +#define __IAR_FT _Pragma("inline=forced") __intrinsic + +#if (__VER__ >= 8000000) + #define __ICCARM_V8 1 +#else + #define __ICCARM_V8 0 +#endif + +#ifndef __ALIGNED + #if __ICCARM_V8 + #define __ALIGNED(x) __attribute__((aligned(x))) + #elif (__VER__ >= 7080000) + /* Needs IAR language extensions */ + #define __ALIGNED(x) __attribute__((aligned(x))) + #else + #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored. + #define __ALIGNED(x) + #endif +#endif + + +/* Define compiler macros for CPU architecture, used in CMSIS 5. + */ +#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__ +/* Macros already defined */ +#else + #if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #elif defined(__ARM8M_BASELINE__) + #define __ARM_ARCH_8M_BASE__ 1 + #elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M' + #if __ARM_ARCH == 6 + #define __ARM_ARCH_6M__ 1 + #elif __ARM_ARCH == 7 + #if __ARM_FEATURE_DSP + #define __ARM_ARCH_7EM__ 1 + #else + #define __ARM_ARCH_7M__ 1 + #endif + #endif /* __ARM_ARCH */ + #endif /* __ARM_ARCH_PROFILE == 'M' */ +#endif + +/* Alternativ core deduction for older ICCARM's */ +#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \ + !defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__) + #if defined(__ARM6M__) && (__CORE__ == __ARM6M__) + #define __ARM_ARCH_6M__ 1 + #elif defined(__ARM7M__) && (__CORE__ == __ARM7M__) + #define __ARM_ARCH_7M__ 1 + #elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__) + #define __ARM_ARCH_7EM__ 1 + #elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__) + #define __ARM_ARCH_8M_BASE__ 1 + #elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__) + #define __ARM_ARCH_8M_MAIN__ 1 + #else + #error "Unknown target." + #endif +#endif + + + +#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1 + #define __IAR_M0_FAMILY 1 +#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1 + #define __IAR_M0_FAMILY 1 +#else + #define __IAR_M0_FAMILY 0 +#endif + + +#ifndef __ASM + #define __ASM __asm +#endif + +#ifndef __INLINE + #define __INLINE inline +#endif + +#ifndef __NO_RETURN + #if __ICCARM_V8 + #define __NO_RETURN __attribute__((__noreturn__)) + #else + #define __NO_RETURN _Pragma("object_attribute=__noreturn") + #endif +#endif + +#ifndef __PACKED + #if __ICCARM_V8 + #define __PACKED __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED __packed + #endif +#endif + +#ifndef __PACKED_STRUCT + #if __ICCARM_V8 + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED_STRUCT __packed struct + #endif +#endif + +#ifndef __PACKED_UNION + #if __ICCARM_V8 + #define __PACKED_UNION union __attribute__((packed, aligned(1))) + #else + /* Needs IAR language extensions */ + #define __PACKED_UNION __packed union + #endif +#endif + +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif + +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif + +#ifndef __FORCEINLINE + #define __FORCEINLINE _Pragma("inline=forced") +#endif + +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE +#endif + +#ifndef __UNALIGNED_UINT16_READ +#pragma language=save +#pragma language=extended +__IAR_FT uint16_t __iar_uint16_read(void const *ptr) +{ + return *(__packed uint16_t*)(ptr); +} +#pragma language=restore +#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR) +#endif + + +#ifndef __UNALIGNED_UINT16_WRITE +#pragma language=save +#pragma language=extended +__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val) +{ + *(__packed uint16_t*)(ptr) = val;; +} +#pragma language=restore +#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL) +#endif + +#ifndef __UNALIGNED_UINT32_READ +#pragma language=save +#pragma language=extended +__IAR_FT uint32_t __iar_uint32_read(void const *ptr) +{ + return *(__packed uint32_t*)(ptr); +} +#pragma language=restore +#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR) +#endif + +#ifndef __UNALIGNED_UINT32_WRITE +#pragma language=save +#pragma language=extended +__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val) +{ + *(__packed uint32_t*)(ptr) = val;; +} +#pragma language=restore +#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL) +#endif + +#ifndef __UNALIGNED_UINT32 /* deprecated */ +#pragma language=save +#pragma language=extended +__packed struct __iar_u32 { uint32_t v; }; +#pragma language=restore +#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v) +#endif + +#ifndef __USED + #if __ICCARM_V8 + #define __USED __attribute__((used)) + #else + #define __USED _Pragma("__root") + #endif +#endif + +#ifndef __WEAK + #if __ICCARM_V8 + #define __WEAK __attribute__((weak)) + #else + #define __WEAK _Pragma("__weak") + #endif +#endif + + +#ifndef __ICCARM_INTRINSICS_VERSION__ + #define __ICCARM_INTRINSICS_VERSION__ 0 +#endif + +#if __ICCARM_INTRINSICS_VERSION__ == 2 + + #if defined(__CLZ) + #undef __CLZ + #endif + #if defined(__REVSH) + #undef __REVSH + #endif + #if defined(__RBIT) + #undef __RBIT + #endif + #if defined(__SSAT) + #undef __SSAT + #endif + #if defined(__USAT) + #undef __USAT + #endif + + #include "iccarm_builtin.h" + + #define __disable_fault_irq __iar_builtin_disable_fiq + #define __disable_irq __iar_builtin_disable_interrupt + #define __enable_fault_irq __iar_builtin_enable_fiq + #define __enable_irq __iar_builtin_enable_interrupt + #define __arm_rsr __iar_builtin_rsr + #define __arm_wsr __iar_builtin_wsr + + + #define __get_APSR() (__arm_rsr("APSR")) + #define __get_BASEPRI() (__arm_rsr("BASEPRI")) + #define __get_CONTROL() (__arm_rsr("CONTROL")) + #define __get_FAULTMASK() (__arm_rsr("FAULTMASK")) + + #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + #define __get_FPSCR() (__arm_rsr("FPSCR")) + #define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE))) + #else + #define __get_FPSCR() ( 0 ) + #define __set_FPSCR(VALUE) ((void)VALUE) + #endif + + #define __get_IPSR() (__arm_rsr("IPSR")) + #define __get_MSP() (__arm_rsr("MSP")) + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + #define __get_MSPLIM() (0U) + #else + #define __get_MSPLIM() (__arm_rsr("MSPLIM")) + #endif + #define __get_PRIMASK() (__arm_rsr("PRIMASK")) + #define __get_PSP() (__arm_rsr("PSP")) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __get_PSPLIM() (0U) + #else + #define __get_PSPLIM() (__arm_rsr("PSPLIM")) + #endif + + #define __get_xPSR() (__arm_rsr("xPSR")) + + #define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE))) + #define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE))) + #define __set_CONTROL(VALUE) (__arm_wsr("CONTROL", (VALUE))) + #define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE))) + #define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE))) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + #define __set_MSPLIM(VALUE) ((void)(VALUE)) + #else + #define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE))) + #endif + #define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE))) + #define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE))) + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __set_PSPLIM(VALUE) ((void)(VALUE)) + #else + #define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE))) + #endif + + #define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS")) + #define __TZ_set_CONTROL_NS(VALUE) (__arm_wsr("CONTROL_NS", (VALUE))) + #define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS")) + #define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE))) + #define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS")) + #define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE))) + #define __TZ_get_SP_NS() (__arm_rsr("SP_NS")) + #define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE))) + #define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS")) + #define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE))) + #define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS")) + #define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE))) + #define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS")) + #define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE))) + + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + #define __TZ_get_PSPLIM_NS() (0U) + #define __TZ_set_PSPLIM_NS(VALUE) ((void)(VALUE)) + #else + #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS")) + #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE))) + #endif + + #define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS")) + #define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE))) + + #define __NOP __iar_builtin_no_operation + + #define __CLZ __iar_builtin_CLZ + #define __CLREX __iar_builtin_CLREX + + #define __DMB __iar_builtin_DMB + #define __DSB __iar_builtin_DSB + #define __ISB __iar_builtin_ISB + + #define __LDREXB __iar_builtin_LDREXB + #define __LDREXH __iar_builtin_LDREXH + #define __LDREXW __iar_builtin_LDREX + + #define __RBIT __iar_builtin_RBIT + #define __REV __iar_builtin_REV + #define __REV16 __iar_builtin_REV16 + + __IAR_FT int16_t __REVSH(int16_t val) + { + return (int16_t) __iar_builtin_REVSH(val); + } + + #define __ROR __iar_builtin_ROR + #define __RRX __iar_builtin_RRX + + #define __SEV __iar_builtin_SEV + + #if !__IAR_M0_FAMILY + #define __SSAT __iar_builtin_SSAT + #endif + + #define __STREXB __iar_builtin_STREXB + #define __STREXH __iar_builtin_STREXH + #define __STREXW __iar_builtin_STREX + + #if !__IAR_M0_FAMILY + #define __USAT __iar_builtin_USAT + #endif + + #define __WFE __iar_builtin_WFE + #define __WFI __iar_builtin_WFI + + #if __ARM_MEDIA__ + #define __SADD8 __iar_builtin_SADD8 + #define __QADD8 __iar_builtin_QADD8 + #define __SHADD8 __iar_builtin_SHADD8 + #define __UADD8 __iar_builtin_UADD8 + #define __UQADD8 __iar_builtin_UQADD8 + #define __UHADD8 __iar_builtin_UHADD8 + #define __SSUB8 __iar_builtin_SSUB8 + #define __QSUB8 __iar_builtin_QSUB8 + #define __SHSUB8 __iar_builtin_SHSUB8 + #define __USUB8 __iar_builtin_USUB8 + #define __UQSUB8 __iar_builtin_UQSUB8 + #define __UHSUB8 __iar_builtin_UHSUB8 + #define __SADD16 __iar_builtin_SADD16 + #define __QADD16 __iar_builtin_QADD16 + #define __SHADD16 __iar_builtin_SHADD16 + #define __UADD16 __iar_builtin_UADD16 + #define __UQADD16 __iar_builtin_UQADD16 + #define __UHADD16 __iar_builtin_UHADD16 + #define __SSUB16 __iar_builtin_SSUB16 + #define __QSUB16 __iar_builtin_QSUB16 + #define __SHSUB16 __iar_builtin_SHSUB16 + #define __USUB16 __iar_builtin_USUB16 + #define __UQSUB16 __iar_builtin_UQSUB16 + #define __UHSUB16 __iar_builtin_UHSUB16 + #define __SASX __iar_builtin_SASX + #define __QASX __iar_builtin_QASX + #define __SHASX __iar_builtin_SHASX + #define __UASX __iar_builtin_UASX + #define __UQASX __iar_builtin_UQASX + #define __UHASX __iar_builtin_UHASX + #define __SSAX __iar_builtin_SSAX + #define __QSAX __iar_builtin_QSAX + #define __SHSAX __iar_builtin_SHSAX + #define __USAX __iar_builtin_USAX + #define __UQSAX __iar_builtin_UQSAX + #define __UHSAX __iar_builtin_UHSAX + #define __USAD8 __iar_builtin_USAD8 + #define __USADA8 __iar_builtin_USADA8 + #define __SSAT16 __iar_builtin_SSAT16 + #define __USAT16 __iar_builtin_USAT16 + #define __UXTB16 __iar_builtin_UXTB16 + #define __UXTAB16 __iar_builtin_UXTAB16 + #define __SXTB16 __iar_builtin_SXTB16 + #define __SXTAB16 __iar_builtin_SXTAB16 + #define __SMUAD __iar_builtin_SMUAD + #define __SMUADX __iar_builtin_SMUADX + #define __SMMLA __iar_builtin_SMMLA + #define __SMLAD __iar_builtin_SMLAD + #define __SMLADX __iar_builtin_SMLADX + #define __SMLALD __iar_builtin_SMLALD + #define __SMLALDX __iar_builtin_SMLALDX + #define __SMUSD __iar_builtin_SMUSD + #define __SMUSDX __iar_builtin_SMUSDX + #define __SMLSD __iar_builtin_SMLSD + #define __SMLSDX __iar_builtin_SMLSDX + #define __SMLSLD __iar_builtin_SMLSLD + #define __SMLSLDX __iar_builtin_SMLSLDX + #define __SEL __iar_builtin_SEL + #define __QADD __iar_builtin_QADD + #define __QSUB __iar_builtin_QSUB + #define __PKHBT __iar_builtin_PKHBT + #define __PKHTB __iar_builtin_PKHTB + #endif + +#else /* __ICCARM_INTRINSICS_VERSION__ == 2 */ + + #if __IAR_M0_FAMILY + /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */ + #define __CLZ __cmsis_iar_clz_not_active + #define __SSAT __cmsis_iar_ssat_not_active + #define __USAT __cmsis_iar_usat_not_active + #define __RBIT __cmsis_iar_rbit_not_active + #define __get_APSR __cmsis_iar_get_APSR_not_active + #endif + + + #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) )) + #define __get_FPSCR __cmsis_iar_get_FPSR_not_active + #define __set_FPSCR __cmsis_iar_set_FPSR_not_active + #endif + + #ifdef __INTRINSICS_INCLUDED + #error intrinsics.h is already included previously! + #endif + + #include + + #if __IAR_M0_FAMILY + /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */ + #undef __CLZ + #undef __SSAT + #undef __USAT + #undef __RBIT + #undef __get_APSR + + __STATIC_INLINE uint8_t __CLZ(uint32_t data) + { + if (data == 0U) { return 32U; } + + uint32_t count = 0U; + uint32_t mask = 0x80000000U; + + while ((data & mask) == 0U) + { + count += 1U; + mask = mask >> 1U; + } + return count; + } + + __STATIC_INLINE uint32_t __RBIT(uint32_t v) + { + uint8_t sc = 31U; + uint32_t r = v; + for (v >>= 1U; v; v >>= 1U) + { + r <<= 1U; + r |= v & 1U; + sc--; + } + return (r << sc); + } + + __STATIC_INLINE uint32_t __get_APSR(void) + { + uint32_t res; + __asm("MRS %0,APSR" : "=r" (res)); + return res; + } + + #endif + + #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) )) + #undef __get_FPSCR + #undef __set_FPSCR + #define __get_FPSCR() (0) + #define __set_FPSCR(VALUE) ((void)VALUE) + #endif + + #pragma diag_suppress=Pe940 + #pragma diag_suppress=Pe177 + + #define __enable_irq __enable_interrupt + #define __disable_irq __disable_interrupt + #define __NOP __no_operation + + #define __get_xPSR __get_PSR + + #if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0) + + __IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr) + { + return __LDREX((unsigned long *)ptr); + } + + __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr) + { + return __STREX(value, (unsigned long *)ptr); + } + #endif + + + /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */ + #if (__CORTEX_M >= 0x03) + + __IAR_FT uint32_t __RRX(uint32_t value) + { + uint32_t result; + __ASM("RRX %0, %1" : "=r"(result) : "r" (value) : "cc"); + return(result); + } + + __IAR_FT void __set_BASEPRI_MAX(uint32_t value) + { + __asm volatile("MSR BASEPRI_MAX,%0"::"r" (value)); + } + + + #define __enable_fault_irq __enable_fiq + #define __disable_fault_irq __disable_fiq + + + #endif /* (__CORTEX_M >= 0x03) */ + + __IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2) + { + return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2)); + } + + #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + + __IAR_FT uint32_t __get_MSPLIM(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,MSPLIM" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __set_MSPLIM(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR MSPLIM,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __get_PSPLIM(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,PSPLIM" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __set_PSPLIM(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR PSPLIM,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __TZ_get_CONTROL_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,CONTROL_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_CONTROL_NS(uint32_t value) + { + __asm volatile("MSR CONTROL_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PSP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,PSP_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_PSP_NS(uint32_t value) + { + __asm volatile("MSR PSP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_MSP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,MSP_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_MSP_NS(uint32_t value) + { + __asm volatile("MSR MSP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_SP_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,SP_NS" : "=r" (res)); + return res; + } + __IAR_FT void __TZ_set_SP_NS(uint32_t value) + { + __asm volatile("MSR SP_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PRIMASK_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,PRIMASK_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_PRIMASK_NS(uint32_t value) + { + __asm volatile("MSR PRIMASK_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_BASEPRI_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,BASEPRI_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_BASEPRI_NS(uint32_t value) + { + __asm volatile("MSR BASEPRI_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_FAULTMASK_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,FAULTMASK_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_FAULTMASK_NS(uint32_t value) + { + __asm volatile("MSR FAULTMASK_NS,%0" :: "r" (value)); + } + + __IAR_FT uint32_t __TZ_get_PSPLIM_NS(void) + { + uint32_t res; + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + res = 0U; + #else + __asm volatile("MRS %0,PSPLIM_NS" : "=r" (res)); + #endif + return res; + } + + __IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value) + { + #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)value; + #else + __asm volatile("MSR PSPLIM_NS,%0" :: "r" (value)); + #endif + } + + __IAR_FT uint32_t __TZ_get_MSPLIM_NS(void) + { + uint32_t res; + __asm volatile("MRS %0,MSPLIM_NS" : "=r" (res)); + return res; + } + + __IAR_FT void __TZ_set_MSPLIM_NS(uint32_t value) + { + __asm volatile("MSR MSPLIM_NS,%0" :: "r" (value)); + } + + #endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */ + +#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */ + +#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value)) + +#if __IAR_M0_FAMILY + __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) + { + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; + } + + __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) + { + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; + } +#endif + +#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */ + + __IAR_FT uint8_t __LDRBT(volatile uint8_t *addr) + { + uint32_t res; + __ASM("LDRBT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDRHT(volatile uint16_t *addr) + { + uint32_t res; + __ASM("LDRHT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDRT(volatile uint32_t *addr) + { + uint32_t res; + __ASM("LDRT %0, [%1]" : "=r" (res) : "r" (addr) : "memory"); + return res; + } + + __IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr) + { + __ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory"); + } + + __IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr) + { + __ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory"); + } + + __IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr) + { + __ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory"); + } + +#endif /* (__CORTEX_M >= 0x03) */ + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + + + __IAR_FT uint8_t __LDAB(volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDAH(volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDA(volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("LDA %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return res; + } + + __IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr) + { + __ASM volatile ("STLB %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr) + { + __ASM volatile ("STLH %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr) + { + __ASM volatile ("STL %1, [%0]" :: "r" (ptr), "r" (value) : "memory"); + } + + __IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEXB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint8_t)res); + } + + __IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEXH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return ((uint16_t)res); + } + + __IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("LDAEX %0, [%1]" : "=r" (res) : "r" (ptr) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEXB %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEXH %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + + __IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) + { + uint32_t res; + __ASM volatile ("STLEX %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory"); + return res; + } + +#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */ + +#undef __IAR_FT +#undef __IAR_M0_FAMILY +#undef __ICCARM_V8 + +#pragma diag_default=Pe940 +#pragma diag_default=Pe177 + +#endif /* __CMSIS_ICCARM_H__ */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/cmsis_version.h b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_version.h new file mode 100644 index 0000000..660f612 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/cmsis_version.h @@ -0,0 +1,39 @@ +/**************************************************************************//** + * @file cmsis_version.h + * @brief CMSIS Core(M) Version definitions + * @version V5.0.2 + * @date 19. April 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CMSIS_VERSION_H +#define __CMSIS_VERSION_H + +/* CMSIS Version definitions */ +#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ +#define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ +#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ + __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ +#endif diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mbl.h b/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mbl.h new file mode 100644 index 0000000..251e4ed --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mbl.h @@ -0,0 +1,1918 @@ +/**************************************************************************//** + * @file core_armv8mbl.h + * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 22. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_ARMV8MBL_H_GENERIC +#define __CORE_ARMV8MBL_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_ARMv8MBL + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS definitions */ +#define __ARMv8MBL_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __ARMv8MBL_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \ + __ARMv8MBL_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M ( 2U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MBL_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_ARMV8MBL_H_DEPENDANT +#define __CORE_ARMV8MBL_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __ARMv8MBL_REV + #define __ARMv8MBL_REV 0x0000U + #warning "__ARMv8MBL_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif + + #ifndef __ETM_PRESENT + #define __ETM_PRESENT 0U + #warning "__ETM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MTB_PRESENT + #define __MTB_PRESENT 0U + #warning "__MTB_PRESENT not defined in device header file; using default!" + #endif + +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group ARMv8MBL */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t RESERVED0[6U]; + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[809U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */ + uint32_t RESERVED4[4U]; + __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */ +#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI Periodic Synchronization Control Register Definitions */ +#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */ +#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */ + +/* TPI Software Lock Status Register Definitions */ +#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */ +#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */ + +#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */ +#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */ + +#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */ +#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + uint32_t RESERVED0[7U]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#endif +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register */ +#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */ +#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MBL_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mml.h b/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mml.h new file mode 100644 index 0000000..3a3148e --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_armv8mml.h @@ -0,0 +1,2927 @@ +/**************************************************************************//** + * @file core_armv8mml.h + * @brief CMSIS Armv8-M Mainline Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 06. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_ARMV8MML_H_GENERIC +#define __CORE_ARMV8MML_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_ARMv8MML + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS Armv8MML definitions */ +#define __ARMv8MML_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __ARMv8MML_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \ + __ARMv8MML_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (81U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined(__ARM_FEATURE_DSP) + #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MML_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_ARMV8MML_H_DEPENDANT +#define __CORE_ARMV8MML_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __ARMv8MML_REV + #define __ARMv8MML_REV 0x0000U + #warning "__ARMv8MML_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DSP_PRESENT + #define __DSP_PRESENT 0U + #warning "__DSP_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group ARMv8MML */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ +#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */ + uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */ + uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */ +#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */ + +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED6[580U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */ + uint32_t RESERVED3[92U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */ +#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */ +#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */ + +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */ +#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */ +#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Non-Secure Access Control Register Definitions */ +#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */ +#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */ + +#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */ +#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */ + +#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */ +#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ + __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */ + uint32_t RESERVED6[4U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Stimulus Port Register Definitions */ +#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */ +#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */ + +#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */ +#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */ + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */ +#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */ + +#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */ +#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ + uint32_t RESERVED32[934U]; + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ + uint32_t RESERVED33[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */ +#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[809U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */ + uint32_t RESERVED4[4U]; + __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */ +#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI Periodic Synchronization Control Register Definitions */ +#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */ +#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */ + +/* TPI Software Lock Status Register Definitions */ +#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */ +#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */ + +#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */ +#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */ + +#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */ +#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */ + __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */ + __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */ + __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */ + uint32_t RESERVED0[1]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#else + uint32_t RESERVED0[3]; +#endif + __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */ + __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */ +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/* Secure Fault Status Register Definitions */ +#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */ +#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */ + +#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */ +#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */ + +#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */ +#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */ + +#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */ +#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */ + +#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */ +#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */ + +#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */ +#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */ + +#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */ +#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */ + +#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */ +#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */ +#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */ + +#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */ +#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */ + +#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */ +#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */ + +#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */ +#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */ + +#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */ +#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */ + +#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */ +#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */ +#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */ +#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + + #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ + #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */ + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + + #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */ + #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */ + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Set Priority Grouping (non-secure) + \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB_NS->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB_NS->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping (non-secure) + \details Reads the priority grouping field from the non-secure NVIC when in secure state. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void) +{ + return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_ARMV8MML_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm0.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm0.h new file mode 100644 index 0000000..f929bba --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm0.h @@ -0,0 +1,949 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V5.0.5 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M0 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000U + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm0plus.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm0plus.h new file mode 100644 index 0000000..424011a --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm0plus.h @@ -0,0 +1,1083 @@ +/**************************************************************************//** + * @file core_cm0plus.h + * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File + * @version V5.0.6 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0PLUS_H_GENERIC +#define __CORE_CM0PLUS_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex-M0+ + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM0+ definitions */ +#define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ + __CM0PLUS_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0PLUS_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0PLUS_H_DEPENDANT +#define __CORE_CM0PLUS_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0PLUS_REV + #define __CM0PLUS_REV 0x0000U + #warning "__CM0PLUS_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex-M0+ */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Interrupt Control State Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0+ header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; + +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0PLUS_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm1.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm1.h new file mode 100644 index 0000000..0ed678e --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm1.h @@ -0,0 +1,976 @@ +/**************************************************************************//** + * @file core_cm1.h + * @brief CMSIS Cortex-M1 Core Peripheral Access Layer Header File + * @version V1.0.0 + * @date 23. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM1_H_GENERIC +#define __CORE_CM1_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M1 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM1 definitions */ +#define __CM1_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM1_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM1_CMSIS_VERSION ((__CM1_CMSIS_VERSION_MAIN << 16U) | \ + __CM1_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (1U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM1_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM1_H_DEPENDANT +#define __CORE_CM1_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM1_REV + #define __CM1_REV 0x0100U + #warning "__CM1_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M1 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_ITCMUAEN_Pos 4U /*!< ACTLR: Instruction TCM Upper Alias Enable Position */ +#define SCnSCB_ACTLR_ITCMUAEN_Msk (1UL << SCnSCB_ACTLR_ITCMUAEN_Pos) /*!< ACTLR: Instruction TCM Upper Alias Enable Mask */ + +#define SCnSCB_ACTLR_ITCMLAEN_Pos 3U /*!< ACTLR: Instruction TCM Lower Alias Enable Position */ +#define SCnSCB_ACTLR_ITCMLAEN_Msk (1UL << SCnSCB_ACTLR_ITCMLAEN_Pos) /*!< ACTLR: Instruction TCM Lower Alias Enable Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M1 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M1 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M1 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM1_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm23.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm23.h new file mode 100644 index 0000000..acbc5df --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm23.h @@ -0,0 +1,1993 @@ +/**************************************************************************//** + * @file core_cm23.h + * @brief CMSIS Cortex-M23 Core Peripheral Access Layer Header File + * @version V5.0.7 + * @date 22. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM23_H_GENERIC +#define __CORE_CM23_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M23 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS definitions */ +#define __CM23_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM23_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM23_CMSIS_VERSION ((__CM23_CMSIS_VERSION_MAIN << 16U) | \ + __CM23_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (23U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM23_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM23_H_DEPENDANT +#define __CORE_CM23_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM23_REV + #define __CM23_REV 0x0000U + #warning "__CM23_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif + + #ifndef __ETM_PRESENT + #define __ETM_PRESENT 0U + #warning "__ETM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MTB_PRESENT + #define __MTB_PRESENT 0U + #warning "__MTB_PRESENT not defined in device header file; using default!" + #endif + +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M23 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t RESERVED0[6U]; + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */ + __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */ + __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration Test FIFO Test Data 0 Register Definitions */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */ +#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */ +#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */ +#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */ + +/* TPI Integration Test ATB Control Register 2 Register Definitions */ +#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */ +#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */ + +#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */ +#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */ + +#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */ +#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */ + +#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */ +#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */ + +/* TPI Integration Test FIFO Test Data 1 Register Definitions */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */ +#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */ +#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */ +#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */ + +/* TPI Integration Test ATB Control Register 0 Definitions */ +#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */ +#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */ + +#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */ +#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */ + +#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */ +#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */ + +#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */ +#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + uint32_t RESERVED0[7U]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 1U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#endif +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register */ +#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */ +#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M23 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M23 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + +#define __NVIC_SetPriorityGrouping(X) (void)(X) +#define __NVIC_GetPriorityGrouping() (0U) + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + If VTOR is not present address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ +#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) + uint32_t *vectors = (uint32_t *)SCB->VTOR; +#else + uint32_t *vectors = (uint32_t *)0x0U; +#endif + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM23_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm3.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm3.h new file mode 100644 index 0000000..74bff64 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm3.h @@ -0,0 +1,1941 @@ +/**************************************************************************//** + * @file core_cm3.h + * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM3_H_GENERIC +#define __CORE_CM3_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M3 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM3 definitions */ +#define __CM3_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM3_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \ + __CM3_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (3U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM3_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM3_H_DEPENDANT +#define __CORE_CM3_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM3_REV + #define __CM3_REV 0x0200U + #warning "__CM3_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M3 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#if defined (__CM3_REV) && (__CM3_REV < 0x0201U) /* core r2p1 */ +#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ +#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ + +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#else +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ +#if defined (__CM3_REV) && (__CM3_REV >= 0x200U) + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +#else + uint32_t RESERVED1[1U]; +#endif +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM3_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm33.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm33.h new file mode 100644 index 0000000..6cd2db7 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm33.h @@ -0,0 +1,3002 @@ +/**************************************************************************//** + * @file core_cm33.h + * @brief CMSIS Cortex-M33 Core Peripheral Access Layer Header File + * @version V5.0.9 + * @date 06. July 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM33_H_GENERIC +#define __CORE_CM33_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M33 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM33 definitions */ +#define __CM33_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM33_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM33_CMSIS_VERSION ((__CM33_CMSIS_VERSION_MAIN << 16U) | \ + __CM33_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (33U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined (__TARGET_FPU_VFP) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined (__ARM_PCS_VFP) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined (__ARMVFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + + #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U) + #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U) + #define __DSP_USED 1U + #else + #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)" + #define __DSP_USED 0U + #endif + #else + #define __DSP_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined (__TI_VFP_SUPPORT__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined (__FPU_VFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM33_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM33_H_DEPENDANT +#define __CORE_CM33_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM33_REV + #define __CM33_REV 0x0000U + #warning "__CM33_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __SAUREGION_PRESENT + #define __SAUREGION_PRESENT 0U + #warning "__SAUREGION_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DSP_PRESENT + #define __DSP_PRESENT 0U + #warning "__DSP_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M33 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core SAU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */ +#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */ + uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */ + uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */ + uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */ +#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */ + +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[16U]; + __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[16U]; + __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[16U]; + __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[16U]; + __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[16U]; + __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */ + uint32_t RESERVED5[16U]; + __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED6[580U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */ + uint32_t RESERVED3[92U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */ +#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */ + +#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */ +#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */ + +#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */ +#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */ +#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */ +#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */ + +#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */ +#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */ +#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */ +#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */ + +#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */ +#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */ +#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */ +#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */ + +#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */ +#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */ + +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */ +#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */ + +#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */ +#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */ +#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */ +#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Non-Secure Access Control Register Definitions */ +#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */ +#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */ + +#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */ +#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */ + +#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */ +#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ + __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */ + uint32_t RESERVED6[4U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Stimulus Port Register Definitions */ +#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */ +#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */ + +#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */ +#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */ + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */ +#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */ + +#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */ +#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + uint32_t RESERVED3[1U]; + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED4[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + uint32_t RESERVED5[1U]; + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED6[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + uint32_t RESERVED7[1U]; + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED8[1U]; + __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */ + uint32_t RESERVED9[1U]; + __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */ + uint32_t RESERVED10[1U]; + __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */ + uint32_t RESERVED11[1U]; + __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */ + uint32_t RESERVED12[1U]; + __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */ + uint32_t RESERVED13[1U]; + __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */ + uint32_t RESERVED14[1U]; + __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */ + uint32_t RESERVED15[1U]; + __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */ + uint32_t RESERVED16[1U]; + __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */ + uint32_t RESERVED17[1U]; + __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */ + uint32_t RESERVED18[1U]; + __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */ + uint32_t RESERVED19[1U]; + __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */ + uint32_t RESERVED20[1U]; + __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */ + uint32_t RESERVED21[1U]; + __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */ + uint32_t RESERVED22[1U]; + __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */ + uint32_t RESERVED23[1U]; + __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */ + uint32_t RESERVED24[1U]; + __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */ + uint32_t RESERVED25[1U]; + __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */ + uint32_t RESERVED26[1U]; + __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */ + uint32_t RESERVED27[1U]; + __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */ + uint32_t RESERVED28[1U]; + __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */ + uint32_t RESERVED29[1U]; + __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */ + uint32_t RESERVED30[1U]; + __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */ + uint32_t RESERVED31[1U]; + __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */ + uint32_t RESERVED32[934U]; + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ + uint32_t RESERVED33[1U]; + __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */ +#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */ +#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */ + +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */ +#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */ + +#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */ +#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */ + __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */ + __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */ +#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration Test FIFO Test Data 0 Register Definitions */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */ +#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */ +#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */ +#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */ + +#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */ +#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */ + +/* TPI Integration Test ATB Control Register 2 Register Definitions */ +#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */ +#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */ + +#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */ +#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */ + +#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */ +#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */ + +#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */ +#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */ + +/* TPI Integration Test FIFO Test Data 1 Register Definitions */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */ +#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */ + +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */ +#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */ + +#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */ +#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */ +#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */ +#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */ + +#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */ +#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */ + +/* TPI Integration Test ATB Control Register 0 Definitions */ +#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */ +#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */ + +#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */ +#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */ + +#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */ +#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */ + +#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */ +#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */ +#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */ + __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */ + __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */ + __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */ + uint32_t RESERVED0[1]; + union { + __IOM uint32_t MAIR[2]; + struct { + __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */ + __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */ + }; + }; +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */ +#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */ + +#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */ +#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */ + +#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */ +#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */ + +#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */ +#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */ + +/* MPU Region Limit Address Register Definitions */ +#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */ +#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */ + +#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */ +#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */ + +#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */ +#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */ + +/* MPU Memory Attribute Indirection Register 0 Definitions */ +#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */ +#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */ + +#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */ +#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */ + +#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */ +#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */ + +#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */ +#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */ + +/* MPU Memory Attribute Indirection Register 1 Definitions */ +#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */ +#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */ + +#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */ +#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */ + +#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */ +#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */ + +#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */ +#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SAU Security Attribution Unit (SAU) + \brief Type definitions for the Security Attribution Unit (SAU) + @{ + */ + +/** + \brief Structure type to access the Security Attribution Unit (SAU). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */ + __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */ +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */ + __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */ +#else + uint32_t RESERVED0[3]; +#endif + __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */ + __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */ +} SAU_Type; + +/* SAU Control Register Definitions */ +#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */ +#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */ + +#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */ +#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */ + +/* SAU Type Register Definitions */ +#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */ +#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */ + +#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) +/* SAU Region Number Register Definitions */ +#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */ +#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */ + +/* SAU Region Base Address Register Definitions */ +#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */ +#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */ + +/* SAU Region Limit Address Register Definitions */ +#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */ +#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */ + +#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */ +#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */ + +#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */ +#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */ + +#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */ + +/* Secure Fault Status Register Definitions */ +#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */ +#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */ + +#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */ +#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */ + +#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */ +#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */ + +#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */ +#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */ + +#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */ +#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */ + +#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */ +#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */ + +#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */ +#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */ + +#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */ +#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */ + +/*@} end of group CMSIS_SAU */ +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */ +#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */ + +#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */ +#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */ + +#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */ +#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */ + +#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */ +#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */ + +#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */ +#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */ + +#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */ +#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */ +#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */ +#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ + uint32_t RESERVED4[1U]; + __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */ + __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */ +#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/* Debug Authentication Control Register Definitions */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */ +#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */ + +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */ + +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */ +#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */ + +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */ +#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */ + +/* Debug Security Control and Status Register Definitions */ +#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */ +#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */ + +#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */ +#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */ + +#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */ +#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ + #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ + #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ + #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ + #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ + #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ + #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ + #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + + #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ + #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ + #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ + #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ + #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ + #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ + #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ + #endif + + #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */ + #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */ + #endif + + #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ + #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */ + #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */ + #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */ + #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */ + #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */ + + #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */ + #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */ + #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */ + #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */ + #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */ + + #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */ + #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */ + #endif + + #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */ + #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */ + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Special LR values for Secure/Non-Secure call handling and exception handling */ + +/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */ +#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */ + +/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */ +#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */ +#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */ +#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */ +#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */ +#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */ +#define EXC_RETURN_SPSEL (0x00000002UL) /* bit [1] stack pointer used to restore context: 0=MSP 1=PSP */ +#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */ + +/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */ +#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */ +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */ +#else +#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */ +#endif + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Get Interrupt Target State + \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + \return 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Target State + \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Clear Interrupt Target State + \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 if interrupt is assigned to Secure + 1 if interrupt is assigned to Non Secure + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL))); + return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief Set Priority Grouping (non-secure) + \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB_NS->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB_NS->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping (non-secure) + \details Reads the priority grouping field from the non-secure NVIC when in secure state. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void) +{ + return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt (non-secure) + \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status (non-secure) + \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt (non-secure) + \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Pending Interrupt (non-secure) + \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt (non-secure) + \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt (non-secure) + \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt (non-secure) + \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority (non-secure) + \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every non-secure processor exception. + */ +__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority (non-secure) + \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} +#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv8.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## SAU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SAUFunctions SAU Functions + \brief Functions that configure the SAU. + @{ + */ + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + +/** + \brief Enable SAU + \details Enables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Enable(void) +{ + SAU->CTRL |= (SAU_CTRL_ENABLE_Msk); +} + + + +/** + \brief Disable SAU + \details Disables the Security Attribution Unit (SAU). + */ +__STATIC_INLINE void TZ_SAU_Disable(void) +{ + SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk); +} + +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +/*@} end of CMSIS_Core_SAUFunctions */ + + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +/** + \brief System Tick Configuration (non-secure) + \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function TZ_SysTick_Config_NS is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} +#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM33_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm4.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm4.h new file mode 100644 index 0000000..7d56873 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm4.h @@ -0,0 +1,2129 @@ +/**************************************************************************//** + * @file core_cm4.h + * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM4_H_GENERIC +#define __CORE_CM4_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M4 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM4 definitions */ +#define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \ + __CM4_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (4U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM4_H_DEPENDANT +#define __CORE_CM4_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM4_REV + #define __CM4_REV 0x0000U + #warning "__CM4_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M4 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */ +#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */ + +#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */ +#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ +#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ +#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_cm7.h b/SEW-EXA1/Drivers/CMSIS/Include/core_cm7.h new file mode 100644 index 0000000..a14dc62 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_cm7.h @@ -0,0 +1,2671 @@ +/**************************************************************************//** + * @file core_cm7.h + * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File + * @version V5.0.8 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM7_H_GENERIC +#define __CORE_CM7_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M7 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM7 definitions */ +#define __CM7_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM7_CMSIS_VERSION_SUB ( __CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \ + __CM7_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (7U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM7_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM7_H_DEPENDANT +#define __CORE_CM7_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM7_REV + #define __CM7_REV 0x0000U + #warning "__CM7_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __ICACHE_PRESENT + #define __ICACHE_PRESENT 0U + #warning "__ICACHE_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DCACHE_PRESENT + #define __DCACHE_PRESENT 0U + #warning "__DCACHE_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __DTCM_PRESENT + #define __DTCM_PRESENT 0U + #warning "__DTCM_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M7 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ID_AFR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t ID_MFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ID_ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[1U]; + __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */ + __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */ + __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */ + __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */ + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + uint32_t RESERVED3[93U]; + __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */ + uint32_t RESERVED4[15U]; + __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */ + uint32_t RESERVED5[1U]; + __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */ + uint32_t RESERVED6[1U]; + __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */ + __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */ + __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */ + __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */ + __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */ + __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */ + __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */ + __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */ + uint32_t RESERVED7[6U]; + __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */ + __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */ + __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */ + __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */ + __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */ + uint32_t RESERVED8[1U]; + __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: Branch prediction enable bit Position */ +#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: Branch prediction enable bit Mask */ + +#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: Instruction cache enable bit Position */ +#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: Instruction cache enable bit Mask */ + +#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: Cache enable bit Position */ +#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: Cache enable bit Mask */ + +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/* SCB Cache Level ID Register Definitions */ +#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */ +#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */ + +#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */ +#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */ + +/* SCB Cache Type Register Definitions */ +#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */ +#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */ + +#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */ +#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */ + +#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */ +#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */ + +#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */ +#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */ + +#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */ +#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */ + +/* SCB Cache Size ID Register Definitions */ +#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */ +#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */ + +#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */ +#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */ + +#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */ +#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */ + +#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */ +#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */ + +#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */ +#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */ + +#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */ +#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */ + +#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */ +#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */ + +/* SCB Cache Size Selection Register Definitions */ +#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */ +#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */ + +#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */ +#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */ + +/* SCB Software Triggered Interrupt Register Definitions */ +#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */ +#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */ + +/* SCB D-Cache Invalidate by Set-way Register Definitions */ +#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */ +#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */ + +#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */ +#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */ + +/* SCB D-Cache Clean by Set-way Register Definitions */ +#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */ +#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */ + +#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */ +#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */ + +/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */ +#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */ +#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */ + +#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */ +#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */ + +/* Instruction Tightly-Coupled Memory Control Register Definitions */ +#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */ +#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */ + +#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */ +#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */ + +#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */ +#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */ + +#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */ +#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */ + +/* Data Tightly-Coupled Memory Control Register Definitions */ +#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */ +#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */ + +#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */ +#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */ + +#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */ +#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */ + +#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */ +#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */ + +/* AHBP Control Register Definitions */ +#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */ +#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */ + +#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */ +#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */ + +/* L1 Cache Control Register Definitions */ +#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */ +#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */ + +#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */ +#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */ + +#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */ +#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */ + +/* AHBS Control Register Definitions */ +#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */ +#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */ + +#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */ +#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */ + +#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/ +#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */ + +/* Auxiliary Bus Fault Status Register Definitions */ +#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/ +#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */ + +#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/ +#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */ + +#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/ +#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */ + +#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/ +#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */ + +#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/ +#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */ + +#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/ +#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISITMATBFLUSH_Pos 12U /*!< ACTLR: DISITMATBFLUSH Position */ +#define SCnSCB_ACTLR_DISITMATBFLUSH_Msk (1UL << SCnSCB_ACTLR_DISITMATBFLUSH_Pos) /*!< ACTLR: DISITMATBFLUSH Mask */ + +#define SCnSCB_ACTLR_DISRAMODE_Pos 11U /*!< ACTLR: DISRAMODE Position */ +#define SCnSCB_ACTLR_DISRAMODE_Msk (1UL << SCnSCB_ACTLR_DISRAMODE_Pos) /*!< ACTLR: DISRAMODE Mask */ + +#define SCnSCB_ACTLR_FPEXCODIS_Pos 10U /*!< ACTLR: FPEXCODIS Position */ +#define SCnSCB_ACTLR_FPEXCODIS_Msk (1UL << SCnSCB_ACTLR_FPEXCODIS_Pos) /*!< ACTLR: FPEXCODIS Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ + uint32_t RESERVED3[981U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( W) Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/* Media and FP Feature Register 2 Definitions */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ +#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ +#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = SCB->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U) + { + return 2U; /* Double + Single precision FPU */ + } + else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ########################## Cache functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_CacheFunctions Cache Functions + \brief Functions that configure Instruction and Data cache. + @{ + */ + +/* Cache Size ID Register Macros */ +#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos) +#define CCSIDR_SETS(x) (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos ) + + +/** + \brief Enable I-Cache + \details Turns on I-Cache + */ +__STATIC_INLINE void SCB_EnableICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->ICIALLU = 0UL; /* invalidate I-Cache */ + __DSB(); + __ISB(); + SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */ + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Disable I-Cache + \details Turns off I-Cache + */ +__STATIC_INLINE void SCB_DisableICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */ + SCB->ICIALLU = 0UL; /* invalidate I-Cache */ + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Invalidate I-Cache + \details Invalidates I-Cache + */ +__STATIC_INLINE void SCB_InvalidateICache (void) +{ + #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) + __DSB(); + __ISB(); + SCB->ICIALLU = 0UL; + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Enable D-Cache + \details Turns on D-Cache + */ +__STATIC_INLINE void SCB_EnableDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | + ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + __DSB(); + + SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */ + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Disable D-Cache + \details Turns off D-Cache + */ +__STATIC_INLINE void SCB_DisableDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean & invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | + ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Invalidate D-Cache + \details Invalidates D-Cache + */ +__STATIC_INLINE void SCB_InvalidateDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | + ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Clean D-Cache + \details Cleans D-Cache + */ +__STATIC_INLINE void SCB_CleanDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) | + ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief Clean & Invalidate D-Cache + \details Cleans and Invalidates D-Cache + */ +__STATIC_INLINE void SCB_CleanInvalidateDCache (void) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + uint32_t ccsidr; + uint32_t sets; + uint32_t ways; + + SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ + __DSB(); + + ccsidr = SCB->CCSIDR; + + /* clean & invalidate D-Cache */ + sets = (uint32_t)(CCSIDR_SETS(ccsidr)); + do { + ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); + do { + SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | + ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); + #if defined ( __CC_ARM ) + __schedule_barrier(); + #endif + } while (ways-- != 0U); + } while(sets-- != 0U); + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Invalidate by address + \details Invalidates D-Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t)addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCIMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Clean by address + \details Cleans D-Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t) addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCCMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/** + \brief D-Cache Clean and Invalidate by address + \details Cleans and invalidates D_Cache for the given address + \param[in] addr address (aligned to 32-byte boundary) + \param[in] dsize size of memory block (in number of bytes) +*/ +__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) +{ + #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + int32_t op_size = dsize; + uint32_t op_addr = (uint32_t) addr; + int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ + + __DSB(); + + while (op_size > 0) { + SCB->DCCIMVAC = op_addr; + op_addr += (uint32_t)linesize; + op_size -= linesize; + } + + __DSB(); + __ISB(); + #endif +} + + +/*@} end of CMSIS_Core_CacheFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM7_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_sc000.h b/SEW-EXA1/Drivers/CMSIS/Include/core_sc000.h new file mode 100644 index 0000000..9b67c92 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_sc000.h @@ -0,0 +1,1022 @@ +/**************************************************************************//** + * @file core_sc000.h + * @brief CMSIS SC000 Core Peripheral Access Layer Header File + * @version V5.0.5 + * @date 28. May 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_SC000_H_GENERIC +#define __CORE_SC000_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup SC000 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS SC000 definitions */ +#define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \ + __SC000_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_SC (000U) /*!< Cortex secure core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC000_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_SC000_H_DEPENDANT +#define __CORE_SC000_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __SC000_REV + #define __SC000_REV 0x0000U + #warning "__SC000_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group SC000 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED0[1U]; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + uint32_t RESERVED1[154U]; + __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the SC000 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + +/* Interrupt Priorities are WORD accessible only under Armv6-M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC000_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/core_sc300.h b/SEW-EXA1/Drivers/CMSIS/Include/core_sc300.h new file mode 100644 index 0000000..3e8a471 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/core_sc300.h @@ -0,0 +1,1915 @@ +/**************************************************************************//** + * @file core_sc300.h + * @brief CMSIS SC300 Core Peripheral Access Layer Header File + * @version V5.0.6 + * @date 04. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_SC300_H_GENERIC +#define __CORE_SC300_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup SC3000 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS SC300 definitions */ +#define __SC300_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __SC300_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \ + __SC300_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_SC (300U) /*!< Cortex secure core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC300_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_SC300_H_DEPENDANT +#define __CORE_SC300_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __SC300_REV + #define __SC300_REV 0x0000U + #warning "__SC300_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group SC300 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ + uint32_t RESERVED1[129U]; + __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */ +#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */ + +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + uint32_t RESERVED1[1U]; +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29U]; + __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ + + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_SC300_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv7.h b/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv7.h new file mode 100644 index 0000000..0142203 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv7.h @@ -0,0 +1,270 @@ +/****************************************************************************** + * @file mpu_armv7.h + * @brief CMSIS MPU API for Armv7-M MPU + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef ARM_MPU_ARMV7_H +#define ARM_MPU_ARMV7_H + +#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes +#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes +#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes +#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes +#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes +#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte +#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes +#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes +#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes +#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes +#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes +#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes +#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes +#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes +#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes +#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte +#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes +#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes +#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes +#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes +#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes +#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes +#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes +#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes +#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes +#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte +#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes +#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes + +#define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access +#define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only +#define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only +#define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access +#define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only +#define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access + +/** MPU Region Base Address Register Value +* +* \param Region The region to be configured, number 0 to 15. +* \param BaseAddress The base address for the region. +*/ +#define ARM_MPU_RBAR(Region, BaseAddress) \ + (((BaseAddress) & MPU_RBAR_ADDR_Msk) | \ + ((Region) & MPU_RBAR_REGION_Msk) | \ + (MPU_RBAR_VALID_Msk)) + +/** +* MPU Memory Access Attributes +* +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +*/ +#define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \ + ((((TypeExtField ) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \ + (((IsShareable ) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \ + (((IsCacheable ) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \ + (((IsBufferable ) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk)) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \ + ((((DisableExec ) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \ + (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \ + (((AccessAttributes) ) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk))) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \ + ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size) + +/** +* MPU Memory Access Attribute for strongly ordered memory. +* - TEX: 000b +* - Shareable +* - Non-cacheable +* - Non-bufferable +*/ +#define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U) + +/** +* MPU Memory Access Attribute for device memory. +* - TEX: 000b (if non-shareable) or 010b (if shareable) +* - Shareable or non-shareable +* - Non-cacheable +* - Bufferable (if shareable) or non-bufferable (if non-shareable) +* +* \param IsShareable Configures the device memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U)) + +/** +* MPU Memory Access Attribute for normal memory. +* - TEX: 1BBb (reflecting outer cacheability rules) +* - Shareable or non-shareable +* - Cacheable or non-cacheable (reflecting inner cacheability rules) +* - Bufferable or non-bufferable (reflecting inner cacheability rules) +* +* \param OuterCp Configures the outer cache policy. +* \param InnerCp Configures the inner cache policy. +* \param IsShareable Configures the memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) & 2U), ((InnerCp) & 1U)) + +/** +* MPU Memory Access Attribute non-cacheable policy. +*/ +#define ARM_MPU_CACHEP_NOCACHE 0U + +/** +* MPU Memory Access Attribute write-back, write and read allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_WRA 1U + +/** +* MPU Memory Access Attribute write-through, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WT_NWA 2U + +/** +* MPU Memory Access Attribute write-back, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_NWA 3U + + +/** +* Struct for a single MPU Region +*/ +typedef struct { + uint32_t RBAR; //!< The region base address register value (RBAR) + uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR +} ARM_MPU_Region_t; + +/** Enable the MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} + +/** Clear and disable the given MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr) +{ + MPU->RNR = rnr; + MPU->RASR = 0U; +} + +/** Configure an MPU region. +* \param rbar Value for RBAR register. +* \param rsar Value for RSAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr) +{ + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Configure the given MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rsar Value for RSAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr) +{ + MPU->RNR = rnr; + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Memcopy with strictly ordered memory access, e.g. for register targets. +* \param dst Destination data is copied to. +* \param src Source data is copied from. +* \param len Amount of data words to be copied. +*/ +__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len) +{ + uint32_t i; + for (i = 0U; i < len; ++i) + { + dst[i] = src[i]; + } +} + +/** Load the given number of MPU regions from a table. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt) +{ + const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U; + while (cnt > MPU_TYPE_RALIASES) { + orderedCpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize); + table += MPU_TYPE_RALIASES; + cnt -= MPU_TYPE_RALIASES; + } + orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize); +} + +#endif diff --git a/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv8.h b/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv8.h new file mode 100644 index 0000000..62571da --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/mpu_armv8.h @@ -0,0 +1,333 @@ +/****************************************************************************** + * @file mpu_armv8.h + * @brief CMSIS MPU API for Armv8-M MPU + * @version V5.0.4 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef ARM_MPU_ARMV8_H +#define ARM_MPU_ARMV8_H + +/** \brief Attribute for device memory (outer only) */ +#define ARM_MPU_ATTR_DEVICE ( 0U ) + +/** \brief Attribute for non-cacheable, normal memory */ +#define ARM_MPU_ATTR_NON_CACHEABLE ( 4U ) + +/** \brief Attribute for normal memory (outer and inner) +* \param NT Non-Transient: Set to 1 for non-transient data. +* \param WB Write-Back: Set to 1 to use write-back update policy. +* \param RA Read Allocation: Set to 1 to use cache allocation on read miss. +* \param WA Write Allocation: Set to 1 to use cache allocation on write miss. +*/ +#define ARM_MPU_ATTR_MEMORY_(NT, WB, RA, WA) \ + (((NT & 1U) << 3U) | ((WB & 1U) << 2U) | ((RA & 1U) << 1U) | (WA & 1U)) + +/** \brief Device memory type non Gathering, non Re-ordering, non Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGnRnE (0U) + +/** \brief Device memory type non Gathering, non Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGnRE (1U) + +/** \brief Device memory type non Gathering, Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_nGRE (2U) + +/** \brief Device memory type Gathering, Re-ordering, Early Write Acknowledgement */ +#define ARM_MPU_ATTR_DEVICE_GRE (3U) + +/** \brief Memory Attribute +* \param O Outer memory attributes +* \param I O == ARM_MPU_ATTR_DEVICE: Device memory attributes, else: Inner memory attributes +*/ +#define ARM_MPU_ATTR(O, I) (((O & 0xFU) << 4U) | (((O & 0xFU) != 0U) ? (I & 0xFU) : ((I & 0x3U) << 2U))) + +/** \brief Normal memory non-shareable */ +#define ARM_MPU_SH_NON (0U) + +/** \brief Normal memory outer shareable */ +#define ARM_MPU_SH_OUTER (2U) + +/** \brief Normal memory inner shareable */ +#define ARM_MPU_SH_INNER (3U) + +/** \brief Memory access permissions +* \param RO Read-Only: Set to 1 for read-only memory. +* \param NP Non-Privileged: Set to 1 for non-privileged memory. +*/ +#define ARM_MPU_AP_(RO, NP) (((RO & 1U) << 1U) | (NP & 1U)) + +/** \brief Region Base Address Register value +* \param BASE The base address bits [31:5] of a memory region. The value is zero extended. Effective address gets 32 byte aligned. +* \param SH Defines the Shareability domain for this memory region. +* \param RO Read-Only: Set to 1 for a read-only memory region. +* \param NP Non-Privileged: Set to 1 for a non-privileged memory region. +* \oaram XN eXecute Never: Set to 1 for a non-executable memory region. +*/ +#define ARM_MPU_RBAR(BASE, SH, RO, NP, XN) \ + ((BASE & MPU_RBAR_BASE_Msk) | \ + ((SH << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk) | \ + ((ARM_MPU_AP_(RO, NP) << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk) | \ + ((XN << MPU_RBAR_XN_Pos) & MPU_RBAR_XN_Msk)) + +/** \brief Region Limit Address Register value +* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended. +* \param IDX The attribute index to be associated with this memory region. +*/ +#define ARM_MPU_RLAR(LIMIT, IDX) \ + ((LIMIT & MPU_RLAR_LIMIT_Msk) | \ + ((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \ + (MPU_RLAR_EN_Msk)) + +/** +* Struct for a single MPU Region +*/ +typedef struct { + uint32_t RBAR; /*!< Region Base Address Register value */ + uint32_t RLAR; /*!< Region Limit Address Register value */ +} ARM_MPU_Region_t; + +/** Enable the MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} + +#ifdef MPU_NS +/** Enable the Non-secure MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable_NS(uint32_t MPU_Control) +{ + __DSB(); + __ISB(); + MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif +} + +/** Disable the Non-secure MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable_NS(void) +{ + __DSB(); + __ISB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU_NS->CTRL &= ~MPU_CTRL_ENABLE_Msk; +} +#endif + +/** Set the memory attribute encoding to the given MPU. +* \param mpu Pointer to the MPU to be configured. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr) +{ + const uint8_t reg = idx / 4U; + const uint32_t pos = ((idx % 4U) * 8U); + const uint32_t mask = 0xFFU << pos; + + if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) { + return; // invalid index + } + + mpu->MAIR[reg] = ((mpu->MAIR[reg] & ~mask) | ((attr << pos) & mask)); +} + +/** Set the memory attribute encoding. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttr(uint8_t idx, uint8_t attr) +{ + ARM_MPU_SetMemAttrEx(MPU, idx, attr); +} + +#ifdef MPU_NS +/** Set the memory attribute encoding to the Non-secure MPU. +* \param idx The attribute index to be set [0-7] +* \param attr The attribute value to be set. +*/ +__STATIC_INLINE void ARM_MPU_SetMemAttr_NS(uint8_t idx, uint8_t attr) +{ + ARM_MPU_SetMemAttrEx(MPU_NS, idx, attr); +} +#endif + +/** Clear and disable the given MPU region of the given MPU. +* \param mpu Pointer to MPU to be used. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegionEx(MPU_Type* mpu, uint32_t rnr) +{ + mpu->RNR = rnr; + mpu->RLAR = 0U; +} + +/** Clear and disable the given MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr) +{ + ARM_MPU_ClrRegionEx(MPU, rnr); +} + +#ifdef MPU_NS +/** Clear and disable the given Non-secure MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion_NS(uint32_t rnr) +{ + ARM_MPU_ClrRegionEx(MPU_NS, rnr); +} +#endif + +/** Configure the given MPU region of the given MPU. +* \param mpu Pointer to MPU to be used. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegionEx(MPU_Type* mpu, uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + mpu->RNR = rnr; + mpu->RBAR = rbar; + mpu->RLAR = rlar; +} + +/** Configure the given MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + ARM_MPU_SetRegionEx(MPU, rnr, rbar, rlar); +} + +#ifdef MPU_NS +/** Configure the given Non-secure MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rlar Value for RLAR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion_NS(uint32_t rnr, uint32_t rbar, uint32_t rlar) +{ + ARM_MPU_SetRegionEx(MPU_NS, rnr, rbar, rlar); +} +#endif + +/** Memcopy with strictly ordered memory access, e.g. for register targets. +* \param dst Destination data is copied to. +* \param src Source data is copied from. +* \param len Amount of data words to be copied. +*/ +__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len) +{ + uint32_t i; + for (i = 0U; i < len; ++i) + { + dst[i] = src[i]; + } +} + +/** Load the given number of MPU regions from a table to the given MPU. +* \param mpu Pointer to the MPU registers to be used. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_LoadEx(MPU_Type* mpu, uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U; + if (cnt == 1U) { + mpu->RNR = rnr; + orderedCpy(&(mpu->RBAR), &(table->RBAR), rowWordSize); + } else { + uint32_t rnrBase = rnr & ~(MPU_TYPE_RALIASES-1U); + uint32_t rnrOffset = rnr % MPU_TYPE_RALIASES; + + mpu->RNR = rnrBase; + while ((rnrOffset + cnt) > MPU_TYPE_RALIASES) { + uint32_t c = MPU_TYPE_RALIASES - rnrOffset; + orderedCpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize); + table += c; + cnt -= c; + rnrOffset = 0U; + rnrBase += MPU_TYPE_RALIASES; + mpu->RNR = rnrBase; + } + + orderedCpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), cnt*rowWordSize); + } +} + +/** Load the given number of MPU regions from a table. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + ARM_MPU_LoadEx(MPU, rnr, table, cnt); +} + +#ifdef MPU_NS +/** Load the given number of MPU regions from a table to the Non-secure MPU. +* \param rnr First region number to be configured. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load_NS(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt) +{ + ARM_MPU_LoadEx(MPU_NS, rnr, table, cnt); +} +#endif + +#endif + diff --git a/SEW-EXA1/Drivers/CMSIS/Include/tz_context.h b/SEW-EXA1/Drivers/CMSIS/Include/tz_context.h new file mode 100644 index 0000000..0d09749 --- /dev/null +++ b/SEW-EXA1/Drivers/CMSIS/Include/tz_context.h @@ -0,0 +1,70 @@ +/****************************************************************************** + * @file tz_context.h + * @brief Context Management for Armv8-M TrustZone + * @version V1.0.1 + * @date 10. January 2018 + ******************************************************************************/ +/* + * Copyright (c) 2017-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef TZ_CONTEXT_H +#define TZ_CONTEXT_H + +#include + +#ifndef TZ_MODULEID_T +#define TZ_MODULEID_T +/// \details Data type that identifies secure software modules called by a process. +typedef uint32_t TZ_ModuleId_t; +#endif + +/// \details TZ Memory ID identifies an allocated memory slot. +typedef uint32_t TZ_MemoryId_t; + +/// Initialize secure context memory system +/// \return execution status (1: success, 0: error) +uint32_t TZ_InitContextSystem_S (void); + +/// Allocate context memory for calling secure software modules in TrustZone +/// \param[in] module identifies software modules called from non-secure mode +/// \return value != 0 id TrustZone memory slot identifier +/// \return value 0 no memory available or internal error +TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); + +/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); + +/// Load secure context (called on RTOS thread context switch) +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); + +/// Store secure context (called on RTOS thread context switch) +/// \param[in] id TrustZone memory slot identifier +/// \return execution status (1: success, 0: error) +uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); + +#endif // TZ_CONTEXT_H diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h new file mode 100644 index 0000000..ac54cea --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h @@ -0,0 +1,3783 @@ +/** + ****************************************************************************** + * @file stm32_hal_legacy.h + * @author MCD Application Team + * @brief This file contains aliases definition for the STM32Cube HAL constants + * macros and functions maintained for legacy purpose. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * 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 + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup HAL_AES_Aliased_Defines HAL CRYP Aliased Defines maintained for legacy purpose + * @{ + */ +#define AES_FLAG_RDERR CRYP_FLAG_RDERR +#define AES_FLAG_WRERR CRYP_FLAG_WRERR +#define AES_CLEARFLAG_CCF CRYP_CLEARFLAG_CCF +#define AES_CLEARFLAG_RDERR CRYP_CLEARFLAG_RDERR +#define AES_CLEARFLAG_WRERR CRYP_CLEARFLAG_WRERR +/** + * @} + */ + +/** @defgroup HAL_ADC_Aliased_Defines HAL ADC Aliased Defines maintained for legacy purpose + * @{ + */ +#define ADC_RESOLUTION12b ADC_RESOLUTION_12B +#define ADC_RESOLUTION10b ADC_RESOLUTION_10B +#define ADC_RESOLUTION8b ADC_RESOLUTION_8B +#define ADC_RESOLUTION6b ADC_RESOLUTION_6B +#define OVR_DATA_OVERWRITTEN ADC_OVR_DATA_OVERWRITTEN +#define OVR_DATA_PRESERVED ADC_OVR_DATA_PRESERVED +#define EOC_SINGLE_CONV ADC_EOC_SINGLE_CONV +#define EOC_SEQ_CONV ADC_EOC_SEQ_CONV +#define EOC_SINGLE_SEQ_CONV ADC_EOC_SINGLE_SEQ_CONV +#define REGULAR_GROUP ADC_REGULAR_GROUP +#define INJECTED_GROUP ADC_INJECTED_GROUP +#define REGULAR_INJECTED_GROUP ADC_REGULAR_INJECTED_GROUP +#define AWD_EVENT ADC_AWD_EVENT +#define AWD1_EVENT ADC_AWD1_EVENT +#define AWD2_EVENT ADC_AWD2_EVENT +#define AWD3_EVENT ADC_AWD3_EVENT +#define OVR_EVENT ADC_OVR_EVENT +#define JQOVF_EVENT ADC_JQOVF_EVENT +#define ALL_CHANNELS ADC_ALL_CHANNELS +#define REGULAR_CHANNELS ADC_REGULAR_CHANNELS +#define INJECTED_CHANNELS ADC_INJECTED_CHANNELS +#define SYSCFG_FLAG_SENSOR_ADC ADC_FLAG_SENSOR +#define SYSCFG_FLAG_VREF_ADC ADC_FLAG_VREFINT +#define ADC_CLOCKPRESCALER_PCLK_DIV1 ADC_CLOCK_SYNC_PCLK_DIV1 +#define ADC_CLOCKPRESCALER_PCLK_DIV2 ADC_CLOCK_SYNC_PCLK_DIV2 +#define ADC_CLOCKPRESCALER_PCLK_DIV4 ADC_CLOCK_SYNC_PCLK_DIV4 +#define ADC_CLOCKPRESCALER_PCLK_DIV6 ADC_CLOCK_SYNC_PCLK_DIV6 +#define ADC_CLOCKPRESCALER_PCLK_DIV8 ADC_CLOCK_SYNC_PCLK_DIV8 +#define ADC_EXTERNALTRIG0_T6_TRGO ADC_EXTERNALTRIGCONV_T6_TRGO +#define ADC_EXTERNALTRIG1_T21_CC2 ADC_EXTERNALTRIGCONV_T21_CC2 +#define ADC_EXTERNALTRIG2_T2_TRGO ADC_EXTERNALTRIGCONV_T2_TRGO +#define ADC_EXTERNALTRIG3_T2_CC4 ADC_EXTERNALTRIGCONV_T2_CC4 +#define ADC_EXTERNALTRIG4_T22_TRGO ADC_EXTERNALTRIGCONV_T22_TRGO +#define ADC_EXTERNALTRIG7_EXT_IT11 ADC_EXTERNALTRIGCONV_EXT_IT11 +#define ADC_CLOCK_ASYNC ADC_CLOCK_ASYNC_DIV1 +#define ADC_EXTERNALTRIG_EDGE_NONE ADC_EXTERNALTRIGCONVEDGE_NONE +#define ADC_EXTERNALTRIG_EDGE_RISING ADC_EXTERNALTRIGCONVEDGE_RISING +#define ADC_EXTERNALTRIG_EDGE_FALLING ADC_EXTERNALTRIGCONVEDGE_FALLING +#define ADC_EXTERNALTRIG_EDGE_RISINGFALLING ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING +#define ADC_SAMPLETIME_2CYCLE_5 ADC_SAMPLETIME_2CYCLES_5 + +#define HAL_ADC_STATE_BUSY_REG HAL_ADC_STATE_REG_BUSY +#define HAL_ADC_STATE_BUSY_INJ HAL_ADC_STATE_INJ_BUSY +#define HAL_ADC_STATE_EOC_REG HAL_ADC_STATE_REG_EOC +#define HAL_ADC_STATE_EOC_INJ HAL_ADC_STATE_INJ_EOC +#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 */ +/** + * @} + */ + +/** @defgroup HAL_CEC_Aliased_Defines HAL CEC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define __HAL_CEC_GET_IT __HAL_CEC_GET_FLAG + +/** + * @} + */ + +/** @defgroup HAL_COMP_Aliased_Defines HAL COMP Aliased Defines maintained for legacy purpose + * @{ + */ +#define COMP_WINDOWMODE_DISABLED COMP_WINDOWMODE_DISABLE +#define COMP_WINDOWMODE_ENABLED COMP_WINDOWMODE_ENABLE +#define COMP_EXTI_LINE_COMP1_EVENT COMP_EXTI_LINE_COMP1 +#define COMP_EXTI_LINE_COMP2_EVENT COMP_EXTI_LINE_COMP2 +#define COMP_EXTI_LINE_COMP3_EVENT COMP_EXTI_LINE_COMP3 +#define COMP_EXTI_LINE_COMP4_EVENT COMP_EXTI_LINE_COMP4 +#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 +#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 +#define COMP_OUTPUT_TIM3OCREFCLR COMP_OUTPUT_COMP1_TIM3OCREFCLR +#endif /* STM32F373xC || STM32F378xx */ + +#if defined(STM32L0) || defined(STM32L4) +#define COMP_WINDOWMODE_ENABLE COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON + +#define COMP_NONINVERTINGINPUT_IO1 COMP_INPUT_PLUS_IO1 +#define COMP_NONINVERTINGINPUT_IO2 COMP_INPUT_PLUS_IO2 +#define COMP_NONINVERTINGINPUT_IO3 COMP_INPUT_PLUS_IO3 +#define COMP_NONINVERTINGINPUT_IO4 COMP_INPUT_PLUS_IO4 +#define COMP_NONINVERTINGINPUT_IO5 COMP_INPUT_PLUS_IO5 +#define COMP_NONINVERTINGINPUT_IO6 COMP_INPUT_PLUS_IO6 + +#define COMP_INVERTINGINPUT_1_4VREFINT COMP_INPUT_MINUS_1_4VREFINT +#define COMP_INVERTINGINPUT_1_2VREFINT COMP_INPUT_MINUS_1_2VREFINT +#define COMP_INVERTINGINPUT_3_4VREFINT COMP_INPUT_MINUS_3_4VREFINT +#define COMP_INVERTINGINPUT_VREFINT COMP_INPUT_MINUS_VREFINT +#define COMP_INVERTINGINPUT_DAC1_CH1 COMP_INPUT_MINUS_DAC1_CH1 +#define COMP_INVERTINGINPUT_DAC1_CH2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_DAC1 COMP_INPUT_MINUS_DAC1_CH1 +#define COMP_INVERTINGINPUT_DAC2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_IO1 COMP_INPUT_MINUS_IO1 +#if defined(STM32L0) +/* Issue fixed on STM32L0 COMP driver: only 2 dedicated IO (IO1 and IO2), */ +/* IO2 was wrongly assigned to IO shared with DAC and IO3 was corresponding */ +/* to the second dedicated IO (only for COMP2). */ +#define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO2 +#else +#define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_IO2 +#define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO3 +#endif +#define COMP_INVERTINGINPUT_IO4 COMP_INPUT_MINUS_IO4 +#define COMP_INVERTINGINPUT_IO5 COMP_INPUT_MINUS_IO5 + +#define COMP_OUTPUTLEVEL_LOW COMP_OUTPUT_LEVEL_LOW +#define COMP_OUTPUTLEVEL_HIGH COMP_OUTPUT_LEVEL_HIGH + +/* Note: Literal "COMP_FLAG_LOCK" kept for legacy purpose. */ +/* To check COMP lock state, use macro "__HAL_COMP_IS_LOCKED()". */ +#if defined(COMP_CSR_LOCK) +#define COMP_FLAG_LOCK COMP_CSR_LOCK +#elif defined(COMP_CSR_COMP1LOCK) +#define COMP_FLAG_LOCK COMP_CSR_COMP1LOCK +#elif defined(COMP_CSR_COMPxLOCK) +#define COMP_FLAG_LOCK COMP_CSR_COMPxLOCK +#endif + +#if defined(STM32L4) +#define COMP_BLANKINGSRCE_TIM1OC5 COMP_BLANKINGSRC_TIM1_OC5_COMP1 +#define COMP_BLANKINGSRCE_TIM2OC3 COMP_BLANKINGSRC_TIM2_OC3_COMP1 +#define COMP_BLANKINGSRCE_TIM3OC3 COMP_BLANKINGSRC_TIM3_OC3_COMP1 +#define COMP_BLANKINGSRCE_TIM3OC4 COMP_BLANKINGSRC_TIM3_OC4_COMP2 +#define COMP_BLANKINGSRCE_TIM8OC5 COMP_BLANKINGSRC_TIM8_OC5_COMP2 +#define COMP_BLANKINGSRCE_TIM15OC1 COMP_BLANKINGSRC_TIM15_OC1_COMP2 +#define COMP_BLANKINGSRCE_NONE COMP_BLANKINGSRC_NONE +#endif + +#if defined(STM32L0) +#define COMP_MODE_HIGHSPEED COMP_POWERMODE_MEDIUMSPEED +#define COMP_MODE_LOWSPEED COMP_POWERMODE_ULTRALOWPOWER +#else +#define COMP_MODE_HIGHSPEED COMP_POWERMODE_HIGHSPEED +#define COMP_MODE_MEDIUMSPEED COMP_POWERMODE_MEDIUMSPEED +#define COMP_MODE_LOWPOWER COMP_POWERMODE_LOWPOWER +#define COMP_MODE_ULTRALOWPOWER COMP_POWERMODE_ULTRALOWPOWER +#endif + +#endif +/** + * @} + */ + +/** @defgroup HAL_CORTEX_Aliased_Defines HAL CORTEX Aliased Defines maintained for legacy purpose + * @{ + */ +#define __HAL_CORTEX_SYSTICKCLK_CONFIG HAL_SYSTICK_CLKSourceConfig +/** + * @} + */ + +/** @defgroup HAL_CRC_Aliased_Defines HAL CRC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define CRC_OUTPUTDATA_INVERSION_DISABLED CRC_OUTPUTDATA_INVERSION_DISABLE +#define CRC_OUTPUTDATA_INVERSION_ENABLED CRC_OUTPUTDATA_INVERSION_ENABLE + +/** + * @} + */ + +/** @defgroup HAL_DAC_Aliased_Defines HAL DAC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define DAC1_CHANNEL_1 DAC_CHANNEL_1 +#define DAC1_CHANNEL_2 DAC_CHANNEL_2 +#define DAC2_CHANNEL_1 DAC_CHANNEL_1 +#define DAC_WAVE_NONE 0x00000000U +#define DAC_WAVE_NOISE DAC_CR_WAVE1_0 +#define DAC_WAVE_TRIANGLE DAC_CR_WAVE1_1 +#define DAC_WAVEGENERATION_NONE DAC_WAVE_NONE +#define DAC_WAVEGENERATION_NOISE DAC_WAVE_NOISE +#define DAC_WAVEGENERATION_TRIANGLE DAC_WAVE_TRIANGLE + +#if defined(STM32G4) || defined(STM32H7) +#define DAC_CHIPCONNECT_DISABLE DAC_CHIPCONNECT_EXTERNAL +#define DAC_CHIPCONNECT_ENABLE DAC_CHIPCONNECT_INTERNAL +#endif + +#if defined(STM32L1) || defined(STM32L4) || defined(STM32G0) || defined(STM32L5) || defined(STM32H7) || defined(STM32F4) || defined(STM32G4) +#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 + +/** + * @} + */ + +/** @defgroup HAL_DMA_Aliased_Defines HAL DMA Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_REMAPDMA_ADC_DMA_CH2 DMA_REMAP_ADC_DMA_CH2 +#define HAL_REMAPDMA_USART1_TX_DMA_CH4 DMA_REMAP_USART1_TX_DMA_CH4 +#define HAL_REMAPDMA_USART1_RX_DMA_CH5 DMA_REMAP_USART1_RX_DMA_CH5 +#define HAL_REMAPDMA_TIM16_DMA_CH4 DMA_REMAP_TIM16_DMA_CH4 +#define HAL_REMAPDMA_TIM17_DMA_CH2 DMA_REMAP_TIM17_DMA_CH2 +#define HAL_REMAPDMA_USART3_DMA_CH32 DMA_REMAP_USART3_DMA_CH32 +#define HAL_REMAPDMA_TIM16_DMA_CH6 DMA_REMAP_TIM16_DMA_CH6 +#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_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 +#define HAL_REMAPDMA_TIM3_DMA_CH6 DMA_REMAP_TIM3_DMA_CH6 + +#define IS_HAL_REMAPDMA IS_DMA_REMAP +#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 + +#if defined(STM32L4R5xx) || defined(STM32L4R9xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) +#define DMA_REQUEST_DCMI_PSSI DMA_REQUEST_DCMI +#endif + +#endif /* STM32L4 */ + +#if defined(STM32G0) +#define DMA_REQUEST_DAC1_CHANNEL1 DMA_REQUEST_DAC1_CH1 +#define DMA_REQUEST_DAC1_CHANNEL2 DMA_REQUEST_DAC1_CH2 +#define DMA_REQUEST_TIM16_TRIG_COM DMA_REQUEST_TIM16_COM +#define DMA_REQUEST_TIM17_TRIG_COM DMA_REQUEST_TIM17_COM + +#define LL_DMAMUX_REQ_TIM16_TRIG_COM LL_DMAMUX_REQ_TIM16_COM +#define LL_DMAMUX_REQ_TIM17_TRIG_COM LL_DMAMUX_REQ_TIM17_COM +#endif + +#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 + +#define DAC_TRIGGER_LP1_OUT DAC_TRIGGER_LPTIM1_OUT +#define DAC_TRIGGER_LP2_OUT DAC_TRIGGER_LPTIM2_OUT + +#endif /* STM32H7 */ + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Defines HAL FLASH Aliased Defines maintained for legacy purpose + * @{ + */ + +#define TYPEPROGRAM_BYTE FLASH_TYPEPROGRAM_BYTE +#define TYPEPROGRAM_HALFWORD FLASH_TYPEPROGRAM_HALFWORD +#define TYPEPROGRAM_WORD FLASH_TYPEPROGRAM_WORD +#define TYPEPROGRAM_DOUBLEWORD FLASH_TYPEPROGRAM_DOUBLEWORD +#define TYPEERASE_SECTORS FLASH_TYPEERASE_SECTORS +#define TYPEERASE_PAGES FLASH_TYPEERASE_PAGES +#define TYPEERASE_PAGEERASE FLASH_TYPEERASE_PAGES +#define TYPEERASE_MASSERASE FLASH_TYPEERASE_MASSERASE +#define WRPSTATE_DISABLE OB_WRPSTATE_DISABLE +#define WRPSTATE_ENABLE OB_WRPSTATE_ENABLE +#define HAL_FLASH_TIMEOUT_VALUE FLASH_TIMEOUT_VALUE +#define OBEX_PCROP OPTIONBYTE_PCROP +#define OBEX_BOOTCONFIG OPTIONBYTE_BOOTCONFIG +#define PCROPSTATE_DISABLE OB_PCROP_STATE_DISABLE +#define PCROPSTATE_ENABLE OB_PCROP_STATE_ENABLE +#define TYPEERASEDATA_BYTE FLASH_TYPEERASEDATA_BYTE +#define TYPEERASEDATA_HALFWORD FLASH_TYPEERASEDATA_HALFWORD +#define TYPEERASEDATA_WORD FLASH_TYPEERASEDATA_WORD +#define TYPEPROGRAMDATA_BYTE FLASH_TYPEPROGRAMDATA_BYTE +#define TYPEPROGRAMDATA_HALFWORD FLASH_TYPEPROGRAMDATA_HALFWORD +#define TYPEPROGRAMDATA_WORD FLASH_TYPEPROGRAMDATA_WORD +#define TYPEPROGRAMDATA_FASTBYTE FLASH_TYPEPROGRAMDATA_FASTBYTE +#define TYPEPROGRAMDATA_FASTHALFWORD FLASH_TYPEPROGRAMDATA_FASTHALFWORD +#define TYPEPROGRAMDATA_FASTWORD FLASH_TYPEPROGRAMDATA_FASTWORD +#define PAGESIZE FLASH_PAGE_SIZE +#define TYPEPROGRAM_FASTBYTE FLASH_TYPEPROGRAM_BYTE +#define TYPEPROGRAM_FASTHALFWORD FLASH_TYPEPROGRAM_HALFWORD +#define TYPEPROGRAM_FASTWORD FLASH_TYPEPROGRAM_WORD +#define VOLTAGE_RANGE_1 FLASH_VOLTAGE_RANGE_1 +#define VOLTAGE_RANGE_2 FLASH_VOLTAGE_RANGE_2 +#define VOLTAGE_RANGE_3 FLASH_VOLTAGE_RANGE_3 +#define VOLTAGE_RANGE_4 FLASH_VOLTAGE_RANGE_4 +#define TYPEPROGRAM_FAST FLASH_TYPEPROGRAM_FAST +#define TYPEPROGRAM_FAST_AND_LAST FLASH_TYPEPROGRAM_FAST_AND_LAST +#define WRPAREA_BANK1_AREAA OB_WRPAREA_BANK1_AREAA +#define WRPAREA_BANK1_AREAB OB_WRPAREA_BANK1_AREAB +#define WRPAREA_BANK2_AREAA OB_WRPAREA_BANK2_AREAA +#define WRPAREA_BANK2_AREAB OB_WRPAREA_BANK2_AREAB +#define IWDG_STDBY_FREEZE OB_IWDG_STDBY_FREEZE +#define IWDG_STDBY_ACTIVE OB_IWDG_STDBY_RUN +#define IWDG_STOP_FREEZE OB_IWDG_STOP_FREEZE +#define IWDG_STOP_ACTIVE OB_IWDG_STOP_RUN +#define FLASH_ERROR_NONE HAL_FLASH_ERROR_NONE +#define FLASH_ERROR_RD HAL_FLASH_ERROR_RD +#define FLASH_ERROR_PG HAL_FLASH_ERROR_PROG +#define FLASH_ERROR_PGP HAL_FLASH_ERROR_PGS +#define FLASH_ERROR_WRP HAL_FLASH_ERROR_WRP +#define FLASH_ERROR_OPTV HAL_FLASH_ERROR_OPTV +#define FLASH_ERROR_OPTVUSR HAL_FLASH_ERROR_OPTVUSR +#define FLASH_ERROR_PROG HAL_FLASH_ERROR_PROG +#define FLASH_ERROR_OP HAL_FLASH_ERROR_OPERATION +#define FLASH_ERROR_PGA HAL_FLASH_ERROR_PGA +#define FLASH_ERROR_SIZE HAL_FLASH_ERROR_SIZE +#define FLASH_ERROR_SIZ HAL_FLASH_ERROR_SIZE +#define FLASH_ERROR_PGS HAL_FLASH_ERROR_PGS +#define FLASH_ERROR_MIS HAL_FLASH_ERROR_MIS +#define FLASH_ERROR_FAST HAL_FLASH_ERROR_FAST +#define FLASH_ERROR_FWWERR HAL_FLASH_ERROR_FWWERR +#define FLASH_ERROR_NOTZERO HAL_FLASH_ERROR_NOTZERO +#define FLASH_ERROR_OPERATION HAL_FLASH_ERROR_OPERATION +#define FLASH_ERROR_ERS HAL_FLASH_ERROR_ERS +#define OB_WDG_SW OB_IWDG_SW +#define OB_WDG_HW OB_IWDG_HW +#define OB_SDADC12_VDD_MONITOR_SET OB_SDACD_VDD_MONITOR_SET +#define OB_SDADC12_VDD_MONITOR_RESET OB_SDACD_VDD_MONITOR_RESET +#define OB_RAM_PARITY_CHECK_SET OB_SRAM_PARITY_SET +#define OB_RAM_PARITY_CHECK_RESET OB_SRAM_PARITY_RESET +#define IS_OB_SDADC12_VDD_MONITOR IS_OB_SDACD_VDD_MONITOR +#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 +#define FLASH_FLAG_WDW FLASH_FLAG_WBNE +#define OB_WRP_SECTOR_All OB_WRP_SECTOR_ALL +#endif /* STM32H7 */ + +/** + * @} + */ + +/** @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 */ + +/** + * @} + */ + +/** @defgroup HAL_SYSCFG_Aliased_Defines HAL SYSCFG Aliased Defines maintained for legacy purpose + * @{ + */ + +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA9 I2C_FASTMODEPLUS_PA9 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA10 I2C_FASTMODEPLUS_PA10 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB6 I2C_FASTMODEPLUS_PB6 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB7 I2C_FASTMODEPLUS_PB7 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB8 I2C_FASTMODEPLUS_PB8 +#define HAL_SYSCFG_FASTMODEPLUS_I2C_PB9 I2C_FASTMODEPLUS_PB9 +#define HAL_SYSCFG_FASTMODEPLUS_I2C1 I2C_FASTMODEPLUS_I2C1 +#define HAL_SYSCFG_FASTMODEPLUS_I2C2 I2C_FASTMODEPLUS_I2C2 +#define HAL_SYSCFG_FASTMODEPLUS_I2C3 I2C_FASTMODEPLUS_I2C3 +#if defined(STM32G4) + +#define HAL_SYSCFG_EnableIOAnalogSwitchBooster HAL_SYSCFG_EnableIOSwitchBooster +#define HAL_SYSCFG_DisableIOAnalogSwitchBooster HAL_SYSCFG_DisableIOSwitchBooster +#define HAL_SYSCFG_EnableIOAnalogSwitchVDD HAL_SYSCFG_EnableIOSwitchVDD +#define HAL_SYSCFG_DisableIOAnalogSwitchVDD HAL_SYSCFG_DisableIOSwitchVDD +#endif /* STM32G4 */ +/** + * @} + */ + + +/** @defgroup LL_FMC_Aliased_Defines LL FMC Aliased Defines maintained for compatibility purpose + * @{ + */ +#if defined(STM32L4) || defined(STM32F7) || defined(STM32H7) || defined(STM32G4) +#define FMC_NAND_PCC_WAIT_FEATURE_DISABLE FMC_NAND_WAIT_FEATURE_DISABLE +#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 +#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 +#define FMC_NAND_MEM_BUS_WIDTH_16 FMC_NAND_PCC_MEM_BUS_WIDTH_16 +#endif +/** + * @} + */ + +/** @defgroup LL_FSMC_Aliased_Defines LL FSMC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define FSMC_NORSRAM_TYPEDEF FSMC_NORSRAM_TypeDef +#define FSMC_NORSRAM_EXTENDED_TYPEDEF FSMC_NORSRAM_EXTENDED_TypeDef +/** + * @} + */ + +/** @defgroup HAL_GPIO_Aliased_Macros HAL GPIO Aliased Macros maintained for legacy purpose + * @{ + */ +#define GET_GPIO_SOURCE GPIO_GET_INDEX +#define GET_GPIO_INDEX GPIO_GET_INDEX + +#if defined(STM32F4) +#define GPIO_AF12_SDMMC GPIO_AF12_SDIO +#define GPIO_AF12_SDMMC1 GPIO_AF12_SDIO +#endif + +#if defined(STM32F7) +#define GPIO_AF12_SDIO GPIO_AF12_SDMMC1 +#define GPIO_AF12_SDMMC GPIO_AF12_SDMMC1 +#endif + +#if defined(STM32L4) +#define GPIO_AF12_SDIO GPIO_AF12_SDMMC1 +#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 + +#if defined (STM32H743xx) || defined (STM32H753xx) || defined (STM32H750xx) || defined (STM32H742xx) || \ + defined (STM32H745xx) || defined (STM32H755xx) || defined (STM32H747xx) || defined (STM32H757xx) +#define GPIO_AF10_OTG2_HS GPIO_AF10_OTG2_FS +#define GPIO_AF10_OTG1_FS GPIO_AF10_OTG1_HS +#define GPIO_AF12_OTG2_FS GPIO_AF12_OTG1_FS +#endif /*STM32H743xx || STM32H753xx || STM32H750xx || STM32H742xx || STM32H745xx || STM32H755xx || STM32H747xx || STM32H757xx */ +#endif /* STM32H7 */ + +#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) || defined(STM32G4) || 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 || STM32G4 || STM32H7*/ + +#if defined(STM32L1) + #define GPIO_SPEED_VERY_LOW GPIO_SPEED_FREQ_LOW + #define GPIO_SPEED_LOW GPIO_SPEED_FREQ_MEDIUM + #define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_HIGH + #define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_VERY_HIGH +#endif /* STM32L1 */ + +#if defined(STM32F0) || defined(STM32F3) || defined(STM32F1) + #define GPIO_SPEED_LOW GPIO_SPEED_FREQ_LOW + #define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_MEDIUM + #define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_HIGH +#endif /* STM32F0 || STM32F3 || STM32F1 */ + +#define GPIO_AF6_DFSDM GPIO_AF6_DFSDM1 +/** + * @} + */ + +/** @defgroup HAL_HRTIM_Aliased_Macros HAL HRTIM Aliased Macros maintained for legacy purpose + * @{ + */ +#define HRTIM_TIMDELAYEDPROTECTION_DISABLED HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DISABLED +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT1_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT1_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV68 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV6 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT1_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT1_DEEV7 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_DEEV7 +#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV7 +#define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7 + +#define __HAL_HRTIM_SetCounter __HAL_HRTIM_SETCOUNTER +#define __HAL_HRTIM_GetCounter __HAL_HRTIM_GETCOUNTER +#define __HAL_HRTIM_SetPeriod __HAL_HRTIM_SETPERIOD +#define __HAL_HRTIM_GetPeriod __HAL_HRTIM_GETPERIOD +#define __HAL_HRTIM_SetClockPrescaler __HAL_HRTIM_SETCLOCKPRESCALER +#define __HAL_HRTIM_GetClockPrescaler __HAL_HRTIM_GETCLOCKPRESCALER +#define __HAL_HRTIM_SetCompare __HAL_HRTIM_SETCOMPARE +#define __HAL_HRTIM_GetCompare __HAL_HRTIM_GETCOMPARE + +#if defined(STM32G4) +#define HAL_HRTIM_ExternalEventCounterConfig HAL_HRTIM_ExtEventCounterConfig +#define HAL_HRTIM_ExternalEventCounterEnable HAL_HRTIM_ExtEventCounterEnable +#define HAL_HRTIM_ExternalEventCounterDisable HAL_HRTIM_ExtEventCounterDisable +#define HAL_HRTIM_ExternalEventCounterReset HAL_HRTIM_ExtEventCounterReset +#define HRTIM_TIMEEVENT_A HRTIM_EVENTCOUNTER_A +#define HRTIM_TIMEEVENT_B HRTIM_EVENTCOUNTER_B +#define HRTIM_TIMEEVENTRESETMODE_UNCONDITIONAL HRTIM_EVENTCOUNTER_RSTMODE_UNCONDITIONAL +#define HRTIM_TIMEEVENTRESETMODE_CONDITIONAL HRTIM_EVENTCOUNTER_RSTMODE_CONDITIONAL +#endif /* STM32G4 */ + +#if defined(STM32H7) +#define HRTIM_OUTPUTSET_TIMAEV1_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMAEV2_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMAEV3_TIMCCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMAEV4_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMAEV5_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMAEV6_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMAEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMAEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMAEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMBEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMBEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMBEV3_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMBEV4_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMBEV5_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMBEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMBEV7_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMBEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMBEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMCEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMCEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMCEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMCEV4_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMCEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMCEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMCEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMCEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMCEV9_TIMFCMP2 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMDEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMDEV2_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMDEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMDEV4_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMDEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMDEV6_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMDEV7_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMDEV8_TIMFCMP1 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMDEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMEEV1_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMEEV2_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMEEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMEEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMEEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMEEV6_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMEEV7_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMEEV8_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMEEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTSET_TIMFEV1_TIMACMP3 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTSET_TIMFEV2_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTSET_TIMFEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTSET_TIMFEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTSET_TIMFEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTSET_TIMFEV6_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTSET_TIMFEV7_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTSET_TIMFEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTSET_TIMFEV9_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_9 + +#define HRTIM_OUTPUTRESET_TIMAEV1_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMAEV2_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMAEV3_TIMCCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMAEV4_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMAEV5_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMAEV6_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMAEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMAEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMAEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMBEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMBEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMBEV3_TIMCCMP3 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMBEV4_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMBEV5_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMBEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMBEV7_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMBEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMBEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMCEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMCEV2_TIMACMP2 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMCEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMCEV4_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMCEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMCEV6_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMCEV7_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMCEV8_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMCEV9_TIMFCMP2 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMDEV1_TIMACMP1 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMDEV2_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMDEV3_TIMBCMP2 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMDEV4_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMDEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMDEV6_TIMECMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMDEV7_TIMECMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMDEV8_TIMFCMP1 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMDEV9_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMEEV1_TIMACMP4 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMEEV2_TIMBCMP3 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMEEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMEEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMEEV5_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMEEV6_TIMDCMP1 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMEEV7_TIMDCMP2 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMEEV8_TIMFCMP3 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMEEV9_TIMFCMP4 HRTIM_OUTPUTSET_TIMEV_9 +#define HRTIM_OUTPUTRESET_TIMFEV1_TIMACMP3 HRTIM_OUTPUTSET_TIMEV_1 +#define HRTIM_OUTPUTRESET_TIMFEV2_TIMBCMP1 HRTIM_OUTPUTSET_TIMEV_2 +#define HRTIM_OUTPUTRESET_TIMFEV3_TIMBCMP4 HRTIM_OUTPUTSET_TIMEV_3 +#define HRTIM_OUTPUTRESET_TIMFEV4_TIMCCMP1 HRTIM_OUTPUTSET_TIMEV_4 +#define HRTIM_OUTPUTRESET_TIMFEV5_TIMCCMP4 HRTIM_OUTPUTSET_TIMEV_5 +#define HRTIM_OUTPUTRESET_TIMFEV6_TIMDCMP3 HRTIM_OUTPUTSET_TIMEV_6 +#define HRTIM_OUTPUTRESET_TIMFEV7_TIMDCMP4 HRTIM_OUTPUTSET_TIMEV_7 +#define HRTIM_OUTPUTRESET_TIMFEV8_TIMECMP2 HRTIM_OUTPUTSET_TIMEV_8 +#define HRTIM_OUTPUTRESET_TIMFEV9_TIMECMP3 HRTIM_OUTPUTSET_TIMEV_9 +#endif /* STM32H7 */ + +#if defined(STM32F3) +/** @brief Constants defining available sources associated to external events. + */ +#define HRTIM_EVENTSRC_1 (0x00000000U) +#define HRTIM_EVENTSRC_2 (HRTIM_EECR1_EE1SRC_0) +#define HRTIM_EVENTSRC_3 (HRTIM_EECR1_EE1SRC_1) +#define HRTIM_EVENTSRC_4 (HRTIM_EECR1_EE1SRC_1 | HRTIM_EECR1_EE1SRC_0) + +/** @brief Constants defining the events that can be selected to configure the + * set/reset crossbar of a timer output + */ +#define HRTIM_OUTPUTSET_TIMEV_1 (HRTIM_SET1R_TIMEVNT1) +#define HRTIM_OUTPUTSET_TIMEV_2 (HRTIM_SET1R_TIMEVNT2) +#define HRTIM_OUTPUTSET_TIMEV_3 (HRTIM_SET1R_TIMEVNT3) +#define HRTIM_OUTPUTSET_TIMEV_4 (HRTIM_SET1R_TIMEVNT4) +#define HRTIM_OUTPUTSET_TIMEV_5 (HRTIM_SET1R_TIMEVNT5) +#define HRTIM_OUTPUTSET_TIMEV_6 (HRTIM_SET1R_TIMEVNT6) +#define HRTIM_OUTPUTSET_TIMEV_7 (HRTIM_SET1R_TIMEVNT7) +#define HRTIM_OUTPUTSET_TIMEV_8 (HRTIM_SET1R_TIMEVNT8) +#define HRTIM_OUTPUTSET_TIMEV_9 (HRTIM_SET1R_TIMEVNT9) + +#define HRTIM_OUTPUTRESET_TIMEV_1 (HRTIM_RST1R_TIMEVNT1) +#define HRTIM_OUTPUTRESET_TIMEV_2 (HRTIM_RST1R_TIMEVNT2) +#define HRTIM_OUTPUTRESET_TIMEV_3 (HRTIM_RST1R_TIMEVNT3) +#define HRTIM_OUTPUTRESET_TIMEV_4 (HRTIM_RST1R_TIMEVNT4) +#define HRTIM_OUTPUTRESET_TIMEV_5 (HRTIM_RST1R_TIMEVNT5) +#define HRTIM_OUTPUTRESET_TIMEV_6 (HRTIM_RST1R_TIMEVNT6) +#define HRTIM_OUTPUTRESET_TIMEV_7 (HRTIM_RST1R_TIMEVNT7) +#define HRTIM_OUTPUTRESET_TIMEV_8 (HRTIM_RST1R_TIMEVNT8) +#define HRTIM_OUTPUTRESET_TIMEV_9 (HRTIM_RST1R_TIMEVNT9) + +/** @brief Constants defining the event filtering applied to external events + * by a timer + */ +#define HRTIM_TIMEVENTFILTER_NONE (0x00000000U) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP1 (HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP2 (HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP3 (HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGCMP4 (HRTIM_EEFR1_EE1FLTR_2) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR1 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR2 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR3 (HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR4 (HRTIM_EEFR1_EE1FLTR_3) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR5 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR6 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR7 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_BLANKINGFLTR8 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2) +#define HRTIM_TIMEVENTFILTER_WINDOWINGCMP2 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_0) +#define HRTIM_TIMEVENTFILTER_WINDOWINGCMP3 (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1) +#define HRTIM_TIMEVENTFILTER_WINDOWINGTIM (HRTIM_EEFR1_EE1FLTR_3 | HRTIM_EEFR1_EE1FLTR_2 | HRTIM_EEFR1_EE1FLTR_1 | HRTIM_EEFR1_EE1FLTR_0) + +/** @brief Constants defining the DLL calibration periods (in micro seconds) + */ +#define HRTIM_CALIBRATIONRATE_7300 0x00000000U +#define HRTIM_CALIBRATIONRATE_910 (HRTIM_DLLCR_CALRTE_0) +#define HRTIM_CALIBRATIONRATE_114 (HRTIM_DLLCR_CALRTE_1) +#define HRTIM_CALIBRATIONRATE_14 (HRTIM_DLLCR_CALRTE_1 | HRTIM_DLLCR_CALRTE_0) + +#endif /* STM32F3 */ +/** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Defines HAL I2C Aliased Defines maintained for legacy purpose + * @{ + */ +#define I2C_DUALADDRESS_DISABLED I2C_DUALADDRESS_DISABLE +#define I2C_DUALADDRESS_ENABLED I2C_DUALADDRESS_ENABLE +#define I2C_GENERALCALL_DISABLED I2C_GENERALCALL_DISABLE +#define I2C_GENERALCALL_ENABLED I2C_GENERALCALL_ENABLE +#define I2C_NOSTRETCH_DISABLED I2C_NOSTRETCH_DISABLE +#define I2C_NOSTRETCH_ENABLED I2C_NOSTRETCH_ENABLE +#define I2C_ANALOGFILTER_ENABLED I2C_ANALOGFILTER_ENABLE +#define I2C_ANALOGFILTER_DISABLED I2C_ANALOGFILTER_DISABLE +#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32G0) || defined(STM32L4) || defined(STM32L1) || defined(STM32F7) +#define HAL_I2C_STATE_MEM_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_MEM_BUSY_RX HAL_I2C_STATE_BUSY_RX +#define HAL_I2C_STATE_MASTER_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_MASTER_BUSY_RX HAL_I2C_STATE_BUSY_RX +#define HAL_I2C_STATE_SLAVE_BUSY_TX HAL_I2C_STATE_BUSY_TX +#define HAL_I2C_STATE_SLAVE_BUSY_RX HAL_I2C_STATE_BUSY_RX +#endif +/** + * @} + */ + +/** @defgroup HAL_IRDA_Aliased_Defines HAL IRDA Aliased Defines maintained for legacy purpose + * @{ + */ +#define IRDA_ONE_BIT_SAMPLE_DISABLED IRDA_ONE_BIT_SAMPLE_DISABLE +#define IRDA_ONE_BIT_SAMPLE_ENABLED IRDA_ONE_BIT_SAMPLE_ENABLE + +/** + * @} + */ + +/** @defgroup HAL_IWDG_Aliased_Defines HAL IWDG Aliased Defines maintained for legacy purpose + * @{ + */ +#define KR_KEY_RELOAD IWDG_KEY_RELOAD +#define KR_KEY_ENABLE IWDG_KEY_ENABLE +#define KR_KEY_EWA IWDG_KEY_WRITE_ACCESS_ENABLE +#define KR_KEY_DWA IWDG_KEY_WRITE_ACCESS_DISABLE +/** + * @} + */ + +/** @defgroup HAL_LPTIM_Aliased_Defines HAL LPTIM Aliased Defines maintained for legacy purpose + * @{ + */ + +#define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSISTION LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION +#define LPTIM_CLOCKSAMPLETIME_2TRANSISTIONS LPTIM_CLOCKSAMPLETIME_2TRANSITIONS +#define LPTIM_CLOCKSAMPLETIME_4TRANSISTIONS LPTIM_CLOCKSAMPLETIME_4TRANSITIONS +#define LPTIM_CLOCKSAMPLETIME_8TRANSISTIONS LPTIM_CLOCKSAMPLETIME_8TRANSITIONS + +#define LPTIM_CLOCKPOLARITY_RISINGEDGE LPTIM_CLOCKPOLARITY_RISING +#define LPTIM_CLOCKPOLARITY_FALLINGEDGE LPTIM_CLOCKPOLARITY_FALLING +#define LPTIM_CLOCKPOLARITY_BOTHEDGES LPTIM_CLOCKPOLARITY_RISING_FALLING + +#define LPTIM_TRIGSAMPLETIME_DIRECTTRANSISTION LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION +#define LPTIM_TRIGSAMPLETIME_2TRANSISTIONS LPTIM_TRIGSAMPLETIME_2TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_4TRANSISTIONS LPTIM_TRIGSAMPLETIME_4TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_8TRANSISTIONS LPTIM_TRIGSAMPLETIME_8TRANSITIONS + +/* The following 3 definition have also been present in a temporary version of lptim.h */ +/* They need to be renamed also to the right name, just in case */ +#define LPTIM_TRIGSAMPLETIME_2TRANSITION LPTIM_TRIGSAMPLETIME_2TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_4TRANSITION LPTIM_TRIGSAMPLETIME_4TRANSITIONS +#define LPTIM_TRIGSAMPLETIME_8TRANSITION LPTIM_TRIGSAMPLETIME_8TRANSITIONS + +/** + * @} + */ + +/** @defgroup HAL_NAND_Aliased_Defines HAL NAND Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_NAND_Read_Page HAL_NAND_Read_Page_8b +#define HAL_NAND_Write_Page HAL_NAND_Write_Page_8b +#define HAL_NAND_Read_SpareArea HAL_NAND_Read_SpareArea_8b +#define HAL_NAND_Write_SpareArea HAL_NAND_Write_SpareArea_8b + +#define NAND_AddressTypedef NAND_AddressTypeDef + +#define __ARRAY_ADDRESS ARRAY_ADDRESS +#define __ADDR_1st_CYCLE ADDR_1ST_CYCLE +#define __ADDR_2nd_CYCLE ADDR_2ND_CYCLE +#define __ADDR_3rd_CYCLE ADDR_3RD_CYCLE +#define __ADDR_4th_CYCLE ADDR_4TH_CYCLE +/** + * @} + */ + +/** @defgroup HAL_NOR_Aliased_Defines HAL NOR Aliased Defines maintained for legacy purpose + * @{ + */ +#define NOR_StatusTypedef HAL_NOR_StatusTypeDef +#define NOR_SUCCESS HAL_NOR_STATUS_SUCCESS +#define NOR_ONGOING HAL_NOR_STATUS_ONGOING +#define NOR_ERROR HAL_NOR_STATUS_ERROR +#define NOR_TIMEOUT HAL_NOR_STATUS_TIMEOUT + +#define __NOR_WRITE NOR_WRITE +#define __NOR_ADDR_SHIFT NOR_ADDR_SHIFT +/** + * @} + */ + +/** @defgroup HAL_OPAMP_Aliased_Defines HAL OPAMP Aliased Defines maintained for legacy purpose + * @{ + */ + +#define OPAMP_NONINVERTINGINPUT_VP0 OPAMP_NONINVERTINGINPUT_IO0 +#define OPAMP_NONINVERTINGINPUT_VP1 OPAMP_NONINVERTINGINPUT_IO1 +#define OPAMP_NONINVERTINGINPUT_VP2 OPAMP_NONINVERTINGINPUT_IO2 +#define OPAMP_NONINVERTINGINPUT_VP3 OPAMP_NONINVERTINGINPUT_IO3 + +#define OPAMP_SEC_NONINVERTINGINPUT_VP0 OPAMP_SEC_NONINVERTINGINPUT_IO0 +#define OPAMP_SEC_NONINVERTINGINPUT_VP1 OPAMP_SEC_NONINVERTINGINPUT_IO1 +#define OPAMP_SEC_NONINVERTINGINPUT_VP2 OPAMP_SEC_NONINVERTINGINPUT_IO2 +#define OPAMP_SEC_NONINVERTINGINPUT_VP3 OPAMP_SEC_NONINVERTINGINPUT_IO3 + +#define OPAMP_INVERTINGINPUT_VM0 OPAMP_INVERTINGINPUT_IO0 +#define OPAMP_INVERTINGINPUT_VM1 OPAMP_INVERTINGINPUT_IO1 + +#define IOPAMP_INVERTINGINPUT_VM0 OPAMP_INVERTINGINPUT_IO0 +#define IOPAMP_INVERTINGINPUT_VM1 OPAMP_INVERTINGINPUT_IO1 + +#define OPAMP_SEC_INVERTINGINPUT_VM0 OPAMP_SEC_INVERTINGINPUT_IO0 +#define OPAMP_SEC_INVERTINGINPUT_VM1 OPAMP_SEC_INVERTINGINPUT_IO1 + +#define OPAMP_INVERTINGINPUT_VINM OPAMP_SEC_INVERTINGINPUT_IO1 + +#define OPAMP_PGACONNECT_NO OPAMP_PGA_CONNECT_INVERTINGINPUT_NO +#define OPAMP_PGACONNECT_VM0 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 +#define OPAMP_PGACONNECT_VM1 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO1 + +#if defined(STM32L1) || defined(STM32L4) || defined(STM32L5) || defined(STM32H7) || defined(STM32G4) +#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 + + +/** + * @} + */ + +/** @defgroup HAL_I2S_Aliased_Defines HAL I2S Aliased Defines maintained for legacy purpose + * @{ + */ +#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 +/** + * @} + */ + +/** @defgroup HAL_PCCARD_Aliased_Defines HAL PCCARD Aliased Defines maintained for legacy purpose + * @{ + */ + +/* Compact Flash-ATA registers description */ +#define CF_DATA ATA_DATA +#define CF_SECTOR_COUNT ATA_SECTOR_COUNT +#define CF_SECTOR_NUMBER ATA_SECTOR_NUMBER +#define CF_CYLINDER_LOW ATA_CYLINDER_LOW +#define CF_CYLINDER_HIGH ATA_CYLINDER_HIGH +#define CF_CARD_HEAD ATA_CARD_HEAD +#define CF_STATUS_CMD ATA_STATUS_CMD +#define CF_STATUS_CMD_ALTERNATE ATA_STATUS_CMD_ALTERNATE +#define CF_COMMON_DATA_AREA ATA_COMMON_DATA_AREA + +/* Compact Flash-ATA commands */ +#define CF_READ_SECTOR_CMD ATA_READ_SECTOR_CMD +#define CF_WRITE_SECTOR_CMD ATA_WRITE_SECTOR_CMD +#define CF_ERASE_SECTOR_CMD ATA_ERASE_SECTOR_CMD +#define CF_IDENTIFY_CMD ATA_IDENTIFY_CMD + +#define PCCARD_StatusTypedef HAL_PCCARD_StatusTypeDef +#define PCCARD_SUCCESS HAL_PCCARD_STATUS_SUCCESS +#define PCCARD_ONGOING HAL_PCCARD_STATUS_ONGOING +#define PCCARD_ERROR HAL_PCCARD_STATUS_ERROR +#define PCCARD_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT +/** + * @} + */ + +/** @defgroup HAL_RTC_Aliased_Defines HAL RTC Aliased Defines maintained for legacy purpose + * @{ + */ + +#define FORMAT_BIN RTC_FORMAT_BIN +#define FORMAT_BCD RTC_FORMAT_BCD + +#define RTC_ALARMSUBSECONDMASK_None RTC_ALARMSUBSECONDMASK_NONE +#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 + +#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_TAMPER1_2_INTERRUPT RTC_ALL_TAMPER_INTERRUPT +#define RTC_TAMPER1_2_3_INTERRUPT RTC_ALL_TAMPER_INTERRUPT + +#define RTC_TIMESTAMPPIN_PC13 RTC_TIMESTAMPPIN_DEFAULT +#define RTC_TIMESTAMPPIN_PA0 RTC_TIMESTAMPPIN_POS1 +#define RTC_TIMESTAMPPIN_PI8 RTC_TIMESTAMPPIN_POS1 +#define RTC_TIMESTAMPPIN_PC1 RTC_TIMESTAMPPIN_POS2 + +#define RTC_OUTPUT_REMAP_PC13 RTC_OUTPUT_REMAP_NONE +#define RTC_OUTPUT_REMAP_PB14 RTC_OUTPUT_REMAP_POS1 +#define RTC_OUTPUT_REMAP_PB2 RTC_OUTPUT_REMAP_POS1 + +#define RTC_TAMPERPIN_PC13 RTC_TAMPERPIN_DEFAULT +#define RTC_TAMPERPIN_PA0 RTC_TAMPERPIN_POS1 +#define RTC_TAMPERPIN_PI8 RTC_TAMPERPIN_POS1 + +#if defined(STM32H7) +#define RTC_TAMPCR_TAMPXE RTC_TAMPER_X +#define RTC_TAMPCR_TAMPXIE RTC_TAMPER_X_INTERRUPT + +#define RTC_TAMPER1_INTERRUPT RTC_IT_TAMP1 +#define RTC_TAMPER2_INTERRUPT RTC_IT_TAMP2 +#define RTC_TAMPER3_INTERRUPT RTC_IT_TAMP3 +#define RTC_ALL_TAMPER_INTERRUPT RTC_IT_TAMPALL +#endif /* STM32H7 */ + +/** + * @} + */ + + +/** @defgroup HAL_SMARTCARD_Aliased_Defines HAL SMARTCARD Aliased Defines maintained for legacy purpose + * @{ + */ +#define SMARTCARD_NACK_ENABLED SMARTCARD_NACK_ENABLE +#define SMARTCARD_NACK_DISABLED SMARTCARD_NACK_DISABLE + +#define SMARTCARD_ONEBIT_SAMPLING_DISABLED SMARTCARD_ONE_BIT_SAMPLE_DISABLE +#define SMARTCARD_ONEBIT_SAMPLING_ENABLED SMARTCARD_ONE_BIT_SAMPLE_ENABLE +#define SMARTCARD_ONEBIT_SAMPLING_DISABLE SMARTCARD_ONE_BIT_SAMPLE_DISABLE +#define SMARTCARD_ONEBIT_SAMPLING_ENABLE SMARTCARD_ONE_BIT_SAMPLE_ENABLE + +#define SMARTCARD_TIMEOUT_DISABLED SMARTCARD_TIMEOUT_DISABLE +#define SMARTCARD_TIMEOUT_ENABLED SMARTCARD_TIMEOUT_ENABLE + +#define SMARTCARD_LASTBIT_DISABLED SMARTCARD_LASTBIT_DISABLE +#define SMARTCARD_LASTBIT_ENABLED SMARTCARD_LASTBIT_ENABLE +/** + * @} + */ + + +/** @defgroup HAL_SMBUS_Aliased_Defines HAL SMBUS Aliased Defines maintained for legacy purpose + * @{ + */ +#define SMBUS_DUALADDRESS_DISABLED SMBUS_DUALADDRESS_DISABLE +#define SMBUS_DUALADDRESS_ENABLED SMBUS_DUALADDRESS_ENABLE +#define SMBUS_GENERALCALL_DISABLED SMBUS_GENERALCALL_DISABLE +#define SMBUS_GENERALCALL_ENABLED SMBUS_GENERALCALL_ENABLE +#define SMBUS_NOSTRETCH_DISABLED SMBUS_NOSTRETCH_DISABLE +#define SMBUS_NOSTRETCH_ENABLED SMBUS_NOSTRETCH_ENABLE +#define SMBUS_ANALOGFILTER_ENABLED SMBUS_ANALOGFILTER_ENABLE +#define SMBUS_ANALOGFILTER_DISABLED SMBUS_ANALOGFILTER_DISABLE +#define SMBUS_PEC_DISABLED SMBUS_PEC_DISABLE +#define SMBUS_PEC_ENABLED SMBUS_PEC_ENABLE +#define HAL_SMBUS_STATE_SLAVE_LISTEN HAL_SMBUS_STATE_LISTEN +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Defines HAL SPI Aliased Defines maintained for legacy purpose + * @{ + */ +#define SPI_TIMODE_DISABLED SPI_TIMODE_DISABLE +#define SPI_TIMODE_ENABLED SPI_TIMODE_ENABLE + +#define SPI_CRCCALCULATION_DISABLED SPI_CRCCALCULATION_DISABLE +#define SPI_CRCCALCULATION_ENABLED SPI_CRCCALCULATION_ENABLE + +#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 */ + +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Defines HAL TIM Aliased Defines maintained for legacy purpose + * @{ + */ +#define CCER_CCxE_MASK TIM_CCER_CCxE_MASK +#define CCER_CCxNE_MASK TIM_CCER_CCxNE_MASK + +#define TIM_DMABase_CR1 TIM_DMABASE_CR1 +#define TIM_DMABase_CR2 TIM_DMABASE_CR2 +#define TIM_DMABase_SMCR TIM_DMABASE_SMCR +#define TIM_DMABase_DIER TIM_DMABASE_DIER +#define TIM_DMABase_SR TIM_DMABASE_SR +#define TIM_DMABase_EGR TIM_DMABASE_EGR +#define TIM_DMABase_CCMR1 TIM_DMABASE_CCMR1 +#define TIM_DMABase_CCMR2 TIM_DMABASE_CCMR2 +#define TIM_DMABase_CCER TIM_DMABASE_CCER +#define TIM_DMABase_CNT TIM_DMABASE_CNT +#define TIM_DMABase_PSC TIM_DMABASE_PSC +#define TIM_DMABase_ARR TIM_DMABASE_ARR +#define TIM_DMABase_RCR TIM_DMABASE_RCR +#define TIM_DMABase_CCR1 TIM_DMABASE_CCR1 +#define TIM_DMABase_CCR2 TIM_DMABASE_CCR2 +#define TIM_DMABase_CCR3 TIM_DMABASE_CCR3 +#define TIM_DMABase_CCR4 TIM_DMABASE_CCR4 +#define TIM_DMABase_BDTR TIM_DMABASE_BDTR +#define TIM_DMABase_DCR TIM_DMABASE_DCR +#define TIM_DMABase_DMAR TIM_DMABASE_DMAR +#define TIM_DMABase_OR1 TIM_DMABASE_OR1 +#define TIM_DMABase_CCMR3 TIM_DMABASE_CCMR3 +#define TIM_DMABase_CCR5 TIM_DMABASE_CCR5 +#define TIM_DMABase_CCR6 TIM_DMABASE_CCR6 +#define TIM_DMABase_OR2 TIM_DMABASE_OR2 +#define TIM_DMABase_OR3 TIM_DMABASE_OR3 +#define TIM_DMABase_OR TIM_DMABASE_OR + +#define TIM_EventSource_Update TIM_EVENTSOURCE_UPDATE +#define TIM_EventSource_CC1 TIM_EVENTSOURCE_CC1 +#define TIM_EventSource_CC2 TIM_EVENTSOURCE_CC2 +#define TIM_EventSource_CC3 TIM_EVENTSOURCE_CC3 +#define TIM_EventSource_CC4 TIM_EVENTSOURCE_CC4 +#define TIM_EventSource_COM TIM_EVENTSOURCE_COM +#define TIM_EventSource_Trigger TIM_EVENTSOURCE_TRIGGER +#define TIM_EventSource_Break TIM_EVENTSOURCE_BREAK +#define TIM_EventSource_Break2 TIM_EVENTSOURCE_BREAK2 + +#define TIM_DMABurstLength_1Transfer TIM_DMABURSTLENGTH_1TRANSFER +#define TIM_DMABurstLength_2Transfers TIM_DMABURSTLENGTH_2TRANSFERS +#define TIM_DMABurstLength_3Transfers TIM_DMABURSTLENGTH_3TRANSFERS +#define TIM_DMABurstLength_4Transfers TIM_DMABURSTLENGTH_4TRANSFERS +#define TIM_DMABurstLength_5Transfers TIM_DMABURSTLENGTH_5TRANSFERS +#define TIM_DMABurstLength_6Transfers TIM_DMABURSTLENGTH_6TRANSFERS +#define TIM_DMABurstLength_7Transfers TIM_DMABURSTLENGTH_7TRANSFERS +#define TIM_DMABurstLength_8Transfers TIM_DMABURSTLENGTH_8TRANSFERS +#define TIM_DMABurstLength_9Transfers TIM_DMABURSTLENGTH_9TRANSFERS +#define TIM_DMABurstLength_10Transfers TIM_DMABURSTLENGTH_10TRANSFERS +#define TIM_DMABurstLength_11Transfers TIM_DMABURSTLENGTH_11TRANSFERS +#define TIM_DMABurstLength_12Transfers TIM_DMABURSTLENGTH_12TRANSFERS +#define TIM_DMABurstLength_13Transfers TIM_DMABURSTLENGTH_13TRANSFERS +#define TIM_DMABurstLength_14Transfers TIM_DMABURSTLENGTH_14TRANSFERS +#define TIM_DMABurstLength_15Transfers TIM_DMABURSTLENGTH_15TRANSFERS +#define TIM_DMABurstLength_16Transfers TIM_DMABURSTLENGTH_16TRANSFERS +#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 + +/** + * @} + */ + +/** @defgroup HAL_TSC_Aliased_Defines HAL TSC Aliased Defines maintained for legacy purpose + * @{ + */ +#define TSC_SYNC_POL_FALL TSC_SYNC_POLARITY_FALLING +#define TSC_SYNC_POL_RISE_HIGH TSC_SYNC_POLARITY_RISING +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Defines HAL UART Aliased Defines maintained for legacy purpose + * @{ + */ +#define UART_ONEBIT_SAMPLING_DISABLED UART_ONE_BIT_SAMPLE_DISABLE +#define UART_ONEBIT_SAMPLING_ENABLED UART_ONE_BIT_SAMPLE_ENABLE +#define UART_ONE_BIT_SAMPLE_DISABLED UART_ONE_BIT_SAMPLE_DISABLE +#define UART_ONE_BIT_SAMPLE_ENABLED UART_ONE_BIT_SAMPLE_ENABLE + +#define __HAL_UART_ONEBIT_ENABLE __HAL_UART_ONE_BIT_SAMPLE_ENABLE +#define __HAL_UART_ONEBIT_DISABLE __HAL_UART_ONE_BIT_SAMPLE_DISABLE + +#define __DIV_SAMPLING16 UART_DIV_SAMPLING16 +#define __DIVMANT_SAMPLING16 UART_DIVMANT_SAMPLING16 +#define __DIVFRAQ_SAMPLING16 UART_DIVFRAQ_SAMPLING16 +#define __UART_BRR_SAMPLING16 UART_BRR_SAMPLING16 + +#define __DIV_SAMPLING8 UART_DIV_SAMPLING8 +#define __DIVMANT_SAMPLING8 UART_DIVMANT_SAMPLING8 +#define __DIVFRAQ_SAMPLING8 UART_DIVFRAQ_SAMPLING8 +#define __UART_BRR_SAMPLING8 UART_BRR_SAMPLING8 + +#define __DIV_LPUART UART_DIV_LPUART + +#define UART_WAKEUPMETHODE_IDLELINE UART_WAKEUPMETHOD_IDLELINE +#define UART_WAKEUPMETHODE_ADDRESSMARK UART_WAKEUPMETHOD_ADDRESSMARK + +/** + * @} + */ + + +/** @defgroup HAL_USART_Aliased_Defines HAL USART Aliased Defines maintained for legacy purpose + * @{ + */ + +#define USART_CLOCK_DISABLED USART_CLOCK_DISABLE +#define USART_CLOCK_ENABLED USART_CLOCK_ENABLE + +#define USARTNACK_ENABLED USART_NACK_ENABLE +#define USARTNACK_DISABLED USART_NACK_DISABLE +/** + * @} + */ + +/** @defgroup HAL_WWDG_Aliased_Defines HAL WWDG Aliased Defines maintained for legacy purpose + * @{ + */ +#define CFR_BASE WWDG_CFR_BASE + +/** + * @} + */ + +/** @defgroup HAL_CAN_Aliased_Defines HAL CAN Aliased Defines maintained for legacy purpose + * @{ + */ +#define CAN_FilterFIFO0 CAN_FILTER_FIFO0 +#define CAN_FilterFIFO1 CAN_FILTER_FIFO1 +#define CAN_IT_RQCP0 CAN_IT_TME +#define CAN_IT_RQCP1 CAN_IT_TME +#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)0x00U) +#define CAN_TXSTATUS_OK ((uint8_t)0x01U) +#define CAN_TXSTATUS_PENDING ((uint8_t)0x02U) + +/** + * @} + */ + +/** @defgroup HAL_ETH_Aliased_Defines HAL ETH Aliased Defines maintained for legacy purpose + * @{ + */ + +#define VLAN_TAG ETH_VLAN_TAG +#define MIN_ETH_PAYLOAD ETH_MIN_ETH_PAYLOAD +#define MAX_ETH_PAYLOAD ETH_MAX_ETH_PAYLOAD +#define JUMBO_FRAME_PAYLOAD ETH_JUMBO_FRAME_PAYLOAD +#define MACMIIAR_CR_MASK ETH_MACMIIAR_CR_MASK +#define MACCR_CLEAR_MASK ETH_MACCR_CLEAR_MASK +#define MACFCR_CLEAR_MASK ETH_MACFCR_CLEAR_MASK +#define DMAOMR_CLEAR_MASK ETH_DMAOMR_CLEAR_MASK + +#define ETH_MMCCR 0x00000100U +#define ETH_MMCRIR 0x00000104U +#define ETH_MMCTIR 0x00000108U +#define ETH_MMCRIMR 0x0000010CU +#define ETH_MMCTIMR 0x00000110U +#define ETH_MMCTGFSCCR 0x0000014CU +#define ETH_MMCTGFMSCCR 0x00000150U +#define ETH_MMCTGFCR 0x00000168U +#define ETH_MMCRFCECR 0x00000194U +#define ETH_MMCRFAECR 0x00000198U +#define ETH_MMCRGUFCR 0x000001C4U + +#define ETH_MAC_TXFIFO_FULL 0x02000000U /* Tx FIFO full */ +#define ETH_MAC_TXFIFONOT_EMPTY 0x01000000U /* Tx FIFO not empty */ +#define ETH_MAC_TXFIFO_WRITE_ACTIVE 0x00400000U /* Tx FIFO write active */ +#define ETH_MAC_TXFIFO_IDLE 0x00000000U /* Tx FIFO read status: Idle */ +#define ETH_MAC_TXFIFO_READ 0x00100000U /* Tx FIFO read status: Read (transferring data to the MAC transmitter) */ +#define ETH_MAC_TXFIFO_WAITING 0x00200000U /* Tx FIFO read status: Waiting for TxStatus from MAC transmitter */ +#define ETH_MAC_TXFIFO_WRITING 0x00300000U /* Tx FIFO read status: Writing the received TxStatus or flushing the TxFIFO */ +#define ETH_MAC_TRANSMISSION_PAUSE 0x00080000U /* MAC transmitter in pause */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_IDLE 0x00000000U /* MAC transmit frame controller: Idle */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_WAITING 0x00020000U /* MAC transmit frame controller: Waiting for Status of previous frame or IFG/backoff period to be over */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_GENRATING_PCF 0x00040000U /* MAC transmit frame controller: Generating and transmitting a Pause control frame (in full duplex mode) */ +#define ETH_MAC_TRANSMITFRAMECONTROLLER_TRANSFERRING 0x00060000U /* MAC transmit frame controller: Transferring input frame for transmission */ +#define ETH_MAC_MII_TRANSMIT_ACTIVE 0x00010000U /* MAC MII transmit engine active */ +#define ETH_MAC_RXFIFO_EMPTY 0x00000000U /* Rx FIFO fill level: empty */ +#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 */ +#define ETH_MAC_SMALL_FIFO_READ_ACTIVE 0x00000002U /* MAC small FIFO read controller active */ +#define ETH_MAC_SMALL_FIFO_WRITE_ACTIVE 0x00000004U /* MAC small FIFO write controller active */ +#define ETH_MAC_SMALL_FIFO_RW_ACTIVE 0x00000006U /* MAC small FIFO read / write controllers active */ +#define ETH_MAC_MII_RECEIVE_PROTOCOL_ACTIVE 0x00000001U /* MAC MII receive protocol engine active */ + +/** + * @} + */ + +/** @defgroup HAL_DCMI_Aliased_Defines HAL DCMI Aliased Defines maintained for legacy purpose + * @{ + */ +#define HAL_DCMI_ERROR_OVF HAL_DCMI_ERROR_OVR +#define DCMI_IT_OVF DCMI_IT_OVR +#define DCMI_FLAG_OVFRI DCMI_FLAG_OVRRI +#define DCMI_FLAG_OVFMI DCMI_FLAG_OVRMI + +#define HAL_DCMI_ConfigCROP HAL_DCMI_ConfigCrop +#define HAL_DCMI_EnableCROP HAL_DCMI_EnableCrop +#define HAL_DCMI_DisableCROP HAL_DCMI_DisableCrop + +/** + * @} + */ + +#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 + * @{ + */ +#define DMA2D_ARGB8888 DMA2D_OUTPUT_ARGB8888 +#define DMA2D_RGB888 DMA2D_OUTPUT_RGB888 +#define DMA2D_RGB565 DMA2D_OUTPUT_RGB565 +#define DMA2D_ARGB1555 DMA2D_OUTPUT_ARGB1555 +#define DMA2D_ARGB4444 DMA2D_OUTPUT_ARGB4444 + +#define CM_ARGB8888 DMA2D_INPUT_ARGB8888 +#define CM_RGB888 DMA2D_INPUT_RGB888 +#define CM_RGB565 DMA2D_INPUT_RGB565 +#define CM_ARGB1555 DMA2D_INPUT_ARGB1555 +#define CM_ARGB4444 DMA2D_INPUT_ARGB4444 +#define CM_L8 DMA2D_INPUT_L8 +#define CM_AL44 DMA2D_INPUT_AL44 +#define CM_AL88 DMA2D_INPUT_AL88 +#define CM_L4 DMA2D_INPUT_L4 +#define CM_A8 DMA2D_INPUT_A8 +#define CM_A4 DMA2D_INPUT_A4 +/** + * @} + */ +#endif /* STM32L4 || STM32F7 || STM32F4 || STM32H7 */ + +/** @defgroup HAL_PPP_Aliased_Defines HAL PPP Aliased Defines maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup HAL_CRYP_Aliased_Functions HAL CRYP Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_CRYP_ComputationCpltCallback HAL_CRYPEx_ComputationCpltCallback +/** + * @} + */ + +/** @defgroup HAL_HASH_Aliased_Functions HAL HASH Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_HASH_STATETypeDef HAL_HASH_StateTypeDef +#define HAL_HASHPhaseTypeDef HAL_HASH_PhaseTypeDef +#define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish +#define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish +#define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish +#define HAL_HMAC_SHA256_Finish HAL_HASH_SHA256_Finish + +/*HASH Algorithm Selection*/ + +#define HASH_AlgoSelection_SHA1 HASH_ALGOSELECTION_SHA1 +#define HASH_AlgoSelection_SHA224 HASH_ALGOSELECTION_SHA224 +#define HASH_AlgoSelection_SHA256 HASH_ALGOSELECTION_SHA256 +#define HASH_AlgoSelection_MD5 HASH_ALGOSELECTION_MD5 + +#define HASH_AlgoMode_HASH HASH_ALGOMODE_HASH +#define HASH_AlgoMode_HMAC HASH_ALGOMODE_HMAC + +#define HASH_HMACKeyType_ShortKey HASH_HMAC_KEYTYPE_SHORTKEY +#define HASH_HMACKeyType_LongKey HASH_HMAC_KEYTYPE_LONGKEY + +#if defined(STM32L4) || defined(STM32L5) || defined(STM32F2) || defined(STM32F4) || defined(STM32F7) || defined(STM32H7) + +#define HAL_HASH_MD5_Accumulate HAL_HASH_MD5_Accmlt +#define HAL_HASH_MD5_Accumulate_End HAL_HASH_MD5_Accmlt_End +#define HAL_HASH_MD5_Accumulate_IT HAL_HASH_MD5_Accmlt_IT +#define HAL_HASH_MD5_Accumulate_End_IT HAL_HASH_MD5_Accmlt_End_IT + +#define HAL_HASH_SHA1_Accumulate HAL_HASH_SHA1_Accmlt +#define HAL_HASH_SHA1_Accumulate_End HAL_HASH_SHA1_Accmlt_End +#define HAL_HASH_SHA1_Accumulate_IT HAL_HASH_SHA1_Accmlt_IT +#define HAL_HASH_SHA1_Accumulate_End_IT HAL_HASH_SHA1_Accmlt_End_IT + +#define HAL_HASHEx_SHA224_Accumulate HAL_HASHEx_SHA224_Accmlt +#define HAL_HASHEx_SHA224_Accumulate_End HAL_HASHEx_SHA224_Accmlt_End +#define HAL_HASHEx_SHA224_Accumulate_IT HAL_HASHEx_SHA224_Accmlt_IT +#define HAL_HASHEx_SHA224_Accumulate_End_IT HAL_HASHEx_SHA224_Accmlt_End_IT + +#define HAL_HASHEx_SHA256_Accumulate HAL_HASHEx_SHA256_Accmlt +#define HAL_HASHEx_SHA256_Accumulate_End HAL_HASHEx_SHA256_Accmlt_End +#define HAL_HASHEx_SHA256_Accumulate_IT HAL_HASHEx_SHA256_Accmlt_IT +#define HAL_HASHEx_SHA256_Accumulate_End_IT HAL_HASHEx_SHA256_Accmlt_End_IT + +#endif /* STM32L4 || STM32L5 || STM32F2 || STM32F4 || STM32F7 || STM32H7 */ +/** + * @} + */ + +/** @defgroup HAL_Aliased_Functions HAL Generic Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_EnableDBGSleepMode HAL_DBGMCU_EnableDBGSleepMode +#define HAL_DisableDBGSleepMode HAL_DBGMCU_DisableDBGSleepMode +#define HAL_EnableDBGStopMode HAL_DBGMCU_EnableDBGStopMode +#define HAL_DisableDBGStopMode HAL_DBGMCU_DisableDBGStopMode +#define HAL_EnableDBGStandbyMode HAL_DBGMCU_EnableDBGStandbyMode +#define HAL_DisableDBGStandbyMode HAL_DBGMCU_DisableDBGStandbyMode +#define HAL_DBG_LowPowerConfig(Periph, cmd) (((cmd)==ENABLE)? HAL_DBGMCU_DBG_EnableLowPowerConfig(Periph) : HAL_DBGMCU_DBG_DisableLowPowerConfig(Periph)) +#define HAL_VREFINT_OutputSelect HAL_SYSCFG_VREFINT_OutputSelect +#define HAL_Lock_Cmd(cmd) (((cmd)==ENABLE) ? HAL_SYSCFG_Enable_Lock_VREFINT() : HAL_SYSCFG_Disable_Lock_VREFINT()) +#if defined(STM32L0) +#else +#define HAL_VREFINT_Cmd(cmd) (((cmd)==ENABLE)? HAL_SYSCFG_EnableVREFINT() : HAL_SYSCFG_DisableVREFINT()) +#endif +#define HAL_ADC_EnableBuffer_Cmd(cmd) (((cmd)==ENABLE) ? HAL_ADCEx_EnableVREFINT() : HAL_ADCEx_DisableVREFINT()) +#define HAL_ADC_EnableBufferSensor_Cmd(cmd) (((cmd)==ENABLE) ? HAL_ADCEx_EnableVREFINTTempSensor() : HAL_ADCEx_DisableVREFINTTempSensor()) +#if defined(STM32H7A3xx) || defined(STM32H7B3xx) || defined(STM32H7B0xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xxQ) || defined(STM32H7B0xxQ) +#define HAL_EnableSRDomainDBGStopMode HAL_EnableDomain3DBGStopMode +#define HAL_DisableSRDomainDBGStopMode HAL_DisableDomain3DBGStopMode +#define HAL_EnableSRDomainDBGStandbyMode HAL_EnableDomain3DBGStandbyMode +#define HAL_DisableSRDomainDBGStandbyMode HAL_DisableDomain3DBGStandbyMode +#endif /* STM32H7A3xx || STM32H7B3xx || STM32H7B0xx || STM32H7A3xxQ || STM32H7B3xxQ || STM32H7B0xxQ */ + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Functions HAL FLASH Aliased Functions maintained for legacy purpose + * @{ + */ +#define FLASH_HalfPageProgram HAL_FLASHEx_HalfPageProgram +#define FLASH_EnableRunPowerDown HAL_FLASHEx_EnableRunPowerDown +#define FLASH_DisableRunPowerDown HAL_FLASHEx_DisableRunPowerDown +#define HAL_DATA_EEPROMEx_Unlock HAL_FLASHEx_DATAEEPROM_Unlock +#define HAL_DATA_EEPROMEx_Lock HAL_FLASHEx_DATAEEPROM_Lock +#define HAL_DATA_EEPROMEx_Erase HAL_FLASHEx_DATAEEPROM_Erase +#define HAL_DATA_EEPROMEx_Program HAL_FLASHEx_DATAEEPROM_Program + + /** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Functions HAL I2C Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_I2CEx_AnalogFilter_Config HAL_I2CEx_ConfigAnalogFilter +#define HAL_I2CEx_DigitalFilter_Config HAL_I2CEx_ConfigDigitalFilter +#define HAL_FMPI2CEx_AnalogFilter_Config HAL_FMPI2CEx_ConfigAnalogFilter +#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(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32L5) || defined(STM32G4) || defined(STM32L1) +#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 +#endif /* STM32H7 || STM32WB || STM32G0 || STM32F0 || STM32F1 || STM32F2 || STM32F3 || STM32F4 || STM32F7 || STM32L0 || STM32L4 || STM32L5 || STM32G4 || STM32L1 */ +#if defined(STM32H7) || defined(STM32WB) || defined(STM32G0) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32L5) || defined(STM32G4)|| defined(STM32L1) +#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 || STM32L5 || STM32G4 || STM32L1 */ + +#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 */ + /** + * @} + */ + +/** @defgroup HAL_PWR_Aliased HAL PWR Aliased maintained for legacy purpose + * @{ + */ + +#if defined(STM32G0) +#define HAL_PWR_ConfigPVD HAL_PWREx_ConfigPVD +#define HAL_PWR_EnablePVD HAL_PWREx_EnablePVD +#define HAL_PWR_DisablePVD HAL_PWREx_DisablePVD +#define HAL_PWR_PVD_IRQHandler HAL_PWREx_PVD_IRQHandler +#endif +#define HAL_PWR_PVDConfig HAL_PWR_ConfigPVD +#define HAL_PWR_DisableBkUpReg HAL_PWREx_DisableBkUpReg +#define HAL_PWR_DisableFlashPowerDown HAL_PWREx_DisableFlashPowerDown +#define HAL_PWR_DisableVddio2Monitor HAL_PWREx_DisableVddio2Monitor +#define HAL_PWR_EnableBkUpReg HAL_PWREx_EnableBkUpReg +#define HAL_PWR_EnableFlashPowerDown HAL_PWREx_EnableFlashPowerDown +#define HAL_PWR_EnableVddio2Monitor HAL_PWREx_EnableVddio2Monitor +#define HAL_PWR_PVD_PVM_IRQHandler HAL_PWREx_PVD_PVM_IRQHandler +#define HAL_PWR_PVDLevelConfig HAL_PWR_ConfigPVD +#define HAL_PWR_Vddio2Monitor_IRQHandler HAL_PWREx_Vddio2Monitor_IRQHandler +#define HAL_PWR_Vddio2MonitorCallback HAL_PWREx_Vddio2MonitorCallback +#define HAL_PWREx_ActivateOverDrive HAL_PWREx_EnableOverDrive +#define HAL_PWREx_DeactivateOverDrive HAL_PWREx_DisableOverDrive +#define HAL_PWREx_DisableSDADCAnalog HAL_PWREx_DisableSDADC +#define HAL_PWREx_EnableSDADCAnalog HAL_PWREx_EnableSDADC +#define HAL_PWREx_PVMConfig HAL_PWREx_ConfigPVM + +#define PWR_MODE_NORMAL PWR_PVD_MODE_NORMAL +#define PWR_MODE_IT_RISING PWR_PVD_MODE_IT_RISING +#define PWR_MODE_IT_FALLING PWR_PVD_MODE_IT_FALLING +#define PWR_MODE_IT_RISING_FALLING PWR_PVD_MODE_IT_RISING_FALLING +#define PWR_MODE_EVENT_RISING PWR_PVD_MODE_EVENT_RISING +#define PWR_MODE_EVENT_FALLING PWR_PVD_MODE_EVENT_FALLING +#define PWR_MODE_EVENT_RISING_FALLING PWR_PVD_MODE_EVENT_RISING_FALLING + +#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 +#define PMODE_BitNumber PMODE_BIT_NUMBER +#define EWUP_BitNumber EWUP_BIT_NUMBER +#define FPDS_BitNumber FPDS_BIT_NUMBER +#define ODEN_BitNumber ODEN_BIT_NUMBER +#define ODSWEN_BitNumber ODSWEN_BIT_NUMBER +#define MRLVDS_BitNumber MRLVDS_BIT_NUMBER +#define LPLVDS_BitNumber LPLVDS_BIT_NUMBER +#define BRE_BitNumber BRE_BIT_NUMBER + +#define PWR_MODE_EVT PWR_PVD_MODE_NORMAL + + /** + * @} + */ + +/** @defgroup HAL_SMBUS_Aliased_Functions HAL SMBUS Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_SMBUS_Slave_Listen_IT HAL_SMBUS_EnableListen_IT +#define HAL_SMBUS_SlaveAddrCallback HAL_SMBUS_AddrCallback +#define HAL_SMBUS_SlaveListenCpltCallback HAL_SMBUS_ListenCpltCallback +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Functions HAL SPI Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_SPI_FlushRxFifo HAL_SPIEx_FlushRxFifo +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Functions HAL TIM Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_TIM_DMADelayPulseCplt TIM_DMADelayPulseCplt +#define HAL_TIM_DMAError TIM_DMAError +#define HAL_TIM_DMACaptureCplt TIM_DMACaptureCplt +#define HAL_TIMEx_DMACommutationCplt TIMEx_DMACommutationCplt +#if defined(STM32H7) || defined(STM32G0) || defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) || defined(STM32F4) || defined(STM32F7) || 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 || STM32F0 || STM32F1 || STM32F2 || STM32F3 || STM32F4 || STM32F7 || STM32L0 */ +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Functions HAL UART Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_UART_WakeupCallback HAL_UARTEx_WakeupCallback +/** + * @} + */ + +/** @defgroup HAL_LTDC_Aliased_Functions HAL LTDC Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_LTDC_LineEvenCallback HAL_LTDC_LineEventCallback +#define HAL_LTDC_Relaod HAL_LTDC_Reload +#define HAL_LTDC_StructInitFromVideoConfig HAL_LTDCEx_StructInitFromVideoConfig +#define HAL_LTDC_StructInitFromAdaptedCommandConfig HAL_LTDCEx_StructInitFromAdaptedCommandConfig +/** + * @} + */ + + +/** @defgroup HAL_PPP_Aliased_Functions HAL PPP Aliased Functions maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +/* Exported macros ------------------------------------------------------------*/ + +/** @defgroup HAL_AES_Aliased_Macros HAL CRYP Aliased Macros maintained for legacy purpose + * @{ + */ +#define AES_IT_CC CRYP_IT_CC +#define AES_IT_ERR CRYP_IT_ERR +#define AES_FLAG_CCF CRYP_FLAG_CCF +/** + * @} + */ + +/** @defgroup HAL_Aliased_Macros HAL Generic Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_GET_BOOT_MODE __HAL_SYSCFG_GET_BOOT_MODE +#define __HAL_REMAPMEMORY_FLASH __HAL_SYSCFG_REMAPMEMORY_FLASH +#define __HAL_REMAPMEMORY_SYSTEMFLASH __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH +#define __HAL_REMAPMEMORY_SRAM __HAL_SYSCFG_REMAPMEMORY_SRAM +#define __HAL_REMAPMEMORY_FMC __HAL_SYSCFG_REMAPMEMORY_FMC +#define __HAL_REMAPMEMORY_FMC_SDRAM __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM +#define __HAL_REMAPMEMORY_FSMC __HAL_SYSCFG_REMAPMEMORY_FSMC +#define __HAL_REMAPMEMORY_QUADSPI __HAL_SYSCFG_REMAPMEMORY_QUADSPI +#define __HAL_FMC_BANK __HAL_SYSCFG_FMC_BANK +#define __HAL_GET_FLAG __HAL_SYSCFG_GET_FLAG +#define __HAL_CLEAR_FLAG __HAL_SYSCFG_CLEAR_FLAG +#define __HAL_VREFINT_OUT_ENABLE __HAL_SYSCFG_VREFINT_OUT_ENABLE +#define __HAL_VREFINT_OUT_DISABLE __HAL_SYSCFG_VREFINT_OUT_DISABLE +#define __HAL_SYSCFG_SRAM2_WRP_ENABLE __HAL_SYSCFG_SRAM2_WRP_0_31_ENABLE + +#define SYSCFG_FLAG_VREF_READY SYSCFG_FLAG_VREFINT_READY +#define SYSCFG_FLAG_RC48 RCC_FLAG_HSI48 +#define IS_SYSCFG_FASTMODEPLUS_CONFIG IS_I2C_FASTMODEPLUS +#define UFB_MODE_BitNumber UFB_MODE_BIT_NUMBER +#define CMP_PD_BitNumber CMP_PD_BIT_NUMBER + +/** + * @} + */ + + +/** @defgroup HAL_ADC_Aliased_Macros HAL ADC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __ADC_ENABLE __HAL_ADC_ENABLE +#define __ADC_DISABLE __HAL_ADC_DISABLE +#define __HAL_ADC_ENABLING_CONDITIONS ADC_ENABLING_CONDITIONS +#define __HAL_ADC_DISABLING_CONDITIONS ADC_DISABLING_CONDITIONS +#define __HAL_ADC_IS_ENABLED ADC_IS_ENABLE +#define __ADC_IS_ENABLED ADC_IS_ENABLE +#define __HAL_ADC_IS_SOFTWARE_START_REGULAR ADC_IS_SOFTWARE_START_REGULAR +#define __HAL_ADC_IS_SOFTWARE_START_INJECTED ADC_IS_SOFTWARE_START_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR ADC_IS_CONVERSION_ONGOING_REGULAR +#define __HAL_ADC_IS_CONVERSION_ONGOING_INJECTED ADC_IS_CONVERSION_ONGOING_INJECTED +#define __HAL_ADC_IS_CONVERSION_ONGOING ADC_IS_CONVERSION_ONGOING +#define __HAL_ADC_CLEAR_ERRORCODE ADC_CLEAR_ERRORCODE + +#define __HAL_ADC_GET_RESOLUTION ADC_GET_RESOLUTION +#define __HAL_ADC_JSQR_RK ADC_JSQR_RK +#define __HAL_ADC_CFGR_AWD1CH ADC_CFGR_AWD1CH_SHIFT +#define __HAL_ADC_CFGR_AWD23CR ADC_CFGR_AWD23CR +#define __HAL_ADC_CFGR_INJECT_AUTO_CONVERSION ADC_CFGR_INJECT_AUTO_CONVERSION +#define __HAL_ADC_CFGR_INJECT_CONTEXT_QUEUE ADC_CFGR_INJECT_CONTEXT_QUEUE +#define __HAL_ADC_CFGR_INJECT_DISCCONTINUOUS ADC_CFGR_INJECT_DISCCONTINUOUS +#define __HAL_ADC_CFGR_REG_DISCCONTINUOUS ADC_CFGR_REG_DISCCONTINUOUS +#define __HAL_ADC_CFGR_DISCONTINUOUS_NUM ADC_CFGR_DISCONTINUOUS_NUM +#define __HAL_ADC_CFGR_AUTOWAIT ADC_CFGR_AUTOWAIT +#define __HAL_ADC_CFGR_CONTINUOUS ADC_CFGR_CONTINUOUS +#define __HAL_ADC_CFGR_OVERRUN ADC_CFGR_OVERRUN +#define __HAL_ADC_CFGR_DMACONTREQ ADC_CFGR_DMACONTREQ +#define __HAL_ADC_CFGR_EXTSEL ADC_CFGR_EXTSEL_SET +#define __HAL_ADC_JSQR_JEXTSEL ADC_JSQR_JEXTSEL_SET +#define __HAL_ADC_OFR_CHANNEL ADC_OFR_CHANNEL +#define __HAL_ADC_DIFSEL_CHANNEL ADC_DIFSEL_CHANNEL +#define __HAL_ADC_CALFACT_DIFF_SET ADC_CALFACT_DIFF_SET +#define __HAL_ADC_CALFACT_DIFF_GET ADC_CALFACT_DIFF_GET +#define __HAL_ADC_TRX_HIGHTHRESHOLD ADC_TRX_HIGHTHRESHOLD + +#define __HAL_ADC_OFFSET_SHIFT_RESOLUTION ADC_OFFSET_SHIFT_RESOLUTION +#define __HAL_ADC_AWD1THRESHOLD_SHIFT_RESOLUTION ADC_AWD1THRESHOLD_SHIFT_RESOLUTION +#define __HAL_ADC_AWD23THRESHOLD_SHIFT_RESOLUTION ADC_AWD23THRESHOLD_SHIFT_RESOLUTION +#define __HAL_ADC_COMMON_REGISTER ADC_COMMON_REGISTER +#define __HAL_ADC_COMMON_CCR_MULTI ADC_COMMON_CCR_MULTI +#define __HAL_ADC_MULTIMODE_IS_ENABLED ADC_MULTIMODE_IS_ENABLE +#define __ADC_MULTIMODE_IS_ENABLED ADC_MULTIMODE_IS_ENABLE +#define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER ADC_NONMULTIMODE_OR_MULTIMODEMASTER +#define __HAL_ADC_COMMON_ADC_OTHER ADC_COMMON_ADC_OTHER +#define __HAL_ADC_MULTI_SLAVE ADC_MULTI_SLAVE + +#define __HAL_ADC_SQR1_L ADC_SQR1_L_SHIFT +#define __HAL_ADC_JSQR_JL ADC_JSQR_JL_SHIFT +#define __HAL_ADC_JSQR_RK_JL ADC_JSQR_RK_JL +#define __HAL_ADC_CR1_DISCONTINUOUS_NUM ADC_CR1_DISCONTINUOUS_NUM +#define __HAL_ADC_CR1_SCAN ADC_CR1_SCAN_SET +#define __HAL_ADC_CONVCYCLES_MAX_RANGE ADC_CONVCYCLES_MAX_RANGE +#define __HAL_ADC_CLOCK_PRESCALER_RANGE ADC_CLOCK_PRESCALER_RANGE +#define __HAL_ADC_GET_CLOCK_PRESCALER ADC_GET_CLOCK_PRESCALER + +#define __HAL_ADC_SQR1 ADC_SQR1 +#define __HAL_ADC_SMPR1 ADC_SMPR1 +#define __HAL_ADC_SMPR2 ADC_SMPR2 +#define __HAL_ADC_SQR3_RK ADC_SQR3_RK +#define __HAL_ADC_SQR2_RK ADC_SQR2_RK +#define __HAL_ADC_SQR1_RK ADC_SQR1_RK +#define __HAL_ADC_CR2_CONTINUOUS ADC_CR2_CONTINUOUS +#define __HAL_ADC_CR1_DISCONTINUOUS ADC_CR1_DISCONTINUOUS +#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_JSQR ADC_JSQR + +#define __HAL_ADC_CHSELR_CHANNEL ADC_CHSELR_CHANNEL +#define __HAL_ADC_CFGR1_REG_DISCCONTINUOUS ADC_CFGR1_REG_DISCCONTINUOUS +#define __HAL_ADC_CFGR1_AUTOOFF ADC_CFGR1_AUTOOFF +#define __HAL_ADC_CFGR1_AUTOWAIT ADC_CFGR1_AUTOWAIT +#define __HAL_ADC_CFGR1_CONTINUOUS ADC_CFGR1_CONTINUOUS +#define __HAL_ADC_CFGR1_OVERRUN ADC_CFGR1_OVERRUN +#define __HAL_ADC_CFGR1_SCANDIR ADC_CFGR1_SCANDIR +#define __HAL_ADC_CFGR1_DMACONTREQ ADC_CFGR1_DMACONTREQ + +/** + * @} + */ + +/** @defgroup HAL_DAC_Aliased_Macros HAL DAC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_DHR12R1_ALIGNEMENT DAC_DHR12R1_ALIGNMENT +#define __HAL_DHR12R2_ALIGNEMENT DAC_DHR12R2_ALIGNMENT +#define __HAL_DHR12RD_ALIGNEMENT DAC_DHR12RD_ALIGNMENT +#define IS_DAC_GENERATE_WAVE IS_DAC_WAVE + +/** + * @} + */ + +/** @defgroup HAL_DBGMCU_Aliased_Macros HAL DBGMCU Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_FREEZE_TIM1_DBGMCU __HAL_DBGMCU_FREEZE_TIM1 +#define __HAL_UNFREEZE_TIM1_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM1 +#define __HAL_FREEZE_TIM2_DBGMCU __HAL_DBGMCU_FREEZE_TIM2 +#define __HAL_UNFREEZE_TIM2_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM2 +#define __HAL_FREEZE_TIM3_DBGMCU __HAL_DBGMCU_FREEZE_TIM3 +#define __HAL_UNFREEZE_TIM3_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM3 +#define __HAL_FREEZE_TIM4_DBGMCU __HAL_DBGMCU_FREEZE_TIM4 +#define __HAL_UNFREEZE_TIM4_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM4 +#define __HAL_FREEZE_TIM5_DBGMCU __HAL_DBGMCU_FREEZE_TIM5 +#define __HAL_UNFREEZE_TIM5_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM5 +#define __HAL_FREEZE_TIM6_DBGMCU __HAL_DBGMCU_FREEZE_TIM6 +#define __HAL_UNFREEZE_TIM6_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM6 +#define __HAL_FREEZE_TIM7_DBGMCU __HAL_DBGMCU_FREEZE_TIM7 +#define __HAL_UNFREEZE_TIM7_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM7 +#define __HAL_FREEZE_TIM8_DBGMCU __HAL_DBGMCU_FREEZE_TIM8 +#define __HAL_UNFREEZE_TIM8_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM8 + +#define __HAL_FREEZE_TIM9_DBGMCU __HAL_DBGMCU_FREEZE_TIM9 +#define __HAL_UNFREEZE_TIM9_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM9 +#define __HAL_FREEZE_TIM10_DBGMCU __HAL_DBGMCU_FREEZE_TIM10 +#define __HAL_UNFREEZE_TIM10_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM10 +#define __HAL_FREEZE_TIM11_DBGMCU __HAL_DBGMCU_FREEZE_TIM11 +#define __HAL_UNFREEZE_TIM11_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM11 +#define __HAL_FREEZE_TIM12_DBGMCU __HAL_DBGMCU_FREEZE_TIM12 +#define __HAL_UNFREEZE_TIM12_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM12 +#define __HAL_FREEZE_TIM13_DBGMCU __HAL_DBGMCU_FREEZE_TIM13 +#define __HAL_UNFREEZE_TIM13_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM13 +#define __HAL_FREEZE_TIM14_DBGMCU __HAL_DBGMCU_FREEZE_TIM14 +#define __HAL_UNFREEZE_TIM14_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM14 +#define __HAL_FREEZE_CAN2_DBGMCU __HAL_DBGMCU_FREEZE_CAN2 +#define __HAL_UNFREEZE_CAN2_DBGMCU __HAL_DBGMCU_UNFREEZE_CAN2 + + +#define __HAL_FREEZE_TIM15_DBGMCU __HAL_DBGMCU_FREEZE_TIM15 +#define __HAL_UNFREEZE_TIM15_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM15 +#define __HAL_FREEZE_TIM16_DBGMCU __HAL_DBGMCU_FREEZE_TIM16 +#define __HAL_UNFREEZE_TIM16_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM16 +#define __HAL_FREEZE_TIM17_DBGMCU __HAL_DBGMCU_FREEZE_TIM17 +#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 +#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 +#define __HAL_UNFREEZE_I2C2_TIMEOUT_DBGMCU __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT +#define __HAL_FREEZE_I2C3_TIMEOUT_DBGMCU __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT +#define __HAL_UNFREEZE_I2C3_TIMEOUT_DBGMCU __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT +#define __HAL_FREEZE_CAN1_DBGMCU __HAL_DBGMCU_FREEZE_CAN1 +#define __HAL_UNFREEZE_CAN1_DBGMCU __HAL_DBGMCU_UNFREEZE_CAN1 +#define __HAL_FREEZE_LPTIM1_DBGMCU __HAL_DBGMCU_FREEZE_LPTIM1 +#define __HAL_UNFREEZE_LPTIM1_DBGMCU __HAL_DBGMCU_UNFREEZE_LPTIM1 +#define __HAL_FREEZE_LPTIM2_DBGMCU __HAL_DBGMCU_FREEZE_LPTIM2 +#define __HAL_UNFREEZE_LPTIM2_DBGMCU __HAL_DBGMCU_UNFREEZE_LPTIM2 + +/** + * @} + */ + +/** @defgroup HAL_COMP_Aliased_Macros HAL COMP Aliased Macros maintained for legacy purpose + * @{ + */ +#if defined(STM32F3) +#define COMP_START __HAL_COMP_ENABLE +#define COMP_STOP __HAL_COMP_DISABLE +#define COMP_LOCK __HAL_COMP_LOCK + +#if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP6_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP6_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F302xE) || defined(STM32F302xC) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP6_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP6_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP6_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F303xC) || defined(STM32F358xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_RISING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_FALLING_EDGE() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP7_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_IT() : \ + ((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP7_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_GET_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP7_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_CLEAR_FLAG() : \ + ((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP7_EXTI_CLEAR_FLAG()) +# endif +# if defined(STM32F373xC) ||defined(STM32F378xx) +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP2_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()) +# endif +#else +#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()) +#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_ENABLE_IT()) +#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \ + __HAL_COMP_COMP2_EXTI_DISABLE_IT()) +#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \ + __HAL_COMP_COMP2_EXTI_GET_FLAG()) +#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ + __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()) +#endif + +#define __HAL_COMP_GET_EXTI_LINE COMP_GET_EXTI_LINE + +#if defined(STM32L0) || defined(STM32L4) +/* Note: On these STM32 families, the only argument of this macro */ +/* is COMP_FLAG_LOCK. */ +/* This macro is replaced by __HAL_COMP_IS_LOCKED with only HAL handle */ +/* argument. */ +#define __HAL_COMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_COMP_IS_LOCKED(__HANDLE__)) +#endif +/** + * @} + */ + +#if defined(STM32L0) || defined(STM32L4) +/** @defgroup HAL_COMP_Aliased_Functions HAL COMP Aliased Functions maintained for legacy purpose + * @{ + */ +#define HAL_COMP_Start_IT HAL_COMP_Start /* Function considered as legacy as EXTI event or IT configuration is done into HAL_COMP_Init() */ +#define HAL_COMP_Stop_IT HAL_COMP_Stop /* Function considered as legacy as EXTI event or IT configuration is done into HAL_COMP_Init() */ +/** + * @} + */ +#endif + +/** @defgroup HAL_DAC_Aliased_Macros HAL DAC Aliased Macros maintained for legacy purpose + * @{ + */ + +#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_WAVE_NONE) || \ + ((WAVE) == DAC_WAVE_NOISE)|| \ + ((WAVE) == DAC_WAVE_TRIANGLE)) + +/** + * @} + */ + +/** @defgroup HAL_FLASH_Aliased_Macros HAL FLASH Aliased Macros maintained for legacy purpose + * @{ + */ + +#define IS_WRPAREA IS_OB_WRPAREA +#define IS_TYPEPROGRAM IS_FLASH_TYPEPROGRAM +#define IS_TYPEPROGRAMFLASH IS_FLASH_TYPEPROGRAM +#define IS_TYPEERASE IS_FLASH_TYPEERASE +#define IS_NBSECTORS IS_FLASH_NBSECTORS +#define IS_OB_WDG_SOURCE IS_OB_IWDG_SOURCE + +/** + * @} + */ + +/** @defgroup HAL_I2C_Aliased_Macros HAL I2C Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_I2C_RESET_CR2 I2C_RESET_CR2 +#define __HAL_I2C_GENERATE_START I2C_GENERATE_START +#if defined(STM32F1) +#define __HAL_I2C_FREQ_RANGE I2C_FREQRANGE +#else +#define __HAL_I2C_FREQ_RANGE I2C_FREQ_RANGE +#endif /* STM32F1 */ +#define __HAL_I2C_RISE_TIME I2C_RISE_TIME +#define __HAL_I2C_SPEED_STANDARD I2C_SPEED_STANDARD +#define __HAL_I2C_SPEED_FAST I2C_SPEED_FAST +#define __HAL_I2C_SPEED I2C_SPEED +#define __HAL_I2C_7BIT_ADD_WRITE I2C_7BIT_ADD_WRITE +#define __HAL_I2C_7BIT_ADD_READ I2C_7BIT_ADD_READ +#define __HAL_I2C_10BIT_ADDRESS I2C_10BIT_ADDRESS +#define __HAL_I2C_10BIT_HEADER_WRITE I2C_10BIT_HEADER_WRITE +#define __HAL_I2C_10BIT_HEADER_READ I2C_10BIT_HEADER_READ +#define __HAL_I2C_MEM_ADD_MSB I2C_MEM_ADD_MSB +#define __HAL_I2C_MEM_ADD_LSB I2C_MEM_ADD_LSB +#define __HAL_I2C_FREQRANGE I2C_FREQRANGE +/** + * @} + */ + +/** @defgroup HAL_I2S_Aliased_Macros HAL I2S Aliased Macros maintained for legacy purpose + * @{ + */ + +#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 + +/** + * @} + */ + +/** @defgroup HAL_IRDA_Aliased_Macros HAL IRDA Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __IRDA_DISABLE __HAL_IRDA_DISABLE +#define __IRDA_ENABLE __HAL_IRDA_ENABLE + +#define __HAL_IRDA_GETCLOCKSOURCE IRDA_GETCLOCKSOURCE +#define __HAL_IRDA_MASK_COMPUTATION IRDA_MASK_COMPUTATION +#define __IRDA_GETCLOCKSOURCE IRDA_GETCLOCKSOURCE +#define __IRDA_MASK_COMPUTATION IRDA_MASK_COMPUTATION + +#define IS_IRDA_ONEBIT_SAMPLE IS_IRDA_ONE_BIT_SAMPLE + + +/** + * @} + */ + + +/** @defgroup HAL_IWDG_Aliased_Macros HAL IWDG Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_IWDG_ENABLE_WRITE_ACCESS IWDG_ENABLE_WRITE_ACCESS +#define __HAL_IWDG_DISABLE_WRITE_ACCESS IWDG_DISABLE_WRITE_ACCESS +/** + * @} + */ + + +/** @defgroup HAL_LPTIM_Aliased_Macros HAL LPTIM Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_LPTIM_ENABLE_INTERRUPT __HAL_LPTIM_ENABLE_IT +#define __HAL_LPTIM_DISABLE_INTERRUPT __HAL_LPTIM_DISABLE_IT +#define __HAL_LPTIM_GET_ITSTATUS __HAL_LPTIM_GET_IT_SOURCE + +/** + * @} + */ + + +/** @defgroup HAL_OPAMP_Aliased_Macros HAL OPAMP Aliased Macros maintained for legacy purpose + * @{ + */ +#define __OPAMP_CSR_OPAXPD OPAMP_CSR_OPAXPD +#define __OPAMP_CSR_S3SELX OPAMP_CSR_S3SELX +#define __OPAMP_CSR_S4SELX OPAMP_CSR_S4SELX +#define __OPAMP_CSR_S5SELX OPAMP_CSR_S5SELX +#define __OPAMP_CSR_S6SELX OPAMP_CSR_S6SELX +#define __OPAMP_CSR_OPAXCAL_L OPAMP_CSR_OPAXCAL_L +#define __OPAMP_CSR_OPAXCAL_H OPAMP_CSR_OPAXCAL_H +#define __OPAMP_CSR_OPAXLPM OPAMP_CSR_OPAXLPM +#define __OPAMP_CSR_ALL_SWITCHES OPAMP_CSR_ALL_SWITCHES +#define __OPAMP_CSR_ANAWSELX OPAMP_CSR_ANAWSELX +#define __OPAMP_CSR_OPAXCALOUT OPAMP_CSR_OPAXCALOUT +#define __OPAMP_OFFSET_TRIM_BITSPOSITION OPAMP_OFFSET_TRIM_BITSPOSITION +#define __OPAMP_OFFSET_TRIM_SET OPAMP_OFFSET_TRIM_SET + +/** + * @} + */ + + +/** @defgroup HAL_PWR_Aliased_Macros HAL PWR Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_PVD_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT +#define __HAL_PVD_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT +#define __HAL_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PVD_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PVD_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE +#define __HAL_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PVM_EVENT_DISABLE __HAL_PWR_PVM_EVENT_DISABLE +#define __HAL_PVM_EVENT_ENABLE __HAL_PWR_PVM_EVENT_ENABLE +#define __HAL_PVM_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVM_EXTI_FALLINGTRIGGER_DISABLE +#define __HAL_PVM_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVM_EXTI_FALLINGTRIGGER_ENABLE +#define __HAL_PVM_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVM_EXTI_RISINGTRIGGER_DISABLE +#define __HAL_PVM_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVM_EXTI_RISINGTRIGGER_ENABLE +#define __HAL_PWR_INTERNALWAKEUP_DISABLE HAL_PWREx_DisableInternalWakeUpLine +#define __HAL_PWR_INTERNALWAKEUP_ENABLE HAL_PWREx_EnableInternalWakeUpLine +#define __HAL_PWR_PULL_UP_DOWN_CONFIG_DISABLE HAL_PWREx_DisablePullUpPullDownConfig +#define __HAL_PWR_PULL_UP_DOWN_CONFIG_ENABLE HAL_PWREx_EnablePullUpPullDownConfig +#define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() do { __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); } while(0) +#define __HAL_PWR_PVD_EXTI_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT +#define __HAL_PWR_PVD_EXTI_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT +#define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE +#define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE +#define __HAL_PWR_PVM_DISABLE() do { HAL_PWREx_DisablePVM1();HAL_PWREx_DisablePVM2();HAL_PWREx_DisablePVM3();HAL_PWREx_DisablePVM4(); } while(0) +#define __HAL_PWR_PVM_ENABLE() do { HAL_PWREx_EnablePVM1();HAL_PWREx_EnablePVM2();HAL_PWREx_EnablePVM3();HAL_PWREx_EnablePVM4(); } while(0) +#define __HAL_PWR_SRAM2CONTENT_PRESERVE_DISABLE HAL_PWREx_DisableSRAM2ContentRetention +#define __HAL_PWR_SRAM2CONTENT_PRESERVE_ENABLE HAL_PWREx_EnableSRAM2ContentRetention +#define __HAL_PWR_VDDIO2_DISABLE HAL_PWREx_DisableVddIO2 +#define __HAL_PWR_VDDIO2_ENABLE HAL_PWREx_EnableVddIO2 +#define __HAL_PWR_VDDIO2_EXTI_CLEAR_EGDE_TRIGGER __HAL_PWR_VDDIO2_EXTI_DISABLE_FALLING_EDGE +#define __HAL_PWR_VDDIO2_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_VDDIO2_EXTI_ENABLE_FALLING_EDGE +#define __HAL_PWR_VDDUSB_DISABLE HAL_PWREx_DisableVddUSB +#define __HAL_PWR_VDDUSB_ENABLE HAL_PWREx_EnableVddUSB + +#if defined (STM32F4) +#define __HAL_PVD_EXTI_ENABLE_IT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_ENABLE_IT() +#define __HAL_PVD_EXTI_DISABLE_IT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_DISABLE_IT() +#define __HAL_PVD_EXTI_GET_FLAG(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_GET_FLAG() +#define __HAL_PVD_EXTI_CLEAR_FLAG(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_CLEAR_FLAG() +#define __HAL_PVD_EXTI_GENERATE_SWIT(PWR_EXTI_LINE_PVD) __HAL_PWR_PVD_EXTI_GENERATE_SWIT() +#else +#define __HAL_PVD_EXTI_CLEAR_FLAG __HAL_PWR_PVD_EXTI_CLEAR_FLAG +#define __HAL_PVD_EXTI_DISABLE_IT __HAL_PWR_PVD_EXTI_DISABLE_IT +#define __HAL_PVD_EXTI_ENABLE_IT __HAL_PWR_PVD_EXTI_ENABLE_IT +#define __HAL_PVD_EXTI_GENERATE_SWIT __HAL_PWR_PVD_EXTI_GENERATE_SWIT +#define __HAL_PVD_EXTI_GET_FLAG __HAL_PWR_PVD_EXTI_GET_FLAG +#endif /* STM32F4 */ +/** + * @} + */ + + +/** @defgroup HAL_RCC_Aliased HAL RCC Aliased maintained for legacy purpose + * @{ + */ + +#define RCC_StopWakeUpClock_MSI RCC_STOP_WAKEUPCLOCK_MSI +#define RCC_StopWakeUpClock_HSI RCC_STOP_WAKEUPCLOCK_HSI + +#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 __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 +#define __ADC3_CLK_ENABLE __HAL_RCC_ADC3_CLK_ENABLE +#define __ADC3_FORCE_RESET __HAL_RCC_ADC3_FORCE_RESET +#define __ADC3_RELEASE_RESET __HAL_RCC_ADC3_RELEASE_RESET +#define __AES_CLK_DISABLE __HAL_RCC_AES_CLK_DISABLE +#define __AES_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE +#define __AES_CLK_SLEEP_DISABLE __HAL_RCC_AES_CLK_SLEEP_DISABLE +#define __AES_CLK_SLEEP_ENABLE __HAL_RCC_AES_CLK_SLEEP_ENABLE +#define __AES_FORCE_RESET __HAL_RCC_AES_FORCE_RESET +#define __AES_RELEASE_RESET __HAL_RCC_AES_RELEASE_RESET +#define __CRYP_CLK_SLEEP_ENABLE __HAL_RCC_CRYP_CLK_SLEEP_ENABLE +#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_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 +#define __AFIO_FORCE_RESET __HAL_RCC_AFIO_FORCE_RESET +#define __AFIO_RELEASE_RESET __HAL_RCC_AFIO_RELEASE_RESET +#define __AHB_FORCE_RESET __HAL_RCC_AHB_FORCE_RESET +#define __AHB_RELEASE_RESET __HAL_RCC_AHB_RELEASE_RESET +#define __AHB1_FORCE_RESET __HAL_RCC_AHB1_FORCE_RESET +#define __AHB1_RELEASE_RESET __HAL_RCC_AHB1_RELEASE_RESET +#define __AHB2_FORCE_RESET __HAL_RCC_AHB2_FORCE_RESET +#define __AHB2_RELEASE_RESET __HAL_RCC_AHB2_RELEASE_RESET +#define __AHB3_FORCE_RESET __HAL_RCC_AHB3_FORCE_RESET +#define __AHB3_RELEASE_RESET __HAL_RCC_AHB3_RELEASE_RESET +#define __APB1_FORCE_RESET __HAL_RCC_APB1_FORCE_RESET +#define __APB1_RELEASE_RESET __HAL_RCC_APB1_RELEASE_RESET +#define __APB2_FORCE_RESET __HAL_RCC_APB2_FORCE_RESET +#define __APB2_RELEASE_RESET __HAL_RCC_APB2_RELEASE_RESET +#define __BKP_CLK_DISABLE __HAL_RCC_BKP_CLK_DISABLE +#define __BKP_CLK_ENABLE __HAL_RCC_BKP_CLK_ENABLE +#define __BKP_FORCE_RESET __HAL_RCC_BKP_FORCE_RESET +#define __BKP_RELEASE_RESET __HAL_RCC_BKP_RELEASE_RESET +#define __CAN1_CLK_DISABLE __HAL_RCC_CAN1_CLK_DISABLE +#define __CAN1_CLK_ENABLE __HAL_RCC_CAN1_CLK_ENABLE +#define __CAN1_CLK_SLEEP_DISABLE __HAL_RCC_CAN1_CLK_SLEEP_DISABLE +#define __CAN1_CLK_SLEEP_ENABLE __HAL_RCC_CAN1_CLK_SLEEP_ENABLE +#define __CAN1_FORCE_RESET __HAL_RCC_CAN1_FORCE_RESET +#define __CAN1_RELEASE_RESET __HAL_RCC_CAN1_RELEASE_RESET +#define __CAN_CLK_DISABLE __HAL_RCC_CAN1_CLK_DISABLE +#define __CAN_CLK_ENABLE __HAL_RCC_CAN1_CLK_ENABLE +#define __CAN_FORCE_RESET __HAL_RCC_CAN1_FORCE_RESET +#define __CAN_RELEASE_RESET __HAL_RCC_CAN1_RELEASE_RESET +#define __CAN2_CLK_DISABLE __HAL_RCC_CAN2_CLK_DISABLE +#define __CAN2_CLK_ENABLE __HAL_RCC_CAN2_CLK_ENABLE +#define __CAN2_FORCE_RESET __HAL_RCC_CAN2_FORCE_RESET +#define __CAN2_RELEASE_RESET __HAL_RCC_CAN2_RELEASE_RESET +#define __CEC_CLK_DISABLE __HAL_RCC_CEC_CLK_DISABLE +#define __CEC_CLK_ENABLE __HAL_RCC_CEC_CLK_ENABLE +#define __COMP_CLK_DISABLE __HAL_RCC_COMP_CLK_DISABLE +#define __COMP_CLK_ENABLE __HAL_RCC_COMP_CLK_ENABLE +#define __COMP_FORCE_RESET __HAL_RCC_COMP_FORCE_RESET +#define __COMP_RELEASE_RESET __HAL_RCC_COMP_RELEASE_RESET +#define __COMP_CLK_SLEEP_ENABLE __HAL_RCC_COMP_CLK_SLEEP_ENABLE +#define __COMP_CLK_SLEEP_DISABLE __HAL_RCC_COMP_CLK_SLEEP_DISABLE +#define __CEC_FORCE_RESET __HAL_RCC_CEC_FORCE_RESET +#define __CEC_RELEASE_RESET __HAL_RCC_CEC_RELEASE_RESET +#define __CRC_CLK_DISABLE __HAL_RCC_CRC_CLK_DISABLE +#define __CRC_CLK_ENABLE __HAL_RCC_CRC_CLK_ENABLE +#define __CRC_CLK_SLEEP_DISABLE __HAL_RCC_CRC_CLK_SLEEP_DISABLE +#define __CRC_CLK_SLEEP_ENABLE __HAL_RCC_CRC_CLK_SLEEP_ENABLE +#define __CRC_FORCE_RESET __HAL_RCC_CRC_FORCE_RESET +#define __CRC_RELEASE_RESET __HAL_RCC_CRC_RELEASE_RESET +#define __DAC_CLK_DISABLE __HAL_RCC_DAC_CLK_DISABLE +#define __DAC_CLK_ENABLE __HAL_RCC_DAC_CLK_ENABLE +#define __DAC_FORCE_RESET __HAL_RCC_DAC_FORCE_RESET +#define __DAC_RELEASE_RESET __HAL_RCC_DAC_RELEASE_RESET +#define __DAC1_CLK_DISABLE __HAL_RCC_DAC1_CLK_DISABLE +#define __DAC1_CLK_ENABLE __HAL_RCC_DAC1_CLK_ENABLE +#define __DAC1_CLK_SLEEP_DISABLE __HAL_RCC_DAC1_CLK_SLEEP_DISABLE +#define __DAC1_CLK_SLEEP_ENABLE __HAL_RCC_DAC1_CLK_SLEEP_ENABLE +#define __DAC1_FORCE_RESET __HAL_RCC_DAC1_FORCE_RESET +#define __DAC1_RELEASE_RESET __HAL_RCC_DAC1_RELEASE_RESET +#define __DBGMCU_CLK_ENABLE __HAL_RCC_DBGMCU_CLK_ENABLE +#define __DBGMCU_CLK_DISABLE __HAL_RCC_DBGMCU_CLK_DISABLE +#define __DBGMCU_FORCE_RESET __HAL_RCC_DBGMCU_FORCE_RESET +#define __DBGMCU_RELEASE_RESET __HAL_RCC_DBGMCU_RELEASE_RESET +#define __DFSDM_CLK_DISABLE __HAL_RCC_DFSDM_CLK_DISABLE +#define __DFSDM_CLK_ENABLE __HAL_RCC_DFSDM_CLK_ENABLE +#define __DFSDM_CLK_SLEEP_DISABLE __HAL_RCC_DFSDM_CLK_SLEEP_DISABLE +#define __DFSDM_CLK_SLEEP_ENABLE __HAL_RCC_DFSDM_CLK_SLEEP_ENABLE +#define __DFSDM_FORCE_RESET __HAL_RCC_DFSDM_FORCE_RESET +#define __DFSDM_RELEASE_RESET __HAL_RCC_DFSDM_RELEASE_RESET +#define __DMA1_CLK_DISABLE __HAL_RCC_DMA1_CLK_DISABLE +#define __DMA1_CLK_ENABLE __HAL_RCC_DMA1_CLK_ENABLE +#define __DMA1_CLK_SLEEP_DISABLE __HAL_RCC_DMA1_CLK_SLEEP_DISABLE +#define __DMA1_CLK_SLEEP_ENABLE __HAL_RCC_DMA1_CLK_SLEEP_ENABLE +#define __DMA1_FORCE_RESET __HAL_RCC_DMA1_FORCE_RESET +#define __DMA1_RELEASE_RESET __HAL_RCC_DMA1_RELEASE_RESET +#define __DMA2_CLK_DISABLE __HAL_RCC_DMA2_CLK_DISABLE +#define __DMA2_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE +#define __DMA2_CLK_SLEEP_DISABLE __HAL_RCC_DMA2_CLK_SLEEP_DISABLE +#define __DMA2_CLK_SLEEP_ENABLE __HAL_RCC_DMA2_CLK_SLEEP_ENABLE +#define __DMA2_FORCE_RESET __HAL_RCC_DMA2_FORCE_RESET +#define __DMA2_RELEASE_RESET __HAL_RCC_DMA2_RELEASE_RESET +#define __ETHMAC_CLK_DISABLE __HAL_RCC_ETHMAC_CLK_DISABLE +#define __ETHMAC_CLK_ENABLE __HAL_RCC_ETHMAC_CLK_ENABLE +#define __ETHMAC_FORCE_RESET __HAL_RCC_ETHMAC_FORCE_RESET +#define __ETHMAC_RELEASE_RESET __HAL_RCC_ETHMAC_RELEASE_RESET +#define __ETHMACRX_CLK_DISABLE __HAL_RCC_ETHMACRX_CLK_DISABLE +#define __ETHMACRX_CLK_ENABLE __HAL_RCC_ETHMACRX_CLK_ENABLE +#define __ETHMACTX_CLK_DISABLE __HAL_RCC_ETHMACTX_CLK_DISABLE +#define __ETHMACTX_CLK_ENABLE __HAL_RCC_ETHMACTX_CLK_ENABLE +#define __FIREWALL_CLK_DISABLE __HAL_RCC_FIREWALL_CLK_DISABLE +#define __FIREWALL_CLK_ENABLE __HAL_RCC_FIREWALL_CLK_ENABLE +#define __FLASH_CLK_DISABLE __HAL_RCC_FLASH_CLK_DISABLE +#define __FLASH_CLK_ENABLE __HAL_RCC_FLASH_CLK_ENABLE +#define __FLASH_CLK_SLEEP_DISABLE __HAL_RCC_FLASH_CLK_SLEEP_DISABLE +#define __FLASH_CLK_SLEEP_ENABLE __HAL_RCC_FLASH_CLK_SLEEP_ENABLE +#define __FLASH_FORCE_RESET __HAL_RCC_FLASH_FORCE_RESET +#define __FLASH_RELEASE_RESET __HAL_RCC_FLASH_RELEASE_RESET +#define __FLITF_CLK_DISABLE __HAL_RCC_FLITF_CLK_DISABLE +#define __FLITF_CLK_ENABLE __HAL_RCC_FLITF_CLK_ENABLE +#define __FLITF_FORCE_RESET __HAL_RCC_FLITF_FORCE_RESET +#define __FLITF_RELEASE_RESET __HAL_RCC_FLITF_RELEASE_RESET +#define __FLITF_CLK_SLEEP_ENABLE __HAL_RCC_FLITF_CLK_SLEEP_ENABLE +#define __FLITF_CLK_SLEEP_DISABLE __HAL_RCC_FLITF_CLK_SLEEP_DISABLE +#define __FMC_CLK_DISABLE __HAL_RCC_FMC_CLK_DISABLE +#define __FMC_CLK_ENABLE __HAL_RCC_FMC_CLK_ENABLE +#define __FMC_CLK_SLEEP_DISABLE __HAL_RCC_FMC_CLK_SLEEP_DISABLE +#define __FMC_CLK_SLEEP_ENABLE __HAL_RCC_FMC_CLK_SLEEP_ENABLE +#define __FMC_FORCE_RESET __HAL_RCC_FMC_FORCE_RESET +#define __FMC_RELEASE_RESET __HAL_RCC_FMC_RELEASE_RESET +#define __FSMC_CLK_DISABLE __HAL_RCC_FSMC_CLK_DISABLE +#define __FSMC_CLK_ENABLE __HAL_RCC_FSMC_CLK_ENABLE +#define __GPIOA_CLK_DISABLE __HAL_RCC_GPIOA_CLK_DISABLE +#define __GPIOA_CLK_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE +#define __GPIOA_CLK_SLEEP_DISABLE __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE +#define __GPIOA_CLK_SLEEP_ENABLE __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE +#define __GPIOA_FORCE_RESET __HAL_RCC_GPIOA_FORCE_RESET +#define __GPIOA_RELEASE_RESET __HAL_RCC_GPIOA_RELEASE_RESET +#define __GPIOB_CLK_DISABLE __HAL_RCC_GPIOB_CLK_DISABLE +#define __GPIOB_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE +#define __GPIOB_CLK_SLEEP_DISABLE __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE +#define __GPIOB_CLK_SLEEP_ENABLE __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE +#define __GPIOB_FORCE_RESET __HAL_RCC_GPIOB_FORCE_RESET +#define __GPIOB_RELEASE_RESET __HAL_RCC_GPIOB_RELEASE_RESET +#define __GPIOC_CLK_DISABLE __HAL_RCC_GPIOC_CLK_DISABLE +#define __GPIOC_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE +#define __GPIOC_CLK_SLEEP_DISABLE __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE +#define __GPIOC_CLK_SLEEP_ENABLE __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE +#define __GPIOC_FORCE_RESET __HAL_RCC_GPIOC_FORCE_RESET +#define __GPIOC_RELEASE_RESET __HAL_RCC_GPIOC_RELEASE_RESET +#define __GPIOD_CLK_DISABLE __HAL_RCC_GPIOD_CLK_DISABLE +#define __GPIOD_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE +#define __GPIOD_CLK_SLEEP_DISABLE __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE +#define __GPIOD_CLK_SLEEP_ENABLE __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE +#define __GPIOD_FORCE_RESET __HAL_RCC_GPIOD_FORCE_RESET +#define __GPIOD_RELEASE_RESET __HAL_RCC_GPIOD_RELEASE_RESET +#define __GPIOE_CLK_DISABLE __HAL_RCC_GPIOE_CLK_DISABLE +#define __GPIOE_CLK_ENABLE __HAL_RCC_GPIOE_CLK_ENABLE +#define __GPIOE_CLK_SLEEP_DISABLE __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE +#define __GPIOE_CLK_SLEEP_ENABLE __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE +#define __GPIOE_FORCE_RESET __HAL_RCC_GPIOE_FORCE_RESET +#define __GPIOE_RELEASE_RESET __HAL_RCC_GPIOE_RELEASE_RESET +#define __GPIOF_CLK_DISABLE __HAL_RCC_GPIOF_CLK_DISABLE +#define __GPIOF_CLK_ENABLE __HAL_RCC_GPIOF_CLK_ENABLE +#define __GPIOF_CLK_SLEEP_DISABLE __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE +#define __GPIOF_CLK_SLEEP_ENABLE __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE +#define __GPIOF_FORCE_RESET __HAL_RCC_GPIOF_FORCE_RESET +#define __GPIOF_RELEASE_RESET __HAL_RCC_GPIOF_RELEASE_RESET +#define __GPIOG_CLK_DISABLE __HAL_RCC_GPIOG_CLK_DISABLE +#define __GPIOG_CLK_ENABLE __HAL_RCC_GPIOG_CLK_ENABLE +#define __GPIOG_CLK_SLEEP_DISABLE __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE +#define __GPIOG_CLK_SLEEP_ENABLE __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE +#define __GPIOG_FORCE_RESET __HAL_RCC_GPIOG_FORCE_RESET +#define __GPIOG_RELEASE_RESET __HAL_RCC_GPIOG_RELEASE_RESET +#define __GPIOH_CLK_DISABLE __HAL_RCC_GPIOH_CLK_DISABLE +#define __GPIOH_CLK_ENABLE __HAL_RCC_GPIOH_CLK_ENABLE +#define __GPIOH_CLK_SLEEP_DISABLE __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE +#define __GPIOH_CLK_SLEEP_ENABLE __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE +#define __GPIOH_FORCE_RESET __HAL_RCC_GPIOH_FORCE_RESET +#define __GPIOH_RELEASE_RESET __HAL_RCC_GPIOH_RELEASE_RESET +#define __I2C1_CLK_DISABLE __HAL_RCC_I2C1_CLK_DISABLE +#define __I2C1_CLK_ENABLE __HAL_RCC_I2C1_CLK_ENABLE +#define __I2C1_CLK_SLEEP_DISABLE __HAL_RCC_I2C1_CLK_SLEEP_DISABLE +#define __I2C1_CLK_SLEEP_ENABLE __HAL_RCC_I2C1_CLK_SLEEP_ENABLE +#define __I2C1_FORCE_RESET __HAL_RCC_I2C1_FORCE_RESET +#define __I2C1_RELEASE_RESET __HAL_RCC_I2C1_RELEASE_RESET +#define __I2C2_CLK_DISABLE __HAL_RCC_I2C2_CLK_DISABLE +#define __I2C2_CLK_ENABLE __HAL_RCC_I2C2_CLK_ENABLE +#define __I2C2_CLK_SLEEP_DISABLE __HAL_RCC_I2C2_CLK_SLEEP_DISABLE +#define __I2C2_CLK_SLEEP_ENABLE __HAL_RCC_I2C2_CLK_SLEEP_ENABLE +#define __I2C2_FORCE_RESET __HAL_RCC_I2C2_FORCE_RESET +#define __I2C2_RELEASE_RESET __HAL_RCC_I2C2_RELEASE_RESET +#define __I2C3_CLK_DISABLE __HAL_RCC_I2C3_CLK_DISABLE +#define __I2C3_CLK_ENABLE __HAL_RCC_I2C3_CLK_ENABLE +#define __I2C3_CLK_SLEEP_DISABLE __HAL_RCC_I2C3_CLK_SLEEP_DISABLE +#define __I2C3_CLK_SLEEP_ENABLE __HAL_RCC_I2C3_CLK_SLEEP_ENABLE +#define __I2C3_FORCE_RESET __HAL_RCC_I2C3_FORCE_RESET +#define __I2C3_RELEASE_RESET __HAL_RCC_I2C3_RELEASE_RESET +#define __LCD_CLK_DISABLE __HAL_RCC_LCD_CLK_DISABLE +#define __LCD_CLK_ENABLE __HAL_RCC_LCD_CLK_ENABLE +#define __LCD_CLK_SLEEP_DISABLE __HAL_RCC_LCD_CLK_SLEEP_DISABLE +#define __LCD_CLK_SLEEP_ENABLE __HAL_RCC_LCD_CLK_SLEEP_ENABLE +#define __LCD_FORCE_RESET __HAL_RCC_LCD_FORCE_RESET +#define __LCD_RELEASE_RESET __HAL_RCC_LCD_RELEASE_RESET +#define __LPTIM1_CLK_DISABLE __HAL_RCC_LPTIM1_CLK_DISABLE +#define __LPTIM1_CLK_ENABLE __HAL_RCC_LPTIM1_CLK_ENABLE +#define __LPTIM1_CLK_SLEEP_DISABLE __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE +#define __LPTIM1_CLK_SLEEP_ENABLE __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE +#define __LPTIM1_FORCE_RESET __HAL_RCC_LPTIM1_FORCE_RESET +#define __LPTIM1_RELEASE_RESET __HAL_RCC_LPTIM1_RELEASE_RESET +#define __LPTIM2_CLK_DISABLE __HAL_RCC_LPTIM2_CLK_DISABLE +#define __LPTIM2_CLK_ENABLE __HAL_RCC_LPTIM2_CLK_ENABLE +#define __LPTIM2_CLK_SLEEP_DISABLE __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE +#define __LPTIM2_CLK_SLEEP_ENABLE __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE +#define __LPTIM2_FORCE_RESET __HAL_RCC_LPTIM2_FORCE_RESET +#define __LPTIM2_RELEASE_RESET __HAL_RCC_LPTIM2_RELEASE_RESET +#define __LPUART1_CLK_DISABLE __HAL_RCC_LPUART1_CLK_DISABLE +#define __LPUART1_CLK_ENABLE __HAL_RCC_LPUART1_CLK_ENABLE +#define __LPUART1_CLK_SLEEP_DISABLE __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE +#define __LPUART1_CLK_SLEEP_ENABLE __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE +#define __LPUART1_FORCE_RESET __HAL_RCC_LPUART1_FORCE_RESET +#define __LPUART1_RELEASE_RESET __HAL_RCC_LPUART1_RELEASE_RESET +#define __OPAMP_CLK_DISABLE __HAL_RCC_OPAMP_CLK_DISABLE +#define __OPAMP_CLK_ENABLE __HAL_RCC_OPAMP_CLK_ENABLE +#define __OPAMP_CLK_SLEEP_DISABLE __HAL_RCC_OPAMP_CLK_SLEEP_DISABLE +#define __OPAMP_CLK_SLEEP_ENABLE __HAL_RCC_OPAMP_CLK_SLEEP_ENABLE +#define __OPAMP_FORCE_RESET __HAL_RCC_OPAMP_FORCE_RESET +#define __OPAMP_RELEASE_RESET __HAL_RCC_OPAMP_RELEASE_RESET +#define __OTGFS_CLK_DISABLE __HAL_RCC_OTGFS_CLK_DISABLE +#define __OTGFS_CLK_ENABLE __HAL_RCC_OTGFS_CLK_ENABLE +#define __OTGFS_CLK_SLEEP_DISABLE __HAL_RCC_OTGFS_CLK_SLEEP_DISABLE +#define __OTGFS_CLK_SLEEP_ENABLE __HAL_RCC_OTGFS_CLK_SLEEP_ENABLE +#define __OTGFS_FORCE_RESET __HAL_RCC_OTGFS_FORCE_RESET +#define __OTGFS_RELEASE_RESET __HAL_RCC_OTGFS_RELEASE_RESET +#define __PWR_CLK_DISABLE __HAL_RCC_PWR_CLK_DISABLE +#define __PWR_CLK_ENABLE __HAL_RCC_PWR_CLK_ENABLE +#define __PWR_CLK_SLEEP_DISABLE __HAL_RCC_PWR_CLK_SLEEP_DISABLE +#define __PWR_CLK_SLEEP_ENABLE __HAL_RCC_PWR_CLK_SLEEP_ENABLE +#define __PWR_FORCE_RESET __HAL_RCC_PWR_FORCE_RESET +#define __PWR_RELEASE_RESET __HAL_RCC_PWR_RELEASE_RESET +#define __QSPI_CLK_DISABLE __HAL_RCC_QSPI_CLK_DISABLE +#define __QSPI_CLK_ENABLE __HAL_RCC_QSPI_CLK_ENABLE +#define __QSPI_CLK_SLEEP_DISABLE __HAL_RCC_QSPI_CLK_SLEEP_DISABLE +#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 +#define __RNG_CLK_SLEEP_ENABLE __HAL_RCC_RNG_CLK_SLEEP_ENABLE +#define __RNG_FORCE_RESET __HAL_RCC_RNG_FORCE_RESET +#define __RNG_RELEASE_RESET __HAL_RCC_RNG_RELEASE_RESET +#define __SAI1_CLK_DISABLE __HAL_RCC_SAI1_CLK_DISABLE +#define __SAI1_CLK_ENABLE __HAL_RCC_SAI1_CLK_ENABLE +#define __SAI1_CLK_SLEEP_DISABLE __HAL_RCC_SAI1_CLK_SLEEP_DISABLE +#define __SAI1_CLK_SLEEP_ENABLE __HAL_RCC_SAI1_CLK_SLEEP_ENABLE +#define __SAI1_FORCE_RESET __HAL_RCC_SAI1_FORCE_RESET +#define __SAI1_RELEASE_RESET __HAL_RCC_SAI1_RELEASE_RESET +#define __SAI2_CLK_DISABLE __HAL_RCC_SAI2_CLK_DISABLE +#define __SAI2_CLK_ENABLE __HAL_RCC_SAI2_CLK_ENABLE +#define __SAI2_CLK_SLEEP_DISABLE __HAL_RCC_SAI2_CLK_SLEEP_DISABLE +#define __SAI2_CLK_SLEEP_ENABLE __HAL_RCC_SAI2_CLK_SLEEP_ENABLE +#define __SAI2_FORCE_RESET __HAL_RCC_SAI2_FORCE_RESET +#define __SAI2_RELEASE_RESET __HAL_RCC_SAI2_RELEASE_RESET +#define __SDIO_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE +#define __SDIO_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE +#define __SDMMC_CLK_DISABLE __HAL_RCC_SDMMC_CLK_DISABLE +#define __SDMMC_CLK_ENABLE __HAL_RCC_SDMMC_CLK_ENABLE +#define __SDMMC_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC_CLK_SLEEP_DISABLE +#define __SDMMC_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC_CLK_SLEEP_ENABLE +#define __SDMMC_FORCE_RESET __HAL_RCC_SDMMC_FORCE_RESET +#define __SDMMC_RELEASE_RESET __HAL_RCC_SDMMC_RELEASE_RESET +#define __SPI1_CLK_DISABLE __HAL_RCC_SPI1_CLK_DISABLE +#define __SPI1_CLK_ENABLE __HAL_RCC_SPI1_CLK_ENABLE +#define __SPI1_CLK_SLEEP_DISABLE __HAL_RCC_SPI1_CLK_SLEEP_DISABLE +#define __SPI1_CLK_SLEEP_ENABLE __HAL_RCC_SPI1_CLK_SLEEP_ENABLE +#define __SPI1_FORCE_RESET __HAL_RCC_SPI1_FORCE_RESET +#define __SPI1_RELEASE_RESET __HAL_RCC_SPI1_RELEASE_RESET +#define __SPI2_CLK_DISABLE __HAL_RCC_SPI2_CLK_DISABLE +#define __SPI2_CLK_ENABLE __HAL_RCC_SPI2_CLK_ENABLE +#define __SPI2_CLK_SLEEP_DISABLE __HAL_RCC_SPI2_CLK_SLEEP_DISABLE +#define __SPI2_CLK_SLEEP_ENABLE __HAL_RCC_SPI2_CLK_SLEEP_ENABLE +#define __SPI2_FORCE_RESET __HAL_RCC_SPI2_FORCE_RESET +#define __SPI2_RELEASE_RESET __HAL_RCC_SPI2_RELEASE_RESET +#define __SPI3_CLK_DISABLE __HAL_RCC_SPI3_CLK_DISABLE +#define __SPI3_CLK_ENABLE __HAL_RCC_SPI3_CLK_ENABLE +#define __SPI3_CLK_SLEEP_DISABLE __HAL_RCC_SPI3_CLK_SLEEP_DISABLE +#define __SPI3_CLK_SLEEP_ENABLE __HAL_RCC_SPI3_CLK_SLEEP_ENABLE +#define __SPI3_FORCE_RESET __HAL_RCC_SPI3_FORCE_RESET +#define __SPI3_RELEASE_RESET __HAL_RCC_SPI3_RELEASE_RESET +#define __SRAM_CLK_DISABLE __HAL_RCC_SRAM_CLK_DISABLE +#define __SRAM_CLK_ENABLE __HAL_RCC_SRAM_CLK_ENABLE +#define __SRAM1_CLK_SLEEP_DISABLE __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE +#define __SRAM1_CLK_SLEEP_ENABLE __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE +#define __SRAM2_CLK_SLEEP_DISABLE __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE +#define __SRAM2_CLK_SLEEP_ENABLE __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE +#define __SWPMI1_CLK_DISABLE __HAL_RCC_SWPMI1_CLK_DISABLE +#define __SWPMI1_CLK_ENABLE __HAL_RCC_SWPMI1_CLK_ENABLE +#define __SWPMI1_CLK_SLEEP_DISABLE __HAL_RCC_SWPMI1_CLK_SLEEP_DISABLE +#define __SWPMI1_CLK_SLEEP_ENABLE __HAL_RCC_SWPMI1_CLK_SLEEP_ENABLE +#define __SWPMI1_FORCE_RESET __HAL_RCC_SWPMI1_FORCE_RESET +#define __SWPMI1_RELEASE_RESET __HAL_RCC_SWPMI1_RELEASE_RESET +#define __SYSCFG_CLK_DISABLE __HAL_RCC_SYSCFG_CLK_DISABLE +#define __SYSCFG_CLK_ENABLE __HAL_RCC_SYSCFG_CLK_ENABLE +#define __SYSCFG_CLK_SLEEP_DISABLE __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE +#define __SYSCFG_CLK_SLEEP_ENABLE __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE +#define __SYSCFG_FORCE_RESET __HAL_RCC_SYSCFG_FORCE_RESET +#define __SYSCFG_RELEASE_RESET __HAL_RCC_SYSCFG_RELEASE_RESET +#define __TIM1_CLK_DISABLE __HAL_RCC_TIM1_CLK_DISABLE +#define __TIM1_CLK_ENABLE __HAL_RCC_TIM1_CLK_ENABLE +#define __TIM1_CLK_SLEEP_DISABLE __HAL_RCC_TIM1_CLK_SLEEP_DISABLE +#define __TIM1_CLK_SLEEP_ENABLE __HAL_RCC_TIM1_CLK_SLEEP_ENABLE +#define __TIM1_FORCE_RESET __HAL_RCC_TIM1_FORCE_RESET +#define __TIM1_RELEASE_RESET __HAL_RCC_TIM1_RELEASE_RESET +#define __TIM10_CLK_DISABLE __HAL_RCC_TIM10_CLK_DISABLE +#define __TIM10_CLK_ENABLE __HAL_RCC_TIM10_CLK_ENABLE +#define __TIM10_FORCE_RESET __HAL_RCC_TIM10_FORCE_RESET +#define __TIM10_RELEASE_RESET __HAL_RCC_TIM10_RELEASE_RESET +#define __TIM11_CLK_DISABLE __HAL_RCC_TIM11_CLK_DISABLE +#define __TIM11_CLK_ENABLE __HAL_RCC_TIM11_CLK_ENABLE +#define __TIM11_FORCE_RESET __HAL_RCC_TIM11_FORCE_RESET +#define __TIM11_RELEASE_RESET __HAL_RCC_TIM11_RELEASE_RESET +#define __TIM12_CLK_DISABLE __HAL_RCC_TIM12_CLK_DISABLE +#define __TIM12_CLK_ENABLE __HAL_RCC_TIM12_CLK_ENABLE +#define __TIM12_FORCE_RESET __HAL_RCC_TIM12_FORCE_RESET +#define __TIM12_RELEASE_RESET __HAL_RCC_TIM12_RELEASE_RESET +#define __TIM13_CLK_DISABLE __HAL_RCC_TIM13_CLK_DISABLE +#define __TIM13_CLK_ENABLE __HAL_RCC_TIM13_CLK_ENABLE +#define __TIM13_FORCE_RESET __HAL_RCC_TIM13_FORCE_RESET +#define __TIM13_RELEASE_RESET __HAL_RCC_TIM13_RELEASE_RESET +#define __TIM14_CLK_DISABLE __HAL_RCC_TIM14_CLK_DISABLE +#define __TIM14_CLK_ENABLE __HAL_RCC_TIM14_CLK_ENABLE +#define __TIM14_FORCE_RESET __HAL_RCC_TIM14_FORCE_RESET +#define __TIM14_RELEASE_RESET __HAL_RCC_TIM14_RELEASE_RESET +#define __TIM15_CLK_DISABLE __HAL_RCC_TIM15_CLK_DISABLE +#define __TIM15_CLK_ENABLE __HAL_RCC_TIM15_CLK_ENABLE +#define __TIM15_CLK_SLEEP_DISABLE __HAL_RCC_TIM15_CLK_SLEEP_DISABLE +#define __TIM15_CLK_SLEEP_ENABLE __HAL_RCC_TIM15_CLK_SLEEP_ENABLE +#define __TIM15_FORCE_RESET __HAL_RCC_TIM15_FORCE_RESET +#define __TIM15_RELEASE_RESET __HAL_RCC_TIM15_RELEASE_RESET +#define __TIM16_CLK_DISABLE __HAL_RCC_TIM16_CLK_DISABLE +#define __TIM16_CLK_ENABLE __HAL_RCC_TIM16_CLK_ENABLE +#define __TIM16_CLK_SLEEP_DISABLE __HAL_RCC_TIM16_CLK_SLEEP_DISABLE +#define __TIM16_CLK_SLEEP_ENABLE __HAL_RCC_TIM16_CLK_SLEEP_ENABLE +#define __TIM16_FORCE_RESET __HAL_RCC_TIM16_FORCE_RESET +#define __TIM16_RELEASE_RESET __HAL_RCC_TIM16_RELEASE_RESET +#define __TIM17_CLK_DISABLE __HAL_RCC_TIM17_CLK_DISABLE +#define __TIM17_CLK_ENABLE __HAL_RCC_TIM17_CLK_ENABLE +#define __TIM17_CLK_SLEEP_DISABLE __HAL_RCC_TIM17_CLK_SLEEP_DISABLE +#define __TIM17_CLK_SLEEP_ENABLE __HAL_RCC_TIM17_CLK_SLEEP_ENABLE +#define __TIM17_FORCE_RESET __HAL_RCC_TIM17_FORCE_RESET +#define __TIM17_RELEASE_RESET __HAL_RCC_TIM17_RELEASE_RESET +#define __TIM2_CLK_DISABLE __HAL_RCC_TIM2_CLK_DISABLE +#define __TIM2_CLK_ENABLE __HAL_RCC_TIM2_CLK_ENABLE +#define __TIM2_CLK_SLEEP_DISABLE __HAL_RCC_TIM2_CLK_SLEEP_DISABLE +#define __TIM2_CLK_SLEEP_ENABLE __HAL_RCC_TIM2_CLK_SLEEP_ENABLE +#define __TIM2_FORCE_RESET __HAL_RCC_TIM2_FORCE_RESET +#define __TIM2_RELEASE_RESET __HAL_RCC_TIM2_RELEASE_RESET +#define __TIM3_CLK_DISABLE __HAL_RCC_TIM3_CLK_DISABLE +#define __TIM3_CLK_ENABLE __HAL_RCC_TIM3_CLK_ENABLE +#define __TIM3_CLK_SLEEP_DISABLE __HAL_RCC_TIM3_CLK_SLEEP_DISABLE +#define __TIM3_CLK_SLEEP_ENABLE __HAL_RCC_TIM3_CLK_SLEEP_ENABLE +#define __TIM3_FORCE_RESET __HAL_RCC_TIM3_FORCE_RESET +#define __TIM3_RELEASE_RESET __HAL_RCC_TIM3_RELEASE_RESET +#define __TIM4_CLK_DISABLE __HAL_RCC_TIM4_CLK_DISABLE +#define __TIM4_CLK_ENABLE __HAL_RCC_TIM4_CLK_ENABLE +#define __TIM4_CLK_SLEEP_DISABLE __HAL_RCC_TIM4_CLK_SLEEP_DISABLE +#define __TIM4_CLK_SLEEP_ENABLE __HAL_RCC_TIM4_CLK_SLEEP_ENABLE +#define __TIM4_FORCE_RESET __HAL_RCC_TIM4_FORCE_RESET +#define __TIM4_RELEASE_RESET __HAL_RCC_TIM4_RELEASE_RESET +#define __TIM5_CLK_DISABLE __HAL_RCC_TIM5_CLK_DISABLE +#define __TIM5_CLK_ENABLE __HAL_RCC_TIM5_CLK_ENABLE +#define __TIM5_CLK_SLEEP_DISABLE __HAL_RCC_TIM5_CLK_SLEEP_DISABLE +#define __TIM5_CLK_SLEEP_ENABLE __HAL_RCC_TIM5_CLK_SLEEP_ENABLE +#define __TIM5_FORCE_RESET __HAL_RCC_TIM5_FORCE_RESET +#define __TIM5_RELEASE_RESET __HAL_RCC_TIM5_RELEASE_RESET +#define __TIM6_CLK_DISABLE __HAL_RCC_TIM6_CLK_DISABLE +#define __TIM6_CLK_ENABLE __HAL_RCC_TIM6_CLK_ENABLE +#define __TIM6_CLK_SLEEP_DISABLE __HAL_RCC_TIM6_CLK_SLEEP_DISABLE +#define __TIM6_CLK_SLEEP_ENABLE __HAL_RCC_TIM6_CLK_SLEEP_ENABLE +#define __TIM6_FORCE_RESET __HAL_RCC_TIM6_FORCE_RESET +#define __TIM6_RELEASE_RESET __HAL_RCC_TIM6_RELEASE_RESET +#define __TIM7_CLK_DISABLE __HAL_RCC_TIM7_CLK_DISABLE +#define __TIM7_CLK_ENABLE __HAL_RCC_TIM7_CLK_ENABLE +#define __TIM7_CLK_SLEEP_DISABLE __HAL_RCC_TIM7_CLK_SLEEP_DISABLE +#define __TIM7_CLK_SLEEP_ENABLE __HAL_RCC_TIM7_CLK_SLEEP_ENABLE +#define __TIM7_FORCE_RESET __HAL_RCC_TIM7_FORCE_RESET +#define __TIM7_RELEASE_RESET __HAL_RCC_TIM7_RELEASE_RESET +#define __TIM8_CLK_DISABLE __HAL_RCC_TIM8_CLK_DISABLE +#define __TIM8_CLK_ENABLE __HAL_RCC_TIM8_CLK_ENABLE +#define __TIM8_CLK_SLEEP_DISABLE __HAL_RCC_TIM8_CLK_SLEEP_DISABLE +#define __TIM8_CLK_SLEEP_ENABLE __HAL_RCC_TIM8_CLK_SLEEP_ENABLE +#define __TIM8_FORCE_RESET __HAL_RCC_TIM8_FORCE_RESET +#define __TIM8_RELEASE_RESET __HAL_RCC_TIM8_RELEASE_RESET +#define __TIM9_CLK_DISABLE __HAL_RCC_TIM9_CLK_DISABLE +#define __TIM9_CLK_ENABLE __HAL_RCC_TIM9_CLK_ENABLE +#define __TIM9_FORCE_RESET __HAL_RCC_TIM9_FORCE_RESET +#define __TIM9_RELEASE_RESET __HAL_RCC_TIM9_RELEASE_RESET +#define __TSC_CLK_DISABLE __HAL_RCC_TSC_CLK_DISABLE +#define __TSC_CLK_ENABLE __HAL_RCC_TSC_CLK_ENABLE +#define __TSC_CLK_SLEEP_DISABLE __HAL_RCC_TSC_CLK_SLEEP_DISABLE +#define __TSC_CLK_SLEEP_ENABLE __HAL_RCC_TSC_CLK_SLEEP_ENABLE +#define __TSC_FORCE_RESET __HAL_RCC_TSC_FORCE_RESET +#define __TSC_RELEASE_RESET __HAL_RCC_TSC_RELEASE_RESET +#define __UART4_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE +#define __UART4_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE +#define __UART4_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE +#define __UART4_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE +#define __UART4_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET +#define __UART4_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET +#define __UART5_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE +#define __UART5_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE +#define __UART5_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE +#define __UART5_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE +#define __UART5_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET +#define __UART5_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET +#define __USART1_CLK_DISABLE __HAL_RCC_USART1_CLK_DISABLE +#define __USART1_CLK_ENABLE __HAL_RCC_USART1_CLK_ENABLE +#define __USART1_CLK_SLEEP_DISABLE __HAL_RCC_USART1_CLK_SLEEP_DISABLE +#define __USART1_CLK_SLEEP_ENABLE __HAL_RCC_USART1_CLK_SLEEP_ENABLE +#define __USART1_FORCE_RESET __HAL_RCC_USART1_FORCE_RESET +#define __USART1_RELEASE_RESET __HAL_RCC_USART1_RELEASE_RESET +#define __USART2_CLK_DISABLE __HAL_RCC_USART2_CLK_DISABLE +#define __USART2_CLK_ENABLE __HAL_RCC_USART2_CLK_ENABLE +#define __USART2_CLK_SLEEP_DISABLE __HAL_RCC_USART2_CLK_SLEEP_DISABLE +#define __USART2_CLK_SLEEP_ENABLE __HAL_RCC_USART2_CLK_SLEEP_ENABLE +#define __USART2_FORCE_RESET __HAL_RCC_USART2_FORCE_RESET +#define __USART2_RELEASE_RESET __HAL_RCC_USART2_RELEASE_RESET +#define __USART3_CLK_DISABLE __HAL_RCC_USART3_CLK_DISABLE +#define __USART3_CLK_ENABLE __HAL_RCC_USART3_CLK_ENABLE +#define __USART3_CLK_SLEEP_DISABLE __HAL_RCC_USART3_CLK_SLEEP_DISABLE +#define __USART3_CLK_SLEEP_ENABLE __HAL_RCC_USART3_CLK_SLEEP_ENABLE +#define __USART3_FORCE_RESET __HAL_RCC_USART3_FORCE_RESET +#define __USART3_RELEASE_RESET __HAL_RCC_USART3_RELEASE_RESET +#define __USART4_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE +#define __USART4_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE +#define __USART4_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE +#define __USART4_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE +#define __USART4_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET +#define __USART4_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET +#define __USART5_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE +#define __USART5_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE +#define __USART5_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE +#define __USART5_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE +#define __USART5_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET +#define __USART5_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET +#define __USART7_CLK_DISABLE __HAL_RCC_UART7_CLK_DISABLE +#define __USART7_CLK_ENABLE __HAL_RCC_UART7_CLK_ENABLE +#define __USART7_FORCE_RESET __HAL_RCC_UART7_FORCE_RESET +#define __USART7_RELEASE_RESET __HAL_RCC_UART7_RELEASE_RESET +#define __USART8_CLK_DISABLE __HAL_RCC_UART8_CLK_DISABLE +#define __USART8_CLK_ENABLE __HAL_RCC_UART8_CLK_ENABLE +#define __USART8_FORCE_RESET __HAL_RCC_UART8_FORCE_RESET +#define __USART8_RELEASE_RESET __HAL_RCC_UART8_RELEASE_RESET +#define __USB_CLK_DISABLE __HAL_RCC_USB_CLK_DISABLE +#define __USB_CLK_ENABLE __HAL_RCC_USB_CLK_ENABLE +#define __USB_FORCE_RESET __HAL_RCC_USB_FORCE_RESET +#define __USB_CLK_SLEEP_ENABLE __HAL_RCC_USB_CLK_SLEEP_ENABLE +#define __USB_CLK_SLEEP_DISABLE __HAL_RCC_USB_CLK_SLEEP_DISABLE +#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 +#define __TIM21_RELEASE_RESET __HAL_RCC_TIM21_RELEASE_RESET +#define __TIM21_CLK_SLEEP_ENABLE __HAL_RCC_TIM21_CLK_SLEEP_ENABLE +#define __TIM21_CLK_SLEEP_DISABLE __HAL_RCC_TIM21_CLK_SLEEP_DISABLE +#define __TIM22_CLK_ENABLE __HAL_RCC_TIM22_CLK_ENABLE +#define __TIM22_CLK_DISABLE __HAL_RCC_TIM22_CLK_DISABLE +#define __TIM22_FORCE_RESET __HAL_RCC_TIM22_FORCE_RESET +#define __TIM22_RELEASE_RESET __HAL_RCC_TIM22_RELEASE_RESET +#define __TIM22_CLK_SLEEP_ENABLE __HAL_RCC_TIM22_CLK_SLEEP_ENABLE +#define __TIM22_CLK_SLEEP_DISABLE __HAL_RCC_TIM22_CLK_SLEEP_DISABLE +#define __CRS_CLK_DISABLE __HAL_RCC_CRS_CLK_DISABLE +#define __CRS_CLK_ENABLE __HAL_RCC_CRS_CLK_ENABLE +#define __CRS_CLK_SLEEP_DISABLE __HAL_RCC_CRS_CLK_SLEEP_DISABLE +#define __CRS_CLK_SLEEP_ENABLE __HAL_RCC_CRS_CLK_SLEEP_ENABLE +#define __CRS_FORCE_RESET __HAL_RCC_CRS_FORCE_RESET +#define __CRS_RELEASE_RESET __HAL_RCC_CRS_RELEASE_RESET +#define __RCC_BACKUPRESET_FORCE __HAL_RCC_BACKUPRESET_FORCE +#define __RCC_BACKUPRESET_RELEASE __HAL_RCC_BACKUPRESET_RELEASE + +#define __USB_OTG_FS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET +#define __USB_OTG_FS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET +#define __USB_OTG_FS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE +#define __USB_OTG_FS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE +#define __USB_OTG_HS_CLK_DISABLE __HAL_RCC_USB_OTG_HS_CLK_DISABLE +#define __USB_OTG_HS_CLK_ENABLE __HAL_RCC_USB_OTG_HS_CLK_ENABLE +#define __USB_OTG_HS_ULPI_CLK_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE +#define __USB_OTG_HS_ULPI_CLK_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE +#define __TIM9_CLK_SLEEP_ENABLE __HAL_RCC_TIM9_CLK_SLEEP_ENABLE +#define __TIM9_CLK_SLEEP_DISABLE __HAL_RCC_TIM9_CLK_SLEEP_DISABLE +#define __TIM10_CLK_SLEEP_ENABLE __HAL_RCC_TIM10_CLK_SLEEP_ENABLE +#define __TIM10_CLK_SLEEP_DISABLE __HAL_RCC_TIM10_CLK_SLEEP_DISABLE +#define __TIM11_CLK_SLEEP_ENABLE __HAL_RCC_TIM11_CLK_SLEEP_ENABLE +#define __TIM11_CLK_SLEEP_DISABLE __HAL_RCC_TIM11_CLK_SLEEP_DISABLE +#define __ETHMACPTP_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE +#define __ETHMACPTP_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE +#define __ETHMACPTP_CLK_ENABLE __HAL_RCC_ETHMACPTP_CLK_ENABLE +#define __ETHMACPTP_CLK_DISABLE __HAL_RCC_ETHMACPTP_CLK_DISABLE +#define __HASH_CLK_ENABLE __HAL_RCC_HASH_CLK_ENABLE +#define __HASH_FORCE_RESET __HAL_RCC_HASH_FORCE_RESET +#define __HASH_RELEASE_RESET __HAL_RCC_HASH_RELEASE_RESET +#define __HASH_CLK_SLEEP_ENABLE __HAL_RCC_HASH_CLK_SLEEP_ENABLE +#define __HASH_CLK_SLEEP_DISABLE __HAL_RCC_HASH_CLK_SLEEP_DISABLE +#define __HASH_CLK_DISABLE __HAL_RCC_HASH_CLK_DISABLE +#define __SPI5_CLK_ENABLE __HAL_RCC_SPI5_CLK_ENABLE +#define __SPI5_CLK_DISABLE __HAL_RCC_SPI5_CLK_DISABLE +#define __SPI5_FORCE_RESET __HAL_RCC_SPI5_FORCE_RESET +#define __SPI5_RELEASE_RESET __HAL_RCC_SPI5_RELEASE_RESET +#define __SPI5_CLK_SLEEP_ENABLE __HAL_RCC_SPI5_CLK_SLEEP_ENABLE +#define __SPI5_CLK_SLEEP_DISABLE __HAL_RCC_SPI5_CLK_SLEEP_DISABLE +#define __SPI6_CLK_ENABLE __HAL_RCC_SPI6_CLK_ENABLE +#define __SPI6_CLK_DISABLE __HAL_RCC_SPI6_CLK_DISABLE +#define __SPI6_FORCE_RESET __HAL_RCC_SPI6_FORCE_RESET +#define __SPI6_RELEASE_RESET __HAL_RCC_SPI6_RELEASE_RESET +#define __SPI6_CLK_SLEEP_ENABLE __HAL_RCC_SPI6_CLK_SLEEP_ENABLE +#define __SPI6_CLK_SLEEP_DISABLE __HAL_RCC_SPI6_CLK_SLEEP_DISABLE +#define __LTDC_CLK_ENABLE __HAL_RCC_LTDC_CLK_ENABLE +#define __LTDC_CLK_DISABLE __HAL_RCC_LTDC_CLK_DISABLE +#define __LTDC_FORCE_RESET __HAL_RCC_LTDC_FORCE_RESET +#define __LTDC_RELEASE_RESET __HAL_RCC_LTDC_RELEASE_RESET +#define __LTDC_CLK_SLEEP_ENABLE __HAL_RCC_LTDC_CLK_SLEEP_ENABLE +#define __ETHMAC_CLK_SLEEP_ENABLE __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE +#define __ETHMAC_CLK_SLEEP_DISABLE __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE +#define __ETHMACTX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE +#define __ETHMACTX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE +#define __ETHMACRX_CLK_SLEEP_ENABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE +#define __ETHMACRX_CLK_SLEEP_DISABLE __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE +#define __TIM12_CLK_SLEEP_ENABLE __HAL_RCC_TIM12_CLK_SLEEP_ENABLE +#define __TIM12_CLK_SLEEP_DISABLE __HAL_RCC_TIM12_CLK_SLEEP_DISABLE +#define __TIM13_CLK_SLEEP_ENABLE __HAL_RCC_TIM13_CLK_SLEEP_ENABLE +#define __TIM13_CLK_SLEEP_DISABLE __HAL_RCC_TIM13_CLK_SLEEP_DISABLE +#define __TIM14_CLK_SLEEP_ENABLE __HAL_RCC_TIM14_CLK_SLEEP_ENABLE +#define __TIM14_CLK_SLEEP_DISABLE __HAL_RCC_TIM14_CLK_SLEEP_DISABLE +#define __BKPSRAM_CLK_ENABLE __HAL_RCC_BKPSRAM_CLK_ENABLE +#define __BKPSRAM_CLK_DISABLE __HAL_RCC_BKPSRAM_CLK_DISABLE +#define __BKPSRAM_CLK_SLEEP_ENABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE +#define __BKPSRAM_CLK_SLEEP_DISABLE __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE +#define __CCMDATARAMEN_CLK_ENABLE __HAL_RCC_CCMDATARAMEN_CLK_ENABLE +#define __CCMDATARAMEN_CLK_DISABLE __HAL_RCC_CCMDATARAMEN_CLK_DISABLE +#define __USART6_CLK_ENABLE __HAL_RCC_USART6_CLK_ENABLE +#define __USART6_CLK_DISABLE __HAL_RCC_USART6_CLK_DISABLE +#define __USART6_FORCE_RESET __HAL_RCC_USART6_FORCE_RESET +#define __USART6_RELEASE_RESET __HAL_RCC_USART6_RELEASE_RESET +#define __USART6_CLK_SLEEP_ENABLE __HAL_RCC_USART6_CLK_SLEEP_ENABLE +#define __USART6_CLK_SLEEP_DISABLE __HAL_RCC_USART6_CLK_SLEEP_DISABLE +#define __SPI4_CLK_ENABLE __HAL_RCC_SPI4_CLK_ENABLE +#define __SPI4_CLK_DISABLE __HAL_RCC_SPI4_CLK_DISABLE +#define __SPI4_FORCE_RESET __HAL_RCC_SPI4_FORCE_RESET +#define __SPI4_RELEASE_RESET __HAL_RCC_SPI4_RELEASE_RESET +#define __SPI4_CLK_SLEEP_ENABLE __HAL_RCC_SPI4_CLK_SLEEP_ENABLE +#define __SPI4_CLK_SLEEP_DISABLE __HAL_RCC_SPI4_CLK_SLEEP_DISABLE +#define __GPIOI_CLK_ENABLE __HAL_RCC_GPIOI_CLK_ENABLE +#define __GPIOI_CLK_DISABLE __HAL_RCC_GPIOI_CLK_DISABLE +#define __GPIOI_FORCE_RESET __HAL_RCC_GPIOI_FORCE_RESET +#define __GPIOI_RELEASE_RESET __HAL_RCC_GPIOI_RELEASE_RESET +#define __GPIOI_CLK_SLEEP_ENABLE __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE +#define __GPIOI_CLK_SLEEP_DISABLE __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE +#define __GPIOJ_CLK_ENABLE __HAL_RCC_GPIOJ_CLK_ENABLE +#define __GPIOJ_CLK_DISABLE __HAL_RCC_GPIOJ_CLK_DISABLE +#define __GPIOJ_FORCE_RESET __HAL_RCC_GPIOJ_FORCE_RESET +#define __GPIOJ_RELEASE_RESET __HAL_RCC_GPIOJ_RELEASE_RESET +#define __GPIOJ_CLK_SLEEP_ENABLE __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE +#define __GPIOJ_CLK_SLEEP_DISABLE __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE +#define __GPIOK_CLK_ENABLE __HAL_RCC_GPIOK_CLK_ENABLE +#define __GPIOK_CLK_DISABLE __HAL_RCC_GPIOK_CLK_DISABLE +#define __GPIOK_RELEASE_RESET __HAL_RCC_GPIOK_RELEASE_RESET +#define __GPIOK_CLK_SLEEP_ENABLE __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE +#define __GPIOK_CLK_SLEEP_DISABLE __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE +#define __ETH_CLK_ENABLE __HAL_RCC_ETH_CLK_ENABLE +#define __ETH_CLK_DISABLE __HAL_RCC_ETH_CLK_DISABLE +#define __DCMI_CLK_ENABLE __HAL_RCC_DCMI_CLK_ENABLE +#define __DCMI_CLK_DISABLE __HAL_RCC_DCMI_CLK_DISABLE +#define __DCMI_FORCE_RESET __HAL_RCC_DCMI_FORCE_RESET +#define __DCMI_RELEASE_RESET __HAL_RCC_DCMI_RELEASE_RESET +#define __DCMI_CLK_SLEEP_ENABLE __HAL_RCC_DCMI_CLK_SLEEP_ENABLE +#define __DCMI_CLK_SLEEP_DISABLE __HAL_RCC_DCMI_CLK_SLEEP_DISABLE +#define __UART7_CLK_ENABLE __HAL_RCC_UART7_CLK_ENABLE +#define __UART7_CLK_DISABLE __HAL_RCC_UART7_CLK_DISABLE +#define __UART7_RELEASE_RESET __HAL_RCC_UART7_RELEASE_RESET +#define __UART7_FORCE_RESET __HAL_RCC_UART7_FORCE_RESET +#define __UART7_CLK_SLEEP_ENABLE __HAL_RCC_UART7_CLK_SLEEP_ENABLE +#define __UART7_CLK_SLEEP_DISABLE __HAL_RCC_UART7_CLK_SLEEP_DISABLE +#define __UART8_CLK_ENABLE __HAL_RCC_UART8_CLK_ENABLE +#define __UART8_CLK_DISABLE __HAL_RCC_UART8_CLK_DISABLE +#define __UART8_FORCE_RESET __HAL_RCC_UART8_FORCE_RESET +#define __UART8_RELEASE_RESET __HAL_RCC_UART8_RELEASE_RESET +#define __UART8_CLK_SLEEP_ENABLE __HAL_RCC_UART8_CLK_SLEEP_ENABLE +#define __UART8_CLK_SLEEP_DISABLE __HAL_RCC_UART8_CLK_SLEEP_DISABLE +#define __OTGHS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE +#define __OTGHS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE +#define __OTGHS_FORCE_RESET __HAL_RCC_USB_OTG_HS_FORCE_RESET +#define __OTGHS_RELEASE_RESET __HAL_RCC_USB_OTG_HS_RELEASE_RESET +#define __OTGHSULPI_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE +#define __OTGHSULPI_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE +#define __HAL_RCC_OTGHS_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE +#define __HAL_RCC_OTGHS_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE +#define __HAL_RCC_OTGHS_IS_CLK_SLEEP_ENABLED __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_ENABLED +#define __HAL_RCC_OTGHS_IS_CLK_SLEEP_DISABLED __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_DISABLED +#define __HAL_RCC_OTGHS_FORCE_RESET __HAL_RCC_USB_OTG_HS_FORCE_RESET +#define __HAL_RCC_OTGHS_RELEASE_RESET __HAL_RCC_USB_OTG_HS_RELEASE_RESET +#define __HAL_RCC_OTGHSULPI_CLK_SLEEP_ENABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE +#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 __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 +#define __DAC_CLK_SLEEP_ENABLE __HAL_RCC_DAC_CLK_SLEEP_ENABLE +#define __DAC_CLK_SLEEP_DISABLE __HAL_RCC_DAC_CLK_SLEEP_DISABLE +#define __ADC2_CLK_SLEEP_ENABLE __HAL_RCC_ADC2_CLK_SLEEP_ENABLE +#define __ADC2_CLK_SLEEP_DISABLE __HAL_RCC_ADC2_CLK_SLEEP_DISABLE +#define __ADC3_CLK_SLEEP_ENABLE __HAL_RCC_ADC3_CLK_SLEEP_ENABLE +#define __ADC3_CLK_SLEEP_DISABLE __HAL_RCC_ADC3_CLK_SLEEP_DISABLE +#define __FSMC_FORCE_RESET __HAL_RCC_FSMC_FORCE_RESET +#define __FSMC_RELEASE_RESET __HAL_RCC_FSMC_RELEASE_RESET +#define __FSMC_CLK_SLEEP_ENABLE __HAL_RCC_FSMC_CLK_SLEEP_ENABLE +#define __FSMC_CLK_SLEEP_DISABLE __HAL_RCC_FSMC_CLK_SLEEP_DISABLE +#define __SDIO_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET +#define __SDIO_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET +#define __SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE +#define __SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE +#define __DMA2D_CLK_ENABLE __HAL_RCC_DMA2D_CLK_ENABLE +#define __DMA2D_CLK_DISABLE __HAL_RCC_DMA2D_CLK_DISABLE +#define __DMA2D_FORCE_RESET __HAL_RCC_DMA2D_FORCE_RESET +#define __DMA2D_RELEASE_RESET __HAL_RCC_DMA2D_RELEASE_RESET +#define __DMA2D_CLK_SLEEP_ENABLE __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE +#define __DMA2D_CLK_SLEEP_DISABLE __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE + +/* alias define maintained for legacy */ +#define __HAL_RCC_OTGFS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET +#define __HAL_RCC_OTGFS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET + +#define __ADC12_CLK_ENABLE __HAL_RCC_ADC12_CLK_ENABLE +#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 __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 +#define __TIM18_CLK_DISABLE __HAL_RCC_TIM18_CLK_DISABLE +#define __TIM19_CLK_ENABLE __HAL_RCC_TIM19_CLK_ENABLE +#define __TIM19_CLK_DISABLE __HAL_RCC_TIM19_CLK_DISABLE +#define __TIM20_CLK_ENABLE __HAL_RCC_TIM20_CLK_ENABLE +#define __TIM20_CLK_DISABLE __HAL_RCC_TIM20_CLK_DISABLE +#define __HRTIM1_CLK_ENABLE __HAL_RCC_HRTIM1_CLK_ENABLE +#define __HRTIM1_CLK_DISABLE __HAL_RCC_HRTIM1_CLK_DISABLE +#define __SDADC1_CLK_ENABLE __HAL_RCC_SDADC1_CLK_ENABLE +#define __SDADC2_CLK_ENABLE __HAL_RCC_SDADC2_CLK_ENABLE +#define __SDADC3_CLK_ENABLE __HAL_RCC_SDADC3_CLK_ENABLE +#define __SDADC1_CLK_DISABLE __HAL_RCC_SDADC1_CLK_DISABLE +#define __SDADC2_CLK_DISABLE __HAL_RCC_SDADC2_CLK_DISABLE +#define __SDADC3_CLK_DISABLE __HAL_RCC_SDADC3_CLK_DISABLE + +#define __ADC12_FORCE_RESET __HAL_RCC_ADC12_FORCE_RESET +#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 __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 +#define __TIM18_RELEASE_RESET __HAL_RCC_TIM18_RELEASE_RESET +#define __TIM19_FORCE_RESET __HAL_RCC_TIM19_FORCE_RESET +#define __TIM19_RELEASE_RESET __HAL_RCC_TIM19_RELEASE_RESET +#define __TIM20_FORCE_RESET __HAL_RCC_TIM20_FORCE_RESET +#define __TIM20_RELEASE_RESET __HAL_RCC_TIM20_RELEASE_RESET +#define __HRTIM1_FORCE_RESET __HAL_RCC_HRTIM1_FORCE_RESET +#define __HRTIM1_RELEASE_RESET __HAL_RCC_HRTIM1_RELEASE_RESET +#define __SDADC1_FORCE_RESET __HAL_RCC_SDADC1_FORCE_RESET +#define __SDADC2_FORCE_RESET __HAL_RCC_SDADC2_FORCE_RESET +#define __SDADC3_FORCE_RESET __HAL_RCC_SDADC3_FORCE_RESET +#define __SDADC1_RELEASE_RESET __HAL_RCC_SDADC1_RELEASE_RESET +#define __SDADC2_RELEASE_RESET __HAL_RCC_SDADC2_RELEASE_RESET +#define __SDADC3_RELEASE_RESET __HAL_RCC_SDADC3_RELEASE_RESET + +#define __ADC1_IS_CLK_ENABLED __HAL_RCC_ADC1_IS_CLK_ENABLED +#define __ADC1_IS_CLK_DISABLED __HAL_RCC_ADC1_IS_CLK_DISABLED +#define __ADC12_IS_CLK_ENABLED __HAL_RCC_ADC12_IS_CLK_ENABLED +#define __ADC12_IS_CLK_DISABLED __HAL_RCC_ADC12_IS_CLK_DISABLED +#define __ADC34_IS_CLK_ENABLED __HAL_RCC_ADC34_IS_CLK_ENABLED +#define __ADC34_IS_CLK_DISABLED __HAL_RCC_ADC34_IS_CLK_DISABLED +#define __CEC_IS_CLK_ENABLED __HAL_RCC_CEC_IS_CLK_ENABLED +#define __CEC_IS_CLK_DISABLED __HAL_RCC_CEC_IS_CLK_DISABLED +#define __CRC_IS_CLK_ENABLED __HAL_RCC_CRC_IS_CLK_ENABLED +#define __CRC_IS_CLK_DISABLED __HAL_RCC_CRC_IS_CLK_DISABLED +#define __DAC1_IS_CLK_ENABLED __HAL_RCC_DAC1_IS_CLK_ENABLED +#define __DAC1_IS_CLK_DISABLED __HAL_RCC_DAC1_IS_CLK_DISABLED +#define __DAC2_IS_CLK_ENABLED __HAL_RCC_DAC2_IS_CLK_ENABLED +#define __DAC2_IS_CLK_DISABLED __HAL_RCC_DAC2_IS_CLK_DISABLED +#define __DMA1_IS_CLK_ENABLED __HAL_RCC_DMA1_IS_CLK_ENABLED +#define __DMA1_IS_CLK_DISABLED __HAL_RCC_DMA1_IS_CLK_DISABLED +#define __DMA2_IS_CLK_ENABLED __HAL_RCC_DMA2_IS_CLK_ENABLED +#define __DMA2_IS_CLK_DISABLED __HAL_RCC_DMA2_IS_CLK_DISABLED +#define __FLITF_IS_CLK_ENABLED __HAL_RCC_FLITF_IS_CLK_ENABLED +#define __FLITF_IS_CLK_DISABLED __HAL_RCC_FLITF_IS_CLK_DISABLED +#define __FMC_IS_CLK_ENABLED __HAL_RCC_FMC_IS_CLK_ENABLED +#define __FMC_IS_CLK_DISABLED __HAL_RCC_FMC_IS_CLK_DISABLED +#define __GPIOA_IS_CLK_ENABLED __HAL_RCC_GPIOA_IS_CLK_ENABLED +#define __GPIOA_IS_CLK_DISABLED __HAL_RCC_GPIOA_IS_CLK_DISABLED +#define __GPIOB_IS_CLK_ENABLED __HAL_RCC_GPIOB_IS_CLK_ENABLED +#define __GPIOB_IS_CLK_DISABLED __HAL_RCC_GPIOB_IS_CLK_DISABLED +#define __GPIOC_IS_CLK_ENABLED __HAL_RCC_GPIOC_IS_CLK_ENABLED +#define __GPIOC_IS_CLK_DISABLED __HAL_RCC_GPIOC_IS_CLK_DISABLED +#define __GPIOD_IS_CLK_ENABLED __HAL_RCC_GPIOD_IS_CLK_ENABLED +#define __GPIOD_IS_CLK_DISABLED __HAL_RCC_GPIOD_IS_CLK_DISABLED +#define __GPIOE_IS_CLK_ENABLED __HAL_RCC_GPIOE_IS_CLK_ENABLED +#define __GPIOE_IS_CLK_DISABLED __HAL_RCC_GPIOE_IS_CLK_DISABLED +#define __GPIOF_IS_CLK_ENABLED __HAL_RCC_GPIOF_IS_CLK_ENABLED +#define __GPIOF_IS_CLK_DISABLED __HAL_RCC_GPIOF_IS_CLK_DISABLED +#define __GPIOG_IS_CLK_ENABLED __HAL_RCC_GPIOG_IS_CLK_ENABLED +#define __GPIOG_IS_CLK_DISABLED __HAL_RCC_GPIOG_IS_CLK_DISABLED +#define __GPIOH_IS_CLK_ENABLED __HAL_RCC_GPIOH_IS_CLK_ENABLED +#define __GPIOH_IS_CLK_DISABLED __HAL_RCC_GPIOH_IS_CLK_DISABLED +#define __HRTIM1_IS_CLK_ENABLED __HAL_RCC_HRTIM1_IS_CLK_ENABLED +#define __HRTIM1_IS_CLK_DISABLED __HAL_RCC_HRTIM1_IS_CLK_DISABLED +#define __I2C1_IS_CLK_ENABLED __HAL_RCC_I2C1_IS_CLK_ENABLED +#define __I2C1_IS_CLK_DISABLED __HAL_RCC_I2C1_IS_CLK_DISABLED +#define __I2C2_IS_CLK_ENABLED __HAL_RCC_I2C2_IS_CLK_ENABLED +#define __I2C2_IS_CLK_DISABLED __HAL_RCC_I2C2_IS_CLK_DISABLED +#define __I2C3_IS_CLK_ENABLED __HAL_RCC_I2C3_IS_CLK_ENABLED +#define __I2C3_IS_CLK_DISABLED __HAL_RCC_I2C3_IS_CLK_DISABLED +#define __PWR_IS_CLK_ENABLED __HAL_RCC_PWR_IS_CLK_ENABLED +#define __PWR_IS_CLK_DISABLED __HAL_RCC_PWR_IS_CLK_DISABLED +#define __SYSCFG_IS_CLK_ENABLED __HAL_RCC_SYSCFG_IS_CLK_ENABLED +#define __SYSCFG_IS_CLK_DISABLED __HAL_RCC_SYSCFG_IS_CLK_DISABLED +#define __SPI1_IS_CLK_ENABLED __HAL_RCC_SPI1_IS_CLK_ENABLED +#define __SPI1_IS_CLK_DISABLED __HAL_RCC_SPI1_IS_CLK_DISABLED +#define __SPI2_IS_CLK_ENABLED __HAL_RCC_SPI2_IS_CLK_ENABLED +#define __SPI2_IS_CLK_DISABLED __HAL_RCC_SPI2_IS_CLK_DISABLED +#define __SPI3_IS_CLK_ENABLED __HAL_RCC_SPI3_IS_CLK_ENABLED +#define __SPI3_IS_CLK_DISABLED __HAL_RCC_SPI3_IS_CLK_DISABLED +#define __SPI4_IS_CLK_ENABLED __HAL_RCC_SPI4_IS_CLK_ENABLED +#define __SPI4_IS_CLK_DISABLED __HAL_RCC_SPI4_IS_CLK_DISABLED +#define __SDADC1_IS_CLK_ENABLED __HAL_RCC_SDADC1_IS_CLK_ENABLED +#define __SDADC1_IS_CLK_DISABLED __HAL_RCC_SDADC1_IS_CLK_DISABLED +#define __SDADC2_IS_CLK_ENABLED __HAL_RCC_SDADC2_IS_CLK_ENABLED +#define __SDADC2_IS_CLK_DISABLED __HAL_RCC_SDADC2_IS_CLK_DISABLED +#define __SDADC3_IS_CLK_ENABLED __HAL_RCC_SDADC3_IS_CLK_ENABLED +#define __SDADC3_IS_CLK_DISABLED __HAL_RCC_SDADC3_IS_CLK_DISABLED +#define __SRAM_IS_CLK_ENABLED __HAL_RCC_SRAM_IS_CLK_ENABLED +#define __SRAM_IS_CLK_DISABLED __HAL_RCC_SRAM_IS_CLK_DISABLED +#define __TIM1_IS_CLK_ENABLED __HAL_RCC_TIM1_IS_CLK_ENABLED +#define __TIM1_IS_CLK_DISABLED __HAL_RCC_TIM1_IS_CLK_DISABLED +#define __TIM2_IS_CLK_ENABLED __HAL_RCC_TIM2_IS_CLK_ENABLED +#define __TIM2_IS_CLK_DISABLED __HAL_RCC_TIM2_IS_CLK_DISABLED +#define __TIM3_IS_CLK_ENABLED __HAL_RCC_TIM3_IS_CLK_ENABLED +#define __TIM3_IS_CLK_DISABLED __HAL_RCC_TIM3_IS_CLK_DISABLED +#define __TIM4_IS_CLK_ENABLED __HAL_RCC_TIM4_IS_CLK_ENABLED +#define __TIM4_IS_CLK_DISABLED __HAL_RCC_TIM4_IS_CLK_DISABLED +#define __TIM5_IS_CLK_ENABLED __HAL_RCC_TIM5_IS_CLK_ENABLED +#define __TIM5_IS_CLK_DISABLED __HAL_RCC_TIM5_IS_CLK_DISABLED +#define __TIM6_IS_CLK_ENABLED __HAL_RCC_TIM6_IS_CLK_ENABLED +#define __TIM6_IS_CLK_DISABLED __HAL_RCC_TIM6_IS_CLK_DISABLED +#define __TIM7_IS_CLK_ENABLED __HAL_RCC_TIM7_IS_CLK_ENABLED +#define __TIM7_IS_CLK_DISABLED __HAL_RCC_TIM7_IS_CLK_DISABLED +#define __TIM8_IS_CLK_ENABLED __HAL_RCC_TIM8_IS_CLK_ENABLED +#define __TIM8_IS_CLK_DISABLED __HAL_RCC_TIM8_IS_CLK_DISABLED +#define __TIM12_IS_CLK_ENABLED __HAL_RCC_TIM12_IS_CLK_ENABLED +#define __TIM12_IS_CLK_DISABLED __HAL_RCC_TIM12_IS_CLK_DISABLED +#define __TIM13_IS_CLK_ENABLED __HAL_RCC_TIM13_IS_CLK_ENABLED +#define __TIM13_IS_CLK_DISABLED __HAL_RCC_TIM13_IS_CLK_DISABLED +#define __TIM14_IS_CLK_ENABLED __HAL_RCC_TIM14_IS_CLK_ENABLED +#define __TIM14_IS_CLK_DISABLED __HAL_RCC_TIM14_IS_CLK_DISABLED +#define __TIM15_IS_CLK_ENABLED __HAL_RCC_TIM15_IS_CLK_ENABLED +#define __TIM15_IS_CLK_DISABLED __HAL_RCC_TIM15_IS_CLK_DISABLED +#define __TIM16_IS_CLK_ENABLED __HAL_RCC_TIM16_IS_CLK_ENABLED +#define __TIM16_IS_CLK_DISABLED __HAL_RCC_TIM16_IS_CLK_DISABLED +#define __TIM17_IS_CLK_ENABLED __HAL_RCC_TIM17_IS_CLK_ENABLED +#define __TIM17_IS_CLK_DISABLED __HAL_RCC_TIM17_IS_CLK_DISABLED +#define __TIM18_IS_CLK_ENABLED __HAL_RCC_TIM18_IS_CLK_ENABLED +#define __TIM18_IS_CLK_DISABLED __HAL_RCC_TIM18_IS_CLK_DISABLED +#define __TIM19_IS_CLK_ENABLED __HAL_RCC_TIM19_IS_CLK_ENABLED +#define __TIM19_IS_CLK_DISABLED __HAL_RCC_TIM19_IS_CLK_DISABLED +#define __TIM20_IS_CLK_ENABLED __HAL_RCC_TIM20_IS_CLK_ENABLED +#define __TIM20_IS_CLK_DISABLED __HAL_RCC_TIM20_IS_CLK_DISABLED +#define __TSC_IS_CLK_ENABLED __HAL_RCC_TSC_IS_CLK_ENABLED +#define __TSC_IS_CLK_DISABLED __HAL_RCC_TSC_IS_CLK_DISABLED +#define __UART4_IS_CLK_ENABLED __HAL_RCC_UART4_IS_CLK_ENABLED +#define __UART4_IS_CLK_DISABLED __HAL_RCC_UART4_IS_CLK_DISABLED +#define __UART5_IS_CLK_ENABLED __HAL_RCC_UART5_IS_CLK_ENABLED +#define __UART5_IS_CLK_DISABLED __HAL_RCC_UART5_IS_CLK_DISABLED +#define __USART1_IS_CLK_ENABLED __HAL_RCC_USART1_IS_CLK_ENABLED +#define __USART1_IS_CLK_DISABLED __HAL_RCC_USART1_IS_CLK_DISABLED +#define __USART2_IS_CLK_ENABLED __HAL_RCC_USART2_IS_CLK_ENABLED +#define __USART2_IS_CLK_DISABLED __HAL_RCC_USART2_IS_CLK_DISABLED +#define __USART3_IS_CLK_ENABLED __HAL_RCC_USART3_IS_CLK_ENABLED +#define __USART3_IS_CLK_DISABLED __HAL_RCC_USART3_IS_CLK_DISABLED +#define __USB_IS_CLK_ENABLED __HAL_RCC_USB_IS_CLK_ENABLED +#define __USB_IS_CLK_DISABLED __HAL_RCC_USB_IS_CLK_DISABLED +#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 +#define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE +#define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE +#define __HAL_RCC_SDMMC1_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE +#define __HAL_RCC_SDMMC1_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE +#define __HAL_RCC_SDMMC1_IS_CLK_ENABLED __HAL_RCC_SDIO_IS_CLK_ENABLED +#define __HAL_RCC_SDMMC1_IS_CLK_DISABLED __HAL_RCC_SDIO_IS_CLK_DISABLED +#define Sdmmc1ClockSelection SdioClockSelection +#define RCC_PERIPHCLK_SDMMC1 RCC_PERIPHCLK_SDIO +#define RCC_SDMMC1CLKSOURCE_CLK48 RCC_SDIOCLKSOURCE_CK48 +#define RCC_SDMMC1CLKSOURCE_SYSCLK RCC_SDIOCLKSOURCE_SYSCLK +#define __HAL_RCC_SDMMC1_CONFIG __HAL_RCC_SDIO_CONFIG +#define __HAL_RCC_GET_SDMMC1_SOURCE __HAL_RCC_GET_SDIO_SOURCE +#endif + +#if defined(STM32F7) || defined(STM32L4) +#define __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SDMMC1_FORCE_RESET +#define __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SDMMC1_RELEASE_RESET +#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE +#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE +#define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE +#define __HAL_RCC_SDIO_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE +#define __HAL_RCC_SDIO_IS_CLK_ENABLED __HAL_RCC_SDMMC1_IS_CLK_ENABLED +#define __HAL_RCC_SDIO_IS_CLK_DISABLED __HAL_RCC_SDMMC1_IS_CLK_DISABLED +#define SdioClockSelection Sdmmc1ClockSelection +#define RCC_PERIPHCLK_SDIO RCC_PERIPHCLK_SDMMC1 +#define __HAL_RCC_SDIO_CONFIG __HAL_RCC_SDMMC1_CONFIG +#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() +#define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() __HAL_RCC_USB1_OTG_HS_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_HS_FORCE_RESET() __HAL_RCC_USB1_OTG_HS_FORCE_RESET() +#define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() __HAL_RCC_USB1_OTG_HS_RELEASE_RESET() +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_DISABLE() +#define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_DISABLE() + +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() __HAL_RCC_USB2_OTG_FS_CLK_ENABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_ENABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_ENABLE() +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() __HAL_RCC_USB2_OTG_FS_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_DISABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_DISABLE() +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() __HAL_RCC_USB2_OTG_FS_FORCE_RESET() +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() __HAL_RCC_USB2_OTG_FS_RELEASE_RESET() +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_SLEEP_ENABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_ENABLE() +#define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_DISABLE() +#define __HAL_RCC_USB_OTG_FS_ULPI_CLK_SLEEP_DISABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE() +#endif + +#define __HAL_RCC_I2SCLK __HAL_RCC_I2S_CONFIG +#define __HAL_RCC_I2SCLK_CONFIG __HAL_RCC_I2S_CONFIG + +#define __RCC_PLLSRC RCC_GET_PLL_OSCSOURCE + +#define IS_RCC_MSIRANGE IS_RCC_MSI_CLOCK_RANGE +#define IS_RCC_RTCCLK_SOURCE IS_RCC_RTCCLKSOURCE +#define IS_RCC_SYSCLK_DIV IS_RCC_HCLK +#define IS_RCC_HCLK_DIV IS_RCC_PCLK +#define IS_RCC_PERIPHCLK IS_RCC_PERIPHCLOCK + +#define RCC_IT_HSI14 RCC_IT_HSI14RDY + +#define RCC_IT_CSSLSE RCC_IT_LSECSS +#define RCC_IT_CSSHSE RCC_IT_CSS + +#define RCC_PLLMUL_3 RCC_PLL_MUL3 +#define RCC_PLLMUL_4 RCC_PLL_MUL4 +#define RCC_PLLMUL_6 RCC_PLL_MUL6 +#define RCC_PLLMUL_8 RCC_PLL_MUL8 +#define RCC_PLLMUL_12 RCC_PLL_MUL12 +#define RCC_PLLMUL_16 RCC_PLL_MUL16 +#define RCC_PLLMUL_24 RCC_PLL_MUL24 +#define RCC_PLLMUL_32 RCC_PLL_MUL32 +#define RCC_PLLMUL_48 RCC_PLL_MUL48 + +#define RCC_PLLDIV_2 RCC_PLL_DIV2 +#define RCC_PLLDIV_3 RCC_PLL_DIV3 +#define RCC_PLLDIV_4 RCC_PLL_DIV4 + +#define IS_RCC_MCOSOURCE IS_RCC_MCO1SOURCE +#define __HAL_RCC_MCO_CONFIG __HAL_RCC_MCO1_CONFIG +#define RCC_MCO_NODIV RCC_MCODIV_1 +#define RCC_MCO_DIV1 RCC_MCODIV_1 +#define RCC_MCO_DIV2 RCC_MCODIV_2 +#define RCC_MCO_DIV4 RCC_MCODIV_4 +#define RCC_MCO_DIV8 RCC_MCODIV_8 +#define RCC_MCO_DIV16 RCC_MCODIV_16 +#define RCC_MCO_DIV32 RCC_MCODIV_32 +#define RCC_MCO_DIV64 RCC_MCODIV_64 +#define RCC_MCO_DIV128 RCC_MCODIV_128 +#define RCC_MCOSOURCE_NONE RCC_MCO1SOURCE_NOCLOCK +#define RCC_MCOSOURCE_LSI RCC_MCO1SOURCE_LSI +#define RCC_MCOSOURCE_LSE RCC_MCO1SOURCE_LSE +#define RCC_MCOSOURCE_SYSCLK RCC_MCO1SOURCE_SYSCLK +#define RCC_MCOSOURCE_HSI RCC_MCO1SOURCE_HSI +#define RCC_MCOSOURCE_HSI14 RCC_MCO1SOURCE_HSI14 +#define RCC_MCOSOURCE_HSI48 RCC_MCO1SOURCE_HSI48 +#define RCC_MCOSOURCE_HSE RCC_MCO1SOURCE_HSE +#define RCC_MCOSOURCE_PLLCLK_DIV1 RCC_MCO1SOURCE_PLLCLK +#define RCC_MCOSOURCE_PLLCLK_NODIV RCC_MCO1SOURCE_PLLCLK +#define RCC_MCOSOURCE_PLLCLK_DIV2 RCC_MCO1SOURCE_PLLCLK_DIV2 + +#if defined(STM32L4) || defined(STM32WB) || defined(STM32G0) || defined(STM32G4) || defined(STM32L5) || defined(STM32WL) +#define RCC_RTCCLKSOURCE_NO_CLK RCC_RTCCLKSOURCE_NONE +#else +#define RCC_RTCCLKSOURCE_NONE RCC_RTCCLKSOURCE_NO_CLK +#endif + +#define RCC_USBCLK_PLLSAI1 RCC_USBCLKSOURCE_PLLSAI1 +#define RCC_USBCLK_PLL RCC_USBCLKSOURCE_PLL +#define RCC_USBCLK_MSI RCC_USBCLKSOURCE_MSI +#define RCC_USBCLKSOURCE_PLLCLK RCC_USBCLKSOURCE_PLL +#define RCC_USBPLLCLK_DIV1 RCC_USBCLKSOURCE_PLL +#define RCC_USBPLLCLK_DIV1_5 RCC_USBCLKSOURCE_PLL_DIV1_5 +#define RCC_USBPLLCLK_DIV2 RCC_USBCLKSOURCE_PLL_DIV2 +#define RCC_USBPLLCLK_DIV3 RCC_USBCLKSOURCE_PLL_DIV3 + +#define HSION_BitNumber RCC_HSION_BIT_NUMBER +#define HSION_BITNUMBER RCC_HSION_BIT_NUMBER +#define HSEON_BitNumber RCC_HSEON_BIT_NUMBER +#define HSEON_BITNUMBER RCC_HSEON_BIT_NUMBER +#define MSION_BITNUMBER RCC_MSION_BIT_NUMBER +#define CSSON_BitNumber RCC_CSSON_BIT_NUMBER +#define CSSON_BITNUMBER RCC_CSSON_BIT_NUMBER +#define PLLON_BitNumber RCC_PLLON_BIT_NUMBER +#define PLLON_BITNUMBER RCC_PLLON_BIT_NUMBER +#define PLLI2SON_BitNumber RCC_PLLI2SON_BIT_NUMBER +#define I2SSRC_BitNumber RCC_I2SSRC_BIT_NUMBER +#define RTCEN_BitNumber RCC_RTCEN_BIT_NUMBER +#define RTCEN_BITNUMBER RCC_RTCEN_BIT_NUMBER +#define BDRST_BitNumber RCC_BDRST_BIT_NUMBER +#define BDRST_BITNUMBER RCC_BDRST_BIT_NUMBER +#define RTCRST_BITNUMBER RCC_RTCRST_BIT_NUMBER +#define LSION_BitNumber RCC_LSION_BIT_NUMBER +#define LSION_BITNUMBER RCC_LSION_BIT_NUMBER +#define LSEON_BitNumber RCC_LSEON_BIT_NUMBER +#define LSEON_BITNUMBER RCC_LSEON_BIT_NUMBER +#define LSEBYP_BITNUMBER RCC_LSEBYP_BIT_NUMBER +#define PLLSAION_BitNumber RCC_PLLSAION_BIT_NUMBER +#define TIMPRE_BitNumber RCC_TIMPRE_BIT_NUMBER +#define RMVF_BitNumber RCC_RMVF_BIT_NUMBER +#define RMVF_BITNUMBER RCC_RMVF_BIT_NUMBER +#define RCC_CR2_HSI14TRIM_BitNumber RCC_HSI14TRIM_BIT_NUMBER +#define CR_BYTE2_ADDRESS RCC_CR_BYTE2_ADDRESS +#define CIR_BYTE1_ADDRESS RCC_CIR_BYTE1_ADDRESS +#define CIR_BYTE2_ADDRESS RCC_CIR_BYTE2_ADDRESS +#define BDCR_BYTE0_ADDRESS RCC_BDCR_BYTE0_ADDRESS +#define DBP_TIMEOUT_VALUE RCC_DBP_TIMEOUT_VALUE +#define LSE_TIMEOUT_VALUE RCC_LSE_TIMEOUT_VALUE + +#define CR_HSION_BB RCC_CR_HSION_BB +#define CR_CSSON_BB RCC_CR_CSSON_BB +#define CR_PLLON_BB RCC_CR_PLLON_BB +#define CR_PLLI2SON_BB RCC_CR_PLLI2SON_BB +#define CR_MSION_BB RCC_CR_MSION_BB +#define CSR_LSION_BB RCC_CSR_LSION_BB +#define CSR_LSEON_BB RCC_CSR_LSEON_BB +#define CSR_LSEBYP_BB RCC_CSR_LSEBYP_BB +#define CSR_RTCEN_BB RCC_CSR_RTCEN_BB +#define CSR_RTCRST_BB RCC_CSR_RTCRST_BB +#define CFGR_I2SSRC_BB RCC_CFGR_I2SSRC_BB +#define BDCR_RTCEN_BB RCC_BDCR_RTCEN_BB +#define BDCR_BDRST_BB RCC_BDCR_BDRST_BB +#define CR_HSEON_BB RCC_CR_HSEON_BB +#define CSR_RMVF_BB RCC_CSR_RMVF_BB +#define CR_PLLSAION_BB RCC_CR_PLLSAION_BB +#define DCKCFGR_TIMPRE_BB RCC_DCKCFGR_TIMPRE_BB + +#define __HAL_RCC_CRS_ENABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE +#define __HAL_RCC_CRS_DISABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE +#define __HAL_RCC_CRS_ENABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE +#define __HAL_RCC_CRS_DISABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE +#define __HAL_RCC_CRS_CALCULATE_RELOADVALUE __HAL_RCC_CRS_RELOADVALUE_CALCULATE + +#define __HAL_RCC_GET_IT_SOURCE __HAL_RCC_GET_IT + +#define RCC_CRS_SYNCWARM RCC_CRS_SYNCWARN +#define RCC_CRS_TRIMOV RCC_CRS_TRIMOVF + +#define RCC_PERIPHCLK_CK48 RCC_PERIPHCLK_CLK48 +#define RCC_CK48CLKSOURCE_PLLQ RCC_CLK48CLKSOURCE_PLLQ +#define RCC_CK48CLKSOURCE_PLLSAIP RCC_CLK48CLKSOURCE_PLLSAIP +#define RCC_CK48CLKSOURCE_PLLI2SQ RCC_CLK48CLKSOURCE_PLLI2SQ +#define IS_RCC_CK48CLKSOURCE IS_RCC_CLK48CLKSOURCE +#define RCC_SDIOCLKSOURCE_CK48 RCC_SDIOCLKSOURCE_CLK48 + +#define __HAL_RCC_DFSDM_CLK_ENABLE __HAL_RCC_DFSDM1_CLK_ENABLE +#define __HAL_RCC_DFSDM_CLK_DISABLE __HAL_RCC_DFSDM1_CLK_DISABLE +#define __HAL_RCC_DFSDM_IS_CLK_ENABLED __HAL_RCC_DFSDM1_IS_CLK_ENABLED +#define __HAL_RCC_DFSDM_IS_CLK_DISABLED __HAL_RCC_DFSDM1_IS_CLK_DISABLED +#define __HAL_RCC_DFSDM_FORCE_RESET __HAL_RCC_DFSDM1_FORCE_RESET +#define __HAL_RCC_DFSDM_RELEASE_RESET __HAL_RCC_DFSDM1_RELEASE_RESET +#define __HAL_RCC_DFSDM_CLK_SLEEP_ENABLE __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE +#define __HAL_RCC_DFSDM_CLK_SLEEP_DISABLE __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE +#define __HAL_RCC_DFSDM_IS_CLK_SLEEP_ENABLED __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED +#define __HAL_RCC_DFSDM_IS_CLK_SLEEP_DISABLED __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED +#define DfsdmClockSelection Dfsdm1ClockSelection +#define RCC_PERIPHCLK_DFSDM RCC_PERIPHCLK_DFSDM1 +#define RCC_DFSDMCLKSOURCE_PCLK RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_DFSDMCLKSOURCE_SYSCLK RCC_DFSDM1CLKSOURCE_SYSCLK +#define __HAL_RCC_DFSDM_CONFIG __HAL_RCC_DFSDM1_CONFIG +#define __HAL_RCC_GET_DFSDM_SOURCE __HAL_RCC_GET_DFSDM1_SOURCE +#define RCC_DFSDM1CLKSOURCE_PCLK RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_SWPMI1CLKSOURCE_PCLK RCC_SWPMI1CLKSOURCE_PCLK1 +#define RCC_LPTIM1CLKSOURCE_PCLK RCC_LPTIM1CLKSOURCE_PCLK1 +#define RCC_LPTIM2CLKSOURCE_PCLK RCC_LPTIM2CLKSOURCE_PCLK1 + +#define RCC_DFSDM1AUDIOCLKSOURCE_I2SAPB1 RCC_DFSDM1AUDIOCLKSOURCE_I2S1 +#define RCC_DFSDM1AUDIOCLKSOURCE_I2SAPB2 RCC_DFSDM1AUDIOCLKSOURCE_I2S2 +#define RCC_DFSDM2AUDIOCLKSOURCE_I2SAPB1 RCC_DFSDM2AUDIOCLKSOURCE_I2S1 +#define RCC_DFSDM2AUDIOCLKSOURCE_I2SAPB2 RCC_DFSDM2AUDIOCLKSOURCE_I2S2 +#define RCC_DFSDM1CLKSOURCE_APB2 RCC_DFSDM1CLKSOURCE_PCLK2 +#define RCC_DFSDM2CLKSOURCE_APB2 RCC_DFSDM2CLKSOURCE_PCLK2 +#define RCC_FMPI2C1CLKSOURCE_APB RCC_FMPI2C1CLKSOURCE_PCLK1 + +/** + * @} + */ + +/** @defgroup HAL_RNG_Aliased_Macros HAL RNG Aliased Macros maintained for legacy purpose + * @{ + */ +#define HAL_RNG_ReadyCallback(__HANDLE__) HAL_RNG_ReadyDataCallback((__HANDLE__), uint32_t random32bit) + +/** + * @} + */ + +/** @defgroup HAL_RTC_Aliased_Macros HAL RTC Aliased Macros maintained for legacy purpose + * @{ + */ +#if defined (STM32G0) || defined (STM32L5) || defined (STM32L412xx) || defined (STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) || defined (STM32G4) || defined (STM32WL) +#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 + +#if defined (STM32F1) +#define __HAL_RTC_EXTI_CLEAR_FLAG(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() + +#define __HAL_RTC_EXTI_ENABLE_IT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_ENABLE_IT() + +#define __HAL_RTC_EXTI_DISABLE_IT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_DISABLE_IT() + +#define __HAL_RTC_EXTI_GET_FLAG(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_GET_FLAG() + +#define __HAL_RTC_EXTI_GENERATE_SWIT(RTC_EXTI_LINE_ALARM_EVENT) __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() +#else +#define __HAL_RTC_EXTI_CLEAR_FLAG(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG())) +#define __HAL_RTC_EXTI_ENABLE_IT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_ENABLE_IT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT())) +#define __HAL_RTC_EXTI_DISABLE_IT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_DISABLE_IT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT())) +#define __HAL_RTC_EXTI_GET_FLAG(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_GET_FLAG() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG())) +#define __HAL_RTC_EXTI_GENERATE_SWIT(__EXTI_LINE__) (((__EXTI_LINE__) == RTC_EXTI_LINE_ALARM_EVENT) ? __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() : \ + (((__EXTI_LINE__) == RTC_EXTI_LINE_WAKEUPTIMER_EVENT) ? __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() : \ + __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT())) +#endif /* STM32F1 */ + +#define IS_ALARM IS_RTC_ALARM +#define IS_ALARM_MASK IS_RTC_ALARM_MASK +#define IS_TAMPER IS_RTC_TAMPER +#define IS_TAMPER_ERASE_MODE IS_RTC_TAMPER_ERASE_MODE +#define IS_TAMPER_FILTER IS_RTC_TAMPER_FILTER +#define IS_TAMPER_INTERRUPT IS_RTC_TAMPER_INTERRUPT +#define IS_TAMPER_MASKFLAG_STATE IS_RTC_TAMPER_MASKFLAG_STATE +#define IS_TAMPER_PRECHARGE_DURATION IS_RTC_TAMPER_PRECHARGE_DURATION +#define IS_TAMPER_PULLUP_STATE IS_RTC_TAMPER_PULLUP_STATE +#define IS_TAMPER_SAMPLING_FREQ IS_RTC_TAMPER_SAMPLING_FREQ +#define IS_TAMPER_TIMESTAMPONTAMPER_DETECTION IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION +#define IS_TAMPER_TRIGGER IS_RTC_TAMPER_TRIGGER +#define IS_WAKEUP_CLOCK IS_RTC_WAKEUP_CLOCK +#define IS_WAKEUP_COUNTER IS_RTC_WAKEUP_COUNTER + +#define __RTC_WRITEPROTECTION_ENABLE __HAL_RTC_WRITEPROTECTION_ENABLE +#define __RTC_WRITEPROTECTION_DISABLE __HAL_RTC_WRITEPROTECTION_DISABLE + +/** + * @} + */ + +/** @defgroup HAL_SD_Aliased_Macros HAL SD Aliased Macros maintained for legacy purpose + * @{ + */ + +#define SD_OCR_CID_CSD_OVERWRIETE SD_OCR_CID_CSD_OVERWRITE +#define SD_CMD_SD_APP_STAUS SD_CMD_SD_APP_STATUS + +#if defined(STM32F4) || defined(STM32F2) +#define SD_SDMMC_DISABLED SD_SDIO_DISABLED +#define SD_SDMMC_FUNCTION_BUSY SD_SDIO_FUNCTION_BUSY +#define SD_SDMMC_FUNCTION_FAILED SD_SDIO_FUNCTION_FAILED +#define SD_SDMMC_UNKNOWN_FUNCTION SD_SDIO_UNKNOWN_FUNCTION +#define SD_CMD_SDMMC_SEN_OP_COND SD_CMD_SDIO_SEN_OP_COND +#define SD_CMD_SDMMC_RW_DIRECT SD_CMD_SDIO_RW_DIRECT +#define SD_CMD_SDMMC_RW_EXTENDED SD_CMD_SDIO_RW_EXTENDED +#define __HAL_SD_SDMMC_ENABLE __HAL_SD_SDIO_ENABLE +#define __HAL_SD_SDMMC_DISABLE __HAL_SD_SDIO_DISABLE +#define __HAL_SD_SDMMC_DMA_ENABLE __HAL_SD_SDIO_DMA_ENABLE +#define __HAL_SD_SDMMC_DMA_DISABLE __HAL_SD_SDIO_DMA_DISABL +#define __HAL_SD_SDMMC_ENABLE_IT __HAL_SD_SDIO_ENABLE_IT +#define __HAL_SD_SDMMC_DISABLE_IT __HAL_SD_SDIO_DISABLE_IT +#define __HAL_SD_SDMMC_GET_FLAG __HAL_SD_SDIO_GET_FLAG +#define __HAL_SD_SDMMC_CLEAR_FLAG __HAL_SD_SDIO_CLEAR_FLAG +#define __HAL_SD_SDMMC_GET_IT __HAL_SD_SDIO_GET_IT +#define __HAL_SD_SDMMC_CLEAR_IT __HAL_SD_SDIO_CLEAR_IT +#define SDMMC_STATIC_FLAGS SDIO_STATIC_FLAGS +#define SDMMC_CMD0TIMEOUT SDIO_CMD0TIMEOUT +#define SD_SDMMC_SEND_IF_COND SD_SDIO_SEND_IF_COND +/* alias CMSIS */ +#define SDMMC1_IRQn SDIO_IRQn +#define SDMMC1_IRQHandler SDIO_IRQHandler +#endif + +#if defined(STM32F7) || defined(STM32L4) +#define SD_SDIO_DISABLED SD_SDMMC_DISABLED +#define SD_SDIO_FUNCTION_BUSY SD_SDMMC_FUNCTION_BUSY +#define SD_SDIO_FUNCTION_FAILED SD_SDMMC_FUNCTION_FAILED +#define SD_SDIO_UNKNOWN_FUNCTION SD_SDMMC_UNKNOWN_FUNCTION +#define SD_CMD_SDIO_SEN_OP_COND SD_CMD_SDMMC_SEN_OP_COND +#define SD_CMD_SDIO_RW_DIRECT SD_CMD_SDMMC_RW_DIRECT +#define SD_CMD_SDIO_RW_EXTENDED SD_CMD_SDMMC_RW_EXTENDED +#define __HAL_SD_SDIO_ENABLE __HAL_SD_SDMMC_ENABLE +#define __HAL_SD_SDIO_DISABLE __HAL_SD_SDMMC_DISABLE +#define __HAL_SD_SDIO_DMA_ENABLE __HAL_SD_SDMMC_DMA_ENABLE +#define __HAL_SD_SDIO_DMA_DISABL __HAL_SD_SDMMC_DMA_DISABLE +#define __HAL_SD_SDIO_ENABLE_IT __HAL_SD_SDMMC_ENABLE_IT +#define __HAL_SD_SDIO_DISABLE_IT __HAL_SD_SDMMC_DISABLE_IT +#define __HAL_SD_SDIO_GET_FLAG __HAL_SD_SDMMC_GET_FLAG +#define __HAL_SD_SDIO_CLEAR_FLAG __HAL_SD_SDMMC_CLEAR_FLAG +#define __HAL_SD_SDIO_GET_IT __HAL_SD_SDMMC_GET_IT +#define __HAL_SD_SDIO_CLEAR_IT __HAL_SD_SDMMC_CLEAR_IT +#define SDIO_STATIC_FLAGS SDMMC_STATIC_FLAGS +#define SDIO_CMD0TIMEOUT SDMMC_CMD0TIMEOUT +#define SD_SDIO_SEND_IF_COND SD_SDMMC_SEND_IF_COND +/* alias CMSIS for compatibilities */ +#define SDIO_IRQn SDMMC1_IRQn +#define SDIO_IRQHandler SDMMC1_IRQHandler +#endif + +#if defined(STM32F7) || defined(STM32F4) || defined(STM32F2) || defined(STM32L4) || defined(STM32H7) +#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) || defined(STM32L5) +#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 +/** + * @} + */ + +/** @defgroup HAL_SMARTCARD_Aliased_Macros HAL SMARTCARD Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __SMARTCARD_ENABLE_IT __HAL_SMARTCARD_ENABLE_IT +#define __SMARTCARD_DISABLE_IT __HAL_SMARTCARD_DISABLE_IT +#define __SMARTCARD_ENABLE __HAL_SMARTCARD_ENABLE +#define __SMARTCARD_DISABLE __HAL_SMARTCARD_DISABLE +#define __SMARTCARD_DMA_REQUEST_ENABLE __HAL_SMARTCARD_DMA_REQUEST_ENABLE +#define __SMARTCARD_DMA_REQUEST_DISABLE __HAL_SMARTCARD_DMA_REQUEST_DISABLE + +#define __HAL_SMARTCARD_GETCLOCKSOURCE SMARTCARD_GETCLOCKSOURCE +#define __SMARTCARD_GETCLOCKSOURCE SMARTCARD_GETCLOCKSOURCE + +#define IS_SMARTCARD_ONEBIT_SAMPLING IS_SMARTCARD_ONE_BIT_SAMPLE + +/** + * @} + */ + +/** @defgroup HAL_SMBUS_Aliased_Macros HAL SMBUS Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_SMBUS_RESET_CR1 SMBUS_RESET_CR1 +#define __HAL_SMBUS_RESET_CR2 SMBUS_RESET_CR2 +#define __HAL_SMBUS_GENERATE_START SMBUS_GENERATE_START +#define __HAL_SMBUS_GET_ADDR_MATCH SMBUS_GET_ADDR_MATCH +#define __HAL_SMBUS_GET_DIR SMBUS_GET_DIR +#define __HAL_SMBUS_GET_STOP_MODE SMBUS_GET_STOP_MODE +#define __HAL_SMBUS_GET_PEC_MODE SMBUS_GET_PEC_MODE +#define __HAL_SMBUS_GET_ALERT_ENABLED SMBUS_GET_ALERT_ENABLED +/** + * @} + */ + +/** @defgroup HAL_SPI_Aliased_Macros HAL SPI Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_SPI_1LINE_TX SPI_1LINE_TX +#define __HAL_SPI_1LINE_RX SPI_1LINE_RX +#define __HAL_SPI_RESET_CRC SPI_RESET_CRC + +/** + * @} + */ + +/** @defgroup HAL_UART_Aliased_Macros HAL UART Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_UART_GETCLOCKSOURCE UART_GETCLOCKSOURCE +#define __HAL_UART_MASK_COMPUTATION UART_MASK_COMPUTATION +#define __UART_GETCLOCKSOURCE UART_GETCLOCKSOURCE +#define __UART_MASK_COMPUTATION UART_MASK_COMPUTATION + +#define IS_UART_WAKEUPMETHODE IS_UART_WAKEUPMETHOD + +#define IS_UART_ONEBIT_SAMPLE IS_UART_ONE_BIT_SAMPLE +#define IS_UART_ONEBIT_SAMPLING IS_UART_ONE_BIT_SAMPLE + +/** + * @} + */ + + +/** @defgroup HAL_USART_Aliased_Macros HAL USART Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __USART_ENABLE_IT __HAL_USART_ENABLE_IT +#define __USART_DISABLE_IT __HAL_USART_DISABLE_IT +#define __USART_ENABLE __HAL_USART_ENABLE +#define __USART_DISABLE __HAL_USART_DISABLE + +#define __HAL_USART_GETCLOCKSOURCE USART_GETCLOCKSOURCE +#define __USART_GETCLOCKSOURCE USART_GETCLOCKSOURCE + +/** + * @} + */ + +/** @defgroup HAL_USB_Aliased_Macros HAL USB Aliased Macros maintained for legacy purpose + * @{ + */ +#define USB_EXTI_LINE_WAKEUP USB_WAKEUP_EXTI_LINE + +#define USB_FS_EXTI_TRIGGER_RISING_EDGE USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE +#define USB_FS_EXTI_TRIGGER_FALLING_EDGE USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE +#define USB_FS_EXTI_TRIGGER_BOTH_EDGE USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE +#define USB_FS_EXTI_LINE_WAKEUP USB_OTG_FS_WAKEUP_EXTI_LINE + +#define USB_HS_EXTI_TRIGGER_RISING_EDGE USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE +#define USB_HS_EXTI_TRIGGER_FALLING_EDGE USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE +#define USB_HS_EXTI_TRIGGER_BOTH_EDGE USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE +#define USB_HS_EXTI_LINE_WAKEUP USB_OTG_HS_WAKEUP_EXTI_LINE + +#define __HAL_USB_EXTI_ENABLE_IT __HAL_USB_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_EXTI_DISABLE_IT __HAL_USB_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_EXTI_GET_FLAG __HAL_USB_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_EXTI_CLEAR_FLAG __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_EXTI_SET_RISING_EDGE_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_EXTI_SET_FALLING_EDGE_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE + +#define __HAL_USB_FS_EXTI_ENABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_FS_EXTI_DISABLE_IT __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_FS_EXTI_GET_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_FS_EXTI_CLEAR_FLAG __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_FS_EXTI_SET_RISING_EGDE_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_FS_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_FS_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE +#define __HAL_USB_FS_EXTI_GENERATE_SWIT __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT + +#define __HAL_USB_HS_EXTI_ENABLE_IT __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT +#define __HAL_USB_HS_EXTI_DISABLE_IT __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT +#define __HAL_USB_HS_EXTI_GET_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG +#define __HAL_USB_HS_EXTI_CLEAR_FLAG __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_USB_HS_EXTI_SET_RISING_EGDE_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE +#define __HAL_USB_HS_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLING_EDGE +#define __HAL_USB_HS_EXTI_SET_FALLINGRISING_TRIGGER __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE +#define __HAL_USB_HS_EXTI_GENERATE_SWIT __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT + +#define HAL_PCD_ActiveRemoteWakeup HAL_PCD_ActivateRemoteWakeup +#define HAL_PCD_DeActiveRemoteWakeup HAL_PCD_DeActivateRemoteWakeup + +#define HAL_PCD_SetTxFiFo HAL_PCDEx_SetTxFiFo +#define HAL_PCD_SetRxFiFo HAL_PCDEx_SetRxFiFo +/** + * @} + */ + +/** @defgroup HAL_TIM_Aliased_Macros HAL TIM Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_TIM_SetICPrescalerValue TIM_SET_ICPRESCALERVALUE +#define __HAL_TIM_ResetICPrescalerValue TIM_RESET_ICPRESCALERVALUE + +#define TIM_GET_ITSTATUS __HAL_TIM_GET_IT_SOURCE +#define TIM_GET_CLEAR_IT __HAL_TIM_CLEAR_IT + +#define __HAL_TIM_GET_ITSTATUS __HAL_TIM_GET_IT_SOURCE + +#define __HAL_TIM_DIRECTION_STATUS __HAL_TIM_IS_TIM_COUNTING_DOWN +#define __HAL_TIM_PRESCALER __HAL_TIM_SET_PRESCALER +#define __HAL_TIM_SetCounter __HAL_TIM_SET_COUNTER +#define __HAL_TIM_GetCounter __HAL_TIM_GET_COUNTER +#define __HAL_TIM_SetAutoreload __HAL_TIM_SET_AUTORELOAD +#define __HAL_TIM_GetAutoreload __HAL_TIM_GET_AUTORELOAD +#define __HAL_TIM_SetClockDivision __HAL_TIM_SET_CLOCKDIVISION +#define __HAL_TIM_GetClockDivision __HAL_TIM_GET_CLOCKDIVISION +#define __HAL_TIM_SetICPrescaler __HAL_TIM_SET_ICPRESCALER +#define __HAL_TIM_GetICPrescaler __HAL_TIM_GET_ICPRESCALER +#define __HAL_TIM_SetCompare __HAL_TIM_SET_COMPARE +#define __HAL_TIM_GetCompare __HAL_TIM_GET_COMPARE + +#define TIM_BREAKINPUTSOURCE_DFSDM TIM_BREAKINPUTSOURCE_DFSDM1 +/** + * @} + */ + +/** @defgroup HAL_ETH_Aliased_Macros HAL ETH Aliased Macros maintained for legacy purpose + * @{ + */ + +#define __HAL_ETH_EXTI_ENABLE_IT __HAL_ETH_WAKEUP_EXTI_ENABLE_IT +#define __HAL_ETH_EXTI_DISABLE_IT __HAL_ETH_WAKEUP_EXTI_DISABLE_IT +#define __HAL_ETH_EXTI_GET_FLAG __HAL_ETH_WAKEUP_EXTI_GET_FLAG +#define __HAL_ETH_EXTI_CLEAR_FLAG __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG +#define __HAL_ETH_EXTI_SET_RISING_EGDE_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER +#define __HAL_ETH_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE_TRIGGER +#define __HAL_ETH_EXTI_SET_FALLINGRISING_TRIGGER __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLINGRISING_TRIGGER + +#define ETH_PROMISCIOUSMODE_ENABLE ETH_PROMISCUOUS_MODE_ENABLE +#define ETH_PROMISCIOUSMODE_DISABLE ETH_PROMISCUOUS_MODE_DISABLE +#define IS_ETH_PROMISCIOUS_MODE IS_ETH_PROMISCUOUS_MODE +/** + * @} + */ + +/** @defgroup HAL_LTDC_Aliased_Macros HAL LTDC Aliased Macros maintained for legacy purpose + * @{ + */ +#define __HAL_LTDC_LAYER LTDC_LAYER +#define __HAL_LTDC_RELOAD_CONFIG __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG +/** + * @} + */ + +/** @defgroup HAL_SAI_Aliased_Macros HAL SAI Aliased Macros maintained for legacy purpose + * @{ + */ +#define SAI_OUTPUTDRIVE_DISABLED SAI_OUTPUTDRIVE_DISABLE +#define SAI_OUTPUTDRIVE_ENABLED SAI_OUTPUTDRIVE_ENABLE +#define SAI_MASTERDIVIDER_ENABLED SAI_MASTERDIVIDER_ENABLE +#define SAI_MASTERDIVIDER_DISABLED SAI_MASTERDIVIDER_DISABLE +#define SAI_STREOMODE SAI_STEREOMODE +#define SAI_FIFOStatus_Empty SAI_FIFOSTATUS_EMPTY +#define SAI_FIFOStatus_Less1QuarterFull SAI_FIFOSTATUS_LESS1QUARTERFULL +#define SAI_FIFOStatus_1QuarterFull SAI_FIFOSTATUS_1QUARTERFULL +#define SAI_FIFOStatus_HalfFull SAI_FIFOSTATUS_HALFFULL +#define SAI_FIFOStatus_3QuartersFull SAI_FIFOSTATUS_3QUARTERFULL +#define SAI_FIFOStatus_Full SAI_FIFOSTATUS_FULL +#define IS_SAI_BLOCK_MONO_STREO_MODE IS_SAI_BLOCK_MONO_STEREO_MODE +#define SAI_SYNCHRONOUS_EXT SAI_SYNCHRONOUS_EXT_SAI1 +#define SAI_SYNCEXT_IN_ENABLE SAI_SYNCEXT_OUTBLOCKA_ENABLE +/** + * @} + */ + +/** @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 (STM32G4) || 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) || defined (STM32F4) || defined (STM32F7) || defined(STM32H7) +#define HAL_QPSI_TIMEOUT_DEFAULT_VALUE HAL_QSPI_TIMEOUT_DEFAULT_VALUE +#endif /* STM32L4 || STM32F4 || STM32F7 */ +/** + * @} + */ + +/** @defgroup HAL_PPP_Aliased_Macros HAL PPP Aliased Macros maintained for legacy purpose + * @{ + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32_HAL_LEGACY */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h new file mode 100644 index 0000000..35092c0 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h @@ -0,0 +1,358 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the HAL + * module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_H +#define __STM32F1xx_HAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_conf.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup HAL + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup HAL_Exported_Constants HAL Exported Constants + * @{ + */ + +/** @defgroup HAL_TICK_FREQ Tick Frequency + * @{ + */ +typedef enum +{ + HAL_TICK_FREQ_10HZ = 100U, + HAL_TICK_FREQ_100HZ = 10U, + HAL_TICK_FREQ_1KHZ = 1U, + HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ +} HAL_TickFreqTypeDef; +/** + * @} + */ +/* Exported types ------------------------------------------------------------*/ +extern __IO uint32_t uwTick; +extern uint32_t uwTickPrio; +extern HAL_TickFreqTypeDef uwTickFreq; + +/** + * @} + */ +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup HAL_Exported_Macros HAL Exported Macros + * @{ + */ + +/** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode + * @brief Freeze/Unfreeze Peripherals in Debug mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @{ + */ + +/* Peripherals on APB1 */ +/** + * @brief TIM2 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) + +/** + * @brief TIM3 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM3() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM3() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) + +#if defined (DBGMCU_CR_DBG_TIM4_STOP) +/** + * @brief TIM4 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM4() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM4() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM5_STOP) +/** + * @brief TIM5 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM5() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM5() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM6_STOP) +/** + * @brief TIM6 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM6() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM6() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM7_STOP) +/** + * @brief TIM7 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM7() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM7() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM12_STOP) +/** + * @brief TIM12 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM12() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM12() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM13_STOP) +/** + * @brief TIM13 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM13() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM13() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM14_STOP) +/** + * @brief TIM14 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM14() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM14() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) +#endif + +/** + * @brief WWDG Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_WWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) +#define __HAL_DBGMCU_UNFREEZE_WWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) + +/** + * @brief IWDG Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_IWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) +#define __HAL_DBGMCU_UNFREEZE_IWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) + +/** + * @brief I2C1 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) +#define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) + +#if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) +/** + * @brief I2C2 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) +#define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) +#endif + +#if defined (DBGMCU_CR_DBG_CAN1_STOP) +/** + * @brief CAN1 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_CAN1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) +#define __HAL_DBGMCU_UNFREEZE_CAN1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_CAN2_STOP) +/** + * @brief CAN2 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_CAN2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) +#define __HAL_DBGMCU_UNFREEZE_CAN2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) +#endif + +/* Peripherals on APB2 */ +#if defined (DBGMCU_CR_DBG_TIM1_STOP) +/** + * @brief TIM1 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM8_STOP) +/** + * @brief TIM8 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM8() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM8() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM9_STOP) +/** + * @brief TIM9 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM9() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM9() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM10_STOP) +/** + * @brief TIM10 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM10() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM10() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM11_STOP) +/** + * @brief TIM11 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM11() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM11() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) +#endif + + +#if defined (DBGMCU_CR_DBG_TIM15_STOP) +/** + * @brief TIM15 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM15() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM15() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM16_STOP) +/** + * @brief TIM16 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM16() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM16() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) +#endif + +#if defined (DBGMCU_CR_DBG_TIM17_STOP) +/** + * @brief TIM17 Peripherals Debug mode + */ +#define __HAL_DBGMCU_FREEZE_TIM17() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) +#define __HAL_DBGMCU_UNFREEZE_TIM17() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) +#endif + +/** + * @} + */ + +/** @defgroup HAL_Private_Macros HAL Private Macros + * @{ + */ +#define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \ + ((FREQ) == HAL_TICK_FREQ_100HZ) || \ + ((FREQ) == HAL_TICK_FREQ_1KHZ)) +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_Exported_Functions + * @{ + */ +/** @addtogroup HAL_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions ******************************/ +HAL_StatusTypeDef HAL_Init(void); +HAL_StatusTypeDef HAL_DeInit(void); +void HAL_MspInit(void); +void HAL_MspDeInit(void); +HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority); +/** + * @} + */ + +/** @addtogroup HAL_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ************************************************/ +void HAL_IncTick(void); +void HAL_Delay(uint32_t Delay); +uint32_t HAL_GetTick(void); +uint32_t HAL_GetTickPrio(void); +HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); +HAL_TickFreqTypeDef HAL_GetTickFreq(void); +void HAL_SuspendTick(void); +void HAL_ResumeTick(void); +uint32_t HAL_GetHalVersion(void); +uint32_t HAL_GetREVID(void); +uint32_t HAL_GetDEVID(void); +uint32_t HAL_GetUIDw0(void); +uint32_t HAL_GetUIDw1(void); +uint32_t HAL_GetUIDw2(void); +void HAL_DBGMCU_EnableDBGSleepMode(void); +void HAL_DBGMCU_DisableDBGSleepMode(void); +void HAL_DBGMCU_EnableDBGStopMode(void); +void HAL_DBGMCU_DisableDBGStopMode(void); +void HAL_DBGMCU_EnableDBGStandbyMode(void); +void HAL_DBGMCU_DisableDBGStandbyMode(void); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup HAL_Private_Variables HAL Private Variables + * @{ + */ +/** + * @} + */ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup HAL_Private_Constants HAL Private Constants + * @{ + */ +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h new file mode 100644 index 0000000..e2787aa --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h @@ -0,0 +1,850 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_can.h + * @author MCD Application Team + * @brief Header file of CAN HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_CAN_H +#define STM32F1xx_HAL_CAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +#if defined (CAN1) +/** @addtogroup CAN + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CAN_Exported_Types CAN Exported Types + * @{ + */ +/** + * @brief HAL State structures definition + */ +typedef enum +{ + HAL_CAN_STATE_RESET = 0x00U, /*!< CAN not yet initialized or disabled */ + HAL_CAN_STATE_READY = 0x01U, /*!< CAN initialized and ready for use */ + HAL_CAN_STATE_LISTENING = 0x02U, /*!< CAN receive process is ongoing */ + HAL_CAN_STATE_SLEEP_PENDING = 0x03U, /*!< CAN sleep request is pending */ + HAL_CAN_STATE_SLEEP_ACTIVE = 0x04U, /*!< CAN sleep mode is active */ + HAL_CAN_STATE_ERROR = 0x05U /*!< CAN error state */ + +} HAL_CAN_StateTypeDef; + +/** + * @brief CAN init structure definition + */ +typedef struct +{ + uint32_t Prescaler; /*!< Specifies the length of a time quantum. + This parameter must be a number between Min_Data = 1 and Max_Data = 1024. */ + + uint32_t Mode; /*!< Specifies the CAN operating mode. + This parameter can be a value of @ref CAN_operating_mode */ + + uint32_t SyncJumpWidth; /*!< Specifies the maximum number of time quanta the CAN hardware + is allowed to lengthen or shorten a bit to perform resynchronization. + This parameter can be a value of @ref CAN_synchronisation_jump_width */ + + uint32_t TimeSeg1; /*!< Specifies the number of time quanta in Bit Segment 1. + This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ + + uint32_t TimeSeg2; /*!< Specifies the number of time quanta in Bit Segment 2. + This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ + + FunctionalState TimeTriggeredMode; /*!< Enable or disable the time triggered communication mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoBusOff; /*!< Enable or disable the automatic bus-off management. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoWakeUp; /*!< Enable or disable the automatic wake-up mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState AutoRetransmission; /*!< Enable or disable the non-automatic retransmission mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState ReceiveFifoLocked; /*!< Enable or disable the Receive FIFO Locked mode. + This parameter can be set to ENABLE or DISABLE. */ + + FunctionalState TransmitFifoPriority;/*!< Enable or disable the transmit FIFO priority. + This parameter can be set to ENABLE or DISABLE. */ + +} CAN_InitTypeDef; + +/** + * @brief CAN filter configuration structure definition + */ +typedef struct +{ + uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit + configuration, first one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit + configuration, second one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, + according to the mode (MSBs for a 32-bit configuration, + first one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, + according to the mode (LSBs for a 32-bit configuration, + second one for a 16-bit configuration). + This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1U) which will be assigned to the filter. + This parameter can be a value of @ref CAN_filter_FIFO */ + + uint32_t FilterBank; /*!< Specifies the filter bank which will be initialized. + For single CAN instance(14 dedicated filter banks), + this parameter must be a number between Min_Data = 0 and Max_Data = 13. + For dual CAN instances(28 filter banks shared), + this parameter must be a number between Min_Data = 0 and Max_Data = 27. */ + + uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. + This parameter can be a value of @ref CAN_filter_mode */ + + uint32_t FilterScale; /*!< Specifies the filter scale. + This parameter can be a value of @ref CAN_filter_scale */ + + uint32_t FilterActivation; /*!< Enable or disable the filter. + This parameter can be a value of @ref CAN_filter_activation */ + + uint32_t SlaveStartFilterBank; /*!< Select the start filter bank for the slave CAN instance. + For single CAN instances, this parameter is meaningless. + For dual CAN instances, all filter banks with lower index are assigned to master + CAN instance, whereas all filter banks with greater index are assigned to slave + CAN instance. + This parameter must be a number between Min_Data = 0 and Max_Data = 27. */ + +} CAN_FilterTypeDef; + +/** + * @brief CAN Tx message header structure definition + */ +typedef struct +{ + uint32_t StdId; /*!< Specifies the standard identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ + + uint32_t ExtId; /*!< Specifies the extended identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ + + uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. + This parameter can be a value of @ref CAN_identifier_type */ + + uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. + This parameter can be a value of @ref CAN_remote_transmission_request */ + + uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. + This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ + + FunctionalState TransmitGlobalTime; /*!< Specifies whether the timestamp counter value captured on start + of frame transmission, is sent in DATA6 and DATA7 replacing pData[6] and pData[7]. + @note: Time Triggered Communication Mode must be enabled. + @note: DLC must be programmed as 8 bytes, in order these 2 bytes are sent. + This parameter can be set to ENABLE or DISABLE. */ + +} CAN_TxHeaderTypeDef; + +/** + * @brief CAN Rx message header structure definition + */ +typedef struct +{ + uint32_t StdId; /*!< Specifies the standard identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ + + uint32_t ExtId; /*!< Specifies the extended identifier. + This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ + + uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. + This parameter can be a value of @ref CAN_identifier_type */ + + uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. + This parameter can be a value of @ref CAN_remote_transmission_request */ + + uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. + This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ + + uint32_t Timestamp; /*!< Specifies the timestamp counter value captured on start of frame reception. + @note: Time Triggered Communication Mode must be enabled. + This parameter must be a number between Min_Data = 0 and Max_Data = 0xFFFF. */ + + uint32_t FilterMatchIndex; /*!< Specifies the index of matching acceptance filter element. + This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */ + +} CAN_RxHeaderTypeDef; + +/** + * @brief CAN handle Structure definition + */ +typedef struct __CAN_HandleTypeDef +{ + CAN_TypeDef *Instance; /*!< Register base address */ + + CAN_InitTypeDef Init; /*!< CAN required parameters */ + + __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ + + __IO uint32_t ErrorCode; /*!< CAN Error code. + This parameter can be a value of @ref CAN_Error_Code */ + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + void (* TxMailbox0CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 0 complete callback */ + void (* TxMailbox1CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 1 complete callback */ + void (* TxMailbox2CompleteCallback)(struct __CAN_HandleTypeDef *hcan);/*!< CAN Tx Mailbox 2 complete callback */ + void (* TxMailbox0AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 0 abort callback */ + void (* TxMailbox1AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 1 abort callback */ + void (* TxMailbox2AbortCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Tx Mailbox 2 abort callback */ + void (* RxFifo0MsgPendingCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 0 msg pending callback */ + void (* RxFifo0FullCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 0 full callback */ + void (* RxFifo1MsgPendingCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 1 msg pending callback */ + void (* RxFifo1FullCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Rx FIFO 1 full callback */ + void (* SleepCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Sleep callback */ + void (* WakeUpFromRxMsgCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Wake Up from Rx msg callback */ + void (* ErrorCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Error callback */ + + void (* MspInitCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Msp Init callback */ + void (* MspDeInitCallback)(struct __CAN_HandleTypeDef *hcan); /*!< CAN Msp DeInit callback */ + +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ +} CAN_HandleTypeDef; + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/** + * @brief HAL CAN common Callback ID enumeration definition + */ +typedef enum +{ + HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID = 0x00U, /*!< CAN Tx Mailbox 0 complete callback ID */ + HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID = 0x01U, /*!< CAN Tx Mailbox 1 complete callback ID */ + HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID = 0x02U, /*!< CAN Tx Mailbox 2 complete callback ID */ + HAL_CAN_TX_MAILBOX0_ABORT_CB_ID = 0x03U, /*!< CAN Tx Mailbox 0 abort callback ID */ + HAL_CAN_TX_MAILBOX1_ABORT_CB_ID = 0x04U, /*!< CAN Tx Mailbox 1 abort callback ID */ + HAL_CAN_TX_MAILBOX2_ABORT_CB_ID = 0x05U, /*!< CAN Tx Mailbox 2 abort callback ID */ + HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID = 0x06U, /*!< CAN Rx FIFO 0 message pending callback ID */ + HAL_CAN_RX_FIFO0_FULL_CB_ID = 0x07U, /*!< CAN Rx FIFO 0 full callback ID */ + HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID = 0x08U, /*!< CAN Rx FIFO 1 message pending callback ID */ + HAL_CAN_RX_FIFO1_FULL_CB_ID = 0x09U, /*!< CAN Rx FIFO 1 full callback ID */ + HAL_CAN_SLEEP_CB_ID = 0x0AU, /*!< CAN Sleep callback ID */ + HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID = 0x0BU, /*!< CAN Wake Up from Rx msg callback ID */ + HAL_CAN_ERROR_CB_ID = 0x0CU, /*!< CAN Error callback ID */ + + HAL_CAN_MSPINIT_CB_ID = 0x0DU, /*!< CAN MspInit callback ID */ + HAL_CAN_MSPDEINIT_CB_ID = 0x0EU, /*!< CAN MspDeInit callback ID */ + +} HAL_CAN_CallbackIDTypeDef; + +/** + * @brief HAL CAN Callback pointer definition + */ +typedef void (*pCAN_CallbackTypeDef)(CAN_HandleTypeDef *hcan); /*!< pointer to a CAN callback function */ + +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup CAN_Exported_Constants CAN Exported Constants + * @{ + */ + +/** @defgroup CAN_Error_Code CAN Error Code + * @{ + */ +#define HAL_CAN_ERROR_NONE (0x00000000U) /*!< No error */ +#define HAL_CAN_ERROR_EWG (0x00000001U) /*!< Protocol Error Warning */ +#define HAL_CAN_ERROR_EPV (0x00000002U) /*!< Error Passive */ +#define HAL_CAN_ERROR_BOF (0x00000004U) /*!< Bus-off error */ +#define HAL_CAN_ERROR_STF (0x00000008U) /*!< Stuff error */ +#define HAL_CAN_ERROR_FOR (0x00000010U) /*!< Form error */ +#define HAL_CAN_ERROR_ACK (0x00000020U) /*!< Acknowledgment error */ +#define HAL_CAN_ERROR_BR (0x00000040U) /*!< Bit recessive error */ +#define HAL_CAN_ERROR_BD (0x00000080U) /*!< Bit dominant error */ +#define HAL_CAN_ERROR_CRC (0x00000100U) /*!< CRC error */ +#define HAL_CAN_ERROR_RX_FOV0 (0x00000200U) /*!< Rx FIFO0 overrun error */ +#define HAL_CAN_ERROR_RX_FOV1 (0x00000400U) /*!< Rx FIFO1 overrun error */ +#define HAL_CAN_ERROR_TX_ALST0 (0x00000800U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR0 (0x00001000U) /*!< TxMailbox 0 transmit failure due to transmit error */ +#define HAL_CAN_ERROR_TX_ALST1 (0x00002000U) /*!< TxMailbox 1 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR1 (0x00004000U) /*!< TxMailbox 1 transmit failure due to transmit error */ +#define HAL_CAN_ERROR_TX_ALST2 (0x00008000U) /*!< TxMailbox 2 transmit failure due to arbitration lost */ +#define HAL_CAN_ERROR_TX_TERR2 (0x00010000U) /*!< TxMailbox 2 transmit failure due to transmit error */ +#define HAL_CAN_ERROR_TIMEOUT (0x00020000U) /*!< Timeout error */ +#define HAL_CAN_ERROR_NOT_INITIALIZED (0x00040000U) /*!< Peripheral not initialized */ +#define HAL_CAN_ERROR_NOT_READY (0x00080000U) /*!< Peripheral not ready */ +#define HAL_CAN_ERROR_NOT_STARTED (0x00100000U) /*!< Peripheral not started */ +#define HAL_CAN_ERROR_PARAM (0x00200000U) /*!< Parameter error */ + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +#define HAL_CAN_ERROR_INVALID_CALLBACK (0x00400000U) /*!< Invalid Callback error */ +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ +#define HAL_CAN_ERROR_INTERNAL (0x00800000U) /*!< Internal error */ + +/** + * @} + */ + +/** @defgroup CAN_InitStatus CAN InitStatus + * @{ + */ +#define CAN_INITSTATUS_FAILED (0x00000000U) /*!< CAN initialization failed */ +#define CAN_INITSTATUS_SUCCESS (0x00000001U) /*!< CAN initialization OK */ +/** + * @} + */ + +/** @defgroup CAN_operating_mode CAN Operating Mode + * @{ + */ +#define CAN_MODE_NORMAL (0x00000000U) /*!< Normal mode */ +#define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ +#define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ +#define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ +/** + * @} + */ + + +/** @defgroup CAN_synchronisation_jump_width CAN Synchronization Jump Width + * @{ + */ +#define CAN_SJW_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ +#define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ +#define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in Bit Segment 1 + * @{ + */ +#define CAN_BS1_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ +#define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ +#define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ +#define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ +#define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ +#define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ +#define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ +#define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ +#define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ +#define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ +#define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ +#define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ +#define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ +#define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ +#define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in Bit Segment 2 + * @{ + */ +#define CAN_BS2_1TQ (0x00000000U) /*!< 1 time quantum */ +#define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ +#define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ +#define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ +#define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ +#define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ +#define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ +#define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ +/** + * @} + */ + +/** @defgroup CAN_filter_mode CAN Filter Mode + * @{ + */ +#define CAN_FILTERMODE_IDMASK (0x00000000U) /*!< Identifier mask mode */ +#define CAN_FILTERMODE_IDLIST (0x00000001U) /*!< Identifier list mode */ +/** + * @} + */ + +/** @defgroup CAN_filter_scale CAN Filter Scale + * @{ + */ +#define CAN_FILTERSCALE_16BIT (0x00000000U) /*!< Two 16-bit filters */ +#define CAN_FILTERSCALE_32BIT (0x00000001U) /*!< One 32-bit filter */ +/** + * @} + */ + +/** @defgroup CAN_filter_activation CAN Filter Activation + * @{ + */ +#define CAN_FILTER_DISABLE (0x00000000U) /*!< Disable filter */ +#define CAN_FILTER_ENABLE (0x00000001U) /*!< Enable filter */ +/** + * @} + */ + +/** @defgroup CAN_filter_FIFO CAN Filter FIFO + * @{ + */ +#define CAN_FILTER_FIFO0 (0x00000000U) /*!< Filter FIFO 0 assignment for filter x */ +#define CAN_FILTER_FIFO1 (0x00000001U) /*!< Filter FIFO 1 assignment for filter x */ +/** + * @} + */ + +/** @defgroup CAN_identifier_type CAN Identifier Type + * @{ + */ +#define CAN_ID_STD (0x00000000U) /*!< Standard Id */ +#define CAN_ID_EXT (0x00000004U) /*!< Extended Id */ +/** + * @} + */ + +/** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request + * @{ + */ +#define CAN_RTR_DATA (0x00000000U) /*!< Data frame */ +#define CAN_RTR_REMOTE (0x00000002U) /*!< Remote frame */ +/** + * @} + */ + +/** @defgroup CAN_receive_FIFO_number CAN Receive FIFO Number + * @{ + */ +#define CAN_RX_FIFO0 (0x00000000U) /*!< CAN receive FIFO 0 */ +#define CAN_RX_FIFO1 (0x00000001U) /*!< CAN receive FIFO 1 */ +/** + * @} + */ + +/** @defgroup CAN_Tx_Mailboxes CAN Tx Mailboxes + * @{ + */ +#define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */ +#define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */ +#define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */ +/** + * @} + */ + +/** @defgroup CAN_flags CAN Flags + * @{ + */ +/* Transmit Flags */ +#define CAN_FLAG_RQCP0 (0x00000500U) /*!< Request complete MailBox 0 flag */ +#define CAN_FLAG_TXOK0 (0x00000501U) /*!< Transmission OK MailBox 0 flag */ +#define CAN_FLAG_ALST0 (0x00000502U) /*!< Arbitration Lost MailBox 0 flag */ +#define CAN_FLAG_TERR0 (0x00000503U) /*!< Transmission error MailBox 0 flag */ +#define CAN_FLAG_RQCP1 (0x00000508U) /*!< Request complete MailBox1 flag */ +#define CAN_FLAG_TXOK1 (0x00000509U) /*!< Transmission OK MailBox 1 flag */ +#define CAN_FLAG_ALST1 (0x0000050AU) /*!< Arbitration Lost MailBox 1 flag */ +#define CAN_FLAG_TERR1 (0x0000050BU) /*!< Transmission error MailBox 1 flag */ +#define CAN_FLAG_RQCP2 (0x00000510U) /*!< Request complete MailBox2 flag */ +#define CAN_FLAG_TXOK2 (0x00000511U) /*!< Transmission OK MailBox 2 flag */ +#define CAN_FLAG_ALST2 (0x00000512U) /*!< Arbitration Lost MailBox 2 flag */ +#define CAN_FLAG_TERR2 (0x00000513U) /*!< Transmission error MailBox 2 flag */ +#define CAN_FLAG_TME0 (0x0000051AU) /*!< Transmit mailbox 0 empty flag */ +#define CAN_FLAG_TME1 (0x0000051BU) /*!< Transmit mailbox 1 empty flag */ +#define CAN_FLAG_TME2 (0x0000051CU) /*!< Transmit mailbox 2 empty flag */ +#define CAN_FLAG_LOW0 (0x0000051DU) /*!< Lowest priority mailbox 0 flag */ +#define CAN_FLAG_LOW1 (0x0000051EU) /*!< Lowest priority mailbox 1 flag */ +#define CAN_FLAG_LOW2 (0x0000051FU) /*!< Lowest priority mailbox 2 flag */ + +/* Receive Flags */ +#define CAN_FLAG_FF0 (0x00000203U) /*!< RX FIFO 0 Full flag */ +#define CAN_FLAG_FOV0 (0x00000204U) /*!< RX FIFO 0 Overrun flag */ +#define CAN_FLAG_FF1 (0x00000403U) /*!< RX FIFO 1 Full flag */ +#define CAN_FLAG_FOV1 (0x00000404U) /*!< RX FIFO 1 Overrun flag */ + +/* Operating Mode Flags */ +#define CAN_FLAG_INAK (0x00000100U) /*!< Initialization acknowledge flag */ +#define CAN_FLAG_SLAK (0x00000101U) /*!< Sleep acknowledge flag */ +#define CAN_FLAG_ERRI (0x00000102U) /*!< Error flag */ +#define CAN_FLAG_WKU (0x00000103U) /*!< Wake up interrupt flag */ +#define CAN_FLAG_SLAKI (0x00000104U) /*!< Sleep acknowledge interrupt flag */ + +/* Error Flags */ +#define CAN_FLAG_EWG (0x00000300U) /*!< Error warning flag */ +#define CAN_FLAG_EPV (0x00000301U) /*!< Error passive flag */ +#define CAN_FLAG_BOF (0x00000302U) /*!< Bus-Off flag */ +/** + * @} + */ + + +/** @defgroup CAN_Interrupts CAN Interrupts + * @{ + */ +/* Transmit Interrupt */ +#define CAN_IT_TX_MAILBOX_EMPTY ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ + +/* Receive Interrupts */ +#define CAN_IT_RX_FIFO0_MSG_PENDING ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ +#define CAN_IT_RX_FIFO0_FULL ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ +#define CAN_IT_RX_FIFO0_OVERRUN ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ +#define CAN_IT_RX_FIFO1_MSG_PENDING ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ +#define CAN_IT_RX_FIFO1_FULL ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ +#define CAN_IT_RX_FIFO1_OVERRUN ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ + +/* Operating Mode Interrupts */ +#define CAN_IT_WAKEUP ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ +#define CAN_IT_SLEEP_ACK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ + +/* Error Interrupts */ +#define CAN_IT_ERROR_WARNING ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ +#define CAN_IT_ERROR_PASSIVE ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ +#define CAN_IT_BUSOFF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ +#define CAN_IT_LAST_ERROR_CODE ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ +#define CAN_IT_ERROR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup CAN_Exported_Macros CAN Exported Macros + * @{ + */ + +/** @brief Reset CAN handle state + * @param __HANDLE__ CAN handle. + * @retval None + */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +#define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) do{ \ + (__HANDLE__)->State = HAL_CAN_STATE_RESET; \ + (__HANDLE__)->MspInitCallback = NULL; \ + (__HANDLE__)->MspDeInitCallback = NULL; \ + } while(0) +#else +#define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) +#endif /*USE_HAL_CAN_REGISTER_CALLBACKS */ + +/** + * @brief Enable the specified CAN interrupts. + * @param __HANDLE__ CAN handle. + * @param __INTERRUPT__ CAN Interrupt sources to enable. + * This parameter can be any combination of @arg CAN_Interrupts + * @retval None + */ +#define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) + +/** + * @brief Disable the specified CAN interrupts. + * @param __HANDLE__ CAN handle. + * @param __INTERRUPT__ CAN Interrupt sources to disable. + * This parameter can be any combination of @arg CAN_Interrupts + * @retval None + */ +#define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) + +/** @brief Check if the specified CAN interrupt source is enabled or disabled. + * @param __HANDLE__ specifies the CAN Handle. + * @param __INTERRUPT__ specifies the CAN interrupt source to check. + * This parameter can be a value of @arg CAN_Interrupts + * @retval The state of __IT__ (TRUE or FALSE). + */ +#define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) & (__INTERRUPT__)) + +/** @brief Check whether the specified CAN flag is set or not. + * @param __HANDLE__ specifies the CAN Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of @arg CAN_flags + * @retval The state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ + ((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 3U)? ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) + +/** @brief Clear the specified CAN pending flag. + * @param __HANDLE__ specifies the CAN Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg CAN_FLAG_RQCP0: Request complete MailBox 0 Flag + * @arg CAN_FLAG_TXOK0: Transmission OK MailBox 0 Flag + * @arg CAN_FLAG_ALST0: Arbitration Lost MailBox 0 Flag + * @arg CAN_FLAG_TERR0: Transmission error MailBox 0 Flag + * @arg CAN_FLAG_RQCP1: Request complete MailBox 1 Flag + * @arg CAN_FLAG_TXOK1: Transmission OK MailBox 1 Flag + * @arg CAN_FLAG_ALST1: Arbitration Lost MailBox 1 Flag + * @arg CAN_FLAG_TERR1: Transmission error MailBox 1 Flag + * @arg CAN_FLAG_RQCP2: Request complete MailBox 2 Flag + * @arg CAN_FLAG_TXOK2: Transmission OK MailBox 2 Flag + * @arg CAN_FLAG_ALST2: Arbitration Lost MailBox 2 Flag + * @arg CAN_FLAG_TERR2: Transmission error MailBox 2 Flag + * @arg CAN_FLAG_FF0: RX FIFO 0 Full Flag + * @arg CAN_FLAG_FOV0: RX FIFO 0 Overrun Flag + * @arg CAN_FLAG_FF1: RX FIFO 1 Full Flag + * @arg CAN_FLAG_FOV1: RX FIFO 1 Overrun Flag + * @arg CAN_FLAG_WKUI: Wake up Interrupt Flag + * @arg CAN_FLAG_SLAKI: Sleep acknowledge Interrupt Flag + * @retval None + */ +#define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ + ((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ + (((__FLAG__) >> 8U) == 1U)? (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CAN_Exported_Functions CAN Exported Functions + * @{ + */ + +/** @addtogroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/* Initialization and de-initialization functions *****************************/ +HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan); +void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan); +void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/* Callbacks Register/UnRegister functions ***********************************/ +HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID, void (* pCallback)(CAN_HandleTypeDef *_hcan)); +HAL_StatusTypeDef HAL_CAN_UnRegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID); + +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group2 Configuration functions + * @brief Configuration functions + * @{ + */ + +/* Configuration functions ****************************************************/ +HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group3 Control functions + * @brief Control functions + * @{ + */ + +/* Control functions **********************************************************/ +HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox); +HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); +uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); +uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox); +HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]); +uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group4 Interrupts management + * @brief Interrupts management + * @{ + */ +/* Interrupts management ******************************************************/ +HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs); +HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs); +void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group5 Callback functions + * @brief Callback functions + * @{ + */ +/* Callbacks functions ********************************************************/ + +void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan); +void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** @addtogroup CAN_Exported_Functions_Group6 Peripheral State and Error functions + * @brief CAN Peripheral State functions + * @{ + */ +/* Peripheral State and Error functions ***************************************/ +HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan); +uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); +HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan); + +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/** @defgroup CAN_Private_Types CAN Private Types + * @{ + */ + +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/** @defgroup CAN_Private_Variables CAN Private Variables + * @{ + */ + +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup CAN_Private_Constants CAN Private Constants + * @{ + */ +#define CAN_FLAG_MASK (0x000000FFU) +/** + * @} + */ + +/* Private Macros -----------------------------------------------------------*/ +/** @defgroup CAN_Private_Macros CAN Private Macros + * @{ + */ + +#define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ + ((MODE) == CAN_MODE_LOOPBACK)|| \ + ((MODE) == CAN_MODE_SILENT) || \ + ((MODE) == CAN_MODE_SILENT_LOOPBACK)) +#define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ) || \ + ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) +#define IS_CAN_BS1(BS1) (((BS1) == CAN_BS1_1TQ) || ((BS1) == CAN_BS1_2TQ) || \ + ((BS1) == CAN_BS1_3TQ) || ((BS1) == CAN_BS1_4TQ) || \ + ((BS1) == CAN_BS1_5TQ) || ((BS1) == CAN_BS1_6TQ) || \ + ((BS1) == CAN_BS1_7TQ) || ((BS1) == CAN_BS1_8TQ) || \ + ((BS1) == CAN_BS1_9TQ) || ((BS1) == CAN_BS1_10TQ)|| \ + ((BS1) == CAN_BS1_11TQ)|| ((BS1) == CAN_BS1_12TQ)|| \ + ((BS1) == CAN_BS1_13TQ)|| ((BS1) == CAN_BS1_14TQ)|| \ + ((BS1) == CAN_BS1_15TQ)|| ((BS1) == CAN_BS1_16TQ)) +#define IS_CAN_BS2(BS2) (((BS2) == CAN_BS2_1TQ) || ((BS2) == CAN_BS2_2TQ) || \ + ((BS2) == CAN_BS2_3TQ) || ((BS2) == CAN_BS2_4TQ) || \ + ((BS2) == CAN_BS2_5TQ) || ((BS2) == CAN_BS2_6TQ) || \ + ((BS2) == CAN_BS2_7TQ) || ((BS2) == CAN_BS2_8TQ)) +#define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U)) +#define IS_CAN_FILTER_ID_HALFWORD(HALFWORD) ((HALFWORD) <= 0xFFFFU) +#if defined(CAN2) +#define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 27U) +#endif +#define IS_CAN_FILTER_BANK_SINGLE(BANK) ((BANK) <= 13U) +#define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ + ((MODE) == CAN_FILTERMODE_IDLIST)) +#define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ + ((SCALE) == CAN_FILTERSCALE_32BIT)) +#define IS_CAN_FILTER_ACTIVATION(ACTIVATION) (((ACTIVATION) == CAN_FILTER_DISABLE) || \ + ((ACTIVATION) == CAN_FILTER_ENABLE)) +#define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ + ((FIFO) == CAN_FILTER_FIFO1)) +#define IS_CAN_TX_MAILBOX(TRANSMITMAILBOX) (((TRANSMITMAILBOX) == CAN_TX_MAILBOX0 ) || \ + ((TRANSMITMAILBOX) == CAN_TX_MAILBOX1 ) || \ + ((TRANSMITMAILBOX) == CAN_TX_MAILBOX2 )) +#define IS_CAN_TX_MAILBOX_LIST(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= (CAN_TX_MAILBOX0 | CAN_TX_MAILBOX1 | CAN_TX_MAILBOX2)) +#define IS_CAN_STDID(STDID) ((STDID) <= 0x7FFU) +#define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU) +#define IS_CAN_DLC(DLC) ((DLC) <= 8U) +#define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ + ((IDTYPE) == CAN_ID_EXT)) +#define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) +#define IS_CAN_RX_FIFO(FIFO) (((FIFO) == CAN_RX_FIFO0) || ((FIFO) == CAN_RX_FIFO1)) +#define IS_CAN_IT(IT) ((IT) <= (CAN_IT_TX_MAILBOX_EMPTY | CAN_IT_RX_FIFO0_MSG_PENDING | \ + CAN_IT_RX_FIFO0_FULL | CAN_IT_RX_FIFO0_OVERRUN | \ + CAN_IT_RX_FIFO1_MSG_PENDING | CAN_IT_RX_FIFO1_FULL | \ + CAN_IT_RX_FIFO1_OVERRUN | CAN_IT_WAKEUP | \ + CAN_IT_SLEEP_ACK | CAN_IT_ERROR_WARNING | \ + CAN_IT_ERROR_PASSIVE | CAN_IT_BUSOFF | \ + CAN_IT_LAST_ERROR_CODE | CAN_IT_ERROR)) + +/** + * @} + */ +/* End of private macros -----------------------------------------------------*/ + +/** + * @} + */ + + +#endif /* CAN1 */ +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_HAL_CAN_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h new file mode 100644 index 0000000..a365b02 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h @@ -0,0 +1,410 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_cortex.h + * @author MCD Application Team + * @brief Header file of CORTEX HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_CORTEX_H +#define __STM32F1xx_HAL_CORTEX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup CORTEX + * @{ + */ +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CORTEX_Exported_Types Cortex Exported Types + * @{ + */ + +#if (__MPU_PRESENT == 1U) +/** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition + * @brief MPU Region initialization structure + * @{ + */ +typedef struct +{ + uint8_t Enable; /*!< Specifies the status of the region. + This parameter can be a value of @ref CORTEX_MPU_Region_Enable */ + uint8_t Number; /*!< Specifies the number of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Number */ + uint32_t BaseAddress; /*!< Specifies the base address of the region to protect. */ + uint8_t Size; /*!< Specifies the size of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Size */ + uint8_t SubRegionDisable; /*!< Specifies the number of the subregion protection to disable. + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ + uint8_t TypeExtField; /*!< Specifies the TEX field level. + This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */ + uint8_t AccessPermission; /*!< Specifies the region access permission type. + This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */ + uint8_t DisableExec; /*!< Specifies the instruction access status. + This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */ + uint8_t IsShareable; /*!< Specifies the shareability status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */ + uint8_t IsCacheable; /*!< Specifies the cacheable status of the region protected. + This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */ + uint8_t IsBufferable; /*!< Specifies the bufferable status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */ +}MPU_Region_InitTypeDef; +/** + * @} + */ +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants + * @{ + */ + +/** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group + * @{ + */ +#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority + 4 bits for subpriority */ +#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority + 3 bits for subpriority */ +#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority + 2 bits for subpriority */ +#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority + 1 bits for subpriority */ +#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority + 0 bits for subpriority */ +/** + * @} + */ + +/** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source + * @{ + */ +#define SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U +#define SYSTICK_CLKSOURCE_HCLK 0x00000004U + +/** + * @} + */ + +#if (__MPU_PRESENT == 1) +/** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control + * @{ + */ +#define MPU_HFNMI_PRIVDEF_NONE 0x00000000U +#define MPU_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk +#define MPU_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk +#define MPU_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) + +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable + * @{ + */ +#define MPU_REGION_ENABLE ((uint8_t)0x01) +#define MPU_REGION_DISABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access + * @{ + */ +#define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00) +#define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable + * @{ + */ +#define MPU_ACCESS_SHAREABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable + * @{ + */ +#define MPU_ACCESS_CACHEABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable + * @{ + */ +#define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01) +#define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels + * @{ + */ +#define MPU_TEX_LEVEL0 ((uint8_t)0x00) +#define MPU_TEX_LEVEL1 ((uint8_t)0x01) +#define MPU_TEX_LEVEL2 ((uint8_t)0x02) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size + * @{ + */ +#define MPU_REGION_SIZE_32B ((uint8_t)0x04) +#define MPU_REGION_SIZE_64B ((uint8_t)0x05) +#define MPU_REGION_SIZE_128B ((uint8_t)0x06) +#define MPU_REGION_SIZE_256B ((uint8_t)0x07) +#define MPU_REGION_SIZE_512B ((uint8_t)0x08) +#define MPU_REGION_SIZE_1KB ((uint8_t)0x09) +#define MPU_REGION_SIZE_2KB ((uint8_t)0x0A) +#define MPU_REGION_SIZE_4KB ((uint8_t)0x0B) +#define MPU_REGION_SIZE_8KB ((uint8_t)0x0C) +#define MPU_REGION_SIZE_16KB ((uint8_t)0x0D) +#define MPU_REGION_SIZE_32KB ((uint8_t)0x0E) +#define MPU_REGION_SIZE_64KB ((uint8_t)0x0F) +#define MPU_REGION_SIZE_128KB ((uint8_t)0x10) +#define MPU_REGION_SIZE_256KB ((uint8_t)0x11) +#define MPU_REGION_SIZE_512KB ((uint8_t)0x12) +#define MPU_REGION_SIZE_1MB ((uint8_t)0x13) +#define MPU_REGION_SIZE_2MB ((uint8_t)0x14) +#define MPU_REGION_SIZE_4MB ((uint8_t)0x15) +#define MPU_REGION_SIZE_8MB ((uint8_t)0x16) +#define MPU_REGION_SIZE_16MB ((uint8_t)0x17) +#define MPU_REGION_SIZE_32MB ((uint8_t)0x18) +#define MPU_REGION_SIZE_64MB ((uint8_t)0x19) +#define MPU_REGION_SIZE_128MB ((uint8_t)0x1A) +#define MPU_REGION_SIZE_256MB ((uint8_t)0x1B) +#define MPU_REGION_SIZE_512MB ((uint8_t)0x1C) +#define MPU_REGION_SIZE_1GB ((uint8_t)0x1D) +#define MPU_REGION_SIZE_2GB ((uint8_t)0x1E) +#define MPU_REGION_SIZE_4GB ((uint8_t)0x1F) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes + * @{ + */ +#define MPU_REGION_NO_ACCESS ((uint8_t)0x00) +#define MPU_REGION_PRIV_RW ((uint8_t)0x01) +#define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02) +#define MPU_REGION_FULL_ACCESS ((uint8_t)0x03) +#define MPU_REGION_PRIV_RO ((uint8_t)0x05) +#define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06) +/** + * @} + */ + +/** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number + * @{ + */ +#define MPU_REGION_NUMBER0 ((uint8_t)0x00) +#define MPU_REGION_NUMBER1 ((uint8_t)0x01) +#define MPU_REGION_NUMBER2 ((uint8_t)0x02) +#define MPU_REGION_NUMBER3 ((uint8_t)0x03) +#define MPU_REGION_NUMBER4 ((uint8_t)0x04) +#define MPU_REGION_NUMBER5 ((uint8_t)0x05) +#define MPU_REGION_NUMBER6 ((uint8_t)0x06) +#define MPU_REGION_NUMBER7 ((uint8_t)0x07) +/** + * @} + */ +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + + +/* Exported Macros -----------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CORTEX_Exported_Functions + * @{ + */ + +/** @addtogroup CORTEX_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup); +void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority); +void HAL_NVIC_EnableIRQ(IRQn_Type IRQn); +void HAL_NVIC_DisableIRQ(IRQn_Type IRQn); +void HAL_NVIC_SystemReset(void); +uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); +/** + * @} + */ + +/** @addtogroup CORTEX_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ***********************************************/ +uint32_t HAL_NVIC_GetPriorityGrouping(void); +void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority); +uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); +void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn); +void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn); +uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn); +void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource); +void HAL_SYSTICK_IRQHandler(void); +void HAL_SYSTICK_Callback(void); + +#if (__MPU_PRESENT == 1U) +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 */ +/** + * @} + */ + +/** + * @} + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup CORTEX_Private_Macros CORTEX Private Macros + * @{ + */ +#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \ + ((GROUP) == NVIC_PRIORITYGROUP_1) || \ + ((GROUP) == NVIC_PRIORITYGROUP_2) || \ + ((GROUP) == NVIC_PRIORITYGROUP_3) || \ + ((GROUP) == NVIC_PRIORITYGROUP_4)) + +#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U) + +#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U) + +#define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= (IRQn_Type)0x00U) + +#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \ + ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) + +#if (__MPU_PRESENT == 1U) +#define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \ + ((STATE) == MPU_REGION_DISABLE)) + +#define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \ + ((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE)) + +#define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \ + ((STATE) == MPU_ACCESS_NOT_SHAREABLE)) + +#define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \ + ((STATE) == MPU_ACCESS_NOT_CACHEABLE)) + +#define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \ + ((STATE) == MPU_ACCESS_NOT_BUFFERABLE)) + +#define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \ + ((TYPE) == MPU_TEX_LEVEL1) || \ + ((TYPE) == MPU_TEX_LEVEL2)) + +#define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \ + ((TYPE) == MPU_REGION_PRIV_RW) || \ + ((TYPE) == MPU_REGION_PRIV_RW_URO) || \ + ((TYPE) == MPU_REGION_FULL_ACCESS) || \ + ((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) || \ + ((NUMBER) == MPU_REGION_NUMBER7)) + +#define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \ + ((SIZE) == MPU_REGION_SIZE_64B) || \ + ((SIZE) == MPU_REGION_SIZE_128B) || \ + ((SIZE) == MPU_REGION_SIZE_256B) || \ + ((SIZE) == MPU_REGION_SIZE_512B) || \ + ((SIZE) == MPU_REGION_SIZE_1KB) || \ + ((SIZE) == MPU_REGION_SIZE_2KB) || \ + ((SIZE) == MPU_REGION_SIZE_4KB) || \ + ((SIZE) == MPU_REGION_SIZE_8KB) || \ + ((SIZE) == MPU_REGION_SIZE_16KB) || \ + ((SIZE) == MPU_REGION_SIZE_32KB) || \ + ((SIZE) == MPU_REGION_SIZE_64KB) || \ + ((SIZE) == MPU_REGION_SIZE_128KB) || \ + ((SIZE) == MPU_REGION_SIZE_256KB) || \ + ((SIZE) == MPU_REGION_SIZE_512KB) || \ + ((SIZE) == MPU_REGION_SIZE_1MB) || \ + ((SIZE) == MPU_REGION_SIZE_2MB) || \ + ((SIZE) == MPU_REGION_SIZE_4MB) || \ + ((SIZE) == MPU_REGION_SIZE_8MB) || \ + ((SIZE) == MPU_REGION_SIZE_16MB) || \ + ((SIZE) == MPU_REGION_SIZE_32MB) || \ + ((SIZE) == MPU_REGION_SIZE_64MB) || \ + ((SIZE) == MPU_REGION_SIZE_128MB) || \ + ((SIZE) == MPU_REGION_SIZE_256MB) || \ + ((SIZE) == MPU_REGION_SIZE_512MB) || \ + ((SIZE) == MPU_REGION_SIZE_1GB) || \ + ((SIZE) == MPU_REGION_SIZE_2GB) || \ + ((SIZE) == MPU_REGION_SIZE_4GB)) + +#define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF) +#endif /* __MPU_PRESENT */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_CORTEX_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h new file mode 100644 index 0000000..155c017 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h @@ -0,0 +1,210 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_def.h + * @author MCD Application Team + * @brief This file contains HAL common defines, enumeration, macros and + * structures definitions. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_DEF +#define __STM32F1xx_HAL_DEF + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" +#include "Legacy/stm32_hal_legacy.h" +#include + +/* Exported types ------------------------------------------------------------*/ + +/** + * @brief HAL Status structures definition + */ +typedef enum +{ + HAL_OK = 0x00U, + HAL_ERROR = 0x01U, + HAL_BUSY = 0x02U, + HAL_TIMEOUT = 0x03U +} HAL_StatusTypeDef; + +/** + * @brief HAL Lock structures definition + */ +typedef enum +{ + HAL_UNLOCKED = 0x00U, + HAL_LOCKED = 0x01U +} HAL_LockTypeDef; + +/* Exported macro ------------------------------------------------------------*/ +#define HAL_MAX_DELAY 0xFFFFFFFFU + +#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != 0U) +#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) + +#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ + do{ \ + (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ + (__DMA_HANDLE__).Parent = (__HANDLE__); \ + } while(0U) + +#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ + +/** @brief Reset the Handle's State field. + * @param __HANDLE__ specifies the Peripheral Handle. + * @note This macro can be used for the following purpose: + * - When the Handle is declared as local variable; before passing it as parameter + * to HAL_PPP_Init() for the first time, it is mandatory to use this macro + * to set to 0 the Handle's "State" field. + * Otherwise, "State" field may have any random value and the first time the function + * HAL_PPP_Init() is called, the low level hardware initialization will be missed + * (i.e. HAL_PPP_MspInit() will not be executed). + * - When there is a need to reconfigure the low level hardware: instead of calling + * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). + * In this later function, when the Handle's "State" field is set to 0, it will execute the function + * HAL_PPP_MspInit() which will reconfigure the low level hardware. + * @retval None + */ +#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) + +#if (USE_RTOS == 1U) +/* Reserved for future use */ +#error "USE_RTOS should be 0 in the current HAL release" +#else +#define __HAL_LOCK(__HANDLE__) \ + do{ \ + if((__HANDLE__)->Lock == HAL_LOCKED) \ + { \ + return HAL_BUSY; \ + } \ + else \ + { \ + (__HANDLE__)->Lock = HAL_LOCKED; \ + } \ + }while (0U) + +#define __HAL_UNLOCK(__HANDLE__) \ + do{ \ + (__HANDLE__)->Lock = HAL_UNLOCKED; \ + }while (0U) +#endif /* USE_RTOS */ + +#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ +#ifndef __weak +#define __weak __attribute__((weak)) +#endif +#ifndef __packed +#define __packed __attribute__((packed)) +#endif +#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ +#ifndef __weak +#define __weak __attribute__((weak)) +#endif /* __weak */ +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif /* __packed */ +#endif /* __GNUC__ */ + + +/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ +#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ +#ifndef __ALIGN_BEGIN +#define __ALIGN_BEGIN +#endif +#ifndef __ALIGN_END +#define __ALIGN_END __attribute__ ((aligned (4))) +#endif +#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ +#ifndef __ALIGN_END +#define __ALIGN_END __attribute__ ((aligned (4))) +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#define __ALIGN_BEGIN +#endif /* __ALIGN_BEGIN */ +#else +#ifndef __ALIGN_END +#define __ALIGN_END +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#if defined (__CC_ARM) /* ARM Compiler V5*/ +#define __ALIGN_BEGIN __align(4) +#elif defined (__ICCARM__) /* IAR Compiler */ +#define __ALIGN_BEGIN +#endif /* __CC_ARM */ +#endif /* __ALIGN_BEGIN */ +#endif /* __GNUC__ */ + + +/** + * @brief __RAM_FUNC definition + */ +#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) +/* ARM Compiler V4/V5 and V6 + -------------------------- + RAM functions are defined using the toolchain options. + Functions that are executed in RAM should reside in a separate source module. + Using the 'Options for File' dialog you can simply change the 'Code / Const' + area of a module to a memory space in physical RAM. + Available memory areas are declared in the 'Target' tab of the 'Options for Target' + dialog. +*/ +#define __RAM_FUNC + +#elif defined ( __ICCARM__ ) +/* ICCARM Compiler + --------------- + RAM functions are defined using a specific toolchain keyword "__ramfunc". +*/ +#define __RAM_FUNC __ramfunc + +#elif defined ( __GNUC__ ) +/* GNU Compiler + ------------ + RAM functions are defined using a specific toolchain attribute + "__attribute__((section(".RamFunc")))". +*/ +#define __RAM_FUNC __attribute__((section(".RamFunc"))) + +#endif + +/** + * @brief __NOINLINE definition + */ +#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) +/* ARM V4/V5 and V6 & GNU Compiler + ------------------------------- +*/ +#define __NOINLINE __attribute__ ( (noinline) ) + +#elif defined ( __ICCARM__ ) +/* ICCARM Compiler + --------------- +*/ +#define __NOINLINE _Pragma("optimize = no_inline") + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ___STM32F1xx_HAL_DEF */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h new file mode 100644 index 0000000..9a407f4 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h @@ -0,0 +1,457 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_dma.h + * @author MCD Application Team + * @brief Header file of DMA HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_DMA_H +#define __STM32F1xx_HAL_DMA_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup DMA + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Types DMA Exported Types + * @{ + */ + +/** + * @brief DMA Configuration Structure definition + */ +typedef struct +{ + uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory. + This parameter can be a value of @ref DMA_Data_transfer_direction */ + + uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not. + This parameter can be a value of @ref DMA_Peripheral_incremented_mode */ + + uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not. + This parameter can be a value of @ref DMA_Memory_incremented_mode */ + + uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width. + This parameter can be a value of @ref DMA_Peripheral_data_size */ + + uint32_t MemDataAlignment; /*!< Specifies the Memory data width. + This parameter can be a value of @ref DMA_Memory_data_size */ + + uint32_t Mode; /*!< Specifies the operation mode of the DMAy Channelx. + This parameter can be a value of @ref DMA_mode + @note The circular buffer mode cannot be used if the memory-to-memory + data transfer is configured on the selected Channel */ + + uint32_t Priority; /*!< Specifies the software priority for the DMAy Channelx. + This parameter can be a value of @ref DMA_Priority_level */ +} DMA_InitTypeDef; + +/** + * @brief HAL DMA State structures definition + */ +typedef enum +{ + HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */ + HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */ + HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */ + HAL_DMA_STATE_TIMEOUT = 0x03U /*!< DMA timeout state */ +}HAL_DMA_StateTypeDef; + +/** + * @brief HAL DMA Error Code structure definition + */ +typedef enum +{ + HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */ + HAL_DMA_HALF_TRANSFER = 0x01U /*!< Half Transfer */ +}HAL_DMA_LevelCompleteTypeDef; + +/** + * @brief HAL DMA Callback ID structure definition + */ +typedef enum +{ + HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */ + HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half transfer */ + HAL_DMA_XFER_ERROR_CB_ID = 0x02U, /*!< Error */ + HAL_DMA_XFER_ABORT_CB_ID = 0x03U, /*!< Abort */ + HAL_DMA_XFER_ALL_CB_ID = 0x04U /*!< All */ + +}HAL_DMA_CallbackIDTypeDef; + +/** + * @brief DMA handle Structure definition + */ +typedef struct __DMA_HandleTypeDef +{ + DMA_Channel_TypeDef *Instance; /*!< Register base address */ + + DMA_InitTypeDef Init; /*!< DMA communication parameters */ + + HAL_LockTypeDef Lock; /*!< DMA locking object */ + + HAL_DMA_StateTypeDef State; /*!< DMA transfer state */ + + void *Parent; /*!< Parent object state */ + + void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */ + + void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */ + + void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */ + + void (* XferAbortCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer abort callback */ + + __IO uint32_t ErrorCode; /*!< DMA Error code */ + + DMA_TypeDef *DmaBaseAddress; /*!< DMA Channel Base Address */ + + uint32_t ChannelIndex; /*!< DMA Channel Index */ + +} DMA_HandleTypeDef; +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Constants DMA Exported Constants + * @{ + */ + +/** @defgroup DMA_Error_Code DMA Error Code + * @{ + */ +#define HAL_DMA_ERROR_NONE 0x00000000U /*!< No error */ +#define HAL_DMA_ERROR_TE 0x00000001U /*!< Transfer error */ +#define HAL_DMA_ERROR_NO_XFER 0x00000004U /*!< no ongoing transfer */ +#define HAL_DMA_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */ +#define HAL_DMA_ERROR_NOT_SUPPORTED 0x00000100U /*!< Not supported mode */ +/** + * @} + */ + +/** @defgroup DMA_Data_transfer_direction DMA Data transfer direction + * @{ + */ +#define DMA_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */ +#define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_CCR_DIR) /*!< Memory to peripheral direction */ +#define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_CCR_MEM2MEM) /*!< Memory to memory direction */ + +/** + * @} + */ + +/** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode + * @{ + */ +#define DMA_PINC_ENABLE ((uint32_t)DMA_CCR_PINC) /*!< Peripheral increment mode Enable */ +#define DMA_PINC_DISABLE 0x00000000U /*!< Peripheral increment mode Disable */ +/** + * @} + */ + +/** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode + * @{ + */ +#define DMA_MINC_ENABLE ((uint32_t)DMA_CCR_MINC) /*!< Memory increment mode Enable */ +#define DMA_MINC_DISABLE 0x00000000U /*!< Memory increment mode Disable */ +/** + * @} + */ + +/** @defgroup DMA_Peripheral_data_size DMA Peripheral data size + * @{ + */ +#define DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment: Byte */ +#define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */ +#define DMA_PDATAALIGN_WORD ((uint32_t)DMA_CCR_PSIZE_1) /*!< Peripheral data alignment: Word */ +/** + * @} + */ + +/** @defgroup DMA_Memory_data_size DMA Memory data size + * @{ + */ +#define DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment: Byte */ +#define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_MSIZE_0) /*!< Memory data alignment: HalfWord */ +#define DMA_MDATAALIGN_WORD ((uint32_t)DMA_CCR_MSIZE_1) /*!< Memory data alignment: Word */ +/** + * @} + */ + +/** @defgroup DMA_mode DMA mode + * @{ + */ +#define DMA_NORMAL 0x00000000U /*!< Normal mode */ +#define DMA_CIRCULAR ((uint32_t)DMA_CCR_CIRC) /*!< Circular mode */ +/** + * @} + */ + +/** @defgroup DMA_Priority_level DMA Priority level + * @{ + */ +#define DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */ +#define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_CCR_PL_0) /*!< Priority level : Medium */ +#define DMA_PRIORITY_HIGH ((uint32_t)DMA_CCR_PL_1) /*!< Priority level : High */ +#define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_CCR_PL) /*!< Priority level : Very_High */ +/** + * @} + */ + + +/** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions + * @{ + */ +#define DMA_IT_TC ((uint32_t)DMA_CCR_TCIE) +#define DMA_IT_HT ((uint32_t)DMA_CCR_HTIE) +#define DMA_IT_TE ((uint32_t)DMA_CCR_TEIE) +/** + * @} + */ + +/** @defgroup DMA_flag_definitions DMA flag definitions + * @{ + */ +#define DMA_FLAG_GL1 0x00000001U +#define DMA_FLAG_TC1 0x00000002U +#define DMA_FLAG_HT1 0x00000004U +#define DMA_FLAG_TE1 0x00000008U +#define DMA_FLAG_GL2 0x00000010U +#define DMA_FLAG_TC2 0x00000020U +#define DMA_FLAG_HT2 0x00000040U +#define DMA_FLAG_TE2 0x00000080U +#define DMA_FLAG_GL3 0x00000100U +#define DMA_FLAG_TC3 0x00000200U +#define DMA_FLAG_HT3 0x00000400U +#define DMA_FLAG_TE3 0x00000800U +#define DMA_FLAG_GL4 0x00001000U +#define DMA_FLAG_TC4 0x00002000U +#define DMA_FLAG_HT4 0x00004000U +#define DMA_FLAG_TE4 0x00008000U +#define DMA_FLAG_GL5 0x00010000U +#define DMA_FLAG_TC5 0x00020000U +#define DMA_FLAG_HT5 0x00040000U +#define DMA_FLAG_TE5 0x00080000U +#define DMA_FLAG_GL6 0x00100000U +#define DMA_FLAG_TC6 0x00200000U +#define DMA_FLAG_HT6 0x00400000U +#define DMA_FLAG_TE6 0x00800000U +#define DMA_FLAG_GL7 0x01000000U +#define DMA_FLAG_TC7 0x02000000U +#define DMA_FLAG_HT7 0x04000000U +#define DMA_FLAG_TE7 0x08000000U +/** + * @} + */ + +/** + * @} + */ + + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup DMA_Exported_Macros DMA Exported Macros + * @{ + */ + +/** @brief Reset DMA handle state. + * @param __HANDLE__: DMA handle + * @retval None + */ +#define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET) + +/** + * @brief Enable the specified DMA Channel. + * @param __HANDLE__: DMA handle + * @retval None + */ +#define __HAL_DMA_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CCR, DMA_CCR_EN)) + +/** + * @brief Disable the specified DMA Channel. + * @param __HANDLE__: DMA handle + * @retval None + */ +#define __HAL_DMA_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CCR, DMA_CCR_EN)) + + +/* Interrupt & Flag management */ + +/** + * @brief Enables the specified DMA Channel interrupts. + * @param __HANDLE__: DMA handle + * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. + * This parameter can be any combination of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask + * @arg DMA_IT_HT: Half transfer complete interrupt mask + * @arg DMA_IT_TE: Transfer error interrupt mask + * @retval None + */ +#define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->CCR, (__INTERRUPT__))) + +/** + * @brief Disable the specified DMA Channel interrupts. + * @param __HANDLE__: DMA handle + * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. + * This parameter can be any combination of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask + * @arg DMA_IT_HT: Half transfer complete interrupt mask + * @arg DMA_IT_TE: Transfer error interrupt mask + * @retval None + */ +#define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->CCR , (__INTERRUPT__))) + +/** + * @brief Check whether the specified DMA Channel interrupt is enabled or not. + * @param __HANDLE__: DMA handle + * @param __INTERRUPT__: specifies the DMA interrupt source to check. + * This parameter can be one of the following values: + * @arg DMA_IT_TC: Transfer complete interrupt mask + * @arg DMA_IT_HT: Half transfer complete interrupt mask + * @arg DMA_IT_TE: Transfer error interrupt mask + * @retval The state of DMA_IT (SET or RESET). + */ +#define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CCR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) + +/** + * @brief Return the number of remaining data units in the current DMA Channel transfer. + * @param __HANDLE__: DMA handle + * @retval The number of remaining data units in the current DMA Channel transfer. + */ +#define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNDTR) + +/** + * @} + */ + +/* Include DMA HAL Extension module */ +#include "stm32f1xx_hal_dma_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup DMA_Exported_Functions + * @{ + */ + +/** @addtogroup DMA_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_DeInit (DMA_HandleTypeDef *hdma); +/** + * @} + */ + +/** @addtogroup DMA_Exported_Functions_Group2 + * @{ + */ +/* IO operation functions *****************************************************/ +HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout); +void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma); +HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)( DMA_HandleTypeDef * _hdma)); +HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID); + +/** + * @} + */ + +/** @addtogroup DMA_Exported_Functions_Group3 + * @{ + */ +/* Peripheral State and Error functions ***************************************/ +HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma); +uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); +/** + * @} + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup DMA_Private_Macros DMA Private Macros + * @{ + */ + +#define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ + ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ + ((DIRECTION) == DMA_MEMORY_TO_MEMORY)) + +#define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1U) && ((SIZE) < 0x10000U)) + +#define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \ + ((STATE) == DMA_PINC_DISABLE)) + +#define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \ + ((STATE) == DMA_MINC_DISABLE)) + +#define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \ + ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \ + ((SIZE) == DMA_PDATAALIGN_WORD)) + +#define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \ + ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \ + ((SIZE) == DMA_MDATAALIGN_WORD )) + +#define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \ + ((MODE) == DMA_CIRCULAR)) + +#define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \ + ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \ + ((PRIORITY) == DMA_PRIORITY_HIGH) || \ + ((PRIORITY) == DMA_PRIORITY_VERY_HIGH)) + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_DMA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h new file mode 100644 index 0000000..2de1a2d --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h @@ -0,0 +1,277 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_dma_ex.h + * @author MCD Application Team + * @brief Header file of DMA HAL extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_DMA_EX_H +#define __STM32F1xx_HAL_DMA_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup DMAEx DMAEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DMAEx_Exported_Macros DMA Extended Exported Macros + * @{ + */ +/* Interrupt & Flag management */ +#if defined (STM32F100xE) || defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || \ + defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC) +/** @defgroup DMAEx_High_density_XL_density_Product_devices DMAEx High density and XL density product devices + * @{ + */ + +/** + * @brief Returns the current DMA Channel transfer complete flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer complete flag index. + */ +#define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TC3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TC4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TC5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_TC7 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TC1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_TC2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_TC3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_TC4 :\ + DMA_FLAG_TC5) + +/** + * @brief Returns the current DMA Channel half transfer complete flag. + * @param __HANDLE__: DMA handle + * @retval The specified half transfer complete flag index. + */ +#define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_HT5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_HT7 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_HT1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_HT2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_HT3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_HT4 :\ + DMA_FLAG_HT5) + +/** + * @brief Returns the current DMA Channel transfer error flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer error flag index. + */ +#define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TE3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TE4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TE5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_TE7 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TE1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_TE2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_TE3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_TE4 :\ + DMA_FLAG_TE5) + +/** + * @brief Return the current DMA Channel Global interrupt flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer error flag index. + */ +#define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_GL1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_GL2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_GL3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_GL4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_GL5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_GL6 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_GL7 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_GL1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_GL2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_GL3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_GL4 :\ + DMA_FLAG_GL5) + +/** + * @brief Get the DMA Channel pending flags. + * @param __HANDLE__: DMA handle + * @param __FLAG__: Get the specified flag. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCx: Transfer complete flag + * @arg DMA_FLAG_HTx: Half transfer complete flag + * @arg DMA_FLAG_TEx: Transfer error flag + * Where x can be 1_7 or 1_5 (depending on DMA1 or DMA2) to select the DMA Channel flag. + * @retval The state of FLAG (SET or RESET). + */ +#define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\ +(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Channel7)? (DMA2->ISR & (__FLAG__)) :\ + (DMA1->ISR & (__FLAG__))) + +/** + * @brief Clears the DMA Channel pending flags. + * @param __HANDLE__: DMA handle + * @param __FLAG__: specifies the flag to clear. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCx: Transfer complete flag + * @arg DMA_FLAG_HTx: Half transfer complete flag + * @arg DMA_FLAG_TEx: Transfer error flag + * Where x can be 1_7 or 1_5 (depending on DMA1 or DMA2) to select the DMA Channel flag. + * @retval None + */ +#define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \ +(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Channel7)? (DMA2->IFCR = (__FLAG__)) :\ + (DMA1->IFCR = (__FLAG__))) + +/** + * @} + */ + +#else +/** @defgroup DMA_Low_density_Medium_density_Product_devices DMA Low density and Medium density product devices + * @{ + */ + +/** + * @brief Returns the current DMA Channel transfer complete flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer complete flag index. + */ +#define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TC3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TC4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TC5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ + DMA_FLAG_TC7) + +/** + * @brief Return the current DMA Channel half transfer complete flag. + * @param __HANDLE__: DMA handle + * @retval The specified half transfer complete flag index. + */ +#define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_HT5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ + DMA_FLAG_HT7) + +/** + * @brief Return the current DMA Channel transfer error flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer error flag index. + */ +#define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TE3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TE4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TE5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ + DMA_FLAG_TE7) + +/** + * @brief Return the current DMA Channel Global interrupt flag. + * @param __HANDLE__: DMA handle + * @retval The specified transfer error flag index. + */ +#define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ +(((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_GL1 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_GL2 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_GL3 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_GL4 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_GL5 :\ + ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_GL6 :\ + DMA_FLAG_GL7) + +/** + * @brief Get the DMA Channel pending flags. + * @param __HANDLE__: DMA handle + * @param __FLAG__: Get the specified flag. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCx: Transfer complete flag + * @arg DMA_FLAG_HTx: Half transfer complete flag + * @arg DMA_FLAG_TEx: Transfer error flag + * @arg DMA_FLAG_GLx: Global interrupt flag + * Where x can be 1_7 to select the DMA Channel flag. + * @retval The state of FLAG (SET or RESET). + */ + +#define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__)) + +/** + * @brief Clear the DMA Channel pending flags. + * @param __HANDLE__: DMA handle + * @param __FLAG__: specifies the flag to clear. + * This parameter can be any combination of the following values: + * @arg DMA_FLAG_TCx: Transfer complete flag + * @arg DMA_FLAG_HTx: Half transfer complete flag + * @arg DMA_FLAG_TEx: Transfer error flag + * @arg DMA_FLAG_GLx: Global interrupt flag + * Where x can be 1_7 to select the DMA Channel flag. + * @retval None + */ +#define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) (DMA1->IFCR = (__FLAG__)) + +/** + * @} + */ + +#endif + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || */ + /* STM32F103xG || STM32F105xC || STM32F107xC */ + +#endif /* __STM32F1xx_HAL_DMA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h new file mode 100644 index 0000000..3a79557 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h @@ -0,0 +1,320 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_exti.h + * @author MCD Application Team + * @brief Header file of EXTI HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_EXTI_H +#define STM32F1xx_HAL_EXTI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup EXTI EXTI + * @brief EXTI HAL module driver + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup EXTI_Exported_Types EXTI Exported Types + * @{ + */ + +/** + * @brief HAL EXTI common Callback ID enumeration definition + */ +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 */ +} EXTI_ConfigTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EXTI_Exported_Constants EXTI Exported Constants + * @{ + */ + +/** @defgroup EXTI_Line EXTI Line + * @{ + */ +#define EXTI_LINE_0 (EXTI_GPIO | 0x00u) /*!< External interrupt line 0 */ +#define EXTI_LINE_1 (EXTI_GPIO | 0x01u) /*!< External interrupt line 1 */ +#define EXTI_LINE_2 (EXTI_GPIO | 0x02u) /*!< External interrupt line 2 */ +#define EXTI_LINE_3 (EXTI_GPIO | 0x03u) /*!< External interrupt line 3 */ +#define EXTI_LINE_4 (EXTI_GPIO | 0x04u) /*!< External interrupt line 4 */ +#define EXTI_LINE_5 (EXTI_GPIO | 0x05u) /*!< External interrupt line 5 */ +#define EXTI_LINE_6 (EXTI_GPIO | 0x06u) /*!< External interrupt line 6 */ +#define EXTI_LINE_7 (EXTI_GPIO | 0x07u) /*!< External interrupt line 7 */ +#define EXTI_LINE_8 (EXTI_GPIO | 0x08u) /*!< External interrupt line 8 */ +#define EXTI_LINE_9 (EXTI_GPIO | 0x09u) /*!< External interrupt line 9 */ +#define EXTI_LINE_10 (EXTI_GPIO | 0x0Au) /*!< External interrupt line 10 */ +#define EXTI_LINE_11 (EXTI_GPIO | 0x0Bu) /*!< External interrupt line 11 */ +#define EXTI_LINE_12 (EXTI_GPIO | 0x0Cu) /*!< External interrupt line 12 */ +#define EXTI_LINE_13 (EXTI_GPIO | 0x0Du) /*!< External interrupt line 13 */ +#define EXTI_LINE_14 (EXTI_GPIO | 0x0Eu) /*!< External interrupt line 14 */ +#define EXTI_LINE_15 (EXTI_GPIO | 0x0Fu) /*!< External interrupt line 15 */ +#define EXTI_LINE_16 (EXTI_CONFIG | 0x10u) /*!< External interrupt line 16 Connected to the PVD Output */ +#define EXTI_LINE_17 (EXTI_CONFIG | 0x11u) /*!< External interrupt line 17 Connected to the RTC Alarm event */ +#if defined(EXTI_IMR_IM18) +#define EXTI_LINE_18 (EXTI_CONFIG | 0x12u) /*!< External interrupt line 18 Connected to the USB Wakeup from suspend event */ +#endif /* EXTI_IMR_IM18 */ +#if defined(EXTI_IMR_IM19) +#define EXTI_LINE_19 (EXTI_CONFIG | 0x13u) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ +#endif /* EXTI_IMR_IM19 */ + +/** + * @} + */ + +/** @defgroup EXTI_Mode EXTI Mode + * @{ + */ +#define EXTI_MODE_NONE 0x00000000u +#define EXTI_MODE_INTERRUPT 0x00000001u +#define EXTI_MODE_EVENT 0x00000002u +/** + * @} + */ + +/** @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 +#if defined (GPIOE) +#define EXTI_GPIOE 0x00000004u +#endif /* GPIOE */ +#if defined (GPIOF) +#define EXTI_GPIOF 0x00000005u +#endif /* GPIOF */ +#if defined (GPIOG) +#define EXTI_GPIOG 0x00000006u +#endif /* GPIOG */ +/** + * @} + */ + +/** + * @} + */ + +/* 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_CONFIG (0x02uL << EXTI_PROPERTY_SHIFT) +#define EXTI_GPIO ((0x04uL << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG) +#define EXTI_PROPERTY_MASK (EXTI_CONFIG | EXTI_GPIO) + +/** + * @brief EXTI bit usage + */ +#define EXTI_PIN_MASK 0x0000001Fu + +/** + * @brief EXTI Mask for interrupt & event mode + */ +#define EXTI_MODE_MASK (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT) + +/** + * @brief EXTI Mask for trigger possibilities + */ +#define EXTI_TRIGGER_MASK (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING) + +/** + * @brief EXTI Line number + */ +#if defined(EXTI_IMR_IM19) +#define EXTI_LINE_NB 20UL +#elif defined(EXTI_IMR_IM18) +#define EXTI_LINE_NB 19UL +#else /* EXTI_IMR_IM17 */ +#define EXTI_LINE_NB 18UL +#endif /* EXTI_IMR_IM19 */ +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup EXTI_Private_Macros EXTI Private Macros + * @{ + */ +#define IS_EXTI_LINE(__EXTI_LINE__) ((((__EXTI_LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_PIN_MASK)) == 0x00u) && \ + ((((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG) || \ + (((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO)) && \ + (((__EXTI_LINE__) & EXTI_PIN_MASK) < EXTI_LINE_NB)) + +#define IS_EXTI_MODE(__EXTI_LINE__) ((((__EXTI_LINE__) & EXTI_MODE_MASK) != 0x00u) && \ + (((__EXTI_LINE__) & ~EXTI_MODE_MASK) == 0x00u)) + +#define IS_EXTI_TRIGGER(__EXTI_LINE__) (((__EXTI_LINE__) & ~EXTI_TRIGGER_MASK) == 0x00u) + +#define IS_EXTI_PENDING_EDGE(__EXTI_LINE__) ((__EXTI_LINE__) == EXTI_TRIGGER_RISING_FALLING) + +#define IS_EXTI_CONFIG_LINE(__EXTI_LINE__) (((__EXTI_LINE__) & EXTI_CONFIG) != 0x00u) + +#if defined (GPIOG) +#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)) +#elif defined (GPIOF) +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOD) || \ + ((__PORT__) == EXTI_GPIOE) || \ + ((__PORT__) == EXTI_GPIOF)) +#elif defined (GPIOE) +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOD) || \ + ((__PORT__) == EXTI_GPIOE)) +#else +#define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ + ((__PORT__) == EXTI_GPIOB) || \ + ((__PORT__) == EXTI_GPIOC) || \ + ((__PORT__) == EXTI_GPIOD)) +#endif /* GPIOG */ + +#define IS_EXTI_GPIO_PIN(__PIN__) ((__PIN__) < 16u) + +/** + * @} + */ + +/* 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 /* STM32F1xx_HAL_EXTI_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h new file mode 100644 index 0000000..52e480b --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h @@ -0,0 +1,328 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_flash.h + * @author MCD Application Team + * @brief Header file of Flash HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_FLASH_H +#define __STM32F1xx_HAL_FLASH_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup FLASH + * @{ + */ + +/** @addtogroup FLASH_Private_Constants + * @{ + */ +#define FLASH_TIMEOUT_VALUE 50000U /* 50 s */ +/** + * @} + */ + +/** @addtogroup FLASH_Private_Macros + * @{ + */ + +#define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \ + ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \ + ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD)) + +#if defined(FLASH_ACR_LATENCY) +#define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \ + ((__LATENCY__) == FLASH_LATENCY_1) || \ + ((__LATENCY__) == FLASH_LATENCY_2)) + +#else +#define IS_FLASH_LATENCY(__LATENCY__) ((__LATENCY__) == FLASH_LATENCY_0) +#endif /* FLASH_ACR_LATENCY */ +/** + * @} + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Types FLASH Exported Types + * @{ + */ + +/** + * @brief FLASH Procedure structure definition + */ +typedef enum +{ + FLASH_PROC_NONE = 0U, + FLASH_PROC_PAGEERASE = 1U, + FLASH_PROC_MASSERASE = 2U, + FLASH_PROC_PROGRAMHALFWORD = 3U, + FLASH_PROC_PROGRAMWORD = 4U, + FLASH_PROC_PROGRAMDOUBLEWORD = 5U +} FLASH_ProcedureTypeDef; + +/** + * @brief FLASH handle Structure definition + */ +typedef struct +{ + __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */ + + __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */ + + __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */ + + __IO uint64_t Data; /*!< Internal variable to save data to be programmed */ + + HAL_LockTypeDef Lock; /*!< FLASH locking object */ + + __IO uint32_t ErrorCode; /*!< FLASH error code + This parameter can be a value of @ref FLASH_Error_Codes */ +} FLASH_ProcessTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Constants FLASH Exported Constants + * @{ + */ + +/** @defgroup FLASH_Error_Codes FLASH Error Codes + * @{ + */ + +#define HAL_FLASH_ERROR_NONE 0x00U /*!< No error */ +#define HAL_FLASH_ERROR_PROG 0x01U /*!< Programming error */ +#define HAL_FLASH_ERROR_WRP 0x02U /*!< Write protection error */ +#define HAL_FLASH_ERROR_OPTV 0x04U /*!< Option validity error */ + +/** + * @} + */ + +/** @defgroup FLASH_Type_Program FLASH Type Program + * @{ + */ +#define FLASH_TYPEPROGRAM_HALFWORD 0x01U /*!ACR |= FLASH_ACR_HLFCYA) + +/** + * @brief Disable the FLASH half cycle access. + * @note half cycle access can only be used with a low-frequency clock of less than + 8 MHz that can be obtained with the use of HSI or HSE but not of PLL. + * @retval None + */ +#define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA)) + +/** + * @} + */ + +#if defined(FLASH_ACR_LATENCY) +/** @defgroup FLASH_EM_Latency FLASH Latency + * @brief macros to handle FLASH Latency + * @{ + */ + +/** + * @brief Set the FLASH Latency. + * @param __LATENCY__ FLASH Latency + * The value of this parameter depend on device used within the same series + * @retval None + */ +#define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__)) + + +/** + * @brief Get the FLASH Latency. + * @retval FLASH Latency + * The value of this parameter depend on device used within the same series + */ +#define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)) + +/** + * @} + */ + +#endif /* FLASH_ACR_LATENCY */ +/** @defgroup FLASH_Prefetch FLASH Prefetch + * @brief macros to handle FLASH Prefetch buffer + * @{ + */ +/** + * @brief Enable the FLASH prefetch buffer. + * @retval None + */ +#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE) + +/** + * @brief Disable the FLASH prefetch buffer. + * @retval None + */ +#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE)) + +/** + * @} + */ + +/** + * @} + */ + +/* Include FLASH HAL Extended module */ +#include "stm32f1xx_hal_flash_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup FLASH_Exported_Functions + * @{ + */ + +/** @addtogroup FLASH_Exported_Functions_Group1 + * @{ + */ +/* IO operation functions *****************************************************/ +HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); +HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); + +/* FLASH IRQ handler function */ +void HAL_FLASH_IRQHandler(void); +/* Callbacks in non blocking modes */ +void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); +void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); + +/** + * @} + */ + +/** @addtogroup FLASH_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ***********************************************/ +HAL_StatusTypeDef HAL_FLASH_Unlock(void); +HAL_StatusTypeDef HAL_FLASH_Lock(void); +HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); +HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); +void HAL_FLASH_OB_Launch(void); + +/** + * @} + */ + +/** @addtogroup FLASH_Exported_Functions_Group3 + * @{ + */ +/* Peripheral State and Error functions ***************************************/ +uint32_t HAL_FLASH_GetError(void); + +/** + * @} + */ + +/** + * @} + */ + +/* Private function -------------------------------------------------*/ +/** @addtogroup FLASH_Private_Functions + * @{ + */ +HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); +#if defined(FLASH_BANK2_END) +HAL_StatusTypeDef FLASH_WaitForLastOperationBank2(uint32_t Timeout); +#endif /* FLASH_BANK2_END */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_FLASH_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h new file mode 100644 index 0000000..0a5b24a --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h @@ -0,0 +1,786 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_flash_ex.h + * @author MCD Application Team + * @brief Header file of Flash HAL Extended module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_FLASH_EX_H +#define __STM32F1xx_HAL_FLASH_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup FLASHEx + * @{ + */ + +/** @addtogroup FLASHEx_Private_Constants + * @{ + */ + +#define FLASH_SIZE_DATA_REGISTER 0x1FFFF7E0U +#define OBR_REG_INDEX 1U +#define SR_FLAG_MASK ((uint32_t)(FLASH_SR_BSY | FLASH_SR_PGERR | FLASH_SR_WRPRTERR | FLASH_SR_EOP)) + +/** + * @} + */ + +/** @addtogroup FLASHEx_Private_Macros + * @{ + */ + +#define IS_FLASH_TYPEERASE(VALUE) (((VALUE) == FLASH_TYPEERASE_PAGES) || ((VALUE) == FLASH_TYPEERASE_MASSERASE)) + +#define IS_OPTIONBYTE(VALUE) (((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))) + +#define IS_WRPSTATE(VALUE) (((VALUE) == OB_WRPSTATE_DISABLE) || ((VALUE) == OB_WRPSTATE_ENABLE)) + +#define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) || ((LEVEL) == OB_RDP_LEVEL_1)) + +#define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == OB_DATA_ADDRESS_DATA0) || ((ADDRESS) == OB_DATA_ADDRESS_DATA1)) + +#define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) + +#define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST)) + +#define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST)) + +#if defined(FLASH_BANK2_END) +#define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET)) +#endif /* FLASH_BANK2_END */ + +/* Low Density */ +#if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6)) +#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)- 1 <= 0x08007FFFU) : \ + ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)- 1 <= 0x08003FFFU)) +#endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */ + +/* Medium Density */ +#if (defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB)) +#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0801FFFFU) : \ + (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0800FFFFU) : \ + (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x08007FFFU) : \ + ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x08003FFFU)))) +#endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB*/ + +/* High Density */ +#if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE)) +#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x200U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0807FFFFU) : \ + (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x180U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0805FFFFU) : \ + ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0803FFFFU))) +#endif /* STM32F100xE || STM32F101xE || STM32F103xE */ + +/* XL Density */ +#if defined(FLASH_BANK2_END) +#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x400U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x080FFFFFU) : \ + ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x080BFFFFU)) +#endif /* FLASH_BANK2_END */ + +/* Connectivity Line */ +#if (defined(STM32F105xC) || defined(STM32F107xC)) +#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0803FFFFU) : \ + (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0801FFFFU) : \ + ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0800FFFFU))) +#endif /* STM32F105xC || STM32F107xC */ + +#define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000U)) + +#if defined(FLASH_BANK2_END) +#define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \ + ((BANK) == FLASH_BANK_2) || \ + ((BANK) == FLASH_BANK_BOTH)) +#else +#define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1)) +#endif /* FLASH_BANK2_END */ + +/* Low Density */ +#if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6)) +#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? \ + ((ADDRESS) <= FLASH_BANK1_END) : ((ADDRESS) <= 0x08003FFFU))) + +#endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */ + +/* Medium Density */ +#if (defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB)) +#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? \ + ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? \ + ((ADDRESS) <= 0x0800FFFF) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? \ + ((ADDRESS) <= 0x08007FFF) : ((ADDRESS) <= 0x08003FFFU))))) + +#endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB*/ + +/* High Density */ +#if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE)) +#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x200U) ? \ + ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x180U) ? \ + ((ADDRESS) <= 0x0805FFFFU) : ((ADDRESS) <= 0x0803FFFFU)))) + +#endif /* STM32F100xE || STM32F101xE || STM32F103xE */ + +/* XL Density */ +#if defined(FLASH_BANK2_END) +#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x400U) ? \ + ((ADDRESS) <= FLASH_BANK2_END) : ((ADDRESS) <= 0x080BFFFFU))) + +#endif /* FLASH_BANK2_END */ + +/* Connectivity Line */ +#if (defined(STM32F105xC) || defined(STM32F107xC)) +#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? \ + ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? \ + ((ADDRESS) <= 0x0801FFFFU) : ((ADDRESS) <= 0x0800FFFFU)))) + +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types + * @{ + */ + +/** + * @brief FLASH Erase structure definition + */ +typedef struct +{ + uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase. + This parameter can be a value of @ref FLASHEx_Type_Erase */ + + uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled. + This parameter must be a value of @ref FLASHEx_Banks */ + + uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled + This parameter must be a number between Min_Data = 0x08000000 and Max_Data = FLASH_BANKx_END + (x = 1 or 2 depending on devices)*/ + + uint32_t NbPages; /*!< NbPages: Number of pagess to be erased. + This parameter must be a value between Min_Data = 1 and Max_Data = (max number of pages - value of initial page)*/ + +} FLASH_EraseInitTypeDef; + +/** + * @brief FLASH Options bytes program structure definition + */ +typedef struct +{ + uint32_t OptionType; /*!< OptionType: Option byte to be configured. + This parameter can be a value of @ref FLASHEx_OB_Type */ + + uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation. + This parameter can be a value of @ref FLASHEx_OB_WRP_State */ + + uint32_t WRPPage; /*!< WRPPage: specifies the page(s) to be write protected + This parameter can be a value of @ref FLASHEx_OB_Write_Protection */ + + uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors. + This parameter must be a value of @ref FLASHEx_Banks */ + + uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level.. + This parameter can be a value of @ref FLASHEx_OB_Read_Protection */ + +#if defined(FLASH_BANK2_END) + uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: + IWDG / STOP / STDBY / BOOT1 + This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP, + @ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1 */ +#else + uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: + IWDG / STOP / STDBY + This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP, + @ref FLASHEx_OB_nRST_STDBY */ +#endif /* FLASH_BANK2_END */ + + uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed + This parameter can be a value of @ref FLASHEx_OB_Data_Address */ + + uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ +} FLASH_OBProgramInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants + * @{ + */ + +/** @defgroup FLASHEx_Constants FLASH Constants + * @{ + */ + +/** @defgroup FLASHEx_Page_Size Page Size + * @{ + */ +#if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6) || defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB)) +#define FLASH_PAGE_SIZE 0x400U +#endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */ + /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */ + +#if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)) +#define FLASH_PAGE_SIZE 0x800U +#endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */ + /* STM32F101xG || STM32F103xG */ + /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** @defgroup FLASHEx_Type_Erase Type Erase + * @{ + */ +#define FLASH_TYPEERASE_PAGES 0x00U /*!CR, ((__INTERRUPT__) & 0x0000FFFFU)); \ + /* Enable Bank2 IT */ \ + SET_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16U)); \ + } while(0U) + +/** + * @brief Disable the specified FLASH interrupt. + * @param __INTERRUPT__ FLASH interrupt + * This parameter can be any combination of the following values: + * @arg @ref FLASH_IT_EOP_BANK1 End of FLASH Operation Interrupt on bank1 + * @arg @ref FLASH_IT_ERR_BANK1 Error Interrupt on bank1 + * @arg @ref FLASH_IT_EOP_BANK2 End of FLASH Operation Interrupt on bank2 + * @arg @ref FLASH_IT_ERR_BANK2 Error Interrupt on bank2 + * @retval none + */ +#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { \ + /* Disable Bank1 IT */ \ + CLEAR_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFFU)); \ + /* Disable Bank2 IT */ \ + CLEAR_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16U)); \ + } while(0U) + +/** + * @brief Get the specified FLASH flag status. + * @param __FLAG__ specifies the FLASH flag to check. + * This parameter can be one of the following values: + * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1 + * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1 + * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1 + * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1 + * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2 + * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2 + * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2 + * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2 + * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match + * @retval The new state of __FLAG__ (SET or RESET). + */ +#define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ + (FLASH->OBR & FLASH_OBR_OPTERR) : \ + ((((__FLAG__) & SR_FLAG_MASK) != RESET)? \ + (FLASH->SR & ((__FLAG__) & SR_FLAG_MASK)) : \ + (FLASH->SR2 & ((__FLAG__) >> 16U)))) + +/** + * @brief Clear the specified FLASH flag. + * @param __FLAG__ specifies the FLASH flags to clear. + * This parameter can be any combination of the following values: + * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1 + * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1 + * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1 + * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1 + * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2 + * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2 + * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2 + * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2 + * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match + * @retval none + */ +#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ + /* Clear FLASH_FLAG_OPTVERR flag */ \ + if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ + { \ + CLEAR_BIT(FLASH->OBR, FLASH_OBR_OPTERR); \ + } \ + else { \ + /* Clear Flag in Bank1 */ \ + if (((__FLAG__) & SR_FLAG_MASK) != RESET) \ + { \ + FLASH->SR = ((__FLAG__) & SR_FLAG_MASK); \ + } \ + /* Clear Flag in Bank2 */ \ + if (((__FLAG__) >> 16U) != RESET) \ + { \ + FLASH->SR2 = ((__FLAG__) >> 16U); \ + } \ + } \ + } while(0U) +#else +/** + * @brief Enable the specified FLASH interrupt. + * @param __INTERRUPT__ FLASH interrupt + * This parameter can be any combination of the following values: + * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt + * @arg @ref FLASH_IT_ERR Error Interrupt + * @retval none + */ +#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) + +/** + * @brief Disable the specified FLASH interrupt. + * @param __INTERRUPT__ FLASH interrupt + * This parameter can be any combination of the following values: + * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt + * @arg @ref FLASH_IT_ERR Error Interrupt + * @retval none + */ +#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(__INTERRUPT__)) + +/** + * @brief Get the specified FLASH flag status. + * @param __FLAG__ specifies the FLASH flag to check. + * This parameter can be one of the following values: + * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag + * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag + * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag + * @arg @ref FLASH_FLAG_BSY FLASH Busy flag + * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match + * @retval The new state of __FLAG__ (SET or RESET). + */ +#define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ + (FLASH->OBR & FLASH_OBR_OPTERR) : \ + (FLASH->SR & (__FLAG__))) +/** + * @brief Clear the specified FLASH flag. + * @param __FLAG__ specifies the FLASH flags to clear. + * This parameter can be any combination of the following values: + * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag + * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag + * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag + * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match + * @retval none + */ +#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ + /* Clear FLASH_FLAG_OPTVERR flag */ \ + if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ + { \ + CLEAR_BIT(FLASH->OBR, FLASH_OBR_OPTERR); \ + } \ + else { \ + /* Clear Flag in Bank1 */ \ + FLASH->SR = (__FLAG__); \ + } \ + } while(0U) + +#endif + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup FLASHEx_Exported_Functions + * @{ + */ + +/** @addtogroup FLASHEx_Exported_Functions_Group1 + * @{ + */ +/* IO operation functions *****************************************************/ +HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); +HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); + +/** + * @} + */ + +/** @addtogroup FLASHEx_Exported_Functions_Group2 + * @{ + */ +/* Peripheral Control functions ***********************************************/ +HAL_StatusTypeDef HAL_FLASHEx_OBErase(void); +HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); +void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); +uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_FLASH_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h new file mode 100644 index 0000000..a344f8f --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h @@ -0,0 +1,308 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_gpio.h + * @author MCD Application Team + * @brief Header file of GPIO HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_GPIO_H +#define STM32F1xx_HAL_GPIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup GPIO + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Types GPIO Exported Types + * @{ + */ + +/** + * @brief GPIO Init structure definition + */ +typedef struct +{ + uint32_t Pin; /*!< Specifies the GPIO pins to be configured. + This parameter can be any value of @ref GPIO_pins_define */ + + uint32_t Mode; /*!< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_mode_define */ + + uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins. + This parameter can be a value of @ref GPIO_pull_define */ + + uint32_t Speed; /*!< Specifies the speed for the selected pins. + This parameter can be a value of @ref GPIO_speed_define */ +} GPIO_InitTypeDef; + +/** + * @brief GPIO Bit SET and Bit RESET enumeration + */ +typedef enum +{ + GPIO_PIN_RESET = 0u, + GPIO_PIN_SET +} GPIO_PinState; +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup GPIO_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_pins_define GPIO pins define + * @{ + */ +#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 */ +/** + * @} + */ + +/** @defgroup GPIO_mode_define GPIO mode define + * @brief GPIO Configuration Mode + * Elements values convention: 0xX0yz00YZ + * - X : GPIO mode or EXTI Mode + * - y : External IT or Event trigger detection + * - z : IO configuration on External IT or Event + * - Y : Output type (Push Pull or Open Drain) + * - Z : IO Direction mode (Input, Output, Alternate or Analog) + * @{ + */ +#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_AF_INPUT GPIO_MODE_INPUT /*!< Alternate Function Input Mode */ + +#define GPIO_MODE_ANALOG 0x00000003u /*!< Analog Mode */ + +#define GPIO_MODE_IT_RISING 0x10110000u /*!< External Interrupt Mode with Rising edge trigger detection */ +#define GPIO_MODE_IT_FALLING 0x10210000u /*!< External Interrupt Mode with Falling edge trigger detection */ +#define GPIO_MODE_IT_RISING_FALLING 0x10310000u /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ + +#define GPIO_MODE_EVT_RISING 0x10120000u /*!< External Event Mode with Rising edge trigger detection */ +#define GPIO_MODE_EVT_FALLING 0x10220000u /*!< External Event Mode with Falling edge trigger detection */ +#define GPIO_MODE_EVT_RISING_FALLING 0x10320000u /*!< External Event Mode with Rising/Falling edge trigger detection */ + +/** + * @} + */ + +/** @defgroup GPIO_speed_define GPIO speed define + * @brief GPIO Output Maximum frequency + * @{ + */ +#define GPIO_SPEED_FREQ_LOW (GPIO_CRL_MODE0_1) /*!< Low speed */ +#define GPIO_SPEED_FREQ_MEDIUM (GPIO_CRL_MODE0_0) /*!< Medium speed */ +#define GPIO_SPEED_FREQ_HIGH (GPIO_CRL_MODE0) /*!< High speed */ + +/** + * @} + */ + +/** @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 */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** + * @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_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR & (__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_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR = (__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_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR & (__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_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR = (__EXTI_LINE__)) + +/** + * @brief Generates a Software interrupt on selected EXTI line. + * @param __EXTI_LINE__: specifies the EXTI line to check. + * This parameter can be GPIO_PIN_x where x can be(0..15) + * @retval None + */ +#define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER |= (__EXTI_LINE__)) +/** + * @} + */ + +/* Include GPIO HAL Extension module */ +#include "stm32f1xx_hal_gpio_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup GPIO_Exported_Functions + * @{ + */ + +/** @addtogroup GPIO_Exported_Functions_Group1 + * @{ + */ +/* Initialization and de-initialization functions *****************************/ +void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init); +void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin); +/** + * @} + */ + +/** @addtogroup GPIO_Exported_Functions_Group2 + * @{ + */ +/* 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); +void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin); +void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); + +/** + * @} + */ + +/** + * @} + */ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup GPIO_Private_Constants GPIO Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup GPIO_Private_Macros GPIO Private Macros + * @{ + */ +#define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) +#define IS_GPIO_PIN(PIN) (((((uint32_t)PIN) & GPIO_PIN_MASK ) != 0x00u) && ((((uint32_t)PIN) & ~GPIO_PIN_MASK) == 0x00u)) +#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\ + ((MODE) == GPIO_MODE_OUTPUT_PP) ||\ + ((MODE) == GPIO_MODE_OUTPUT_OD) ||\ + ((MODE) == GPIO_MODE_AF_PP) ||\ + ((MODE) == GPIO_MODE_AF_OD) ||\ + ((MODE) == GPIO_MODE_IT_RISING) ||\ + ((MODE) == GPIO_MODE_IT_FALLING) ||\ + ((MODE) == GPIO_MODE_IT_RISING_FALLING) ||\ + ((MODE) == GPIO_MODE_EVT_RISING) ||\ + ((MODE) == GPIO_MODE_EVT_FALLING) ||\ + ((MODE) == GPIO_MODE_EVT_RISING_FALLING) ||\ + ((MODE) == GPIO_MODE_ANALOG)) +#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_SPEED_FREQ_LOW) || \ + ((SPEED) == GPIO_SPEED_FREQ_MEDIUM) || ((SPEED) == GPIO_SPEED_FREQ_HIGH)) +#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \ + ((PULL) == GPIO_PULLDOWN)) +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup GPIO_Private_Functions GPIO Private Functions + * @{ + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_HAL_GPIO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h new file mode 100644 index 0000000..5f6c3fd --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h @@ -0,0 +1,894 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_gpio_ex.h + * @author MCD Application Team + * @brief Header file of GPIO HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_GPIO_EX_H +#define STM32F1xx_HAL_GPIO_EX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup GPIOEx GPIOEx + * @{ + */ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants + * @{ + */ + +/** @defgroup GPIOEx_EVENTOUT EVENTOUT Cortex Configuration + * @brief This section propose definition to use the Cortex EVENTOUT signal. + * @{ + */ + +/** @defgroup GPIOEx_EVENTOUT_PIN EVENTOUT Pin + * @{ + */ + +#define AFIO_EVENTOUT_PIN_0 AFIO_EVCR_PIN_PX0 /*!< EVENTOUT on pin 0 */ +#define AFIO_EVENTOUT_PIN_1 AFIO_EVCR_PIN_PX1 /*!< EVENTOUT on pin 1 */ +#define AFIO_EVENTOUT_PIN_2 AFIO_EVCR_PIN_PX2 /*!< EVENTOUT on pin 2 */ +#define AFIO_EVENTOUT_PIN_3 AFIO_EVCR_PIN_PX3 /*!< EVENTOUT on pin 3 */ +#define AFIO_EVENTOUT_PIN_4 AFIO_EVCR_PIN_PX4 /*!< EVENTOUT on pin 4 */ +#define AFIO_EVENTOUT_PIN_5 AFIO_EVCR_PIN_PX5 /*!< EVENTOUT on pin 5 */ +#define AFIO_EVENTOUT_PIN_6 AFIO_EVCR_PIN_PX6 /*!< EVENTOUT on pin 6 */ +#define AFIO_EVENTOUT_PIN_7 AFIO_EVCR_PIN_PX7 /*!< EVENTOUT on pin 7 */ +#define AFIO_EVENTOUT_PIN_8 AFIO_EVCR_PIN_PX8 /*!< EVENTOUT on pin 8 */ +#define AFIO_EVENTOUT_PIN_9 AFIO_EVCR_PIN_PX9 /*!< EVENTOUT on pin 9 */ +#define AFIO_EVENTOUT_PIN_10 AFIO_EVCR_PIN_PX10 /*!< EVENTOUT on pin 10 */ +#define AFIO_EVENTOUT_PIN_11 AFIO_EVCR_PIN_PX11 /*!< EVENTOUT on pin 11 */ +#define AFIO_EVENTOUT_PIN_12 AFIO_EVCR_PIN_PX12 /*!< EVENTOUT on pin 12 */ +#define AFIO_EVENTOUT_PIN_13 AFIO_EVCR_PIN_PX13 /*!< EVENTOUT on pin 13 */ +#define AFIO_EVENTOUT_PIN_14 AFIO_EVCR_PIN_PX14 /*!< EVENTOUT on pin 14 */ +#define AFIO_EVENTOUT_PIN_15 AFIO_EVCR_PIN_PX15 /*!< EVENTOUT on pin 15 */ + +#define IS_AFIO_EVENTOUT_PIN(__PIN__) (((__PIN__) == AFIO_EVENTOUT_PIN_0) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_1) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_2) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_3) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_4) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_5) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_6) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_7) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_8) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_9) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_10) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_11) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_12) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_13) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_14) || \ + ((__PIN__) == AFIO_EVENTOUT_PIN_15)) +/** + * @} + */ + +/** @defgroup GPIOEx_EVENTOUT_PORT EVENTOUT Port + * @{ + */ + +#define AFIO_EVENTOUT_PORT_A AFIO_EVCR_PORT_PA /*!< EVENTOUT on port A */ +#define AFIO_EVENTOUT_PORT_B AFIO_EVCR_PORT_PB /*!< EVENTOUT on port B */ +#define AFIO_EVENTOUT_PORT_C AFIO_EVCR_PORT_PC /*!< EVENTOUT on port C */ +#define AFIO_EVENTOUT_PORT_D AFIO_EVCR_PORT_PD /*!< EVENTOUT on port D */ +#define AFIO_EVENTOUT_PORT_E AFIO_EVCR_PORT_PE /*!< EVENTOUT on port E */ + +#define IS_AFIO_EVENTOUT_PORT(__PORT__) (((__PORT__) == AFIO_EVENTOUT_PORT_A) || \ + ((__PORT__) == AFIO_EVENTOUT_PORT_B) || \ + ((__PORT__) == AFIO_EVENTOUT_PORT_C) || \ + ((__PORT__) == AFIO_EVENTOUT_PORT_D) || \ + ((__PORT__) == AFIO_EVENTOUT_PORT_E)) +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup GPIOEx_AFIO_AF_REMAPPING Alternate Function Remapping + * @brief This section propose definition to remap the alternate function to some other port/pins. + * @{ + */ + +/** + * @brief Enable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI. + * @note ENABLE: Remap (NSS/PA15, SCK/PB3, MISO/PB4, MOSI/PB5) + * @retval None + */ +#define __HAL_AFIO_REMAP_SPI1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_SPI1_REMAP) + +/** + * @brief Disable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI. + * @note DISABLE: No remap (NSS/PA4, SCK/PA5, MISO/PA6, MOSI/PA7) + * @retval None + */ +#define __HAL_AFIO_REMAP_SPI1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_SPI1_REMAP) + +/** + * @brief Enable the remapping of I2C1 alternate function SCL and SDA. + * @note ENABLE: Remap (SCL/PB8, SDA/PB9) + * @retval None + */ +#define __HAL_AFIO_REMAP_I2C1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_I2C1_REMAP) + +/** + * @brief Disable the remapping of I2C1 alternate function SCL and SDA. + * @note DISABLE: No remap (SCL/PB6, SDA/PB7) + * @retval None + */ +#define __HAL_AFIO_REMAP_I2C1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_I2C1_REMAP) + +/** + * @brief Enable the remapping of USART1 alternate function TX and RX. + * @note ENABLE: Remap (TX/PB6, RX/PB7) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_USART1_REMAP) + +/** + * @brief Disable the remapping of USART1 alternate function TX and RX. + * @note DISABLE: No remap (TX/PA9, RX/PA10) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_USART1_REMAP) + +/** + * @brief Enable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX. + * @note ENABLE: Remap (CTS/PD3, RTS/PD4, TX/PD5, RX/PD6, CK/PD7) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART2_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_USART2_REMAP) + +/** + * @brief Disable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX. + * @note DISABLE: No remap (CTS/PA0, RTS/PA1, TX/PA2, RX/PA3, CK/PA4) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART2_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_USART2_REMAP) + +/** + * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @note ENABLE: Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART3_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_FULLREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @note PARTIAL: Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART3_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_PARTIALREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP) + +/** + * @brief Disable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @note DISABLE: No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14) + * @retval None + */ +#define __HAL_AFIO_REMAP_USART3_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_NOREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @note ENABLE: Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM1_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_FULLREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @note PARTIAL: Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM1_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_PARTIALREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP) + +/** + * @brief Disable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @note DISABLE: No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM1_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_NOREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @note ENABLE: Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM2_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_FULLREMAP, AFIO_MAPR_TIM2_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @note PARTIAL_2: Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM2_PARTIAL_2() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2, AFIO_MAPR_TIM2_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @note PARTIAL_1: Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM2_PARTIAL_1() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1, AFIO_MAPR_TIM2_REMAP_FULLREMAP) + +/** + * @brief Disable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @note DISABLE: No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM2_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_NOREMAP, AFIO_MAPR_TIM2_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM3 alternate function channels 1 to 4 + * @note ENABLE: Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM3_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_FULLREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM3 alternate function channels 1 to 4 + * @note PARTIAL: Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM3_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_PARTIALREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP) + +/** + * @brief Disable the remapping of TIM3 alternate function channels 1 to 4 + * @note DISABLE: No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM3_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_NOREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP) + +/** + * @brief Enable the remapping of TIM4 alternate function channels 1 to 4. + * @note ENABLE: Full remap (TIM4_CH1/PD12, TIM4_CH2/PD13, TIM4_CH3/PD14, TIM4_CH4/PD15) + * @note TIM4_ETR on PE0 is not re-mapped. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM4_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM4_REMAP) + +/** + * @brief Disable the remapping of TIM4 alternate function channels 1 to 4. + * @note DISABLE: No remap (TIM4_CH1/PB6, TIM4_CH2/PB7, TIM4_CH3/PB8, TIM4_CH4/PB9) + * @note TIM4_ETR on PE0 is not re-mapped. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM4_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM4_REMAP) + +#if defined(AFIO_MAPR_CAN_REMAP_REMAP1) + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @note CASE 1: CAN_RX mapped to PA11, CAN_TX mapped to PA12 + * @retval None + */ +#define __HAL_AFIO_REMAP_CAN1_1() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP1, AFIO_MAPR_CAN_REMAP) + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @note CASE 2: CAN_RX mapped to PB8, CAN_TX mapped to PB9 (not available on 36-pin package) + * @retval None + */ +#define __HAL_AFIO_REMAP_CAN1_2() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP2, AFIO_MAPR_CAN_REMAP) + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @note CASE 3: CAN_RX mapped to PD0, CAN_TX mapped to PD1 + * @retval None + */ +#define __HAL_AFIO_REMAP_CAN1_3() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP3, AFIO_MAPR_CAN_REMAP) + +#endif + +/** + * @brief Enable the remapping of PD0 and PD1. When the HSE oscillator is not used + * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and + * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available + * on 100-pin and 144-pin packages, no need for remapping). + * @note ENABLE: PD0 remapped on OSC_IN, PD1 remapped on OSC_OUT. + * @retval None + */ +#define __HAL_AFIO_REMAP_PD01_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_PD01_REMAP) + +/** + * @brief Disable the remapping of PD0 and PD1. When the HSE oscillator is not used + * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and + * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available + * on 100-pin and 144-pin packages, no need for remapping). + * @note DISABLE: No remapping of PD0 and PD1 + * @retval None + */ +#define __HAL_AFIO_REMAP_PD01_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_PD01_REMAP) + +#if defined(AFIO_MAPR_TIM5CH4_IREMAP) +/** + * @brief Enable the remapping of TIM5CH4. + * @note ENABLE: LSI internal clock is connected to TIM5_CH4 input for calibration purpose. + * @note This function is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM5CH4_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM5CH4_IREMAP) + +/** + * @brief Disable the remapping of TIM5CH4. + * @note DISABLE: TIM5_CH4 is connected to PA3 + * @note This function is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM5CH4_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM5CH4_IREMAP) +#endif + +#if defined(AFIO_MAPR_ETH_REMAP) +/** + * @brief Enable the remapping of Ethernet MAC connections with the PHY. + * @note ENABLE: Remap (RX_DV-CRS_DV/PD8, RXD0/PD9, RXD1/PD10, RXD2/PD11, RXD3/PD12) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_ETH_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ETH_REMAP) + +/** + * @brief Disable the remapping of Ethernet MAC connections with the PHY. + * @note DISABLE: No remap (RX_DV-CRS_DV/PA7, RXD0/PC4, RXD1/PC5, RXD2/PB0, RXD3/PB1) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_ETH_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ETH_REMAP) +#endif + +#if defined(AFIO_MAPR_CAN2_REMAP) + +/** + * @brief Enable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX. + * @note ENABLE: Remap (CAN2_RX/PB5, CAN2_TX/PB6) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_CAN2_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_CAN2_REMAP) + +/** + * @brief Disable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX. + * @note DISABLE: No remap (CAN2_RX/PB12, CAN2_TX/PB13) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_CAN2_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_CAN2_REMAP) +#endif + +#if defined(AFIO_MAPR_MII_RMII_SEL) +/** + * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY. + * @note ETH_RMII: Configure Ethernet MAC for connection with an RMII PHY + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_ETH_RMII() AFIO_REMAP_ENABLE(AFIO_MAPR_MII_RMII_SEL) + +/** + * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY. + * @note ETH_MII: Configure Ethernet MAC for connection with an MII PHY + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_ETH_MII() AFIO_REMAP_DISABLE(AFIO_MAPR_MII_RMII_SEL) +#endif + +/** + * @brief Enable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion). + * @note ENABLE: ADC1 External Event injected conversion is connected to TIM8 Channel4. + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC1_ETRGINJ_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC1_ETRGINJ_REMAP) + +/** + * @brief Disable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion). + * @note DISABLE: ADC1 External trigger injected conversion is connected to EXTI15 + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC1_ETRGINJ_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC1_ETRGINJ_REMAP) + +/** + * @brief Enable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion). + * @note ENABLE: ADC1 External Event regular conversion is connected to TIM8 TRG0. + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC1_ETRGREG_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC1_ETRGREG_REMAP) + +/** + * @brief Disable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion). + * @note DISABLE: ADC1 External trigger regular conversion is connected to EXTI11 + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC1_ETRGREG_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC1_ETRGREG_REMAP) + +#if defined(AFIO_MAPR_ADC2_ETRGINJ_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion). + * @note ENABLE: ADC2 External Event injected conversion is connected to TIM8 Channel4. + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC2_ETRGINJ_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC2_ETRGINJ_REMAP) + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion). + * @note DISABLE: ADC2 External trigger injected conversion is connected to EXTI15 + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC2_ETRGINJ_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC2_ETRGINJ_REMAP) +#endif + +#if defined (AFIO_MAPR_ADC2_ETRGREG_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @note ENABLE: ADC2 External Event regular conversion is connected to TIM8 TRG0. + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC2_ETRGREG_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC2_ETRGREG_REMAP) + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @note DISABLE: ADC2 External trigger regular conversion is connected to EXTI11 + * @retval None + */ +#define __HAL_AFIO_REMAP_ADC2_ETRGREG_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC2_ETRGREG_REMAP) +#endif + +/** + * @brief Enable the Serial wire JTAG configuration + * @note ENABLE: Full SWJ (JTAG-DP + SW-DP): Reset State + * @retval None + */ +#define __HAL_AFIO_REMAP_SWJ_ENABLE() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_RESET) + +/** + * @brief Enable the Serial wire JTAG configuration + * @note NONJTRST: Full SWJ (JTAG-DP + SW-DP) but without NJTRST + * @retval None + */ +#define __HAL_AFIO_REMAP_SWJ_NONJTRST() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_NOJNTRST) + +/** + * @brief Enable the Serial wire JTAG configuration + * @note NOJTAG: JTAG-DP Disabled and SW-DP Enabled + * @retval None + */ + +#define __HAL_AFIO_REMAP_SWJ_NOJTAG() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_JTAGDISABLE) + +/** + * @brief Disable the Serial wire JTAG configuration + * @note DISABLE: JTAG-DP Disabled and SW-DP Disabled + * @retval None + */ +#define __HAL_AFIO_REMAP_SWJ_DISABLE() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_DISABLE) + +#if defined(AFIO_MAPR_SPI3_REMAP) + +/** + * @brief Enable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD. + * @note ENABLE: Remap (SPI3_NSS-I2S3_WS/PA4, SPI3_SCK-I2S3_CK/PC10, SPI3_MISO/PC11, SPI3_MOSI-I2S3_SD/PC12) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_SPI3_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_SPI3_REMAP) + +/** + * @brief Disable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD. + * @note DISABLE: No remap (SPI3_NSS-I2S3_WS/PA15, SPI3_SCK-I2S3_CK/PB3, SPI3_MISO/PB4, SPI3_MOSI-I2S3_SD/PB5). + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_REMAP_SPI3_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_SPI3_REMAP) +#endif + +#if defined(AFIO_MAPR_TIM2ITR1_IREMAP) + +/** + * @brief Control of TIM2_ITR1 internal mapping. + * @note TO_USB: Connect USB OTG SOF (Start of Frame) output to TIM2_ITR1 for calibration purposes. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_TIM2ITR1_TO_USB() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM2ITR1_IREMAP) + +/** + * @brief Control of TIM2_ITR1 internal mapping. + * @note TO_ETH: Connect TIM2_ITR1 internally to the Ethernet PTP output for calibration purposes. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_TIM2ITR1_TO_ETH() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM2ITR1_IREMAP) +#endif + +#if defined(AFIO_MAPR_PTP_PPS_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @note ENABLE: PTP_PPS is output on PB5 pin. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_ETH_PTP_PPS_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_PTP_PPS_REMAP) + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @note DISABLE: PTP_PPS not output on PB5 pin. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +#define __HAL_AFIO_ETH_PTP_PPS_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_PTP_PPS_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM9_REMAP) + +/** + * @brief Enable the remapping of TIM9_CH1 and TIM9_CH2. + * @note ENABLE: Remap (TIM9_CH1 on PE5 and TIM9_CH2 on PE6). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM9_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP) + +/** + * @brief Disable the remapping of TIM9_CH1 and TIM9_CH2. + * @note DISABLE: No remap (TIM9_CH1 on PA2 and TIM9_CH2 on PA3). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM9_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM10_REMAP) + +/** + * @brief Enable the remapping of TIM10_CH1. + * @note ENABLE: Remap (TIM10_CH1 on PF6). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM10_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP) + +/** + * @brief Disable the remapping of TIM10_CH1. + * @note DISABLE: No remap (TIM10_CH1 on PB8). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM10_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM11_REMAP) +/** + * @brief Enable the remapping of TIM11_CH1. + * @note ENABLE: Remap (TIM11_CH1 on PF7). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM11_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP) + +/** + * @brief Disable the remapping of TIM11_CH1. + * @note DISABLE: No remap (TIM11_CH1 on PB9). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM11_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM13_REMAP) + +/** + * @brief Enable the remapping of TIM13_CH1. + * @note ENABLE: Remap STM32F100:(TIM13_CH1 on PF8). Others:(TIM13_CH1 on PB0). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM13_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP) + +/** + * @brief Disable the remapping of TIM13_CH1. + * @note DISABLE: No remap STM32F100:(TIM13_CH1 on PA6). Others:(TIM13_CH1 on PC8). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM13_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM14_REMAP) + +/** + * @brief Enable the remapping of TIM14_CH1. + * @note ENABLE: Remap STM32F100:(TIM14_CH1 on PB1). Others:(TIM14_CH1 on PF9). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM14_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP) + +/** + * @brief Disable the remapping of TIM14_CH1. + * @note DISABLE: No remap STM32F100:(TIM14_CH1 on PC9). Others:(TIM14_CH1 on PA7). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM14_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP) +#endif + +#if defined(AFIO_MAPR2_FSMC_NADV_REMAP) + +/** + * @brief Controls the use of the optional FSMC_NADV signal. + * @note DISCONNECTED: The NADV signal is not connected. The I/O pin can be used by another peripheral. + * @retval None + */ +#define __HAL_AFIO_FSMCNADV_DISCONNECTED() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP) + +/** + * @brief Controls the use of the optional FSMC_NADV signal. + * @note CONNECTED: The NADV signal is connected to the output (default). + * @retval None + */ +#define __HAL_AFIO_FSMCNADV_CONNECTED() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM15_REMAP) + +/** + * @brief Enable the remapping of TIM15_CH1 and TIM15_CH2. + * @note ENABLE: Remap (TIM15_CH1 on PB14 and TIM15_CH2 on PB15). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM15_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP) + +/** + * @brief Disable the remapping of TIM15_CH1 and TIM15_CH2. + * @note DISABLE: No remap (TIM15_CH1 on PA2 and TIM15_CH2 on PA3). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM15_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM16_REMAP) + +/** + * @brief Enable the remapping of TIM16_CH1. + * @note ENABLE: Remap (TIM16_CH1 on PA6). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM16_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP) + +/** + * @brief Disable the remapping of TIM16_CH1. + * @note DISABLE: No remap (TIM16_CH1 on PB8). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM16_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM17_REMAP) + +/** + * @brief Enable the remapping of TIM17_CH1. + * @note ENABLE: Remap (TIM17_CH1 on PA7). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM17_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP) + +/** + * @brief Disable the remapping of TIM17_CH1. + * @note DISABLE: No remap (TIM17_CH1 on PB9). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM17_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP) +#endif + +#if defined(AFIO_MAPR2_CEC_REMAP) + +/** + * @brief Enable the remapping of CEC. + * @note ENABLE: Remap (CEC on PB10). + * @retval None + */ +#define __HAL_AFIO_REMAP_CEC_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP) + +/** + * @brief Disable the remapping of CEC. + * @note DISABLE: No remap (CEC on PB8). + * @retval None + */ +#define __HAL_AFIO_REMAP_CEC_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM1_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels. + * @note ENABLE: Remap (TIM1_CH1 DMA request/DMA1 Channel6, TIM1_CH2 DMA request/DMA1 Channel6) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM1DMA_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels. + * @note DISABLE: No remap (TIM1_CH1 DMA request/DMA1 Channel2, TIM1_CH2 DMA request/DMA1 Channel3). + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM1DMA_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM67_DAC_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels. + * @note ENABLE: Remap (TIM6_DAC1 DMA request/DMA1 Channel3, TIM7_DAC2 DMA request/DMA1 Channel4) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM67DACDMA_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels. + * @note DISABLE: No remap (TIM6_DAC1 DMA request/DMA2 Channel3, TIM7_DAC2 DMA request/DMA2 Channel4) + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM67DACDMA_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP) +#endif + +#if defined(AFIO_MAPR2_TIM12_REMAP) + +/** + * @brief Enable the remapping of TIM12_CH1 and TIM12_CH2. + * @note ENABLE: Remap (TIM12_CH1 on PB12 and TIM12_CH2 on PB13). + * @note This bit is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM12_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP) + +/** + * @brief Disable the remapping of TIM12_CH1 and TIM12_CH2. + * @note DISABLE: No remap (TIM12_CH1 on PC4 and TIM12_CH2 on PC5). + * @note This bit is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_TIM12_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP) +#endif + +#if defined(AFIO_MAPR2_MISC_REMAP) + +/** + * @brief Miscellaneous features remapping. + * This bit is set and cleared by software. It controls miscellaneous features. + * The DMA2 channel 5 interrupt position in the vector table. + * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register). + * @note ENABLE: DMA2 channel 5 interrupt is mapped separately at position 60 and TIM15 TRGO event is + * selected as DAC Trigger 3, TIM15 triggers TIM1/3. + * @note This bit is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_MISC_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP) + +/** + * @brief Miscellaneous features remapping. + * This bit is set and cleared by software. It controls miscellaneous features. + * The DMA2 channel 5 interrupt position in the vector table. + * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register). + * @note DISABLE: DMA2 channel 5 interrupt is mapped with DMA2 channel 4 at position 59, TIM5 TRGO + * event is selected as DAC Trigger 3, TIM5 triggers TIM1/3. + * @note This bit is available only in high density value line devices. + * @retval None + */ +#define __HAL_AFIO_REMAP_MISC_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP) +#endif + +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup GPIOEx_Private_Macros GPIOEx Private Macros + * @{ + */ +#if defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6) +#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ + ((__GPIOx__) == (GPIOB))? 1uL :\ + ((__GPIOx__) == (GPIOC))? 2uL :3uL) +#elif defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F103xB) || defined(STM32F105xC) || defined(STM32F107xC) +#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ + ((__GPIOx__) == (GPIOB))? 1uL :\ + ((__GPIOx__) == (GPIOC))? 2uL :\ + ((__GPIOx__) == (GPIOD))? 3uL :4uL) +#elif defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) +#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ + ((__GPIOx__) == (GPIOB))? 1uL :\ + ((__GPIOx__) == (GPIOC))? 2uL :\ + ((__GPIOx__) == (GPIOD))? 3uL :\ + ((__GPIOx__) == (GPIOE))? 4uL :\ + ((__GPIOx__) == (GPIOF))? 5uL :6uL) +#endif + +#define AFIO_REMAP_ENABLE(REMAP_PIN) do{ uint32_t tmpreg = AFIO->MAPR; \ + tmpreg |= AFIO_MAPR_SWJ_CFG; \ + tmpreg |= REMAP_PIN; \ + AFIO->MAPR = tmpreg; \ + }while(0u) + +#define AFIO_REMAP_DISABLE(REMAP_PIN) do{ uint32_t tmpreg = AFIO->MAPR; \ + tmpreg |= AFIO_MAPR_SWJ_CFG; \ + tmpreg &= ~REMAP_PIN; \ + AFIO->MAPR = tmpreg; \ + }while(0u) + +#define AFIO_REMAP_PARTIAL(REMAP_PIN, REMAP_PIN_MASK) do{ uint32_t tmpreg = AFIO->MAPR; \ + tmpreg &= ~REMAP_PIN_MASK; \ + tmpreg |= AFIO_MAPR_SWJ_CFG; \ + tmpreg |= REMAP_PIN; \ + AFIO->MAPR = tmpreg; \ + }while(0u) + +#define AFIO_DBGAFR_CONFIG(DBGAFR_SWJCFG) do{ uint32_t tmpreg = AFIO->MAPR; \ + tmpreg &= ~AFIO_MAPR_SWJ_CFG_Msk; \ + tmpreg |= DBGAFR_SWJCFG; \ + AFIO->MAPR = tmpreg; \ + }while(0u) + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup GPIOEx_Exported_Functions + * @{ + */ + +/** @addtogroup GPIOEx_Exported_Functions_Group1 + * @{ + */ +void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource); +void HAL_GPIOEx_EnableEventout(void); +void HAL_GPIOEx_DisableEventout(void); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_HAL_GPIO_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h new file mode 100644 index 0000000..9696c00 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h @@ -0,0 +1,388 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_pwr.h + * @author MCD Application Team + * @brief Header file of PWR HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_PWR_H +#define __STM32F1xx_HAL_PWR_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup PWR + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup PWR_Exported_Types PWR Exported Types + * @{ + */ + +/** + * @brief PWR PVD configuration structure definition + */ +typedef struct +{ + uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. + 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 */ +}PWR_PVDTypeDef; + + +/** + * @} + */ + + +/* Internal constants --------------------------------------------------------*/ + +/** @addtogroup PWR_Private_Constants + * @{ + */ + +#define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */ + +/** + * @} + */ + + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup PWR_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_PVD_detection_level PWR PVD detection level + * @{ + */ +#define PWR_PVDLEVEL_0 PWR_CR_PLS_2V2 +#define PWR_PVDLEVEL_1 PWR_CR_PLS_2V3 +#define PWR_PVDLEVEL_2 PWR_CR_PLS_2V4 +#define PWR_PVDLEVEL_3 PWR_CR_PLS_2V5 +#define PWR_PVDLEVEL_4 PWR_CR_PLS_2V6 +#define PWR_PVDLEVEL_5 PWR_CR_PLS_2V7 +#define PWR_PVDLEVEL_6 PWR_CR_PLS_2V8 +#define PWR_PVDLEVEL_7 PWR_CR_PLS_2V9 + +/** + * @} + */ + +/** @defgroup PWR_PVD_Mode PWR PVD Mode + * @{ + */ +#define PWR_PVD_MODE_NORMAL 0x00000000U /*!< basic mode is used */ +#define PWR_PVD_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */ +#define PWR_PVD_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */ +#define PWR_PVD_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ +#define PWR_PVD_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */ +#define PWR_PVD_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */ +#define PWR_PVD_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */ + +/** + * @} + */ + + +/** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins + * @{ + */ + +#define PWR_WAKEUP_PIN1 PWR_CSR_EWUP + +/** + * @} + */ + +/** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR Regulator state in SLEEP/STOP mode + * @{ + */ +#define PWR_MAINREGULATOR_ON 0x00000000U +#define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS + +/** + * @} + */ + +/** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry + * @{ + */ +#define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) +#define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) + +/** + * @} + */ + +/** @defgroup PWR_STOP_mode_entry PWR STOP mode entry + * @{ + */ +#define PWR_STOPENTRY_WFI ((uint8_t)0x01) +#define PWR_STOPENTRY_WFE ((uint8_t)0x02) + +/** + * @} + */ + +/** @defgroup PWR_Flag PWR Flag + * @{ + */ +#define PWR_FLAG_WU PWR_CSR_WUF +#define PWR_FLAG_SB PWR_CSR_SBF +#define PWR_FLAG_PVDO PWR_CSR_PVDO + + +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWR_Exported_Macros PWR Exported Macros + * @{ + */ + +/** @brief Check PWR flag is set or not. + * @param __FLAG__: specifies the flag to check. + * This parameter can be one of the following values: + * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event + * was received from the WKUP pin or from the RTC alarm + * An additional wakeup event is detected if the WKUP pin is enabled + * (by setting the EWUP bit) when the WKUP pin level is already high. + * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was + * resumed from StandBy mode. + * @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. + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the PWR's pending flags. + * @param __FLAG__: specifies the flag to clear. + * This parameter can be one of the following values: + * @arg PWR_FLAG_WU: Wake Up flag + * @arg PWR_FLAG_SB: StandBy flag + */ +#define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CR, ((__FLAG__) << 2)) + +/** + * @brief Enable interrupt on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) + +/** + * @brief Disable interrupt on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD) + +/** + * @brief Enable event on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) + +/** + * @brief Disable event on PVD Exti Line 16. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD) + + +/** + * @brief PVD EXTI line configuration: set falling edge trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) + + +/** + * @brief Disable the PVD Extended Interrupt Falling Trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD) + + +/** + * @brief PVD EXTI line configuration: set rising edge trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) + +/** + * @brief Disable the PVD Extended Interrupt Rising Trigger. + * This parameter can be: + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD) + +/** + * @brief PVD EXTI line configuration: set rising & falling edge trigger. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); + +/** + * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger. + * This parameter can be: + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); + + + +/** + * @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() (EXTI->PR & (PWR_EXTI_LINE_PVD)) + +/** + * @brief Clear the PVD EXTI flag. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD)) + +/** + * @brief Generate a Software interrupt on selected EXTI line. + * @retval None. + */ +#define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, PWR_EXTI_LINE_PVD) +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup PWR_Private_Macros PWR Private Macros + * @{ + */ +#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \ + ((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_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1)) + +#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)) + +/** + * @} + */ + + + +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup PWR_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions + * @{ + */ + +/* Initialization and de-initialization functions *******************************/ +void HAL_PWR_DeInit(void); +void HAL_PWR_EnableBkUpAccess(void); +void HAL_PWR_DisableBkUpAccess(void); + +/** + * @} + */ + +/** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions + * @{ + */ + +/* Peripheral Control functions ************************************************/ +void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD); +/* #define HAL_PWR_ConfigPVD 12*/ +void HAL_PWR_EnablePVD(void); +void HAL_PWR_DisablePVD(void); + +/* WakeUp pins configuration functions ****************************************/ +void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); +void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); + +/* Low Power modes configuration functions ************************************/ +void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); +void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); +void HAL_PWR_EnterSTANDBYMode(void); + +void HAL_PWR_EnableSleepOnExit(void); +void HAL_PWR_DisableSleepOnExit(void); +void HAL_PWR_EnableSEVOnPend(void); +void HAL_PWR_DisableSEVOnPend(void); + + + +void HAL_PWR_PVD_IRQHandler(void); +void HAL_PWR_PVDCallback(void); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __STM32F1xx_HAL_PWR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h new file mode 100644 index 0000000..782e33a --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h @@ -0,0 +1,1378 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_rcc.h + * @author MCD Application Team + * @brief Header file of RCC HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_RCC_H +#define __STM32F1xx_HAL_RCC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup RCC + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup RCC_Exported_Types RCC Exported Types + * @{ + */ + +/** + * @brief RCC PLL configuration structure definition + */ +typedef struct +{ + uint32_t PLLState; /*!< PLLState: The new state of the PLL. + This parameter can be a value of @ref RCC_PLL_Config */ + + uint32_t PLLSource; /*!< PLLSource: PLL entry clock source. + This parameter must be a value of @ref RCC_PLL_Clock_Source */ + + uint32_t PLLMUL; /*!< PLLMUL: Multiplication factor for PLL VCO input clock + This parameter must be a value of @ref RCCEx_PLL_Multiplication_Factor */ +} RCC_PLLInitTypeDef; + +/** + * @brief RCC System, AHB and APB busses clock configuration structure definition + */ +typedef struct +{ + uint32_t ClockType; /*!< The clock to be configured. + This parameter can be a value of @ref RCC_System_Clock_Type */ + + uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock. + This parameter can be a value of @ref RCC_System_Clock_Source */ + + uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). + This parameter can be a value of @ref RCC_AHB_Clock_Source */ + + uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ + + uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ +} RCC_ClkInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RCC_Exported_Constants RCC Exported Constants + * @{ + */ + +/** @defgroup RCC_PLL_Clock_Source PLL Clock Source + * @{ + */ + +#define RCC_PLLSOURCE_HSI_DIV2 0x00000000U /*!< HSI clock divided by 2 selected as PLL entry clock source */ +#define RCC_PLLSOURCE_HSE RCC_CFGR_PLLSRC /*!< HSE clock selected as PLL entry clock source */ + +/** + * @} + */ + +/** @defgroup RCC_Oscillator_Type Oscillator Type + * @{ + */ +#define RCC_OSCILLATORTYPE_NONE 0x00000000U +#define RCC_OSCILLATORTYPE_HSE 0x00000001U +#define RCC_OSCILLATORTYPE_HSI 0x00000002U +#define RCC_OSCILLATORTYPE_LSE 0x00000004U +#define RCC_OSCILLATORTYPE_LSI 0x00000008U +/** + * @} + */ + +/** @defgroup RCC_HSE_Config HSE Config + * @{ + */ +#define RCC_HSE_OFF 0x00000000U /*!< HSE clock deactivation */ +#define RCC_HSE_ON RCC_CR_HSEON /*!< HSE clock activation */ +#define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON)) /*!< External clock source for HSE clock */ +/** + * @} + */ + +/** @defgroup RCC_LSE_Config LSE Config + * @{ + */ +#define RCC_LSE_OFF 0x00000000U /*!< LSE clock deactivation */ +#define RCC_LSE_ON RCC_BDCR_LSEON /*!< LSE clock activation */ +#define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) /*!< External clock source for LSE clock */ + +/** + * @} + */ + +/** @defgroup RCC_HSI_Config HSI Config + * @{ + */ +#define RCC_HSI_OFF 0x00000000U /*!< HSI clock deactivation */ +#define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */ + +#define RCC_HSICALIBRATION_DEFAULT 0x10U /* Default HSI calibration trimming value */ + +/** + * @} + */ + +/** @defgroup RCC_LSI_Config LSI Config + * @{ + */ +#define RCC_LSI_OFF 0x00000000U /*!< LSI clock deactivation */ +#define RCC_LSI_ON RCC_CSR_LSION /*!< LSI clock activation */ + +/** + * @} + */ + +/** @defgroup RCC_PLL_Config PLL Config + * @{ + */ +#define RCC_PLL_NONE 0x00000000U /*!< PLL is not configured */ +#define RCC_PLL_OFF 0x00000001U /*!< PLL deactivation */ +#define RCC_PLL_ON 0x00000002U /*!< PLL activation */ + +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Type System Clock Type + * @{ + */ +#define RCC_CLOCKTYPE_SYSCLK 0x00000001U /*!< SYSCLK to configure */ +#define RCC_CLOCKTYPE_HCLK 0x00000002U /*!< HCLK to configure */ +#define RCC_CLOCKTYPE_PCLK1 0x00000004U /*!< PCLK1 to configure */ +#define RCC_CLOCKTYPE_PCLK2 0x00000008U /*!< PCLK2 to configure */ + +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Source System Clock Source + * @{ + */ +#define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selected as system clock */ +#define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selected as system clock */ +#define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL /*!< PLL selected as system clock */ + +/** + * @} + */ + +/** @defgroup RCC_System_Clock_Source_Status System Clock Source Status + * @{ + */ +#define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */ +#define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */ +#define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */ + +/** + * @} + */ + +/** @defgroup RCC_AHB_Clock_Source AHB Clock Source + * @{ + */ +#define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */ +#define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */ +#define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */ +#define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */ +#define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */ +#define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */ +#define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */ +#define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */ +#define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */ + +/** + * @} + */ + +/** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source + * @{ + */ +#define RCC_HCLK_DIV1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */ +#define RCC_HCLK_DIV2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */ +#define RCC_HCLK_DIV4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */ +#define RCC_HCLK_DIV8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */ +#define RCC_HCLK_DIV16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */ + +/** + * @} + */ + +/** @defgroup RCC_RTC_Clock_Source RTC Clock Source + * @{ + */ +#define RCC_RTCCLKSOURCE_NO_CLK 0x00000000U /*!< No clock */ +#define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_LSE /*!< LSE oscillator clock used as RTC clock */ +#define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_LSI /*!< LSI oscillator clock used as RTC clock */ +#define RCC_RTCCLKSOURCE_HSE_DIV128 RCC_BDCR_RTCSEL_HSE /*!< HSE oscillator clock divided by 128 used as RTC clock */ +/** + * @} + */ + + +/** @defgroup RCC_MCO_Index MCO Index + * @{ + */ +#define RCC_MCO1 0x00000000U +#define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 2 MCOs*/ + +/** + * @} + */ + +/** @defgroup RCC_MCOx_Clock_Prescaler MCO Clock Prescaler + * @{ + */ +#define RCC_MCODIV_1 0x00000000U + +/** + * @} + */ + +/** @defgroup RCC_Interrupt Interrupts + * @{ + */ +#define RCC_IT_LSIRDY ((uint8_t)RCC_CIR_LSIRDYF) /*!< LSI Ready Interrupt flag */ +#define RCC_IT_LSERDY ((uint8_t)RCC_CIR_LSERDYF) /*!< LSE Ready Interrupt flag */ +#define RCC_IT_HSIRDY ((uint8_t)RCC_CIR_HSIRDYF) /*!< HSI Ready Interrupt flag */ +#define RCC_IT_HSERDY ((uint8_t)RCC_CIR_HSERDYF) /*!< HSE Ready Interrupt flag */ +#define RCC_IT_PLLRDY ((uint8_t)RCC_CIR_PLLRDYF) /*!< PLL Ready Interrupt flag */ +#define RCC_IT_CSS ((uint8_t)RCC_CIR_CSSF) /*!< Clock Security System Interrupt flag */ +/** + * @} + */ + +/** @defgroup RCC_Flag Flags + * Elements values convention: XXXYYYYYb + * - YYYYY : Flag position in the register + * - XXX : Register index + * - 001: CR register + * - 010: BDCR register + * - 011: CSR register + * @{ + */ +/* Flags in the CR register */ +#define RCC_FLAG_HSIRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_Pos)) /*!< Internal High Speed clock ready flag */ +#define RCC_FLAG_HSERDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_Pos)) /*!< External High Speed clock ready flag */ +#define RCC_FLAG_PLLRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_Pos)) /*!< PLL clock ready flag */ + +/* Flags in the CSR register */ +#define RCC_FLAG_LSIRDY ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSIRDY_Pos)) /*!< Internal Low Speed oscillator Ready */ +#define RCC_FLAG_PINRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_Pos)) /*!< PIN reset flag */ +#define RCC_FLAG_PORRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PORRSTF_Pos)) /*!< POR/PDR reset flag */ +#define RCC_FLAG_SFTRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_Pos)) /*!< Software Reset flag */ +#define RCC_FLAG_IWDGRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_Pos)) /*!< Independent Watchdog reset flag */ +#define RCC_FLAG_WWDGRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_Pos)) /*!< Window watchdog reset flag */ +#define RCC_FLAG_LPWRRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_Pos)) /*!< Low-Power reset flag */ + +/* Flags in the BDCR register */ +#define RCC_FLAG_LSERDY ((uint8_t)((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSERDY_Pos)) /*!< External Low Speed oscillator Ready */ + +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/** @defgroup RCC_Exported_Macros RCC Exported Macros + * @{ + */ + +/** @defgroup RCC_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable + * @brief Enable or disable the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_DMA1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SRAM_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_FLITF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_CRC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_DMA1_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA1EN)) +#define __HAL_RCC_SRAM_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SRAMEN)) +#define __HAL_RCC_FLITF_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FLITFEN)) +#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_CRCEN)) + +/** + * @} + */ + +/** @defgroup RCC_AHB_Peripheral_Clock_Enable_Disable_Status AHB Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#define __HAL_RCC_DMA1_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) != RESET) +#define __HAL_RCC_DMA1_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) == RESET) +#define __HAL_RCC_SRAM_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) != RESET) +#define __HAL_RCC_SRAM_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) == RESET) +#define __HAL_RCC_FLITF_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) != RESET) +#define __HAL_RCC_FLITF_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) == RESET) +#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) != RESET) +#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) == RESET) + +/** + * @} + */ + +/** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_TIM2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_WWDG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_USART2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_I2C1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_BKP_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_BKPEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_BKPEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_PWR_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN)) +#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN)) +#define __HAL_RCC_WWDG_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_WWDGEN)) +#define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN)) +#define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN)) + +#define __HAL_RCC_BKP_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_BKPEN)) +#define __HAL_RCC_PWR_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN)) + +/** + * @} + */ + +/** @defgroup RCC_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET) +#define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET) +#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET) +#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET) +#define __HAL_RCC_WWDG_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != RESET) +#define __HAL_RCC_WWDG_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == RESET) +#define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET) +#define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET) +#define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET) +#define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET) +#define __HAL_RCC_BKP_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_BKPEN)) != RESET) +#define __HAL_RCC_BKP_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_BKPEN)) == RESET) +#define __HAL_RCC_PWR_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != RESET) +#define __HAL_RCC_PWR_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == RESET) + +/** + * @} + */ + +/** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ +#define __HAL_RCC_AFIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_AFIOEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_AFIOEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOA_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPAEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPAEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOB_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPBEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPBEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ADC1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SPI1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_USART1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\ + /* Delay after an RCC peripheral clock enabling */\ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_AFIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_AFIOEN)) +#define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPAEN)) +#define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPBEN)) +#define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPCEN)) +#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPDEN)) +#define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN)) + +#define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN)) +#define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN)) +#define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN)) + +/** + * @} + */ + +/** @defgroup RCC_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#define __HAL_RCC_AFIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_AFIOEN)) != RESET) +#define __HAL_RCC_AFIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_AFIOEN)) == RESET) +#define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPAEN)) != RESET) +#define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPAEN)) == RESET) +#define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPBEN)) != RESET) +#define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPBEN)) == RESET) +#define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPCEN)) != RESET) +#define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPCEN)) == RESET) +#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPDEN)) != RESET) +#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPDEN)) == RESET) +#define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET) +#define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET) +#define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET) +#define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET) +#define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET) +#define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET) +#define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET) +#define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET) + +/** + * @} + */ + +/** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST)) +#define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST)) +#define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST)) + +#define __HAL_RCC_BKP_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_BKPRST)) +#define __HAL_RCC_PWR_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST)) + +#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00) +#define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) +#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST)) +#define __HAL_RCC_WWDG_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_WWDGRST)) +#define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST)) +#define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST)) + +#define __HAL_RCC_BKP_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_BKPRST)) +#define __HAL_RCC_PWR_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_PWRRST)) + +/** + * @} + */ + +/** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ +#define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) +#define __HAL_RCC_AFIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_AFIORST)) +#define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPARST)) +#define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPBRST)) +#define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPCRST)) +#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPDRST)) +#define __HAL_RCC_ADC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC1RST)) + +#define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST)) +#define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST)) +#define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST)) + +#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00) +#define __HAL_RCC_AFIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_AFIORST)) +#define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPARST)) +#define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPBRST)) +#define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPCRST)) +#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPDRST)) +#define __HAL_RCC_ADC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC1RST)) + +#define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST)) +#define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST)) +#define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST)) + +/** + * @} + */ + +/** @defgroup RCC_HSI_Configuration HSI Configuration + * @{ + */ + +/** @brief Macros to enable or disable the Internal High Speed oscillator (HSI). + * @note The HSI is stopped by hardware when entering STOP and STANDBY modes. + * @note HSI can not be stopped if it is used as system clock source. In this case, + * you have to select another source of the system clock then stop the HSI. + * @note After enabling the HSI, the application software should wait on HSIRDY + * flag to be set indicating that HSI clock is stable and can be used as + * system clock source. + * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator + * clock cycles. + */ +#define __HAL_RCC_HSI_ENABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = ENABLE) +#define __HAL_RCC_HSI_DISABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = DISABLE) + +/** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value. + * @note The calibration is used to compensate for the variations in voltage + * and temperature that influence the frequency of the internal HSI RC. + * @param _HSICALIBRATIONVALUE_ specifies the calibration trimming value. + * (default is RCC_HSICALIBRATION_DEFAULT). + * This parameter must be a number between 0 and 0x1F. + */ +#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(_HSICALIBRATIONVALUE_) \ + (MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, (uint32_t)(_HSICALIBRATIONVALUE_) << RCC_CR_HSITRIM_Pos)) + +/** + * @} + */ + +/** @defgroup RCC_LSI_Configuration LSI Configuration + * @{ + */ + +/** @brief Macro to enable the Internal Low Speed oscillator (LSI). + * @note After enabling the LSI, the application software should wait on + * LSIRDY flag to be set indicating that LSI clock is stable and can + * be used to clock the IWDG and/or the RTC. + */ +#define __HAL_RCC_LSI_ENABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE) + +/** @brief Macro to disable the Internal Low Speed oscillator (LSI). + * @note LSI can not be disabled if the IWDG is running. + * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator + * clock cycles. + */ +#define __HAL_RCC_LSI_DISABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = DISABLE) + +/** + * @} + */ + +/** @defgroup RCC_HSE_Configuration HSE Configuration + * @{ + */ + +/** + * @brief Macro to configure the External High Speed oscillator (HSE). + * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not + * supported by this macro. User should request a transition to HSE Off + * first and then HSE On or HSE Bypass. + * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application + * software should wait on HSERDY flag to be set indicating that HSE clock + * is stable and can be used to clock the PLL and/or system clock. + * @note HSE state can not be changed if it is used directly or through the + * PLL as system clock. In this case, you have to select another source + * of the system clock then change the HSE state (ex. disable it). + * @note The HSE is stopped by hardware when entering STOP and STANDBY modes. + * @note This function reset the CSSON bit, so if the clock security system(CSS) + * was previously enabled you have to enable it again after calling this + * function. + * @param __STATE__ specifies the new state of the HSE. + * This parameter can be one of the following values: + * @arg @ref RCC_HSE_OFF turn OFF the HSE oscillator, HSERDY flag goes low after + * 6 HSE oscillator clock cycles. + * @arg @ref RCC_HSE_ON turn ON the HSE oscillator + * @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock + */ +#define __HAL_RCC_HSE_CONFIG(__STATE__) \ + do{ \ + if ((__STATE__) == RCC_HSE_ON) \ + { \ + SET_BIT(RCC->CR, RCC_CR_HSEON); \ + } \ + else if ((__STATE__) == RCC_HSE_OFF) \ + { \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \ + } \ + else if ((__STATE__) == RCC_HSE_BYPASS) \ + { \ + SET_BIT(RCC->CR, RCC_CR_HSEBYP); \ + SET_BIT(RCC->CR, RCC_CR_HSEON); \ + } \ + else \ + { \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \ + } \ + }while(0U) + +/** + * @} + */ + +/** @defgroup RCC_LSE_Configuration LSE Configuration + * @{ + */ + +/** + * @brief Macro to configure the External Low Speed oscillator (LSE). + * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro. + * @note As the LSE is in the Backup domain and write access is denied to + * this domain after reset, you have to enable write access using + * @ref HAL_PWR_EnableBkUpAccess() function before to configure the LSE + * (to be done once after reset). + * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application + * software should wait on LSERDY flag to be set indicating that LSE clock + * is stable and can be used to clock the RTC. + * @param __STATE__ specifies the new state of the LSE. + * This parameter can be one of the following values: + * @arg @ref RCC_LSE_OFF turn OFF the LSE oscillator, LSERDY flag goes low after + * 6 LSE oscillator clock cycles. + * @arg @ref RCC_LSE_ON turn ON the LSE oscillator. + * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock. + */ +#define __HAL_RCC_LSE_CONFIG(__STATE__) \ + do{ \ + if ((__STATE__) == RCC_LSE_ON) \ + { \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + } \ + else if ((__STATE__) == RCC_LSE_OFF) \ + { \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ + } \ + else if ((__STATE__) == RCC_LSE_BYPASS) \ + { \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + } \ + else \ + { \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ + } \ + }while(0U) + +/** + * @} + */ + +/** @defgroup RCC_PLL_Configuration PLL Configuration + * @{ + */ + +/** @brief Macro to enable the main PLL. + * @note After enabling the main PLL, the application software should wait on + * PLLRDY flag to be set indicating that PLL clock is stable and can + * be used as system clock source. + * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLL_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = ENABLE) + +/** @brief Macro to disable the main PLL. + * @note The main PLL can not be disabled if it is used as system clock source + */ +#define __HAL_RCC_PLL_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = DISABLE) + +/** @brief Macro to configure the main PLL clock source and multiplication factors. + * @note This function must be used only when the main PLL is disabled. + * + * @param __RCC_PLLSOURCE__ specifies the PLL entry clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL clock entry + * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry + * @param __PLLMUL__ specifies the multiplication factor for PLL VCO output clock + * This parameter can be one of the following values: + * @arg @ref RCC_PLL_MUL4 PLLVCO = PLL clock entry x 4 + * @arg @ref RCC_PLL_MUL6 PLLVCO = PLL clock entry x 6 + @if STM32F105xC + * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5 + @elseif STM32F107xC + * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5 + @else + * @arg @ref RCC_PLL_MUL2 PLLVCO = PLL clock entry x 2 + * @arg @ref RCC_PLL_MUL3 PLLVCO = PLL clock entry x 3 + * @arg @ref RCC_PLL_MUL10 PLLVCO = PLL clock entry x 10 + * @arg @ref RCC_PLL_MUL11 PLLVCO = PLL clock entry x 11 + * @arg @ref RCC_PLL_MUL12 PLLVCO = PLL clock entry x 12 + * @arg @ref RCC_PLL_MUL13 PLLVCO = PLL clock entry x 13 + * @arg @ref RCC_PLL_MUL14 PLLVCO = PLL clock entry x 14 + * @arg @ref RCC_PLL_MUL15 PLLVCO = PLL clock entry x 15 + * @arg @ref RCC_PLL_MUL16 PLLVCO = PLL clock entry x 16 + @endif + * @arg @ref RCC_PLL_MUL8 PLLVCO = PLL clock entry x 8 + * @arg @ref RCC_PLL_MUL9 PLLVCO = PLL clock entry x 9 + * + */ +#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__)\ + MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMULL),((__RCC_PLLSOURCE__) | (__PLLMUL__) )) + +/** @brief Get oscillator clock selected as PLL input clock + * @retval The clock source used for PLL entry. The returned value can be one + * of the following: + * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL input clock + * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL input clock + */ +#define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC))) + +/** + * @} + */ + +/** @defgroup RCC_Get_Clock_source Get Clock source + * @{ + */ + +/** + * @brief Macro to configure the system clock source. + * @param __SYSCLKSOURCE__ specifies the system clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source. + * @arg @ref RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source. + * @arg @ref RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source. + */ +#define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__)) + +/** @brief Macro to get the clock source used as system clock. + * @retval The clock source used as system clock. The returned value can be one + * of the following: + * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock + * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock + * @arg @ref RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock + */ +#define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS))) + +/** + * @} + */ + +/** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config + * @{ + */ + +#if defined(RCC_CFGR_MCO_3) +/** @brief Macro to configure the MCO clock. + * @param __MCOCLKSOURCE__ specifies the MCO clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_PLL2CLK PLL2 clock selected by 2 selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_PLL3CLK_DIV2 PLL3 clock divided by 2 selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_EXT_HSE XT1 external 3-25 MHz oscillator clock selected (for Ethernet) as MCO clock + * @arg @ref RCC_MCO1SOURCE_PLL3CLK PLL3 clock selected (for Ethernet) as MCO clock + * @param __MCODIV__ specifies the MCO clock prescaler. + * This parameter can be one of the following values: + * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source + */ +#else +/** @brief Macro to configure the MCO clock. + * @param __MCOCLKSOURCE__ specifies the MCO clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock + * @param __MCODIV__ specifies the MCO clock prescaler. + * This parameter can be one of the following values: + * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source + */ +#endif + +#define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, (__MCOCLKSOURCE__)) + + +/** + * @} + */ + +/** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration +* @{ +*/ + +/** @brief Macro to configure the RTC clock (RTCCLK). + * @note As the RTC clock configuration bits are in the Backup domain and write + * access is denied to this domain after reset, you have to enable write + * access using the Power Backup Access macro before to configure + * the RTC clock source (to be done once after reset). + * @note Once the RTC clock is configured it can't be changed unless the + * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by + * a Power On Reset (POR). + * + * @param __RTC_CLKSOURCE__ specifies the RTC clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock + * @note If the LSE or LSI is used as RTC clock source, the RTC continues to + * work in STOP and STANDBY modes, and can be used as wakeup source. + * However, when the HSE clock is used as RTC clock source, the RTC + * cannot be used in STOP and STANDBY modes. + * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as + * RTC clock source). + */ +#define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__)) + +/** @brief Macro to get the RTC clock source. + * @retval The clock source can be one of the following values: + * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock + * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock + */ +#define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)) + +/** @brief Macro to enable the the RTC clock. + * @note These macros must be used only after the RTC clock source was selected. + */ +#define __HAL_RCC_RTC_ENABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = ENABLE) + +/** @brief Macro to disable the the RTC clock. + * @note These macros must be used only after the RTC clock source was selected. + */ +#define __HAL_RCC_RTC_DISABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = DISABLE) + +/** @brief Macro to force the Backup domain reset. + * @note This function resets the RTC peripheral (including the backup registers) + * and the RTC clock source selection in RCC_BDCR register. + */ +#define __HAL_RCC_BACKUPRESET_FORCE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = ENABLE) + +/** @brief Macros to release the Backup domain reset. + */ +#define __HAL_RCC_BACKUPRESET_RELEASE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = DISABLE) + +/** + * @} + */ + +/** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management + * @brief macros to manage the specified RCC Flags and interrupts. + * @{ + */ + +/** @brief Enable RCC interrupt. + * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled. + * This parameter can be any combination of the following values: + * @arg @ref RCC_IT_LSIRDY LSI ready interrupt + * @arg @ref RCC_IT_LSERDY LSE ready interrupt + * @arg @ref RCC_IT_HSIRDY HSI ready interrupt + * @arg @ref RCC_IT_HSERDY HSE ready interrupt + * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt + @if STM32F105xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @elsif STM32F107xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @endif + */ +#define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__)) + +/** @brief Disable RCC interrupt. + * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled. + * This parameter can be any combination of the following values: + * @arg @ref RCC_IT_LSIRDY LSI ready interrupt + * @arg @ref RCC_IT_LSERDY LSE ready interrupt + * @arg @ref RCC_IT_HSIRDY HSI ready interrupt + * @arg @ref RCC_IT_HSERDY HSE ready interrupt + * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt + @if STM32F105xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @elsif STM32F107xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @endif + */ +#define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= (uint8_t)(~(__INTERRUPT__))) + +/** @brief Clear the RCC's interrupt pending bits. + * @param __INTERRUPT__ specifies the interrupt pending bit to clear. + * This parameter can be any combination of the following values: + * @arg @ref RCC_IT_LSIRDY LSI ready interrupt. + * @arg @ref RCC_IT_LSERDY LSE ready interrupt. + * @arg @ref RCC_IT_HSIRDY HSI ready interrupt. + * @arg @ref RCC_IT_HSERDY HSE ready interrupt. + * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt. + @if STM32F105xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @elsif STM32F107xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @endif + * @arg @ref RCC_IT_CSS Clock Security System interrupt + */ +#define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__)) + +/** @brief Check the RCC's interrupt has occurred or not. + * @param __INTERRUPT__ specifies the RCC interrupt source to check. + * This parameter can be one of the following values: + * @arg @ref RCC_IT_LSIRDY LSI ready interrupt. + * @arg @ref RCC_IT_LSERDY LSE ready interrupt. + * @arg @ref RCC_IT_HSIRDY HSI ready interrupt. + * @arg @ref RCC_IT_HSERDY HSE ready interrupt. + * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt. + @if STM32F105xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @elsif STM32F107xx + * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. + * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. + @endif + * @arg @ref RCC_IT_CSS Clock Security System interrupt + * @retval The new state of __INTERRUPT__ (TRUE or FALSE). + */ +#define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__)) + +/** @brief Set RMVF bit to clear the reset flags. + * The reset flags are RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, + * RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST + */ +#define __HAL_RCC_CLEAR_RESET_FLAGS() (*(__IO uint32_t *)RCC_CSR_RMVF_BB = ENABLE) + +/** @brief Check RCC flag is set or not. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready. + * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready. + * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready. + @if STM32F105xx + * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready. + * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready. + @elsif STM32F107xx + * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready. + * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready. + @endif + * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready. + * @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready. + * @arg @ref RCC_FLAG_PINRST Pin reset. + * @arg @ref RCC_FLAG_PORRST POR/PDR reset. + * @arg @ref RCC_FLAG_SFTRST Software reset. + * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset. + * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset. + * @arg @ref RCC_FLAG_LPWRRST Low Power reset. + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5U) == CR_REG_INDEX)? RCC->CR : \ + ((((__FLAG__) >> 5U) == BDCR_REG_INDEX)? RCC->BDCR : \ + RCC->CSR)) & (1U << ((__FLAG__) & RCC_FLAG_MASK))) + +/** + * @} + */ + +/** + * @} + */ + +/* Include RCC HAL Extension module */ +#include "stm32f1xx_hal_rcc_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup RCC_Exported_Functions + * @{ + */ + +/** @addtogroup RCC_Exported_Functions_Group1 + * @{ + */ + +/* Initialization and de-initialization functions ******************************/ +HAL_StatusTypeDef HAL_RCC_DeInit(void); +HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct); +HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency); + +/** + * @} + */ + +/** @addtogroup RCC_Exported_Functions_Group2 + * @{ + */ + +/* Peripheral Control functions ************************************************/ +void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv); +void HAL_RCC_EnableCSS(void); +void HAL_RCC_DisableCSS(void); +uint32_t HAL_RCC_GetSysClockFreq(void); +uint32_t HAL_RCC_GetHCLKFreq(void); +uint32_t HAL_RCC_GetPCLK1Freq(void); +uint32_t HAL_RCC_GetPCLK2Freq(void); +void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct); +void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency); + +/* CSS NMI IRQ handler */ +void HAL_RCC_NMI_IRQHandler(void); + +/* User Callbacks in non blocking mode (IT mode) */ +void HAL_RCC_CSSCallback(void); + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup RCC_Private_Constants + * @{ + */ + +/** @defgroup RCC_Timeout RCC Timeout + * @{ + */ + +/* Disable Backup domain write protection state change timeout */ +#define RCC_DBP_TIMEOUT_VALUE 100U /* 100 ms */ +/* LSE state change timeout */ +#define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT +#define CLOCKSWITCH_TIMEOUT_VALUE 5000 /* 5 s */ +#define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT +#define HSI_TIMEOUT_VALUE 2U /* 2 ms (minimum Tick + 1) */ +#define LSI_TIMEOUT_VALUE 2U /* 2 ms (minimum Tick + 1) */ +#define PLL_TIMEOUT_VALUE 2U /* 2 ms (minimum Tick + 1) */ + +/** + * @} + */ + +/** @defgroup RCC_Register_Offset Register offsets + * @{ + */ +#define RCC_OFFSET (RCC_BASE - PERIPH_BASE) +#define RCC_CR_OFFSET 0x00U +#define RCC_CFGR_OFFSET 0x04U +#define RCC_CIR_OFFSET 0x08U +#define RCC_BDCR_OFFSET 0x20U +#define RCC_CSR_OFFSET 0x24U + +/** + * @} + */ + +/** @defgroup RCC_BitAddress_AliasRegion BitAddress AliasRegion + * @brief RCC registers bit address in the alias region + * @{ + */ +#define RCC_CR_OFFSET_BB (RCC_OFFSET + RCC_CR_OFFSET) +#define RCC_CFGR_OFFSET_BB (RCC_OFFSET + RCC_CFGR_OFFSET) +#define RCC_CIR_OFFSET_BB (RCC_OFFSET + RCC_CIR_OFFSET) +#define RCC_BDCR_OFFSET_BB (RCC_OFFSET + RCC_BDCR_OFFSET) +#define RCC_CSR_OFFSET_BB (RCC_OFFSET + RCC_CSR_OFFSET) + +/* --- CR Register ---*/ +/* Alias word address of HSION bit */ +#define RCC_HSION_BIT_NUMBER RCC_CR_HSION_Pos +#define RCC_CR_HSION_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_HSION_BIT_NUMBER * 4U))) +/* Alias word address of HSEON bit */ +#define RCC_HSEON_BIT_NUMBER RCC_CR_HSEON_Pos +#define RCC_CR_HSEON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_HSEON_BIT_NUMBER * 4U))) +/* Alias word address of CSSON bit */ +#define RCC_CSSON_BIT_NUMBER RCC_CR_CSSON_Pos +#define RCC_CR_CSSON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_CSSON_BIT_NUMBER * 4U))) +/* Alias word address of PLLON bit */ +#define RCC_PLLON_BIT_NUMBER RCC_CR_PLLON_Pos +#define RCC_CR_PLLON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_PLLON_BIT_NUMBER * 4U))) + +/* --- CSR Register ---*/ +/* Alias word address of LSION bit */ +#define RCC_LSION_BIT_NUMBER RCC_CSR_LSION_Pos +#define RCC_CSR_LSION_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_LSION_BIT_NUMBER * 4U))) + +/* Alias word address of RMVF bit */ +#define RCC_RMVF_BIT_NUMBER RCC_CSR_RMVF_Pos +#define RCC_CSR_RMVF_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_RMVF_BIT_NUMBER * 4U))) + +/* --- BDCR Registers ---*/ +/* Alias word address of LSEON bit */ +#define RCC_LSEON_BIT_NUMBER RCC_BDCR_LSEON_Pos +#define RCC_BDCR_LSEON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32U) + (RCC_LSEON_BIT_NUMBER * 4U))) + +/* Alias word address of LSEON bit */ +#define RCC_LSEBYP_BIT_NUMBER RCC_BDCR_LSEBYP_Pos +#define RCC_BDCR_LSEBYP_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32U) + (RCC_LSEBYP_BIT_NUMBER * 4U))) + +/* Alias word address of RTCEN bit */ +#define RCC_RTCEN_BIT_NUMBER RCC_BDCR_RTCEN_Pos +#define RCC_BDCR_RTCEN_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32U) + (RCC_RTCEN_BIT_NUMBER * 4U))) + +/* Alias word address of BDRST bit */ +#define RCC_BDRST_BIT_NUMBER RCC_BDCR_BDRST_Pos +#define RCC_BDCR_BDRST_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32U) + (RCC_BDRST_BIT_NUMBER * 4U))) + +/** + * @} + */ + +/* CR register byte 2 (Bits[23:16]) base address */ +#define RCC_CR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CR_OFFSET + 0x02U)) + +/* CIR register byte 1 (Bits[15:8]) base address */ +#define RCC_CIR_BYTE1_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x01U)) + +/* CIR register byte 2 (Bits[23:16]) base address */ +#define RCC_CIR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x02U)) + +/* Defines used for Flags */ +#define CR_REG_INDEX ((uint8_t)1) +#define BDCR_REG_INDEX ((uint8_t)2) +#define CSR_REG_INDEX ((uint8_t)3) + +#define RCC_FLAG_MASK ((uint8_t)0x1F) + +/** + * @} + */ + +/** @addtogroup RCC_Private_Macros + * @{ + */ +/** @defgroup RCC_Alias_For_Legacy Alias define maintained for legacy + * @{ + */ +#define __HAL_RCC_SYSCFG_CLK_DISABLE __HAL_RCC_AFIO_CLK_DISABLE +#define __HAL_RCC_SYSCFG_CLK_ENABLE __HAL_RCC_AFIO_CLK_ENABLE +#define __HAL_RCC_SYSCFG_FORCE_RESET __HAL_RCC_AFIO_FORCE_RESET +#define __HAL_RCC_SYSCFG_RELEASE_RESET __HAL_RCC_AFIO_RELEASE_RESET +/** + * @} + */ + +#define IS_RCC_PLLSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLSOURCE_HSI_DIV2) || \ + ((__SOURCE__) == RCC_PLLSOURCE_HSE)) +#define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \ + (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \ + (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \ + (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \ + (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE)) +#define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \ + ((__HSE__) == RCC_HSE_BYPASS)) +#define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \ + ((__LSE__) == RCC_LSE_BYPASS)) +#define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON)) +#define IS_RCC_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0x1FU) +#define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON)) +#define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) || ((__PLL__) == RCC_PLL_OFF) || \ + ((__PLL__) == RCC_PLL_ON)) + +#define IS_RCC_CLOCKTYPE(CLK) ((((CLK) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK) || \ + (((CLK) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) || \ + (((CLK) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) || \ + (((CLK) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2)) +#define IS_RCC_SYSCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_HSI) || \ + ((__SOURCE__) == RCC_SYSCLKSOURCE_HSE) || \ + ((__SOURCE__) == RCC_SYSCLKSOURCE_PLLCLK)) +#define IS_RCC_SYSCLKSOURCE_STATUS(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_HSI) || \ + ((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_HSE) || \ + ((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_PLLCLK)) +#define IS_RCC_HCLK(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || \ + ((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV8) || \ + ((__HCLK__) == RCC_SYSCLK_DIV16) || ((__HCLK__) == RCC_SYSCLK_DIV64) || \ + ((__HCLK__) == RCC_SYSCLK_DIV128) || ((__HCLK__) == RCC_SYSCLK_DIV256) || \ + ((__HCLK__) == RCC_SYSCLK_DIV512)) +#define IS_RCC_PCLK(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \ + ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \ + ((__PCLK__) == RCC_HCLK_DIV16)) +#define IS_RCC_MCO(__MCO__) ((__MCO__) == RCC_MCO) +#define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1)) +#define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \ + ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV128)) + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_RCC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h new file mode 100644 index 0000000..822ca9b --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h @@ -0,0 +1,1908 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_rcc_ex.h + * @author MCD Application Team + * @brief Header file of RCC HAL Extension module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_HAL_RCC_EX_H +#define __STM32F1xx_HAL_RCC_EX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup RCCEx + * @{ + */ + +/** @addtogroup RCCEx_Private_Constants + * @{ + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + +/* Alias word address of PLLI2SON bit */ +#define PLLI2SON_BITNUMBER RCC_CR_PLL3ON_Pos +#define RCC_CR_PLLI2SON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLLI2SON_BITNUMBER * 4U))) +/* Alias word address of PLL2ON bit */ +#define PLL2ON_BITNUMBER RCC_CR_PLL2ON_Pos +#define RCC_CR_PLL2ON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLL2ON_BITNUMBER * 4U))) + +#define PLLI2S_TIMEOUT_VALUE 100U /* 100 ms */ +#define PLL2_TIMEOUT_VALUE 100U /* 100 ms */ + +#endif /* STM32F105xC || STM32F107xC */ + + +#define CR_REG_INDEX ((uint8_t)1) + +/** + * @} + */ + +/** @addtogroup RCCEx_Private_Macros + * @{ + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define IS_RCC_PREDIV1_SOURCE(__SOURCE__) (((__SOURCE__) == RCC_PREDIV1_SOURCE_HSE) || \ + ((__SOURCE__) == RCC_PREDIV1_SOURCE_PLL2)) +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ + || defined(STM32F100xE) +#define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV3) || ((__DIV__) == RCC_HSE_PREDIV_DIV4) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV5) || ((__DIV__) == RCC_HSE_PREDIV_DIV6) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV7) || ((__DIV__) == RCC_HSE_PREDIV_DIV8) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV9) || ((__DIV__) == RCC_HSE_PREDIV_DIV10) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV11) || ((__DIV__) == RCC_HSE_PREDIV_DIV12) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV13) || ((__DIV__) == RCC_HSE_PREDIV_DIV14) || \ + ((__DIV__) == RCC_HSE_PREDIV_DIV15) || ((__DIV__) == RCC_HSE_PREDIV_DIV16)) + +#else +#define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2)) +#endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \ + ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \ + ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \ + ((__MUL__) == RCC_PLL_MUL6_5)) + +#define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_HSI) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_PLL2CLK) || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK_DIV2) || ((__SOURCE__) == RCC_MCO1SOURCE_EXT_HSE) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK)) + +#else +#define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL2) || ((__MUL__) == RCC_PLL_MUL3) || \ + ((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \ + ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \ + ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \ + ((__MUL__) == RCC_PLL_MUL10) || ((__MUL__) == RCC_PLL_MUL11) || \ + ((__MUL__) == RCC_PLL_MUL12) || ((__MUL__) == RCC_PLL_MUL13) || \ + ((__MUL__) == RCC_PLL_MUL14) || ((__MUL__) == RCC_PLL_MUL15) || \ + ((__MUL__) == RCC_PLL_MUL16)) + +#define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_HSI) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) \ + || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK)) + +#endif /* STM32F105xC || STM32F107xC*/ + +#define IS_RCC_ADCPLLCLK_DIV(__ADCCLK__) (((__ADCCLK__) == RCC_ADCPCLK2_DIV2) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV4) || \ + ((__ADCCLK__) == RCC_ADCPCLK2_DIV6) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV8)) + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define IS_RCC_I2S2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S2CLKSOURCE_PLLI2S_VCO)) + +#define IS_RCC_I2S3CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S3CLKSOURCE_PLLI2S_VCO)) + +#define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV2) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV3)) + +#define IS_RCC_PLLI2S_MUL(__MUL__) (((__MUL__) == RCC_PLLI2S_MUL8) || ((__MUL__) == RCC_PLLI2S_MUL9) || \ + ((__MUL__) == RCC_PLLI2S_MUL10) || ((__MUL__) == RCC_PLLI2S_MUL11) || \ + ((__MUL__) == RCC_PLLI2S_MUL12) || ((__MUL__) == RCC_PLLI2S_MUL13) || \ + ((__MUL__) == RCC_PLLI2S_MUL14) || ((__MUL__) == RCC_PLLI2S_MUL16) || \ + ((__MUL__) == RCC_PLLI2S_MUL20)) + +#define IS_RCC_HSE_PREDIV2(__DIV__) (((__DIV__) == RCC_HSE_PREDIV2_DIV1) || ((__DIV__) == RCC_HSE_PREDIV2_DIV2) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV3) || ((__DIV__) == RCC_HSE_PREDIV2_DIV4) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV5) || ((__DIV__) == RCC_HSE_PREDIV2_DIV6) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV7) || ((__DIV__) == RCC_HSE_PREDIV2_DIV8) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV9) || ((__DIV__) == RCC_HSE_PREDIV2_DIV10) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV11) || ((__DIV__) == RCC_HSE_PREDIV2_DIV12) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV13) || ((__DIV__) == RCC_HSE_PREDIV2_DIV14) || \ + ((__DIV__) == RCC_HSE_PREDIV2_DIV15) || ((__DIV__) == RCC_HSE_PREDIV2_DIV16)) + +#define IS_RCC_PLL2(__PLL__) (((__PLL__) == RCC_PLL2_NONE) || ((__PLL__) == RCC_PLL2_OFF) || \ + ((__PLL__) == RCC_PLL2_ON)) + +#define IS_RCC_PLL2_MUL(__MUL__) (((__MUL__) == RCC_PLL2_MUL8) || ((__MUL__) == RCC_PLL2_MUL9) || \ + ((__MUL__) == RCC_PLL2_MUL10) || ((__MUL__) == RCC_PLL2_MUL11) || \ + ((__MUL__) == RCC_PLL2_MUL12) || ((__MUL__) == RCC_PLL2_MUL13) || \ + ((__MUL__) == RCC_PLL2_MUL14) || ((__MUL__) == RCC_PLL2_MUL16) || \ + ((__MUL__) == RCC_PLL2_MUL20)) + +#define IS_RCC_PERIPHCLOCK(__SELECTION__) \ + ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \ + (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \ + (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) + +#elif defined(STM32F103xE) || defined(STM32F103xG) + +#define IS_RCC_I2S2CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK) + +#define IS_RCC_I2S3CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK) + +#define IS_RCC_PERIPHCLOCK(__SELECTION__) \ + ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \ + (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \ + (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) + + +#elif defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) + +#define IS_RCC_PERIPHCLOCK(__SELECTION__) \ + ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) + +#else + +#define IS_RCC_PERIPHCLOCK(__SELECTION__) \ + ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ + (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC)) + +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) + +#define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV1_5)) + +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + +/** + * @} + */ + +/* Exported types ------------------------------------------------------------*/ + +/** @defgroup RCCEx_Exported_Types RCCEx Exported Types + * @{ + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** + * @brief RCC PLL2 configuration structure definition + */ +typedef struct +{ + uint32_t PLL2State; /*!< The new state of the PLL2. + This parameter can be a value of @ref RCCEx_PLL2_Config */ + + uint32_t PLL2MUL; /*!< PLL2MUL: Multiplication factor for PLL2 VCO input clock + This parameter must be a value of @ref RCCEx_PLL2_Multiplication_Factor*/ + +#if defined(STM32F105xC) || defined(STM32F107xC) + uint32_t HSEPrediv2Value; /*!< The Prediv2 factor value. + This parameter can be a value of @ref RCCEx_Prediv2_Factor */ + +#endif /* STM32F105xC || STM32F107xC */ +} RCC_PLL2InitTypeDef; + +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @brief RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition + */ +typedef struct +{ + uint32_t OscillatorType; /*!< The oscillators to be configured. + This parameter can be a value of @ref RCC_Oscillator_Type */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + uint32_t Prediv1Source; /*!< The Prediv1 source value. + This parameter can be a value of @ref RCCEx_Prediv1_Source */ +#endif /* STM32F105xC || STM32F107xC */ + + uint32_t HSEState; /*!< The new state of the HSE. + This parameter can be a value of @ref RCC_HSE_Config */ + + uint32_t HSEPredivValue; /*!< The Prediv1 factor value (named PREDIV1 or PLLXTPRE in RM) + This parameter can be a value of @ref RCCEx_Prediv1_Factor */ + + uint32_t LSEState; /*!< The new state of the LSE. + This parameter can be a value of @ref RCC_LSE_Config */ + + uint32_t HSIState; /*!< The new state of the HSI. + This parameter can be a value of @ref RCC_HSI_Config */ + + uint32_t HSICalibrationValue; /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT). + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */ + + uint32_t LSIState; /*!< The new state of the LSI. + This parameter can be a value of @ref RCC_LSI_Config */ + + RCC_PLLInitTypeDef PLL; /*!< PLL structure parameters */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + RCC_PLL2InitTypeDef PLL2; /*!< PLL2 structure parameters */ +#endif /* STM32F105xC || STM32F107xC */ +} RCC_OscInitTypeDef; + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** + * @brief RCC PLLI2S configuration structure definition + */ +typedef struct +{ + uint32_t PLLI2SMUL; /*!< PLLI2SMUL: Multiplication factor for PLLI2S VCO input clock + This parameter must be a value of @ref RCCEx_PLLI2S_Multiplication_Factor*/ + +#if defined(STM32F105xC) || defined(STM32F107xC) + uint32_t HSEPrediv2Value; /*!< The Prediv2 factor value. + This parameter can be a value of @ref RCCEx_Prediv2_Factor */ + +#endif /* STM32F105xC || STM32F107xC */ +} RCC_PLLI2SInitTypeDef; +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @brief RCC extended clocks structure definition + */ +typedef struct +{ + uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. + This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ + + uint32_t RTCClockSelection; /*!< specifies the RTC clock source. + This parameter can be a value of @ref RCC_RTC_Clock_Source */ + + uint32_t AdcClockSelection; /*!< ADC clock source + This parameter can be a value of @ref RCCEx_ADC_Prescaler */ + +#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ + || defined(STM32F107xC) + uint32_t I2s2ClockSelection; /*!< I2S2 clock source + This parameter can be a value of @ref RCCEx_I2S2_Clock_Source */ + + uint32_t I2s3ClockSelection; /*!< I2S3 clock source + This parameter can be a value of @ref RCCEx_I2S3_Clock_Source */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters + This parameter will be used only when PLLI2S is selected as Clock Source I2S2 or I2S3 */ + +#endif /* STM32F105xC || STM32F107xC */ +#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) + uint32_t UsbClockSelection; /*!< USB clock source + This parameter can be a value of @ref RCCEx_USB_Prescaler */ + +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ +} RCC_PeriphCLKInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants + * @{ + */ + +/** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection + * @{ + */ +#define RCC_PERIPHCLK_RTC 0x00000001U +#define RCC_PERIPHCLK_ADC 0x00000002U +#if defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_PERIPHCLK_I2S2 0x00000004U +#define RCC_PERIPHCLK_I2S3 0x00000008U +#endif /* STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_PERIPHCLK_USB 0x00000010U +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** @defgroup RCCEx_ADC_Prescaler ADC Prescaler + * @{ + */ +#define RCC_ADCPCLK2_DIV2 RCC_CFGR_ADCPRE_DIV2 +#define RCC_ADCPCLK2_DIV4 RCC_CFGR_ADCPRE_DIV4 +#define RCC_ADCPCLK2_DIV6 RCC_CFGR_ADCPRE_DIV6 +#define RCC_ADCPCLK2_DIV8 RCC_CFGR_ADCPRE_DIV8 + +/** + * @} + */ + +#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ + || defined(STM32F107xC) +/** @defgroup RCCEx_I2S2_Clock_Source I2S2 Clock Source + * @{ + */ +#define RCC_I2S2CLKSOURCE_SYSCLK 0x00000000U +#if defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_I2S2CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S2SRC +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** @defgroup RCCEx_I2S3_Clock_Source I2S3 Clock Source + * @{ + */ +#define RCC_I2S3CLKSOURCE_SYSCLK 0x00000000U +#if defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_I2S3CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S3SRC +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) + +/** @defgroup RCCEx_USB_Prescaler USB Prescaler + * @{ + */ +#define RCC_USBCLKSOURCE_PLL RCC_CFGR_USBPRE +#define RCC_USBCLKSOURCE_PLL_DIV1_5 0x00000000U + +/** + * @} + */ + +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_USB_Prescaler USB Prescaler + * @{ + */ +#define RCC_USBCLKSOURCE_PLL_DIV2 RCC_CFGR_OTGFSPRE +#define RCC_USBCLKSOURCE_PLL_DIV3 0x00000000U + +/** + * @} + */ + +/** @defgroup RCCEx_PLLI2S_Multiplication_Factor PLLI2S Multiplication Factor + * @{ + */ + +#define RCC_PLLI2S_MUL8 RCC_CFGR2_PLL3MUL8 /*!< PLLI2S input clock * 8 */ +#define RCC_PLLI2S_MUL9 RCC_CFGR2_PLL3MUL9 /*!< PLLI2S input clock * 9 */ +#define RCC_PLLI2S_MUL10 RCC_CFGR2_PLL3MUL10 /*!< PLLI2S input clock * 10 */ +#define RCC_PLLI2S_MUL11 RCC_CFGR2_PLL3MUL11 /*!< PLLI2S input clock * 11 */ +#define RCC_PLLI2S_MUL12 RCC_CFGR2_PLL3MUL12 /*!< PLLI2S input clock * 12 */ +#define RCC_PLLI2S_MUL13 RCC_CFGR2_PLL3MUL13 /*!< PLLI2S input clock * 13 */ +#define RCC_PLLI2S_MUL14 RCC_CFGR2_PLL3MUL14 /*!< PLLI2S input clock * 14 */ +#define RCC_PLLI2S_MUL16 RCC_CFGR2_PLL3MUL16 /*!< PLLI2S input clock * 16 */ +#define RCC_PLLI2S_MUL20 RCC_CFGR2_PLL3MUL20 /*!< PLLI2S input clock * 20 */ + +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_Prediv1_Source Prediv1 Source + * @{ + */ + +#define RCC_PREDIV1_SOURCE_HSE RCC_CFGR2_PREDIV1SRC_HSE +#define RCC_PREDIV1_SOURCE_PLL2 RCC_CFGR2_PREDIV1SRC_PLL2 + +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC */ + +/** @defgroup RCCEx_Prediv1_Factor HSE Prediv1 Factor + * @{ + */ + +#define RCC_HSE_PREDIV_DIV1 0x00000000U + +#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ + || defined(STM32F100xE) +#define RCC_HSE_PREDIV_DIV2 RCC_CFGR2_PREDIV1_DIV2 +#define RCC_HSE_PREDIV_DIV3 RCC_CFGR2_PREDIV1_DIV3 +#define RCC_HSE_PREDIV_DIV4 RCC_CFGR2_PREDIV1_DIV4 +#define RCC_HSE_PREDIV_DIV5 RCC_CFGR2_PREDIV1_DIV5 +#define RCC_HSE_PREDIV_DIV6 RCC_CFGR2_PREDIV1_DIV6 +#define RCC_HSE_PREDIV_DIV7 RCC_CFGR2_PREDIV1_DIV7 +#define RCC_HSE_PREDIV_DIV8 RCC_CFGR2_PREDIV1_DIV8 +#define RCC_HSE_PREDIV_DIV9 RCC_CFGR2_PREDIV1_DIV9 +#define RCC_HSE_PREDIV_DIV10 RCC_CFGR2_PREDIV1_DIV10 +#define RCC_HSE_PREDIV_DIV11 RCC_CFGR2_PREDIV1_DIV11 +#define RCC_HSE_PREDIV_DIV12 RCC_CFGR2_PREDIV1_DIV12 +#define RCC_HSE_PREDIV_DIV13 RCC_CFGR2_PREDIV1_DIV13 +#define RCC_HSE_PREDIV_DIV14 RCC_CFGR2_PREDIV1_DIV14 +#define RCC_HSE_PREDIV_DIV15 RCC_CFGR2_PREDIV1_DIV15 +#define RCC_HSE_PREDIV_DIV16 RCC_CFGR2_PREDIV1_DIV16 +#else +#define RCC_HSE_PREDIV_DIV2 RCC_CFGR_PLLXTPRE +#endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_Prediv2_Factor HSE Prediv2 Factor + * @{ + */ + +#define RCC_HSE_PREDIV2_DIV1 RCC_CFGR2_PREDIV2_DIV1 /*!< PREDIV2 input clock not divided */ +#define RCC_HSE_PREDIV2_DIV2 RCC_CFGR2_PREDIV2_DIV2 /*!< PREDIV2 input clock divided by 2 */ +#define RCC_HSE_PREDIV2_DIV3 RCC_CFGR2_PREDIV2_DIV3 /*!< PREDIV2 input clock divided by 3 */ +#define RCC_HSE_PREDIV2_DIV4 RCC_CFGR2_PREDIV2_DIV4 /*!< PREDIV2 input clock divided by 4 */ +#define RCC_HSE_PREDIV2_DIV5 RCC_CFGR2_PREDIV2_DIV5 /*!< PREDIV2 input clock divided by 5 */ +#define RCC_HSE_PREDIV2_DIV6 RCC_CFGR2_PREDIV2_DIV6 /*!< PREDIV2 input clock divided by 6 */ +#define RCC_HSE_PREDIV2_DIV7 RCC_CFGR2_PREDIV2_DIV7 /*!< PREDIV2 input clock divided by 7 */ +#define RCC_HSE_PREDIV2_DIV8 RCC_CFGR2_PREDIV2_DIV8 /*!< PREDIV2 input clock divided by 8 */ +#define RCC_HSE_PREDIV2_DIV9 RCC_CFGR2_PREDIV2_DIV9 /*!< PREDIV2 input clock divided by 9 */ +#define RCC_HSE_PREDIV2_DIV10 RCC_CFGR2_PREDIV2_DIV10 /*!< PREDIV2 input clock divided by 10 */ +#define RCC_HSE_PREDIV2_DIV11 RCC_CFGR2_PREDIV2_DIV11 /*!< PREDIV2 input clock divided by 11 */ +#define RCC_HSE_PREDIV2_DIV12 RCC_CFGR2_PREDIV2_DIV12 /*!< PREDIV2 input clock divided by 12 */ +#define RCC_HSE_PREDIV2_DIV13 RCC_CFGR2_PREDIV2_DIV13 /*!< PREDIV2 input clock divided by 13 */ +#define RCC_HSE_PREDIV2_DIV14 RCC_CFGR2_PREDIV2_DIV14 /*!< PREDIV2 input clock divided by 14 */ +#define RCC_HSE_PREDIV2_DIV15 RCC_CFGR2_PREDIV2_DIV15 /*!< PREDIV2 input clock divided by 15 */ +#define RCC_HSE_PREDIV2_DIV16 RCC_CFGR2_PREDIV2_DIV16 /*!< PREDIV2 input clock divided by 16 */ + +/** + * @} + */ + +/** @defgroup RCCEx_PLL2_Config PLL Config + * @{ + */ +#define RCC_PLL2_NONE 0x00000000U +#define RCC_PLL2_OFF 0x00000001U +#define RCC_PLL2_ON 0x00000002U + +/** + * @} + */ + +/** @defgroup RCCEx_PLL2_Multiplication_Factor PLL2 Multiplication Factor + * @{ + */ + +#define RCC_PLL2_MUL8 RCC_CFGR2_PLL2MUL8 /*!< PLL2 input clock * 8 */ +#define RCC_PLL2_MUL9 RCC_CFGR2_PLL2MUL9 /*!< PLL2 input clock * 9 */ +#define RCC_PLL2_MUL10 RCC_CFGR2_PLL2MUL10 /*!< PLL2 input clock * 10 */ +#define RCC_PLL2_MUL11 RCC_CFGR2_PLL2MUL11 /*!< PLL2 input clock * 11 */ +#define RCC_PLL2_MUL12 RCC_CFGR2_PLL2MUL12 /*!< PLL2 input clock * 12 */ +#define RCC_PLL2_MUL13 RCC_CFGR2_PLL2MUL13 /*!< PLL2 input clock * 13 */ +#define RCC_PLL2_MUL14 RCC_CFGR2_PLL2MUL14 /*!< PLL2 input clock * 14 */ +#define RCC_PLL2_MUL16 RCC_CFGR2_PLL2MUL16 /*!< PLL2 input clock * 16 */ +#define RCC_PLL2_MUL20 RCC_CFGR2_PLL2MUL20 /*!< PLL2 input clock * 20 */ + +/** + * @} + */ + +#endif /* STM32F105xC || STM32F107xC */ + +/** @defgroup RCCEx_PLL_Multiplication_Factor PLL Multiplication Factor + * @{ + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#else +#define RCC_PLL_MUL2 RCC_CFGR_PLLMULL2 +#define RCC_PLL_MUL3 RCC_CFGR_PLLMULL3 +#endif /* STM32F105xC || STM32F107xC */ +#define RCC_PLL_MUL4 RCC_CFGR_PLLMULL4 +#define RCC_PLL_MUL5 RCC_CFGR_PLLMULL5 +#define RCC_PLL_MUL6 RCC_CFGR_PLLMULL6 +#define RCC_PLL_MUL7 RCC_CFGR_PLLMULL7 +#define RCC_PLL_MUL8 RCC_CFGR_PLLMULL8 +#define RCC_PLL_MUL9 RCC_CFGR_PLLMULL9 +#if defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_PLL_MUL6_5 RCC_CFGR_PLLMULL6_5 +#else +#define RCC_PLL_MUL10 RCC_CFGR_PLLMULL10 +#define RCC_PLL_MUL11 RCC_CFGR_PLLMULL11 +#define RCC_PLL_MUL12 RCC_CFGR_PLLMULL12 +#define RCC_PLL_MUL13 RCC_CFGR_PLLMULL13 +#define RCC_PLL_MUL14 RCC_CFGR_PLLMULL14 +#define RCC_PLL_MUL15 RCC_CFGR_PLLMULL15 +#define RCC_PLL_MUL16 RCC_CFGR_PLLMULL16 +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** @defgroup RCCEx_MCO1_Clock_Source MCO1 Clock Source + * @{ + */ +#define RCC_MCO1SOURCE_NOCLOCK ((uint32_t)RCC_CFGR_MCO_NOCLOCK) +#define RCC_MCO1SOURCE_SYSCLK ((uint32_t)RCC_CFGR_MCO_SYSCLK) +#define RCC_MCO1SOURCE_HSI ((uint32_t)RCC_CFGR_MCO_HSI) +#define RCC_MCO1SOURCE_HSE ((uint32_t)RCC_CFGR_MCO_HSE) +#define RCC_MCO1SOURCE_PLLCLK ((uint32_t)RCC_CFGR_MCO_PLLCLK_DIV2) +#if defined(STM32F105xC) || defined(STM32F107xC) +#define RCC_MCO1SOURCE_PLL2CLK ((uint32_t)RCC_CFGR_MCO_PLL2CLK) +#define RCC_MCO1SOURCE_PLL3CLK_DIV2 ((uint32_t)RCC_CFGR_MCO_PLL3CLK_DIV2) +#define RCC_MCO1SOURCE_EXT_HSE ((uint32_t)RCC_CFGR_MCO_EXT_HSE) +#define RCC_MCO1SOURCE_PLL3CLK ((uint32_t)RCC_CFGR_MCO_PLL3CLK) +#endif /* STM32F105xC || STM32F107xC*/ +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_Interrupt RCCEx Interrupt + * @{ + */ +#define RCC_IT_PLL2RDY ((uint8_t)RCC_CIR_PLL2RDYF) +#define RCC_IT_PLLI2SRDY ((uint8_t)RCC_CIR_PLL3RDYF) +/** + * @} + */ + +/** @defgroup RCCEx_Flag RCCEx Flag + * Elements values convention: 0XXYYYYYb + * - YYYYY : Flag position in the register + * - XX : Register index + * - 01: CR register + * @{ + */ +/* Flags in the CR register */ +#define RCC_FLAG_PLL2RDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL2RDY_Pos)) +#define RCC_FLAG_PLLI2SRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL3RDY_Pos)) +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC*/ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros + * @{ + */ + +/** @defgroup RCCEx_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable + * @brief Enable or disable the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\ + || defined (STM32F100xE) +#define __HAL_RCC_DMA2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA2EN)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F105xC || STM32F107xC || STM32F100xE */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined (STM32F100xE) +#define __HAL_RCC_FSMC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FSMCEN)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F100xE */ + +#if defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_SDIO_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\ + UNUSED(tmpreg); \ + } while(0U) + + +#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SDIOEN)) +#endif /* STM32F103xE || STM32F103xG */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\ + UNUSED(tmpreg); \ + } while(0U) + + +#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_OTGFSEN)) +#endif /* STM32F105xC || STM32F107xC*/ + +#if defined(STM32F107xC) +#define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACEN)) +#define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACTXEN)) +#define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACRXEN)) + +/** + * @brief Enable ETHERNET clock. + */ +#define __HAL_RCC_ETH_CLK_ENABLE() do { \ + __HAL_RCC_ETHMAC_CLK_ENABLE(); \ + __HAL_RCC_ETHMACTX_CLK_ENABLE(); \ + __HAL_RCC_ETHMACRX_CLK_ENABLE(); \ + } while(0U) +/** + * @brief Disable ETHERNET clock. + */ +#define __HAL_RCC_ETH_CLK_DISABLE() do { \ + __HAL_RCC_ETHMACTX_CLK_DISABLE(); \ + __HAL_RCC_ETHMACRX_CLK_DISABLE(); \ + __HAL_RCC_ETHMAC_CLK_DISABLE(); \ + } while(0U) + +#endif /* STM32F107xC*/ + +/** + * @} + */ + +/** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the AHB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\ + || defined (STM32F100xE) +#define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) != RESET) +#define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) == RESET) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F105xC || STM32F107xC || STM32F100xE */ +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined (STM32F100xE) +#define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) != RESET) +#define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) == RESET) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F100xE */ +#if defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) != RESET) +#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) == RESET) +#endif /* STM32F103xE || STM32F103xG */ +#if defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) != RESET) +#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) == RESET) +#endif /* STM32F105xC || STM32F107xC*/ +#if defined(STM32F107xC) +#define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) != RESET) +#define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) == RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) != RESET) +#define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) == RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) != RESET) +#define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) == RESET) +#endif /* STM32F107xC*/ + +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Clock Enable Disable + * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ + || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) +#define __HAL_RCC_CAN1_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) +#endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + +#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ + || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SPI2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_USART3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_I2C2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) +#define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN)) +#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) +#define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN)) +#endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_USB_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_USB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USBEN)) +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN)) +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F100xB) || defined (STM32F100xE) +#define __HAL_RCC_TIM6_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM7_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_DAC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_CEC_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) +#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) +#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) +#define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN)) +#endif /* STM32F100xB || STM32F100xE */ + +#ifdef STM32F100xE +#define __HAL_RCC_TIM5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_SPI3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_UART4_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_UART5_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN)) +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) +#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) +#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) +#endif /* STM32F100xE */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_CAN2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM12_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM13_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM14_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) +#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) +#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) +#endif /* STM32F101xG || STM32F103xG*/ + +/** + * @} + */ + +/** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB1 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ + || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) +#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET) +#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) +#endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ +#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ + || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) +#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) +#define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET) +#define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET) +#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) +#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) +#define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET) +#define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET) +#endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_USB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) != RESET) +#define __HAL_RCC_USB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) == RESET) +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET) +#define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ +#if defined(STM32F100xB) || defined (STM32F100xE) +#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) +#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) +#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) +#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) +#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) +#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) +#define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET) +#define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET) +#endif /* STM32F100xB || STM32F100xE */ +#ifdef STM32F100xE +#define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET) +#define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) +#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) +#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) +#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) +#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) +#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) +#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) +#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) +#endif /* STM32F100xE */ +#if defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) +#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) +#endif /* STM32F105xC || STM32F107xC */ +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) +#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) +#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) +#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) +#endif /* STM32F101xG || STM32F103xG*/ + +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Clock Enable Disable + * @brief Enable or disable the High Speed APB (APB2) peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ + || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ + || defined(STM32F103xG) +#define __HAL_RCC_ADC2_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN)) +#endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ + +#if defined(STM32F100xB) || defined(STM32F100xE) +#define __HAL_RCC_TIM15_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM16_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM17_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM15_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM15EN)) +#define __HAL_RCC_TIM16_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM16EN)) +#define __HAL_RCC_TIM17_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM17EN)) +#endif /* STM32F100xB || STM32F100xE */ + +#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ + || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ + || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ + || defined(STM32F107xC) +#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPEEN)) +#endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ + +#if defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_TIM8_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_ADC3_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) +#define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN)) +#endif /* STM32F103xE || STM32F103xG */ + +#if defined(STM32F100xE) +#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN)) +#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN)) +#endif /* STM32F100xE */ + +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM9_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM10_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM11_CLK_ENABLE() do { \ + __IO uint32_t tmpreg; \ + SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ + /* Delay after an RCC peripheral clock enabling */ \ + tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ + UNUSED(tmpreg); \ + } while(0U) + +#define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN)) +#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) +#define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN)) +#endif /* STM32F101xG || STM32F103xG */ + +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status + * @brief Get the enable or disable status of the APB2 peripheral clock. + * @note After reset, the peripheral clock (used for registers read/write access) + * is disabled and the application software has to enable this clock before + * using it. + * @{ + */ + +#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ + || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ + || defined(STM32F103xG) +#define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET) +#define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET) +#endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ +#if defined(STM32F100xB) || defined(STM32F100xE) +#define __HAL_RCC_TIM15_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) != RESET) +#define __HAL_RCC_TIM15_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) == RESET) +#define __HAL_RCC_TIM16_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) != RESET) +#define __HAL_RCC_TIM16_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) == RESET) +#define __HAL_RCC_TIM17_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) != RESET) +#define __HAL_RCC_TIM17_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) == RESET) +#endif /* STM32F100xB || STM32F100xE */ +#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ + || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ + || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ + || defined(STM32F107xC) +#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) != RESET) +#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) == RESET) +#endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ +#if defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) +#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) +#define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET) +#define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET) +#endif /* STM32F103xE || STM32F103xG */ +#if defined(STM32F100xE) +#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET) +#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET) +#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET) +#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET) +#endif /* STM32F100xE */ +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET) +#define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET) +#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) +#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) +#define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET) +#define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET) +#endif /* STM32F101xG || STM32F103xG */ + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_Peripheral_Clock_Force_Release Peripheral Clock Force Release + * @brief Force or release AHB peripheral reset. + * @{ + */ +#define __HAL_RCC_AHB_FORCE_RESET() (RCC->AHBRSTR = 0xFFFFFFFFU) +#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_OTGFSRST)) +#if defined(STM32F107xC) +#define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_ETHMACRST)) +#endif /* STM32F107xC */ + +#define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00) +#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_OTGFSRST)) +#if defined(STM32F107xC) +#define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_ETHMACRST)) +#endif /* STM32F107xC */ + +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC */ + +/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset + * @brief Force or release APB1 peripheral reset. + * @{ + */ + +#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ + || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) +#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) + +#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) +#endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + +#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ + || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST)) +#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST)) + +#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) +#define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST)) +#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) +#define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST)) +#endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_USB_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST)) +#define __HAL_RCC_USB_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USBRST)) +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) + +#define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F100xB) || defined (STM32F100xE) +#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST)) + +#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) +#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) +#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) +#define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST)) +#endif /* STM32F100xB || STM32F100xE */ + +#if defined (STM32F100xE) +#define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) + +#define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST)) +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) +#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) +#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) +#endif /* STM32F100xE */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) + +#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) + +#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) +#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) +#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) +#endif /* STM32F101xG || STM32F103xG */ + +/** + * @} + */ + +/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset + * @brief Force or release APB2 peripheral reset. + * @{ + */ + +#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ + || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ + || defined(STM32F103xG) +#define __HAL_RCC_ADC2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC2RST)) + +#define __HAL_RCC_ADC2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC2RST)) +#endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ + +#if defined(STM32F100xB) || defined(STM32F100xE) +#define __HAL_RCC_TIM15_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM15RST)) +#define __HAL_RCC_TIM16_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM16RST)) +#define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM17RST)) + +#define __HAL_RCC_TIM15_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM15RST)) +#define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM16RST)) +#define __HAL_RCC_TIM17_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM17RST)) +#endif /* STM32F100xB || STM32F100xE */ + +#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ + || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ + || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ + || defined(STM32F107xC) +#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPERST)) + +#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPERST)) +#endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ + +#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ + || defined(STM32F103xG) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST)) + +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST)) +#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ + +#if defined(STM32F103xE) || defined(STM32F103xG) +#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_ADC3_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC3RST)) + +#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) +#define __HAL_RCC_ADC3_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC3RST)) +#endif /* STM32F103xE || STM32F103xG */ + +#if defined(STM32F100xE) +#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST)) +#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST)) + +#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST)) +#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST)) +#endif /* STM32F100xE */ + +#if defined(STM32F101xG) || defined(STM32F103xG) +#define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST)) +#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST)) + +#define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST)) +#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) +#define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST)) +#endif /* STM32F101xG || STM32F103xG*/ + +/** + * @} + */ + +/** @defgroup RCCEx_HSE_Configuration HSE Configuration + * @{ + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ + || defined(STM32F100xE) +/** + * @brief Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL. + * @note Predivision factor can not be changed if PLL is used as system clock + * In this case, you have to select another source of the system clock, disable the PLL and + * then change the HSE predivision factor. + * @param __HSE_PREDIV_VALUE__ specifies the division value applied to HSE. + * This parameter must be a number between RCC_HSE_PREDIV_DIV1 and RCC_HSE_PREDIV_DIV16. + */ +#define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1, (uint32_t)(__HSE_PREDIV_VALUE__)) +#else +/** + * @brief Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL. + * @note Predivision factor can not be changed if PLL is used as system clock + * In this case, you have to select another source of the system clock, disable the PLL and + * then change the HSE predivision factor. + * @param __HSE_PREDIV_VALUE__ specifies the division value applied to HSE. + * This parameter must be a number between RCC_HSE_PREDIV_DIV1 and RCC_HSE_PREDIV_DIV2. + */ +#define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) \ + MODIFY_REG(RCC->CFGR,RCC_CFGR_PLLXTPRE, (uint32_t)(__HSE_PREDIV_VALUE__)) + +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ + || defined(STM32F100xE) +/** + * @brief Macro to get prediv1 factor for PLL. + */ +#define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1) + +#else +/** + * @brief Macro to get prediv1 factor for PLL. + */ +#define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR, RCC_CFGR_PLLXTPRE) + +#endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_PLLI2S_Configuration PLLI2S Configuration + * @{ + */ + +/** @brief Macros to enable the main PLLI2S. + * @note After enabling the main PLLI2S, the application software should wait on + * PLLI2SRDY flag to be set indicating that PLLI2S clock is stable and can + * be used as system clock source. + * @note The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE) + +/** @brief Macros to disable the main PLLI2S. + * @note The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE) + +/** @brief macros to configure the main PLLI2S multiplication factor. + * @note This function must be used only when the main PLLI2S is disabled. + * + * @param __PLLI2SMUL__ specifies the multiplication factor for PLLI2S VCO output clock + * This parameter can be one of the following values: + * @arg @ref RCC_PLLI2S_MUL8 PLLI2SVCO = PLLI2S clock entry x 8 + * @arg @ref RCC_PLLI2S_MUL9 PLLI2SVCO = PLLI2S clock entry x 9 + * @arg @ref RCC_PLLI2S_MUL10 PLLI2SVCO = PLLI2S clock entry x 10 + * @arg @ref RCC_PLLI2S_MUL11 PLLI2SVCO = PLLI2S clock entry x 11 + * @arg @ref RCC_PLLI2S_MUL12 PLLI2SVCO = PLLI2S clock entry x 12 + * @arg @ref RCC_PLLI2S_MUL13 PLLI2SVCO = PLLI2S clock entry x 13 + * @arg @ref RCC_PLLI2S_MUL14 PLLI2SVCO = PLLI2S clock entry x 14 + * @arg @ref RCC_PLLI2S_MUL16 PLLI2SVCO = PLLI2S clock entry x 16 + * @arg @ref RCC_PLLI2S_MUL20 PLLI2SVCO = PLLI2S clock entry x 20 + * + */ +#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SMUL__)\ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL3MUL,(__PLLI2SMUL__)) + +/** + * @} + */ + +#endif /* STM32F105xC || STM32F107xC */ + +/** @defgroup RCCEx_Peripheral_Configuration Peripheral Configuration + * @brief Macros to configure clock source of different peripherals. + * @{ + */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) +/** @brief Macro to configure the USB clock. + * @param __USBCLKSOURCE__ specifies the USB clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_USBCLKSOURCE_PLL PLL clock divided by 1 selected as USB clock + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV1_5 PLL clock divided by 1.5 selected as USB clock + */ +#define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_USBPRE, (uint32_t)(__USBCLKSOURCE__)) + +/** @brief Macro to get the USB clock (USBCLK). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_USBCLKSOURCE_PLL PLL clock divided by 1 selected as USB clock + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV1_5 PLL clock divided by 1.5 selected as USB clock + */ +#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_USBPRE))) + +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + +/** @brief Macro to configure the USB OTSclock. + * @param __USBCLKSOURCE__ specifies the USB clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV2 PLL clock divided by 2 selected as USB OTG FS clock + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV3 PLL clock divided by 3 selected as USB OTG FS clock + */ +#define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_OTGFSPRE, (uint32_t)(__USBCLKSOURCE__)) + +/** @brief Macro to get the USB clock (USBCLK). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV2 PLL clock divided by 2 selected as USB OTG FS clock + * @arg @ref RCC_USBCLKSOURCE_PLL_DIV3 PLL clock divided by 3 selected as USB OTG FS clock + */ +#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_OTGFSPRE))) + +#endif /* STM32F105xC || STM32F107xC */ + +/** @brief Macro to configure the ADCx clock (x=1 to 3 depending on devices). + * @param __ADCCLKSOURCE__ specifies the ADC clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_ADCPCLK2_DIV2 PCLK2 clock divided by 2 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV4 PCLK2 clock divided by 4 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV6 PCLK2 clock divided by 6 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV8 PCLK2 clock divided by 8 selected as ADC clock + */ +#define __HAL_RCC_ADC_CONFIG(__ADCCLKSOURCE__) \ + MODIFY_REG(RCC->CFGR, RCC_CFGR_ADCPRE, (uint32_t)(__ADCCLKSOURCE__)) + +/** @brief Macro to get the ADC clock (ADCxCLK, x=1 to 3 depending on devices). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_ADCPCLK2_DIV2 PCLK2 clock divided by 2 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV4 PCLK2 clock divided by 4 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV6 PCLK2 clock divided by 6 selected as ADC clock + * @arg @ref RCC_ADCPCLK2_DIV8 PCLK2 clock divided by 8 selected as ADC clock + */ +#define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_ADCPRE))) + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + +/** @addtogroup RCCEx_HSE_Configuration + * @{ + */ + +/** + * @brief Macro to configure the PLL2 & PLLI2S Predivision factor. + * @note Predivision factor can not be changed if PLL2 is used indirectly as system clock + * In this case, you have to select another source of the system clock, disable the PLL2 and PLLI2S and + * then change the PREDIV2 factor. + * @param __HSE_PREDIV2_VALUE__ specifies the PREDIV2 value applied to PLL2 & PLLI2S. + * This parameter must be a number between RCC_HSE_PREDIV2_DIV1 and RCC_HSE_PREDIV2_DIV16. + */ +#define __HAL_RCC_HSE_PREDIV2_CONFIG(__HSE_PREDIV2_VALUE__) \ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2, (uint32_t)(__HSE_PREDIV2_VALUE__)) + +/** + * @brief Macro to get prediv2 factor for PLL2 & PLL3. + */ +#define __HAL_RCC_HSE_GET_PREDIV2() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2) + +/** + * @} + */ + +/** @addtogroup RCCEx_PLLI2S_Configuration + * @{ + */ + +/** @brief Macros to enable the main PLL2. + * @note After enabling the main PLL2, the application software should wait on + * PLL2RDY flag to be set indicating that PLL2 clock is stable and can + * be used as system clock source. + * @note The main PLL2 is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLL2_ENABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = ENABLE) + +/** @brief Macros to disable the main PLL2. + * @note The main PLL2 can not be disabled if it is used indirectly as system clock source + * @note The main PLL2 is disabled by hardware when entering STOP and STANDBY modes. + */ +#define __HAL_RCC_PLL2_DISABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = DISABLE) + +/** @brief macros to configure the main PLL2 multiplication factor. + * @note This function must be used only when the main PLL2 is disabled. + * + * @param __PLL2MUL__ specifies the multiplication factor for PLL2 VCO output clock + * This parameter can be one of the following values: + * @arg @ref RCC_PLL2_MUL8 PLL2VCO = PLL2 clock entry x 8 + * @arg @ref RCC_PLL2_MUL9 PLL2VCO = PLL2 clock entry x 9 + * @arg @ref RCC_PLL2_MUL10 PLL2VCO = PLL2 clock entry x 10 + * @arg @ref RCC_PLL2_MUL11 PLL2VCO = PLL2 clock entry x 11 + * @arg @ref RCC_PLL2_MUL12 PLL2VCO = PLL2 clock entry x 12 + * @arg @ref RCC_PLL2_MUL13 PLL2VCO = PLL2 clock entry x 13 + * @arg @ref RCC_PLL2_MUL14 PLL2VCO = PLL2 clock entry x 14 + * @arg @ref RCC_PLL2_MUL16 PLL2VCO = PLL2 clock entry x 16 + * @arg @ref RCC_PLL2_MUL20 PLL2VCO = PLL2 clock entry x 20 + * + */ +#define __HAL_RCC_PLL2_CONFIG(__PLL2MUL__)\ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL2MUL,(__PLL2MUL__)) + +/** + * @} + */ + +/** @defgroup RCCEx_I2S_Configuration I2S Configuration + * @brief Macros to configure clock source of I2S peripherals. + * @{ + */ + +/** @brief Macro to configure the I2S2 clock. + * @param __I2S2CLKSOURCE__ specifies the I2S2 clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry + * @arg @ref RCC_I2S2CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry + */ +#define __HAL_RCC_I2S2_CONFIG(__I2S2CLKSOURCE__) \ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S2SRC, (uint32_t)(__I2S2CLKSOURCE__)) + +/** @brief Macro to get the I2S2 clock (I2S2CLK). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry + * @arg @ref RCC_I2S2CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry + */ +#define __HAL_RCC_GET_I2S2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S2SRC))) + +/** @brief Macro to configure the I2S3 clock. + * @param __I2S2CLKSOURCE__ specifies the I2S3 clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_I2S3CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry + * @arg @ref RCC_I2S3CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry + */ +#define __HAL_RCC_I2S3_CONFIG(__I2S2CLKSOURCE__) \ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S3SRC, (uint32_t)(__I2S2CLKSOURCE__)) + +/** @brief Macro to get the I2S3 clock (I2S3CLK). + * @retval The clock source can be one of the following values: + * @arg @ref RCC_I2S3CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry + * @arg @ref RCC_I2S3CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry + */ +#define __HAL_RCC_GET_I2S3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S3SRC))) + +/** + * @} + */ + +#endif /* STM32F105xC || STM32F107xC */ +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup RCCEx_Exported_Functions + * @{ + */ + +/** @addtogroup RCCEx_Exported_Functions_Group1 + * @{ + */ + +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk); + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @addtogroup RCCEx_Exported_Functions_Group2 + * @{ + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit); +HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void); + +/** + * @} + */ + +/** @addtogroup RCCEx_Exported_Functions_Group3 + * @{ + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLL2(RCC_PLL2InitTypeDef *PLL2Init); +HAL_StatusTypeDef HAL_RCCEx_DisablePLL2(void); + +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_RCC_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h new file mode 100644 index 0000000..fb80276 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h @@ -0,0 +1,2129 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_tim.h + * @author MCD Application Team + * @brief Header file of TIM HAL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_TIM_H +#define STM32F1xx_HAL_TIM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup TIM + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIM_Exported_Types TIM Exported Types + * @{ + */ + +/** + * @brief TIM Time base Configuration Structure definition + */ +typedef struct +{ + uint32_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ + + uint32_t CounterMode; /*!< Specifies the counter mode. + This parameter can be a value of @ref TIM_Counter_Mode */ + + uint32_t Period; /*!< Specifies the period value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ + + uint32_t ClockDivision; /*!< Specifies the clock division. + This parameter can be a value of @ref TIM_ClockDivision */ + + uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter + reaches zero, an update event is generated and counting restarts + from the RCR value (N). + This means in PWM mode that (N+1) corresponds to: + - the number of PWM periods in edge-aligned mode + - the number of half PWM period in center-aligned mode + GP timers: this parameter must be a number between Min_Data = 0x00 and + Max_Data = 0xFF. + Advanced timers: this parameter must be a number between Min_Data = 0x0000 and + Max_Data = 0xFFFF. */ + + uint32_t AutoReloadPreload; /*!< Specifies the auto-reload preload. + This parameter can be a value of @ref TIM_AutoReloadPreload */ +} TIM_Base_InitTypeDef; + +/** + * @brief TIM Output Compare Configuration Structure definition + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the TIM mode. + This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ + + uint32_t Pulse; /*!< 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 */ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_Output_Compare_Polarity */ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_Output_Compare_N_Polarity + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCFastMode; /*!< Specifies the Fast mode state. + This parameter can be a value of @ref TIM_Output_Fast_State + @note This parameter is valid only in PWM1 and PWM2 mode. */ + + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ +} TIM_OC_InitTypeDef; + +/** + * @brief TIM One Pulse Mode Configuration Structure definition + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the TIM mode. + This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ + + uint32_t Pulse; /*!< 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 */ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_Output_Compare_Polarity */ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_Output_Compare_N_Polarity + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State + @note This parameter is valid only for timer instances supporting break feature. */ + + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Input_Capture_Polarity */ + + uint32_t ICSelection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_OnePulse_InitTypeDef; + +/** + * @brief TIM Input Capture Configuration Structure definition + */ +typedef struct +{ + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Input_Capture_Polarity */ + + uint32_t ICSelection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_IC_InitTypeDef; + +/** + * @brief TIM Encoder Configuration Structure definition + */ +typedef struct +{ + uint32_t EncoderMode; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Mode */ + + uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Input_Polarity */ + + uint32_t IC1Selection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + 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 IC2Polarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_Encoder_Input_Polarity */ + + uint32_t IC2Selection; /*!< Specifies the input. + This parameter can be a value of @ref TIM_Input_Capture_Selection */ + + uint32_t IC2Prescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ + + uint32_t IC2Filter; /*!< Specifies the input capture filter. + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_Encoder_InitTypeDef; + +/** + * @brief Clock Configuration Handle Structure definition + */ +typedef struct +{ + uint32_t ClockSource; /*!< TIM clock sources + This parameter can be a value of @ref TIM_Clock_Source */ + uint32_t ClockPolarity; /*!< TIM clock polarity + This parameter can be a value of @ref TIM_Clock_Polarity */ + uint32_t ClockPrescaler; /*!< TIM clock prescaler + This parameter can be a value of @ref TIM_Clock_Prescaler */ + uint32_t ClockFilter; /*!< TIM clock filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_ClockConfigTypeDef; + +/** + * @brief TIM Clear Input Configuration Handle Structure definition + */ +typedef struct +{ + uint32_t ClearInputState; /*!< TIM clear Input state + This parameter can be ENABLE or DISABLE */ + uint32_t ClearInputSource; /*!< TIM clear Input sources + This parameter can be a value of @ref TIM_ClearInput_Source */ + uint32_t ClearInputPolarity; /*!< TIM Clear Input polarity + This parameter can be a value of @ref TIM_ClearInput_Polarity */ + uint32_t ClearInputPrescaler; /*!< TIM Clear Input prescaler + This parameter must be 0: When OCRef clear feature is used with ETR source, + ETR prescaler must be off */ + uint32_t ClearInputFilter; /*!< TIM Clear Input filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ +} TIM_ClearInputConfigTypeDef; + +/** + * @brief TIM Master configuration Structure definition + */ +typedef struct +{ + uint32_t MasterOutputTrigger; /*!< Trigger output (TRGO) selection + This parameter can be a value of @ref TIM_Master_Mode_Selection */ + uint32_t MasterSlaveMode; /*!< Master/slave mode selection + This parameter can be a value of @ref TIM_Master_Slave_Mode + @note When the Master/slave mode is enabled, the effect of + an event on the trigger input (TRGI) is delayed to allow a + perfect synchronization between the current timer and its + slaves (through TRGO). It is not mandatory in case of timer + synchronization mode. */ +} TIM_MasterConfigTypeDef; + +/** + * @brief TIM Slave configuration Structure definition + */ +typedef struct +{ + uint32_t SlaveMode; /*!< Slave mode selection + This parameter can be a value of @ref TIM_Slave_Mode */ + uint32_t InputTrigger; /*!< Input Trigger source + This parameter can be a value of @ref TIM_Trigger_Selection */ + uint32_t TriggerPolarity; /*!< Input Trigger polarity + This parameter can be a value of @ref TIM_Trigger_Polarity */ + uint32_t TriggerPrescaler; /*!< Input trigger prescaler + This parameter can be a value of @ref TIM_Trigger_Prescaler */ + uint32_t TriggerFilter; /*!< Input trigger filter + This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ + +} TIM_SlaveConfigTypeDef; + +/** + * @brief TIM Break input(s) and Dead time configuration Structure definition + * @note 2 break inputs can be configured (BKIN and BKIN2) with configurable + * filter and polarity. + */ +typedef struct +{ + uint32_t OffStateRunMode; /*!< TIM off state in run mode, This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */ + + uint32_t OffStateIDLEMode; /*!< TIM off state in IDLE mode, This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */ + + uint32_t LockLevel; /*!< TIM Lock level, This parameter can be a value of @ref TIM_Lock_level */ + + uint32_t DeadTime; /*!< TIM dead Time, This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF */ + + uint32_t BreakState; /*!< TIM Break State, This parameter can be a value of @ref TIM_Break_Input_enable_disable */ + + uint32_t BreakPolarity; /*!< TIM Break input polarity, This parameter can be a value of @ref TIM_Break_Polarity */ + + uint32_t BreakFilter; /*!< Specifies the break input filter.This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ + + uint32_t AutomaticOutput; /*!< TIM Automatic Output Enable state, This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */ + +} TIM_BreakDeadTimeConfigTypeDef; + +/** + * @brief HAL State structures definition + */ +typedef enum +{ + HAL_TIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */ + HAL_TIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ + HAL_TIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */ + HAL_TIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ + HAL_TIM_STATE_ERROR = 0x04U /*!< Reception process is ongoing */ +} HAL_TIM_StateTypeDef; + +/** + * @brief TIM Channel States definition + */ +typedef enum +{ + HAL_TIM_CHANNEL_STATE_RESET = 0x00U, /*!< TIM Channel initial state */ + HAL_TIM_CHANNEL_STATE_READY = 0x01U, /*!< TIM Channel ready for use */ + HAL_TIM_CHANNEL_STATE_BUSY = 0x02U, /*!< An internal process is ongoing on the TIM channel */ +} HAL_TIM_ChannelStateTypeDef; + +/** + * @brief DMA Burst States definition + */ +typedef enum +{ + HAL_DMA_BURST_STATE_RESET = 0x00U, /*!< DMA Burst initial state */ + HAL_DMA_BURST_STATE_READY = 0x01U, /*!< DMA Burst ready for use */ + HAL_DMA_BURST_STATE_BUSY = 0x02U, /*!< Ongoing DMA Burst */ +} HAL_TIM_DMABurstStateTypeDef; + +/** + * @brief HAL Active channel structures definition + */ +typedef enum +{ + HAL_TIM_ACTIVE_CHANNEL_1 = 0x01U, /*!< The active channel is 1 */ + HAL_TIM_ACTIVE_CHANNEL_2 = 0x02U, /*!< The active channel is 2 */ + HAL_TIM_ACTIVE_CHANNEL_3 = 0x04U, /*!< The active channel is 3 */ + HAL_TIM_ACTIVE_CHANNEL_4 = 0x08U, /*!< The active channel is 4 */ + HAL_TIM_ACTIVE_CHANNEL_CLEARED = 0x00U /*!< All active channels cleared */ +} HAL_TIM_ActiveChannel; + +/** + * @brief TIM Time Base Handle Structure definition + */ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +typedef struct __TIM_HandleTypeDef +#else +typedef struct +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +{ + TIM_TypeDef *Instance; /*!< Register base address */ + TIM_Base_InitTypeDef Init; /*!< TIM Time Base required parameters */ + HAL_TIM_ActiveChannel Channel; /*!< Active channel */ + DMA_HandleTypeDef *hdma[7]; /*!< DMA Handlers array + This array is accessed by a @ref DMA_Handle_index */ + HAL_LockTypeDef Lock; /*!< Locking object */ + __IO HAL_TIM_StateTypeDef State; /*!< TIM operation state */ + __IO HAL_TIM_ChannelStateTypeDef ChannelState[4]; /*!< TIM channel operation state */ + __IO HAL_TIM_ChannelStateTypeDef ChannelNState[4]; /*!< TIM complementary channel operation state */ + __IO HAL_TIM_DMABurstStateTypeDef DMABurstState; /*!< DMA burst operation state */ + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + void (* Base_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Base Msp Init Callback */ + void (* Base_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Base Msp DeInit Callback */ + void (* IC_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM IC Msp Init Callback */ + void (* IC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM IC Msp DeInit Callback */ + void (* OC_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM OC Msp Init Callback */ + void (* OC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM OC Msp DeInit Callback */ + void (* PWM_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Msp Init Callback */ + void (* PWM_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Msp DeInit Callback */ + void (* OnePulse_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM One Pulse Msp Init Callback */ + void (* OnePulse_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM One Pulse Msp DeInit Callback */ + void (* Encoder_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Encoder Msp Init Callback */ + void (* Encoder_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Encoder Msp DeInit Callback */ + void (* HallSensor_MspInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Hall Sensor Msp Init Callback */ + void (* HallSensor_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Hall Sensor Msp DeInit Callback */ + void (* PeriodElapsedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Period Elapsed Callback */ + void (* PeriodElapsedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Period Elapsed half complete Callback */ + void (* TriggerCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Trigger Callback */ + void (* TriggerHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Trigger half complete Callback */ + void (* IC_CaptureCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Input Capture Callback */ + void (* IC_CaptureHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Input Capture half complete Callback */ + void (* OC_DelayElapsedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Output Compare Delay Elapsed Callback */ + void (* PWM_PulseFinishedCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Pulse Finished Callback */ + void (* PWM_PulseFinishedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM PWM Pulse Finished half complete Callback */ + void (* ErrorCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Error Callback */ + void (* CommutationCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Commutation Callback */ + void (* CommutationHalfCpltCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Commutation half complete Callback */ + void (* BreakCallback)(struct __TIM_HandleTypeDef *htim); /*!< TIM Break Callback */ +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} TIM_HandleTypeDef; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief HAL TIM Callback ID enumeration definition + */ +typedef enum +{ + HAL_TIM_BASE_MSPINIT_CB_ID = 0x00U /*!< TIM Base MspInit Callback ID */ + , HAL_TIM_BASE_MSPDEINIT_CB_ID = 0x01U /*!< TIM Base MspDeInit Callback ID */ + , HAL_TIM_IC_MSPINIT_CB_ID = 0x02U /*!< TIM IC MspInit Callback ID */ + , HAL_TIM_IC_MSPDEINIT_CB_ID = 0x03U /*!< TIM IC MspDeInit Callback ID */ + , HAL_TIM_OC_MSPINIT_CB_ID = 0x04U /*!< TIM OC MspInit Callback ID */ + , HAL_TIM_OC_MSPDEINIT_CB_ID = 0x05U /*!< TIM OC MspDeInit Callback ID */ + , HAL_TIM_PWM_MSPINIT_CB_ID = 0x06U /*!< TIM PWM MspInit Callback ID */ + , HAL_TIM_PWM_MSPDEINIT_CB_ID = 0x07U /*!< TIM PWM MspDeInit Callback ID */ + , HAL_TIM_ONE_PULSE_MSPINIT_CB_ID = 0x08U /*!< TIM One Pulse MspInit Callback ID */ + , HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID = 0x09U /*!< TIM One Pulse MspDeInit Callback ID */ + , HAL_TIM_ENCODER_MSPINIT_CB_ID = 0x0AU /*!< TIM Encoder MspInit Callback ID */ + , HAL_TIM_ENCODER_MSPDEINIT_CB_ID = 0x0BU /*!< TIM Encoder MspDeInit Callback ID */ + , HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID = 0x0CU /*!< TIM Hall Sensor MspDeInit Callback ID */ + , HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID = 0x0DU /*!< TIM Hall Sensor MspDeInit Callback ID */ + , HAL_TIM_PERIOD_ELAPSED_CB_ID = 0x0EU /*!< TIM Period Elapsed Callback ID */ + , HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID = 0x0FU /*!< TIM Period Elapsed half complete Callback ID */ + , HAL_TIM_TRIGGER_CB_ID = 0x10U /*!< TIM Trigger Callback ID */ + , HAL_TIM_TRIGGER_HALF_CB_ID = 0x11U /*!< TIM Trigger half complete Callback ID */ + + , HAL_TIM_IC_CAPTURE_CB_ID = 0x12U /*!< TIM Input Capture Callback ID */ + , HAL_TIM_IC_CAPTURE_HALF_CB_ID = 0x13U /*!< TIM Input Capture half complete Callback ID */ + , HAL_TIM_OC_DELAY_ELAPSED_CB_ID = 0x14U /*!< TIM Output Compare Delay Elapsed Callback ID */ + , HAL_TIM_PWM_PULSE_FINISHED_CB_ID = 0x15U /*!< TIM PWM Pulse Finished Callback ID */ + , HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID = 0x16U /*!< TIM PWM Pulse Finished half complete Callback ID */ + , HAL_TIM_ERROR_CB_ID = 0x17U /*!< TIM Error Callback ID */ + , HAL_TIM_COMMUTATION_CB_ID = 0x18U /*!< TIM Commutation Callback ID */ + , HAL_TIM_COMMUTATION_HALF_CB_ID = 0x19U /*!< TIM Commutation half complete Callback ID */ + , HAL_TIM_BREAK_CB_ID = 0x1AU /*!< TIM Break Callback ID */ +} HAL_TIM_CallbackIDTypeDef; + +/** + * @brief HAL TIM Callback pointer definition + */ +typedef void (*pTIM_CallbackTypeDef)(TIM_HandleTypeDef *htim); /*!< pointer to the TIM callback function */ + +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ +/* End of exported types -----------------------------------------------------*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIM_Exported_Constants TIM Exported Constants + * @{ + */ + +/** @defgroup TIM_ClearInput_Source TIM Clear Input Source + * @{ + */ +#define TIM_CLEARINPUTSOURCE_NONE 0x00000000U /*!< OCREF_CLR is disabled */ +#define TIM_CLEARINPUTSOURCE_ETR 0x00000001U /*!< OCREF_CLR is connected to ETRF input */ +/** + * @} + */ + +/** @defgroup TIM_DMA_Base_address TIM DMA Base Address + * @{ + */ +#define TIM_DMABASE_CR1 0x00000000U +#define TIM_DMABASE_CR2 0x00000001U +#define TIM_DMABASE_SMCR 0x00000002U +#define TIM_DMABASE_DIER 0x00000003U +#define TIM_DMABASE_SR 0x00000004U +#define TIM_DMABASE_EGR 0x00000005U +#define TIM_DMABASE_CCMR1 0x00000006U +#define TIM_DMABASE_CCMR2 0x00000007U +#define TIM_DMABASE_CCER 0x00000008U +#define TIM_DMABASE_CNT 0x00000009U +#define TIM_DMABASE_PSC 0x0000000AU +#define TIM_DMABASE_ARR 0x0000000BU +#define TIM_DMABASE_RCR 0x0000000CU +#define TIM_DMABASE_CCR1 0x0000000DU +#define TIM_DMABASE_CCR2 0x0000000EU +#define TIM_DMABASE_CCR3 0x0000000FU +#define TIM_DMABASE_CCR4 0x00000010U +#define TIM_DMABASE_BDTR 0x00000011U +#define TIM_DMABASE_DCR 0x00000012U +#define TIM_DMABASE_DMAR 0x00000013U +/** + * @} + */ + +/** @defgroup TIM_Event_Source TIM Event 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 */ +/** + * @} + */ + +/** @defgroup TIM_Input_Channel_Polarity TIM Input Channel polarity + * @{ + */ +#define TIM_INPUTCHANNELPOLARITY_RISING 0x00000000U /*!< Polarity for TIx source */ +#define TIM_INPUTCHANNELPOLARITY_FALLING TIM_CCER_CC1P /*!< Polarity for TIx source */ +#define TIM_INPUTCHANNELPOLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP) /*!< Polarity for TIx source */ +/** + * @} + */ + +/** @defgroup TIM_ETR_Polarity TIM ETR Polarity + * @{ + */ +#define TIM_ETRPOLARITY_INVERTED TIM_SMCR_ETP /*!< Polarity for ETR source */ +#define TIM_ETRPOLARITY_NONINVERTED 0x00000000U /*!< Polarity for ETR source */ +/** + * @} + */ + +/** @defgroup TIM_ETR_Prescaler TIM ETR Prescaler + * @{ + */ +#define TIM_ETRPRESCALER_DIV1 0x00000000U /*!< No prescaler is used */ +#define TIM_ETRPRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR input source is divided by 2 */ +#define TIM_ETRPRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR input source is divided by 4 */ +#define TIM_ETRPRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR input source is divided by 8 */ +/** + * @} + */ + +/** @defgroup TIM_Counter_Mode TIM Counter Mode + * @{ + */ +#define TIM_COUNTERMODE_UP 0x00000000U /*!< Counter used as up-counter */ +#define TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as down-counter */ +#define TIM_COUNTERMODE_CENTERALIGNED1 TIM_CR1_CMS_0 /*!< Center-aligned mode 1 */ +#define TIM_COUNTERMODE_CENTERALIGNED2 TIM_CR1_CMS_1 /*!< Center-aligned mode 2 */ +#define TIM_COUNTERMODE_CENTERALIGNED3 TIM_CR1_CMS /*!< Center-aligned mode 3 */ +/** + * @} + */ + +/** @defgroup TIM_ClockDivision TIM Clock Division + * @{ + */ +#define TIM_CLOCKDIVISION_DIV1 0x00000000U /*!< Clock division: tDTS=tCK_INT */ +#define TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< Clock division: tDTS=2*tCK_INT */ +#define TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< Clock division: tDTS=4*tCK_INT */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_State TIM Output Compare State + * @{ + */ +#define TIM_OUTPUTSTATE_DISABLE 0x00000000U /*!< Capture/Compare 1 output disabled */ +#define TIM_OUTPUTSTATE_ENABLE TIM_CCER_CC1E /*!< Capture/Compare 1 output enabled */ +/** + * @} + */ + +/** @defgroup TIM_AutoReloadPreload TIM Auto-Reload Preload + * @{ + */ +#define TIM_AUTORELOAD_PRELOAD_DISABLE 0x00000000U /*!< TIMx_ARR register is not buffered */ +#define TIM_AUTORELOAD_PRELOAD_ENABLE TIM_CR1_ARPE /*!< TIMx_ARR register is buffered */ + +/** + * @} + */ + +/** @defgroup TIM_Output_Fast_State TIM Output Fast State + * @{ + */ +#define TIM_OCFAST_DISABLE 0x00000000U /*!< Output Compare fast disable */ +#define TIM_OCFAST_ENABLE TIM_CCMR1_OC1FE /*!< Output Compare fast enable */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_State TIM Complementary Output Compare State + * @{ + */ +#define TIM_OUTPUTNSTATE_DISABLE 0x00000000U /*!< OCxN is disabled */ +#define TIM_OUTPUTNSTATE_ENABLE TIM_CCER_CC1NE /*!< OCxN is enabled */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_Polarity TIM Output Compare Polarity + * @{ + */ +#define TIM_OCPOLARITY_HIGH 0x00000000U /*!< Capture/Compare output polarity */ +#define TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< Capture/Compare output polarity */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_Polarity TIM Complementary Output Compare Polarity + * @{ + */ +#define TIM_OCNPOLARITY_HIGH 0x00000000U /*!< Capture/Compare complementary output polarity */ +#define TIM_OCNPOLARITY_LOW TIM_CCER_CC1NP /*!< Capture/Compare complementary output polarity */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_Idle_State TIM Output Compare Idle State + * @{ + */ +#define TIM_OCIDLESTATE_SET TIM_CR2_OIS1 /*!< Output Idle state: OCx=1 when MOE=0 */ +#define TIM_OCIDLESTATE_RESET 0x00000000U /*!< Output Idle state: OCx=0 when MOE=0 */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_N_Idle_State TIM Complementary Output Compare Idle State + * @{ + */ +#define TIM_OCNIDLESTATE_SET TIM_CR2_OIS1N /*!< Complementary output Idle state: OCxN=1 when MOE=0 */ +#define TIM_OCNIDLESTATE_RESET 0x00000000U /*!< Complementary output Idle state: OCxN=0 when MOE=0 */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Polarity TIM Input Capture Polarity + * @{ + */ +#define TIM_ICPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Capture triggered by rising edge on timer input */ +#define TIM_ICPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Capture triggered by falling edge on timer input */ +#define TIM_ICPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Capture triggered by both rising and falling edges on timer input*/ +/** + * @} + */ + +/** @defgroup TIM_Encoder_Input_Polarity TIM Encoder Input Polarity + * @{ + */ +#define TIM_ENCODERINPUTPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Encoder input with rising edge polarity */ +#define TIM_ENCODERINPUTPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Encoder input with falling edge polarity */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Selection TIM Input Capture Selection + * @{ + */ +#define TIM_ICSELECTION_DIRECTTI TIM_CCMR1_CC1S_0 /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to IC1, IC2, IC3 or IC4, respectively */ +#define TIM_ICSELECTION_INDIRECTTI TIM_CCMR1_CC1S_1 /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to IC2, IC1, IC4 or IC3, respectively */ +#define TIM_ICSELECTION_TRC TIM_CCMR1_CC1S /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC */ +/** + * @} + */ + +/** @defgroup TIM_Input_Capture_Prescaler TIM Input Capture Prescaler + * @{ + */ +#define TIM_ICPSC_DIV1 0x00000000U /*!< Capture performed each time an edge is detected on the capture input */ +#define TIM_ICPSC_DIV2 TIM_CCMR1_IC1PSC_0 /*!< Capture performed once every 2 events */ +#define TIM_ICPSC_DIV4 TIM_CCMR1_IC1PSC_1 /*!< Capture performed once every 4 events */ +#define TIM_ICPSC_DIV8 TIM_CCMR1_IC1PSC /*!< Capture performed once every 8 events */ +/** + * @} + */ + +/** @defgroup TIM_One_Pulse_Mode TIM One Pulse Mode + * @{ + */ +#define TIM_OPMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */ +#define TIM_OPMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */ +/** + * @} + */ + +/** @defgroup TIM_Encoder_Mode TIM Encoder Mode + * @{ + */ +#define TIM_ENCODERMODE_TI1 TIM_SMCR_SMS_0 /*!< Quadrature encoder mode 1, x2 mode, counts up/down on TI1FP1 edge depending on TI2FP2 level */ +#define TIM_ENCODERMODE_TI2 TIM_SMCR_SMS_1 /*!< Quadrature encoder mode 2, x2 mode, counts up/down on TI2FP2 edge depending on TI1FP1 level. */ +#define TIM_ENCODERMODE_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode 3, x4 mode, counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input. */ +/** + * @} + */ + +/** @defgroup TIM_Interrupt_definition TIM interrupt Definition + * @{ + */ +#define TIM_IT_UPDATE TIM_DIER_UIE /*!< Update interrupt */ +#define TIM_IT_CC1 TIM_DIER_CC1IE /*!< Capture/Compare 1 interrupt */ +#define TIM_IT_CC2 TIM_DIER_CC2IE /*!< Capture/Compare 2 interrupt */ +#define TIM_IT_CC3 TIM_DIER_CC3IE /*!< Capture/Compare 3 interrupt */ +#define TIM_IT_CC4 TIM_DIER_CC4IE /*!< Capture/Compare 4 interrupt */ +#define TIM_IT_COM TIM_DIER_COMIE /*!< Commutation interrupt */ +#define TIM_IT_TRIGGER TIM_DIER_TIE /*!< Trigger interrupt */ +#define TIM_IT_BREAK TIM_DIER_BIE /*!< Break interrupt */ +/** + * @} + */ + +/** @defgroup TIM_Commutation_Source TIM Commutation Source + * @{ + */ +#define TIM_COMMUTATION_TRGI TIM_CR2_CCUS /*!< When Capture/compare control bits are preloaded, they are updated by setting the COMG bit or when an rising edge occurs on trigger input */ +#define TIM_COMMUTATION_SOFTWARE 0x00000000U /*!< When Capture/compare control bits are preloaded, they are updated by setting the COMG bit */ +/** + * @} + */ + +/** @defgroup TIM_DMA_sources TIM DMA Sources + * @{ + */ +#define TIM_DMA_UPDATE TIM_DIER_UDE /*!< DMA request is triggered by the update event */ +#define TIM_DMA_CC1 TIM_DIER_CC1DE /*!< DMA request is triggered by the capture/compare macth 1 event */ +#define TIM_DMA_CC2 TIM_DIER_CC2DE /*!< DMA request is triggered by the capture/compare macth 2 event event */ +#define TIM_DMA_CC3 TIM_DIER_CC3DE /*!< DMA request is triggered by the capture/compare macth 3 event event */ +#define TIM_DMA_CC4 TIM_DIER_CC4DE /*!< DMA request is triggered by the capture/compare macth 4 event event */ +#define TIM_DMA_COM TIM_DIER_COMDE /*!< DMA request is triggered by the commutation event */ +#define TIM_DMA_TRIGGER TIM_DIER_TDE /*!< DMA request is triggered by the trigger event */ +/** + * @} + */ + +/** @defgroup TIM_Flag_definition TIM Flag Definition + * @{ + */ +#define TIM_FLAG_UPDATE TIM_SR_UIF /*!< Update interrupt flag */ +#define TIM_FLAG_CC1 TIM_SR_CC1IF /*!< Capture/Compare 1 interrupt flag */ +#define TIM_FLAG_CC2 TIM_SR_CC2IF /*!< Capture/Compare 2 interrupt flag */ +#define TIM_FLAG_CC3 TIM_SR_CC3IF /*!< Capture/Compare 3 interrupt flag */ +#define TIM_FLAG_CC4 TIM_SR_CC4IF /*!< Capture/Compare 4 interrupt flag */ +#define TIM_FLAG_COM TIM_SR_COMIF /*!< Commutation interrupt flag */ +#define TIM_FLAG_TRIGGER TIM_SR_TIF /*!< Trigger interrupt flag */ +#define TIM_FLAG_BREAK TIM_SR_BIF /*!< Break interrupt flag */ +#define TIM_FLAG_CC1OF TIM_SR_CC1OF /*!< Capture 1 overcapture flag */ +#define TIM_FLAG_CC2OF TIM_SR_CC2OF /*!< Capture 2 overcapture flag */ +#define TIM_FLAG_CC3OF TIM_SR_CC3OF /*!< Capture 3 overcapture flag */ +#define TIM_FLAG_CC4OF TIM_SR_CC4OF /*!< Capture 4 overcapture flag */ +/** + * @} + */ + +/** @defgroup TIM_Channel TIM Channel + * @{ + */ +#define TIM_CHANNEL_1 0x00000000U /*!< Capture/compare channel 1 identifier */ +#define TIM_CHANNEL_2 0x00000004U /*!< Capture/compare channel 2 identifier */ +#define TIM_CHANNEL_3 0x00000008U /*!< Capture/compare channel 3 identifier */ +#define TIM_CHANNEL_4 0x0000000CU /*!< Capture/compare channel 4 identifier */ +#define TIM_CHANNEL_ALL 0x0000003CU /*!< Global Capture/compare channel identifier */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Source TIM Clock Source + * @{ + */ +#define TIM_CLOCKSOURCE_ETRMODE2 TIM_SMCR_ETPS_1 /*!< External clock source mode 2 */ +#define TIM_CLOCKSOURCE_INTERNAL TIM_SMCR_ETPS_0 /*!< Internal clock source */ +#define TIM_CLOCKSOURCE_ITR0 TIM_TS_ITR0 /*!< External clock source mode 1 (ITR0) */ +#define TIM_CLOCKSOURCE_ITR1 TIM_TS_ITR1 /*!< External clock source mode 1 (ITR1) */ +#define TIM_CLOCKSOURCE_ITR2 TIM_TS_ITR2 /*!< External clock source mode 1 (ITR2) */ +#define TIM_CLOCKSOURCE_ITR3 TIM_TS_ITR3 /*!< External clock source mode 1 (ITR3) */ +#define TIM_CLOCKSOURCE_TI1ED TIM_TS_TI1F_ED /*!< External clock source mode 1 (TTI1FP1 + edge detect.) */ +#define TIM_CLOCKSOURCE_TI1 TIM_TS_TI1FP1 /*!< External clock source mode 1 (TTI1FP1) */ +#define TIM_CLOCKSOURCE_TI2 TIM_TS_TI2FP2 /*!< External clock source mode 1 (TTI2FP2) */ +#define TIM_CLOCKSOURCE_ETRMODE1 TIM_TS_ETRF /*!< External clock source mode 1 (ETRF) */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Polarity TIM Clock Polarity + * @{ + */ +#define TIM_CLOCKPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx clock sources */ +#define TIM_CLOCKPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx clock sources */ +#define TIM_CLOCKPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIx clock sources */ +#define TIM_CLOCKPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIx clock sources */ +#define TIM_CLOCKPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIx clock sources */ +/** + * @} + */ + +/** @defgroup TIM_Clock_Prescaler TIM Clock Prescaler + * @{ + */ +#define TIM_CLOCKPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_CLOCKPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Clock: Capture performed once every 2 events. */ +#define TIM_CLOCKPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Clock: Capture performed once every 4 events. */ +#define TIM_CLOCKPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Clock: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_ClearInput_Polarity TIM Clear Input Polarity + * @{ + */ +#define TIM_CLEARINPUTPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx pin */ +#define TIM_CLEARINPUTPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx pin */ +/** + * @} + */ + +/** @defgroup TIM_ClearInput_Prescaler TIM Clear Input Prescaler + * @{ + */ +#define TIM_CLEARINPUTPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_CLEARINPUTPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR pin: Capture performed once every 2 events. */ +#define TIM_CLEARINPUTPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR pin: Capture performed once every 4 events. */ +#define TIM_CLEARINPUTPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR pin: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_OSSR_Off_State_Selection_for_Run_mode_state TIM OSSR OffState Selection for Run mode state + * @{ + */ +#define TIM_OSSR_ENABLE TIM_BDTR_OSSR /*!< When inactive, OC/OCN outputs are enabled (still controlled by the timer) */ +#define TIM_OSSR_DISABLE 0x00000000U /*!< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer) */ +/** + * @} + */ + +/** @defgroup TIM_OSSI_Off_State_Selection_for_Idle_mode_state TIM OSSI OffState Selection for Idle mode state + * @{ + */ +#define TIM_OSSI_ENABLE TIM_BDTR_OSSI /*!< When inactive, OC/OCN outputs are enabled (still controlled by the timer) */ +#define TIM_OSSI_DISABLE 0x00000000U /*!< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer) */ +/** + * @} + */ +/** @defgroup TIM_Lock_level TIM Lock level + * @{ + */ +#define TIM_LOCKLEVEL_OFF 0x00000000U /*!< LOCK OFF */ +#define TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0 /*!< LOCK Level 1 */ +#define TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1 /*!< LOCK Level 2 */ +#define TIM_LOCKLEVEL_3 TIM_BDTR_LOCK /*!< LOCK Level 3 */ +/** + * @} + */ + +/** @defgroup TIM_Break_Input_enable_disable TIM Break Input Enable + * @{ + */ +#define TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break input BRK is enabled */ +#define TIM_BREAK_DISABLE 0x00000000U /*!< Break input BRK is disabled */ +/** + * @} + */ + +/** @defgroup TIM_Break_Polarity TIM Break Input Polarity + * @{ + */ +#define TIM_BREAKPOLARITY_LOW 0x00000000U /*!< Break input BRK is active low */ +#define TIM_BREAKPOLARITY_HIGH TIM_BDTR_BKP /*!< Break input BRK is active high */ +/** + * @} + */ + +/** @defgroup TIM_AOE_Bit_Set_Reset TIM Automatic Output Enable + * @{ + */ +#define TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */ +#define TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event (if none of the break inputs BRK and BRK2 is active) */ +/** + * @} + */ + +/** @defgroup TIM_Master_Mode_Selection TIM Master Mode Selection + * @{ + */ +#define TIM_TRGO_RESET 0x00000000U /*!< TIMx_EGR.UG bit is used as trigger output (TRGO) */ +#define TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< TIMx_CR1.CEN bit is used as trigger output (TRGO) */ +#define TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output (TRGO) */ +#define TIM_TRGO_OC1 (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< Capture or a compare match 1 is used as trigger output (TRGO) */ +#define TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output (TRGO) */ +#define TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output(TRGO) */ +#define TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output(TRGO) */ +#define TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output(TRGO) */ +/** + * @} + */ + +/** @defgroup TIM_Master_Slave_Mode TIM Master/Slave Mode + * @{ + */ +#define TIM_MASTERSLAVEMODE_ENABLE TIM_SMCR_MSM /*!< No action */ +#define TIM_MASTERSLAVEMODE_DISABLE 0x00000000U /*!< Master/slave mode is selected */ +/** + * @} + */ + +/** @defgroup TIM_Slave_Mode TIM Slave mode + * @{ + */ +#define TIM_SLAVEMODE_DISABLE 0x00000000U /*!< Slave mode disabled */ +#define TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode */ +#define TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Gated Mode */ +#define TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Trigger Mode */ +#define TIM_SLAVEMODE_EXTERNAL1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< External Clock Mode 1 */ +/** + * @} + */ + +/** @defgroup TIM_Output_Compare_and_PWM_modes TIM Output Compare and PWM Modes + * @{ + */ +#define TIM_OCMODE_TIMING 0x00000000U /*!< Frozen */ +#define TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!< Set channel to active level on match */ +#define TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!< Set channel to inactive level on match */ +#define TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< Toggle */ +#define TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!< PWM mode 1 */ +#define TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< PWM mode 2 */ +#define TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!< Force active level */ +#define TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!< Force inactive level */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Selection TIM Trigger Selection + * @{ + */ +#define TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) */ +#define TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) */ +#define TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) */ +#define TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) */ +#define TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) */ +#define TIM_TS_TI1FP1 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2) /*!< Filtered Timer Input 1 (TI1FP1) */ +#define TIM_TS_TI2FP2 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2) /*!< Filtered Timer Input 2 (TI2FP2) */ +#define TIM_TS_ETRF (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2) /*!< Filtered External Trigger input (ETRF) */ +#define TIM_TS_NONE 0x0000FFFFU /*!< No trigger selected */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Polarity TIM Trigger Polarity + * @{ + */ +#define TIM_TRIGGERPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx trigger sources */ +#define TIM_TRIGGERPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx trigger sources */ +#define TIM_TRIGGERPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +#define TIM_TRIGGERPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +#define TIM_TRIGGERPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE /*!< Polarity for TIxFPx or TI1_ED trigger sources */ +/** + * @} + */ + +/** @defgroup TIM_Trigger_Prescaler TIM Trigger Prescaler + * @{ + */ +#define TIM_TRIGGERPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ +#define TIM_TRIGGERPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR Trigger: Capture performed once every 2 events. */ +#define TIM_TRIGGERPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR Trigger: Capture performed once every 4 events. */ +#define TIM_TRIGGERPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR Trigger: Capture performed once every 8 events. */ +/** + * @} + */ + +/** @defgroup TIM_TI1_Selection TIM TI1 Input Selection + * @{ + */ +#define TIM_TI1SELECTION_CH1 0x00000000U /*!< The TIMx_CH1 pin is connected to TI1 input */ +#define TIM_TI1SELECTION_XORCOMBINATION TIM_CR2_TI1S /*!< The TIMx_CH1, CH2 and CH3 pins are connected to the TI1 input (XOR combination) */ +/** + * @} + */ + +/** @defgroup TIM_DMA_Burst_Length TIM DMA Burst Length + * @{ + */ +#define TIM_DMABURSTLENGTH_1TRANSFER 0x00000000U /*!< The transfer is done to 1 register starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_2TRANSFERS 0x00000100U /*!< The transfer is done to 2 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_3TRANSFERS 0x00000200U /*!< The transfer is done to 3 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_4TRANSFERS 0x00000300U /*!< The transfer is done to 4 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_5TRANSFERS 0x00000400U /*!< The transfer is done to 5 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_6TRANSFERS 0x00000500U /*!< The transfer is done to 6 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_7TRANSFERS 0x00000600U /*!< The transfer is done to 7 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_8TRANSFERS 0x00000700U /*!< The transfer is done to 8 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_9TRANSFERS 0x00000800U /*!< The transfer is done to 9 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_10TRANSFERS 0x00000900U /*!< The transfer is done to 10 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_11TRANSFERS 0x00000A00U /*!< The transfer is done to 11 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_12TRANSFERS 0x00000B00U /*!< The transfer is done to 12 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_13TRANSFERS 0x00000C00U /*!< The transfer is done to 13 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_14TRANSFERS 0x00000D00U /*!< The transfer is done to 14 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_15TRANSFERS 0x00000E00U /*!< The transfer is done to 15 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_16TRANSFERS 0x00000F00U /*!< The transfer is done to 16 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_17TRANSFERS 0x00001000U /*!< The transfer is done to 17 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +#define TIM_DMABURSTLENGTH_18TRANSFERS 0x00001100U /*!< The transfer is done to 18 registers starting from TIMx_CR1 + TIMx_DCR.DBA */ +/** + * @} + */ + +/** @defgroup DMA_Handle_index TIM DMA Handle Index + * @{ + */ +#define TIM_DMA_ID_UPDATE ((uint16_t) 0x0000) /*!< Index of the DMA handle used for Update DMA requests */ +#define TIM_DMA_ID_CC1 ((uint16_t) 0x0001) /*!< Index of the DMA handle used for Capture/Compare 1 DMA requests */ +#define TIM_DMA_ID_CC2 ((uint16_t) 0x0002) /*!< Index of the DMA handle used for Capture/Compare 2 DMA requests */ +#define TIM_DMA_ID_CC3 ((uint16_t) 0x0003) /*!< Index of the DMA handle used for Capture/Compare 3 DMA requests */ +#define TIM_DMA_ID_CC4 ((uint16_t) 0x0004) /*!< Index of the DMA handle used for Capture/Compare 4 DMA requests */ +#define TIM_DMA_ID_COMMUTATION ((uint16_t) 0x0005) /*!< Index of the DMA handle used for Commutation DMA requests */ +#define TIM_DMA_ID_TRIGGER ((uint16_t) 0x0006) /*!< Index of the DMA handle used for Trigger DMA requests */ +/** + * @} + */ + +/** @defgroup Channel_CC_State TIM Capture/Compare Channel State + * @{ + */ +#define TIM_CCx_ENABLE 0x00000001U /*!< Input or output channel is enabled */ +#define TIM_CCx_DISABLE 0x00000000U /*!< Input or output channel is disabled */ +#define TIM_CCxN_ENABLE 0x00000004U /*!< Complementary output channel is enabled */ +#define TIM_CCxN_DISABLE 0x00000000U /*!< Complementary output channel is enabled */ +/** + * @} + */ + +/** + * @} + */ +/* End of exported constants -------------------------------------------------*/ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup TIM_Exported_Macros TIM Exported Macros + * @{ + */ + +/** @brief Reset TIM handle state. + * @param __HANDLE__ TIM handle. + * @retval None + */ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \ + (__HANDLE__)->State = HAL_TIM_STATE_RESET; \ + (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \ + (__HANDLE__)->Base_MspInitCallback = NULL; \ + (__HANDLE__)->Base_MspDeInitCallback = NULL; \ + (__HANDLE__)->IC_MspInitCallback = NULL; \ + (__HANDLE__)->IC_MspDeInitCallback = NULL; \ + (__HANDLE__)->OC_MspInitCallback = NULL; \ + (__HANDLE__)->OC_MspDeInitCallback = NULL; \ + (__HANDLE__)->PWM_MspInitCallback = NULL; \ + (__HANDLE__)->PWM_MspDeInitCallback = NULL; \ + (__HANDLE__)->OnePulse_MspInitCallback = NULL; \ + (__HANDLE__)->OnePulse_MspDeInitCallback = NULL; \ + (__HANDLE__)->Encoder_MspInitCallback = NULL; \ + (__HANDLE__)->Encoder_MspDeInitCallback = NULL; \ + (__HANDLE__)->HallSensor_MspInitCallback = NULL; \ + (__HANDLE__)->HallSensor_MspDeInitCallback = NULL; \ + } while(0) +#else +#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \ + (__HANDLE__)->State = HAL_TIM_STATE_RESET; \ + (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \ + (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \ + } while(0) +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @brief Enable the TIM peripheral. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN)) + +/** + * @brief Enable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_MOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE)) + +/** + * @brief Disable the TIM peripheral. + * @param __HANDLE__ TIM handle + * @retval None + */ +#define __HAL_TIM_DISABLE(__HANDLE__) \ + do { \ + if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \ + { \ + if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \ + { \ + (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \ + } \ + } \ + } while(0) + +/** + * @brief Disable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + * @note The Main Output Enable of a timer instance is disabled only if all the CCx and CCxN channels have been + * disabled + */ +#define __HAL_TIM_MOE_DISABLE(__HANDLE__) \ + do { \ + if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \ + { \ + if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \ + { \ + (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \ + } \ + } \ + } while(0) + +/** + * @brief Disable the TIM main Output. + * @param __HANDLE__ TIM handle + * @retval None + * @note The Main Output Enable of a timer instance is disabled unconditionally + */ +#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__) (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE) + +/** @brief Enable the specified TIM interrupt. + * @param __HANDLE__ specifies the TIM Handle. + * @param __INTERRUPT__ specifies the TIM interrupt source to enable. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__)) + +/** @brief Disable the specified TIM interrupt. + * @param __HANDLE__ specifies the TIM Handle. + * @param __INTERRUPT__ specifies the TIM interrupt source to disable. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__)) + +/** @brief Enable the specified DMA request. + * @param __HANDLE__ specifies the TIM Handle. + * @param __DMA__ specifies the TIM DMA request to enable. + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: Update DMA request + * @arg TIM_DMA_CC1: Capture/Compare 1 DMA request + * @arg TIM_DMA_CC2: Capture/Compare 2 DMA request + * @arg TIM_DMA_CC3: Capture/Compare 3 DMA request + * @arg TIM_DMA_CC4: Capture/Compare 4 DMA request + * @arg TIM_DMA_COM: Commutation DMA request + * @arg TIM_DMA_TRIGGER: Trigger DMA request + * @retval None + */ +#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER |= (__DMA__)) + +/** @brief Disable the specified DMA request. + * @param __HANDLE__ specifies the TIM Handle. + * @param __DMA__ specifies the TIM DMA request to disable. + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: Update DMA request + * @arg TIM_DMA_CC1: Capture/Compare 1 DMA request + * @arg TIM_DMA_CC2: Capture/Compare 2 DMA request + * @arg TIM_DMA_CC3: Capture/Compare 3 DMA request + * @arg TIM_DMA_CC4: Capture/Compare 4 DMA request + * @arg TIM_DMA_COM: Commutation DMA request + * @arg TIM_DMA_TRIGGER: Trigger DMA request + * @retval None + */ +#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER &= ~(__DMA__)) + +/** @brief Check whether the specified TIM interrupt flag is set or not. + * @param __HANDLE__ specifies the TIM Handle. + * @param __FLAG__ specifies the TIM interrupt flag to check. + * This parameter can be one of the following values: + * @arg TIM_FLAG_UPDATE: Update interrupt flag + * @arg TIM_FLAG_CC1: Capture/Compare 1 interrupt flag + * @arg TIM_FLAG_CC2: Capture/Compare 2 interrupt flag + * @arg TIM_FLAG_CC3: Capture/Compare 3 interrupt flag + * @arg TIM_FLAG_CC4: Capture/Compare 4 interrupt flag + * @arg TIM_FLAG_COM: Commutation interrupt flag + * @arg TIM_FLAG_TRIGGER: Trigger interrupt flag + * @arg TIM_FLAG_BREAK: Break interrupt flag + * @arg TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag + * @arg TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag + * @arg TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag + * @arg TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified TIM interrupt flag. + * @param __HANDLE__ specifies the TIM Handle. + * @param __FLAG__ specifies the TIM interrupt flag to clear. + * This parameter can be one of the following values: + * @arg TIM_FLAG_UPDATE: Update interrupt flag + * @arg TIM_FLAG_CC1: Capture/Compare 1 interrupt flag + * @arg TIM_FLAG_CC2: Capture/Compare 2 interrupt flag + * @arg TIM_FLAG_CC3: Capture/Compare 3 interrupt flag + * @arg TIM_FLAG_CC4: Capture/Compare 4 interrupt flag + * @arg TIM_FLAG_COM: Commutation interrupt flag + * @arg TIM_FLAG_TRIGGER: Trigger interrupt flag + * @arg TIM_FLAG_BREAK: Break interrupt flag + * @arg TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag + * @arg TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag + * @arg TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag + * @arg TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) + +/** + * @brief Check whether the specified TIM interrupt source is enabled or not. + * @param __HANDLE__ TIM handle + * @param __INTERRUPT__ specifies the TIM interrupt source to check. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval The state of TIM_IT (SET or RESET). + */ +#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) \ + == (__INTERRUPT__)) ? SET : RESET) + +/** @brief Clear the TIM interrupt pending bits. + * @param __HANDLE__ TIM handle + * @param __INTERRUPT__ specifies the interrupt pending bit to clear. + * This parameter can be one of the following values: + * @arg TIM_IT_UPDATE: Update interrupt + * @arg TIM_IT_CC1: Capture/Compare 1 interrupt + * @arg TIM_IT_CC2: Capture/Compare 2 interrupt + * @arg TIM_IT_CC3: Capture/Compare 3 interrupt + * @arg TIM_IT_CC4: Capture/Compare 4 interrupt + * @arg TIM_IT_COM: Commutation interrupt + * @arg TIM_IT_TRIGGER: Trigger interrupt + * @arg TIM_IT_BREAK: Break interrupt + * @retval None + */ +#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__)) + +/** + * @brief Indicates whether or not the TIM Counter is used as downcounter. + * @param __HANDLE__ TIM handle. + * @retval False (Counter used as upcounter) or True (Counter used as downcounter) + * @note This macro is particularly useful to get the counting mode when the timer operates in Center-aligned mode + * or Encoder mode. + */ +#define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__) (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR)) + +/** + * @brief Set the TIM Prescaler on runtime. + * @param __HANDLE__ TIM handle. + * @param __PRESC__ specifies the Prescaler new value. + * @retval None + */ +#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__)) + +/** + * @brief Set the TIM Counter Register value on runtime. + * @param __HANDLE__ TIM handle. + * @param __COUNTER__ specifies the Counter register new value. + * @retval None + */ +#define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__)) + +/** + * @brief Get the TIM Counter Register value on runtime. + * @param __HANDLE__ TIM handle. + * @retval 16-bit or 32-bit value of the timer counter register (TIMx_CNT) + */ +#define __HAL_TIM_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNT) + +/** + * @brief Set the TIM Autoreload Register value on runtime without calling another time any Init function. + * @param __HANDLE__ TIM handle. + * @param __AUTORELOAD__ specifies the Counter register new value. + * @retval None + */ +#define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__) \ + do{ \ + (__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \ + (__HANDLE__)->Init.Period = (__AUTORELOAD__); \ + } while(0) + +/** + * @brief Get the TIM Autoreload Register value on runtime. + * @param __HANDLE__ TIM handle. + * @retval 16-bit or 32-bit value of the timer auto-reload register(TIMx_ARR) + */ +#define __HAL_TIM_GET_AUTORELOAD(__HANDLE__) ((__HANDLE__)->Instance->ARR) + +/** + * @brief Set the TIM Clock Division value on runtime without calling another time any Init function. + * @param __HANDLE__ TIM handle. + * @param __CKD__ specifies the clock division value. + * This parameter can be one of the following value: + * @arg TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT + * @arg TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT + * @arg TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT + * @retval None + */ +#define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__) \ + do{ \ + (__HANDLE__)->Instance->CR1 &= (~TIM_CR1_CKD); \ + (__HANDLE__)->Instance->CR1 |= (__CKD__); \ + (__HANDLE__)->Init.ClockDivision = (__CKD__); \ + } while(0) + +/** + * @brief Get the TIM Clock Division value on runtime. + * @param __HANDLE__ TIM handle. + * @retval The clock division can be one of the following values: + * @arg TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT + * @arg TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT + * @arg TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT + */ +#define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__) ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD) + +/** + * @brief Set the TIM Input Capture prescaler on runtime without calling another time HAL_TIM_IC_ConfigChannel() + * function. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __ICPSC__ specifies the Input Capture4 prescaler new value. + * This parameter can be one of the following values: + * @arg TIM_ICPSC_DIV1: no prescaler + * @arg TIM_ICPSC_DIV2: capture is done once every 2 events + * @arg TIM_ICPSC_DIV4: capture is done once every 4 events + * @arg TIM_ICPSC_DIV8: capture is done once every 8 events + * @retval None + */ +#define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__) \ + do{ \ + TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \ + TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \ + } while(0) + +/** + * @brief Get the TIM Input Capture prescaler on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: get input capture 1 prescaler value + * @arg TIM_CHANNEL_2: get input capture 2 prescaler value + * @arg TIM_CHANNEL_3: get input capture 3 prescaler value + * @arg TIM_CHANNEL_4: get input capture 4 prescaler value + * @retval The input capture prescaler can be one of the following values: + * @arg TIM_ICPSC_DIV1: no prescaler + * @arg TIM_ICPSC_DIV2: capture is done once every 2 events + * @arg TIM_ICPSC_DIV4: capture is done once every 4 events + * @arg TIM_ICPSC_DIV8: capture is done once every 8 events + */ +#define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8U) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\ + (((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8U) + +/** + * @brief Set the TIM Capture Compare Register value on runtime without calling another time ConfigChannel function. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __COMPARE__ specifies the Capture Compare register new value. + * @retval None + */ +#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\ + ((__HANDLE__)->Instance->CCR4 = (__COMPARE__))) + +/** + * @brief Get the TIM Capture Compare Register value on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channel associated with the capture compare register + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: get capture/compare 1 register value + * @arg TIM_CHANNEL_2: get capture/compare 2 register value + * @arg TIM_CHANNEL_3: get capture/compare 3 register value + * @arg TIM_CHANNEL_4: get capture/compare 4 register value + * @retval 16-bit or 32-bit value of the capture/compare register (TIMx_CCRy) + */ +#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3) :\ + ((__HANDLE__)->Instance->CCR4)) + +/** + * @brief Set the TIM Output compare preload. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval None + */ +#define __HAL_TIM_ENABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3PE) :\ + ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4PE)) + +/** + * @brief Reset the TIM Output compare preload. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval None + */ +#define __HAL_TIM_DISABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2PE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3PE) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4PE)) + +/** + * @brief Enable fast mode for a given channel. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @note When fast mode is enabled an active edge on the trigger input acts + * like a compare match on CCx output. Delay to sample the trigger + * input and to activate CCx output is reduced to 3 clock cycles. + * @note Fast mode acts only if the channel is configured in PWM1 or PWM2 mode. + * @retval None + */ +#define __HAL_TIM_ENABLE_OCxFAST(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3FE) :\ + ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4FE)) + +/** + * @brief Disable fast mode for a given channel. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @note When fast mode is disabled CCx output behaves normally depending + * on counter and CCRx values even when the trigger is ON. The minimum + * delay to activate CCx output when an active edge occurs on the + * trigger input is 5 clock cycles. + * @retval None + */ +#define __HAL_TIM_DISABLE_OCxFAST(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE)) + +/** + * @brief Set the Update Request Source (URS) bit of the TIMx_CR1 register. + * @param __HANDLE__ TIM handle. + * @note When the URS bit of the TIMx_CR1 register is set, only counter + * overflow/underflow generates an update interrupt or DMA request (if + * enabled) + * @retval None + */ +#define __HAL_TIM_URS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS) + +/** + * @brief Reset the Update Request Source (URS) bit of the TIMx_CR1 register. + * @param __HANDLE__ TIM handle. + * @note When the URS bit of the TIMx_CR1 register is reset, any of the + * following events generate an update interrupt or DMA request (if + * enabled): + * _ Counter overflow underflow + * _ Setting the UG bit + * _ Update generation through the slave mode controller + * @retval None + */ +#define __HAL_TIM_URS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS) + +/** + * @brief Set the TIM Capture x input polarity on runtime. + * @param __HANDLE__ TIM handle. + * @param __CHANNEL__ TIM Channels to be configured. + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param __POLARITY__ Polarity for TIx source + * @arg TIM_INPUTCHANNELPOLARITY_RISING: Rising Edge + * @arg TIM_INPUTCHANNELPOLARITY_FALLING: Falling Edge + * @arg TIM_INPUTCHANNELPOLARITY_BOTHEDGE: Rising and Falling Edge + * @retval None + */ +#define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \ + do{ \ + TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \ + TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \ + }while(0) + +/** + * @} + */ +/* End of exported macros ----------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup TIM_Private_Constants TIM Private Constants + * @{ + */ +/* The counter of a timer instance is disabled only if all the CCx and CCxN + channels have been disabled */ +#define TIM_CCER_CCxE_MASK ((uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E)) +#define TIM_CCER_CCxNE_MASK ((uint32_t)(TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) +/** + * @} + */ +/* End of private constants --------------------------------------------------*/ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup TIM_Private_Macros TIM Private Macros + * @{ + */ +#define IS_TIM_CLEARINPUT_SOURCE(__MODE__) (((__MODE__) == TIM_CLEARINPUTSOURCE_NONE) || \ + ((__MODE__) == TIM_CLEARINPUTSOURCE_ETR)) + +#define IS_TIM_DMA_BASE(__BASE__) (((__BASE__) == TIM_DMABASE_CR1) || \ + ((__BASE__) == TIM_DMABASE_CR2) || \ + ((__BASE__) == TIM_DMABASE_SMCR) || \ + ((__BASE__) == TIM_DMABASE_DIER) || \ + ((__BASE__) == TIM_DMABASE_SR) || \ + ((__BASE__) == TIM_DMABASE_EGR) || \ + ((__BASE__) == TIM_DMABASE_CCMR1) || \ + ((__BASE__) == TIM_DMABASE_CCMR2) || \ + ((__BASE__) == TIM_DMABASE_CCER) || \ + ((__BASE__) == TIM_DMABASE_CNT) || \ + ((__BASE__) == TIM_DMABASE_PSC) || \ + ((__BASE__) == TIM_DMABASE_ARR) || \ + ((__BASE__) == TIM_DMABASE_RCR) || \ + ((__BASE__) == TIM_DMABASE_CCR1) || \ + ((__BASE__) == TIM_DMABASE_CCR2) || \ + ((__BASE__) == TIM_DMABASE_CCR3) || \ + ((__BASE__) == TIM_DMABASE_CCR4) || \ + ((__BASE__) == TIM_DMABASE_BDTR)) + +#define IS_TIM_EVENT_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFFFF00U) == 0x00000000U) && ((__SOURCE__) != 0x00000000U)) + +#define IS_TIM_COUNTER_MODE(__MODE__) (((__MODE__) == TIM_COUNTERMODE_UP) || \ + ((__MODE__) == TIM_COUNTERMODE_DOWN) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED1) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED2) || \ + ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED3)) + +#define IS_TIM_CLOCKDIVISION_DIV(__DIV__) (((__DIV__) == TIM_CLOCKDIVISION_DIV1) || \ + ((__DIV__) == TIM_CLOCKDIVISION_DIV2) || \ + ((__DIV__) == TIM_CLOCKDIVISION_DIV4)) + +#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD) (((PRELOAD) == TIM_AUTORELOAD_PRELOAD_DISABLE) || \ + ((PRELOAD) == TIM_AUTORELOAD_PRELOAD_ENABLE)) + +#define IS_TIM_FAST_STATE(__STATE__) (((__STATE__) == TIM_OCFAST_DISABLE) || \ + ((__STATE__) == TIM_OCFAST_ENABLE)) + +#define IS_TIM_OC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCPOLARITY_HIGH) || \ + ((__POLARITY__) == TIM_OCPOLARITY_LOW)) + +#define IS_TIM_OCN_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCNPOLARITY_HIGH) || \ + ((__POLARITY__) == TIM_OCNPOLARITY_LOW)) + +#define IS_TIM_OCIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCIDLESTATE_SET) || \ + ((__STATE__) == TIM_OCIDLESTATE_RESET)) + +#define IS_TIM_OCNIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCNIDLESTATE_SET) || \ + ((__STATE__) == TIM_OCNIDLESTATE_RESET)) + +#define IS_TIM_ENCODERINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_FALLING)) + +#define IS_TIM_IC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ICPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_ICPOLARITY_FALLING) || \ + ((__POLARITY__) == TIM_ICPOLARITY_BOTHEDGE)) + +#define IS_TIM_IC_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_ICSELECTION_DIRECTTI) || \ + ((__SELECTION__) == TIM_ICSELECTION_INDIRECTTI) || \ + ((__SELECTION__) == TIM_ICSELECTION_TRC)) + +#define IS_TIM_IC_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ICPSC_DIV1) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV2) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV4) || \ + ((__PRESCALER__) == TIM_ICPSC_DIV8)) + +#define IS_TIM_OPM_MODE(__MODE__) (((__MODE__) == TIM_OPMODE_SINGLE) || \ + ((__MODE__) == TIM_OPMODE_REPETITIVE)) + +#define IS_TIM_ENCODER_MODE(__MODE__) (((__MODE__) == TIM_ENCODERMODE_TI1) || \ + ((__MODE__) == TIM_ENCODERMODE_TI2) || \ + ((__MODE__) == TIM_ENCODERMODE_TI12)) + +#define IS_TIM_DMA_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFF80FFU) == 0x00000000U) && ((__SOURCE__) != 0x00000000U)) + +#define IS_TIM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2) || \ + ((__CHANNEL__) == TIM_CHANNEL_3) || \ + ((__CHANNEL__) == TIM_CHANNEL_4) || \ + ((__CHANNEL__) == TIM_CHANNEL_ALL)) + +#define IS_TIM_OPM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2)) + +#define IS_TIM_COMPLEMENTARY_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \ + ((__CHANNEL__) == TIM_CHANNEL_2) || \ + ((__CHANNEL__) == TIM_CHANNEL_3)) + +#define IS_TIM_CLOCKSOURCE(__CLOCK__) (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ITR3) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ + ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1)) + +#define IS_TIM_CLOCKPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLOCKPOLARITY_INVERTED) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_NONINVERTED) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_RISING) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_FALLING) || \ + ((__POLARITY__) == TIM_CLOCKPOLARITY_BOTHEDGE)) + +#define IS_TIM_CLOCKPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV8)) + +#define IS_TIM_CLOCKFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLEARINPUTPOLARITY_INVERTED) || \ + ((__POLARITY__) == TIM_CLEARINPUTPOLARITY_NONINVERTED)) + +#define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV8)) + +#define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_OSSR_STATE(__STATE__) (((__STATE__) == TIM_OSSR_ENABLE) || \ + ((__STATE__) == TIM_OSSR_DISABLE)) + +#define IS_TIM_OSSI_STATE(__STATE__) (((__STATE__) == TIM_OSSI_ENABLE) || \ + ((__STATE__) == TIM_OSSI_DISABLE)) + +#define IS_TIM_LOCK_LEVEL(__LEVEL__) (((__LEVEL__) == TIM_LOCKLEVEL_OFF) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_1) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_2) || \ + ((__LEVEL__) == TIM_LOCKLEVEL_3)) + +#define IS_TIM_BREAK_FILTER(__BRKFILTER__) ((__BRKFILTER__) <= 0xFUL) + + +#define IS_TIM_BREAK_STATE(__STATE__) (((__STATE__) == TIM_BREAK_ENABLE) || \ + ((__STATE__) == TIM_BREAK_DISABLE)) + +#define IS_TIM_BREAK_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKPOLARITY_LOW) || \ + ((__POLARITY__) == TIM_BREAKPOLARITY_HIGH)) + +#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__) (((__STATE__) == TIM_AUTOMATICOUTPUT_ENABLE) || \ + ((__STATE__) == TIM_AUTOMATICOUTPUT_DISABLE)) + +#define IS_TIM_TRGO_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO_RESET) || \ + ((__SOURCE__) == TIM_TRGO_ENABLE) || \ + ((__SOURCE__) == TIM_TRGO_UPDATE) || \ + ((__SOURCE__) == TIM_TRGO_OC1) || \ + ((__SOURCE__) == TIM_TRGO_OC1REF) || \ + ((__SOURCE__) == TIM_TRGO_OC2REF) || \ + ((__SOURCE__) == TIM_TRGO_OC3REF) || \ + ((__SOURCE__) == TIM_TRGO_OC4REF)) + +#define IS_TIM_MSM_STATE(__STATE__) (((__STATE__) == TIM_MASTERSLAVEMODE_ENABLE) || \ + ((__STATE__) == TIM_MASTERSLAVEMODE_DISABLE)) + +#define IS_TIM_SLAVE_MODE(__MODE__) (((__MODE__) == TIM_SLAVEMODE_DISABLE) || \ + ((__MODE__) == TIM_SLAVEMODE_RESET) || \ + ((__MODE__) == TIM_SLAVEMODE_GATED) || \ + ((__MODE__) == TIM_SLAVEMODE_TRIGGER) || \ + ((__MODE__) == TIM_SLAVEMODE_EXTERNAL1)) + +#define IS_TIM_PWM_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_PWM1) || \ + ((__MODE__) == TIM_OCMODE_PWM2)) + +#define IS_TIM_OC_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_TIMING) || \ + ((__MODE__) == TIM_OCMODE_ACTIVE) || \ + ((__MODE__) == TIM_OCMODE_INACTIVE) || \ + ((__MODE__) == TIM_OCMODE_TOGGLE) || \ + ((__MODE__) == TIM_OCMODE_FORCED_ACTIVE) || \ + ((__MODE__) == TIM_OCMODE_FORCED_INACTIVE)) + +#define IS_TIM_TRIGGER_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \ + ((__SELECTION__) == TIM_TS_ITR1) || \ + ((__SELECTION__) == TIM_TS_ITR2) || \ + ((__SELECTION__) == TIM_TS_ITR3) || \ + ((__SELECTION__) == TIM_TS_TI1F_ED) || \ + ((__SELECTION__) == TIM_TS_TI1FP1) || \ + ((__SELECTION__) == TIM_TS_TI2FP2) || \ + ((__SELECTION__) == TIM_TS_ETRF)) + +#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \ + ((__SELECTION__) == TIM_TS_ITR1) || \ + ((__SELECTION__) == TIM_TS_ITR2) || \ + ((__SELECTION__) == TIM_TS_ITR3) || \ + ((__SELECTION__) == TIM_TS_NONE)) + +#define IS_TIM_TRIGGERPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_TRIGGERPOLARITY_INVERTED ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_NONINVERTED) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_RISING ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_FALLING ) || \ + ((__POLARITY__) == TIM_TRIGGERPOLARITY_BOTHEDGE )) + +#define IS_TIM_TRIGGERPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV1) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV2) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV4) || \ + ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV8)) + +#define IS_TIM_TRIGGERFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_TI1SELECTION(__TI1SELECTION__) (((__TI1SELECTION__) == TIM_TI1SELECTION_CH1) || \ + ((__TI1SELECTION__) == TIM_TI1SELECTION_XORCOMBINATION)) + +#define IS_TIM_DMA_LENGTH(__LENGTH__) (((__LENGTH__) == TIM_DMABURSTLENGTH_1TRANSFER) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_2TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_3TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_4TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_5TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_6TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_7TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_8TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_9TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_10TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_11TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_12TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_13TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_14TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_15TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_16TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_17TRANSFERS) || \ + ((__LENGTH__) == TIM_DMABURSTLENGTH_18TRANSFERS)) + +#define IS_TIM_DMA_DATA_LENGTH(LENGTH) (((LENGTH) >= 0x1U) && ((LENGTH) < 0x10000U)) + +#define IS_TIM_IC_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU) + +#define IS_TIM_DEADTIME(__DEADTIME__) ((__DEADTIME__) <= 0xFFU) + +#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__) ((__TRIGGER__) == TIM_SLAVEMODE_TRIGGER) + +#define TIM_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= (__ICPSC__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= ((__ICPSC__) << 8U)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= (__ICPSC__)) :\ + ((__HANDLE__)->Instance->CCMR2 |= ((__ICPSC__) << 8U))) + +#define TIM_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC) :\ + ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC)) + +#define TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER |= (__POLARITY__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 4U)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 8U)) :\ + ((__HANDLE__)->Instance->CCER |= (((__POLARITY__) << 12U)))) + +#define TIM_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC3P)) :\ + ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC4P))) + +#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)\ + (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelState[0] :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelState[1] :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelState[2] :\ + (__HANDLE__)->ChannelState[3]) + +#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelState[0] = (__CHANNEL_STATE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelState[1] = (__CHANNEL_STATE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelState[2] = (__CHANNEL_STATE__)) :\ + ((__HANDLE__)->ChannelState[3] = (__CHANNEL_STATE__))) + +#define TIM_CHANNEL_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \ + (__HANDLE__)->ChannelState[0] = (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelState[1] = (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelState[2] = (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelState[3] = (__CHANNEL_STATE__); \ + } while(0) + +#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)\ + (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelNState[0] :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelNState[1] :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelNState[2] :\ + (__HANDLE__)->ChannelNState[3]) + +#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \ + (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelNState[0] = (__CHANNEL_STATE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelNState[1] = (__CHANNEL_STATE__)) :\ + ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelNState[2] = (__CHANNEL_STATE__)) :\ + ((__HANDLE__)->ChannelNState[3] = (__CHANNEL_STATE__))) + +#define TIM_CHANNEL_N_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \ + (__HANDLE__)->ChannelNState[0] = \ + (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelNState[1] = \ + (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelNState[2] = \ + (__CHANNEL_STATE__); \ + (__HANDLE__)->ChannelNState[3] = \ + (__CHANNEL_STATE__); \ + } while(0) + +/** + * @} + */ +/* End of private macros -----------------------------------------------------*/ + +/* Include TIM HAL Extended module */ +#include "stm32f1xx_hal_tim_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIM_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @addtogroup TIM_Exported_Functions_Group1 TIM Time Base functions + * @brief Time Base functions + * @{ + */ +/* Time Base functions ********************************************************/ +HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group2 TIM Output Compare functions + * @brief TIM Output Compare functions + * @{ + */ +/* Timer Output Compare functions *********************************************/ +HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group3 TIM PWM functions + * @brief TIM PWM functions + * @{ + */ +/* Timer PWM functions ********************************************************/ +HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group4 TIM Input Capture functions + * @brief TIM Input Capture functions + * @{ + */ +/* Timer Input Capture functions **********************************************/ +HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group5 TIM One Pulse functions + * @brief TIM One Pulse functions + * @{ + */ +/* Timer One Pulse functions **************************************************/ +HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode); +HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group6 TIM Encoder functions + * @brief TIM Encoder functions + * @{ + */ +/* Timer Encoder functions ****************************************************/ +HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig); +HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim); +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, + uint32_t *pData2, uint16_t Length); +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIM_Exported_Functions_Group7 TIM IRQ handler management + * @brief IRQ handler management + * @{ + */ +/* Interrupt Handler functions ***********************************************/ +void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group8 TIM Peripheral Control functions + * @brief Peripheral Control functions + * @{ + */ +/* Control functions *********************************************************/ +HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, + uint32_t OutputChannel, uint32_t InputChannel); +HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef *sClearInputConfig, + uint32_t Channel); +HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig); +HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection); +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig); +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig); +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, + uint32_t BurstLength, uint32_t DataLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc); +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, + uint32_t BurstLength, uint32_t DataLength); +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc); +HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource); +uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group9 TIM Callbacks functions + * @brief TIM Callbacks functions + * @{ + */ +/* Callback in non blocking modes (Interrupt and DMA) *************************/ +void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim); + +/* Callbacks Register/UnRegister functions ***********************************/ +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, + pTIM_CallbackTypeDef pCallback); +HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group10 TIM Peripheral State functions + * @brief Peripheral State functions + * @{ + */ +/* Peripheral State functions ************************************************/ +HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim); + +/* Peripheral Channel state functions ************************************************/ +HAL_TIM_ActiveChannel HAL_TIM_GetActiveChannel(TIM_HandleTypeDef *htim); +HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** + * @} + */ +/* End of exported functions -------------------------------------------------*/ + +/* Private functions----------------------------------------------------------*/ +/** @defgroup TIM_Private_Functions TIM Private Functions + * @{ + */ +void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure); +void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter); +void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, + uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter); + +void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma); +void TIM_DMAError(DMA_HandleTypeDef *hdma); +void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma); +void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma); +void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +void TIM_ResetCallback(TIM_HandleTypeDef *htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ +/* End of private functions --------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_HAL_TIM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h new file mode 100644 index 0000000..1979d73 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h @@ -0,0 +1,262 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_tim_ex.h + * @author MCD Application Team + * @brief Header file of TIM HAL Extended module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_HAL_TIM_EX_H +#define STM32F1xx_HAL_TIM_EX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal_def.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup TIMEx + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Types TIM Extended Exported Types + * @{ + */ + +/** + * @brief TIM Hall sensor Configuration Structure definition + */ + +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 */ + + 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 */ +} TIM_HallSensor_InitTypeDef; +/** + * @} + */ +/* End of exported types -----------------------------------------------------*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants + * @{ + */ + +/** @defgroup TIMEx_Remap TIM Extended Remapping + * @{ + */ +/** + * @} + */ + +/** + * @} + */ +/* End of exported constants -------------------------------------------------*/ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros + * @{ + */ + +/** + * @} + */ +/* End of exported macro -----------------------------------------------------*/ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup TIMEx_Private_Macros TIM Extended Private Macros + * @{ + */ + +/** + * @} + */ +/* End of private macro ------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions + * @{ + */ + +/** @addtogroup TIMEx_Exported_Functions_Group1 Extended 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_DeInit(TIM_HandleTypeDef *htim); + +void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); +void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); + +/* 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 */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim); +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); +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 + * @{ + */ +/* Timer Complementary Output Compare functions *****************************/ +/* Blocking mode: Polling */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group3 Extended 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); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); +/* Non-Blocking mode: DMA */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group4 Extended 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); +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); + +/* Non-Blocking mode: Interrupt */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions + * @brief Peripheral Control functions + * @{ + */ +/* Extended Control functions ************************************************/ +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); +HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions + * @brief Extended Callbacks functions + * @{ + */ +/* Extended Callback **********************************************************/ +void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); +void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); +void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); +/** + * @} + */ + +/** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions + * @brief Extended Peripheral State functions + * @{ + */ +/* Extended Peripheral State functions ***************************************/ +HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim); +HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN); +/** + * @} + */ + +/** + * @} + */ +/* End of exported functions -------------------------------------------------*/ + +/* 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 --------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif /* STM32F1xx_HAL_TIM_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h new file mode 100644 index 0000000..8857920 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h @@ -0,0 +1,1015 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_bus.h + * @author MCD Application Team + * @brief Header file of BUS LL module. + + @verbatim + ##### RCC Limitations ##### + ============================================================================== + [..] + A delay between an RCC peripheral clock enable and the effective peripheral + enabling should be taken into account in order to manage the peripheral read/write + from/to registers. + (+) This delay depends on the peripheral mapping. + (++) AHB & APB peripherals, 1 dummy read is necessary + + [..] + Workarounds: + (#) For AHB & APB peripherals, a dummy read to the peripheral register has been + inserted in each LL_{BUS}_GRP{x}_EnableClock() function. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_BUS_H +#define __STM32F1xx_LL_BUS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @defgroup BUS_LL BUS + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +#if defined(RCC_AHBRSTR_OTGFSRST) || defined(RCC_AHBRSTR_ETHMACRST) +#define RCC_AHBRSTR_SUPPORT +#endif /* RCC_AHBRSTR_OTGFSRST || RCC_AHBRSTR_ETHMACRST */ + +/* Private macros ------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup BUS_LL_Exported_Constants BUS Exported Constants + * @{ + */ + +/** @defgroup BUS_LL_EC_AHB1_GRP1_PERIPH AHB1 GRP1 PERIPH + * @{ + */ +#define LL_AHB1_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU +#define LL_AHB1_GRP1_PERIPH_CRC RCC_AHBENR_CRCEN +#define LL_AHB1_GRP1_PERIPH_DMA1 RCC_AHBENR_DMA1EN +#if defined(DMA2) +#define LL_AHB1_GRP1_PERIPH_DMA2 RCC_AHBENR_DMA2EN +#endif /*DMA2*/ +#if defined(ETH) +#define LL_AHB1_GRP1_PERIPH_ETHMAC RCC_AHBENR_ETHMACEN +#define LL_AHB1_GRP1_PERIPH_ETHMACRX RCC_AHBENR_ETHMACRXEN +#define LL_AHB1_GRP1_PERIPH_ETHMACTX RCC_AHBENR_ETHMACTXEN +#endif /*ETH*/ +#define LL_AHB1_GRP1_PERIPH_FLASH RCC_AHBENR_FLITFEN +#if defined(FSMC_Bank1) +#define LL_AHB1_GRP1_PERIPH_FSMC RCC_AHBENR_FSMCEN +#endif /*FSMC_Bank1*/ +#if defined(USB_OTG_FS) +#define LL_AHB1_GRP1_PERIPH_OTGFS RCC_AHBENR_OTGFSEN +#endif /*USB_OTG_FS*/ +#if defined(SDIO) +#define LL_AHB1_GRP1_PERIPH_SDIO RCC_AHBENR_SDIOEN +#endif /*SDIO*/ +#define LL_AHB1_GRP1_PERIPH_SRAM RCC_AHBENR_SRAMEN +/** + * @} + */ + +/** @defgroup BUS_LL_EC_APB1_GRP1_PERIPH APB1 GRP1 PERIPH + * @{ + */ +#define LL_APB1_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU +#define LL_APB1_GRP1_PERIPH_BKP RCC_APB1ENR_BKPEN +#if defined(CAN1) +#define LL_APB1_GRP1_PERIPH_CAN1 RCC_APB1ENR_CAN1EN +#endif /*CAN1*/ +#if defined(CAN2) +#define LL_APB1_GRP1_PERIPH_CAN2 RCC_APB1ENR_CAN2EN +#endif /*CAN2*/ +#if defined(CEC) +#define LL_APB1_GRP1_PERIPH_CEC RCC_APB1ENR_CECEN +#endif /*CEC*/ +#if defined(DAC) +#define LL_APB1_GRP1_PERIPH_DAC1 RCC_APB1ENR_DACEN +#endif /*DAC*/ +#define LL_APB1_GRP1_PERIPH_I2C1 RCC_APB1ENR_I2C1EN +#if defined(I2C2) +#define LL_APB1_GRP1_PERIPH_I2C2 RCC_APB1ENR_I2C2EN +#endif /*I2C2*/ +#define LL_APB1_GRP1_PERIPH_PWR RCC_APB1ENR_PWREN +#if defined(SPI2) +#define LL_APB1_GRP1_PERIPH_SPI2 RCC_APB1ENR_SPI2EN +#endif /*SPI2*/ +#if defined(SPI3) +#define LL_APB1_GRP1_PERIPH_SPI3 RCC_APB1ENR_SPI3EN +#endif /*SPI3*/ +#if defined(TIM12) +#define LL_APB1_GRP1_PERIPH_TIM12 RCC_APB1ENR_TIM12EN +#endif /*TIM12*/ +#if defined(TIM13) +#define LL_APB1_GRP1_PERIPH_TIM13 RCC_APB1ENR_TIM13EN +#endif /*TIM13*/ +#if defined(TIM14) +#define LL_APB1_GRP1_PERIPH_TIM14 RCC_APB1ENR_TIM14EN +#endif /*TIM14*/ +#define LL_APB1_GRP1_PERIPH_TIM2 RCC_APB1ENR_TIM2EN +#define LL_APB1_GRP1_PERIPH_TIM3 RCC_APB1ENR_TIM3EN +#if defined(TIM4) +#define LL_APB1_GRP1_PERIPH_TIM4 RCC_APB1ENR_TIM4EN +#endif /*TIM4*/ +#if defined(TIM5) +#define LL_APB1_GRP1_PERIPH_TIM5 RCC_APB1ENR_TIM5EN +#endif /*TIM5*/ +#if defined(TIM6) +#define LL_APB1_GRP1_PERIPH_TIM6 RCC_APB1ENR_TIM6EN +#endif /*TIM6*/ +#if defined(TIM7) +#define LL_APB1_GRP1_PERIPH_TIM7 RCC_APB1ENR_TIM7EN +#endif /*TIM7*/ +#if defined(UART4) +#define LL_APB1_GRP1_PERIPH_UART4 RCC_APB1ENR_UART4EN +#endif /*UART4*/ +#if defined(UART5) +#define LL_APB1_GRP1_PERIPH_UART5 RCC_APB1ENR_UART5EN +#endif /*UART5*/ +#define LL_APB1_GRP1_PERIPH_USART2 RCC_APB1ENR_USART2EN +#if defined(USART3) +#define LL_APB1_GRP1_PERIPH_USART3 RCC_APB1ENR_USART3EN +#endif /*USART3*/ +#if defined(USB) +#define LL_APB1_GRP1_PERIPH_USB RCC_APB1ENR_USBEN +#endif /*USB*/ +#define LL_APB1_GRP1_PERIPH_WWDG RCC_APB1ENR_WWDGEN +/** + * @} + */ + +/** @defgroup BUS_LL_EC_APB2_GRP1_PERIPH APB2 GRP1 PERIPH + * @{ + */ +#define LL_APB2_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU +#define LL_APB2_GRP1_PERIPH_ADC1 RCC_APB2ENR_ADC1EN +#if defined(ADC2) +#define LL_APB2_GRP1_PERIPH_ADC2 RCC_APB2ENR_ADC2EN +#endif /*ADC2*/ +#if defined(ADC3) +#define LL_APB2_GRP1_PERIPH_ADC3 RCC_APB2ENR_ADC3EN +#endif /*ADC3*/ +#define LL_APB2_GRP1_PERIPH_AFIO RCC_APB2ENR_AFIOEN +#define LL_APB2_GRP1_PERIPH_GPIOA RCC_APB2ENR_IOPAEN +#define LL_APB2_GRP1_PERIPH_GPIOB RCC_APB2ENR_IOPBEN +#define LL_APB2_GRP1_PERIPH_GPIOC RCC_APB2ENR_IOPCEN +#define LL_APB2_GRP1_PERIPH_GPIOD RCC_APB2ENR_IOPDEN +#if defined(GPIOE) +#define LL_APB2_GRP1_PERIPH_GPIOE RCC_APB2ENR_IOPEEN +#endif /*GPIOE*/ +#if defined(GPIOF) +#define LL_APB2_GRP1_PERIPH_GPIOF RCC_APB2ENR_IOPFEN +#endif /*GPIOF*/ +#if defined(GPIOG) +#define LL_APB2_GRP1_PERIPH_GPIOG RCC_APB2ENR_IOPGEN +#endif /*GPIOG*/ +#define LL_APB2_GRP1_PERIPH_SPI1 RCC_APB2ENR_SPI1EN +#if defined(TIM10) +#define LL_APB2_GRP1_PERIPH_TIM10 RCC_APB2ENR_TIM10EN +#endif /*TIM10*/ +#if defined(TIM11) +#define LL_APB2_GRP1_PERIPH_TIM11 RCC_APB2ENR_TIM11EN +#endif /*TIM11*/ +#if defined(TIM15) +#define LL_APB2_GRP1_PERIPH_TIM15 RCC_APB2ENR_TIM15EN +#endif /*TIM15*/ +#if defined(TIM16) +#define LL_APB2_GRP1_PERIPH_TIM16 RCC_APB2ENR_TIM16EN +#endif /*TIM16*/ +#if defined(TIM17) +#define LL_APB2_GRP1_PERIPH_TIM17 RCC_APB2ENR_TIM17EN +#endif /*TIM17*/ +#define LL_APB2_GRP1_PERIPH_TIM1 RCC_APB2ENR_TIM1EN +#if defined(TIM8) +#define LL_APB2_GRP1_PERIPH_TIM8 RCC_APB2ENR_TIM8EN +#endif /*TIM8*/ +#if defined(TIM9) +#define LL_APB2_GRP1_PERIPH_TIM9 RCC_APB2ENR_TIM9EN +#endif /*TIM9*/ +#define LL_APB2_GRP1_PERIPH_USART1 RCC_APB2ENR_USART1EN +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup BUS_LL_Exported_Functions BUS Exported Functions + * @{ + */ + +/** @defgroup BUS_LL_EF_AHB1 AHB1 + * @{ + */ + +/** + * @brief Enable AHB1 peripherals clock. + * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_EnableClock\n + * AHBENR DMA1EN LL_AHB1_GRP1_EnableClock\n + * AHBENR DMA2EN LL_AHB1_GRP1_EnableClock\n + * AHBENR ETHMACEN LL_AHB1_GRP1_EnableClock\n + * AHBENR ETHMACRXEN LL_AHB1_GRP1_EnableClock\n + * AHBENR ETHMACTXEN LL_AHB1_GRP1_EnableClock\n + * AHBENR FLITFEN LL_AHB1_GRP1_EnableClock\n + * AHBENR FSMCEN LL_AHB1_GRP1_EnableClock\n + * AHBENR OTGFSEN LL_AHB1_GRP1_EnableClock\n + * AHBENR SDIOEN LL_AHB1_GRP1_EnableClock\n + * AHBENR SRAMEN LL_AHB1_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH + * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->AHBENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->AHBENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if AHB1 peripheral clock is enabled or not + * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR DMA1EN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR DMA2EN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR ETHMACEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR ETHMACRXEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR ETHMACTXEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR FLITFEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR FSMCEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR OTGFSEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR SDIOEN LL_AHB1_GRP1_IsEnabledClock\n + * AHBENR SRAMEN LL_AHB1_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH + * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->AHBENR, Periphs) == Periphs); +} + +/** + * @brief Disable AHB1 peripherals clock. + * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_DisableClock\n + * AHBENR DMA1EN LL_AHB1_GRP1_DisableClock\n + * AHBENR DMA2EN LL_AHB1_GRP1_DisableClock\n + * AHBENR ETHMACEN LL_AHB1_GRP1_DisableClock\n + * AHBENR ETHMACRXEN LL_AHB1_GRP1_DisableClock\n + * AHBENR ETHMACTXEN LL_AHB1_GRP1_DisableClock\n + * AHBENR FLITFEN LL_AHB1_GRP1_DisableClock\n + * AHBENR FSMCEN LL_AHB1_GRP1_DisableClock\n + * AHBENR OTGFSEN LL_AHB1_GRP1_DisableClock\n + * AHBENR SDIOEN LL_AHB1_GRP1_DisableClock\n + * AHBENR SRAMEN LL_AHB1_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_CRC + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1 + * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH + * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHBENR, Periphs); +} + +#if defined(RCC_AHBRSTR_SUPPORT) +/** + * @brief Force AHB1 peripherals reset. + * @rmtoll AHBRSTR ETHMACRST LL_AHB1_GRP1_ForceReset\n + * AHBRSTR OTGFSRST LL_AHB1_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_ALL + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->AHBRSTR, Periphs); +} + +/** + * @brief Release AHB1 peripherals reset. + * @rmtoll AHBRSTR ETHMACRST LL_AHB1_GRP1_ReleaseReset\n + * AHBRSTR OTGFSRST LL_AHB1_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_AHB1_GRP1_PERIPH_ALL + * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*) + * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*) + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->AHBRSTR, Periphs); +} +#endif /* RCC_AHBRSTR_SUPPORT */ + +/** + * @} + */ + +/** @defgroup BUS_LL_EF_APB1 APB1 + * @{ + */ + +/** + * @brief Enable APB1 peripherals clock. + * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_EnableClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR CECEN LL_APB1_GRP1_EnableClock\n + * APB1ENR DACEN LL_APB1_GRP1_EnableClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_EnableClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR PWREN LL_APB1_GRP1_EnableClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_EnableClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART4EN LL_APB1_GRP1_EnableClock\n + * APB1ENR UART5EN LL_APB1_GRP1_EnableClock\n + * APB1ENR USART2EN LL_APB1_GRP1_EnableClock\n + * APB1ENR USART3EN LL_APB1_GRP1_EnableClock\n + * APB1ENR USBEN LL_APB1_GRP1_EnableClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_BKP + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USB (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB1ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB1ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if APB1 peripheral clock is enabled or not + * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR CECEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR DACEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR PWREN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART4EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR UART5EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR USART2EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR USART3EN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR USBEN LL_APB1_GRP1_IsEnabledClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_BKP + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USB (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_APB1_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->APB1ENR, Periphs) == Periphs); +} + +/** + * @brief Disable APB1 peripherals clock. + * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_DisableClock\n + * APB1ENR CAN1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CAN2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR CECEN LL_APB1_GRP1_DisableClock\n + * APB1ENR DACEN LL_APB1_GRP1_DisableClock\n + * APB1ENR I2C1EN LL_APB1_GRP1_DisableClock\n + * APB1ENR I2C2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR PWREN LL_APB1_GRP1_DisableClock\n + * APB1ENR SPI2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR SPI3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM12EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM13EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM14EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM4EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM5EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM6EN LL_APB1_GRP1_DisableClock\n + * APB1ENR TIM7EN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART4EN LL_APB1_GRP1_DisableClock\n + * APB1ENR UART5EN LL_APB1_GRP1_DisableClock\n + * APB1ENR USART2EN LL_APB1_GRP1_DisableClock\n + * APB1ENR USART3EN LL_APB1_GRP1_DisableClock\n + * APB1ENR USBEN LL_APB1_GRP1_DisableClock\n + * APB1ENR WWDGEN LL_APB1_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_BKP + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USB (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB1ENR, Periphs); +} + +/** + * @brief Force APB1 peripherals reset. + * @rmtoll APB1RSTR BKPRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CAN1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CAN2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR CECRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR DACRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR I2C1RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR I2C2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR PWRRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR SPI2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR SPI3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM12RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM13RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM14RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM4RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM5RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM6RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR TIM7RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART4RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR UART5RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR USART2RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR USART3RST LL_APB1_GRP1_ForceReset\n + * APB1RSTR USBRST LL_APB1_GRP1_ForceReset\n + * APB1RSTR WWDGRST LL_APB1_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_ALL + * @arg @ref LL_APB1_GRP1_PERIPH_BKP + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USB (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->APB1RSTR, Periphs); +} + +/** + * @brief Release APB1 peripherals reset. + * @rmtoll APB1RSTR BKPRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CAN1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CAN2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR CECRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR DACRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR I2C1RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR I2C2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR PWRRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR SPI2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR SPI3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM12RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM13RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM14RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM4RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM5RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM6RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR TIM7RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART4RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR UART5RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR USART2RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR USART3RST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR USBRST LL_APB1_GRP1_ReleaseReset\n + * APB1RSTR WWDGRST LL_APB1_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB1_GRP1_PERIPH_ALL + * @arg @ref LL_APB1_GRP1_PERIPH_BKP + * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*) + * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_I2C1 + * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_PWR + * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM3 + * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USART2 + * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*) + * @arg @ref LL_APB1_GRP1_PERIPH_USB (*) + * @arg @ref LL_APB1_GRP1_PERIPH_WWDG + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB1RSTR, Periphs); +} + +/** + * @} + */ + +/** @defgroup BUS_LL_EF_APB2 APB2 + * @{ + */ + +/** + * @brief Enable APB2 peripherals clock. + * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_EnableClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_EnableClock\n + * APB2ENR AFIOEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPAEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPBEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPCEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPDEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPEEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPFEN LL_APB2_GRP1_EnableClock\n + * APB2ENR IOPGEN LL_APB2_GRP1_EnableClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM15EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM16EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM17EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM1EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_EnableClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_EnableClock\n + * APB2ENR USART1EN LL_APB2_GRP1_EnableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_AFIO + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_EnableClock(uint32_t Periphs) +{ + __IO uint32_t tmpreg; + SET_BIT(RCC->APB2ENR, Periphs); + /* Delay after an RCC peripheral clock enabling */ + tmpreg = READ_BIT(RCC->APB2ENR, Periphs); + (void)tmpreg; +} + +/** + * @brief Check if APB2 peripheral clock is enabled or not + * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR AFIOEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPAEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPBEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPCEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPDEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPEEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPFEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR IOPGEN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM15EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM16EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM17EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM1EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_IsEnabledClock\n + * APB2ENR USART1EN LL_APB2_GRP1_IsEnabledClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_AFIO + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * + * (*) value not defined in all devices. + * @retval State of Periphs (1 or 0). +*/ +__STATIC_INLINE uint32_t LL_APB2_GRP1_IsEnabledClock(uint32_t Periphs) +{ + return (READ_BIT(RCC->APB2ENR, Periphs) == Periphs); +} + +/** + * @brief Disable APB2 peripherals clock. + * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR ADC2EN LL_APB2_GRP1_DisableClock\n + * APB2ENR ADC3EN LL_APB2_GRP1_DisableClock\n + * APB2ENR AFIOEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPAEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPBEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPCEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPDEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPEEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPFEN LL_APB2_GRP1_DisableClock\n + * APB2ENR IOPGEN LL_APB2_GRP1_DisableClock\n + * APB2ENR SPI1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM10EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM11EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM15EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM16EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM17EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM1EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM8EN LL_APB2_GRP1_DisableClock\n + * APB2ENR TIM9EN LL_APB2_GRP1_DisableClock\n + * APB2ENR USART1EN LL_APB2_GRP1_DisableClock + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_AFIO + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_DisableClock(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB2ENR, Periphs); +} + +/** + * @brief Force APB2 peripherals reset. + * @rmtoll APB2RSTR ADC1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR ADC2RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR ADC3RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR AFIORST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPARST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPBRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPCRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPDRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPERST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPFRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR IOPGRST LL_APB2_GRP1_ForceReset\n + * APB2RSTR SPI1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM10RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM11RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM15RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM16RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM17RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM1RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM8RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR TIM9RST LL_APB2_GRP1_ForceReset\n + * APB2RSTR USART1RST LL_APB2_GRP1_ForceReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ALL + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_AFIO + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_ForceReset(uint32_t Periphs) +{ + SET_BIT(RCC->APB2RSTR, Periphs); +} + +/** + * @brief Release APB2 peripherals reset. + * @rmtoll APB2RSTR ADC1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR ADC2RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR ADC3RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR AFIORST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPARST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPBRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPCRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPDRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPERST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPFRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR IOPGRST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR SPI1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM10RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM11RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM15RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM16RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM17RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM1RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM8RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR TIM9RST LL_APB2_GRP1_ReleaseReset\n + * APB2RSTR USART1RST LL_APB2_GRP1_ReleaseReset + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_APB2_GRP1_PERIPH_ALL + * @arg @ref LL_APB2_GRP1_PERIPH_ADC1 + * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_AFIO + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*) + * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*) + * @arg @ref LL_APB2_GRP1_PERIPH_SPI1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM1 + * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*) + * @arg @ref LL_APB2_GRP1_PERIPH_USART1 + * + * (*) value not defined in all devices. + * @retval None +*/ +__STATIC_INLINE void LL_APB2_GRP1_ReleaseReset(uint32_t Periphs) +{ + CLEAR_BIT(RCC->APB2RSTR, Periphs); +} + +/** + * @} + */ + + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(RCC) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_BUS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h new file mode 100644 index 0000000..a1444a8 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h @@ -0,0 +1,640 @@ +/** + ****************************************************************************** + * @file stm32f1xx_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 + (MPU services provided only on some devices) + (+) API to access to MCU info (CPUID register) + (+) API to enable fault handler (SHCSR accesses) + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_CORTEX_H +#define __STM32F1xx_LL_CORTEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_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 0x00000000U /*!< 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 0x00000000U /*!< 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 0x00U /*!< REGION Number 0 */ +#define LL_MPU_REGION_NUMBER1 0x01U /*!< REGION Number 1 */ +#define LL_MPU_REGION_NUMBER2 0x02U /*!< REGION Number 2 */ +#define LL_MPU_REGION_NUMBER3 0x03U /*!< REGION Number 3 */ +#define LL_MPU_REGION_NUMBER4 0x04U /*!< REGION Number 4 */ +#define LL_MPU_REGION_NUMBER5 0x05U /*!< REGION Number 5 */ +#define LL_MPU_REGION_NUMBER6 0x06U /*!< REGION Number 6 */ +#define LL_MPU_REGION_NUMBER7 0x07U /*!< REGION Number 7 */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_REGION_SIZE MPU Region Size + * @{ + */ +#define LL_MPU_REGION_SIZE_32B (0x04U << MPU_RASR_SIZE_Pos) /*!< 32B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64B (0x05U << MPU_RASR_SIZE_Pos) /*!< 64B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128B (0x06U << MPU_RASR_SIZE_Pos) /*!< 128B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256B (0x07U << MPU_RASR_SIZE_Pos) /*!< 256B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512B (0x08U << MPU_RASR_SIZE_Pos) /*!< 512B Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1KB (0x09U << MPU_RASR_SIZE_Pos) /*!< 1KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2KB (0x0AU << MPU_RASR_SIZE_Pos) /*!< 2KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4KB (0x0BU << MPU_RASR_SIZE_Pos) /*!< 4KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_8KB (0x0CU << MPU_RASR_SIZE_Pos) /*!< 8KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_16KB (0x0DU << MPU_RASR_SIZE_Pos) /*!< 16KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_32KB (0x0EU << MPU_RASR_SIZE_Pos) /*!< 32KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64KB (0x0FU << MPU_RASR_SIZE_Pos) /*!< 64KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128KB (0x10U << MPU_RASR_SIZE_Pos) /*!< 128KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256KB (0x11U << MPU_RASR_SIZE_Pos) /*!< 256KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512KB (0x12U << MPU_RASR_SIZE_Pos) /*!< 512KB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1MB (0x13U << MPU_RASR_SIZE_Pos) /*!< 1MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2MB (0x14U << MPU_RASR_SIZE_Pos) /*!< 2MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4MB (0x15U << MPU_RASR_SIZE_Pos) /*!< 4MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_8MB (0x16U << MPU_RASR_SIZE_Pos) /*!< 8MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_16MB (0x17U << MPU_RASR_SIZE_Pos) /*!< 16MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_32MB (0x18U << MPU_RASR_SIZE_Pos) /*!< 32MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_64MB (0x19U << MPU_RASR_SIZE_Pos) /*!< 64MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_128MB (0x1AU << MPU_RASR_SIZE_Pos) /*!< 128MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_256MB (0x1BU << MPU_RASR_SIZE_Pos) /*!< 256MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_512MB (0x1CU << MPU_RASR_SIZE_Pos) /*!< 512MB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_1GB (0x1DU << MPU_RASR_SIZE_Pos) /*!< 1GB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_2GB (0x1EU << MPU_RASR_SIZE_Pos) /*!< 2GB Size of the MPU protection region */ +#define LL_MPU_REGION_SIZE_4GB (0x1FU << 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 (0x00U << MPU_RASR_AP_Pos) /*!< No access*/ +#define LL_MPU_REGION_PRIV_RW (0x01U << MPU_RASR_AP_Pos) /*!< RW privileged (privileged access only)*/ +#define LL_MPU_REGION_PRIV_RW_URO (0x02U << MPU_RASR_AP_Pos) /*!< RW privileged - RO user (Write in a user program generates a fault) */ +#define LL_MPU_REGION_FULL_ACCESS (0x03U << MPU_RASR_AP_Pos) /*!< RW privileged & user (Full access) */ +#define LL_MPU_REGION_PRIV_RO (0x05U << MPU_RASR_AP_Pos) /*!< RO privileged (privileged read only)*/ +#define LL_MPU_REGION_PRIV_RO_URO (0x06U << MPU_RASR_AP_Pos) /*!< RO privileged & user (read only) */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_TEX MPU TEX Level + * @{ + */ +#define LL_MPU_TEX_LEVEL0 (0x00U << MPU_RASR_TEX_Pos) /*!< b000 for TEX bits */ +#define LL_MPU_TEX_LEVEL1 (0x01U << MPU_RASR_TEX_Pos) /*!< b001 for TEX bits */ +#define LL_MPU_TEX_LEVEL2 (0x02U << MPU_RASR_TEX_Pos) /*!< b010 for TEX bits */ +#define LL_MPU_TEX_LEVEL4 (0x04U << MPU_RASR_TEX_Pos) /*!< b100 for TEX bits */ +/** + * @} + */ + +/** @defgroup CORTEX_LL_EC_INSTRUCTION_ACCESS MPU Instruction Access + * @{ + */ +#define LL_MPU_INSTRUCTION_ACCESS_ENABLE 0x00U /*!< 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 0x00U /*!< 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 0x00U /*!< 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 0x00U /*!< 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)); +} + +/** + * @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) +{ + if (Source == LL_SYSTICK_CLKSOURCE_HCLK) + { + SET_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK); + } + else + { + CLEAR_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK); + } +} + +/** + * @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 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)); +} + +/** + * @} + */ + +/** @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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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, ((uint32_t)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 (0x1: revision 1, 0x2: revision 2) + */ +__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-M3 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 0xC23 for Cortex-M3 + */ +__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 (0x0: patch 0, 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)); +} + +/** + * @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 + * @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 + * @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 + * @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 + * @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 /* __STM32F1xx_LL_CORTEX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h new file mode 100644 index 0000000..e205066 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h @@ -0,0 +1,1960 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_dma.h + * @author MCD Application Team + * @brief Header file of DMA LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_DMA_H +#define __STM32F1xx_LL_DMA_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (DMA1) || defined (DMA2) + +/** @defgroup DMA_LL DMA + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup DMA_LL_Private_Variables DMA Private Variables + * @{ + */ +/* Array used to get the DMA channel register offset versus channel index LL_DMA_CHANNEL_x */ +static const uint8_t CHANNEL_OFFSET_TAB[] = +{ + (uint8_t)(DMA1_Channel1_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel2_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel3_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel4_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel5_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel6_BASE - DMA1_BASE), + (uint8_t)(DMA1_Channel7_BASE - DMA1_BASE) +}; +/** + * @} + */ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup DMA_LL_Private_Macros DMA Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup DMA_LL_ES_INIT DMA Exported Init structure + * @{ + */ +typedef struct +{ + uint32_t PeriphOrM2MSrcAddress; /*!< Specifies the peripheral base address for DMA transfer + or as Source base address in case of memory to memory transfer direction. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t MemoryOrM2MDstAddress; /*!< Specifies the memory base address for DMA transfer + or as Destination base address in case of memory to memory transfer direction. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory. + This parameter can be a value of @ref DMA_LL_EC_DIRECTION + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataTransferDirection(). */ + + uint32_t Mode; /*!< Specifies the normal or circular operation mode. + This parameter can be a value of @ref DMA_LL_EC_MODE + @note: The circular buffer mode cannot be used if the memory to memory + data transfer direction is configured on the selected Channel + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMode(). */ + + uint32_t PeriphOrM2MSrcIncMode; /*!< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction + is incremented or not. + This parameter can be a value of @ref DMA_LL_EC_PERIPH + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphIncMode(). */ + + uint32_t MemoryOrM2MDstIncMode; /*!< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction + is incremented or not. + This parameter can be a value of @ref DMA_LL_EC_MEMORY + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryIncMode(). */ + + uint32_t PeriphOrM2MSrcDataSize; /*!< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word) + in case of memory to memory transfer direction. + This parameter can be a value of @ref DMA_LL_EC_PDATAALIGN + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphSize(). */ + + uint32_t MemoryOrM2MDstDataSize; /*!< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word) + in case of memory to memory transfer direction. + This parameter can be a value of @ref DMA_LL_EC_MDATAALIGN + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemorySize(). */ + + uint32_t NbData; /*!< Specifies the number of data to transfer, in data unit. + The data unit is equal to the source buffer configuration set in PeripheralSize + or MemorySize parameters depending in the transfer direction. + This parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataLength(). */ + + uint32_t Priority; /*!< Specifies the channel priority level. + This parameter can be a value of @ref DMA_LL_EC_PRIORITY + + This feature can be modified afterwards using unitary function @ref LL_DMA_SetChannelPriorityLevel(). */ + +} LL_DMA_InitTypeDef; +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Constants DMA Exported Constants + * @{ + */ +/** @defgroup DMA_LL_EC_CLEAR_FLAG Clear Flags Defines + * @brief Flags defines which can be used with LL_DMA_WriteReg function + * @{ + */ +#define LL_DMA_IFCR_CGIF1 DMA_IFCR_CGIF1 /*!< Channel 1 global flag */ +#define LL_DMA_IFCR_CTCIF1 DMA_IFCR_CTCIF1 /*!< Channel 1 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF1 DMA_IFCR_CHTIF1 /*!< Channel 1 half transfer flag */ +#define LL_DMA_IFCR_CTEIF1 DMA_IFCR_CTEIF1 /*!< Channel 1 transfer error flag */ +#define LL_DMA_IFCR_CGIF2 DMA_IFCR_CGIF2 /*!< Channel 2 global flag */ +#define LL_DMA_IFCR_CTCIF2 DMA_IFCR_CTCIF2 /*!< Channel 2 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF2 DMA_IFCR_CHTIF2 /*!< Channel 2 half transfer flag */ +#define LL_DMA_IFCR_CTEIF2 DMA_IFCR_CTEIF2 /*!< Channel 2 transfer error flag */ +#define LL_DMA_IFCR_CGIF3 DMA_IFCR_CGIF3 /*!< Channel 3 global flag */ +#define LL_DMA_IFCR_CTCIF3 DMA_IFCR_CTCIF3 /*!< Channel 3 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF3 DMA_IFCR_CHTIF3 /*!< Channel 3 half transfer flag */ +#define LL_DMA_IFCR_CTEIF3 DMA_IFCR_CTEIF3 /*!< Channel 3 transfer error flag */ +#define LL_DMA_IFCR_CGIF4 DMA_IFCR_CGIF4 /*!< Channel 4 global flag */ +#define LL_DMA_IFCR_CTCIF4 DMA_IFCR_CTCIF4 /*!< Channel 4 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF4 DMA_IFCR_CHTIF4 /*!< Channel 4 half transfer flag */ +#define LL_DMA_IFCR_CTEIF4 DMA_IFCR_CTEIF4 /*!< Channel 4 transfer error flag */ +#define LL_DMA_IFCR_CGIF5 DMA_IFCR_CGIF5 /*!< Channel 5 global flag */ +#define LL_DMA_IFCR_CTCIF5 DMA_IFCR_CTCIF5 /*!< Channel 5 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF5 DMA_IFCR_CHTIF5 /*!< Channel 5 half transfer flag */ +#define LL_DMA_IFCR_CTEIF5 DMA_IFCR_CTEIF5 /*!< Channel 5 transfer error flag */ +#define LL_DMA_IFCR_CGIF6 DMA_IFCR_CGIF6 /*!< Channel 6 global flag */ +#define LL_DMA_IFCR_CTCIF6 DMA_IFCR_CTCIF6 /*!< Channel 6 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF6 DMA_IFCR_CHTIF6 /*!< Channel 6 half transfer flag */ +#define LL_DMA_IFCR_CTEIF6 DMA_IFCR_CTEIF6 /*!< Channel 6 transfer error flag */ +#define LL_DMA_IFCR_CGIF7 DMA_IFCR_CGIF7 /*!< Channel 7 global flag */ +#define LL_DMA_IFCR_CTCIF7 DMA_IFCR_CTCIF7 /*!< Channel 7 transfer complete flag */ +#define LL_DMA_IFCR_CHTIF7 DMA_IFCR_CHTIF7 /*!< Channel 7 half transfer flag */ +#define LL_DMA_IFCR_CTEIF7 DMA_IFCR_CTEIF7 /*!< Channel 7 transfer error flag */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_DMA_ReadReg function + * @{ + */ +#define LL_DMA_ISR_GIF1 DMA_ISR_GIF1 /*!< Channel 1 global flag */ +#define LL_DMA_ISR_TCIF1 DMA_ISR_TCIF1 /*!< Channel 1 transfer complete flag */ +#define LL_DMA_ISR_HTIF1 DMA_ISR_HTIF1 /*!< Channel 1 half transfer flag */ +#define LL_DMA_ISR_TEIF1 DMA_ISR_TEIF1 /*!< Channel 1 transfer error flag */ +#define LL_DMA_ISR_GIF2 DMA_ISR_GIF2 /*!< Channel 2 global flag */ +#define LL_DMA_ISR_TCIF2 DMA_ISR_TCIF2 /*!< Channel 2 transfer complete flag */ +#define LL_DMA_ISR_HTIF2 DMA_ISR_HTIF2 /*!< Channel 2 half transfer flag */ +#define LL_DMA_ISR_TEIF2 DMA_ISR_TEIF2 /*!< Channel 2 transfer error flag */ +#define LL_DMA_ISR_GIF3 DMA_ISR_GIF3 /*!< Channel 3 global flag */ +#define LL_DMA_ISR_TCIF3 DMA_ISR_TCIF3 /*!< Channel 3 transfer complete flag */ +#define LL_DMA_ISR_HTIF3 DMA_ISR_HTIF3 /*!< Channel 3 half transfer flag */ +#define LL_DMA_ISR_TEIF3 DMA_ISR_TEIF3 /*!< Channel 3 transfer error flag */ +#define LL_DMA_ISR_GIF4 DMA_ISR_GIF4 /*!< Channel 4 global flag */ +#define LL_DMA_ISR_TCIF4 DMA_ISR_TCIF4 /*!< Channel 4 transfer complete flag */ +#define LL_DMA_ISR_HTIF4 DMA_ISR_HTIF4 /*!< Channel 4 half transfer flag */ +#define LL_DMA_ISR_TEIF4 DMA_ISR_TEIF4 /*!< Channel 4 transfer error flag */ +#define LL_DMA_ISR_GIF5 DMA_ISR_GIF5 /*!< Channel 5 global flag */ +#define LL_DMA_ISR_TCIF5 DMA_ISR_TCIF5 /*!< Channel 5 transfer complete flag */ +#define LL_DMA_ISR_HTIF5 DMA_ISR_HTIF5 /*!< Channel 5 half transfer flag */ +#define LL_DMA_ISR_TEIF5 DMA_ISR_TEIF5 /*!< Channel 5 transfer error flag */ +#define LL_DMA_ISR_GIF6 DMA_ISR_GIF6 /*!< Channel 6 global flag */ +#define LL_DMA_ISR_TCIF6 DMA_ISR_TCIF6 /*!< Channel 6 transfer complete flag */ +#define LL_DMA_ISR_HTIF6 DMA_ISR_HTIF6 /*!< Channel 6 half transfer flag */ +#define LL_DMA_ISR_TEIF6 DMA_ISR_TEIF6 /*!< Channel 6 transfer error flag */ +#define LL_DMA_ISR_GIF7 DMA_ISR_GIF7 /*!< Channel 7 global flag */ +#define LL_DMA_ISR_TCIF7 DMA_ISR_TCIF7 /*!< Channel 7 transfer complete flag */ +#define LL_DMA_ISR_HTIF7 DMA_ISR_HTIF7 /*!< Channel 7 half transfer flag */ +#define LL_DMA_ISR_TEIF7 DMA_ISR_TEIF7 /*!< Channel 7 transfer error flag */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_DMA_ReadReg and LL_DMA_WriteReg functions + * @{ + */ +#define LL_DMA_CCR_TCIE DMA_CCR_TCIE /*!< Transfer complete interrupt */ +#define LL_DMA_CCR_HTIE DMA_CCR_HTIE /*!< Half Transfer interrupt */ +#define LL_DMA_CCR_TEIE DMA_CCR_TEIE /*!< Transfer error interrupt */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_CHANNEL CHANNEL + * @{ + */ +#define LL_DMA_CHANNEL_1 0x00000001U /*!< DMA Channel 1 */ +#define LL_DMA_CHANNEL_2 0x00000002U /*!< DMA Channel 2 */ +#define LL_DMA_CHANNEL_3 0x00000003U /*!< DMA Channel 3 */ +#define LL_DMA_CHANNEL_4 0x00000004U /*!< DMA Channel 4 */ +#define LL_DMA_CHANNEL_5 0x00000005U /*!< DMA Channel 5 */ +#define LL_DMA_CHANNEL_6 0x00000006U /*!< DMA Channel 6 */ +#define LL_DMA_CHANNEL_7 0x00000007U /*!< DMA Channel 7 */ +#if defined(USE_FULL_LL_DRIVER) +#define LL_DMA_CHANNEL_ALL 0xFFFF0000U /*!< DMA Channel all (used only for function @ref LL_DMA_DeInit(). */ +#endif /*USE_FULL_LL_DRIVER*/ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_DIRECTION Transfer Direction + * @{ + */ +#define LL_DMA_DIRECTION_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */ +#define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_CCR_DIR /*!< Memory to peripheral direction */ +#define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_CCR_MEM2MEM /*!< Memory to memory direction */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MODE Transfer mode + * @{ + */ +#define LL_DMA_MODE_NORMAL 0x00000000U /*!< Normal Mode */ +#define LL_DMA_MODE_CIRCULAR DMA_CCR_CIRC /*!< Circular Mode */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PERIPH Peripheral increment mode + * @{ + */ +#define LL_DMA_PERIPH_INCREMENT DMA_CCR_PINC /*!< Peripheral increment mode Enable */ +#define LL_DMA_PERIPH_NOINCREMENT 0x00000000U /*!< Peripheral increment mode Disable */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MEMORY Memory increment mode + * @{ + */ +#define LL_DMA_MEMORY_INCREMENT DMA_CCR_MINC /*!< Memory increment mode Enable */ +#define LL_DMA_MEMORY_NOINCREMENT 0x00000000U /*!< Memory increment mode Disable */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PDATAALIGN Peripheral data alignment + * @{ + */ +#define LL_DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */ +#define LL_DMA_PDATAALIGN_HALFWORD DMA_CCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */ +#define LL_DMA_PDATAALIGN_WORD DMA_CCR_PSIZE_1 /*!< Peripheral data alignment : Word */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_MDATAALIGN Memory data alignment + * @{ + */ +#define LL_DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */ +#define LL_DMA_MDATAALIGN_HALFWORD DMA_CCR_MSIZE_0 /*!< Memory data alignment : HalfWord */ +#define LL_DMA_MDATAALIGN_WORD DMA_CCR_MSIZE_1 /*!< Memory data alignment : Word */ +/** + * @} + */ + +/** @defgroup DMA_LL_EC_PRIORITY Transfer Priority level + * @{ + */ +#define LL_DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */ +#define LL_DMA_PRIORITY_MEDIUM DMA_CCR_PL_0 /*!< Priority level : Medium */ +#define LL_DMA_PRIORITY_HIGH DMA_CCR_PL_1 /*!< Priority level : High */ +#define LL_DMA_PRIORITY_VERYHIGH DMA_CCR_PL /*!< Priority level : Very_High */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Macros DMA Exported Macros + * @{ + */ + +/** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers macros + * @{ + */ +/** + * @brief Write a value in DMA register + * @param __INSTANCE__ DMA Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_DMA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in DMA register + * @param __INSTANCE__ DMA Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_DMA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** @defgroup DMA_LL_EM_CONVERT_DMAxCHANNELy Convert DMAxChannely + * @{ + */ + +/** + * @brief Convert DMAx_Channely into DMAx + * @param __CHANNEL_INSTANCE__ DMAx_Channely + * @retval DMAx + */ +#if defined(DMA2) +#define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) \ +(((uint32_t)(__CHANNEL_INSTANCE__) > ((uint32_t)DMA1_Channel7)) ? DMA2 : DMA1) +#else +#define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) (DMA1) +#endif + +/** + * @brief Convert DMAx_Channely into LL_DMA_CHANNEL_y + * @param __CHANNEL_INSTANCE__ DMAx_Channely + * @retval LL_DMA_CHANNEL_y + */ +#if defined (DMA2) +#define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \ +(((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel1)) ? LL_DMA_CHANNEL_1 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel2)) ? LL_DMA_CHANNEL_2 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel3)) ? LL_DMA_CHANNEL_3 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel4)) ? LL_DMA_CHANNEL_4 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel5)) ? LL_DMA_CHANNEL_5 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \ + LL_DMA_CHANNEL_7) +#else +#define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \ +(((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \ + ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \ + LL_DMA_CHANNEL_7) +#endif + +/** + * @brief Convert DMA Instance DMAx and LL_DMA_CHANNEL_y into DMAx_Channely + * @param __DMA_INSTANCE__ DMAx + * @param __CHANNEL__ LL_DMA_CHANNEL_y + * @retval DMAx_Channely + */ +#if defined (DMA2) +#define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \ +((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA2_Channel1 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA2_Channel2 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA2_Channel3 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA2_Channel4 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA2_Channel5 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \ + DMA1_Channel7) +#else +#define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \ +((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \ + (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \ + DMA1_Channel7) +#endif + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Functions DMA Exported Functions + * @{ + */ + +/** @defgroup DMA_LL_EF_Configuration Configuration + * @{ + */ +/** + * @brief Enable DMA channel. + * @rmtoll CCR EN LL_DMA_EnableChannel + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableChannel(DMA_TypeDef *DMAx, uint32_t Channel) +{ + SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN); +} + +/** + * @brief Disable DMA channel. + * @rmtoll CCR EN LL_DMA_DisableChannel + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableChannel(DMA_TypeDef *DMAx, uint32_t Channel) +{ + CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN); +} + +/** + * @brief Check if DMA channel is enabled or disabled. + * @rmtoll CCR EN LL_DMA_IsEnabledChannel + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledChannel(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_EN) == (DMA_CCR_EN)); +} + +/** + * @brief Configure all parameters link to DMA transfer. + * @rmtoll CCR DIR LL_DMA_ConfigTransfer\n + * CCR MEM2MEM LL_DMA_ConfigTransfer\n + * CCR CIRC LL_DMA_ConfigTransfer\n + * CCR PINC LL_DMA_ConfigTransfer\n + * CCR MINC LL_DMA_ConfigTransfer\n + * CCR PSIZE LL_DMA_ConfigTransfer\n + * CCR MSIZE LL_DMA_ConfigTransfer\n + * CCR PL LL_DMA_ConfigTransfer + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY or @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH or @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @arg @ref LL_DMA_MODE_NORMAL or @ref LL_DMA_MODE_CIRCULAR + * @arg @ref LL_DMA_PERIPH_INCREMENT or @ref LL_DMA_PERIPH_NOINCREMENT + * @arg @ref LL_DMA_MEMORY_INCREMENT or @ref LL_DMA_MEMORY_NOINCREMENT + * @arg @ref LL_DMA_PDATAALIGN_BYTE or @ref LL_DMA_PDATAALIGN_HALFWORD or @ref LL_DMA_PDATAALIGN_WORD + * @arg @ref LL_DMA_MDATAALIGN_BYTE or @ref LL_DMA_MDATAALIGN_HALFWORD or @ref LL_DMA_MDATAALIGN_WORD + * @arg @ref LL_DMA_PRIORITY_LOW or @ref LL_DMA_PRIORITY_MEDIUM or @ref LL_DMA_PRIORITY_HIGH or @ref LL_DMA_PRIORITY_VERYHIGH + * @retval None + */ +__STATIC_INLINE void LL_DMA_ConfigTransfer(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Configuration) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_DIR | DMA_CCR_MEM2MEM | DMA_CCR_CIRC | DMA_CCR_PINC | DMA_CCR_MINC | DMA_CCR_PSIZE | DMA_CCR_MSIZE | DMA_CCR_PL, + Configuration); +} + +/** + * @brief Set Data transfer direction (read from peripheral or from memory). + * @rmtoll CCR DIR LL_DMA_SetDataTransferDirection\n + * CCR MEM2MEM LL_DMA_SetDataTransferDirection + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param Direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Direction) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_DIR | DMA_CCR_MEM2MEM, Direction); +} + +/** + * @brief Get Data transfer direction (read from peripheral or from memory). + * @rmtoll CCR DIR LL_DMA_GetDataTransferDirection\n + * CCR MEM2MEM LL_DMA_GetDataTransferDirection + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + */ +__STATIC_INLINE uint32_t LL_DMA_GetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_DIR | DMA_CCR_MEM2MEM)); +} + +/** + * @brief Set DMA mode circular or normal. + * @note The circular buffer mode cannot be used if the memory-to-memory + * data transfer is configured on the selected Channel. + * @rmtoll CCR CIRC LL_DMA_SetMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_DMA_MODE_NORMAL + * @arg @ref LL_DMA_MODE_CIRCULAR + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Mode) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_CIRC, + Mode); +} + +/** + * @brief Get DMA mode circular or normal. + * @rmtoll CCR CIRC LL_DMA_GetMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MODE_NORMAL + * @arg @ref LL_DMA_MODE_CIRCULAR + */ +__STATIC_INLINE uint32_t LL_DMA_GetMode(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_CIRC)); +} + +/** + * @brief Set Peripheral increment mode. + * @rmtoll CCR PINC LL_DMA_SetPeriphIncMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param PeriphOrM2MSrcIncMode This parameter can be one of the following values: + * @arg @ref LL_DMA_PERIPH_INCREMENT + * @arg @ref LL_DMA_PERIPH_NOINCREMENT + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcIncMode) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PINC, + PeriphOrM2MSrcIncMode); +} + +/** + * @brief Get Peripheral increment mode. + * @rmtoll CCR PINC LL_DMA_GetPeriphIncMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PERIPH_INCREMENT + * @arg @ref LL_DMA_PERIPH_NOINCREMENT + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_PINC)); +} + +/** + * @brief Set Memory increment mode. + * @rmtoll CCR MINC LL_DMA_SetMemoryIncMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param MemoryOrM2MDstIncMode This parameter can be one of the following values: + * @arg @ref LL_DMA_MEMORY_INCREMENT + * @arg @ref LL_DMA_MEMORY_NOINCREMENT + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstIncMode) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MINC, + MemoryOrM2MDstIncMode); +} + +/** + * @brief Get Memory increment mode. + * @rmtoll CCR MINC LL_DMA_GetMemoryIncMode + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MEMORY_INCREMENT + * @arg @ref LL_DMA_MEMORY_NOINCREMENT + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_MINC)); +} + +/** + * @brief Set Peripheral size. + * @rmtoll CCR PSIZE LL_DMA_SetPeriphSize + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param PeriphOrM2MSrcDataSize This parameter can be one of the following values: + * @arg @ref LL_DMA_PDATAALIGN_BYTE + * @arg @ref LL_DMA_PDATAALIGN_HALFWORD + * @arg @ref LL_DMA_PDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcDataSize) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PSIZE, + PeriphOrM2MSrcDataSize); +} + +/** + * @brief Get Peripheral size. + * @rmtoll CCR PSIZE LL_DMA_GetPeriphSize + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PDATAALIGN_BYTE + * @arg @ref LL_DMA_PDATAALIGN_HALFWORD + * @arg @ref LL_DMA_PDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_PSIZE)); +} + +/** + * @brief Set Memory size. + * @rmtoll CCR MSIZE LL_DMA_SetMemorySize + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param MemoryOrM2MDstDataSize This parameter can be one of the following values: + * @arg @ref LL_DMA_MDATAALIGN_BYTE + * @arg @ref LL_DMA_MDATAALIGN_HALFWORD + * @arg @ref LL_DMA_MDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstDataSize) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MSIZE, + MemoryOrM2MDstDataSize); +} + +/** + * @brief Get Memory size. + * @rmtoll CCR MSIZE LL_DMA_GetMemorySize + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MDATAALIGN_BYTE + * @arg @ref LL_DMA_MDATAALIGN_HALFWORD + * @arg @ref LL_DMA_MDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_MSIZE)); +} + +/** + * @brief Set Channel priority level. + * @rmtoll CCR PL LL_DMA_SetChannelPriorityLevel + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param Priority This parameter can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_LOW + * @arg @ref LL_DMA_PRIORITY_MEDIUM + * @arg @ref LL_DMA_PRIORITY_HIGH + * @arg @ref LL_DMA_PRIORITY_VERYHIGH + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Priority) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PL, + Priority); +} + +/** + * @brief Get Channel priority level. + * @rmtoll CCR PL LL_DMA_GetChannelPriorityLevel + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_LOW + * @arg @ref LL_DMA_PRIORITY_MEDIUM + * @arg @ref LL_DMA_PRIORITY_HIGH + * @arg @ref LL_DMA_PRIORITY_VERYHIGH + */ +__STATIC_INLINE uint32_t LL_DMA_GetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_PL)); +} + +/** + * @brief Set Number of data to transfer. + * @note This action has no effect if + * channel is enabled. + * @rmtoll CNDTR NDT LL_DMA_SetDataLength + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param NbData Between Min_Data = 0 and Max_Data = 0x0000FFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetDataLength(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t NbData) +{ + MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR, + DMA_CNDTR_NDT, NbData); +} + +/** + * @brief Get Number of data to transfer. + * @note Once the channel is enabled, the return value indicate the + * remaining bytes to be transmitted. + * @rmtoll CNDTR NDT LL_DMA_GetDataLength + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetDataLength(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR, + DMA_CNDTR_NDT)); +} + +/** + * @brief Configure the Source and Destination addresses. + * @note This API must not be called when the DMA channel is enabled. + * @note Each IP using DMA provides an API to get directly the register adress (LL_PPP_DMA_GetRegAddr). + * @rmtoll CPAR PA LL_DMA_ConfigAddresses\n + * CMAR MA LL_DMA_ConfigAddresses + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param SrcAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @param DstAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @param Direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @retval None + */ +__STATIC_INLINE void LL_DMA_ConfigAddresses(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t SrcAddress, + uint32_t DstAddress, uint32_t Direction) +{ + /* Direction Memory to Periph */ + if (Direction == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) + { + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, SrcAddress); + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, DstAddress); + } + /* Direction Periph to Memory and Memory to Memory */ + else + { + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, SrcAddress); + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, DstAddress); + } +} + +/** + * @brief Set the Memory address. + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @note This API must not be called when the DMA channel is enabled. + * @rmtoll CMAR MA LL_DMA_SetMemoryAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress) +{ + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress); +} + +/** + * @brief Set the Peripheral address. + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @note This API must not be called when the DMA channel is enabled. + * @rmtoll CPAR PA LL_DMA_SetPeriphAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param PeriphAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphAddress) +{ + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, PeriphAddress); +} + +/** + * @brief Get Memory address. + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @rmtoll CMAR MA LL_DMA_GetMemoryAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR)); +} + +/** + * @brief Get Peripheral address. + * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only. + * @rmtoll CPAR PA LL_DMA_GetPeriphAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR)); +} + +/** + * @brief Set the Memory to Memory Source address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @note This API must not be called when the DMA channel is enabled. + * @rmtoll CPAR PA LL_DMA_SetM2MSrcAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress) +{ + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, MemoryAddress); +} + +/** + * @brief Set the Memory to Memory Destination address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @note This API must not be called when the DMA channel is enabled. + * @rmtoll CMAR MA LL_DMA_SetM2MDstAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void LL_DMA_SetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress) +{ + WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress); +} + +/** + * @brief Get the Memory to Memory Source address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @rmtoll CPAR PA LL_DMA_GetM2MSrcAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR)); +} + +/** + * @brief Get the Memory to Memory Destination address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * @rmtoll CMAR MA LL_DMA_GetM2MDstAddress + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR)); +} + +/** + * @} + */ + +/** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get Channel 1 global interrupt flag. + * @rmtoll ISR GIF1 LL_DMA_IsActiveFlag_GI1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF1) == (DMA_ISR_GIF1)); +} + +/** + * @brief Get Channel 2 global interrupt flag. + * @rmtoll ISR GIF2 LL_DMA_IsActiveFlag_GI2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF2) == (DMA_ISR_GIF2)); +} + +/** + * @brief Get Channel 3 global interrupt flag. + * @rmtoll ISR GIF3 LL_DMA_IsActiveFlag_GI3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF3) == (DMA_ISR_GIF3)); +} + +/** + * @brief Get Channel 4 global interrupt flag. + * @rmtoll ISR GIF4 LL_DMA_IsActiveFlag_GI4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF4) == (DMA_ISR_GIF4)); +} + +/** + * @brief Get Channel 5 global interrupt flag. + * @rmtoll ISR GIF5 LL_DMA_IsActiveFlag_GI5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF5) == (DMA_ISR_GIF5)); +} + +/** + * @brief Get Channel 6 global interrupt flag. + * @rmtoll ISR GIF6 LL_DMA_IsActiveFlag_GI6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF6) == (DMA_ISR_GIF6)); +} + +/** + * @brief Get Channel 7 global interrupt flag. + * @rmtoll ISR GIF7 LL_DMA_IsActiveFlag_GI7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_GIF7) == (DMA_ISR_GIF7)); +} + +/** + * @brief Get Channel 1 transfer complete flag. + * @rmtoll ISR TCIF1 LL_DMA_IsActiveFlag_TC1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF1) == (DMA_ISR_TCIF1)); +} + +/** + * @brief Get Channel 2 transfer complete flag. + * @rmtoll ISR TCIF2 LL_DMA_IsActiveFlag_TC2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF2) == (DMA_ISR_TCIF2)); +} + +/** + * @brief Get Channel 3 transfer complete flag. + * @rmtoll ISR TCIF3 LL_DMA_IsActiveFlag_TC3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF3) == (DMA_ISR_TCIF3)); +} + +/** + * @brief Get Channel 4 transfer complete flag. + * @rmtoll ISR TCIF4 LL_DMA_IsActiveFlag_TC4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF4) == (DMA_ISR_TCIF4)); +} + +/** + * @brief Get Channel 5 transfer complete flag. + * @rmtoll ISR TCIF5 LL_DMA_IsActiveFlag_TC5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF5) == (DMA_ISR_TCIF5)); +} + +/** + * @brief Get Channel 6 transfer complete flag. + * @rmtoll ISR TCIF6 LL_DMA_IsActiveFlag_TC6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF6) == (DMA_ISR_TCIF6)); +} + +/** + * @brief Get Channel 7 transfer complete flag. + * @rmtoll ISR TCIF7 LL_DMA_IsActiveFlag_TC7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF7) == (DMA_ISR_TCIF7)); +} + +/** + * @brief Get Channel 1 half transfer flag. + * @rmtoll ISR HTIF1 LL_DMA_IsActiveFlag_HT1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF1) == (DMA_ISR_HTIF1)); +} + +/** + * @brief Get Channel 2 half transfer flag. + * @rmtoll ISR HTIF2 LL_DMA_IsActiveFlag_HT2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF2) == (DMA_ISR_HTIF2)); +} + +/** + * @brief Get Channel 3 half transfer flag. + * @rmtoll ISR HTIF3 LL_DMA_IsActiveFlag_HT3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF3) == (DMA_ISR_HTIF3)); +} + +/** + * @brief Get Channel 4 half transfer flag. + * @rmtoll ISR HTIF4 LL_DMA_IsActiveFlag_HT4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF4) == (DMA_ISR_HTIF4)); +} + +/** + * @brief Get Channel 5 half transfer flag. + * @rmtoll ISR HTIF5 LL_DMA_IsActiveFlag_HT5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF5) == (DMA_ISR_HTIF5)); +} + +/** + * @brief Get Channel 6 half transfer flag. + * @rmtoll ISR HTIF6 LL_DMA_IsActiveFlag_HT6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF6) == (DMA_ISR_HTIF6)); +} + +/** + * @brief Get Channel 7 half transfer flag. + * @rmtoll ISR HTIF7 LL_DMA_IsActiveFlag_HT7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF7) == (DMA_ISR_HTIF7)); +} + +/** + * @brief Get Channel 1 transfer error flag. + * @rmtoll ISR TEIF1 LL_DMA_IsActiveFlag_TE1 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE1(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF1) == (DMA_ISR_TEIF1)); +} + +/** + * @brief Get Channel 2 transfer error flag. + * @rmtoll ISR TEIF2 LL_DMA_IsActiveFlag_TE2 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE2(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF2) == (DMA_ISR_TEIF2)); +} + +/** + * @brief Get Channel 3 transfer error flag. + * @rmtoll ISR TEIF3 LL_DMA_IsActiveFlag_TE3 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF3) == (DMA_ISR_TEIF3)); +} + +/** + * @brief Get Channel 4 transfer error flag. + * @rmtoll ISR TEIF4 LL_DMA_IsActiveFlag_TE4 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE4(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF4) == (DMA_ISR_TEIF4)); +} + +/** + * @brief Get Channel 5 transfer error flag. + * @rmtoll ISR TEIF5 LL_DMA_IsActiveFlag_TE5 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE5(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF5) == (DMA_ISR_TEIF5)); +} + +/** + * @brief Get Channel 6 transfer error flag. + * @rmtoll ISR TEIF6 LL_DMA_IsActiveFlag_TE6 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE6(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF6) == (DMA_ISR_TEIF6)); +} + +/** + * @brief Get Channel 7 transfer error flag. + * @rmtoll ISR TEIF7 LL_DMA_IsActiveFlag_TE7 + * @param DMAx DMAx Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7(DMA_TypeDef *DMAx) +{ + return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF7) == (DMA_ISR_TEIF7)); +} + +/** + * @brief Clear Channel 1 global interrupt flag. + * @rmtoll IFCR CGIF1 LL_DMA_ClearFlag_GI1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF1); +} + +/** + * @brief Clear Channel 2 global interrupt flag. + * @rmtoll IFCR CGIF2 LL_DMA_ClearFlag_GI2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF2); +} + +/** + * @brief Clear Channel 3 global interrupt flag. + * @rmtoll IFCR CGIF3 LL_DMA_ClearFlag_GI3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF3); +} + +/** + * @brief Clear Channel 4 global interrupt flag. + * @rmtoll IFCR CGIF4 LL_DMA_ClearFlag_GI4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF4); +} + +/** + * @brief Clear Channel 5 global interrupt flag. + * @rmtoll IFCR CGIF5 LL_DMA_ClearFlag_GI5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF5); +} + +/** + * @brief Clear Channel 6 global interrupt flag. + * @rmtoll IFCR CGIF6 LL_DMA_ClearFlag_GI6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF6); +} + +/** + * @brief Clear Channel 7 global interrupt flag. + * @rmtoll IFCR CGIF7 LL_DMA_ClearFlag_GI7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_GI7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF7); +} + +/** + * @brief Clear Channel 1 transfer complete flag. + * @rmtoll IFCR CTCIF1 LL_DMA_ClearFlag_TC1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF1); +} + +/** + * @brief Clear Channel 2 transfer complete flag. + * @rmtoll IFCR CTCIF2 LL_DMA_ClearFlag_TC2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF2); +} + +/** + * @brief Clear Channel 3 transfer complete flag. + * @rmtoll IFCR CTCIF3 LL_DMA_ClearFlag_TC3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF3); +} + +/** + * @brief Clear Channel 4 transfer complete flag. + * @rmtoll IFCR CTCIF4 LL_DMA_ClearFlag_TC4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF4); +} + +/** + * @brief Clear Channel 5 transfer complete flag. + * @rmtoll IFCR CTCIF5 LL_DMA_ClearFlag_TC5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF5); +} + +/** + * @brief Clear Channel 6 transfer complete flag. + * @rmtoll IFCR CTCIF6 LL_DMA_ClearFlag_TC6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF6); +} + +/** + * @brief Clear Channel 7 transfer complete flag. + * @rmtoll IFCR CTCIF7 LL_DMA_ClearFlag_TC7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TC7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF7); +} + +/** + * @brief Clear Channel 1 half transfer flag. + * @rmtoll IFCR CHTIF1 LL_DMA_ClearFlag_HT1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF1); +} + +/** + * @brief Clear Channel 2 half transfer flag. + * @rmtoll IFCR CHTIF2 LL_DMA_ClearFlag_HT2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF2); +} + +/** + * @brief Clear Channel 3 half transfer flag. + * @rmtoll IFCR CHTIF3 LL_DMA_ClearFlag_HT3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF3); +} + +/** + * @brief Clear Channel 4 half transfer flag. + * @rmtoll IFCR CHTIF4 LL_DMA_ClearFlag_HT4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF4); +} + +/** + * @brief Clear Channel 5 half transfer flag. + * @rmtoll IFCR CHTIF5 LL_DMA_ClearFlag_HT5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF5); +} + +/** + * @brief Clear Channel 6 half transfer flag. + * @rmtoll IFCR CHTIF6 LL_DMA_ClearFlag_HT6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF6); +} + +/** + * @brief Clear Channel 7 half transfer flag. + * @rmtoll IFCR CHTIF7 LL_DMA_ClearFlag_HT7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_HT7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF7); +} + +/** + * @brief Clear Channel 1 transfer error flag. + * @rmtoll IFCR CTEIF1 LL_DMA_ClearFlag_TE1 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE1(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF1); +} + +/** + * @brief Clear Channel 2 transfer error flag. + * @rmtoll IFCR CTEIF2 LL_DMA_ClearFlag_TE2 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE2(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF2); +} + +/** + * @brief Clear Channel 3 transfer error flag. + * @rmtoll IFCR CTEIF3 LL_DMA_ClearFlag_TE3 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE3(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF3); +} + +/** + * @brief Clear Channel 4 transfer error flag. + * @rmtoll IFCR CTEIF4 LL_DMA_ClearFlag_TE4 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE4(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF4); +} + +/** + * @brief Clear Channel 5 transfer error flag. + * @rmtoll IFCR CTEIF5 LL_DMA_ClearFlag_TE5 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE5(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF5); +} + +/** + * @brief Clear Channel 6 transfer error flag. + * @rmtoll IFCR CTEIF6 LL_DMA_ClearFlag_TE6 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE6(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF6); +} + +/** + * @brief Clear Channel 7 transfer error flag. + * @rmtoll IFCR CTEIF7 LL_DMA_ClearFlag_TE7 + * @param DMAx DMAx Instance + * @retval None + */ +__STATIC_INLINE void LL_DMA_ClearFlag_TE7(DMA_TypeDef *DMAx) +{ + WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF7); +} + +/** + * @} + */ + +/** @defgroup DMA_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable Transfer complete interrupt. + * @rmtoll CCR TCIE LL_DMA_EnableIT_TC + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel) +{ + SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE); +} + +/** + * @brief Enable Half transfer interrupt. + * @rmtoll CCR HTIE LL_DMA_EnableIT_HT + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel) +{ + SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE); +} + +/** + * @brief Enable Transfer error interrupt. + * @rmtoll CCR TEIE LL_DMA_EnableIT_TE + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel) +{ + SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE); +} + +/** + * @brief Disable Transfer complete interrupt. + * @rmtoll CCR TCIE LL_DMA_DisableIT_TC + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel) +{ + CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE); +} + +/** + * @brief Disable Half transfer interrupt. + * @rmtoll CCR HTIE LL_DMA_DisableIT_HT + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel) +{ + CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE); +} + +/** + * @brief Disable Transfer error interrupt. + * @rmtoll CCR TEIE LL_DMA_DisableIT_TE + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void LL_DMA_DisableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel) +{ + CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE); +} + +/** + * @brief Check if Transfer complete Interrupt is enabled. + * @rmtoll CCR TCIE LL_DMA_IsEnabledIT_TC + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_TCIE) == (DMA_CCR_TCIE)); +} + +/** + * @brief Check if Half transfer Interrupt is enabled. + * @rmtoll CCR HTIE LL_DMA_IsEnabledIT_HT + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_HT(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_HTIE) == (DMA_CCR_HTIE)); +} + +/** + * @brief Check if Transfer error Interrupt is enabled. + * @rmtoll CCR TEIE LL_DMA_IsEnabledIT_TE + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TE(DMA_TypeDef *DMAx, uint32_t Channel) +{ + return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, + DMA_CCR_TEIE) == (DMA_CCR_TEIE)); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct); +uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel); +void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct); + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* DMA1 || DMA2 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_DMA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h new file mode 100644 index 0000000..f0be0ad --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h @@ -0,0 +1,888 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_exti.h + * @author MCD Application Team + * @brief Header file of EXTI LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_LL_EXTI_H +#define STM32F1xx_LL_EXTI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (EXTI) + +/** @defgroup EXTI_LL EXTI + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private Macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_Private_Macros EXTI Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_ES_INIT EXTI Exported Init structure + * @{ + */ +typedef struct +{ + + uint32_t Line_0_31; /*!< Specifies the EXTI lines to be enabled or disabled for Lines in range 0 to 31 + This parameter can be any combination of @ref EXTI_LL_EC_LINE */ + + FunctionalState LineCommand; /*!< Specifies the new state of the selected EXTI lines. + This parameter can be set either to ENABLE or DISABLE */ + + uint8_t Mode; /*!< Specifies the mode for the EXTI lines. + This parameter can be a value of @ref EXTI_LL_EC_MODE. */ + + uint8_t Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines. + This parameter can be a value of @ref EXTI_LL_EC_TRIGGER. */ +} LL_EXTI_InitTypeDef; + +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Constants EXTI Exported Constants + * @{ + */ + +/** @defgroup EXTI_LL_EC_LINE LINE + * @{ + */ +#define LL_EXTI_LINE_0 EXTI_IMR_IM0 /*!< Extended line 0 */ +#define LL_EXTI_LINE_1 EXTI_IMR_IM1 /*!< Extended line 1 */ +#define LL_EXTI_LINE_2 EXTI_IMR_IM2 /*!< Extended line 2 */ +#define LL_EXTI_LINE_3 EXTI_IMR_IM3 /*!< Extended line 3 */ +#define LL_EXTI_LINE_4 EXTI_IMR_IM4 /*!< Extended line 4 */ +#define LL_EXTI_LINE_5 EXTI_IMR_IM5 /*!< Extended line 5 */ +#define LL_EXTI_LINE_6 EXTI_IMR_IM6 /*!< Extended line 6 */ +#define LL_EXTI_LINE_7 EXTI_IMR_IM7 /*!< Extended line 7 */ +#define LL_EXTI_LINE_8 EXTI_IMR_IM8 /*!< Extended line 8 */ +#define LL_EXTI_LINE_9 EXTI_IMR_IM9 /*!< Extended line 9 */ +#define LL_EXTI_LINE_10 EXTI_IMR_IM10 /*!< Extended line 10 */ +#define LL_EXTI_LINE_11 EXTI_IMR_IM11 /*!< Extended line 11 */ +#define LL_EXTI_LINE_12 EXTI_IMR_IM12 /*!< Extended line 12 */ +#define LL_EXTI_LINE_13 EXTI_IMR_IM13 /*!< Extended line 13 */ +#define LL_EXTI_LINE_14 EXTI_IMR_IM14 /*!< Extended line 14 */ +#define LL_EXTI_LINE_15 EXTI_IMR_IM15 /*!< Extended line 15 */ +#if defined(EXTI_IMR_IM16) +#define LL_EXTI_LINE_16 EXTI_IMR_IM16 /*!< Extended line 16 */ +#endif +#define LL_EXTI_LINE_17 EXTI_IMR_IM17 /*!< Extended line 17 */ +#if defined(EXTI_IMR_IM18) +#define LL_EXTI_LINE_18 EXTI_IMR_IM18 /*!< Extended line 18 */ +#endif +#if defined(EXTI_IMR_IM19) +#define LL_EXTI_LINE_19 EXTI_IMR_IM19 /*!< Extended line 19 */ +#endif +#if defined(EXTI_IMR_IM20) +#define LL_EXTI_LINE_20 EXTI_IMR_IM20 /*!< Extended line 20 */ +#endif +#if defined(EXTI_IMR_IM21) +#define LL_EXTI_LINE_21 EXTI_IMR_IM21 /*!< Extended line 21 */ +#endif +#if defined(EXTI_IMR_IM22) +#define LL_EXTI_LINE_22 EXTI_IMR_IM22 /*!< Extended line 22 */ +#endif +#if defined(EXTI_IMR_IM23) +#define LL_EXTI_LINE_23 EXTI_IMR_IM23 /*!< Extended line 23 */ +#endif +#if defined(EXTI_IMR_IM24) +#define LL_EXTI_LINE_24 EXTI_IMR_IM24 /*!< Extended line 24 */ +#endif +#if defined(EXTI_IMR_IM25) +#define LL_EXTI_LINE_25 EXTI_IMR_IM25 /*!< Extended line 25 */ +#endif +#if defined(EXTI_IMR_IM26) +#define LL_EXTI_LINE_26 EXTI_IMR_IM26 /*!< Extended line 26 */ +#endif +#if defined(EXTI_IMR_IM27) +#define LL_EXTI_LINE_27 EXTI_IMR_IM27 /*!< Extended line 27 */ +#endif +#if defined(EXTI_IMR_IM28) +#define LL_EXTI_LINE_28 EXTI_IMR_IM28 /*!< Extended line 28 */ +#endif +#if defined(EXTI_IMR_IM29) +#define LL_EXTI_LINE_29 EXTI_IMR_IM29 /*!< Extended line 29 */ +#endif +#if defined(EXTI_IMR_IM30) +#define LL_EXTI_LINE_30 EXTI_IMR_IM30 /*!< Extended line 30 */ +#endif +#if defined(EXTI_IMR_IM31) +#define LL_EXTI_LINE_31 EXTI_IMR_IM31 /*!< Extended line 31 */ +#endif +#define LL_EXTI_LINE_ALL_0_31 EXTI_IMR_IM /*!< All Extended line not reserved*/ + + +#define LL_EXTI_LINE_ALL (0xFFFFFFFFU) /*!< All Extended line */ + +#if defined(USE_FULL_LL_DRIVER) +#define LL_EXTI_LINE_NONE (0x00000000U) /*!< None Extended line */ +#endif /*USE_FULL_LL_DRIVER*/ + +/** + * @} + */ +#if defined(USE_FULL_LL_DRIVER) + +/** @defgroup EXTI_LL_EC_MODE Mode + * @{ + */ +#define LL_EXTI_MODE_IT ((uint8_t)0x00) /*!< Interrupt Mode */ +#define LL_EXTI_MODE_EVENT ((uint8_t)0x01) /*!< Event Mode */ +#define LL_EXTI_MODE_IT_EVENT ((uint8_t)0x02) /*!< Interrupt & Event Mode */ +/** + * @} + */ + +/** @defgroup EXTI_LL_EC_TRIGGER Edge Trigger + * @{ + */ +#define LL_EXTI_TRIGGER_NONE ((uint8_t)0x00) /*!< No Trigger Mode */ +#define LL_EXTI_TRIGGER_RISING ((uint8_t)0x01) /*!< Trigger Rising Mode */ +#define LL_EXTI_TRIGGER_FALLING ((uint8_t)0x02) /*!< Trigger Falling Mode */ +#define LL_EXTI_TRIGGER_RISING_FALLING ((uint8_t)0x03) /*!< Trigger Rising & Falling Mode */ + +/** + * @} + */ + + +#endif /*USE_FULL_LL_DRIVER*/ + + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Macros EXTI Exported Macros + * @{ + */ + +/** @defgroup EXTI_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in EXTI register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_EXTI_WriteReg(__REG__, __VALUE__) WRITE_REG(EXTI->__REG__, (__VALUE__)) + +/** + * @brief Read a value in EXTI register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_EXTI_ReadReg(__REG__) READ_REG(EXTI->__REG__) +/** + * @} + */ + + +/** + * @} + */ + + + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup EXTI_LL_Exported_Functions EXTI Exported Functions + * @{ + */ +/** @defgroup EXTI_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Interrupt request for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_EnableIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->IMR, ExtiLine); +} + +/** + * @brief Disable ExtiLine Interrupt request for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_DisableIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->IMR, ExtiLine); +} + + +/** + * @brief Indicate if ExtiLine Interrupt request is enabled for Lines in range 0 to 31 + * @note The reset value for the direct or internal lines (see RM) + * is set to 1 in order to enable the interrupt by default. + * Bits are set automatically at Power on. + * @rmtoll IMR IMx LL_EXTI_IsEnabledIT_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledIT_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->IMR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Event_Management Event_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Event request for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_EnableEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->EMR, ExtiLine); + +} + + +/** + * @brief Disable ExtiLine Event request for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_DisableEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->EMR, ExtiLine); +} + + +/** + * @brief Indicate if ExtiLine Event request is enabled for Lines in range 0 to 31 + * @rmtoll EMR EMx LL_EXTI_IsEnabledEvent_0_31 + * @param ExtiLine This parameter can be one of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_17 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @arg @ref LL_EXTI_LINE_ALL_0_31 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledEvent_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->EMR, ExtiLine) == (ExtiLine)); + +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Rising_Trigger_Management Rising_Trigger_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a rising edge on a configurable interrupt + * line occurs during a write operation in the EXTI_RTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll RTSR RTx LL_EXTI_EnableRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->RTSR, ExtiLine); + +} + + +/** + * @brief Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a rising edge on a configurable interrupt + * line occurs during a write operation in the EXTI_RTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll RTSR RTx LL_EXTI_DisableRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->RTSR, ExtiLine); + +} + + +/** + * @brief Check if rising edge trigger is enabled for Lines in range 0 to 31 + * @rmtoll RTSR RTx LL_EXTI_IsEnabledRisingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledRisingTrig_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->RTSR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Falling_Trigger_Management Falling_Trigger_Management + * @{ + */ + +/** + * @brief Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a falling edge on a configurable interrupt + * line occurs during a write operation in the EXTI_FTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for + * the same interrupt line. In this case, both generate a trigger + * condition. + * @rmtoll FTSR FTx LL_EXTI_EnableFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->FTSR, ExtiLine); +} + + +/** + * @brief Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31 + * @note The configurable wakeup lines are edge-triggered. No glitch must be + * generated on these lines. If a Falling edge on a configurable interrupt + * line occurs during a write operation in the EXTI_FTSR register, the + * pending bit is not set. + * Rising and falling edge triggers can be set for the same interrupt line. + * In this case, both generate a trigger condition. + * @rmtoll FTSR FTx LL_EXTI_DisableFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine) +{ + CLEAR_BIT(EXTI->FTSR, ExtiLine); +} + + +/** + * @brief Check if falling edge trigger is enabled for Lines in range 0 to 31 + * @rmtoll FTSR FTx LL_EXTI_IsEnabledFallingTrig_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsEnabledFallingTrig_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->FTSR, ExtiLine) == (ExtiLine)); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Software_Interrupt_Management Software_Interrupt_Management + * @{ + */ + +/** + * @brief Generate a software Interrupt Event for Lines in range 0 to 31 + * @note If the interrupt is enabled on this line in the EXTI_IMR, writing a 1 to + * this bit when it is at '0' sets the corresponding pending bit in EXTI_PR + * resulting in an interrupt request generation. + * This bit is cleared by clearing the corresponding bit in the EXTI_PR + * register (by writing a 1 into the bit) + * @rmtoll SWIER SWIx LL_EXTI_GenerateSWI_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_GenerateSWI_0_31(uint32_t ExtiLine) +{ + SET_BIT(EXTI->SWIER, ExtiLine); +} + + +/** + * @} + */ + +/** @defgroup EXTI_LL_EF_Flag_Management Flag_Management + * @{ + */ + +/** + * @brief Check if the ExtLine Flag is set or not for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_IsActiveFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine) +{ + return (READ_BIT(EXTI->PR, ExtiLine) == (ExtiLine)); +} + + +/** + * @brief Read ExtLine Combination Flag for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_ReadFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval @note This bit is set when the selected edge event arrives on the interrupt + */ +__STATIC_INLINE uint32_t LL_EXTI_ReadFlag_0_31(uint32_t ExtiLine) +{ + return (uint32_t)(READ_BIT(EXTI->PR, ExtiLine)); +} + + +/** + * @brief Clear ExtLine Flags for Lines in range 0 to 31 + * @note This bit is set when the selected edge event arrives on the interrupt + * line. This bit is cleared by writing a 1 to the bit. + * @rmtoll PR PIFx LL_EXTI_ClearFlag_0_31 + * @param ExtiLine This parameter can be a combination of the following values: + * @arg @ref LL_EXTI_LINE_0 + * @arg @ref LL_EXTI_LINE_1 + * @arg @ref LL_EXTI_LINE_2 + * @arg @ref LL_EXTI_LINE_3 + * @arg @ref LL_EXTI_LINE_4 + * @arg @ref LL_EXTI_LINE_5 + * @arg @ref LL_EXTI_LINE_6 + * @arg @ref LL_EXTI_LINE_7 + * @arg @ref LL_EXTI_LINE_8 + * @arg @ref LL_EXTI_LINE_9 + * @arg @ref LL_EXTI_LINE_10 + * @arg @ref LL_EXTI_LINE_11 + * @arg @ref LL_EXTI_LINE_12 + * @arg @ref LL_EXTI_LINE_13 + * @arg @ref LL_EXTI_LINE_14 + * @arg @ref LL_EXTI_LINE_15 + * @arg @ref LL_EXTI_LINE_16 + * @arg @ref LL_EXTI_LINE_18 + * @arg @ref LL_EXTI_LINE_19 + * @note Please check each device line mapping for EXTI Line availability + * @retval None + */ +__STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine) +{ + WRITE_REG(EXTI->PR, ExtiLine); +} + + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup EXTI_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct); +uint32_t LL_EXTI_DeInit(void); +void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct); + + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* EXTI */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_LL_EXTI_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h new file mode 100644 index 0000000..c6f41d5 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h @@ -0,0 +1,2347 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_gpio.h + * @author MCD Application Team + * @brief Header file of GPIO LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 STM32F1xx_LL_GPIO_H +#define STM32F1xx_LL_GPIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) + +/** @defgroup GPIO_LL GPIO + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ + +/** @defgroup GPIO_LL_Private_Constants GPIO Private Constants + * @{ + */ +/* Defines used for Pin Mask Initialization */ +#define GPIO_PIN_MASK_POS 8U +#define GPIO_PIN_NB 16U +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_Private_Macros GPIO Private Macros + * @{ + */ + +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures + * @{ + */ + +/** + * @brief LL GPIO Init Structure definition + */ +typedef struct +{ + uint32_t Pin; /*!< Specifies the GPIO pins to be configured. + This parameter can be any value of @ref GPIO_LL_EC_PIN */ + + uint32_t Mode; /*!< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_MODE. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/ + + uint32_t Speed; /*!< Specifies the speed for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_SPEED. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/ + + uint32_t OutputType; /*!< Specifies the operating output type for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_OUTPUT. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/ + + uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_PULL. + + GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/ +} LL_GPIO_InitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_LL_EC_PIN PIN + * @{ + */ +#define LL_GPIO_PIN_0 ((GPIO_BSRR_BS0 << GPIO_PIN_MASK_POS) | 0x00000001U) /*!< Select pin 0 */ +#define LL_GPIO_PIN_1 ((GPIO_BSRR_BS1 << GPIO_PIN_MASK_POS) | 0x00000002U) /*!< Select pin 1 */ +#define LL_GPIO_PIN_2 ((GPIO_BSRR_BS2 << GPIO_PIN_MASK_POS) | 0x00000004U) /*!< Select pin 2 */ +#define LL_GPIO_PIN_3 ((GPIO_BSRR_BS3 << GPIO_PIN_MASK_POS) | 0x00000008U) /*!< Select pin 3 */ +#define LL_GPIO_PIN_4 ((GPIO_BSRR_BS4 << GPIO_PIN_MASK_POS) | 0x00000010U) /*!< Select pin 4 */ +#define LL_GPIO_PIN_5 ((GPIO_BSRR_BS5 << GPIO_PIN_MASK_POS) | 0x00000020U) /*!< Select pin 5 */ +#define LL_GPIO_PIN_6 ((GPIO_BSRR_BS6 << GPIO_PIN_MASK_POS) | 0x00000040U) /*!< Select pin 6 */ +#define LL_GPIO_PIN_7 ((GPIO_BSRR_BS7 << GPIO_PIN_MASK_POS) | 0x00000080U) /*!< Select pin 7 */ +#define LL_GPIO_PIN_8 ((GPIO_BSRR_BS8 << GPIO_PIN_MASK_POS) | 0x04000001U) /*!< Select pin 8 */ +#define LL_GPIO_PIN_9 ((GPIO_BSRR_BS9 << GPIO_PIN_MASK_POS) | 0x04000002U) /*!< Select pin 9 */ +#define LL_GPIO_PIN_10 ((GPIO_BSRR_BS10 << GPIO_PIN_MASK_POS) | 0x04000004U) /*!< Select pin 10 */ +#define LL_GPIO_PIN_11 ((GPIO_BSRR_BS11 << GPIO_PIN_MASK_POS) | 0x04000008U) /*!< Select pin 11 */ +#define LL_GPIO_PIN_12 ((GPIO_BSRR_BS12 << GPIO_PIN_MASK_POS) | 0x04000010U) /*!< Select pin 12 */ +#define LL_GPIO_PIN_13 ((GPIO_BSRR_BS13 << GPIO_PIN_MASK_POS) | 0x04000020U) /*!< Select pin 13 */ +#define LL_GPIO_PIN_14 ((GPIO_BSRR_BS14 << GPIO_PIN_MASK_POS) | 0x04000040U) /*!< Select pin 14 */ +#define LL_GPIO_PIN_15 ((GPIO_BSRR_BS15 << GPIO_PIN_MASK_POS) | 0x04000080U) /*!< Select pin 15 */ +#define LL_GPIO_PIN_ALL (LL_GPIO_PIN_0 | LL_GPIO_PIN_1 | LL_GPIO_PIN_2 | \ + LL_GPIO_PIN_3 | LL_GPIO_PIN_4 | LL_GPIO_PIN_5 | \ + LL_GPIO_PIN_6 | LL_GPIO_PIN_7 | LL_GPIO_PIN_8 | \ + LL_GPIO_PIN_9 | LL_GPIO_PIN_10 | LL_GPIO_PIN_11 | \ + LL_GPIO_PIN_12 | LL_GPIO_PIN_13 | LL_GPIO_PIN_14 | \ + LL_GPIO_PIN_15) /*!< Select all pins */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_MODE Mode + * @{ + */ +#define LL_GPIO_MODE_ANALOG 0x00000000U /*!< Select analog mode */ +#define LL_GPIO_MODE_FLOATING GPIO_CRL_CNF0_0 /*!< Select floating mode */ +#define LL_GPIO_MODE_INPUT GPIO_CRL_CNF0_1 /*!< Select input mode */ +#define LL_GPIO_MODE_OUTPUT GPIO_CRL_MODE0_0 /*!< Select general purpose output mode */ +#define LL_GPIO_MODE_ALTERNATE (GPIO_CRL_CNF0_1 | GPIO_CRL_MODE0_0) /*!< Select alternate function mode */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_OUTPUT Output Type + * @{ + */ +#define LL_GPIO_OUTPUT_PUSHPULL 0x00000000U /*!< Select push-pull as output type */ +#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_CRL_CNF0_0 /*!< Select open-drain as output type */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_SPEED Output Speed + * @{ + */ +#define LL_GPIO_MODE_OUTPUT_10MHz GPIO_CRL_MODE0_0 /*!< Select Output mode, max speed 10 MHz */ +#define LL_GPIO_MODE_OUTPUT_2MHz GPIO_CRL_MODE0_1 /*!< Select Output mode, max speed 20 MHz */ +#define LL_GPIO_MODE_OUTPUT_50MHz GPIO_CRL_MODE0 /*!< Select Output mode, max speed 50 MHz */ +/** + * @} + */ + +#define LL_GPIO_SPEED_FREQ_LOW LL_GPIO_MODE_OUTPUT_2MHz /*!< Select I/O low output speed */ +#define LL_GPIO_SPEED_FREQ_MEDIUM LL_GPIO_MODE_OUTPUT_10MHz /*!< Select I/O medium output speed */ +#define LL_GPIO_SPEED_FREQ_HIGH LL_GPIO_MODE_OUTPUT_50MHz /*!< Select I/O high output speed */ + +/** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down + * @{ + */ +#define LL_GPIO_PULL_DOWN 0x00000000U /*!< Select I/O pull down */ +#define LL_GPIO_PULL_UP GPIO_ODR_ODR0 /*!< Select I/O pull up */ + +/** + * @} + */ + +/** @defgroup GPIO_LL_EVENTOUT_PIN EVENTOUT Pin + * @{ + */ + +#define LL_GPIO_AF_EVENTOUT_PIN_0 AFIO_EVCR_PIN_PX0 /*!< EVENTOUT on pin 0 */ +#define LL_GPIO_AF_EVENTOUT_PIN_1 AFIO_EVCR_PIN_PX1 /*!< EVENTOUT on pin 1 */ +#define LL_GPIO_AF_EVENTOUT_PIN_2 AFIO_EVCR_PIN_PX2 /*!< EVENTOUT on pin 2 */ +#define LL_GPIO_AF_EVENTOUT_PIN_3 AFIO_EVCR_PIN_PX3 /*!< EVENTOUT on pin 3 */ +#define LL_GPIO_AF_EVENTOUT_PIN_4 AFIO_EVCR_PIN_PX4 /*!< EVENTOUT on pin 4 */ +#define LL_GPIO_AF_EVENTOUT_PIN_5 AFIO_EVCR_PIN_PX5 /*!< EVENTOUT on pin 5 */ +#define LL_GPIO_AF_EVENTOUT_PIN_6 AFIO_EVCR_PIN_PX6 /*!< EVENTOUT on pin 6 */ +#define LL_GPIO_AF_EVENTOUT_PIN_7 AFIO_EVCR_PIN_PX7 /*!< EVENTOUT on pin 7 */ +#define LL_GPIO_AF_EVENTOUT_PIN_8 AFIO_EVCR_PIN_PX8 /*!< EVENTOUT on pin 8 */ +#define LL_GPIO_AF_EVENTOUT_PIN_9 AFIO_EVCR_PIN_PX9 /*!< EVENTOUT on pin 9 */ +#define LL_GPIO_AF_EVENTOUT_PIN_10 AFIO_EVCR_PIN_PX10 /*!< EVENTOUT on pin 10 */ +#define LL_GPIO_AF_EVENTOUT_PIN_11 AFIO_EVCR_PIN_PX11 /*!< EVENTOUT on pin 11 */ +#define LL_GPIO_AF_EVENTOUT_PIN_12 AFIO_EVCR_PIN_PX12 /*!< EVENTOUT on pin 12 */ +#define LL_GPIO_AF_EVENTOUT_PIN_13 AFIO_EVCR_PIN_PX13 /*!< EVENTOUT on pin 13 */ +#define LL_GPIO_AF_EVENTOUT_PIN_14 AFIO_EVCR_PIN_PX14 /*!< EVENTOUT on pin 14 */ +#define LL_GPIO_AF_EVENTOUT_PIN_15 AFIO_EVCR_PIN_PX15 /*!< EVENTOUT on pin 15 */ + +/** + * @} + */ + +/** @defgroup GPIO_LL_EVENTOUT_PORT EVENTOUT Port + * @{ + */ + +#define LL_GPIO_AF_EVENTOUT_PORT_A AFIO_EVCR_PORT_PA /*!< EVENTOUT on port A */ +#define LL_GPIO_AF_EVENTOUT_PORT_B AFIO_EVCR_PORT_PB /*!< EVENTOUT on port B */ +#define LL_GPIO_AF_EVENTOUT_PORT_C AFIO_EVCR_PORT_PC /*!< EVENTOUT on port C */ +#define LL_GPIO_AF_EVENTOUT_PORT_D AFIO_EVCR_PORT_PD /*!< EVENTOUT on port D */ +#define LL_GPIO_AF_EVENTOUT_PORT_E AFIO_EVCR_PORT_PE /*!< EVENTOUT on port E */ + +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_EXTI_PORT GPIO EXTI PORT + * @{ + */ +#define LL_GPIO_AF_EXTI_PORTA 0U /*!< EXTI PORT A */ +#define LL_GPIO_AF_EXTI_PORTB 1U /*!< EXTI PORT B */ +#define LL_GPIO_AF_EXTI_PORTC 2U /*!< EXTI PORT C */ +#define LL_GPIO_AF_EXTI_PORTD 3U /*!< EXTI PORT D */ +#define LL_GPIO_AF_EXTI_PORTE 4U /*!< EXTI PORT E */ +#define LL_GPIO_AF_EXTI_PORTF 5U /*!< EXTI PORT F */ +#define LL_GPIO_AF_EXTI_PORTG 6U /*!< EXTI PORT G */ +/** + * @} + */ + +/** @defgroup GPIO_LL_EC_EXTI_LINE GPIO EXTI LINE + * @{ + */ +#define LL_GPIO_AF_EXTI_LINE0 (0x000FU << 16U | 0U) /*!< EXTI_POSITION_0 | EXTICR[0] */ +#define LL_GPIO_AF_EXTI_LINE1 (0x00F0U << 16U | 0U) /*!< EXTI_POSITION_4 | EXTICR[0] */ +#define LL_GPIO_AF_EXTI_LINE2 (0x0F00U << 16U | 0U) /*!< EXTI_POSITION_8 | EXTICR[0] */ +#define LL_GPIO_AF_EXTI_LINE3 (0xF000U << 16U | 0U) /*!< EXTI_POSITION_12 | EXTICR[0] */ +#define LL_GPIO_AF_EXTI_LINE4 (0x000FU << 16U | 1U) /*!< EXTI_POSITION_0 | EXTICR[1] */ +#define LL_GPIO_AF_EXTI_LINE5 (0x00F0U << 16U | 1U) /*!< EXTI_POSITION_4 | EXTICR[1] */ +#define LL_GPIO_AF_EXTI_LINE6 (0x0F00U << 16U | 1U) /*!< EXTI_POSITION_8 | EXTICR[1] */ +#define LL_GPIO_AF_EXTI_LINE7 (0xF000U << 16U | 1U) /*!< EXTI_POSITION_12 | EXTICR[1] */ +#define LL_GPIO_AF_EXTI_LINE8 (0x000FU << 16U | 2U) /*!< EXTI_POSITION_0 | EXTICR[2] */ +#define LL_GPIO_AF_EXTI_LINE9 (0x00F0U << 16U | 2U) /*!< EXTI_POSITION_4 | EXTICR[2] */ +#define LL_GPIO_AF_EXTI_LINE10 (0x0F00U << 16U | 2U) /*!< EXTI_POSITION_8 | EXTICR[2] */ +#define LL_GPIO_AF_EXTI_LINE11 (0xF000U << 16U | 2U) /*!< EXTI_POSITION_12 | EXTICR[2] */ +#define LL_GPIO_AF_EXTI_LINE12 (0x000FU << 16U | 3U) /*!< EXTI_POSITION_0 | EXTICR[3] */ +#define LL_GPIO_AF_EXTI_LINE13 (0x00F0U << 16U | 3U) /*!< EXTI_POSITION_4 | EXTICR[3] */ +#define LL_GPIO_AF_EXTI_LINE14 (0x0F00U << 16U | 3U) /*!< EXTI_POSITION_8 | EXTICR[3] */ +#define LL_GPIO_AF_EXTI_LINE15 (0xF000U << 16U | 3U) /*!< EXTI_POSITION_12 | EXTICR[3] */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in GPIO register + * @param __INSTANCE__ GPIO Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in GPIO register + * @param __INSTANCE__ GPIO Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions + * @{ + */ + +/** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration + * @{ + */ + +/** + * @brief Configure gpio mode for a dedicated pin on dedicated port. + * @note I/O mode can be Analog, Floating input, Input with pull-up/pull-down, General purpose Output, + * Alternate function Output. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll CRL CNFy LL_GPIO_SetPinMode + * @rmtoll CRL MODEy LL_GPIO_SetPinMode + * @rmtoll CRH CNFy LL_GPIO_SetPinMode + * @rmtoll CRH MODEy LL_GPIO_SetPinMode + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_GPIO_MODE_ANALOG + * @arg @ref LL_GPIO_MODE_FLOATING + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + * @arg @ref LL_GPIO_MODE_ALTERNATE + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + MODIFY_REG(*pReg, ((GPIO_CRL_CNF0 | GPIO_CRL_MODE0) << (POSITION_VAL(Pin) * 4U)), (Mode << (POSITION_VAL(Pin) * 4U))); +} + +/** + * @brief Return gpio mode for a dedicated pin on dedicated port. + * @note I/O mode can be Analog, Floating input, Input with pull-up/pull-down, General purpose Output, + * Alternate function Output. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll CRL CNFy LL_GPIO_GetPinMode + * @rmtoll CRL MODEy LL_GPIO_GetPinMode + * @rmtoll CRH CNFy LL_GPIO_GetPinMode + * @rmtoll CRH MODEy LL_GPIO_GetPinMode + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_MODE_ANALOG + * @arg @ref LL_GPIO_MODE_FLOATING + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + * @arg @ref LL_GPIO_MODE_ALTERNATE + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + return (READ_BIT(*pReg, ((GPIO_CRL_CNF0 | GPIO_CRL_MODE0) << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); +} + +/** + * @brief Configure gpio speed for a dedicated pin on dedicated port. + * @note I/O speed can be Low, Medium or Fast speed. + * @note Warning: only one pin can be passed as parameter. + * @note Refer to datasheet for frequency specifications and the power + * supply and load conditions for each speed. + * @rmtoll CRL MODEy LL_GPIO_SetPinSpeed + * @rmtoll CRH MODEy LL_GPIO_SetPinSpeed + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Speed This parameter can be one of the following values: + * @arg @ref LL_GPIO_SPEED_FREQ_LOW + * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM + * @arg @ref LL_GPIO_SPEED_FREQ_HIGH + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + MODIFY_REG(*pReg, (GPIO_CRL_MODE0 << (POSITION_VAL(Pin) * 4U)), + (Speed << (POSITION_VAL(Pin) * 4U))); +} + +/** + * @brief Return gpio speed for a dedicated pin on dedicated port. + * @note I/O speed can be Low, Medium, Fast or High speed. + * @note Warning: only one pin can be passed as parameter. + * @note Refer to datasheet for frequency specifications and the power + * supply and load conditions for each speed. + * @rmtoll CRL MODEy LL_GPIO_GetPinSpeed + * @rmtoll CRH MODEy LL_GPIO_GetPinSpeed + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_SPEED_FREQ_LOW + * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM + * @arg @ref LL_GPIO_SPEED_FREQ_HIGH + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + return (READ_BIT(*pReg, (GPIO_CRL_MODE0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); +} + +/** + * @brief Configure gpio output type for several pins on dedicated port. + * @note Output type as to be set when gpio pin is in output or + * alternate modes. Possible type are Push-pull or Open-drain. + * @rmtoll CRL MODEy LL_GPIO_SetPinOutputType + * @rmtoll CRH MODEy LL_GPIO_SetPinOutputType + * @param GPIOx GPIO Port + * @param Pin This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @param OutputType This parameter can be one of the following values: + * @arg @ref LL_GPIO_OUTPUT_PUSHPULL + * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t OutputType) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + MODIFY_REG(*pReg, (GPIO_CRL_CNF0_0 << (POSITION_VAL(Pin) * 4U)), + (OutputType << (POSITION_VAL(Pin) * 4U))); +} + +/** + * @brief Return gpio output type for several pins on dedicated port. + * @note Output type as to be set when gpio pin is in output or + * alternate modes. Possible type are Push-pull or Open-drain. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll CRL MODEy LL_GPIO_GetPinOutputType + * @rmtoll CRH MODEy LL_GPIO_GetPinOutputType + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_OUTPUT_PUSHPULL + * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); + return (READ_BIT(*pReg, (GPIO_CRL_CNF0_0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); + +} + +/** + * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port. + * @note Warning: only one pin can be passed as parameter. + * @rmtoll ODR ODR LL_GPIO_SetPinPull + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param Pull This parameter can be one of the following values: + * @arg @ref LL_GPIO_PULL_DOWN + * @arg @ref LL_GPIO_PULL_UP + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) +{ + MODIFY_REG(GPIOx->ODR, (Pin >> GPIO_PIN_MASK_POS), Pull << (POSITION_VAL(Pin >> GPIO_PIN_MASK_POS))); +} + +/** + * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port + * @note Warning: only one pin can be passed as parameter. + * @rmtoll ODR ODR LL_GPIO_GetPinPull + * @param GPIOx GPIO Port + * @param Pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_PULL_DOWN + * @arg @ref LL_GPIO_PULL_UP + */ +__STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin) +{ + return (READ_BIT(GPIOx->ODR, (GPIO_ODR_ODR0 << (POSITION_VAL(Pin >> GPIO_PIN_MASK_POS)))) >> (POSITION_VAL(Pin >> GPIO_PIN_MASK_POS))); +} + +/** + * @brief Lock configuration of several pins for a dedicated port. + * @note When the lock sequence has been applied on a port bit, the + * value of this port bit can no longer be modified until the + * next reset. + * @note Each lock bit freezes a specific configuration register + * (control and alternate function registers). + * @rmtoll LCKR LCKK LL_GPIO_LockPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + __IO uint32_t temp; + WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); + WRITE_REG(GPIOx->LCKR, ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); + WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); + temp = READ_REG(GPIOx->LCKR); + (void) temp; +} + +/** + * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0. + * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->LCKR, ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)) == ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); +} + +/** + * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0. + * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked + * @param GPIOx GPIO Port + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx) +{ + return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)); +} + +/** + * @} + */ + +/** @defgroup GPIO_LL_EF_Data_Access Data Access + * @{ + */ + +/** + * @brief Return full input data register value for a dedicated port. + * @rmtoll IDR IDy LL_GPIO_ReadInputPort + * @param GPIOx GPIO Port + * @retval Input data register value of port + */ +__STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx) +{ + return (READ_REG(GPIOx->IDR)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * @rmtoll IDR IDy LL_GPIO_IsInputPinSet + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->IDR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU) == ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); +} + +/** + * @brief Write output data register for the port. + * @rmtoll ODR ODy LL_GPIO_WriteOutputPort + * @param GPIOx GPIO Port + * @param PortValue Level value for each pin of the port + * @retval None + */ +__STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue) +{ + WRITE_REG(GPIOx->ODR, PortValue); +} + +/** + * @brief Return full output data register value for a dedicated port. + * @rmtoll ODR ODy LL_GPIO_ReadOutputPort + * @param GPIOx GPIO Port + * @retval Output data register value of port + */ +__STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx) +{ + return (uint32_t)(READ_REG(GPIOx->ODR)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + return (READ_BIT(GPIOx->ODR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU) == ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU)); +} + +/** + * @brief Set several pins to high level on dedicated gpio port. + * @rmtoll BSRR BSy LL_GPIO_SetOutputPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + WRITE_REG(GPIOx->BSRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); +} + +/** + * @brief Set several pins to low level on dedicated gpio port. + * @rmtoll BRR BRy LL_GPIO_ResetOutputPin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + WRITE_REG(GPIOx->BRR, (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); +} + +/** + * @brief Toggle data value for several pin of dedicated port. + * @rmtoll ODR ODy LL_GPIO_TogglePin + * @param GPIOx GPIO Port + * @param PinMask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask) +{ + uint32_t odr = READ_REG(GPIOx->ODR); + uint32_t pinmask = ((PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU); + WRITE_REG(GPIOx->BSRR, ((odr & pinmask) << 16u) | (~odr & pinmask)); +} + +/** + * @} + */ + +/** @defgroup GPIO_AF_REMAPPING Alternate Function Remapping + * @brief This section propose definition to remap the alternate function to some other port/pins. + * @{ + */ + +/** + * @brief Enable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI. + * @rmtoll MAPR SPI1_REMAP LL_GPIO_AF_EnableRemap_SPI1 + * @note ENABLE: Remap (NSS/PA15, SCK/PB3, MISO/PB4, MOSI/PB5) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_SPI1(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_SPI1_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI. + * @rmtoll MAPR SPI1_REMAP LL_GPIO_AF_DisableRemap_SPI1 + * @note DISABLE: No remap (NSS/PA4, SCK/PA5, MISO/PA6, MOSI/PA7) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_SPI1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_SPI1_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if SPI1 has been remaped or not + * @rmtoll MAPR SPI1_REMAP LL_GPIO_AF_IsEnabledRemap_SPI1 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_SPI1(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_SPI1_REMAP) == (AFIO_MAPR_SPI1_REMAP)); +} + +/** + * @brief Enable the remapping of I2C1 alternate function SCL and SDA. + * @rmtoll MAPR I2C1_REMAP LL_GPIO_AF_EnableRemap_I2C1 + * @note ENABLE: Remap (SCL/PB8, SDA/PB9) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_I2C1(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_I2C1_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of I2C1 alternate function SCL and SDA. + * @rmtoll MAPR I2C1_REMAP LL_GPIO_AF_DisableRemap_I2C1 + * @note DISABLE: No remap (SCL/PB6, SDA/PB7) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_I2C1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_I2C1_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if I2C1 has been remaped or not + * @rmtoll MAPR I2C1_REMAP LL_GPIO_AF_IsEnabledRemap_I2C1 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_I2C1(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_I2C1_REMAP) == (AFIO_MAPR_I2C1_REMAP)); +} + +/** + * @brief Enable the remapping of USART1 alternate function TX and RX. + * @rmtoll MAPR USART1_REMAP LL_GPIO_AF_EnableRemap_USART1 + * @note ENABLE: Remap (TX/PB6, RX/PB7) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_USART1(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_USART1_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of USART1 alternate function TX and RX. + * @rmtoll MAPR USART1_REMAP LL_GPIO_AF_DisableRemap_USART1 + * @note DISABLE: No remap (TX/PA9, RX/PA10) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_USART1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_USART1_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if USART1 has been remaped or not + * @rmtoll MAPR USART1_REMAP LL_GPIO_AF_IsEnabledRemap_USART1 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_USART1(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_USART1_REMAP) == (AFIO_MAPR_USART1_REMAP)); +} + +/** + * @brief Enable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX. + * @rmtoll MAPR USART2_REMAP LL_GPIO_AF_EnableRemap_USART2 + * @note ENABLE: Remap (CTS/PD3, RTS/PD4, TX/PD5, RX/PD6, CK/PD7) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_USART2(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_USART2_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX. + * @rmtoll MAPR USART2_REMAP LL_GPIO_AF_DisableRemap_USART2 + * @note DISABLE: No remap (CTS/PA0, RTS/PA1, TX/PA2, RX/PA3, CK/PA4) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_USART2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_USART2_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if USART2 has been remaped or not + * @rmtoll MAPR USART2_REMAP LL_GPIO_AF_IsEnabledRemap_USART2 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_USART2(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_USART2_REMAP) == (AFIO_MAPR_USART2_REMAP)); +} + +#if defined (AFIO_MAPR_USART3_REMAP) +/** + * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @rmtoll MAPR USART3_REMAP LL_GPIO_AF_EnableRemap_USART3 + * @note ENABLE: Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_USART3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_USART3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_USART3_REMAP_FULLREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @rmtoll MAPR USART3_REMAP LL_GPIO_AF_RemapPartial_USART3 + * @note PARTIAL: Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial_USART3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_USART3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_USART3_REMAP_PARTIALREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Disable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX. + * @rmtoll MAPR USART3_REMAP LL_GPIO_AF_DisableRemap_USART3 + * @note DISABLE: No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_USART3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_USART3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_USART3_REMAP_NOREMAP | AFIO_MAPR_SWJ_CFG)); +} +#endif + +/** + * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @rmtoll MAPR TIM1_REMAP LL_GPIO_AF_EnableRemap_TIM1 + * @note ENABLE: Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM1_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM1_REMAP_FULLREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @rmtoll MAPR TIM1_REMAP LL_GPIO_AF_RemapPartial_TIM1 + * @note PARTIAL: Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial_TIM1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM1_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM1_REMAP_PARTIALREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Disable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) + * @rmtoll MAPR TIM1_REMAP LL_GPIO_AF_DisableRemap_TIM1 + * @note DISABLE: No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM1_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM1_REMAP_NOREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @rmtoll MAPR TIM2_REMAP LL_GPIO_AF_EnableRemap_TIM2 + * @note ENABLE: Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM2_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM2_REMAP_FULLREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @rmtoll MAPR TIM2_REMAP LL_GPIO_AF_RemapPartial2_TIM2 + * @note PARTIAL_2: Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial2_TIM2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM2_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2 | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @rmtoll MAPR TIM2_REMAP LL_GPIO_AF_RemapPartial1_TIM2 + * @note PARTIAL_1: Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial1_TIM2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM2_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1 | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Disable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR) + * @rmtoll MAPR TIM2_REMAP LL_GPIO_AF_DisableRemap_TIM2 + * @note DISABLE: No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM2_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM2_REMAP_NOREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM3 alternate function channels 1 to 4 + * @rmtoll MAPR TIM3_REMAP LL_GPIO_AF_EnableRemap_TIM3 + * @note ENABLE: Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM3_REMAP_FULLREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable the remapping of TIM3 alternate function channels 1 to 4 + * @rmtoll MAPR TIM3_REMAP LL_GPIO_AF_RemapPartial_TIM3 + * @note PARTIAL: Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial_TIM3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM3_REMAP_PARTIALREMAP | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Disable the remapping of TIM3 alternate function channels 1 to 4 + * @rmtoll MAPR TIM3_REMAP LL_GPIO_AF_DisableRemap_TIM3 + * @note DISABLE: No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1) + * @note TIM3_ETR on PE0 is not re-mapped. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM3_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_TIM3_REMAP_NOREMAP | AFIO_MAPR_SWJ_CFG)); +} + +#if defined(AFIO_MAPR_TIM4_REMAP) +/** + * @brief Enable the remapping of TIM4 alternate function channels 1 to 4. + * @rmtoll MAPR TIM4_REMAP LL_GPIO_AF_EnableRemap_TIM4 + * @note ENABLE: Full remap (TIM4_CH1/PD12, TIM4_CH2/PD13, TIM4_CH3/PD14, TIM4_CH4/PD15) + * @note TIM4_ETR on PE0 is not re-mapped. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM4(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_TIM4_REMAP | AFIO_MAPR_SWJ_CFG); +} +/** + * @brief Disable the remapping of TIM4 alternate function channels 1 to 4. + * @rmtoll MAPR TIM4_REMAP LL_GPIO_AF_DisableRemap_TIM4 + * @note DISABLE: No remap (TIM4_CH1/PB6, TIM4_CH2/PB7, TIM4_CH3/PB8, TIM4_CH4/PB9) + * @note TIM4_ETR on PE0 is not re-mapped. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM4(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM4_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if TIM4 has been remaped or not + * @rmtoll MAPR TIM4_REMAP LL_GPIO_AF_IsEnabledRemap_TIM4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM4(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_TIM4_REMAP) == (AFIO_MAPR_TIM4_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_CAN_REMAP_REMAP1) + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @rmtoll MAPR CAN_REMAP LL_GPIO_AF_RemapPartial1_CAN1 + * @note CASE 1: CAN_RX mapped to PA11, CAN_TX mapped to PA12 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial1_CAN1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_CAN_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_CAN_REMAP_REMAP1 | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @rmtoll MAPR CAN_REMAP LL_GPIO_AF_RemapPartial2_CAN1 + * @note CASE 2: CAN_RX mapped to PB8, CAN_TX mapped to PB9 (not available on 36-pin package) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial2_CAN1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_CAN_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_CAN_REMAP_REMAP2 | AFIO_MAPR_SWJ_CFG)); +} + +/** + * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface. + * @rmtoll MAPR CAN_REMAP LL_GPIO_AF_RemapPartial3_CAN1 + * @note CASE 3: CAN_RX mapped to PD0, CAN_TX mapped to PD1 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_RemapPartial3_CAN1(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_CAN_REMAP | AFIO_MAPR_SWJ_CFG), (AFIO_MAPR_CAN_REMAP_REMAP3 | AFIO_MAPR_SWJ_CFG)); +} +#endif + +/** + * @brief Enable the remapping of PD0 and PD1. When the HSE oscillator is not used + * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and + * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available + * on 100-pin and 144-pin packages, no need for remapping). + * @rmtoll MAPR PD01_REMAP LL_GPIO_AF_EnableRemap_PD01 + * @note ENABLE: PD0 remapped on OSC_IN, PD1 remapped on OSC_OUT. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_PD01(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_PD01_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of PD0 and PD1. When the HSE oscillator is not used + * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and + * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available + * on 100-pin and 144-pin packages, no need for remapping). + * @rmtoll MAPR PD01_REMAP LL_GPIO_AF_DisableRemap_PD01 + * @note DISABLE: No remapping of PD0 and PD1 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_PD01(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_PD01_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if PD01 has been remaped or not + * @rmtoll MAPR PD01_REMAP LL_GPIO_AF_IsEnabledRemap_PD01 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_PD01(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_PD01_REMAP) == (AFIO_MAPR_PD01_REMAP)); +} + +#if defined(AFIO_MAPR_TIM5CH4_IREMAP) +/** + * @brief Enable the remapping of TIM5CH4. + * @rmtoll MAPR TIM5CH4_IREMAP LL_GPIO_AF_EnableRemap_TIM5CH4 + * @note ENABLE: LSI internal clock is connected to TIM5_CH4 input for calibration purpose. + * @note This function is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM5CH4(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_TIM5CH4_IREMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of TIM5CH4. + * @rmtoll MAPR TIM5CH4_IREMAP LL_GPIO_AF_DisableRemap_TIM5CH4 + * @note DISABLE: TIM5_CH4 is connected to PA3 + * @note This function is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM5CH4(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM5CH4_IREMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if TIM5CH4 has been remaped or not + * @rmtoll MAPR TIM5CH4_IREMAP LL_GPIO_AF_IsEnabledRemap_TIM5CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM5CH4(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_TIM5CH4_IREMAP) == (AFIO_MAPR_TIM5CH4_IREMAP)); +} +#endif + +#if defined(AFIO_MAPR_ETH_REMAP) +/** + * @brief Enable the remapping of Ethernet MAC connections with the PHY. + * @rmtoll MAPR ETH_REMAP LL_GPIO_AF_EnableRemap_ETH + * @note ENABLE: Remap (RX_DV-CRS_DV/PD8, RXD0/PD9, RXD1/PD10, RXD2/PD11, RXD3/PD12) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ETH(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_ETH_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of Ethernet MAC connections with the PHY. + * @rmtoll MAPR ETH_REMAP LL_GPIO_AF_DisableRemap_ETH + * @note DISABLE: No remap (RX_DV-CRS_DV/PA7, RXD0/PC4, RXD1/PC5, RXD2/PB0, RXD3/PB1) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ETH(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_ETH_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if ETH has been remaped or not + * @rmtoll MAPR ETH_REMAP LL_GPIO_AF_IsEnabledRemap_ETH + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_ETH(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_ETH_REMAP) == (AFIO_MAPR_ETH_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_CAN2_REMAP) + +/** + * @brief Enable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX. + * @rmtoll MAPR CAN2_REMAP LL_GPIO_AF_EnableRemap_CAN2 + * @note ENABLE: Remap (CAN2_RX/PB5, CAN2_TX/PB6) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_CAN2(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_CAN2_REMAP | AFIO_MAPR_SWJ_CFG); +} +/** + * @brief Disable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX. + * @rmtoll MAPR CAN2_REMAP LL_GPIO_AF_DisableRemap_CAN2 + * @note DISABLE: No remap (CAN2_RX/PB12, CAN2_TX/PB13) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_CAN2(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_CAN2_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if CAN2 has been remaped or not + * @rmtoll MAPR CAN2_REMAP LL_GPIO_AF_IsEnabledRemap_CAN2 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_CAN2(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_CAN2_REMAP) == (AFIO_MAPR_CAN2_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_MII_RMII_SEL) +/** + * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY. + * @rmtoll MAPR MII_RMII_SEL LL_GPIO_AF_Select_ETH_RMII + * @note ETH_RMII: Configure Ethernet MAC for connection with an RMII PHY + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Select_ETH_RMII(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_MII_RMII_SEL | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY. + * @rmtoll MAPR MII_RMII_SEL LL_GPIO_AF_Select_ETH_MII + * @note ETH_MII: Configure Ethernet MAC for connection with an MII PHY + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Select_ETH_MII(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_MII_RMII_SEL | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} +#endif + +#if defined(AFIO_MAPR_ADC1_ETRGINJ_REMAP) +/** + * @brief Enable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion). + * @rmtoll MAPR ADC1_ETRGINJ_REMAP LL_GPIO_AF_EnableRemap_ADC1_ETRGINJ + * @note ENABLE: ADC1 External Event injected conversion is connected to TIM8 Channel4. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ADC1_ETRGINJ(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_ADC1_ETRGINJ_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion). + * @rmtoll MAPR ADC1_ETRGINJ_REMAP LL_GPIO_AF_DisableRemap_ADC1_ETRGINJ + * @note DISABLE: ADC1 External trigger injected conversion is connected to EXTI15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ADC1_ETRGINJ(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_ADC1_ETRGINJ_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if ADC1_ETRGINJ has been remaped or not + * @rmtoll MAPR ADC1_ETRGINJ_REMAP LL_GPIO_AF_IsEnabledRemap_ADC1_ETRGINJ + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_ADC1_ETRGINJ(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_ADC1_ETRGINJ_REMAP) == (AFIO_MAPR_ADC1_ETRGINJ_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_ADC1_ETRGREG_REMAP) +/** + * @brief Enable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion). + * @rmtoll MAPR ADC1_ETRGREG_REMAP LL_GPIO_AF_EnableRemap_ADC1_ETRGREG + * @note ENABLE: ADC1 External Event regular conversion is connected to TIM8 TRG0. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ADC1_ETRGREG(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_ADC1_ETRGREG_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion). + * @rmtoll MAPR ADC1_ETRGREG_REMAP LL_GPIO_AF_DisableRemap_ADC1_ETRGREG + * @note DISABLE: ADC1 External trigger regular conversion is connected to EXTI11 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ADC1_ETRGREG(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_ADC1_ETRGREG_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if ADC1_ETRGREG has been remaped or not + * @rmtoll MAPR ADC1_ETRGREG_REMAP LL_GPIO_AF_IsEnabledRemap_ADC1_ETRGREG + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_ADC1_ETRGREG(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_ADC1_ETRGREG_REMAP) == (AFIO_MAPR_ADC1_ETRGREG_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_ADC2_ETRGINJ_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion). + * @rmtoll MAPR ADC2_ETRGINJ_REMAP LL_GPIO_AF_EnableRemap_ADC2_ETRGINJ + * @note ENABLE: ADC2 External Event injected conversion is connected to TIM8 Channel4. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ADC2_ETRGINJ(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_ADC2_ETRGINJ_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion). + * @rmtoll MAPR ADC2_ETRGINJ_REMAP LL_GPIO_AF_DisableRemap_ADC2_ETRGINJ + * @note DISABLE: ADC2 External trigger injected conversion is connected to EXTI15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ADC2_ETRGINJ(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_ADC2_ETRGINJ_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if ADC2_ETRGINJ has been remaped or not + * @rmtoll MAPR ADC2_ETRGINJ_REMAP LL_GPIO_AF_IsEnabledRemap_ADC2_ETRGINJ + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_ADC2_ETRGINJ(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_ADC2_ETRGINJ_REMAP) == (AFIO_MAPR_ADC2_ETRGINJ_REMAP)); +} +#endif + +#if defined (AFIO_MAPR_ADC2_ETRGREG_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @rmtoll MAPR ADC2_ETRGREG_REMAP LL_GPIO_AF_EnableRemap_ADC2_ETRGREG + * @note ENABLE: ADC2 External Event regular conversion is connected to TIM8 TRG0. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ADC2_ETRGREG(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_ADC2_ETRGREG_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @rmtoll MAPR ADC2_ETRGREG_REMAP LL_GPIO_AF_DisableRemap_ADC2_ETRGREG + * @note DISABLE: ADC2 External trigger regular conversion is connected to EXTI11 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ADC2_ETRGREG(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_ADC2_ETRGREG_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if ADC2_ETRGREG has been remaped or not + * @rmtoll MAPR ADC2_ETRGREG_REMAP LL_GPIO_AF_IsEnabledRemap_ADC2_ETRGREG + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_ADC2_ETRGREG(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_ADC2_ETRGREG_REMAP) == (AFIO_MAPR_ADC2_ETRGREG_REMAP)); +} +#endif + +/** + * @brief Enable the Serial wire JTAG configuration + * @rmtoll MAPR SWJ_CFG LL_GPIO_AF_EnableRemap_SWJ + * @note ENABLE: Full SWJ (JTAG-DP + SW-DP): Reset State + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_SWJ(void) +{ + CLEAR_BIT(AFIO->MAPR,AFIO_MAPR_SWJ_CFG); + SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_RESET); +} + +/** + * @brief Enable the Serial wire JTAG configuration + * @rmtoll MAPR SWJ_CFG LL_GPIO_AF_Remap_SWJ_NONJTRST + * @note NONJTRST: Full SWJ (JTAG-DP + SW-DP) but without NJTRST + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Remap_SWJ_NONJTRST(void) +{ + CLEAR_BIT(AFIO->MAPR,AFIO_MAPR_SWJ_CFG); + SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_NOJNTRST); +} + +/** + * @brief Enable the Serial wire JTAG configuration + * @rmtoll MAPR SWJ_CFG LL_GPIO_AF_Remap_SWJ_NOJTAG + * @note NOJTAG: JTAG-DP Disabled and SW-DP Enabled + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Remap_SWJ_NOJTAG(void) +{ + CLEAR_BIT(AFIO->MAPR,AFIO_MAPR_SWJ_CFG); + SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_JTAGDISABLE); +} + +/** + * @brief Disable the Serial wire JTAG configuration + * @rmtoll MAPR SWJ_CFG LL_GPIO_AF_DisableRemap_SWJ + * @note DISABLE: JTAG-DP Disabled and SW-DP Disabled + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_SWJ(void) +{ + CLEAR_BIT(AFIO->MAPR,AFIO_MAPR_SWJ_CFG); + SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_DISABLE); +} + +#if defined(AFIO_MAPR_SPI3_REMAP) + +/** + * @brief Enable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD. + * @rmtoll MAPR SPI3_REMAP LL_GPIO_AF_EnableRemap_SPI3 + * @note ENABLE: Remap (SPI3_NSS-I2S3_WS/PA4, SPI3_SCK-I2S3_CK/PC10, SPI3_MISO/PC11, SPI3_MOSI-I2S3_SD/PC12) + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_SPI3(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_SPI3_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD. + * @rmtoll MAPR SPI3_REMAP LL_GPIO_AF_DisableRemap_SPI3 + * @note DISABLE: No remap (SPI3_NSS-I2S3_WS/PA15, SPI3_SCK-I2S3_CK/PB3, SPI3_MISO/PB4, SPI3_MOSI-I2S3_SD/PB5). + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_SPI3(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_SPI3_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Check if SPI3 has been remaped or not + * @rmtoll MAPR SPI3_REMAP LL_GPIO_AF_IsEnabledRemap_SPI3_REMAP + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_SPI3(void) +{ + return (READ_BIT(AFIO->MAPR, AFIO_MAPR_SPI3_REMAP) == (AFIO_MAPR_SPI3_REMAP)); +} +#endif + +#if defined(AFIO_MAPR_TIM2ITR1_IREMAP) + +/** + * @brief Control of TIM2_ITR1 internal mapping. + * @rmtoll MAPR TIM2ITR1_IREMAP LL_GPIO_AF_Remap_TIM2ITR1_TO_USB + * @note TO_USB: Connect USB OTG SOF (Start of Frame) output to TIM2_ITR1 for calibration purposes. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Remap_TIM2ITR1_TO_USB(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_TIM2ITR1_IREMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Control of TIM2_ITR1 internal mapping. + * @rmtoll MAPR TIM2ITR1_IREMAP LL_GPIO_AF_Remap_TIM2ITR1_TO_ETH + * @note TO_ETH: Connect TIM2_ITR1 internally to the Ethernet PTP output for calibration purposes. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Remap_TIM2ITR1_TO_ETH(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_TIM2ITR1_IREMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} +#endif + +#if defined(AFIO_MAPR_PTP_PPS_REMAP) + +/** + * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @rmtoll MAPR PTP_PPS_REMAP LL_GPIO_AF_EnableRemap_ETH_PTP_PPS + * @note ENABLE: PTP_PPS is output on PB5 pin. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_ETH_PTP_PPS(void) +{ + SET_BIT(AFIO->MAPR, AFIO_MAPR_PTP_PPS_REMAP | AFIO_MAPR_SWJ_CFG); +} + +/** + * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion). + * @rmtoll MAPR PTP_PPS_REMAP LL_GPIO_AF_DisableRemap_ETH_PTP_PPS + * @note DISABLE: PTP_PPS not output on PB5 pin. + * @note This bit is available only in connectivity line devices and is reserved otherwise. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_ETH_PTP_PPS(void) +{ + MODIFY_REG(AFIO->MAPR, (AFIO_MAPR_PTP_PPS_REMAP | AFIO_MAPR_SWJ_CFG), AFIO_MAPR_SWJ_CFG); +} +#endif + +#if defined(AFIO_MAPR2_TIM9_REMAP) + +/** + * @brief Enable the remapping of TIM9_CH1 and TIM9_CH2. + * @rmtoll MAPR2 TIM9_REMAP LL_GPIO_AF_EnableRemap_TIM9 + * @note ENABLE: Remap (TIM9_CH1 on PE5 and TIM9_CH2 on PE6). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM9(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP); +} + +/** + * @brief Disable the remapping of TIM9_CH1 and TIM9_CH2. + * @rmtoll MAPR2 TIM9_REMAP LL_GPIO_AF_DisableRemap_TIM9 + * @note DISABLE: No remap (TIM9_CH1 on PA2 and TIM9_CH2 on PA3). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM9(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP); +} + +/** + * @brief Check if TIM9_CH1 and TIM9_CH2 have been remaped or not + * @rmtoll MAPR2 TIM9_REMAP LL_GPIO_AF_IsEnabledRemap_TIM9 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM9(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP) == (AFIO_MAPR2_TIM9_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM10_REMAP) + +/** + * @brief Enable the remapping of TIM10_CH1. + * @rmtoll MAPR2 TIM10_REMAP LL_GPIO_AF_EnableRemap_TIM10 + * @note ENABLE: Remap (TIM10_CH1 on PF6). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM10(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP); +} + +/** + * @brief Disable the remapping of TIM10_CH1. + * @rmtoll MAPR2 TIM10_REMAP LL_GPIO_AF_DisableRemap_TIM10 + * @note DISABLE: No remap (TIM10_CH1 on PB8). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM10(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP); +} + +/** + * @brief Check if TIM10_CH1 has been remaped or not + * @rmtoll MAPR2 TIM10_REMAP LL_GPIO_AF_IsEnabledRemap_TIM10 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM10(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP) == (AFIO_MAPR2_TIM10_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM11_REMAP) +/** + * @brief Enable the remapping of TIM11_CH1. + * @rmtoll MAPR2 TIM11_REMAP LL_GPIO_AF_EnableRemap_TIM11 + * @note ENABLE: Remap (TIM11_CH1 on PF7). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM11(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP); +} + +/** + * @brief Disable the remapping of TIM11_CH1. + * @rmtoll MAPR2 TIM11_REMAP LL_GPIO_AF_DisableRemap_TIM11 + * @note DISABLE: No remap (TIM11_CH1 on PB9). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM11(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP); +} + +/** + * @brief Check if TIM11_CH1 has been remaped or not + * @rmtoll MAPR2 TIM11_REMAP LL_GPIO_AF_IsEnabledRemap_TIM11 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM11(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP) == (AFIO_MAPR2_TIM11_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM13_REMAP) + +/** + * @brief Enable the remapping of TIM13_CH1. + * @rmtoll MAPR2 TIM13_REMAP LL_GPIO_AF_EnableRemap_TIM13 + * @note ENABLE: Remap STM32F100:(TIM13_CH1 on PF8). Others:(TIM13_CH1 on PB0). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM13(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP); +} + +/** + * @brief Disable the remapping of TIM13_CH1. + * @rmtoll MAPR2 TIM13_REMAP LL_GPIO_AF_DisableRemap_TIM13 + * @note DISABLE: No remap STM32F100:(TIM13_CH1 on PA6). Others:(TIM13_CH1 on PC8). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM13(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP); +} + +/** + * @brief Check if TIM13_CH1 has been remaped or not + * @rmtoll MAPR2 TIM13_REMAP LL_GPIO_AF_IsEnabledRemap_TIM13 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM13(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP) == (AFIO_MAPR2_TIM13_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM14_REMAP) + +/** + * @brief Enable the remapping of TIM14_CH1. + * @rmtoll MAPR2 TIM14_REMAP LL_GPIO_AF_EnableRemap_TIM14 + * @note ENABLE: Remap STM32F100:(TIM14_CH1 on PB1). Others:(TIM14_CH1 on PF9). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM14(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP); +} + +/** + * @brief Disable the remapping of TIM14_CH1. + * @rmtoll MAPR2 TIM14_REMAP LL_GPIO_AF_DisableRemap_TIM14 + * @note DISABLE: No remap STM32F100:(TIM14_CH1 on PC9). Others:(TIM14_CH1 on PA7). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM14(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP); +} + +/** + * @brief Check if TIM14_CH1 has been remaped or not + * @rmtoll MAPR2 TIM14_REMAP LL_GPIO_AF_IsEnabledRemap_TIM14 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM14(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP) == (AFIO_MAPR2_TIM14_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_FSMC_NADV_REMAP) + +/** + * @brief Controls the use of the optional FSMC_NADV signal. + * @rmtoll MAPR2 FSMC_NADV LL_GPIO_AF_Disconnect_FSMCNADV + * @note DISCONNECTED: The NADV signal is not connected. The I/O pin can be used by another peripheral. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Disconnect_FSMCNADV(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP); +} + +/** + * @brief Controls the use of the optional FSMC_NADV signal. + * @rmtoll MAPR2 FSMC_NADV LL_GPIO_AF_Connect_FSMCNADV + * @note CONNECTED: The NADV signal is connected to the output (default). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_Connect_FSMCNADV(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP); +} +#endif + +#if defined(AFIO_MAPR2_TIM15_REMAP) + +/** + * @brief Enable the remapping of TIM15_CH1 and TIM15_CH2. + * @rmtoll MAPR2 TIM15_REMAP LL_GPIO_AF_EnableRemap_TIM15 + * @note ENABLE: Remap (TIM15_CH1 on PB14 and TIM15_CH2 on PB15). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM15(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP); +} +/** + * @brief Disable the remapping of TIM15_CH1 and TIM15_CH2. + * @rmtoll MAPR2 TIM15_REMAP LL_GPIO_AF_DisableRemap_TIM15 + * @note DISABLE: No remap (TIM15_CH1 on PA2 and TIM15_CH2 on PA3). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM15(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP); +} + +/** + * @brief Check if TIM15_CH1 has been remaped or not + * @rmtoll MAPR2 TIM15_REMAP LL_GPIO_AF_IsEnabledRemap_TIM15 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM15(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP) == (AFIO_MAPR2_TIM15_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM16_REMAP) + +/** + * @brief Enable the remapping of TIM16_CH1. + * @rmtoll MAPR2 TIM16_REMAP LL_GPIO_AF_EnableRemap_TIM16 + * @note ENABLE: Remap (TIM16_CH1 on PA6). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM16(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP); +} + +/** + * @brief Disable the remapping of TIM16_CH1. + * @rmtoll MAPR2 TIM16_REMAP LL_GPIO_AF_DisableRemap_TIM16 + * @note DISABLE: No remap (TIM16_CH1 on PB8). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM16(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP); +} + +/** + * @brief Check if TIM16_CH1 has been remaped or not + * @rmtoll MAPR2 TIM16_REMAP LL_GPIO_AF_IsEnabledRemap_TIM16 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM16(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP) == (AFIO_MAPR2_TIM16_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM17_REMAP) + +/** + * @brief Enable the remapping of TIM17_CH1. + * @rmtoll MAPR2 TIM17_REMAP LL_GPIO_AF_EnableRemap_TIM17 + * @note ENABLE: Remap (TIM17_CH1 on PA7). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM17(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP); +} + +/** + * @brief Disable the remapping of TIM17_CH1. + * @rmtoll MAPR2 TIM17_REMAP LL_GPIO_AF_DisableRemap_TIM17 + * @note DISABLE: No remap (TIM17_CH1 on PB9). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM17(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP); +} + +/** + * @brief Check if TIM17_CH1 has been remaped or not + * @rmtoll MAPR2 TIM17_REMAP LL_GPIO_AF_IsEnabledRemap_TIM17 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM17(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP) == (AFIO_MAPR2_TIM17_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_CEC_REMAP) + +/** + * @brief Enable the remapping of CEC. + * @rmtoll MAPR2 CEC_REMAP LL_GPIO_AF_EnableRemap_CEC + * @note ENABLE: Remap (CEC on PB10). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_CEC(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP); +} + +/** + * @brief Disable the remapping of CEC. + * @rmtoll MAPR2 CEC_REMAP LL_GPIO_AF_DisableRemap_CEC + * @note DISABLE: No remap (CEC on PB8). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_CEC(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP); +} + +/** + * @brief Check if CEC has been remaped or not + * @rmtoll MAPR2 CEC_REMAP LL_GPIO_AF_IsEnabledRemap_CEC + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_CEC(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP) == (AFIO_MAPR2_CEC_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM1_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels. + * @rmtoll MAPR2 TIM1_DMA_REMAP LL_GPIO_AF_EnableRemap_TIM1DMA + * @note ENABLE: Remap (TIM1_CH1 DMA request/DMA1 Channel6, TIM1_CH2 DMA request/DMA1 Channel6) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM1DMA(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP); +} + +/** + * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels. + * @rmtoll MAPR2 TIM1_DMA_REMAP LL_GPIO_AF_DisableRemap_TIM1DMA + * @note DISABLE: No remap (TIM1_CH1 DMA request/DMA1 Channel2, TIM1_CH2 DMA request/DMA1 Channel3). + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM1DMA(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP); +} + +/** + * @brief Check if TIM1DMA has been remaped or not + * @rmtoll MAPR2 TIM1_DMA_REMAP LL_GPIO_AF_IsEnabledRemap_TIM1DMA + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM1DMA(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP) == (AFIO_MAPR2_TIM1_DMA_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM67_DAC_DMA_REMAP) + +/** + * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels. + * @rmtoll MAPR2 TIM76_DAC_DMA_REMAP LL_GPIO_AF_EnableRemap_TIM67DACDMA + * @note ENABLE: Remap (TIM6_DAC1 DMA request/DMA1 Channel3, TIM7_DAC2 DMA request/DMA1 Channel4) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM67DACDMA(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP); +} + +/** + * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels. + * @rmtoll MAPR2 TIM76_DAC_DMA_REMAP LL_GPIO_AF_DisableRemap_TIM67DACDMA + * @note DISABLE: No remap (TIM6_DAC1 DMA request/DMA2 Channel3, TIM7_DAC2 DMA request/DMA2 Channel4) + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM67DACDMA(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP); +} + +/** + * @brief Check if TIM67DACDMA has been remaped or not + * @rmtoll MAPR2 TIM76_DAC_DMA_REMAP LL_GPIO_AF_IsEnabledRemap_TIM67DACDMA + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM67DACDMA(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP) == (AFIO_MAPR2_TIM67_DAC_DMA_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_TIM12_REMAP) + +/** + * @brief Enable the remapping of TIM12_CH1 and TIM12_CH2. + * @rmtoll MAPR2 TIM12_REMAP LL_GPIO_AF_EnableRemap_TIM12 + * @note ENABLE: Remap (TIM12_CH1 on PB12 and TIM12_CH2 on PB13). + * @note This bit is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_TIM12(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP); +} + +/** + * @brief Disable the remapping of TIM12_CH1 and TIM12_CH2. + * @rmtoll MAPR2 TIM12_REMAP LL_GPIO_AF_DisableRemap_TIM12 + * @note DISABLE: No remap (TIM12_CH1 on PC4 and TIM12_CH2 on PC5). + * @note This bit is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_TIM12(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP); +} + +/** + * @brief Check if TIM12_CH1 has been remaped or not + * @rmtoll MAPR2 TIM12_REMAP LL_GPIO_AF_IsEnabledRemap_TIM12 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_TIM12(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP) == (AFIO_MAPR2_TIM12_REMAP)); +} +#endif + +#if defined(AFIO_MAPR2_MISC_REMAP) + +/** + * @brief Miscellaneous features remapping. + * This bit is set and cleared by software. It controls miscellaneous features. + * The DMA2 channel 5 interrupt position in the vector table. + * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register). + * @rmtoll MAPR2 MISC_REMAP LL_GPIO_AF_EnableRemap_MISC + * @note ENABLE: DMA2 channel 5 interrupt is mapped separately at position 60 and TIM15 TRGO event is + * selected as DAC Trigger 3, TIM15 triggers TIM1/3. + * @note This bit is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableRemap_MISC(void) +{ + SET_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP); +} + +/** + * @brief Miscellaneous features remapping. + * This bit is set and cleared by software. It controls miscellaneous features. + * The DMA2 channel 5 interrupt position in the vector table. + * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register). + * @rmtoll MAPR2 MISC_REMAP LL_GPIO_AF_DisableRemap_MISC + * @note DISABLE: DMA2 channel 5 interrupt is mapped with DMA2 channel 4 at position 59, TIM5 TRGO + * event is selected as DAC Trigger 3, TIM5 triggers TIM1/3. + * @note This bit is available only in high density value line devices. + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableRemap_MISC(void) +{ + CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP); +} + +/** + * @brief Check if MISC has been remaped or not + * @rmtoll MAPR2 MISC_REMAP LL_GPIO_AF_IsEnabledRemap_MISC + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_IsEnabledRemap_MISC(void) +{ + return (READ_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP) == (AFIO_MAPR2_MISC_REMAP)); +} +#endif + +/** + * @} + */ + +/** @defgroup GPIO_AF_LL_EVENTOUT Output Event configuration + * @brief This section propose definition to Configure EVENTOUT Cortex feature . + * @{ + */ + +/** + * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. + * @rmtoll EVCR PORT LL_GPIO_AF_ConfigEventout\n + * EVCR PIN LL_GPIO_AF_ConfigEventout + * @param LL_GPIO_PortSource This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_EVENTOUT_PORT_A + * @arg @ref LL_GPIO_AF_EVENTOUT_PORT_B + * @arg @ref LL_GPIO_AF_EVENTOUT_PORT_C + * @arg @ref LL_GPIO_AF_EVENTOUT_PORT_D + * @arg @ref LL_GPIO_AF_EVENTOUT_PORT_E + * @param LL_GPIO_PinSource This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_0 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_1 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_2 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_3 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_4 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_5 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_6 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_7 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_8 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_9 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_10 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_11 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_12 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_13 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_14 + * @arg @ref LL_GPIO_AF_EVENTOUT_PIN_15 + * @retval None +*/ +__STATIC_INLINE void LL_GPIO_AF_ConfigEventout(uint32_t LL_GPIO_PortSource, uint32_t LL_GPIO_PinSource) +{ + MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (LL_GPIO_PortSource) | (LL_GPIO_PinSource)); +} + +/** + * @brief Enables the Event Output. + * @rmtoll EVCR EVOE LL_GPIO_AF_EnableEventout + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_EnableEventout(void) +{ + SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); +} + +/** + * @brief Disables the Event Output. + * @rmtoll EVCR EVOE LL_GPIO_AF_DisableEventout + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_DisableEventout(void) +{ + CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); +} + +/** + * @} + */ +/** @defgroup GPIO_AF_LL_EXTI EXTI external interrupt + * @brief This section Configure source input for the EXTI external interrupt . + * @{ + */ + +/** + * @brief Configure source input for the EXTI external interrupt. + * @rmtoll AFIO_EXTICR1 EXTIx LL_GPIO_AF_SetEXTISource\n + * AFIO_EXTICR2 EXTIx LL_GPIO_AF_SetEXTISource\n + * AFIO_EXTICR3 EXTIx LL_GPIO_AF_SetEXTISource\n + * AFIO_EXTICR4 EXTIx LL_GPIO_AF_SetEXTISource + * @param Port This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_EXTI_PORTA + * @arg @ref LL_GPIO_AF_EXTI_PORTB + * @arg @ref LL_GPIO_AF_EXTI_PORTC + * @arg @ref LL_GPIO_AF_EXTI_PORTD + * @arg @ref LL_GPIO_AF_EXTI_PORTE + * @arg @ref LL_GPIO_AF_EXTI_PORTF + * @arg @ref LL_GPIO_AF_EXTI_PORTG + * @param Line This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_EXTI_LINE0 + * @arg @ref LL_GPIO_AF_EXTI_LINE1 + * @arg @ref LL_GPIO_AF_EXTI_LINE2 + * @arg @ref LL_GPIO_AF_EXTI_LINE3 + * @arg @ref LL_GPIO_AF_EXTI_LINE4 + * @arg @ref LL_GPIO_AF_EXTI_LINE5 + * @arg @ref LL_GPIO_AF_EXTI_LINE6 + * @arg @ref LL_GPIO_AF_EXTI_LINE7 + * @arg @ref LL_GPIO_AF_EXTI_LINE8 + * @arg @ref LL_GPIO_AF_EXTI_LINE9 + * @arg @ref LL_GPIO_AF_EXTI_LINE10 + * @arg @ref LL_GPIO_AF_EXTI_LINE11 + * @arg @ref LL_GPIO_AF_EXTI_LINE12 + * @arg @ref LL_GPIO_AF_EXTI_LINE13 + * @arg @ref LL_GPIO_AF_EXTI_LINE14 + * @arg @ref LL_GPIO_AF_EXTI_LINE15 + * @retval None + */ +__STATIC_INLINE void LL_GPIO_AF_SetEXTISource(uint32_t Port, uint32_t Line) +{ + MODIFY_REG(AFIO->EXTICR[Line & 0xFF], (Line >> 16), Port << POSITION_VAL((Line >> 16))); +} + +/** + * @brief Get the configured defined for specific EXTI Line + * @rmtoll AFIO_EXTICR1 EXTIx LL_GPIO_AF_GetEXTISource\n + * AFIO_EXTICR2 EXTIx LL_GPIO_AF_GetEXTISource\n + * AFIO_EXTICR3 EXTIx LL_GPIO_AF_GetEXTISource\n + * AFIO_EXTICR4 EXTIx LL_GPIO_AF_GetEXTISource + * @param Line This parameter can be one of the following values: + * @arg @ref LL_GPIO_AF_EXTI_LINE0 + * @arg @ref LL_GPIO_AF_EXTI_LINE1 + * @arg @ref LL_GPIO_AF_EXTI_LINE2 + * @arg @ref LL_GPIO_AF_EXTI_LINE3 + * @arg @ref LL_GPIO_AF_EXTI_LINE4 + * @arg @ref LL_GPIO_AF_EXTI_LINE5 + * @arg @ref LL_GPIO_AF_EXTI_LINE6 + * @arg @ref LL_GPIO_AF_EXTI_LINE7 + * @arg @ref LL_GPIO_AF_EXTI_LINE8 + * @arg @ref LL_GPIO_AF_EXTI_LINE9 + * @arg @ref LL_GPIO_AF_EXTI_LINE10 + * @arg @ref LL_GPIO_AF_EXTI_LINE11 + * @arg @ref LL_GPIO_AF_EXTI_LINE12 + * @arg @ref LL_GPIO_AF_EXTI_LINE13 + * @arg @ref LL_GPIO_AF_EXTI_LINE14 + * @arg @ref LL_GPIO_AF_EXTI_LINE15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_AF_EXTI_PORTA + * @arg @ref LL_GPIO_AF_EXTI_PORTB + * @arg @ref LL_GPIO_AF_EXTI_PORTC + * @arg @ref LL_GPIO_AF_EXTI_PORTD + * @arg @ref LL_GPIO_AF_EXTI_PORTE + * @arg @ref LL_GPIO_AF_EXTI_PORTF + * @arg @ref LL_GPIO_AF_EXTI_PORTG + */ +__STATIC_INLINE uint32_t LL_GPIO_AF_GetEXTISource(uint32_t Line) +{ + return (uint32_t)(READ_BIT(AFIO->EXTICR[Line & 0xFF], (Line >> 16)) >> POSITION_VAL(Line >> 16)); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx); +ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct); +void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct); + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) */ +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F1xx_LL_GPIO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h new file mode 100644 index 0000000..caad8b3 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h @@ -0,0 +1,440 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_pwr.h + * @author MCD Application Team + * @brief Header file of PWR LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_PWR_H +#define __STM32F1xx_LL_PWR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined(PWR) + +/** @defgroup PWR_LL PWR + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_LL_EC_CLEAR_FLAG Clear Flags Defines + * @brief Flags defines which can be used with LL_PWR_WriteReg function + * @{ + */ +#define LL_PWR_CR_CSBF PWR_CR_CSBF /*!< Clear standby flag */ +#define LL_PWR_CR_CWUF PWR_CR_CWUF /*!< Clear wakeup flag */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_PWR_ReadReg function + * @{ + */ +#define LL_PWR_CSR_WUF PWR_CSR_WUF /*!< Wakeup flag */ +#define LL_PWR_CSR_SBF PWR_CSR_SBF /*!< Standby flag */ +#define LL_PWR_CSR_PVDO PWR_CSR_PVDO /*!< Power voltage detector output flag */ +#define LL_PWR_CSR_EWUP1 PWR_CSR_EWUP /*!< Enable WKUP pin 1 */ +/** + * @} + */ + + +/** @defgroup PWR_LL_EC_MODE_PWR Mode Power + * @{ + */ +#define LL_PWR_MODE_STOP_MAINREGU 0x00000000U /*!< Enter Stop mode when the CPU enters deepsleep */ +#define LL_PWR_MODE_STOP_LPREGU (PWR_CR_LPDS) /*!< Enter Stop mode (with low power Regulator ON) when the CPU enters deepsleep */ +#define LL_PWR_MODE_STANDBY (PWR_CR_PDDS) /*!< Enter Standby mode when the CPU enters deepsleep */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_REGU_MODE_DS_MODE Regulator Mode In Deep Sleep Mode + * @{ + */ +#define LL_PWR_REGU_DSMODE_MAIN 0x00000000U /*!< Voltage Regulator in main mode during deepsleep mode */ +#define LL_PWR_REGU_DSMODE_LOW_POWER (PWR_CR_LPDS) /*!< Voltage Regulator in low-power mode during deepsleep mode */ +/** + * @} + */ + +/** @defgroup PWR_LL_EC_PVDLEVEL Power Voltage Detector Level + * @{ + */ +#define LL_PWR_PVDLEVEL_0 (PWR_CR_PLS_LEV0) /*!< Voltage threshold detected by PVD 2.2 V */ +#define LL_PWR_PVDLEVEL_1 (PWR_CR_PLS_LEV1) /*!< Voltage threshold detected by PVD 2.3 V */ +#define LL_PWR_PVDLEVEL_2 (PWR_CR_PLS_LEV2) /*!< Voltage threshold detected by PVD 2.4 V */ +#define LL_PWR_PVDLEVEL_3 (PWR_CR_PLS_LEV3) /*!< Voltage threshold detected by PVD 2.5 V */ +#define LL_PWR_PVDLEVEL_4 (PWR_CR_PLS_LEV4) /*!< Voltage threshold detected by PVD 2.6 V */ +#define LL_PWR_PVDLEVEL_5 (PWR_CR_PLS_LEV5) /*!< Voltage threshold detected by PVD 2.7 V */ +#define LL_PWR_PVDLEVEL_6 (PWR_CR_PLS_LEV6) /*!< Voltage threshold detected by PVD 2.8 V */ +#define LL_PWR_PVDLEVEL_7 (PWR_CR_PLS_LEV7) /*!< Voltage threshold detected by PVD 2.9 V */ +/** + * @} + */ +/** @defgroup PWR_LL_EC_WAKEUP_PIN Wakeup Pins + * @{ + */ +#define LL_PWR_WAKEUP_PIN1 (PWR_CSR_EWUP) /*!< WKUP pin 1 : PA0 */ +/** + * @} + */ + +/** + * @} + */ + + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Macros PWR Exported Macros + * @{ + */ + +/** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in PWR register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(PWR->__REG__, (__VALUE__)) + +/** + * @brief Read a value in PWR register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_PWR_ReadReg(__REG__) READ_REG(PWR->__REG__) +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @defgroup PWR_LL_EF_Configuration Configuration + * @{ + */ + +/** + * @brief Enable access to the backup domain + * @rmtoll CR DBP LL_PWR_EnableBkUpAccess + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableBkUpAccess(void) +{ + SET_BIT(PWR->CR, PWR_CR_DBP); +} + +/** + * @brief Disable access to the backup domain + * @rmtoll CR DBP LL_PWR_DisableBkUpAccess + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableBkUpAccess(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_DBP); +} + +/** + * @brief Check if the backup domain is enabled + * @rmtoll CR DBP LL_PWR_IsEnabledBkUpAccess + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledBkUpAccess(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_DBP) == (PWR_CR_DBP)); +} + +/** + * @brief Set voltage Regulator mode during deep sleep mode + * @rmtoll CR LPDS LL_PWR_SetRegulModeDS + * @param RegulMode This parameter can be one of the following values: + * @arg @ref LL_PWR_REGU_DSMODE_MAIN + * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetRegulModeDS(uint32_t RegulMode) +{ + MODIFY_REG(PWR->CR, PWR_CR_LPDS, RegulMode); +} + +/** + * @brief Get voltage Regulator mode during deep sleep mode + * @rmtoll CR LPDS LL_PWR_GetRegulModeDS + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_REGU_DSMODE_MAIN + * @arg @ref LL_PWR_REGU_DSMODE_LOW_POWER + */ +__STATIC_INLINE uint32_t LL_PWR_GetRegulModeDS(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_LPDS)); +} + +/** + * @brief Set Power Down mode when CPU enters deepsleep + * @rmtoll CR PDDS LL_PWR_SetPowerMode\n + * @rmtoll CR LPDS LL_PWR_SetPowerMode + * @param PDMode This parameter can be one of the following values: + * @arg @ref LL_PWR_MODE_STOP_MAINREGU + * @arg @ref LL_PWR_MODE_STOP_LPREGU + * @arg @ref LL_PWR_MODE_STANDBY + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetPowerMode(uint32_t PDMode) +{ + MODIFY_REG(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS), PDMode); +} + +/** + * @brief Get Power Down mode when CPU enters deepsleep + * @rmtoll CR PDDS LL_PWR_GetPowerMode\n + * @rmtoll CR LPDS LL_PWR_GetPowerMode + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_MODE_STOP_MAINREGU + * @arg @ref LL_PWR_MODE_STOP_LPREGU + * @arg @ref LL_PWR_MODE_STANDBY + */ +__STATIC_INLINE uint32_t LL_PWR_GetPowerMode(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, (PWR_CR_PDDS| PWR_CR_LPDS))); +} + +/** + * @brief Configure the voltage threshold detected by the Power Voltage Detector + * @rmtoll CR PLS LL_PWR_SetPVDLevel + * @param PVDLevel This parameter can be one of the following values: + * @arg @ref LL_PWR_PVDLEVEL_0 + * @arg @ref LL_PWR_PVDLEVEL_1 + * @arg @ref LL_PWR_PVDLEVEL_2 + * @arg @ref LL_PWR_PVDLEVEL_3 + * @arg @ref LL_PWR_PVDLEVEL_4 + * @arg @ref LL_PWR_PVDLEVEL_5 + * @arg @ref LL_PWR_PVDLEVEL_6 + * @arg @ref LL_PWR_PVDLEVEL_7 + * @retval None + */ +__STATIC_INLINE void LL_PWR_SetPVDLevel(uint32_t PVDLevel) +{ + MODIFY_REG(PWR->CR, PWR_CR_PLS, PVDLevel); +} + +/** + * @brief Get the voltage threshold detection + * @rmtoll CR PLS LL_PWR_GetPVDLevel + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_PVDLEVEL_0 + * @arg @ref LL_PWR_PVDLEVEL_1 + * @arg @ref LL_PWR_PVDLEVEL_2 + * @arg @ref LL_PWR_PVDLEVEL_3 + * @arg @ref LL_PWR_PVDLEVEL_4 + * @arg @ref LL_PWR_PVDLEVEL_5 + * @arg @ref LL_PWR_PVDLEVEL_6 + * @arg @ref LL_PWR_PVDLEVEL_7 + */ +__STATIC_INLINE uint32_t LL_PWR_GetPVDLevel(void) +{ + return (uint32_t)(READ_BIT(PWR->CR, PWR_CR_PLS)); +} + +/** + * @brief Enable Power Voltage Detector + * @rmtoll CR PVDE LL_PWR_EnablePVD + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnablePVD(void) +{ + SET_BIT(PWR->CR, PWR_CR_PVDE); +} + +/** + * @brief Disable Power Voltage Detector + * @rmtoll CR PVDE LL_PWR_DisablePVD + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisablePVD(void) +{ + CLEAR_BIT(PWR->CR, PWR_CR_PVDE); +} + +/** + * @brief Check if Power Voltage Detector is enabled + * @rmtoll CR PVDE LL_PWR_IsEnabledPVD + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledPVD(void) +{ + return (READ_BIT(PWR->CR, PWR_CR_PVDE) == (PWR_CR_PVDE)); +} + +/** + * @brief Enable the WakeUp PINx functionality + * @rmtoll CSR EWUP LL_PWR_EnableWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @retval None + */ +__STATIC_INLINE void LL_PWR_EnableWakeUpPin(uint32_t WakeUpPin) +{ + SET_BIT(PWR->CSR, WakeUpPin); +} + +/** + * @brief Disable the WakeUp PINx functionality + * @rmtoll CSR EWUP LL_PWR_DisableWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @retval None + */ +__STATIC_INLINE void LL_PWR_DisableWakeUpPin(uint32_t WakeUpPin) +{ + CLEAR_BIT(PWR->CSR, WakeUpPin); +} + +/** + * @brief Check if the WakeUp PINx functionality is enabled + * @rmtoll CSR EWUP LL_PWR_IsEnabledWakeUpPin + * @param WakeUpPin This parameter can be one of the following values: + * @arg @ref LL_PWR_WAKEUP_PIN1 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsEnabledWakeUpPin(uint32_t WakeUpPin) +{ + return (READ_BIT(PWR->CSR, WakeUpPin) == (WakeUpPin)); +} + + +/** + * @} + */ + +/** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get Wake-up Flag + * @rmtoll CSR WUF LL_PWR_IsActiveFlag_WU + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_WU(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_WUF) == (PWR_CSR_WUF)); +} + +/** + * @brief Get Standby Flag + * @rmtoll CSR SBF LL_PWR_IsActiveFlag_SB + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_SB(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_SBF) == (PWR_CSR_SBF)); +} + +/** + * @brief Indicate whether VDD voltage is below the selected PVD threshold + * @rmtoll CSR PVDO LL_PWR_IsActiveFlag_PVDO + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_PWR_IsActiveFlag_PVDO(void) +{ + return (READ_BIT(PWR->CSR, PWR_CSR_PVDO) == (PWR_CSR_PVDO)); +} + +/** + * @brief Clear Standby Flag + * @rmtoll CR CSBF LL_PWR_ClearFlag_SB + * @retval None + */ +__STATIC_INLINE void LL_PWR_ClearFlag_SB(void) +{ + SET_BIT(PWR->CR, PWR_CR_CSBF); +} + +/** + * @brief Clear Wake-up Flags + * @rmtoll CR CWUF LL_PWR_ClearFlag_WU + * @retval None + */ +__STATIC_INLINE void LL_PWR_ClearFlag_WU(void) +{ + SET_BIT(PWR->CR, PWR_CR_CWUF); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup PWR_LL_EF_Init De-initialization function + * @{ + */ +ErrorStatus LL_PWR_DeInit(void); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(PWR) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_PWR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h new file mode 100644 index 0000000..804c75f --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h @@ -0,0 +1,2312 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_rcc.h + * @author MCD Application Team + * @brief Header file of RCC LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_RCC_H +#define __STM32F1xx_LL_RCC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @defgroup RCC_LL RCC + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_Private_Macros RCC Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_Exported_Types RCC Exported Types + * @{ + */ + +/** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure + * @{ + */ + +/** + * @brief RCC Clocks Frequency Structure + */ +typedef struct +{ + uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency */ + uint32_t HCLK_Frequency; /*!< HCLK clock frequency */ + uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency */ + uint32_t PCLK2_Frequency; /*!< PCLK2 clock frequency */ +} LL_RCC_ClocksTypeDef; + +/** + * @} + */ + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Constants RCC Exported Constants + * @{ + */ + +/** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation + * @brief Defines used to adapt values of different oscillators + * @note These values could be modified in the user environment according to + * HW set-up. + * @{ + */ +#if !defined (HSE_VALUE) +#define HSE_VALUE 8000000U /*!< Value of the HSE oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSI_VALUE) +#define HSI_VALUE 8000000U /*!< Value of the HSI oscillator in Hz */ +#endif /* HSI_VALUE */ + +#if !defined (LSE_VALUE) +#define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSI_VALUE) +#define LSI_VALUE 40000U /*!< Value of the LSI oscillator in Hz */ +#endif /* LSI_VALUE */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines + * @brief Flags defines which can be used with LL_RCC_WriteReg function + * @{ + */ +#define LL_RCC_CIR_LSIRDYC RCC_CIR_LSIRDYC /*!< LSI Ready Interrupt Clear */ +#define LL_RCC_CIR_LSERDYC RCC_CIR_LSERDYC /*!< LSE Ready Interrupt Clear */ +#define LL_RCC_CIR_HSIRDYC RCC_CIR_HSIRDYC /*!< HSI Ready Interrupt Clear */ +#define LL_RCC_CIR_HSERDYC RCC_CIR_HSERDYC /*!< HSE Ready Interrupt Clear */ +#define LL_RCC_CIR_PLLRDYC RCC_CIR_PLLRDYC /*!< PLL Ready Interrupt Clear */ +#define LL_RCC_CIR_PLL3RDYC RCC_CIR_PLL3RDYC /*!< PLL3(PLLI2S) Ready Interrupt Clear */ +#define LL_RCC_CIR_PLL2RDYC RCC_CIR_PLL2RDYC /*!< PLL2 Ready Interrupt Clear */ +#define LL_RCC_CIR_CSSC RCC_CIR_CSSC /*!< Clock Security System Interrupt Clear */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_RCC_ReadReg function + * @{ + */ +#define LL_RCC_CIR_LSIRDYF RCC_CIR_LSIRDYF /*!< LSI Ready Interrupt flag */ +#define LL_RCC_CIR_LSERDYF RCC_CIR_LSERDYF /*!< LSE Ready Interrupt flag */ +#define LL_RCC_CIR_HSIRDYF RCC_CIR_HSIRDYF /*!< HSI Ready Interrupt flag */ +#define LL_RCC_CIR_HSERDYF RCC_CIR_HSERDYF /*!< HSE Ready Interrupt flag */ +#define LL_RCC_CIR_PLLRDYF RCC_CIR_PLLRDYF /*!< PLL Ready Interrupt flag */ +#define LL_RCC_CIR_PLL3RDYF RCC_CIR_PLL3RDYF /*!< PLL3(PLLI2S) Ready Interrupt flag */ +#define LL_RCC_CIR_PLL2RDYF RCC_CIR_PLL2RDYF /*!< PLL2 Ready Interrupt flag */ +#define LL_RCC_CIR_CSSF RCC_CIR_CSSF /*!< Clock Security System Interrupt flag */ +#define LL_RCC_CSR_PINRSTF RCC_CSR_PINRSTF /*!< PIN reset flag */ +#define LL_RCC_CSR_PORRSTF RCC_CSR_PORRSTF /*!< POR/PDR reset flag */ +#define LL_RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */ +#define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */ +#define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */ +#define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset flag */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions + * @{ + */ +#define LL_RCC_CIR_LSIRDYIE RCC_CIR_LSIRDYIE /*!< LSI Ready Interrupt Enable */ +#define LL_RCC_CIR_LSERDYIE RCC_CIR_LSERDYIE /*!< LSE Ready Interrupt Enable */ +#define LL_RCC_CIR_HSIRDYIE RCC_CIR_HSIRDYIE /*!< HSI Ready Interrupt Enable */ +#define LL_RCC_CIR_HSERDYIE RCC_CIR_HSERDYIE /*!< HSE Ready Interrupt Enable */ +#define LL_RCC_CIR_PLLRDYIE RCC_CIR_PLLRDYIE /*!< PLL Ready Interrupt Enable */ +#define LL_RCC_CIR_PLL3RDYIE RCC_CIR_PLL3RDYIE /*!< PLL3(PLLI2S) Ready Interrupt Enable */ +#define LL_RCC_CIR_PLL2RDYIE RCC_CIR_PLL2RDYIE /*!< PLL2 Ready Interrupt Enable */ +/** + * @} + */ + +#if defined(RCC_CFGR2_PREDIV2) +/** @defgroup RCC_LL_EC_HSE_PREDIV2_DIV HSE PREDIV2 Division factor + * @{ + */ +#define LL_RCC_HSE_PREDIV2_DIV_1 RCC_CFGR2_PREDIV2_DIV1 /*!< PREDIV2 input clock not divided */ +#define LL_RCC_HSE_PREDIV2_DIV_2 RCC_CFGR2_PREDIV2_DIV2 /*!< PREDIV2 input clock divided by 2 */ +#define LL_RCC_HSE_PREDIV2_DIV_3 RCC_CFGR2_PREDIV2_DIV3 /*!< PREDIV2 input clock divided by 3 */ +#define LL_RCC_HSE_PREDIV2_DIV_4 RCC_CFGR2_PREDIV2_DIV4 /*!< PREDIV2 input clock divided by 4 */ +#define LL_RCC_HSE_PREDIV2_DIV_5 RCC_CFGR2_PREDIV2_DIV5 /*!< PREDIV2 input clock divided by 5 */ +#define LL_RCC_HSE_PREDIV2_DIV_6 RCC_CFGR2_PREDIV2_DIV6 /*!< PREDIV2 input clock divided by 6 */ +#define LL_RCC_HSE_PREDIV2_DIV_7 RCC_CFGR2_PREDIV2_DIV7 /*!< PREDIV2 input clock divided by 7 */ +#define LL_RCC_HSE_PREDIV2_DIV_8 RCC_CFGR2_PREDIV2_DIV8 /*!< PREDIV2 input clock divided by 8 */ +#define LL_RCC_HSE_PREDIV2_DIV_9 RCC_CFGR2_PREDIV2_DIV9 /*!< PREDIV2 input clock divided by 9 */ +#define LL_RCC_HSE_PREDIV2_DIV_10 RCC_CFGR2_PREDIV2_DIV10 /*!< PREDIV2 input clock divided by 10 */ +#define LL_RCC_HSE_PREDIV2_DIV_11 RCC_CFGR2_PREDIV2_DIV11 /*!< PREDIV2 input clock divided by 11 */ +#define LL_RCC_HSE_PREDIV2_DIV_12 RCC_CFGR2_PREDIV2_DIV12 /*!< PREDIV2 input clock divided by 12 */ +#define LL_RCC_HSE_PREDIV2_DIV_13 RCC_CFGR2_PREDIV2_DIV13 /*!< PREDIV2 input clock divided by 13 */ +#define LL_RCC_HSE_PREDIV2_DIV_14 RCC_CFGR2_PREDIV2_DIV14 /*!< PREDIV2 input clock divided by 14 */ +#define LL_RCC_HSE_PREDIV2_DIV_15 RCC_CFGR2_PREDIV2_DIV15 /*!< PREDIV2 input clock divided by 15 */ +#define LL_RCC_HSE_PREDIV2_DIV_16 RCC_CFGR2_PREDIV2_DIV16 /*!< PREDIV2 input clock divided by 16 */ +/** + * @} + */ + +#endif /* RCC_CFGR2_PREDIV2 */ + +/** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch + * @{ + */ +#define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */ +#define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */ +#define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW_PLL /*!< PLL selection as system clock */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status + * @{ + */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */ +#define LL_RCC_SYS_CLKSOURCE_STATUS_PLL RCC_CFGR_SWS_PLL /*!< PLL used as system clock */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler + * @{ + */ +#define LL_RCC_SYSCLK_DIV_1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */ +#define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */ +#define LL_RCC_SYSCLK_DIV_4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */ +#define LL_RCC_SYSCLK_DIV_8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */ +#define LL_RCC_SYSCLK_DIV_16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */ +#define LL_RCC_SYSCLK_DIV_64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */ +#define LL_RCC_SYSCLK_DIV_128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */ +#define LL_RCC_SYSCLK_DIV_256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */ +#define LL_RCC_SYSCLK_DIV_512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1) + * @{ + */ +#define LL_RCC_APB1_DIV_1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */ +#define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */ +#define LL_RCC_APB1_DIV_4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */ +#define LL_RCC_APB1_DIV_8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */ +#define LL_RCC_APB1_DIV_16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_APB2_DIV APB high-speed prescaler (APB2) + * @{ + */ +#define LL_RCC_APB2_DIV_1 RCC_CFGR_PPRE2_DIV1 /*!< HCLK not divided */ +#define LL_RCC_APB2_DIV_2 RCC_CFGR_PPRE2_DIV2 /*!< HCLK divided by 2 */ +#define LL_RCC_APB2_DIV_4 RCC_CFGR_PPRE2_DIV4 /*!< HCLK divided by 4 */ +#define LL_RCC_APB2_DIV_8 RCC_CFGR_PPRE2_DIV8 /*!< HCLK divided by 8 */ +#define LL_RCC_APB2_DIV_16 RCC_CFGR_PPRE2_DIV16 /*!< HCLK divided by 16 */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_MCO1SOURCE MCO1 SOURCE selection + * @{ + */ +#define LL_RCC_MCO1SOURCE_NOCLOCK RCC_CFGR_MCO_NOCLOCK /*!< MCO output disabled, no clock on MCO */ +#define LL_RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCO_SYSCLK /*!< SYSCLK selection as MCO source */ +#define LL_RCC_MCO1SOURCE_HSI RCC_CFGR_MCO_HSI /*!< HSI selection as MCO source */ +#define LL_RCC_MCO1SOURCE_HSE RCC_CFGR_MCO_HSE /*!< HSE selection as MCO source */ +#define LL_RCC_MCO1SOURCE_PLLCLK_DIV_2 RCC_CFGR_MCO_PLLCLK_DIV2 /*!< PLL clock divided by 2*/ +#if defined(RCC_CFGR_MCO_PLL2CLK) +#define LL_RCC_MCO1SOURCE_PLL2CLK RCC_CFGR_MCO_PLL2CLK /*!< PLL2 clock selected as MCO source*/ +#endif /* RCC_CFGR_MCO_PLL2CLK */ +#if defined(RCC_CFGR_MCO_PLL3CLK_DIV2) +#define LL_RCC_MCO1SOURCE_PLLI2SCLK_DIV2 RCC_CFGR_MCO_PLL3CLK_DIV2 /*!< PLLI2S clock divided by 2 selected as MCO source*/ +#endif /* RCC_CFGR_MCO_PLL3CLK_DIV2 */ +#if defined(RCC_CFGR_MCO_EXT_HSE) +#define LL_RCC_MCO1SOURCE_EXT_HSE RCC_CFGR_MCO_EXT_HSE /*!< XT1 external 3-25 MHz oscillator clock selected as MCO source */ +#endif /* RCC_CFGR_MCO_EXT_HSE */ +#if defined(RCC_CFGR_MCO_PLL3CLK) +#define LL_RCC_MCO1SOURCE_PLLI2SCLK RCC_CFGR_MCO_PLL3CLK /*!< PLLI2S clock selected as MCO source */ +#endif /* RCC_CFGR_MCO_PLL3CLK */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency + * @{ + */ +#define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */ +#define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +#if defined(RCC_CFGR2_I2S2SRC) +/** @defgroup RCC_LL_EC_I2S2CLKSOURCE Peripheral I2S clock source selection + * @{ + */ +#define LL_RCC_I2S2_CLKSOURCE_SYSCLK RCC_CFGR2_I2S2SRC /*!< System clock (SYSCLK) selected as I2S2 clock entry */ +#define LL_RCC_I2S2_CLKSOURCE_PLLI2S_VCO (uint32_t)(RCC_CFGR2_I2S2SRC | (RCC_CFGR2_I2S2SRC >> 16U)) /*!< PLLI2S VCO clock selected as I2S2 clock entry */ +#define LL_RCC_I2S3_CLKSOURCE_SYSCLK RCC_CFGR2_I2S3SRC /*!< System clock (SYSCLK) selected as I2S3 clock entry */ +#define LL_RCC_I2S3_CLKSOURCE_PLLI2S_VCO (uint32_t)(RCC_CFGR2_I2S3SRC | (RCC_CFGR2_I2S3SRC >> 16U)) /*!< PLLI2S VCO clock selected as I2S3 clock entry */ +/** + * @} + */ +#endif /* RCC_CFGR2_I2S2SRC */ + +#if defined(USB_OTG_FS) || defined(USB) +/** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection + * @{ + */ +#if defined(RCC_CFGR_USBPRE) +#define LL_RCC_USB_CLKSOURCE_PLL RCC_CFGR_USBPRE /*!< PLL clock is not divided */ +#define LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5 0x00000000U /*!< PLL clock is divided by 1.5 */ +#endif /*RCC_CFGR_USBPRE*/ +#if defined(RCC_CFGR_OTGFSPRE) +#define LL_RCC_USB_CLKSOURCE_PLL_DIV_2 RCC_CFGR_OTGFSPRE /*!< PLL clock is divided by 2 */ +#define LL_RCC_USB_CLKSOURCE_PLL_DIV_3 0x00000000U /*!< PLL clock is divided by 3 */ +#endif /*RCC_CFGR_OTGFSPRE*/ +/** + * @} + */ +#endif /* USB_OTG_FS || USB */ + +/** @defgroup RCC_LL_EC_ADC_CLKSOURCE_PCLK2 Peripheral ADC clock source selection + * @{ + */ +#define LL_RCC_ADC_CLKSRC_PCLK2_DIV_2 RCC_CFGR_ADCPRE_DIV2 /*ADC prescaler PCLK2 divided by 2*/ +#define LL_RCC_ADC_CLKSRC_PCLK2_DIV_4 RCC_CFGR_ADCPRE_DIV4 /*ADC prescaler PCLK2 divided by 4*/ +#define LL_RCC_ADC_CLKSRC_PCLK2_DIV_6 RCC_CFGR_ADCPRE_DIV6 /*ADC prescaler PCLK2 divided by 6*/ +#define LL_RCC_ADC_CLKSRC_PCLK2_DIV_8 RCC_CFGR_ADCPRE_DIV8 /*ADC prescaler PCLK2 divided by 8*/ +/** + * @} + */ + +#if defined(RCC_CFGR2_I2S2SRC) +/** @defgroup RCC_LL_EC_I2S2 Peripheral I2S get clock source + * @{ + */ +#define LL_RCC_I2S2_CLKSOURCE RCC_CFGR2_I2S2SRC /*!< I2S2 Clock source selection */ +#define LL_RCC_I2S3_CLKSOURCE RCC_CFGR2_I2S3SRC /*!< I2S3 Clock source selection */ +/** + * @} + */ + +#endif /* RCC_CFGR2_I2S2SRC */ + +#if defined(USB_OTG_FS) || defined(USB) +/** @defgroup RCC_LL_EC_USB Peripheral USB get clock source + * @{ + */ +#define LL_RCC_USB_CLKSOURCE 0x00400000U /*!< USB Clock source selection */ +/** + * @} + */ + +#endif /* USB_OTG_FS || USB */ + +/** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source + * @{ + */ +#define LL_RCC_ADC_CLKSOURCE RCC_CFGR_ADCPRE /*!< ADC Clock source selection */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection + * @{ + */ +#define LL_RCC_RTC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */ +#define LL_RCC_RTC_CLKSOURCE_HSE_DIV128 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 128 used as RTC clock */ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLL_MUL PLL Multiplicator factor + * @{ + */ +#if defined(RCC_CFGR_PLLMULL2) +#define LL_RCC_PLL_MUL_2 RCC_CFGR_PLLMULL2 /*!< PLL input clock*2 */ +#endif /*RCC_CFGR_PLLMULL2*/ +#if defined(RCC_CFGR_PLLMULL3) +#define LL_RCC_PLL_MUL_3 RCC_CFGR_PLLMULL3 /*!< PLL input clock*3 */ +#endif /*RCC_CFGR_PLLMULL3*/ +#define LL_RCC_PLL_MUL_4 RCC_CFGR_PLLMULL4 /*!< PLL input clock*4 */ +#define LL_RCC_PLL_MUL_5 RCC_CFGR_PLLMULL5 /*!< PLL input clock*5 */ +#define LL_RCC_PLL_MUL_6 RCC_CFGR_PLLMULL6 /*!< PLL input clock*6 */ +#define LL_RCC_PLL_MUL_7 RCC_CFGR_PLLMULL7 /*!< PLL input clock*7 */ +#define LL_RCC_PLL_MUL_8 RCC_CFGR_PLLMULL8 /*!< PLL input clock*8 */ +#define LL_RCC_PLL_MUL_9 RCC_CFGR_PLLMULL9 /*!< PLL input clock*9 */ +#if defined(RCC_CFGR_PLLMULL6_5) +#define LL_RCC_PLL_MUL_6_5 RCC_CFGR_PLLMULL6_5 /*!< PLL input clock*6 */ +#else +#define LL_RCC_PLL_MUL_10 RCC_CFGR_PLLMULL10 /*!< PLL input clock*10 */ +#define LL_RCC_PLL_MUL_11 RCC_CFGR_PLLMULL11 /*!< PLL input clock*11 */ +#define LL_RCC_PLL_MUL_12 RCC_CFGR_PLLMULL12 /*!< PLL input clock*12 */ +#define LL_RCC_PLL_MUL_13 RCC_CFGR_PLLMULL13 /*!< PLL input clock*13 */ +#define LL_RCC_PLL_MUL_14 RCC_CFGR_PLLMULL14 /*!< PLL input clock*14 */ +#define LL_RCC_PLL_MUL_15 RCC_CFGR_PLLMULL15 /*!< PLL input clock*15 */ +#define LL_RCC_PLL_MUL_16 RCC_CFGR_PLLMULL16 /*!< PLL input clock*16 */ +#endif /*RCC_CFGR_PLLMULL6_5*/ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PLLSOURCE PLL SOURCE + * @{ + */ +#define LL_RCC_PLLSOURCE_HSI_DIV_2 0x00000000U /*!< HSI clock divided by 2 selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE RCC_CFGR_PLLSRC /*!< HSE/PREDIV1 clock selected as PLL entry clock source */ +#if defined(RCC_CFGR2_PREDIV1SRC) +#define LL_RCC_PLLSOURCE_PLL2 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/PREDIV1 clock selected as PLL entry clock source */ +#endif /*RCC_CFGR2_PREDIV1SRC*/ + +#if defined(RCC_CFGR2_PREDIV1) +#define LL_RCC_PLLSOURCE_HSE_DIV_1 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV1) /*!< HSE/1 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_2 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV2) /*!< HSE/2 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_3 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV3) /*!< HSE/3 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_4 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV4) /*!< HSE/4 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_5 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV5) /*!< HSE/5 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_6 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV6) /*!< HSE/6 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_7 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV7) /*!< HSE/7 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_8 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV8) /*!< HSE/8 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_9 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV9) /*!< HSE/9 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_10 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV10) /*!< HSE/10 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_11 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV11) /*!< HSE/11 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_12 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV12) /*!< HSE/12 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_13 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV13) /*!< HSE/13 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_14 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV14) /*!< HSE/14 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_15 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV15) /*!< HSE/15 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_16 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV16) /*!< HSE/16 clock selected as PLL entry clock source */ +#if defined(RCC_CFGR2_PREDIV1SRC) +#define LL_RCC_PLLSOURCE_PLL2_DIV_1 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV1 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/1 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_2 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV2 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/2 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_3 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV3 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/3 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_4 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV4 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/4 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_5 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV5 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/5 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_6 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV6 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/6 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_7 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV7 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/7 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_8 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV8 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/8 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_9 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV9 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/9 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_10 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV10 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/10 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_11 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV11 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/11 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_12 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV12 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/12 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_13 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV13 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/13 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_14 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV14 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/14 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_15 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV15 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/15 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_PLL2_DIV_16 (RCC_CFGR_PLLSRC | RCC_CFGR2_PREDIV1_DIV16 | RCC_CFGR2_PREDIV1SRC << 4U) /*!< PLL2/16 clock selected as PLL entry clock source */ +#endif /*RCC_CFGR2_PREDIV1SRC*/ +#else +#define LL_RCC_PLLSOURCE_HSE_DIV_1 (RCC_CFGR_PLLSRC | 0x00000000U) /*!< HSE/1 clock selected as PLL entry clock source */ +#define LL_RCC_PLLSOURCE_HSE_DIV_2 (RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE) /*!< HSE/2 clock selected as PLL entry clock source */ +#endif /*RCC_CFGR2_PREDIV1*/ +/** + * @} + */ + +/** @defgroup RCC_LL_EC_PREDIV_DIV PREDIV Division factor + * @{ + */ +#if defined(RCC_CFGR2_PREDIV1) +#define LL_RCC_PREDIV_DIV_1 RCC_CFGR2_PREDIV1_DIV1 /*!< PREDIV1 input clock not divided */ +#define LL_RCC_PREDIV_DIV_2 RCC_CFGR2_PREDIV1_DIV2 /*!< PREDIV1 input clock divided by 2 */ +#define LL_RCC_PREDIV_DIV_3 RCC_CFGR2_PREDIV1_DIV3 /*!< PREDIV1 input clock divided by 3 */ +#define LL_RCC_PREDIV_DIV_4 RCC_CFGR2_PREDIV1_DIV4 /*!< PREDIV1 input clock divided by 4 */ +#define LL_RCC_PREDIV_DIV_5 RCC_CFGR2_PREDIV1_DIV5 /*!< PREDIV1 input clock divided by 5 */ +#define LL_RCC_PREDIV_DIV_6 RCC_CFGR2_PREDIV1_DIV6 /*!< PREDIV1 input clock divided by 6 */ +#define LL_RCC_PREDIV_DIV_7 RCC_CFGR2_PREDIV1_DIV7 /*!< PREDIV1 input clock divided by 7 */ +#define LL_RCC_PREDIV_DIV_8 RCC_CFGR2_PREDIV1_DIV8 /*!< PREDIV1 input clock divided by 8 */ +#define LL_RCC_PREDIV_DIV_9 RCC_CFGR2_PREDIV1_DIV9 /*!< PREDIV1 input clock divided by 9 */ +#define LL_RCC_PREDIV_DIV_10 RCC_CFGR2_PREDIV1_DIV10 /*!< PREDIV1 input clock divided by 10 */ +#define LL_RCC_PREDIV_DIV_11 RCC_CFGR2_PREDIV1_DIV11 /*!< PREDIV1 input clock divided by 11 */ +#define LL_RCC_PREDIV_DIV_12 RCC_CFGR2_PREDIV1_DIV12 /*!< PREDIV1 input clock divided by 12 */ +#define LL_RCC_PREDIV_DIV_13 RCC_CFGR2_PREDIV1_DIV13 /*!< PREDIV1 input clock divided by 13 */ +#define LL_RCC_PREDIV_DIV_14 RCC_CFGR2_PREDIV1_DIV14 /*!< PREDIV1 input clock divided by 14 */ +#define LL_RCC_PREDIV_DIV_15 RCC_CFGR2_PREDIV1_DIV15 /*!< PREDIV1 input clock divided by 15 */ +#define LL_RCC_PREDIV_DIV_16 RCC_CFGR2_PREDIV1_DIV16 /*!< PREDIV1 input clock divided by 16 */ +#else +#define LL_RCC_PREDIV_DIV_1 0x00000000U /*!< HSE divider clock clock not divided */ +#define LL_RCC_PREDIV_DIV_2 RCC_CFGR_PLLXTPRE /*!< HSE divider clock divided by 2 for PLL entry */ +#endif /*RCC_CFGR2_PREDIV1*/ +/** + * @} + */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** @defgroup RCC_LL_EC_PLLI2S_MUL PLLI2S MUL + * @{ + */ +#define LL_RCC_PLLI2S_MUL_8 RCC_CFGR2_PLL3MUL8 /*!< PLLI2S input clock * 8 */ +#define LL_RCC_PLLI2S_MUL_9 RCC_CFGR2_PLL3MUL9 /*!< PLLI2S input clock * 9 */ +#define LL_RCC_PLLI2S_MUL_10 RCC_CFGR2_PLL3MUL10 /*!< PLLI2S input clock * 10 */ +#define LL_RCC_PLLI2S_MUL_11 RCC_CFGR2_PLL3MUL11 /*!< PLLI2S input clock * 11 */ +#define LL_RCC_PLLI2S_MUL_12 RCC_CFGR2_PLL3MUL12 /*!< PLLI2S input clock * 12 */ +#define LL_RCC_PLLI2S_MUL_13 RCC_CFGR2_PLL3MUL13 /*!< PLLI2S input clock * 13 */ +#define LL_RCC_PLLI2S_MUL_14 RCC_CFGR2_PLL3MUL14 /*!< PLLI2S input clock * 14 */ +#define LL_RCC_PLLI2S_MUL_16 RCC_CFGR2_PLL3MUL16 /*!< PLLI2S input clock * 16 */ +#define LL_RCC_PLLI2S_MUL_20 RCC_CFGR2_PLL3MUL20 /*!< PLLI2S input clock * 20 */ +/** + * @} + */ + +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** @defgroup RCC_LL_EC_PLL2_MUL PLL2 MUL + * @{ + */ +#define LL_RCC_PLL2_MUL_8 RCC_CFGR2_PLL2MUL8 /*!< PLL2 input clock * 8 */ +#define LL_RCC_PLL2_MUL_9 RCC_CFGR2_PLL2MUL9 /*!< PLL2 input clock * 9 */ +#define LL_RCC_PLL2_MUL_10 RCC_CFGR2_PLL2MUL10 /*!< PLL2 input clock * 10 */ +#define LL_RCC_PLL2_MUL_11 RCC_CFGR2_PLL2MUL11 /*!< PLL2 input clock * 11 */ +#define LL_RCC_PLL2_MUL_12 RCC_CFGR2_PLL2MUL12 /*!< PLL2 input clock * 12 */ +#define LL_RCC_PLL2_MUL_13 RCC_CFGR2_PLL2MUL13 /*!< PLL2 input clock * 13 */ +#define LL_RCC_PLL2_MUL_14 RCC_CFGR2_PLL2MUL14 /*!< PLL2 input clock * 14 */ +#define LL_RCC_PLL2_MUL_16 RCC_CFGR2_PLL2MUL16 /*!< PLL2 input clock * 16 */ +#define LL_RCC_PLL2_MUL_20 RCC_CFGR2_PLL2MUL20 /*!< PLL2 input clock * 20 */ +/** + * @} + */ + +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Macros RCC Exported Macros + * @{ + */ + +/** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in RCC register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__)) + +/** + * @brief Read a value in RCC register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__) +/** + * @} + */ + +/** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies + * @{ + */ + +#if defined(RCC_CFGR_PLLMULL6_5) +/** + * @brief Helper macro to calculate the PLLCLK frequency + * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE / (@ref LL_RCC_PLL_GetPrediv () + 1), @ref LL_RCC_PLL_GetMultiplicator()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE div Prediv1 / HSI div 2 / PLL2 div Prediv1) + * @param __PLLMUL__: This parameter can be one of the following values: + * @arg @ref LL_RCC_PLL_MUL_4 + * @arg @ref LL_RCC_PLL_MUL_5 + * @arg @ref LL_RCC_PLL_MUL_6 + * @arg @ref LL_RCC_PLL_MUL_7 + * @arg @ref LL_RCC_PLL_MUL_8 + * @arg @ref LL_RCC_PLL_MUL_9 + * @arg @ref LL_RCC_PLL_MUL_6_5 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLMUL__) \ + (((__PLLMUL__) != RCC_CFGR_PLLMULL6_5) ? \ + ((__INPUTFREQ__) * ((((__PLLMUL__) & RCC_CFGR_PLLMULL) >> RCC_CFGR_PLLMULL_Pos) + 2U)) :\ + (((__INPUTFREQ__) * 13U) / 2U)) + +#else +/** + * @brief Helper macro to calculate the PLLCLK frequency + * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE / (@ref LL_RCC_PLL_GetPrediv () + 1), @ref LL_RCC_PLL_GetMultiplicator ()); + * @param __INPUTFREQ__ PLL Input frequency (based on HSE div Prediv1 or div 2 / HSI div 2) + * @param __PLLMUL__: This parameter can be one of the following values: + * @arg @ref LL_RCC_PLL_MUL_2 + * @arg @ref LL_RCC_PLL_MUL_3 + * @arg @ref LL_RCC_PLL_MUL_4 + * @arg @ref LL_RCC_PLL_MUL_5 + * @arg @ref LL_RCC_PLL_MUL_6 + * @arg @ref LL_RCC_PLL_MUL_7 + * @arg @ref LL_RCC_PLL_MUL_8 + * @arg @ref LL_RCC_PLL_MUL_9 + * @arg @ref LL_RCC_PLL_MUL_10 + * @arg @ref LL_RCC_PLL_MUL_11 + * @arg @ref LL_RCC_PLL_MUL_12 + * @arg @ref LL_RCC_PLL_MUL_13 + * @arg @ref LL_RCC_PLL_MUL_14 + * @arg @ref LL_RCC_PLL_MUL_15 + * @arg @ref LL_RCC_PLL_MUL_16 + * @retval PLL clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLMUL__) ((__INPUTFREQ__) * (((__PLLMUL__) >> RCC_CFGR_PLLMULL_Pos) + 2U)) +#endif /* RCC_CFGR_PLLMULL6_5 */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Helper macro to calculate the PLLI2S frequency + * @note ex: @ref __LL_RCC_CALC_PLLI2SCLK_FREQ (HSE_VALUE, @ref LL_RCC_PLLI2S_GetMultiplicator (), @ref LL_RCC_HSE_GetPrediv2 ()); + * @param __INPUTFREQ__ PLLI2S Input frequency (based on HSE value) + * @param __PLLI2SMUL__: This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2S_MUL_8 + * @arg @ref LL_RCC_PLLI2S_MUL_9 + * @arg @ref LL_RCC_PLLI2S_MUL_10 + * @arg @ref LL_RCC_PLLI2S_MUL_11 + * @arg @ref LL_RCC_PLLI2S_MUL_12 + * @arg @ref LL_RCC_PLLI2S_MUL_13 + * @arg @ref LL_RCC_PLLI2S_MUL_14 + * @arg @ref LL_RCC_PLLI2S_MUL_16 + * @arg @ref LL_RCC_PLLI2S_MUL_20 + * @param __PLLI2SDIV__: This parameter can be one of the following values: + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_1 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_2 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_3 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_4 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_5 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_6 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_7 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_8 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_9 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_10 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_11 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_12 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_13 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_14 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_15 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_16 + * @retval PLLI2S clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLLI2SCLK_FREQ(__INPUTFREQ__, __PLLI2SMUL__, __PLLI2SDIV__) (((__INPUTFREQ__) * (((__PLLI2SMUL__) >> RCC_CFGR2_PLL3MUL_Pos) + 2U)) / (((__PLLI2SDIV__) >> RCC_CFGR2_PREDIV2_Pos) + 1U)) +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Helper macro to calculate the PLL2 frequency + * @note ex: @ref __LL_RCC_CALC_PLL2CLK_FREQ (HSE_VALUE, @ref LL_RCC_PLL2_GetMultiplicator (), @ref LL_RCC_HSE_GetPrediv2 ()); + * @param __INPUTFREQ__ PLL2 Input frequency (based on HSE value) + * @param __PLL2MUL__: This parameter can be one of the following values: + * @arg @ref LL_RCC_PLL2_MUL_8 + * @arg @ref LL_RCC_PLL2_MUL_9 + * @arg @ref LL_RCC_PLL2_MUL_10 + * @arg @ref LL_RCC_PLL2_MUL_11 + * @arg @ref LL_RCC_PLL2_MUL_12 + * @arg @ref LL_RCC_PLL2_MUL_13 + * @arg @ref LL_RCC_PLL2_MUL_14 + * @arg @ref LL_RCC_PLL2_MUL_16 + * @arg @ref LL_RCC_PLL2_MUL_20 + * @param __PLL2DIV__: This parameter can be one of the following values: + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_1 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_2 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_3 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_4 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_5 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_6 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_7 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_8 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_9 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_10 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_11 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_12 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_13 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_14 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_15 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_16 + * @retval PLL2 clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PLL2CLK_FREQ(__INPUTFREQ__, __PLL2MUL__, __PLL2DIV__) (((__INPUTFREQ__) * (((__PLL2MUL__) >> RCC_CFGR2_PLL2MUL_Pos) + 2U)) / (((__PLL2DIV__) >> RCC_CFGR2_PREDIV2_Pos) + 1U)) +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Helper macro to calculate the HCLK frequency + * @note: __AHBPRESCALER__ be retrieved by @ref LL_RCC_GetAHBPrescaler + * ex: __LL_RCC_CALC_HCLK_FREQ(LL_RCC_GetAHBPrescaler()) + * @param __SYSCLKFREQ__ SYSCLK frequency (based on HSE/HSI/PLLCLK) + * @param __AHBPRESCALER__: This parameter can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + * @retval HCLK clock frequency (in Hz) + */ +#define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __AHBPRESCALER__) ((__SYSCLKFREQ__) >> AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos]) + +/** + * @brief Helper macro to calculate the PCLK1 frequency (ABP1) + * @note: __APB1PRESCALER__ be retrieved by @ref LL_RCC_GetAPB1Prescaler + * ex: __LL_RCC_CALC_PCLK1_FREQ(LL_RCC_GetAPB1Prescaler()) + * @param __HCLKFREQ__ HCLK frequency + * @param __APB1PRESCALER__: This parameter can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + * @retval PCLK1 clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE1_Pos]) + +/** + * @brief Helper macro to calculate the PCLK2 frequency (ABP2) + * @note: __APB2PRESCALER__ be retrieved by @ref LL_RCC_GetAPB2Prescaler + * ex: __LL_RCC_CALC_PCLK2_FREQ(LL_RCC_GetAPB2Prescaler()) + * @param __HCLKFREQ__ HCLK frequency + * @param __APB2PRESCALER__: This parameter can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + * @retval PCLK2 clock frequency (in Hz) + */ +#define __LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB2PRESCALER__) >> RCC_CFGR_PPRE2_Pos]) + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup RCC_LL_Exported_Functions RCC Exported Functions + * @{ + */ + +/** @defgroup RCC_LL_EF_HSE HSE + * @{ + */ + +/** + * @brief Enable the Clock Security System. + * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_EnableCSS(void) +{ + SET_BIT(RCC->CR, RCC_CR_CSSON); +} + +/** + * @brief Enable HSE external oscillator (HSE Bypass) + * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_EnableBypass(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSEBYP); +} + +/** + * @brief Disable HSE external oscillator (HSE Bypass) + * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_DisableBypass(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); +} + +/** + * @brief Enable HSE crystal oscillator (HSE ON) + * @rmtoll CR HSEON LL_RCC_HSE_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSEON); +} + +/** + * @brief Disable HSE crystal oscillator (HSE ON) + * @rmtoll CR HSEON LL_RCC_HSE_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSE_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON); +} + +/** + * @brief Check if HSE oscillator Ready + * @rmtoll CR HSERDY LL_RCC_HSE_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY)); +} + +#if defined(RCC_CFGR2_PREDIV2) +/** + * @brief Get PREDIV2 division factor + * @rmtoll CFGR2 PREDIV2 LL_RCC_HSE_GetPrediv2 + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_1 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_2 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_3 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_4 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_5 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_6 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_7 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_8 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_9 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_10 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_11 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_12 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_13 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_14 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_15 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_HSE_GetPrediv2(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2)); +} +#endif /* RCC_CFGR2_PREDIV2 */ + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_HSI HSI + * @{ + */ + +/** + * @brief Enable HSI oscillator + * @rmtoll CR HSION LL_RCC_HSI_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_HSION); +} + +/** + * @brief Disable HSI oscillator + * @rmtoll CR HSION LL_RCC_HSI_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_HSION); +} + +/** + * @brief Check if HSI clock is ready + * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_HSIRDY) == (RCC_CR_HSIRDY)); +} + +/** + * @brief Get HSI Calibration value + * @note When HSITRIM is written, HSICAL is updated with the sum of + * HSITRIM and the factory trim value + * @rmtoll CR HSICAL LL_RCC_HSI_GetCalibration + * @retval Between Min_Data = 0x00 and Max_Data = 0xFF + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void) +{ + return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSICAL) >> RCC_CR_HSICAL_Pos); +} + +/** + * @brief Set HSI Calibration trimming + * @note user-programmable trimming value that is added to the HSICAL + * @note Default value is 16, which, when added to the HSICAL value, + * should trim the HSI to 16 MHz +/- 1 % + * @rmtoll CR HSITRIM LL_RCC_HSI_SetCalibTrimming + * @param Value between Min_Data = 0x00 and Max_Data = 0x1F + * @retval None + */ +__STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value) +{ + MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, Value << RCC_CR_HSITRIM_Pos); +} + +/** + * @brief Get HSI Calibration trimming + * @rmtoll CR HSITRIM LL_RCC_HSI_GetCalibTrimming + * @retval Between Min_Data = 0x00 and Max_Data = 0x1F + */ +__STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void) +{ + return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_LSE LSE + * @{ + */ + +/** + * @brief Enable Low Speed External (LSE) crystal. + * @rmtoll BDCR LSEON LL_RCC_LSE_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_Enable(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); +} + +/** + * @brief Disable Low Speed External (LSE) crystal. + * @rmtoll BDCR LSEON LL_RCC_LSE_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_Disable(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); +} + +/** + * @brief Enable external clock source (LSE bypass). + * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_EnableBypass(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); +} + +/** + * @brief Disable external clock source (LSE bypass). + * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSE_DisableBypass(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); +} + +/** + * @brief Check if LSE oscillator Ready + * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void) +{ + return (READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == (RCC_BDCR_LSERDY)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_LSI LSI + * @{ + */ + +/** + * @brief Enable LSI Oscillator + * @rmtoll CSR LSION LL_RCC_LSI_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSI_Enable(void) +{ + SET_BIT(RCC->CSR, RCC_CSR_LSION); +} + +/** + * @brief Disable LSI Oscillator + * @rmtoll CSR LSION LL_RCC_LSI_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_LSI_Disable(void) +{ + CLEAR_BIT(RCC->CSR, RCC_CSR_LSION); +} + +/** + * @brief Check if LSI is Ready + * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == (RCC_CSR_LSIRDY)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_System System + * @{ + */ + +/** + * @brief Configure the system clock source + * @rmtoll CFGR SW LL_RCC_SetSysClkSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI + * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source); +} + +/** + * @brief Get the system clock source + * @rmtoll CFGR SWS LL_RCC_GetSysClkSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE + * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL + */ +__STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS)); +} + +/** + * @brief Set AHB prescaler + * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler); +} + +/** + * @brief Set APB1 prescaler + * @rmtoll CFGR PPRE1 LL_RCC_SetAPB1Prescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler); +} + +/** + * @brief Set APB2 prescaler + * @rmtoll CFGR PPRE2 LL_RCC_SetAPB2Prescaler + * @param Prescaler This parameter can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler); +} + +/** + * @brief Get AHB prescaler + * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_SYSCLK_DIV_1 + * @arg @ref LL_RCC_SYSCLK_DIV_2 + * @arg @ref LL_RCC_SYSCLK_DIV_4 + * @arg @ref LL_RCC_SYSCLK_DIV_8 + * @arg @ref LL_RCC_SYSCLK_DIV_16 + * @arg @ref LL_RCC_SYSCLK_DIV_64 + * @arg @ref LL_RCC_SYSCLK_DIV_128 + * @arg @ref LL_RCC_SYSCLK_DIV_256 + * @arg @ref LL_RCC_SYSCLK_DIV_512 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE)); +} + +/** + * @brief Get APB1 prescaler + * @rmtoll CFGR PPRE1 LL_RCC_GetAPB1Prescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_APB1_DIV_1 + * @arg @ref LL_RCC_APB1_DIV_2 + * @arg @ref LL_RCC_APB1_DIV_4 + * @arg @ref LL_RCC_APB1_DIV_8 + * @arg @ref LL_RCC_APB1_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE1)); +} + +/** + * @brief Get APB2 prescaler + * @rmtoll CFGR PPRE2 LL_RCC_GetAPB2Prescaler + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_APB2_DIV_1 + * @arg @ref LL_RCC_APB2_DIV_2 + * @arg @ref LL_RCC_APB2_DIV_4 + * @arg @ref LL_RCC_APB2_DIV_8 + * @arg @ref LL_RCC_APB2_DIV_16 + */ +__STATIC_INLINE uint32_t LL_RCC_GetAPB2Prescaler(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE2)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_MCO MCO + * @{ + */ + +/** + * @brief Configure MCOx + * @rmtoll CFGR MCO LL_RCC_ConfigMCO + * @param MCOxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK + * @arg @ref LL_RCC_MCO1SOURCE_SYSCLK + * @arg @ref LL_RCC_MCO1SOURCE_HSI + * @arg @ref LL_RCC_MCO1SOURCE_HSE + * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK_DIV_2 + * @arg @ref LL_RCC_MCO1SOURCE_PLL2CLK (*) + * @arg @ref LL_RCC_MCO1SOURCE_PLLI2SCLK_DIV2 (*) + * @arg @ref LL_RCC_MCO1SOURCE_EXT_HSE (*) + * @arg @ref LL_RCC_MCO1SOURCE_PLLI2SCLK (*) + * + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL, MCOxSource); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source + * @{ + */ + +#if defined(RCC_CFGR2_I2S2SRC) +/** + * @brief Configure I2Sx clock source + * @rmtoll CFGR2 I2S2SRC LL_RCC_SetI2SClockSource\n + * CFGR2 I2S3SRC LL_RCC_SetI2SClockSource + * @param I2SxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S2_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLI2S_VCO + * @arg @ref LL_RCC_I2S3_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_I2S3_CLKSOURCE_PLLI2S_VCO + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetI2SClockSource(uint32_t I2SxSource) +{ + MODIFY_REG(RCC->CFGR2, (I2SxSource & 0xFFFF0000U), (I2SxSource << 16U)); +} +#endif /* RCC_CFGR2_I2S2SRC */ + +#if defined(USB_OTG_FS) || defined(USB) +/** + * @brief Configure USB clock source + * @rmtoll CFGR OTGFSPRE LL_RCC_SetUSBClockSource\n + * CFGR USBPRE LL_RCC_SetUSBClockSource + * @param USBxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5 (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_2 (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_3 (*) + * + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource) +{ +#if defined(RCC_CFGR_USBPRE) + MODIFY_REG(RCC->CFGR, RCC_CFGR_USBPRE, USBxSource); +#else /*RCC_CFGR_OTGFSPRE*/ + MODIFY_REG(RCC->CFGR, RCC_CFGR_OTGFSPRE, USBxSource); +#endif /*RCC_CFGR_USBPRE*/ +} +#endif /* USB_OTG_FS || USB */ + +/** + * @brief Configure ADC clock source + * @rmtoll CFGR ADCPRE LL_RCC_SetADCClockSource + * @param ADCxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_2 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_4 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_6 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_8 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetADCClockSource(uint32_t ADCxSource) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_ADCPRE, ADCxSource); +} + +#if defined(RCC_CFGR2_I2S2SRC) +/** + * @brief Get I2Sx clock source + * @rmtoll CFGR2 I2S2SRC LL_RCC_GetI2SClockSource\n + * CFGR2 I2S3SRC LL_RCC_GetI2SClockSource + * @param I2Sx This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S2_CLKSOURCE + * @arg @ref LL_RCC_I2S3_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_I2S2_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLLI2S_VCO + * @arg @ref LL_RCC_I2S3_CLKSOURCE_SYSCLK + * @arg @ref LL_RCC_I2S3_CLKSOURCE_PLLI2S_VCO + */ +__STATIC_INLINE uint32_t LL_RCC_GetI2SClockSource(uint32_t I2Sx) +{ + return (uint32_t)(READ_BIT(RCC->CFGR2, I2Sx) >> 16U | I2Sx); +} +#endif /* RCC_CFGR2_I2S2SRC */ + +#if defined(USB_OTG_FS) || defined(USB) +/** + * @brief Get USBx clock source + * @rmtoll CFGR OTGFSPRE LL_RCC_GetUSBClockSource\n + * CFGR USBPRE LL_RCC_GetUSBClockSource + * @param USBx This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5 (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_2 (*) + * @arg @ref LL_RCC_USB_CLKSOURCE_PLL_DIV_3 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, USBx)); +} +#endif /* USB_OTG_FS || USB */ + +/** + * @brief Get ADCx clock source + * @rmtoll CFGR ADCPRE LL_RCC_GetADCClockSource + * @param ADCx This parameter can be one of the following values: + * @arg @ref LL_RCC_ADC_CLKSOURCE + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_2 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_4 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_6 + * @arg @ref LL_RCC_ADC_CLKSRC_PCLK2_DIV_8 + */ +__STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, ADCx)); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_RTC RTC + * @{ + */ + +/** + * @brief Set RTC Clock Source + * @note Once the RTC clock source has been selected, it cannot be changed any more unless + * the Backup domain is reset. The BDRST bit can be used to reset them. + * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI + * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV128 + * @retval None + */ +__STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source) +{ + MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source); +} + +/** + * @brief Get RTC Clock Source + * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE + * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI + * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV128 + */ +__STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void) +{ + return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)); +} + +/** + * @brief Enable RTC + * @rmtoll BDCR RTCEN LL_RCC_EnableRTC + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableRTC(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN); +} + +/** + * @brief Disable RTC + * @rmtoll BDCR RTCEN LL_RCC_DisableRTC + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableRTC(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN); +} + +/** + * @brief Check if RTC has been enabled or not + * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void) +{ + return (READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == (RCC_BDCR_RTCEN)); +} + +/** + * @brief Force the Backup domain reset + * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset + * @retval None + */ +__STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void) +{ + SET_BIT(RCC->BDCR, RCC_BDCR_BDRST); +} + +/** + * @brief Release the Backup domain reset + * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset + * @retval None + */ +__STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void) +{ + CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_PLL PLL + * @{ + */ + +/** + * @brief Enable PLL + * @rmtoll CR PLLON LL_RCC_PLL_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLLON); +} + +/** + * @brief Disable PLL + * @note Cannot be disabled if the PLL clock is used as the system clock + * @rmtoll CR PLLON LL_RCC_PLL_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLLON); +} + +/** + * @brief Check if PLL Ready + * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == (RCC_CR_PLLRDY)); +} + +/** + * @brief Configure PLL used for SYSCLK Domain + * @rmtoll CFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n + * CFGR PLLXTPRE LL_RCC_PLL_ConfigDomain_SYS\n + * CFGR PLLMULL LL_RCC_PLL_ConfigDomain_SYS\n + * CFGR2 PREDIV1 LL_RCC_PLL_ConfigDomain_SYS\n + * CFGR2 PREDIV1SRC LL_RCC_PLL_ConfigDomain_SYS + * @param Source This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2 + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_1 + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_2 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_3 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_4 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_5 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_6 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_7 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_8 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_9 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_10 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_11 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_12 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_13 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_14 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_15 (*) + * @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_16 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_1 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_2 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_3 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_4 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_5 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_6 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_7 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_8 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_9 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_10 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_11 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_12 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_13 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_14 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_15 (*) + * @arg @ref LL_RCC_PLLSOURCE_PLL2_DIV_16 (*) + * + * (*) value not defined in all devices + * @param PLLMul This parameter can be one of the following values: + * @arg @ref LL_RCC_PLL_MUL_2 (*) + * @arg @ref LL_RCC_PLL_MUL_3 (*) + * @arg @ref LL_RCC_PLL_MUL_4 + * @arg @ref LL_RCC_PLL_MUL_5 + * @arg @ref LL_RCC_PLL_MUL_6 + * @arg @ref LL_RCC_PLL_MUL_7 + * @arg @ref LL_RCC_PLL_MUL_8 + * @arg @ref LL_RCC_PLL_MUL_9 + * @arg @ref LL_RCC_PLL_MUL_6_5 (*) + * @arg @ref LL_RCC_PLL_MUL_10 (*) + * @arg @ref LL_RCC_PLL_MUL_11 (*) + * @arg @ref LL_RCC_PLL_MUL_12 (*) + * @arg @ref LL_RCC_PLL_MUL_13 (*) + * @arg @ref LL_RCC_PLL_MUL_14 (*) + * @arg @ref LL_RCC_PLL_MUL_15 (*) + * @arg @ref LL_RCC_PLL_MUL_16 (*) + * + * (*) value not defined in all devices + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLMul) +{ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL, + (Source & (RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE)) | PLLMul); +#if defined(RCC_CFGR2_PREDIV1) +#if defined(RCC_CFGR2_PREDIV1SRC) + MODIFY_REG(RCC->CFGR2, (RCC_CFGR2_PREDIV1 | RCC_CFGR2_PREDIV1SRC), + (Source & RCC_CFGR2_PREDIV1) | ((Source & (RCC_CFGR2_PREDIV1SRC << 4U)) >> 4U)); +#else + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1, (Source & RCC_CFGR2_PREDIV1)); +#endif /*RCC_CFGR2_PREDIV1SRC*/ +#endif /*RCC_CFGR2_PREDIV1*/ +} + +/** + * @brief Configure PLL clock source + * @rmtoll CFGR PLLSRC LL_RCC_PLL_SetMainSource\n + * CFGR2 PREDIV1SRC LL_RCC_PLL_SetMainSource + * @param PLLSource This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2 + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLSOURCE_PLL2 (*) + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource) +{ +#if defined(RCC_CFGR2_PREDIV1SRC) + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC, ((PLLSource & (RCC_CFGR2_PREDIV1SRC << 4U)) >> 4U)); +#endif /* RCC_CFGR2_PREDIV1SRC */ + MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC, PLLSource); +} + +/** + * @brief Get the oscillator used as PLL clock source. + * @rmtoll CFGR PLLSRC LL_RCC_PLL_GetMainSource\n + * CFGR2 PREDIV1SRC LL_RCC_PLL_GetMainSource + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2 + * @arg @ref LL_RCC_PLLSOURCE_HSE + * @arg @ref LL_RCC_PLLSOURCE_PLL2 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void) +{ +#if defined(RCC_CFGR2_PREDIV1SRC) + uint32_t pllsrc = READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC); + uint32_t predivsrc = (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC) << 4U); + return (uint32_t)(pllsrc | predivsrc); +#else + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC)); +#endif /*RCC_CFGR2_PREDIV1SRC*/ +} + +/** + * @brief Get PLL multiplication Factor + * @rmtoll CFGR PLLMULL LL_RCC_PLL_GetMultiplicator + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLL_MUL_2 (*) + * @arg @ref LL_RCC_PLL_MUL_3 (*) + * @arg @ref LL_RCC_PLL_MUL_4 + * @arg @ref LL_RCC_PLL_MUL_5 + * @arg @ref LL_RCC_PLL_MUL_6 + * @arg @ref LL_RCC_PLL_MUL_7 + * @arg @ref LL_RCC_PLL_MUL_8 + * @arg @ref LL_RCC_PLL_MUL_9 + * @arg @ref LL_RCC_PLL_MUL_6_5 (*) + * @arg @ref LL_RCC_PLL_MUL_10 (*) + * @arg @ref LL_RCC_PLL_MUL_11 (*) + * @arg @ref LL_RCC_PLL_MUL_12 (*) + * @arg @ref LL_RCC_PLL_MUL_13 (*) + * @arg @ref LL_RCC_PLL_MUL_14 (*) + * @arg @ref LL_RCC_PLL_MUL_15 (*) + * @arg @ref LL_RCC_PLL_MUL_16 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetMultiplicator(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLMULL)); +} + +/** + * @brief Get PREDIV1 division factor for the main PLL + * @note They can be written only when the PLL is disabled + * @rmtoll CFGR2 PREDIV1 LL_RCC_PLL_GetPrediv\n + * CFGR2 PLLXTPRE LL_RCC_PLL_GetPrediv + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PREDIV_DIV_1 + * @arg @ref LL_RCC_PREDIV_DIV_2 + * @arg @ref LL_RCC_PREDIV_DIV_3 (*) + * @arg @ref LL_RCC_PREDIV_DIV_4 (*) + * @arg @ref LL_RCC_PREDIV_DIV_5 (*) + * @arg @ref LL_RCC_PREDIV_DIV_6 (*) + * @arg @ref LL_RCC_PREDIV_DIV_7 (*) + * @arg @ref LL_RCC_PREDIV_DIV_8 (*) + * @arg @ref LL_RCC_PREDIV_DIV_9 (*) + * @arg @ref LL_RCC_PREDIV_DIV_10 (*) + * @arg @ref LL_RCC_PREDIV_DIV_11 (*) + * @arg @ref LL_RCC_PREDIV_DIV_12 (*) + * @arg @ref LL_RCC_PREDIV_DIV_13 (*) + * @arg @ref LL_RCC_PREDIV_DIV_14 (*) + * @arg @ref LL_RCC_PREDIV_DIV_15 (*) + * @arg @ref LL_RCC_PREDIV_DIV_16 (*) + * + * (*) value not defined in all devices + */ +__STATIC_INLINE uint32_t LL_RCC_PLL_GetPrediv(void) +{ +#if defined(RCC_CFGR2_PREDIV1) + return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1)); +#else + return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLXTPRE) >> RCC_CFGR_PLLXTPRE_Pos); +#endif /*RCC_CFGR2_PREDIV1*/ +} + +/** + * @} + */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** @defgroup RCC_LL_EF_PLLI2S PLLI2S + * @{ + */ + +/** + * @brief Enable PLLI2S + * @rmtoll CR PLL3ON LL_RCC_PLLI2S_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLL3ON); +} + +/** + * @brief Disable PLLI2S + * @rmtoll CR PLL3ON LL_RCC_PLLI2S_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLLI2S_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLL3ON); +} + +/** + * @brief Check if PLLI2S Ready + * @rmtoll CR PLL3RDY LL_RCC_PLLI2S_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLL3RDY) == (RCC_CR_PLL3RDY)); +} + +/** + * @brief Configure PLLI2S used for I2S Domain + * @rmtoll CFGR2 PREDIV2 LL_RCC_PLL_ConfigDomain_PLLI2S\n + * CFGR2 PLL3MUL LL_RCC_PLL_ConfigDomain_PLLI2S + * @param Divider This parameter can be one of the following values: + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_1 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_2 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_3 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_4 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_5 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_6 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_7 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_8 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_9 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_10 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_11 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_12 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_13 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_14 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_15 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_16 + * @param Multiplicator This parameter can be one of the following values: + * @arg @ref LL_RCC_PLLI2S_MUL_8 + * @arg @ref LL_RCC_PLLI2S_MUL_9 + * @arg @ref LL_RCC_PLLI2S_MUL_10 + * @arg @ref LL_RCC_PLLI2S_MUL_11 + * @arg @ref LL_RCC_PLLI2S_MUL_12 + * @arg @ref LL_RCC_PLLI2S_MUL_13 + * @arg @ref LL_RCC_PLLI2S_MUL_14 + * @arg @ref LL_RCC_PLLI2S_MUL_16 + * @arg @ref LL_RCC_PLLI2S_MUL_20 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_PLLI2S(uint32_t Divider, uint32_t Multiplicator) +{ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2 | RCC_CFGR2_PLL3MUL, Divider | Multiplicator); +} + +/** + * @brief Get PLLI2S Multiplication Factor + * @rmtoll CFGR2 PLL3MUL LL_RCC_PLLI2S_GetMultiplicator + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLLI2S_MUL_8 + * @arg @ref LL_RCC_PLLI2S_MUL_9 + * @arg @ref LL_RCC_PLLI2S_MUL_10 + * @arg @ref LL_RCC_PLLI2S_MUL_11 + * @arg @ref LL_RCC_PLLI2S_MUL_12 + * @arg @ref LL_RCC_PLLI2S_MUL_13 + * @arg @ref LL_RCC_PLLI2S_MUL_14 + * @arg @ref LL_RCC_PLLI2S_MUL_16 + * @arg @ref LL_RCC_PLLI2S_MUL_20 + */ +__STATIC_INLINE uint32_t LL_RCC_PLLI2S_GetMultiplicator(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PLL3MUL)); +} + +/** + * @} + */ +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** @defgroup RCC_LL_EF_PLL2 PLL2 + * @{ + */ + +/** + * @brief Enable PLL2 + * @rmtoll CR PLL2ON LL_RCC_PLL2_Enable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL2_Enable(void) +{ + SET_BIT(RCC->CR, RCC_CR_PLL2ON); +} + +/** + * @brief Disable PLL2 + * @rmtoll CR PLL2ON LL_RCC_PLL2_Disable + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL2_Disable(void) +{ + CLEAR_BIT(RCC->CR, RCC_CR_PLL2ON); +} + +/** + * @brief Check if PLL2 Ready + * @rmtoll CR PLL2RDY LL_RCC_PLL2_IsReady + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_PLL2_IsReady(void) +{ + return (READ_BIT(RCC->CR, RCC_CR_PLL2RDY) == (RCC_CR_PLL2RDY)); +} + +/** + * @brief Configure PLL2 used for PLL2 Domain + * @rmtoll CFGR2 PREDIV2 LL_RCC_PLL_ConfigDomain_PLL2\n + * CFGR2 PLL2MUL LL_RCC_PLL_ConfigDomain_PLL2 + * @param Divider This parameter can be one of the following values: + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_1 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_2 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_3 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_4 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_5 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_6 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_7 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_8 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_9 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_10 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_11 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_12 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_13 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_14 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_15 + * @arg @ref LL_RCC_HSE_PREDIV2_DIV_16 + * @param Multiplicator This parameter can be one of the following values: + * @arg @ref LL_RCC_PLL2_MUL_8 + * @arg @ref LL_RCC_PLL2_MUL_9 + * @arg @ref LL_RCC_PLL2_MUL_10 + * @arg @ref LL_RCC_PLL2_MUL_11 + * @arg @ref LL_RCC_PLL2_MUL_12 + * @arg @ref LL_RCC_PLL2_MUL_13 + * @arg @ref LL_RCC_PLL2_MUL_14 + * @arg @ref LL_RCC_PLL2_MUL_16 + * @arg @ref LL_RCC_PLL2_MUL_20 + * @retval None + */ +__STATIC_INLINE void LL_RCC_PLL_ConfigDomain_PLL2(uint32_t Divider, uint32_t Multiplicator) +{ + MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2 | RCC_CFGR2_PLL2MUL, Divider | Multiplicator); +} + +/** + * @brief Get PLL2 Multiplication Factor + * @rmtoll CFGR2 PLL2MUL LL_RCC_PLL2_GetMultiplicator + * @retval Returned value can be one of the following values: + * @arg @ref LL_RCC_PLL2_MUL_8 + * @arg @ref LL_RCC_PLL2_MUL_9 + * @arg @ref LL_RCC_PLL2_MUL_10 + * @arg @ref LL_RCC_PLL2_MUL_11 + * @arg @ref LL_RCC_PLL2_MUL_12 + * @arg @ref LL_RCC_PLL2_MUL_13 + * @arg @ref LL_RCC_PLL2_MUL_14 + * @arg @ref LL_RCC_PLL2_MUL_16 + * @arg @ref LL_RCC_PLL2_MUL_20 + */ +__STATIC_INLINE uint32_t LL_RCC_PLL2_GetMultiplicator(void) +{ + return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PLL2MUL)); +} + +/** + * @} + */ +#endif /* RCC_PLL2_SUPPORT */ + +/** @defgroup RCC_LL_EF_FLAG_Management FLAG Management + * @{ + */ + +/** + * @brief Clear LSI ready interrupt flag + * @rmtoll CIR LSIRDYC LL_RCC_ClearFlag_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC); +} + +/** + * @brief Clear LSE ready interrupt flag + * @rmtoll CIR LSERDYC LL_RCC_ClearFlag_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSERDYC); +} + +/** + * @brief Clear HSI ready interrupt flag + * @rmtoll CIR HSIRDYC LL_RCC_ClearFlag_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSIRDYC); +} + +/** + * @brief Clear HSE ready interrupt flag + * @rmtoll CIR HSERDYC LL_RCC_ClearFlag_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSERDYC); +} + +/** + * @brief Clear PLL ready interrupt flag + * @rmtoll CIR PLLRDYC LL_RCC_ClearFlag_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLRDYC); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Clear PLLI2S ready interrupt flag + * @rmtoll CIR PLL3RDYC LL_RCC_ClearFlag_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLLI2SRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLL3RDYC); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Clear PLL2 ready interrupt flag + * @rmtoll CIR PLL2RDYC LL_RCC_ClearFlag_PLL2RDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_PLL2RDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLL2RDYC); +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Clear Clock security system interrupt flag + * @rmtoll CIR CSSC LL_RCC_ClearFlag_HSECSS + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_CSSC); +} + +/** + * @brief Check if LSI ready interrupt occurred or not + * @rmtoll CIR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYF) == (RCC_CIR_LSIRDYF)); +} + +/** + * @brief Check if LSE ready interrupt occurred or not + * @rmtoll CIR LSERDYF LL_RCC_IsActiveFlag_LSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYF) == (RCC_CIR_LSERDYF)); +} + +/** + * @brief Check if HSI ready interrupt occurred or not + * @rmtoll CIR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYF) == (RCC_CIR_HSIRDYF)); +} + +/** + * @brief Check if HSE ready interrupt occurred or not + * @rmtoll CIR HSERDYF LL_RCC_IsActiveFlag_HSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYF) == (RCC_CIR_HSERDYF)); +} + +/** + * @brief Check if PLL ready interrupt occurred or not + * @rmtoll CIR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYF) == (RCC_CIR_PLLRDYF)); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Check if PLLI2S ready interrupt occurred or not + * @rmtoll CIR PLL3RDYF LL_RCC_IsActiveFlag_PLLI2SRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLI2SRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLL3RDYF) == (RCC_CIR_PLL3RDYF)); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Check if PLL2 ready interrupt occurred or not + * @rmtoll CIR PLL2RDYF LL_RCC_IsActiveFlag_PLL2RDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLL2RDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLL2RDYF) == (RCC_CIR_PLL2RDYF)); +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Check if Clock security system interrupt occurred or not + * @rmtoll CIR CSSF LL_RCC_IsActiveFlag_HSECSS + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_CSSF) == (RCC_CIR_CSSF)); +} + +/** + * @brief Check if RCC flag Independent Watchdog reset is set or not. + * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == (RCC_CSR_IWDGRSTF)); +} + +/** + * @brief Check if RCC flag Low Power reset is set or not. + * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == (RCC_CSR_LPWRRSTF)); +} + +/** + * @brief Check if RCC flag Pin reset is set or not. + * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == (RCC_CSR_PINRSTF)); +} + +/** + * @brief Check if RCC flag POR/PDR reset is set or not. + * @rmtoll CSR PORRSTF LL_RCC_IsActiveFlag_PORRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PORRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_PORRSTF) == (RCC_CSR_PORRSTF)); +} + +/** + * @brief Check if RCC flag Software reset is set or not. + * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == (RCC_CSR_SFTRSTF)); +} + +/** + * @brief Check if RCC flag Window Watchdog reset is set or not. + * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void) +{ + return (READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == (RCC_CSR_WWDGRSTF)); +} + +/** + * @brief Set RMVF bit to clear the reset flags. + * @rmtoll CSR RMVF LL_RCC_ClearResetFlags + * @retval None + */ +__STATIC_INLINE void LL_RCC_ClearResetFlags(void) +{ + SET_BIT(RCC->CSR, RCC_CSR_RMVF); +} + +/** + * @} + */ + +/** @defgroup RCC_LL_EF_IT_Management IT Management + * @{ + */ + +/** + * @brief Enable LSI ready interrupt + * @rmtoll CIR LSIRDYIE LL_RCC_EnableIT_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSIRDYIE); +} + +/** + * @brief Enable LSE ready interrupt + * @rmtoll CIR LSERDYIE LL_RCC_EnableIT_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_LSERDYIE); +} + +/** + * @brief Enable HSI ready interrupt + * @rmtoll CIR HSIRDYIE LL_RCC_EnableIT_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSIRDYIE); +} + +/** + * @brief Enable HSE ready interrupt + * @rmtoll CIR HSERDYIE LL_RCC_EnableIT_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_HSERDYIE); +} + +/** + * @brief Enable PLL ready interrupt + * @rmtoll CIR PLLRDYIE LL_RCC_EnableIT_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLLRDYIE); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Enable PLLI2S ready interrupt + * @rmtoll CIR PLL3RDYIE LL_RCC_EnableIT_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLLI2SRDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLL3RDYIE); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Enable PLL2 ready interrupt + * @rmtoll CIR PLL2RDYIE LL_RCC_EnableIT_PLL2RDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_EnableIT_PLL2RDY(void) +{ + SET_BIT(RCC->CIR, RCC_CIR_PLL2RDYIE); +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Disable LSI ready interrupt + * @rmtoll CIR LSIRDYIE LL_RCC_DisableIT_LSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE); +} + +/** + * @brief Disable LSE ready interrupt + * @rmtoll CIR LSERDYIE LL_RCC_DisableIT_LSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_LSERDYIE); +} + +/** + * @brief Disable HSI ready interrupt + * @rmtoll CIR HSIRDYIE LL_RCC_DisableIT_HSIRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_HSIRDYIE); +} + +/** + * @brief Disable HSE ready interrupt + * @rmtoll CIR HSERDYIE LL_RCC_DisableIT_HSERDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_HSERDYIE); +} + +/** + * @brief Disable PLL ready interrupt + * @rmtoll CIR PLLRDYIE LL_RCC_DisableIT_PLLRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLLRDYIE); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Disable PLLI2S ready interrupt + * @rmtoll CIR PLL3RDYIE LL_RCC_DisableIT_PLLI2SRDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLLI2SRDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLL3RDYIE); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Disable PLL2 ready interrupt + * @rmtoll CIR PLL2RDYIE LL_RCC_DisableIT_PLL2RDY + * @retval None + */ +__STATIC_INLINE void LL_RCC_DisableIT_PLL2RDY(void) +{ + CLEAR_BIT(RCC->CIR, RCC_CIR_PLL2RDYIE); +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Checks if LSI ready interrupt source is enabled or disabled. + * @rmtoll CIR LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYIE) == (RCC_CIR_LSIRDYIE)); +} + +/** + * @brief Checks if LSE ready interrupt source is enabled or disabled. + * @rmtoll CIR LSERDYIE LL_RCC_IsEnabledIT_LSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYIE) == (RCC_CIR_LSERDYIE)); +} + +/** + * @brief Checks if HSI ready interrupt source is enabled or disabled. + * @rmtoll CIR HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYIE) == (RCC_CIR_HSIRDYIE)); +} + +/** + * @brief Checks if HSE ready interrupt source is enabled or disabled. + * @rmtoll CIR HSERDYIE LL_RCC_IsEnabledIT_HSERDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYIE) == (RCC_CIR_HSERDYIE)); +} + +/** + * @brief Checks if PLL ready interrupt source is enabled or disabled. + * @rmtoll CIR PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYIE) == (RCC_CIR_PLLRDYIE)); +} + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Checks if PLLI2S ready interrupt source is enabled or disabled. + * @rmtoll CIR PLL3RDYIE LL_RCC_IsEnabledIT_PLLI2SRDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLI2SRDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLL3RDYIE) == (RCC_CIR_PLL3RDYIE)); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Checks if PLL2 ready interrupt source is enabled or disabled. + * @rmtoll CIR PLL2RDYIE LL_RCC_IsEnabledIT_PLL2RDY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLL2RDY(void) +{ + return (READ_BIT(RCC->CIR, RCC_CIR_PLL2RDYIE) == (RCC_CIR_PLL2RDYIE)); +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup RCC_LL_EF_Init De-initialization function + * @{ + */ +ErrorStatus LL_RCC_DeInit(void); +/** + * @} + */ + +/** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions + * @{ + */ +void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks); +#if defined(RCC_CFGR2_I2S2SRC) +uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource); +#endif /* RCC_CFGR2_I2S2SRC */ +#if defined(USB_OTG_FS) || defined(USB) +uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource); +#endif /* USB_OTG_FS || USB */ +uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* RCC */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_RCC_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h new file mode 100644 index 0000000..f62c1d2 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h @@ -0,0 +1,574 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_system.h + * @author MCD Application Team + * @brief Header file of SYSTEM LL module. + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The LL SYSTEM driver contains a set of generic APIs that can be + used by user: + (+) Some of the FLASH features need to be handled in the SYSTEM file. + (+) Access to DBGCMU registers + (+) Access to SYSCFG registers + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_SYSTEM_H +#define __STM32F1xx_LL_SYSTEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (FLASH) || defined (DBGMCU) + +/** @defgroup SYSTEM_LL SYSTEM + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Private_Constants SYSTEM Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Exported_Constants SYSTEM Exported Constants + * @{ + */ + + + +/** @defgroup SYSTEM_LL_EC_TRACE DBGMCU TRACE Pin Assignment + * @{ + */ +#define LL_DBGMCU_TRACE_NONE 0x00000000U /*!< TRACE pins not assigned (default state) */ +#define LL_DBGMCU_TRACE_ASYNCH DBGMCU_CR_TRACE_IOEN /*!< TRACE pin assignment for Asynchronous Mode */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE1 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_0) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 1 */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE2 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_1) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 2 */ +#define LL_DBGMCU_TRACE_SYNCH_SIZE4 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 4 */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_APB1_GRP1_STOP_IP DBGMCU APB1 GRP1 STOP IP + * @{ + */ +#define LL_DBGMCU_APB1_GRP1_TIM2_STOP DBGMCU_CR_DBG_TIM2_STOP /*!< TIM2 counter stopped when core is halted */ +#define LL_DBGMCU_APB1_GRP1_TIM3_STOP DBGMCU_CR_DBG_TIM3_STOP /*!< TIM3 counter stopped when core is halted */ +#define LL_DBGMCU_APB1_GRP1_TIM4_STOP DBGMCU_CR_DBG_TIM4_STOP /*!< TIM4 counter stopped when core is halted */ +#if defined(DBGMCU_CR_DBG_TIM5_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM5_STOP DBGMCU_CR_DBG_TIM5_STOP /*!< TIM5 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM5_STOP */ +#if defined(DBGMCU_CR_DBG_TIM6_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM6_STOP DBGMCU_CR_DBG_TIM6_STOP /*!< TIM6 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM6_STOP */ +#if defined(DBGMCU_CR_DBG_TIM7_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM7_STOP DBGMCU_CR_DBG_TIM7_STOP /*!< TIM7 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM7_STOP */ +#if defined(DBGMCU_CR_DBG_TIM12_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM12_STOP DBGMCU_CR_DBG_TIM12_STOP /*!< TIM12 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM12_STOP */ +#if defined(DBGMCU_CR_DBG_TIM13_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM13_STOP DBGMCU_CR_DBG_TIM13_STOP /*!< TIM13 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM13_STOP */ +#if defined(DBGMCU_CR_DBG_TIM14_STOP) +#define LL_DBGMCU_APB1_GRP1_TIM14_STOP DBGMCU_CR_DBG_TIM14_STOP /*!< TIM14 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM14_STOP */ +#define LL_DBGMCU_APB1_GRP1_WWDG_STOP DBGMCU_CR_DBG_WWDG_STOP /*!< Debug Window Watchdog stopped when Core is halted */ +#define LL_DBGMCU_APB1_GRP1_IWDG_STOP DBGMCU_CR_DBG_IWDG_STOP /*!< Debug Independent Watchdog stopped when Core is halted */ +#define LL_DBGMCU_APB1_GRP1_I2C1_STOP DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT /*!< I2C1 SMBUS timeout mode stopped when Core is halted */ +#if defined(DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) +#define LL_DBGMCU_APB1_GRP1_I2C2_STOP DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT /*!< I2C2 SMBUS timeout mode stopped when Core is halted */ +#endif /* DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT */ +#if defined(DBGMCU_CR_DBG_CAN1_STOP) +#define LL_DBGMCU_APB1_GRP1_CAN1_STOP DBGMCU_CR_DBG_CAN1_STOP /*!< CAN1 debug stopped when Core is halted */ +#endif /* DBGMCU_CR_DBG_CAN1_STOP */ +#if defined(DBGMCU_CR_DBG_CAN2_STOP) +#define LL_DBGMCU_APB1_GRP1_CAN2_STOP DBGMCU_CR_DBG_CAN2_STOP /*!< CAN2 debug stopped when Core is halted */ +#endif /* DBGMCU_CR_DBG_CAN2_STOP */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_APB2_GRP1_STOP_IP DBGMCU APB2 GRP1 STOP IP + * @{ + */ +#define LL_DBGMCU_APB2_GRP1_TIM1_STOP DBGMCU_CR_DBG_TIM1_STOP /*!< TIM1 counter stopped when core is halted */ +#if defined(DBGMCU_CR_DBG_TIM8_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM8_STOP DBGMCU_CR_DBG_TIM8_STOP /*!< TIM8 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_CAN1_STOP */ +#if defined(DBGMCU_CR_DBG_TIM9_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM9_STOP DBGMCU_CR_DBG_TIM9_STOP /*!< TIM9 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM9_STOP */ +#if defined(DBGMCU_CR_DBG_TIM10_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM10_STOP DBGMCU_CR_DBG_TIM10_STOP /*!< TIM10 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM10_STOP */ +#if defined(DBGMCU_CR_DBG_TIM11_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM11_STOP DBGMCU_CR_DBG_TIM11_STOP /*!< TIM11 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM11_STOP */ +#if defined(DBGMCU_CR_DBG_TIM15_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM15_STOP DBGMCU_CR_DBG_TIM15_STOP /*!< TIM15 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM15_STOP */ +#if defined(DBGMCU_CR_DBG_TIM16_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM16_STOP DBGMCU_CR_DBG_TIM16_STOP /*!< TIM16 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM16_STOP */ +#if defined(DBGMCU_CR_DBG_TIM17_STOP) +#define LL_DBGMCU_APB2_GRP1_TIM17_STOP DBGMCU_CR_DBG_TIM17_STOP /*!< TIM17 counter stopped when core is halted */ +#endif /* DBGMCU_CR_DBG_TIM17_STOP */ +/** + * @} + */ + +/** @defgroup SYSTEM_LL_EC_LATENCY FLASH LATENCY + * @{ + */ +#if defined(FLASH_ACR_LATENCY) +#define LL_FLASH_LATENCY_0 0x00000000U /*!< FLASH Zero Latency cycle */ +#define LL_FLASH_LATENCY_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */ +#define LL_FLASH_LATENCY_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two wait states */ +#else +#endif /* FLASH_ACR_LATENCY */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SYSTEM_LL_Exported_Functions SYSTEM Exported Functions + * @{ + */ + + + +/** @defgroup SYSTEM_LL_EF_DBGMCU DBGMCU + * @{ + */ + +/** + * @brief Return the device identifier + * @note For Low Density devices, the device ID is 0x412 + * @note For Medium Density devices, the device ID is 0x410 + * @note For High Density devices, the device ID is 0x414 + * @note For XL Density devices, the device ID is 0x430 + * @note For Connectivity Line devices, the device ID is 0x418 + * @rmtoll DBGMCU_IDCODE DEV_ID LL_DBGMCU_GetDeviceID + * @retval Values between Min_Data=0x00 and Max_Data=0xFFF + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetDeviceID(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_DEV_ID)); +} + +/** + * @brief Return the device revision identifier + * @note This field indicates the revision of the device. + For example, it is read as revA -> 0x1000,for Low Density devices + For example, it is read as revA -> 0x0000, revB -> 0x2000, revZ -> 0x2001, rev1,2,3,X or Y -> 0x2003,for Medium Density devices + For example, it is read as revA or 1 -> 0x1000, revZ -> 0x1001,rev1,2,3,X or Y -> 0x1003,for Medium Density devices + For example, it is read as revA or 1 -> 0x1003,for XL Density devices + For example, it is read as revA -> 0x1000, revZ -> 0x1001 for Connectivity line devices + * @rmtoll DBGMCU_IDCODE REV_ID LL_DBGMCU_GetRevisionID + * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetRevisionID(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_REV_ID) >> DBGMCU_IDCODE_REV_ID_Pos); +} + +/** + * @brief Enable the Debug Module during SLEEP mode + * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_EnableDBGSleepMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGSleepMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Disable the Debug Module during SLEEP mode + * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_DisableDBGSleepMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGSleepMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Enable the Debug Module during STOP mode + * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_EnableDBGStopMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGStopMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Disable the Debug Module during STOP mode + * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_DisableDBGStopMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGStopMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Enable the Debug Module during STANDBY mode + * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_EnableDBGStandbyMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_EnableDBGStandbyMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Disable the Debug Module during STANDBY mode + * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_DisableDBGStandbyMode + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_DisableDBGStandbyMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Set Trace pin assignment control + * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_SetTracePinAssignment\n + * DBGMCU_CR TRACE_MODE LL_DBGMCU_SetTracePinAssignment + * @param PinAssignment This parameter can be one of the following values: + * @arg @ref LL_DBGMCU_TRACE_NONE + * @arg @ref LL_DBGMCU_TRACE_ASYNCH + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4 + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_SetTracePinAssignment(uint32_t PinAssignment) +{ + MODIFY_REG(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE, PinAssignment); +} + +/** + * @brief Get Trace pin assignment control + * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_GetTracePinAssignment\n + * DBGMCU_CR TRACE_MODE LL_DBGMCU_GetTracePinAssignment + * @retval Returned value can be one of the following values: + * @arg @ref LL_DBGMCU_TRACE_NONE + * @arg @ref LL_DBGMCU_TRACE_ASYNCH + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2 + * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4 + */ +__STATIC_INLINE uint32_t LL_DBGMCU_GetTracePinAssignment(void) +{ + return (uint32_t)(READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE)); +} + +/** + * @brief Freeze APB1 peripherals (group1 peripherals) + * @rmtoll DBGMCU_CR_APB1 DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n + * DBGMCU_CR_APB1 DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB1_GRP1_FreezePeriph(uint32_t Periphs) +{ + SET_BIT(DBGMCU->CR, Periphs); +} + +/** + * @brief Unfreeze APB1 peripherals (group1 peripherals) + * @rmtoll DBGMCU_CR_APB1 DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n + * DBGMCU_CR_APB1 DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP + * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*) + * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB1_GRP1_UnFreezePeriph(uint32_t Periphs) +{ + CLEAR_BIT(DBGMCU->CR, Periphs); +} + +/** + * @brief Freeze APB2 peripherals + * @rmtoll DBGMCU_CR_APB2 DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM15_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM16_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM17_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB2_GRP1_FreezePeriph(uint32_t Periphs) +{ + SET_BIT(DBGMCU->CR, Periphs); +} + +/** + * @brief Unfreeze APB2 peripherals + * @rmtoll DBGMCU_CR_APB2 DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM15_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM16_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n + * DBGMCU_CR_APB2 DBG_TIM17_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph + * @param Periphs This parameter can be a combination of the following values: + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP (*) + * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*) + * + * (*) value not defined in all devices. + * @retval None + */ +__STATIC_INLINE void LL_DBGMCU_APB2_GRP1_UnFreezePeriph(uint32_t Periphs) +{ + CLEAR_BIT(DBGMCU->CR, Periphs); +} +/** + * @} + */ + +#if defined(FLASH_ACR_LATENCY) +/** @defgroup SYSTEM_LL_EF_FLASH FLASH + * @{ + */ + +/** + * @brief Set FLASH Latency + * @rmtoll FLASH_ACR LATENCY LL_FLASH_SetLatency + * @param Latency This parameter can be one of the following values: + * @arg @ref LL_FLASH_LATENCY_0 + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + * @retval None + */ +__STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency) +{ + MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency); +} + +/** + * @brief Get FLASH Latency + * @rmtoll FLASH_ACR LATENCY LL_FLASH_GetLatency + * @retval Returned value can be one of the following values: + * @arg @ref LL_FLASH_LATENCY_0 + * @arg @ref LL_FLASH_LATENCY_1 + * @arg @ref LL_FLASH_LATENCY_2 + */ +__STATIC_INLINE uint32_t LL_FLASH_GetLatency(void) +{ + return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY)); +} + +/** + * @brief Enable Prefetch + * @rmtoll FLASH_ACR PRFTBE LL_FLASH_EnablePrefetch + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnablePrefetch(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_PRFTBE); +} + +/** + * @brief Disable Prefetch + * @rmtoll FLASH_ACR PRFTBE LL_FLASH_DisablePrefetch + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisablePrefetch(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_PRFTBE); +} + +/** + * @brief Check if Prefetch buffer is enabled + * @rmtoll FLASH_ACR PRFTBS LL_FLASH_IsPrefetchEnabled + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_FLASH_IsPrefetchEnabled(void) +{ + return (READ_BIT(FLASH->ACR, FLASH_ACR_PRFTBS) == (FLASH_ACR_PRFTBS)); +} + +#endif /* FLASH_ACR_LATENCY */ +/** + * @brief Enable Flash Half Cycle Access + * @rmtoll FLASH_ACR HLFCYA LL_FLASH_EnableHalfCycleAccess + * @retval None + */ +__STATIC_INLINE void LL_FLASH_EnableHalfCycleAccess(void) +{ + SET_BIT(FLASH->ACR, FLASH_ACR_HLFCYA); +} + +/** + * @brief Disable Flash Half Cycle Access + * @rmtoll FLASH_ACR HLFCYA LL_FLASH_DisableHalfCycleAccess + * @retval None + */ +__STATIC_INLINE void LL_FLASH_DisableHalfCycleAccess(void) +{ + CLEAR_BIT(FLASH->ACR, FLASH_ACR_HLFCYA); +} + +/** + * @brief Check if Flash Half Cycle Access is enabled or not + * @rmtoll FLASH_ACR HLFCYA LL_FLASH_IsHalfCycleAccessEnabled + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_FLASH_IsHalfCycleAccessEnabled(void) +{ + return (READ_BIT(FLASH->ACR, FLASH_ACR_HLFCYA) == (FLASH_ACR_HLFCYA)); +} + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (FLASH) || defined (DBGMCU) */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_SYSTEM_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h new file mode 100644 index 0000000..8f8346d --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_tim.h @@ -0,0 +1,3904 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_tim.h + * @author MCD Application Team + * @brief Header file of TIM LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_TIM_H +#define __STM32F1xx_LL_TIM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) || defined (TIM15) || defined (TIM16) || defined (TIM17) + +/** @defgroup TIM_LL TIM + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Variables TIM Private Variables + * @{ + */ +static const uint8_t OFFSET_TAB_CCMRx[] = +{ + 0x00U, /* 0: TIMx_CH1 */ + 0x00U, /* 1: TIMx_CH1N */ + 0x00U, /* 2: TIMx_CH2 */ + 0x00U, /* 3: TIMx_CH2N */ + 0x04U, /* 4: TIMx_CH3 */ + 0x04U, /* 5: TIMx_CH3N */ + 0x04U /* 6: TIMx_CH4 */ +}; + +static const uint8_t SHIFT_TAB_OCxx[] = +{ + 0U, /* 0: OC1M, OC1FE, OC1PE */ + 0U, /* 1: - NA */ + 8U, /* 2: OC2M, OC2FE, OC2PE */ + 0U, /* 3: - NA */ + 0U, /* 4: OC3M, OC3FE, OC3PE */ + 0U, /* 5: - NA */ + 8U /* 6: OC4M, OC4FE, OC4PE */ +}; + +static const uint8_t SHIFT_TAB_ICxx[] = +{ + 0U, /* 0: CC1S, IC1PSC, IC1F */ + 0U, /* 1: - NA */ + 8U, /* 2: CC2S, IC2PSC, IC2F */ + 0U, /* 3: - NA */ + 0U, /* 4: CC3S, IC3PSC, IC3F */ + 0U, /* 5: - NA */ + 8U /* 6: CC4S, IC4PSC, IC4F */ +}; + +static const uint8_t SHIFT_TAB_CCxP[] = +{ + 0U, /* 0: CC1P */ + 2U, /* 1: CC1NP */ + 4U, /* 2: CC2P */ + 6U, /* 3: CC2NP */ + 8U, /* 4: CC3P */ + 10U, /* 5: CC3NP */ + 12U /* 6: CC4P */ +}; + +static const uint8_t SHIFT_TAB_OISx[] = +{ + 0U, /* 0: OIS1 */ + 1U, /* 1: OIS1N */ + 2U, /* 2: OIS2 */ + 3U, /* 3: OIS2N */ + 4U, /* 4: OIS3 */ + 5U, /* 5: OIS3N */ + 6U /* 6: OIS4 */ +}; +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Constants TIM Private Constants + * @{ + */ + + + +/* Mask used to set the TDG[x:0] of the DTG bits of the TIMx_BDTR register */ +#define DT_DELAY_1 ((uint8_t)0x7F) +#define DT_DELAY_2 ((uint8_t)0x3F) +#define DT_DELAY_3 ((uint8_t)0x1F) +#define DT_DELAY_4 ((uint8_t)0x1F) + +/* Mask used to set the DTG[7:5] bits of the DTG bits of the TIMx_BDTR register */ +#define DT_RANGE_1 ((uint8_t)0x00) +#define DT_RANGE_2 ((uint8_t)0x80) +#define DT_RANGE_3 ((uint8_t)0xC0) +#define DT_RANGE_4 ((uint8_t)0xE0) + + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup TIM_LL_Private_Macros TIM Private Macros + * @{ + */ +/** @brief Convert channel id into channel index. + * @param __CHANNEL__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval none + */ +#define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \ + (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\ + ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U) + +/** @brief Calculate the deadtime sampling period(in ps). + * @param __TIMCLK__ timer input clock frequency (in Hz). + * @param __CKD__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @retval none + */ +#define TIM_CALC_DTS(__TIMCLK__, __CKD__) \ + (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \ + ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \ + ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U))) +/** + * @} + */ + + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_ES_INIT TIM Exported Init structure + * @{ + */ + +/** + * @brief TIM Time Base configuration structure definition. + */ +typedef struct +{ + uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. + This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetPrescaler().*/ + + uint32_t CounterMode; /*!< Specifies the counter mode. + This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetCounterMode().*/ + + uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + Some timer instances may support 32 bits counters. In that case this parameter must + be a number between 0x0000 and 0xFFFFFFFF. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetAutoReload().*/ + + uint32_t ClockDivision; /*!< Specifies the clock division. + This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetClockDivision().*/ + + uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter + reaches zero, an update event is generated and counting restarts + from the RCR value (N). + This means in PWM mode that (N+1) corresponds to: + - the number of PWM periods in edge-aligned mode + - the number of half PWM period in center-aligned mode + GP timers: this parameter must be a number between Min_Data = 0x00 and + Max_Data = 0xFF. + Advanced timers: this parameter must be a number between Min_Data = 0x0000 and + Max_Data = 0xFFFF. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetRepetitionCounter().*/ +} LL_TIM_InitTypeDef; + +/** + * @brief TIM Output Compare configuration structure definition. + */ +typedef struct +{ + uint32_t OCMode; /*!< Specifies the output mode. + This parameter can be a value of @ref TIM_LL_EC_OCMODE. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetMode().*/ + + uint32_t OCState; /*!< Specifies the TIM Output Compare state. + This parameter can be a value of @ref TIM_LL_EC_OCSTATE. + + This feature can be modified afterwards using unitary functions + @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ + + uint32_t OCNState; /*!< Specifies the TIM complementary Output Compare state. + This parameter can be a value of @ref TIM_LL_EC_OCSTATE. + + This feature can be modified afterwards using unitary functions + @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ + + uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register. + This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. + + This feature can be modified afterwards using unitary function + LL_TIM_OC_SetCompareCHx (x=1..6).*/ + + uint32_t OCPolarity; /*!< Specifies the output polarity. + This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetPolarity().*/ + + uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. + This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetPolarity().*/ + + + uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetIdleState().*/ + + uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. + This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetIdleState().*/ +} LL_TIM_OC_InitTypeDef; + +/** + * @brief TIM Input Capture configuration structure definition. + */ + +typedef struct +{ + + uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t ICActiveInput; /*!< Specifies the input. + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t ICFilter; /*!< Specifies the input capture filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetFilter().*/ +} LL_TIM_IC_InitTypeDef; + + +/** + * @brief TIM Encoder interface configuration structure definition. + */ +typedef struct +{ + uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4). + This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetEncoderMode().*/ + + uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC1Filter; /*!< Specifies the TI1 input filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetFilter().*/ + + uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source + This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetActiveInput().*/ + + uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC2Filter; /*!< Specifies the TI2 input filter. + This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetFilter().*/ + +} LL_TIM_ENCODER_InitTypeDef; + +/** + * @brief TIM Hall sensor interface configuration structure definition. + */ +typedef struct +{ + + uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. + This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPolarity().*/ + + uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. + Prescaler must be set to get a maximum counter period longer than the + time interval between 2 consecutive changes on the Hall inputs. + This parameter can be a value of @ref TIM_LL_EC_ICPSC. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetPrescaler().*/ + + uint32_t IC1Filter; /*!< Specifies the TI1 input filter. + This parameter can be a value of + @ref TIM_LL_EC_IC_FILTER. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_IC_SetFilter().*/ + + uint32_t CommutationDelay; /*!< Specifies the compare value to be loaded into the Capture Compare Register. + A positive pulse (TRGO event) is generated with a programmable delay every time + a change occurs on the Hall inputs. + This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetCompareCH2().*/ +} LL_TIM_HALLSENSOR_InitTypeDef; + +/** + * @brief BDTR (Break and Dead Time) structure definition + */ +typedef struct +{ + uint32_t OSSRState; /*!< Specifies the Off-State selection used in Run mode. + This parameter can be a value of @ref TIM_LL_EC_OSSR + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetOffStates() + + @note This bit-field cannot be modified as long as LOCK level 2 has been + programmed. */ + + uint32_t OSSIState; /*!< Specifies the Off-State used in Idle state. + This parameter can be a value of @ref TIM_LL_EC_OSSI + + This feature can be modified afterwards using unitary function + @ref LL_TIM_SetOffStates() + + @note This bit-field cannot be modified as long as LOCK level 2 has been + programmed. */ + + uint32_t LockLevel; /*!< Specifies the LOCK level parameters. + This parameter can be a value of @ref TIM_LL_EC_LOCKLEVEL + + @note The LOCK bits can be written only once after the reset. Once the TIMx_BDTR + register has been written, their content is frozen until the next reset.*/ + + uint8_t DeadTime; /*!< Specifies the delay time between the switching-off and the + switching-on of the outputs. + This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF. + + This feature can be modified afterwards using unitary function + @ref LL_TIM_OC_SetDeadTime() + + @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been + programmed. */ + + uint16_t BreakState; /*!< Specifies whether the TIM Break input is enabled or not. + This parameter can be a value of @ref TIM_LL_EC_BREAK_ENABLE + + This feature can be modified afterwards using unitary functions + @ref LL_TIM_EnableBRK() or @ref LL_TIM_DisableBRK() + + @note This bit-field can not be modified as long as LOCK level 1 has been + programmed. */ + + uint32_t BreakPolarity; /*!< Specifies the TIM Break Input pin polarity. + This parameter can be a value of @ref TIM_LL_EC_BREAK_POLARITY + + This feature can be modified afterwards using unitary function + @ref LL_TIM_ConfigBRK() + + @note This bit-field can not be modified as long as LOCK level 1 has been + programmed. */ + + uint32_t AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not. + This parameter can be a value of @ref TIM_LL_EC_AUTOMATICOUTPUT_ENABLE + + This feature can be modified afterwards using unitary functions + @ref LL_TIM_EnableAutomaticOutput() or @ref LL_TIM_DisableAutomaticOutput() + + @note This bit-field can not be modified as long as LOCK level 1 has been + programmed. */ +} LL_TIM_BDTR_InitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIM_LL_Exported_Constants TIM Exported Constants + * @{ + */ + +/** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_TIM_ReadReg function. + * @{ + */ +#define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */ +#define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */ +#define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */ +#define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */ +#define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */ +#define LL_TIM_SR_COMIF TIM_SR_COMIF /*!< COM interrupt flag */ +#define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */ +#define LL_TIM_SR_BIF TIM_SR_BIF /*!< Break interrupt flag */ +#define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */ +#define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */ +#define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */ +#define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_EC_BREAK_ENABLE Break Enable + * @{ + */ +#define LL_TIM_BREAK_DISABLE 0x00000000U /*!< Break function disabled */ +#define LL_TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break function enabled */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_AUTOMATICOUTPUT_ENABLE Automatic output enable + * @{ + */ +#define LL_TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */ +#define LL_TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event */ +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** @defgroup TIM_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions. + * @{ + */ +#define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */ +#define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */ +#define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */ +#define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */ +#define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */ +#define LL_TIM_DIER_COMIE TIM_DIER_COMIE /*!< COM interrupt enable */ +#define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */ +#define LL_TIM_DIER_BIE TIM_DIER_BIE /*!< Break interrupt enable */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_UPDATESOURCE Update Source + * @{ + */ +#define LL_TIM_UPDATESOURCE_REGULAR 0x00000000U /*!< Counter overflow/underflow, Setting the UG bit or Update generation through the slave mode controller generates an update request */ +#define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode + * @{ + */ +#define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */ +#define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode + * @{ + */ +#define LL_TIM_COUNTERMODE_UP 0x00000000U /*!TIMx_CCRy else active.*/ +#define LL_TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!TIMx_CCRy else inactive*/ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity + * @{ + */ +#define LL_TIM_OCPOLARITY_HIGH 0x00000000U /*!< OCxactive high*/ +#define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/ +/** + * @} + */ + +/** @defgroup TIM_LL_EC_OCIDLESTATE Output Configuration Idle State + * @{ + */ +#define LL_TIM_OCIDLESTATE_LOW 0x00000000U /*!__REG__, (__VALUE__)) + +/** + * @brief Read a value in TIM register. + * @param __INSTANCE__ TIM Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__) +/** + * @} + */ + +/** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros + * @{ + */ + +/** + * @brief HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration. + * @note ex: @ref __LL_TIM_CALC_DEADTIME (80000000, @ref LL_TIM_GetClockDivision (), 120); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __CKD__ This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @param __DT__ deadtime duration (in ns) + * @retval DTG[0:7] + */ +#define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \ + ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ + (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \ + (((uint64_t)((__DT__)*1000U)) < ((64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ + (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ + (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\ + (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ + (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ + (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\ + (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ + (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ + (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\ + 0U) + +/** + * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. + * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __CNTCLK__ counter clock frequency (in Hz) + * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ + (((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)(((__TIMCLK__)/(__CNTCLK__)) - 1U) : 0U) + +/** + * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. + * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __FREQ__ output signal frequency (in Hz) + * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ + ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) + +/** + * @brief HELPER macro calculating the compare value required to achieve the required timer output compare + * active/inactive delay. + * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __DELAY__ timer output compare active/inactive delay (in us) + * @retval Compare value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ + ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ + / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) + +/** + * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration + * (when the timer operates in one pulse mode). + * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); + * @param __TIMCLK__ timer input clock frequency (in Hz) + * @param __PSC__ prescaler + * @param __DELAY__ timer output compare active/inactive delay (in us) + * @param __PULSE__ pulse duration (in us) + * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) + */ +#define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ + ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \ + + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__)))) + +/** + * @brief HELPER macro retrieving the ratio of the input capture prescaler + * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ()); + * @param __ICPSC__ This parameter can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + * @retval Input capture prescaler ratio (1, 2, 4 or 8) + */ +#define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \ + ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos))) + + +/** + * @} + */ + + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup TIM_LL_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @defgroup TIM_LL_EF_Time_Base Time Base configuration + * @{ + */ +/** + * @brief Enable timer counter. + * @rmtoll CR1 CEN LL_TIM_EnableCounter + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_CEN); +} + +/** + * @brief Disable timer counter. + * @rmtoll CR1 CEN LL_TIM_DisableCounter + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN); +} + +/** + * @brief Indicates whether the timer counter is enabled. + * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL); +} + +/** + * @brief Enable update event generation. + * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS); +} + +/** + * @brief Disable update event generation. + * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_UDIS); +} + +/** + * @brief Indicates whether update event generation is enabled. + * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent + * @param TIMx Timer instance + * @retval Inverted state of bit (0 or 1). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (uint32_t)RESET) ? 1UL : 0UL); +} + +/** + * @brief Set update event source + * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events + * generate an update interrupt or DMA request if enabled: + * - Counter overflow/underflow + * - Setting the UG bit + * - Update generation through the slave mode controller + * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter + * overflow/underflow generates an update interrupt or DMA request if enabled. + * @rmtoll CR1 URS LL_TIM_SetUpdateSource + * @param TIMx Timer instance + * @param UpdateSource This parameter can be one of the following values: + * @arg @ref LL_TIM_UPDATESOURCE_REGULAR + * @arg @ref LL_TIM_UPDATESOURCE_COUNTER + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource); +} + +/** + * @brief Get actual event update source + * @rmtoll CR1 URS LL_TIM_GetUpdateSource + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_UPDATESOURCE_REGULAR + * @arg @ref LL_TIM_UPDATESOURCE_COUNTER + */ +__STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS)); +} + +/** + * @brief Set one pulse mode (one shot v.s. repetitive). + * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode + * @param TIMx Timer instance + * @param OnePulseMode This parameter can be one of the following values: + * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE + * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode); +} + +/** + * @brief Get actual one pulse mode. + * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE + * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE + */ +__STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM)); +} + +/** + * @brief Set the timer counter counting mode. + * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to + * check whether or not the counter mode selection feature is supported + * by a timer instance. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n + * CR1 CMS LL_TIM_SetCounterMode + * @param TIMx Timer instance + * @param CounterMode This parameter can be one of the following values: + * @arg @ref LL_TIM_COUNTERMODE_UP + * @arg @ref LL_TIM_COUNTERMODE_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP + * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode) +{ + MODIFY_REG(TIMx->CR1, (TIM_CR1_DIR | TIM_CR1_CMS), CounterMode); +} + +/** + * @brief Get actual counter mode. + * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to + * check whether or not the counter mode selection feature is supported + * by a timer instance. + * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n + * CR1 CMS LL_TIM_GetCounterMode + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_COUNTERMODE_UP + * @arg @ref LL_TIM_COUNTERMODE_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP + * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN + * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN + */ +__STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx) +{ + uint32_t counter_mode; + + counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CMS)); + + if (counter_mode == 0U) + { + counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); + } + + return counter_mode; +} + +/** + * @brief Enable auto-reload (ARR) preload. + * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR1, TIM_CR1_ARPE); +} + +/** + * @brief Disable auto-reload (ARR) preload. + * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE); +} + +/** + * @brief Indicates whether auto-reload (ARR) preload is enabled. + * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); +} + +/** + * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators + * (when supported) and the digital filters. + * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check + * whether or not the clock division feature is supported by the timer + * instance. + * @rmtoll CR1 CKD LL_TIM_SetClockDivision + * @param TIMx Timer instance + * @param ClockDivision This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision) +{ + MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); +} + +/** + * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time + * generators (when supported) and the digital filters. + * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check + * whether or not the clock division feature is supported by the timer + * instance. + * @rmtoll CR1 CKD LL_TIM_GetClockDivision + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 + * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 + */ +__STATIC_INLINE uint32_t LL_TIM_GetClockDivision(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD)); +} + +/** + * @brief Set the counter value. + * @rmtoll CNT CNT LL_TIM_SetCounter + * @param TIMx Timer instance + * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF) + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter) +{ + WRITE_REG(TIMx->CNT, Counter); +} + +/** + * @brief Get the counter value. + * @rmtoll CNT CNT LL_TIM_GetCounter + * @param TIMx Timer instance + * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF) + */ +__STATIC_INLINE uint32_t LL_TIM_GetCounter(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CNT)); +} + +/** + * @brief Get the current direction of the counter + * @rmtoll CR1 DIR LL_TIM_GetDirection + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_COUNTERDIRECTION_UP + * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN + */ +__STATIC_INLINE uint32_t LL_TIM_GetDirection(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); +} + +/** + * @brief Set the prescaler value. + * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1). + * @note The prescaler can be changed on the fly as this control register is buffered. The new + * prescaler ratio is taken into account at the next update event. + * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter + * @rmtoll PSC PSC LL_TIM_SetPrescaler + * @param TIMx Timer instance + * @param Prescaler between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler) +{ + WRITE_REG(TIMx->PSC, Prescaler); +} + +/** + * @brief Get the prescaler value. + * @rmtoll PSC PSC LL_TIM_GetPrescaler + * @param TIMx Timer instance + * @retval Prescaler value between Min_Data=0 and Max_Data=65535 + */ +__STATIC_INLINE uint32_t LL_TIM_GetPrescaler(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->PSC)); +} + +/** + * @brief Set the auto-reload value. + * @note The counter is blocked while the auto-reload value is null. + * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter + * @rmtoll ARR ARR LL_TIM_SetAutoReload + * @param TIMx Timer instance + * @param AutoReload between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload) +{ + WRITE_REG(TIMx->ARR, AutoReload); +} + +/** + * @brief Get the auto-reload value. + * @rmtoll ARR ARR LL_TIM_GetAutoReload + * @param TIMx Timer instance + * @retval Auto-reload value + */ +__STATIC_INLINE uint32_t LL_TIM_GetAutoReload(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->ARR)); +} + +/** + * @brief Set the repetition counter value. + * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a repetition counter. + * @rmtoll RCR REP LL_TIM_SetRepetitionCounter + * @param TIMx Timer instance + * @param RepetitionCounter between Min_Data=0 and Max_Data=255 or 65535 for advanced timer. + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter) +{ + WRITE_REG(TIMx->RCR, RepetitionCounter); +} + +/** + * @brief Get the repetition counter value. + * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports a repetition counter. + * @rmtoll RCR REP LL_TIM_GetRepetitionCounter + * @param TIMx Timer instance + * @retval Repetition counter value + */ +__STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->RCR)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration + * @{ + */ +/** + * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. + * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written, + * they are updated only when a commutation event (COM) occurs. + * @note Only on channels that have a complementary output. + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_EnablePreload(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR2, TIM_CR2_CCPC); +} + +/** + * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_DisablePreload(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC); +} + +/** + * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM). + * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check + * whether or not a timer instance is able to generate a commutation event. + * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate + * @param TIMx Timer instance + * @param CCUpdateSource This parameter can be one of the following values: + * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY + * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetUpdate(TIM_TypeDef *TIMx, uint32_t CCUpdateSource) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_CCUS, CCUpdateSource); +} + +/** + * @brief Set the trigger of the capture/compare DMA request. + * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger + * @param TIMx Timer instance + * @param DMAReqTrigger This parameter can be one of the following values: + * @arg @ref LL_TIM_CCDMAREQUEST_CC + * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger); +} + +/** + * @brief Get actual trigger of the capture/compare DMA request. + * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger + * @param TIMx Timer instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_CCDMAREQUEST_CC + * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE + */ +__STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS)); +} + +/** + * @brief Set the lock level to freeze the + * configuration of several capture/compare parameters. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * the lock mechanism is supported by a timer instance. + * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel + * @param TIMx Timer instance + * @param LockLevel This parameter can be one of the following values: + * @arg @ref LL_TIM_LOCKLEVEL_OFF + * @arg @ref LL_TIM_LOCKLEVEL_1 + * @arg @ref LL_TIM_LOCKLEVEL_2 + * @arg @ref LL_TIM_LOCKLEVEL_3 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_SetLockLevel(TIM_TypeDef *TIMx, uint32_t LockLevel) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_LOCK, LockLevel); +} + +/** + * @brief Enable capture/compare channels. + * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n + * CCER CC1NE LL_TIM_CC_EnableChannel\n + * CCER CC2E LL_TIM_CC_EnableChannel\n + * CCER CC2NE LL_TIM_CC_EnableChannel\n + * CCER CC3E LL_TIM_CC_EnableChannel\n + * CCER CC3NE LL_TIM_CC_EnableChannel\n + * CCER CC4E LL_TIM_CC_EnableChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + SET_BIT(TIMx->CCER, Channels); +} + +/** + * @brief Disable capture/compare channels. + * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n + * CCER CC1NE LL_TIM_CC_DisableChannel\n + * CCER CC2E LL_TIM_CC_DisableChannel\n + * CCER CC2NE LL_TIM_CC_DisableChannel\n + * CCER CC3E LL_TIM_CC_DisableChannel\n + * CCER CC3NE LL_TIM_CC_DisableChannel\n + * CCER CC4E LL_TIM_CC_DisableChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + CLEAR_BIT(TIMx->CCER, Channels); +} + +/** + * @brief Indicate whether channel(s) is(are) enabled. + * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n + * CCER CC1NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC2E LL_TIM_CC_IsEnabledChannel\n + * CCER CC2NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC3E LL_TIM_CC_IsEnabledChannel\n + * CCER CC3NE LL_TIM_CC_IsEnabledChannel\n + * CCER CC4E LL_TIM_CC_IsEnabledChannel + * @param TIMx Timer instance + * @param Channels This parameter can be a combination of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels) +{ + return ((READ_BIT(TIMx->CCER, Channels) == (Channels)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Output_Channel Output channel configuration + * @{ + */ +/** + * @brief Configure an output channel. + * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n + * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n + * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n + * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n + * CCER CC1P LL_TIM_OC_ConfigOutput\n + * CCER CC2P LL_TIM_OC_ConfigOutput\n + * CCER CC3P LL_TIM_OC_ConfigOutput\n + * CCER CC4P LL_TIM_OC_ConfigOutput\n + * CR2 OIS1 LL_TIM_OC_ConfigOutput\n + * CR2 OIS2 LL_TIM_OC_ConfigOutput\n + * CR2 OIS3 LL_TIM_OC_ConfigOutput\n + * CR2 OIS4 LL_TIM_OC_ConfigOutput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW + * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); + MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), + (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); + MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), + (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Define the behavior of the output reference signal OCxREF from which + * OCx and OCxN (when relevant) are derived. + * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n + * CCMR1 OC2M LL_TIM_OC_SetMode\n + * CCMR2 OC3M LL_TIM_OC_SetMode\n + * CCMR2 OC4M LL_TIM_OC_SetMode + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Mode This parameter can be one of the following values: + * @arg @ref LL_TIM_OCMODE_FROZEN + * @arg @ref LL_TIM_OCMODE_ACTIVE + * @arg @ref LL_TIM_OCMODE_INACTIVE + * @arg @ref LL_TIM_OCMODE_TOGGLE + * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE + * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE + * @arg @ref LL_TIM_OCMODE_PWM1 + * @arg @ref LL_TIM_OCMODE_PWM2 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); +} + +/** + * @brief Get the output compare mode of an output channel. + * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n + * CCMR1 OC2M LL_TIM_OC_GetMode\n + * CCMR2 OC3M LL_TIM_OC_GetMode\n + * CCMR2 OC4M LL_TIM_OC_GetMode + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCMODE_FROZEN + * @arg @ref LL_TIM_OCMODE_ACTIVE + * @arg @ref LL_TIM_OCMODE_INACTIVE + * @arg @ref LL_TIM_OCMODE_TOGGLE + * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE + * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE + * @arg @ref LL_TIM_OCMODE_PWM1 + * @arg @ref LL_TIM_OCMODE_PWM2 + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); +} + +/** + * @brief Set the polarity of an output channel. + * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n + * CCER CC1NP LL_TIM_OC_SetPolarity\n + * CCER CC2P LL_TIM_OC_SetPolarity\n + * CCER CC2NP LL_TIM_OC_SetPolarity\n + * CCER CC3P LL_TIM_OC_SetPolarity\n + * CCER CC3NP LL_TIM_OC_SetPolarity\n + * CCER CC4P LL_TIM_OC_SetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Polarity This parameter can be one of the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH + * @arg @ref LL_TIM_OCPOLARITY_LOW + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Get the polarity of an output channel. + * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n + * CCER CC1NP LL_TIM_OC_GetPolarity\n + * CCER CC2P LL_TIM_OC_GetPolarity\n + * CCER CC2NP LL_TIM_OC_GetPolarity\n + * CCER CC3P LL_TIM_OC_GetPolarity\n + * CCER CC3NP LL_TIM_OC_GetPolarity\n + * CCER CC4P LL_TIM_OC_GetPolarity + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCPOLARITY_HIGH + * @arg @ref LL_TIM_OCPOLARITY_LOW + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Set the IDLE state of an output channel + * @note This function is significant only for the timer instances + * supporting the break feature. Macro IS_TIM_BREAK_INSTANCE(TIMx) + * can be used to check whether or not a timer instance provides + * a break input. + * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n + * CR2 OIS1N LL_TIM_OC_SetIdleState\n + * CR2 OIS2 LL_TIM_OC_SetIdleState\n + * CR2 OIS2N LL_TIM_OC_SetIdleState\n + * CR2 OIS3 LL_TIM_OC_SetIdleState\n + * CR2 OIS3N LL_TIM_OC_SetIdleState\n + * CR2 OIS4 LL_TIM_OC_SetIdleState + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param IdleState This parameter can be one of the following values: + * @arg @ref LL_TIM_OCIDLESTATE_LOW + * @arg @ref LL_TIM_OCIDLESTATE_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Get the IDLE state of an output channel + * @rmtoll CR2 OIS1 LL_TIM_OC_GetIdleState\n + * CR2 OIS1N LL_TIM_OC_GetIdleState\n + * CR2 OIS2 LL_TIM_OC_GetIdleState\n + * CR2 OIS2N LL_TIM_OC_GetIdleState\n + * CR2 OIS3 LL_TIM_OC_GetIdleState\n + * CR2 OIS3N LL_TIM_OC_GetIdleState\n + * CR2 OIS4 LL_TIM_OC_GetIdleState + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH1N + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH2N + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH3N + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_OCIDLESTATE_LOW + * @arg @ref LL_TIM_OCIDLESTATE_HIGH + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]); +} + +/** + * @brief Enable fast mode for the output channel. + * @note Acts only if the channel is configured in PWM1 or PWM2 mode. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n + * CCMR1 OC2FE LL_TIM_OC_EnableFast\n + * CCMR2 OC3FE LL_TIM_OC_EnableFast\n + * CCMR2 OC4FE LL_TIM_OC_EnableFast + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); + +} + +/** + * @brief Disable fast mode for the output channel. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n + * CCMR1 OC2FE LL_TIM_OC_DisableFast\n + * CCMR2 OC3FE LL_TIM_OC_DisableFast\n + * CCMR2 OC4FE LL_TIM_OC_DisableFast + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); + +} + +/** + * @brief Indicates whether fast mode is enabled for the output channel. + * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n + * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n + * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n + * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Enable compare register (TIMx_CCRx) preload for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n + * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n + * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n + * CCMR2 OC4PE LL_TIM_OC_EnablePreload + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Disable compare register (TIMx_CCRx) preload for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n + * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n + * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n + * CCMR2 OC4PE LL_TIM_OC_DisablePreload + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. + * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n + * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n + * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n + * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Enable clearing the output channel on an external event. + * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n + * CCMR1 OC2CE LL_TIM_OC_EnableClear\n + * CCMR2 OC3CE LL_TIM_OC_EnableClear\n + * CCMR2 OC4CE LL_TIM_OC_EnableClear + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Disable clearing the output channel on an external event. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n + * CCMR1 OC2CE LL_TIM_OC_DisableClear\n + * CCMR2 OC3CE LL_TIM_OC_DisableClear\n + * CCMR2 OC4CE LL_TIM_OC_DisableClear + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); +} + +/** + * @brief Indicates clearing the output channel on an external event is enabled for the output channel. + * @note This function enables clearing the output channel on an external event. + * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. + * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether + * or not a timer instance can clear the OCxREF signal on an external event. + * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n + * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n + * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n + * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; + return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); +} + +/** + * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge of + * the Ocx and OCxN signals). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * dead-time insertion feature is supported by a timer instance. + * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter + * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime + * @param TIMx Timer instance + * @param DeadTime between Min_Data=0 and Max_Data=255 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime); +} + +/** + * @brief Set compare value for output channel 1 (TIMx_CCR1). + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * output channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR1, CompareValue); +} + +/** + * @brief Set compare value for output channel 2 (TIMx_CCR2). + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * output channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR2, CompareValue); +} + +/** + * @brief Set compare value for output channel 3 (TIMx_CCR3). + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * output channel is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR3, CompareValue); +} + +/** + * @brief Set compare value for output channel 4 (TIMx_CCR4). + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * output channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4 + * @param TIMx Timer instance + * @param CompareValue between Min_Data=0 and Max_Data=65535 + * @retval None + */ +__STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue) +{ + WRITE_REG(TIMx->CCR4, CompareValue); +} + +/** + * @brief Get compare value (TIMx_CCR1) set for output channel 1. + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * output channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR1)); +} + +/** + * @brief Get compare value (TIMx_CCR2) set for output channel 2. + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * output channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR2)); +} + +/** + * @brief Get compare value (TIMx_CCR3) set for output channel 3. + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * output channel 3 is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR3)); +} + +/** + * @brief Get compare value (TIMx_CCR4) set for output channel 4. + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * output channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4 + * @param TIMx Timer instance + * @retval CompareValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR4)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Input_Channel Input channel configuration + * @{ + */ +/** + * @brief Configure input channel. + * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n + * CCMR1 IC1PSC LL_TIM_IC_Config\n + * CCMR1 IC1F LL_TIM_IC_Config\n + * CCMR1 CC2S LL_TIM_IC_Config\n + * CCMR1 IC2PSC LL_TIM_IC_Config\n + * CCMR1 IC2F LL_TIM_IC_Config\n + * CCMR2 CC3S LL_TIM_IC_Config\n + * CCMR2 IC3PSC LL_TIM_IC_Config\n + * CCMR2 IC3F LL_TIM_IC_Config\n + * CCMR2 CC4S LL_TIM_IC_Config\n + * CCMR2 IC4PSC LL_TIM_IC_Config\n + * CCMR2 IC4F LL_TIM_IC_Config\n + * CCER CC1P LL_TIM_IC_Config\n + * CCER CC1NP LL_TIM_IC_Config\n + * CCER CC2P LL_TIM_IC_Config\n + * CCER CC2NP LL_TIM_IC_Config\n + * CCER CC3P LL_TIM_IC_Config\n + * CCER CC3NP LL_TIM_IC_Config\n + * CCER CC4P LL_TIM_IC_Config\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param Configuration This parameter must be a combination of all the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC + * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8 + * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8 + * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), + ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) \ + << SHIFT_TAB_ICxx[iChannel]); + MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), + (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Set the active input. + * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n + * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n + * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n + * CCMR2 CC4S LL_TIM_IC_SetActiveInput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICActiveInput This parameter can be one of the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_TRC + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the current active input. + * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n + * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n + * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n + * CCMR2 CC4S LL_TIM_IC_GetActiveInput + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI + * @arg @ref LL_TIM_ACTIVEINPUT_TRC + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the prescaler of input channel. + * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n + * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n + * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n + * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICPrescaler This parameter can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the current prescaler value acting on an input channel. + * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n + * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n + * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n + * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_ICPSC_DIV1 + * @arg @ref LL_TIM_ICPSC_DIV2 + * @arg @ref LL_TIM_ICPSC_DIV4 + * @arg @ref LL_TIM_ICPSC_DIV8 + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the input filter duration. + * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n + * CCMR1 IC2F LL_TIM_IC_SetFilter\n + * CCMR2 IC3F LL_TIM_IC_SetFilter\n + * CCMR2 IC4F LL_TIM_IC_SetFilter + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICFilter This parameter can be one of the following values: + * @arg @ref LL_TIM_IC_FILTER_FDIV1 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); +} + +/** + * @brief Get the input filter duration. + * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n + * CCMR1 IC2F LL_TIM_IC_GetFilter\n + * CCMR2 IC3F LL_TIM_IC_GetFilter\n + * CCMR2 IC4F LL_TIM_IC_GetFilter + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_IC_FILTER_FDIV1 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); + return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); +} + +/** + * @brief Set the input channel polarity. + * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n + * CCER CC1NP LL_TIM_IC_SetPolarity\n + * CCER CC2P LL_TIM_IC_SetPolarity\n + * CCER CC2NP LL_TIM_IC_SetPolarity\n + * CCER CC3P LL_TIM_IC_SetPolarity\n + * CCER CC3NP LL_TIM_IC_SetPolarity\n + * CCER CC4P LL_TIM_IC_SetPolarity\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param ICPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_IC_POLARITY_RISING + * @arg @ref LL_TIM_IC_POLARITY_FALLING + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), + ICPolarity << SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Get the current input channel polarity. + * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n + * CCER CC1NP LL_TIM_IC_GetPolarity\n + * CCER CC2P LL_TIM_IC_GetPolarity\n + * CCER CC2NP LL_TIM_IC_GetPolarity\n + * CCER CC3P LL_TIM_IC_GetPolarity\n + * CCER CC3NP LL_TIM_IC_GetPolarity\n + * CCER CC4P LL_TIM_IC_GetPolarity\n + * @param TIMx Timer instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_TIM_IC_POLARITY_RISING + * @arg @ref LL_TIM_IC_POLARITY_FALLING + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) +{ + uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); + return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> + SHIFT_TAB_CCxP[iChannel]); +} + +/** + * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination). + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->CR2, TIM_CR2_TI1S); +} + +/** + * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input. + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S); +} + +/** + * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input. + * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an XOR input. + * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)) ? 1UL : 0UL); +} + +/** + * @brief Get captured value for input channel 1. + * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not + * input channel 1 is supported by a timer instance. + * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR1)); +} + +/** + * @brief Get captured value for input channel 2. + * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not + * input channel 2 is supported by a timer instance. + * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR2)); +} + +/** + * @brief Get captured value for input channel 3. + * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not + * input channel 3 is supported by a timer instance. + * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR3)); +} + +/** + * @brief Get captured value for input channel 4. + * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not + * input channel 4 is supported by a timer instance. + * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4 + * @param TIMx Timer instance + * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) + */ +__STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(TIM_TypeDef *TIMx) +{ + return (uint32_t)(READ_REG(TIMx->CCR4)); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection + * @{ + */ +/** + * @brief Enable external clock mode 2. + * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_EnableExternalClock + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->SMCR, TIM_SMCR_ECE); +} + +/** + * @brief Disable external clock mode 2. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_DisableExternalClock + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE); +} + +/** + * @brief Indicate whether external clock mode 2 is enabled. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)) ? 1UL : 0UL); +} + +/** + * @brief Set the clock source of the counter clock. + * @note when selected clock source is external clock mode 1, the timer input + * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput() + * function. This timer input must be configured by calling + * the @ref LL_TIM_IC_Config() function. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode1. + * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports external clock mode2. + * @rmtoll SMCR SMS LL_TIM_SetClockSource\n + * SMCR ECE LL_TIM_SetClockSource + * @param TIMx Timer instance + * @param ClockSource This parameter can be one of the following values: + * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1 + * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); +} + +/** + * @brief Set the encoder interface mode. + * @note Macro IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check + * whether or not a timer instance supports the encoder mode. + * @rmtoll SMCR SMS LL_TIM_SetEncoderMode + * @param TIMx Timer instance + * @param EncoderMode This parameter can be one of the following values: + * @arg @ref LL_TIM_ENCODERMODE_X2_TI1 + * @arg @ref LL_TIM_ENCODERMODE_X2_TI2 + * @arg @ref LL_TIM_ENCODERMODE_X4_TI12 + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration + * @{ + */ +/** + * @brief Set the trigger output (TRGO) used for timer synchronization . + * @note Macro IS_TIM_MASTER_INSTANCE(TIMx) can be used to check + * whether or not a timer instance can operate as a master timer. + * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput + * @param TIMx Timer instance + * @param TimerSynchronization This parameter can be one of the following values: + * @arg @ref LL_TIM_TRGO_RESET + * @arg @ref LL_TIM_TRGO_ENABLE + * @arg @ref LL_TIM_TRGO_UPDATE + * @arg @ref LL_TIM_TRGO_CC1IF + * @arg @ref LL_TIM_TRGO_OC1REF + * @arg @ref LL_TIM_TRGO_OC2REF + * @arg @ref LL_TIM_TRGO_OC3REF + * @arg @ref LL_TIM_TRGO_OC4REF + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization) +{ + MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); +} + +/** + * @brief Set the synchronization mode of a slave timer. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR SMS LL_TIM_SetSlaveMode + * @param TIMx Timer instance + * @param SlaveMode This parameter can be one of the following values: + * @arg @ref LL_TIM_SLAVEMODE_DISABLED + * @arg @ref LL_TIM_SLAVEMODE_RESET + * @arg @ref LL_TIM_SLAVEMODE_GATED + * @arg @ref LL_TIM_SLAVEMODE_TRIGGER + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode); +} + +/** + * @brief Set the selects the trigger input to be used to synchronize the counter. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR TS LL_TIM_SetTriggerInput + * @param TIMx Timer instance + * @param TriggerInput This parameter can be one of the following values: + * @arg @ref LL_TIM_TS_ITR0 + * @arg @ref LL_TIM_TS_ITR1 + * @arg @ref LL_TIM_TS_ITR2 + * @arg @ref LL_TIM_TS_ITR3 + * @arg @ref LL_TIM_TS_TI1F_ED + * @arg @ref LL_TIM_TS_TI1FP1 + * @arg @ref LL_TIM_TS_TI2FP2 + * @arg @ref LL_TIM_TS_ETRF + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput); +} + +/** + * @brief Enable the Master/Slave mode. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->SMCR, TIM_SMCR_MSM); +} + +/** + * @brief Disable the Master/Slave mode. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); +} + +/** + * @brief Indicates whether the Master/Slave mode is enabled. + * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not + * a timer instance can operate as a slave timer. + * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)) ? 1UL : 0UL); +} + +/** + * @brief Configure the external trigger (ETR) input. + * @note Macro IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides an external trigger input. + * @rmtoll SMCR ETP LL_TIM_ConfigETR\n + * SMCR ETPS LL_TIM_ConfigETR\n + * SMCR ETF LL_TIM_ConfigETR + * @param TIMx Timer instance + * @param ETRPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED + * @arg @ref LL_TIM_ETR_POLARITY_INVERTED + * @param ETRPrescaler This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_PRESCALER_DIV1 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV2 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV4 + * @arg @ref LL_TIM_ETR_PRESCALER_DIV8 + * @param ETRFilter This parameter can be one of the following values: + * @arg @ref LL_TIM_ETR_FILTER_FDIV1 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4 + * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6 + * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8 + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler, + uint32_t ETRFilter) +{ + MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_Break_Function Break function configuration + * @{ + */ +/** + * @brief Enable the break function. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR BKE LL_TIM_EnableBRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx) +{ + __IO uint32_t tmpreg; + SET_BIT(TIMx->BDTR, TIM_BDTR_BKE); + /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Disable the break function. + * @rmtoll BDTR BKE LL_TIM_DisableBRK + * @param TIMx Timer instance + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx) +{ + __IO uint32_t tmpreg; + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE); + /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Configure the break input. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR BKP LL_TIM_ConfigBRK + * @param TIMx Timer instance + * @param BreakPolarity This parameter can be one of the following values: + * @arg @ref LL_TIM_BREAK_POLARITY_LOW + * @arg @ref LL_TIM_BREAK_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity) +{ + __IO uint32_t tmpreg; + MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity); + /* Note: Any write operation to BKP bit takes a delay of 1 APB clock cycle to become effective. */ + tmpreg = READ_REG(TIMx->BDTR); + (void)(tmpreg); +} + +/** + * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n + * BDTR OSSR LL_TIM_SetOffStates + * @param TIMx Timer instance + * @param OffStateIdle This parameter can be one of the following values: + * @arg @ref LL_TIM_OSSI_DISABLE + * @arg @ref LL_TIM_OSSI_ENABLE + * @param OffStateRun This parameter can be one of the following values: + * @arg @ref LL_TIM_OSSR_DISABLE + * @arg @ref LL_TIM_OSSR_ENABLE + * @retval None + */ +__STATIC_INLINE void LL_TIM_SetOffStates(TIM_TypeDef *TIMx, uint32_t OffStateIdle, uint32_t OffStateRun) +{ + MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun); +} + +/** + * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableAutomaticOutput(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->BDTR, TIM_BDTR_AOE); +} + +/** + * @brief Disable automatic output (MOE can be set only by software). + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableAutomaticOutput(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE); +} + +/** + * @brief Indicate whether automatic output is enabled. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)) ? 1UL : 0UL); +} + +/** + * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register). + * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by + * software and is reset in case of break or break2 event + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableAllOutputs(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->BDTR, TIM_BDTR_MOE); +} + +/** + * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register). + * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by + * software and is reset in case of break or break2 event. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableAllOutputs(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE); +} + +/** + * @brief Indicates whether outputs are enabled. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration + * @{ + */ +/** + * @brief Configures the timer DMA burst feature. + * @note Macro IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or + * not a timer instance supports the DMA burst mode. + * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n + * DCR DBA LL_TIM_ConfigDMABurst + * @param TIMx Timer instance + * @param DMABurstBaseAddress This parameter can be one of the following values: + * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR + * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER + * @arg @ref LL_TIM_DMABURST_BASEADDR_SR + * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER + * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT + * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC + * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR + * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3 + * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4 + * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR + * @param DMABurstLength This parameter can be one of the following values: + * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER + * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS + * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS + * @retval None + */ +__STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength) +{ + MODIFY_REG(TIMx->DCR, (TIM_DCR_DBL | TIM_DCR_DBA), (DMABurstBaseAddress | DMABurstLength)); +} + +/** + * @} + */ + + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management + * @{ + */ +/** + * @brief Clear the update interrupt flag (UIF). + * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_UIF)); +} + +/** + * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending). + * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 1 interrupt flag (CC1F). + * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF)); +} + +/** + * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending). + * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 2 interrupt flag (CC2F). + * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF)); +} + +/** + * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending). + * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 3 interrupt flag (CC3F). + * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF)); +} + +/** + * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending). + * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 4 interrupt flag (CC4F). + * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF)); +} + +/** + * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending). + * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the commutation interrupt flag (COMIF). + * @rmtoll SR COMIF LL_TIM_ClearFlag_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_COM(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_COMIF)); +} + +/** + * @brief Indicate whether commutation interrupt flag (COMIF) is set (commutation interrupt is pending). + * @rmtoll SR COMIF LL_TIM_IsActiveFlag_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the trigger interrupt flag (TIF). + * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_TIF)); +} + +/** + * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending). + * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the break interrupt flag (BIF). + * @rmtoll SR BIF LL_TIM_ClearFlag_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_BRK(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_BIF)); +} + +/** + * @brief Indicate whether break interrupt flag (BIF) is set (break interrupt is pending). + * @rmtoll SR BIF LL_TIM_IsActiveFlag_BRK + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF). + * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF)); +} + +/** + * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set + * (Capture/Compare 1 interrupt is pending). + * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF). + * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF)); +} + +/** + * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set + * (Capture/Compare 2 over-capture interrupt is pending). + * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF). + * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF)); +} + +/** + * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set + * (Capture/Compare 3 over-capture interrupt is pending). + * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)) ? 1UL : 0UL); +} + +/** + * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF). + * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx) +{ + WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF)); +} + +/** + * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set + * (Capture/Compare 4 over-capture interrupt is pending). + * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_IT_Management IT-Management + * @{ + */ +/** + * @brief Enable update interrupt (UIE). + * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_UIE); +} + +/** + * @brief Disable update interrupt (UIE). + * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE); +} + +/** + * @brief Indicates whether the update interrupt (UIE) is enabled. + * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 1 interrupt (CC1IE). + * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC1IE); +} + +/** + * @brief Disable capture/compare 1 interrupt (CC1IE). + * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE); +} + +/** + * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled. + * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 2 interrupt (CC2IE). + * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC2IE); +} + +/** + * @brief Disable capture/compare 2 interrupt (CC2IE). + * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE); +} + +/** + * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled. + * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 3 interrupt (CC3IE). + * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC3IE); +} + +/** + * @brief Disable capture/compare 3 interrupt (CC3IE). + * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE); +} + +/** + * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled. + * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 4 interrupt (CC4IE). + * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC4IE); +} + +/** + * @brief Disable capture/compare 4 interrupt (CC4IE). + * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE); +} + +/** + * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled. + * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)) ? 1UL : 0UL); +} + +/** + * @brief Enable commutation interrupt (COMIE). + * @rmtoll DIER COMIE LL_TIM_EnableIT_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_COMIE); +} + +/** + * @brief Disable commutation interrupt (COMIE). + * @rmtoll DIER COMIE LL_TIM_DisableIT_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_COM(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_COMIE); +} + +/** + * @brief Indicates whether the commutation interrupt (COMIE) is enabled. + * @rmtoll DIER COMIE LL_TIM_IsEnabledIT_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable trigger interrupt (TIE). + * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_TIE); +} + +/** + * @brief Disable trigger interrupt (TIE). + * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE); +} + +/** + * @brief Indicates whether the trigger interrupt (TIE) is enabled. + * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)) ? 1UL : 0UL); +} + +/** + * @brief Enable break interrupt (BIE). + * @rmtoll DIER BIE LL_TIM_EnableIT_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableIT_BRK(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_BIE); +} + +/** + * @brief Disable break interrupt (BIE). + * @rmtoll DIER BIE LL_TIM_DisableIT_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableIT_BRK(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_BIE); +} + +/** + * @brief Indicates whether the break interrupt (BIE) is enabled. + * @rmtoll DIER BIE LL_TIM_IsEnabledIT_BRK + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_DMA_Management DMA-Management + * @{ + */ +/** + * @brief Enable update DMA request (UDE). + * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_UDE); +} + +/** + * @brief Disable update DMA request (UDE). + * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE); +} + +/** + * @brief Indicates whether the update DMA request (UDE) is enabled. + * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 1 DMA request (CC1DE). + * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC1DE); +} + +/** + * @brief Disable capture/compare 1 DMA request (CC1DE). + * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE); +} + +/** + * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled. + * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 2 DMA request (CC2DE). + * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC2DE); +} + +/** + * @brief Disable capture/compare 2 DMA request (CC2DE). + * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE); +} + +/** + * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled. + * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 3 DMA request (CC3DE). + * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC3DE); +} + +/** + * @brief Disable capture/compare 3 DMA request (CC3DE). + * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE); +} + +/** + * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled. + * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable capture/compare 4 DMA request (CC4DE). + * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_CC4DE); +} + +/** + * @brief Disable capture/compare 4 DMA request (CC4DE). + * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE); +} + +/** + * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled. + * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4 + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)) ? 1UL : 0UL); +} + +/** + * @brief Enable commutation DMA request (COMDE). + * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_COMDE); +} + +/** + * @brief Disable commutation DMA request (COMDE). + * @rmtoll DIER COMDE LL_TIM_DisableDMAReq_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_COM(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_COMDE); +} + +/** + * @brief Indicates whether the commutation DMA request (COMDE) is enabled. + * @rmtoll DIER COMDE LL_TIM_IsEnabledDMAReq_COM + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)) ? 1UL : 0UL); +} + +/** + * @brief Enable trigger interrupt (TDE). + * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->DIER, TIM_DIER_TDE); +} + +/** + * @brief Disable trigger interrupt (TDE). + * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE); +} + +/** + * @brief Indicates whether the trigger interrupt (TDE) is enabled. + * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG + * @param TIMx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx) +{ + return ((READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)) ? 1UL : 0UL); +} + +/** + * @} + */ + +/** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management + * @{ + */ +/** + * @brief Generate an update event. + * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_UG); +} + +/** + * @brief Generate Capture/Compare 1 event. + * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC1G); +} + +/** + * @brief Generate Capture/Compare 2 event. + * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC2G); +} + +/** + * @brief Generate Capture/Compare 3 event. + * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC3G); +} + +/** + * @brief Generate Capture/Compare 4 event. + * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4 + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_CC4G); +} + +/** + * @brief Generate commutation event. + * @rmtoll EGR COMG LL_TIM_GenerateEvent_COM + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_COM(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_COMG); +} + +/** + * @brief Generate trigger event. + * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_TG); +} + +/** + * @brief Generate break event. + * @rmtoll EGR BG LL_TIM_GenerateEvent_BRK + * @param TIMx Timer instance + * @retval None + */ +__STATIC_INLINE void LL_TIM_GenerateEvent_BRK(TIM_TypeDef *TIMx) +{ + SET_BIT(TIMx->EGR, TIM_EGR_BG); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions + * @{ + */ + +ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx); +void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct); +ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct); +void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); +ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); +void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct); +void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); +ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); +void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); +ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); +void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); +ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 || TIM15 || TIM16 || TIM17 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_TIM_H */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h new file mode 100644 index 0000000..9993b17 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h @@ -0,0 +1,2569 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_usart.h + * @author MCD Application Team + * @brief Header file of USART LL module. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_USART_H +#define __STM32F1xx_LL_USART_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5) + +/** @defgroup USART_LL USART + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup USART_LL_Private_Constants USART Private Constants + * @{ + */ + +/* Defines used for the bit position in the register and perform offsets*/ +#define USART_POSITION_GTPR_GT USART_GTPR_GT_Pos +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_Private_Macros USART Private Macros + * @{ + */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/* Exported types ------------------------------------------------------------*/ +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_ES_INIT USART Exported Init structures + * @{ + */ + +/** + * @brief LL USART Init Structure definition + */ +typedef struct +{ + uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/ + + uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. + This parameter can be a value of @ref USART_LL_EC_DATAWIDTH. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/ + + uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. + This parameter can be a value of @ref USART_LL_EC_STOPBITS. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/ + + uint32_t Parity; /*!< Specifies the parity mode. + This parameter can be a value of @ref USART_LL_EC_PARITY. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/ + + uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_DIRECTION. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/ + + uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_HWCONTROL. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/ + + uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8. + This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING. + + This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/ + +} LL_USART_InitTypeDef; + +/** + * @brief LL USART Clock Init Structure definition + */ +typedef struct +{ + uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled. + This parameter can be a value of @ref USART_LL_EC_CLOCK. + + USART HW configuration can be modified afterwards using unitary functions + @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput(). + For more details, refer to description of this function. */ + + uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock. + This parameter can be a value of @ref USART_LL_EC_POLARITY. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity(). + For more details, refer to description of this function. */ + + uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made. + This parameter can be a value of @ref USART_LL_EC_PHASE. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase(). + For more details, refer to description of this function. */ + + uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted + data bit (MSB) has to be output on the SCLK pin in synchronous mode. + This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE. + + USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput(). + For more details, refer to description of this function. */ + +} LL_USART_ClockInitTypeDef; + +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup USART_LL_Exported_Constants USART Exported Constants + * @{ + */ + +/** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_USART_ReadReg function + * @{ + */ +#define LL_USART_SR_PE USART_SR_PE /*!< Parity error flag */ +#define LL_USART_SR_FE USART_SR_FE /*!< Framing error flag */ +#define LL_USART_SR_NE USART_SR_NE /*!< Noise detected flag */ +#define LL_USART_SR_ORE USART_SR_ORE /*!< Overrun error flag */ +#define LL_USART_SR_IDLE USART_SR_IDLE /*!< Idle line detected flag */ +#define LL_USART_SR_RXNE USART_SR_RXNE /*!< Read data register not empty flag */ +#define LL_USART_SR_TC USART_SR_TC /*!< Transmission complete flag */ +#define LL_USART_SR_TXE USART_SR_TXE /*!< Transmit data register empty flag */ +#define LL_USART_SR_LBD USART_SR_LBD /*!< LIN break detection flag */ +#define LL_USART_SR_CTS USART_SR_CTS /*!< CTS flag */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_IT IT Defines + * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions + * @{ + */ +#define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */ +#define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */ +#define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */ +#define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */ +#define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */ +#define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */ +#define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */ +#define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_DIRECTION Communication Direction + * @{ + */ +#define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */ +#define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */ +#define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */ +#define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_PARITY Parity Control + * @{ + */ +#define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */ +#define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */ +#define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_WAKEUP Wakeup + * @{ + */ +#define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */ +#define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_DATAWIDTH Datawidth + * @{ + */ +#define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */ +#define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_OVERSAMPLING Oversampling + * @{ + */ +#define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */ +#if defined(USART_CR1_OVER8) +#define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */ +#endif /* USART_OverSampling_Feature */ +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_EC_CLOCK Clock Signal + * @{ + */ + +#define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */ +#define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */ +/** + * @} + */ +#endif /*USE_FULL_LL_DRIVER*/ + +/** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse + * @{ + */ +#define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */ +#define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_PHASE Clock Phase + * @{ + */ +#define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */ +#define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_POLARITY Clock Polarity + * @{ + */ +#define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/ +#define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_STOPBITS Stop Bits + * @{ + */ +#define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */ +#define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */ +#define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */ +#define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_HWCONTROL Hardware Control + * @{ + */ +#define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */ +#define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */ +#define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */ +#define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_IRDA_POWER IrDA Power + * @{ + */ +#define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */ +#define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */ +/** + * @} + */ + +/** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length + * @{ + */ +#define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */ +#define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup USART_LL_Exported_Macros USART Exported Macros + * @{ + */ + +/** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in USART register + * @param __INSTANCE__ USART Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in USART register + * @param __INSTANCE__ USART Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) +/** + * @} + */ + +/** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper + * @{ + */ + +/** + * @brief Compute USARTDIV value according to Peripheral Clock and + * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case + */ +#define __LL_USART_DIV_SAMPLING8_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(2*(__BAUDRATE__))) +#define __LL_USART_DIVMANT_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__))/100) +#define __LL_USART_DIVFRAQ_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 8 + 50) / 100) +/* UART BRR = mantissa + overflow + fraction + = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07) */ +#define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ + ((__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0xF8) << 1)) + \ + (__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0x07)) + +/** + * @brief Compute USARTDIV value according to Peripheral Clock and + * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case + */ +#define __LL_USART_DIV_SAMPLING16_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(4*(__BAUDRATE__))) +#define __LL_USART_DIVMANT_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__))/100) +#define __LL_USART_DIVFRAQ_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) ((((__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 16) + 50) / 100) +/* USART BRR = mantissa + overflow + fraction + = (USART DIVMANT << 4) + (USART DIVFRAQ & 0xF0) + (USART DIVFRAQ & 0x0F) */ +#define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \ + (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0xF0)) + \ + (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0x0F)) + +/** + * @} + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup USART_LL_Exported_Functions USART Exported Functions + * @{ + */ + +/** @defgroup USART_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief USART Enable + * @rmtoll CR1 UE LL_USART_Enable + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_UE); +} + +/** + * @brief USART Disable (all USART prescalers and outputs are disabled) + * @note When USART is disabled, USART prescalers and outputs are stopped immediately, + * and current operations are discarded. The configuration of the USART is kept, but all the status + * flags, in the USARTx_SR are set to their default values. + * @rmtoll CR1 UE LL_USART_Disable + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_UE); +} + +/** + * @brief Indicate if USART is enabled + * @rmtoll CR1 UE LL_USART_IsEnabled + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)); +} + +/** + * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit) + * @rmtoll CR1 RE LL_USART_EnableDirectionRx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RE); +} + +/** + * @brief Receiver Disable + * @rmtoll CR1 RE LL_USART_DisableDirectionRx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RE); +} + +/** + * @brief Transmitter Enable + * @rmtoll CR1 TE LL_USART_EnableDirectionTx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TE); +} + +/** + * @brief Transmitter Disable + * @rmtoll CR1 TE LL_USART_DisableDirectionTx + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TE); +} + +/** + * @brief Configure simultaneously enabled/disabled states + * of Transmitter and Receiver + * @rmtoll CR1 RE LL_USART_SetTransferDirection\n + * CR1 TE LL_USART_SetTransferDirection + * @param USARTx USART Instance + * @param TransferDirection This parameter can be one of the following values: + * @arg @ref LL_USART_DIRECTION_NONE + * @arg @ref LL_USART_DIRECTION_RX + * @arg @ref LL_USART_DIRECTION_TX + * @arg @ref LL_USART_DIRECTION_TX_RX + * @retval None + */ +__STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection); +} + +/** + * @brief Return enabled/disabled states of Transmitter and Receiver + * @rmtoll CR1 RE LL_USART_GetTransferDirection\n + * CR1 TE LL_USART_GetTransferDirection + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_DIRECTION_NONE + * @arg @ref LL_USART_DIRECTION_RX + * @arg @ref LL_USART_DIRECTION_TX + * @arg @ref LL_USART_DIRECTION_TX_RX + */ +__STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE)); +} + +/** + * @brief Configure Parity (enabled/disabled and parity mode if enabled). + * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. + * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position + * (9th or 8th bit depending on data width) and parity is checked on the received data. + * @rmtoll CR1 PS LL_USART_SetParity\n + * CR1 PCE LL_USART_SetParity + * @param USARTx USART Instance + * @param Parity This parameter can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + * @retval None + */ +__STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity); +} + +/** + * @brief Return Parity configuration (enabled/disabled and parity mode if enabled) + * @rmtoll CR1 PS LL_USART_GetParity\n + * CR1 PCE LL_USART_GetParity + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + */ +__STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE)); +} + +/** + * @brief Set Receiver Wake Up method from Mute mode. + * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod + * @param USARTx USART Instance + * @param Method This parameter can be one of the following values: + * @arg @ref LL_USART_WAKEUP_IDLELINE + * @arg @ref LL_USART_WAKEUP_ADDRESSMARK + * @retval None + */ +__STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method); +} + +/** + * @brief Return Receiver Wake Up method from Mute mode + * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_WAKEUP_IDLELINE + * @arg @ref LL_USART_WAKEUP_ADDRESSMARK + */ +__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE)); +} + +/** + * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits) + * @rmtoll CR1 M LL_USART_SetDataWidth + * @param USARTx USART Instance + * @param DataWidth This parameter can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + * @retval None + */ +__STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth); +} + +/** + * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits) + * @rmtoll CR1 M LL_USART_GetDataWidth + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + */ +__STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M)); +} + +#if defined(USART_CR1_OVER8) +/** + * @brief Set Oversampling to 8-bit or 16-bit mode + * @rmtoll CR1 OVER8 LL_USART_SetOverSampling + * @param USARTx USART Instance + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling); +} + +/** + * @brief Return Oversampling mode + * @rmtoll CR1 OVER8 LL_USART_GetOverSampling + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + */ +__STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8)); +} + +#endif /* USART_OverSampling_Feature */ +/** + * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput + * @param USARTx USART Instance + * @param LastBitClockPulse This parameter can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + * @retval None + */ +__STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse); +} + +/** + * @brief Retrieve Clock pulse of the last data bit output configuration + * (Last bit Clock pulse output to the SCLK pin or not) + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + */ +__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL)); +} + +/** + * @brief Select the phase of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPHA LL_USART_SetClockPhase + * @param USARTx USART Instance + * @param ClockPhase This parameter can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + * @retval None + */ +__STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase); +} + +/** + * @brief Return phase of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPHA LL_USART_GetClockPhase + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + */ +__STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA)); +} + +/** + * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPOL LL_USART_SetClockPolarity + * @param USARTx USART Instance + * @param ClockPolarity This parameter can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + * @retval None + */ +__STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity); +} + +/** + * @brief Return polarity of the clock output on the SCLK pin in synchronous mode + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CPOL LL_USART_GetClockPolarity + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + */ +__STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL)); +} + +/** + * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse) + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function + * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function + * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function + * @rmtoll CR2 CPHA LL_USART_ConfigClock\n + * CR2 CPOL LL_USART_ConfigClock\n + * CR2 LBCL LL_USART_ConfigClock + * @param USARTx USART Instance + * @param Phase This parameter can be one of the following values: + * @arg @ref LL_USART_PHASE_1EDGE + * @arg @ref LL_USART_PHASE_2EDGE + * @param Polarity This parameter can be one of the following values: + * @arg @ref LL_USART_POLARITY_LOW + * @arg @ref LL_USART_POLARITY_HIGH + * @param LBCPOutput This parameter can be one of the following values: + * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT + * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput); +} + +/** + * @brief Enable Clock output on SCLK pin + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Disable Clock output on SCLK pin + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Indicate if Clock output on SCLK pin is enabled + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)); +} + +/** + * @brief Set the length of the stop bits + * @rmtoll CR2 STOP LL_USART_SetStopBitsLength + * @param USARTx USART Instance + * @param StopBits This parameter can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); +} + +/** + * @brief Retrieve the length of the stop bits + * @rmtoll CR2 STOP LL_USART_GetStopBitsLength + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + */ +__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP)); +} + +/** + * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) + * @note Call of this function is equivalent to following function call sequence : + * - Data Width configuration using @ref LL_USART_SetDataWidth() function + * - Parity Control and mode configuration using @ref LL_USART_SetParity() function + * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function + * @rmtoll CR1 PS LL_USART_ConfigCharacter\n + * CR1 PCE LL_USART_ConfigCharacter\n + * CR1 M LL_USART_ConfigCharacter\n + * CR2 STOP LL_USART_ConfigCharacter + * @param USARTx USART Instance + * @param DataWidth This parameter can be one of the following values: + * @arg @ref LL_USART_DATAWIDTH_8B + * @arg @ref LL_USART_DATAWIDTH_9B + * @param Parity This parameter can be one of the following values: + * @arg @ref LL_USART_PARITY_NONE + * @arg @ref LL_USART_PARITY_EVEN + * @arg @ref LL_USART_PARITY_ODD + * @param StopBits This parameter can be one of the following values: + * @arg @ref LL_USART_STOPBITS_0_5 + * @arg @ref LL_USART_STOPBITS_1 + * @arg @ref LL_USART_STOPBITS_1_5 + * @arg @ref LL_USART_STOPBITS_2 + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, + uint32_t StopBits) +{ + MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth); + MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits); +} + +/** + * @brief Set Address of the USART node. + * @note This is used in multiprocessor communication during Mute mode or Stop mode, + * for wake up with address mark detection. + * @rmtoll CR2 ADD LL_USART_SetNodeAddress + * @param USARTx USART Instance + * @param NodeAddress 4 bit Address of the USART node. + * @retval None + */ +__STATIC_INLINE void LL_USART_SetNodeAddress(USART_TypeDef *USARTx, uint32_t NodeAddress) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_ADD, (NodeAddress & USART_CR2_ADD)); +} + +/** + * @brief Return 4 bit Address of the USART node as set in ADD field of CR2. + * @note only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) + * @rmtoll CR2 ADD LL_USART_GetNodeAddress + * @param USARTx USART Instance + * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255) + */ +__STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD)); +} + +/** + * @brief Enable RTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_RTSE); +} + +/** + * @brief Disable RTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE); +} + +/** + * @brief Enable CTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_CTSE); +} + +/** + * @brief Disable CTS HW Flow Control + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE); +} + +/** + * @brief Configure HW Flow Control mode (both CTS and RTS) + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n + * CR3 CTSE LL_USART_SetHWFlowCtrl + * @param USARTx USART Instance + * @param HardwareFlowControl This parameter can be one of the following values: + * @arg @ref LL_USART_HWCONTROL_NONE + * @arg @ref LL_USART_HWCONTROL_RTS + * @arg @ref LL_USART_HWCONTROL_CTS + * @arg @ref LL_USART_HWCONTROL_RTS_CTS + * @retval None + */ +__STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl) +{ + MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); +} + +/** + * @brief Return HW Flow Control configuration (both CTS and RTS) + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n + * CR3 CTSE LL_USART_GetHWFlowCtrl + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_HWCONTROL_NONE + * @arg @ref LL_USART_HWCONTROL_RTS + * @arg @ref LL_USART_HWCONTROL_CTS + * @arg @ref LL_USART_HWCONTROL_RTS_CTS + */ +__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE)); +} + +#if defined(USART_CR3_ONEBIT) +/** + * @brief Enable One bit sampling method + * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_ONEBIT); +} + +/** + * @brief Disable One bit sampling method + * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT); +} + +/** + * @brief Indicate if One bit sampling method is enabled + * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)); +} +#endif /* USART_OneBitSampling_Feature */ + +#if defined(USART_CR1_OVER8) +/** + * @brief Configure USART BRR register for achieving expected Baud Rate value. + * @note Compute and set USARTDIV value in BRR Register (full BRR content) + * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values + * @note Peripheral clock and Baud rate values provided as function parameters should be valid + * (Baud rate value != 0) + * @rmtoll BRR BRR LL_USART_SetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @param BaudRate Baud Rate + * @retval None + */ +__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling, + uint32_t BaudRate) +{ + if (OverSampling == LL_USART_OVERSAMPLING_8) + { + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate)); + } + else + { + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); + } +} + +/** + * @brief Return current Baud Rate value, according to USARTDIV present in BRR register + * (full BRR content), and to used Peripheral Clock and Oversampling mode values + * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. + * @rmtoll BRR BRR LL_USART_GetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @param OverSampling This parameter can be one of the following values: + * @arg @ref LL_USART_OVERSAMPLING_16 + * @arg @ref LL_USART_OVERSAMPLING_8 + * @retval Baud Rate + */ +__STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling) +{ + uint32_t usartdiv = 0x0U; + uint32_t brrresult = 0x0U; + + usartdiv = USARTx->BRR; + + if (OverSampling == LL_USART_OVERSAMPLING_8) + { + if ((usartdiv & 0xFFF7U) != 0U) + { + usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ; + brrresult = (PeriphClk * 2U) / usartdiv; + } + } + else + { + if ((usartdiv & 0xFFFFU) != 0U) + { + brrresult = PeriphClk / usartdiv; + } + } + return (brrresult); +} +#else +/** + * @brief Configure USART BRR register for achieving expected Baud Rate value. + * @note Compute and set USARTDIV value in BRR Register (full BRR content) + * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values + * @note Peripheral clock and Baud rate values provided as function parameters should be valid + * (Baud rate value != 0) + * @rmtoll BRR BRR LL_USART_SetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @param BaudRate Baud Rate + * @retval None + */ +__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t BaudRate) +{ + USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate)); +} + +/** + * @brief Return current Baud Rate value, according to USARTDIV present in BRR register + * (full BRR content), and to used Peripheral Clock and Oversampling mode values + * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. + * @rmtoll BRR BRR LL_USART_GetBaudRate + * @param USARTx USART Instance + * @param PeriphClk Peripheral Clock + * @retval Baud Rate + */ +__STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk) +{ + uint32_t usartdiv = 0x0U; + uint32_t brrresult = 0x0U; + + usartdiv = USARTx->BRR; + + if ((usartdiv & 0xFFFFU) != 0U) + { + brrresult = PeriphClk / usartdiv; + } + return (brrresult); +} +#endif /* USART_OverSampling_Feature */ + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature + * @{ + */ + +/** + * @brief Enable IrDA mode + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_EnableIrda + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Disable IrDA mode + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_DisableIrda + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Indicate if IrDA mode is enabled + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IREN LL_USART_IsEnabledIrda + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN)); +} + +/** + * @brief Configure IrDA Power Mode (Normal or Low Power) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode + * @param USARTx USART Instance + * @param PowerMode This parameter can be one of the following values: + * @arg @ref LL_USART_IRDA_POWER_NORMAL + * @arg @ref LL_USART_IRDA_POWER_LOW + * @retval None + */ +__STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode) +{ + MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode); +} + +/** + * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_IRDA_POWER_NORMAL + * @arg @ref LL_USART_PHASE_2EDGE + */ +__STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP)); +} + +/** + * @brief Set Irda prescaler value, used for dividing the USART clock source + * to achieve the Irda Low Power frequency (8 bits value) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler + * @param USARTx USART Instance + * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); +} + +/** + * @brief Return Irda prescaler value, used for dividing the USART clock source + * to achieve the Irda Low Power frequency (8 bits value) + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler + * @param USARTx USART Instance + * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF) + */ +__STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature + * @{ + */ + +/** + * @brief Enable Smartcard NACK transmission + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_NACK); +} + +/** + * @brief Disable Smartcard NACK transmission + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_NACK); +} + +/** + * @brief Indicate if Smartcard NACK transmission is enabled + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK)); +} + +/** + * @brief Enable Smartcard mode + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_EnableSmartcard + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Disable Smartcard mode + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_DisableSmartcard + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Indicate if Smartcard mode is enabled + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN)); +} + +/** + * @brief Set Smartcard prescaler value, used for dividing the USART clock + * source to provide the SMARTCARD Clock (5 bits value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler + * @param USARTx USART Instance + * @param PrescalerValue Value between Min_Data=0 and Max_Data=31 + * @retval None + */ +__STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue); +} + +/** + * @brief Return Smartcard prescaler value, used for dividing the USART clock + * source to provide the SMARTCARD Clock (5 bits value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler + * @param USARTx USART Instance + * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31) + */ +__STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC)); +} + +/** + * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods + * (GT[7:0] bits : Guard time value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime + * @param USARTx USART Instance + * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime) +{ + MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_POSITION_GTPR_GT); +} + +/** + * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods + * (GT[7:0] bits : Guard time value) + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime + * @param USARTx USART Instance + * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF) + */ +__STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_POSITION_GTPR_GT); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature + * @{ + */ + +/** + * @brief Enable Single Wire Half-Duplex mode + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Disable Single Wire Half-Duplex mode + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Indicate if Single Wire Half-Duplex mode is enabled + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature + * @{ + */ + +/** + * @brief Set LIN Break Detection Length + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen + * @param USARTx USART Instance + * @param LINBDLength This parameter can be one of the following values: + * @arg @ref LL_USART_LINBREAK_DETECT_10B + * @arg @ref LL_USART_LINBREAK_DETECT_11B + * @retval None + */ +__STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength) +{ + MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength); +} + +/** + * @brief Return LIN Break Detection Length + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen + * @param USARTx USART Instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_USART_LINBREAK_DETECT_10B + * @arg @ref LL_USART_LINBREAK_DETECT_11B + */ +__STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx) +{ + return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL)); +} + +/** + * @brief Enable LIN mode + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_EnableLIN + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Disable LIN mode + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_DisableLIN + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Indicate if LIN mode is enabled + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services + * @{ + */ + +/** + * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART) + * @note In UART mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * @note Other remaining configurations items related to Asynchronous Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n + * CR2 CLKEN LL_USART_ConfigAsyncMode\n + * CR3 SCEN LL_USART_ConfigAsyncMode\n + * CR3 IREN LL_USART_ConfigAsyncMode\n + * CR3 HDSEL LL_USART_ConfigAsyncMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx) +{ + /* In Asynchronous mode, the following bits must be kept cleared: + - LINEN, CLKEN bits in the USART_CR2 register, + - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Synchronous Mode + * @note In Synchronous mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also sets the USART in Synchronous mode. + * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not + * Synchronous mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function + * @note Other remaining configurations items related to Synchronous Mode + * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n + * CR2 CLKEN LL_USART_ConfigSyncMode\n + * CR3 SCEN LL_USART_ConfigSyncMode\n + * CR3 IREN LL_USART_ConfigSyncMode\n + * CR3 HDSEL LL_USART_ConfigSyncMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx) +{ + /* In Synchronous mode, the following bits must be kept cleared: + - LINEN bit in the USART_CR2 register, + - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL)); + /* set the UART/USART in Synchronous mode */ + SET_BIT(USARTx->CR2, USART_CR2_CLKEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in LIN Mode + * @note In LIN mode, the following bits must be kept cleared: + * - STOP and CLKEN bits in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also set the UART/USART in LIN mode. + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function + * @note Other remaining configurations items related to LIN Mode + * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using + * dedicated functions + * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n + * CR2 STOP LL_USART_ConfigLINMode\n + * CR2 LINEN LL_USART_ConfigLINMode\n + * CR3 IREN LL_USART_ConfigLINMode\n + * CR3 SCEN LL_USART_ConfigLINMode\n + * CR3 HDSEL LL_USART_ConfigLINMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx) +{ + /* In LIN mode, the following bits must be kept cleared: + - STOP and CLKEN bits in the USART_CR2 register, + - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL)); + /* Set the UART/USART in LIN mode */ + SET_BIT(USARTx->CR2, USART_CR2_LINEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode + * @note In Half Duplex mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * This function also sets the UART/USART in Half Duplex mode. + * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not + * Half-Duplex mode is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function + * @note Other remaining configurations items related to Half Duplex Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n + * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n + * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n + * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n + * CR3 IREN LL_USART_ConfigHalfDuplexMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx) +{ + /* In Half Duplex mode, the following bits must be kept cleared: + - LINEN and CLKEN bits in the USART_CR2 register, + - SCEN and IREN bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN)); + /* set the UART/USART in Half Duplex mode */ + SET_BIT(USARTx->CR3, USART_CR3_HDSEL); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Smartcard Mode + * @note In Smartcard mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also configures Stop bits to 1.5 bits and + * sets the USART in Smartcard mode (SCEN bit). + * Clock Output is also enabled (CLKEN). + * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not + * Smartcard feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function + * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function + * @note Other remaining configurations items related to Smartcard Mode + * (as Baud Rate, Word length, Parity, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n + * CR2 STOP LL_USART_ConfigSmartcardMode\n + * CR2 CLKEN LL_USART_ConfigSmartcardMode\n + * CR3 HDSEL LL_USART_ConfigSmartcardMode\n + * CR3 SCEN LL_USART_ConfigSmartcardMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx) +{ + /* In Smartcard mode, the following bits must be kept cleared: + - LINEN bit in the USART_CR2 register, + - IREN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL)); + /* Configure Stop bits to 1.5 bits */ + /* Synchronous mode is activated by default */ + SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN)); + /* set the UART/USART in Smartcard mode */ + SET_BIT(USARTx->CR3, USART_CR3_SCEN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Irda Mode + * @note In IRDA mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - STOP and CLKEN bits in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * This function also sets the UART/USART in IRDA mode (IREN bit). + * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not + * IrDA feature is supported by the USARTx instance. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function + * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function + * @note Other remaining configurations items related to Irda Mode + * (as Baud Rate, Word length, Power mode, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n + * CR2 CLKEN LL_USART_ConfigIrdaMode\n + * CR2 STOP LL_USART_ConfigIrdaMode\n + * CR3 SCEN LL_USART_ConfigIrdaMode\n + * CR3 HDSEL LL_USART_ConfigIrdaMode\n + * CR3 IREN LL_USART_ConfigIrdaMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx) +{ + /* In IRDA mode, the following bits must be kept cleared: + - LINEN, STOP and CLKEN bits in the USART_CR2 register, + - SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL)); + /* set the UART/USART in IRDA mode */ + SET_BIT(USARTx->CR3, USART_CR3_IREN); +} + +/** + * @brief Perform basic configuration of USART for enabling use in Multi processor Mode + * (several USARTs connected in a network, one of the USARTs can be the master, + * its TX output connected to the RX inputs of the other slaves USARTs). + * @note In MultiProcessor mode, the following bits must be kept cleared: + * - LINEN bit in the USART_CR2 register, + * - CLKEN bit in the USART_CR2 register, + * - SCEN bit in the USART_CR3 register, + * - IREN bit in the USART_CR3 register, + * - HDSEL bit in the USART_CR3 register. + * @note Call of this function is equivalent to following function call sequence : + * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function + * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function + * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function + * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function + * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function + * @note Other remaining configurations items related to Multi processor Mode + * (as Baud Rate, Wake Up Method, Node address, ...) should be set using + * dedicated functions + * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n + * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n + * CR3 SCEN LL_USART_ConfigMultiProcessMode\n + * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n + * CR3 IREN LL_USART_ConfigMultiProcessMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx) +{ + /* In Multi Processor mode, the following bits must be kept cleared: + - LINEN and CLKEN bits in the USART_CR2 register, + - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/ + CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); + CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Check if the USART Parity Error Flag is set or not + * @rmtoll SR PE LL_USART_IsActiveFlag_PE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_PE) == (USART_SR_PE)); +} + +/** + * @brief Check if the USART Framing Error Flag is set or not + * @rmtoll SR FE LL_USART_IsActiveFlag_FE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_FE) == (USART_SR_FE)); +} + +/** + * @brief Check if the USART Noise error detected Flag is set or not + * @rmtoll SR NF LL_USART_IsActiveFlag_NE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_NE) == (USART_SR_NE)); +} + +/** + * @brief Check if the USART OverRun Error Flag is set or not + * @rmtoll SR ORE LL_USART_IsActiveFlag_ORE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_ORE) == (USART_SR_ORE)); +} + +/** + * @brief Check if the USART IDLE line detected Flag is set or not + * @rmtoll SR IDLE LL_USART_IsActiveFlag_IDLE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_IDLE) == (USART_SR_IDLE)); +} + +/** + * @brief Check if the USART Read Data Register Not Empty Flag is set or not + * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE)); +} + +/** + * @brief Check if the USART Transmission Complete Flag is set or not + * @rmtoll SR TC LL_USART_IsActiveFlag_TC + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC)); +} + +/** + * @brief Check if the USART Transmit Data Register Empty Flag is set or not + * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE)); +} + +/** + * @brief Check if the USART LIN Break Detection Flag is set or not + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll SR LBD LL_USART_IsActiveFlag_LBD + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_LBD) == (USART_SR_LBD)); +} + +/** + * @brief Check if the USART CTS Flag is set or not + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll SR CTS LL_USART_IsActiveFlag_nCTS + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->SR, USART_SR_CTS) == (USART_SR_CTS)); +} + +/** + * @brief Check if the USART Send Break Flag is set or not + * @rmtoll CR1 SBK LL_USART_IsActiveFlag_SBK + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_SBK) == (USART_CR1_SBK)); +} + +/** + * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not + * @rmtoll CR1 RWU LL_USART_IsActiveFlag_RWU + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_RWU) == (USART_CR1_RWU)); +} + +/** + * @brief Clear Parity Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * NE, FE, ORE, IDLE would also be cleared. + * @rmtoll SR PE LL_USART_ClearFlag_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Framing Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, ORE, IDLE would also be cleared. + * @rmtoll SR FE LL_USART_ClearFlag_FE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Noise detected Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, FE, ORE, IDLE would also be cleared. + * @rmtoll SR NF LL_USART_ClearFlag_NE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear OverRun Error Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, FE, IDLE would also be cleared. + * @rmtoll SR ORE LL_USART_ClearFlag_ORE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear IDLE line detected Flag + * @note Clearing this flag is done by a read access to the USARTx_SR + * register followed by a read access to the USARTx_DR register. + * @note Please also consider that when clearing this flag, other flags as + * PE, NE, FE, ORE would also be cleared. + * @rmtoll SR IDLE LL_USART_ClearFlag_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx) +{ + __IO uint32_t tmpreg; + tmpreg = USARTx->SR; + (void) tmpreg; + tmpreg = USARTx->DR; + (void) tmpreg; +} + +/** + * @brief Clear Transmission Complete Flag + * @rmtoll SR TC LL_USART_ClearFlag_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_TC)); +} + +/** + * @brief Clear RX Not Empty Flag + * @rmtoll SR RXNE LL_USART_ClearFlag_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_RXNE(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_RXNE)); +} + +/** + * @brief Clear LIN Break Detection Flag + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll SR LBD LL_USART_ClearFlag_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_LBD)); +} + +/** + * @brief Clear CTS Interrupt Flag + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll SR CTS LL_USART_ClearFlag_nCTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx) +{ + WRITE_REG(USARTx->SR, ~(USART_SR_CTS)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable IDLE Interrupt + * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_IDLEIE); +} + +/** + * @brief Enable RX Not Empty Interrupt + * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RXNEIE); +} + +/** + * @brief Enable Transmission Complete Interrupt + * @rmtoll CR1 TCIE LL_USART_EnableIT_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TCIE); +} + +/** + * @brief Enable TX Empty Interrupt + * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_TXEIE); +} + +/** + * @brief Enable Parity Error Interrupt + * @rmtoll CR1 PEIE LL_USART_EnableIT_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_PEIE); +} + +/** + * @brief Enable LIN Break Detection Interrupt + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR2, USART_CR2_LBDIE); +} + +/** + * @brief Enable Error Interrupt + * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing + * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). + * 0: Interrupt is inhibited + * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. + * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_EIE); +} + +/** + * @brief Enable CTS Interrupt + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_CTSIE); +} + +/** + * @brief Disable IDLE Interrupt + * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE); +} + +/** + * @brief Disable RX Not Empty Interrupt + * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE); +} + +/** + * @brief Disable Transmission Complete Interrupt + * @rmtoll CR1 TCIE LL_USART_DisableIT_TC + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE); +} + +/** + * @brief Disable TX Empty Interrupt + * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE); +} + +/** + * @brief Disable Parity Error Interrupt + * @rmtoll CR1 PEIE LL_USART_DisableIT_PE + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE); +} + +/** + * @brief Disable LIN Break Detection Interrupt + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE); +} + +/** + * @brief Disable Error Interrupt + * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing + * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register). + * 0: Interrupt is inhibited + * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register. + * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_EIE); +} + +/** + * @brief Disable CTS Interrupt + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE); +} + +/** + * @brief Check if the USART IDLE Interrupt source is enabled or disabled. + * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)); +} + +/** + * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled. + * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)); +} + +/** + * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled. + * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)); +} + +/** + * @brief Check if the USART TX Empty Interrupt is enabled or disabled. + * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)); +} + +/** + * @brief Check if the USART Parity Error Interrupt is enabled or disabled. + * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)); +} + +/** + * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled. + * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not + * LIN feature is supported by the USARTx instance. + * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE)); +} + +/** + * @brief Check if the USART Error Interrupt is enabled or disabled. + * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)); +} + +/** + * @brief Check if the USART CTS Interrupt is enabled or disabled. + * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not + * Hardware Flow control feature is supported by the USARTx instance. + * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Enable DMA Mode for reception + * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_DMAR); +} + +/** + * @brief Disable DMA Mode for reception + * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR); +} + +/** + * @brief Check if DMA Mode is enabled for reception + * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)); +} + +/** + * @brief Enable DMA Mode for transmission + * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR3, USART_CR3_DMAT); +} + +/** + * @brief Disable DMA Mode for transmission + * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT); +} + +/** + * @brief Check if DMA Mode is enabled for transmission + * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX + * @param USARTx USART Instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx) +{ + return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)); +} + +/** + * @brief Get the data register address used for DMA transfer + * @rmtoll DR DR LL_USART_DMA_GetRegAddr + * @note Address of Data Register is valid for both Transmit and Receive transfers. + * @param USARTx USART Instance + * @retval Address of data register + */ +__STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx) +{ + /* return address of DR register */ + return ((uint32_t) & (USARTx->DR)); +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Read Receiver Data register (Receive Data value, 8 bits) + * @rmtoll DR DR LL_USART_ReceiveData8 + * @param USARTx USART Instance + * @retval Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx) +{ + return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR)); +} + +/** + * @brief Read Receiver Data register (Receive Data value, 9 bits) + * @rmtoll DR DR LL_USART_ReceiveData9 + * @param USARTx USART Instance + * @retval Value between Min_Data=0x00 and Max_Data=0x1FF + */ +__STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx) +{ + return (uint16_t)(READ_BIT(USARTx->DR, USART_DR_DR)); +} + +/** + * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) + * @rmtoll DR DR LL_USART_TransmitData8 + * @param USARTx USART Instance + * @param Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value) +{ + USARTx->DR = Value; +} + +/** + * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits) + * @rmtoll DR DR LL_USART_TransmitData9 + * @param USARTx USART Instance + * @param Value between Min_Data=0x00 and Max_Data=0x1FF + * @retval None + */ +__STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value) +{ + USARTx->DR = Value & 0x1FFU; +} + +/** + * @} + */ + +/** @defgroup USART_LL_EF_Execution Execution + * @{ + */ + +/** + * @brief Request Break sending + * @rmtoll CR1 SBK LL_USART_RequestBreakSending + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_SBK); +} + +/** + * @brief Put USART in Mute mode + * @rmtoll CR1 RWU LL_USART_RequestEnterMuteMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx) +{ + SET_BIT(USARTx->CR1, USART_CR1_RWU); +} + +/** + * @brief Put USART in Active mode + * @rmtoll CR1 RWU LL_USART_RequestExitMuteMode + * @param USARTx USART Instance + * @retval None + */ +__STATIC_INLINE void LL_USART_RequestExitMuteMode(USART_TypeDef *USARTx) +{ + CLEAR_BIT(USARTx->CR1, USART_CR1_RWU); +} + +/** + * @} + */ + +#if defined(USE_FULL_LL_DRIVER) +/** @defgroup USART_LL_EF_Init Initialization and de-initialization functions + * @{ + */ +ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx); +ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct); +void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct); +ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct); +void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct); +/** + * @} + */ +#endif /* USE_FULL_LL_DRIVER */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* USART1 || USART2 || USART3 || UART4 || UART5 */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_USART_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h new file mode 100644 index 0000000..681ef89 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h @@ -0,0 +1,272 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_utils.h + * @author MCD Application Team + * @brief Header file of UTILS LL module. + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The LL UTILS driver contains a set of generic APIs that can be + used by user: + (+) Device electronic signature + (+) Timing functions + (+) PLL configuration functions + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 __STM32F1xx_LL_UTILS_H +#define __STM32F1xx_LL_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx.h" + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +/** @defgroup UTILS_LL UTILS + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Constants UTILS Private Constants + * @{ + */ + +/* Max delay can be used in LL_mDelay */ +#define LL_MAX_DELAY 0xFFFFFFFFU + +/** + * @brief Unique device ID register base address + */ +#define UID_BASE_ADDRESS UID_BASE + +/** + * @brief Flash size data register base address + */ +#define FLASHSIZE_BASE_ADDRESS FLASHSIZE_BASE + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Macros UTILS Private Macros + * @{ + */ +/** + * @} + */ +/* Exported types ------------------------------------------------------------*/ +/** @defgroup UTILS_LL_ES_INIT UTILS Exported structures + * @{ + */ +/** + * @brief UTILS PLL structure definition + */ +typedef struct +{ + uint32_t PLLMul; /*!< Multiplication factor for PLL VCO input clock. + This parameter can be a value of @ref RCC_LL_EC_PLL_MUL + + This feature can be modified afterwards using unitary function + @ref LL_RCC_PLL_ConfigDomain_SYS(). */ + + uint32_t Prediv; /*!< Division factor for HSE used as PLL clock source. + This parameter can be a value of @ref RCC_LL_EC_PREDIV_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_PLL_ConfigDomain_SYS(). */ +} LL_UTILS_PLLInitTypeDef; + +/** + * @brief UTILS System, AHB and APB buses clock configuration structure definition + */ +typedef struct +{ + uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). + This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAHBPrescaler(). */ + + uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_LL_EC_APB1_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAPB1Prescaler(). */ + + uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). + This parameter can be a value of @ref RCC_LL_EC_APB2_DIV + + This feature can be modified afterwards using unitary function + @ref LL_RCC_SetAPB2Prescaler(). */ + +} LL_UTILS_ClkInitTypeDef; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants + * @{ + */ + +/** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation + * @{ + */ +#define LL_UTILS_HSEBYPASS_OFF 0x00000000U /*!< HSE Bypass is not enabled */ +#define LL_UTILS_HSEBYPASS_ON 0x00000001U /*!< HSE Bypass is enabled */ +/** + * @} + */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions + * @{ + */ + +/** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE + * @{ + */ + +/** + * @brief Get Word0 of the unique device identifier (UID based on 96 bits) + * @retval UID[31:0] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word0(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS))); +} + +/** + * @brief Get Word1 of the unique device identifier (UID based on 96 bits) + * @retval UID[63:32] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word1(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U)))); +} + +/** + * @brief Get Word2 of the unique device identifier (UID based on 96 bits) + * @retval UID[95:64] + */ +__STATIC_INLINE uint32_t LL_GetUID_Word2(void) +{ + return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U)))); +} + +/** + * @brief Get Flash memory size + * @note This bitfield indicates the size of the device Flash memory expressed in + * Kbytes. As an example, 0x040 corresponds to 64 Kbytes. + * @retval FLASH_SIZE[15:0]: Flash memory size + */ +__STATIC_INLINE uint32_t LL_GetFlashSize(void) +{ + return (uint16_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS))); +} + + +/** + * @} + */ + +/** @defgroup UTILS_LL_EF_DELAY DELAY + * @{ + */ + +/** + * @brief This function configures the Cortex-M SysTick source of the time base. + * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) + * @note When a RTOS is used, it is recommended to avoid changing the SysTick + * configuration by calling this function, for a delay use rather osDelay RTOS service. + * @param Ticks Number of ticks + * @retval None + */ +__STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks) +{ + /* Configure the SysTick to have interrupt in 1ms time base */ + SysTick->LOAD = (uint32_t)((HCLKFrequency / Ticks) - 1UL); /* set reload register */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable the Systick Timer */ +} + +void LL_Init1msTick(uint32_t HCLKFrequency); +void LL_mDelay(uint32_t Delay); + +/** + * @} + */ + +/** @defgroup UTILS_EF_SYSTEM SYSTEM + * @{ + */ + +void LL_SetSystemCoreClock(uint32_t HCLKFrequency); +#if defined(FLASH_ACR_LATENCY) +ErrorStatus LL_SetFlashLatency(uint32_t Frequency); +#endif /* FLASH_ACR_LATENCY */ +ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +#if defined(RCC_PLL2_SUPPORT) +ErrorStatus LL_PLL_ConfigSystemClock_PLL2(uint32_t HSEFrequency, uint32_t HSEBypass, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_PLLInitTypeDef *UTILS_PLL2InitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +#endif /* RCC_PLL2_SUPPORT */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_LL_UTILS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c new file mode 100644 index 0000000..3c9544b --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c @@ -0,0 +1,606 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal.c + * @author MCD Application Team + * @brief HAL module driver. + * This is the common part of the HAL initialization + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The common HAL driver contains a set of generic and common APIs that can be + used by the PPP peripheral drivers and the user to start using the HAL. + [..] + The HAL contains two APIs' categories: + (+) Common HAL APIs + (+) Services HAL APIs + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup HAL HAL + * @brief HAL module driver. + * @{ + */ + +#ifdef HAL_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +/** @defgroup HAL_Private_Constants HAL Private Constants + * @{ + */ +/** + * @brief STM32F1xx HAL Driver version number V1.1.8 + */ +#define __STM32F1xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ +#define __STM32F1xx_HAL_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */ +#define __STM32F1xx_HAL_VERSION_SUB2 (0x08U) /*!< [15:8] sub2 version */ +#define __STM32F1xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ +#define __STM32F1xx_HAL_VERSION ((__STM32F1xx_HAL_VERSION_MAIN << 24)\ + |(__STM32F1xx_HAL_VERSION_SUB1 << 16)\ + |(__STM32F1xx_HAL_VERSION_SUB2 << 8 )\ + |(__STM32F1xx_HAL_VERSION_RC)) + +#define IDCODE_DEVID_MASK 0x00000FFFU + +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/** @defgroup HAL_Private_Variables HAL Private Variables + * @{ + */ +__IO uint32_t uwTick; +uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */ +HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */ +/** + * @} + */ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions ---------------------------------------------------------*/ + +/** @defgroup HAL_Exported_Functions HAL Exported Functions + * @{ + */ + +/** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Initializes the Flash interface, the NVIC allocation and initial clock + configuration. It initializes the systick also when timeout is needed + and the backup domain when enabled. + (+) de-Initializes common part of the HAL. + (+) Configure The time base source to have 1ms time base with a dedicated + Tick interrupt priority. + (++) SysTick timer is used by default as source of time base, but user + can eventually implement his proper time base source (a general purpose + timer for example or other time source), keeping in mind that Time base + duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and + handled in milliseconds basis. + (++) Time base configuration function (HAL_InitTick ()) is called automatically + at the beginning of the program after reset by HAL_Init() or at any time + when clock is configured, by HAL_RCC_ClockConfig(). + (++) Source of time base is configured to generate interrupts at regular + time intervals. Care must be taken if HAL_Delay() is called from a + peripheral ISR process, the Tick interrupt line must have higher priority + (numerically lower) than the peripheral interrupt. Otherwise the caller + ISR process will be blocked. + (++) functions affecting time base configurations are declared as __weak + to make override possible in case of other implementations in user file. +@endverbatim + * @{ + */ + +/** + * @brief This function is used to initialize the HAL Library; it must be the first + * instruction to be executed in the main program (before to call any other + * HAL function), it performs the following: + * Configure the Flash prefetch. + * Configures the SysTick to generate an interrupt each 1 millisecond, + * which is clocked by the HSI (at this stage, the clock is not yet + * configured and thus the system is running from the internal HSI at 16 MHz). + * Set NVIC Group Priority to 4. + * Calls the HAL_MspInit() callback function defined in user file + * "stm32f1xx_hal_msp.c" to do the global low level hardware initialization + * + * @note SysTick is used as time base for the HAL_Delay() function, the application + * need to ensure that the SysTick time base is always set to 1 millisecond + * to have correct HAL operation. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_Init(void) +{ + /* Configure Flash prefetch */ +#if (PREFETCH_ENABLE != 0) +#if defined(STM32F101x6) || defined(STM32F101xB) || defined(STM32F101xE) || defined(STM32F101xG) || \ + defined(STM32F102x6) || defined(STM32F102xB) || \ + defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || \ + defined(STM32F105xC) || defined(STM32F107xC) + + /* Prefetch buffer is not available on value line devices */ + __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); +#endif +#endif /* PREFETCH_ENABLE */ + + /* Set Interrupt Group Priority */ + HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); + + /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */ + HAL_InitTick(TICK_INT_PRIORITY); + + /* Init the low level hardware */ + HAL_MspInit(); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief This function de-Initializes common part of the HAL and stops the systick. + * of time base. + * @note This function is optional. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DeInit(void) +{ + /* Reset of all peripherals */ + __HAL_RCC_APB1_FORCE_RESET(); + __HAL_RCC_APB1_RELEASE_RESET(); + + __HAL_RCC_APB2_FORCE_RESET(); + __HAL_RCC_APB2_RELEASE_RESET(); + +#if defined(STM32F105xC) || defined(STM32F107xC) + __HAL_RCC_AHB_FORCE_RESET(); + __HAL_RCC_AHB_RELEASE_RESET(); +#endif + + /* De-Init the low level hardware */ + HAL_MspDeInit(); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Initialize the MSP. + * @retval None + */ +__weak void HAL_MspInit(void) +{ + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes the MSP. + * @retval None + */ +__weak void HAL_MspDeInit(void) +{ + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief This function configures the source of the time base. + * The time source is configured to have 1ms time base with a dedicated + * Tick interrupt priority. + * @note This function is called automatically at the beginning of program after + * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig(). + * @note In the default implementation, SysTick timer is the source of time base. + * It is used to generate interrupts at regular time intervals. + * Care must be taken if HAL_Delay() is called from a peripheral ISR process, + * The SysTick interrupt must have higher priority (numerically lower) + * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. + * The function is declared as __weak to be overwritten in case of other + * implementation in user file. + * @param TickPriority Tick interrupt priority. + * @retval HAL status + */ +__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) +{ + /* Configure the SysTick to have interrupt in 1ms time basis*/ + if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U) + { + return HAL_ERROR; + } + + /* Configure the SysTick IRQ priority */ + if (TickPriority < (1UL << __NVIC_PRIO_BITS)) + { + HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U); + uwTickPrio = TickPriority; + } + else + { + return HAL_ERROR; + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup HAL_Exported_Functions_Group2 HAL Control functions + * @brief HAL Control functions + * +@verbatim + =============================================================================== + ##### HAL Control functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Provide a tick value in millisecond + (+) Provide a blocking delay in millisecond + (+) Suspend the time base source interrupt + (+) Resume the time base source interrupt + (+) Get the HAL API driver version + (+) Get the device identifier + (+) Get the device revision identifier + (+) Enable/Disable Debug module during SLEEP mode + (+) Enable/Disable Debug module during STOP mode + (+) Enable/Disable Debug module during STANDBY mode + +@endverbatim + * @{ + */ + +/** + * @brief This function is called to increment a global variable "uwTick" + * used as application time base. + * @note In the default implementation, this variable is incremented each 1ms + * in SysTick ISR. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_IncTick(void) +{ + uwTick += uwTickFreq; +} + +/** + * @brief Provides a tick value in millisecond. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval tick value + */ +__weak uint32_t HAL_GetTick(void) +{ + return uwTick; +} + +/** + * @brief This function returns a tick priority. + * @retval tick priority + */ +uint32_t HAL_GetTickPrio(void) +{ + return uwTickPrio; +} + +/** + * @brief Set new tick Freq. + * @retval status + */ +HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_TickFreqTypeDef prevTickFreq; + + assert_param(IS_TICKFREQ(Freq)); + + if (uwTickFreq != Freq) + { + /* Back up uwTickFreq frequency */ + prevTickFreq = uwTickFreq; + + /* Update uwTickFreq global variable used by HAL_InitTick() */ + uwTickFreq = Freq; + + /* Apply the new tick Freq */ + status = HAL_InitTick(uwTickPrio); + + if (status != HAL_OK) + { + /* Restore previous tick frequency */ + uwTickFreq = prevTickFreq; + } + } + + return status; +} + +/** + * @brief Return tick frequency. + * @retval tick period in Hz + */ +HAL_TickFreqTypeDef HAL_GetTickFreq(void) +{ + return uwTickFreq; +} + +/** + * @brief This function provides minimum delay (in milliseconds) based + * on variable incremented. + * @note In the default implementation , SysTick timer is the source of time base. + * It is used to generate interrupts at regular time intervals where uwTick + * is incremented. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @param Delay specifies the delay time length, in milliseconds. + * @retval None + */ +__weak void HAL_Delay(uint32_t Delay) +{ + uint32_t tickstart = HAL_GetTick(); + uint32_t wait = Delay; + + /* Add a freq to guarantee minimum wait */ + if (wait < HAL_MAX_DELAY) + { + wait += (uint32_t)(uwTickFreq); + } + + while ((HAL_GetTick() - tickstart) < wait) + { + } +} + +/** + * @brief Suspend Tick increment. + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once HAL_SuspendTick() + * is called, the SysTick interrupt will be disabled and so Tick increment + * is suspended. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_SuspendTick(void) +{ + /* Disable SysTick Interrupt */ + CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); +} + +/** + * @brief Resume Tick increment. + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once HAL_ResumeTick() + * is called, the SysTick interrupt will be enabled and so Tick increment + * is resumed. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @retval None + */ +__weak void HAL_ResumeTick(void) +{ + /* Enable SysTick Interrupt */ + SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); +} + +/** + * @brief Returns the HAL revision + * @retval version 0xXYZR (8bits for each decimal, R for RC) + */ +uint32_t HAL_GetHalVersion(void) +{ + return __STM32F1xx_HAL_VERSION; +} + +/** + * @brief Returns the device revision identifier. + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval Device revision identifier + */ +uint32_t HAL_GetREVID(void) +{ + return ((DBGMCU->IDCODE) >> DBGMCU_IDCODE_REV_ID_Pos); +} + +/** + * @brief Returns the device identifier. + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval Device identifier + */ +uint32_t HAL_GetDEVID(void) +{ + return ((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); +} + +/** + * @brief Returns first word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw0(void) +{ + return(READ_REG(*((uint32_t *)UID_BASE))); +} + +/** + * @brief Returns second word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw1(void) +{ + return(READ_REG(*((uint32_t *)(UID_BASE + 4U)))); +} + +/** + * @brief Returns third word of the unique device identifier (UID based on 96 bits) + * @retval Device identifier + */ +uint32_t HAL_GetUIDw2(void) +{ + return(READ_REG(*((uint32_t *)(UID_BASE + 8U)))); +} + +/** + * @brief Enable the Debug Module during SLEEP mode + * @retval None + */ +void HAL_DBGMCU_EnableDBGSleepMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Disable the Debug Module during SLEEP mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval None + */ +void HAL_DBGMCU_DisableDBGSleepMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); +} + +/** + * @brief Enable the Debug Module during STOP mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * Note: On all STM32F1 devices: + * If the system tick timer interrupt is enabled during the Stop mode + * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup + * the system from Stop mode. + * Workaround: To debug the Stop mode, disable the system tick timer + * interrupt. + * Refer to errata sheet of these devices for more details. + * Note: On all STM32F1 devices: + * If the system tick timer interrupt is enabled during the Stop mode + * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup + * the system from Stop mode. + * Workaround: To debug the Stop mode, disable the system tick timer + * interrupt. + * Refer to errata sheet of these devices for more details. + * @retval None + */ +void HAL_DBGMCU_EnableDBGStopMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Disable the Debug Module during STOP mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval None + */ +void HAL_DBGMCU_DisableDBGStopMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); +} + +/** + * @brief Enable the Debug Module during STANDBY mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval None + */ +void HAL_DBGMCU_EnableDBGStandbyMode(void) +{ + SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @brief Disable the Debug Module during STANDBY mode + * Note: On devices STM32F10xx8 and STM32F10xxB, + * STM32F101xC/D/E and STM32F103xC/D/E, + * STM32F101xF/G and STM32F103xF/G + * STM32F10xx4 and STM32F10xx6 + * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in + * debug mode (not accessible by the user software in normal mode). + * Refer to errata sheet of these devices for more details. + * @retval None + */ +void HAL_DBGMCU_DisableDBGStandbyMode(void) +{ + CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c new file mode 100644 index 0000000..331405e --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c @@ -0,0 +1,2436 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_can.c + * @author MCD Application Team + * @brief CAN HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Controller Area Network (CAN) peripheral: + * + Initialization and de-initialization functions + * + Configuration functions + * + Control functions + * + Interrupts management + * + Callbacks functions + * + Peripheral State and Error functions + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the CAN low level resources by implementing the + HAL_CAN_MspInit(): + (++) Enable the CAN interface clock using __HAL_RCC_CANx_CLK_ENABLE() + (++) Configure CAN pins + (+++) Enable the clock for the CAN GPIOs + (+++) Configure CAN pins as alternate function open-drain + (++) In case of using interrupts (e.g. HAL_CAN_ActivateNotification()) + (+++) Configure the CAN interrupt priority using + HAL_NVIC_SetPriority() + (+++) Enable the CAN IRQ handler using HAL_NVIC_EnableIRQ() + (+++) In CAN IRQ handler, call HAL_CAN_IRQHandler() + + (#) Initialize the CAN peripheral using HAL_CAN_Init() function. This + function resorts to HAL_CAN_MspInit() for low-level initialization. + + (#) Configure the reception filters using the following configuration + functions: + (++) HAL_CAN_ConfigFilter() + + (#) Start the CAN module using HAL_CAN_Start() function. At this level + the node is active on the bus: it receive messages, and can send + messages. + + (#) To manage messages transmission, the following Tx control functions + can be used: + (++) HAL_CAN_AddTxMessage() to request transmission of a new + message. + (++) HAL_CAN_AbortTxRequest() to abort transmission of a pending + message. + (++) HAL_CAN_GetTxMailboxesFreeLevel() to get the number of free Tx + mailboxes. + (++) HAL_CAN_IsTxMessagePending() to check if a message is pending + in a Tx mailbox. + (++) HAL_CAN_GetTxTimestamp() to get the timestamp of Tx message + sent, if time triggered communication mode is enabled. + + (#) When a message is received into the CAN Rx FIFOs, it can be retrieved + using the HAL_CAN_GetRxMessage() function. The function + HAL_CAN_GetRxFifoFillLevel() allows to know how many Rx message are + stored in the Rx Fifo. + + (#) Calling the HAL_CAN_Stop() function stops the CAN module. + + (#) The deinitialization is achieved with HAL_CAN_DeInit() function. + + + *** Polling mode operation *** + ============================== + [..] + (#) Reception: + (++) Monitor reception of message using HAL_CAN_GetRxFifoFillLevel() + until at least one message is received. + (++) Then get the message using HAL_CAN_GetRxMessage(). + + (#) Transmission: + (++) Monitor the Tx mailboxes availability until at least one Tx + mailbox is free, using HAL_CAN_GetTxMailboxesFreeLevel(). + (++) Then request transmission of a message using + HAL_CAN_AddTxMessage(). + + + *** Interrupt mode operation *** + ================================ + [..] + (#) Notifications are activated using HAL_CAN_ActivateNotification() + function. Then, the process can be controlled through the + available user callbacks: HAL_CAN_xxxCallback(), using same APIs + HAL_CAN_GetRxMessage() and HAL_CAN_AddTxMessage(). + + (#) Notifications can be deactivated using + HAL_CAN_DeactivateNotification() function. + + (#) Special care should be taken for CAN_IT_RX_FIFO0_MSG_PENDING and + CAN_IT_RX_FIFO1_MSG_PENDING notifications. These notifications trig + the callbacks HAL_CAN_RxFIFO0MsgPendingCallback() and + HAL_CAN_RxFIFO1MsgPendingCallback(). User has two possible options + here. + (++) Directly get the Rx message in the callback, using + HAL_CAN_GetRxMessage(). + (++) Or deactivate the notification in the callback without + getting the Rx message. The Rx message can then be got later + using HAL_CAN_GetRxMessage(). Once the Rx message have been + read, the notification can be activated again. + + + *** Sleep mode *** + ================== + [..] + (#) The CAN peripheral can be put in sleep mode (low power), using + HAL_CAN_RequestSleep(). The sleep mode will be entered as soon as the + current CAN activity (transmission or reception of a CAN frame) will + be completed. + + (#) A notification can be activated to be informed when the sleep mode + will be entered. + + (#) It can be checked if the sleep mode is entered using + HAL_CAN_IsSleepActive(). + Note that the CAN state (accessible from the API HAL_CAN_GetState()) + is HAL_CAN_STATE_SLEEP_PENDING as soon as the sleep mode request is + submitted (the sleep mode is not yet entered), and become + HAL_CAN_STATE_SLEEP_ACTIVE when the sleep mode is effective. + + (#) The wake-up from sleep mode can be triggered by two ways: + (++) Using HAL_CAN_WakeUp(). When returning from this function, + the sleep mode is exited (if return status is HAL_OK). + (++) When a start of Rx CAN frame is detected by the CAN peripheral, + if automatic wake up mode is enabled. + + *** Callback registration *** + ============================================= + + The compilation define USE_HAL_CAN_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + Use Function @ref HAL_CAN_RegisterCallback() to register an interrupt callback. + + Function @ref HAL_CAN_RegisterCallback() allows to register following callbacks: + (+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback. + (+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback. + (+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback. + (+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback. + (+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback. + (+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback. + (+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback. + (+) RxFifo0FullCallback : Rx Fifo 0 Full Callback. + (+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback. + (+) RxFifo1FullCallback : Rx Fifo 1 Full Callback. + (+) SleepCallback : Sleep Callback. + (+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback. + (+) ErrorCallback : Error Callback. + (+) MspInitCallback : CAN MspInit. + (+) MspDeInitCallback : CAN MspDeInit. + This function takes as parameters the HAL peripheral handle, the Callback ID + and a pointer to the user callback function. + + Use function @ref HAL_CAN_UnRegisterCallback() to reset a callback to the default + weak function. + @ref HAL_CAN_UnRegisterCallback takes as parameters the HAL peripheral handle, + and the Callback ID. + This function allows to reset following callbacks: + (+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback. + (+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback. + (+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback. + (+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback. + (+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback. + (+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback. + (+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback. + (+) RxFifo0FullCallback : Rx Fifo 0 Full Callback. + (+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback. + (+) RxFifo1FullCallback : Rx Fifo 1 Full Callback. + (+) SleepCallback : Sleep Callback. + (+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback. + (+) ErrorCallback : Error Callback. + (+) MspInitCallback : CAN MspInit. + (+) MspDeInitCallback : CAN MspDeInit. + + By default, after the @ref HAL_CAN_Init() and when the state is HAL_CAN_STATE_RESET, + all callbacks are set to the corresponding weak functions: + example @ref HAL_CAN_ErrorCallback(). + Exception done for MspInit and MspDeInit functions that are + reset to the legacy weak function in the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit() only when + these callbacks are null (not registered beforehand). + if not, MspInit or MspDeInit are not null, the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit() + keep and use the user MspInit/MspDeInit callbacks (registered beforehand) + + Callbacks can be registered/unregistered in HAL_CAN_STATE_READY state only. + Exception done MspInit/MspDeInit that can be registered/unregistered + in HAL_CAN_STATE_READY or HAL_CAN_STATE_RESET state, + thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_CAN_RegisterCallback() before calling @ref HAL_CAN_DeInit() + or @ref HAL_CAN_Init() function. + + When The compilation define USE_HAL_CAN_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registration feature is not available and all callbacks + are set to the corresponding weak functions. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +#if defined(CAN1) + +/** @defgroup CAN CAN + * @brief CAN driver modules + * @{ + */ + +#ifdef HAL_CAN_MODULE_ENABLED + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #error "The CAN driver cannot be used with its legacy, Please enable only one CAN module at once" +#endif + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup CAN_Private_Constants CAN Private Constants + * @{ + */ +#define CAN_TIMEOUT_VALUE 10U +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup CAN_Exported_Functions CAN Exported Functions + * @{ + */ + +/** @defgroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_Init : Initialize and configure the CAN. + (+) HAL_CAN_DeInit : De-initialize the CAN. + (+) HAL_CAN_MspInit : Initialize the CAN MSP. + (+) HAL_CAN_MspDeInit : DeInitialize the CAN MSP. + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the CAN peripheral according to the specified + * parameters in the CAN_InitStruct. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + /* Check CAN handle */ + if (hcan == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_CAN_ALL_INSTANCE(hcan->Instance)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.TimeTriggeredMode)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoBusOff)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoWakeUp)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.AutoRetransmission)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.ReceiveFifoLocked)); + assert_param(IS_FUNCTIONAL_STATE(hcan->Init.TransmitFifoPriority)); + assert_param(IS_CAN_MODE(hcan->Init.Mode)); + assert_param(IS_CAN_SJW(hcan->Init.SyncJumpWidth)); + assert_param(IS_CAN_BS1(hcan->Init.TimeSeg1)); + assert_param(IS_CAN_BS2(hcan->Init.TimeSeg2)); + assert_param(IS_CAN_PRESCALER(hcan->Init.Prescaler)); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + if (hcan->State == HAL_CAN_STATE_RESET) + { + /* Reset callbacks to legacy functions */ + hcan->RxFifo0MsgPendingCallback = HAL_CAN_RxFifo0MsgPendingCallback; /* Legacy weak RxFifo0MsgPendingCallback */ + hcan->RxFifo0FullCallback = HAL_CAN_RxFifo0FullCallback; /* Legacy weak RxFifo0FullCallback */ + hcan->RxFifo1MsgPendingCallback = HAL_CAN_RxFifo1MsgPendingCallback; /* Legacy weak RxFifo1MsgPendingCallback */ + hcan->RxFifo1FullCallback = HAL_CAN_RxFifo1FullCallback; /* Legacy weak RxFifo1FullCallback */ + hcan->TxMailbox0CompleteCallback = HAL_CAN_TxMailbox0CompleteCallback; /* Legacy weak TxMailbox0CompleteCallback */ + hcan->TxMailbox1CompleteCallback = HAL_CAN_TxMailbox1CompleteCallback; /* Legacy weak TxMailbox1CompleteCallback */ + hcan->TxMailbox2CompleteCallback = HAL_CAN_TxMailbox2CompleteCallback; /* Legacy weak TxMailbox2CompleteCallback */ + hcan->TxMailbox0AbortCallback = HAL_CAN_TxMailbox0AbortCallback; /* Legacy weak TxMailbox0AbortCallback */ + hcan->TxMailbox1AbortCallback = HAL_CAN_TxMailbox1AbortCallback; /* Legacy weak TxMailbox1AbortCallback */ + hcan->TxMailbox2AbortCallback = HAL_CAN_TxMailbox2AbortCallback; /* Legacy weak TxMailbox2AbortCallback */ + hcan->SleepCallback = HAL_CAN_SleepCallback; /* Legacy weak SleepCallback */ + hcan->WakeUpFromRxMsgCallback = HAL_CAN_WakeUpFromRxMsgCallback; /* Legacy weak WakeUpFromRxMsgCallback */ + hcan->ErrorCallback = HAL_CAN_ErrorCallback; /* Legacy weak ErrorCallback */ + + if (hcan->MspInitCallback == NULL) + { + hcan->MspInitCallback = HAL_CAN_MspInit; /* Legacy weak MspInit */ + } + + /* Init the low level hardware: CLOCK, NVIC */ + hcan->MspInitCallback(hcan); + } + +#else + if (hcan->State == HAL_CAN_STATE_RESET) + { + /* Init the low level hardware: CLOCK, NVIC */ + HAL_CAN_MspInit(hcan); + } +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ + + /* Request initialisation */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait initialisation acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Exit from sleep mode */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Check Sleep mode leave acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Set the time triggered communication mode */ + if (hcan->Init.TimeTriggeredMode == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TTCM); + } + + /* Set the automatic bus-off management */ + if (hcan->Init.AutoBusOff == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_ABOM); + } + + /* Set the automatic wake-up mode */ + if (hcan->Init.AutoWakeUp == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_AWUM); + } + + /* Set the automatic retransmission */ + if (hcan->Init.AutoRetransmission == ENABLE) + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_NART); + } + else + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_NART); + } + + /* Set the receive FIFO locked mode */ + if (hcan->Init.ReceiveFifoLocked == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_RFLM); + } + + /* Set the transmit FIFO priority */ + if (hcan->Init.TransmitFifoPriority == ENABLE) + { + SET_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + } + else + { + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_TXFP); + } + + /* Set the bit timing register */ + WRITE_REG(hcan->Instance->BTR, (uint32_t)(hcan->Init.Mode | + hcan->Init.SyncJumpWidth | + hcan->Init.TimeSeg1 | + hcan->Init.TimeSeg2 | + (hcan->Init.Prescaler - 1U))); + + /* Initialize the error code */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Initialize the CAN state */ + hcan->State = HAL_CAN_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Deinitializes the CAN peripheral registers to their default + * reset values. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan) +{ + /* Check CAN handle */ + if (hcan == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_CAN_ALL_INSTANCE(hcan->Instance)); + + /* Stop the CAN module */ + (void)HAL_CAN_Stop(hcan); + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + if (hcan->MspDeInitCallback == NULL) + { + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; /* Legacy weak MspDeInit */ + } + + /* DeInit the low level hardware: CLOCK, NVIC */ + hcan->MspDeInitCallback(hcan); + +#else + /* DeInit the low level hardware: CLOCK, NVIC */ + HAL_CAN_MspDeInit(hcan); +#endif /* (USE_HAL_CAN_REGISTER_CALLBACKS) */ + + /* Reset the CAN peripheral */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_RESET); + + /* Reset the CAN ErrorCode */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_RESET; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Initializes the CAN MSP. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes the CAN MSP. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_MspDeInit could be implemented in the user file + */ +} + +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 +/** + * @brief Register a CAN CallBack. + * To be used instead of the weak predefined callback + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for CAN module + * @param CallbackID ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID Tx Mailbox 0 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID Tx Mailbox 1 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID Tx Mailbox 2 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX0_ABORT_CB_ID Tx Mailbox 0 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_ABORT_CB_ID Tx Mailbox 1 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_ABORT_CB_ID Tx Mailbox 2 Abort callback ID + * @arg @ref HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID Rx Fifo 0 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO0_FULL_CB_ID Rx Fifo 0 full callback ID + * @arg @ref HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID Rx Fifo 1 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO1_FULL_CB_ID Rx Fifo 1 full callback ID + * @arg @ref HAL_CAN_SLEEP_CB_ID Sleep callback ID + * @arg @ref HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID Wake Up from Rx message callback ID + * @arg @ref HAL_CAN_ERROR_CB_ID Error callback ID + * @arg @ref HAL_CAN_MSPINIT_CB_ID MspInit callback ID + * @arg @ref HAL_CAN_MSPDEINIT_CB_ID MspDeInit callback ID + * @param pCallback pointer to the Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID, void (* pCallback)(CAN_HandleTypeDef *_hcan)) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + if (hcan->State == HAL_CAN_STATE_READY) + { + switch (CallbackID) + { + case HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID : + hcan->TxMailbox0CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID : + hcan->TxMailbox1CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID : + hcan->TxMailbox2CompleteCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX0_ABORT_CB_ID : + hcan->TxMailbox0AbortCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX1_ABORT_CB_ID : + hcan->TxMailbox1AbortCallback = pCallback; + break; + + case HAL_CAN_TX_MAILBOX2_ABORT_CB_ID : + hcan->TxMailbox2AbortCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID : + hcan->RxFifo0MsgPendingCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO0_FULL_CB_ID : + hcan->RxFifo0FullCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID : + hcan->RxFifo1MsgPendingCallback = pCallback; + break; + + case HAL_CAN_RX_FIFO1_FULL_CB_ID : + hcan->RxFifo1FullCallback = pCallback; + break; + + case HAL_CAN_SLEEP_CB_ID : + hcan->SleepCallback = pCallback; + break; + + case HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID : + hcan->WakeUpFromRxMsgCallback = pCallback; + break; + + case HAL_CAN_ERROR_CB_ID : + hcan->ErrorCallback = pCallback; + break; + + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = pCallback; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hcan->State == HAL_CAN_STATE_RESET) + { + switch (CallbackID) + { + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = pCallback; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + return status; +} + +/** + * @brief Unregister a CAN CallBack. + * CAN callabck is redirected to the weak predefined callback + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for CAN module + * @param CallbackID ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID Tx Mailbox 0 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID Tx Mailbox 1 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID Tx Mailbox 2 Complete callback ID + * @arg @ref HAL_CAN_TX_MAILBOX0_ABORT_CB_ID Tx Mailbox 0 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX1_ABORT_CB_ID Tx Mailbox 1 Abort callback ID + * @arg @ref HAL_CAN_TX_MAILBOX2_ABORT_CB_ID Tx Mailbox 2 Abort callback ID + * @arg @ref HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID Rx Fifo 0 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO0_FULL_CB_ID Rx Fifo 0 full callback ID + * @arg @ref HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID Rx Fifo 1 message pending callback ID + * @arg @ref HAL_CAN_RX_FIFO1_FULL_CB_ID Rx Fifo 1 full callback ID + * @arg @ref HAL_CAN_SLEEP_CB_ID Sleep callback ID + * @arg @ref HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID Wake Up from Rx message callback ID + * @arg @ref HAL_CAN_ERROR_CB_ID Error callback ID + * @arg @ref HAL_CAN_MSPINIT_CB_ID MspInit callback ID + * @arg @ref HAL_CAN_MSPDEINIT_CB_ID MspDeInit callback ID + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_UnRegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (hcan->State == HAL_CAN_STATE_READY) + { + switch (CallbackID) + { + case HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID : + hcan->TxMailbox0CompleteCallback = HAL_CAN_TxMailbox0CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID : + hcan->TxMailbox1CompleteCallback = HAL_CAN_TxMailbox1CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID : + hcan->TxMailbox2CompleteCallback = HAL_CAN_TxMailbox2CompleteCallback; + break; + + case HAL_CAN_TX_MAILBOX0_ABORT_CB_ID : + hcan->TxMailbox0AbortCallback = HAL_CAN_TxMailbox0AbortCallback; + break; + + case HAL_CAN_TX_MAILBOX1_ABORT_CB_ID : + hcan->TxMailbox1AbortCallback = HAL_CAN_TxMailbox1AbortCallback; + break; + + case HAL_CAN_TX_MAILBOX2_ABORT_CB_ID : + hcan->TxMailbox2AbortCallback = HAL_CAN_TxMailbox2AbortCallback; + break; + + case HAL_CAN_RX_FIFO0_MSG_PENDING_CB_ID : + hcan->RxFifo0MsgPendingCallback = HAL_CAN_RxFifo0MsgPendingCallback; + break; + + case HAL_CAN_RX_FIFO0_FULL_CB_ID : + hcan->RxFifo0FullCallback = HAL_CAN_RxFifo0FullCallback; + break; + + case HAL_CAN_RX_FIFO1_MSG_PENDING_CB_ID : + hcan->RxFifo1MsgPendingCallback = HAL_CAN_RxFifo1MsgPendingCallback; + break; + + case HAL_CAN_RX_FIFO1_FULL_CB_ID : + hcan->RxFifo1FullCallback = HAL_CAN_RxFifo1FullCallback; + break; + + case HAL_CAN_SLEEP_CB_ID : + hcan->SleepCallback = HAL_CAN_SleepCallback; + break; + + case HAL_CAN_WAKEUP_FROM_RX_MSG_CB_ID : + hcan->WakeUpFromRxMsgCallback = HAL_CAN_WakeUpFromRxMsgCallback; + break; + + case HAL_CAN_ERROR_CB_ID : + hcan->ErrorCallback = HAL_CAN_ErrorCallback; + break; + + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = HAL_CAN_MspInit; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hcan->State == HAL_CAN_STATE_RESET) + { + switch (CallbackID) + { + case HAL_CAN_MSPINIT_CB_ID : + hcan->MspInitCallback = HAL_CAN_MspInit; + break; + + case HAL_CAN_MSPDEINIT_CB_ID : + hcan->MspDeInitCallback = HAL_CAN_MspDeInit; + break; + + default : + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + return status; +} +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group2 Configuration functions + * @brief Configuration functions. + * +@verbatim + ============================================================================== + ##### Configuration functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_ConfigFilter : Configure the CAN reception filters + +@endverbatim + * @{ + */ + +/** + * @brief Configures the CAN reception filter according to the specified + * parameters in the CAN_FilterInitStruct. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param sFilterConfig pointer to a CAN_FilterTypeDef structure that + * contains the filter configuration information. + * @retval None + */ +HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig) +{ + uint32_t filternbrbitpos; + CAN_TypeDef *can_ip = hcan->Instance; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check the parameters */ + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterIdHigh)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterIdLow)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterMaskIdHigh)); + assert_param(IS_CAN_FILTER_ID_HALFWORD(sFilterConfig->FilterMaskIdLow)); + assert_param(IS_CAN_FILTER_MODE(sFilterConfig->FilterMode)); + assert_param(IS_CAN_FILTER_SCALE(sFilterConfig->FilterScale)); + assert_param(IS_CAN_FILTER_FIFO(sFilterConfig->FilterFIFOAssignment)); + assert_param(IS_CAN_FILTER_ACTIVATION(sFilterConfig->FilterActivation)); + +#if defined(CAN2) + /* CAN1 and CAN2 are dual instances with 28 common filters banks */ + /* Select master instance to access the filter banks */ + can_ip = CAN1; + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->FilterBank)); + assert_param(IS_CAN_FILTER_BANK_DUAL(sFilterConfig->SlaveStartFilterBank)); +#else + /* CAN1 is single instance with 14 dedicated filters banks */ + + /* Check the parameters */ + assert_param(IS_CAN_FILTER_BANK_SINGLE(sFilterConfig->FilterBank)); +#endif + + /* Initialisation mode for the filter */ + SET_BIT(can_ip->FMR, CAN_FMR_FINIT); + +#if defined(CAN2) + /* Select the start filter number of CAN2 slave instance */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_CAN2SB); + SET_BIT(can_ip->FMR, sFilterConfig->SlaveStartFilterBank << CAN_FMR_CAN2SB_Pos); + +#endif + /* Convert filter number into bit position */ + filternbrbitpos = (uint32_t)1 << (sFilterConfig->FilterBank & 0x1FU); + + /* Filter Deactivation */ + CLEAR_BIT(can_ip->FA1R, filternbrbitpos); + + /* Filter Scale */ + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_16BIT) + { + /* 16-bit scale for the filter */ + CLEAR_BIT(can_ip->FS1R, filternbrbitpos); + + /* First 16-bit identifier and First 16-bit mask */ + /* Or First 16-bit identifier and Second 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + + /* Second 16-bit identifier and Second 16-bit mask */ + /* Or Third 16-bit identifier and Fourth 16-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh); + } + + if (sFilterConfig->FilterScale == CAN_FILTERSCALE_32BIT) + { + /* 32-bit scale for the filter */ + SET_BIT(can_ip->FS1R, filternbrbitpos); + + /* 32-bit identifier or First 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR1 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); + + /* 32-bit mask or Second 32-bit identifier */ + can_ip->sFilterRegister[sFilterConfig->FilterBank].FR2 = + ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | + (0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow); + } + + /* Filter Mode */ + if (sFilterConfig->FilterMode == CAN_FILTERMODE_IDMASK) + { + /* Id/Mask mode for the filter*/ + CLEAR_BIT(can_ip->FM1R, filternbrbitpos); + } + else /* CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdList */ + { + /* Identifier list mode for the filter*/ + SET_BIT(can_ip->FM1R, filternbrbitpos); + } + + /* Filter FIFO assignment */ + if (sFilterConfig->FilterFIFOAssignment == CAN_FILTER_FIFO0) + { + /* FIFO 0 assignation for the filter */ + CLEAR_BIT(can_ip->FFA1R, filternbrbitpos); + } + else + { + /* FIFO 1 assignation for the filter */ + SET_BIT(can_ip->FFA1R, filternbrbitpos); + } + + /* Filter activation */ + if (sFilterConfig->FilterActivation == CAN_FILTER_ENABLE) + { + SET_BIT(can_ip->FA1R, filternbrbitpos); + } + + /* Leave the initialisation mode for the filter */ + CLEAR_BIT(can_ip->FMR, CAN_FMR_FINIT); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group3 Control functions + * @brief Control functions + * +@verbatim + ============================================================================== + ##### Control functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_Start : Start the CAN module + (+) HAL_CAN_Stop : Stop the CAN module + (+) HAL_CAN_RequestSleep : Request sleep mode entry. + (+) HAL_CAN_WakeUp : Wake up from sleep mode. + (+) HAL_CAN_IsSleepActive : Check is sleep mode is active. + (+) HAL_CAN_AddTxMessage : Add a message to the Tx mailboxes + and activate the corresponding + transmission request + (+) HAL_CAN_AbortTxRequest : Abort transmission request + (+) HAL_CAN_GetTxMailboxesFreeLevel : Return Tx mailboxes free level + (+) HAL_CAN_IsTxMessagePending : Check if a transmission request is + pending on the selected Tx mailbox + (+) HAL_CAN_GetRxMessage : Get a CAN frame from the Rx FIFO + (+) HAL_CAN_GetRxFifoFillLevel : Return Rx FIFO fill level + +@endverbatim + * @{ + */ + +/** + * @brief Start the CAN module. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + if (hcan->State == HAL_CAN_STATE_READY) + { + /* Change CAN peripheral state */ + hcan->State = HAL_CAN_STATE_LISTENING; + + /* Request leave initialisation */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait the acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) != 0U) + { + /* Check for the Timeout */ + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Reset the CAN ErrorCode */ + hcan->ErrorCode = HAL_CAN_ERROR_NONE; + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_READY; + + return HAL_ERROR; + } +} + +/** + * @brief Stop the CAN module and enable access to configuration registers. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan) +{ + uint32_t tickstart; + + if (hcan->State == HAL_CAN_STATE_LISTENING) + { + /* Request initialisation */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_INRQ); + + /* Get tick */ + tickstart = HAL_GetTick(); + + /* Wait the acknowledge */ + while ((hcan->Instance->MSR & CAN_MSR_INAK) == 0U) + { + /* Check for the Timeout */ + if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + /* Change CAN state */ + hcan->State = HAL_CAN_STATE_ERROR; + + return HAL_ERROR; + } + } + + /* Exit from sleep mode */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Change CAN peripheral state */ + hcan->State = HAL_CAN_STATE_READY; + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_STARTED; + + return HAL_ERROR; + } +} + +/** + * @brief Request the sleep mode (low power) entry. + * When returning from this function, Sleep mode will be entered + * as soon as the current CAN activity (transmission or reception + * of a CAN frame) has been completed. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status. + */ +HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Request Sleep mode */ + SET_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + /* Return function status */ + return HAL_ERROR; + } +} + +/** + * @brief Wake up from sleep mode. + * When returning with HAL_OK status from this function, Sleep mode + * is exited. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status. + */ +HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan) +{ + __IO uint32_t count = 0; + uint32_t timeout = 1000000U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Wake up request */ + CLEAR_BIT(hcan->Instance->MCR, CAN_MCR_SLEEP); + + /* Wait sleep mode is exited */ + do + { + /* Increment counter */ + count++; + + /* Check if timeout is reached */ + if (count > timeout) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT; + + return HAL_ERROR; + } + } + while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Check is sleep mode is active. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval Status + * - 0 : Sleep mode is not active. + * - 1 : Sleep mode is active. + */ +uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan) +{ + uint32_t status = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Sleep mode */ + if ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + status = 1U; + } + } + + /* Return function status */ + return status; +} + +/** + * @brief Add a message to the first free Tx mailbox and activate the + * corresponding transmission request. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param pHeader pointer to a CAN_TxHeaderTypeDef structure. + * @param aData array containing the payload of the Tx frame. + * @param pTxMailbox pointer to a variable where the function will return + * the TxMailbox used to store the Tx message. + * This parameter can be a value of @arg CAN_Tx_Mailboxes. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox) +{ + uint32_t transmitmailbox; + HAL_CAN_StateTypeDef state = hcan->State; + uint32_t tsr = READ_REG(hcan->Instance->TSR); + + /* Check the parameters */ + assert_param(IS_CAN_IDTYPE(pHeader->IDE)); + assert_param(IS_CAN_RTR(pHeader->RTR)); + assert_param(IS_CAN_DLC(pHeader->DLC)); + if (pHeader->IDE == CAN_ID_STD) + { + assert_param(IS_CAN_STDID(pHeader->StdId)); + } + else + { + assert_param(IS_CAN_EXTID(pHeader->ExtId)); + } + assert_param(IS_FUNCTIONAL_STATE(pHeader->TransmitGlobalTime)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check that all the Tx mailboxes are not full */ + if (((tsr & CAN_TSR_TME0) != 0U) || + ((tsr & CAN_TSR_TME1) != 0U) || + ((tsr & CAN_TSR_TME2) != 0U)) + { + /* Select an empty transmit mailbox */ + transmitmailbox = (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos; + + /* Check transmit mailbox value */ + if (transmitmailbox > 2U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_INTERNAL; + + return HAL_ERROR; + } + + /* Store the Tx mailbox */ + *pTxMailbox = (uint32_t)1 << transmitmailbox; + + /* Set up the Id */ + if (pHeader->IDE == CAN_ID_STD) + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->StdId << CAN_TI0R_STID_Pos) | + pHeader->RTR); + } + else + { + hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | + pHeader->IDE | + pHeader->RTR); + } + + /* Set up the DLC */ + hcan->Instance->sTxMailBox[transmitmailbox].TDTR = (pHeader->DLC); + + /* Set up the Transmit Global Time mode */ + if (pHeader->TransmitGlobalTime == ENABLE) + { + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TDTR, CAN_TDT0R_TGT); + } + + /* Set up the data field */ + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDHR, + ((uint32_t)aData[7] << CAN_TDH0R_DATA7_Pos) | + ((uint32_t)aData[6] << CAN_TDH0R_DATA6_Pos) | + ((uint32_t)aData[5] << CAN_TDH0R_DATA5_Pos) | + ((uint32_t)aData[4] << CAN_TDH0R_DATA4_Pos)); + WRITE_REG(hcan->Instance->sTxMailBox[transmitmailbox].TDLR, + ((uint32_t)aData[3] << CAN_TDL0R_DATA3_Pos) | + ((uint32_t)aData[2] << CAN_TDL0R_DATA2_Pos) | + ((uint32_t)aData[1] << CAN_TDL0R_DATA1_Pos) | + ((uint32_t)aData[0] << CAN_TDL0R_DATA0_Pos)); + + /* Request transmission */ + SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TIR, CAN_TI0R_TXRQ); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Abort transmission requests + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailboxes List of the Tx Mailboxes to abort. + * This parameter can be any combination of @arg CAN_Tx_Mailboxes. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX_LIST(TxMailboxes)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Tx Mailbox 0 */ + if ((TxMailboxes & CAN_TX_MAILBOX0) != 0U) + { + /* Add cancellation request for Tx Mailbox 0 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ0); + } + + /* Check Tx Mailbox 1 */ + if ((TxMailboxes & CAN_TX_MAILBOX1) != 0U) + { + /* Add cancellation request for Tx Mailbox 1 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ1); + } + + /* Check Tx Mailbox 2 */ + if ((TxMailboxes & CAN_TX_MAILBOX2) != 0U) + { + /* Add cancellation request for Tx Mailbox 2 */ + SET_BIT(hcan->Instance->TSR, CAN_TSR_ABRQ2); + } + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Return Tx Mailboxes free level: number of free Tx Mailboxes. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval Number of free Tx Mailboxes. + */ +uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan) +{ + uint32_t freelevel = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check Tx Mailbox 0 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME0) != 0U) + { + freelevel++; + } + + /* Check Tx Mailbox 1 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME1) != 0U) + { + freelevel++; + } + + /* Check Tx Mailbox 2 status */ + if ((hcan->Instance->TSR & CAN_TSR_TME2) != 0U) + { + freelevel++; + } + } + + /* Return Tx Mailboxes free level */ + return freelevel; +} + +/** + * @brief Check if a transmission request is pending on the selected Tx + * Mailboxes. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailboxes List of Tx Mailboxes to check. + * This parameter can be any combination of @arg CAN_Tx_Mailboxes. + * @retval Status + * - 0 : No pending transmission request on any selected Tx Mailboxes. + * - 1 : Pending transmission request on at least one of the selected + * Tx Mailbox. + */ +uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes) +{ + uint32_t status = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX_LIST(TxMailboxes)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check pending transmission request on the selected Tx Mailboxes */ + if ((hcan->Instance->TSR & (TxMailboxes << CAN_TSR_TME0_Pos)) != (TxMailboxes << CAN_TSR_TME0_Pos)) + { + status = 1U; + } + } + + /* Return status */ + return status; +} + +/** + * @brief Return timestamp of Tx message sent, if time triggered communication + mode is enabled. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param TxMailbox Tx Mailbox where the timestamp of message sent will be + * read. + * This parameter can be one value of @arg CAN_Tx_Mailboxes. + * @retval Timestamp of message sent from Tx Mailbox. + */ +uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox) +{ + uint32_t timestamp = 0U; + uint32_t transmitmailbox; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_TX_MAILBOX(TxMailbox)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Select the Tx mailbox */ + transmitmailbox = POSITION_VAL(TxMailbox); + + /* Get timestamp */ + timestamp = (hcan->Instance->sTxMailBox[transmitmailbox].TDTR & CAN_TDT0R_TIME) >> CAN_TDT0R_TIME_Pos; + } + + /* Return the timestamp */ + return timestamp; +} + +/** + * @brief Get an CAN frame from the Rx FIFO zone into the message RAM. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param RxFifo Fifo number of the received message to be read. + * This parameter can be a value of @arg CAN_receive_FIFO_number. + * @param pHeader pointer to a CAN_RxHeaderTypeDef structure where the header + * of the Rx frame will be stored. + * @param aData array where the payload of the Rx frame will be stored. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check the Rx FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + { + /* Check that the Rx FIFO 0 is not empty */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) == 0U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Check that the Rx FIFO 1 is not empty */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) == 0U) + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; + + return HAL_ERROR; + } + } + + /* Get the header */ + pHeader->IDE = CAN_RI0R_IDE & hcan->Instance->sFIFOMailBox[RxFifo].RIR; + if (pHeader->IDE == CAN_ID_STD) + { + pHeader->StdId = (CAN_RI0R_STID & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_TI0R_STID_Pos; + } + else + { + pHeader->ExtId = ((CAN_RI0R_EXID | CAN_RI0R_STID) & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_EXID_Pos; + } + pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR); + pHeader->DLC = (CAN_RDT0R_DLC & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_DLC_Pos; + pHeader->FilterMatchIndex = (CAN_RDT0R_FMI & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_FMI_Pos; + pHeader->Timestamp = (CAN_RDT0R_TIME & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_TIME_Pos; + + /* Get the data */ + aData[0] = (uint8_t)((CAN_RDL0R_DATA0 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA0_Pos); + aData[1] = (uint8_t)((CAN_RDL0R_DATA1 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA1_Pos); + aData[2] = (uint8_t)((CAN_RDL0R_DATA2 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA2_Pos); + aData[3] = (uint8_t)((CAN_RDL0R_DATA3 & hcan->Instance->sFIFOMailBox[RxFifo].RDLR) >> CAN_RDL0R_DATA3_Pos); + aData[4] = (uint8_t)((CAN_RDH0R_DATA4 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA4_Pos); + aData[5] = (uint8_t)((CAN_RDH0R_DATA5 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA5_Pos); + aData[6] = (uint8_t)((CAN_RDH0R_DATA6 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA6_Pos); + aData[7] = (uint8_t)((CAN_RDH0R_DATA7 & hcan->Instance->sFIFOMailBox[RxFifo].RDHR) >> CAN_RDH0R_DATA7_Pos); + + /* Release the FIFO */ + if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ + { + /* Release RX FIFO 0 */ + SET_BIT(hcan->Instance->RF0R, CAN_RF0R_RFOM0); + } + else /* Rx element is assigned to Rx FIFO 1 */ + { + /* Release RX FIFO 1 */ + SET_BIT(hcan->Instance->RF1R, CAN_RF1R_RFOM1); + } + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Return Rx FIFO fill level. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param RxFifo Rx FIFO. + * This parameter can be a value of @arg CAN_receive_FIFO_number. + * @retval Number of messages available in Rx FIFO. + */ +uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo) +{ + uint32_t filllevel = 0U; + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_RX_FIFO(RxFifo)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + if (RxFifo == CAN_RX_FIFO0) + { + filllevel = hcan->Instance->RF0R & CAN_RF0R_FMP0; + } + else /* RxFifo == CAN_RX_FIFO1 */ + { + filllevel = hcan->Instance->RF1R & CAN_RF1R_FMP1; + } + } + + /* Return Rx FIFO fill level */ + return filllevel; +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group4 Interrupts management + * @brief Interrupts management + * +@verbatim + ============================================================================== + ##### Interrupts management ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) HAL_CAN_ActivateNotification : Enable interrupts + (+) HAL_CAN_DeactivateNotification : Disable interrupts + (+) HAL_CAN_IRQHandler : Handles CAN interrupt request + +@endverbatim + * @{ + */ + +/** + * @brief Enable interrupts. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param ActiveITs indicates which interrupts will be enabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_IT(ActiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Enable the selected interrupts */ + __HAL_CAN_ENABLE_IT(hcan, ActiveITs); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Disable interrupts. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @param InactiveITs indicates which interrupts will be disabled. + * This parameter can be any combination of @arg CAN_Interrupts. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + /* Check function parameters */ + assert_param(IS_CAN_IT(InactiveITs)); + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Disable the selected interrupts */ + __HAL_CAN_DISABLE_IT(hcan, InactiveITs); + + /* Return function status */ + return HAL_OK; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + return HAL_ERROR; + } +} + +/** + * @brief Handles CAN interrupt request + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan) +{ + uint32_t errorcode = HAL_CAN_ERROR_NONE; + uint32_t interrupts = READ_REG(hcan->Instance->IER); + uint32_t msrflags = READ_REG(hcan->Instance->MSR); + uint32_t tsrflags = READ_REG(hcan->Instance->TSR); + uint32_t rf0rflags = READ_REG(hcan->Instance->RF0R); + uint32_t rf1rflags = READ_REG(hcan->Instance->RF1R); + uint32_t esrflags = READ_REG(hcan->Instance->ESR); + + /* Transmit Mailbox empty interrupt management *****************************/ + if ((interrupts & CAN_IT_TX_MAILBOX_EMPTY) != 0U) + { + /* Transmit Mailbox 0 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP0) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK0,ALST0,TERR0 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP0); + + if ((tsrflags & CAN_TSR_TXOK0) != 0U) + { + /* Transmission Mailbox 0 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST0) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST0; + } + else if ((tsrflags & CAN_TSR_TERR0) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR0; + } + else + { + /* Transmission Mailbox 0 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox0AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox0AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + + /* Transmit Mailbox 1 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP1) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK1,ALST1,TERR1 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP1); + + if ((tsrflags & CAN_TSR_TXOK1) != 0U) + { + /* Transmission Mailbox 1 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST1) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST1; + } + else if ((tsrflags & CAN_TSR_TERR1) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR1; + } + else + { + /* Transmission Mailbox 1 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox1AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox1AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + + /* Transmit Mailbox 2 management *****************************************/ + if ((tsrflags & CAN_TSR_RQCP2) != 0U) + { + /* Clear the Transmission Complete flag (and TXOK2,ALST2,TERR2 bits) */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_RQCP2); + + if ((tsrflags & CAN_TSR_TXOK2) != 0U) + { + /* Transmission Mailbox 2 complete callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2CompleteCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2CompleteCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + else + { + if ((tsrflags & CAN_TSR_ALST2) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_ALST2; + } + else if ((tsrflags & CAN_TSR_TERR2) != 0U) + { + /* Update error code */ + errorcode |= HAL_CAN_ERROR_TX_TERR2; + } + else + { + /* Transmission Mailbox 2 abort callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->TxMailbox2AbortCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_TxMailbox2AbortCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + } + } + + /* Receive FIFO 0 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO0_OVERRUN) != 0U) + { + if ((rf0rflags & CAN_RF0R_FOVR0) != 0U) + { + /* Set CAN error code to Rx Fifo 0 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV0; + + /* Clear FIFO0 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV0); + } + } + + /* Receive FIFO 0 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO0_FULL) != 0U) + { + if ((rf0rflags & CAN_RF0R_FULL0) != 0U) + { + /* Clear FIFO 0 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF0); + + /* Receive FIFO 0 full Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0FullCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 0 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO0_MSG_PENDING) != 0U) + { + /* Check if message is still pending */ + if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) != 0U) + { + /* Receive FIFO 0 message pending Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo0MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo0MsgPendingCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 overrun interrupt management *****************************/ + if ((interrupts & CAN_IT_RX_FIFO1_OVERRUN) != 0U) + { + if ((rf1rflags & CAN_RF1R_FOVR1) != 0U) + { + /* Set CAN error code to Rx Fifo 1 overrun error */ + errorcode |= HAL_CAN_ERROR_RX_FOV1; + + /* Clear FIFO1 Overrun Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV1); + } + } + + /* Receive FIFO 1 full interrupt management ********************************/ + if ((interrupts & CAN_IT_RX_FIFO1_FULL) != 0U) + { + if ((rf1rflags & CAN_RF1R_FULL1) != 0U) + { + /* Clear FIFO 1 full Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FF1); + + /* Receive FIFO 1 full Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1FullCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1FullCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Receive FIFO 1 message pending interrupt management *********************/ + if ((interrupts & CAN_IT_RX_FIFO1_MSG_PENDING) != 0U) + { + /* Check if message is still pending */ + if ((hcan->Instance->RF1R & CAN_RF1R_FMP1) != 0U) + { + /* Receive FIFO 1 message pending Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->RxFifo1MsgPendingCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_RxFifo1MsgPendingCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Sleep interrupt management *********************************************/ + if ((interrupts & CAN_IT_SLEEP_ACK) != 0U) + { + if ((msrflags & CAN_MSR_SLAKI) != 0U) + { + /* Clear Sleep interrupt Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_SLAKI); + + /* Sleep Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->SleepCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_SleepCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* WakeUp interrupt management *********************************************/ + if ((interrupts & CAN_IT_WAKEUP) != 0U) + { + if ((msrflags & CAN_MSR_WKUI) != 0U) + { + /* Clear WakeUp Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_WKU); + + /* WakeUp Callback */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->WakeUpFromRxMsgCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_WakeUpFromRxMsgCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } + } + + /* Error interrupts management *********************************************/ + if ((interrupts & CAN_IT_ERROR) != 0U) + { + if ((msrflags & CAN_MSR_ERRI) != 0U) + { + /* Check Error Warning Flag */ + if (((interrupts & CAN_IT_ERROR_WARNING) != 0U) && + ((esrflags & CAN_ESR_EWGF) != 0U)) + { + /* Set CAN error code to Error Warning */ + errorcode |= HAL_CAN_ERROR_EWG; + + /* No need for clear of Error Warning Flag as read-only */ + } + + /* Check Error Passive Flag */ + if (((interrupts & CAN_IT_ERROR_PASSIVE) != 0U) && + ((esrflags & CAN_ESR_EPVF) != 0U)) + { + /* Set CAN error code to Error Passive */ + errorcode |= HAL_CAN_ERROR_EPV; + + /* No need for clear of Error Passive Flag as read-only */ + } + + /* Check Bus-off Flag */ + if (((interrupts & CAN_IT_BUSOFF) != 0U) && + ((esrflags & CAN_ESR_BOFF) != 0U)) + { + /* Set CAN error code to Bus-Off */ + errorcode |= HAL_CAN_ERROR_BOF; + + /* No need for clear of Error Bus-Off as read-only */ + } + + /* Check Last Error Code Flag */ + if (((interrupts & CAN_IT_LAST_ERROR_CODE) != 0U) && + ((esrflags & CAN_ESR_LEC) != 0U)) + { + switch (esrflags & CAN_ESR_LEC) + { + case (CAN_ESR_LEC_0): + /* Set CAN error code to Stuff error */ + errorcode |= HAL_CAN_ERROR_STF; + break; + case (CAN_ESR_LEC_1): + /* Set CAN error code to Form error */ + errorcode |= HAL_CAN_ERROR_FOR; + break; + case (CAN_ESR_LEC_1 | CAN_ESR_LEC_0): + /* Set CAN error code to Acknowledgement error */ + errorcode |= HAL_CAN_ERROR_ACK; + break; + case (CAN_ESR_LEC_2): + /* Set CAN error code to Bit recessive error */ + errorcode |= HAL_CAN_ERROR_BR; + break; + case (CAN_ESR_LEC_2 | CAN_ESR_LEC_0): + /* Set CAN error code to Bit Dominant error */ + errorcode |= HAL_CAN_ERROR_BD; + break; + case (CAN_ESR_LEC_2 | CAN_ESR_LEC_1): + /* Set CAN error code to CRC error */ + errorcode |= HAL_CAN_ERROR_CRC; + break; + default: + break; + } + + /* Clear Last error code Flag */ + CLEAR_BIT(hcan->Instance->ESR, CAN_ESR_LEC); + } + } + + /* Clear ERRI Flag */ + __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_ERRI); + } + + /* Call the Error call Back in case of Errors */ + if (errorcode != HAL_CAN_ERROR_NONE) + { + /* Update error code in handle */ + hcan->ErrorCode |= errorcode; + + /* Call Error callback function */ +#if USE_HAL_CAN_REGISTER_CALLBACKS == 1 + /* Call registered callback*/ + hcan->ErrorCallback(hcan); +#else + /* Call weak (surcharged) callback */ + HAL_CAN_ErrorCallback(hcan); +#endif /* USE_HAL_CAN_REGISTER_CALLBACKS */ + } +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group5 Callback functions + * @brief CAN Callback functions + * +@verbatim + ============================================================================== + ##### Callback functions ##### + ============================================================================== + [..] + This subsection provides the following callback functions: + (+) HAL_CAN_TxMailbox0CompleteCallback + (+) HAL_CAN_TxMailbox1CompleteCallback + (+) HAL_CAN_TxMailbox2CompleteCallback + (+) HAL_CAN_TxMailbox0AbortCallback + (+) HAL_CAN_TxMailbox1AbortCallback + (+) HAL_CAN_TxMailbox2AbortCallback + (+) HAL_CAN_RxFifo0MsgPendingCallback + (+) HAL_CAN_RxFifo0FullCallback + (+) HAL_CAN_RxFifo1MsgPendingCallback + (+) HAL_CAN_RxFifo1FullCallback + (+) HAL_CAN_SleepCallback + (+) HAL_CAN_WakeUpFromRxMsgCallback + (+) HAL_CAN_ErrorCallback + +@endverbatim + * @{ + */ + +/** + * @brief Transmission Mailbox 0 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox0CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 1 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox1CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 2 complete callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox2CompleteCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 0 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox0AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 1 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox1AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Transmission Mailbox 2 Cancellation callback. + * @param hcan pointer to an CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_TxMailbox2AbortCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 0 message pending callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo0MsgPendingCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 0 full callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo0FullCallback could be implemented in the user + file + */ +} + +/** + * @brief Rx FIFO 1 message pending callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1MsgPendingCallback could be implemented in the + user file + */ +} + +/** + * @brief Rx FIFO 1 full callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_RxFifo1FullCallback could be implemented in the user + file + */ +} + +/** + * @brief Sleep callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_SleepCallback could be implemented in the user file + */ +} + +/** + * @brief WakeUp from Rx message callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_WakeUpFromRxMsgCallback could be implemented in the + user file + */ +} + +/** + * @brief Error CAN callback. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval None + */ +__weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hcan); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_CAN_ErrorCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup CAN_Exported_Functions_Group6 Peripheral State and Error functions + * @brief CAN Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral State and Error functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) HAL_CAN_GetState() : Return the CAN state. + (+) HAL_CAN_GetError() : Return the CAN error codes if any. + (+) HAL_CAN_ResetError(): Reset the CAN error codes if any. + +@endverbatim + * @{ + */ + +/** + * @brief Return the CAN state. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL state + */ +HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan) +{ + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Check sleep mode acknowledge flag */ + if ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U) + { + /* Sleep mode is active */ + state = HAL_CAN_STATE_SLEEP_ACTIVE; + } + /* Check sleep mode request flag */ + else if ((hcan->Instance->MCR & CAN_MCR_SLEEP) != 0U) + { + /* Sleep mode request is pending */ + state = HAL_CAN_STATE_SLEEP_PENDING; + } + else + { + /* Neither sleep mode request nor sleep mode acknowledge */ + } + } + + /* Return CAN state */ + return state; +} + +/** + * @brief Return the CAN error code. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval CAN Error Code + */ +uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan) +{ + /* Return CAN error code */ + return hcan->ErrorCode; +} + +/** + * @brief Reset the CAN error code. + * @param hcan pointer to a CAN_HandleTypeDef structure that contains + * the configuration information for the specified CAN. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan) +{ + HAL_StatusTypeDef status = HAL_OK; + HAL_CAN_StateTypeDef state = hcan->State; + + if ((state == HAL_CAN_STATE_READY) || + (state == HAL_CAN_STATE_LISTENING)) + { + /* Reset CAN error code */ + hcan->ErrorCode = 0U; + } + else + { + /* Update error code */ + hcan->ErrorCode |= HAL_CAN_ERROR_NOT_INITIALIZED; + + status = HAL_ERROR; + } + + /* Return the status */ + return status; +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_CAN_MODULE_ENABLED */ + +/** + * @} + */ + +#endif /* CAN1 */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c new file mode 100644 index 0000000..e66ccee --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c @@ -0,0 +1,505 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_cortex.c + * @author MCD Application Team + * @brief CORTEX HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the CORTEX: + * + Initialization and de-initialization functions + * + Peripheral Control functions + * + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + + [..] + *** How to configure Interrupts using CORTEX HAL driver *** + =========================================================== + [..] + This section provides functions allowing to configure the NVIC interrupts (IRQ). + The Cortex-M3 exceptions are managed by CMSIS functions. + + (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() + function according to the following table. + (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority(). + (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ(). + (#) please refer to programming manual for details in how to configure priority. + + -@- When the NVIC_PRIORITYGROUP_0 is selected, IRQ preemption is no more possible. + The pending IRQ priority will be managed only by the sub priority. + + -@- IRQ priority order (sorted by highest to lowest priority): + (+@) Lowest preemption priority + (+@) Lowest sub priority + (+@) Lowest hardware priority (IRQ number) + + [..] + *** How to configure Systick using CORTEX HAL driver *** + ======================================================== + [..] + Setup SysTick Timer for time base. + + (+) The HAL_SYSTICK_Config()function calls the SysTick_Config() function which + is a CMSIS function that: + (++) Configures the SysTick Reload register with value passed as function parameter. + (++) Configures the SysTick IRQ priority to the lowest value 0x0F. + (++) Resets the SysTick Counter register. + (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK). + (++) Enables the SysTick Interrupt. + (++) Starts the SysTick Counter. + + (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro + __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the + HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined + inside the stm32f1xx_hal_cortex.h file. + + (+) You can change the SysTick IRQ priority by calling the + HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function + call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function. + + (+) To adjust the SysTick time base, use the following formula: + + Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s) + (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function + (++) Reload Value should not exceed 0xFFFFFF + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup CORTEX CORTEX + * @brief CORTEX HAL module driver + * @{ + */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup CORTEX_Exported_Functions CORTEX Exported Functions + * @{ + */ + + +/** @defgroup CORTEX_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] + This section provides the CORTEX HAL driver functions allowing to configure Interrupts + Systick functionalities + +@endverbatim + * @{ + */ + + +/** + * @brief Sets the priority grouping field (preemption priority and subpriority) + * using the required unlock sequence. + * @param PriorityGroup: The priority grouping bits length. + * This parameter can be one of the following values: + * @arg NVIC_PRIORITYGROUP_0: 0 bits for preemption priority + * 4 bits for subpriority + * @arg NVIC_PRIORITYGROUP_1: 1 bits for preemption priority + * 3 bits for subpriority + * @arg NVIC_PRIORITYGROUP_2: 2 bits for preemption priority + * 2 bits for subpriority + * @arg NVIC_PRIORITYGROUP_3: 3 bits for preemption priority + * 1 bits for subpriority + * @arg NVIC_PRIORITYGROUP_4: 4 bits for preemption priority + * 0 bits for subpriority + * @note When the NVIC_PriorityGroup_0 is selected, IRQ preemption is no more possible. + * The pending IRQ priority will be managed only by the subpriority. + * @retval None + */ +void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + /* Check the parameters */ + assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup)); + + /* Set the PRIGROUP[10:8] bits according to the PriorityGroup parameter value */ + NVIC_SetPriorityGrouping(PriorityGroup); +} + +/** + * @brief Sets the priority of an interrupt. + * @param IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xx.h)) + * @param PreemptPriority: The preemption priority for the IRQn channel. + * This parameter can be a value between 0 and 15 + * A lower priority value indicates a higher priority + * @param SubPriority: the subpriority level for the IRQ channel. + * This parameter can be a value between 0 and 15 + * A lower priority value indicates a higher priority. + * @retval None + */ +void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t prioritygroup = 0x00U; + + /* Check the parameters */ + assert_param(IS_NVIC_SUB_PRIORITY(SubPriority)); + assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority)); + + prioritygroup = NVIC_GetPriorityGrouping(); + + NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority)); +} + +/** + * @brief Enables a device specific interrupt in the NVIC interrupt controller. + * @note To configure interrupts priority correctly, the NVIC_PriorityGroupConfig() + * function should be called before. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval None + */ +void HAL_NVIC_EnableIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Enable interrupt */ + NVIC_EnableIRQ(IRQn); +} + +/** + * @brief Disables a device specific interrupt in the NVIC interrupt controller. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval None + */ +void HAL_NVIC_DisableIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Disable interrupt */ + NVIC_DisableIRQ(IRQn); +} + +/** + * @brief Initiates a system reset request to reset the MCU. + * @retval None + */ +void HAL_NVIC_SystemReset(void) +{ + /* System Reset */ + NVIC_SystemReset(); +} + +/** + * @brief Initializes the System Timer and its interrupt, and starts the System Tick Timer. + * Counter is in free running mode to generate periodic interrupts. + * @param TicksNumb: Specifies the ticks Number of ticks between two interrupts. + * @retval status: - 0 Function succeeded. + * - 1 Function failed. + */ +uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb) +{ + return SysTick_Config(TicksNumb); +} +/** + * @} + */ + +/** @defgroup CORTEX_Exported_Functions_Group2 Peripheral Control functions + * @brief Cortex control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control the CORTEX + (NVIC, SYSTICK, MPU) functionalities. + + +@endverbatim + * @{ + */ + +#if (__MPU_PRESENT == 1U) +/** + * @brief Disables the MPU + * @retval None + */ +void HAL_MPU_Disable(void) +{ + /* Make sure outstanding transfers are done */ + __DMB(); + + /* Disable fault exceptions */ + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; + + /* Disable the MPU and clear the control register*/ + MPU->CTRL = 0U; +} + +/** + * @brief Enable 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 + */ +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; + + /* Ensure MPU setting take effects */ + __DSB(); + __ISB(); +} + +/** + * @brief Initializes and configures the Region and the memory to be protected. + * @param MPU_Init: Pointer to a MPU_Region_InitTypeDef structure that contains + * the initialization and configuration information. + * @retval None + */ +void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init) +{ + /* Check the parameters */ + assert_param(IS_MPU_REGION_NUMBER(MPU_Init->Number)); + assert_param(IS_MPU_REGION_ENABLE(MPU_Init->Enable)); + + /* Set the Region number */ + MPU->RNR = MPU_Init->Number; + + if ((MPU_Init->Enable) != RESET) + { + /* Check the parameters */ + assert_param(IS_MPU_INSTRUCTION_ACCESS(MPU_Init->DisableExec)); + assert_param(IS_MPU_REGION_PERMISSION_ATTRIBUTE(MPU_Init->AccessPermission)); + assert_param(IS_MPU_TEX_LEVEL(MPU_Init->TypeExtField)); + assert_param(IS_MPU_ACCESS_SHAREABLE(MPU_Init->IsShareable)); + assert_param(IS_MPU_ACCESS_CACHEABLE(MPU_Init->IsCacheable)); + assert_param(IS_MPU_ACCESS_BUFFERABLE(MPU_Init->IsBufferable)); + assert_param(IS_MPU_SUB_REGION_DISABLE(MPU_Init->SubRegionDisable)); + assert_param(IS_MPU_REGION_SIZE(MPU_Init->Size)); + + MPU->RBAR = MPU_Init->BaseAddress; + MPU->RASR = ((uint32_t)MPU_Init->DisableExec << MPU_RASR_XN_Pos) | + ((uint32_t)MPU_Init->AccessPermission << MPU_RASR_AP_Pos) | + ((uint32_t)MPU_Init->TypeExtField << MPU_RASR_TEX_Pos) | + ((uint32_t)MPU_Init->IsShareable << MPU_RASR_S_Pos) | + ((uint32_t)MPU_Init->IsCacheable << MPU_RASR_C_Pos) | + ((uint32_t)MPU_Init->IsBufferable << MPU_RASR_B_Pos) | + ((uint32_t)MPU_Init->SubRegionDisable << MPU_RASR_SRD_Pos) | + ((uint32_t)MPU_Init->Size << MPU_RASR_SIZE_Pos) | + ((uint32_t)MPU_Init->Enable << MPU_RASR_ENABLE_Pos); + } + else + { + MPU->RBAR = 0x00U; + MPU->RASR = 0x00U; + } +} +#endif /* __MPU_PRESENT */ + +/** + * @brief Gets the priority grouping field from the NVIC Interrupt Controller. + * @retval Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field) + */ +uint32_t HAL_NVIC_GetPriorityGrouping(void) +{ + /* Get the PRIGROUP[10:8] field value */ + return NVIC_GetPriorityGrouping(); +} + +/** + * @brief Gets the priority of an interrupt. + * @param IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @param PriorityGroup: the priority grouping bits length. + * This parameter can be one of the following values: + * @arg NVIC_PRIORITYGROUP_0: 0 bits for preemption priority + * 4 bits for subpriority + * @arg NVIC_PRIORITYGROUP_1: 1 bits for preemption priority + * 3 bits for subpriority + * @arg NVIC_PRIORITYGROUP_2: 2 bits for preemption priority + * 2 bits for subpriority + * @arg NVIC_PRIORITYGROUP_3: 3 bits for preemption priority + * 1 bits for subpriority + * @arg NVIC_PRIORITYGROUP_4: 4 bits for preemption priority + * 0 bits for subpriority + * @param pPreemptPriority: Pointer on the Preemptive priority value (starting from 0). + * @param pSubPriority: Pointer on the Subpriority value (starting from 0). + * @retval None + */ +void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority) +{ + /* Check the parameters */ + assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup)); + /* Get priority for Cortex-M system or device specific interrupts */ + NVIC_DecodePriority(NVIC_GetPriority(IRQn), PriorityGroup, pPreemptPriority, pSubPriority); +} + +/** + * @brief Sets Pending bit of an external interrupt. + * @param IRQn External interrupt number + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval None + */ +void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Set interrupt pending */ + NVIC_SetPendingIRQ(IRQn); +} + +/** + * @brief Gets Pending Interrupt (reads the pending register in the NVIC + * and returns the pending bit for the specified interrupt). + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval status: - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + */ +uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Return 1 if pending else 0 */ + return NVIC_GetPendingIRQ(IRQn); +} + +/** + * @brief Clears the pending bit of an external interrupt. + * @param IRQn External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval None + */ +void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Clear pending interrupt */ + NVIC_ClearPendingIRQ(IRQn); +} + +/** + * @brief Gets active interrupt ( reads the active register in NVIC and returns the active bit). + * @param IRQn External interrupt number + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f10xxx.h)) + * @retval status: - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + */ +uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn) +{ + /* Check the parameters */ + assert_param(IS_NVIC_DEVICE_IRQ(IRQn)); + + /* Return 1 if active else 0 */ + return NVIC_GetActive(IRQn); +} + +/** + * @brief Configures the SysTick clock source. + * @param CLKSource: specifies the SysTick clock source. + * This parameter can be one of the following values: + * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source. + * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source. + * @retval None + */ +void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource) +{ + /* Check the parameters */ + assert_param(IS_SYSTICK_CLK_SOURCE(CLKSource)); + if (CLKSource == SYSTICK_CLKSOURCE_HCLK) + { + SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; + } + else + { + SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; + } +} + +/** + * @brief This function handles SYSTICK interrupt request. + * @retval None + */ +void HAL_SYSTICK_IRQHandler(void) +{ + HAL_SYSTICK_Callback(); +} + +/** + * @brief SYSTICK callback. + * @retval None + */ +__weak void HAL_SYSTICK_Callback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_SYSTICK_Callback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_CORTEX_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c new file mode 100644 index 0000000..62a1d28 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c @@ -0,0 +1,899 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_dma.c + * @author MCD Application Team + * @brief DMA HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Direct Memory Access (DMA) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + Peripheral State and errors functions + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Enable and configure the peripheral to be connected to the DMA Channel + (except for internal SRAM / FLASH memories: no initialization is + necessary). Please refer to the Reference manual for connection between peripherals + and DMA requests. + + (#) For a given Channel, program the required configuration through the following parameters: + Channel request, Transfer Direction, Source and Destination data formats, + Circular or Normal mode, Channel Priority level, Source and Destination Increment mode + using HAL_DMA_Init() function. + + (#) Use HAL_DMA_GetState() function to return the DMA state and HAL_DMA_GetError() in case of error + detection. + + (#) Use HAL_DMA_Abort() function to abort the current transfer + + -@- In Memory-to-Memory transfer mode, Circular mode is not allowed. + *** Polling mode IO operation *** + ================================= + [..] + (+) Use HAL_DMA_Start() to start DMA transfer after the configuration of Source + address and destination address and the Length of data to be transferred + (+) Use HAL_DMA_PollForTransfer() to poll for the end of current transfer, in this + case a fixed Timeout can be configured by User depending from his application. + + *** Interrupt mode IO operation *** + =================================== + [..] + (+) Configure the DMA interrupt priority using HAL_NVIC_SetPriority() + (+) Enable the DMA IRQ handler using HAL_NVIC_EnableIRQ() + (+) Use HAL_DMA_Start_IT() to start DMA transfer after the configuration of + Source address and destination address and the Length of data to be transferred. + In this case the DMA interrupt is configured + (+) Use HAL_DMA_IRQHandler() called under DMA_IRQHandler() Interrupt subroutine + (+) At the end of data transfer HAL_DMA_IRQHandler() function is executed and user can + add his own function by customization of function pointer XferCpltCallback and + XferErrorCallback (i.e. a member of DMA handle structure). + + *** DMA HAL driver macros list *** + ============================================= + [..] + Below the list of most used macros in DMA HAL driver. + + (+) __HAL_DMA_ENABLE: Enable the specified DMA Channel. + (+) __HAL_DMA_DISABLE: Disable the specified DMA Channel. + (+) __HAL_DMA_GET_FLAG: Get the DMA Channel pending flags. + (+) __HAL_DMA_CLEAR_FLAG: Clear the DMA Channel pending flags. + (+) __HAL_DMA_ENABLE_IT: Enable the specified DMA Channel interrupts. + (+) __HAL_DMA_DISABLE_IT: Disable the specified DMA Channel interrupts. + (+) __HAL_DMA_GET_IT_SOURCE: Check whether the specified DMA Channel interrupt has occurred or not. + + [..] + (@) You can refer to the DMA HAL driver header file for more useful macros + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup DMA DMA + * @brief DMA HAL module driver + * @{ + */ + +#ifdef HAL_DMA_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup DMA_Private_Functions DMA Private Functions + * @{ + */ +static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ + +/** @defgroup DMA_Exported_Functions DMA Exported Functions + * @{ + */ + +/** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to initialize the DMA Channel source + and destination addresses, incrementation and data sizes, transfer direction, + circular/normal mode selection, memory-to-memory mode selection and Channel priority value. + [..] + The HAL_DMA_Init() function follows the DMA configuration procedures as described in + reference manual. + +@endverbatim + * @{ + */ + +/** + * @brief Initialize the DMA according to the specified + * parameters in the DMA_InitTypeDef and initialize the associated handle. + * @param hdma: Pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma) +{ + uint32_t tmp = 0U; + + /* Check the DMA handle allocation */ + if(hdma == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance)); + assert_param(IS_DMA_DIRECTION(hdma->Init.Direction)); + assert_param(IS_DMA_PERIPHERAL_INC_STATE(hdma->Init.PeriphInc)); + assert_param(IS_DMA_MEMORY_INC_STATE(hdma->Init.MemInc)); + assert_param(IS_DMA_PERIPHERAL_DATA_SIZE(hdma->Init.PeriphDataAlignment)); + assert_param(IS_DMA_MEMORY_DATA_SIZE(hdma->Init.MemDataAlignment)); + assert_param(IS_DMA_MODE(hdma->Init.Mode)); + assert_param(IS_DMA_PRIORITY(hdma->Init.Priority)); + +#if defined (DMA2) + /* calculation of the channel index */ + if ((uint32_t)(hdma->Instance) < (uint32_t)(DMA2_Channel1)) + { + /* DMA1 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA1_Channel1) / ((uint32_t)DMA1_Channel2 - (uint32_t)DMA1_Channel1)) << 2; + hdma->DmaBaseAddress = DMA1; + } + else + { + /* DMA2 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA2_Channel1) / ((uint32_t)DMA2_Channel2 - (uint32_t)DMA2_Channel1)) << 2; + hdma->DmaBaseAddress = DMA2; + } +#else + /* DMA1 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA1_Channel1) / ((uint32_t)DMA1_Channel2 - (uint32_t)DMA1_Channel1)) << 2; + hdma->DmaBaseAddress = DMA1; +#endif /* DMA2 */ + + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + + /* Get the CR register value */ + tmp = hdma->Instance->CCR; + + /* Clear PL, MSIZE, PSIZE, MINC, PINC, CIRC and DIR bits */ + tmp &= ((uint32_t)~(DMA_CCR_PL | DMA_CCR_MSIZE | DMA_CCR_PSIZE | \ + DMA_CCR_MINC | DMA_CCR_PINC | DMA_CCR_CIRC | \ + DMA_CCR_DIR)); + + /* Prepare the DMA Channel configuration */ + tmp |= hdma->Init.Direction | + hdma->Init.PeriphInc | hdma->Init.MemInc | + hdma->Init.PeriphDataAlignment | hdma->Init.MemDataAlignment | + hdma->Init.Mode | hdma->Init.Priority; + + /* Write to DMA Channel CR register */ + hdma->Instance->CCR = tmp; + + /* Initialise the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Initialize the DMA state*/ + hdma->State = HAL_DMA_STATE_READY; + /* Allocate lock resource and initialize it */ + hdma->Lock = HAL_UNLOCKED; + + return HAL_OK; +} + +/** + * @brief DeInitialize the DMA peripheral. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma) +{ + /* Check the DMA handle allocation */ + if(hdma == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance)); + + /* Disable the selected DMA Channelx */ + __HAL_DMA_DISABLE(hdma); + + /* Reset DMA Channel control register */ + hdma->Instance->CCR = 0U; + + /* Reset DMA Channel Number of Data to Transfer register */ + hdma->Instance->CNDTR = 0U; + + /* Reset DMA Channel peripheral address register */ + hdma->Instance->CPAR = 0U; + + /* Reset DMA Channel memory address register */ + hdma->Instance->CMAR = 0U; + +#if defined (DMA2) + /* calculation of the channel index */ + if ((uint32_t)(hdma->Instance) < (uint32_t)(DMA2_Channel1)) + { + /* DMA1 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA1_Channel1) / ((uint32_t)DMA1_Channel2 - (uint32_t)DMA1_Channel1)) << 2; + hdma->DmaBaseAddress = DMA1; + } + else + { + /* DMA2 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA2_Channel1) / ((uint32_t)DMA2_Channel2 - (uint32_t)DMA2_Channel1)) << 2; + hdma->DmaBaseAddress = DMA2; + } +#else + /* DMA1 */ + hdma->ChannelIndex = (((uint32_t)hdma->Instance - (uint32_t)DMA1_Channel1) / ((uint32_t)DMA1_Channel2 - (uint32_t)DMA1_Channel1)) << 2; + hdma->DmaBaseAddress = DMA1; +#endif /* DMA2 */ + + /* Clear all flags */ + hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << (hdma->ChannelIndex)); + + /* Clean all callbacks */ + hdma->XferCpltCallback = NULL; + hdma->XferHalfCpltCallback = NULL; + hdma->XferErrorCallback = NULL; + hdma->XferAbortCallback = NULL; + + /* Reset the error code */ + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Reset the DMA state */ + hdma->State = HAL_DMA_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup DMA_Exported_Functions_Group2 Input and Output operation functions + * @brief Input and Output operation functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Configure the source, destination address and data length and Start DMA transfer + (+) Configure the source, destination address and data length and + Start DMA transfer with interrupt + (+) Abort DMA transfer + (+) Poll for transfer complete + (+) Handle DMA interrupt request + +@endverbatim + * @{ + */ + +/** + * @brief Start the DMA Transfer. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param SrcAddress: The source memory Buffer address + * @param DstAddress: The destination memory Buffer address + * @param DataLength: The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Start(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Disable the peripheral */ + __HAL_DMA_DISABLE(hdma); + + /* Configure the source, destination address and the data length & clear flags*/ + DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Enable the Peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + status = HAL_BUSY; + } + return status; +} + +/** + * @brief Start the DMA Transfer with interrupt enabled. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param SrcAddress: The source memory Buffer address + * @param DstAddress: The destination memory Buffer address + * @param DataLength: The length of data to be transferred from source to destination + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_DMA_BUFFER_SIZE(DataLength)); + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + /* Change DMA peripheral state */ + hdma->State = HAL_DMA_STATE_BUSY; + hdma->ErrorCode = HAL_DMA_ERROR_NONE; + + /* Disable the peripheral */ + __HAL_DMA_DISABLE(hdma); + + /* Configure the source, destination address and the data length & clear flags*/ + DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength); + + /* Enable the transfer complete interrupt */ + /* Enable the transfer Error interrupt */ + if(NULL != hdma->XferHalfCpltCallback) + { + /* Enable the Half transfer complete interrupt as well */ + __HAL_DMA_ENABLE_IT(hdma, (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)); + } + else + { + __HAL_DMA_DISABLE_IT(hdma, DMA_IT_HT); + __HAL_DMA_ENABLE_IT(hdma, (DMA_IT_TC | DMA_IT_TE)); + } + /* Enable the Peripheral */ + __HAL_DMA_ENABLE(hdma); + } + else + { + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Remain BUSY */ + status = HAL_BUSY; + } + return status; +} + +/** + * @brief Abort the DMA Transfer. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma) +{ + HAL_StatusTypeDef status = HAL_OK; + + if(hdma->State != HAL_DMA_STATE_BUSY) + { + /* no transfer ongoing */ + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + return HAL_ERROR; + } + else + + { + /* Disable DMA IT */ + __HAL_DMA_DISABLE_IT(hdma, (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)); + + /* Disable the channel */ + __HAL_DMA_DISABLE(hdma); + + /* Clear all flags */ + hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << hdma->ChannelIndex); + } + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + return status; +} + +/** + * @brief Aborts the DMA Transfer in Interrupt mode. + * @param hdma : pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma) +{ + HAL_StatusTypeDef status = HAL_OK; + + if(HAL_DMA_STATE_BUSY != hdma->State) + { + /* no transfer ongoing */ + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + + status = HAL_ERROR; + } + else + { + /* Disable DMA IT */ + __HAL_DMA_DISABLE_IT(hdma, (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)); + + /* Disable the channel */ + __HAL_DMA_DISABLE(hdma); + + /* Clear all flags */ + __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_GI_FLAG_INDEX(hdma)); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + /* Call User Abort callback */ + if(hdma->XferAbortCallback != NULL) + { + hdma->XferAbortCallback(hdma); + } + } + return status; +} + +/** + * @brief Polling for transfer complete. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param CompleteLevel: Specifies the DMA level complete. + * @param Timeout: Timeout duration. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout) +{ + uint32_t temp; + uint32_t tickstart = 0U; + + if(HAL_DMA_STATE_BUSY != hdma->State) + { + /* no transfer ongoing */ + hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER; + __HAL_UNLOCK(hdma); + return HAL_ERROR; + } + + /* Polling mode not supported in circular mode */ + if (RESET != (hdma->Instance->CCR & DMA_CCR_CIRC)) + { + hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED; + return HAL_ERROR; + } + + /* Get the level transfer complete flag */ + if(CompleteLevel == HAL_DMA_FULL_TRANSFER) + { + /* Transfer Complete flag */ + temp = __HAL_DMA_GET_TC_FLAG_INDEX(hdma); + } + else + { + /* Half Transfer Complete flag */ + temp = __HAL_DMA_GET_HT_FLAG_INDEX(hdma); + } + + /* Get tick */ + tickstart = HAL_GetTick(); + + while(__HAL_DMA_GET_FLAG(hdma, temp) == RESET) + { + if((__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma)) != RESET)) + { + /* When a DMA transfer error occurs */ + /* A hardware clear of its EN bits is performed */ + /* Clear all flags */ + hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << hdma->ChannelIndex); + + /* Update error code */ + SET_BIT(hdma->ErrorCode, HAL_DMA_ERROR_TE); + + /* Change the DMA state */ + hdma->State= HAL_DMA_STATE_READY; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + return HAL_ERROR; + } + /* Check for the Timeout */ + if(Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout)) + { + /* Update error code */ + SET_BIT(hdma->ErrorCode, HAL_DMA_ERROR_TIMEOUT); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + return HAL_ERROR; + } + } + } + + if(CompleteLevel == HAL_DMA_FULL_TRANSFER) + { + /* Clear the transfer complete flag */ + __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma)); + + /* The selected Channelx EN bit is cleared (DMA is disabled and + all transfers are complete) */ + hdma->State = HAL_DMA_STATE_READY; + } + else + { + /* Clear the half transfer complete flag */ + __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma)); + } + + /* Process unlocked */ + __HAL_UNLOCK(hdma); + + return HAL_OK; +} + +/** + * @brief Handles DMA interrupt request. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval None + */ +void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma) +{ + uint32_t flag_it = hdma->DmaBaseAddress->ISR; + uint32_t source_it = hdma->Instance->CCR; + + /* Half Transfer Complete Interrupt management ******************************/ + if (((flag_it & (DMA_FLAG_HT1 << hdma->ChannelIndex)) != RESET) && ((source_it & DMA_IT_HT) != RESET)) + { + /* Disable the half transfer interrupt if the DMA mode is not CIRCULAR */ + if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0U) + { + /* Disable the half transfer interrupt */ + __HAL_DMA_DISABLE_IT(hdma, DMA_IT_HT); + } + /* Clear the half transfer complete flag */ + __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma)); + + /* DMA peripheral state is not updated in Half Transfer */ + /* but in Transfer Complete case */ + + if(hdma->XferHalfCpltCallback != NULL) + { + /* Half transfer callback */ + hdma->XferHalfCpltCallback(hdma); + } + } + + /* Transfer Complete Interrupt management ***********************************/ + else if (((flag_it & (DMA_FLAG_TC1 << hdma->ChannelIndex)) != RESET) && ((source_it & DMA_IT_TC) != RESET)) + { + if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0U) + { + /* Disable the transfer complete and error interrupt */ + __HAL_DMA_DISABLE_IT(hdma, DMA_IT_TE | DMA_IT_TC); + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + } + /* Clear the transfer complete flag */ + __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma)); + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + if(hdma->XferCpltCallback != NULL) + { + /* Transfer complete callback */ + hdma->XferCpltCallback(hdma); + } + } + + /* Transfer Error Interrupt management **************************************/ + else if (( RESET != (flag_it & (DMA_FLAG_TE1 << hdma->ChannelIndex))) && (RESET != (source_it & DMA_IT_TE))) + { + /* When a DMA transfer error occurs */ + /* A hardware clear of its EN bits is performed */ + /* Disable ALL DMA IT */ + __HAL_DMA_DISABLE_IT(hdma, (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)); + + /* Clear all flags */ + hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << hdma->ChannelIndex); + + /* Update error code */ + hdma->ErrorCode = HAL_DMA_ERROR_TE; + + /* Change the DMA state */ + hdma->State = HAL_DMA_STATE_READY; + + /* Process Unlocked */ + __HAL_UNLOCK(hdma); + + if (hdma->XferErrorCallback != NULL) + { + /* Transfer error callback */ + hdma->XferErrorCallback(hdma); + } + } + return; +} + +/** + * @brief Register callbacks + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param CallbackID: User Callback identifer + * a HAL_DMA_CallbackIDTypeDef ENUM as parameter. + * @param pCallback: pointer to private callbacsk function which has pointer to + * a DMA_HandleTypeDef structure as parameter. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)( DMA_HandleTypeDef * _hdma)) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + switch (CallbackID) + { + case HAL_DMA_XFER_CPLT_CB_ID: + hdma->XferCpltCallback = pCallback; + break; + + case HAL_DMA_XFER_HALFCPLT_CB_ID: + hdma->XferHalfCpltCallback = pCallback; + break; + + case HAL_DMA_XFER_ERROR_CB_ID: + hdma->XferErrorCallback = pCallback; + break; + + case HAL_DMA_XFER_ABORT_CB_ID: + hdma->XferAbortCallback = pCallback; + break; + + default: + status = HAL_ERROR; + break; + } + } + else + { + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return status; +} + +/** + * @brief UnRegister callbacks + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param CallbackID: User Callback identifer + * a HAL_DMA_CallbackIDTypeDef ENUM as parameter. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hdma); + + if(HAL_DMA_STATE_READY == hdma->State) + { + switch (CallbackID) + { + case HAL_DMA_XFER_CPLT_CB_ID: + hdma->XferCpltCallback = NULL; + break; + + case HAL_DMA_XFER_HALFCPLT_CB_ID: + hdma->XferHalfCpltCallback = NULL; + break; + + case HAL_DMA_XFER_ERROR_CB_ID: + hdma->XferErrorCallback = NULL; + break; + + case HAL_DMA_XFER_ABORT_CB_ID: + hdma->XferAbortCallback = NULL; + break; + + case HAL_DMA_XFER_ALL_CB_ID: + hdma->XferCpltCallback = NULL; + hdma->XferHalfCpltCallback = NULL; + hdma->XferErrorCallback = NULL; + hdma->XferAbortCallback = NULL; + break; + + default: + status = HAL_ERROR; + break; + } + } + else + { + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hdma); + + return status; +} + +/** + * @} + */ + +/** @defgroup DMA_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief Peripheral State and Errors functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides functions allowing to + (+) Check the DMA state + (+) Get error code + +@endverbatim + * @{ + */ + +/** + * @brief Return the DMA hande state. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval HAL state + */ +HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma) +{ + /* Return DMA handle state */ + return hdma->State; +} + +/** + * @brief Return the DMA error code. + * @param hdma : pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @retval DMA Error Code + */ +uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma) +{ + return hdma->ErrorCode; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup DMA_Private_Functions + * @{ + */ + +/** + * @brief Sets the DMA Transfer parameter. + * @param hdma: pointer to a DMA_HandleTypeDef structure that contains + * the configuration information for the specified DMA Channel. + * @param SrcAddress: The source memory Buffer address + * @param DstAddress: The destination memory Buffer address + * @param DataLength: The length of data to be transferred from source to destination + * @retval HAL status + */ +static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) +{ + /* Clear all flags */ + hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << hdma->ChannelIndex); + + /* Configure DMA Channel data length */ + hdma->Instance->CNDTR = DataLength; + + /* Memory to Peripheral */ + if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH) + { + /* Configure DMA Channel destination address */ + hdma->Instance->CPAR = DstAddress; + + /* Configure DMA Channel source address */ + hdma->Instance->CMAR = SrcAddress; + } + /* Peripheral to Memory */ + else + { + /* Configure DMA Channel source address */ + hdma->Instance->CPAR = SrcAddress; + + /* Configure DMA Channel destination address */ + hdma->Instance->CMAR = DstAddress; + } +} + +/** + * @} + */ + +#endif /* HAL_DMA_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c new file mode 100644 index 0000000..8af23a2 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c @@ -0,0 +1,555 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_exti.c + * @author MCD Application Team + * @brief EXTI HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Extended Interrupts and events controller (EXTI) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + @verbatim + ============================================================================== + ##### EXTI Peripheral features ##### + ============================================================================== + [..] + (+) Each Exti line can be configured within this driver. + + (+) Exti line can be configured in 3 different modes + (++) Interrupt + (++) Event + (++) Both of them + + (+) Configurable Exti lines can be configured with 3 different triggers + (++) Rising + (++) Falling + (++) Both of them + + (+) When set in interrupt mode, configurable Exti lines have two different + interrupts pending registers which allow to distinguish which transition + occurs: + (++) Rising edge pending interrupt + (++) Falling + + (+) Exti lines 0 to 15 are linked to gpio pin number 0 to 15. Gpio port can + be selected through multiplexer. + + ##### How to use this driver ##### + ============================================================================== + [..] + + (#) Configure the EXTI line using HAL_EXTI_SetConfigLine(). + (++) Choose the interrupt line number by setting "Line" member from + EXTI_ConfigTypeDef structure. + (++) Configure the interrupt and/or event mode using "Mode" member from + EXTI_ConfigTypeDef structure. + (++) For configurable lines, configure rising and/or falling trigger + "Trigger" member from EXTI_ConfigTypeDef structure. + (++) For Exti lines linked to gpio, choose gpio port using "GPIOSel" + member from GPIO_InitTypeDef structure. + + (#) Get current Exti configuration of a dedicated line using + HAL_EXTI_GetConfigLine(). + (++) Provide exiting handle as parameter. + (++) Provide pointer on EXTI_ConfigTypeDef structure as second parameter. + + (#) Clear Exti configuration of a dedicated line using HAL_EXTI_GetConfigLine(). + (++) Provide exiting handle as parameter. + + (#) Register callback to treat Exti interrupts using HAL_EXTI_RegisterCallback(). + (++) Provide exiting handle as first parameter. + (++) Provide which callback will be registered using one value from + EXTI_CallbackIDTypeDef. + (++) Provide callback function pointer. + + (#) Get interrupt pending bit using HAL_EXTI_GetPending(). + + (#) Clear interrupt pending bit using HAL_EXTI_GetPending(). + + (#) Generate software interrupt using HAL_EXTI_GenerateSWI(). + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @addtogroup EXTI + * @{ + */ +/** MISRA C:2012 deviation rule has been granted for following rule: + * Rule-18.1_b - Medium: Array `EXTICR' 1st subscript interval [0,7] may be out + * of bounds [0,3] in following API : + * HAL_EXTI_SetConfigLine + * HAL_EXTI_GetConfigLine + * HAL_EXTI_ClearConfigLine + */ + +#ifdef HAL_EXTI_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private defines -----------------------------------------------------------*/ +/** @defgroup EXTI_Private_Constants EXTI Private Constants + * @{ + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup EXTI_Exported_Functions + * @{ + */ + +/** @addtogroup EXTI_Exported_Functions_Group1 + * @brief Configuration functions + * +@verbatim + =============================================================================== + ##### Configuration functions ##### + =============================================================================== + +@endverbatim + * @{ + */ + +/** + * @brief Set configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @param pExtiConfig Pointer on EXTI configuration to be set. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if ((hexti == NULL) || (pExtiConfig == NULL)) + { + return HAL_ERROR; + } + + /* Check parameters */ + assert_param(IS_EXTI_LINE(pExtiConfig->Line)); + assert_param(IS_EXTI_MODE(pExtiConfig->Mode)); + + /* Assign line number to handle */ + hexti->Line = pExtiConfig->Line; + + /* Compute line mask */ + linepos = (pExtiConfig->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* Configure triggers for configurable lines */ + if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u) + { + assert_param(IS_EXTI_TRIGGER(pExtiConfig->Trigger)); + + /* Configure rising trigger */ + /* Mask or set line */ + if ((pExtiConfig->Trigger & EXTI_TRIGGER_RISING) != 0x00u) + { + EXTI->RTSR |= maskline; + } + else + { + EXTI->RTSR &= ~maskline; + } + + /* Configure falling trigger */ + /* Mask or set line */ + if ((pExtiConfig->Trigger & EXTI_TRIGGER_FALLING) != 0x00u) + { + EXTI->FTSR |= maskline; + } + else + { + EXTI->FTSR &= ~maskline; + } + + + /* Configure gpio port selection in case of gpio exti line */ + if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PORT(pExtiConfig->GPIOSel)); + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = AFIO->EXTICR[linepos >> 2u]; + regval &= ~(AFIO_EXTICR1_EXTI0 << (AFIO_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + regval |= (pExtiConfig->GPIOSel << (AFIO_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + AFIO->EXTICR[linepos >> 2u] = regval; + } + } + + /* Configure interrupt mode : read current mode */ + /* Mask or set line */ + if ((pExtiConfig->Mode & EXTI_MODE_INTERRUPT) != 0x00u) + { + EXTI->IMR |= maskline; + } + else + { + EXTI->IMR &= ~maskline; + } + + /* Configure event mode : read current mode */ + /* Mask or set line */ + if ((pExtiConfig->Mode & EXTI_MODE_EVENT) != 0x00u) + { + EXTI->EMR |= maskline; + } + else + { + EXTI->EMR &= ~maskline; + } + + return HAL_OK; +} + +/** + * @brief Get configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @param pExtiConfig Pointer on structure to store Exti configuration. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if ((hexti == NULL) || (pExtiConfig == NULL)) + { + return HAL_ERROR; + } + + /* Check the parameter */ + assert_param(IS_EXTI_LINE(hexti->Line)); + + /* Store handle line number to configuration structure */ + pExtiConfig->Line = hexti->Line; + + /* Compute line mask */ + linepos = (pExtiConfig->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* 1] Get core mode : interrupt */ + + /* Check if selected line is enable */ + if ((EXTI->IMR & maskline) != 0x00u) + { + pExtiConfig->Mode = EXTI_MODE_INTERRUPT; + } + else + { + pExtiConfig->Mode = EXTI_MODE_NONE; + } + + /* Get event mode */ + /* Check if selected line is enable */ + if ((EXTI->EMR & maskline) != 0x00u) + { + pExtiConfig->Mode |= EXTI_MODE_EVENT; + } + + /* Get default Trigger and GPIOSel configuration */ + pExtiConfig->Trigger = EXTI_TRIGGER_NONE; + pExtiConfig->GPIOSel = 0x00u; + + /* 2] Get trigger for configurable lines : rising */ + if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u) + { + /* Check if configuration of selected line is enable */ + if ((EXTI->RTSR & maskline) != 0x00u) + { + pExtiConfig->Trigger = EXTI_TRIGGER_RISING; + } + + /* Get falling configuration */ + /* Check if configuration of selected line is enable */ + if ((EXTI->FTSR & maskline) != 0x00u) + { + pExtiConfig->Trigger |= EXTI_TRIGGER_FALLING; + } + + /* Get Gpio port selection for gpio lines */ + if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = AFIO->EXTICR[linepos >> 2u]; + pExtiConfig->GPIOSel = ((regval << (AFIO_EXTICR1_EXTI1_Pos * (3uL - (linepos & 0x03u)))) >> 24); + } + } + + return HAL_OK; +} + +/** + * @brief Clear whole configuration of a dedicated Exti line. + * @param hexti Exti handle. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti) +{ + uint32_t regval; + uint32_t linepos; + uint32_t maskline; + + /* Check null pointer */ + if (hexti == NULL) + { + return HAL_ERROR; + } + + /* Check the parameter */ + assert_param(IS_EXTI_LINE(hexti->Line)); + + /* compute line mask */ + linepos = (hexti->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* 1] Clear interrupt mode */ + EXTI->IMR = (EXTI->IMR & ~maskline); + + /* 2] Clear event mode */ + EXTI->EMR = (EXTI->EMR & ~maskline); + + /* 3] Clear triggers in case of configurable lines */ + if ((hexti->Line & EXTI_CONFIG) != 0x00u) + { + EXTI->RTSR = (EXTI->RTSR & ~maskline); + EXTI->FTSR = (EXTI->FTSR & ~maskline); + + /* Get Gpio port selection for gpio lines */ + if ((hexti->Line & EXTI_GPIO) == EXTI_GPIO) + { + assert_param(IS_EXTI_GPIO_PIN(linepos)); + + regval = AFIO->EXTICR[linepos >> 2u]; + regval &= ~(AFIO_EXTICR1_EXTI0 << (AFIO_EXTICR1_EXTI1_Pos * (linepos & 0x03u))); + AFIO->EXTICR[linepos >> 2u] = regval; + } + } + + return HAL_OK; +} + +/** + * @brief Register callback for a dedicated Exti line. + * @param hexti Exti handle. + * @param CallbackID User callback identifier. + * This parameter can be one of @arg @ref EXTI_CallbackIDTypeDef values. + * @param pPendingCbfn function pointer to be stored as callback. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void)) +{ + HAL_StatusTypeDef status = HAL_OK; + + switch (CallbackID) + { + case HAL_EXTI_COMMON_CB_ID: + hexti->PendingCallback = pPendingCbfn; + break; + + default: + status = HAL_ERROR; + break; + } + + return status; +} + +/** + * @brief Store line number as handle private field. + * @param hexti Exti handle. + * @param ExtiLine Exti line number. + * This parameter can be from 0 to @ref EXTI_LINE_NB. + * @retval HAL Status. + */ +HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine) +{ + /* Check the parameters */ + assert_param(IS_EXTI_LINE(ExtiLine)); + + /* Check null pointer */ + if (hexti == NULL) + { + return HAL_ERROR; + } + else + { + /* Store line number as handle private field */ + hexti->Line = ExtiLine; + + return HAL_OK; + } +} + +/** + * @} + */ + +/** @addtogroup EXTI_Exported_Functions_Group2 + * @brief EXTI IO functions. + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + +@endverbatim + * @{ + */ + +/** + * @brief Handle EXTI interrupt request. + * @param hexti Exti handle. + * @retval none. + */ +void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti) +{ + uint32_t regval; + uint32_t maskline; + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Get pending bit */ + regval = (EXTI->PR & maskline); + if (regval != 0x00u) + { + /* Clear pending bit */ + EXTI->PR = maskline; + + /* Call callback */ + if (hexti->PendingCallback != NULL) + { + hexti->PendingCallback(); + } + } +} + +/** + * @brief Get interrupt pending bit of a dedicated line. + * @param hexti Exti handle. + * @param Edge Specify which pending edge as to be checked. + * This parameter can be one of the following values: + * @arg @ref EXTI_TRIGGER_RISING_FALLING + * This parameter is kept for compatibility with other series. + * @retval 1 if interrupt is pending else 0. + */ +uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge) +{ + uint32_t regval; + uint32_t maskline; + uint32_t linepos; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + assert_param(IS_EXTI_PENDING_EDGE(Edge)); + + /* Prevent unused argument compilation warning */ + UNUSED(Edge); + + /* Compute line mask */ + linepos = (hexti->Line & EXTI_PIN_MASK); + maskline = (1uL << linepos); + + /* return 1 if bit is set else 0 */ + regval = ((EXTI->PR & maskline) >> linepos); + return regval; +} + +/** + * @brief Clear interrupt pending bit of a dedicated line. + * @param hexti Exti handle. + * @param Edge Specify which pending edge as to be clear. + * This parameter can be one of the following values: + * @arg @ref EXTI_TRIGGER_RISING_FALLING + * This parameter is kept for compatibility with other series. + * @retval None. + */ +void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge) +{ + uint32_t maskline; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + assert_param(IS_EXTI_PENDING_EDGE(Edge)); + + /* Prevent unused argument compilation warning */ + UNUSED(Edge); + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Clear Pending bit */ + EXTI->PR = maskline; +} + +/** + * @brief Generate a software interrupt for a dedicated line. + * @param hexti Exti handle. + * @retval None. + */ +void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti) +{ + uint32_t maskline; + + /* Check parameters */ + assert_param(IS_EXTI_LINE(hexti->Line)); + assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); + + /* Compute line mask */ + maskline = (1uL << (hexti->Line & EXTI_PIN_MASK)); + + /* Generate Software interrupt */ + EXTI->SWIER = maskline; +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_EXTI_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c new file mode 100644 index 0000000..2a628e8 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c @@ -0,0 +1,967 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_flash.c + * @author MCD Application Team + * @brief FLASH HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the internal FLASH memory: + * + Program operations functions + * + Memory Control functions + * + Peripheral State functions + * + @verbatim + ============================================================================== + ##### FLASH peripheral features ##### + ============================================================================== + [..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses + to the Flash memory. It implements the erase and program Flash memory operations + and the read and write protection mechanisms. + + [..] The Flash memory interface accelerates code execution with a system of instruction + prefetch. + + [..] The FLASH main features are: + (+) Flash memory read operations + (+) Flash memory program/erase operations + (+) Read / write protections + (+) Prefetch on I-Code + (+) Option Bytes programming + + + ##### How to use this driver ##### + ============================================================================== + [..] + This driver provides functions and macros to configure and program the FLASH + memory of all STM32F1xx devices. + + (#) FLASH Memory I/O Programming functions: this group includes all needed + functions to erase and program the main memory: + (++) Lock and Unlock the FLASH interface + (++) Erase function: Erase page, erase all pages + (++) Program functions: half word, word and doubleword + (#) FLASH Option Bytes Programming functions: this group includes all needed + functions to manage the Option Bytes: + (++) Lock and Unlock the Option Bytes + (++) Set/Reset the write protection + (++) Set the Read protection Level + (++) Program the user Option Bytes + (++) Launch the Option Bytes loader + (++) Erase Option Bytes + (++) Program the data Option Bytes + (++) Get the Write protection. + (++) Get the user option bytes. + + (#) Interrupts and flags management functions : this group + includes all needed functions to: + (++) Handle FLASH interrupts + (++) Wait for last FLASH operation according to its status + (++) Get error flag status + + [..] In addition to these function, this driver includes a set of macros allowing + to handle the following operations: + + (+) Set/Get the latency + (+) Enable/Disable the prefetch buffer + (+) Enable/Disable the half cycle access + (+) Enable/Disable the FLASH interrupts + (+) Monitor the FLASH flags status + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +#ifdef HAL_FLASH_MODULE_ENABLED + +/** @defgroup FLASH FLASH + * @brief FLASH HAL module driver + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup FLASH_Private_Constants FLASH Private Constants + * @{ + */ +/** + * @} + */ + +/* Private macro ---------------------------- ---------------------------------*/ +/** @defgroup FLASH_Private_Macros FLASH Private Macros + * @{ + */ + +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/** @defgroup FLASH_Private_Variables FLASH Private Variables + * @{ + */ +/* Variables used for Erase pages under interruption*/ +FLASH_ProcessTypeDef pFlash; +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup FLASH_Private_Functions FLASH Private Functions + * @{ + */ +static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data); +static void FLASH_SetErrorCode(void); +extern void FLASH_PageErase(uint32_t PageAddress); +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ +/** @defgroup FLASH_Exported_Functions FLASH Exported Functions + * @{ + */ + +/** @defgroup FLASH_Exported_Functions_Group1 Programming operation functions + * @brief Programming operation functions + * +@verbatim +@endverbatim + * @{ + */ + +/** + * @brief Program halfword, word or double word at a specified address + * @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface + * The function HAL_FLASH_Lock() should be called after to lock the FLASH interface + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @note FLASH should be previously erased before new programmation (only exception to this + * is when 0x0000 is programmed) + * + * @param TypeProgram: Indicate the way to program at a specified address. + * This parameter can be a value of @ref FLASH_Type_Program + * @param Address: Specifies the address to be programmed. + * @param Data: Specifies the data to be programmed + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data) +{ + HAL_StatusTypeDef status = HAL_ERROR; + uint8_t index = 0; + uint8_t nbiterations = 0; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); + assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); + +#if defined(FLASH_BANK2_END) + if(Address <= FLASH_BANK1_END) + { +#endif /* FLASH_BANK2_END */ + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); +#if defined(FLASH_BANK2_END) + } + else + { + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperationBank2(FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_BANK2_END */ + + if(status == HAL_OK) + { + if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD) + { + /* Program halfword (16-bit) at a specified address. */ + nbiterations = 1U; + } + else if(TypeProgram == FLASH_TYPEPROGRAM_WORD) + { + /* Program word (32-bit = 2*16-bit) at a specified address. */ + nbiterations = 2U; + } + else + { + /* Program double word (64-bit = 4*16-bit) at a specified address. */ + nbiterations = 4U; + } + + for (index = 0U; index < nbiterations; index++) + { + FLASH_Program_HalfWord((Address + (2U*index)), (uint16_t)(Data >> (16U*index))); + +#if defined(FLASH_BANK2_END) + if(Address <= FLASH_BANK1_END) + { +#endif /* FLASH_BANK2_END */ + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); + + /* If the program operation is completed, disable the PG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PG); +#if defined(FLASH_BANK2_END) + } + else + { + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperationBank2(FLASH_TIMEOUT_VALUE); + + /* If the program operation is completed, disable the PG Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_PG); + } +#endif /* FLASH_BANK2_END */ + /* In case of error, stop programation procedure */ + if (status != HAL_OK) + { + break; + } + } + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Program halfword, word or double word at a specified address with interrupt enabled. + * @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface + * The function HAL_FLASH_Lock() should be called after to lock the FLASH interface + * + * @note If an erase and a program operations are requested simultaneously, + * the erase operation is performed before the program one. + * + * @param TypeProgram: Indicate the way to program at a specified address. + * This parameter can be a value of @ref FLASH_Type_Program + * @param Address: Specifies the address to be programmed. + * @param Data: Specifies the data to be programmed + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); + assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); + +#if defined(FLASH_BANK2_END) + /* If procedure already ongoing, reject the next one */ + if (pFlash.ProcedureOnGoing != FLASH_PROC_NONE) + { + return HAL_ERROR; + } + + if(Address <= FLASH_BANK1_END) + { + /* Enable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP_BANK1 | FLASH_IT_ERR_BANK1); + + }else + { + /* Enable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP_BANK2 | FLASH_IT_ERR_BANK2); + } +#else + /* Enable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP | FLASH_IT_ERR); +#endif /* FLASH_BANK2_END */ + + pFlash.Address = Address; + pFlash.Data = Data; + + if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD) + { + pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMHALFWORD; + /* Program halfword (16-bit) at a specified address. */ + pFlash.DataRemaining = 1U; + } + else if(TypeProgram == FLASH_TYPEPROGRAM_WORD) + { + pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMWORD; + /* Program word (32-bit : 2*16-bit) at a specified address. */ + pFlash.DataRemaining = 2U; + } + else + { + pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMDOUBLEWORD; + /* Program double word (64-bit : 4*16-bit) at a specified address. */ + pFlash.DataRemaining = 4U; + } + + /* Program halfword (16-bit) at a specified address. */ + FLASH_Program_HalfWord(Address, (uint16_t)Data); + + return status; +} + +/** + * @brief This function handles FLASH interrupt request. + * @retval None + */ +void HAL_FLASH_IRQHandler(void) +{ + uint32_t addresstmp = 0U; + + /* Check FLASH operation error flags */ +#if defined(FLASH_BANK2_END) + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR_BANK1) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR_BANK1) || \ + (__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR_BANK2) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR_BANK2))) +#else + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) +#endif /* FLASH_BANK2_END */ + { + /* Return the faulty address */ + addresstmp = pFlash.Address; + /* Reset address */ + pFlash.Address = 0xFFFFFFFFU; + + /* Save the Error code */ + FLASH_SetErrorCode(); + + /* FLASH error interrupt user callback */ + HAL_FLASH_OperationErrorCallback(addresstmp); + + /* Stop the procedure ongoing */ + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + + /* Check FLASH End of Operation flag */ +#if defined(FLASH_BANK2_END) + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP_BANK1)) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP_BANK1); +#else + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP)) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); +#endif /* FLASH_BANK2_END */ + + /* Process can continue only if no error detected */ + if(pFlash.ProcedureOnGoing != FLASH_PROC_NONE) + { + if(pFlash.ProcedureOnGoing == FLASH_PROC_PAGEERASE) + { + /* Nb of pages to erased can be decreased */ + pFlash.DataRemaining--; + + /* Check if there are still pages to erase */ + if(pFlash.DataRemaining != 0U) + { + addresstmp = pFlash.Address; + /*Indicate user which sector has been erased */ + HAL_FLASH_EndOfOperationCallback(addresstmp); + + /*Increment sector number*/ + addresstmp = pFlash.Address + FLASH_PAGE_SIZE; + pFlash.Address = addresstmp; + + /* If the erase operation is completed, disable the PER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PER); + + FLASH_PageErase(addresstmp); + } + else + { + /* No more pages to Erase, user callback can be called. */ + /* Reset Sector and stop Erase pages procedure */ + pFlash.Address = addresstmp = 0xFFFFFFFFU; + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(addresstmp); + } + } + else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE) + { + /* Operation is completed, disable the MER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_MER); + +#if defined(FLASH_BANK2_END) + /* Stop Mass Erase procedure if no pending mass erase on other bank */ + if (HAL_IS_BIT_CLR(FLASH->CR2, FLASH_CR2_MER)) + { +#endif /* FLASH_BANK2_END */ + /* MassErase ended. Return the selected bank */ + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(0U); + + /* Stop Mass Erase procedure*/ + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } +#if defined(FLASH_BANK2_END) + } +#endif /* FLASH_BANK2_END */ + else + { + /* Nb of 16-bit data to program can be decreased */ + pFlash.DataRemaining--; + + /* Check if there are still 16-bit data to program */ + if(pFlash.DataRemaining != 0U) + { + /* Increment address to 16-bit */ + pFlash.Address += 2U; + addresstmp = pFlash.Address; + + /* Shift to have next 16-bit data */ + pFlash.Data = (pFlash.Data >> 16U); + + /* Operation is completed, disable the PG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PG); + + /*Program halfword (16-bit) at a specified address.*/ + FLASH_Program_HalfWord(addresstmp, (uint16_t)pFlash.Data); + } + else + { + /* Program ended. Return the selected address */ + /* FLASH EOP interrupt user callback */ + if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAMHALFWORD) + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address); + } + else if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAMWORD) + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address - 2U); + } + else + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address - 6U); + } + + /* Reset Address and stop Program procedure */ + pFlash.Address = 0xFFFFFFFFU; + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + } + } + } + +#if defined(FLASH_BANK2_END) + /* Check FLASH End of Operation flag */ + if(__HAL_FLASH_GET_FLAG( FLASH_FLAG_EOP_BANK2)) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP_BANK2); + + /* Process can continue only if no error detected */ + if(pFlash.ProcedureOnGoing != FLASH_PROC_NONE) + { + if(pFlash.ProcedureOnGoing == FLASH_PROC_PAGEERASE) + { + /* Nb of pages to erased can be decreased */ + pFlash.DataRemaining--; + + /* Check if there are still pages to erase*/ + if(pFlash.DataRemaining != 0U) + { + /* Indicate user which page address has been erased*/ + HAL_FLASH_EndOfOperationCallback(pFlash.Address); + + /* Increment page address to next page */ + pFlash.Address += FLASH_PAGE_SIZE; + addresstmp = pFlash.Address; + + /* Operation is completed, disable the PER Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_PER); + + FLASH_PageErase(addresstmp); + } + else + { + /*No more pages to Erase*/ + + /*Reset Address and stop Erase pages procedure*/ + pFlash.Address = 0xFFFFFFFFU; + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(pFlash.Address); + } + } + else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE) + { + /* Operation is completed, disable the MER Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_MER); + + if (HAL_IS_BIT_CLR(FLASH->CR, FLASH_CR_MER)) + { + /* MassErase ended. Return the selected bank*/ + /* FLASH EOP interrupt user callback */ + HAL_FLASH_EndOfOperationCallback(0U); + + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + } + else + { + /* Nb of 16-bit data to program can be decreased */ + pFlash.DataRemaining--; + + /* Check if there are still 16-bit data to program */ + if(pFlash.DataRemaining != 0U) + { + /* Increment address to 16-bit */ + pFlash.Address += 2U; + addresstmp = pFlash.Address; + + /* Shift to have next 16-bit data */ + pFlash.Data = (pFlash.Data >> 16U); + + /* Operation is completed, disable the PG Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_PG); + + /*Program halfword (16-bit) at a specified address.*/ + FLASH_Program_HalfWord(addresstmp, (uint16_t)pFlash.Data); + } + else + { + /*Program ended. Return the selected address*/ + /* FLASH EOP interrupt user callback */ + if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAMHALFWORD) + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address); + } + else if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAMWORD) + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address-2U); + } + else + { + HAL_FLASH_EndOfOperationCallback(pFlash.Address-6U); + } + + /* Reset Address and stop Program procedure*/ + pFlash.Address = 0xFFFFFFFFU; + pFlash.ProcedureOnGoing = FLASH_PROC_NONE; + } + } + } + } +#endif + + if(pFlash.ProcedureOnGoing == FLASH_PROC_NONE) + { +#if defined(FLASH_BANK2_END) + /* Operation is completed, disable the PG, PER and MER Bits for both bank */ + CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_PER | FLASH_CR_MER)); + CLEAR_BIT(FLASH->CR2, (FLASH_CR2_PG | FLASH_CR2_PER | FLASH_CR2_MER)); + + /* Disable End of FLASH Operation and Error source interrupts for both banks */ + __HAL_FLASH_DISABLE_IT(FLASH_IT_EOP_BANK1 | FLASH_IT_ERR_BANK1 | FLASH_IT_EOP_BANK2 | FLASH_IT_ERR_BANK2); +#else + /* Operation is completed, disable the PG, PER and MER Bits */ + CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_PER | FLASH_CR_MER)); + + /* Disable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_DISABLE_IT(FLASH_IT_EOP | FLASH_IT_ERR); +#endif /* FLASH_BANK2_END */ + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + } +} + +/** + * @brief FLASH end of operation interrupt callback + * @param ReturnValue: The value saved in this parameter depends on the ongoing procedure + * - Mass Erase: No return value expected + * - Pages Erase: Address of the page which has been erased + * (if 0xFFFFFFFF, it means that all the selected pages have been erased) + * - Program: Address which was selected for data program + * @retval none + */ +__weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(ReturnValue); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_FLASH_EndOfOperationCallback could be implemented in the user file + */ +} + +/** + * @brief FLASH operation error interrupt callback + * @param ReturnValue: The value saved in this parameter depends on the ongoing procedure + * - Mass Erase: No return value expected + * - Pages Erase: Address of the page which returned an error + * - Program: Address which was selected for data program + * @retval none + */ +__weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(ReturnValue); + + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_FLASH_OperationErrorCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup FLASH_Exported_Functions_Group2 Peripheral Control functions + * @brief management functions + * +@verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the FLASH + memory operations. + +@endverbatim + * @{ + */ + +/** + * @brief Unlock the FLASH control register access + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Unlock(void) +{ + HAL_StatusTypeDef status = HAL_OK; + + if(READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET) + { + /* Authorize the FLASH Registers access */ + WRITE_REG(FLASH->KEYR, FLASH_KEY1); + WRITE_REG(FLASH->KEYR, FLASH_KEY2); + + /* Verify Flash is unlocked */ + if(READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET) + { + status = HAL_ERROR; + } + } +#if defined(FLASH_BANK2_END) + if(READ_BIT(FLASH->CR2, FLASH_CR2_LOCK) != RESET) + { + /* Authorize the FLASH BANK2 Registers access */ + WRITE_REG(FLASH->KEYR2, FLASH_KEY1); + WRITE_REG(FLASH->KEYR2, FLASH_KEY2); + + /* Verify Flash BANK2 is unlocked */ + if(READ_BIT(FLASH->CR2, FLASH_CR2_LOCK) != RESET) + { + status = HAL_ERROR; + } + } +#endif /* FLASH_BANK2_END */ + + return status; +} + +/** + * @brief Locks the FLASH control register access + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_Lock(void) +{ + /* Set the LOCK Bit to lock the FLASH Registers access */ + SET_BIT(FLASH->CR, FLASH_CR_LOCK); + +#if defined(FLASH_BANK2_END) + /* Set the LOCK Bit to lock the FLASH BANK2 Registers access */ + SET_BIT(FLASH->CR2, FLASH_CR2_LOCK); + +#endif /* FLASH_BANK2_END */ + return HAL_OK; +} + +/** + * @brief Unlock the FLASH Option Control Registers access. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void) +{ + if (HAL_IS_BIT_CLR(FLASH->CR, FLASH_CR_OPTWRE)) + { + /* Authorizes the Option Byte register programming */ + WRITE_REG(FLASH->OPTKEYR, FLASH_OPTKEY1); + WRITE_REG(FLASH->OPTKEYR, FLASH_OPTKEY2); + } + else + { + return HAL_ERROR; + } + + return HAL_OK; +} + +/** + * @brief Lock the FLASH Option Control Registers access. + * @retval HAL Status + */ +HAL_StatusTypeDef HAL_FLASH_OB_Lock(void) +{ + /* Clear the OPTWRE Bit to lock the FLASH Option Byte Registers access */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTWRE); + + return HAL_OK; +} + +/** + * @brief Launch the option byte loading. + * @note This function will reset automatically the MCU. + * @retval None + */ +void HAL_FLASH_OB_Launch(void) +{ + /* Initiates a system reset request to launch the option byte loading */ + HAL_NVIC_SystemReset(); +} + +/** + * @} + */ + +/** @defgroup FLASH_Exported_Functions_Group3 Peripheral errors functions + * @brief Peripheral errors functions + * +@verbatim + =============================================================================== + ##### Peripheral Errors functions ##### + =============================================================================== + [..] + This subsection permit to get in run-time errors of the FLASH peripheral. + +@endverbatim + * @{ + */ + +/** + * @brief Get the specific FLASH error flag. + * @retval FLASH_ErrorCode The returned value can be: + * @ref FLASH_Error_Codes + */ +uint32_t HAL_FLASH_GetError(void) +{ + return pFlash.ErrorCode; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup FLASH_Private_Functions + * @{ + */ + +/** + * @brief Program a half-word (16-bit) at a specified address. + * @param Address specify the address to be programmed. + * @param Data specify the data to be programmed. + * @retval None + */ +static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data) +{ + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + +#if defined(FLASH_BANK2_END) + if(Address <= FLASH_BANK1_END) + { +#endif /* FLASH_BANK2_END */ + /* Proceed to program the new data */ + SET_BIT(FLASH->CR, FLASH_CR_PG); +#if defined(FLASH_BANK2_END) + } + else + { + /* Proceed to program the new data */ + SET_BIT(FLASH->CR2, FLASH_CR2_PG); + } +#endif /* FLASH_BANK2_END */ + + /* Write data in the address */ + *(__IO uint16_t*)Address = Data; +} + +/** + * @brief Wait for a FLASH operation to complete. + * @param Timeout maximum flash operation timeout + * @retval HAL Status + */ +HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) +{ + /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset. + Even if the FLASH operation fails, the BUSY flag will be reset and an error + flag will be set */ + + uint32_t tickstart = HAL_GetTick(); + + while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY)) + { + if (Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + /* Check FLASH End of Operation flag */ + if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP)) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); + } + + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) || + __HAL_FLASH_GET_FLAG(FLASH_FLAG_OPTVERR) || + __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) + { + /*Save the error code*/ + FLASH_SetErrorCode(); + return HAL_ERROR; + } + + /* There is no error flag set */ + return HAL_OK; +} + +#if defined(FLASH_BANK2_END) +/** + * @brief Wait for a FLASH BANK2 operation to complete. + * @param Timeout maximum flash operation timeout + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef FLASH_WaitForLastOperationBank2(uint32_t Timeout) +{ + /* Wait for the FLASH BANK2 operation to complete by polling on BUSY flag to be reset. + Even if the FLASH BANK2 operation fails, the BUSY flag will be reset and an error + flag will be set */ + + uint32_t tickstart = HAL_GetTick(); + + while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY_BANK2)) + { + if (Timeout != HAL_MAX_DELAY) + { + if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout)) + { + return HAL_TIMEOUT; + } + } + } + + /* Check FLASH End of Operation flag */ + if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP_BANK2)) + { + /* Clear FLASH End of Operation pending bit */ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP_BANK2); + } + + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR_BANK2) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR_BANK2)) + { + /*Save the error code*/ + FLASH_SetErrorCode(); + return HAL_ERROR; + } + + /* If there is an error flag set */ + return HAL_OK; + +} +#endif /* FLASH_BANK2_END */ + +/** + * @brief Set the specific FLASH error flag. + * @retval None + */ +static void FLASH_SetErrorCode(void) +{ + uint32_t flags = 0U; + +#if defined(FLASH_BANK2_END) + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR_BANK2)) +#else + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR)) +#endif /* FLASH_BANK2_END */ + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP; +#if defined(FLASH_BANK2_END) + flags |= FLASH_FLAG_WRPERR | FLASH_FLAG_WRPERR_BANK2; +#else + flags |= FLASH_FLAG_WRPERR; +#endif /* FLASH_BANK2_END */ + } +#if defined(FLASH_BANK2_END) + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR_BANK2)) +#else + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) +#endif /* FLASH_BANK2_END */ + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_PROG; +#if defined(FLASH_BANK2_END) + flags |= FLASH_FLAG_PGERR | FLASH_FLAG_PGERR_BANK2; +#else + flags |= FLASH_FLAG_PGERR; +#endif /* FLASH_BANK2_END */ + } + if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_OPTVERR)) + { + pFlash.ErrorCode |= HAL_FLASH_ERROR_OPTV; + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR); + } + + /* Clear FLASH error pending bits */ + __HAL_FLASH_CLEAR_FLAG(flags); +} +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_FLASH_MODULE_ENABLED */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c new file mode 100644 index 0000000..27b07b8 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c @@ -0,0 +1,1127 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_flash_ex.c + * @author MCD Application Team + * @brief Extended FLASH HAL module driver. + * + * This file provides firmware functions to manage the following + * functionalities of the FLASH peripheral: + * + Extended Initialization/de-initialization functions + * + Extended I/O operation functions + * + Extended Peripheral Control functions + * + @verbatim + ============================================================================== + ##### Flash peripheral extended features ##### + ============================================================================== + + ##### How to use this driver ##### + ============================================================================== + [..] This driver provides functions to configure and program the FLASH memory + of all STM32F1xxx devices. It includes + + (++) Set/Reset the write protection + (++) Program the user Option Bytes + (++) Get the Read protection Level + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ +#ifdef HAL_FLASH_MODULE_ENABLED + +/** @addtogroup FLASH + * @{ + */ +/** @addtogroup FLASH_Private_Variables + * @{ + */ +/* Variables used for Erase pages under interruption*/ +extern FLASH_ProcessTypeDef pFlash; +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup FLASHEx FLASHEx + * @brief FLASH HAL Extension module driver + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup FLASHEx_Private_Constants FLASHEx Private Constants + * @{ + */ +#define FLASH_POSITION_IWDGSW_BIT FLASH_OBR_IWDG_SW_Pos +#define FLASH_POSITION_OB_USERDATA0_BIT FLASH_OBR_DATA0_Pos +#define FLASH_POSITION_OB_USERDATA1_BIT FLASH_OBR_DATA1_Pos +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup FLASHEx_Private_Macros FLASHEx Private Macros + * @{ + */ +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup FLASHEx_Private_Functions FLASHEx Private Functions + * @{ + */ +/* Erase operations */ +static void FLASH_MassErase(uint32_t Banks); +void FLASH_PageErase(uint32_t PageAddress); + +/* Option bytes control */ +static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage); +static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage); +static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t ReadProtectLevel); +static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig); +static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data); +static uint32_t FLASH_OB_GetWRP(void); +static uint32_t FLASH_OB_GetRDP(void); +static uint8_t FLASH_OB_GetUser(void); + +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ +/** @defgroup FLASHEx_Exported_Functions FLASHEx Exported Functions + * @{ + */ + +/** @defgroup FLASHEx_Exported_Functions_Group1 FLASHEx Memory Erasing functions + * @brief FLASH Memory Erasing functions + * +@verbatim + ============================================================================== + ##### FLASH Erasing Programming functions ##### + ============================================================================== + + [..] The FLASH Memory Erasing functions, includes the following functions: + (+) @ref HAL_FLASHEx_Erase: return only when erase has been done + (+) @ref HAL_FLASHEx_Erase_IT: end of erase is done when @ref HAL_FLASH_EndOfOperationCallback + is called with parameter 0xFFFFFFFF + + [..] Any operation of erase should follow these steps: + (#) Call the @ref HAL_FLASH_Unlock() function to enable the flash control register and + program memory access. + (#) Call the desired function to erase page. + (#) Call the @ref HAL_FLASH_Lock() to disable the flash program memory access + (recommended to protect the FLASH memory against possible unwanted operation). + +@endverbatim + * @{ + */ + + +/** + * @brief Perform a mass erase or erase the specified FLASH memory pages + * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function + * must be called before. + * Call the @ref HAL_FLASH_Lock() to disable the flash memory access + * (recommended to protect the FLASH memory against possible unwanted operation) + * @param[in] pEraseInit pointer to an FLASH_EraseInitTypeDef structure that + * contains the configuration information for the erasing. + * + * @param[out] PageError pointer to variable that + * contains the configuration information on faulty page in case of error + * (0xFFFFFFFF means that all the pages have been correctly erased) + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError) +{ + HAL_StatusTypeDef status = HAL_ERROR; + uint32_t address = 0U; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase)); + + if (pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE) + { +#if defined(FLASH_BANK2_END) + if (pEraseInit->Banks == FLASH_BANK_BOTH) + { + /* Mass Erase requested for Bank1 and Bank2 */ + /* Wait for last operation to be completed */ + if ((FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) && \ + (FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK)) + { + /*Mass erase to be done*/ + FLASH_MassErase(FLASH_BANK_BOTH); + + /* Wait for last operation to be completed */ + if ((FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) && \ + (FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK)) + { + status = HAL_OK; + } + + /* If the erase operation is completed, disable the MER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_MER); + CLEAR_BIT(FLASH->CR2, FLASH_CR2_MER); + } + } + else if (pEraseInit->Banks == FLASH_BANK_2) + { + /* Mass Erase requested for Bank2 */ + /* Wait for last operation to be completed */ + if (FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) + { + /*Mass erase to be done*/ + FLASH_MassErase(FLASH_BANK_2); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the MER Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_MER); + } + } + else +#endif /* FLASH_BANK2_END */ + { + /* Mass Erase requested for Bank1 */ + /* Wait for last operation to be completed */ + if (FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) + { + /*Mass erase to be done*/ + FLASH_MassErase(FLASH_BANK_1); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the MER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_MER); + } + } + } + else + { + /* Page Erase is requested */ + /* Check the parameters */ + assert_param(IS_FLASH_PROGRAM_ADDRESS(pEraseInit->PageAddress)); + assert_param(IS_FLASH_NB_PAGES(pEraseInit->PageAddress, pEraseInit->NbPages)); + +#if defined(FLASH_BANK2_END) + /* Page Erase requested on address located on bank2 */ + if(pEraseInit->PageAddress > FLASH_BANK1_END) + { + /* Wait for last operation to be completed */ + if (FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) + { + /*Initialization of PageError variable*/ + *PageError = 0xFFFFFFFFU; + + /* Erase by page by page to be done*/ + for(address = pEraseInit->PageAddress; + address < (pEraseInit->PageAddress + (pEraseInit->NbPages)*FLASH_PAGE_SIZE); + address += FLASH_PAGE_SIZE) + { + FLASH_PageErase(address); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperationBank2((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the PER Bit */ + CLEAR_BIT(FLASH->CR2, FLASH_CR2_PER); + + if (status != HAL_OK) + { + /* In case of error, stop erase procedure and return the faulty address */ + *PageError = address; + break; + } + } + } + } + else +#endif /* FLASH_BANK2_END */ + { + /* Page Erase requested on address located on bank1 */ + /* Wait for last operation to be completed */ + if (FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) + { + /*Initialization of PageError variable*/ + *PageError = 0xFFFFFFFFU; + + /* Erase page by page to be done*/ + for(address = pEraseInit->PageAddress; + address < ((pEraseInit->NbPages * FLASH_PAGE_SIZE) + pEraseInit->PageAddress); + address += FLASH_PAGE_SIZE) + { + FLASH_PageErase(address); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the PER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_PER); + + if (status != HAL_OK) + { + /* In case of error, stop erase procedure and return the faulty address */ + *PageError = address; + break; + } + } + } + } + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Perform a mass erase or erase the specified FLASH memory pages with interrupt enabled + * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function + * must be called before. + * Call the @ref HAL_FLASH_Lock() to disable the flash memory access + * (recommended to protect the FLASH memory against possible unwanted operation) + * @param pEraseInit pointer to an FLASH_EraseInitTypeDef structure that + * contains the configuration information for the erasing. + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* If procedure already ongoing, reject the next one */ + if (pFlash.ProcedureOnGoing != FLASH_PROC_NONE) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase)); + + /* Enable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP | FLASH_IT_ERR); + +#if defined(FLASH_BANK2_END) + /* Enable End of FLASH Operation and Error source interrupts */ + __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP_BANK2 | FLASH_IT_ERR_BANK2); + +#endif + if (pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE) + { + /*Mass erase to be done*/ + pFlash.ProcedureOnGoing = FLASH_PROC_MASSERASE; + FLASH_MassErase(pEraseInit->Banks); + } + else + { + /* Erase by page to be done*/ + + /* Check the parameters */ + assert_param(IS_FLASH_PROGRAM_ADDRESS(pEraseInit->PageAddress)); + assert_param(IS_FLASH_NB_PAGES(pEraseInit->PageAddress, pEraseInit->NbPages)); + + pFlash.ProcedureOnGoing = FLASH_PROC_PAGEERASE; + pFlash.DataRemaining = pEraseInit->NbPages; + pFlash.Address = pEraseInit->PageAddress; + + /*Erase 1st page and wait for IT*/ + FLASH_PageErase(pEraseInit->PageAddress); + } + + return status; +} + +/** + * @} + */ + +/** @defgroup FLASHEx_Exported_Functions_Group2 Option Bytes Programming functions + * @brief Option Bytes Programming functions + * +@verbatim + ============================================================================== + ##### Option Bytes Programming functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control the FLASH + option bytes operations. + +@endverbatim + * @{ + */ + +/** + * @brief Erases the FLASH option bytes. + * @note This functions erases all option bytes except the Read protection (RDP). + * The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface + * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes + * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes + * (system reset will occur) + * @retval HAL status + */ + +HAL_StatusTypeDef HAL_FLASHEx_OBErase(void) +{ + uint8_t rdptmp = OB_RDP_LEVEL_0; + HAL_StatusTypeDef status = HAL_ERROR; + + /* Get the actual read protection Option Byte value */ + rdptmp = FLASH_OB_GetRDP(); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* If the previous operation is completed, proceed to erase the option bytes */ + SET_BIT(FLASH->CR, FLASH_CR_OPTER); + SET_BIT(FLASH->CR, FLASH_CR_STRT); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the OPTER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTER); + + if(status == HAL_OK) + { + /* Restore the last read protection Option Byte value */ + status = FLASH_OB_RDP_LevelConfig(rdptmp); + } + } + + /* Return the erase status */ + return status; +} + +/** + * @brief Program option bytes + * @note The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface + * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes + * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes + * (system reset will occur) + * + * @param pOBInit pointer to an FLASH_OBInitStruct structure that + * contains the configuration information for the programming. + * + * @retval HAL_StatusTypeDef HAL Status + */ +HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit) +{ + HAL_StatusTypeDef status = HAL_ERROR; + + /* Process Locked */ + __HAL_LOCK(&pFlash); + + /* Check the parameters */ + assert_param(IS_OPTIONBYTE(pOBInit->OptionType)); + + /* Write protection configuration */ + if((pOBInit->OptionType & OPTIONBYTE_WRP) == OPTIONBYTE_WRP) + { + assert_param(IS_WRPSTATE(pOBInit->WRPState)); + if (pOBInit->WRPState == OB_WRPSTATE_ENABLE) + { + /* Enable of Write protection on the selected page */ + status = FLASH_OB_EnableWRP(pOBInit->WRPPage); + } + else + { + /* Disable of Write protection on the selected page */ + status = FLASH_OB_DisableWRP(pOBInit->WRPPage); + } + if (status != HAL_OK) + { + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + return status; + } + } + + /* Read protection configuration */ + if((pOBInit->OptionType & OPTIONBYTE_RDP) == OPTIONBYTE_RDP) + { + status = FLASH_OB_RDP_LevelConfig(pOBInit->RDPLevel); + if (status != HAL_OK) + { + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + return status; + } + } + + /* USER configuration */ + if((pOBInit->OptionType & OPTIONBYTE_USER) == OPTIONBYTE_USER) + { + status = FLASH_OB_UserConfig(pOBInit->USERConfig); + if (status != HAL_OK) + { + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + return status; + } + } + + /* DATA configuration*/ + if((pOBInit->OptionType & OPTIONBYTE_DATA) == OPTIONBYTE_DATA) + { + status = FLASH_OB_ProgramData(pOBInit->DATAAddress, pOBInit->DATAData); + if (status != HAL_OK) + { + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + return status; + } + } + + /* Process Unlocked */ + __HAL_UNLOCK(&pFlash); + + return status; +} + +/** + * @brief Get the Option byte configuration + * @param pOBInit pointer to an FLASH_OBInitStruct structure that + * contains the configuration information for the programming. + * + * @retval None + */ +void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit) +{ + pOBInit->OptionType = OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER; + + /*Get WRP*/ + pOBInit->WRPPage = FLASH_OB_GetWRP(); + + /*Get RDP Level*/ + pOBInit->RDPLevel = FLASH_OB_GetRDP(); + + /*Get USER*/ + pOBInit->USERConfig = FLASH_OB_GetUser(); +} + +/** + * @brief Get the Option byte user data + * @param DATAAdress Address of the option byte DATA + * This parameter can be one of the following values: + * @arg @ref OB_DATA_ADDRESS_DATA0 + * @arg @ref OB_DATA_ADDRESS_DATA1 + * @retval Value programmed in USER data + */ +uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress) +{ + uint32_t value = 0; + + if (DATAAdress == OB_DATA_ADDRESS_DATA0) + { + /* Get value programmed in OB USER Data0 */ + value = READ_BIT(FLASH->OBR, FLASH_OBR_DATA0) >> FLASH_POSITION_OB_USERDATA0_BIT; + } + else + { + /* Get value programmed in OB USER Data1 */ + value = READ_BIT(FLASH->OBR, FLASH_OBR_DATA1) >> FLASH_POSITION_OB_USERDATA1_BIT; + } + + return value; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup FLASHEx_Private_Functions + * @{ + */ + +/** + * @brief Full erase of FLASH memory Bank + * @param Banks Banks to be erased + * This parameter can be one of the following values: + * @arg @ref FLASH_BANK_1 Bank1 to be erased + @if STM32F101xG + * @arg @ref FLASH_BANK_2 Bank2 to be erased + * @arg @ref FLASH_BANK_BOTH Bank1 and Bank2 to be erased + @endif + @if STM32F103xG + * @arg @ref FLASH_BANK_2 Bank2 to be erased + * @arg @ref FLASH_BANK_BOTH Bank1 and Bank2 to be erased + @endif + * + * @retval None + */ +static void FLASH_MassErase(uint32_t Banks) +{ + /* Check the parameters */ + assert_param(IS_FLASH_BANK(Banks)); + + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + +#if defined(FLASH_BANK2_END) + if(Banks == FLASH_BANK_BOTH) + { + /* bank1 & bank2 will be erased*/ + SET_BIT(FLASH->CR, FLASH_CR_MER); + SET_BIT(FLASH->CR2, FLASH_CR2_MER); + SET_BIT(FLASH->CR, FLASH_CR_STRT); + SET_BIT(FLASH->CR2, FLASH_CR2_STRT); + } + else if(Banks == FLASH_BANK_2) + { + /*Only bank2 will be erased*/ + SET_BIT(FLASH->CR2, FLASH_CR2_MER); + SET_BIT(FLASH->CR2, FLASH_CR2_STRT); + } + else + { +#endif /* FLASH_BANK2_END */ +#if !defined(FLASH_BANK2_END) + /* Prevent unused argument(s) compilation warning */ + UNUSED(Banks); +#endif /* FLASH_BANK2_END */ + /* Only bank1 will be erased*/ + SET_BIT(FLASH->CR, FLASH_CR_MER); + SET_BIT(FLASH->CR, FLASH_CR_STRT); +#if defined(FLASH_BANK2_END) + } +#endif /* FLASH_BANK2_END */ +} + +/** + * @brief Enable the write protection of the desired pages + * @note An option byte erase is done automatically in this function. + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash page i if + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * + * @param WriteProtectPage specifies the page(s) to be write protected. + * The value of this parameter depend on device used within the same series + * @retval HAL status + */ +static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage) +{ + HAL_StatusTypeDef status = HAL_OK; + uint16_t WRP0_Data = 0xFFFF; +#if defined(FLASH_WRP1_WRP1) + uint16_t WRP1_Data = 0xFFFF; +#endif /* FLASH_WRP1_WRP1 */ +#if defined(FLASH_WRP2_WRP2) + uint16_t WRP2_Data = 0xFFFF; +#endif /* FLASH_WRP2_WRP2 */ +#if defined(FLASH_WRP3_WRP3) + uint16_t WRP3_Data = 0xFFFF; +#endif /* FLASH_WRP3_WRP3 */ + + /* Check the parameters */ + assert_param(IS_OB_WRP(WriteProtectPage)); + + /* Get current write protected pages and the new pages to be protected ******/ + WriteProtectPage = (uint32_t)(~((~FLASH_OB_GetWRP()) | WriteProtectPage)); + +#if defined(OB_WRP_PAGES0TO15MASK) + WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK); +#elif defined(OB_WRP_PAGES0TO31MASK) + WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK); +#endif /* OB_WRP_PAGES0TO31MASK */ + +#if defined(OB_WRP_PAGES16TO31MASK) + WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8U); +#elif defined(OB_WRP_PAGES32TO63MASK) + WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8U); +#endif /* OB_WRP_PAGES32TO63MASK */ + +#if defined(OB_WRP_PAGES64TO95MASK) + WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES64TO95MASK) >> 16U); +#endif /* OB_WRP_PAGES64TO95MASK */ +#if defined(OB_WRP_PAGES32TO47MASK) + WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO47MASK) >> 16U); +#endif /* OB_WRP_PAGES32TO47MASK */ + +#if defined(OB_WRP_PAGES96TO127MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES96TO127MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO255MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO255MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO511MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO511MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO127MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24U); +#endif /* OB_WRP_PAGES96TO127MASK */ + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* To be able to write again option byte, need to perform a option byte erase */ + status = HAL_FLASHEx_OBErase(); + if (status == HAL_OK) + { + /* Enable write protection */ + SET_BIT(FLASH->CR, FLASH_CR_OPTPG); + +#if defined(FLASH_WRP0_WRP0) + if(WRP0_Data != 0xFFU) + { + OB->WRP0 &= WRP0_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP0_WRP0 */ + +#if defined(FLASH_WRP1_WRP1) + if((status == HAL_OK) && (WRP1_Data != 0xFFU)) + { + OB->WRP1 &= WRP1_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP1_WRP1 */ + +#if defined(FLASH_WRP2_WRP2) + if((status == HAL_OK) && (WRP2_Data != 0xFFU)) + { + OB->WRP2 &= WRP2_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP2_WRP2 */ + +#if defined(FLASH_WRP3_WRP3) + if((status == HAL_OK) && (WRP3_Data != 0xFFU)) + { + OB->WRP3 &= WRP3_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP3_WRP3 */ + + /* if the program operation is completed, disable the OPTPG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG); + } + } + + return status; +} + +/** + * @brief Disable the write protection of the desired pages + * @note An option byte erase is done automatically in this function. + * @note When the memory read protection level is selected (RDP level = 1), + * it is not possible to program or erase the flash page i if + * debug features are connected or boot code is executed in RAM, even if nWRPi = 1 + * + * @param WriteProtectPage specifies the page(s) to be write unprotected. + * The value of this parameter depend on device used within the same series + * @retval HAL status + */ +static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage) +{ + HAL_StatusTypeDef status = HAL_OK; + uint16_t WRP0_Data = 0xFFFF; +#if defined(FLASH_WRP1_WRP1) + uint16_t WRP1_Data = 0xFFFF; +#endif /* FLASH_WRP1_WRP1 */ +#if defined(FLASH_WRP2_WRP2) + uint16_t WRP2_Data = 0xFFFF; +#endif /* FLASH_WRP2_WRP2 */ +#if defined(FLASH_WRP3_WRP3) + uint16_t WRP3_Data = 0xFFFF; +#endif /* FLASH_WRP3_WRP3 */ + + /* Check the parameters */ + assert_param(IS_OB_WRP(WriteProtectPage)); + + /* Get current write protected pages and the new pages to be unprotected ******/ + WriteProtectPage = (FLASH_OB_GetWRP() | WriteProtectPage); + +#if defined(OB_WRP_PAGES0TO15MASK) + WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK); +#elif defined(OB_WRP_PAGES0TO31MASK) + WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK); +#endif /* OB_WRP_PAGES0TO31MASK */ + +#if defined(OB_WRP_PAGES16TO31MASK) + WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8U); +#elif defined(OB_WRP_PAGES32TO63MASK) + WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8U); +#endif /* OB_WRP_PAGES32TO63MASK */ + +#if defined(OB_WRP_PAGES64TO95MASK) + WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES64TO95MASK) >> 16U); +#endif /* OB_WRP_PAGES64TO95MASK */ +#if defined(OB_WRP_PAGES32TO47MASK) + WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO47MASK) >> 16U); +#endif /* OB_WRP_PAGES32TO47MASK */ + +#if defined(OB_WRP_PAGES96TO127MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES96TO127MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO255MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO255MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO511MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO511MASK) >> 24U); +#elif defined(OB_WRP_PAGES48TO127MASK) + WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24U); +#endif /* OB_WRP_PAGES96TO127MASK */ + + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* To be able to write again option byte, need to perform a option byte erase */ + status = HAL_FLASHEx_OBErase(); + if (status == HAL_OK) + { + SET_BIT(FLASH->CR, FLASH_CR_OPTPG); + +#if defined(FLASH_WRP0_WRP0) + if(WRP0_Data != 0xFFU) + { + OB->WRP0 |= WRP0_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP0_WRP0 */ + +#if defined(FLASH_WRP1_WRP1) + if((status == HAL_OK) && (WRP1_Data != 0xFFU)) + { + OB->WRP1 |= WRP1_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP1_WRP1 */ + +#if defined(FLASH_WRP2_WRP2) + if((status == HAL_OK) && (WRP2_Data != 0xFFU)) + { + OB->WRP2 |= WRP2_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP2_WRP2 */ + +#if defined(FLASH_WRP3_WRP3) + if((status == HAL_OK) && (WRP3_Data != 0xFFU)) + { + OB->WRP3 |= WRP3_Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + } +#endif /* FLASH_WRP3_WRP3 */ + + /* if the program operation is completed, disable the OPTPG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG); + } + } + return status; +} + +/** + * @brief Set the read protection level. + * @param ReadProtectLevel specifies the read protection level. + * This parameter can be one of the following values: + * @arg @ref OB_RDP_LEVEL_0 No protection + * @arg @ref OB_RDP_LEVEL_1 Read protection of the memory + * @retval HAL status + */ +static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t ReadProtectLevel) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_RDP_LEVEL(ReadProtectLevel)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* If the previous operation is completed, proceed to erase the option bytes */ + SET_BIT(FLASH->CR, FLASH_CR_OPTER); + SET_BIT(FLASH->CR, FLASH_CR_STRT); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the erase operation is completed, disable the OPTER Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTER); + + if(status == HAL_OK) + { + /* Enable the Option Bytes Programming operation */ + SET_BIT(FLASH->CR, FLASH_CR_OPTPG); + + WRITE_REG(OB->RDP, ReadProtectLevel); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* if the program operation is completed, disable the OPTPG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG); + } + } + + return status; +} + +/** + * @brief Program the FLASH User Option Byte. + * @note Programming of the OB should be performed only after an erase (otherwise PGERR occurs) + * @param UserConfig The FLASH User Option Bytes values FLASH_OBR_IWDG_SW(Bit2), + * FLASH_OBR_nRST_STOP(Bit3),FLASH_OBR_nRST_STDBY(Bit4). + * And BFBF2(Bit5) for STM32F101xG and STM32F103xG . + * @retval HAL status + */ +static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Check the parameters */ + assert_param(IS_OB_IWDG_SOURCE((UserConfig&OB_IWDG_SW))); + assert_param(IS_OB_STOP_SOURCE((UserConfig&OB_STOP_NO_RST))); + assert_param(IS_OB_STDBY_SOURCE((UserConfig&OB_STDBY_NO_RST))); +#if defined(FLASH_BANK2_END) + assert_param(IS_OB_BOOT1((UserConfig&OB_BOOT1_SET))); +#endif /* FLASH_BANK2_END */ + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* Enable the Option Bytes Programming operation */ + SET_BIT(FLASH->CR, FLASH_CR_OPTPG); + +#if defined(FLASH_BANK2_END) + OB->USER = (UserConfig | 0xF0U); +#else + OB->USER = (UserConfig | 0x88U); +#endif /* FLASH_BANK2_END */ + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* if the program operation is completed, disable the OPTPG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG); + } + + return status; +} + +/** + * @brief Programs a half word at a specified Option Byte Data address. + * @note The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface + * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes + * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes + * (system reset will occur) + * Programming of the OB should be performed only after an erase (otherwise PGERR occurs) + * @param Address specifies the address to be programmed. + * This parameter can be 0x1FFFF804 or 0x1FFFF806. + * @param Data specifies the data to be programmed. + * @retval HAL status + */ +static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data) +{ + HAL_StatusTypeDef status = HAL_ERROR; + + /* Check the parameters */ + assert_param(IS_OB_DATA_ADDRESS(Address)); + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + if(status == HAL_OK) + { + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + + /* Enables the Option Bytes Programming operation */ + SET_BIT(FLASH->CR, FLASH_CR_OPTPG); + *(__IO uint16_t*)Address = Data; + + /* Wait for last operation to be completed */ + status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); + + /* If the program operation is completed, disable the OPTPG Bit */ + CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG); + } + /* Return the Option Byte Data Program Status */ + return status; +} + +/** + * @brief Return the FLASH Write Protection Option Bytes value. + * @retval The FLASH Write Protection Option Bytes value + */ +static uint32_t FLASH_OB_GetWRP(void) +{ + /* Return the FLASH write protection Register value */ + return (uint32_t)(READ_REG(FLASH->WRPR)); +} + +/** + * @brief Returns the FLASH Read Protection level. + * @retval FLASH RDP level + * This parameter can be one of the following values: + * @arg @ref OB_RDP_LEVEL_0 No protection + * @arg @ref OB_RDP_LEVEL_1 Read protection of the memory + */ +static uint32_t FLASH_OB_GetRDP(void) +{ + uint32_t readstatus = OB_RDP_LEVEL_0; + uint32_t tmp_reg = 0U; + + /* Read RDP level bits */ + tmp_reg = READ_BIT(FLASH->OBR, FLASH_OBR_RDPRT); + + if (tmp_reg == FLASH_OBR_RDPRT) + { + readstatus = OB_RDP_LEVEL_1; + } + else + { + readstatus = OB_RDP_LEVEL_0; + } + + return readstatus; +} + +/** + * @brief Return the FLASH User Option Byte value. + * @retval The FLASH User Option Bytes values: FLASH_OBR_IWDG_SW(Bit2), + * FLASH_OBR_nRST_STOP(Bit3),FLASH_OBR_nRST_STDBY(Bit4). + * And FLASH_OBR_BFB2(Bit5) for STM32F101xG and STM32F103xG . + */ +static uint8_t FLASH_OB_GetUser(void) +{ + /* Return the User Option Byte */ + return (uint8_t)((READ_REG(FLASH->OBR) & FLASH_OBR_USER) >> FLASH_POSITION_IWDGSW_BIT); +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup FLASH + * @{ + */ + +/** @addtogroup FLASH_Private_Functions + * @{ + */ + +/** + * @brief Erase the specified FLASH memory page + * @param PageAddress FLASH page to erase + * The value of this parameter depend on device used within the same series + * + * @retval None + */ +void FLASH_PageErase(uint32_t PageAddress) +{ + /* Clean the error context */ + pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; + +#if defined(FLASH_BANK2_END) + if(PageAddress > FLASH_BANK1_END) + { + /* Proceed to erase the page */ + SET_BIT(FLASH->CR2, FLASH_CR2_PER); + WRITE_REG(FLASH->AR2, PageAddress); + SET_BIT(FLASH->CR2, FLASH_CR2_STRT); + } + else + { +#endif /* FLASH_BANK2_END */ + /* Proceed to erase the page */ + SET_BIT(FLASH->CR, FLASH_CR_PER); + WRITE_REG(FLASH->AR, PageAddress); + SET_BIT(FLASH->CR, FLASH_CR_STRT); +#if defined(FLASH_BANK2_END) + } +#endif /* FLASH_BANK2_END */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_FLASH_MODULE_ENABLED */ +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c new file mode 100644 index 0000000..6ba68a9 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c @@ -0,0 +1,587 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_gpio.c + * @author MCD Application Team + * @brief GPIO HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the General Purpose Input/Output (GPIO) peripheral: + * + Initialization and de-initialization functions + * + IO operation functions + * + @verbatim + ============================================================================== + ##### GPIO Peripheral features ##### + ============================================================================== + [..] + Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each + port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software + in several modes: + (+) Input mode + (+) Analog mode + (+) Output mode + (+) Alternate function mode + (+) External interrupt/event lines + + [..] + During and just after reset, the alternate functions and external interrupt + lines are not active and the I/O ports are configured in input floating mode. + + [..] + All GPIO pins have weak internal pull-up and pull-down resistors, which can be + activated or not. + + [..] + In Output or Alternate mode, each IO can be configured on open-drain or push-pull + type and the IO speed can be selected depending on the VDD value. + + [..] + All ports have external interrupt/event capability. To use external interrupt + lines, the port must be configured in input mode. All available GPIO pins are + connected to the 16 external interrupt/event lines from EXTI0 to EXTI15. + + [..] + The external interrupt/event controller consists of up to 20 edge detectors in connectivity + line devices, or 19 edge detectors in other devices for generating event/interrupt requests. + Each input line can be independently configured to select the type (event or interrupt) and + the corresponding trigger event (rising or falling or both). Each line can also masked + independently. A pending register maintains the status line of the interrupt requests + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Enable the GPIO APB2 clock using the following function : __HAL_RCC_GPIOx_CLK_ENABLE(). + + (#) Configure the GPIO pin(s) using HAL_GPIO_Init(). + (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure + (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef + structure. + (++) In case of Output or alternate function mode selection: the speed is + configured through "Speed" member from GPIO_InitTypeDef structure + (++) Analog mode is required when a pin is to be used as ADC channel + or DAC output. + (++) In case of external interrupt/event selection the "Mode" member from + GPIO_InitTypeDef structure select the type (interrupt or event) and + the corresponding trigger event (rising or falling or both). + + (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority + mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using + HAL_NVIC_EnableIRQ(). + + (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin(). + + (#) To set/reset the level of a pin configured in output mode use + HAL_GPIO_WritePin()/HAL_GPIO_TogglePin(). + + (#) To lock pin configuration until next reset use HAL_GPIO_LockPin(). + + (#) During and just after reset, the alternate functions are not + active and the GPIO pins are configured in input floating mode (except JTAG + pins). + + (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose + (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has + priority over the GPIO function. + + (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as + general purpose PD0 and PD1, respectively, when the HSE oscillator is off. + The HSE has priority over the GPIO function. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup GPIO GPIO + * @brief GPIO HAL module driver + * @{ + */ + +#ifdef HAL_GPIO_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @addtogroup GPIO_Private_Constants GPIO Private Constants + * @{ + */ +#define GPIO_MODE 0x00000003u +#define EXTI_MODE 0x10000000u +#define GPIO_MODE_IT 0x00010000u +#define GPIO_MODE_EVT 0x00020000u +#define RISING_EDGE 0x00100000u +#define FALLING_EDGE 0x00200000u +#define GPIO_OUTPUT_TYPE 0x00000010u + +#define GPIO_NUMBER 16u + +/* Definitions for bit manipulation of CRL and CRH register */ +#define GPIO_CR_MODE_INPUT 0x00000000u /*!< 00: Input mode (reset state) */ +#define GPIO_CR_CNF_ANALOG 0x00000000u /*!< 00: Analog mode */ +#define GPIO_CR_CNF_INPUT_FLOATING 0x00000004u /*!< 01: Floating input (reset state) */ +#define GPIO_CR_CNF_INPUT_PU_PD 0x00000008u /*!< 10: Input with pull-up / pull-down */ +#define GPIO_CR_CNF_GP_OUTPUT_PP 0x00000000u /*!< 00: General purpose output push-pull */ +#define GPIO_CR_CNF_GP_OUTPUT_OD 0x00000004u /*!< 01: General purpose output Open-drain */ +#define GPIO_CR_CNF_AF_OUTPUT_PP 0x00000008u /*!< 10: Alternate function output Push-pull */ +#define GPIO_CR_CNF_AF_OUTPUT_OD 0x0000000Cu /*!< 11: Alternate function output Open-drain */ + +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Functions GPIO Exported Functions + * @{ + */ + +/** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to initialize and de-initialize the GPIOs + to be ready for use. + +@endverbatim + * @{ + */ + + +/** + * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init. + * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral + * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains + * the configuration information for the specified GPIO peripheral. + * @retval None + */ +void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) +{ + uint32_t position = 0x00u; + uint32_t ioposition; + uint32_t iocurrent; + uint32_t temp; + uint32_t config = 0x00u; + __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */ + uint32_t registeroffset; /* offset used during computation of CNF and MODE bits placement inside CRL or CRH register */ + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_GPIO_PIN(GPIO_Init->Pin)); + assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); + + /* Configure the port pins */ + while (((GPIO_Init->Pin) >> position) != 0x00u) + { + /* Get the IO position */ + ioposition = (0x01uL << position); + + /* Get the current IO position */ + iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition; + + if (iocurrent == ioposition) + { + /* Check the Alternate function parameters */ + assert_param(IS_GPIO_AF_INSTANCE(GPIOx)); + + /* Based on the required mode, filling config variable with MODEy[1:0] and CNFy[3:2] corresponding bits */ + switch (GPIO_Init->Mode) + { + /* If we are configuring the pin in OUTPUT push-pull mode */ + case GPIO_MODE_OUTPUT_PP: + /* Check the GPIO speed parameter */ + assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_PP; + break; + + /* If we are configuring the pin in OUTPUT open-drain mode */ + case GPIO_MODE_OUTPUT_OD: + /* Check the GPIO speed parameter */ + assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_OD; + break; + + /* If we are configuring the pin in ALTERNATE FUNCTION push-pull mode */ + case GPIO_MODE_AF_PP: + /* Check the GPIO speed parameter */ + assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_PP; + break; + + /* If we are configuring the pin in ALTERNATE FUNCTION open-drain mode */ + case GPIO_MODE_AF_OD: + /* Check the GPIO speed parameter */ + assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_OD; + break; + + /* If we are configuring the pin in INPUT (also applicable to EVENT and IT mode) */ + case GPIO_MODE_INPUT: + case GPIO_MODE_IT_RISING: + case GPIO_MODE_IT_FALLING: + case GPIO_MODE_IT_RISING_FALLING: + case GPIO_MODE_EVT_RISING: + case GPIO_MODE_EVT_FALLING: + case GPIO_MODE_EVT_RISING_FALLING: + /* Check the GPIO pull parameter */ + assert_param(IS_GPIO_PULL(GPIO_Init->Pull)); + if (GPIO_Init->Pull == GPIO_NOPULL) + { + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_FLOATING; + } + else if (GPIO_Init->Pull == GPIO_PULLUP) + { + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD; + + /* Set the corresponding ODR bit */ + GPIOx->BSRR = ioposition; + } + else /* GPIO_PULLDOWN */ + { + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD; + + /* Reset the corresponding ODR bit */ + GPIOx->BRR = ioposition; + } + break; + + /* If we are configuring the pin in INPUT analog mode */ + case GPIO_MODE_ANALOG: + config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_ANALOG; + break; + + /* Parameters are checked with assert_param */ + default: + break; + } + + /* Check if the current bit belongs to first half or last half of the pin count number + in order to address CRH or CRL register*/ + configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL : &GPIOx->CRH; + registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2u) : ((position - 8u) << 2u); + + /* Apply the new configuration of the pin to the register */ + MODIFY_REG((*configregister), ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset), (config << registeroffset)); + + /*--------------------- EXTI Mode Configuration ------------------------*/ + /* Configure the External Interrupt or event for the current IO */ + if ((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) + { + /* Enable AFIO Clock */ + __HAL_RCC_AFIO_CLK_ENABLE(); + temp = AFIO->EXTICR[position >> 2u]; + CLEAR_BIT(temp, (0x0Fu) << (4u * (position & 0x03u))); + SET_BIT(temp, (GPIO_GET_INDEX(GPIOx)) << (4u * (position & 0x03u))); + AFIO->EXTICR[position >> 2u] = temp; + + + /* Configure the interrupt mask */ + if ((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) + { + SET_BIT(EXTI->IMR, iocurrent); + } + else + { + CLEAR_BIT(EXTI->IMR, iocurrent); + } + + /* Configure the event mask */ + if ((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) + { + SET_BIT(EXTI->EMR, iocurrent); + } + else + { + CLEAR_BIT(EXTI->EMR, iocurrent); + } + + /* Enable or disable the rising trigger */ + if ((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) + { + SET_BIT(EXTI->RTSR, iocurrent); + } + else + { + CLEAR_BIT(EXTI->RTSR, iocurrent); + } + + /* Enable or disable the falling trigger */ + if ((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) + { + SET_BIT(EXTI->FTSR, iocurrent); + } + else + { + CLEAR_BIT(EXTI->FTSR, iocurrent); + } + } + } + + position++; + } +} + +/** + * @brief De-initializes the GPIOx peripheral registers to their default reset values. + * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral + * @param GPIO_Pin: specifies the port bit to be written. + * This parameter can be one of GPIO_PIN_x where x can be (0..15). + * @retval None + */ +void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin) +{ + uint32_t position = 0x00u; + uint32_t iocurrent; + uint32_t tmp; + __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */ + uint32_t registeroffset; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + /* Configure the port pins */ + while ((GPIO_Pin >> position) != 0u) + { + /* Get current io position */ + iocurrent = (GPIO_Pin) & (1uL << position); + + if (iocurrent) + { + /*------------------------- EXTI Mode Configuration --------------------*/ + /* Clear the External Interrupt or Event for the current IO */ + + tmp = AFIO->EXTICR[position >> 2u]; + tmp &= 0x0FuL << (4u * (position & 0x03u)); + if (tmp == (GPIO_GET_INDEX(GPIOx) << (4u * (position & 0x03u)))) + { + tmp = 0x0FuL << (4u * (position & 0x03u)); + CLEAR_BIT(AFIO->EXTICR[position >> 2u], tmp); + + /* Clear EXTI line configuration */ + CLEAR_BIT(EXTI->IMR, (uint32_t)iocurrent); + CLEAR_BIT(EXTI->EMR, (uint32_t)iocurrent); + + /* Clear Rising Falling edge configuration */ + CLEAR_BIT(EXTI->RTSR, (uint32_t)iocurrent); + CLEAR_BIT(EXTI->FTSR, (uint32_t)iocurrent); + } + /*------------------------- GPIO Mode Configuration --------------------*/ + /* Check if the current bit belongs to first half or last half of the pin count number + in order to address CRH or CRL register */ + configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL : &GPIOx->CRH; + registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2u) : ((position - 8u) << 2u); + + /* CRL/CRH default value is floating input(0x04) shifted to correct position */ + MODIFY_REG(*configregister, ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset), GPIO_CRL_CNF0_0 << registeroffset); + + /* ODR default value is 0 */ + CLEAR_BIT(GPIOx->ODR, iocurrent); + } + + position++; + } +} + +/** + * @} + */ + +/** @defgroup GPIO_Exported_Functions_Group2 IO operation functions + * @brief GPIO Read and Write + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the GPIOs. + +@endverbatim + * @{ + */ + +/** + * @brief Reads the specified input port pin. + * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral + * @param GPIO_Pin: specifies the port bit to read. + * This parameter can be GPIO_PIN_x where x can be (0..15). + * @retval The input port pin value. + */ +GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) +{ + GPIO_PinState bitstatus; + + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET) + { + bitstatus = GPIO_PIN_SET; + } + else + { + bitstatus = GPIO_PIN_RESET; + } + return bitstatus; +} + +/** + * @brief Sets or clears the selected data port bit. + * + * @note This function uses GPIOx_BSRR register to allow atomic read/modify + * accesses. In this way, there is no risk of an IRQ occurring between + * the read and the modify access. + * + * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral + * @param GPIO_Pin: specifies the port bit to be written. + * This parameter can be one of GPIO_PIN_x where x can be (0..15). + * @param PinState: specifies the value to be written to the selected bit. + * This parameter can be one of the GPIO_PinState enum values: + * @arg GPIO_PIN_RESET: to clear the port pin + * @arg GPIO_PIN_SET: to set the port pin + * @retval None + */ +void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState) +{ + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + assert_param(IS_GPIO_PIN_ACTION(PinState)); + + if (PinState != GPIO_PIN_RESET) + { + GPIOx->BSRR = GPIO_Pin; + } + else + { + GPIOx->BSRR = (uint32_t)GPIO_Pin << 16u; + } +} + +/** + * @brief Toggles the specified GPIO pin + * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral + * @param GPIO_Pin: Specifies the pins to be toggled. + * @retval None + */ +void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) +{ + uint32_t odr; + + /* Check the parameters */ + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + /* get current Ouput Data Register value */ + odr = GPIOx->ODR; + + /* Set selected pins that were at low level, and reset ones that were high */ + GPIOx->BSRR = ((odr & GPIO_Pin) << GPIO_NUMBER) | (~odr & GPIO_Pin); +} + +/** +* @brief Locks GPIO Pins configuration registers. +* @note The locking mechanism allows the IO configuration to be frozen. When the LOCK sequence +* has been applied on a port bit, it is no longer possible to modify the value of the port bit until +* the next reset. +* @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral +* @param GPIO_Pin: specifies the port bit to be locked. +* This parameter can be any combination of GPIO_Pin_x where x can be (0..15). +* @retval None +*/ +HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) +{ + __IO uint32_t tmp = GPIO_LCKR_LCKK; + + /* Check the parameters */ + assert_param(IS_GPIO_LOCK_INSTANCE(GPIOx)); + assert_param(IS_GPIO_PIN(GPIO_Pin)); + + /* Apply lock key write sequence */ + SET_BIT(tmp, GPIO_Pin); + /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ + GPIOx->LCKR = tmp; + /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */ + GPIOx->LCKR = GPIO_Pin; + /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ + GPIOx->LCKR = tmp; + /* Read LCKK register. This read is mandatory to complete key lock sequence */ + tmp = GPIOx->LCKR; + + /* read again in order to confirm lock is active */ + if ((uint32_t)(GPIOx->LCKR & GPIO_LCKR_LCKK)) + { + return HAL_OK; + } + else + { + return HAL_ERROR; + } +} + +/** + * @brief This function handles EXTI interrupt request. + * @param GPIO_Pin: Specifies the pins connected EXTI line + * @retval None + */ +void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) +{ + /* EXTI line interrupt detected */ + if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u) + { + __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); + HAL_GPIO_EXTI_Callback(GPIO_Pin); + } +} + +/** + * @brief EXTI line detection callbacks. + * @param GPIO_Pin: Specifies the pins connected EXTI line + * @retval None + */ +__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(GPIO_Pin); + /* NOTE: This function Should not be modified, when the callback is needed, + the HAL_GPIO_EXTI_Callback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_GPIO_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c new file mode 100644 index 0000000..e6dea5b --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c @@ -0,0 +1,127 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_gpio_ex.c + * @author MCD Application Team + * @brief GPIO Extension HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the General Purpose Input/Output (GPIO) extension peripheral. + * + Extended features functions + * + @verbatim + ============================================================================== + ##### GPIO Peripheral extension features ##### + ============================================================================== + [..] GPIO module on STM32F1 family, manage also the AFIO register: + (+) Possibility to use the EVENTOUT Cortex feature + + ##### How to use this driver ##### + ============================================================================== + [..] This driver provides functions to use EVENTOUT Cortex feature + (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() + (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() + (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup GPIOEx GPIOEx + * @brief GPIO HAL module driver + * @{ + */ + +#ifdef HAL_GPIO_MODULE_ENABLED + +/** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions + * @{ + */ + +/** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions + * @brief Extended features functions + * +@verbatim + ============================================================================== + ##### Extended features functions ##### + ============================================================================== + [..] This section provides functions allowing to: + (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() + (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() + (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() + +@endverbatim + * @{ + */ + +/** + * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. + * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal. + * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT. + * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal. + * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN. + * @retval None + */ +void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource) +{ + /* Verify the parameters */ + assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource)); + assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource)); + + /* Apply the new configuration */ + MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource)); +} + +/** + * @brief Enables the Event Output. + * @retval None + */ +void HAL_GPIOEx_EnableEventout(void) +{ + SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); +} + +/** + * @brief Disables the Event Output. + * @retval None + */ +void HAL_GPIOEx_DisableEventout(void) +{ + CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_GPIO_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c new file mode 100644 index 0000000..a9bf56b --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c @@ -0,0 +1,621 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_pwr.c + * @author MCD Application Team + * @brief PWR HAL module driver. + * + * This file provides firmware functions to manage the following + * functionalities of the Power Controller (PWR) peripheral: + * + Initialization/de-initialization functions + * + Peripheral Control functions + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup PWR PWR + * @brief PWR HAL module driver + * @{ + */ + +#ifdef HAL_PWR_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +/** @defgroup PWR_Private_Constants PWR Private Constants + * @{ + */ + +/** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask + * @{ + */ +#define PVD_MODE_IT 0x00010000U +#define PVD_MODE_EVT 0x00020000U +#define PVD_RISING_EDGE 0x00000001U +#define PVD_FALLING_EDGE 0x00000002U +/** + * @} + */ + + +/** @defgroup PWR_register_alias_address PWR Register alias address + * @{ + */ +/* ------------- PWR registers bit address in the alias region ---------------*/ +#define PWR_OFFSET (PWR_BASE - PERIPH_BASE) +#define PWR_CR_OFFSET 0x00U +#define PWR_CSR_OFFSET 0x04U +#define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET) +#define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET) +/** + * @} + */ + +/** @defgroup PWR_CR_register_alias PWR CR Register alias address + * @{ + */ +/* --- CR Register ---*/ +/* Alias word address of LPSDSR bit */ +#define LPSDSR_BIT_NUMBER PWR_CR_LPDS_Pos +#define CR_LPSDSR_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPSDSR_BIT_NUMBER * 4U))) + +/* Alias word address of DBP bit */ +#define DBP_BIT_NUMBER PWR_CR_DBP_Pos +#define CR_DBP_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (DBP_BIT_NUMBER * 4U))) + +/* Alias word address of PVDE bit */ +#define PVDE_BIT_NUMBER PWR_CR_PVDE_Pos +#define CR_PVDE_BB ((uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (PVDE_BIT_NUMBER * 4U))) + +/** + * @} + */ + +/** @defgroup PWR_CSR_register_alias PWR CSR Register alias address + * @{ + */ + +/* --- CSR Register ---*/ +/* Alias word address of EWUP1 bit */ +#define CSR_EWUP_BB(VAL) ((uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (POSITION_VAL(VAL) * 4U))) +/** + * @} + */ + +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup PWR_Private_Functions PWR Private Functions + * brief WFE cortex command overloaded for HAL_PWR_EnterSTOPMode usage only (see Workaround section) + * @{ + */ +static void PWR_OverloadWfe(void); + +/* Private functions ---------------------------------------------------------*/ +__NOINLINE +static void PWR_OverloadWfe(void) +{ + __asm volatile( "wfe" ); + __asm volatile( "nop" ); +} + +/** + * @} + */ + + +/** @defgroup PWR_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @defgroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + After reset, the backup domain (RTC registers, RTC backup data + registers) is protected against possible unwanted + write accesses. + To enable access to the RTC Domain and RTC registers, proceed as follows: + (+) Enable the Power Controller (PWR) APB1 interface clock using the + __HAL_RCC_PWR_CLK_ENABLE() macro. + (+) Enable access to RTC domain using the HAL_PWR_EnableBkUpAccess() function. + +@endverbatim + * @{ + */ + +/** + * @brief Deinitializes the PWR peripheral registers to their default reset values. + * @retval None + */ +void HAL_PWR_DeInit(void) +{ + __HAL_RCC_PWR_FORCE_RESET(); + __HAL_RCC_PWR_RELEASE_RESET(); +} + +/** + * @brief Enables access to the backup domain (RTC registers, RTC + * backup data registers ). + * @note If the HSE divided by 128 is used as the RTC clock, the + * Backup Domain Access should be kept enabled. + * @retval None + */ +void HAL_PWR_EnableBkUpAccess(void) +{ + /* Enable access to RTC and backup registers */ + *(__IO uint32_t *) CR_DBP_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables access to the backup domain (RTC registers, RTC + * backup data registers). + * @note If the HSE divided by 128 is used as the RTC clock, the + * Backup Domain Access should be kept enabled. + * @retval None + */ +void HAL_PWR_DisableBkUpAccess(void) +{ + /* Disable access to RTC and backup registers */ + *(__IO uint32_t *) CR_DBP_BB = (uint32_t)DISABLE; +} + +/** + * @} + */ + +/** @defgroup PWR_Exported_Functions_Group2 Peripheral Control functions + * @brief Low Power modes configuration functions + * +@verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + + *** PVD configuration *** + ========================= + [..] + (+) The PVD is used to monitor the VDD power supply by comparing it to a + threshold selected by the PVD Level (PLS[2:0] bits in the PWR_CR). + + (+) A PVDO flag is available to indicate if VDD/VDDA is higher or lower + than the PVD threshold. This event is internally connected to the EXTI + line16 and can generate an interrupt if enabled. This is done through + __HAL_PVD_EXTI_ENABLE_IT() macro. + (+) The PVD is stopped in Standby mode. + + *** WakeUp pin configuration *** + ================================ + [..] + (+) WakeUp pin is used to wake up the system from Standby mode. This pin is + forced in input pull-down configuration and is active on rising edges. + (+) There is one WakeUp pin: + WakeUp Pin 1 on PA.00. + + [..] + + *** Low Power modes configuration *** + ===================================== + [..] + The device features 3 low-power modes: + (+) Sleep mode: CPU clock off, all peripherals including Cortex-M3 core peripherals like + NVIC, SysTick, etc. are kept running + (+) Stop mode: All clocks are stopped + (+) Standby mode: 1.8V domain powered off + + + *** Sleep mode *** + ================== + [..] + (+) Entry: + The Sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFx) + functions with + (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction + (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction + + (+) Exit: + (++) WFI entry mode, Any peripheral interrupt acknowledged by the nested vectored interrupt + controller (NVIC) can wake up the device from Sleep mode. + (++) WFE entry mode, Any wakeup event can wake up the device from Sleep mode. + (+++) Any peripheral interrupt w/o NVIC configuration & SEVONPEND bit set in the Cortex (HAL_PWR_EnableSEVOnPend) + (+++) Any EXTI Line (Internal or External) configured in Event mode + + *** Stop mode *** + ================= + [..] + The Stop mode is based on the Cortex-M3 deepsleep mode combined with peripheral + clock gating. The voltage regulator can be configured either in normal or low-power mode. + In Stop mode, all clocks in the 1.8 V domain are stopped, the PLL, the HSI and the HSE RC + oscillators are disabled. SRAM and register contents are preserved. + In Stop mode, all I/O pins keep the same state as in Run mode. + + (+) Entry: + The Stop mode is entered using the HAL_PWR_EnterSTOPMode(PWR_REGULATOR_VALUE, PWR_SLEEPENTRY_WFx ) + function with: + (++) PWR_REGULATOR_VALUE= PWR_MAINREGULATOR_ON: Main regulator ON. + (++) PWR_REGULATOR_VALUE= PWR_LOWPOWERREGULATOR_ON: Low Power regulator ON. + (++) PWR_SLEEPENTRY_WFx= PWR_SLEEPENTRY_WFI: enter STOP mode with WFI instruction + (++) PWR_SLEEPENTRY_WFx= PWR_SLEEPENTRY_WFE: enter STOP mode with WFE instruction + (+) Exit: + (++) WFI entry mode, Any EXTI Line (Internal or External) configured in Interrupt mode with NVIC configured + (++) WFE entry mode, Any EXTI Line (Internal or External) configured in Event mode. + + *** Standby mode *** + ==================== + [..] + The Standby mode allows to achieve the lowest power consumption. It is based on the + Cortex-M3 deepsleep mode, with the voltage regulator disabled. The 1.8 V domain is + consequently powered off. The PLL, the HSI oscillator and the HSE oscillator are also + switched off. SRAM and register contents are lost except for registers in the Backup domain + and Standby circuitry + + (+) Entry: + (++) The Standby mode is entered using the HAL_PWR_EnterSTANDBYMode() function. + (+) Exit: + (++) WKUP pin rising edge, RTC alarm event rising edge, external Reset in + NRSTpin, IWDG Reset + + *** Auto-wakeup (AWU) from low-power mode *** + ============================================= + [..] + + (+) The MCU can be woken up from low-power mode by an RTC Alarm event, + without depending on an external interrupt (Auto-wakeup mode). + + (+) RTC auto-wakeup (AWU) from the Stop and Standby modes + + (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to + configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function. + + *** PWR Workarounds linked to Silicon Limitation *** + ==================================================== + [..] + Below the list of all silicon limitations known on STM32F1xx prouct. + + (#)Workarounds Implemented inside PWR HAL Driver + (##)Debugging Stop mode with WFE entry - overloaded the WFE by an internal function + +@endverbatim + * @{ + */ + +/** + * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD). + * @param sConfigPVD: pointer to an PWR_PVDTypeDef structure that contains the configuration + * information for the PVD. + * @note Refer to the electrical characteristics of your device datasheet for + * more details about the voltage threshold corresponding to each + * detection level. + * @retval None + */ +void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD) +{ + /* Check the parameters */ + assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel)); + assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode)); + + /* Set PLS[7:5] bits according to PVDLevel value */ + MODIFY_REG(PWR->CR, PWR_CR_PLS, sConfigPVD->PVDLevel); + + /* Clear any previous config. Keep it clear if no event or IT mode is selected */ + __HAL_PWR_PVD_EXTI_DISABLE_EVENT(); + __HAL_PWR_PVD_EXTI_DISABLE_IT(); + __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); + __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); + + /* Configure interrupt mode */ + if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT) + { + __HAL_PWR_PVD_EXTI_ENABLE_IT(); + } + + /* Configure event mode */ + if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT) + { + __HAL_PWR_PVD_EXTI_ENABLE_EVENT(); + } + + /* Configure the edge */ + if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE) + { + __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); + } + + if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE) + { + __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); + } +} + +/** + * @brief Enables the Power Voltage Detector(PVD). + * @retval None + */ +void HAL_PWR_EnablePVD(void) +{ + /* Enable the power voltage detector */ + *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Power Voltage Detector(PVD). + * @retval None + */ +void HAL_PWR_DisablePVD(void) +{ + /* Disable the power voltage detector */ + *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)DISABLE; +} + +/** + * @brief Enables the WakeUp PINx functionality. + * @param WakeUpPinx: Specifies the Power Wake-Up pin to enable. + * This parameter can be one of the following values: + * @arg PWR_WAKEUP_PIN1 + * @retval None + */ +void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx) +{ + /* Check the parameter */ + assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); + /* Enable the EWUPx pin */ + *(__IO uint32_t *) CSR_EWUP_BB(WakeUpPinx) = (uint32_t)ENABLE; +} + +/** + * @brief Disables the WakeUp PINx functionality. + * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. + * This parameter can be one of the following values: + * @arg PWR_WAKEUP_PIN1 + * @retval None + */ +void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) +{ + /* Check the parameter */ + assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); + /* Disable the EWUPx pin */ + *(__IO uint32_t *) CSR_EWUP_BB(WakeUpPinx) = (uint32_t)DISABLE; +} + +/** + * @brief Enters Sleep mode. + * @note In Sleep mode, all I/O pins keep the same state as in Run mode. + * @param Regulator: Regulator state as no effect in SLEEP mode - allows to support portability from legacy software + * @param SLEEPEntry: Specifies if SLEEP mode is entered with WFI or WFE instruction. + * When WFI entry is used, tick interrupt have to be disabled if not desired as + * the interrupt wake up source. + * This parameter can be one of the following values: + * @arg PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction + * @arg PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction + * @retval None + */ +void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry) +{ + /* Check the parameters */ + /* No check on Regulator because parameter not used in SLEEP mode */ + /* Prevent unused argument(s) compilation warning */ + UNUSED(Regulator); + + assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry)); + + /* Clear SLEEPDEEP bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* Select SLEEP mode entry -------------------------------------------------*/ + if(SLEEPEntry == PWR_SLEEPENTRY_WFI) + { + /* Request Wait For Interrupt */ + __WFI(); + } + else + { + /* Request Wait For Event */ + __SEV(); + __WFE(); + __WFE(); + } +} + +/** + * @brief Enters Stop mode. + * @note In Stop mode, all I/O pins keep the same state as in Run mode. + * @note When exiting Stop mode by using an interrupt or a wakeup event, + * HSI RC oscillator is selected as system clock. + * @note When the voltage regulator operates in low power mode, an additional + * startup delay is incurred when waking up from Stop mode. + * By keeping the internal regulator ON during Stop mode, the consumption + * is higher although the startup time is reduced. + * @param Regulator: Specifies the regulator state in Stop mode. + * This parameter can be one of the following values: + * @arg PWR_MAINREGULATOR_ON: Stop mode with regulator ON + * @arg PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON + * @param STOPEntry: Specifies if Stop mode in entered with WFI or WFE instruction. + * This parameter can be one of the following values: + * @arg PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction + * @arg PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction + * @retval None + */ +void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) +{ + /* Check the parameters */ + assert_param(IS_PWR_REGULATOR(Regulator)); + assert_param(IS_PWR_STOP_ENTRY(STOPEntry)); + + /* Clear PDDS bit in PWR register to specify entering in STOP mode when CPU enter in Deepsleep */ + CLEAR_BIT(PWR->CR, PWR_CR_PDDS); + + /* Select the voltage regulator mode by setting LPDS bit in PWR register according to Regulator parameter value */ + MODIFY_REG(PWR->CR, PWR_CR_LPDS, Regulator); + + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* Select Stop mode entry --------------------------------------------------*/ + if(STOPEntry == PWR_STOPENTRY_WFI) + { + /* Request Wait For Interrupt */ + __WFI(); + } + else + { + /* Request Wait For Event */ + __SEV(); + PWR_OverloadWfe(); /* WFE redefine locally */ + PWR_OverloadWfe(); /* WFE redefine locally */ + } + /* Reset SLEEPDEEP bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); +} + +/** + * @brief Enters Standby mode. + * @note In Standby mode, all I/O pins are high impedance except for: + * - Reset pad (still available) + * - TAMPER pin if configured for tamper or calibration out. + * - WKUP pin (PA0) if enabled. + * @retval None + */ +void HAL_PWR_EnterSTANDBYMode(void) +{ + /* Select Standby mode */ + SET_BIT(PWR->CR, PWR_CR_PDDS); + + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); + + /* This option is used to ensure that store operations are completed */ +#if defined ( __CC_ARM) + __force_stores(); +#endif + /* Request Wait For Interrupt */ + __WFI(); +} + + +/** + * @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode. + * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor + * re-enters SLEEP mode when an interruption handling is over. + * Setting this bit is useful when the processor is expected to run only on + * interruptions handling. + * @retval None + */ +void HAL_PWR_EnableSleepOnExit(void) +{ + /* Set SLEEPONEXIT bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); +} + + +/** + * @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode. + * @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor + * re-enters SLEEP mode when an interruption handling is over. + * @retval None + */ +void HAL_PWR_DisableSleepOnExit(void) +{ + /* Clear SLEEPONEXIT bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk)); +} + + +/** + * @brief Enables CORTEX M3 SEVONPEND bit. + * @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes + * WFE to wake up when an interrupt moves from inactive to pended. + * @retval None + */ +void HAL_PWR_EnableSEVOnPend(void) +{ + /* Set SEVONPEND bit of Cortex System Control Register */ + SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); +} + + +/** + * @brief Disables CORTEX M3 SEVONPEND bit. + * @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes + * WFE to wake up when an interrupt moves from inactive to pended. + * @retval None + */ +void HAL_PWR_DisableSEVOnPend(void) +{ + /* Clear SEVONPEND bit of Cortex System Control Register */ + CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); +} + + + +/** + * @brief This function handles the PWR PVD interrupt request. + * @note This API should be called under the PVD_IRQHandler(). + * @retval None + */ +void HAL_PWR_PVD_IRQHandler(void) +{ + /* Check PWR exti flag */ + if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET) + { + /* PWR PVD interrupt user callback */ + HAL_PWR_PVDCallback(); + + /* Clear PWR Exti pending bit */ + __HAL_PWR_PVD_EXTI_CLEAR_FLAG(); + } +} + +/** + * @brief PWR PVD interrupt callback + * @retval None + */ +__weak void HAL_PWR_PVDCallback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_PWR_PVDCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_PWR_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c new file mode 100644 index 0000000..fb3c5be --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c @@ -0,0 +1,1403 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_rcc.c + * @author MCD Application Team + * @brief RCC HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Reset and Clock Control (RCC) peripheral: + * + Initialization and de-initialization functions + * + Peripheral Control functions + * + @verbatim + ============================================================================== + ##### RCC specific features ##### + ============================================================================== + [..] + After reset the device is running from Internal High Speed oscillator + (HSI 8MHz) with Flash 0 wait state, Flash prefetch buffer is enabled, + and all peripherals are off except internal SRAM, Flash and JTAG. + (+) There is no prescaler on High speed (AHB) and Low speed (APB) buses; + all peripherals mapped on these buses are running at HSI speed. + (+) The clock for all peripherals is switched off, except the SRAM and FLASH. + (+) All GPIOs are in input floating state, except the JTAG pins which + are assigned to be used for debug purpose. + [..] Once the device started from reset, the user application has to: + (+) Configure the clock source to be used to drive the System clock + (if the application needs higher frequency/performance) + (+) Configure the System clock frequency and Flash settings + (+) Configure the AHB and APB buses prescalers + (+) Enable the clock for the peripheral(s) to be used + (+) Configure the clock source(s) for peripherals whose clocks are not + derived from the System clock (I2S, RTC, ADC, USB OTG FS) + + ##### RCC Limitations ##### + ============================================================================== + [..] + A delay between an RCC peripheral clock enable and the effective peripheral + enabling should be taken into account in order to manage the peripheral read/write + from/to registers. + (+) This delay depends on the peripheral mapping. + (++) AHB & APB peripherals, 1 dummy read is necessary + + [..] + Workarounds: + (#) For AHB & APB peripherals, a dummy read to the peripheral register has been + inserted in each __HAL_RCC_PPP_CLK_ENABLE() macro. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup RCC RCC +* @brief RCC HAL module driver + * @{ + */ + +#ifdef HAL_RCC_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup RCC_Private_Constants RCC Private Constants + * @{ + */ +/** + * @} + */ +/* Private macro -------------------------------------------------------------*/ +/** @defgroup RCC_Private_Macros RCC Private Macros + * @{ + */ + +#define MCO1_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() +#define MCO1_GPIO_PORT GPIOA +#define MCO1_PIN GPIO_PIN_8 + +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/** @defgroup RCC_Private_Variables RCC Private Variables + * @{ + */ +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +static void RCC_Delay(uint32_t mdelay); + +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup RCC_Exported_Functions RCC Exported Functions + * @{ + */ + +/** @defgroup RCC_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * + @verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to configure the internal/external oscillators + (HSE, HSI, LSE, LSI, PLL, CSS and MCO) and the System buses clocks (SYSCLK, AHB, APB1 + and APB2). + + [..] Internal/external clock and PLL configuration + (#) HSI (high-speed internal), 8 MHz factory-trimmed RC used directly or through + the PLL as System clock source. + (#) LSI (low-speed internal), ~40 KHz low consumption RC used as IWDG and/or RTC + clock source. + + (#) HSE (high-speed external), 4 to 24 MHz (STM32F100xx) or 4 to 16 MHz (STM32F101x/STM32F102x/STM32F103x) or 3 to 25 MHz (STM32F105x/STM32F107x) crystal oscillator used directly or + through the PLL as System clock source. Can be used also as RTC clock source. + + (#) LSE (low-speed external), 32 KHz oscillator used as RTC clock source. + + (#) PLL (clocked by HSI or HSE), featuring different output clocks: + (++) The first output is used to generate the high speed system clock (up to 72 MHz for STM32F10xxx or up to 24 MHz for STM32F100xx) + (++) The second output is used to generate the clock for the USB OTG FS (48 MHz) + + (#) CSS (Clock security system), once enable using the macro __HAL_RCC_CSS_ENABLE() + and if a HSE clock failure occurs(HSE used directly or through PLL as System + clock source), the System clocks automatically switched to HSI and an interrupt + is generated if enabled. The interrupt is linked to the Cortex-M3 NMI + (Non-Maskable Interrupt) exception vector. + + (#) MCO1 (microcontroller clock output), used to output SYSCLK, HSI, + HSE or PLL clock (divided by 2) on PA8 pin + PLL2CLK, PLL3CLK/2, PLL3CLK and XTI for STM32F105x/STM32F107x + + [..] System, AHB and APB buses clocks configuration + (#) Several clock sources can be used to drive the System clock (SYSCLK): HSI, + HSE and PLL. + The AHB clock (HCLK) is derived from System clock through configurable + prescaler and used to clock the CPU, memory and peripherals mapped + on AHB bus (DMA, GPIO...). APB1 (PCLK1) and APB2 (PCLK2) clocks are derived + from AHB clock through configurable prescalers and used to clock + the peripherals mapped on these buses. You can use + "@ref HAL_RCC_GetSysClockFreq()" function to retrieve the frequencies of these clocks. + + -@- All the peripheral clocks are derived from the System clock (SYSCLK) except: + (+@) RTC: RTC clock can be derived either from the LSI, LSE or HSE clock + divided by 128. + (+@) USB OTG FS and RTC: USB OTG FS require a frequency equal to 48 MHz + to work correctly. This clock is derived of the main PLL through PLL Multiplier. + (+@) I2S interface on STM32F105x/STM32F107x can be derived from PLL3CLK + (+@) IWDG clock which is always the LSI clock. + + (#) For STM32F10xxx, the maximum frequency of the SYSCLK and HCLK/PCLK2 is 72 MHz, PCLK1 36 MHz. + For STM32F100xx, the maximum frequency of the SYSCLK and HCLK/PCLK1/PCLK2 is 24 MHz. + Depending on the SYSCLK frequency, the flash latency should be adapted accordingly. + @endverbatim + * @{ + */ + +/* + Additional consideration on the SYSCLK based on Latency settings: + +-----------------------------------------------+ + | Latency | SYSCLK clock frequency (MHz) | + |---------------|-------------------------------| + |0WS(1CPU cycle)| 0 < SYSCLK <= 24 | + |---------------|-------------------------------| + |1WS(2CPU cycle)| 24 < SYSCLK <= 48 | + |---------------|-------------------------------| + |2WS(3CPU cycle)| 48 < SYSCLK <= 72 | + +-----------------------------------------------+ + */ + +/** + * @brief Resets the RCC clock configuration to the default reset state. + * @note The default reset state of the clock configuration is given below: + * - HSI ON and used as system clock source + * - HSE, PLL, PLL2 and PLL3 are OFF + * - AHB, APB1 and APB2 prescaler set to 1. + * - CSS and MCO1 OFF + * - All interrupts disabled + * - All flags are cleared + * @note This function does not modify the configuration of the + * - Peripheral clocks + * - LSI, LSE and RTC clocks + * @retval HAL_StatusTypeDef + */ +HAL_StatusTypeDef HAL_RCC_DeInit(void) +{ + uint32_t tickstart; + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Set HSION bit */ + SET_BIT(RCC->CR, RCC_CR_HSION); + + /* Wait till HSI is ready */ + while (READ_BIT(RCC->CR, RCC_CR_HSIRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Set HSITRIM bits to the reset value */ + MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, (0x10U << RCC_CR_HSITRIM_Pos)); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Reset CFGR register */ + CLEAR_REG(RCC->CFGR); + + /* Wait till clock switch is ready */ + while (READ_BIT(RCC->CFGR, RCC_CFGR_SWS) != RESET) + { + if ((HAL_GetTick() - tickstart) > CLOCKSWITCH_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Update the SystemCoreClock global variable */ + SystemCoreClock = HSI_VALUE; + + /* Adapt Systick interrupt period */ + if (HAL_InitTick(uwTickPrio) != HAL_OK) + { + return HAL_ERROR; + } + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Second step is to clear PLLON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLLON); + + /* Wait till PLL is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Ensure to reset PLLSRC and PLLMUL bits */ + CLEAR_REG(RCC->CFGR); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Reset HSEON & CSSON bits */ + CLEAR_BIT(RCC->CR, RCC_CR_HSEON | RCC_CR_CSSON); + + /* Wait till HSE is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_HSERDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Reset HSEBYP bit */ + CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); + +#if defined(RCC_PLL2_SUPPORT) + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Clear PLL2ON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLL2ON); + + /* Wait till PLL2 is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLL2RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } +#endif /* RCC_PLL2_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Clear PLL3ON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLL3ON); + + /* Wait till PLL3 is disabled */ + while (READ_BIT(RCC->CR, RCC_CR_PLL3RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(RCC_CFGR2_PREDIV1) + /* Reset CFGR2 register */ + CLEAR_REG(RCC->CFGR2); +#endif /* RCC_CFGR2_PREDIV1 */ + + /* Reset all CSR flags */ + SET_BIT(RCC->CSR, RCC_CSR_RMVF); + + /* Disable all interrupts */ + CLEAR_REG(RCC->CIR); + + return HAL_OK; +} + +/** + * @brief Initializes the RCC Oscillators according to the specified parameters in the + * RCC_OscInitTypeDef. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that + * contains the configuration information for the RCC Oscillators. + * @note The PLL is not disabled when used as system clock. + * @note The PLL is not disabled when USB OTG FS clock is enabled (specific to devices with USB FS) + * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not + * supported by this macro. User should request a transition to LSE Off + * first and then LSE On or LSE Bypass. + * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not + * supported by this macro. User should request a transition to HSE Off + * first and then HSE On or HSE Bypass. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + uint32_t tickstart; + uint32_t pll_config; + + /* Check Null pointer */ + if (RCC_OscInitStruct == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_RCC_OSCILLATORTYPE(RCC_OscInitStruct->OscillatorType)); + + /*------------------------------- HSE Configuration ------------------------*/ + if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) + { + /* Check the parameters */ + assert_param(IS_RCC_HSE(RCC_OscInitStruct->HSEState)); + + /* When the HSE is used as system clock or clock source for PLL in these cases it is not allowed to be disabled */ + if ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSE) + || ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE))) + { + if ((__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) && (RCC_OscInitStruct->HSEState == RCC_HSE_OFF)) + { + return HAL_ERROR; + } + } + else + { + /* Set the new HSE configuration ---------------------------------------*/ + __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState); + + + /* Check the HSE State */ + if (RCC_OscInitStruct->HSEState != RCC_HSE_OFF) + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSE is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSE is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*----------------------------- HSI Configuration --------------------------*/ + if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) + { + /* Check the parameters */ + assert_param(IS_RCC_HSI(RCC_OscInitStruct->HSIState)); + assert_param(IS_RCC_CALIBRATION_VALUE(RCC_OscInitStruct->HSICalibrationValue)); + + /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ + if ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSI) + || ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI_DIV2))) + { + /* When HSI is used as system clock it will not disabled */ + if ((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON)) + { + return HAL_ERROR; + } + /* Otherwise, just the calibration is allowed */ + else + { + /* Adjusts the Internal High Speed oscillator (HSI) calibration value.*/ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + } + else + { + /* Check the HSI State */ + if (RCC_OscInitStruct->HSIState != RCC_HSI_OFF) + { + /* Enable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSI is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Adjusts the Internal High Speed oscillator (HSI) calibration value.*/ + __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(RCC_OscInitStruct->HSICalibrationValue); + } + else + { + /* Disable the Internal High Speed oscillator (HSI). */ + __HAL_RCC_HSI_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till HSI is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > HSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + /*------------------------------ LSI Configuration -------------------------*/ + if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) + { + /* Check the parameters */ + assert_param(IS_RCC_LSI(RCC_OscInitStruct->LSIState)); + + /* Check the LSI State */ + if (RCC_OscInitStruct->LSIState != RCC_LSI_OFF) + { + /* Enable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSI is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + /* To have a fully stabilized clock in the specified range, a software delay of 1ms + should be added.*/ + RCC_Delay(1); + } + else + { + /* Disable the Internal Low Speed oscillator (LSI). */ + __HAL_RCC_LSI_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSI is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > LSI_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + /*------------------------------ LSE Configuration -------------------------*/ + if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) + { + FlagStatus pwrclkchanged = RESET; + + /* Check the parameters */ + assert_param(IS_RCC_LSE(RCC_OscInitStruct->LSEState)); + + /* Update LSE configuration in Backup Domain control register */ + /* Requires to enable write access to Backup Domain of necessary */ + if (__HAL_RCC_PWR_IS_CLK_DISABLED()) + { + __HAL_RCC_PWR_CLK_ENABLE(); + pwrclkchanged = SET; + } + + if (HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + /* Enable write access to Backup domain */ + SET_BIT(PWR->CR, PWR_CR_DBP); + + /* Wait for Backup domain Write protection disable */ + tickstart = HAL_GetTick(); + + while (HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + if ((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Set the new LSE configuration -----------------------------------------*/ + __HAL_RCC_LSE_CONFIG(RCC_OscInitStruct->LSEState); + /* Check the LSE State */ + if (RCC_OscInitStruct->LSEState != RCC_LSE_OFF) + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Require to disable power clock if necessary */ + if (pwrclkchanged == SET) + { + __HAL_RCC_PWR_CLK_DISABLE(); + } + } + +#if defined(RCC_CR_PLL2ON) + /*-------------------------------- PLL2 Configuration -----------------------*/ + /* Check the parameters */ + assert_param(IS_RCC_PLL2(RCC_OscInitStruct->PLL2.PLL2State)); + if ((RCC_OscInitStruct->PLL2.PLL2State) != RCC_PLL2_NONE) + { + /* This bit can not be cleared if the PLL2 clock is used indirectly as system + clock (i.e. it is used as PLL clock entry that is used as system clock). */ + if ((__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE) && \ + (__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && \ + ((READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC)) == RCC_CFGR2_PREDIV1SRC_PLL2)) + { + return HAL_ERROR; + } + else + { + if ((RCC_OscInitStruct->PLL2.PLL2State) == RCC_PLL2_ON) + { + /* Check the parameters */ + assert_param(IS_RCC_PLL2_MUL(RCC_OscInitStruct->PLL2.PLL2MUL)); + assert_param(IS_RCC_HSE_PREDIV2(RCC_OscInitStruct->PLL2.HSEPrediv2Value)); + + /* Prediv2 can be written only when the PLLI2S is disabled. */ + /* Return an error only if new value is different from the programmed value */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL3ON) && \ + (__HAL_RCC_HSE_GET_PREDIV2() != RCC_OscInitStruct->PLL2.HSEPrediv2Value)) + { + return HAL_ERROR; + } + + /* Disable the main PLL2. */ + __HAL_RCC_PLL2_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the HSE prediv2 factor --------------------------------*/ + __HAL_RCC_HSE_PREDIV2_CONFIG(RCC_OscInitStruct->PLL2.HSEPrediv2Value); + + /* Configure the main PLL2 multiplication factors. */ + __HAL_RCC_PLL2_CONFIG(RCC_OscInitStruct->PLL2.PLL2MUL); + + /* Enable the main PLL2. */ + __HAL_RCC_PLL2_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Set PREDIV1 source to HSE */ + CLEAR_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC); + + /* Disable the main PLL2. */ + __HAL_RCC_PLL2_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + } + +#endif /* RCC_CR_PLL2ON */ + /*-------------------------------- PLL Configuration -----------------------*/ + /* Check the parameters */ + assert_param(IS_RCC_PLL(RCC_OscInitStruct->PLL.PLLState)); + if ((RCC_OscInitStruct->PLL.PLLState) != RCC_PLL_NONE) + { + /* Check if the PLL is used as system clock or not */ + if (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_PLLCLK) + { + if ((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_ON) + { + /* Check the parameters */ + assert_param(IS_RCC_PLLSOURCE(RCC_OscInitStruct->PLL.PLLSource)); + assert_param(IS_RCC_PLL_MUL(RCC_OscInitStruct->PLL.PLLMUL)); + + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the HSE prediv factor --------------------------------*/ + /* It can be written only when the PLL is disabled. Not used in PLL source is different than HSE */ + if (RCC_OscInitStruct->PLL.PLLSource == RCC_PLLSOURCE_HSE) + { + /* Check the parameter */ + assert_param(IS_RCC_HSE_PREDIV(RCC_OscInitStruct->HSEPredivValue)); +#if defined(RCC_CFGR2_PREDIV1SRC) + assert_param(IS_RCC_PREDIV1_SOURCE(RCC_OscInitStruct->Prediv1Source)); + + /* Set PREDIV1 source */ + SET_BIT(RCC->CFGR2, RCC_OscInitStruct->Prediv1Source); +#endif /* RCC_CFGR2_PREDIV1SRC */ + + /* Set PREDIV1 Value */ + __HAL_RCC_HSE_PREDIV_CONFIG(RCC_OscInitStruct->HSEPredivValue); + } + + /* Configure the main PLL clock source and multiplication factors. */ + __HAL_RCC_PLL_CONFIG(RCC_OscInitStruct->PLL.PLLSource, + RCC_OscInitStruct->PLL.PLLMUL); + /* Enable the main PLL. */ + __HAL_RCC_PLL_ENABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Disable the main PLL. */ + __HAL_RCC_PLL_DISABLE(); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till PLL is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + else + { + /* Check if there is a request to disable the PLL used as System clock source */ + if ((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_OFF) + { + return HAL_ERROR; + } + else + { + /* Do not return HAL_ERROR if request repeats the current configuration */ + pll_config = RCC->CFGR; + if ((READ_BIT(pll_config, RCC_CFGR_PLLSRC) != RCC_OscInitStruct->PLL.PLLSource) || + (READ_BIT(pll_config, RCC_CFGR_PLLMULL) != RCC_OscInitStruct->PLL.PLLMUL)) + { + return HAL_ERROR; + } + } + } + } + + return HAL_OK; +} + +/** + * @brief Initializes the CPU, AHB and APB buses clocks according to the specified + * parameters in the RCC_ClkInitStruct. + * @param RCC_ClkInitStruct pointer to an RCC_OscInitTypeDef structure that + * contains the configuration information for the RCC peripheral. + * @param FLatency FLASH Latency + * The value of this parameter depend on device used within the same series + * @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency + * and updated by @ref HAL_RCC_GetHCLKFreq() function called within this function + * + * @note The HSI is used (enabled by hardware) as system clock source after + * start-up from Reset, wake-up from STOP and STANDBY mode, or in case + * of failure of the HSE used directly or indirectly as system clock + * (if the Clock Security System CSS is enabled). + * + * @note A switch from one clock source to another occurs only if the target + * clock source is ready (clock stable after start-up delay or PLL locked). + * If a clock source which is not yet ready is selected, the switch will + * occur when the clock source will be ready. + * You can use @ref HAL_RCC_GetClockConfig() function to know which clock is + * currently used as system clock source. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency) +{ + uint32_t tickstart; + + /* Check Null pointer */ + if (RCC_ClkInitStruct == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_RCC_CLOCKTYPE(RCC_ClkInitStruct->ClockType)); + assert_param(IS_FLASH_LATENCY(FLatency)); + + /* To correctly read data from FLASH memory, the number of wait states (LATENCY) + must be correctly programmed according to the frequency of the CPU clock + (HCLK) of the device. */ + +#if defined(FLASH_ACR_LATENCY) + /* Increasing the number of wait states because of higher CPU frequency */ + if (FLatency > __HAL_FLASH_GET_LATENCY()) + { + /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ + __HAL_FLASH_SET_LATENCY(FLatency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + if (__HAL_FLASH_GET_LATENCY() != FLatency) + { + return HAL_ERROR; + } +} + +#endif /* FLASH_ACR_LATENCY */ +/*-------------------------- HCLK Configuration --------------------------*/ +if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) + { + /* Set the highest APBx dividers in order to ensure that we do not go through + a non-spec phase whatever we decrease or increase HCLK. */ + if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) + { + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, RCC_HCLK_DIV16); + } + + if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2) + { + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, (RCC_HCLK_DIV16 << 3)); + } + + /* Set the new HCLK clock divider */ + assert_param(IS_RCC_HCLK(RCC_ClkInitStruct->AHBCLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, RCC_ClkInitStruct->AHBCLKDivider); + } + + /*------------------------- SYSCLK Configuration ---------------------------*/ + if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK) + { + assert_param(IS_RCC_SYSCLKSOURCE(RCC_ClkInitStruct->SYSCLKSource)); + + /* HSE is selected as System Clock Source */ + if (RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE) + { + /* Check the HSE ready flag */ + if (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) + { + return HAL_ERROR; + } + } + /* PLL is selected as System Clock Source */ + else if (RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_PLLCLK) + { + /* Check the PLL ready flag */ + if (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) + { + return HAL_ERROR; + } + } + /* HSI is selected as System Clock Source */ + else + { + /* Check the HSI ready flag */ + if (__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) + { + return HAL_ERROR; + } + } + __HAL_RCC_SYSCLK_CONFIG(RCC_ClkInitStruct->SYSCLKSource); + + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + while (__HAL_RCC_GET_SYSCLK_SOURCE() != (RCC_ClkInitStruct->SYSCLKSource << RCC_CFGR_SWS_Pos)) + { + if ((HAL_GetTick() - tickstart) > CLOCKSWITCH_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + +#if defined(FLASH_ACR_LATENCY) + /* Decreasing the number of wait states because of lower CPU frequency */ + if (FLatency < __HAL_FLASH_GET_LATENCY()) + { + /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ + __HAL_FLASH_SET_LATENCY(FLatency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + if (__HAL_FLASH_GET_LATENCY() != FLatency) + { + return HAL_ERROR; + } +} +#endif /* FLASH_ACR_LATENCY */ + +/*-------------------------- PCLK1 Configuration ---------------------------*/ +if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) + { + assert_param(IS_RCC_PCLK(RCC_ClkInitStruct->APB1CLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, RCC_ClkInitStruct->APB1CLKDivider); + } + + /*-------------------------- PCLK2 Configuration ---------------------------*/ + if (((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2) + { + assert_param(IS_RCC_PCLK(RCC_ClkInitStruct->APB2CLKDivider)); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, ((RCC_ClkInitStruct->APB2CLKDivider) << 3)); + } + + /* Update the SystemCoreClock global variable */ + SystemCoreClock = HAL_RCC_GetSysClockFreq() >> AHBPrescTable[(RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos]; + + /* Configure the source of time base considering new system clocks settings*/ + HAL_InitTick(uwTickPrio); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup RCC_Exported_Functions_Group2 Peripheral Control functions + * @brief RCC clocks control functions + * + @verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the RCC Clocks + frequencies. + + @endverbatim + * @{ + */ + +/** + * @brief Selects the clock source to output on MCO pin. + * @note MCO pin should be configured in alternate function mode. + * @param RCC_MCOx specifies the output direction for the clock source. + * This parameter can be one of the following values: + * @arg @ref RCC_MCO1 Clock source to output on MCO1 pin(PA8). + * @param RCC_MCOSource specifies the clock source to output. + * This parameter can be one of the following values: + * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock + * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock + @if STM32F105xC + * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL2CLK PLL2 clock selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL3CLK_DIV2 PLL3 clock divided by 2 selected as MCO source + * @arg @ref RCC_MCO1SOURCE_EXT_HSE XT1 external 3-25 MHz oscillator clock selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL3CLK PLL3 clock selected as MCO source + @endif + @if STM32F107xC + * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL2CLK PLL2 clock selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL3CLK_DIV2 PLL3 clock divided by 2 selected as MCO source + * @arg @ref RCC_MCO1SOURCE_EXT_HSE XT1 external 3-25 MHz oscillator clock selected as MCO source + * @arg @ref RCC_MCO1SOURCE_PLL3CLK PLL3 clock selected as MCO source + @endif + * @param RCC_MCODiv specifies the MCO DIV. + * This parameter can be one of the following values: + * @arg @ref RCC_MCODIV_1 no division applied to MCO clock + * @retval None + */ +void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv) +{ + GPIO_InitTypeDef gpio = {0U}; + + /* Check the parameters */ + assert_param(IS_RCC_MCO(RCC_MCOx)); + assert_param(IS_RCC_MCODIV(RCC_MCODiv)); + assert_param(IS_RCC_MCO1SOURCE(RCC_MCOSource)); + + /* Prevent unused argument(s) compilation warning */ + UNUSED(RCC_MCOx); + UNUSED(RCC_MCODiv); + + /* Configure the MCO1 pin in alternate function mode */ + gpio.Mode = GPIO_MODE_AF_PP; + gpio.Speed = GPIO_SPEED_FREQ_HIGH; + gpio.Pull = GPIO_NOPULL; + gpio.Pin = MCO1_PIN; + + /* MCO1 Clock Enable */ + MCO1_CLK_ENABLE(); + + HAL_GPIO_Init(MCO1_GPIO_PORT, &gpio); + + /* Configure the MCO clock source */ + __HAL_RCC_MCO1_CONFIG(RCC_MCOSource, RCC_MCODiv); +} + +/** + * @brief Enables the Clock Security System. + * @note If a failure is detected on the HSE oscillator clock, this oscillator + * is automatically disabled and an interrupt is generated to inform the + * software about the failure (Clock Security System Interrupt, CSSI), + * allowing the MCU to perform rescue operations. The CSSI is linked to + * the Cortex-M3 NMI (Non-Maskable Interrupt) exception vector. + * @retval None + */ +void HAL_RCC_EnableCSS(void) +{ + *(__IO uint32_t *) RCC_CR_CSSON_BB = (uint32_t)ENABLE; +} + +/** + * @brief Disables the Clock Security System. + * @retval None + */ +void HAL_RCC_DisableCSS(void) +{ + *(__IO uint32_t *) RCC_CR_CSSON_BB = (uint32_t)DISABLE; +} + +/** + * @brief Returns the SYSCLK frequency + * @note The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(*) + * @note If SYSCLK source is HSE, function returns a value based on HSE_VALUE + * divided by PREDIV factor(**) + * @note If SYSCLK source is PLL, function returns a value based on HSE_VALUE + * divided by PREDIV factor(**) or HSI_VALUE(*) multiplied by the PLL factor. + * @note (*) HSI_VALUE is a constant defined in stm32f1xx_hal_conf.h file (default value + * 8 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * @note (**) HSE_VALUE is a constant defined in stm32f1xx_hal_conf.h file (default value + * 8 MHz), user has to ensure that HSE_VALUE is same as the real + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * + * @note The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @note This function can be used by the user application to compute the + * baud-rate for the communication peripherals or configure other parameters. + * + * @note Each time SYSCLK changes, this function must be called to update the + * right SYSCLK value. Otherwise, any configuration based on this function will be incorrect. + * + * @retval SYSCLK frequency + */ +uint32_t HAL_RCC_GetSysClockFreq(void) +{ +#if defined(RCC_CFGR2_PREDIV1SRC) + const uint8_t aPLLMULFactorTable[14] = {0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 13}; + const uint8_t aPredivFactorTable[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; +#else + const uint8_t aPLLMULFactorTable[16] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16}; +#if defined(RCC_CFGR2_PREDIV1) + const uint8_t aPredivFactorTable[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; +#else + const uint8_t aPredivFactorTable[2] = {1, 2}; +#endif /*RCC_CFGR2_PREDIV1*/ + +#endif + uint32_t tmpreg = 0U, prediv = 0U, pllclk = 0U, pllmul = 0U; + uint32_t sysclockfreq = 0U; +#if defined(RCC_CFGR2_PREDIV1SRC) + uint32_t prediv2 = 0U, pll2mul = 0U; +#endif /*RCC_CFGR2_PREDIV1SRC*/ + + tmpreg = RCC->CFGR; + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (tmpreg & RCC_CFGR_SWS) + { + case RCC_SYSCLKSOURCE_STATUS_HSE: /* HSE used as system clock */ + { + sysclockfreq = HSE_VALUE; + break; + } + case RCC_SYSCLKSOURCE_STATUS_PLLCLK: /* PLL used as system clock */ + { + pllmul = aPLLMULFactorTable[(uint32_t)(tmpreg & RCC_CFGR_PLLMULL) >> RCC_CFGR_PLLMULL_Pos]; + if ((tmpreg & RCC_CFGR_PLLSRC) != RCC_PLLSOURCE_HSI_DIV2) + { +#if defined(RCC_CFGR2_PREDIV1) + prediv = aPredivFactorTable[(uint32_t)(RCC->CFGR2 & RCC_CFGR2_PREDIV1) >> RCC_CFGR2_PREDIV1_Pos]; +#else + prediv = aPredivFactorTable[(uint32_t)(RCC->CFGR & RCC_CFGR_PLLXTPRE) >> RCC_CFGR_PLLXTPRE_Pos]; +#endif /*RCC_CFGR2_PREDIV1*/ +#if defined(RCC_CFGR2_PREDIV1SRC) + + if (HAL_IS_BIT_SET(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC)) + { + /* PLL2 selected as Prediv1 source */ + /* PLLCLK = PLL2CLK / PREDIV1 * PLLMUL with PLL2CLK = HSE/PREDIV2 * PLL2MUL */ + prediv2 = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> RCC_CFGR2_PREDIV2_Pos) + 1; + pll2mul = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> RCC_CFGR2_PLL2MUL_Pos) + 2; + pllclk = (uint32_t)(((uint64_t)HSE_VALUE * (uint64_t)pll2mul * (uint64_t)pllmul) / ((uint64_t)prediv2 * (uint64_t)prediv)); + } + else + { + /* HSE used as PLL clock source : PLLCLK = HSE/PREDIV1 * PLLMUL */ + pllclk = (uint32_t)((HSE_VALUE * pllmul) / prediv); + } + + /* If PLLMUL was set to 13 means that it was to cover the case PLLMUL 6.5 (avoid using float) */ + /* In this case need to divide pllclk by 2 */ + if (pllmul == aPLLMULFactorTable[(uint32_t)(RCC_CFGR_PLLMULL6_5) >> RCC_CFGR_PLLMULL_Pos]) + { + pllclk = pllclk / 2; + } +#else + /* HSE used as PLL clock source : PLLCLK = HSE/PREDIV1 * PLLMUL */ + pllclk = (uint32_t)((HSE_VALUE * pllmul) / prediv); +#endif /*RCC_CFGR2_PREDIV1SRC*/ + } + else + { + /* HSI used as PLL clock source : PLLCLK = HSI/2 * PLLMUL */ + pllclk = (uint32_t)((HSI_VALUE >> 1) * pllmul); + } + sysclockfreq = pllclk; + break; + } + case RCC_SYSCLKSOURCE_STATUS_HSI: /* HSI used as system clock source */ + default: /* HSI used as system clock */ + { + sysclockfreq = HSI_VALUE; + break; + } + } + return sysclockfreq; +} + +/** + * @brief Returns the HCLK frequency + * @note Each time HCLK changes, this function must be called to update the + * right HCLK value. Otherwise, any configuration based on this function will be incorrect. + * + * @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency + * and updated within this function + * @retval HCLK frequency + */ +uint32_t HAL_RCC_GetHCLKFreq(void) +{ + return SystemCoreClock; +} + +/** + * @brief Returns the PCLK1 frequency + * @note Each time PCLK1 changes, this function must be called to update the + * right PCLK1 value. Otherwise, any configuration based on this function will be incorrect. + * @retval PCLK1 frequency + */ +uint32_t HAL_RCC_GetPCLK1Freq(void) +{ + /* Get HCLK source and Compute PCLK1 frequency ---------------------------*/ + return (HAL_RCC_GetHCLKFreq() >> APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE1) >> RCC_CFGR_PPRE1_Pos]); +} + +/** + * @brief Returns the PCLK2 frequency + * @note Each time PCLK2 changes, this function must be called to update the + * right PCLK2 value. Otherwise, any configuration based on this function will be incorrect. + * @retval PCLK2 frequency + */ +uint32_t HAL_RCC_GetPCLK2Freq(void) +{ + /* Get HCLK source and Compute PCLK2 frequency ---------------------------*/ + return (HAL_RCC_GetHCLKFreq() >> APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE2) >> RCC_CFGR_PPRE2_Pos]); +} + +/** + * @brief Configures the RCC_OscInitStruct according to the internal + * RCC configuration registers. + * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that + * will be configured. + * @retval None + */ +void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) +{ + /* Check the parameters */ + assert_param(RCC_OscInitStruct != NULL); + + /* Set all possible values for the Oscillator type parameter ---------------*/ + RCC_OscInitStruct->OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI \ + | RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_LSI; + +#if defined(RCC_CFGR2_PREDIV1SRC) + /* Get the Prediv1 source --------------------------------------------------*/ + RCC_OscInitStruct->Prediv1Source = READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC); +#endif /* RCC_CFGR2_PREDIV1SRC */ + + /* Get the HSE configuration -----------------------------------------------*/ + if ((RCC->CR & RCC_CR_HSEBYP) == RCC_CR_HSEBYP) + { + RCC_OscInitStruct->HSEState = RCC_HSE_BYPASS; + } + else if ((RCC->CR & RCC_CR_HSEON) == RCC_CR_HSEON) + { + RCC_OscInitStruct->HSEState = RCC_HSE_ON; + } + else + { + RCC_OscInitStruct->HSEState = RCC_HSE_OFF; + } + RCC_OscInitStruct->HSEPredivValue = __HAL_RCC_HSE_GET_PREDIV(); + + /* Get the HSI configuration -----------------------------------------------*/ + if ((RCC->CR & RCC_CR_HSION) == RCC_CR_HSION) + { + RCC_OscInitStruct->HSIState = RCC_HSI_ON; + } + else + { + RCC_OscInitStruct->HSIState = RCC_HSI_OFF; + } + + RCC_OscInitStruct->HSICalibrationValue = (uint32_t)((RCC->CR & RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos); + + /* Get the LSE configuration -----------------------------------------------*/ + if ((RCC->BDCR & RCC_BDCR_LSEBYP) == RCC_BDCR_LSEBYP) + { + RCC_OscInitStruct->LSEState = RCC_LSE_BYPASS; + } + else if ((RCC->BDCR & RCC_BDCR_LSEON) == RCC_BDCR_LSEON) + { + RCC_OscInitStruct->LSEState = RCC_LSE_ON; + } + else + { + RCC_OscInitStruct->LSEState = RCC_LSE_OFF; + } + + /* Get the LSI configuration -----------------------------------------------*/ + if ((RCC->CSR & RCC_CSR_LSION) == RCC_CSR_LSION) + { + RCC_OscInitStruct->LSIState = RCC_LSI_ON; + } + else + { + RCC_OscInitStruct->LSIState = RCC_LSI_OFF; + } + + + /* Get the PLL configuration -----------------------------------------------*/ + if ((RCC->CR & RCC_CR_PLLON) == RCC_CR_PLLON) + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_ON; + } + else + { + RCC_OscInitStruct->PLL.PLLState = RCC_PLL_OFF; + } + RCC_OscInitStruct->PLL.PLLSource = (uint32_t)(RCC->CFGR & RCC_CFGR_PLLSRC); + RCC_OscInitStruct->PLL.PLLMUL = (uint32_t)(RCC->CFGR & RCC_CFGR_PLLMULL); +#if defined(RCC_CR_PLL2ON) + /* Get the PLL2 configuration -----------------------------------------------*/ + if ((RCC->CR & RCC_CR_PLL2ON) == RCC_CR_PLL2ON) + { + RCC_OscInitStruct->PLL2.PLL2State = RCC_PLL2_ON; + } + else + { + RCC_OscInitStruct->PLL2.PLL2State = RCC_PLL2_OFF; + } + RCC_OscInitStruct->PLL2.HSEPrediv2Value = __HAL_RCC_HSE_GET_PREDIV2(); + RCC_OscInitStruct->PLL2.PLL2MUL = (uint32_t)(RCC->CFGR2 & RCC_CFGR2_PLL2MUL); +#endif /* RCC_CR_PLL2ON */ +} + +/** + * @brief Get the RCC_ClkInitStruct according to the internal + * RCC configuration registers. + * @param RCC_ClkInitStruct pointer to an RCC_ClkInitTypeDef structure that + * contains the current clock configuration. + * @param pFLatency Pointer on the Flash Latency. + * @retval None + */ +void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency) +{ + /* Check the parameters */ + assert_param(RCC_ClkInitStruct != NULL); + assert_param(pFLatency != NULL); + + /* Set all possible values for the Clock type parameter --------------------*/ + RCC_ClkInitStruct->ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + + /* Get the SYSCLK configuration --------------------------------------------*/ + RCC_ClkInitStruct->SYSCLKSource = (uint32_t)(RCC->CFGR & RCC_CFGR_SW); + + /* Get the HCLK configuration ----------------------------------------------*/ + RCC_ClkInitStruct->AHBCLKDivider = (uint32_t)(RCC->CFGR & RCC_CFGR_HPRE); + + /* Get the APB1 configuration ----------------------------------------------*/ + RCC_ClkInitStruct->APB1CLKDivider = (uint32_t)(RCC->CFGR & RCC_CFGR_PPRE1); + + /* Get the APB2 configuration ----------------------------------------------*/ + RCC_ClkInitStruct->APB2CLKDivider = (uint32_t)((RCC->CFGR & RCC_CFGR_PPRE2) >> 3); + +#if defined(FLASH_ACR_LATENCY) + /* Get the Flash Wait State (Latency) configuration ------------------------*/ + *pFLatency = (uint32_t)(FLASH->ACR & FLASH_ACR_LATENCY); +#else + /* For VALUE lines devices, only LATENCY_0 can be set*/ + *pFLatency = (uint32_t)FLASH_LATENCY_0; +#endif +} + +/** + * @brief This function handles the RCC CSS interrupt request. + * @note This API should be called under the NMI_Handler(). + * @retval None + */ +void HAL_RCC_NMI_IRQHandler(void) +{ + /* Check RCC CSSF flag */ + if (__HAL_RCC_GET_IT(RCC_IT_CSS)) + { + /* RCC Clock Security System interrupt user callback */ + HAL_RCC_CSSCallback(); + + /* Clear RCC CSS pending bit */ + __HAL_RCC_CLEAR_IT(RCC_IT_CSS); + } +} + +/** + * @brief This function provides delay (in milliseconds) based on CPU cycles method. + * @param mdelay: specifies the delay time length, in milliseconds. + * @retval None + */ +static void RCC_Delay(uint32_t mdelay) +{ + __IO uint32_t Delay = mdelay * (SystemCoreClock / 8U / 1000U); + do + { + __NOP(); + } + while (Delay --); +} + +/** + * @brief RCC Clock Security System interrupt callback + * @retval none + */ +__weak void HAL_RCC_CSSCallback(void) +{ + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_RCC_CSSCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_RCC_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c new file mode 100644 index 0000000..a5be9af --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c @@ -0,0 +1,863 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_rcc_ex.c + * @author MCD Application Team + * @brief Extended RCC HAL module driver. + * This file provides firmware functions to manage the following + * functionalities RCC extension peripheral: + * + Extended Peripheral Control functions + * + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +#ifdef HAL_RCC_MODULE_ENABLED + +/** @defgroup RCCEx RCCEx + * @brief RCC Extension HAL module driver. + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/** @defgroup RCCEx_Private_Constants RCCEx Private Constants + * @{ + */ +/** + * @} + */ + +/* Private macro -------------------------------------------------------------*/ +/** @defgroup RCCEx_Private_Macros RCCEx Private Macros + * @{ + */ +/** + * @} + */ + +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/** @defgroup RCCEx_Exported_Functions RCCEx Exported Functions + * @{ + */ + +/** @defgroup RCCEx_Exported_Functions_Group1 Peripheral Control functions + * @brief Extended Peripheral Control functions + * +@verbatim + =============================================================================== + ##### Extended Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the RCC Clocks + frequencies. + [..] + (@) Important note: Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to + select the RTC clock source; in this case the Backup domain will be reset in + order to modify the RTC Clock source, as consequence RTC registers (including + the backup registers) are set to their reset values. + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the RCC extended peripherals clocks according to the specified parameters in the + * RCC_PeriphCLKInitTypeDef. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * contains the configuration information for the Extended Peripherals clocks(RTC clock). + * + * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select + * the RTC clock source; in this case the Backup domain will be reset in + * order to modify the RTC Clock source, as consequence RTC registers (including + * the backup registers) are set to their reset values. + * + * @note In case of STM32F105xC or STM32F107xC devices, PLLI2S will be enabled if requested on + * one of 2 I2S interfaces. When PLLI2S is enabled, you need to call HAL_RCCEx_DisablePLLI2S to + * manually disable it. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t tickstart = 0U, temp_reg = 0U; +#if defined(STM32F105xC) || defined(STM32F107xC) + uint32_t pllactive = 0U; +#endif /* STM32F105xC || STM32F107xC */ + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection)); + + /*------------------------------- RTC/LCD Configuration ------------------------*/ + if ((((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC)) + { + FlagStatus pwrclkchanged = RESET; + + /* check for RTC Parameters used to output RTCCLK */ + assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection)); + + /* As soon as function is called to change RTC clock source, activation of the + power domain is done. */ + /* Requires to enable write access to Backup Domain of necessary */ + if (__HAL_RCC_PWR_IS_CLK_DISABLED()) + { + __HAL_RCC_PWR_CLK_ENABLE(); + pwrclkchanged = SET; + } + + if (HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + /* Enable write access to Backup domain */ + SET_BIT(PWR->CR, PWR_CR_DBP); + + /* Wait for Backup domain Write protection disable */ + tickstart = HAL_GetTick(); + + while (HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP)) + { + if ((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + /* Reset the Backup domain only if the RTC Clock source selection is modified from reset value */ + temp_reg = (RCC->BDCR & RCC_BDCR_RTCSEL); + if ((temp_reg != 0x00000000U) && (temp_reg != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))) + { + /* Store the content of BDCR register before the reset of Backup Domain */ + temp_reg = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); + /* RTC Clock selection can be changed only if the Backup Domain is reset */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + /* Restore the Content of BDCR register */ + RCC->BDCR = temp_reg; + + /* Wait for LSERDY if LSE was enabled */ + if (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSEON)) + { + /* Get Start Tick */ + tickstart = HAL_GetTick(); + + /* Wait till LSE is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > RCC_LSE_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + } + __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); + + /* Require to disable power clock if necessary */ + if (pwrclkchanged == SET) + { + __HAL_RCC_PWR_CLK_DISABLE(); + } + } + + /*------------------------------ ADC clock Configuration ------------------*/ + if (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) + { + /* Check the parameters */ + assert_param(IS_RCC_ADCPLLCLK_DIV(PeriphClkInit->AdcClockSelection)); + + /* Configure the ADC clock source */ + __HAL_RCC_ADC_CONFIG(PeriphClkInit->AdcClockSelection); + } + +#if defined(STM32F105xC) || defined(STM32F107xC) + /*------------------------------ I2S2 Configuration ------------------------*/ + if (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) + { + /* Check the parameters */ + assert_param(IS_RCC_I2S2CLKSOURCE(PeriphClkInit->I2s2ClockSelection)); + + /* Configure the I2S2 clock source */ + __HAL_RCC_I2S2_CONFIG(PeriphClkInit->I2s2ClockSelection); + } + + /*------------------------------ I2S3 Configuration ------------------------*/ + if (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) + { + /* Check the parameters */ + assert_param(IS_RCC_I2S3CLKSOURCE(PeriphClkInit->I2s3ClockSelection)); + + /* Configure the I2S3 clock source */ + __HAL_RCC_I2S3_CONFIG(PeriphClkInit->I2s3ClockSelection); + } + + /*------------------------------ PLL I2S Configuration ----------------------*/ + /* Check that PLLI2S need to be enabled */ + if (HAL_IS_BIT_SET(RCC->CFGR2, RCC_CFGR2_I2S2SRC) || HAL_IS_BIT_SET(RCC->CFGR2, RCC_CFGR2_I2S3SRC)) + { + /* Update flag to indicate that PLL I2S should be active */ + pllactive = 1; + } + + /* Check if PLL I2S need to be enabled */ + if (pllactive == 1) + { + /* Enable PLL I2S only if not active */ + if (HAL_IS_BIT_CLR(RCC->CR, RCC_CR_PLL3ON)) + { + /* Check the parameters */ + assert_param(IS_RCC_PLLI2S_MUL(PeriphClkInit->PLLI2S.PLLI2SMUL)); + assert_param(IS_RCC_HSE_PREDIV2(PeriphClkInit->PLLI2S.HSEPrediv2Value)); + + /* Prediv2 can be written only when the PLL2 is disabled. */ + /* Return an error only if new value is different from the programmed value */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL2ON) && \ + (__HAL_RCC_HSE_GET_PREDIV2() != PeriphClkInit->PLLI2S.HSEPrediv2Value)) + { + return HAL_ERROR; + } + + /* Configure the HSE prediv2 factor --------------------------------*/ + __HAL_RCC_HSE_PREDIV2_CONFIG(PeriphClkInit->PLLI2S.HSEPrediv2Value); + + /* Configure the main PLLI2S multiplication factors. */ + __HAL_RCC_PLLI2S_CONFIG(PeriphClkInit->PLLI2S.PLLI2SMUL); + + /* Enable the main PLLI2S. */ + __HAL_RCC_PLLI2S_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLLI2S is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* Return an error only if user wants to change the PLLI2SMUL whereas PLLI2S is active */ + if (READ_BIT(RCC->CFGR2, RCC_CFGR2_PLL3MUL) != PeriphClkInit->PLLI2S.PLLI2SMUL) + { + return HAL_ERROR; + } + } + } +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) + /*------------------------------ USB clock Configuration ------------------*/ + if (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) + { + /* Check the parameters */ + assert_param(IS_RCC_USBPLLCLK_DIV(PeriphClkInit->UsbClockSelection)); + + /* Configure the USB clock source */ + __HAL_RCC_USB_CONFIG(PeriphClkInit->UsbClockSelection); + } +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + + return HAL_OK; +} + +/** + * @brief Get the PeriphClkInit according to the internal + * RCC configuration registers. + * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that + * returns the configuration information for the Extended Peripherals clocks(RTC, I2S, ADC clocks). + * @retval None + */ +void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) +{ + uint32_t srcclk = 0U; + + /* Set all possible values for the extended clock type parameter------------*/ + PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_RTC; + + /* Get the RTC configuration -----------------------------------------------*/ + srcclk = __HAL_RCC_GET_RTC_SOURCE(); + /* Source clock is LSE or LSI*/ + PeriphClkInit->RTCClockSelection = srcclk; + + /* Get the ADC clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_ADC; + PeriphClkInit->AdcClockSelection = __HAL_RCC_GET_ADC_SOURCE(); + +#if defined(STM32F105xC) || defined(STM32F107xC) + /* Get the I2S2 clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2S2; + PeriphClkInit->I2s2ClockSelection = __HAL_RCC_GET_I2S2_SOURCE(); + + /* Get the I2S3 clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2S3; + PeriphClkInit->I2s3ClockSelection = __HAL_RCC_GET_I2S3_SOURCE(); + +#endif /* STM32F105xC || STM32F107xC */ + +#if defined(STM32F103xE) || defined(STM32F103xG) + /* Get the I2S2 clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2S2; + PeriphClkInit->I2s2ClockSelection = RCC_I2S2CLKSOURCE_SYSCLK; + + /* Get the I2S3 clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2S3; + PeriphClkInit->I2s3ClockSelection = RCC_I2S3CLKSOURCE_SYSCLK; + +#endif /* STM32F103xE || STM32F103xG */ + +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) + /* Get the USB clock configuration -----------------------------------------*/ + PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_USB; + PeriphClkInit->UsbClockSelection = __HAL_RCC_GET_USB_SOURCE(); +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ +} + +/** + * @brief Returns the peripheral clock frequency + * @note Returns 0 if peripheral clock is unknown + * @param PeriphClk Peripheral clock identifier + * This parameter can be one of the following values: + * @arg @ref RCC_PERIPHCLK_RTC RTC peripheral clock + * @arg @ref RCC_PERIPHCLK_ADC ADC peripheral clock + @if STM32F103xE + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + @endif + @if STM32F103xG + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + @endif + @if STM32F105xC + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_USB USB peripheral clock + @endif + @if STM32F107xC + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S3 I2S3 peripheral clock + * @arg @ref RCC_PERIPHCLK_I2S2 I2S2 peripheral clock + * @arg @ref RCC_PERIPHCLK_USB USB peripheral clock + @endif + @if STM32F102xx + * @arg @ref RCC_PERIPHCLK_USB USB peripheral clock + @endif + @if STM32F103xx + * @arg @ref RCC_PERIPHCLK_USB USB peripheral clock + @endif + * @retval Frequency in Hz (0: means that no available frequency for the peripheral) + */ +uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) +{ +#if defined(STM32F105xC) || defined(STM32F107xC) + const uint8_t aPLLMULFactorTable[14] = {0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 13}; + const uint8_t aPredivFactorTable[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + + uint32_t prediv1 = 0U, pllclk = 0U, pllmul = 0U; + uint32_t pll2mul = 0U, pll3mul = 0U, prediv2 = 0U; +#endif /* STM32F105xC || STM32F107xC */ +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6) || \ + defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) + const uint8_t aPLLMULFactorTable[16] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16}; + const uint8_t aPredivFactorTable[2] = {1, 2}; + + uint32_t prediv1 = 0U, pllclk = 0U, pllmul = 0U; +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ + uint32_t temp_reg = 0U, frequency = 0U; + + /* Check the parameters */ + assert_param(IS_RCC_PERIPHCLOCK(PeriphClk)); + + switch (PeriphClk) + { +#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ + || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ + || defined(STM32F105xC) || defined(STM32F107xC) + case RCC_PERIPHCLK_USB: + { + /* Get RCC configuration ------------------------------------------------------*/ + temp_reg = RCC->CFGR; + + /* Check if PLL is enabled */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLLON)) + { + pllmul = aPLLMULFactorTable[(uint32_t)(temp_reg & RCC_CFGR_PLLMULL) >> RCC_CFGR_PLLMULL_Pos]; + if ((temp_reg & RCC_CFGR_PLLSRC) != RCC_PLLSOURCE_HSI_DIV2) + { +#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ + || defined(STM32F100xE) + prediv1 = aPredivFactorTable[(uint32_t)(RCC->CFGR2 & RCC_CFGR2_PREDIV1) >> RCC_CFGR2_PREDIV1_Pos]; +#else + prediv1 = aPredivFactorTable[(uint32_t)(RCC->CFGR & RCC_CFGR_PLLXTPRE) >> RCC_CFGR_PLLXTPRE_Pos]; +#endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ + +#if defined(STM32F105xC) || defined(STM32F107xC) + if (HAL_IS_BIT_SET(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC)) + { + /* PLL2 selected as Prediv1 source */ + /* PLLCLK = PLL2CLK / PREDIV1 * PLLMUL with PLL2CLK = HSE/PREDIV2 * PLL2MUL */ + prediv2 = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> RCC_CFGR2_PREDIV2_Pos) + 1; + pll2mul = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> RCC_CFGR2_PLL2MUL_Pos) + 2; + pllclk = (uint32_t)((((HSE_VALUE / prediv2) * pll2mul) / prediv1) * pllmul); + } + else + { + /* HSE used as PLL clock source : PLLCLK = HSE/PREDIV1 * PLLMUL */ + pllclk = (uint32_t)((HSE_VALUE / prediv1) * pllmul); + } + + /* If PLLMUL was set to 13 means that it was to cover the case PLLMUL 6.5 (avoid using float) */ + /* In this case need to divide pllclk by 2 */ + if (pllmul == aPLLMULFactorTable[(uint32_t)(RCC_CFGR_PLLMULL6_5) >> RCC_CFGR_PLLMULL_Pos]) + { + pllclk = pllclk / 2; + } +#else + if ((temp_reg & RCC_CFGR_PLLSRC) != RCC_PLLSOURCE_HSI_DIV2) + { + /* HSE used as PLL clock source : PLLCLK = HSE/PREDIV1 * PLLMUL */ + pllclk = (uint32_t)((HSE_VALUE / prediv1) * pllmul); + } +#endif /* STM32F105xC || STM32F107xC */ + } + else + { + /* HSI used as PLL clock source : PLLCLK = HSI/2 * PLLMUL */ + pllclk = (uint32_t)((HSI_VALUE >> 1) * pllmul); + } + + /* Calcul of the USB frequency*/ +#if defined(STM32F105xC) || defined(STM32F107xC) + /* USBCLK = PLLVCO = (2 x PLLCLK) / USB prescaler */ + if (__HAL_RCC_GET_USB_SOURCE() == RCC_USBCLKSOURCE_PLL_DIV2) + { + /* Prescaler of 2 selected for USB */ + frequency = pllclk; + } + else + { + /* Prescaler of 3 selected for USB */ + frequency = (2 * pllclk) / 3; + } +#else + /* USBCLK = PLLCLK / USB prescaler */ + if (__HAL_RCC_GET_USB_SOURCE() == RCC_USBCLKSOURCE_PLL) + { + /* No prescaler selected for USB */ + frequency = pllclk; + } + else + { + /* Prescaler of 1.5 selected for USB */ + frequency = (pllclk * 2) / 3; + } +#endif + } + break; + } +#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ +#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) + case RCC_PERIPHCLK_I2S2: + { +#if defined(STM32F103xE) || defined(STM32F103xG) + /* SYSCLK used as source clock for I2S2 */ + frequency = HAL_RCC_GetSysClockFreq(); +#else + if (__HAL_RCC_GET_I2S2_SOURCE() == RCC_I2S2CLKSOURCE_SYSCLK) + { + /* SYSCLK used as source clock for I2S2 */ + frequency = HAL_RCC_GetSysClockFreq(); + } + else + { + /* Check if PLLI2S is enabled */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL3ON)) + { + /* PLLI2SVCO = 2 * PLLI2SCLK = 2 * (HSE/PREDIV2 * PLL3MUL) */ + prediv2 = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> RCC_CFGR2_PREDIV2_Pos) + 1; + pll3mul = ((RCC->CFGR2 & RCC_CFGR2_PLL3MUL) >> RCC_CFGR2_PLL3MUL_Pos) + 2; + frequency = (uint32_t)(2 * ((HSE_VALUE / prediv2) * pll3mul)); + } + } +#endif /* STM32F103xE || STM32F103xG */ + break; + } + case RCC_PERIPHCLK_I2S3: + { +#if defined(STM32F103xE) || defined(STM32F103xG) + /* SYSCLK used as source clock for I2S3 */ + frequency = HAL_RCC_GetSysClockFreq(); +#else + if (__HAL_RCC_GET_I2S3_SOURCE() == RCC_I2S3CLKSOURCE_SYSCLK) + { + /* SYSCLK used as source clock for I2S3 */ + frequency = HAL_RCC_GetSysClockFreq(); + } + else + { + /* Check if PLLI2S is enabled */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL3ON)) + { + /* PLLI2SVCO = 2 * PLLI2SCLK = 2 * (HSE/PREDIV2 * PLL3MUL) */ + prediv2 = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> RCC_CFGR2_PREDIV2_Pos) + 1; + pll3mul = ((RCC->CFGR2 & RCC_CFGR2_PLL3MUL) >> RCC_CFGR2_PLL3MUL_Pos) + 2; + frequency = (uint32_t)(2 * ((HSE_VALUE / prediv2) * pll3mul)); + } + } +#endif /* STM32F103xE || STM32F103xG */ + break; + } +#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ + case RCC_PERIPHCLK_RTC: + { + /* Get RCC BDCR configuration ------------------------------------------------------*/ + temp_reg = RCC->BDCR; + + /* Check if LSE is ready if RTC clock selection is LSE */ + if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSE) && (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSERDY))) + { + frequency = LSE_VALUE; + } + /* Check if LSI is ready if RTC clock selection is LSI */ + else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSI) && (HAL_IS_BIT_SET(RCC->CSR, RCC_CSR_LSIRDY))) + { + frequency = LSI_VALUE; + } + else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_HSE_DIV128) && (HAL_IS_BIT_SET(RCC->CR, RCC_CR_HSERDY))) + { + frequency = HSE_VALUE / 128U; + } + /* Clock not enabled for RTC*/ + else + { + /* nothing to do: frequency already initialized to 0U */ + } + break; + } + case RCC_PERIPHCLK_ADC: + { + frequency = HAL_RCC_GetPCLK2Freq() / (((__HAL_RCC_GET_ADC_SOURCE() >> RCC_CFGR_ADCPRE_Pos) + 1) * 2); + break; + } + default: + { + break; + } + } + return (frequency); +} + +/** + * @} + */ + +#if defined(STM32F105xC) || defined(STM32F107xC) +/** @defgroup RCCEx_Exported_Functions_Group2 PLLI2S Management function + * @brief PLLI2S Management functions + * +@verbatim + =============================================================================== + ##### Extended PLLI2S Management functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the PLLI2S + activation or deactivation +@endverbatim + * @{ + */ + +/** + * @brief Enable PLLI2S + * @param PLLI2SInit pointer to an RCC_PLLI2SInitTypeDef structure that + * contains the configuration information for the PLLI2S + * @note The PLLI2S configuration not modified if used by I2S2 or I2S3 Interface. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit) +{ + uint32_t tickstart = 0U; + + /* Check that PLL I2S has not been already enabled by I2S2 or I2S3*/ + if (HAL_IS_BIT_CLR(RCC->CFGR2, RCC_CFGR2_I2S2SRC) && HAL_IS_BIT_CLR(RCC->CFGR2, RCC_CFGR2_I2S3SRC)) + { + /* Check the parameters */ + assert_param(IS_RCC_PLLI2S_MUL(PLLI2SInit->PLLI2SMUL)); + assert_param(IS_RCC_HSE_PREDIV2(PLLI2SInit->HSEPrediv2Value)); + + /* Prediv2 can be written only when the PLL2 is disabled. */ + /* Return an error only if new value is different from the programmed value */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL2ON) && \ + (__HAL_RCC_HSE_GET_PREDIV2() != PLLI2SInit->HSEPrediv2Value)) + { + return HAL_ERROR; + } + + /* Disable the main PLLI2S. */ + __HAL_RCC_PLLI2S_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLLI2S is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the HSE prediv2 factor --------------------------------*/ + __HAL_RCC_HSE_PREDIV2_CONFIG(PLLI2SInit->HSEPrediv2Value); + + + /* Configure the main PLLI2S multiplication factors. */ + __HAL_RCC_PLLI2S_CONFIG(PLLI2SInit->PLLI2SMUL); + + /* Enable the main PLLI2S. */ + __HAL_RCC_PLLI2S_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLLI2S is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* PLLI2S cannot be modified as already used by I2S2 or I2S3 */ + return HAL_ERROR; + } + + return HAL_OK; +} + +/** + * @brief Disable PLLI2S + * @note PLLI2S is not disabled if used by I2S2 or I2S3 Interface. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void) +{ + uint32_t tickstart = 0U; + + /* Disable PLL I2S as not requested by I2S2 or I2S3*/ + if (HAL_IS_BIT_CLR(RCC->CFGR2, RCC_CFGR2_I2S2SRC) && HAL_IS_BIT_CLR(RCC->CFGR2, RCC_CFGR2_I2S3SRC)) + { + /* Disable the main PLLI2S. */ + __HAL_RCC_PLLI2S_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLLI2S is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLI2SRDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLLI2S_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + else + { + /* PLLI2S is currently used by I2S2 or I2S3. Cannot be disabled.*/ + return HAL_ERROR; + } + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup RCCEx_Exported_Functions_Group3 PLL2 Management function + * @brief PLL2 Management functions + * +@verbatim + =============================================================================== + ##### Extended PLL2 Management functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the PLL2 + activation or deactivation +@endverbatim + * @{ + */ + +/** + * @brief Enable PLL2 + * @param PLL2Init pointer to an RCC_PLL2InitTypeDef structure that + * contains the configuration information for the PLL2 + * @note The PLL2 configuration not modified if used indirectly as system clock. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_EnablePLL2(RCC_PLL2InitTypeDef *PLL2Init) +{ + uint32_t tickstart = 0U; + + /* This bit can not be cleared if the PLL2 clock is used indirectly as system + clock (i.e. it is used as PLL clock entry that is used as system clock). */ + if ((__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE) && \ + (__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && \ + ((READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC)) == RCC_CFGR2_PREDIV1SRC_PLL2)) + { + return HAL_ERROR; + } + else + { + /* Check the parameters */ + assert_param(IS_RCC_PLL2_MUL(PLL2Init->PLL2MUL)); + assert_param(IS_RCC_HSE_PREDIV2(PLL2Init->HSEPrediv2Value)); + + /* Prediv2 can be written only when the PLLI2S is disabled. */ + /* Return an error only if new value is different from the programmed value */ + if (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLL3ON) && \ + (__HAL_RCC_HSE_GET_PREDIV2() != PLL2Init->HSEPrediv2Value)) + { + return HAL_ERROR; + } + + /* Disable the main PLL2. */ + __HAL_RCC_PLL2_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + + /* Configure the HSE prediv2 factor --------------------------------*/ + __HAL_RCC_HSE_PREDIV2_CONFIG(PLL2Init->HSEPrediv2Value); + + /* Configure the main PLL2 multiplication factors. */ + __HAL_RCC_PLL2_CONFIG(PLL2Init->PLL2MUL); + + /* Enable the main PLL2. */ + __HAL_RCC_PLL2_ENABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is ready */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) == RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + return HAL_OK; +} + +/** + * @brief Disable PLL2 + * @note PLL2 is not disabled if used indirectly as system clock. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_RCCEx_DisablePLL2(void) +{ + uint32_t tickstart = 0U; + + /* This bit can not be cleared if the PLL2 clock is used indirectly as system + clock (i.e. it is used as PLL clock entry that is used as system clock). */ + if ((__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE) && \ + (__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && \ + ((READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1SRC)) == RCC_CFGR2_PREDIV1SRC_PLL2)) + { + return HAL_ERROR; + } + else + { + /* Disable the main PLL2. */ + __HAL_RCC_PLL2_DISABLE(); + + /* Get Start Tick*/ + tickstart = HAL_GetTick(); + + /* Wait till PLL2 is disabled */ + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL2RDY) != RESET) + { + if ((HAL_GetTick() - tickstart) > PLL2_TIMEOUT_VALUE) + { + return HAL_TIMEOUT; + } + } + } + + return HAL_OK; +} + +/** + * @} + */ +#endif /* STM32F105xC || STM32F107xC */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* HAL_RCC_MODULE_ENABLED */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c new file mode 100644 index 0000000..edf4a72 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c @@ -0,0 +1,7483 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_tim.c + * @author MCD Application Team + * @brief TIM HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Timer (TIM) peripheral: + * + TIM Time Base Initialization + * + TIM Time Base Start + * + TIM Time Base Start Interruption + * + TIM Time Base Start DMA + * + TIM Output Compare/PWM Initialization + * + TIM Output Compare/PWM Channel Configuration + * + TIM Output Compare/PWM Start + * + TIM Output Compare/PWM Start Interruption + * + TIM Output Compare/PWM Start DMA + * + TIM Input Capture Initialization + * + TIM Input Capture Channel Configuration + * + TIM Input Capture Start + * + TIM Input Capture Start Interruption + * + TIM Input Capture Start DMA + * + TIM One Pulse Initialization + * + TIM One Pulse Channel Configuration + * + TIM One Pulse Start + * + TIM Encoder Interface Initialization + * + TIM Encoder Interface Start + * + TIM Encoder Interface Start Interruption + * + TIM Encoder Interface Start DMA + * + Commutation Event configuration with Interruption and DMA + * + TIM OCRef clear configuration + * + TIM External Clock configuration + @verbatim + ============================================================================== + ##### TIMER Generic features ##### + ============================================================================== + [..] The Timer features include: + (#) 16-bit up, down, up/down auto-reload counter. + (#) 16-bit programmable prescaler allowing dividing (also on the fly) the + counter clock frequency either by any factor between 1 and 65536. + (#) Up to 4 independent channels for: + (++) Input Capture + (++) Output Compare + (++) PWM generation (Edge and Center-aligned Mode) + (++) One-pulse mode output + (#) Synchronization circuit to control the timer with external signals and to interconnect + several timers together. + (#) Supports incremental encoder for positioning purposes + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the TIM low level resources by implementing the following functions + depending on the selected feature: + (++) Time Base : HAL_TIM_Base_MspInit() + (++) Input Capture : HAL_TIM_IC_MspInit() + (++) Output Compare : HAL_TIM_OC_MspInit() + (++) PWM generation : HAL_TIM_PWM_MspInit() + (++) One-pulse mode output : HAL_TIM_OnePulse_MspInit() + (++) Encoder mode output : HAL_TIM_Encoder_MspInit() + + (#) Initialize the TIM low level resources : + (##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE(); + (##) TIM pins configuration + (+++) Enable the clock for the TIM GPIOs using the following function: + __HAL_RCC_GPIOx_CLK_ENABLE(); + (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init(); + + (#) The external Clock can be configured, if needed (the default clock is the + internal clock from the APBx), using the following function: + HAL_TIM_ConfigClockSource, the clock configuration should be done before + any start function. + + (#) Configure the TIM in the desired functioning mode using one of the + Initialization function of this driver: + (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base + (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an + Output Compare signal. + (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a + PWM signal. + (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an + external signal. + (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer + in One Pulse Mode. + (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface. + + (#) Activate the TIM peripheral using one of the start functions depending from the feature used: + (++) Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(), HAL_TIM_Base_Start_IT() + (++) Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(), HAL_TIM_IC_Start_IT() + (++) Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(), HAL_TIM_OC_Start_IT() + (++) PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(), HAL_TIM_PWM_Start_IT() + (++) One-pulse mode output : HAL_TIM_OnePulse_Start(), HAL_TIM_OnePulse_Start_IT() + (++) Encoder mode output : HAL_TIM_Encoder_Start(), HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT(). + + (#) The DMA Burst is managed with the two following functions: + HAL_TIM_DMABurst_WriteStart() + HAL_TIM_DMABurst_ReadStart() + + *** Callback registration *** + ============================================= + + [..] + The compilation define USE_HAL_TIM_REGISTER_CALLBACKS when set to 1 + allows the user to configure dynamically the driver callbacks. + + [..] + Use Function @ref HAL_TIM_RegisterCallback() to register a callback. + @ref HAL_TIM_RegisterCallback() takes as parameters the HAL peripheral handle, + the Callback ID and a pointer to the user callback function. + + [..] + Use function @ref HAL_TIM_UnRegisterCallback() to reset a callback to the default + weak function. + @ref HAL_TIM_UnRegisterCallback takes as parameters the HAL peripheral handle, + and the Callback ID. + + [..] + These functions allow to register/unregister following callbacks: + (+) Base_MspInitCallback : TIM Base Msp Init Callback. + (+) Base_MspDeInitCallback : TIM Base Msp DeInit Callback. + (+) IC_MspInitCallback : TIM IC Msp Init Callback. + (+) IC_MspDeInitCallback : TIM IC Msp DeInit Callback. + (+) OC_MspInitCallback : TIM OC Msp Init Callback. + (+) OC_MspDeInitCallback : TIM OC Msp DeInit Callback. + (+) PWM_MspInitCallback : TIM PWM Msp Init Callback. + (+) PWM_MspDeInitCallback : TIM PWM Msp DeInit Callback. + (+) OnePulse_MspInitCallback : TIM One Pulse Msp Init Callback. + (+) OnePulse_MspDeInitCallback : TIM One Pulse Msp DeInit Callback. + (+) Encoder_MspInitCallback : TIM Encoder Msp Init Callback. + (+) Encoder_MspDeInitCallback : TIM Encoder Msp DeInit Callback. + (+) HallSensor_MspInitCallback : TIM Hall Sensor Msp Init Callback. + (+) HallSensor_MspDeInitCallback : TIM Hall Sensor Msp DeInit Callback. + (+) PeriodElapsedCallback : TIM Period Elapsed Callback. + (+) PeriodElapsedHalfCpltCallback : TIM Period Elapsed half complete Callback. + (+) TriggerCallback : TIM Trigger Callback. + (+) TriggerHalfCpltCallback : TIM Trigger half complete Callback. + (+) IC_CaptureCallback : TIM Input Capture Callback. + (+) IC_CaptureHalfCpltCallback : TIM Input Capture half complete Callback. + (+) OC_DelayElapsedCallback : TIM Output Compare Delay Elapsed Callback. + (+) PWM_PulseFinishedCallback : TIM PWM Pulse Finished Callback. + (+) PWM_PulseFinishedHalfCpltCallback : TIM PWM Pulse Finished half complete Callback. + (+) ErrorCallback : TIM Error Callback. + (+) CommutationCallback : TIM Commutation Callback. + (+) CommutationHalfCpltCallback : TIM Commutation half complete Callback. + (+) BreakCallback : TIM Break Callback. + + [..] +By default, after the Init and when the state is HAL_TIM_STATE_RESET +all interrupt callbacks are set to the corresponding weak functions: + examples @ref HAL_TIM_TriggerCallback(), @ref HAL_TIM_ErrorCallback(). + + [..] + Exception done for MspInit and MspDeInit functions that are reset to the legacy weak + functionalities in the Init / DeInit only when these callbacks are null + (not registered beforehand). If not, MspInit or MspDeInit are not null, the Init / DeInit + keep and use the user MspInit / MspDeInit callbacks(registered beforehand) + + [..] + Callbacks can be registered / unregistered in HAL_TIM_STATE_READY state only. + Exception done MspInit / MspDeInit that can be registered / unregistered + in HAL_TIM_STATE_READY or HAL_TIM_STATE_RESET state, + thus registered(user) MspInit / DeInit callbacks can be used during the Init / DeInit. + In that case first register the MspInit/MspDeInit user callbacks + using @ref HAL_TIM_RegisterCallback() before calling DeInit or Init function. + + [..] + When The compilation define USE_HAL_TIM_REGISTER_CALLBACKS is set to 0 or + not defined, the callback registration feature is not available and all callbacks + are set to the corresponding weak functions. + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup TIM TIM + * @brief TIM HAL module driver + * @{ + */ + +#ifdef HAL_TIM_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/** @addtogroup TIM_Private_Functions + * @{ + */ +static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config); +static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter); +static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter); +static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter); +static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource); +static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma); +static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig); +/** + * @} + */ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup TIM_Exported_Functions TIM Exported Functions + * @{ + */ + +/** @defgroup TIM_Exported_Functions_Group1 TIM Time Base functions + * @brief Time Base functions + * +@verbatim + ============================================================================== + ##### Time Base functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM base. + (+) De-initialize the TIM base. + (+) Start the Time Base. + (+) Stop the Time Base. + (+) Start the Time Base and enable interrupt. + (+) Stop the Time Base and disable interrupt. + (+) Start the Time Base and enable DMA transfer. + (+) Stop the Time Base and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Time base Unit according to the specified + * parameters in the TIM_HandleTypeDef and initialize the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_Base_DeInit() before HAL_TIM_Base_Init() + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->Base_MspInitCallback == NULL) + { + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->Base_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + HAL_TIM_Base_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Set the Time Base configuration */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM Base peripheral + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->Base_MspDeInitCallback == NULL) + { + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; + } + /* DeInit the low level hardware */ + htim->Base_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_Base_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Change the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Base MSP. + * @param htim TIM Base handle + * @retval None + */ +__weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Base_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Base MSP. + * @param htim TIM Base handle + * @retval None + */ +__weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Base_MspDeInit could be implemented in the user file + */ +} + + +/** + * @brief Starts the TIM Base generation. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Check the TIM state */ + if (htim->State != HAL_TIM_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Base generation in interrupt mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Check the TIM state */ + if (htim->State != HAL_TIM_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Enable the TIM Update interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation in interrupt mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + /* Disable the TIM Update interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_UPDATE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Base generation in DMA mode. + * @param htim TIM Base handle + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_DMA_INSTANCE(htim->Instance)); + + /* Set the TIM state */ + if (htim->State == HAL_TIM_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->State == HAL_TIM_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + htim->State = HAL_TIM_STATE_BUSY; + } + } + else + { + return HAL_ERROR; + } + + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + + /* Enable the TIM Update DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_UPDATE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Base generation in DMA mode. + * @param htim TIM Base handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_INSTANCE(htim->Instance)); + + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_UPDATE); + + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group2 TIM Output Compare functions + * @brief TIM Output Compare functions + * +@verbatim + ============================================================================== + ##### TIM Output Compare functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Output Compare. + (+) De-initialize the TIM Output Compare. + (+) Start the TIM Output Compare. + (+) Stop the TIM Output Compare. + (+) Start the TIM Output Compare and enable interrupt. + (+) Stop the TIM Output Compare and disable interrupt. + (+) Start the TIM Output Compare and enable DMA transfer. + (+) Stop the TIM Output Compare and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Output Compare according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_OC_DeInit() before HAL_TIM_OC_Init() + * @param htim TIM Output Compare handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->OC_MspInitCallback == NULL) + { + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->OC_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OC_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the Output Compare */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM Output Compare handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->OC_MspDeInitCallback == NULL) + { + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; + } + /* DeInit the low level hardware */ + htim->OC_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OC_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Change the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Output Compare MSP. + * @param htim TIM Output Compare handle + * @retval None + */ +__weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Output Compare MSP. + * @param htim TIM Output Compare handle + * @retval None + */ +__weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Output Compare signal generation. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in interrupt mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in interrupt mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in DMA mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Set the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY) + { + return HAL_BUSY; + } + else if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Enable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in DMA mode. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Output compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group3 TIM PWM functions + * @brief TIM PWM functions + * +@verbatim + ============================================================================== + ##### TIM PWM functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM PWM. + (+) De-initialize the TIM PWM. + (+) Start the TIM PWM. + (+) Stop the TIM PWM. + (+) Start the TIM PWM and enable interrupt. + (+) Stop the TIM PWM and disable interrupt. + (+) Start the TIM PWM and enable DMA transfer. + (+) Stop the TIM PWM and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM PWM Time Base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_PWM_DeInit() before HAL_TIM_PWM_Init() + * @param htim TIM PWM handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->PWM_MspInitCallback == NULL) + { + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->PWM_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_PWM_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the PWM */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM PWM handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->PWM_MspDeInitCallback == NULL) + { + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; + } + /* DeInit the low level hardware */ + htim->PWM_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_PWM_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Change the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM PWM MSP. + * @param htim TIM PWM handle + * @retval None + */ +__weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM PWM MSP. + * @param htim TIM PWM handle + * @retval None + */ +__weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the PWM signal generation. + * @param htim TIM handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the PWM signal generation in interrupt mode. + * @param htim TIM PWM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation in interrupt mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM PWM signal generation in DMA mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Set the TIM channel state */ + if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY) + { + return HAL_BUSY; + } + else if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Output Capture/Compare 3 request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM PWM signal generation in DMA mode. + * @param htim TIM PWM handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group4 TIM Input Capture functions + * @brief TIM Input Capture functions + * +@verbatim + ============================================================================== + ##### TIM Input Capture functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Input Capture. + (+) De-initialize the TIM Input Capture. + (+) Start the TIM Input Capture. + (+) Stop the TIM Input Capture. + (+) Start the TIM Input Capture and enable interrupt. + (+) Stop the TIM Input Capture and disable interrupt. + (+) Start the TIM Input Capture and enable DMA transfer. + (+) Stop the TIM Input Capture and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Input Capture Time base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_IC_DeInit() before HAL_TIM_IC_Init() + * @param htim TIM Input Capture handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->IC_MspInitCallback == NULL) + { + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->IC_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_IC_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Init the base time for the input capture */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM peripheral + * @param htim TIM Input Capture handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->IC_MspDeInitCallback == NULL) + { + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; + } + /* DeInit the low level hardware */ + htim->IC_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_IC_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Change the TIM channels state */ + TIM_CHANNEL_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET_ALL(htim, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Input Capture MSP. + * @param htim TIM Input Capture handle + * @retval None + */ +__weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Input Capture MSP. + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Input Capture measurement. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel); + HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel); + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if ((channel_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Input Capture measurement in interrupt mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel); + HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel); + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM channel state */ + if ((channel_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Enable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement in interrupt mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4); + break; + } + + default: + break; + } + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Input Capture measurement in DMA mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @param pData The destination Buffer address. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel); + HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel); + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + /* Set the TIM channel state */ + if ((channel_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_state == HAL_TIM_CHANNEL_STATE_BUSY)) + { + return HAL_BUSY; + } + else if ((channel_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_state == HAL_TIM_CHANNEL_STATE_READY)) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + /* Enable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->CCR3, (uint32_t)pData, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + case TIM_CHANNEL_4: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->CCR4, (uint32_t)pData, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4); + break; + } + + default: + break; + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Input Capture measurement in DMA mode. + * @param htim TIM Input Capture handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channel */ + TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + case TIM_CHANNEL_4: + { + /* Disable the TIM Capture/Compare 4 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + + default: + break; + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group5 TIM One Pulse functions + * @brief TIM One Pulse functions + * +@verbatim + ============================================================================== + ##### TIM One Pulse functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM One Pulse. + (+) De-initialize the TIM One Pulse. + (+) Start the TIM One Pulse. + (+) Stop the TIM One Pulse. + (+) Start the TIM One Pulse and enable interrupt. + (+) Stop the TIM One Pulse and disable interrupt. + (+) Start the TIM One Pulse and enable DMA transfer. + (+) Stop the TIM One Pulse and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM One Pulse Time Base according to the specified + * parameters in the TIM_HandleTypeDef and initializes the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_OnePulse_DeInit() before HAL_TIM_OnePulse_Init() + * @note When the timer instance is initialized in One Pulse mode, timer + * channels 1 and channel 2 are reserved and cannot be used for other + * purpose. + * @param htim TIM One Pulse handle + * @param OnePulseMode Select the One pulse mode. + * This parameter can be one of the following values: + * @arg TIM_OPMODE_SINGLE: Only one pulse will be generated. + * @arg TIM_OPMODE_REPETITIVE: Repetitive pulses will be generated. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode) +{ + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_OPM_MODE(OnePulseMode)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->OnePulse_MspInitCallback == NULL) + { + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->OnePulse_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_OnePulse_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Configure the Time base in the One Pulse Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Reset the OPM Bit */ + htim->Instance->CR1 &= ~TIM_CR1_OPM; + + /* Configure the OPM Mode */ + htim->Instance->CR1 |= OnePulseMode; + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM One Pulse + * @param htim TIM One Pulse handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->OnePulse_MspDeInitCallback == NULL) + { + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; + } + /* DeInit the low level hardware */ + htim->OnePulse_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_OnePulse_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM One Pulse MSP. + * @param htim TIM One Pulse handle + * @retval None + */ +__weak void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OnePulse_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM One Pulse MSP. + * @param htim TIM One Pulse handle + * @retval None + */ +__weak void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OnePulse_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM One Pulse signal generation. + * @note Though OutputChannel parameter is deprecated and ignored by the function + * it has been kept to avoid HAL_TIM API compatibility break. + * @note The pulse output channel is determined when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel See note above + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together + + No need to enable the counter, it's enabled automatically by hardware + (the counter starts in response to a stimulus and generate a pulse */ + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation. + * @note Though OutputChannel parameter is deprecated and ignored by the function + * it has been kept to avoid HAL_TIM API compatibility break. + * @note The pulse output channel is determined when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel See note above + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Disable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */ + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM One Pulse signal generation in interrupt mode. + * @note Though OutputChannel parameter is deprecated and ignored by the function + * it has been kept to avoid HAL_TIM API compatibility break. + * @note The pulse output channel is determined when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel See note above + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together + + No need to enable the counter, it's enabled automatically by hardware + (the counter starts in response to a stimulus and generate a pulse */ + + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Enable the main output */ + __HAL_TIM_MOE_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation in interrupt mode. + * @note Though OutputChannel parameter is deprecated and ignored by the function + * it has been kept to avoid HAL_TIM API compatibility break. + * @note The pulse output channel is determined when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel See note above + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(OutputChannel); + + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + + /* Disable the Capture compare and the Input Capture channels + (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) + if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and + if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output + whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) + { + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group6 TIM Encoder functions + * @brief TIM Encoder functions + * +@verbatim + ============================================================================== + ##### TIM Encoder functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIM Encoder. + (+) De-initialize the TIM Encoder. + (+) Start the TIM Encoder. + (+) Stop the TIM Encoder. + (+) Start the TIM Encoder and enable interrupt. + (+) Stop the TIM Encoder and disable interrupt. + (+) Start the TIM Encoder and enable DMA transfer. + (+) Stop the TIM Encoder and disable DMA transfer. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Encoder Interface and initialize the associated handle. + * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) + * requires a timer reset to avoid unexpected direction + * due to DIR bit readonly in center aligned mode. + * Ex: call @ref HAL_TIM_Encoder_DeInit() before HAL_TIM_Encoder_Init() + * @note Encoder mode and External clock mode 2 are not compatible and must not be selected together + * Ex: A call for @ref HAL_TIM_Encoder_Init will erase the settings of @ref HAL_TIM_ConfigClockSource + * using TIM_CLOCKSOURCE_ETRMODE2 and vice versa + * @note When the timer instance is initialized in Encoder mode, timer + * channels 1 and channel 2 are reserved and cannot be used for other + * purpose. + * @param htim TIM Encoder Interface handle + * @param sConfig TIM Encoder Interface configuration structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig) +{ + uint32_t tmpsmcr; + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + assert_param(IS_TIM_ENCODER_MODE(sConfig->EncoderMode)); + assert_param(IS_TIM_IC_SELECTION(sConfig->IC1Selection)); + assert_param(IS_TIM_IC_SELECTION(sConfig->IC2Selection)); + assert_param(IS_TIM_ENCODERINPUT_POLARITY(sConfig->IC1Polarity)); + assert_param(IS_TIM_ENCODERINPUT_POLARITY(sConfig->IC2Polarity)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC1Prescaler)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC2Prescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC2Filter)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy weak callbacks */ + TIM_ResetCallback(htim); + + if (htim->Encoder_MspInitCallback == NULL) + { + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->Encoder_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIM_Encoder_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Reset the SMS and ECE bits */ + htim->Instance->SMCR &= ~(TIM_SMCR_SMS | TIM_SMCR_ECE); + + /* Configure the Time base in the Encoder Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = htim->Instance->CCMR1; + + /* Get the TIMx CCER register value */ + tmpccer = htim->Instance->CCER; + + /* Set the encoder Mode */ + tmpsmcr |= sConfig->EncoderMode; + + /* Select the Capture Compare 1 and the Capture Compare 2 as input */ + tmpccmr1 &= ~(TIM_CCMR1_CC1S | TIM_CCMR1_CC2S); + tmpccmr1 |= (sConfig->IC1Selection | (sConfig->IC2Selection << 8U)); + + /* Set the Capture Compare 1 and the Capture Compare 2 prescalers and filters */ + tmpccmr1 &= ~(TIM_CCMR1_IC1PSC | TIM_CCMR1_IC2PSC); + tmpccmr1 &= ~(TIM_CCMR1_IC1F | TIM_CCMR1_IC2F); + tmpccmr1 |= sConfig->IC1Prescaler | (sConfig->IC2Prescaler << 8U); + tmpccmr1 |= (sConfig->IC1Filter << 4U) | (sConfig->IC2Filter << 12U); + + /* Set the TI1 and the TI2 Polarities */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC2P); + tmpccer |= sConfig->IC1Polarity | (sConfig->IC2Polarity << 4U); + + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + + /* Write to TIMx CCMR1 */ + htim->Instance->CCMR1 = tmpccmr1; + + /* Write to TIMx CCER */ + htim->Instance->CCER = tmpccer; + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + + +/** + * @brief DeInitializes the TIM Encoder interface + * @param htim TIM Encoder Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->Encoder_MspDeInitCallback == NULL) + { + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; + } + /* DeInit the low level hardware */ + htim->Encoder_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIM_Encoder_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Encoder Interface MSP. + * @param htim TIM Encoder Interface handle + * @retval None + */ +__weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Encoder_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Encoder Interface MSP. + * @param htim TIM Encoder Interface handle + * @retval None + */ +__weak void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_Encoder_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Encoder Interface. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Set the TIM channel(s) state */ + if (Channel == TIM_CHANNEL_1) + { + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else if (Channel == TIM_CHANNEL_2) + { + if ((channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + + /* Enable the encoder interface channels */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + } + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + break; + } + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel(s) state */ + if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2)) + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Encoder Interface in interrupt mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Set the TIM channel(s) state */ + if (Channel == TIM_CHANNEL_1) + { + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else if (Channel == TIM_CHANNEL_2) + { + if ((channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + + /* Enable the encoder interface channels */ + /* Enable the capture compare Interrupts 1 and/or 2 */ + switch (Channel) + { + case TIM_CHANNEL_1: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + default : + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + } + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface in interrupt mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + if (Channel == TIM_CHANNEL_1) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 1 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + } + else if (Channel == TIM_CHANNEL_2) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 2 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + } + else + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts 1 and 2 */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel(s) state */ + if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2)) + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Encoder Interface in DMA mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @param pData1 The destination Buffer address for IC1. + * @param pData2 The destination Buffer address for IC2. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, + uint32_t *pData2, uint16_t Length) +{ + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Set the TIM channel(s) state */ + if (Channel == TIM_CHANNEL_1) + { + if ((channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY)) + { + return HAL_BUSY; + } + else if ((channel_1_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_READY)) + { + if ((pData1 == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + } + else if (Channel == TIM_CHANNEL_2) + { + if ((channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY)) + { + return HAL_BUSY; + } + else if ((channel_2_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_READY)) + { + if ((pData2 == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + } + else + { + if ((channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY)) + { + return HAL_BUSY; + } + else if ((channel_1_state == HAL_TIM_CHANNEL_STATE_READY) + && (channel_2_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_READY)) + { + if ((((pData1 == NULL) || (pData2 == NULL))) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError; + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + break; + } + + case TIM_CHANNEL_ALL: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the Peripheral */ + __HAL_TIM_ENABLE(htim); + + /* Enable the Capture compare channel */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); + + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + /* Enable the TIM Input Capture DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + default: + break; + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Encoder Interface in DMA mode. + * @param htim TIM Encoder Interface handle + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1 and 2 + (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */ + if (Channel == TIM_CHANNEL_1) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 1 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + } + else if (Channel == TIM_CHANNEL_2) + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 2 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + } + else + { + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE); + + /* Disable the capture compare DMA Request 1 and 2 */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + } + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel(s) state */ + if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2)) + { + TIM_CHANNEL_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ +/** @defgroup TIM_Exported_Functions_Group7 TIM IRQ handler management + * @brief TIM IRQ handler management + * +@verbatim + ============================================================================== + ##### IRQ handler management ##### + ============================================================================== + [..] + This section provides Timer IRQ handler function. + +@endverbatim + * @{ + */ +/** + * @brief This function handles TIM interrupts requests. + * @param htim TIM handle + * @retval None + */ +void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) +{ + /* Capture compare 1 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC1) != RESET) + { + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC1); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + + /* Input capture event */ + if ((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + } + /* Capture compare 2 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC2) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC2); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + /* Input capture event */ + if ((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* Capture compare 3 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC3) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC3); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + /* Input capture event */ + if ((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* Capture compare 4 event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC4) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_CC4); + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + /* Input capture event */ + if ((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U) + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + /* Output compare event */ + else + { +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->OC_DelayElapsedCallback(htim); + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_OC_DelayElapsedCallback(htim); + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; + } + } + /* TIM Update event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedCallback(htim); +#else + HAL_TIM_PeriodElapsedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM Break input event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_BREAK) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_BREAK); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->BreakCallback(htim); +#else + HAL_TIMEx_BreakCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM Trigger detection event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_TRIGGER) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_TRIGGER) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_IT_TRIGGER); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerCallback(htim); +#else + HAL_TIM_TriggerCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } + /* TIM commutation event */ + if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_COM) != RESET) + { + __HAL_TIM_CLEAR_IT(htim, TIM_FLAG_COM); +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationCallback(htim); +#else + HAL_TIMEx_CommutCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + } +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group8 TIM Peripheral Control functions + * @brief TIM Peripheral Control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Configure The Input Output channels for OC, PWM, IC or One Pulse mode. + (+) Configure External Clock source. + (+) Configure Complementary channels, break features and dead time. + (+) Configure Master and the Slave synchronization. + (+) Configure the DMA Burst Mode. + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the TIM Output Compare Channels according to the specified + * parameters in the TIM_OC_InitTypeDef. + * @param htim TIM Output Compare handle + * @param sConfig TIM Output Compare configuration structure + * @param Channel TIM Channels to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, + TIM_OC_InitTypeDef *sConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CHANNELS(Channel)); + assert_param(IS_TIM_OC_MODE(sConfig->OCMode)); + assert_param(IS_TIM_OC_POLARITY(sConfig->OCPolarity)); + + /* Process Locked */ + __HAL_LOCK(htim); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 1 in Output Compare */ + TIM_OC1_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 2 in Output Compare */ + TIM_OC2_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 3 in Output Compare */ + TIM_OC3_SetConfig(htim->Instance, sConfig); + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Configure the TIM Channel 4 in Output Compare */ + TIM_OC4_SetConfig(htim->Instance, sConfig); + break; + } + + default: + break; + } + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Input Capture Channels according to the specified + * parameters in the TIM_IC_InitTypeDef. + * @param htim TIM IC handle + * @param sConfig TIM Input Capture configuration structure + * @param Channel TIM Channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_IC_POLARITY(sConfig->ICPolarity)); + assert_param(IS_TIM_IC_SELECTION(sConfig->ICSelection)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->ICPrescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->ICFilter)); + + /* Process Locked */ + __HAL_LOCK(htim); + + if (Channel == TIM_CHANNEL_1) + { + /* TI1 Configuration */ + TIM_TI1_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + + /* Set the IC1PSC value */ + htim->Instance->CCMR1 |= sConfig->ICPrescaler; + } + else if (Channel == TIM_CHANNEL_2) + { + /* TI2 Configuration */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_TI2_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC2PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC; + + /* Set the IC2PSC value */ + htim->Instance->CCMR1 |= (sConfig->ICPrescaler << 8U); + } + else if (Channel == TIM_CHANNEL_3) + { + /* TI3 Configuration */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + TIM_TI3_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC3PSC Bits */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC; + + /* Set the IC3PSC value */ + htim->Instance->CCMR2 |= sConfig->ICPrescaler; + } + else + { + /* TI4 Configuration */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + TIM_TI4_SetConfig(htim->Instance, + sConfig->ICPolarity, + sConfig->ICSelection, + sConfig->ICFilter); + + /* Reset the IC4PSC Bits */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC; + + /* Set the IC4PSC value */ + htim->Instance->CCMR2 |= (sConfig->ICPrescaler << 8U); + } + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM PWM channels according to the specified + * parameters in the TIM_OC_InitTypeDef. + * @param htim TIM PWM handle + * @param sConfig TIM PWM configuration structure + * @param Channel TIM Channels to be configured + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, + TIM_OC_InitTypeDef *sConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CHANNELS(Channel)); + assert_param(IS_TIM_PWM_MODE(sConfig->OCMode)); + assert_param(IS_TIM_OC_POLARITY(sConfig->OCPolarity)); + assert_param(IS_TIM_FAST_STATE(sConfig->OCFastMode)); + + /* Process Locked */ + __HAL_LOCK(htim); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Configure the Channel 1 in PWM mode */ + TIM_OC1_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel1 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC1PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE; + htim->Instance->CCMR1 |= sConfig->OCFastMode; + break; + } + + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Configure the Channel 2 in PWM mode */ + TIM_OC2_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel2 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC2PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE; + htim->Instance->CCMR1 |= sConfig->OCFastMode << 8U; + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Configure the Channel 3 in PWM mode */ + TIM_OC3_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel3 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC3PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE; + htim->Instance->CCMR2 |= sConfig->OCFastMode; + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Configure the Channel 4 in PWM mode */ + TIM_OC4_SetConfig(htim->Instance, sConfig); + + /* Set the Preload enable bit for channel4 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC4PE; + + /* Configure the Output Fast mode */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE; + htim->Instance->CCMR2 |= sConfig->OCFastMode << 8U; + break; + } + + default: + break; + } + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM One Pulse Channels according to the specified + * parameters in the TIM_OnePulse_InitTypeDef. + * @param htim TIM One Pulse handle + * @param sConfig TIM One Pulse configuration structure + * @param OutputChannel TIM output channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @param InputChannel TIM input Channel to configure + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @note To output a waveform with a minimum delay user can enable the fast + * mode by calling the @ref __HAL_TIM_ENABLE_OCxFAST macro. Then CCx + * output is forced in response to the edge detection on TIx input, + * without taking in account the comparison. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, + uint32_t OutputChannel, uint32_t InputChannel) +{ + TIM_OC_InitTypeDef temp1; + + /* Check the parameters */ + assert_param(IS_TIM_OPM_CHANNELS(OutputChannel)); + assert_param(IS_TIM_OPM_CHANNELS(InputChannel)); + + if (OutputChannel != InputChannel) + { + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Extract the Output compare configuration from sConfig structure */ + temp1.OCMode = sConfig->OCMode; + temp1.Pulse = sConfig->Pulse; + temp1.OCPolarity = sConfig->OCPolarity; + temp1.OCNPolarity = sConfig->OCNPolarity; + temp1.OCIdleState = sConfig->OCIdleState; + temp1.OCNIdleState = sConfig->OCNIdleState; + + switch (OutputChannel) + { + case TIM_CHANNEL_1: + { + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + TIM_OC1_SetConfig(htim->Instance, &temp1); + break; + } + case TIM_CHANNEL_2: + { + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_OC2_SetConfig(htim->Instance, &temp1); + break; + } + default: + break; + } + + switch (InputChannel) + { + case TIM_CHANNEL_1: + { + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity, + sConfig->ICSelection, sConfig->ICFilter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + + /* Select the Trigger source */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI1FP1; + + /* Select the Slave Mode */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER; + break; + } + case TIM_CHANNEL_2: + { + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity, + sConfig->ICSelection, sConfig->ICFilter); + + /* Reset the IC2PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC; + + /* Select the Trigger source */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI2FP2; + + /* Select the Slave Mode */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER; + break; + } + + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; + } + else + { + return HAL_ERROR; + } +} + +/** + * @brief Configure the DMA Burst to transfer Data from the memory to the TIM peripheral + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data write + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @note This function should be used only when BurstLength is equal to DMA data transfer length. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength) +{ + return HAL_TIM_DMABurst_MultiWriteStart(htim, BurstBaseAddress, BurstRequestSrc, BurstBuffer, BurstLength, + ((BurstLength) >> 8U) + 1U); +} + +/** + * @brief Configure the DMA Burst to transfer multiple Data from the memory to the TIM peripheral + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data write + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @param DataLength Data length. This parameter can be one value + * between 1 and 0xFFFF. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, + uint32_t BurstLength, uint32_t DataLength) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance)); + assert_param(IS_TIM_DMA_BASE(BurstBaseAddress)); + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + assert_param(IS_TIM_DMA_LENGTH(BurstLength)); + assert_param(IS_TIM_DMA_DATA_LENGTH(DataLength)); + + if (htim->DMABurstState == HAL_DMA_BURST_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->DMABurstState == HAL_DMA_BURST_STATE_READY) + { + if ((BurstBuffer == NULL) && (BurstLength > 0U)) + { + return HAL_ERROR; + } + else + { + htim->DMABurstState = HAL_DMA_BURST_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC4: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_COM: + { + /* Set the DMA commutation callbacks */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_TRIGGER: + { + /* Set the DMA trigger callbacks */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt; + htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer, + (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + default: + break; + } + + /* Configure the DMA Burst Mode */ + htim->Instance->DCR = (BurstBaseAddress | BurstLength); + /* Enable the TIM DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM DMA Burst mode + * @param htim TIM handle + * @param BurstRequestSrc TIM DMA Request sources to disable + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + + /* Abort the DMA transfer (at least disable the DMA channel) */ + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + break; + } + case TIM_DMA_CC1: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + case TIM_DMA_CC2: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + case TIM_DMA_CC3: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + case TIM_DMA_CC4: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + case TIM_DMA_COM: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]); + break; + } + case TIM_DMA_TRIGGER: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]); + break; + } + default: + break; + } + + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc); + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Configure the DMA Burst to transfer Data from the TIM peripheral to the memory + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data read + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @note This function should be used only when BurstLength is equal to DMA data transfer length. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength) +{ + return HAL_TIM_DMABurst_MultiReadStart(htim, BurstBaseAddress, BurstRequestSrc, BurstBuffer, BurstLength, + ((BurstLength) >> 8U) + 1U); +} + +/** + * @brief Configure the DMA Burst to transfer Data from the TIM peripheral to the memory + * @param htim TIM handle + * @param BurstBaseAddress TIM Base address from where the DMA will start the Data read + * This parameter can be one of the following values: + * @arg TIM_DMABASE_CR1 + * @arg TIM_DMABASE_CR2 + * @arg TIM_DMABASE_SMCR + * @arg TIM_DMABASE_DIER + * @arg TIM_DMABASE_SR + * @arg TIM_DMABASE_EGR + * @arg TIM_DMABASE_CCMR1 + * @arg TIM_DMABASE_CCMR2 + * @arg TIM_DMABASE_CCER + * @arg TIM_DMABASE_CNT + * @arg TIM_DMABASE_PSC + * @arg TIM_DMABASE_ARR + * @arg TIM_DMABASE_RCR + * @arg TIM_DMABASE_CCR1 + * @arg TIM_DMABASE_CCR2 + * @arg TIM_DMABASE_CCR3 + * @arg TIM_DMABASE_CCR4 + * @arg TIM_DMABASE_BDTR + * @param BurstRequestSrc TIM DMA Request sources + * This parameter can be one of the following values: + * @arg TIM_DMA_UPDATE: TIM update Interrupt source + * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source + * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source + * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source + * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source + * @arg TIM_DMA_COM: TIM Commutation DMA source + * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source + * @param BurstBuffer The Buffer address. + * @param BurstLength DMA Burst length. This parameter can be one value + * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS. + * @param DataLength Data length. This parameter can be one value + * between 1 and 0xFFFF. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, + uint32_t BurstRequestSrc, uint32_t *BurstBuffer, + uint32_t BurstLength, uint32_t DataLength) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance)); + assert_param(IS_TIM_DMA_BASE(BurstBaseAddress)); + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + assert_param(IS_TIM_DMA_LENGTH(BurstLength)); + assert_param(IS_TIM_DMA_DATA_LENGTH(DataLength)); + + if (htim->DMABurstState == HAL_DMA_BURST_STATE_BUSY) + { + return HAL_BUSY; + } + else if (htim->DMABurstState == HAL_DMA_BURST_STATE_READY) + { + if ((BurstBuffer == NULL) && (BurstLength > 0U)) + { + return HAL_ERROR; + } + else + { + htim->DMABurstState = HAL_DMA_BURST_STATE_BUSY; + } + } + else + { + /* nothing to do */ + } + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + /* Set the DMA Period elapsed callbacks */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt; + htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC1: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC2: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC3: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_CC4: + { + /* Set the DMA capture callbacks */ + htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC4]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_COM: + { + /* Set the DMA commutation callbacks */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + case TIM_DMA_TRIGGER: + { + /* Set the DMA trigger callbacks */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt; + htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, + DataLength) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + break; + } + default: + break; + } + + /* Configure the DMA Burst Mode */ + htim->Instance->DCR = (BurstBaseAddress | BurstLength); + + /* Enable the TIM DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stop the DMA burst reading + * @param htim TIM handle + * @param BurstRequestSrc TIM DMA Request sources to disable. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc)); + + /* Abort the DMA transfer (at least disable the DMA channel) */ + switch (BurstRequestSrc) + { + case TIM_DMA_UPDATE: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]); + break; + } + case TIM_DMA_CC1: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + case TIM_DMA_CC2: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + case TIM_DMA_CC3: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + case TIM_DMA_CC4: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]); + break; + } + case TIM_DMA_COM: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]); + break; + } + case TIM_DMA_TRIGGER: + { + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]); + break; + } + default: + break; + } + + /* Disable the TIM Update DMA request */ + __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc); + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Generate a software event + * @param htim TIM handle + * @param EventSource specifies the event source. + * This parameter can be one of the following values: + * @arg TIM_EVENTSOURCE_UPDATE: Timer update Event source + * @arg TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source + * @arg TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source + * @arg TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source + * @arg TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source + * @arg TIM_EVENTSOURCE_COM: Timer COM event source + * @arg TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source + * @arg TIM_EVENTSOURCE_BREAK: Timer Break event source + * @note Basic timers can only generate an update event. + * @note TIM_EVENTSOURCE_COM is relevant only with advanced timer instances. + * @note TIM_EVENTSOURCE_BREAK are relevant only for timer instances + * supporting a break input. + * @retval HAL status + */ + +HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + assert_param(IS_TIM_EVENT_SOURCE(EventSource)); + + /* Process Locked */ + __HAL_LOCK(htim); + + /* Change the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Set the event sources */ + htim->Instance->EGR = EventSource; + + /* Change the TIM state */ + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Configures the OCRef clear feature + * @param htim TIM handle + * @param sClearInputConfig pointer to a TIM_ClearInputConfigTypeDef structure that + * contains the OCREF clear feature and parameters for the TIM peripheral. + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, + TIM_ClearInputConfigTypeDef *sClearInputConfig, + uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_OCXREF_CLEAR_INSTANCE(htim->Instance)); + assert_param(IS_TIM_CLEARINPUT_SOURCE(sClearInputConfig->ClearInputSource)); + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + switch (sClearInputConfig->ClearInputSource) + { + case TIM_CLEARINPUTSOURCE_NONE: + { + /* Clear the OCREF clear selection bit and the the ETR Bits */ + CLEAR_BIT(htim->Instance->SMCR, (TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP)); + break; + } + + case TIM_CLEARINPUTSOURCE_ETR: + { + /* Check the parameters */ + assert_param(IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity)); + assert_param(IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler)); + assert_param(IS_TIM_CLEARINPUT_FILTER(sClearInputConfig->ClearInputFilter)); + + /* When OCRef clear feature is used with ETR source, ETR prescaler must be off */ + if (sClearInputConfig->ClearInputPrescaler != TIM_CLEARINPUTPRESCALER_DIV1) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + TIM_ETR_SetConfig(htim->Instance, + sClearInputConfig->ClearInputPrescaler, + sClearInputConfig->ClearInputPolarity, + sClearInputConfig->ClearInputFilter); + break; + } + + default: + break; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 1 */ + SET_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC1CE); + } + else + { + /* Disable the OCREF clear feature for Channel 1 */ + CLEAR_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC1CE); + } + break; + } + case TIM_CHANNEL_2: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 2 */ + SET_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC2CE); + } + else + { + /* Disable the OCREF clear feature for Channel 2 */ + CLEAR_BIT(htim->Instance->CCMR1, TIM_CCMR1_OC2CE); + } + break; + } + case TIM_CHANNEL_3: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 3 */ + SET_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC3CE); + } + else + { + /* Disable the OCREF clear feature for Channel 3 */ + CLEAR_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC3CE); + } + break; + } + case TIM_CHANNEL_4: + { + if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE) + { + /* Enable the OCREF clear feature for Channel 4 */ + SET_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC4CE); + } + else + { + /* Disable the OCREF clear feature for Channel 4 */ + CLEAR_BIT(htim->Instance->CCMR2, TIM_CCMR2_OC4CE); + } + break; + } + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the clock source to be used + * @param htim TIM handle + * @param sClockSourceConfig pointer to a TIM_ClockConfigTypeDef structure that + * contains the clock source information for the TIM peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig) +{ + uint32_t tmpsmcr; + + /* Process Locked */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Check the parameters */ + assert_param(IS_TIM_CLOCKSOURCE(sClockSourceConfig->ClockSource)); + + /* Reset the SMS, TS, ECE, ETPS and ETRF bits */ + tmpsmcr = htim->Instance->SMCR; + tmpsmcr &= ~(TIM_SMCR_SMS | TIM_SMCR_TS); + tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); + htim->Instance->SMCR = tmpsmcr; + + switch (sClockSourceConfig->ClockSource) + { + case TIM_CLOCKSOURCE_INTERNAL: + { + assert_param(IS_TIM_INSTANCE(htim->Instance)); + break; + } + + case TIM_CLOCKSOURCE_ETRMODE1: + { + /* Check whether or not the timer instance supports external trigger input mode 1 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance)); + + /* Check ETR input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler)); + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + /* Configure the ETR Clock source */ + TIM_ETR_SetConfig(htim->Instance, + sClockSourceConfig->ClockPrescaler, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + + /* Select the External clock mode1 and the ETRF trigger */ + tmpsmcr = htim->Instance->SMCR; + tmpsmcr |= (TIM_SLAVEMODE_EXTERNAL1 | TIM_CLOCKSOURCE_ETRMODE1); + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + break; + } + + case TIM_CLOCKSOURCE_ETRMODE2: + { + /* Check whether or not the timer instance supports external trigger input mode 2 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(htim->Instance)); + + /* Check ETR input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler)); + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + /* Configure the ETR Clock source */ + TIM_ETR_SetConfig(htim->Instance, + sClockSourceConfig->ClockPrescaler, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + /* Enable the External clock mode2 */ + htim->Instance->SMCR |= TIM_SMCR_ECE; + break; + } + + case TIM_CLOCKSOURCE_TI1: + { + /* Check whether or not the timer instance supports external clock mode 1 */ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI1 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI1_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1); + break; + } + + case TIM_CLOCKSOURCE_TI2: + { + /* Check whether or not the timer instance supports external clock mode 1 (ETRF)*/ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI2 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI2_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI2); + break; + } + + case TIM_CLOCKSOURCE_TI1ED: + { + /* Check whether or not the timer instance supports external clock mode 1 */ + assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance)); + + /* Check TI1 input conditioning related parameters */ + assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity)); + assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter)); + + TIM_TI1_ConfigInputStage(htim->Instance, + sClockSourceConfig->ClockPolarity, + sClockSourceConfig->ClockFilter); + TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1ED); + break; + } + + case TIM_CLOCKSOURCE_ITR0: + case TIM_CLOCKSOURCE_ITR1: + case TIM_CLOCKSOURCE_ITR2: + case TIM_CLOCKSOURCE_ITR3: + { + /* Check whether or not the timer instance supports internal trigger input */ + assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance)); + + TIM_ITRx_SetConfig(htim->Instance, sClockSourceConfig->ClockSource); + break; + } + + default: + break; + } + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Selects the signal connected to the TI1 input: direct from CH1_input + * or a XOR combination between CH1_input, CH2_input & CH3_input + * @param htim TIM handle. + * @param TI1_Selection Indicate whether or not channel 1 is connected to the + * output of a XOR gate. + * This parameter can be one of the following values: + * @arg TIM_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1 input + * @arg TIM_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3 + * pins are connected to the TI1 input (XOR combination) + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection) +{ + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_XOR_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TI1SELECTION(TI1_Selection)); + + /* Get the TIMx CR2 register value */ + tmpcr2 = htim->Instance->CR2; + + /* Reset the TI1 selection */ + tmpcr2 &= ~TIM_CR2_TI1S; + + /* Set the TI1 selection */ + tmpcr2 |= TI1_Selection; + + /* Write to TIMxCR2 */ + htim->Instance->CR2 = tmpcr2; + + return HAL_OK; +} + +/** + * @brief Configures the TIM in Slave mode + * @param htim TIM handle. + * @param sSlaveConfig pointer to a TIM_SlaveConfigTypeDef structure that + * contains the selected trigger (internal trigger input, filtered + * timer input or external trigger input) and the Slave mode + * (Disable, Reset, Gated, Trigger, External clock mode 1). + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + /* Check the parameters */ + assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode)); + assert_param(IS_TIM_TRIGGER_SELECTION(sSlaveConfig->InputTrigger)); + + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + /* Disable Trigger Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_TRIGGER); + + /* Disable Trigger DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_TRIGGER); + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIM in Slave mode in interrupt mode + * @param htim TIM handle. + * @param sSlaveConfig pointer to a TIM_SlaveConfigTypeDef structure that + * contains the selected trigger (internal trigger input, filtered + * timer input or external trigger input) and the Slave mode + * (Disable, Reset, Gated, Trigger, External clock mode 1). + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + /* Check the parameters */ + assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode)); + assert_param(IS_TIM_TRIGGER_SELECTION(sSlaveConfig->InputTrigger)); + + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK) + { + htim->State = HAL_TIM_STATE_READY; + __HAL_UNLOCK(htim); + return HAL_ERROR; + } + + /* Enable Trigger Interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_TRIGGER); + + /* Disable Trigger DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_TRIGGER); + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Read the captured value from Capture Compare unit + * @param htim TIM handle. + * @param Channel TIM Channels to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @arg TIM_CHANNEL_4: TIM Channel 4 selected + * @retval Captured value + */ +uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpreg = 0U; + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + + /* Return the capture 1 value */ + tmpreg = htim->Instance->CCR1; + + break; + } + case TIM_CHANNEL_2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + + /* Return the capture 2 value */ + tmpreg = htim->Instance->CCR2; + + break; + } + + case TIM_CHANNEL_3: + { + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(htim->Instance)); + + /* Return the capture 3 value */ + tmpreg = htim->Instance->CCR3; + + break; + } + + case TIM_CHANNEL_4: + { + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(htim->Instance)); + + /* Return the capture 4 value */ + tmpreg = htim->Instance->CCR4; + + break; + } + + default: + break; + } + + return tmpreg; +} + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group9 TIM Callbacks functions + * @brief TIM Callbacks functions + * +@verbatim + ============================================================================== + ##### TIM Callbacks functions ##### + ============================================================================== + [..] + This section provides TIM callback functions: + (+) TIM Period elapsed callback + (+) TIM Output Compare callback + (+) TIM Input capture callback + (+) TIM Trigger callback + (+) TIM Error callback + +@endverbatim + * @{ + */ + +/** + * @brief Period elapsed callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PeriodElapsedCallback could be implemented in the user file + */ +} + +/** + * @brief Period elapsed half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PeriodElapsedHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Output Compare callback in non-blocking mode + * @param htim TIM OC handle + * @retval None + */ +__weak void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_OC_DelayElapsedCallback could be implemented in the user file + */ +} + +/** + * @brief Input Capture callback in non-blocking mode + * @param htim TIM IC handle + * @retval None + */ +__weak void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_CaptureCallback could be implemented in the user file + */ +} + +/** + * @brief Input Capture half complete callback in non-blocking mode + * @param htim TIM IC handle + * @retval None + */ +__weak void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_IC_CaptureHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief PWM Pulse finished callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_PulseFinishedCallback could be implemented in the user file + */ +} + +/** + * @brief PWM Pulse finished half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_PWM_PulseFinishedHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Trigger detection callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_TriggerCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Trigger detection half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_TriggerHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Timer error callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIM_ErrorCallback could be implemented in the user file + */ +} + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief Register a User TIM callback to be used instead of the weak predefined callback + * @param htim tim handle + * @param CallbackID ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_TIM_BASE_MSPINIT_CB_ID Base MspInit Callback ID + * @arg @ref HAL_TIM_BASE_MSPDEINIT_CB_ID Base MspDeInit Callback ID + * @arg @ref HAL_TIM_IC_MSPINIT_CB_ID IC MspInit Callback ID + * @arg @ref HAL_TIM_IC_MSPDEINIT_CB_ID IC MspDeInit Callback ID + * @arg @ref HAL_TIM_OC_MSPINIT_CB_ID OC MspInit Callback ID + * @arg @ref HAL_TIM_OC_MSPDEINIT_CB_ID OC MspDeInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPINIT_CB_ID PWM MspInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPDEINIT_CB_ID PWM MspDeInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPINIT_CB_ID One Pulse MspInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID One Pulse MspDeInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPINIT_CB_ID Encoder MspInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPDEINIT_CB_ID Encoder MspDeInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID Hall Sensor MspInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID Hall Sensor MspDeInit Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_CB_ID Period Elapsed Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID Period Elapsed half complete Callback ID + * @arg @ref HAL_TIM_TRIGGER_CB_ID Trigger Callback ID + * @arg @ref HAL_TIM_TRIGGER_HALF_CB_ID Trigger half complete Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_CB_ID Input Capture Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_HALF_CB_ID Input Capture half complete Callback ID + * @arg @ref HAL_TIM_OC_DELAY_ELAPSED_CB_ID Output Compare Delay Elapsed Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_CB_ID PWM Pulse Finished Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID PWM Pulse Finished half complete Callback ID + * @arg @ref HAL_TIM_ERROR_CB_ID Error Callback ID + * @arg @ref HAL_TIM_COMMUTATION_CB_ID Commutation Callback ID + * @arg @ref HAL_TIM_COMMUTATION_HALF_CB_ID Commutation half complete Callback ID + * @arg @ref HAL_TIM_BREAK_CB_ID Break Callback ID + * @param pCallback pointer to the callback function + * @retval status + */ +HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, + pTIM_CallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + return HAL_ERROR; + } + /* Process locked */ + __HAL_LOCK(htim); + + if (htim->State == HAL_TIM_STATE_READY) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = pCallback; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PERIOD_ELAPSED_CB_ID : + htim->PeriodElapsedCallback = pCallback; + break; + + case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID : + htim->PeriodElapsedHalfCpltCallback = pCallback; + break; + + case HAL_TIM_TRIGGER_CB_ID : + htim->TriggerCallback = pCallback; + break; + + case HAL_TIM_TRIGGER_HALF_CB_ID : + htim->TriggerHalfCpltCallback = pCallback; + break; + + case HAL_TIM_IC_CAPTURE_CB_ID : + htim->IC_CaptureCallback = pCallback; + break; + + case HAL_TIM_IC_CAPTURE_HALF_CB_ID : + htim->IC_CaptureHalfCpltCallback = pCallback; + break; + + case HAL_TIM_OC_DELAY_ELAPSED_CB_ID : + htim->OC_DelayElapsedCallback = pCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_CB_ID : + htim->PWM_PulseFinishedCallback = pCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID : + htim->PWM_PulseFinishedHalfCpltCallback = pCallback; + break; + + case HAL_TIM_ERROR_CB_ID : + htim->ErrorCallback = pCallback; + break; + + case HAL_TIM_COMMUTATION_CB_ID : + htim->CommutationCallback = pCallback; + break; + + case HAL_TIM_COMMUTATION_HALF_CB_ID : + htim->CommutationHalfCpltCallback = pCallback; + break; + + case HAL_TIM_BREAK_CB_ID : + htim->BreakCallback = pCallback; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (htim->State == HAL_TIM_STATE_RESET) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + htim->Base_MspInitCallback = pCallback; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + htim->Base_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + htim->IC_MspInitCallback = pCallback; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + htim->IC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + htim->OC_MspInitCallback = pCallback; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + htim->OC_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + htim->PWM_MspInitCallback = pCallback; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + htim->PWM_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + htim->OnePulse_MspInitCallback = pCallback; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + htim->OnePulse_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + htim->Encoder_MspInitCallback = pCallback; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + htim->Encoder_MspDeInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + htim->HallSensor_MspInitCallback = pCallback; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + htim->HallSensor_MspDeInitCallback = pCallback; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return status; +} + +/** + * @brief Unregister a TIM callback + * TIM callback is redirected to the weak predefined callback + * @param htim tim handle + * @param CallbackID ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_TIM_BASE_MSPINIT_CB_ID Base MspInit Callback ID + * @arg @ref HAL_TIM_BASE_MSPDEINIT_CB_ID Base MspDeInit Callback ID + * @arg @ref HAL_TIM_IC_MSPINIT_CB_ID IC MspInit Callback ID + * @arg @ref HAL_TIM_IC_MSPDEINIT_CB_ID IC MspDeInit Callback ID + * @arg @ref HAL_TIM_OC_MSPINIT_CB_ID OC MspInit Callback ID + * @arg @ref HAL_TIM_OC_MSPDEINIT_CB_ID OC MspDeInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPINIT_CB_ID PWM MspInit Callback ID + * @arg @ref HAL_TIM_PWM_MSPDEINIT_CB_ID PWM MspDeInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPINIT_CB_ID One Pulse MspInit Callback ID + * @arg @ref HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID One Pulse MspDeInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPINIT_CB_ID Encoder MspInit Callback ID + * @arg @ref HAL_TIM_ENCODER_MSPDEINIT_CB_ID Encoder MspDeInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID Hall Sensor MspInit Callback ID + * @arg @ref HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID Hall Sensor MspDeInit Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_CB_ID Period Elapsed Callback ID + * @arg @ref HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID Period Elapsed half complete Callback ID + * @arg @ref HAL_TIM_TRIGGER_CB_ID Trigger Callback ID + * @arg @ref HAL_TIM_TRIGGER_HALF_CB_ID Trigger half complete Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_CB_ID Input Capture Callback ID + * @arg @ref HAL_TIM_IC_CAPTURE_HALF_CB_ID Input Capture half complete Callback ID + * @arg @ref HAL_TIM_OC_DELAY_ELAPSED_CB_ID Output Compare Delay Elapsed Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_CB_ID PWM Pulse Finished Callback ID + * @arg @ref HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID PWM Pulse Finished half complete Callback ID + * @arg @ref HAL_TIM_ERROR_CB_ID Error Callback ID + * @arg @ref HAL_TIM_COMMUTATION_CB_ID Commutation Callback ID + * @arg @ref HAL_TIM_COMMUTATION_HALF_CB_ID Commutation half complete Callback ID + * @arg @ref HAL_TIM_BREAK_CB_ID Break Callback ID + * @retval status + */ +HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(htim); + + if (htim->State == HAL_TIM_STATE_READY) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + /* Legacy weak Base MspInit Callback */ + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + /* Legacy weak Base Msp DeInit Callback */ + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + /* Legacy weak IC Msp Init Callback */ + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + /* Legacy weak IC Msp DeInit Callback */ + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + /* Legacy weak OC Msp Init Callback */ + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + /* Legacy weak OC Msp DeInit Callback */ + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + /* Legacy weak PWM Msp Init Callback */ + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + /* Legacy weak PWM Msp DeInit Callback */ + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + /* Legacy weak One Pulse Msp Init Callback */ + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + /* Legacy weak One Pulse Msp DeInit Callback */ + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + /* Legacy weak Encoder Msp Init Callback */ + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + /* Legacy weak Encoder Msp DeInit Callback */ + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + /* Legacy weak Hall Sensor Msp Init Callback */ + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + /* Legacy weak Hall Sensor Msp DeInit Callback */ + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; + break; + + case HAL_TIM_PERIOD_ELAPSED_CB_ID : + /* Legacy weak Period Elapsed Callback */ + htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; + break; + + case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID : + /* Legacy weak Period Elapsed half complete Callback */ + htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; + break; + + case HAL_TIM_TRIGGER_CB_ID : + /* Legacy weak Trigger Callback */ + htim->TriggerCallback = HAL_TIM_TriggerCallback; + break; + + case HAL_TIM_TRIGGER_HALF_CB_ID : + /* Legacy weak Trigger half complete Callback */ + htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; + break; + + case HAL_TIM_IC_CAPTURE_CB_ID : + /* Legacy weak IC Capture Callback */ + htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; + break; + + case HAL_TIM_IC_CAPTURE_HALF_CB_ID : + /* Legacy weak IC Capture half complete Callback */ + htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; + break; + + case HAL_TIM_OC_DELAY_ELAPSED_CB_ID : + /* Legacy weak OC Delay Elapsed Callback */ + htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_CB_ID : + /* Legacy weak PWM Pulse Finished Callback */ + htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; + break; + + case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID : + /* Legacy weak PWM Pulse Finished half complete Callback */ + htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; + break; + + case HAL_TIM_ERROR_CB_ID : + /* Legacy weak Error Callback */ + htim->ErrorCallback = HAL_TIM_ErrorCallback; + break; + + case HAL_TIM_COMMUTATION_CB_ID : + /* Legacy weak Commutation Callback */ + htim->CommutationCallback = HAL_TIMEx_CommutCallback; + break; + + case HAL_TIM_COMMUTATION_HALF_CB_ID : + /* Legacy weak Commutation half complete Callback */ + htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; + break; + + case HAL_TIM_BREAK_CB_ID : + /* Legacy weak Break Callback */ + htim->BreakCallback = HAL_TIMEx_BreakCallback; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (htim->State == HAL_TIM_STATE_RESET) + { + switch (CallbackID) + { + case HAL_TIM_BASE_MSPINIT_CB_ID : + /* Legacy weak Base MspInit Callback */ + htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; + break; + + case HAL_TIM_BASE_MSPDEINIT_CB_ID : + /* Legacy weak Base Msp DeInit Callback */ + htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; + break; + + case HAL_TIM_IC_MSPINIT_CB_ID : + /* Legacy weak IC Msp Init Callback */ + htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; + break; + + case HAL_TIM_IC_MSPDEINIT_CB_ID : + /* Legacy weak IC Msp DeInit Callback */ + htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; + break; + + case HAL_TIM_OC_MSPINIT_CB_ID : + /* Legacy weak OC Msp Init Callback */ + htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; + break; + + case HAL_TIM_OC_MSPDEINIT_CB_ID : + /* Legacy weak OC Msp DeInit Callback */ + htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; + break; + + case HAL_TIM_PWM_MSPINIT_CB_ID : + /* Legacy weak PWM Msp Init Callback */ + htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; + break; + + case HAL_TIM_PWM_MSPDEINIT_CB_ID : + /* Legacy weak PWM Msp DeInit Callback */ + htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; + break; + + case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID : + /* Legacy weak One Pulse Msp Init Callback */ + htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; + break; + + case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID : + /* Legacy weak One Pulse Msp DeInit Callback */ + htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; + break; + + case HAL_TIM_ENCODER_MSPINIT_CB_ID : + /* Legacy weak Encoder Msp Init Callback */ + htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; + break; + + case HAL_TIM_ENCODER_MSPDEINIT_CB_ID : + /* Legacy weak Encoder Msp DeInit Callback */ + htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; + break; + + case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID : + /* Legacy weak Hall Sensor Msp Init Callback */ + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; + break; + + case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID : + /* Legacy weak Hall Sensor Msp DeInit Callback */ + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; + break; + + default : + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return status; +} +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup TIM_Exported_Functions_Group10 TIM Peripheral State functions + * @brief TIM Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Return the TIM Base handle state. + * @param htim TIM Base handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM OC handle state. + * @param htim TIM Output Compare handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM PWM handle state. + * @param htim TIM handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM Input Capture handle state. + * @param htim TIM IC handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM One Pulse Mode handle state. + * @param htim TIM OPM handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM Encoder Mode handle state. + * @param htim TIM Encoder Interface handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return the TIM Encoder Mode handle state. + * @param htim TIM handle + * @retval Active channel + */ +HAL_TIM_ActiveChannel HAL_TIM_GetActiveChannel(TIM_HandleTypeDef *htim) +{ + return htim->Channel; +} + +/** + * @brief Return actual state of the TIM channel. + * @param htim TIM handle + * @param Channel TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @arg TIM_CHANNEL_5: TIM Channel 5 + * @arg TIM_CHANNEL_6: TIM Channel 6 + * @retval TIM Channel state + */ +HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + HAL_TIM_ChannelStateTypeDef channel_state; + + /* Check the parameters */ + assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel)); + + channel_state = TIM_CHANNEL_STATE_GET(htim, Channel); + + return channel_state; +} + +/** + * @brief Return actual state of a DMA burst operation. + * @param htim TIM handle + * @retval DMA burst state + */ +HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance)); + + return htim->DMABurstState; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup TIM_Private_Functions TIM Private Functions + * @{ + */ + +/** + * @brief TIM DMA error callback + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMAError(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_4, HAL_TIM_CHANNEL_STATE_READY); + } + else + { + htim->State = HAL_TIM_STATE_READY; + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->ErrorCallback(htim); +#else + HAL_TIM_ErrorCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Delay Pulse complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_4, HAL_TIM_CHANNEL_STATE_READY); + } + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Delay Pulse half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PWM_PulseFinishedHalfCpltCallback(htim); +#else + HAL_TIM_PWM_PulseFinishedHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Capture complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_4, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_4, HAL_TIM_CHANNEL_STATE_READY); + } + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureCallback(htim); +#else + HAL_TIM_IC_CaptureCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Capture half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->IC_CaptureHalfCpltCallback(htim); +#else + HAL_TIM_IC_CaptureHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA Period Elapse complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (htim->hdma[TIM_DMA_ID_UPDATE]->Init.Mode == DMA_NORMAL) + { + htim->State = HAL_TIM_STATE_READY; + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedCallback(htim); +#else + HAL_TIM_PeriodElapsedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Period Elapse half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PeriodElapsedHalfCpltCallback(htim); +#else + HAL_TIM_PeriodElapsedHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Trigger callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (htim->hdma[TIM_DMA_ID_TRIGGER]->Init.Mode == DMA_NORMAL) + { + htim->State = HAL_TIM_STATE_READY; + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerCallback(htim); +#else + HAL_TIM_TriggerCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Trigger half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->TriggerHalfCpltCallback(htim); +#else + HAL_TIM_TriggerHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief Time Base configuration + * @param TIMx TIM peripheral + * @param Structure TIM Base configuration structure + * @retval None + */ +void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure) +{ + uint32_t tmpcr1; + tmpcr1 = TIMx->CR1; + + /* Set TIM Time Base Unit parameters ---------------------------------------*/ + if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) + { + /* Select the Counter Mode */ + tmpcr1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS); + tmpcr1 |= Structure->CounterMode; + } + + if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) + { + /* Set the clock division */ + tmpcr1 &= ~TIM_CR1_CKD; + tmpcr1 |= (uint32_t)Structure->ClockDivision; + } + + /* Set the auto-reload preload */ + MODIFY_REG(tmpcr1, TIM_CR1_ARPE, Structure->AutoReloadPreload); + + TIMx->CR1 = tmpcr1; + + /* Set the Autoreload value */ + TIMx->ARR = (uint32_t)Structure->Period ; + + /* Set the Prescaler value */ + TIMx->PSC = Structure->Prescaler; + + if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) + { + /* Set the Repetition Counter value */ + TIMx->RCR = Structure->RepetitionCounter; + } + + /* Generate an update event to reload the Prescaler + and the repetition counter (only for advanced timer) value immediately */ + TIMx->EGR = TIM_EGR_UG; +} + +/** + * @brief Timer Output Compare 1 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The output configuration structure + * @retval None + */ +static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= ~TIM_CCER_CC1E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR1 register value */ + tmpccmrx = TIMx->CCMR1; + + /* Reset the Output Compare Mode Bits */ + tmpccmrx &= ~TIM_CCMR1_OC1M; + tmpccmrx &= ~TIM_CCMR1_CC1S; + /* Select the Output Compare Mode */ + tmpccmrx |= OC_Config->OCMode; + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC1P; + /* Set the Output Compare Polarity */ + tmpccer |= OC_Config->OCPolarity; + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_1)) + { + /* Check parameters */ + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC1NP; + /* Set the Output N Polarity */ + tmpccer |= OC_Config->OCNPolarity; + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC1NE; + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS1; + tmpcr2 &= ~TIM_CR2_OIS1N; + /* Set the Output Idle state */ + tmpcr2 |= OC_Config->OCIdleState; + /* Set the Output N Idle state */ + tmpcr2 |= OC_Config->OCNIdleState; + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR1 */ + TIMx->CCMR1 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR1 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 2 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The output configuration structure + * @retval None + */ +void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR1 register value */ + tmpccmrx = TIMx->CCMR1; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR1_OC2M; + tmpccmrx &= ~TIM_CCMR1_CC2S; + + /* Select the Output Compare Mode */ + tmpccmrx |= (OC_Config->OCMode << 8U); + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC2P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 4U); + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_2)) + { + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC2NP; + /* Set the Output N Polarity */ + tmpccer |= (OC_Config->OCNPolarity << 4U); + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC2NE; + + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS2; + tmpcr2 &= ~TIM_CR2_OIS2N; + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 2U); + /* Set the Output N Idle state */ + tmpcr2 |= (OC_Config->OCNIdleState << 2U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR1 */ + TIMx->CCMR1 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR2 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 3 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The output configuration structure + * @retval None + */ +static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 3: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC3E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR2 register value */ + tmpccmrx = TIMx->CCMR2; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR2_OC3M; + tmpccmrx &= ~TIM_CCMR2_CC3S; + /* Select the Output Compare Mode */ + tmpccmrx |= OC_Config->OCMode; + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC3P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 8U); + + if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_3)) + { + assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity)); + + /* Reset the Output N Polarity level */ + tmpccer &= ~TIM_CCER_CC3NP; + /* Set the Output N Polarity */ + tmpccer |= (OC_Config->OCNPolarity << 8U); + /* Reset the Output N State */ + tmpccer &= ~TIM_CCER_CC3NE; + } + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState)); + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare and Output Compare N IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS3; + tmpcr2 &= ~TIM_CR2_OIS3N; + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 4U); + /* Set the Output N Idle state */ + tmpcr2 |= (OC_Config->OCNIdleState << 4U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR2 */ + TIMx->CCMR2 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR3 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Timer Output Compare 4 configuration + * @param TIMx to select the TIM peripheral + * @param OC_Config The output configuration structure + * @retval None + */ +static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) +{ + uint32_t tmpccmrx; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= ~TIM_CCER_CC4E; + + /* Get the TIMx CCER register value */ + tmpccer = TIMx->CCER; + /* Get the TIMx CR2 register value */ + tmpcr2 = TIMx->CR2; + + /* Get the TIMx CCMR2 register value */ + tmpccmrx = TIMx->CCMR2; + + /* Reset the Output Compare mode and Capture/Compare selection Bits */ + tmpccmrx &= ~TIM_CCMR2_OC4M; + tmpccmrx &= ~TIM_CCMR2_CC4S; + + /* Select the Output Compare Mode */ + tmpccmrx |= (OC_Config->OCMode << 8U); + + /* Reset the Output Polarity level */ + tmpccer &= ~TIM_CCER_CC4P; + /* Set the Output Compare Polarity */ + tmpccer |= (OC_Config->OCPolarity << 12U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + /* Check parameters */ + assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState)); + + /* Reset the Output Compare IDLE State */ + tmpcr2 &= ~TIM_CR2_OIS4; + + /* Set the Output Idle state */ + tmpcr2 |= (OC_Config->OCIdleState << 6U); + } + + /* Write to TIMx CR2 */ + TIMx->CR2 = tmpcr2; + + /* Write to TIMx CCMR2 */ + TIMx->CCMR2 = tmpccmrx; + + /* Set the Capture Compare Register value */ + TIMx->CCR4 = OC_Config->Pulse; + + /* Write to TIMx CCER */ + TIMx->CCER = tmpccer; +} + +/** + * @brief Slave Timer configuration function + * @param htim TIM handle + * @param sSlaveConfig Slave timer configuration + * @retval None + */ +static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim, + TIM_SlaveConfigTypeDef *sSlaveConfig) +{ + uint32_t tmpsmcr; + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Reset the Trigger Selection Bits */ + tmpsmcr &= ~TIM_SMCR_TS; + /* Set the Input Trigger source */ + tmpsmcr |= sSlaveConfig->InputTrigger; + + /* Reset the slave mode Bits */ + tmpsmcr &= ~TIM_SMCR_SMS; + /* Set the slave mode */ + tmpsmcr |= sSlaveConfig->SlaveMode; + + /* Write to TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + + /* Configure the trigger prescaler, filter, and polarity */ + switch (sSlaveConfig->InputTrigger) + { + case TIM_TS_ETRF: + { + /* Check the parameters */ + assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPRESCALER(sSlaveConfig->TriggerPrescaler)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + /* Configure the ETR Trigger source */ + TIM_ETR_SetConfig(htim->Instance, + sSlaveConfig->TriggerPrescaler, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_TI1F_ED: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + if (sSlaveConfig->SlaveMode == TIM_SLAVEMODE_GATED) + { + return HAL_ERROR; + } + + /* Disable the Channel 1: Reset the CC1E Bit */ + tmpccer = htim->Instance->CCER; + htim->Instance->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = htim->Instance->CCMR1; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= ((sSlaveConfig->TriggerFilter) << 4U); + + /* Write to TIMx CCMR1 and CCER registers */ + htim->Instance->CCMR1 = tmpccmr1; + htim->Instance->CCER = tmpccer; + break; + } + + case TIM_TS_TI1FP1: + { + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + /* Configure TI1 Filter and Polarity */ + TIM_TI1_ConfigInputStage(htim->Instance, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_TI2FP2: + { + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity)); + assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter)); + + /* Configure TI2 Filter and Polarity */ + TIM_TI2_ConfigInputStage(htim->Instance, + sSlaveConfig->TriggerPolarity, + sSlaveConfig->TriggerFilter); + break; + } + + case TIM_TS_ITR0: + case TIM_TS_ITR1: + case TIM_TS_ITR2: + case TIM_TS_ITR3: + { + /* Check the parameter */ + assert_param(IS_TIM_CC2_INSTANCE(htim->Instance)); + break; + } + + default: + break; + } + return HAL_OK; +} + +/** + * @brief Configure the TI1 as Input. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 1 is selected to be connected to IC1. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 1 is selected to be connected to IC2. + * @arg TIM_ICSELECTION_TRC: TIM Input 1 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI2FP1 + * (on channel2 path) is used as the input signal. Therefore CCMR1 must be + * protected against un-initialized filter and polarity values. + */ +void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Select the Input */ + if (IS_TIM_CC2_INSTANCE(TIMx) != RESET) + { + tmpccmr1 &= ~TIM_CCMR1_CC1S; + tmpccmr1 |= TIM_ICSelection; + } + else + { + tmpccmr1 |= TIM_CCMR1_CC1S_0; + } + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= ((TIM_ICFilter << 4U) & TIM_CCMR1_IC1F); + + /* Select the Polarity and set the CC1E Bit */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP); + tmpccer |= (TIM_ICPolarity & (TIM_CCER_CC1P | TIM_CCER_CC1NP)); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the Polarity and Filter for TI1. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + */ +static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 1: Reset the CC1E Bit */ + tmpccer = TIMx->CCER; + TIMx->CCER &= ~TIM_CCER_CC1E; + tmpccmr1 = TIMx->CCMR1; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC1F; + tmpccmr1 |= (TIM_ICFilter << 4U); + + /* Select the Polarity and set the CC1E Bit */ + tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP); + tmpccer |= TIM_ICPolarity; + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI2 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 2 is selected to be connected to IC2. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 2 is selected to be connected to IC1. + * @arg TIM_ICSELECTION_TRC: TIM Input 2 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI1FP2 + * (on channel1 path) is used as the input signal. Therefore CCMR1 must be + * protected against un-initialized filter and polarity values. + */ +static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr1 &= ~TIM_CCMR1_CC2S; + tmpccmr1 |= (TIM_ICSelection << 8U); + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC2F; + tmpccmr1 |= ((TIM_ICFilter << 12U) & TIM_CCMR1_IC2F); + + /* Select the Polarity and set the CC2E Bit */ + tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= ((TIM_ICPolarity << 4U) & (TIM_CCER_CC2P | TIM_CCER_CC2NP)); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1 ; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the Polarity and Filter for TI2. + * @param TIMx to select the TIM peripheral. + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @arg TIM_ICPOLARITY_BOTHEDGE + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + */ +static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= ~TIM_CCER_CC2E; + tmpccmr1 = TIMx->CCMR1; + tmpccer = TIMx->CCER; + + /* Set the filter */ + tmpccmr1 &= ~TIM_CCMR1_IC2F; + tmpccmr1 |= (TIM_ICFilter << 12U); + + /* Select the Polarity and set the CC2E Bit */ + tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (TIM_ICPolarity << 4U); + + /* Write to TIMx CCMR1 and CCER registers */ + TIMx->CCMR1 = tmpccmr1 ; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI3 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 3 is selected to be connected to IC3. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 3 is selected to be connected to IC4. + * @arg TIM_ICSELECTION_TRC: TIM Input 3 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @retval None + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI3FP4 + * (on channel1 path) is used as the input signal. Therefore CCMR2 must be + * protected against un-initialized filter and polarity values. + */ +static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + + /* Disable the Channel 3: Reset the CC3E Bit */ + TIMx->CCER &= ~TIM_CCER_CC3E; + tmpccmr2 = TIMx->CCMR2; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr2 &= ~TIM_CCMR2_CC3S; + tmpccmr2 |= TIM_ICSelection; + + /* Set the filter */ + tmpccmr2 &= ~TIM_CCMR2_IC3F; + tmpccmr2 |= ((TIM_ICFilter << 4U) & TIM_CCMR2_IC3F); + + /* Select the Polarity and set the CC3E Bit */ + tmpccer &= ~(TIM_CCER_CC3P); + tmpccer |= ((TIM_ICPolarity << 8U) & TIM_CCER_CC3P); + + /* Write to TIMx CCMR2 and CCER registers */ + TIMx->CCMR2 = tmpccmr2; + TIMx->CCER = tmpccer; +} + +/** + * @brief Configure the TI4 as Input. + * @param TIMx to select the TIM peripheral + * @param TIM_ICPolarity The Input Polarity. + * This parameter can be one of the following values: + * @arg TIM_ICPOLARITY_RISING + * @arg TIM_ICPOLARITY_FALLING + * @param TIM_ICSelection specifies the input to be used. + * This parameter can be one of the following values: + * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 4 is selected to be connected to IC4. + * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 4 is selected to be connected to IC3. + * @arg TIM_ICSELECTION_TRC: TIM Input 4 is selected to be connected to TRC. + * @param TIM_ICFilter Specifies the Input Capture Filter. + * This parameter must be a value between 0x00 and 0x0F. + * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI4FP3 + * (on channel1 path) is used as the input signal. Therefore CCMR2 must be + * protected against un-initialized filter and polarity values. + * @retval None + */ +static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, + uint32_t TIM_ICFilter) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= ~TIM_CCER_CC4E; + tmpccmr2 = TIMx->CCMR2; + tmpccer = TIMx->CCER; + + /* Select the Input */ + tmpccmr2 &= ~TIM_CCMR2_CC4S; + tmpccmr2 |= (TIM_ICSelection << 8U); + + /* Set the filter */ + tmpccmr2 &= ~TIM_CCMR2_IC4F; + tmpccmr2 |= ((TIM_ICFilter << 12U) & TIM_CCMR2_IC4F); + + /* Select the Polarity and set the CC4E Bit */ + tmpccer &= ~(TIM_CCER_CC4P); + tmpccer |= ((TIM_ICPolarity << 12U) & TIM_CCER_CC4P); + + /* Write to TIMx CCMR2 and CCER registers */ + TIMx->CCMR2 = tmpccmr2; + TIMx->CCER = tmpccer ; +} + +/** + * @brief Selects the Input Trigger source + * @param TIMx to select the TIM peripheral + * @param InputTriggerSource The Input Trigger source. + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal Trigger 0 + * @arg TIM_TS_ITR1: Internal Trigger 1 + * @arg TIM_TS_ITR2: Internal Trigger 2 + * @arg TIM_TS_ITR3: Internal Trigger 3 + * @arg TIM_TS_TI1F_ED: TI1 Edge Detector + * @arg TIM_TS_TI1FP1: Filtered Timer Input 1 + * @arg TIM_TS_TI2FP2: Filtered Timer Input 2 + * @arg TIM_TS_ETRF: External Trigger input + * @retval None + */ +static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource) +{ + uint32_t tmpsmcr; + + /* Get the TIMx SMCR register value */ + tmpsmcr = TIMx->SMCR; + /* Reset the TS Bits */ + tmpsmcr &= ~TIM_SMCR_TS; + /* Set the Input Trigger source and the slave mode*/ + tmpsmcr |= (InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1); + /* Write to TIMx SMCR */ + TIMx->SMCR = tmpsmcr; +} +/** + * @brief Configures the TIMx External Trigger (ETR). + * @param TIMx to select the TIM peripheral + * @param TIM_ExtTRGPrescaler The external Trigger Prescaler. + * This parameter can be one of the following values: + * @arg TIM_ETRPRESCALER_DIV1: ETRP Prescaler OFF. + * @arg TIM_ETRPRESCALER_DIV2: ETRP frequency divided by 2. + * @arg TIM_ETRPRESCALER_DIV4: ETRP frequency divided by 4. + * @arg TIM_ETRPRESCALER_DIV8: ETRP frequency divided by 8. + * @param TIM_ExtTRGPolarity The external Trigger Polarity. + * This parameter can be one of the following values: + * @arg TIM_ETRPOLARITY_INVERTED: active low or falling edge active. + * @arg TIM_ETRPOLARITY_NONINVERTED: active high or rising edge active. + * @param ExtTRGFilter External Trigger Filter. + * This parameter must be a value between 0x00 and 0x0F + * @retval None + */ +void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, + uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter) +{ + uint32_t tmpsmcr; + + tmpsmcr = TIMx->SMCR; + + /* Reset the ETR Bits */ + tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); + + /* Set the Prescaler, the Filter value and the Polarity */ + tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler | (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U))); + + /* Write to TIMx SMCR */ + TIMx->SMCR = tmpsmcr; +} + +/** + * @brief Enables or disables the TIM Capture Compare Channel x. + * @param TIMx to select the TIM peripheral + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @param ChannelState specifies the TIM Channel CCxE bit new state. + * This parameter can be: TIM_CCx_ENABLE or TIM_CCx_DISABLE. + * @retval None + */ +void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState) +{ + uint32_t tmp; + + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_TIM_CHANNELS(Channel)); + + tmp = TIM_CCER_CC1E << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */ + + /* Reset the CCxE Bit */ + TIMx->CCER &= ~tmp; + + /* Set or reset the CCxE Bit */ + TIMx->CCER |= (uint32_t)(ChannelState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */ +} + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) +/** + * @brief Reset interrupt callbacks to the legacy weak callbacks. + * @param htim pointer to a TIM_HandleTypeDef structure that contains + * the configuration information for TIM module. + * @retval None + */ +void TIM_ResetCallback(TIM_HandleTypeDef *htim) +{ + /* Reset the TIM callback to the legacy weak callbacks */ + htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; + htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; + htim->TriggerCallback = HAL_TIM_TriggerCallback; + htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; + htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; + htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; + htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; + htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; + htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; + htim->ErrorCallback = HAL_TIM_ErrorCallback; + htim->CommutationCallback = HAL_TIMEx_CommutCallback; + htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; + htim->BreakCallback = HAL_TIMEx_BreakCallback; +} +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + +/** + * @} + */ + +#endif /* HAL_TIM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c new file mode 100644 index 0000000..79e46aa --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c @@ -0,0 +1,2335 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_tim_ex.c + * @author MCD Application Team + * @brief TIM HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the Timer Extended peripheral: + * + Time Hall Sensor Interface Initialization + * + Time Hall Sensor Interface Start + * + Time Complementary signal break and dead time configuration + * + Time Master and Slave synchronization configuration + * + Timer remapping capabilities configuration + @verbatim + ============================================================================== + ##### TIMER Extended features ##### + ============================================================================== + [..] + The Timer Extended features include: + (#) Complementary outputs with programmable dead-time for : + (++) Output Compare + (++) PWM generation (Edge and Center-aligned Mode) + (++) One-pulse mode output + (#) Synchronization circuit to control the timer with external signals and to + interconnect several timers together. + (#) Break input to put the timer output signals in reset state or in a known state. + (#) Supports incremental (quadrature) encoder and hall-sensor circuitry for + positioning purposes + + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Initialize the TIM low level resources by implementing the following functions + depending on the selected feature: + (++) Hall Sensor output : HAL_TIMEx_HallSensor_MspInit() + + (#) Initialize the TIM low level resources : + (##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE(); + (##) TIM pins configuration + (+++) Enable the clock for the TIM GPIOs using the following function: + __HAL_RCC_GPIOx_CLK_ENABLE(); + (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init(); + + (#) The external Clock can be configured, if needed (the default clock is the + internal clock from the APBx), using the following function: + HAL_TIM_ConfigClockSource, the clock configuration should be done before + any start function. + + (#) Configure the TIM in the desired functioning mode using one of the + initialization function of this driver: + (++) HAL_TIMEx_HallSensor_Init() and HAL_TIMEx_ConfigCommutEvent(): to use the + Timer Hall Sensor Interface and the commutation event with the corresponding + Interrupt and DMA request if needed (Note that One Timer is used to interface + with the Hall sensor Interface and another Timer should be used to use + the commutation event). + + (#) Activate the TIM peripheral using one of the start functions: + (++) Complementary Output Compare : HAL_TIMEx_OCN_Start(), HAL_TIMEx_OCN_Start_DMA(), + HAL_TIMEx_OCN_Start_IT() + (++) Complementary PWM generation : HAL_TIMEx_PWMN_Start(), HAL_TIMEx_PWMN_Start_DMA(), + HAL_TIMEx_PWMN_Start_IT() + (++) Complementary One-pulse mode output : HAL_TIMEx_OnePulseN_Start(), HAL_TIMEx_OnePulseN_Start_IT() + (++) Hall Sensor output : HAL_TIMEx_HallSensor_Start(), HAL_TIMEx_HallSensor_Start_DMA(), + HAL_TIMEx_HallSensor_Start_IT(). + + @endverbatim + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" + +/** @addtogroup STM32F1xx_HAL_Driver + * @{ + */ + +/** @defgroup TIMEx TIMEx + * @brief TIM Extended HAL module driver + * @{ + */ + +#ifdef HAL_TIM_MODULE_ENABLED + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +static void TIM_DMADelayPulseNCplt(DMA_HandleTypeDef *hdma); +static void TIM_DMAErrorCCxN(DMA_HandleTypeDef *hdma); +static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState); + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup TIMEx_Exported_Functions TIM Extended Exported Functions + * @{ + */ + +/** @defgroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions + * @brief Timer Hall Sensor functions + * +@verbatim + ============================================================================== + ##### Timer Hall Sensor functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure TIM HAL Sensor. + (+) De-initialize TIM HAL Sensor. + (+) Start the Hall Sensor Interface. + (+) Stop the Hall Sensor Interface. + (+) Start the Hall Sensor Interface and enable interrupts. + (+) Stop the Hall Sensor Interface and disable interrupts. + (+) Start the Hall Sensor Interface and enable DMA transfers. + (+) Stop the Hall Sensor Interface and disable DMA transfers. + +@endverbatim + * @{ + */ +/** + * @brief Initializes the TIM Hall Sensor Interface and initialize the associated handle. + * @note When the timer instance is initialized in Hall Sensor Interface mode, + * timer channels 1 and channel 2 are reserved and cannot be used for + * other purpose. + * @param htim TIM Hall Sensor Interface handle + * @param sConfig TIM Hall Sensor configuration structure + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig) +{ + TIM_OC_InitTypeDef OC_Config; + + /* Check the TIM handle allocation */ + if (htim == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode)); + assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision)); + assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload)); + assert_param(IS_TIM_IC_POLARITY(sConfig->IC1Polarity)); + assert_param(IS_TIM_IC_PRESCALER(sConfig->IC1Prescaler)); + assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter)); + + if (htim->State == HAL_TIM_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + htim->Lock = HAL_UNLOCKED; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + /* Reset interrupt callbacks to legacy week callbacks */ + TIM_ResetCallback(htim); + + if (htim->HallSensor_MspInitCallback == NULL) + { + htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; + } + /* Init the low level hardware : GPIO, CLOCK, NVIC */ + htim->HallSensor_MspInitCallback(htim); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ + HAL_TIMEx_HallSensor_MspInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + } + + /* Set the TIM state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Configure the Time base in the Encoder Mode */ + TIM_Base_SetConfig(htim->Instance, &htim->Init); + + /* Configure the Channel 1 as Input Channel to interface with the three Outputs of the Hall sensor */ + TIM_TI1_SetConfig(htim->Instance, sConfig->IC1Polarity, TIM_ICSELECTION_TRC, sConfig->IC1Filter); + + /* Reset the IC1PSC Bits */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC; + /* Set the IC1PSC value */ + htim->Instance->CCMR1 |= sConfig->IC1Prescaler; + + /* Enable the Hall sensor interface (XOR function of the three inputs) */ + htim->Instance->CR2 |= TIM_CR2_TI1S; + + /* Select the TIM_TS_TI1F_ED signal as Input trigger for the TIM */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= TIM_TS_TI1F_ED; + + /* Use the TIM_TS_TI1F_ED signal to reset the TIM counter each edge detection */ + htim->Instance->SMCR &= ~TIM_SMCR_SMS; + htim->Instance->SMCR |= TIM_SLAVEMODE_RESET; + + /* Program channel 2 in PWM 2 mode with the desired Commutation_Delay*/ + OC_Config.OCFastMode = TIM_OCFAST_DISABLE; + OC_Config.OCIdleState = TIM_OCIDLESTATE_RESET; + OC_Config.OCMode = TIM_OCMODE_PWM2; + OC_Config.OCNIdleState = TIM_OCNIDLESTATE_RESET; + OC_Config.OCNPolarity = TIM_OCNPOLARITY_HIGH; + OC_Config.OCPolarity = TIM_OCPOLARITY_HIGH; + OC_Config.Pulse = sConfig->Commutation_Delay; + + TIM_OC2_SetConfig(htim->Instance, &OC_Config); + + /* Select OC2REF as trigger output on TRGO: write the MMS bits in the TIMx_CR2 + register to 101 */ + htim->Instance->CR2 &= ~TIM_CR2_MMS; + htim->Instance->CR2 |= TIM_TRGO_OC2REF; + + /* Initialize the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_READY; + + /* Initialize the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Initialize the TIM state*/ + htim->State = HAL_TIM_STATE_READY; + + return HAL_OK; +} + +/** + * @brief DeInitializes the TIM Hall Sensor interface + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(htim->Instance)); + + htim->State = HAL_TIM_STATE_BUSY; + + /* Disable the TIM Peripheral Clock */ + __HAL_TIM_DISABLE(htim); + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + if (htim->HallSensor_MspDeInitCallback == NULL) + { + htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; + } + /* DeInit the low level hardware */ + htim->HallSensor_MspDeInitCallback(htim); +#else + /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ + HAL_TIMEx_HallSensor_MspDeInit(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + /* Change the DMA burst operation state */ + htim->DMABurstState = HAL_DMA_BURST_STATE_RESET; + + /* Change the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_RESET); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_RESET); + + /* Change TIM state */ + htim->State = HAL_TIM_STATE_RESET; + + /* Release Lock */ + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Initializes the TIM Hall Sensor MSP. + * @param htim TIM Hall Sensor Interface handle + * @retval None + */ +__weak void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_HallSensor_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes TIM Hall Sensor MSP. + * @param htim TIM Hall Sensor Interface handle + * @retval None + */ +__weak void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_HallSensor_MspDeInit could be implemented in the user file + */ +} + +/** + * @brief Starts the TIM Hall Sensor Interface. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall sensor Interface. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channels 1, 2 and 3 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Hall Sensor Interface in interrupt mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the capture compare Interrupts 1 event */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall Sensor Interface in interrupt mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + /* Disable the capture compare Interrupts event */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Hall Sensor Interface in DMA mode. + * @param htim TIM Hall Sensor Interface handle + * @param pData The destination Buffer address. + * @param Length The length of data to be transferred from TIM peripheral to memory. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Set the TIM channel state */ + if ((channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY) + || (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY)) + { + return HAL_BUSY; + } + else if ((channel_1_state == HAL_TIM_CHANNEL_STATE_READY) + && (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_READY)) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + /* Enable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); + + /* Set the DMA Input Capture 1 Callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt; + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ; + + /* Enable the DMA channel for Capture 1*/ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the capture compare 1 Interrupt */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Hall Sensor Interface in DMA mode. + * @param htim TIM Hall Sensor Interface handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim) +{ + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance)); + + /* Disable the Input Capture channel 1 + (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, + TIM_CHANNEL_2 and TIM_CHANNEL_3) */ + TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE); + + + /* Disable the capture compare Interrupts 1 event */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channel state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions + * @brief Timer Complementary Output Compare functions + * +@verbatim + ============================================================================== + ##### Timer Complementary Output Compare functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary Output Compare/PWM. + (+) Stop the Complementary Output Compare/PWM. + (+) Start the Complementary Output Compare/PWM and enable interrupts. + (+) Stop the Complementary Output Compare/PWM and disable interrupts. + (+) Start the Complementary Output Compare/PWM and enable DMA transfers. + (+) Stop the Complementary Output Compare/PWM and disable DMA transfers. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the TIM Output Compare signal generation on the complementary + * output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation on the complementary + * output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in interrupt mode + * on the complementary output. + * @param htim TIM OC handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Output Compare interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + + default: + break; + } + + /* Enable the TIM Break interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK); + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in interrupt mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpccer; + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Output Compare interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the TIM Break interrupt (only if no more channel is active) */ + tmpccer = htim->Instance->CCER; + if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET) + { + __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK); + } + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM Output Compare signal generation in DMA mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Set the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY) + { + return HAL_BUSY; + } + else if (TIM_CHANNEL_N_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Output Compare DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + default: + break; + } + + /* Enable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM Output Compare signal generation in DMA mode + * on the complementary output. + * @param htim TIM Output Compare handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Output Compare DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + default: + break; + } + + /* Disable the Capture compare channel N */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions + * @brief Timer Complementary PWM functions + * +@verbatim + ============================================================================== + ##### Timer Complementary PWM functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary PWM. + (+) Stop the Complementary PWM. + (+) Start the Complementary PWM and enable interrupts. + (+) Stop the Complementary PWM and disable interrupts. + (+) Start the Complementary PWM and enable DMA transfers. + (+) Stop the Complementary PWM and disable DMA transfers. + (+) Start the Complementary Input Capture measurement. + (+) Stop the Complementary Input Capture. + (+) Start the Complementary Input Capture and enable interrupts. + (+) Stop the Complementary Input Capture and disable interrupts. + (+) Start the Complementary Input Capture and enable DMA transfers. + (+) Stop the Complementary Input Capture and disable DMA transfers. + (+) Start the Complementary One Pulse generation. + (+) Stop the Complementary One Pulse. + (+) Start the Complementary One Pulse and enable interrupts. + (+) Stop the Complementary One Pulse and disable interrupts. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the PWM signal generation on the complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation on the complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the PWM signal generation in interrupt mode on the + * complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Check the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY) + { + return HAL_ERROR; + } + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Enable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Enable the TIM Break interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK); + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the PWM signal generation in interrupt mode on the + * complementary output. + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + uint32_t tmpccer; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3); + break; + } + + default: + break; + } + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the TIM Break interrupt (only if no more channel is active) */ + tmpccer = htim->Instance->CCER; + if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET) + { + __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK); + } + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM PWM signal generation in DMA mode on the + * complementary output + * @param htim TIM handle + * @param Channel TIM Channel to be enabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @param pData The source Buffer address. + * @param Length The length of data to be transferred from memory to TIM peripheral + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length) +{ + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + /* Set the TIM complementary channel state */ + if (TIM_CHANNEL_N_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY) + { + return HAL_BUSY; + } + else if (TIM_CHANNEL_N_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY) + { + if ((pData == NULL) && (Length > 0U)) + { + return HAL_ERROR; + } + else + { + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_BUSY); + } + } + else + { + return HAL_ERROR; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1); + break; + } + + case TIM_CHANNEL_2: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2); + break; + } + + case TIM_CHANNEL_3: + { + /* Set the DMA compare callbacks */ + htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseNCplt; + htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt; + + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAErrorCCxN ; + + /* Enable the DMA channel */ + if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, + Length) != HAL_OK) + { + /* Return error status */ + return HAL_ERROR; + } + /* Enable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3); + break; + } + + default: + break; + } + + /* Enable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */ + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS; + if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) + { + __HAL_TIM_ENABLE(htim); + } + } + else + { + __HAL_TIM_ENABLE(htim); + } + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM PWM signal generation in DMA mode on the complementary + * output + * @param htim TIM handle + * @param Channel TIM Channel to be disabled + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @arg TIM_CHANNEL_3: TIM Channel 3 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel) +{ + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel)); + + switch (Channel) + { + case TIM_CHANNEL_1: + { + /* Disable the TIM Capture/Compare 1 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]); + break; + } + + case TIM_CHANNEL_2: + { + /* Disable the TIM Capture/Compare 2 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]); + break; + } + + case TIM_CHANNEL_3: + { + /* Disable the TIM Capture/Compare 3 DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3); + (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]); + break; + } + + default: + break; + } + + /* Disable the complementary PWM output */ + TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM complementary channel state */ + TIM_CHANNEL_N_STATE_SET(htim, Channel, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions + * @brief Timer Complementary One Pulse functions + * +@verbatim + ============================================================================== + ##### Timer Complementary One Pulse functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the Complementary One Pulse generation. + (+) Stop the Complementary One Pulse. + (+) Start the Complementary One Pulse and enable interrupts. + (+) Stop the Complementary One Pulse and disable interrupts. + +@endverbatim + * @{ + */ + +/** + * @brief Starts the TIM One Pulse signal generation on the complementary + * output. + * @note OutputChannel must match the pulse output channel chosen when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel pulse output channel to enable + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + uint32_t input_channel = (OutputChannel == TIM_CHANNEL_1) ? TIM_CHANNEL_2 : TIM_CHANNEL_1; + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the complementary One Pulse output channel and the Input Capture channel */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE); + TIM_CCxChannelCmd(htim->Instance, input_channel, TIM_CCx_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation on the complementary + * output. + * @note OutputChannel must match the pulse output channel chosen when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel pulse output channel to disable + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + uint32_t input_channel = (OutputChannel == TIM_CHANNEL_1) ? TIM_CHANNEL_2 : TIM_CHANNEL_1; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Disable the complementary One Pulse output channel and the Input Capture channel */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE); + TIM_CCxChannelCmd(htim->Instance, input_channel, TIM_CCx_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Starts the TIM One Pulse signal generation in interrupt mode on the + * complementary channel. + * @note OutputChannel must match the pulse output channel chosen when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel pulse output channel to enable + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + uint32_t input_channel = (OutputChannel == TIM_CHANNEL_1) ? TIM_CHANNEL_2 : TIM_CHANNEL_1; + HAL_TIM_ChannelStateTypeDef channel_1_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef channel_2_state = TIM_CHANNEL_STATE_GET(htim, TIM_CHANNEL_2); + HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1); + HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2); + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Check the TIM channels state */ + if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY) + || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY)) + { + return HAL_ERROR; + } + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_BUSY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_BUSY); + + /* Enable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1); + + /* Enable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2); + + /* Enable the complementary One Pulse output channel and the Input Capture channel */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE); + TIM_CCxChannelCmd(htim->Instance, input_channel, TIM_CCx_ENABLE); + + /* Enable the Main Output */ + __HAL_TIM_MOE_ENABLE(htim); + + /* Return function status */ + return HAL_OK; +} + +/** + * @brief Stops the TIM One Pulse signal generation in interrupt mode on the + * complementary channel. + * @note OutputChannel must match the pulse output channel chosen when calling + * @ref HAL_TIM_OnePulse_ConfigChannel(). + * @param htim TIM One Pulse handle + * @param OutputChannel pulse output channel to disable + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 selected + * @arg TIM_CHANNEL_2: TIM Channel 2 selected + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel) +{ + uint32_t input_channel = (OutputChannel == TIM_CHANNEL_1) ? TIM_CHANNEL_2 : TIM_CHANNEL_1; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel)); + + /* Disable the TIM Capture/Compare 1 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1); + + /* Disable the TIM Capture/Compare 2 interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2); + + /* Disable the complementary One Pulse output channel and the Input Capture channel */ + TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE); + TIM_CCxChannelCmd(htim->Instance, input_channel, TIM_CCx_DISABLE); + + /* Disable the Main Output */ + __HAL_TIM_MOE_DISABLE(htim); + + /* Disable the Peripheral */ + __HAL_TIM_DISABLE(htim); + + /* Set the TIM channels state */ + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + + /* Return function status */ + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions + * @brief Peripheral Control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Configure the commutation event in case of use of the Hall sensor interface. + (+) Configure Output channels for OC and PWM mode. + + (+) Configure Complementary channels, break features and dead time. + (+) Configure Master synchronization. + (+) Configure timer remapping capabilities. + +@endverbatim + * @{ + */ + +/** + * @brief Configure the TIM commutation event sequence. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Disable Commutation Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM); + + /* Disable Commutation DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configure the TIM commutation event sequence with interrupt. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Disable Commutation DMA request */ + __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM); + + /* Enable the Commutation Interrupt */ + __HAL_TIM_ENABLE_IT(htim, TIM_IT_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configure the TIM commutation event sequence with DMA. + * @note This function is mandatory to use the commutation event in order to + * update the configuration at each commutation detection on the TRGI input of the Timer, + * the typical use of this feature is with the use of another Timer(interface Timer) + * configured in Hall sensor interface, this interface Timer will generate the + * commutation at its TRGO output (connected to Timer used in this function) each time + * the TI1 of the Interface Timer detect a commutation at its input TI1. + * @note The user should configure the DMA in his own software, in This function only the COMDE bit is set + * @param htim TIM handle + * @param InputTrigger the Internal trigger corresponding to the Timer Interfacing with the Hall sensor + * This parameter can be one of the following values: + * @arg TIM_TS_ITR0: Internal trigger 0 selected + * @arg TIM_TS_ITR1: Internal trigger 1 selected + * @arg TIM_TS_ITR2: Internal trigger 2 selected + * @arg TIM_TS_ITR3: Internal trigger 3 selected + * @arg TIM_TS_NONE: No trigger is needed + * @param CommutationSource the Commutation Event source + * This parameter can be one of the following values: + * @arg TIM_COMMUTATION_TRGI: Commutation source is the TRGI of the Interface Timer + * @arg TIM_COMMUTATION_SOFTWARE: Commutation source is set by software using the COMG bit + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, + uint32_t CommutationSource) +{ + /* Check the parameters */ + assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance)); + assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger)); + + __HAL_LOCK(htim); + + if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) || + (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3)) + { + /* Select the Input trigger */ + htim->Instance->SMCR &= ~TIM_SMCR_TS; + htim->Instance->SMCR |= InputTrigger; + } + + /* Select the Capture Compare preload feature */ + htim->Instance->CR2 |= TIM_CR2_CCPC; + /* Select the Commutation event source */ + htim->Instance->CR2 &= ~TIM_CR2_CCUS; + htim->Instance->CR2 |= CommutationSource; + + /* Enable the Commutation DMA Request */ + /* Set the DMA Commutation Callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt; + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt; + /* Set the DMA error callback */ + htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError; + + /* Disable Commutation Interrupt */ + __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM); + + /* Enable the Commutation DMA Request */ + __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_COM); + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIM in master mode. + * @param htim TIM handle. + * @param sMasterConfig pointer to a TIM_MasterConfigTypeDef structure that + * contains the selected trigger output (TRGO) and the Master/Slave + * mode. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, + TIM_MasterConfigTypeDef *sMasterConfig) +{ + uint32_t tmpcr2; + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_MASTER_INSTANCE(htim->Instance)); + assert_param(IS_TIM_TRGO_SOURCE(sMasterConfig->MasterOutputTrigger)); + assert_param(IS_TIM_MSM_STATE(sMasterConfig->MasterSlaveMode)); + + /* Check input state */ + __HAL_LOCK(htim); + + /* Change the handler state */ + htim->State = HAL_TIM_STATE_BUSY; + + /* Get the TIMx CR2 register value */ + tmpcr2 = htim->Instance->CR2; + + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Reset the MMS Bits */ + tmpcr2 &= ~TIM_CR2_MMS; + /* Select the TRGO source */ + tmpcr2 |= sMasterConfig->MasterOutputTrigger; + + /* Update TIMx CR2 */ + htim->Instance->CR2 = tmpcr2; + + if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) + { + /* Reset the MSM Bit */ + tmpsmcr &= ~TIM_SMCR_MSM; + /* Set master mode */ + tmpsmcr |= sMasterConfig->MasterSlaveMode; + + /* Update TIMx SMCR */ + htim->Instance->SMCR = tmpsmcr; + } + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the Break feature, dead time, Lock level, OSSI/OSSR State + * and the AOE(automatic output enable). + * @param htim TIM handle + * @param sBreakDeadTimeConfig pointer to a TIM_ConfigBreakDeadConfigTypeDef structure that + * contains the BDTR Register configuration information for the TIM peripheral. + * @note Interrupts can be generated when an active level is detected on the + * break input, the break 2 input or the system break input. Break + * interrupt can be enabled by calling the @ref __HAL_TIM_ENABLE_IT macro. + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, + TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig) +{ + /* Keep this variable initialized to 0 as it is used to configure BDTR register */ + uint32_t tmpbdtr = 0U; + + /* Check the parameters */ + assert_param(IS_TIM_BREAK_INSTANCE(htim->Instance)); + assert_param(IS_TIM_OSSR_STATE(sBreakDeadTimeConfig->OffStateRunMode)); + assert_param(IS_TIM_OSSI_STATE(sBreakDeadTimeConfig->OffStateIDLEMode)); + assert_param(IS_TIM_LOCK_LEVEL(sBreakDeadTimeConfig->LockLevel)); + assert_param(IS_TIM_DEADTIME(sBreakDeadTimeConfig->DeadTime)); + assert_param(IS_TIM_BREAK_STATE(sBreakDeadTimeConfig->BreakState)); + assert_param(IS_TIM_BREAK_POLARITY(sBreakDeadTimeConfig->BreakPolarity)); + assert_param(IS_TIM_AUTOMATIC_OUTPUT_STATE(sBreakDeadTimeConfig->AutomaticOutput)); + + /* Check input state */ + __HAL_LOCK(htim); + + /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State, + the OSSI State, the dead time value and the Automatic Output Enable Bit */ + + /* Set the BDTR bits */ + MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, sBreakDeadTimeConfig->DeadTime); + MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, sBreakDeadTimeConfig->LockLevel); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, sBreakDeadTimeConfig->OffStateIDLEMode); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, sBreakDeadTimeConfig->OffStateRunMode); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, sBreakDeadTimeConfig->BreakState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, sBreakDeadTimeConfig->BreakPolarity); + MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, sBreakDeadTimeConfig->AutomaticOutput); + + + /* Set TIMx_BDTR */ + htim->Instance->BDTR = tmpbdtr; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} + +/** + * @brief Configures the TIMx Remapping input capabilities. + * @param htim TIM handle. + * @param Remap specifies the TIM remapping source. + * + * @retval HAL status + */ +HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + UNUSED(Remap); + + return HAL_OK; +} + +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions + * @brief Extended Callbacks functions + * +@verbatim + ============================================================================== + ##### Extended Callbacks functions ##### + ============================================================================== + [..] + This section provides Extended TIM callback functions: + (+) Timer Commutation callback + (+) Timer Break callback + +@endverbatim + * @{ + */ + +/** + * @brief Hall commutation changed callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_CommutCallback could be implemented in the user file + */ +} +/** + * @brief Hall commutation changed half complete callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_CommutHalfCpltCallback could be implemented in the user file + */ +} + +/** + * @brief Hall Break detection callback in non-blocking mode + * @param htim TIM handle + * @retval None + */ +__weak void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(htim); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_TIMEx_BreakCallback could be implemented in the user file + */ +} +/** + * @} + */ + +/** @defgroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions + * @brief Extended Peripheral State functions + * +@verbatim + ============================================================================== + ##### Extended Peripheral State functions ##### + ============================================================================== + [..] + This subsection permits to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Return the TIM Hall Sensor interface handle state. + * @param htim TIM Hall Sensor handle + * @retval HAL state + */ +HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim) +{ + return htim->State; +} + +/** + * @brief Return actual state of the TIM complementary channel. + * @param htim TIM handle + * @param ChannelN TIM Complementary channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @retval TIM Complementary channel state + */ +HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN) +{ + HAL_TIM_ChannelStateTypeDef channel_state; + + /* Check the parameters */ + assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, ChannelN)); + + channel_state = TIM_CHANNEL_N_STATE_GET(htim, ChannelN); + + return channel_state; +} +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup TIMEx_Private_Functions TIMEx Private Functions + * @{ + */ + +/** + * @brief TIM DMA Commutation callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationCallback(htim); +#else + HAL_TIMEx_CommutCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + +/** + * @brief TIM DMA Commutation half complete callback. + * @param hdma pointer to DMA handle. + * @retval None + */ +void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + /* Change the htim state */ + htim->State = HAL_TIM_STATE_READY; + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->CommutationHalfCpltCallback(htim); +#else + HAL_TIMEx_CommutHalfCpltCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ +} + + +/** + * @brief TIM DMA Delay Pulse complete callback (complementary channel). + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMADelayPulseNCplt(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + } + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4; + + if (hdma->Init.Mode == DMA_NORMAL) + { + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_4, HAL_TIM_CHANNEL_STATE_READY); + } + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->PWM_PulseFinishedCallback(htim); +#else + HAL_TIM_PWM_PulseFinishedCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief TIM DMA error callback (complementary channel) + * @param hdma pointer to DMA handle. + * @retval None + */ +static void TIM_DMAErrorCCxN(DMA_HandleTypeDef *hdma) +{ + TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; + + if (hdma == htim->hdma[TIM_DMA_ID_CC1]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1; + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_1, HAL_TIM_CHANNEL_STATE_READY); + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2; + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_2, HAL_TIM_CHANNEL_STATE_READY); + } + else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) + { + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3; + TIM_CHANNEL_N_STATE_SET(htim, TIM_CHANNEL_3, HAL_TIM_CHANNEL_STATE_READY); + } + else + { + /* nothing to do */ + } + +#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1) + htim->ErrorCallback(htim); +#else + HAL_TIM_ErrorCallback(htim); +#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */ + + htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED; +} + +/** + * @brief Enables or disables the TIM Capture Compare Channel xN. + * @param TIMx to select the TIM peripheral + * @param Channel specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @param ChannelNState specifies the TIM Channel CCxNE bit new state. + * This parameter can be: TIM_CCxN_ENABLE or TIM_CCxN_Disable. + * @retval None + */ +static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState) +{ + uint32_t tmp; + + tmp = TIM_CCER_CC1NE << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */ + + /* Reset the CCxNE Bit */ + TIMx->CCER &= ~tmp; + + /* Set or reset the CCxNE Bit */ + TIMx->CCER |= (uint32_t)(ChannelNState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */ +} +/** + * @} + */ + +#endif /* HAL_TIM_MODULE_ENABLED */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c new file mode 100644 index 0000000..5461480 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c @@ -0,0 +1,314 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_dma.c + * @author MCD Application Team + * @brief DMA LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_dma.h" +#include "stm32f1xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (DMA1) || defined (DMA2) + +/** @defgroup DMA_LL DMA + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup DMA_LL_Private_Macros + * @{ + */ +#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \ + ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \ + ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY)) + +#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \ + ((__VALUE__) == LL_DMA_MODE_CIRCULAR)) + +#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \ + ((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT)) + +#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \ + ((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT)) + +#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \ + ((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \ + ((__VALUE__) == LL_DMA_PDATAALIGN_WORD)) + +#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \ + ((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \ + ((__VALUE__) == LL_DMA_MDATAALIGN_WORD)) + +#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU) + +#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \ + ((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \ + ((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \ + ((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH)) + +#if defined (DMA2) +#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \ + (((CHANNEL) == LL_DMA_CHANNEL_1) || \ + ((CHANNEL) == LL_DMA_CHANNEL_2) || \ + ((CHANNEL) == LL_DMA_CHANNEL_3) || \ + ((CHANNEL) == LL_DMA_CHANNEL_4) || \ + ((CHANNEL) == LL_DMA_CHANNEL_5) || \ + ((CHANNEL) == LL_DMA_CHANNEL_6) || \ + ((CHANNEL) == LL_DMA_CHANNEL_7))) || \ + (((INSTANCE) == DMA2) && \ + (((CHANNEL) == LL_DMA_CHANNEL_1) || \ + ((CHANNEL) == LL_DMA_CHANNEL_2) || \ + ((CHANNEL) == LL_DMA_CHANNEL_3) || \ + ((CHANNEL) == LL_DMA_CHANNEL_4) || \ + ((CHANNEL) == LL_DMA_CHANNEL_5)))) +#else +#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \ + (((CHANNEL) == LL_DMA_CHANNEL_1) || \ + ((CHANNEL) == LL_DMA_CHANNEL_2) || \ + ((CHANNEL) == LL_DMA_CHANNEL_3) || \ + ((CHANNEL) == LL_DMA_CHANNEL_4) || \ + ((CHANNEL) == LL_DMA_CHANNEL_5) || \ + ((CHANNEL) == LL_DMA_CHANNEL_6) || \ + ((CHANNEL) == LL_DMA_CHANNEL_7)))) +#endif +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup DMA_LL_Exported_Functions + * @{ + */ + +/** @addtogroup DMA_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the DMA registers to their default reset values. + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval An ErrorStatus enumeration value: + * - SUCCESS: DMA registers are de-initialized + * - ERROR: DMA registers are not de-initialized + */ +uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel) +{ + DMA_Channel_TypeDef *tmp = (DMA_Channel_TypeDef *)DMA1_Channel1; + ErrorStatus status = SUCCESS; + + /* Check the DMA Instance DMAx and Channel parameters*/ + assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel)); + + tmp = (DMA_Channel_TypeDef *)(__LL_DMA_GET_CHANNEL_INSTANCE(DMAx, Channel)); + + /* Disable the selected DMAx_Channely */ + CLEAR_BIT(tmp->CCR, DMA_CCR_EN); + + /* Reset DMAx_Channely control register */ + LL_DMA_WriteReg(tmp, CCR, 0U); + + /* Reset DMAx_Channely remaining bytes register */ + LL_DMA_WriteReg(tmp, CNDTR, 0U); + + /* Reset DMAx_Channely peripheral address register */ + LL_DMA_WriteReg(tmp, CPAR, 0U); + + /* Reset DMAx_Channely memory address register */ + LL_DMA_WriteReg(tmp, CMAR, 0U); + + if (Channel == LL_DMA_CHANNEL_1) + { + /* Reset interrupt pending bits for DMAx Channel1 */ + LL_DMA_ClearFlag_GI1(DMAx); + } + else if (Channel == LL_DMA_CHANNEL_2) + { + /* Reset interrupt pending bits for DMAx Channel2 */ + LL_DMA_ClearFlag_GI2(DMAx); + } + else if (Channel == LL_DMA_CHANNEL_3) + { + /* Reset interrupt pending bits for DMAx Channel3 */ + LL_DMA_ClearFlag_GI3(DMAx); + } + else if (Channel == LL_DMA_CHANNEL_4) + { + /* Reset interrupt pending bits for DMAx Channel4 */ + LL_DMA_ClearFlag_GI4(DMAx); + } + else if (Channel == LL_DMA_CHANNEL_5) + { + /* Reset interrupt pending bits for DMAx Channel5 */ + LL_DMA_ClearFlag_GI5(DMAx); + } + + else if (Channel == LL_DMA_CHANNEL_6) + { + /* Reset interrupt pending bits for DMAx Channel6 */ + LL_DMA_ClearFlag_GI6(DMAx); + } + else if (Channel == LL_DMA_CHANNEL_7) + { + /* Reset interrupt pending bits for DMAx Channel7 */ + LL_DMA_ClearFlag_GI7(DMAx); + } + else + { + status = ERROR; + } + + return status; +} + +/** + * @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct. + * @note To convert DMAx_Channely Instance to DMAx Instance and Channely, use helper macros : + * @arg @ref __LL_DMA_GET_INSTANCE + * @arg @ref __LL_DMA_GET_CHANNEL + * @param DMAx DMAx Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: DMA registers are initialized + * - ERROR: Not applicable + */ +uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct) +{ + /* Check the DMA Instance DMAx and Channel parameters*/ + assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel)); + + /* Check the DMA parameters from DMA_InitStruct */ + assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction)); + assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode)); + assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode)); + assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode)); + assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize)); + assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize)); + assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData)); + assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority)); + + /*---------------------------- DMAx CCR Configuration ------------------------ + * Configure DMAx_Channely: data transfer direction, data transfer mode, + * peripheral and memory increment mode, + * data size alignment and priority level with parameters : + * - Direction: DMA_CCR_DIR and DMA_CCR_MEM2MEM bits + * - Mode: DMA_CCR_CIRC bit + * - PeriphOrM2MSrcIncMode: DMA_CCR_PINC bit + * - MemoryOrM2MDstIncMode: DMA_CCR_MINC bit + * - PeriphOrM2MSrcDataSize: DMA_CCR_PSIZE[1:0] bits + * - MemoryOrM2MDstDataSize: DMA_CCR_MSIZE[1:0] bits + * - Priority: DMA_CCR_PL[1:0] bits + */ + LL_DMA_ConfigTransfer(DMAx, Channel, DMA_InitStruct->Direction | \ + DMA_InitStruct->Mode | \ + DMA_InitStruct->PeriphOrM2MSrcIncMode | \ + DMA_InitStruct->MemoryOrM2MDstIncMode | \ + DMA_InitStruct->PeriphOrM2MSrcDataSize | \ + DMA_InitStruct->MemoryOrM2MDstDataSize | \ + DMA_InitStruct->Priority); + + /*-------------------------- DMAx CMAR Configuration ------------------------- + * Configure the memory or destination base address with parameter : + * - MemoryOrM2MDstAddress: DMA_CMAR_MA[31:0] bits + */ + LL_DMA_SetMemoryAddress(DMAx, Channel, DMA_InitStruct->MemoryOrM2MDstAddress); + + /*-------------------------- DMAx CPAR Configuration ------------------------- + * Configure the peripheral or source base address with parameter : + * - PeriphOrM2MSrcAddress: DMA_CPAR_PA[31:0] bits + */ + LL_DMA_SetPeriphAddress(DMAx, Channel, DMA_InitStruct->PeriphOrM2MSrcAddress); + + /*--------------------------- DMAx CNDTR Configuration ----------------------- + * Configure the peripheral base address with parameter : + * - NbData: DMA_CNDTR_NDT[15:0] bits + */ + LL_DMA_SetDataLength(DMAx, Channel, DMA_InitStruct->NbData); + + return SUCCESS; +} + +/** + * @brief Set each @ref LL_DMA_InitTypeDef field to default value. + * @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure. + * @retval None + */ +void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct) +{ + /* Set DMA_InitStruct fields to default values */ + DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U; + DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U; + DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY; + DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL; + DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT; + DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT; + DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE; + DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE; + DMA_InitStruct->NbData = 0x00000000U; + DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* DMA1 || DMA2 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c new file mode 100644 index 0000000..38a4190 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c @@ -0,0 +1,215 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_exti.c + * @author MCD Application Team + * @brief EXTI LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_exti.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (EXTI) + +/** @defgroup EXTI_LL EXTI + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup EXTI_LL_Private_Macros + * @{ + */ + +#define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U) + +#define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \ + || ((__VALUE__) == LL_EXTI_MODE_EVENT) \ + || ((__VALUE__) == LL_EXTI_MODE_IT_EVENT)) + + +#define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \ + || ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup EXTI_LL_Exported_Functions + * @{ + */ + +/** @addtogroup EXTI_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize the EXTI registers to their default reset values. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: EXTI registers are de-initialized + * - ERROR: not applicable + */ +uint32_t LL_EXTI_DeInit(void) +{ + /* Interrupt mask register set to default reset values */ + LL_EXTI_WriteReg(IMR, 0x00000000U); + /* Event mask register set to default reset values */ + LL_EXTI_WriteReg(EMR, 0x00000000U); + /* Rising Trigger selection register set to default reset values */ + LL_EXTI_WriteReg(RTSR, 0x00000000U); + /* Falling Trigger selection register set to default reset values */ + LL_EXTI_WriteReg(FTSR, 0x00000000U); + /* Software interrupt event register set to default reset values */ + LL_EXTI_WriteReg(SWIER, 0x00000000U); + /* Pending register clear */ + LL_EXTI_WriteReg(PR, 0x000FFFFFU); + + return SUCCESS; +} + +/** + * @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct. + * @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: EXTI registers are initialized + * - ERROR: not applicable + */ +uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct) +{ + ErrorStatus status = SUCCESS; + /* Check the parameters */ + assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31)); + assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand)); + assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode)); + + /* ENABLE LineCommand */ + if (EXTI_InitStruct->LineCommand != DISABLE) + { + assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger)); + + /* Configure EXTI Lines in range from 0 to 31 */ + if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE) + { + switch (EXTI_InitStruct->Mode) + { + case LL_EXTI_MODE_IT: + /* First Disable Event on provided Lines */ + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable IT on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_MODE_EVENT: + /* First Disable IT on provided Lines */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Event on provided Lines */ + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_MODE_IT_EVENT: + /* Directly Enable IT & Event on provided Lines */ + LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); + break; + default: + status = ERROR; + break; + } + if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE) + { + switch (EXTI_InitStruct->Trigger) + { + case LL_EXTI_TRIGGER_RISING: + /* First Disable Falling Trigger on provided Lines */ + LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Rising Trigger on provided Lines */ + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_TRIGGER_FALLING: + /* First Disable Rising Trigger on provided Lines */ + LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + /* Then Enable Falling Trigger on provided Lines */ + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + case LL_EXTI_TRIGGER_RISING_FALLING: + LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); + break; + default: + status = ERROR; + break; + } + } + } + } + /* DISABLE LineCommand */ + else + { + /* De-configure EXTI Lines in range from 0 to 31 */ + LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); + LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); + } + return status; +} + +/** + * @brief Set each @ref LL_EXTI_InitTypeDef field to default value. + * @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure. + * @retval None + */ +void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct) +{ + EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE; + EXTI_InitStruct->LineCommand = DISABLE; + EXTI_InitStruct->Mode = LL_EXTI_MODE_IT; + EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (EXTI) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c new file mode 100644 index 0000000..22f2158 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c @@ -0,0 +1,258 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_gpio.c + * @author MCD Application Team + * @brief GPIO LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_gpio.h" +#include "stm32f1xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) + +/** @addtogroup GPIO_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup GPIO_LL_Private_Macros + * @{ + */ + +#define IS_LL_GPIO_PIN(__VALUE__) ((((__VALUE__) & LL_GPIO_PIN_ALL)!= 0u) &&\ + (((__VALUE__) & (~LL_GPIO_PIN_ALL))== 0u)) + +#define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_ANALOG) ||\ + ((__VALUE__) == LL_GPIO_MODE_FLOATING) ||\ + ((__VALUE__) == LL_GPIO_MODE_INPUT) ||\ + ((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\ + ((__VALUE__) == LL_GPIO_MODE_ALTERNATE)) + +#define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\ + ((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\ + ((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH)) + +#define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\ + ((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN)) + +#define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_DOWN) ||\ + ((__VALUE__) == LL_GPIO_PULL_UP)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup GPIO_LL_Exported_Functions + * @{ + */ + +/** @addtogroup GPIO_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize GPIO registers (Registers restored to their default values). + * @param GPIOx GPIO Port + * @retval An ErrorStatus enumeration value: + * - SUCCESS: GPIO registers are de-initialized + * - ERROR: Wrong GPIO Port + */ +ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx) +{ + ErrorStatus status = SUCCESS; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + + /* Force and Release reset on clock of GPIOx Port */ + if (GPIOx == GPIOA) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOA); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOA); + } + else if (GPIOx == GPIOB) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOB); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOB); + } + else if (GPIOx == GPIOC) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOC); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOC); + } + else if (GPIOx == GPIOD) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOD); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOD); + } +#if defined(GPIOE) + else if (GPIOx == GPIOE) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOE); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOE); + } +#endif +#if defined(GPIOF) + else if (GPIOx == GPIOF) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOF); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOF); + } +#endif +#if defined(GPIOG) + else if (GPIOx == GPIOG) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_GPIOG); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_GPIOG); + } +#endif + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct. + * @param GPIOx GPIO Port + * @param GPIO_InitStruct: pointer to a @ref LL_GPIO_InitTypeDef structure + * that contains the configuration information for the specified GPIO peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content + * - ERROR: Not applicable + */ +ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) +{ + uint32_t pinmask; + uint32_t pinpos; + uint32_t currentpin; + + /* Check the parameters */ + assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); + assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); + + /* ------------------------- Configure the port pins ---------------- */ + /* Initialize pinpos on first pin set */ + + pinmask = ((GPIO_InitStruct->Pin) << GPIO_PIN_MASK_POS) >> GPIO_PIN_NB; + pinpos = POSITION_VAL(pinmask); + + /* Configure the port pins */ + while ((pinmask >> pinpos) != 0u) + { + /* skip if bit is not set */ + if ((pinmask & (1u << pinpos)) != 0u) + { + /* Get current io position */ + if (pinpos < GPIO_PIN_MASK_POS) + { + currentpin = (0x00000101uL << pinpos); + } + else + { + currentpin = ((0x00010001u << (pinpos - GPIO_PIN_MASK_POS)) | 0x04000000u); + } + + if (GPIO_InitStruct->Mode == LL_GPIO_MODE_INPUT) + { + /* Check The Pull parameter */ + assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); + + /* Pull-up Pull-down resistor configuration*/ + LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); + } + + /* Check Pin Mode parameters */ + assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); + + /* Pin Mode configuration */ + LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); + + if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) + { + /* Check speed and Output mode parameters */ + assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); + assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); + + /* Speed mode configuration */ + LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); + + /* Output mode configuration*/ + LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType); + } + } + pinpos++; + } + return (SUCCESS); +} + +/** + * @brief Set each @ref LL_GPIO_InitTypeDef field to default value. + * @param GPIO_InitStruct: pointer to a @ref LL_GPIO_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ + +void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct) +{ + /* Reset GPIO init structure parameters values */ + GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL; + GPIO_InitStruct->Mode = LL_GPIO_MODE_FLOATING; + GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + GPIO_InitStruct->Pull = LL_GPIO_PULL_DOWN; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c new file mode 100644 index 0000000..2f63c33 --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_rcc.c + * @author MCD Application Team + * @brief RCC LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_rcc.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined(RCC) + +/** @defgroup RCC_LL RCC + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup RCC_LL_Private_Macros + * @{ + */ +#if defined(RCC_PLLI2S_SUPPORT) +#define IS_LL_RCC_I2S_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_I2S2_CLKSOURCE) \ + || ((__VALUE__) == LL_RCC_I2S3_CLKSOURCE)) +#endif /* RCC_PLLI2S_SUPPORT */ + +#if defined(USB) || defined(USB_OTG_FS) +#define IS_LL_RCC_USB_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_USB_CLKSOURCE)) +#endif /* USB */ + +#define IS_LL_RCC_ADC_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_ADC_CLKSOURCE)) +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup RCC_LL_Private_Functions RCC Private functions + * @{ + */ +uint32_t RCC_GetSystemClockFreq(void); +uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency); +uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency); +uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency); +uint32_t RCC_PLL_GetFreqDomain_SYS(void); +#if defined(RCC_PLLI2S_SUPPORT) +uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void); +#endif /* RCC_PLLI2S_SUPPORT */ +#if defined(RCC_PLL2_SUPPORT) +uint32_t RCC_PLL2_GetFreqClockFreq(void); +#endif /* RCC_PLL2_SUPPORT */ +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup RCC_LL_Exported_Functions + * @{ + */ + +/** @addtogroup RCC_LL_EF_Init + * @{ + */ + +/** + * @brief Reset the RCC clock configuration to the default reset state. + * @note The default reset state of the clock configuration is given below: + * - HSI ON and used as system clock source + * - HSE PLL, PLL2 & PLL3 are OFF + * - AHB, APB1 and APB2 prescaler set to 1. + * - CSS, MCO OFF + * - All interrupts disabled + * @note This function doesn't modify the configuration of the + * - Peripheral clocks + * - LSI, LSE and RTC clocks + * @retval An ErrorStatus enumeration value: + * - SUCCESS: RCC registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_RCC_DeInit(void) +{ + /* Set HSION bit */ + LL_RCC_HSI_Enable(); + + /* Wait for HSI READY bit */ + while (LL_RCC_HSI_IsReady() != 1U) + {} + + /* Configure HSI as system clock source */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI); + + /* Wait till clock switch is ready */ + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI) + {} + + /* Reset PLLON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLLON); + + /* Wait for PLL READY bit to be reset */ + while (LL_RCC_PLL_IsReady() != 0U) + {} + + /* Reset CFGR register */ + LL_RCC_WriteReg(CFGR, 0x00000000U); + + /* Reset HSEON, HSEBYP & CSSON bits */ + CLEAR_BIT(RCC->CR, (RCC_CR_CSSON | RCC_CR_HSEON | RCC_CR_HSEBYP)); + +#if defined(RCC_CR_PLL2ON) + /* Reset PLL2ON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLL2ON); +#endif /* RCC_CR_PLL2ON */ + +#if defined(RCC_CR_PLL3ON) + /* Reset PLL3ON bit */ + CLEAR_BIT(RCC->CR, RCC_CR_PLL3ON); +#endif /* RCC_CR_PLL3ON */ + + /* Set HSITRIM bits to the reset value */ + LL_RCC_HSI_SetCalibTrimming(0x10U); + +#if defined(RCC_CFGR2_PREDIV1) + /* Reset CFGR2 register */ + LL_RCC_WriteReg(CFGR2, 0x00000000U); +#endif /* RCC_CFGR2_PREDIV1 */ + + /* Disable all interrupts */ + LL_RCC_WriteReg(CIR, 0x00000000U); + + /* Clear reset flags */ + LL_RCC_ClearResetFlags(); + + return SUCCESS; +} + +/** + * @} + */ + +/** @addtogroup RCC_LL_EF_Get_Freq + * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks + * and different peripheral clocks available on the device. + * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(**) + * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(***) + * @note If SYSCLK source is PLL, function returns values based on + * HSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors. + * @note (**) HSI_VALUE is a defined constant but the real value may vary + * depending on the variations in voltage and temperature. + * @note (***) HSE_VALUE is a defined constant, user has to ensure that + * HSE_VALUE is same as the real frequency of the crystal used. + * Otherwise, this function may have wrong result. + * @note The result of this function could be incorrect when using fractional + * value for HSE crystal. + * @note This function can be used by the user application to compute the + * baud-rate for the communication peripherals or configure other parameters. + * @{ + */ + +/** + * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks + * @note Each time SYSCLK, HCLK, PCLK1 and/or PCLK2 clock changes, this function + * must be called to update structure fields. Otherwise, any + * configuration based on this function will be incorrect. + * @param RCC_Clocks pointer to a @ref LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies + * @retval None + */ +void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks) +{ + /* Get SYSCLK frequency */ + RCC_Clocks->SYSCLK_Frequency = RCC_GetSystemClockFreq(); + + /* HCLK clock frequency */ + RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency); + + /* PCLK1 clock frequency */ + RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency); + + /* PCLK2 clock frequency */ + RCC_Clocks->PCLK2_Frequency = RCC_GetPCLK2ClockFreq(RCC_Clocks->HCLK_Frequency); +} + +#if defined(RCC_CFGR2_I2S2SRC) +/** + * @brief Return I2Sx clock frequency + * @param I2SxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_I2S2_CLKSOURCE + * @arg @ref LL_RCC_I2S3_CLKSOURCE + * @retval I2S clock frequency (in Hz) + */ +uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource) +{ + uint32_t i2s_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_I2S_CLKSOURCE(I2SxSource)); + + /* I2S1CLK clock frequency */ + switch (LL_RCC_GetI2SClockSource(I2SxSource)) + { + case LL_RCC_I2S2_CLKSOURCE_SYSCLK: /*!< System clock selected as I2S clock source */ + case LL_RCC_I2S3_CLKSOURCE_SYSCLK: + i2s_frequency = RCC_GetSystemClockFreq(); + break; + + case LL_RCC_I2S2_CLKSOURCE_PLLI2S_VCO: /*!< PLLI2S oscillator clock selected as I2S clock source */ + case LL_RCC_I2S3_CLKSOURCE_PLLI2S_VCO: + default: + i2s_frequency = RCC_PLLI2S_GetFreqDomain_I2S() * 2U; + break; + } + + return i2s_frequency; +} +#endif /* RCC_CFGR2_I2S2SRC */ + +#if defined(USB) || defined(USB_OTG_FS) +/** + * @brief Return USBx clock frequency + * @param USBxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_USB_CLKSOURCE + * @retval USB clock frequency (in Hz) + * @arg @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI), HSE or PLL is not ready + */ +uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource) +{ + uint32_t usb_frequency = LL_RCC_PERIPH_FREQUENCY_NO; + + /* Check parameter */ + assert_param(IS_LL_RCC_USB_CLKSOURCE(USBxSource)); + + /* USBCLK clock frequency */ + switch (LL_RCC_GetUSBClockSource(USBxSource)) + { +#if defined(RCC_CFGR_USBPRE) + case LL_RCC_USB_CLKSOURCE_PLL: /* PLL clock used as USB clock source */ + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = RCC_PLL_GetFreqDomain_SYS(); + } + break; + + case LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5: /* PLL clock divided by 1.5 used as USB clock source */ + default: + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = (RCC_PLL_GetFreqDomain_SYS() * 3U) / 2U; + } + break; +#endif /* RCC_CFGR_USBPRE */ +#if defined(RCC_CFGR_OTGFSPRE) + /* USBCLK = PLLVCO/2 + = (2 x PLLCLK) / 2 + = PLLCLK */ + case LL_RCC_USB_CLKSOURCE_PLL_DIV_2: /* PLL clock used as USB clock source */ + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = RCC_PLL_GetFreqDomain_SYS(); + } + break; + + /* USBCLK = PLLVCO/3 + = (2 x PLLCLK) / 3 */ + case LL_RCC_USB_CLKSOURCE_PLL_DIV_3: /* PLL clock divided by 3 used as USB clock source */ + default: + if (LL_RCC_PLL_IsReady()) + { + usb_frequency = (RCC_PLL_GetFreqDomain_SYS() * 2U) / 3U; + } + break; +#endif /* RCC_CFGR_OTGFSPRE */ + } + + return usb_frequency; +} +#endif /* USB */ + +/** + * @brief Return ADCx clock frequency + * @param ADCxSource This parameter can be one of the following values: + * @arg @ref LL_RCC_ADC_CLKSOURCE + * @retval ADC clock frequency (in Hz) + */ +uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource) +{ + uint32_t adc_prescaler = 0U; + uint32_t adc_frequency = 0U; + + /* Check parameter */ + assert_param(IS_LL_RCC_ADC_CLKSOURCE(ADCxSource)); + + /* Get ADC prescaler */ + adc_prescaler = LL_RCC_GetADCClockSource(ADCxSource); + + /* ADC frequency = PCLK2 frequency / ADC prescaler (2, 4, 6 or 8) */ + adc_frequency = RCC_GetPCLK2ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())) + / (((adc_prescaler >> POSITION_VAL(ADCxSource)) + 1U) * 2U); + + return adc_frequency; +} + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup RCC_LL_Private_Functions + * @{ + */ + +/** + * @brief Return SYSTEM clock frequency + * @retval SYSTEM clock frequency (in Hz) + */ +uint32_t RCC_GetSystemClockFreq(void) +{ + uint32_t frequency = 0U; + + /* Get SYSCLK source -------------------------------------------------------*/ + switch (LL_RCC_GetSysClkSource()) + { + case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: /* HSI used as system clock source */ + frequency = HSI_VALUE; + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: /* HSE used as system clock source */ + frequency = HSE_VALUE; + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: /* PLL used as system clock source */ + frequency = RCC_PLL_GetFreqDomain_SYS(); + break; + + default: + frequency = HSI_VALUE; + break; + } + + return frequency; +} + +/** + * @brief Return HCLK clock frequency + * @param SYSCLK_Frequency SYSCLK clock frequency + * @retval HCLK clock frequency (in Hz) + */ +uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency) +{ + /* HCLK clock frequency */ + return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler()); +} + +/** + * @brief Return PCLK1 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK1 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency) +{ + /* PCLK1 clock frequency */ + return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler()); +} + +/** + * @brief Return PCLK2 clock frequency + * @param HCLK_Frequency HCLK clock frequency + * @retval PCLK2 clock frequency (in Hz) + */ +uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency) +{ + /* PCLK2 clock frequency */ + return __LL_RCC_CALC_PCLK2_FREQ(HCLK_Frequency, LL_RCC_GetAPB2Prescaler()); +} + +/** + * @brief Return PLL clock frequency used for system domain + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL_GetFreqDomain_SYS(void) +{ + uint32_t pllinputfreq = 0U, pllsource = 0U; + + /* PLL_VCO = (HSE_VALUE, HSI_VALUE or PLL2 / PLL Predivider) * PLL Multiplicator */ + + /* Get PLL source */ + pllsource = LL_RCC_PLL_GetMainSource(); + + switch (pllsource) + { + case LL_RCC_PLLSOURCE_HSI_DIV_2: /* HSI used as PLL clock source */ + pllinputfreq = HSI_VALUE / 2U; + break; + + case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ + pllinputfreq = HSE_VALUE / (LL_RCC_PLL_GetPrediv() + 1U); + break; + +#if defined(RCC_PLL2_SUPPORT) + case LL_RCC_PLLSOURCE_PLL2: /* PLL2 used as PLL clock source */ + pllinputfreq = RCC_PLL2_GetFreqClockFreq() / (LL_RCC_PLL_GetPrediv() + 1U); + break; +#endif /* RCC_PLL2_SUPPORT */ + + default: + pllinputfreq = HSI_VALUE / 2U; + break; + } + return __LL_RCC_CALC_PLLCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetMultiplicator()); +} + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Return PLL clock frequency used for system domain + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLL2_GetFreqClockFreq(void) +{ + return __LL_RCC_CALC_PLL2CLK_FREQ(HSE_VALUE, LL_RCC_PLL2_GetMultiplicator(), LL_RCC_HSE_GetPrediv2()); +} +#endif /* RCC_PLL2_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) +/** + * @brief Return PLL clock frequency used for system domain + * @retval PLL clock frequency (in Hz) + */ +uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void) +{ + return __LL_RCC_CALC_PLLI2SCLK_FREQ(HSE_VALUE, LL_RCC_PLLI2S_GetMultiplicator(), LL_RCC_HSE_GetPrediv2()); +} +#endif /* RCC_PLLI2S_SUPPORT */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(RCC) */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c new file mode 100644 index 0000000..07b05ee --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c @@ -0,0 +1,1209 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_tim.c + * @author MCD Application Team + * @brief TIM LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_tim.h" +#include "stm32f1xx_ll_bus.h" + +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) || defined (TIM15) || defined (TIM16) || defined (TIM17) + +/** @addtogroup TIM_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup TIM_LL_Private_Macros + * @{ + */ +#define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \ + || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN)) + +#define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \ + || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \ + || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4)) + +#define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \ + || ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \ + || ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \ + || ((__VALUE__) == LL_TIM_OCMODE_PWM1) \ + || ((__VALUE__) == LL_TIM_OCMODE_PWM2)) + +#define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \ + || ((__VALUE__) == LL_TIM_OCSTATE_ENABLE)) + +#define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \ + || ((__VALUE__) == LL_TIM_OCPOLARITY_LOW)) + +#define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \ + || ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH)) + +#define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \ + || ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \ + || ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC)) + +#define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV2) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV4) \ + || ((__VALUE__) == LL_TIM_ICPSC_DIV8)) + +#define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \ + || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8)) + +#define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ + || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) + +#define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \ + || ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \ + || ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12)) + +#define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ + || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) + +#define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \ + || ((__VALUE__) == LL_TIM_OSSR_ENABLE)) + +#define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \ + || ((__VALUE__) == LL_TIM_OSSI_ENABLE)) + +#define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \ + || ((__VALUE__) == LL_TIM_LOCKLEVEL_3)) + +#define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \ + || ((__VALUE__) == LL_TIM_BREAK_ENABLE)) + +#define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \ + || ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH)) + +#define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \ + || ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE)) +/** + * @} + */ + + +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup TIM_LL_Private_Functions TIM Private Functions + * @{ + */ +static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct); +static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup TIM_LL_Exported_Functions + * @{ + */ + +/** @addtogroup TIM_LL_EF_Init + * @{ + */ + +/** + * @brief Set TIMx registers to their reset values. + * @param TIMx Timer instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: invalid TIMx instance + */ +ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx) +{ + ErrorStatus result = SUCCESS; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(TIMx)); + + if (TIMx == TIM2) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2); + } +#if defined(TIM1) + else if (TIMx == TIM1) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1); + } +#endif +#if defined(TIM3) + else if (TIMx == TIM3) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM3); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM3); + } +#endif +#if defined(TIM4) + else if (TIMx == TIM4) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM4); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM4); + } +#endif +#if defined(TIM5) + else if (TIMx == TIM5) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM5); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM5); + } +#endif +#if defined(TIM6) + else if (TIMx == TIM6) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM6); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM6); + } +#endif +#if defined (TIM7) + else if (TIMx == TIM7) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM7); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM7); + } +#endif +#if defined(TIM8) + else if (TIMx == TIM8) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM8); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM8); + } +#endif +#if defined(TIM9) + else if (TIMx == TIM9) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM9); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM9); + } +#endif +#if defined(TIM10) + else if (TIMx == TIM10) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM10); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM10); + } +#endif +#if defined(TIM11) + else if (TIMx == TIM11) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM11); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM11); + } +#endif +#if defined(TIM12) + else if (TIMx == TIM12) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM12); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM12); + } +#endif +#if defined(TIM13) + else if (TIMx == TIM13) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM13); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM13); + } +#endif +#if defined(TIM14) + else if (TIMx == TIM14) + { + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM14); + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM14); + } +#endif +#if defined(TIM15) + else if (TIMx == TIM15) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM15); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM15); + } +#endif +#if defined(TIM16) + else if (TIMx == TIM16) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM16); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM16); + } +#endif +#if defined(TIM17) + else if (TIMx == TIM17) + { + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM17); + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM17); + } +#endif + else + { + result = ERROR; + } + + return result; +} + +/** + * @brief Set the fields of the time base unit configuration data structure + * to their default values. + * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (time base unit configuration data structure) + * @retval None + */ +void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct) +{ + /* Set the default configuration */ + TIM_InitStruct->Prescaler = (uint16_t)0x0000; + TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP; + TIM_InitStruct->Autoreload = 0xFFFFFFFFU; + TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; + TIM_InitStruct->RepetitionCounter = 0x00000000U; +} + +/** + * @brief Configure the TIMx time base unit. + * @param TIMx Timer Instance + * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure + * (TIMx time base unit configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct) +{ + uint32_t tmpcr1; + + /* Check the parameters */ + assert_param(IS_TIM_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode)); + assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision)); + + tmpcr1 = LL_TIM_ReadReg(TIMx, CR1); + + if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) + { + /* Select the Counter Mode */ + MODIFY_REG(tmpcr1, (TIM_CR1_DIR | TIM_CR1_CMS), TIM_InitStruct->CounterMode); + } + + if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) + { + /* Set the clock division */ + MODIFY_REG(tmpcr1, TIM_CR1_CKD, TIM_InitStruct->ClockDivision); + } + + /* Write to TIMx CR1 */ + LL_TIM_WriteReg(TIMx, CR1, tmpcr1); + + /* Set the Autoreload value */ + LL_TIM_SetAutoReload(TIMx, TIM_InitStruct->Autoreload); + + /* Set the Prescaler value */ + LL_TIM_SetPrescaler(TIMx, TIM_InitStruct->Prescaler); + + if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) + { + /* Set the Repetition Counter value */ + LL_TIM_SetRepetitionCounter(TIMx, TIM_InitStruct->RepetitionCounter); + } + + /* Generate an update event to reload the Prescaler + and the repetition counter value (if applicable) immediately */ + LL_TIM_GenerateEvent_UPDATE(TIMx); + + return SUCCESS; +} + +/** + * @brief Set the fields of the TIMx output channel configuration data + * structure to their default values. + * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure + * (the output channel configuration data structure) + * @retval None + */ +void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct) +{ + /* Set the default configuration */ + TIM_OC_InitStruct->OCMode = LL_TIM_OCMODE_FROZEN; + TIM_OC_InitStruct->OCState = LL_TIM_OCSTATE_DISABLE; + TIM_OC_InitStruct->OCNState = LL_TIM_OCSTATE_DISABLE; + TIM_OC_InitStruct->CompareValue = 0x00000000U; + TIM_OC_InitStruct->OCPolarity = LL_TIM_OCPOLARITY_HIGH; + TIM_OC_InitStruct->OCNPolarity = LL_TIM_OCPOLARITY_HIGH; + TIM_OC_InitStruct->OCIdleState = LL_TIM_OCIDLESTATE_LOW; + TIM_OC_InitStruct->OCNIdleState = LL_TIM_OCIDLESTATE_LOW; +} + +/** + * @brief Configure the TIMx output channel. + * @param TIMx Timer Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration + * data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx output channel is initialized + * - ERROR: TIMx output channel is not initialized + */ +ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct) +{ + ErrorStatus result = ERROR; + + switch (Channel) + { + case LL_TIM_CHANNEL_CH1: + result = OC1Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH2: + result = OC2Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH3: + result = OC3Config(TIMx, TIM_OC_InitStruct); + break; + case LL_TIM_CHANNEL_CH4: + result = OC4Config(TIMx, TIM_OC_InitStruct); + break; + default: + break; + } + + return result; +} + +/** + * @brief Set the fields of the TIMx input channel configuration data + * structure to their default values. + * @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration + * data structure) + * @retval None + */ +void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Set the default configuration */ + TIM_ICInitStruct->ICPolarity = LL_TIM_IC_POLARITY_RISING; + TIM_ICInitStruct->ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_ICInitStruct->ICPrescaler = LL_TIM_ICPSC_DIV1; + TIM_ICInitStruct->ICFilter = LL_TIM_IC_FILTER_FDIV1; +} + +/** + * @brief Configure the TIMx input channel. + * @param TIMx Timer Instance + * @param Channel This parameter can be one of the following values: + * @arg @ref LL_TIM_CHANNEL_CH1 + * @arg @ref LL_TIM_CHANNEL_CH2 + * @arg @ref LL_TIM_CHANNEL_CH3 + * @arg @ref LL_TIM_CHANNEL_CH4 + * @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data + * structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx output channel is initialized + * - ERROR: TIMx output channel is not initialized + */ +ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct) +{ + ErrorStatus result = ERROR; + + switch (Channel) + { + case LL_TIM_CHANNEL_CH1: + result = IC1Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH2: + result = IC2Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH3: + result = IC3Config(TIMx, TIM_IC_InitStruct); + break; + case LL_TIM_CHANNEL_CH4: + result = IC4Config(TIMx, TIM_IC_InitStruct); + break; + default: + break; + } + + return result; +} + +/** + * @brief Fills each TIM_EncoderInitStruct field with its default value + * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface + * configuration data structure) + * @retval None + */ +void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) +{ + /* Set the default configuration */ + TIM_EncoderInitStruct->EncoderMode = LL_TIM_ENCODERMODE_X2_TI1; + TIM_EncoderInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_EncoderInitStruct->IC1ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_EncoderInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1; + TIM_EncoderInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1; + TIM_EncoderInitStruct->IC2Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_EncoderInitStruct->IC2ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI; + TIM_EncoderInitStruct->IC2Prescaler = LL_TIM_ICPSC_DIV1; + TIM_EncoderInitStruct->IC2Filter = LL_TIM_IC_FILTER_FDIV1; +} + +/** + * @brief Configure the encoder interface of the timer instance. + * @param TIMx Timer Instance + * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface + * configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + + /* Check the parameters */ + assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC1ActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC1Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC1Filter)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC2Polarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC2ActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC2Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC2Filter)); + + /* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */ + TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Configure TI1 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1ActiveInput >> 16U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Filter >> 16U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Prescaler >> 16U); + + /* Configure TI2 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2ActiveInput >> 8U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Filter >> 8U); + tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Prescaler >> 8U); + + /* Set TI1 and TI2 polarity and enable TI1 and TI2 */ + tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC1Polarity); + tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC2Polarity << 4U); + tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Set encoder mode */ + LL_TIM_SetEncoderMode(TIMx, TIM_EncoderInitStruct->EncoderMode); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Set the fields of the TIMx Hall sensor interface configuration data + * structure to their default values. + * @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (HALL sensor interface + * configuration data structure) + * @retval None + */ +void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) +{ + /* Set the default configuration */ + TIM_HallSensorInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING; + TIM_HallSensorInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1; + TIM_HallSensorInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1; + TIM_HallSensorInitStruct->CommutationDelay = 0U; +} + +/** + * @brief Configure the Hall sensor interface of the timer instance. + * @note TIMx CH1, CH2 and CH3 inputs connected through a XOR + * to the TI1 input channel + * @note TIMx slave mode controller is configured in reset mode. + Selected internal trigger is TI1F_ED. + * @note Channel 1 is configured as input, IC1 is mapped on TRC. + * @note Captured value stored in TIMx_CCR1 correspond to the time elapsed + * between 2 changes on the inputs. It gives information about motor speed. + * @note Channel 2 is configured in output PWM 2 mode. + * @note Compare value stored in TIMx_CCR2 corresponds to the commutation delay. + * @note OC2REF is selected as trigger output on TRGO. + * @param TIMx Timer Instance + * @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (TIMx HALL sensor + * interface configuration data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) +{ + uint32_t tmpcr2; + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpsmcr; + + /* Check the parameters */ + assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity)); + assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_HallSensorInitStruct->IC1Filter)); + + /* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */ + TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx SMCR register value */ + tmpsmcr = LL_TIM_ReadReg(TIMx, SMCR); + + /* Connect TIMx_CH1, CH2 and CH3 pins to the TI1 input */ + tmpcr2 |= TIM_CR2_TI1S; + + /* OC2REF signal is used as trigger output (TRGO) */ + tmpcr2 |= LL_TIM_TRGO_OC2REF; + + /* Configure the slave mode controller */ + tmpsmcr &= (uint32_t)~(TIM_SMCR_TS | TIM_SMCR_SMS); + tmpsmcr |= LL_TIM_TS_TI1F_ED; + tmpsmcr |= LL_TIM_SLAVEMODE_RESET; + + /* Configure input channel 1 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC); + tmpccmr1 |= (uint32_t)(LL_TIM_ACTIVEINPUT_TRC >> 16U); + tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Filter >> 16U); + tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Prescaler >> 16U); + + /* Configure input channel 2 */ + tmpccmr1 &= (uint32_t)~(TIM_CCMR1_OC2M | TIM_CCMR1_OC2FE | TIM_CCMR1_OC2PE | TIM_CCMR1_OC2CE); + tmpccmr1 |= (uint32_t)(LL_TIM_OCMODE_PWM2 << 8U); + + /* Set Channel 1 polarity and enable Channel 1 and Channel2 */ + tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP); + tmpccer |= (uint32_t)(TIM_HallSensorInitStruct->IC1Polarity); + tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E); + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx SMCR */ + LL_TIM_WriteReg(TIMx, SMCR, tmpsmcr); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + /* Write to TIMx CCR2 */ + LL_TIM_OC_SetCompareCH2(TIMx, TIM_HallSensorInitStruct->CommutationDelay); + + return SUCCESS; +} + +/** + * @brief Set the fields of the Break and Dead Time configuration data structure + * to their default values. + * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration + * data structure) + * @retval None + */ +void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) +{ + /* Set the default configuration */ + TIM_BDTRInitStruct->OSSRState = LL_TIM_OSSR_DISABLE; + TIM_BDTRInitStruct->OSSIState = LL_TIM_OSSI_DISABLE; + TIM_BDTRInitStruct->LockLevel = LL_TIM_LOCKLEVEL_OFF; + TIM_BDTRInitStruct->DeadTime = (uint8_t)0x00; + TIM_BDTRInitStruct->BreakState = LL_TIM_BREAK_DISABLE; + TIM_BDTRInitStruct->BreakPolarity = LL_TIM_BREAK_POLARITY_LOW; + TIM_BDTRInitStruct->AutomaticOutput = LL_TIM_AUTOMATICOUTPUT_DISABLE; +} + +/** + * @brief Configure the Break and Dead Time feature of the timer instance. + * @note As the bits AOE, BKP, BKE, OSSR, OSSI and DTG[7:0] can be write-locked + * depending on the LOCK configuration, it can be necessary to configure all of + * them during the first write access to the TIMx_BDTR register. + * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not + * a timer instance provides a break input. + * @param TIMx Timer Instance + * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration + * data structure) + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Break and Dead Time is initialized + * - ERROR: not applicable + */ +ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) +{ + uint32_t tmpbdtr = 0; + + /* Check the parameters */ + assert_param(IS_TIM_BREAK_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OSSR_STATE(TIM_BDTRInitStruct->OSSRState)); + assert_param(IS_LL_TIM_OSSI_STATE(TIM_BDTRInitStruct->OSSIState)); + assert_param(IS_LL_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->LockLevel)); + assert_param(IS_LL_TIM_BREAK_STATE(TIM_BDTRInitStruct->BreakState)); + assert_param(IS_LL_TIM_BREAK_POLARITY(TIM_BDTRInitStruct->BreakPolarity)); + assert_param(IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(TIM_BDTRInitStruct->AutomaticOutput)); + + /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State, + the OSSI State, the dead time value and the Automatic Output Enable Bit */ + + /* Set the BDTR bits */ + MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, TIM_BDTRInitStruct->DeadTime); + MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, TIM_BDTRInitStruct->LockLevel); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, TIM_BDTRInitStruct->OSSIState); + MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, TIM_BDTRInitStruct->OSSRState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, TIM_BDTRInitStruct->BreakState); + MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, TIM_BDTRInitStruct->BreakPolarity); + MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, TIM_BDTRInitStruct->AutomaticOutput); + MODIFY_REG(tmpbdtr, TIM_BDTR_MOE, TIM_BDTRInitStruct->AutomaticOutput); + + /* Set TIMx_BDTR */ + LL_TIM_WriteReg(TIMx, BDTR, tmpbdtr); + + return SUCCESS; +} +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup TIM_LL_Private_Functions TIM Private Functions + * @brief Private functions + * @{ + */ +/** + * @brief Configure the TIMx output channel 1. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 1 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 1: Reset the CC1E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC1E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC1S); + + /* Set the Output Compare Mode */ + MODIFY_REG(tmpccmr1, TIM_CCMR1_OC1M, TIM_OCInitStruct->OCMode); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC1P, TIM_OCInitStruct->OCPolarity); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC1E, TIM_OCInitStruct->OCState); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC1NP, TIM_OCInitStruct->OCNPolarity << 2U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC1NE, TIM_OCInitStruct->OCNState << 2U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS1, TIM_OCInitStruct->OCIdleState); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS1N, TIM_OCInitStruct->OCNIdleState << 1U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH1(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 2. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 2 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr1; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 2: Reset the CC2E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC2E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR1 register value */ + tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC2S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr1, TIM_CCMR1_OC2M, TIM_OCInitStruct->OCMode << 8U); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC2P, TIM_OCInitStruct->OCPolarity << 4U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC2E, TIM_OCInitStruct->OCState << 4U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC2NP, TIM_OCInitStruct->OCNPolarity << 6U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC2NE, TIM_OCInitStruct->OCNState << 6U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS2, TIM_OCInitStruct->OCIdleState << 2U); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS2N, TIM_OCInitStruct->OCNIdleState << 3U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR1 */ + LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH2(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 3. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 3 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + + /* Disable the Channel 3: Reset the CC3E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC3E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR2 register value */ + tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC3S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr2, TIM_CCMR2_OC3M, TIM_OCInitStruct->OCMode); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC3P, TIM_OCInitStruct->OCPolarity << 8U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC3E, TIM_OCInitStruct->OCState << 8U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the complementary output Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC3NP, TIM_OCInitStruct->OCNPolarity << 10U); + + /* Set the complementary output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC3NE, TIM_OCInitStruct->OCNState << 10U); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS3, TIM_OCInitStruct->OCIdleState << 4U); + + /* Set the complementary output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS3N, TIM_OCInitStruct->OCNIdleState << 5U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR2 */ + LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH3(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx output channel 4. + * @param TIMx Timer Instance + * @param TIM_OCInitStruct pointer to the the TIMx output channel 4 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) +{ + uint32_t tmpccmr2; + uint32_t tmpccer; + uint32_t tmpcr2; + + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity)); + assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity)); + assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState)); + + /* Disable the Channel 4: Reset the CC4E Bit */ + CLEAR_BIT(TIMx->CCER, TIM_CCER_CC4E); + + /* Get the TIMx CCER register value */ + tmpccer = LL_TIM_ReadReg(TIMx, CCER); + + /* Get the TIMx CR2 register value */ + tmpcr2 = LL_TIM_ReadReg(TIMx, CR2); + + /* Get the TIMx CCMR2 register value */ + tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2); + + /* Reset Capture/Compare selection Bits */ + CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC4S); + + /* Select the Output Compare Mode */ + MODIFY_REG(tmpccmr2, TIM_CCMR2_OC4M, TIM_OCInitStruct->OCMode << 8U); + + /* Set the Output Compare Polarity */ + MODIFY_REG(tmpccer, TIM_CCER_CC4P, TIM_OCInitStruct->OCPolarity << 12U); + + /* Set the Output State */ + MODIFY_REG(tmpccer, TIM_CCER_CC4E, TIM_OCInitStruct->OCState << 12U); + + if (IS_TIM_BREAK_INSTANCE(TIMx)) + { + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState)); + assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState)); + + /* Set the Output Idle state */ + MODIFY_REG(tmpcr2, TIM_CR2_OIS4, TIM_OCInitStruct->OCIdleState << 6U); + } + + /* Write to TIMx CR2 */ + LL_TIM_WriteReg(TIMx, CR2, tmpcr2); + + /* Write to TIMx CCMR2 */ + LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2); + + /* Set the Capture Compare Register value */ + LL_TIM_OC_SetCompareCH4(TIMx, TIM_OCInitStruct->CompareValue); + + /* Write to TIMx CCER */ + LL_TIM_WriteReg(TIMx, CCER, tmpccer); + + return SUCCESS; +} + + +/** + * @brief Configure the TIMx input channel 1. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 1 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC1_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 1: Reset the CC1E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR1, + (TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U); + + /* Select the Polarity and set the CC1E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC1P | TIM_CCER_CC1NP), + (TIM_ICInitStruct->ICPolarity | TIM_CCER_CC1E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 2. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 2 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC2_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 2: Reset the CC2E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC2E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR1, + (TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U); + + /* Select the Polarity and set the CC2E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC2P | TIM_CCER_CC2NP), + ((TIM_ICInitStruct->ICPolarity << 4U) | TIM_CCER_CC2E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 3. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 3 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC3_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 3: Reset the CC3E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC3E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR2, + (TIM_CCMR2_CC3S | TIM_CCMR2_IC3F | TIM_CCMR2_IC3PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U); + + /* Select the Polarity and set the CC3E Bit */ + MODIFY_REG(TIMx->CCER, + (TIM_CCER_CC3P | TIM_CCER_CC3NP), + ((TIM_ICInitStruct->ICPolarity << 8U) | TIM_CCER_CC3E)); + + return SUCCESS; +} + +/** + * @brief Configure the TIMx input channel 4. + * @param TIMx Timer Instance + * @param TIM_ICInitStruct pointer to the the TIMx input channel 4 configuration data structure + * @retval An ErrorStatus enumeration value: + * - SUCCESS: TIMx registers are de-initialized + * - ERROR: not applicable + */ +static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct) +{ + /* Check the parameters */ + assert_param(IS_TIM_CC4_INSTANCE(TIMx)); + assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity)); + assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput)); + assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler)); + assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter)); + + /* Disable the Channel 4: Reset the CC4E Bit */ + TIMx->CCER &= (uint32_t)~TIM_CCER_CC4E; + + /* Select the Input and set the filter and the prescaler value */ + MODIFY_REG(TIMx->CCMR2, + (TIM_CCMR2_CC4S | TIM_CCMR2_IC4F | TIM_CCMR2_IC4PSC), + (TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U); + + /* Select the Polarity and set the CC4E Bit */ + MODIFY_REG(TIMx->CCER, + TIM_CCER_CC4P, + ((TIM_ICInitStruct->ICPolarity << 12U) | TIM_CCER_CC4E)); + + return SUCCESS; +} + + +/** + * @} + */ + +/** + * @} + */ + +#endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 || TIM15 || TIM16 || TIM17 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c new file mode 100644 index 0000000..81d2b4f --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c @@ -0,0 +1,440 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_usart.c + * @author MCD Application Team + * @brief USART LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +#if defined(USE_FULL_LL_DRIVER) + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_usart.h" +#include "stm32f1xx_ll_rcc.h" +#include "stm32f1xx_ll_bus.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +#if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5) + +/** @addtogroup USART_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @addtogroup USART_LL_Private_Constants + * @{ + */ + +/** + * @} + */ + + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup USART_LL_Private_Macros + * @{ + */ + +/* __BAUDRATE__ The maximum Baud Rate is derived from the maximum clock available + * divided by the smallest oversampling used on the USART (i.e. 8) */ +#define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 4500000U) + +/* __VALUE__ In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d. */ +#define IS_LL_USART_BRR_MIN(__VALUE__) ((__VALUE__) >= 16U) + +#define IS_LL_USART_DIRECTION(__VALUE__) (((__VALUE__) == LL_USART_DIRECTION_NONE) \ + || ((__VALUE__) == LL_USART_DIRECTION_RX) \ + || ((__VALUE__) == LL_USART_DIRECTION_TX) \ + || ((__VALUE__) == LL_USART_DIRECTION_TX_RX)) + +#define IS_LL_USART_PARITY(__VALUE__) (((__VALUE__) == LL_USART_PARITY_NONE) \ + || ((__VALUE__) == LL_USART_PARITY_EVEN) \ + || ((__VALUE__) == LL_USART_PARITY_ODD)) + +#define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_8B) \ + || ((__VALUE__) == LL_USART_DATAWIDTH_9B)) + +#define IS_LL_USART_OVERSAMPLING(__VALUE__) (((__VALUE__) == LL_USART_OVERSAMPLING_16) \ + || ((__VALUE__) == LL_USART_OVERSAMPLING_8)) + +#define IS_LL_USART_LASTBITCLKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_LASTCLKPULSE_NO_OUTPUT) \ + || ((__VALUE__) == LL_USART_LASTCLKPULSE_OUTPUT)) + +#define IS_LL_USART_CLOCKPHASE(__VALUE__) (((__VALUE__) == LL_USART_PHASE_1EDGE) \ + || ((__VALUE__) == LL_USART_PHASE_2EDGE)) + +#define IS_LL_USART_CLOCKPOLARITY(__VALUE__) (((__VALUE__) == LL_USART_POLARITY_LOW) \ + || ((__VALUE__) == LL_USART_POLARITY_HIGH)) + +#define IS_LL_USART_CLOCKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_CLOCK_DISABLE) \ + || ((__VALUE__) == LL_USART_CLOCK_ENABLE)) + +#define IS_LL_USART_STOPBITS(__VALUE__) (((__VALUE__) == LL_USART_STOPBITS_0_5) \ + || ((__VALUE__) == LL_USART_STOPBITS_1) \ + || ((__VALUE__) == LL_USART_STOPBITS_1_5) \ + || ((__VALUE__) == LL_USART_STOPBITS_2)) + +#define IS_LL_USART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_USART_HWCONTROL_NONE) \ + || ((__VALUE__) == LL_USART_HWCONTROL_RTS) \ + || ((__VALUE__) == LL_USART_HWCONTROL_CTS) \ + || ((__VALUE__) == LL_USART_HWCONTROL_RTS_CTS)) + +/** + * @} + */ + +/* Private function prototypes -----------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup USART_LL_Exported_Functions + * @{ + */ + +/** @addtogroup USART_LL_EF_Init + * @{ + */ + +/** + * @brief De-initialize USART registers (Registers restored to their default values). + * @param USARTx USART Instance + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers are de-initialized + * - ERROR: USART registers are not de-initialized + */ +ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx) +{ + ErrorStatus status = SUCCESS; + + /* Check the parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + + if (USARTx == USART1) + { + /* Force reset of USART clock */ + LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1); + + /* Release reset of USART clock */ + LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1); + } + else if (USARTx == USART2) + { + /* Force reset of USART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART2); + + /* Release reset of USART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART2); + } +#if defined(USART3) + else if (USARTx == USART3) + { + /* Force reset of USART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART3); + + /* Release reset of USART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART3); + } +#endif /* USART3 */ +#if defined(UART4) + else if (USARTx == UART4) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART4); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART4); + } +#endif /* UART4 */ +#if defined(UART5) + else if (USARTx == UART5) + { + /* Force reset of UART clock */ + LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART5); + + /* Release reset of UART clock */ + LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART5); + } +#endif /* UART5 */ + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Initialize USART registers according to the specified + * parameters in USART_InitStruct. + * @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), + * USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @note Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0). + * @param USARTx USART Instance + * @param USART_InitStruct pointer to a LL_USART_InitTypeDef structure + * that contains the configuration information for the specified USART peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers are initialized according to USART_InitStruct content + * - ERROR: Problem occurred during USART Registers initialization + */ +ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct) +{ + ErrorStatus status = ERROR; + uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO; + LL_RCC_ClocksTypeDef rcc_clocks; + + /* Check the parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate)); + assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth)); + assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits)); + assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity)); + assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection)); + assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl)); +#if defined(USART_CR1_OVER8) + assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling)); +#endif /* USART_OverSampling_Feature */ + + /* USART needs to be in disabled state, in order to be able to configure some bits in + CRx registers */ + if (LL_USART_IsEnabled(USARTx) == 0U) + { + /*---------------------------- USART CR1 Configuration ----------------------- + * Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters: + * - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value + * - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value + * - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value + * - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value. + */ +#if defined(USART_CR1_OVER8) + MODIFY_REG(USARTx->CR1, + (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | + USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8), + (USART_InitStruct->DataWidth | USART_InitStruct->Parity | + USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling)); +#else + MODIFY_REG(USARTx->CR1, + (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | + USART_CR1_TE | USART_CR1_RE), + (USART_InitStruct->DataWidth | USART_InitStruct->Parity | + USART_InitStruct->TransferDirection)); +#endif /* USART_OverSampling_Feature */ + + /*---------------------------- USART CR2 Configuration ----------------------- + * Configure USARTx CR2 (Stop bits) with parameters: + * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value. + * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit(). + */ + LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits); + + /*---------------------------- USART CR3 Configuration ----------------------- + * Configure USARTx CR3 (Hardware Flow Control) with parameters: + * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to USART_InitStruct->HardwareFlowControl value. + */ + LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl); + + /*---------------------------- USART BRR Configuration ----------------------- + * Retrieve Clock frequency used for USART Peripheral + */ + LL_RCC_GetSystemClocksFreq(&rcc_clocks); + if (USARTx == USART1) + { + periphclk = rcc_clocks.PCLK2_Frequency; + } + else if (USARTx == USART2) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#if defined(USART3) + else if (USARTx == USART3) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* USART3 */ +#if defined(UART4) + else if (USARTx == UART4) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART4 */ +#if defined(UART5) + else if (USARTx == UART5) + { + periphclk = rcc_clocks.PCLK1_Frequency; + } +#endif /* UART5 */ + else + { + /* Nothing to do, as error code is already assigned to ERROR value */ + } + + /* Configure the USART Baud Rate : + - valid baud rate value (different from 0) is required + - Peripheral clock as returned by RCC service, should be valid (different from 0). + */ + if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO) + && (USART_InitStruct->BaudRate != 0U)) + { + status = SUCCESS; +#if defined(USART_CR1_OVER8) + LL_USART_SetBaudRate(USARTx, + periphclk, + USART_InitStruct->OverSampling, + USART_InitStruct->BaudRate); +#else + LL_USART_SetBaudRate(USARTx, + periphclk, + USART_InitStruct->BaudRate); +#endif /* USART_OverSampling_Feature */ + + /* Check BRR is greater than or equal to 16d */ + assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR)); + } + } + /* Endif (=> USART not in Disabled state => return ERROR) */ + + return (status); +} + +/** + * @brief Set each @ref LL_USART_InitTypeDef field to default value. + * @param USART_InitStruct Pointer to a @ref LL_USART_InitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ + +void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct) +{ + /* Set USART_InitStruct fields to default values */ + USART_InitStruct->BaudRate = 9600U; + USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct->StopBits = LL_USART_STOPBITS_1; + USART_InitStruct->Parity = LL_USART_PARITY_NONE ; + USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX; + USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE; +#if defined(USART_CR1_OVER8) + USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16; +#endif /* USART_OverSampling_Feature */ +} + +/** + * @brief Initialize USART Clock related settings according to the + * specified parameters in the USART_ClockInitStruct. + * @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), + * USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. + * @param USARTx USART Instance + * @param USART_ClockInitStruct Pointer to a @ref LL_USART_ClockInitTypeDef structure + * that contains the Clock configuration information for the specified USART peripheral. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: USART registers related to Clock settings are initialized according to USART_ClockInitStruct content + * - ERROR: Problem occurred during USART Registers initialization + */ +ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct) +{ + ErrorStatus status = SUCCESS; + + /* Check USART Instance and Clock signal output parameters */ + assert_param(IS_UART_INSTANCE(USARTx)); + assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput)); + + /* USART needs to be in disabled state, in order to be able to configure some bits in + CRx registers */ + if (LL_USART_IsEnabled(USARTx) == 0U) + { + /*---------------------------- USART CR2 Configuration -----------------------*/ + /* If Clock signal has to be output */ + if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE) + { + /* Deactivate Clock signal delivery : + * - Disable Clock Output: USART_CR2_CLKEN cleared + */ + LL_USART_DisableSCLKOutput(USARTx); + } + else + { + /* Ensure USART instance is USART capable */ + assert_param(IS_USART_INSTANCE(USARTx)); + + /* Check clock related parameters */ + assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity)); + assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase)); + assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse)); + + /*---------------------------- USART CR2 Configuration ----------------------- + * Configure USARTx CR2 (Clock signal related bits) with parameters: + * - Enable Clock Output: USART_CR2_CLKEN set + * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value + * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value + * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value. + */ + MODIFY_REG(USARTx->CR2, + USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, + USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity | + USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse); + } + } + /* Else (USART not in Disabled state => return ERROR */ + else + { + status = ERROR; + } + + return (status); +} + +/** + * @brief Set each field of a @ref LL_USART_ClockInitTypeDef type structure to default value. + * @param USART_ClockInitStruct Pointer to a @ref LL_USART_ClockInitTypeDef structure + * whose fields will be set to default values. + * @retval None + */ +void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct) +{ + /* Set LL_USART_ClockInitStruct fields with default values */ + USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE; + USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ + USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ + USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */ +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* USART1 || USART2 || USART3 || UART4 || UART5 */ + +/** + * @} + */ + +#endif /* USE_FULL_LL_DRIVER */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c new file mode 100644 index 0000000..ce0ffce --- /dev/null +++ b/SEW-EXA1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c @@ -0,0 +1,770 @@ +/** + ****************************************************************************** + * @file stm32f1xx_ll_utils.c + * @author MCD Application Team + * @brief UTILS LL module driver. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2016 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_ll_rcc.h" +#include "stm32f1xx_ll_utils.h" +#include "stm32f1xx_ll_system.h" +#ifdef USE_FULL_ASSERT +#include "stm32_assert.h" +#else +#define assert_param(expr) ((void)0U) +#endif + +/** @addtogroup STM32F1xx_LL_Driver + * @{ + */ + +/** @addtogroup UTILS_LL + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Private_Constants + * @{ + */ + +/* Defines used for PLL range */ +#define UTILS_PLL_OUTPUT_MAX RCC_MAX_FREQUENCY /*!< Frequency max for PLL output, in Hz */ +#define UTILS_PLL2_OUTPUT_MAX RCC_MAX_FREQUENCY /*!< Frequency max for PLL2 output, in Hz */ + +/* Defines used for HSE range */ +#define UTILS_HSE_FREQUENCY_MIN RCC_HSE_MIN /*!< Frequency min for HSE frequency, in Hz */ +#define UTILS_HSE_FREQUENCY_MAX RCC_HSE_MAX /*!< Frequency max for HSE frequency, in Hz */ + +/* Defines used for FLASH latency according to HCLK Frequency */ +#if defined(FLASH_ACR_LATENCY) +#define UTILS_LATENCY1_FREQ 24000000U /*!< SYSCLK frequency to set FLASH latency 1 */ +#define UTILS_LATENCY2_FREQ 48000000U /*!< SYSCLK frequency to set FLASH latency 2 */ +#else +/*!< No Latency Configuration in this device */ +#endif +/** + * @} + */ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Private_Macros + * @{ + */ +#define IS_LL_UTILS_SYSCLK_DIV(__VALUE__) (((__VALUE__) == LL_RCC_SYSCLK_DIV_1) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_2) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_4) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_8) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_16) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_64) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_128) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_256) \ + || ((__VALUE__) == LL_RCC_SYSCLK_DIV_512)) + +#define IS_LL_UTILS_APB1_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB1_DIV_1) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_2) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_4) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_8) \ + || ((__VALUE__) == LL_RCC_APB1_DIV_16)) + +#define IS_LL_UTILS_APB2_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB2_DIV_1) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_2) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_4) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_8) \ + || ((__VALUE__) == LL_RCC_APB2_DIV_16)) + +#if defined(RCC_CFGR_PLLMULL6_5) +#define IS_LL_UTILS_PLLMUL_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLL_MUL_4) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_5) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_6) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_7) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_8) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_9) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_6_5)) +#else +#define IS_LL_UTILS_PLLMUL_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLL_MUL_2) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_3) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_4) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_5) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_6) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_7) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_8) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_9) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_10) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_11) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_12) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_13) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_14) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_15) \ + || ((__VALUE__) == LL_RCC_PLL_MUL_16)) +#endif /* RCC_CFGR_PLLMULL6_5 */ + +#if defined(RCC_CFGR2_PREDIV1) +#define IS_LL_UTILS_PREDIV_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PREDIV_DIV_1) || ((__VALUE__) == LL_RCC_PREDIV_DIV_2) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_3) || ((__VALUE__) == LL_RCC_PREDIV_DIV_4) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_5) || ((__VALUE__) == LL_RCC_PREDIV_DIV_6) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_7) || ((__VALUE__) == LL_RCC_PREDIV_DIV_8) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_9) || ((__VALUE__) == LL_RCC_PREDIV_DIV_10) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_11) || ((__VALUE__) == LL_RCC_PREDIV_DIV_12) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_13) || ((__VALUE__) == LL_RCC_PREDIV_DIV_14) || \ + ((__VALUE__) == LL_RCC_PREDIV_DIV_15) || ((__VALUE__) == LL_RCC_PREDIV_DIV_16)) +#else +#define IS_LL_UTILS_PREDIV_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PREDIV_DIV_1) || ((__VALUE__) == LL_RCC_PREDIV_DIV_2)) +#endif /*RCC_PREDIV1_DIV_2_16_SUPPORT*/ + +#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((__VALUE__) <= UTILS_PLL_OUTPUT_MAX) + +#if defined(RCC_PLL2_SUPPORT) +#define IS_LL_UTILS_PLL2MUL_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLL2_MUL_8) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_9) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_10) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_11) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_12) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_13) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_14) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_16) \ + || ((__VALUE__) == LL_RCC_PLL2_MUL_20)) + +#define IS_LL_UTILS_PREDIV2_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_1) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_2) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_3) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_4) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_5) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_6) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_7) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_8) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_9) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_10) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_11) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_12) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_13) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_14) || \ + ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_15) || ((__VALUE__) == LL_RCC_HSE_PREDIV2_DIV_16)) + +#define IS_LL_UTILS_PLL2_FREQUENCY(__VALUE__) ((__VALUE__) <= UTILS_PLL2_OUTPUT_MAX) +#endif /* RCC_PLL2_SUPPORT */ + +#define IS_LL_UTILS_HSE_BYPASS(__STATE__) (((__STATE__) == LL_UTILS_HSEBYPASS_ON) \ + || ((__STATE__) == LL_UTILS_HSEBYPASS_OFF)) + +#define IS_LL_UTILS_HSE_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) >= UTILS_HSE_FREQUENCY_MIN) && ((__FREQUENCY__) <= UTILS_HSE_FREQUENCY_MAX)) +/** + * @} + */ +/* Private function prototypes -----------------------------------------------*/ +/** @defgroup UTILS_LL_Private_Functions UTILS Private functions + * @{ + */ +static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct); +static ErrorStatus UTILS_PLL_HSE_ConfigSystemClock(uint32_t PLL_InputFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +#if defined(RCC_PLL2_SUPPORT) +static uint32_t UTILS_GetPLL2OutputFrequency(uint32_t PLL2_InputFrequency, + LL_UTILS_PLLInitTypeDef *UTILS_PLL2InitStruct); +#endif /* RCC_PLL2_SUPPORT */ +static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); +static ErrorStatus UTILS_PLL_IsBusy(void); +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup UTILS_LL_Exported_Functions + * @{ + */ + +/** @addtogroup UTILS_LL_EF_DELAY + * @{ + */ + +/** + * @brief This function configures the Cortex-M SysTick source to have 1ms time base. + * @note When a RTOS is used, it is recommended to avoid changing the Systick + * configuration by calling this function, for a delay use rather osDelay RTOS service. + * @param HCLKFrequency HCLK frequency in Hz + * @note HCLK frequency can be calculated thanks to RCC helper macro or function @ref LL_RCC_GetSystemClocksFreq + * @retval None + */ +void LL_Init1msTick(uint32_t HCLKFrequency) +{ + /* Use frequency provided in argument */ + LL_InitTick(HCLKFrequency, 1000U); +} + +/** + * @brief This function provides accurate delay (in milliseconds) based + * on SysTick counter flag + * @note When a RTOS is used, it is recommended to avoid using blocking delay + * and use rather osDelay service. + * @note To respect 1ms timebase, user should call @ref LL_Init1msTick function which + * will configure Systick to 1ms + * @param Delay specifies the delay time length, in milliseconds. + * @retval None + */ +void LL_mDelay(uint32_t Delay) +{ + __IO uint32_t tmp = SysTick->CTRL; /* Clear the COUNTFLAG first */ + /* Add this code to indicate that local variable is not used */ + ((void)tmp); + + /* Add a period to guaranty minimum wait */ + if (Delay < LL_MAX_DELAY) + { + Delay++; + } + + while (Delay) + { + if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) + { + Delay--; + } + } +} + +/** + * @} + */ + +/** @addtogroup UTILS_EF_SYSTEM + * @brief System Configuration functions + * + @verbatim + =============================================================================== + ##### System Configuration functions ##### + =============================================================================== + [..] + System, AHB and APB buses clocks configuration + + (+) The maximum frequency of the SYSCLK, HCLK, PCLK1 and PCLK2 is RCC_MAX_FREQUENCY Hz. + @endverbatim + @internal + Depending on the SYSCLK frequency, the flash latency should be adapted accordingly: + (++) +-----------------------------------------------+ + (++) | Latency | SYSCLK clock frequency (MHz) | + (++) |---------------|-------------------------------| + (++) |0WS(1CPU cycle)| 0 < SYSCLK <= 24 | + (++) |---------------|-------------------------------| + (++) |1WS(2CPU cycle)| 24 < SYSCLK <= 48 | + (++) |---------------|-------------------------------| + (++) |2WS(3CPU cycle)| 48 < SYSCLK <= 72 | + (++) +-----------------------------------------------+ + @endinternal + * @{ + */ + +/** + * @brief This function sets directly SystemCoreClock CMSIS variable. + * @note Variable can be calculated also through SystemCoreClockUpdate function. + * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) + * @retval None + */ +void LL_SetSystemCoreClock(uint32_t HCLKFrequency) +{ + /* HCLK clock frequency */ + SystemCoreClock = HCLKFrequency; +} + +/** + * @brief Update number of Flash wait states in line with new frequency and current + voltage range. + * @param Frequency SYSCLK frequency + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Latency has been modified + * - ERROR: Latency cannot be modified + */ +#if defined(FLASH_ACR_LATENCY) +ErrorStatus LL_SetFlashLatency(uint32_t Frequency) +{ + uint32_t timeout; + uint32_t getlatency; + uint32_t latency = LL_FLASH_LATENCY_0; /* default value 0WS */ + ErrorStatus status = SUCCESS; + + /* Frequency cannot be equal to 0 */ + if (Frequency == 0U) + { + status = ERROR; + } + else + { + if (Frequency > UTILS_LATENCY2_FREQ) + { + /* 48 < SYSCLK <= 72 => 2WS (3 CPU cycles) */ + latency = LL_FLASH_LATENCY_2; + } + else + { + if (Frequency > UTILS_LATENCY1_FREQ) + { + /* 24 < SYSCLK <= 48 => 1WS (2 CPU cycles) */ + latency = LL_FLASH_LATENCY_1; + } + else + { + /* else SYSCLK < 24MHz default LL_FLASH_LATENCY_0 0WS */ + latency = LL_FLASH_LATENCY_0; + } + } + + if (status != ERROR) + { + LL_FLASH_SetLatency(latency); + + /* Check that the new number of wait states is taken into account to access the Flash + memory by reading the FLASH_ACR register */ + timeout = 2; + do + { + /* Wait for Flash latency to be updated */ + getlatency = LL_FLASH_GetLatency(); + timeout--; + } + while ((getlatency != latency) && (timeout > 0)); + + if (getlatency != latency) + { + status = ERROR; + } + else + { + status = SUCCESS; + } + } + } + + return status; +} +#endif /* FLASH_ACR_LATENCY */ + +/** + * @brief This function configures system clock with HSI as clock source of the PLL + * @note The application need to ensure that PLL is disabled. + * @note Function is based on the following formula: + * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) + * - PREDIV: Set to 2 for few devices + * - PLLMUL: The application software must set correctly the PLL multiplication factor to + * not exceed 72MHz + * @note FLASH latency can be modified through this function. + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Max frequency configuration done + * - ERROR: Max frequency configuration not done + */ +ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t pllfreq = 0U; + + /* Check if one of the PLL is enabled */ + if (UTILS_PLL_IsBusy() == SUCCESS) + { +#if defined(RCC_PLLSRC_PREDIV1_SUPPORT) + /* Check PREDIV value */ + assert_param(IS_LL_UTILS_PREDIV_VALUE(UTILS_PLLInitStruct->PLLDiv)); +#else + /* Force PREDIV value to 2 */ + UTILS_PLLInitStruct->Prediv = LL_RCC_PREDIV_DIV_2; +#endif /*RCC_PLLSRC_PREDIV1_SUPPORT*/ + /* Calculate the new PLL output frequency */ + pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct); + + /* Enable HSI if not enabled */ + if (LL_RCC_HSI_IsReady() != 1U) + { + LL_RCC_HSI_Enable(); + while (LL_RCC_HSI_IsReady() != 1U) + { + /* Wait for HSI ready */ + } + } + + /* Configure PLL */ + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI_DIV_2, UTILS_PLLInitStruct->PLLMul); + + /* Enable PLL and switch system clock to PLL */ + status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); + } + else + { + /* Current PLL configuration cannot be modified */ + status = ERROR; + } + + return status; +} + +/** + * @brief This function configures system clock with HSE as clock source of the PLL + * @note The application need to ensure that PLL is disabled. + * @note Function is based on the following formula: + * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) + * - PREDIV: Set to 2 for few devices + * - PLLMUL: The application software must set correctly the PLL multiplication factor to + * not exceed @ref UTILS_PLL_OUTPUT_MAX + * @note FLASH latency can be modified through this function. + * @param HSEFrequency Value between Min_Data = RCC_HSE_MIN and Max_Data = RCC_HSE_MAX + * @param HSEBypass This parameter can be one of the following values: + * @arg @ref LL_UTILS_HSEBYPASS_ON + * @arg @ref LL_UTILS_HSEBYPASS_OFF + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Max frequency configuration done + * - ERROR: Max frequency configuration not done + */ +ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t pllfrequency = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_HSE_FREQUENCY(HSEFrequency)); + assert_param(IS_LL_UTILS_HSE_BYPASS(HSEBypass)); + assert_param(IS_LL_UTILS_PREDIV_VALUE(UTILS_PLLInitStruct->Prediv)); + + /* Calculate the new PLL output frequency */ + pllfrequency = UTILS_GetPLLOutputFrequency(HSEFrequency, UTILS_PLLInitStruct); + + /* Enable HSE if not enabled */ + status = UTILS_PLL_HSE_ConfigSystemClock(HSEFrequency, HSEBypass, UTILS_PLLInitStruct, UTILS_ClkInitStruct); + + /* Check if HSE is not enabled*/ + if (status == SUCCESS) + { + /* Configure PLL */ + LL_RCC_PLL_ConfigDomain_SYS((LL_RCC_PLLSOURCE_HSE | UTILS_PLLInitStruct->Prediv), UTILS_PLLInitStruct->PLLMul); + + /* Enable PLL and switch system clock to PLL */ + status = UTILS_EnablePLLAndSwitchSystem(pllfrequency, UTILS_ClkInitStruct); + } + + return status; +} + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief This function configures system clock with HSE as clock source of the PLL, via PLL2 + * @note The application need to ensure that PLL and PLL2 are disabled. + * @note Function is based on the following formula: + * - PLL output frequency = ((((HSE frequency / PREDIV2) * PLL2MUL) / PREDIV) * PLLMUL) + * - PREDIV, PLLMUL, PREDIV2, PLL2MUL: The application software must set correctly the + * PLL multiplication factor to not exceed @ref UTILS_PLL_OUTPUT_MAX + * @note FLASH latency can be modified through this function. + * @param HSEFrequency Value between Min_Data = RCC_HSE_MIN and Max_Data = RCC_HSE_MAX + * @param HSEBypass This parameter can be one of the following values: + * @arg @ref LL_UTILS_HSEBYPASS_ON + * @arg @ref LL_UTILS_HSEBYPASS_OFF + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_PLL2InitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL2. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: Max frequency configuration done + * - ERROR: Max frequency configuration not done + */ +ErrorStatus LL_PLL_ConfigSystemClock_PLL2(uint32_t HSEFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_PLLInitTypeDef *UTILS_PLL2InitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + uint32_t pllfrequency = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_HSE_FREQUENCY(HSEFrequency)); + assert_param(IS_LL_UTILS_HSE_BYPASS(HSEBypass)); + assert_param(IS_LL_UTILS_PREDIV_VALUE(UTILS_PLLInitStruct->Prediv)); + assert_param(IS_LL_UTILS_PREDIV2_VALUE(UTILS_PLL2InitStruct->Prediv)); + + /* Calculate the new PLL output frequency */ + pllfrequency = UTILS_GetPLLOutputFrequency(HSEFrequency, UTILS_PLLInitStruct); + + /* Enable HSE if not enabled */ + status = UTILS_PLL_HSE_ConfigSystemClock(HSEFrequency, HSEBypass, UTILS_PLLInitStruct, UTILS_ClkInitStruct); + + /* Check if HSE is not enabled*/ + if (status == SUCCESS) + { + /* Configure PLL */ + LL_RCC_PLL_ConfigDomain_PLL2(UTILS_PLL2InitStruct->Prediv, UTILS_PLL2InitStruct->PLLMul); + LL_RCC_PLL_ConfigDomain_SYS((LL_RCC_PLLSOURCE_PLL2 | UTILS_PLLInitStruct->Prediv), UTILS_PLLInitStruct->PLLMul); + + /* Calculate the new PLL output frequency */ + pllfrequency = UTILS_GetPLL2OutputFrequency(pllfrequency, UTILS_PLL2InitStruct); + + /* Enable PLL and switch system clock to PLL */ + status = UTILS_EnablePLLAndSwitchSystem(pllfrequency, UTILS_ClkInitStruct); + } + + return status; +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup UTILS_LL_Private_Functions + * @{ + */ +/** + * @brief Function to check that PLL can be modified + * @param PLL_InputFrequency PLL input frequency (in Hz) + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @retval PLL output frequency (in Hz) + */ +static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct) +{ + uint32_t pllfreq = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_PLLMUL_VALUE(UTILS_PLLInitStruct->PLLMul)); + + /* Check different PLL parameters according to RM */ +#if defined (RCC_CFGR2_PREDIV1) + pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / (UTILS_PLLInitStruct->Prediv + 1U), UTILS_PLLInitStruct->PLLMul); +#else + pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / ((UTILS_PLLInitStruct->Prediv >> RCC_CFGR_PLLXTPRE_Pos) + 1U), UTILS_PLLInitStruct->PLLMul); +#endif /*RCC_CFGR2_PREDIV1SRC*/ + assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq)); + + return pllfreq; +} + +/** + * @brief This function enable the HSE when it is used by PLL or PLL2 + * @note The application need to ensure that PLL is disabled. + * @param HSEFrequency Value between Min_Data = RCC_HSE_MIN and Max_Data = RCC_HSE_MAX + * @param HSEBypass This parameter can be one of the following values: + * @arg @ref LL_UTILS_HSEBYPASS_ON + * @arg @ref LL_UTILS_HSEBYPASS_OFF + * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: HSE configuration done + * - ERROR: HSE configuration not done + */ +static ErrorStatus UTILS_PLL_HSE_ConfigSystemClock(uint32_t PLL_InputFrequency, uint32_t HSEBypass, + LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, + LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; + + /* Check if one of the PLL is enabled */ + if (UTILS_PLL_IsBusy() == SUCCESS) + { + /* Enable HSE if not enabled */ + if (LL_RCC_HSE_IsReady() != 1U) + { + /* Check if need to enable HSE bypass feature or not */ + if (HSEBypass == LL_UTILS_HSEBYPASS_ON) + { + LL_RCC_HSE_EnableBypass(); + } + else + { + LL_RCC_HSE_DisableBypass(); + } + + /* Enable HSE */ + LL_RCC_HSE_Enable(); + while (LL_RCC_HSE_IsReady() != 1U) + { + /* Wait for HSE ready */ + } + } + } + else + { + /* Current PLL configuration cannot be modified */ + status = ERROR; + } + + return status; +} + +#if defined(RCC_PLL2_SUPPORT) +/** + * @brief Function to check that PLL2 can be modified + * @param PLL2_InputFrequency PLL2 input frequency (in Hz) + * @param UTILS_PLL2InitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains + * the configuration information for the PLL. + * @retval PLL2 output frequency (in Hz) + */ +static uint32_t UTILS_GetPLL2OutputFrequency(uint32_t PLL2_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLL2InitStruct) +{ + uint32_t pll2freq = 0U; + + /* Check the parameters */ + assert_param(IS_LL_UTILS_PLL2MUL_VALUE(UTILS_PLL2InitStruct->PLLMul)); + assert_param(IS_LL_UTILS_PREDIV2_VALUE(UTILS_PLL2InitStruct->Prediv)); + + /* Check different PLL2 parameters according to RM */ + pll2freq = __LL_RCC_CALC_PLL2CLK_FREQ(PLL2_InputFrequency, UTILS_PLL2InitStruct->PLLMul, UTILS_PLL2InitStruct->Prediv); + assert_param(IS_LL_UTILS_PLL2_FREQUENCY(pll2freq)); + + return pll2freq; +} +#endif /* RCC_PLL2_SUPPORT */ + +/** + * @brief Function to check that PLL can be modified + * @retval An ErrorStatus enumeration value: + * - SUCCESS: PLL modification can be done + * - ERROR: PLL is busy + */ +static ErrorStatus UTILS_PLL_IsBusy(void) +{ + ErrorStatus status = SUCCESS; + + /* Check if PLL is busy*/ + if (LL_RCC_PLL_IsReady() != 0U) + { + /* PLL configuration cannot be modified */ + status = ERROR; + } +#if defined(RCC_PLL2_SUPPORT) + /* Check if PLL2 is busy*/ + if (LL_RCC_PLL2_IsReady() != 0U) + { + /* PLL2 configuration cannot be modified */ + status = ERROR; + } +#endif /* RCC_PLL2_SUPPORT */ + +#if defined(RCC_PLLI2S_SUPPORT) + /* Check if PLLI2S is busy*/ + if (LL_RCC_PLLI2S_IsReady() != 0U) + { + /* PLLI2S configuration cannot be modified */ + status = ERROR; + } +#endif /* RCC_PLLI2S_SUPPORT */ + + return status; +} + +/** + * @brief Function to enable PLL and switch system clock to PLL + * @param SYSCLK_Frequency SYSCLK frequency + * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains + * the configuration information for the BUS prescalers. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: No problem to switch system to PLL + * - ERROR: Problem to switch system to PLL + */ +static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct) +{ + ErrorStatus status = SUCCESS; +#if defined(FLASH_ACR_LATENCY) + uint32_t sysclk_frequency_current = 0U; +#endif /* FLASH_ACR_LATENCY */ + + assert_param(IS_LL_UTILS_SYSCLK_DIV(UTILS_ClkInitStruct->AHBCLKDivider)); + assert_param(IS_LL_UTILS_APB1_DIV(UTILS_ClkInitStruct->APB1CLKDivider)); + assert_param(IS_LL_UTILS_APB2_DIV(UTILS_ClkInitStruct->APB2CLKDivider)); + +#if defined(FLASH_ACR_LATENCY) + /* Calculate current SYSCLK frequency */ + sysclk_frequency_current = (SystemCoreClock << AHBPrescTable[LL_RCC_GetAHBPrescaler() >> RCC_CFGR_HPRE_Pos]); +#endif /* FLASH_ACR_LATENCY */ + + /* Increasing the number of wait states because of higher CPU frequency */ +#if defined (FLASH_ACR_LATENCY) + if (sysclk_frequency_current < SYSCLK_Frequency) + { + /* Set FLASH latency to highest latency */ + status = LL_SetFlashLatency(SYSCLK_Frequency); + } +#endif /* FLASH_ACR_LATENCY */ + + /* Update system clock configuration */ + if (status == SUCCESS) + { +#if defined(RCC_PLL2_SUPPORT) + if (LL_RCC_PLL_GetMainSource() != LL_RCC_PLLSOURCE_HSI_DIV_2) + { + /* Enable PLL2 */ + LL_RCC_PLL2_Enable(); + while (LL_RCC_PLL2_IsReady() != 1U) + { + /* Wait for PLL2 ready */ + } + } +#endif /* RCC_PLL2_SUPPORT */ + /* Enable PLL */ + LL_RCC_PLL_Enable(); + while (LL_RCC_PLL_IsReady() != 1U) + { + /* Wait for PLL ready */ + } + + /* Sysclk activation on the main PLL */ + LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider); + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + { + /* Wait for system clock switch to PLL */ + } + + /* Set APB1 & APB2 prescaler*/ + LL_RCC_SetAPB1Prescaler(UTILS_ClkInitStruct->APB1CLKDivider); + LL_RCC_SetAPB2Prescaler(UTILS_ClkInitStruct->APB2CLKDivider); + } + + /* Decreasing the number of wait states because of lower CPU frequency */ +#if defined (FLASH_ACR_LATENCY) + if (sysclk_frequency_current > SYSCLK_Frequency) + { + /* Set FLASH latency to lowest latency */ + status = LL_SetFlashLatency(SYSCLK_Frequency); + } +#endif /* FLASH_ACR_LATENCY */ + + /* Update SystemCoreClock variable */ + if (status == SUCCESS) + { + LL_SetSystemCoreClock(__LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, UTILS_ClkInitStruct->AHBCLKDivider)); + } + + return status; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/SEW-EXA1/SEW-EXA1.ioc b/SEW-EXA1/SEW-EXA1.ioc new file mode 100644 index 0000000..5bd71f8 --- /dev/null +++ b/SEW-EXA1/SEW-EXA1.ioc @@ -0,0 +1,395 @@ +#MicroXplorer Configuration settings - do not modify +CAN.ABOM=ENABLE +CAN.BS1=CAN_BS1_14TQ +CAN.BS2=CAN_BS2_3TQ +CAN.CalculateBaudRate=500000 +CAN.CalculateTimeBit=1999.99 +CAN.CalculateTimeQuantum=111.11111111111111 +CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,SJW,ABOM,NART,BS2 +CAN.NART=ENABLE +CAN.Prescaler=4 +CAN.SJW=CAN_SJW_2TQ +File.Version=6 +GPIO.groupedBy=Group By Peripherals +KeepUserPlacement=false +Mcu.Family=STM32F1 +Mcu.IP0=CAN +Mcu.IP1=NVIC +Mcu.IP2=RCC +Mcu.IP3=SYS +Mcu.IP4=TIM1 +Mcu.IP5=USART1 +Mcu.IP6=USART2 +Mcu.IP7=USART3 +Mcu.IPNb=8 +Mcu.Name=STM32F103R(C-D-E)Tx +Mcu.Package=LQFP64 +Mcu.Pin0=PC13-TAMPER-RTC +Mcu.Pin1=PC14-OSC32_IN +Mcu.Pin10=PA5 +Mcu.Pin11=PA6 +Mcu.Pin12=PA7 +Mcu.Pin13=PC4 +Mcu.Pin14=PC5 +Mcu.Pin15=PB0 +Mcu.Pin16=PB1 +Mcu.Pin17=PB10 +Mcu.Pin18=PB11 +Mcu.Pin19=PB12 +Mcu.Pin2=PD0-OSC_IN +Mcu.Pin20=PB13 +Mcu.Pin21=PB14 +Mcu.Pin22=PB15 +Mcu.Pin23=PC6 +Mcu.Pin24=PC7 +Mcu.Pin25=PC8 +Mcu.Pin26=PC9 +Mcu.Pin27=PA8 +Mcu.Pin28=PA9 +Mcu.Pin29=PA10 +Mcu.Pin3=PD1-OSC_OUT +Mcu.Pin30=PA11 +Mcu.Pin31=PA12 +Mcu.Pin32=PA13 +Mcu.Pin33=PA14 +Mcu.Pin34=PA15 +Mcu.Pin35=PC10 +Mcu.Pin36=PC11 +Mcu.Pin37=PC12 +Mcu.Pin38=PD2 +Mcu.Pin39=PB3 +Mcu.Pin4=PC2 +Mcu.Pin40=PB4 +Mcu.Pin41=PB5 +Mcu.Pin42=PB6 +Mcu.Pin43=PB7 +Mcu.Pin44=PB8 +Mcu.Pin45=PB9 +Mcu.Pin46=VP_SYS_VS_Systick +Mcu.Pin47=VP_TIM1_VS_ClockSourceINT +Mcu.Pin5=PA0-WKUP +Mcu.Pin6=PA1 +Mcu.Pin7=PA2 +Mcu.Pin8=PA3 +Mcu.Pin9=PA4 +Mcu.PinsNb=48 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32F103RCTx +MxCube.Version=6.1.0 +MxDb.Version=DB.6.0.10 +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.EXTI15_10_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.ForceEnableDMAVector=true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true +NVIC.TIM1_BRK_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USB_HP_CAN1_TX_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USB_LP_CAN1_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +PA0-WKUP.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PA0-WKUP.GPIO_Label=OUTPWM2 +PA0-WKUP.GPIO_PuPd=GPIO_PULLUP +PA0-WKUP.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA0-WKUP.Locked=true +PA0-WKUP.PinState=GPIO_PIN_SET +PA0-WKUP.Signal=GPIO_Output +PA1.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PA1.GPIO_Label=RS485_2_EN +PA1.GPIO_PuPd=GPIO_PULLUP +PA1.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA1.Locked=true +PA1.PinState=GPIO_PIN_RESET +PA1.Signal=GPIO_Output +PA10.GPIOParameters=GPIO_Label +PA10.GPIO_Label=ZP +PA10.Locked=true +PA10.Signal=GPXTI10 +PA11.Locked=true +PA11.Mode=CAN_Activate +PA11.Signal=CAN_RX +PA12.Locked=true +PA12.Mode=CAN_Activate +PA12.Signal=CAN_TX +PA13.Locked=true +PA13.Mode=Serial_Wire +PA13.Signal=SYS_JTMS-SWDIO +PA14.Locked=true +PA14.Mode=Serial_Wire +PA14.Signal=SYS_JTCK-SWCLK +PA15.GPIOParameters=GPIO_Label +PA15.GPIO_Label=INPUT8 +PA15.Locked=true +PA15.Signal=GPIO_Input +PA2.Locked=true +PA2.Mode=Asynchronous +PA2.Signal=USART2_TX +PA3.Locked=true +PA3.Mode=Asynchronous +PA3.Signal=USART2_RX +PA4.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label +PA4.GPIO_Label=MT_DIR +PA4.GPIO_PuPd=GPIO_PULLUP +PA4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA4.Locked=true +PA4.Signal=GPIO_Output +PA5.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label +PA5.GPIO_Label=MT_STEP +PA5.GPIO_PuPd=GPIO_PULLUP +PA5.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA5.Locked=true +PA5.Signal=GPIO_Output +PA6.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label +PA6.GPIO_Label=MT_SON +PA6.GPIO_PuPd=GPIO_PULLUP +PA6.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA6.Locked=true +PA6.Signal=GPIO_Output +PA7.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PA7.GPIO_Label=OUTPUT1 +PA7.GPIO_PuPd=GPIO_PULLUP +PA7.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA7.Locked=true +PA7.PinState=GPIO_PIN_SET +PA7.Signal=GPIO_Output +PA8.GPIOParameters=GPIO_Label +PA8.GPIO_Label=AP +PA8.Locked=true +PA8.Signal=GPXTI8 +PA9.GPIOParameters=GPIO_Label +PA9.GPIO_Label=BP +PA9.Locked=true +PA9.Signal=GPXTI9 +PB0.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PB0.GPIO_Label=OUTPUT4 +PB0.GPIO_PuPd=GPIO_PULLUP +PB0.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB0.Locked=true +PB0.PinState=GPIO_PIN_SET +PB0.Signal=GPIO_Output +PB1.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label +PB1.GPIO_Label=RS485_EN +PB1.GPIO_PuPd=GPIO_PULLUP +PB1.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB1.Locked=true +PB1.Signal=GPIO_Output +PB10.Locked=true +PB10.Mode=Asynchronous +PB10.Signal=USART3_TX +PB11.Locked=true +PB11.Mode=Asynchronous +PB11.Signal=USART3_RX +PB12.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PB12.GPIO_Label=OUTPUT5 +PB12.GPIO_PuPd=GPIO_PULLUP +PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB12.Locked=true +PB12.PinState=GPIO_PIN_SET +PB12.Signal=GPIO_Output +PB13.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PB13.GPIO_Label=OUTPUT6 +PB13.GPIO_PuPd=GPIO_PULLUP +PB13.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB13.Locked=true +PB13.PinState=GPIO_PIN_SET +PB13.Signal=GPIO_Output +PB14.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PB14.GPIO_Label=OUTPUT7 +PB14.GPIO_PuPd=GPIO_PULLUP +PB14.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB14.Locked=true +PB14.PinState=GPIO_PIN_SET +PB14.Signal=GPIO_Output +PB15.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP +PB15.GPIO_Label=OUTPUT8 +PB15.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP +PB15.GPIO_PuPd=GPIO_PULLUP +PB15.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PB15.Locked=true +PB15.PinState=GPIO_PIN_SET +PB15.Signal=GPIO_Output +PB3.GPIOParameters=GPIO_Label +PB3.GPIO_Label=INPUT3 +PB3.Locked=true +PB3.Signal=GPIO_Input +PB4.GPIOParameters=GPIO_Label +PB4.GPIO_Label=INPUT2 +PB4.Locked=true +PB4.Signal=GPIO_Input +PB5.GPIOParameters=GPIO_Label +PB5.GPIO_Label=INPUT1 +PB5.Locked=true +PB5.Signal=GPIO_Input +PB6.Locked=true +PB6.Mode=Asynchronous +PB6.Signal=USART1_TX +PB7.Locked=true +PB7.Mode=Asynchronous +PB7.Signal=USART1_RX +PB8.GPIOParameters=GPIO_Label +PB8.GPIO_Label=SW4 +PB8.Locked=true +PB8.Signal=GPIO_Input +PB9.GPIOParameters=GPIO_Label +PB9.GPIO_Label=CAN_ZP +PB9.Locked=true +PB9.Signal=GPIO_Input +PC10.GPIOParameters=GPIO_Label +PC10.GPIO_Label=INPUT7 +PC10.Locked=true +PC10.Signal=GPIO_Input +PC11.GPIOParameters=GPIO_Label +PC11.GPIO_Label=INPUT6 +PC11.Locked=true +PC11.Signal=GPIO_Input +PC12.GPIOParameters=GPIO_Label +PC12.GPIO_Label=INPUT5 +PC12.Locked=true +PC12.Signal=GPIO_Input +PC13-TAMPER-RTC.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PC13-TAMPER-RTC.GPIO_Label=ERR_LED +PC13-TAMPER-RTC.GPIO_PuPd=GPIO_PULLUP +PC13-TAMPER-RTC.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC13-TAMPER-RTC.Locked=true +PC13-TAMPER-RTC.PinState=GPIO_PIN_RESET +PC13-TAMPER-RTC.Signal=GPIO_Output +PC14-OSC32_IN.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PC14-OSC32_IN.GPIO_Label=SYS_LED +PC14-OSC32_IN.GPIO_PuPd=GPIO_PULLUP +PC14-OSC32_IN.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC14-OSC32_IN.Locked=true +PC14-OSC32_IN.PinState=GPIO_PIN_RESET +PC14-OSC32_IN.Signal=GPIO_Output +PC2.GPIOParameters=GPIO_Label +PC2.GPIO_Label=CAN_MP +PC2.Locked=true +PC2.Signal=GPIO_Input +PC4.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PC4.GPIO_Label=OUTPUT2 +PC4.GPIO_PuPd=GPIO_PULLUP +PC4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC4.Locked=true +PC4.PinState=GPIO_PIN_SET +PC4.Signal=GPIO_Output +PC5.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PC5.GPIO_Label=OUTPUT3 +PC5.GPIO_PuPd=GPIO_PULLUP +PC5.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC5.Locked=true +PC5.PinState=GPIO_PIN_SET +PC5.Signal=GPIO_Output +PC6.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label +PC6.GPIO_Label=OUTPWM1 +PC6.GPIO_PuPd=GPIO_PULLUP +PC6.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PC6.Locked=true +PC6.PinState=GPIO_PIN_SET +PC6.Signal=GPIO_Output +PC7.GPIOParameters=GPIO_Label +PC7.GPIO_Label=SW1 +PC7.Locked=true +PC7.Signal=GPIO_Input +PC8.GPIOParameters=GPIO_Label +PC8.GPIO_Label=SW2 +PC8.Locked=true +PC8.Signal=GPIO_Input +PC9.GPIOParameters=GPIO_Label +PC9.GPIO_Label=SW3 +PC9.Locked=true +PC9.Signal=GPIO_Input +PD0-OSC_IN.Locked=true +PD0-OSC_IN.Mode=HSE-External-Oscillator +PD0-OSC_IN.Signal=RCC_OSC_IN +PD1-OSC_OUT.Locked=true +PD1-OSC_OUT.Mode=HSE-External-Oscillator +PD1-OSC_OUT.Signal=RCC_OSC_OUT +PD2.GPIOParameters=GPIO_Label +PD2.GPIO_Label=INPUT4 +PD2.Locked=true +PD2.Signal=GPIO_Input +PinOutPanel.RotationAngle=0 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=6 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=true +ProjectManager.DeviceId=STM32F103RCTx +ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.4 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=false +ProjectManager.HeapSize=0x200 +ProjectManager.KeepUserCode=true +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=1 +ProjectManager.MainLocation=Core/Src +ProjectManager.NoMain=false +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=SEW-EXA1.ioc +ProjectManager.ProjectName=SEW-EXA1 +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0x400 +ProjectManager.TargetToolchain=STM32CubeIDE +ProjectManager.ToolChainLocation= +ProjectManager.UnderRoot=true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-LL-true,2-SystemClock_Config-RCC-false-LL-false,3-MX_CAN_Init-CAN-false-HAL-true,4-MX_TIM1_Init-TIM1-false-LL-true,5-MX_USART1_UART_Init-USART1-false-LL-true,6-MX_USART2_UART_Init-USART2-false-LL-true,7-MX_USART3_UART_Init-USART3-false-LL-true +RCC.ADCFreqValue=36000000 +RCC.AHBFreq_Value=72000000 +RCC.APB1CLKDivider=RCC_HCLK_DIV2 +RCC.APB1Freq_Value=36000000 +RCC.APB1TimFreq_Value=72000000 +RCC.APB2Freq_Value=72000000 +RCC.APB2TimFreq_Value=72000000 +RCC.FCLKCortexFreq_Value=72000000 +RCC.FamilyName=M +RCC.HCLKFreq_Value=72000000 +RCC.I2S2Freq_Value=72000000 +RCC.I2S3Freq_Value=72000000 +RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,I2S2Freq_Value,I2S3Freq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SDIOFreq_Value,SDIOHCLKDiv2FreqValue,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value +RCC.MCOFreq_Value=72000000 +RCC.PLLCLKFreq_Value=72000000 +RCC.PLLMCOFreq_Value=36000000 +RCC.PLLMUL=RCC_PLL_MUL9 +RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.SDIOFreq_Value=72000000 +RCC.SDIOHCLKDiv2FreqValue=36000000 +RCC.SYSCLKFreq_VALUE=72000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK +RCC.TimSysFreq_Value=72000000 +RCC.USBFreq_Value=72000000 +RCC.VCOOutput2Freq_Value=8000000 +SH.GPXTI10.0=GPIO_EXTI10 +SH.GPXTI10.ConfNb=1 +SH.GPXTI8.0=GPIO_EXTI8 +SH.GPXTI8.ConfNb=1 +SH.GPXTI9.0=GPIO_EXTI9 +SH.GPXTI9.ConfNb=1 +TIM1.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE +TIM1.IPParameters=Prescaler,Period,AutoReloadPreload +TIM1.Period=33 +TIM1.Prescaler=71 +USART1.IPParameters=VirtualMode +USART1.VirtualMode=VM_ASYNC +USART2.IPParameters=VirtualMode +USART2.VirtualMode=VM_ASYNC +USART3.IPParameters=VirtualMode +USART3.VirtualMode=VM_ASYNC +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM1_VS_ClockSourceINT.Mode=Internal +VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT +board=custom +isbadioc=false diff --git a/SEW-EXA1/STM32F103RCTX_FLASH.ld b/SEW-EXA1/STM32F103RCTX_FLASH.ld new file mode 100644 index 0000000..f22c3cf --- /dev/null +++ b/SEW-EXA1/STM32F103RCTX_FLASH.ld @@ -0,0 +1,177 @@ +/** + ****************************************************************************** + * @file LinkerScript.ld + * @author Auto-generated by STM32CubeIDE + * @brief Linker script for STM32F103RCTx Device from STM32F1 series + * 256Kbytes FLASH + * 48Kbytes RAM + * + * Set heap size, stack size and stack location according + * to application requirements. + * + * Set memory bank area and size if external memory is used + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * 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 + * + ****************************************************************************** + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ + +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Memories definition */ +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +} + +/* Sections */ +SECTIONS +{ + /* The startup code into "FLASH" Rom type memory */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data into "FLASH" Rom type memory */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data into "FLASH" Rom type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >FLASH + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >FLASH + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >FLASH + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >FLASH + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >FLASH + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections into "RAM" Ram type memory */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + + } >RAM AT> FLASH + + /* Uninitialized data section into "RAM" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/SEW-EXA1/Users/App/apptasks.c b/SEW-EXA1/Users/App/apptasks.c new file mode 100644 index 0000000..2b76826 --- /dev/null +++ b/SEW-EXA1/Users/App/apptasks.c @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------- +// File Name: sewhead.c +// Brief: +// Version: 1.0.0 +// Create Date: 2024/10/17 +// Create by: W.X +// Copyright: +// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED +// All rights reserved. +// +// Modify by: W.X +// Modify Date: 2024/10/17 +//------------------------------------------------------------------------------- + +#include "apptasks.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + +#include "trigger.h" +#include "workctrl.h" + +void AppMainTask(void) +{ + InitTrigger(); // ʼʱ + + InitWorkCtrl(); // ʼ + + do + { + TriggerTask(); // + + + WorkCtrlTask(); + +#if (0) // ѭٶ + static u32 timer = 0; + static u32 temp; + static int runcount = 0; + + runcount++; + + temp = GetMsSoftTimer(); + if (temp - timer >= 1000) + { + timer = temp; + printf("run circle = %d/s\r\n", runcount); + runcount = 0; + } +#endif + + }while(1); + +} + +#endif diff --git a/SEW-EXA1/Users/App/apptasks.h b/SEW-EXA1/Users/App/apptasks.h new file mode 100644 index 0000000..cc83d55 --- /dev/null +++ b/SEW-EXA1/Users/App/apptasks.h @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------- +// File Name: apptasks.h +// Brief: +// Version: 1.1.0 +// Create Date: 2020/07/31 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2020, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2020/07/31 +//------------------------------------------------------------------------------- + +#ifndef __APPTASKS_H__ +#define __APPTASKS_H__ + +#include "config.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) + +void AppMainTask(void); + +#endif + +#endif + diff --git a/SEW-EXA1/Users/App/sewhead/sewhead.c b/SEW-EXA1/Users/App/sewhead/sewhead.c new file mode 100644 index 0000000..e6f46c4 --- /dev/null +++ b/SEW-EXA1/Users/App/sewhead/sewhead.c @@ -0,0 +1,2191 @@ +//------------------------------------------------------------------------------- +// File Name: sewhead.c +// Brief: +// Version: 1.0.0 +// Create Date: 2024/10/11 +// Create by: W.X +// Copyright: +// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED +// All rights reserved. +// +// Modify by: W.X +// Modify Date: 2024/10/17 +//------------------------------------------------------------------------------- + +#define _IN_HEADBOARD_C + +#include "sewhead.h" +#if (BOARD_USE_FOR == SEW_HEAD) + +#include "trigger.h" +#include "inout.h" +#include "debug.h" +#include "workctrl.h" +#include "shell.h" +#include "delay.h" +#include "modbus_def.h" +#include "modbus_s.h" +#include "modbus_m.h" +#include "canwork.h" +#include "para.h" + +typedef void (*PwmFunc)(void); +PwmFunc D29PwmProc = NULL; + +void RefreshOutputSta(void); +void OutputCtrl(u8 num, u8 onof); +void PwmCtrlTask(void); +void InitSTM32PwmTimer(void); +void InitSoftPwmCtrl(PwmFunc proc); +void SoftPwmIntProc(void); +void InOutStaRefreshTask(void); + +#if(CONTROL_BUS == COMM_485) +void InOutWorkTask(Rs485Cmd * pCmd); +#endif + +void ModBusCmdProcTask(Rs485Cmd * pCmd); +void RefreshElasticMoto(void); +void TopThreadBreakCheck(void); +void ModBusReceiveProc(Rs485Cmd *cmd); +int MotoMoveAsOfst(int mode, int ofst, spdCtrl *spd, int block); +void FootMotoDis(void); +void FootMotoEn(void); +void FollowEcdOutPulseOn(void); +void FollowEcdOutPulseOff(void); +void FollowEcdOutDirOn(void); +void FollowEcdOutDirOff(void); +void FootMotoToZero(void); +void CheckParasValue(void); +void PFootCtrlUp(void); +void PFootCtrlDown(void); +void PFootCtrlBack(void); +void SetMotoPosValue(u16 pos,u16 value); + +void TestAction(char * para1, char * para2); + +#define CHK_TIME_GAP 10 // ʱ, λ 100us +#define MODRSV_TIMEOUT 820 // ȡʱʱ, λΪ CHK_TIME_GAP * 100us +#define MODSEND_GAP 50 // ͺͶȡļ, λΪ CHK_TIME_GAP * 100us +//------------------------------------------------------------------------------- + +#define BUF_TAB_SIZE 1000 // С + +typedef struct +{ + u8 boardId; + u8 outputSta; + u8 inputSta; + u8 outputCtrl; + u8 pwmOutputFlag; + u8 softLockSta; +// u16 d29cmdReg[MODBUS_REG_MAX-MODBUS_REG_MIN]; + + u16 pwmCtrl; // ռձ 0~100 + u16 pwmFreq; // ʱPWMƵ + u16 pwmCount; + u32 timeCount; + u32 pwmPulsTime; + u32 startTime; // ʱ + u32 chgTime; // 仯 + u32 cmprbuf; // Ƶϵ + int workingSta; + + u32 tabIdx; // + u32 chgTimeTab[BUF_TAB_SIZE]; // + u32 curTimeTab[BUF_TAB_SIZE]; // + u8 pwmTab[BUF_TAB_SIZE]; // PWM滺 + + u8 outsta; + u8 outOtFlag; + u8 workFlag; + + u16 enable; + u16 adcvalue; + u16 thrdBreakFlag; + u16 mtWkSta[8]; + u32 outTime; + + u32 enflag; + u32 stopAngle; + u32 encoderValue; + s32 footMtPos; + + u32 followRunNum; + int followStartPPos; + int followStartNPos; + u32 followConPAng; + u32 followConNAng; + + u32 pfootFlLowPos; + + u32 followEcdEn; + u32 followCountr; + u32 followStepNum; + u32 followNumLow; + u32 followNumHigh; + int followTableIdx; + int followEcdDir; + int followEcdCheck; + int followChangeFlag; + u32 followChangeNum; + int setParasFlag; + u32 setParasTime; + int pfootSta; + + u32 pfootRunHighPos; + u32 pfootFlowPAng; // ѹŸλ + u32 pfootFlowNAng; // ѹŸ½λ + u32 pfootFlowPuls; // ѹŸ + u32 pfootRunLowPos; // ѹеλ + u32 pfootRunBackPos; // ѹлλ + s32 ecOfstValue; // ֵ + u32 pfootRunConAng; // Ƕ + //------------ + void (*FollowMotoPulseOn)(void); + void (*FollowMotoPulseOff)(void); + void (*FollowMotoSignOn)(void); + void (*FollowMotoSignOff)(void); + //------------ + + u32 thrdBreakCount; + u32 motocoordinate; + u16 headCmdReg[MODBUS_REG_MAX-MODBUS_REG_MIN]; +}HeadCtrl; + +HeadCtrl g_headCtrl; + +//------------------------------------------------------------------------------- +u8 GetBoardSwitchValue(void) +{ + u8 val = 0; + if(GetSwitch1Status() == SENSOR_ON) + { + val |= 0x01; + } + if(GetSwitch2Status() == SENSOR_ON) + { + val |= 0x02; + } + if(GetSwitch3Status() == SENSOR_ON) + { + val |= 0x04; + } + if(GetSwitch4Status() == SENSOR_ON) + { + val |= 0x08; + } + return val; +} + +// ʼ +void InitSewHeadBoard(void) +{ + memset(&g_headCtrl, 0, sizeof(HeadCtrl)); + g_headCtrl.boardId = GetBoardSwitchValue(); + + if((g_headCtrl.boardId & 0x04) == 0) + { + InitSoftPwmCtrl(PwmCtrlTask); +#if(PWM_TIMER_CTRL == 1) + g_headCtrl.pwmOutputFlag = 1; +#endif + printf("initsoftpwmctrl."); + } + +#if(CONTROL_BUS == COMM_485) +#if(COM_485_RTU == 1) + InitModbusS(COMM_USART2, B115200, '8', 'N', '1','R'); // ʼ485 +#else + if((g_headCtrl.boardId & 0x08) != 0) + { + InitModbusS(COMM_USART2, B115200, '8', 'N', '1','R'); // ʼ485 + } + else + { + InitModbusS(COMM_USART2, B115200, '8', 'N', '1','A'); // ʼ485 + } +#endif + //InitModbusS(COMM_USART1,B115200, '9', 'E', '1', 'A'); // 3,115200 + InitModbusReg(MODBUS_REG_MIN, &g_headCtrl.d29cmdReg[0], (MODBUS_REG_MAX-MODBUS_REG_MIN)); + InitModbusSCtrl(D29_BOARD_ID,30); // modbus(հʱʱ:2ms) + + RegModbusSCmdProc(ModBusCmdProcTask); // ⲿ + +#endif + InitModbus_m(0,COMM_USART3, B115200, '8', 'N', '1','R'); // ʼ485 + InitRs485Ctrl(MODRSV_TIMEOUT); + RegRsCmdProc(ModBusReceiveProc); + + CheckParasValue(); + g_headCtrl.pfootFlLowPos = g_headCtrl.pfootRunLowPos; + g_headCtrl.enflag = EN_FALG; + g_headCtrl.FollowMotoPulseOn = FollowEcdOutPulseOn; + g_headCtrl.FollowMotoPulseOff = FollowEcdOutPulseOff; + g_headCtrl.FollowMotoSignOn = FollowEcdOutDirOn; + g_headCtrl.FollowMotoSignOff = FollowEcdOutDirOff; + DelayRef(500); + FootMotoToZero(); + SetEn485OutOff(); + + AddShellCmd("KEY", "test action", TestAction); +} + + +void InitSTM32PwmTimer(void) +{ +#if(PWM_TIMER_CTRL == 1) + +#else + NVIC_InitTypeDef NVIC_InitStructure; + TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; + TIM_OCInitTypeDef TIM_TimeOCStructure; +/* ж */ + NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; /* ͨ */ + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; /* ռʽжȼ */ + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; /* Ӧʽжȼ */ + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; /* ʹж */ + NVIC_Init(&NVIC_InitStructure); +/*IO*/ + GPIO_InitTypeDef GPIO_InitStructure; + RCC_APB2PeriphClockCmd(OUT7_RCC_APB2Periph, ENABLE); + + GPIO_PinRemapConfig(GPIO_PartialRemap_TIM3,ENABLE); + + GPIO_InitStructure.GPIO_Pin = OUT6_GPIO_Pin | OUT7_GPIO_Pin; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; + +// GPIO_InitStructure.GPIO_Pin = OUT7_GPIO_Pin; +// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; +// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; + + GPIO_Init(OUT7_GPIO_PORT, &GPIO_InitStructure); + +///* ʱ */ + RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); /* ʱʱ */ + TIM_DeInit(TIM3); /* ½TimerΪȱʡֵ */ +///* ʱ */ + TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); + TIM_TimeBaseStructure.TIM_Prescaler = (72-1); /* ԤƵ */ + TIM_TimeBaseStructure.TIM_Period = (3334-1); /* Զװֵ 500usж*/ + TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; /* ʱ */ + TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; /* ϼģʽ */ + TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); /* ʼTIMx */ + + TIM_TimeOCStructure.TIM_OCMode = TIM_OCMode_PWM2; + TIM_TimeOCStructure.TIM_OCPolarity = TIM_OCPolarity_High; + TIM_TimeOCStructure.TIM_OutputState = TIM_OutputState_Enable; + TIM_TimeOCStructure.TIM_Pulse = 0; + + TIM_OC1Init(TIM3,&TIM_TimeOCStructure); + TIM_OC2Init(TIM3,&TIM_TimeOCStructure); + + TIM_CtrlPWMOutputs(TIM3,DISABLE); + + TIM_OC1PreloadConfig(TIM3,ENABLE); + TIM_OC2PreloadConfig(TIM3,ENABLE); + TIM_ARRPreloadConfig(TIM3,ENABLE); + + //TIM_ClearFlag(TIM3, TIM_FLAG_Update); /* жϱ־ */ + //TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE); /* ж */ + TIM_Cmd(TIM3, ENABLE); /* ʱ */ + +#endif +} + +void SoftPwmIntProc(void) +{ +#if(PWM_TIMER_CTRL == 1) + if (D29PwmProc != NULL) + { + D29PwmProc(); + } +#else + if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) + { + TIM_ClearITPendingBit(TIM3, TIM_IT_Update); + if (D29PwmProc != NULL) + { + D29PwmProc(); + } + } +#endif +} + +void InitSoftPwmCtrl(PwmFunc proc) +{ +// InitSTM32PwmTimer(); +#if(PWM_TIMER_CTRL == 1) +// Tim1IntProc = SoftPwmIntProc; + D29PwmProc = proc; + g_headCtrl.pwmFreq = 100; + g_headCtrl.pwmCount = 0; + g_headCtrl.pwmCtrl = 0; // ʼռձΪ0 +#else + Tim3IntProc = SoftPwmIntProc; + D29PwmProc = proc; + g_headCtrl.pwmCtrl = 0; + g_headCtrl.pwmFreq = 3334; +#endif +} + +void PwmCtrlTask(void) +{ +#if(PWM_TIMER_CTRL == 1) + if(g_headCtrl.pwmCount < g_headCtrl.pwmCtrl) + { + g_headCtrl.pwmCount ++; +// if((g_headCtrl.pwmIOSta & 0x20) != 0) + { + SetOutputPWM1On(); + SetOutputPWM2On(); + } + } + else if(g_headCtrl.pwmCount < g_headCtrl.pwmFreq) + { + g_headCtrl.pwmCount ++; + if(g_headCtrl.pwmCount >= g_headCtrl.pwmFreq) + { + g_headCtrl.pwmCount = 0; + if(g_headCtrl.timeCount != 0) + { + if(g_headCtrl.timeCount == 1) + { + g_headCtrl.pwmPulsTime = GetUsSoftTimer(); + } + + g_headCtrl.timeCount ++; + if(g_headCtrl.timeCount >= 11) + { + g_headCtrl.timeCount = 0; +// printf("puls Freq:%d.\r\n",10000000/(GetUsSoftTimer() - g_headCtrl.pwmPulsTime)); + } + } + } + SetOutputPWM1Off(); + SetOutputPWM2Off(); + } + else + { + g_headCtrl.pwmCount = 0; +// SetOutput6Off(); +// SetOutput7Off(); + } + +// g_headCtrl.timeCount ++; +// if(g_headCtrl.timeCount > 20000) +// { +// u32 ntime = 0; +// ntime = GetMsSoftTimer(); +// g_headCtrl.timeCount = 0; +// +// printf("timer init 1s,pwmCount = %d,time:%d.\r\n",g_headCtrl.pwmCount,ntime); +// } +#else +// g_headCtrl.timeCount ++; +// if(g_headCtrl.timeCount > 1000000/g_headCtrl.pwmFreq) +// { +// u32 ntime = 0; +// ntime = GetMsSoftTimer(); +// g_headCtrl.timeCount = 0; +// +// printf("timer 1s,time:%d,pwmƵ = %dHz,pwmռձ %d.\r\n",ntime,1000000/g_headCtrl.pwmFreq,g_headCtrl.pwmCtrl); +// } +#endif +} + + +void SysLedTask(void) +{ + static u32 ledsta = 0; + static u32 ledtime = 0; + if(GetMsSoftTimer10() - ledtime >= 1000) + { + if(ledsta == 0) + { + SetSysLedOn(); + ledsta = 1; + } + else + { + SetSysLedOff(); + ledsta = 0; + } + ledtime = GetMsSoftTimer10(); + } +} + + +void SewHeadBoardTask(void) +{ + //SetParasTask(); + Rs485Task(); +#if(CONTROL_BUS == COMM_485) + ModbusSTask(); +#endif + InOutStaRefreshTask(); + SysLedTask(); +} + +void ModBusReceiveProc(Rs485Cmd *cmd) +{ + if (cmd == NULL) + { + return; + } + + memcpy(g_headCtrl.mtWkSta,cmd->rddat,16); + +} + +void SendMotoCtrlCmd(u16 cmd,u16 act) +{ + Rs485Cmd ccmd; + memset(&ccmd,0,sizeof(Rs485Cmd)); + + ccmd.index = 10; + ccmd.cmd = MODBUS_WR; + ccmd.addr = cmd; + ccmd.wrdat[0] = act; + ccmd.wlen = 1; + ccmd.rlen = 0; + + AddRs485Cmd(&ccmd); +} + +void FootMotoCmdRst(void) +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_CMD_RST); +} + +void FootMotoToZero(void) +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_TO_ZERO); +// SetSTM32Moto1RealPos(0); +} + +void FootMotoDis(void) +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_DIS); +} + +void FootMotoEn(void) +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_EN); +} + +void FootMotoReset(void) +{ + SendMotoCtrlCmd(MOTO_CTRL_CMD,MOTO_RESET); +} + +void OutputStepOn(void) +{ + if(g_headCtrl.followEcdDir == 1) + { + g_headCtrl.footMtPos ++; + } + else + { + g_headCtrl.footMtPos --; + } + SetMoto1StepOn(); +} + +#define FOLLOW_TAB_NUM 6 + +int FOLLOW_TABLE[FOLLOW_TAB_NUM] = +{ + 20, + 16, + 12, + 8, + 6, + 3, +}; + +void GetFollowTableValue(u32 angle,u32 puls) +{ + int i, temp,value,followec,sum = 0; + followec = angle*1000/360; + value = followec/puls; + + for(i = 0; i= g_headCtrl.followStepNum) + { + if(g_headCtrl.followNumHigh > g_headCtrl.followRunNum) + { + g_headCtrl.followNumHigh = 0; + g_headCtrl.followNumLow = 0; + g_headCtrl.followEcdEn = 0; + return; + } + + OutputStepOn(); + g_headCtrl.followCountr = 0; + g_headCtrl.followNumHigh++; + + // + if (g_headCtrl.followTableIdx < FOLLOW_TAB_NUM && g_headCtrl.followNumHigh < FOLLOW_TAB_NUM) + { + g_headCtrl.followTableIdx++; // ˶ + g_headCtrl.followStepNum = FOLLOW_TABLE[g_headCtrl.followTableIdx]; // װµֵ + } + + // + if(g_headCtrl.followNumHigh >= g_headCtrl.followRunNum - FOLLOW_TAB_NUM) + { + if(g_headCtrl.followTableIdx <= 0) + { + g_headCtrl.followTableIdx = 0; + } + g_headCtrl.followStepNum = FOLLOW_TABLE[g_headCtrl.followTableIdx]; // װµֵ + g_headCtrl.followTableIdx--; // ˶ + } + } + } +} + +void FollowEcdOutPulseOff(void) +{ + if (g_headCtrl.followEcdEn != 0) + { + if (g_headCtrl.followCountr * 2 + 1 >= g_headCtrl.followStepNum) + { + OutputStepOff(); + g_headCtrl.followNumLow++; + } + } +} + +void FollowEcdOutDirOn(void) +{ + if (g_headCtrl.followEcdCheck != 0) + { + if (g_headCtrl.followEcdDir == 1) + { + OutputDirOn(); + } + else + { + OutputDirOff(); + } + } +} +void FollowEcdOutDirOff(void) +{ + if (g_headCtrl.followEcdCheck != 0) + { + if (g_headCtrl.followEcdDir == 1) + { + OutputDirOff(); + } + else + { + OutputDirOn(); + } + } +} + +void CheckParasValue(void) +{ + g_headCtrl.followRunNum = g_headCtrl.pfootFlowPuls; + if(g_headCtrl.followRunNum == 0) + { + g_headCtrl.followRunNum = 40; + } + g_headCtrl.followStepNum = 3; + g_headCtrl.followStartPPos = g_headCtrl.pfootFlowPAng*1000/360 + g_headCtrl.ecOfstValue; + if(g_headCtrl.followStartPPos >= 1000) + { + g_headCtrl.followStartPPos -= 1000; + } + if(g_headCtrl.followStartPPos < 0) + { + g_headCtrl.followStartPPos += 1000; + } + if(g_headCtrl.followStartPPos == 0) + { + g_headCtrl.followStartPPos = 100; + } + g_headCtrl.followStartNPos = g_headCtrl.pfootFlowNAng*1000/360 + g_headCtrl.ecOfstValue; + if(g_headCtrl.followStartNPos >= 1000) + { + g_headCtrl.followStartNPos -= 1000; + } + if(g_headCtrl.followStartNPos < 0) + { + g_headCtrl.followStartNPos += 1000; + } + if(g_headCtrl.followStartNPos == 0) + { + g_headCtrl.followStartNPos = 600; + } + g_headCtrl.pfootRunLowPos = g_headCtrl.pfootRunLowPos; + if(g_headCtrl.pfootRunLowPos == 0) + { + g_headCtrl.pfootRunLowPos = 10; + } + g_headCtrl.pfootRunBackPos = g_headCtrl.pfootRunBackPos; + if(g_headCtrl.pfootRunBackPos == 0) + { + g_headCtrl.pfootRunBackPos = 10; + } + g_headCtrl.pfootRunHighPos = g_headCtrl.pfootRunLowPos + g_headCtrl.followRunNum; + if(g_headCtrl.pfootRunHighPos == 0) + { + g_headCtrl.pfootRunHighPos = 50; + } + + g_headCtrl.followConPAng = g_headCtrl.pfootRunConAng; + if(g_headCtrl.followConPAng == 0) + { + g_headCtrl.followConPAng = 140; + } + else if(g_headCtrl.followConPAng >160) + { + g_headCtrl.followConPAng = 160; + } + + GetFollowTableValue(g_headCtrl.followConPAng,g_headCtrl.followRunNum); + //GetFollowTableValue(g_headCtrl.followConNAng,g_headCtrl.followRunNum); +} + +void SetMotoPosValue(u16 pos,u16 value) +{ + SendMotoCtrlCmd(pos,value); +} + +void PFootCtrlUp(void) +{ + //MotoMoveAsOfst(1,100,NULL,0); + //SendMotoCtrlCmd(MOTO_CTRL_TOPOS,PFOOT_HIGH_POS); + SendMotoCtrlCmd(MOTO_CTRL_TOZPOS,g_headCtrl.pfootRunHighPos); + g_headCtrl.pfootSta = 1; +} + +void PFootCtrlDown(void) +{ + //MotoMoveAsOfst(1,30,NULL,0); + //SendMotoCtrlCmd(MOTO_CTRL_TOPOS,PFOOT_LOW_POS); + SendMotoCtrlCmd(MOTO_CTRL_TOZPOS,g_headCtrl.pfootRunLowPos); + g_headCtrl.pfootSta = 2; + g_headCtrl.followRunNum = g_headCtrl.pfootRunHighPos - g_headCtrl.pfootRunLowPos; +// g_headCtrl.followChangeNum = g_headCtrl.pfootRunHighPos - g_headCtrl.pfootRunLowPos; +// if(g_headCtrl.followChangeNum != g_headCtrl.followRunNum) +// { +// g_headCtrl.followChangeFlag = 1; +// g_headCtrl.pfootFlLowPos = g_headCtrl.pfootRunLowPos; +// } +} + +void PFootCtrlBack(void) +{ + //MotoMoveAsOfst(1,g_headCtrl.pfootRunBackPos,NULL,0); + SendMotoCtrlCmd(MOTO_CTRL_TOZPOS,g_headCtrl.pfootRunBackPos); + g_headCtrl.pfootSta = 2; + g_headCtrl.followRunNum = g_headCtrl.pfootRunHighPos - g_headCtrl.pfootRunBackPos; +// g_headCtrl.followChangeNum = g_headCtrl.pfootRunHighPos - g_headCtrl.pfootRunBackPos; +// if(g_headCtrl.followChangeNum != g_headCtrl.followRunNum) +// { +// g_headCtrl.followChangeFlag = 1; +// g_headCtrl.pfootFlLowPos = g_headCtrl.pfootRunBackPos; +// } +} + +#if(CONTROL_BUS == COMM_485) +void ModBusCmdProcTask(Rs485Cmd * pCmd) +{ + Rs485Cmd rCmd; + + if (pCmd == NULL) + { + return; + } + memcpy(&rCmd, pCmd, sizeof(Rs485Cmd)); + + InOutWorkTask(pCmd); + if (rCmd.cmd == MODBUS_06WR) + { + switch (rCmd.addr) + { + case 0: + { + break; + } + + case 1: + { + if (rCmd.wrdat[0] == 1) + { + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + g_headCtrl.followEcdCheck = 1; + g_headCtrl.followEcdDir = 1; + g_headCtrl.footMtPos = GetSTM32Moto1RealPos(); + + g_headCtrl.followEcdEn = 0; + } + else + { + g_headCtrl.followEcdCheck = 0; + //g_headCtrl.pfootSta = 0; + } + break; + } + case 5: + { + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + g_headCtrl.followEcdCheck = 1; + g_headCtrl.followEcdDir = 1; + g_headCtrl.footMtPos = GetSTM32Moto1RealPos(); + //if(g_headCtrl.pfootSta == 0) + { + PFootCtrlDown(); + } + g_headCtrl.followEcdEn = 0; + break; + } + case 2: // ѹ + { + if (rCmd.wrdat[0] == 1) + { + PFootCtrlUp(); + } + else if (rCmd.wrdat[0] == 2) + { + PFootCtrlDown(); + } + else if (rCmd.wrdat[0] == 3) + { + PFootCtrlBack(); + } + g_headCtrl.followEcdEn = 0; + break; + } + + case 3: + { + g_headCtrl.followStartNPos = rCmd.wrdat[0]; + break; + } + case 4: + { + g_headCtrl.followStartPPos = rCmd.wrdat[0]; + break; + } + case 11: + { + MotoMoveAsOfst(0,(s16)rCmd.wrdat[0],NULL,0); + break; + } + case 12: + { + MotoMoveAsOfst(1,(s16)rCmd.wrdat[0],NULL,0); + break; + } + case 20: + { + if(rCmd.wrdat[0] == 0) + { + FootMotoToZero(); + } + else if(rCmd.wrdat[0] == 1) + { + FootMotoDis(); + } + else if(rCmd.wrdat[0] == 2) + { + FootMotoEn(); + } + else if(rCmd.wrdat[0] == 10) + { + FootMotoReset(); + } + else + { + FootMotoCmdRst(); + } + break; + } + case 50: // 趨ѹŹλ + { + if(rCmd.wrdat[0] == 0) + { + g_headCtrl.followChangeNum = g_headCtrl.followRunNum; + //g_headCtrl.followChangeFlag = 1; + } + else + { + g_headCtrl.followChangeNum = g_headCtrl.pfootRunHighPos - rCmd.wrdat[0]; + g_headCtrl.pfootFlLowPos = rCmd.wrdat[0]; + if(g_headCtrl.followChangeNum != g_headCtrl.followRunNum) + { + g_headCtrl.followChangeFlag = 1; + } + } + break; + } + case 100: // Уλ + { + int lpos; + lpos = rCmd.wrdat[0]*1000/36000; + g_headCtrl.ecOfstValue = g_headCtrl.encoderValue - lpos; + CheckParasValue(); + SaveD32McPara(); + break; + } + case 200: // Уλ + { + + break; + } + case 1000: // ò + { + + break; + } + + case 10: + {// + if (rCmd.wrdat[0] == 1) + { + SetOutput1On(); + } + else// if (rCmd.wrdat[0] == 2) + { + SetOutput1Off(); + } + + if (rCmd.wrdat[0] == 1) + { + SetOutput1On(); + } + else// if (rCmd.wrdat[0] == 2) + { + SetOutput1Off(); + } + break; + } + default: + break; + } + } + else if (rCmd.cmd == MODBUS_10WR) + { + g_headCtrl.pfootFlowPAng = rCmd.wrdat[0]; + g_headCtrl.pfootFlowNAng = rCmd.wrdat[1]; + g_headCtrl.pfootFlowPuls = rCmd.wrdat[2]; + g_headCtrl.pfootRunLowPos = rCmd.wrdat[3]; + g_headCtrl.pfootRunConAng = rCmd.wrdat[4]; + g_headCtrl.pfootRunBackPos = rCmd.wrdat[5]; + CheckParasValue(); + //g_headCtrl.setParasFlag = 1; + //SaveD32McPara(); + } +} +#elif (CONTROL_BUS == COMM_CAN) +//------------------------------------------------------------------------------- +// CAN  +void CanCmdProc(void) +{ + u32 exid; + int dev, tid, sid, cmd; + + if (g_workCtrl.curBdCtrl.cmdFlag != 0) + { + g_workCtrl.curBdCtrl.cmdFlag = 0; + exid = g_workCtrl.curBdCtrl.ctrlCmd.cancomm.exId.id; + + dev = GET_PRT_FROM_EXID(exid); + tid = GET_TID_FROM_EXID(exid); + sid = GET_SID_FROM_EXID(exid); + cmd = GET_CMD_FROM_EXID(exid); + + if (cmd == BN_CMD_TRAVERSE) // + { + if (dev != BN_PROTOCOL_ALL || tid != BN_ID_BROADCAST) + { + return; + } + g_workCtrl.hostId = sid; + + // ......ܴ + } + else if (cmd == BN_CMD_EXCTRL) // + { + SewHeadCommand * pCmd = (SewHeadCommand *)(&(g_workCtrl.curBdCtrl.ctrlCmd.cancomm.data.buff)); + // printf("exctrl cmd=0x%x\r\n", pCmd->headCtrl.cmd); + switch(pCmd->headCtrl.cmd) + { +#if (BOARD_USE_FOR == SEW_HEAD) + case CTRL_CMD_SEW_HEAD_CTRL: +#endif + { + switch(pCmd->headCtrl.subcmd) + { + case CTRL_SUBCMD_SEW_DISABLE : // ͷƹܹر + { + printf("ctrl func close\r\n"); + g_headCtrl.softLockSta = 1; + + break; + } + case CTRL_SUBCMD_SEW_ENABLE : // ͷƹܴ + { + printf("ctrl func en\r\n"); + g_headCtrl.softLockSta = 0; + + break; + } + case CTRL_SUBCMD_SEW_WORK_STA: // ״̬ˢ + { + u8 pwmval; + pwmval = pCmd->headCtrl.para[0]; +#if (PWM_TIMER_CTRL == 1) + if(pwmval > 0 && pwmval <= 100) + { + if(g_headCtrl.pwmCtrl != pwmval) + { + if(pwmval <= 10 && g_headCtrl.workingSta == 1) + { + printf("little clip level in working.lv:%d\r\n",pwmval); + return; + } + + g_headCtrl.pwmCount = 0; + g_headCtrl.pwmCtrl = pwmval; + +// if (g_headCtrl.cmprbuf != pwmval) +// {// ӡǷ񶪰 +// g_headCtrl.chgTime++; +// g_headCtrl.cmprbuf = pwmval; +// printf("[%d][%d]\tpwm:%d\r\n",g_headCtrl.chgTime,(GetMsSoftTimer10() - g_headCtrl.startTime + 40),pwmval); +// +// // 仯뵽 +// g_headCtrl.tabIdx = g_headCtrl.tabIdx % BUF_TAB_SIZE; +// g_headCtrl.chgTimeTab[g_headCtrl.tabIdx] = g_headCtrl.chgTime; +// g_headCtrl.curTimeTab[g_headCtrl.tabIdx] = GetMsSoftTimer10() - g_headCtrl.startTime + 40; +// g_headCtrl.pwmTab[g_headCtrl.tabIdx] = pwmval; +// g_headCtrl.tabIdx++; +// } + } + } +#endif + u8 sta = pCmd->headCtrl.para[1]; + OutputCtrl(0,sta); + break; + } + case CTRL_SUBCMD_SEW_OUTPUT_CTRL: // IO + { + u8 ionum,sta; + ionum = pCmd->headCtrl.para[0]; + //sta = rCmd.wrdat[1]; + sta = pCmd->headCtrl.para[1]; + OutputCtrl(ionum,sta); + break; + } + case CTRL_SUBCMD_SEW_ELCLIP_CTRL: // Ӽ߿ + { +#if(PWM_TIMER_CTRL == 1) + if(pCmd->headCtrl.para[0] > 0 && pCmd->headCtrl.para[0] <= g_headCtrl.pwmFreq) + { + g_headCtrl.pwmCtrl = pCmd->headCtrl.para[0]; + g_headCtrl.pwmCount = 0; + } + else + { + g_headCtrl.pwmCtrl = 0; + SetOutputPWM1Off(); + SetOutputPWM2Off(); + } +#endif + break; + } + case CTRL_SUBCMD_SEW_IN_WORK: // 빤״̬ + { + if(pCmd->headCtrl.para[0] == 0) + { + g_headCtrl.workingSta = 0; + } + else + { + g_headCtrl.workingSta = 1; + } + break; + } + case CTRL_SUBCMD_SEW_PFOOT_CTRL: // ѹŵ + { + u8 pfoot_cmd= pCmd->headCtrl.para[0]; + if(pfoot_cmd == CTRL_PFOOT_CMD_TO_ZERO) + { + FootMotoToZero(); + } + else if(pfoot_cmd == CTRL_PFOOT_CMD_DIS) + { + FootMotoDis(); + } + else if(pfoot_cmd == CTRL_PFOOT_CMD_EN) + { + FootMotoEn(); + } + else if(pfoot_cmd == CTRL_PFOOT_CMD_RESET) + { + FootMotoReset(); + } + else if (pfoot_cmd == CTRL_PFOOT_CMD_UP) + { + PFootCtrlUp(); + g_headCtrl.followEcdEn = 0; + } + else if (pfoot_cmd == CTRL_PFOOT_CMD_DOWN) + { + PFootCtrlDown(); + g_headCtrl.followEcdEn = 0; + } + else if (pfoot_cmd == CTRL_PFOOT_CMD_BACK) + { + PFootCtrlBack(); + g_headCtrl.followEcdEn = 0; + } + else + { + FootMotoCmdRst(); + } + break; + } + case CTRL_SUBCMD_SEW_PFOOT_FOLLOW_CTRL: // ѹŵ + { + if (pCmd->headCtrl.para[0] == 1) + { + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + g_headCtrl.followEcdCheck = 1; + g_headCtrl.followEcdDir = 1; +// g_headCtrl.footMtPos = GetSTM32Moto1RealPos(); + + if (pCmd->headCtrl.para[1] != 0) + { + PFootCtrlDown(); + } + + g_headCtrl.followEcdEn = 0; + } + else + { + g_headCtrl.followEcdCheck = 0; + //g_headCtrl.pfootSta = 0; + } + break; + } + + case CTRL_SUBCMD_SEW_PFOOT_SET_POS: // 趨ѹŹλ + { + if(pCmd->headCtrl.para[0] == 0) + { + g_headCtrl.followChangeNum = g_headCtrl.followRunNum; + //g_headCtrl.followChangeFlag = 1; + } + else + { + g_headCtrl.followChangeNum = g_headCtrl.pfootRunHighPos - pCmd->headCtrl.para[0]; + g_headCtrl.pfootFlLowPos = pCmd->headCtrl.para[0]; + if(g_headCtrl.followChangeNum != g_headCtrl.followRunNum) + { + g_headCtrl.followChangeFlag = 1; + } + } + break; + } + case CTRL_SUBCMD_SEW_PFOOT_SET_ECD: // Уλ + { + int lpos; + lpos = pCmd->headCtrl.para[0]*1000/36000; + g_headCtrl.ecOfstValue = g_headCtrl.encoderValue - lpos; + CheckParasValue(); + break; + } + default:break; + } + break; + } + case CTRL_CMD_SEW_HEAD_PARA: // һͷ + { +// g_pHeadPara->pfootFlowPAng = pCmd->headPara.para[0]; +// g_pHeadPara->pfootFlowNAng = pCmd->headPara.para[1]; +// g_pHeadPara->pfootFlowPuls = pCmd->headPara.para[2]; +// g_pHeadPara->pfootRunLowPos = pCmd->headPara.para[3]; +// g_pHeadPara->pfootRunConAng = pCmd->headPara.para[4]; +// g_pHeadPara->pfootRunBackPos = pCmd->headPara.para[5]; + g_HeadPara.buf[pCmd->headPara.pataId] = pCmd->headPara.paraVal; + if (pCmd->headPara.cmd != 0) + { + CheckParasValue(); + } + } + default:break; + } + } + else + { + + } + } +} +#endif + +#if (0) +int MotoNormalStop(u32 para1, u32 para2) +{ + int rslt = 0; + + + return rslt; +} + +int MotoQuickStop(u32 para1, u32 para2) +{ + int rslt = 0; + + + return rslt; +} + +int MotoMoveAsOfst(int mode, int ofst, spdCtrl *spd, int block) +{ + int rslt; + MotoCtrl mtcfg; + rslt = 0; + + memset(&mtcfg, 0, sizeof(MotoCtrl)); + + if(mode == 1) + { + ofst = ofst - GetSTM32Moto1RealPos(); + } + // ٶ + if(spd == NULL) + { + mtcfg.startPPS = 100; + mtcfg.runPPS = 200; + mtcfg.addPPSG = 10; + mtcfg.brkPPSG = 50; + } + else + { + mtcfg.startPPS = spd->stspd; + mtcfg.runPPS = spd->runspd; + mtcfg.addPPSG = spd->add; + mtcfg.brkPPSG = spd->brkadd; + } + + mtcfg.movement = ofst;// λ + mtcfg.GetNormalStop = MotoNormalStop; + mtcfg.GetQuickStop = MotoQuickStop; + mtcfg.condPara1 = 0; + mtcfg.condPara2 = 0; + mtcfg.blockRunflag = block; + mtcfg.funTestTime = 1; + mtcfg.ExecWhenRun = NULL; + mtcfg.ExecWhenStart = NULL; + mtcfg.ExecWhenStop = NULL; + + STM32Moto1Stop(); + + DelayRef(50); + + STM32Moto1Start(&mtcfg); + + return rslt; +} +#endif +// õǶȣλ0.01 +int GetAngleFromEncoder(void) +{ + int ang = g_headCtrl.encoderValue * 36000 / ENCODER_PNUM + g_headCtrl.stopAngle; + + // תΪ 0 -- 35999 + while (ang >= 36000) + { + ang -= 36000; + } + + while (ang <= -36000) + { + ang += 36000; + } + return ang; +} + + +#if(CONTROL_BUS == COMM_485) +// +void InOutWorkTask(Rs485Cmd * pCmd) +{ + Rs485Cmd rCmd; + int sendstacmd = 0; + + if (pCmd == NULL) + { + return; + } + + memcpy(&rCmd, pCmd, sizeof(Rs485Cmd)); + + rCmd.index &= 0x7f; + if (rCmd.index != D29_BOARD_ID && rCmd.index != D29_ALL_BOARD_ID) + { + return; + } + + if (rCmd.cmd == MODBUS_WR) + { + if(rCmd.addr != 0) + { + printf("get modbus cmd:%d,data:%d.\r\n",rCmd.addr,rCmd.wrdat[0]); + } + + if(rCmd.addr == 0) // IO + { + u8 ionum,sta; + ionum = 0; + +#if (STM32_MOTOS_NUM == 0 && STM32_SOFT_PWM != 0) + if (D29_BOARD_ID == 1) + {// ͬˢPWMռձ + u8 pwmval; + pwmval = (rCmd.wrdat[0] & 0xFF00) >> 8; + if ((pwmval & 0x80) == 0x80) // յPWMռձȱ־ + { + pwmval = pwmval & 0x7F; +#if (PWM_TIMER_CTRL == 1) + if(pwmval > 0 && pwmval <= 100) + { + if(g_headCtrl.pwmCtrl != pwmval) + { + if(pwmval <= 10 && g_headCtrl.workingSta == 1) + { + printf("little clip level in working.lv:%d\r\n",pwmval); + return; + } + + //g_headCtrl.pwmCtrl = g_headCtrl.pwmFreq; + g_headCtrl.pwmCount = 0; +// TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE); /* ж */ +// TIM_Cmd(TIM1, ENABLE); + g_headCtrl.pwmCtrl = pwmval; + + if (g_headCtrl.cmprbuf != pwmval) + {// ӡǷ񶪰 + g_headCtrl.chgTime++; + g_headCtrl.cmprbuf = pwmval; + printf("[%d][%d]\tpwm:%d\r\n",g_headCtrl.chgTime,(GetMsSoftTimer10() - g_headCtrl.startTime + 40),pwmval); + + // 仯뵽 + g_headCtrl.tabIdx = g_headCtrl.tabIdx % BUF_TAB_SIZE; + g_headCtrl.chgTimeTab[g_headCtrl.tabIdx] = g_headCtrl.chgTime; + g_headCtrl.curTimeTab[g_headCtrl.tabIdx] = GetMsSoftTimer10() - g_headCtrl.startTime + 40; + g_headCtrl.pwmTab[g_headCtrl.tabIdx] = pwmval; + g_headCtrl.tabIdx++; + } + } + } + //printf("P:%d\tF:%d\t",g_headCtrl.pwmCtrl,1000000/g_headCtrl.pwmFreq); +#else + #if (0) + if (pwmval >= 0 && pwmval <= 100) + { + PWMoutputTask(pwmval,1); + } + #else + if ((pwmval >= 0 && pwmval <= 100) && + //(g_headCtrl.pwmCtrl != pwmval) && + 1 ) + { + u32 cmpr; + if(g_headCtrl.pwmCtrl != pwmval) + { + if(pwmval <= 10 && g_headCtrl.workingSta == 1) + { + printf("little clip level in working.lv:%d\r\n",pwmval); + return; + } + cmpr = g_headCtrl.pwmFreq * pwmval / 100; + TIM_SetCompare1(TIM3,cmpr); + TIM_SetCompare2(TIM3,cmpr); + g_headCtrl.pwmCtrl = pwmval; + } + + if (g_headCtrl.cmprbuf != cmpr) + {// ӡǷ񶪰 + g_headCtrl.chgTime++; + g_headCtrl.cmprbuf = cmpr; + printf("[%d][%d]\tpwm:%d\tcmpr:%d (0)\r\n",g_headCtrl.chgTime,(GetMsSoftTimer10() - g_headCtrl.startTime + 40),pwmval,cmpr); + + // 仯뵽 + g_headCtrl.tabIdx = g_headCtrl.tabIdx % BUF_TAB_SIZE; + g_headCtrl.chgTimeTab[g_headCtrl.tabIdx] = g_headCtrl.chgTime; + g_headCtrl.curTimeTab[g_headCtrl.tabIdx] = GetMsSoftTimer10() - g_headCtrl.startTime + 40; + g_headCtrl.pwmTab[g_headCtrl.tabIdx] = pwmval; + g_headCtrl.tabIdx++; + } + //printf("P:%d\tF:%d\t",g_headCtrl.pwmCtrl,1000000/g_headCtrl.pwmFreq); + } + #endif +#endif + } + } +#endif + sta = (rCmd.wrdat[0]>>(8*(D29_BOARD_ID-1))) & 0x00FF; + OutputCtrl(ionum,sta); + } + else if(rCmd.addr == 1) // IOON + { + u8 ionum,sta; + ionum = rCmd.wrdat[0]; + //sta = rCmd.wrdat[1]; + sta = 1; + OutputCtrl(ionum,sta); + } + else if(rCmd.addr == 2) // IOOFF + { + u8 ionum,sta; + ionum = rCmd.wrdat[0]; + //sta = rCmd.wrdat[1]; + sta = 0; + OutputCtrl(ionum,sta); + } +#if (STM32_MOTOS_NUM == 0 && STM32_SOFT_PWM != 0) + else if(rCmd.addr == 3 || rCmd.addr == 30) //PWM + { +#if(PWM_TIMER_CTRL == 1) + if(rCmd.wrdat[0] > 0 && rCmd.wrdat[0] <= g_headCtrl.pwmFreq) + { + g_headCtrl.pwmCtrl = rCmd.wrdat[0]; + g_headCtrl.pwmCount = 0; + //TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE); /* ж */ + //TIM_Cmd(TIM1, ENABLE); + } + else + { + g_headCtrl.pwmCtrl = 0; + //TIM_ITConfig(TIM1, TIM_IT_Update, DISABLE); /* ж */ + //TIM_Cmd(TIM1, DISABLE); // رնʱ + SetOutput6Off(); + SetOutput7Off(); + //SetOutput8Off(); + } +#else + if (rCmd.wrdat[0] >= 0 && rCmd.wrdat[0] <= 100) + { + #if (0) + PWMoutputTask(pwmval,1); + #else + u32 cmpr; + u16 pwmval; + pwmval = rCmd.wrdat[0]; + if(g_headCtrl.pwmCtrl != pwmval) + { + if(pwmval <= 10 && g_headCtrl.workingSta == 1) + { + printf("little clip level in working.lv:%d\r\n",pwmval); + return; + } + cmpr = g_headCtrl.pwmFreq * pwmval / 100; + if(rCmd.addr == 3) + { + TIM_SetCompare1(TIM3,cmpr); + } + TIM_SetCompare2(TIM3,cmpr); + g_headCtrl.pwmCtrl = pwmval; + } + + if (g_headCtrl.cmprbuf != cmpr) + {// ӡǷ񶪰 + g_headCtrl.chgTime++; + g_headCtrl.cmprbuf = cmpr; + printf("[%d][%d]\tpwm:%d\tcmpr:%d (3)\r\n",g_headCtrl.chgTime,(GetMsSoftTimer10() - g_headCtrl.startTime + 40),rCmd.wrdat[0],cmpr); + + // 仯뵽 + g_headCtrl.tabIdx = g_headCtrl.tabIdx % BUF_TAB_SIZE; + g_headCtrl.chgTimeTab[g_headCtrl.tabIdx] = g_headCtrl.chgTime; + g_headCtrl.curTimeTab[g_headCtrl.tabIdx] = GetMsSoftTimer10() - g_headCtrl.startTime + 40; + g_headCtrl.pwmTab[g_headCtrl.tabIdx] = rCmd.wrdat[0]; + g_headCtrl.tabIdx++; + } + + g_headCtrl.pwmCtrl = rCmd.wrdat[0]; + + //printf("pwm:%d,Freq:%dHz\r\n",g_headCtrl.pwmCtrl,1000000/g_headCtrl.pwmFreq); + //printf("ռձȣ%d,Ƶʣ%d Hz\r\n",g_headCtrl.pwmCtrl,1000000/g_headCtrl.pwmFreq); + #endif + } + else + {// ͨѶ쳣,Ӧ + + } +#endif + } +#endif + else if(rCmd.addr == 4) // ʱλ + { + printf("startTime reset\r\n"); + + g_headCtrl.chgTime = 0; + g_headCtrl.startTime = GetMsSoftTimer10(); + } + else if(rCmd.addr == 5) // 빤״̬ + { + if(rCmd.wrdat[0] == 0) + { + g_headCtrl.workingSta = 0; + } + else + { + g_headCtrl.workingSta = 1; + } + } + else if(rCmd.addr == 100) // IO + { + if(rCmd.wrdat[0] == 1) + { + TIM_Cmd(TIM3, DISABLE); // رնʱ + GPIO_InitTypeDef GPIO_InitStructure; + OUT_OD_CONFIG(OUT6); + OUT_OD_CONFIG(OUT7); + g_headCtrl.pwmOutputFlag = 0; + } + else + { + InitSTM32PwmTimer(); + g_headCtrl.pwmOutputFlag = 1; + } + } + else + { +// RefreshOutputSta(); +// sendstacmd = 1; + } + } + + if(sendstacmd == 1) + { + + } +} +#endif +// ˢ״̬ +void RefreshOutputSta(void) +{ + if(GetOutput1Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x01; + } + else + { + g_headCtrl.outputSta &= ~0x01; + } + + if(GetOutput2Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x02; + } + else + { + g_headCtrl.outputSta &= ~0x02; + } + + if(GetOutput3Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x04; + } + else + { + g_headCtrl.outputSta &= ~0x04; + } + + if(GetOutput4Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x08; + } + else + { + g_headCtrl.outputSta &= ~0x08; + } + + if(GetOutput5Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x10; + } + else + { + g_headCtrl.outputSta &= ~0x10; + } + + if(GetOutput6Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x20; + } + else + { + g_headCtrl.outputSta &= ~0x20; + } + + if(GetOutput7Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x40; + } + else + { + g_headCtrl.outputSta &= ~0x40; + } + + if(GetOutput8Status() == SENSOR_ON) + { + g_headCtrl.outputSta |= 0x80; + } + else + { + g_headCtrl.outputSta &= ~0x80; + } +} + +// ˢ״̬ +void InOutStaRefreshTask(void) +{ + if(GetInput1Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x01; + } + else + { + g_headCtrl.inputSta &= ~0x01; + } + + if(GetInput2Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x02; + } + else + { + g_headCtrl.inputSta &= ~0x02; + } + + if(GetInput3Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x04; + } + else + { + g_headCtrl.inputSta &= ~0x04; + } + + if(GetInput4Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x08; + } + else + { + g_headCtrl.inputSta &= ~0x08; + } + + if(GetInput5Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x10; + } + else + { + g_headCtrl.inputSta &= ~0x10; + } + + if(GetInput6Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x20; + } + else + { + g_headCtrl.inputSta &= ~0x20; + } + + if(GetInput7Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x40; + } + else + { + g_headCtrl.inputSta &= ~0x40; + } + + if(GetInput8Status() == SENSOR_ON) + { + g_headCtrl.inputSta |= 0x80; + } + else + { + g_headCtrl.inputSta &= ~0x80; + } + g_headCtrl.headCmdReg[0] = g_headCtrl.inputSta; +} + +// +void OutputCtrl(u8 num, u8 onof) +{ + if(num == 0) + { + if((onof & 0x01) != 0) + { + SetOutput1On(); + } + else + { + SetOutput1Off(); + } + + if((onof & 0x02) != 0) + { + SetOutput2On(); + } + else + { + SetOutput2Off(); + } + + if((onof & 0x04) != 0) + { + SetOutput3On(); + } + else + { + SetOutput3Off(); + } + + if((onof & 0x08) != 0) + { + SetOutput4On(); + } + else + { + SetOutput4Off(); + } + + if((onof & 0x10) != 0) + { + SetOutput5On(); + } + else + { + SetOutput5Off(); + } + +//#if (STM32_MOTOS_NUM == 0 && STM32_SOFT_PWM != 0) +//#else + if(g_headCtrl.pwmOutputFlag == 0) + { + if((onof & 0x20) != 0) + { + SetOutput6On(); + } + else + { + SetOutput6Off(); + } + + if((onof & 0x40) != 0) + { + SetOutput7On(); + } + else + { + SetOutput7Off(); + } + } +//#endif + if((onof & 0x80) != 0) + { + SetOutput8On(); + } + else + { + SetOutput8Off(); + } + } + else if(num == 1) + { + if(onof == 1) + { + SetOutput1On(); + } + else + { + SetOutput1Off(); + } + } + else if(num == 2) + { + if(onof == 1) + { + SetOutput2On(); + } + else + { + SetOutput2Off(); + } + } + else if(num == 3) + { + if(onof == 1) + { + SetOutput3On(); + } + else + { + SetOutput3Off(); + } + } + else if(num == 4) + { + if(onof == 1) + { + SetOutput4On(); + } + else + { + SetOutput4Off(); + } + } + else if(num == 5) + { + if(onof == 1) + { + SetOutput5On(); + } + else + { + SetOutput5Off(); + } + } +//#if (STM32_MOTOS_NUM == 0 && STM32_SOFT_PWM != 0) +//#else + else if(num == 6) + { + if(g_headCtrl.pwmOutputFlag == 0) + { + if(onof == 1) + { + SetOutput6On(); + } + else + { + SetOutput6Off(); + } + } + } + else if(num == 7) + { + if(g_headCtrl.pwmOutputFlag == 0) + { + if(onof == 1) + { + SetOutput7On(); + } + else + { + SetOutput7Off(); + } + } + } +//#endif + else if(num == 8) + { + if(onof == 1) + { + SetOutput8On(); + } + else + { + SetOutput8Off(); + } + } + //printf("N:%d\tO:%d\r\n",num,onof); +} + +void TestOutputTask(void) +{ + static u32 thistime = 0; + static int outsta = 0; + + if(GetMsSoftTimer10() - thistime >= 500) + { + if(outsta != 1) + { + outsta = 1; + } + else + { + outsta = 0; + } + thistime = GetMsSoftTimer10(); + } + + if(outsta == 1) + { + SetOutput1On(); + SetOutput2On(); + SetOutput3On(); + SetOutput4On(); + SetOutput5On(); + SetOutput6On(); + SetOutput7On(); + SetOutput8On(); + } + else + { + SetOutput1Off(); + SetOutput2Off(); + SetOutput3Off(); + SetOutput4Off(); + SetOutput5Off(); + SetOutput6Off(); + SetOutput7Off(); + SetOutput8Off(); + + } +} + +//------------------------------------------------------------------------------- +// APж +void APIntProc(void) +{ + if (g_headCtrl.enflag != EN_FALG) + { + return; + } +#if (TRIGGER_TYPE == TRG_ECD_AP || TRIGGER_TYPE == TRG_ECD_AB2) + if (GetInputAPStatus() == SENSOR_ON) // ½ش + { + if (GetInputBPStatus() == SENSOR_OFF) + { + g_headCtrl.encoderValue++; + if(g_headCtrl.followEcdCheck == 1) + { + if(g_headCtrl.encoderValue == g_headCtrl.followStartPPos) // + { + if(g_headCtrl.pfootSta == 2 || g_headCtrl.pfootSta == 3) + { + g_headCtrl.pfootSta = 3; + g_headCtrl.followEcdDir = 1; + g_headCtrl.followEcdEn = 1; + g_headCtrl.followTableIdx = 0; + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + g_headCtrl.followNumHigh = 0; + g_headCtrl.followNumLow = 0; + } + } + else if(g_headCtrl.encoderValue == g_headCtrl.followStartNPos) // ½ + { + if(g_headCtrl.pfootSta == 1 || g_headCtrl.pfootSta == 3) + { + g_headCtrl.pfootSta = 3; + g_headCtrl.followEcdDir = -1; + g_headCtrl.followEcdEn = 1; + g_headCtrl.followTableIdx = 0; + g_headCtrl.followStepNum = FOLLOW_TABLE[0]; + g_headCtrl.followNumHigh = 0; + g_headCtrl.followNumLow = 0; + if(g_headCtrl.followChangeFlag == 1) + { + g_headCtrl.followRunNum = g_headCtrl.followChangeNum; + g_headCtrl.followChangeFlag = 0; + GetFollowTableValue(g_headCtrl.followConPAng,g_headCtrl.followRunNum); + } + } + } + } + g_headCtrl.FollowMotoSignOn(); + } + else + { + g_headCtrl.encoderValue--; + g_headCtrl.FollowMotoSignOff(); + } + g_headCtrl.FollowMotoPulseOn(); + } + else + { + g_headCtrl.FollowMotoPulseOff(); + } +#elif (TRIGGER_TYPE == TRG_ECD_AB4) + if (GetInputAPStatus() == GetInputBPStatus()) + { + g_headCtrl.encoderValue++; + g_headCtrl.FollowMotoSignOn(); + } + else + { + g_headCtrl.encoderValue--; + g_headCtrl.FollowMotoSignOff(); + } + g_headCtrl.FollowMotoPulseOn(); +#endif +// printf("AP, evalue=%d\r\n", g_headCtrl.encoderValue); +} + +void BPIntProc(void) +{ + if (g_headCtrl.enflag != EN_FALG) + { + return; + } +#if (TRIGGER_TYPE == TRG_ECD_BP || TRIGGER_TYPE == TRG_ECD_AB2) + if (GetInputBPStatus() == SENSOR_ON) // ½ش + { + if (GetInputAPStatus() == SENSOR_OFF) + { + g_headCtrl.encoderValue--; + g_headCtrl.FollowMotoSignOff(); + } + else + { + g_headCtrl.encoderValue++; + g_headCtrl.FollowMotoSignOn(); + } + g_headCtrl.FollowMotoPulseOn(); + } + else + { + g_headCtrl.FollowMotoPulseOff(); + } +#elif (TRIGGER_TYPE == TRG_ECD_AB4) + + if (GetInputAPStatus() == GetInputBPStatus()) + { + g_headCtrl.encoderValue--; + g_headCtrl.FollowMotoSignOff(); + } + else + { + g_headCtrl.encoderValue++; + g_headCtrl.FollowMotoSignOn(); + } + g_headCtrl.FollowMotoPulseOff(); + +#endif + +// printf("BP\r\n"); +} + +// ZPж +void ZPIntProc(void) +{ + if (g_headCtrl.enflag != EN_FALG) + { + return; + } +// printf("zp, evalue=%d\r\n", g_headCtrl.encoderValue); + g_headCtrl.encoderValue = 0; +} + + +void TestAction(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + //-------------------------------- + + //-------------------------------- +#if(PWM_TIMER_CTRL == 0) + if (p1 == 0) + { // ӡʷ + int i,j; + j = g_headCtrl.tabIdx; + + for (i = 0; i 100) + { + return; + } + + cmpr = g_headCtrl.pwmFreq * p2 / 100; + g_headCtrl.pwmCtrl = p2; + TIM_SetCompare1(TIM3,cmpr); + TIM_SetCompare2(TIM3,cmpr); + + TIM_Cmd(TIM3, ENABLE); + printf("ռձȣ%d,Ƶʣ%d Hz\r\n",p2,1000000/g_headCtrl.pwmFreq); + } + else if (p1 == 2) + { + int freq,cmpr; + TIM_Cmd(TIM3, DISABLE); + DelayRef(100); + freq = (1000000/p2)-1; + g_headCtrl.pwmFreq = freq+1; + cmpr = g_headCtrl.pwmFreq * g_headCtrl.pwmCtrl / 100; + TIM_SetCompare1(TIM3,cmpr); + TIM_SetCompare2(TIM3,cmpr); + TIM_SetAutoreload(TIM3,freq); + TIM_Cmd(TIM3, ENABLE); + printf("ռձȣ%d,Ƶʣ%d Hz\r\n",g_headCtrl.pwmCtrl,1000000/g_headCtrl.pwmFreq); + } + else if (p1 == 3) // ر + { + if(p2 == 1) + { + TIM_SetCompare1(TIM3,0); + } + else if(p2 == 2) + { + TIM_SetCompare2(TIM3,0); + } + } + else if (p1 == 4) // + { + u32 cmpr; + cmpr = g_headCtrl.pwmFreq * g_headCtrl.pwmCtrl / 100; + if(p2 == 1) + { + TIM_SetCompare1(TIM3,cmpr); + } + else if(p2 == 2) + { + TIM_SetCompare2(TIM3,cmpr); + } + } + else if (p1 == 5) + { + + } + else if (p1 == 6) + { + + } + else if (p1 == 10) // + { + if(p2 == 1) + { + TIM_Cmd(TIM3, ENABLE); + } + else + { + TIM_Cmd(TIM3, DISABLE); + } + } +#else + else if(p1 == 1) + { + g_headCtrl.pwmCtrl = p2; + LL_TIM_EnableCounter(TIM1); + printf("ռձȣ%d \r\n",g_headCtrl.pwmCtrl); + } + else if(p1 == 2) + { + LL_TIM_EnableIT_UPDATE(TIM1); /* ж */ + LL_TIM_DisableCounter(TIM1); // رնʱ + printf("رնʱ \r\n"); + SetOutput7Off(); + SetOutput6Off(); + } + else if(p1 == 3) + { + g_headCtrl.pwmFreq = p2; + } + else if(p1 == 4) + { + g_headCtrl.timeCount = 1; + } +#endif + else if(p1 == 11) + { + if(p2 == 1) + { + SetOutput1On(); + } + else if(p2 == 2) + { + SetOutput2On(); + } + else if(p2 == 6) + { + SetOutput6On(); + } + else if(p2 == 7) + { + SetOutput7On(); + } + else if(p2 == 8) + { + SetOutput8On(); + } + } + else if(p1 == 12) + { + if(p2 == 1) + { + SetOutput1Off(); + } + else if(p2 == 2) + { + SetOutput2Off(); + } + else if(p2 == 6) + { + SetOutput6Off(); + } + else if(p2 == 7) + { + SetOutput7Off(); + } + else if(p2 == 8) + { + SetOutput8Off(); + } + } +} +#endif + + + diff --git a/SEW-EXA1/Users/App/sewhead/sewhead.h b/SEW-EXA1/Users/App/sewhead/sewhead.h new file mode 100644 index 0000000..80eab98 --- /dev/null +++ b/SEW-EXA1/Users/App/sewhead/sewhead.h @@ -0,0 +1,104 @@ +//------------------------------------------------------------------------------- +// File Name: sewhead.h +// Brief: +// Version: 1.0.0 +// Create Date: 2024/10/11 +// Create by: W.X +// Copyright: +// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED +// All rights reserved. +// +// Modify by: W.X +// Modify Date: 2024/10/17 +//------------------------------------------------------------------------------- + + +#ifndef APP_SEWHEAD_H_ +#define APP_SEWHEAD_H_ + +#include "config.h" +#if (BOARD_USE_FOR == SEW_HEAD) + +#define EN_FALG 0x55AA +// MODBUSͨѶָ +#define MOTO_CTRL_CMD 9216 // +#define MOTO_CMD_RST 0x0000 // λ +#define MOTO_TO_ZERO 0x0001 // +#define MOTO_SET_ZERO 0x0100 // ǰλλ +#define MOTO_DIS 0x0400 // ȥʹ +#define MOTO_EN 0x0800 // ʹ +#define MOTO_RESET 0x2000 // + +#define MOTO_CTRL_TOPOS 9218 // ȥλ +#define PFOOT_HIGH_POS 1 +#define PFOOT_LOW_POS 2 +#define PFOOT_BACK_POS 4 + +#define MOTO_CTRL_TOZPOS 9473 // ȥλ + +#define MOTO_PARA_ZERO 8225 // 趨㷽ʽ +#define MOTO_TZ_EVAL 0 // 趨λ +#define MOTO_TZ_NLMT 1 // طеλ + +#define MOTO_PARA_POS0 8320 // 趨λ0 +#define MOTO_PARA_POS1 8321 // 趨λ1 +#define MOTO_PARA_POS2 8322 // 趨λ2 +#define MOTO_PARA_POS3 8323 // 趨λ3 + +#define SetElasticMotoMode SetSTM32Moto1Mode +#define GetElasticMotoState GetSTM32Moto1State +#define ElasticMotoStart STM32Moto1Start +#define ElasticMotoEnSta GetMoto1EnStatus +#define ElasticMotoEnOn SetMoto1EnOn +#define GetElasticMotoRealPos GetSTM32Moto1RealPos +#define SetElasticMotoRealPos SetSTM32Moto1RealPos + +#define ADVAL_BASE 1635 // ADCֵ +#define PINEL_BASE 0 // ADCСֵ +#define TAUTL_BASE 4000 // ADCֵ +#define ERROR_RANGE 10 //ADCΧ + +#define MOVE 33000 //λ + +#define FOOT_PULS_CL 600 +#define FOOT_MAX_LEN 40 +// 崥ʽ + +#define TRG_ECD_AP 1 // AP +#define TRG_ECD_BP 2 // BP +#define TRG_ECD_AB2 3 // AB , 2 +#define TRG_ECD_AB4 4 // AB , 4 + +#define TRIGGER_TYPE TRG_ECD_AP + +#if (TRIGGER_TYPE == TRG_ECD_AP || TRIGGER_TYPE == TRG_ECD_BP) +#define ENCODER_PNUM 1000 +#elif (TRIGGER_TYPE == TRG_ECD_AB2) +#define ENCODER_PNUM 2000 +#elif (TRIGGER_TYPE == TRG_ECD_AB4) +#define ENCODER_PNUM 4000 +#else + +#endif + +typedef struct +{ + u32 stspd; + u32 runspd; + u32 add; + u32 brkadd; +}spdCtrl; + +//#define OutputStepOn() SetMoto1StepOn() +#define OutputStepOff() SetMoto1StepOff() +#define OutputDirOn() SetMoto1DirOn() +#define OutputDirOff() SetMoto1DirOff() + +void InitSewHeadBoard(void); +void SewHeadBoardTask(void); +void APIntProc(void); +void BPIntProc(void); +void ZPIntProc(void); +void SoftPwmIntProc(void); +#endif +#endif /* APP_SEWHEAD_H_ */ diff --git a/SEW-EXA1/Users/App/workctrl/debug.c b/SEW-EXA1/Users/App/workctrl/debug.c new file mode 100644 index 0000000..78b8567 --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/debug.c @@ -0,0 +1,298 @@ + +//------------------------------------------------------------------------------- +// File Name: debug.c +// Brief: +// Version: 1.0.0 +// Create Date: 2018/03/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2018/03/20 +//------------------------------------------------------------------------------- + +#define _IN_DEBUG_C + +#include "debug.h" +#include "inout.h" +#include "shell.h" +#include "delay.h" + + +//-------------------------------------------------------------------- +void TestInputs(char * para1, char * para2); +void TestOutput(char * para1, char * para2); +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- + +void InitDebug(void) +{ + AddShellCmd("INPUT", "input detect", TestInputs); + AddShellCmd("OUTPUT", "output control", TestOutput); + +#if (0) + do + { + TestOutput("1", "1000"); + }while(1); +#endif +} + + + + +//------------------------------------------------------------------------------------------------------------------------------------------------------------ +// +// Թ + +//-------------------------------------------------------------------- + +char g_inputName[INPUT_NUM][INPUT_STR_LEN] = +{ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", +}; + +#define INPUT_OP(cs, name) do\ +{\ + temp = name();\ + if (temp != inputsta[cs])\ + {\ + inputsta[cs] = temp;\ + printf("%d. (%s) is %d\r\n", inidx++, g_inputName[cs], temp);\ + }\ +}while(0) + + +void TestInputs(char * para1, char * para2) +{ + int p1, p2; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + p1 = 0; + p2 = 0; + if (strcmp(para1, "") != 0) + { + p1 = atoi(para1); + if (strcmp(para2, "") != 0) + { + p2 = atoi(para2); + } + } + + if (p1 == p2) + { + } + + //-------------------------------- + { + int inidx = 0; + u8 inputsta[INPUT_NUM]; + u8 temp; + memset(inputsta, 0xff, INPUT_NUM); + + do + { + INPUT_OP(0, GetInput1Status); + INPUT_OP(1, GetInput2Status); + INPUT_OP(2, GetInput3Status); + INPUT_OP(3, GetInput4Status); + INPUT_OP(4, GetInput5Status); + INPUT_OP(5, GetInput6Status); + INPUT_OP(6, GetInput7Status); + INPUT_OP(7, GetInput8Status); + + DelayMs(10); + + if (IsConsoleCancel() != 0 || p1 == 0) // նֹͣ + { + break; + } + + }while(p1 != 0); + } +} + +//---------------------------------------------------------------- + +char g_outputName[OUTPUT_NUM][OUTPUT_STR_LEN] = +{ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", +}; + + +#define TOUT_OP(cs, name, dl) do\ +{\ + if (p2 == 0)\ + {\ + Set##name##Off();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + }\ + else if (p2 == 1)\ + {\ + Set##name##On();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + }\ + else if (p2 == 2)\ + {\ + Set##name##On();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + DelayMs(dl);\ + Set##name##Off();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + }\ + else if (p2 > 0)\ + {\ + count = dl*p2;\ + while(count > 0) \ + {\ + count--;\ + Set##name##On();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + delay = (p2+9)/10;\ + do \ + { \ + DelayMs(10);\ + if (IsConsoleCancel() != 0) \ + {\ + break;\ + }\ + delay--;\ + }while(delay != 0);\ + if (delay != 0)\ + {\ + break;\ + }\ + Set##name##Off();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + delay = (p2+9)/10;\ + delay *= 4;\ + do \ + { \ + DelayMs(10);\ + if (IsConsoleCancel() != 0) \ + {\ + break;\ + }\ + delay--;\ + }while(delay != 0);\ + if (delay != 0)\ + {\ + break;\ + }\ + }\ + Set##name##Off();\ + printf("%d. (%s) is %d\r\n", cs+1, g_outputName[cs], Get##name##Status());\ + }\ +}while(0) + + +void TestOutput(char * para1, char * para2) +{ + int p1, p2; + int count, delay; + + if (para1 == NULL || para2 == NULL) + { + return; + } + + printf("para1=%s, para2=%s\r\n", para1, para2); + + if (strcmp(para1, "") == 0 || strcmp(para2, "") == 0) + { + return; + } + p1 = atoi(para1); + p2 = atoi(para2); + + if (p1 == p2) + { + } + + //-------------------------------- + if (p1 == 0) + { + if (p2 == 0) + { + TOUT_OP(0, Output1, 1000); + TOUT_OP(1, Output2, 1000); + TOUT_OP(2, Output3, 1000); + TOUT_OP(3, Output4, 1000); + TOUT_OP(4, Output5, 1000); + TOUT_OP(5, Output6, 1000); + TOUT_OP(6, Output7, 1000); + TOUT_OP(7, Output8, 1000); + } + else if (p2 == 1) + { + + } + } + else if (p1 < 100) + { + switch(p1) + { + case 1: + TOUT_OP(0, Output1, 1000); + break; + case 2: + TOUT_OP(1, Output2, 1000); + break; + case 3: + TOUT_OP(2, Output3, 1000); + break; + case 4: + TOUT_OP(3, Output4, 1000); + break; + case 5: + TOUT_OP(4, Output5, 1000); + break; + case 6: + TOUT_OP(5, Output6, 1000); + break; + case 7: + TOUT_OP(6, Output7, 1000); + break; + case 8: + TOUT_OP(7, Output8, 1000); + break; + default: + break; + } + } +} + +//---------------------------------------------------------------- + +void SetInputNameString(const void* pDat) +{ + memcpy(g_inputName, pDat, INPUT_NUM*INPUT_STR_LEN); +} + +void SetOutputNameString(const void* pDat) +{ + memcpy(g_outputName, pDat, OUTPUT_NUM*OUTPUT_STR_LEN); +} diff --git a/SEW-EXA1/Users/App/workctrl/debug.h b/SEW-EXA1/Users/App/workctrl/debug.h new file mode 100644 index 0000000..9a967ac --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/debug.h @@ -0,0 +1,40 @@ + +//------------------------------------------------------------------------------- +// File Name: debug.h +// Brief: +// Version: 1.0.0 +// Create Date: 2018/03/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2018/03/20 +//------------------------------------------------------------------------------- + +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +#include "config.h" + +//------------------------------------------------------------------------------- + +void InitDebug(void); + +//------------------------------------------------------------------------------- + +#define INPUT_NUM 8 +#define INPUT_STR_LEN 20 + +#define OUTPUT_NUM 8 +#define OUTPUT_STR_LEN 20 + +void SetInputNameString(const void* pDat); +void SetOutputNameString(const void* pDat); + +//------------------------------------------------------------------------------- + +#endif + + diff --git a/SEW-EXA1/Users/App/workctrl/para.c b/SEW-EXA1/Users/App/workctrl/para.c new file mode 100644 index 0000000..9cac2e2 --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/para.c @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------- +// File Name: para.c +// Brief: +// Version: 1.1.0 +// Create Date: 2019/06/25 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2019, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2019/06/25 +//------------------------------------------------------------------------------- + +#define _IN_PARA_C + +#include + + + + diff --git a/SEW-EXA1/Users/App/workctrl/para.h b/SEW-EXA1/Users/App/workctrl/para.h new file mode 100644 index 0000000..3bb4715 --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/para.h @@ -0,0 +1,139 @@ +//------------------------------------------------------------------------------- +// File Name: D32para.h +// Brief: +// Version: 1.1.0 +// Create Date: 2019/06/25 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2019, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2019/06/25 +//------------------------------------------------------------------------------- + +#ifndef _PARA_H_ +#define _PARA_H_ + +#include "config.h" + +//------------------------------------------------------------------------------- +#ifndef MAX_PARA_NUM +#define PARA_NUM 256 +#else +#define PARA_NUM MAX_PARA_NUM +#endif + +#define PARA_STR_LEN 30 + +//--------------------------------- + + +typedef struct +{ + u32 buf[PARA_NUM]; +} __attribute__ ((packed)) ParaStruct; + + +//--------------------------------- + +#ifdef _IN_PARA_C + +ParaStruct g_wkPara; + +#else + +extern ParaStruct g_wkPara; // + +#endif + +// ò + +typedef struct +{ +// 0 + u32 pfootFlowPAng; // ѹŸλ + u32 pfootFlowNAng; // ѹŸ½λ + u32 pfootFlowPuls; // ѹŸ + u32 pfootRunLowPos; // ѹеλ + u32 pfootRunBackPos; // ѹлλ + s32 ecOfstValue; // ֵ + u32 pfootRunConAng; // Ƕ + + // 7 + u32 rev1[PARA_NUM-7]; +} __attribute__ ((packed)) HeadPara; + + +//----------------------------------------------- + +#ifdef _IN_PARA_C + +//----------------------------------------------- +// Ʊ + +//static const char g_D32McParaStrList[PARA_NUM][PARA_STR_LEN] = +//{ +// // 0 +// "ѹŸλ", +// "ѹŸ½λ", +// "ѹŸ", +// "ѹеλ", +// "ֵ", +// "", "", "", "", "", +// "", "", "", "", "", "", "", "", "", "", +// "", "", "", "", "", "", "", "", "", "", +// "", "", +//}; + +//----------------------------------------------- + +// Ĭϲ + +//static const D32McPara g_defD32McPara = +//{ +//// 0 +//// u32 rev1[32-0]; +//// 0 1 2 3 4 5 6 7 8 9 +///* +//*/ +// 0, +// 0, +// 0, +// 0, +// 0, +// { +// 0, 0, 0, 0, 0, // 0 -- 9 +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 -- 19 +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 -- 29 +// 0, 0, +// }, +//}; + + +//----------------------------------------------- + +#endif + +//----------------------------------------------- + +//----------------------------------------------- + +// ʹý淢Ͳ +#define g_HeadPara g_wkPara + +#ifdef _IN_PARA_C + +HeadPara * g_pHeadPara = ((HeadPara *)(&g_HeadPara)); + +#else + +extern HeadPara * g_pHeadPara; + +#endif + +//------------------------------------------------------------------------------- + + +#endif + diff --git a/SEW-EXA1/Users/App/workctrl/workctrl.c b/SEW-EXA1/Users/App/workctrl/workctrl.c new file mode 100644 index 0000000..4980466 --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/workctrl.c @@ -0,0 +1,86 @@ + +//------------------------------------------------------------------------------- +// File Name: workctrl.c +// Brief: +// Version: 1.0.0 +// Create Date: 2018/03/19 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2018/03/19 +//------------------------------------------------------------------------------- + +#define _IN_WORKCTRL_C + +#include "workctrl.h" + +#include "inout.h" +#include "shell.h" +#include "delay.h" +#include "trigger.h" +#include "funcs.h" +#include "sewhead.h" +#include "debug.h" + +//------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------- + +void InitWorkCtrl(void) +{ + DelayMs(1000); + + memset(&g_workCtrl, 0, sizeof(WorkCtrl)); + g_workCtrl.workSta = 1; + +#if (BOARD_USE_FOR == SEW_HEAD) + InitSewHeadBoard(); +#endif + +#if (CONTROL_BUS == COMM_CAN) + InitCAN(); +#endif + InitDebug(); + //printf("Init work finish.\r\n"); + +} + +//------------------------------------------------------------------------------- + +void DelayRef(u32 ms) +{ + while(ms != 0) + { + TriggerTask(); // ʱִУTCP ӣ + //CanBusTask(); // ִ + DelayMs(1); + ms--; + } +} + +//------------------------------------------------------------------------------- + +void WorkCtrlTask(void) +{ +#if (BOARD_USE_FOR == SEW_HEAD) + SewHeadBoardTask(); +#endif +#if (CONTROL_BUS == COMM_CAN) + CanBusTask(); +#endif +} + + + +//------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------- + + + + + diff --git a/SEW-EXA1/Users/App/workctrl/workctrl.h b/SEW-EXA1/Users/App/workctrl/workctrl.h new file mode 100644 index 0000000..b827c57 --- /dev/null +++ b/SEW-EXA1/Users/App/workctrl/workctrl.h @@ -0,0 +1,71 @@ + + +//------------------------------------------------------------------------------- +// File Name: workctrl.h +// Brief: +// Version: 1.0.0 +// Create Date: 2018/03/19 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2017, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2018/03/19 +//------------------------------------------------------------------------------- + +#ifndef __WORKCTRL_H__ +#define __WORKCTRL_H__ + +#include "config.h" + +#if (CONTROL_BUS == COMM_CAN) +#include "canwork.h" +#include "sewhdcontrol.h" +#endif + +//---------------------------- + +typedef struct +{ + //----------------------- + int workSta; // ״̬, = 0, ʼ״̬; = 1, ״̬; = 2, ״̬ + + //----------------------- + u8 device; // ڵ豸 + u8 nodeId; // ڵID + + u8 hostDev; // ڵ豸 + u8 hostId; // ڵID +#if (CONTROL_BUS == COMM_CAN) + SewHeadControl curBdCtrl; +#endif + //----------------------- + int idxSetSta; + +}WorkCtrl; + +#ifdef _IN_WORKCTRL_C +WorkCtrl g_workCtrl; +#else +extern WorkCtrl g_workCtrl; +#endif + +//---------------------------- + + +void InitWorkCtrl(void); + +void WorkCtrlTask(void); + +//---------------------------- + +void DelayRef(u32 ms); + +//---------------------------- + + + + + +#endif diff --git a/SEW-EXA1/Users/Base/inout.c b/SEW-EXA1/Users/Base/inout.c new file mode 100644 index 0000000..c4577d1 --- /dev/null +++ b/SEW-EXA1/Users/Base/inout.c @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------- +// File Name: inout.c +// Brief: +// Version: 1.0.0 +// Create Date: 2021/07/21 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/21 +//------------------------------------------------------------------------------- + +#include "inout.h" +#include "funcs.h" + +//-------------ͨѶ------------------------- +OUTPUT_FUNCS(En485Out, RS485_EN); // 485 +OUTPUT_FUNCS(En485_2_Out, RS485_2_EN); // 485 + +//-----------------ź--------------------- +// Moto1 +OUTPUT_FUNCS(Moto1Step, MT_STEP); +OUTPUT_FUNCS(Moto1Dir, MT_DIR); +OUTPUT_FUNCS(Moto1En, MT_SON); + + +//----------------------------------------- +INPUT_FUNCS(InputAP,AP); +INPUT_FUNCS(InputBP,BP); +INPUT_FUNCS(InputZP,ZP); + +//-----------------ź--------------------- +OUTPUT_FUNCS(SysLed, SYS_LED); +OUTPUT_FUNCS(ErrLed, ERR_LED); + +OUTPUT_FUNCS(OutputPWM1, OUTPWM1); +OUTPUT_FUNCS(OutputPWM2, OUTPWM2); + +OUTPUT_FUNCS(Output1, OUTPUT1); +OUTPUT_FUNCS(Output2, OUTPUT2); +OUTPUT_FUNCS(Output3, OUTPUT3); +OUTPUT_FUNCS(Output4, OUTPUT4); +OUTPUT_FUNCS(Output5, OUTPUT5); +OUTPUT_FUNCS(Output6, OUTPUT6); +OUTPUT_FUNCS(Output7, OUTPUT7); +OUTPUT_FUNCS(Output8, OUTPUT8); + +//-----------------ź--------------------- +INPUT_FUNCS(Input1,INPUT1); +INPUT_FUNCS(Input2,INPUT2); +INPUT_FUNCS(Input3,INPUT3); +INPUT_FUNCS(Input4,INPUT4); +INPUT_FUNCS(Input5,INPUT5); +INPUT_FUNCS(Input6,INPUT6); +INPUT_FUNCS(Input7,INPUT7); +INPUT_FUNCS(Input8,INPUT8); + +//-----------------뿪--------------------- +INPUT_FUNCS(Switch1,SW1); +INPUT_FUNCS(Switch2,SW2); +INPUT_FUNCS(Switch3,SW3); +INPUT_FUNCS(Switch4,SW4); + + +void SetOutputNull(void) +{ + //ղ +} + +u8 GetInputNullOn(void) +{ + //ղ + return Bit_RESET; +} + +u8 GetInputNullOff(void) +{ + //ղ + return Bit_SET; +} diff --git a/SEW-EXA1/Users/Base/inout.h b/SEW-EXA1/Users/Base/inout.h new file mode 100644 index 0000000..076a624 --- /dev/null +++ b/SEW-EXA1/Users/Base/inout.h @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------- +// File Name: inout.h +// Brief: +// Version: 1.0.0 +// Create Date: 2021/07/21 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/21 +//------------------------------------------------------------------------------- + + + +#ifndef __IN_OUT_H__ +#define __IN_OUT_H__ + +#include "config.h" + +//-------------ͨѶ------------------------- + +// 485 +void SetEn485OutOn(void); +void SetEn485OutOff(void); +void SetEn485OutToggle(void); +u8 GetEn485OutStatus(void); + +void SetEn485_2_OutOn(void); +void SetEn485_2_OutOff(void); +void SetEn485_2_OutToggle(void); +u8 GetEn485_2_OutStatus(void); +//-----------------ź--------------------- + +// MOTO1 +void SetMoto1StepOn(void); +void SetMoto1StepOff(void); +void SetMoto1StepToggle(void); +u8 GetMoto1StepStatus(void); + +void SetMoto1DirOn(void); +void SetMoto1DirOff(void); +void SetMoto1DirToggle(void); +u8 GetMoto1DirStatus(void); + +void SetMoto1EnOn(void); +void SetMoto1EnOff(void); +void SetMoto1EnToggle(void); +u8 GetMoto1EnStatus(void); + +//-----------------ź--------------------- +u8 GetSwitch1Status(void); +u8 GetSwitch2Status(void); +u8 GetSwitch3Status(void); +u8 GetSwitch4Status(void); + +u8 GetInputAPStatus(void); +u8 GetInputBPStatus(void); +u8 GetInputZPStatus(void); + +u8 GetInput1Status(void); +u8 GetInput2Status(void); +u8 GetInput3Status(void); +u8 GetInput4Status(void); +u8 GetInput5Status(void); +u8 GetInput6Status(void); +u8 GetInput7Status(void); +u8 GetInput8Status(void); +//-----------------ź--------------------- +void SetSysLedOn(void); +void SetSysLedOff(void); +void SetSysLedToggle(void); +u8 GetSysLedStatus(void); + +void SetOutputPWM1On(void); +void SetOutputPWM1Off(void); +u8 GetOutputPWM1Status(void); + +void SetOutputPWM2On(void); +void SetOutputPWM2Off(void); +u8 GetOutputPWM2Status(void); + +void SetOutput1On(void); +void SetOutput1Off(void); +void SetOutput1Toggle(void); +u8 GetOutput1Status(void); + +void SetOutput2On(void); +void SetOutput2Off(void); +void SetOutput2Toggle(void); +u8 GetOutput2Status(void); + +void SetOutput3On(void); +void SetOutput3Off(void); +u8 GetOutput3Status(void); + +void SetOutput4On(void); +void SetOutput4Off(void); +u8 GetOutput4Status(void); + +void SetOutput5On(void); +void SetOutput5Off(void); +u8 GetOutput5Status(void); + +void SetOutput6On(void); +void SetOutput6Off(void); +u8 GetOutput6Status(void); + +void SetOutput7On(void); +void SetOutput7Off(void); +u8 GetOutput7Status(void); + +void SetOutput8On(void); +void SetOutput8Off(void); +u8 GetOutput8Status(void); +//----------------------------------- +void SetOutputNull(void); +u8 GetInputNullOn(void); +u8 GetInputNullOff(void); + +#endif + diff --git a/SEW-EXA1/Users/Config/config.c b/SEW-EXA1/Users/Config/config.c new file mode 100644 index 0000000..edc606e --- /dev/null +++ b/SEW-EXA1/Users/Config/config.c @@ -0,0 +1,118 @@ +//------------------------------------------------------------------------------- +// File Name: config.C +// Brief: +// Version: 1.1.0 +// Create Date: 2021/07/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/20 +//------------------------------------------------------------------------------- + + +#define _IN_CONFIG_C + +#include "config.h" + +static const char VERSION_INFO[VERSION_LEN] = +{ + VER_TYPE, + '-', + VER_PROD, + ' ', +#if (CUR_VERSION == VERSION_DEBUG) // ԰汾 + 'D', +#elif (CUR_VERSION == VERSION_RELEASE) // 汾 + 'R', +#else + 'V', +#endif + VER_CODE_M, + '.', + VER_CODE_S, + '.', + VER_CODE_D, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +}; + +void GetCompileDateTime(char * datetime) +{ + u8 i; + int month, year, day; + int hour, min, second; + + const char *pMonth[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + const char Date[12] = __DATE__; // ȡ + const char time[12] = __TIME__; // ȡʱ + + month = 1; + for (i = 0; i < 12; i++) + { + if (memcmp(Date, pMonth[i], 3) == 0) + { + month = i + 1; + break; + } + } + year = (uint8_t)atoi(Date + 9); // Date[9]ΪλݣDate[7]Ϊ + day = (uint8_t)atoi(Date + 4); + + hour = (uint8_t)atoi(time + 0); + min = (uint8_t)atoi(time + 3); + second = (uint8_t)atoi(time + 6); + + if (datetime != NULL) + { + sprintf(datetime, "%02d%02d%02d%02d%02d%02d", year, month, day, hour, min, second); + } +} + +void GetVersionStr(char * str) +{ + if (str != NULL) + { + memcpy(str, VERSION_INFO, VERSION_LEN); + str[VERSION_LEN-1] = 0; + if (str[0] == 0xff) + { + str[0] = 0; + } + else + { + if ( + str[VERSION_LEN-12] == 0xff && + str[VERSION_LEN-11] == 0xff && + str[VERSION_LEN-10] == 0xff && + str[VERSION_LEN-9] == 0xff && + str[VERSION_LEN-8] == 0xff && + str[VERSION_LEN-7] == 0xff && + str[VERSION_LEN-6] == 0xff && + str[VERSION_LEN-5] == 0xff && + str[VERSION_LEN-4] == 0xff && + str[VERSION_LEN-3] == 0xff && + str[VERSION_LEN-2] == 0xff && + // str[VERSION_LEN-1] == 0xff && + 1 ) // дij + { + u32 wrAddr; + char * vbuf = &(str[VERSION_LEN-12]); + GetCompileDateTime(vbuf); + wrAddr = (u32)VERSION_INFO; + wrAddr += VERSION_LEN-12; + + // STMFlashWrite(wrAddr, (u16*)vbuf, 12/2, 3); // дflash + } + } + } +} + + +void GetBuildStr(char * str) +{ + sprintf(str, "Build: %s %s\r\n", __DATE__, __TIME__); +} + + diff --git a/SEW-EXA1/Users/Config/config.h b/SEW-EXA1/Users/Config/config.h new file mode 100644 index 0000000..028397c --- /dev/null +++ b/SEW-EXA1/Users/Config/config.h @@ -0,0 +1,155 @@ +//------------------------------------------------------------------------------- +// File Name: config.h +// Brief: +// Version: 1.1.0 +// Create Date: 2021/07/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/20 +//------------------------------------------------------------------------------- + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include "afxdef.h" +//--------------------------------------------------------------- +// +// 忨 +//--------------------------------------------------------------- + +#define CORE_BOARD_APP 1 // Ӧô + +#define CUR_CORE_BOARD CORE_BOARD_APP + +//--------------------------------------------------------------- + +#define VERSION_DEBUG 0 // ԰汾 +#define VERSION_RELEASE 1 // 汾 + +#define CUR_VERSION VERSION_DEBUG + +//--------------------------------------------------------------- + + +//--------------------------------------------------------------- + +#define VER_CODE_M '2','4' +#define VER_CODE_S '1','0' +#define VER_CODE_D '1','7' + +//--------------------------------------------------------------- + +// 忨; + +#define TEST_BOARD 0 // Լ + +#define SEW_HEAD 1 // һͷ + +#if (CUR_CORE_BOARD == CORE_BOARD_APP) +#define BOARD_USE_FOR SEW_HEAD +#else +#define BOARD_USE_FOR TEST_BOARD +#endif + +//--------------------------------------------------------------- + +#define USE_IWDOG 0 // ʹÿŹ + +//--------------------------------------------------------------- +#if (BOARD_USE_FOR == SEW_HEAD) +#define RS485_CMD_NUM 21 +#endif +//--------------------------------------------------------------- + +#ifndef SYSCLK +#define SYSCLK 72000000L +#endif + +//--------------------------------------------------------------- + +// bootloader С +#define STM32_BOOT_SIZE (0*1024) + +#define VERSION_LEN 32 + + +//--------------------------------------------------------------- + +// ͨѶ˿ѡ + +#if (1) // ͨѶ˿ѡ + +#define COMM_NONE 0 // ʹãЧ + +#define COMM_USART1 1 // 1, +#define COMM_USART2 2 // 2, 485 +#define COMM_USART3 3 // 3, 485 + +#define CONSOLE_PORT COMM_USART1 // ̨ͨѶ + +#define USART2_485OutEn SetEn485OutOff +#define USART2_485OutDis SetEn485OutOn + +#define USART3_485OutEn SetEn485_2_OutOff +#define USART3_485OutDis SetEn485_2_OutOn + +#define COMM_485 1 +#define COMM_CAN 2 + +#define CONTROL_BUS COMM_CAN + +#endif + +//--------------------------------------------------------------- +#if (CONTROL_BUS == COMM_485) +#define MODBUS_S_PORT +#elif (CONTROL_BUS == COMM_CAN) +#define CUR_EXA1_NODE_ID 0x21 +#define BN_DEVICE_EXA1 0xA1 +#endif +//--------------------------------------------------------------- +#if (BOARD_USE_FOR == SEW_HEAD) +#define MODBUS_M +#endif +//--------------------------------------------------------------- + +//--------------------------------------------------------------- + +#define STM32_SOFT_PWM 1 + +#define STM32_MOTOS_NUM 1 +#define MOTO1_TIM TIM1 + +#define SPEED_PSC 48 + +#define MOOT_TIM_PSC 80 + +//--------------------------------------------------------------- +#if (BOARD_USE_FOR == SEW_HEAD) +#define PWM_TIMER_CTRL 1 +#endif +//--------------------------------------------------------------- + +#if (BOARD_USE_FOR == SEW_HEAD) + #define VER_TYPE 'S','E','W' + #define VER_PROD 'H','E','A','D',' ' +#else + #define VER_TYPE 'Y','R','A' + #define VER_PROD 'D','3','2',' ',' ' +#endif +//--------------------------------------------------------------- + +void GetVersionStr(char * str); +void GetBuildStr(char * str); + +//--------------------------------------------------------------- + +//--------------------------------------------------------------- + +#include "main.h" + +#endif diff --git a/SEW-EXA1/Users/Func/canwork.c b/SEW-EXA1/Users/Func/canwork.c new file mode 100644 index 0000000..3456650 --- /dev/null +++ b/SEW-EXA1/Users/Func/canwork.c @@ -0,0 +1,196 @@ +//------------------------------------------------------------------------------- +// File Name: canwork.c +// Brief: +// Version: 1.0.0 +// Create Date: 2024/10/17 +// Create by: W.X +// Copyright: +// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED +// All rights reserved. +// +// Modify by: W.X +// Modify Date: 2024/10/17 +//------------------------------------------------------------------------------- + +#include "canwork.h" + +#if (CONTROL_BUS == COMM_CAN) + +void ExA1CanFilter(u8 fifo); + +void InitCAN(void) +{ + // CAN ڵ + g_workCtrl.hostId = 1; + + g_workCtrl.device = BN_DEVICE_EXA1; + g_workCtrl.nodeId = CUR_EXA1_NODE_ID; + + g_workCtrl.workSta = 2; + + printf("g_workCtrl.nodeId is %d\r\n",g_workCtrl.nodeId); + + RegistFilter(ExA1CanFilter); + + InitCanCtrl(); + InitSewHeadControl(&g_workCtrl.curBdCtrl); +} + + +void ExA1CanFilter(u8 fifo) +{ + CAN_FilterTypeDef CAN_FilterInitStructure; + + // 󱾽ڵ״̬仯Զ֡ͿƱڵ֡ + CAN_FilterInitStructure.FilterBank = 0; // ù0ΧΪ0~13 + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 0Ϊʶбģʽ + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // 0λΪ32λ + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_REMOTE)); // 趨һ16λ + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_REMOTE)); // 趨һ16λ + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ڶ16λ + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, BN_CMD_EXSTA), CAN_RTR_DATA)); // 趨ڶ16λ + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + + // 㲥Զ֡֡ + CAN_FilterInitStructure.FilterBank = 1; // ù1ΧΪ0~13 + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 1Ϊʶбģʽ + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // 1λΪ32λ + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(BROADCAST_EXID, CAN_RTR_REMOTE)); // 趨16λ + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(BROADCAST_EXID, CAN_RTR_REMOTE)); // 趨16λ + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT, CAN_RTR_DATA)); // 趨ĸ16λ + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT, CAN_RTR_DATA)); // 趨ĸ16λ + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + + // Ա豸IDĹ㲥Զ֡֡ + CAN_FilterInitStructure.FilterBank = 2; // ù2ΧΪ0~13 + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 2Ϊʶλģʽ + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, BN_ID_BROADCAST, 0, 0), 0)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); // д + + // Ա豸ıڵƵԶ֡֡ + CAN_FilterInitStructure.FilterBank = 3; // ù2ΧΪ0~13 + CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST; // 2Ϊʶλģʽ + CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_32BIT; // λΪ132λ + CAN_FilterInitStructure.FilterIdHigh = HIWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, 0), 0)); // 趨ʶ32λλʱΪ߶λ16λλʱΪһ + CAN_FilterInitStructure.FilterIdLow = LOWORD(MAKE_FILTER(MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, 0, 0), 0)); // 趨ʶ32λλʱΪͶλ16λλʱΪڶ + CAN_FilterInitStructure.FilterMaskIdHigh = HIWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪ߶λ16λλʱΪһ + CAN_FilterInitStructure.FilterMaskIdLow = LOWORD(MAKE_FILTER(BNMASK_PRT|BNMASK_TID, 0)); // 趨αʶ߹ʶ32λλʱΪͶλ16λλʱΪڶ) + CAN_FilterInitStructure.FilterFIFOAssignment = fifo; // FIFO + CAN_FilterInitStructure.FilterActivation = ENABLE; // ʹܹ + HAL_CAN_ConfigFilter(&HCAN,&CAN_FilterInitStructure); +} + +//------------------------------------------------------------------------------- + +void CanBusTask(void) +{ + int rslt; + int sendflag; + CanRxMsg rxMsg; + CanTxMsg txMsg; + int dev, tid, sid, cmd; + + sendflag = 0; + + // CAN + rslt = GetACanDataPacket(&rxMsg); + if (rslt == 0) + { + dev = GET_PRT_FROM_EXID(rxMsg.canRxhead.ExtId); + tid = GET_TID_FROM_EXID(rxMsg.canRxhead.ExtId); + sid = GET_SID_FROM_EXID(rxMsg.canRxhead.ExtId); + cmd = GET_CMD_FROM_EXID(rxMsg.canRxhead.ExtId); + + if (rxMsg.canRxhead.RTR == CAN_RTR_REMOTE) // Զ֡ + { + if ((dev == BN_PROTOCOL_ALL || dev == g_workCtrl.device) && // ȫ豸豸 + (tid == BN_ID_BROADCAST || tid == g_workCtrl.nodeId) ) // ȫID򱾰 + { + if (cmd == BN_CMD_EXSTA) // ״̬ + { + sendflag = 1; // ״̬ + printf("receive sta request packet\r\n"); + } + else + { + printf("other Remote cmd, cmd=0x%x\r\n", cmd); + } + } + else + { + printf("other Remote packet, exid=0x%x\r\n", (int)rxMsg.canRxhead.ExtId); + } + } + else // if (rxMsg.canRxhead.RTR == CAN_RTR_DATA) // ֡ + { + if ((dev == BN_PROTOCOL_ALL ||dev == g_workCtrl.device) && // exa1 + (tid == BN_ID_BROADCAST || tid == g_workCtrl.nodeId) ) // ȫID򱾰 + { + if (cmd == BN_CMD_EXCTRL || // + cmd == BN_CMD_TRAVERSE || // + 0 ) + { + g_workCtrl.curBdCtrl.ctrlCmd.cancomm.exId.id = rxMsg.canRxhead.ExtId; + memcpy(g_workCtrl.curBdCtrl.ctrlCmd.cancomm.data.buff, rxMsg.data, CAN_DATA_LEN); // ݳ + g_workCtrl.curBdCtrl.cmdFlag = 1; // ־ + // printf("get ex ctrl cmd\r\n"); + } + else + { + printf("get other data cmd=0x%x\r\n", cmd); + } + } + else + { + printf("other data packet, dev=0x%x, tid=%d, exid=0x%x\r\n", dev, (int)tid, (int)rxMsg.canRxhead.ExtId); + } + } + } + + if (sendflag == 0) + { + sid = g_workCtrl.hostId; + } + + // ״̬Ϣ + if (g_workCtrl.curBdCtrl.staFlag != 0) + { + g_workCtrl.curBdCtrl.staFlag = 0; + sendflag = 1; // ״̬ + } + + if (sendflag == 1) + { + if(g_workCtrl.workSta == 1) + { + txMsg.canTxhead.ExtId = MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, sid, BN_CMD_TRAVERSE); // ״̬ + } + else + { + txMsg.canTxhead.ExtId = MAKE_EXID(g_workCtrl.device, g_workCtrl.nodeId, sid, BN_CMD_EXSTA); // ״̬ + } + txMsg.canTxhead.RTR = CAN_RTR_DATA; // ֡ + txMsg.canTxhead.IDE = CAN_ID_EXT; // չ֡ + txMsg.canTxhead.DLC = CAN_DATA_LEN; // ݳ + memcpy(txMsg.data, g_workCtrl.curBdCtrl.exbSta.cancomm.data.buff, CAN_DATA_LEN); // ݳ + rslt = SendACANDataPacket(&txMsg); + + //printf("send sta data by can, exid=0x%x\r\n", (int)txMsg.ExtId); + } +} + +#endif + + + + diff --git a/SEW-EXA1/Users/Func/canwork.h b/SEW-EXA1/Users/Func/canwork.h new file mode 100644 index 0000000..8e13013 --- /dev/null +++ b/SEW-EXA1/Users/Func/canwork.h @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------- +// File Name: canwork.h +// Brief: +// Version: 1.0.0 +// Create Date: 2024/10/17 +// Create by: W.X +// Copyright: +// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED +// All rights reserved. +// +// Modify by: W.X +// Modify Date: 2024/10/17 +//------------------------------------------------------------------------------- + +#ifndef APP_FUNC_CANWORK_H_ +#define APP_FUNC_CANWORK_H_ + +#include "config.h" +#include "workctrl.h" +#include "canctrl.h" +#include "controlbus.h" +#include "sewhdcontrol.h" + +#if (CONTROL_BUS == COMM_CAN) + + +void InitCAN(void); +void CanBusTask(void); + +#endif + + +#endif /* APP_FUNC_CANWORK_H_ */ diff --git a/SEW-EXA1/Users/tasks.c b/SEW-EXA1/Users/tasks.c new file mode 100644 index 0000000..72560d2 --- /dev/null +++ b/SEW-EXA1/Users/tasks.c @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------- +// File Name: tasks.c +// Brief: +// Version: 1.1.0 +// Create Date: 2021/07/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/20 +//------------------------------------------------------------------------------- + + +#include "tasks.h" + +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) +#else +#include "apptasks.h" +#endif + +void SetVectorTable(void) +{ +#if (__CORTEX_M == 0) + // ʹSTM32F0XXʱIAPAPPнжSRAMϵͳӳ䵽SRAMʹжϻָ +#else + CLEAR_ALL_INT(); +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + SCB->VTOR = FLASH_BASE | 0; +#else + SCB->VTOR = FLASH_BASE | STM32_BOOT_SIZE; +#endif + SET_ALL_INT(); +#endif +} + +void MainTasks(void) +{ +#if (CUR_CORE_BOARD == CORE_BOARD_BOOT) + BootMainTask(); // +#else + AppMainTask(); // Ӧô +#endif +} + + diff --git a/SEW-EXA1/Users/tasks.h b/SEW-EXA1/Users/tasks.h new file mode 100644 index 0000000..f9f9d06 --- /dev/null +++ b/SEW-EXA1/Users/tasks.h @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------- +// File Name: tasks.h +// Brief: +// Version: 1.1.0 +// Create Date: 2021/07/20 +// Create by: Marshal Lee +// Copyright: +// Copyright (c) 2021, Richpeace Co., LTD. +// All rights reserved. +// +// Modify by: Marshal Lee +// Modify Date: 2021/07/20 +//------------------------------------------------------------------------------- + +#ifndef __TASKS_H__ +#define __TASKS_H__ + +#include "config.h" + +void SetVectorTable(void); +void MainTasks(void); + +#endif + + diff --git a/bin2gauf/ecla1_bin2gauf.exe b/bin2gauf/ecla1_bin2gauf.exe new file mode 100644 index 0000000..fbe87c5 Binary files /dev/null and b/bin2gauf/ecla1_bin2gauf.exe differ diff --git a/bin2gauf/ehaos_bin2gauf.exe b/bin2gauf/ehaos_bin2gauf.exe new file mode 100644 index 0000000..0057e5d Binary files /dev/null and b/bin2gauf/ehaos_bin2gauf.exe differ diff --git a/bin2gauf/ehbos_bin2gauf.exe b/bin2gauf/ehbos_bin2gauf.exe new file mode 100644 index 0000000..d55f7a8 Binary files /dev/null and b/bin2gauf/ehbos_bin2gauf.exe differ diff --git a/bin2gauf/embos_bin2gauf.exe b/bin2gauf/embos_bin2gauf.exe new file mode 100644 index 0000000..15bf5de Binary files /dev/null and b/bin2gauf/embos_bin2gauf.exe differ diff --git a/bin2gauf/libgcc_s_dw2-1.dll b/bin2gauf/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..d33266d Binary files /dev/null and b/bin2gauf/libgcc_s_dw2-1.dll differ diff --git a/bin2gauf/libstdc++-6.dll b/bin2gauf/libstdc++-6.dll new file mode 100644 index 0000000..2809f65 Binary files /dev/null and b/bin2gauf/libstdc++-6.dll differ diff --git a/bin2gauf/libwinpthread-1.dll b/bin2gauf/libwinpthread-1.dll new file mode 100644 index 0000000..ccd25e2 Binary files /dev/null and b/bin2gauf/libwinpthread-1.dll differ diff --git a/bin2gauf/pmbos_bin2gauf.exe b/bin2gauf/pmbos_bin2gauf.exe new file mode 100644 index 0000000..fae3877 Binary files /dev/null and b/bin2gauf/pmbos_bin2gauf.exe differ diff --git a/flatprintcut-embos-250822.gauf b/flatprintcut-embos-250822.gauf deleted file mode 100644 index cf200ce..0000000 Binary files a/flatprintcut-embos-250822.gauf and /dev/null differ diff --git a/flatprintcut-embos-250822.hex b/flatprintcut-embos-250822.hex deleted file mode 100644 index 9b09b0e..0000000 --- a/flatprintcut-embos-250822.hex +++ /dev/null @@ -1,12418 +0,0 @@ -:020000040801F1 -:1000000000000220952B01087F1F01089B1F01089B -:10001000B71F0108D31F0108EF1F010800000000EF -:100020000000000000000000000000000B2001089C -:1000300019200108000000002720010835200108D0 -:10004000E52B0108E52B0108E52B0108E52B01084C -:10005000E52B0108E52B0108E52B0108E52B01083C -:10006000E52B0108E52B0108E52B0108E52B01082C -:10007000E52B0108E52B0108E52B0108E52B01081C -:10008000E52B0108E52B0108E52B010845200108B7 -:1000900059200108E52B0108E52B01086D20010816 -:1000A0008D200108B1200108D5200108E52B0108A9 -:1000B000E52B0108E52B0108E52B0108E52B0108DC -:1000C000E52B0108E52B0108E52B0108E52B0108CC -:1000D000E52B0108F9200108E52B0108E52B0108B3 -:1000E00005210108E52B0108E52B01082521010860 -:1000F0004921010885210108E52B0108E52B0108AC -:10010000E52B0108E52B0108E52B0108E52B01088B -:10011000E52B0108E52B0108E52B0108E52B01087B -:10012000E52B0108E52B0108E52B0108E52B01086B -:10013000E52B01080000000000000000E52B01088D -:10014000E52B0108E52B0108E52B0108E52B01084B -:10015000E52B0108E52B0108E52B0108A921010881 -:10016000E52B0108E52B0108E52B0108E52B01082B -:10017000E52B0108E52B0108E52B01080000000034 -:1001800000000000E52B0108000000000000000056 -:10019000E52B01080000000000000000E52B01082D -:1001A000000000000000000000000000E52B010836 -:1001B000E52B0108E52B0108E52B0108E52B0108DB -:0401C000E52B010822 -:1001D00010B5054C237833B9044B13B10448AFF381 -:1001E00000800123237010BDF00E002000000000ED -:1001F000A87A030808B5034B1BB103490348AFF3C2 -:10020000008008BD00000000F40E0020A87A03085A -:1002100010F8012B11F8013B012A28BF9A42F7D0B0 -:10022000D01A7047034613F8012B002AFBD1181A85 -:1002300001387047000000000000000000000000CE -:1002400001F0FF01102A2BDB10F0070F08D010F887 -:10025000013B013A8B422DD010F0070F42B3F6D18B -:10026000F0B441EA012141EA014122F007047FF0A4 -:1002700000070023F0E80256083C85EA010586EAFB -:10028000010685FA47F5A3FA87F586FA47F6A5FA37 -:1002900087F68EB9EED1F0BC01F0FF0102F0070243 -:1002A00032B110F8013B013A83EA010313B1F8D1EE -:1002B0000020704701387047002D06BF35460338CF -:1002C000073815F0010F07D1013015F4807F02BF08 -:1002D000013015F4C03F0130F0BC0138704700BF59 -:1002E00081F0004102E000BF83F0004330B54FEAE7 -:1002F00041044FEA430594EA050F08BF90EA020F54 -:100300001FBF54EA000C55EA020C7FEA645C7FEAE6 -:10031000655C00F0E2804FEA5454D4EB5555B8BF09 -:100320006D420CDD2C4480EA020281EA030382EA7A -:10033000000083EA010180EA020281EA0303362D0C -:1003400088BF30BD11F0004F4FEA01314FF4801CDF -:100350004CEA113102D0404261EB410113F0004FF1 -:100360004FEA03334CEA133302D0524263EB4303A8 -:1003700094EA050F00F0A780A4F10104D5F1200E46 -:100380000DDB02FA0EFC22FA05F2801841F10001A1 -:1003900003FA0EF2801843FA05F359410EE0A5F175 -:1003A00020050EF1200E012A03FA0EFC28BF4CF0A6 -:1003B000020C43FA05F3C01851EBE37101F000455C -:1003C00007D54FF0000EDCF1000C7EEB00006EEB69 -:1003D0000101B1F5801F1BD3B1F5001F0CD34908F3 -:1003E0005FEA30004FEA3C0C04F101044FEA44524A -:1003F00012F5800F80F09A80BCF1004F08BF5FEAD1 -:10040000500C50F1000041EB045141EA050130BDB0 -:100410005FEA4C0C404141EB0101013C28BFB1F5C2 -:10042000801FE9D291F0000F04BF01460020B1FA0D -:1004300081F308BF2033A3F10B03B3F120020CDAE0 -:100440000C3208DD02F1140CC2F10C0201FA0CF0BE -:1004500021FA02F10CE002F11402D8BFC2F1200C23 -:1004600001FA02F120FA0CFCDCBF41EA0C019040D9 -:10047000E41AA2BF01EB0451294330BD6FEA040422 -:100480001F3C1CDA0C340EDC04F11404C4F120020D -:1004900020FA04F001FA02F340EA030021FA04F31F -:1004A00045EA030130BDC4F10C04C4F1200220FA76 -:1004B00002F001FA04F340EA0300294630BD21FAB4 -:1004C00004F0294630BD94F0000F83F4801306BF7A -:1004D00081F480110134013D4EE77FEA645C18BF6E -:1004E0007FEA655C29D094EA050F08BF90EA020F05 -:1004F00005D054EA000C04BF1946104630BD91EAFD -:10050000030F1EBF0021002030BD5FEA545C05D1FF -:100510004000494128BF41F0004130BD14F580043E -:100520003CBF01F5801130BD01F0004545F0FE41B2 -:1005300041F470014FF0000030BD7FEA645C1ABFE7 -:10054000194610467FEA655C1CBF0B46024650EA1E -:10055000013406BF52EA033591EA030F41F400214A -:1005600030BD00BF90F0000F04BF0021704730B5D0 -:100570004FF4806404F132044FF000054FF00001A5 -:1005800050E700BF90F0000F04BF0021704730B566 -:100590004FF4806404F1320410F0004548BF40423B -:1005A0004FF000013EE700BF42004FEAE2014FEA90 -:1005B00031014FEA02701FBF12F07F4393F07F4F6B -:1005C00081F06051704732F07F4208BF704793F06E -:1005D0007F4F04BF41F40021704730B54FF4607481 -:1005E00001F0004521F000411CE700BF50EA010284 -:1005F00008BF704730B54FF000050AE050EA01022D -:1006000008BF704730B511F0004502D5404261EB9C -:1006100041014FF4806404F132045FEA915C3FF4DD -:10062000D8AE4FF003025FEADC0C18BF03325FEA7A -:10063000DC0C18BF033202EBDC02C2F1200300FA2B -:1006400003FC20FA02F001FA03FE40EA0E0021FA50 -:1006500002F11444BDE600BF70B54FF0FF0C4CF43E -:10066000E06C1CEA11541DBF1CEA135594EA0C0FF0 -:1006700095EA0C0F00F0DEF82C4481EA030621EA2B -:100680004C5123EA4C5350EA013518BF52EA033566 -:1006900041F4801143F4801338D0A0FB02CE4FF018 -:1006A0000005E1FB02E506F00042E0FB03E54FF048 -:1006B0000006E1FB03569CF0000F18BF4EF0010E40 -:1006C000A4F1FF04B6F5007F64F5407404D25FEA3C -:1006D0004E0E6D4146EB060642EAC62141EA5551EF -:1006E0004FEAC52040EA5E504FEACE2EB4F1FD0C31 -:1006F00088BFBCF5E06F1ED8BEF1004F08BF5FEAAF -:10070000500E50F1000041EB045170BD06F0004660 -:1007100046EA010140EA020081EA0301B4EB5C040D -:10072000C2BFD4EB0C0541EA045170BD41F4801105 -:100730004FF0000E013C00F3AB8014F1360FDEBF2A -:10074000002001F0004170BDC4F10004203C35DA06 -:100750000C341BDC04F11404C4F1200500FA05F389 -:1007600020FA04F001FA05F240EA020001F000422A -:1007700021F0004110EBD37021FA04F642EB0601A0 -:100780005EEA430E08BF20EAD37070BDC4F10C04CA -:10079000C4F1200500FA04F320FA05F001FA04F28E -:1007A00040EA020001F0004110EBD37041F100017A -:1007B0005EEA430E08BF20EAD37070BDC4F1200585 -:1007C00000FA05F24EEA020E20FA04F301FA05F2ED -:1007D00043EA020321FA04F001F0004121FA04F295 -:1007E00020EA020000EBD3705EEA430E08BF20EA65 -:1007F000D37070BD94F0000F0FD101F0004640009F -:1008000041EB010111F4801F08BF013CF7D041EA20 -:10081000060195F0000F18BF704703F00046520024 -:1008200043EB030313F4801F08BF013DF7D043EAF5 -:100830000603704794EA0C0F0CEA135518BF95EAAB -:100840000C0F0CD050EA410618BF52EA4306D1D132 -:1008500081EA030101F000414FF0000070BD50EA51 -:10086000410606BF1046194652EA430619D094EADB -:100870000C0F02D150EA013613D195EA0C0F05D1C5 -:1008800052EA03361CBF104619460AD181EA030119 -:1008900001F0004141F0FE4141F470014FF00000D1 -:1008A00070BD41F0FE4141F4780170BD70B54FF06C -:1008B000FF0C4CF4E06C1CEA11541DBF1CEA1355EC -:1008C00094EA0C0F95EA0C0F00F0A7F8A4EB0504CE -:1008D00081EA030E52EA03354FEA013100F08880C5 -:1008E0004FEA03334FF0805545EA131343EA12638E -:1008F0004FEA022245EA111545EA10654FEA002643 -:100900000EF000419D4208BF964244F1FD0404F5FB -:10091000407402D25B084FEA3202B61A65EB030557 -:100920005B084FEA32024FF480104FF4002CB6EB14 -:10093000020E75EB030E22BFB61A754640EA0C0094 -:100940005B084FEA3202B6EB020E75EB030E22BFD4 -:10095000B61A754640EA5C005B084FEA3202B6EB15 -:10096000020E75EB030E22BFB61A754640EA9C00D4 -:100970005B084FEA3202B6EB020E75EB030E22BFA4 -:10098000B61A754640EADC0055EA060E18D04FEA62 -:10099000051545EA16754FEA06164FEAC30343EA02 -:1009A00052734FEAC2025FEA1C1CC0D111F4801FCF -:1009B0000BD141EA00014FF000004FF0004CB6E7C8 -:1009C00011F4801F04BF01430020B4F1FD0C88BF67 -:1009D000BCF5E06F3FF6AFAEB5EB030C04BFB6EB72 -:1009E000020C5FEA500C50F1000041EB045170BD65 -:1009F0000EF0004E4EEA113114EB5C04C2BFD4EB92 -:100A00000C0541EA045170BD41F480114FF0000E15 -:100A1000013C90E645EA060E8DE60CEA135594EA91 -:100A20000C0F08BF95EA0C0F3FF43BAF94EA0C0F94 -:100A30000AD150EA01347FF434AF95EA0C0F7FF409 -:100A400025AF104619462CE795EA0C0F06D152EA5D -:100A500003353FF4FDAE1046194622E750EA410641 -:100A600018BF52EA43067FF4C5AE50EA41047FF452 -:100A70000DAF52EA43057FF4EBAE12E74FF0FF3CB7 -:100A800006E000BF4FF0010C02E000BF4FF0010C88 -:100A90004DF804CD4FEA410C7FEA6C5C4FEA430C01 -:100AA00018BF7FEA6C5C1BD001B050EA410C0CBF50 -:100AB00052EA430C91EA030F02BF90EA020F0020B2 -:100AC000704710F1000F91EA030F58BF994208BF19 -:100AD00090422CBFD8176FEAE37040F001007047D6 -:100AE0004FEA410C7FEA6C5C02D150EA013C07D12D -:100AF0004FEA430C7FEA6C5CD6D152EA033CD3D078 -:100B00005DF8040B704700BF8446104662468C4671 -:100B10001946634600E000BF01B5FFF7B7FF0028A4 -:100B200048BF10F1000F01BD4DF808EDFFF7F4FFCD -:100B30000CBF012000205DF808FB00BF4DF808ED58 -:100B4000FFF7EAFF34BF012000205DF808FB00BF7B -:100B50004DF808EDFFF7E0FF94BF012000205DF89D -:100B600008FB00BF4DF808EDFFF7CEFF94BF012052 -:100B700000205DF808FB00BF4DF808EDFFF7C4FF4B -:100B800034BF012000205DF808FB00BF4FEA410C94 -:100B90007FEA6C5C02D150EA013C0AD14FEA430C77 -:100BA0007FEA6C5C02D152EA033C02D14FF00000B4 -:100BB00070474FF0010070474FEA410212F50012F2 -:100BC00015D211D56FF47873B3EB625212D94FEA94 -:100BD000C12343F0004343EA505311F0004F23FA7E -:100BE00002F018BF404270474FF00000704750EAD3 -:100BF000013005D111F0004008BF6FF00040704790 -:100C00004FF00000704700BF4A0011D212F50012E9 -:100C100011D20DD56FF47873B3EB62520ED44FEA54 -:100C2000C12343F0004343EA505323FA02F07047D4 -:100C30004FF00000704750EA013002D14FF0FF3012 -:100C400070474FF00000704753B94AB9002908BFF8 -:100C500000281CBF4FF0FF314FF0FF3000F074B997 -:100C6000ADF1080C6DE904CE00F006F8DDF804E003 -:100C7000DDE9022304B070472DE9F047089D0446E2 -:100C80008E46002B4DD18A42944669D9B2FA82F23F -:100C900052B101FA02F3C2F1200120FA01F10CFA7B -:100CA00002FC41EA030E94404FEA1C48210CBEFBB3 -:100CB000F8F61FFA8CF708FB16E341EA034306FB3C -:100CC00007F199420AD91CEB030306F1FF3080F0CB -:100CD0001F81994240F21C81023E63445B1AA4B218 -:100CE000B3FBF8F008FB103344EA034400FB07F7BA -:100CF000A7420AD91CEB040400F1FF3380F00A81FB -:100D0000A74240F207816444023840EA0640E41BEF -:100D100000261DB1D4400023C5E900433146BDE89B -:100D2000F0878B4209D9002D00F0EF800026C5E93D -:100D3000000130463146BDE8F087B3FA83F6002E55 -:100D40004AD18B4202D3824200F2F980841A61EBCD -:100D5000030301209E46002DE0D0C5E9004EDDE7EB -:100D600002B9FFDEB2FA82F2002A40F09280A1EBD3 -:100D70000C014FEA1C471FFA8CFE0126200CB1FB28 -:100D8000F7F307FB131140EA01410EFB03F0884221 -:100D900008D91CEB010103F1FF3802D2884200F2AE -:100DA000CB804346091AA4B2B1FBF7F007FB101140 -:100DB00044EA01440EFB00FEA64508D91CEB0404DE -:100DC00000F1FF3102D2A64500F2BB800846A4EB39 -:100DD0000E0440EA03409CE7C6F12007B34022FA24 -:100DE00007FC4CEA030C20FA07F401FA06F31C4353 -:100DF000F9404FEA1C4900FA06F3B1FBF9F8200C60 -:100E00001FFA8CFE09FB181140EA014108FB0EF0A5 -:100E1000884202FA06F20BD91CEB010108F1FF3AF5 -:100E200080F08880884240F28580A8F10208614401 -:100E3000091AA4B2B1FBF9F009FB101144EA01410F -:100E400000FB0EFE8E4508D91CEB010100F1FF34BA -:100E50006CD28E456AD90238614440EA0840A0FB52 -:100E60000294A1EB0E01A142C846A64656D353D028 -:100E70005DB1B3EB080261EB0E0101FA07F722FA4C -:100E800006F3F1401F43C5E9007100263146BDE875 -:100E9000F087C2F12003D8400CFA02FC21FA03F3D8 -:100EA000914001434FEA1C471FFA8CFEB3FBF7F059 -:100EB00007FB10360B0C43EA064300FB0EF69E427E -:100EC00004FA02F408D91CEB030300F1FF382FD217 -:100ED0009E422DD9023863449B1B89B2B3FBF7F6BF -:100EE00007FB163341EA034106FB0EF38B4208D998 -:100EF0001CEB010106F1FF3816D28B4214D9023ED9 -:100F00006144C91A46EA004638E72E46284605E7F6 -:100F10000646E3E61846F8E64B45A9D2B9EB0208C7 -:100F200064EB0C0E0138A3E74646EAE7204694E757 -:100F30004046D1E7D0467BE7023B614432E730468A -:100F400009E76444023842E7704700BF80B500AF4C -:100F5000184B194A1A60174B05225A60154B00228C -:100F60009A60144B4FF08072DA60124B4FF45022AB -:100F70001A61104B4FF400125A610E4B00221A7680 -:100F80000C4B01225A760B4B00229A76094B012218 -:100F9000DA76084B00221A77064B00225A7705486A -:100FA00001F094FE0346002B01D000F0F1FD00BFDC -:100FB00080BD00BF0C0F00200064004080B58AB0E7 -:100FC00000AF786007F1140300221A605A609A603B -:100FD000DA601A617B681B68214A93423CD1002386 -:100FE0003B61204B1B6C1F4A43F0007313641D4B85 -:100FF0001B6C03F000733B613B690023FB60194BE2 -:101000001B6B184A43F002031363164B1B6B03F070 -:101010000203FB60FB684FF440737B610223BB61FA -:101020000023FB6103233B6209237B6207F1140366 -:1010300019460D4802F0DCFD00220021132002F0C9 -:10104000A0FD132002F0B9FD00220021142002F0BF -:1010500098FD142002F0B1FD00BF2837BD4680BDC9 -:1010600000640040003802400004024080B58EB0A9 -:1010700000AF07F11C0300221A605A609A60DA6020 -:101080001A615A619A613B4600221A605A609A605E -:10109000DA601A615A619A61664B4FF020421A6019 -:1010A000644B654A5A60634B00229A60614B002290 -:1010B000DA60604B00221A615E4B10225A615D4B70 -:1010C00000229A615B4B0022DA615A4B00225A627D -:1010D000584B4FF480529A62564B0022DA62554BBD -:1010E00000221A63534B00225A63524B00229A6328 -:1010F000504B0022DA634F4B00221A644D4B002202 -:101100005A640323FB610F233B6203237B620123A9 -:10111000BB621023FB6211233B6300237B6307F157 -:101120001C0300221946434802F075FF0346002BBA -:1011300001D000F02DFD414B414A1A603F4B002287 -:101140005A603E4B01229A603C4B0822DA603B4BCE -:1011500010221A61394B40225A61384B4FF4C07249 -:101160009A61364B0022DA61344B4FF400621A6206 -:10117000324B4FF480525A62304B4FF400529A6215 -:1011800002233B6008237B600623BB600623FB60D1 -:1011900004233B6102237B610223BB613B4619466A -:1011A000264802F0B9FE0346002B01D000F0F0FC07 -:1011B000244B234A1A60234B01225A60214B0122FF -:1011C0009A60204B0822DA601E4B10221A611D4BD8 -:1011D00040225A611B4B4FF4C0729A61194B002296 -:1011E000DA61184B4FF400621A62164B4FF48052CA -:1011F0005A62144B4FF400529A6202233B60082358 -:101200007B600623BB600623FB6004233B61022353 -:101210007B610223BB613B4619460A4802F07CFE13 -:101220000346002B01D000F0B3FC00BF3837BD46A9 -:1012300080BD00BF340F0020040100A0840F0020F7 -:10124000400100A0B80F002080B586B000AF3B1D64 -:1012500000221A605A609A60DA601A613B4B1B6880 -:10126000002B6FD1394B01221A6000233B60384BB1 -:101270009B6B374A43F001039363354B9B6B03F041 -:1012800001033B603B684FF63F037B600223BB607A -:101290000023FB6003233B610C237B613B1D19464C -:1012A0002C4802F0A5FC19237B600223BB600023BD -:1012B000FB6003233B610C237B613B1D19462648E1 -:1012C00002F096FC48F237137B600223BB600023D8 -:1012D000FB6003233B610C237B613B1D19461F48C8 -:1012E00002F086FC4FF683737B600223BB60002311 -:1012F000FB6003233B610C237B613B1D19461848AF -:1013000002F076FC4CF2B3737B600223BB600023D7 -:10131000FB6003233B610C237B613B1D1946114895 -:1013200002F066FC60237B600223BB600023FB604D -:1013300003233B610C237B613B1D19460A4802F0E5 -:1013400057FC00E000BF1837BD4680BDEC0F002001 -:101350000038024000140240000802400018024019 -:1013600000100240000C02400004024080B582B030 -:1013700000AF7860FFF768FF00BF0837BD4680BD4B -:1013800080B582B000AF7860FFF75EFF00BF08371E -:10139000BD4680BD80B400AF044BDB681B0A03F080 -:1013A00007031846BD465DF8047B704700ED00E07A -:1013B00080B483B000AF0346FB7197F90730002B70 -:1013C0000BDBFB7903F01F02074997F907305B0934 -:1013D000012000FA02F241F8232000BF0C37BD467D -:1013E0005DF8047B704700BF00E100E080B483B08B -:1013F00000AF03463960FB7197F90730002B0ADB19 -:101400003B68DAB20C4997F907301201D2B20B44AB -:1014100083F800230AE03B68DAB20849FB7903F05D -:101420000F03043B1201D2B20B441A7600BF0C37F3 -:10143000BD465DF8047B704700E100E000ED00E090 -:1014400080B489B000AFF860B9607A60FB6803F0DF -:101450000703FB61FB69C3F10703042B28BF0423C7 -:10146000BB61FB690433062B02D9FB69033B00E037 -:1014700000237B614FF0FF32BB6902FA03F3DA43CA -:10148000BB681A407B699A404FF0FF317B6901FAD3 -:1014900003F3D9437B680B40134318462437BD46FA -:1014A0005DF8047B7047000080B485B000AF7860C1 -:1014B000084B1A6B07497B6813430B63054B1A6B88 -:1014C0007B681340FB60FB6800BF1437BD465DF8C6 -:1014D000047B70470038024080B485B000AF78606C -:1014E0003960134A3B68DBB2023352F823203B6871 -:1014F0001B0CDB4302EA03013B681B0CFB60FB682F -:1015000093FAA3F3BB60BB68B3FA83F3DBB21A466A -:101510007B6803FA02F206483B68DBB20A430233F7 -:1015200040F8232000BF1437BD465DF8047B7047A8 -:101530000038014080B489B000AFF860B9607A60CB -:10154000FB681A68BB687B617B6993FAA3F33B6114 -:101550003B69B3FA83F3DBB25B00032101FA03F3C7 -:10156000DB431A40BB68FB61FB6993FAA3F3BB61E1 -:10157000BB69B3FA83F3DBB25B00796801FA03F36A -:101580001A43FB681A6000BF2437BD465DF8047B30 -:10159000704780B489B000AFF860B9607A60FB68CA -:1015A000DA68BB687B617B6993FAA3F33B613B69B3 -:1015B000B3FA83F3DBB25B00032101FA03F3DB43ED -:1015C0001A40BB68FB61FB6993FAA3F3BB61BB697B -:1015D000B3FA83F3DBB25B00796801FA03F31A43D1 -:1015E000FB68DA6000BF2437BD465DF8047B7047B6 -:1015F00080B483B000AF786039607B683A689A61E4 -:1016000000BF0C37BD465DF8047B704780B483B0E3 -:1016100000AF786039603B681A047B689A6100BF4C -:101620000C37BD465DF8047B7047000080B588B07C -:1016300000AF07F1180300221A605A603B460022EF -:101640001A605A609A60DA601A615A610420FFF7E2 -:101650002BFF2020FFF728FF8020FFF725FF012028 -:10166000FFF722FF4020FFF71FFF1020FFF71CFFAE -:101670000220FFF719FF0820FFF716FF4FF4C041C3 -:101680005F48FFF7B5FF48F210015E48FFF7B0FF73 -:101690004FF480515C48FFF7ABFF4FF4807158481E -:1016A000FFF7B4FF4FF400533B6001237B6000233E -:1016B000BB600123FB6001233B613B461946504858 -:1016C00003F052F94FF480433B6001237B60002319 -:1016D000BB600023FB6001233B613B461946484841 -:1016E00003F042F948F210033B6001237B600223C0 -:1016F000BB600123FB6001233B613B461946414827 -:1017000003F032F94FF480533B6001237B600223E6 -:10171000BB600123FB6001233B613B4619463A480D -:1017200003F022F94FF480733B6001237B600223B6 -:10173000BB600023FB6002233B613B4619463048F7 -:1017400003F012F931490220FFF7C6FE30490320A9 -:10175000FFF7C2FE4FF40043BB6101233B77002338 -:101760007B770223BB7707F11803184602F030FDA0 -:101770004023BB6101233B7700237B770223BB77A8 -:1017800007F11803184602F023FD01224FF400412F -:101790001B48FFF7FEFE012240211E48FFF7F9FE1D -:1017A00000224FF400411648FFF7C4FE00224021FA -:1017B0001848FFF7BFFEFFF7EDFD034600220021AA -:1017C0001846FFF73DFE034619461720FFF70EFEA9 -:1017D0001720FFF7EDFDFFF7DDFD03460022002196 -:1017E0001846FFF72DFE034619462820FFF7FEFD99 -:1017F0002820FFF7DDFD00BF2037BD4680BD00BFBC -:10180000000802400000024000040240030000F013 -:101810000100000F000C024080B400AF054B1B68B4 -:10182000044A43F48023136000BFBD465DF8047B87 -:10183000704700BF0038024080B400AF054B1B6802 -:10184000044A43F48033136000BFBD465DF8047B57 -:10185000704700BF0038024080B400AF074B1B68E0 -:1018600003F40033B3F5003F0CBF01230023DBB2C8 -:101870001846BD465DF8047B704700BF0038024043 -:1018800080B483B000AF7860064B9B6823F00302FE -:1018900004497B6813438B6000BF0C37BD465DF87D -:1018A000047B70470038024080B400AF044B9B6853 -:1018B00003F00C031846BD465DF8047B704700BF7B -:1018C0000038024080B483B000AF7860064B9B685C -:1018D00023F0F00204497B6813438B6000BF0C3790 -:1018E000BD465DF8047B70470038024080B483B089 -:1018F00000AF7860064B9B6823F4E05204497B6894 -:1019000013438B6000BF0C37BD465DF8047B704706 -:101910000038024080B483B000AF7860064B9B680B -:1019200023F4604204497B6813438B6000BF0C378B -:10193000BD465DF8047B70470038024080B483B038 -:1019400000AF7860074BD3F88C3023F080720549E4 -:101950007B681343C1F88C3000BF0C37BD465DF87F -:10196000047B70470038024080B400AF054B1B6811 -:10197000044A43F08073136000BFBD465DF8047BEA -:10198000704700BF0038024080B400AF074B1B68AF -:1019900003F00073B3F1007F0CBF01230023DBB21F -:1019A0001846BD465DF8047B704700BF0038024012 -:1019B00080B485B000AFF860B9607A603B60114BCD -:1019C0005A68114B1340F968BA6811437A6892015A -:1019D0000A430C4913434B600A4B5B6823F44032C3 -:1019E00008493B6813434B60064B5B6823F0E042B9 -:1019F00004493B6813434B6000BF1437BD465DF894 -:101A0000047B7047003802400080BFFF80B483B081 -:101A100000AF7860064B1B6823F00F0204497B6817 -:101A200013430B6000BF0C37BD465DF8047B704765 -:101A3000003C024080B400AF044B1B6803F00F036E -:101A40001846BD465DF8047B704700BF003C02406D -:101A500080B400AF054B1B68044A43F48033136025 -:101A600000BFBD465DF8047B704700BF00700040BA -:101A700080B483B000AF7860064B1B6823F440420B -:101A800004497B6813430B6000BF0C37BD465DF80B -:101A9000047B70470070004080B500AF22F05CFE10 -:101AA00001F0A2F800F022F8FFF7C0FD00F0B2FF4D -:101AB00001F010F8FFF7DAFA00F0CCF8FFF746FA79 -:101AC00000F030F900F082F900F018FD00F076FD2A -:101AD00000F0AEFD00F0E2FD00F016FE00F04EFE5C -:101AE00000F082FE22F054FEFEE7000080B500AF59 -:101AF0000520FFF78BFF00BFFFF79CFF0346052B78 -:101B0000FAD14FF44040FFF7B3FFFFF7A1FFFFF713 -:101B100083FEFFF791FE00BFFFF79EFE0346012BF9 -:101B2000FAD14FF000534FF4B4720C214FF48000FF -:101B3000FFF73EFFFFF718FF00BFFFF725FF034643 -:101B4000012BFAD10020FFF7BDFE4FF4A050FFF7A4 -:101B5000CDFE4FF40040FFF7DDFE0320FFF790FEBF -:101B600000BFFFF7A1FE03460C2BFAD1074803F094 -:101B700017FD002001F05AF80346002B01D000F0B9 -:101B800007F80020FFF7DAFE00BF80BD0095BA0A13 -:101B900080B400AF72B600BFFEE7000080B485B02D -:101BA00000AF7860084B1A6B07497B6813430B63DF -:101BB000054B1A6B7B681340FB60FB6800BF143752 -:101BC000BD465DF8047B70470038024080B485B0A4 -:101BD00000AF7860084B1A6C07497B6813430B64AD -:101BE000054B1A6C7B681340FB60FB6800BF143721 -:101BF000BD465DF8047B70470038024080B485B074 -:101C000000AF7860084B5A6C07497B6813434B64FC -:101C1000054B5A6C7B681340FB60FB6800BF1437B0 -:101C2000BD465DF8047B70470038024080B483B045 -:101C300000AF786039607B685B6823F010023B6816 -:101C40001A437B685A6000BF0C37BD465DF8047BC1 -:101C50007047000080B590B000AF07F1180328224C -:101C60000021184622F0E6FD3B4600221A605A6029 -:101C70009A60DA601A615A614FF48050FFF7BEFF34 -:101C80000120FFF78BFF0220FFF788FFC0233B6096 -:101C900002237B600323BB600023FB6000233B61C6 -:101CA00005237B613B4619461B4802F05DFE082375 -:101CB0003B6002237B600323BB600023FB600023A7 -:101CC0003B6105237B613B461946144802F04CFEFC -:101CD0000023BB614FF48273FB6100233B6200234E -:101CE0007B620023BB624FF40073FB6200233B6303 -:101CF00000237B630023BB630A23FB6307F1180304 -:101D00001946074803F03FF800210548FFF78EFF0A -:101D100000BF4037BD4680BD0000024000040240C5 -:101D20000030014080B590B000AF07F118032822C1 -:101D30000021184622F07EFD3B4600221A605A60C0 -:101D40009A60DA601A615A614FF48040FFF73EFFF3 -:101D50000220FFF723FF4FF460433B6002237B60C8 -:101D60000323BB600023FB6000233B6105237B61F1 -:101D70003B461946134802F0F7FD0023BB614FF4C0 -:101D80008273FB6100233B6200237B620023BB6202 -:101D90004FF40073FB6200233B6300237B6300234B -:101DA000BB630A23FB6307F118031946064802F0D8 -:101DB000EAFF00210448FFF739FF00BF4037BD4666 -:101DC00080BD00BF000402400038004080B590B0E4 -:101DD00000AF07F1180328220021184622F02AFD3F -:101DE0003B4600221A605A609A60DA601A615A61B2 -:101DF0004FF40040FFF7EAFE0420FFF7CFFE022079 -:101E0000FFF7CCFE4FF4A0533B6002237B6003231B -:101E1000BB600023FB6000233B6106237B613B46E4 -:101E200019461C4802F0A0FD10233B6002237B6092 -:101E30000323BB600023FB6000233B6106237B611F -:101E40003B461946144802F08FFD0023BB614FF456 -:101E50008273FB6100233B6200237B620023BB6231 -:101E60004FF40073FB6200233B6300237B6300237A -:101E7000BB630A23FB6307F118031946074802F006 -:101E800082FF00210548FFF7D1FE00BF4037BD4665 -:101E900080BD00BF0008024000040240003C00403A -:101EA00080B483B000AF00237B60104B5B6C0F4AA3 -:101EB00043F4804353640D4B5B6C03F480437B60BD -:101EC0007B6800233B60094B1B6C084A43F080533E -:101ED0001364064B1B6C03F080533B603B6800BFF0 -:101EE0000C37BD465DF8047B704700BF00380240E8 -:101EF00080B483B000AF7860074B5A697B681340A9 -:101F00007A689A420CBF01230023DBB218460C37D3 -:101F1000BD465DF8047B7047003C014080B483B04F -:101F200000AF7860044A7B68536100BF0C37BD4640 -:101F30005DF8047B704700BF003C014080B483B073 -:101F400000AF78607B686FF001021A6100BF0C3748 -:101F5000BD465DF8047B704780B483B000AF786005 -:101F60007B681B6903F00103012B01D1012300E011 -:101F7000002318460C37BD465DF8047B704780B5DA -:101F800082B000AFEFF308833B603B6810337B60A7 -:101F9000796804200AF072F8FEE780B582B000AFDD -:101FA000EFF308833B603B6810337B607968002067 -:101FB0000AF064F8FEE780B582B000AFEFF3088363 -:101FC0003B603B6810337B60796801200AF056F86B -:101FD000FEE780B582B000AFEFF308833B603B685B -:101FE00010337B60796802200AF048F8FEE780B57C -:101FF00082B000AFEFF308833B603B6810337B6037 -:10200000796803200AF03AF8FEE780B400AF00BF19 -:10201000BD465DF8047B704780B400AF00BFBD468D -:102020005DF8047B704780B400AF00BFBD465DF82B -:10203000047B704780B500AF06F058F900F026FE2B -:1020400000BF80BD80B500AF024801F0C1FA00BFFB -:1020500080BD00BF0C0F002080B500AF024801F02A -:10206000B7FA00BF80BD00BF0C0F002080B500AFE5 -:102070004020FFF73DFF0346002B04D04020FFF730 -:102080004DFF18F093FA00BF80BD000080B500AF8F -:102090000648FFF761FF0346012B04D10348FFF711 -:1020A0004DFF0AF0F1FE00BF80BD00BF00400140BF -:1020B00080B500AF0648FFF74FFF0346012B04D160 -:1020C0000348FFF73BFF0BF0E7F800BF80BD00BF00 -:1020D0000044014080B500AF0648FFF73DFF0346CE -:1020E000012B04D10348FFF729FF0BF0DDFA00BFF5 -:1020F00080BD00BF0048014080B500AF05F0FAF98F -:1021000000BF80BD80B500AF4FF40040FFF7F0FE88 -:102110000346002B03D04FF40040FFF7FFFE00BF43 -:1021200080BD000080B500AF0648FFF715FF0346ED -:10213000012B04D10348FFF701FF0BF0BDFC00BFEA -:1021400080BD00BF0018004080B500AF0B48FFF70E -:1021500003FF0346012B04D10848FFF7EFFE0CF004 -:1021600097FA0748FFF7F8FE0346012B04D104480D -:10217000FFF7E4FE0BF0A8FE00BF80BD00040140A5 -:10218000001C004080B500AF0648FFF7E5FE03469F -:10219000012B04D10348FFF7D1FE0CF09DF800BFDE -:1021A00080BD00BF0020004080B500AF05F092FA6E -:1021B00000BF80BD80B400AF01231846BD465DF866 -:1021C000047B704780B582B000AF7860396022F040 -:1021D000E9FA034616221A604FF0FF331846083713 -:1021E000BD4680BD80B582B000AF78604FF0FF3152 -:1021F0007868FFF7E7FFFEE780B483B000AF786050 -:102200004FF0FF3318460C37BD465DF8047B70472E -:1022100080B483B000AF786039603B684FF40052FF -:102220005A60002318460C37BD465DF8047B7047A2 -:1022300080B483B000AF7860012318460C37BD46E8 -:102240005DF8047B704780B485B000AFF860B9607A -:102250007A60002318461437BD465DF8047B70474A -:1022600080B586B000AF7860144A154BD31A7B61F5 -:102270007B693B61134B1B68002B02D1114B124A47 -:102280001A60104B1A687B6813443A699A4207D265 -:1022900022F088FA03460C221A604FF0FF3309E05F -:1022A000084B1B68FB60074B1A687B681344054AA0 -:1022B0001360FB6818461837BD4680BD0000022039 -:1022C00000040000F00F0020A856002080B400AFEA -:1022D000084BD3F88830074A43F47003C2F88830BB -:1022E000044B4FF000629A6000BFBD465DF8047B6E -:1022F000704700BF00ED00E080B400AF044BDB6826 -:102300001B0A03F007031846BD465DF8047B7047BF -:1023100000ED00E080B483B000AF0346FB7197F995 -:102320000730002B0BDBFB7903F01F02074997F9FD -:1023300007305B09012000FA02F241F8232000BFB8 -:102340000C37BD465DF8047B704700BF00E100E03C -:1023500080B483B000AF03463960FB7197F9073052 -:10236000002B0ADB3B68DAB20C4997F907301201FF -:10237000D2B20B4483F800230AE03B68DAB2084982 -:10238000FB7903F00F03043B1201D2B20B441A761F -:1023900000BF0C37BD465DF8047B704700E100E0EC -:1023A00000ED00E080B489B000AFF860B9607A60F9 -:1023B000FB6803F00703FB61FB69C3F10703042B10 -:1023C00028BF0423BB61FB690433062B02D9FB69D8 -:1023D000033B00E000237B614FF0FF32BB6902FA50 -:1023E00003F3DA43BB681A407B699A404FF0FF3130 -:1023F0007B6901FA03F3D9437B680B40134318460A -:102400002437BD465DF8047B7047000080B485B07A -:1024100000AF7860084B1A6C07497B6813430B6464 -:10242000054B1A6C7B681340FB60FB6800BF1437D8 -:10243000BD465DF8047B70470038024080B485B02B -:1024400000AF7860084B5A6C07497B6813434B64B4 -:10245000054B5A6C7B681340FB60FB6800BF143768 -:10246000BD465DF8047B70470038024080B483B0FD -:1024700000AF78607B681B6823F080027B681A607D -:1024800000BF0C37BD465DF8047B704780B483B055 -:1024900000AF786039607B689B6823F4804323F049 -:1024A00007033A681A437B689A6000BF0C37BD4641 -:1024B0005DF8047B704780B483B000AF786039600A -:1024C0007B685B6823F070023B681A437B685A6044 -:1024D00000BF0C37BD465DF8047B704780B483B005 -:1024E00000AF78607B689B6823F080027B689A600D -:1024F00000BF0C37BD465DF8047B704780B586B0E1 -:1025000000AF3B1D00221A605A609A60DA601A61BF -:102510000220FFF793FFFFF7EFFE034600220021A2 -:102520001846FFF73FFF034619462B20FFF710FF21 -:102530002B20FFF7EFFEFFF7DFFE0346002200210E -:102540001846FFF72FFF034619462C20FFF700FF20 -:102550002C20FFF7DFFEFFF7CFFE0346002200210D -:102560001846FFF71FFF034619462D20FFF7F0FE20 -:102570002D20FFF7CFFEB323BB800023BB60632376 -:10258000FB6000233B6100233B753B1D19460A4855 -:1025900002F086FC0848FFF769FF00210648FFF7B4 -:1025A00075FF00210448FFF786FF0348FFF796FFF9 -:1025B00000BF1837BD4680BD0004014080B586B01D -:1025C00000AF3B1D00221A605A609A60DA601A61FF -:1025D0004FF48030FFF732FFFFF78EFE03460022F4 -:1025E00000211846FFF7DEFE034619461820FFF7C4 -:1025F000AFFE1820FFF78EFE40F22B13BB800023A6 -:10260000BB604FF6FF73FB6000233B613B1D194627 -:10261000064802F045FC0548FFF728FF0021034863 -:10262000FFF734FF00BF1837BD4680BD00400140B2 -:1026300080B586B000AF3B1D00221A605A609A60D8 -:10264000DA601A614FF40030FFF7F8FEFFF754FE2E -:102650000346002200211846FFF7A4FE0346194650 -:102660001920FFF775FE1920FFF754FE40F22B13D7 -:10267000BB800023BB604FF6FF73FB6000233B6110 -:102680003B1D1946044802F00BFC0348FFF7EEFE21 -:1026900000BF1837BD4680BD0044014080B586B0FC -:1026A00000AF3B1D00221A605A609A60DA601A611E -:1026B0004FF48020FFF7C2FEFFF71EFE0346002204 -:1026C00000211846FFF76EFE034619461A20FFF751 -:1026D0003FFE1A20FFF71EFE40F22B13BB800023A3 -:1026E000BB604FF6FF73FB6000233B613B1D194647 -:1026F000044802F0D5FB0348FFF7B8FE00BF1837C7 -:10270000BD4680BD0048014080B586B000AF3B1D8E -:1027100000221A605A609A60DA601A614020FFF75E -:1027200075FEFFF7E9FD0346002200211846FFF77A -:1027300039FE034619462B20FFF70AFE2B20FFF730 -:10274000E9FD40F22B13BB800023BB604FF6FF7303 -:10275000FB6000233B613B1D1946074802F0A0FBCC -:102760000548FFF783FE00210348FFF78FFE00BFF7 -:102770001837BD4680BD00BF0018004080B586B048 -:1027800000AF3B1D00221A605A609A60DA601A613D -:102790008020FFF73BFEFFF7AFFD0346002200213C -:1027A0001846FFF7FFFD034619462C20FFF7D0FD22 -:1027B0002C20FFF7AFFD40F22B13BB800023BB6042 -:1027C0004FF6FF73FB6000233B613B1D1946054834 -:1027D00002F066FB0348FFF749FE00BF1837BD460D -:1027E00080BD00BF001C004080B586B000AF3B1D1F -:1027F00000221A605A609A60DA601A614FF48070A1 -:10280000FFF704FEFFF778FD03460022002118467B -:10281000FFF7C8FD034619462D20FFF799FD2D202F -:10282000FFF778FD40F22B13BB800023BB604FF60F -:10283000FF73FB6000233B613B1D1946044802F017 -:102840002FFB0348FFF712FE00BF1837BD4680BDBF -:102850000020004080B400AF044BDB681B0A03F08B -:1028600007031846BD465DF8047B704700ED00E0A5 -:1028700080B483B000AF0346FB7197F90730002B9B -:102880000BDBFB7903F01F02074997F907305B095F -:10289000012000FA02F241F8232000BF0C37BD46A8 -:1028A0005DF8047B704700BF00E100E080B483B0B6 -:1028B00000AF03463960FB7197F90730002B0ADB44 -:1028C0003B68DAB20C4997F907301201D2B20B44D7 -:1028D00083F800230AE03B68DAB20849FB7903F089 -:1028E0000F03043B1201D2B20B441A7600BF0C371F -:1028F000BD465DF8047B704700E100E000ED00E0BC -:1029000080B489B000AFF860B9607A60FB6803F00A -:102910000703FB61FB69C3F10703042B28BF0423F2 -:10292000BB61FB690433062B02D9FB69033B00E062 -:1029300000237B614FF0FF32BB6902FA03F3DA43F5 -:10294000BB681A407B699A404FF0FF317B6901FAFE -:1029500003F3D9437B680B40134318462437BD4625 -:102960005DF8047B7047000080B485B000AF7860EC -:10297000084B1A6B07497B6813430B63054B1A6BB3 -:102980007B681340FB60FB6800BF1437BD465DF8F1 -:10299000047B70470038024080B485B000AF786097 -:1029A000084B5A6C07497B6813434B64054B5A6CC0 -:1029B0007B681340FB60FB6800BF1437BD465DF8C1 -:1029C000047B70470038024080B483B000AF786069 -:1029D0007B68DB6843F400527B68DA6000BF0C3729 -:1029E000BD465DF8047B704780B483B000AF78606B -:1029F0007B681B6923F490427B681A617B685B6982 -:102A000023F02A027B685A6100BF0C37BD465DF88F -:102A1000047B704780B58EB000AF07F11C03002225 -:102A20001A605A609A60DA601A615A619A613B1DB5 -:102A300000221A605A609A60DA601A615A611020A6 -:102A4000FFF7AAFF0120FFF78FFF4FF4C0637B6001 -:102A50000223BB600323FB6000233B6100237B61F7 -:102A60000723BB613B1D1946184801F07DFFFFF7A6 -:102A7000F1FE0346002200211846FFF741FF0346FE -:102A800019462520FFF712FF2520FFF7F1FE4FF42E -:102A9000E133FB6100233B6200237B620023BB62C6 -:102AA0000C23FB6200233B6300237B6307F11C03C1 -:102AB0001946074802F0F4FC0548FFF795FF044863 -:102AC000FFF782FF00BF3837BD4680BD00000240DF -:102AD0000010014080B58EB000AF07F11C0300224A -:102AE0001A605A609A60DA601A615A619A613B1DF5 -:102AF00000221A605A609A60DA601A615A612020D6 -:102B0000FFF74AFF0420FFF72FFFC0237B6002235B -:102B1000BB600323FB6000233B6100237B61082330 -:102B2000BB613B1D1946194801F01EFFFFF792FEDD -:102B30000346002200211846FFF7E2FE034619462D -:102B40004720FFF7B3FE4720FFF792FE4FF4E13333 -:102B5000FB6100233B6200237B620023BB620C23EA -:102B6000FB6200233B6300237B6307F11C031946D0 -:102B7000074802F095FC0648FFF736FF0448FFF7C8 -:102B800023FF00BF3837BD4680BD00BF00080240AC -:102B900000140140DFF834D0002103E00C4B5B58F7 -:102BA000435004310B480C4B42189A42F6D30B4A5F -:102BB00002E0002342F8043B094B9A42F9D3FFF7A5 -:102BC00085FB21F0F5FDFEF767FF7047000002204E -:102BD0009CF8030800000020F00E0020F00E0020FA -:102BE000A4560020FEE7000080B500AF0E4B1B6826 -:102BF0000D4A43F4007313600B4B1B680A4A43F4FD -:102C000080631360084B1B68074A43F480731360AA -:102C1000032000F0ABFF002000F008F8FFF740F9B8 -:102C20000023184680BD00BF003C024080B582B042 -:102C300000AF7860124B1A68124B1B7819464FF49C -:102C40007A73B3FBF1F3B2FBF3F3184600F0C3FF62 -:102C50000346002B01D001230EE07B680F2B0AD81E -:102C6000002279684FF0FF3000F08BFF064A7B6846 -:102C70001360002300E0012318460837BD4680BDDD -:102C800000000020080000200400002080B400AFF5 -:102C9000064B1B781A46064B1B681344044A136004 -:102CA00000BFBD465DF8047B704700BF08000020F0 -:102CB000F40F002080B400AF034B1B681846BD46DC -:102CC0005DF8047B704700BFF40F002080B584B02E -:102CD00000AF78607B68002B01D10123EDE07B68B9 -:102CE00093F82030DBB2002B02D17868FEF766F94A -:102CF0007B681B681A687B681B6822F002021A60F6 -:102D0000FFF7D8FFF86012E0FFF7D4FF0246FB6838 -:102D1000D31A0A2B0BD97B685B6A43F400327B68B9 -:102D20005A627B68052283F820200123C5E07B6876 -:102D30001B685B6803F00203002BE5D17B681B680E -:102D40001A687B681B6842F001021A60FFF7B2FF45 -:102D5000F86012E0FFF7AEFF0246FB68D31A0A2BB9 -:102D60000BD97B685B6A43F400327B685A627B68EC -:102D7000052283F8202001239FE07B681B685B68A5 -:102D800003F00103002BE5D07B681B7E012B08D1EB -:102D90007B681B681A687B681B6842F080021A60B7 -:102DA00007E07B681B681A687B681B6822F080025A -:102DB0001A607B685B7E012B08D17B681B681A68F0 -:102DC0007B681B6842F040021A6007E07B681B6862 -:102DD0001A687B681B6822F040021A607B689B7E41 -:102DE000012B08D17B681B681A687B681B6842F05E -:102DF00020021A6007E07B681B681A687B681B6802 -:102E000022F020021A607B68DB7E012B08D17B68F0 -:102E10001B681A687B681B6822F010021A6007E0C2 -:102E20007B681B681A687B681B6842F010021A6096 -:102E30007B681B7F012B08D17B681B681A687B6845 -:102E40001B6842F008021A6007E07B681B681A687A -:102E50007B681B6822F008021A607B685B7F012B8D -:102E600008D17B681B681A687B681B6842F0040203 -:102E70001A6007E07B681B681A687B681B6822F091 -:102E800004021A607B689A687B68DB681A437B6877 -:102E90001B691A437B685B6942EA03017B685B68D4 -:102EA0005A1E7B681B680A43DA617B6800225A62FB -:102EB0007B68012283F82020002318461037BD4686 -:102EC00080BD000080B487B000AF786039607B6857 -:102ED0001B687B617B6893F82030FB74FB7C012BC3 -:102EE00003D0FB7C022B40F0BE80654B7B617B698D -:102EF000D3F8003243F001027B69C3F800227B69FA -:102F0000D3F8003223F47C527B69C3F800227B693A -:102F1000D3F800223B685B6A1B021A437B69C3F843 -:102F200000223B685B6903F01F03012202FA03F3EE -:102F3000FB607B69D3F81C22FB68DB431A407B698A -:102F4000C3F81C223B68DB69002B23D17B69D3F8D3 -:102F50000C22FB68DB431A407B69C3F80C223B68F8 -:102F6000DB6819043B685B689BB23A685269194395 -:102F70007B69483243F832103B689B6819043B6810 -:102F80001B689AB23B685B690A4379694833DB0086 -:102F90000B445A603B68DB69012B22D17B69D3F873 -:102FA0000C22FB681A437B69C3F80C223B681B6840 -:102FB00019043B685B689BB23A68526919437B69A4 -:102FC000483243F832103B689B6819043B68DB6861 -:102FD0009AB23B685B690A4379694833DB000B446A -:102FE0005A603B689B69002B09D17B69D3F80422A6 -:102FF000FB68DB431A407B69C3F8042207E07B6966 -:10300000D3F80422FB681A437B69C3F804223B68A7 -:103010001B69002B09D17B69D3F81422FB68DB43C1 -:103020001A407B69C3F8142207E07B69D3F81422A5 -:10303000FB681A437B69C3F814223B681B6A012BA7 -:1030400007D17B69D3F81C22FB681A437B69C3F85C -:103050001C227B69D3F8003223F001027B69C3F89C -:103060000022002306E07B685B6A43F480227B68D1 -:103070005A62012318461C37BD465DF8047B704731 -:103080000064004080B584B000AF78607B6893F83E -:103090002030DBB2012B2ED17B68022283F8202066 -:1030A0007B681B681A687B681B6822F001021A6043 -:1030B000FFF700FEF86012E0FFF7FCFD0246FB6838 -:1030C000D31A0A2B0BD97B685B6A43F400327B6806 -:1030D0005A627B68052283F82020012312E07B6876 -:1030E0001B685B6803F00103002BE5D17B680022BD -:1030F0005A62002306E07B685B6A43F400227B6827 -:103100005A62012318461037BD4680BD80B489B08D -:1031100000AFF860B9607A603B60FB6893F82030DC -:10312000FB77FB681B689B68BB61FB7F012B03D0AF -:10313000FB7F022B40F0B880BB6903F08063002B5B -:103140000AD1BB6903F00063002B05D1BB6903F012 -:103150008053002B00F0A080BB691B0E03F003031B -:103160007B617B69022B07D9FB685B6A43F4000231 -:10317000FB685A6201239EE001227B699A403B680A -:103180001A60BB689B68002B0DD1BB681B685A0591 -:10319000BB68DB68F96809681A437B6918331B014F -:1031A0000B441A600FE0BB685B68DA00BB689B6881 -:1031B0001A43BB68DB68F96809681A437B691833EE -:1031C0001B010B441A60FB681968BB681A697B69AC -:1031D00018331B010B4404331A60BB681B7D012BA1 -:1031E00011D1FB681A687B6918331B01134404333F -:1031F0001B68FA68116843F480727B6918331B01FD -:103200000B4404331A607B6807331B781A067B680B -:1032100006331B781B041A437B6805331B781B029B -:1032200013437A68043212781046FA68116843EA48 -:1032300000027B691B010B4403F5C6731A607B68AF -:1032400003331B781A067B6802331B781B041A436E -:103250007B6801331B781B0213437A68127810468F -:10326000FA68116843EA00027B691B010B4403F50D -:10327000C4731A60FB681A687B6918331B01134416 -:103280001B68FA68116843F001027B6918331B015F -:103290000B441A6000230EE0FB685B6A43F40012E3 -:1032A000FB685A62012306E0FB685B6A43F48022F4 -:1032B000FB685A62012318462437BD465DF8047B3B -:1032C000704780B487B000AFF860B9607A603B6047 -:1032D000FB6893F82030FB75FB7D012B03D0FB7D51 -:1032E000022B40F0F380BB68002B0ED1FB681B68FB -:1032F000DB6803F00303002B16D1FB685B6A43F421 -:103300000012FB685A620123E7E0FB681B681B6937 -:1033100003F00303002B07D1FB685B6A43F4001240 -:10332000FB685A620123D8E0FB681A68BB681B334C -:103330001B0113441B6803F004027B689A607B68DE -:103340009B68002B0CD1FB681A68BB681B331B0100 -:1033500013441B685B0DC3F30A027B681A600BE021 -:10336000FB681A68BB681B331B0113441B68DB082E -:1033700023F060427B685A60FB681A68BB681B33A5 -:103380001B0113441B6803F002027B68DA60FB68D0 -:103390001A68BB681B331B01134404331B6803F01A -:1033A0000F027B681A61FB681A68BB681B331B013C -:1033B000134404331B681B0ADAB27B689A61FB680A -:1033C0001A68BB681B331B01134404331B681B0CB6 -:1033D0009AB27B685A61FB681A68BB681B01134488 -:1033E00003F5DC731B68DAB23B681A70FB681A6875 -:1033F000BB681B01134403F5DC731B681A0A3B68A6 -:103400000133D2B21A70FB681A68BB681B011344FF -:1034100003F5DC731B681A0C3B680233D2B21A70D6 -:10342000FB681A68BB681B01134403F5DC731B6857 -:103430001A0E3B680333D2B21A70FB681A68BB6875 -:103440001B01134403F5DE731A683B680433D2B2E0 -:103450001A70FB681A68BB681B01134403F5DE731E -:103460001B681A0A3B680533D2B21A70FB681A68E7 -:10347000BB681B01134403F5DE731B681A0C3B6821 -:103480000633D2B21A70FB681A68BB681B0113447A -:1034900003F5DE731B681A0E3B680733D2B21A704D -:1034A000BB68002B08D1FB681B68DA68FB681B68E7 -:1034B00042F02002DA6007E0FB681B681A69FB68CB -:1034C0001B6842F020021A61002306E0FB685B6A79 -:1034D00043F48022FB685A62012318461C37BD461C -:1034E0005DF8047B704780B485B000AF78603960C8 -:1034F0000023FB607B6893F82030FB72FB7A012B82 -:1035000002D0FB7A022B0FD13B68002B06D17B68DF -:103510001B68DB6803F00303FB6005E07B681B6846 -:103520001B6903F00303FB60FB6818461437BD46B4 -:103530005DF8047B704780B485B000AF7860396077 -:103540007B6893F82030FB73FB7B012B02D0FB7B65 -:10355000022B09D17B681B6859697B681B683A6834 -:103560000A435A61002306E07B685B6A43F48022C9 -:103570007B685A62012318461437BD465DF8047B08 -:10358000704780B485B000AF786039607B6893F88D -:103590002030FB73FB7B012B02D0FB7B022B0AD17B -:1035A0007B681B6859693B68DA437B681B680A4083 -:1035B0005A61002306E07B685B6A43F480227B68E3 -:1035C0005A62012318461437BD465DF8047B7047E4 -:1035D00080B58AB000AF786000237B627B681B688F -:1035E0005B693B627B681B685B68FB617B681B688F -:1035F0009B68BB617B681B68DB687B617B681B68C1 -:103600001B693B617B681B689B69FB603B6A03F03D -:103610000103002B7CD0BB6903F00103002B23D0F6 -:103620007B681B6801229A60BB6903F00203002BD0 -:1036300003D0786802F050FD16E0BB6903F0040384 -:10364000002B04D07B6A43F400637B620CE0BB690F -:1036500003F00803002B04D07B6A43F480537B62A1 -:1036600002E0786800F06BF9BB6903F48073002B0B -:1036700024D07B681B684FF480729A60BB6903F4A6 -:103680000073002B03D0786802F030FD16E0BB69B0 -:1036900003F48063002B04D07B6A43F400537B6205 -:1036A0000CE0BB6903F40063002B04D07B6A43F495 -:1036B00080437B6202E0786800F04BF9BB6903F459 -:1036C0008033002B24D07B681B684FF480329A60D3 -:1036D000BB6903F40033002B03D0786802F010FDBF -:1036E00016E0BB6903F48023002B04D07B6A43F40B -:1036F00000437B620CE0BB6903F40023002B04D081 -:103700007B6A43F480337B6202E0786800F02BF937 -:103710003B6A03F00803002B0CD07B6903F0100315 -:10372000002B07D07B6A43F400737B627B681B68C5 -:103730001022DA603B6A03F00403002B0BD07B6994 -:1037400003F00803002B06D07B681B680822DA60B0 -:10375000786802F0E9FC3B6A03F00203002B09D011 -:103760007B681B68DB6803F00303002B02D07868DA -:1037700002F0D0FC3B6A03F04003002B0CD03B6905 -:1037800003F01003002B07D07B6A43F480637B6255 -:103790007B681B6810221A613B6A03F02003002B30 -:1037A0000BD03B6903F00803002B06D07B681B6835 -:1037B00008221A61786800F0EAF83B6A03F0100307 -:1037C000002B09D07B681B681B6903F00303002BE7 -:1037D00002D0786800F0D1F83B6A03F40033002B84 -:1037E0000BD0FB6903F01003002B06D07B681B682D -:1037F00010225A60786800F0D4F83B6A03F48033F2 -:10380000002B0BD0FB6903F00803002B06D07B686C -:103810001B6808225A60786800F0CDF83B6A03F410 -:103820000043002B7BD0FB6903F00403002B72D014 -:103830003B6A03F48073002B08D0FB6803F001039C -:10384000002B03D07B6A43F001037B623B6A03F4E5 -:103850000073002B08D0FB6803F00203002B03D099 -:103860007B6A43F002037B623B6A03F48063002BB4 -:1038700008D0FB6803F00403002B03D07B6A43F0FD -:1038800004037B623B6A03F40063002B43D0FB68B4 -:1038900003F07003002B3ED0FB6803F07003602B35 -:1038A0002BD0602B2ED8502B22D0502B2AD8402B37 -:1038B00019D0402B26D8302B10D0302B22D8102BEB -:1038C00002D0202B05D01DE07B6A43F008037B6209 -:1038D00019E07B6A43F010037B6214E07B6A43F0DB -:1038E00020037B620FE07B6A43F040037B620AE0C7 -:1038F0007B6A43F080037B6205E07B6A43F480735C -:103900007B6200E000BF7B681B689A697B681B686C -:1039100022F070029A617B681B6804225A607B6AFD -:10392000002B08D07B685A6A7B6A1A437B685A620C -:10393000786802F007FC00BF2837BD4680BD80B420 -:1039400083B000AF786000BF0C37BD465DF8047BE4 -:10395000704780B483B000AF786000BF0C37BD46BD -:103960005DF8047B704780B483B000AF786000BF1F -:103970000C37BD465DF8047B704780B483B000AF60 -:10398000786000BF0C37BD465DF8047B704780B49B -:1039900083B000AF786000BF0C37BD465DF8047B94 -:1039A000704780B483B000AF786000BF0C37BD466D -:1039B0005DF8047B704780B483B000AF786000BFCF -:1039C0000C37BD465DF8047B7047000080B485B0BD -:1039D00000AF78607B6803F00703FB600C4BDB688B -:1039E000BB60BA684FF6FF031340BB60FB681A0266 -:1039F000BB68134343F0BF6343F40033BB60044A26 -:103A0000BB68D36000BF1437BD465DF8047B7047C8 -:103A100000ED00E080B400AF044BDB681B0A03F04C -:103A200007031846BD465DF8047B704700ED00E0D3 -:103A300080B483B000AF0346FB7197F90730002BC9 -:103A40000BDBFB7903F01F02074997F907305B098D -:103A5000012000FA02F241F8232000BF0C37BD46D6 -:103A60005DF8047B704700BF00E100E080B483B0E4 -:103A700000AF03463960FB7197F90730002B0ADB72 -:103A80003B68DAB20C4997F907301201D2B20B4405 -:103A900083F800230AE03B68DAB20849FB7903F0B7 -:103AA0000F03043B1201D2B20B441A7600BF0C374D -:103AB000BD465DF8047B704700E100E000ED00E0EA -:103AC00080B489B000AFF860B9607A60FB6803F039 -:103AD0000703FB61FB69C3F10703042B28BF042321 -:103AE000BB61FB690433062B02D9FB69033B00E091 -:103AF00000237B614FF0FF32BB6902FA03F3DA4324 -:103B0000BB681A407B699A404FF0FF317B6901FA2C -:103B100003F3D9437B680B40134318462437BD4653 -:103B20005DF8047B7047000080B582B000AF78601C -:103B30007B68013BB3F1807F01D301230FE00A4A88 -:103B40007B68013B53600F214FF0FF30FFF78EFF82 -:103B5000054B00229A60044B07221A600023184686 -:103B60000837BD4680BD00BF10E000E080B582B0E0 -:103B700000AF78607868FFF729FF00BF0837BD46BF -:103B800080BD80B586B000AF0346B9607A60FB7334 -:103B900000237B61FFF73EFF78617A68B968786936 -:103BA000FFF78EFF024697F90F3011461846FFF7D0 -:103BB0005DFF00BF1837BD4680BD80B582B000AF45 -:103BC0000346FB7197F907301846FFF731FF00BF36 -:103BD0000837BD4680BD80B582B000AF7860786898 -:103BE000FFF7A2FF034618460837BD4680BD000018 -:103BF00080B489B000AF7860396000237B61002316 -:103C00003B610023BB610023FB6165E10122FB698D -:103C100002FA03F37B613B681B687A6913403B61DE -:103C20003A697B699A4240F054813B685B68012B9A -:103C30000BD03B685B68022B07D03B685B68112B9D -:103C400003D03B685B68122B30D17B689B68BB61FB -:103C5000FB695B00032202FA03F3DB43BA691340FA -:103C6000BB613B68DA68FB695B0002FA03F3BA697F -:103C70001343BB617B68BA699A607B685B68BB6110 -:103C80000122FB6902FA03F3DB43BA691340BB610B -:103C90003B685B681B0903F00102FB6902FA03F34E -:103CA000BA691343BB617B68BA695A607B68DB6899 -:103CB000BB61FB695B00032202FA03F3DB43BA69D1 -:103CC0001340BB613B689A68FB695B0002FA03F32F -:103CD000BA691343BB617B68BA69DA603B685B68A9 -:103CE000022B03D03B685B68122B23D1FB69DA08F7 -:103CF0007B68083253F82230BB61FB6903F007038D -:103D00009B000F2202FA03F3DB43BA691340BB6145 -:103D10003B681A69FB6903F007039B0002FA03F38F -:103D2000BA691343BB61FB69DA087B680832B96979 -:103D300043F822107B681B68BB61FB695B000322B0 -:103D400002FA03F3DB43BA691340BB613B685B686B -:103D500003F00302FB695B0002FA03F3BA69134341 -:103D6000BB617B68BA691A603B685B6803F080538B -:103D7000002B00F0AE800023FB605D4B5B6C5C4A67 -:103D800043F4804353645A4B5B6C03F48043FB6001 -:103D9000FB68584AFB699B08023352F82330BB6129 -:103DA000FB6903F003039B000F2202FA03F3DB43DA -:103DB000BA691340BB617B684F4A934225D07B6848 -:103DC0004E4A93421FD07B684D4A934219D07B687C -:103DD0004C4A934213D07B684B4A93420DD07B6888 -:103DE0004A4A934207D07B68494A934201D106234D -:103DF0000CE007230AE0052308E0042306E0032380 -:103E000004E0022302E0012300E00023FA6902F04B -:103E1000030292009340BA691343BB613549FB69C1 -:103E20009B080233BA6941F823203A4B1B68BB61F7 -:103E30003B69DB43BA691340BB613B685B6803F4D1 -:103E40008033002B03D0BA693B691343BB61314A0D -:103E5000BB6913602F4B5B68BB613B69DB43BA698D -:103E60001340BB613B685B6803F40033002B03D055 -:103E7000BA693B691343BB61264ABB695360254B52 -:103E80009B68BB613B69DB43BA691340BB613B681C -:103E90005B6803F48013002B03D0BA693B691343BA -:103EA000BB611C4ABB6993601A4BDB68BB613B6911 -:103EB000DB43BA691340BB613B685B6803F40013E2 -:103EC000002B03D0BA693B691343BB61114ABB693C -:103ED000D360FB690133FB61FB690F2B7FF696AE64 -:103EE00000BF00BF2437BD465DF8047B704700BFAC -:103EF0000038024000380140000002400004024047 -:103F000000080240000C0240001002400014024071 -:103F100000180240003C014080B582B000AF7860DC -:103F200039607B68002B01D1012325E07B6893F881 -:103F30002C30DBB2002B06D17B68002283F82D20C9 -:103F40007868FDF71DFA7B68022283F82C207B68D5 -:103F50001A687B6804331946104600F0BFFA7B6884 -:103F600018687B685B681A46396800F02AFB7B6832 -:103F7000012283F82C20002318460837BD4680BD57 -:103F800080B584B000AFF860B9607A60FB6893F8E0 -:103F90002C30DBB2022B01D1022318E0FB68022295 -:103FA00083F82C20FB681B687A68B968184600F013 -:103FB00087FBBB681B68022B04D1FB68052283F8D2 -:103FC0002C2003E0FB68012283F82C2000231846F4 -:103FD0001037BD4680BD80B582B000AF78603960D3 -:103FE0007B6893F82C30DBB2022B01D102230EE068 -:103FF0007B68022283F82C207B681B68396818468E -:1040000000F09AFB7B68012283F82C2000231846DD -:104010000837BD4680BD80B584B000AFF860B96098 -:104020007A60FB68002B01D1012334E0FB6893F830 -:104030004930DBB2002B06D1FB68002283F8482010 -:10404000F868FDF793F9FB681A68FB6808331946AE -:10405000104600F03FF9FB681868FB689B681A4639 -:10406000B96800F0A7F9FB685868FB689A68FB68B4 -:104070001B6B796800F0F2F9FB681B68FA689268BC -:1040800053F82210FB681B68FA68926841F001013E -:1040900043F82210002318461037BD4680BD0000AB -:1040A00080B483B000AF7860054B1A6804497B6820 -:1040B00013430B6000BF0C37BD465DF8047B7047AF -:1040C000003C014080B483B000AF7860064B1A68B2 -:1040D0007B68DB43044913400B6000BF0C37BD46CF -:1040E0005DF8047B704700BF003C014080B483B0A2 -:1040F00000AF7860054B5A6804497B6813434B60F6 -:1041000000BF0C37BD465DF8047B7047003C0140A2 -:1041100080B483B000AF7860064B5A687B68DB439D -:10412000044913404B6000BF0C37BD465DF8047B6B -:10413000704700BF003C014080B483B000AF78609E -:10414000054B9A6804497B6813438B6000BF0C37AA -:10415000BD465DF8047B7047003C014080B483B0ED -:1041600000AF7860064B9A687B68DB4304491340D4 -:104170008B6000BF0C37BD465DF8047B704700BF05 -:10418000003C014080B483B000AF7860054BDA6832 -:1041900004497B681343CB6000BF0C37BD465DF814 -:1041A000047B7047003C014080B483B000AF78606E -:1041B000064BDA687B68DB4304491340CB6000BFE1 -:1041C0000C37BD465DF8047B704700BF003C0140E2 -:1041D00080B584B000AF78600023FB737B681B79E7 -:1041E000002B65D07B681B68002B6CD07B685B79EB -:1041F000022B1CD0022B25DC002B02D0012B0BD074 -:1042000020E07B681B681846FFF782FF7B681B680D -:104210001846FFF745FF18E07B681B681846FFF754 -:1042200051FF7B681B681846FFF760FF0DE07B6855 -:104230001B681846FFF734FF7B681B681846FFF7BA -:1042400055FF02E00123FB7300BF7B689B79002BC5 -:1042500039D07B689B79032B1CD0032B25DC012BE9 -:1042600002D0022B0BD020E07B681B681846FFF7BA -:104270009BFF7B681B681846FFF75EFF24E07B68A6 -:104280001B681846FFF76AFF7B681B681846FFF734 -:1042900079FF19E07B681B681846FFF74DFF7B68C4 -:1042A0001B681846FFF76EFF0EE00123FB730BE05F -:1042B0007B681B681846FFF705FF7B681B6818467C -:1042C000FFF726FF00E000BFFB7B18461037BD4616 -:1042D00080BD000080B485B000AF786039600023F5 -:1042E000FB603B681A687B6853F82230FB60FA6811 -:1042F0002F4B1340FB603B685A683B689B681A432E -:104300003B68DB681A433B681B691A433B685B697F -:104310001A433B68DB691A433B681B6A1A433B68D4 -:104320005B6A1A433B689B6A1A433B68DB6A1A4321 -:104330003B681B6B1A433B685B6B1A433B68DB6B48 -:104340001A433B689B6B1343FA681343FB603B685B -:104350009B68082B03D1FB6843F04003FB603B687C -:104360001A687B68F96843F822103B685B6BB3F509 -:10437000801F0AD13B681B68002B06D07B681A6837 -:104380003B685B6B1A437B681A603B681B68002BB9 -:1043900006D07B681A683B689B6B1A437B681A607F -:1043A000002318461437BD465DF8047B704700BFF4 -:1043B0008004C0FF80B487B000AFF860B9607A6055 -:1043C00000237B617B685A1CFB6853F822307B61B9 -:1043D0007B6903F040437B61BB681A68BB685B681C -:1043E0001B011A43BB689B681B021A43BB68DB684E -:1043F0001B041A43BB681B69013B1B051A43BB68BE -:104400005B69023B1B061A43BB689B6913437A69CD -:1044100013437B617B685A1CFB68796943F822105F -:10442000FB681B6803F48013B3F5801F0ED1FB6893 -:104430005B6823F470037B61BB681B69013B1B0550 -:104440007A6913437B61FB687A695A6000231846D6 -:104450001C37BD465DF8047B7047000080B487B010 -:1044600000AFF860B9607A603B6000237B613B6815 -:10447000B3F5804F22D1FB687A6853F822307B6114 -:104480007A69154B13407B61BB681A68BB685B682F -:104490001B011A43BB689B681B021A43BB68DB689D -:1044A0001B041A43BB689B6913437A6913437B61FE -:1044B000FB687A68796943F8221005E0FB687A683E -:1044C0006FF0704143F82210002318461C37BD4698 -:1044D0005DF8047B704700BF0000F0CF80B485B06A -:1044E00000AF786039600023FB600023BB603B684D -:1044F0001B68012B29D07B681B68FB60FB6823F4D9 -:10450000FF4323F07F03FB603B685A683B689B686E -:104510001A433B68DB681A433B681B691A433B68D4 -:104520005B691A433B689B691A433B68DB691A4322 -:104530003B681B6A1A433B685B6A1343FA68134380 -:10454000FB607B68FA681A6034E07B681B68FB607C -:10455000FB6823F4F843FB603B68DA693B681B6A3D -:104560001A433B685B6A1343FA681343FB607B683A -:104570005B68BB60BB6823F4FF4323F07F03BB6031 -:104580003B685A683B689B681A433B68DB681A4380 -:104590003B681B691A433B685B691A433B689B692C -:1045A0001343BA681343BB607B68FA681A607B6880 -:1045B000BA685A60002318461437BD465DF8047B7C -:1045C000704780B487B000AFF860B9607A600023AC -:1045D0007B6100233B617B68012B2ED0FB689B68CD -:1045E0007B617B6903F070437B61BB681B685A1E6B -:1045F000BB685B68013B1B011A43BB689B68013BBE -:104600001B021A43BB68DB68013B1B031A43BB68F0 -:104610001B69013B1B041A43BB685B69013B1B051B -:104620001A43BB689B69013B1B0613437A6913431A -:104630007B61FB687A699A603BE0FB689B687B6101 -:104640007B6923F4700323F470437B61BB68DB68F0 -:10465000013B1A03BB685B69013B1B0513437A6985 -:1046600013437B61FB68DB683B613B6903F070438C -:104670003B61BB681B685A1EBB685B68013B1B0142 -:104680001A43BB689B68013B1B021A43BB681B694A -:10469000013B1B041A43BB689B69013B1B06134388 -:1046A0003A6913433B61FB687A699A60FB683A692F -:1046B000DA60002318461C37BD465DF8047B70475E -:1046C00080B586B000AFF860B9607A6000233B61C6 -:1046D00000237B61BB681A68BB685B681A43BB68D0 -:1046E0009B68013B5B011A43BB68DB685B021343B9 -:1046F0003B613A69FB681A61FEF7DCFA786110E009 -:104700007B68B3F1FF3F0CD07B68002B07D0FEF72E -:10471000D1FA02467B69D31A7A689A4201D20323FE -:1047200006E0FB689B6903F02003202BE8D0002300 -:1047300018461837BD4680BD80B483B000AF78609E -:1047400039607B685A693B685B001A437B685A6131 -:10475000002318460C37BD465DF8047B704780B4D3 -:1047600089B000AFF860B9607A60FB681A68BB680E -:104770007B617B6993FAA3F33B613B69B3FA83F3F3 -:10478000DBB25B00032101FA03F3DB431A40BB6891 -:10479000FB61FB6993FAA3F3BB61BB69B3FA83F3D3 -:1047A000DBB25B00796801FA03F31A43FB681A6015 -:1047B00000BF2437BD465DF8047B704780B485B0E8 -:1047C00000AFF860B9607A60FB685A68BB68DB4389 -:1047D0001A40BB68796801FB03F31A43FB685A600F -:1047E00000BF1437BD465DF8047B704780B489B0C4 -:1047F00000AFF860B9607A60FB689A68BB687B615B -:104800007B6993FAA3F33B613B69B3FA83F3DBB2B1 -:104810005B00032101FA03F3DB431A40BB68FB6131 -:10482000FB6993FAA3F3BB61BB69B3FA83F3DBB211 -:104830005B00796801FA03F31A43FB689A6000BFD2 -:104840002437BD465DF8047B704780B489B000AF63 -:10485000F860B9607A60FB68DA68BB687B617B6985 -:1048600093FAA3F33B613B69B3FA83F3DBB25B00DA -:10487000032101FA03F3DB431A40BB68FB61FB69C8 -:1048800093FAA3F3BB61BB69B3FA83F3DBB25B00BA -:10489000796801FA03F31A43FB68DA6000BF243732 -:1048A000BD465DF8047B704780B489B000AFF86006 -:1048B000B9607A60FB681A6ABB687B617B6993FAAE -:1048C000A3F33B613B69B3FA83F3DBB29B000F2197 -:1048D00001FA03F3DB431A40BB68FB61FB6993FAFF -:1048E000A3F3BB61BB69B3FA83F3DBB29B007968C6 -:1048F00001FA03F31A43FB681A6200BF2437BD466E -:104900005DF8047B704780B489B000AFF860B9608F -:104910007A60FB685A6ABB681B0A7B617B6993FA01 -:10492000A3F33B613B69B3FA83F3DBB29B000F2136 -:1049300001FA03F3DB431A40BB681B0AFB61FB6906 -:1049400093FAA3F3BB61BB69B3FA83F3DBB29B00B9 -:10495000796801FA03F31A43FB685A6200BF2437EF -:10496000BD465DF8047B704780B588B000AF7860C5 -:1049700039600023FB610023BB613B681B687B61DE -:104980007B6993FAA3F33B613B69B3FA83F3DBB230 -:10499000FB6150E03B681A680121FB6901FA03F3EF -:1049A0001340BB61BB69002B42D03B685B68012BA5 -:1049B00003D03B685B68022B0DD13B689B681A46AD -:1049C000B9697868FFF712FF3B68DB681A46B96976 -:1049D0007868FFF7F3FE3B681B691A46B969786887 -:1049E000FFF733FF3B685B68022B1AD1BB69FB60A2 -:1049F000FB6893FAA3F3BB60BB68B3FA83F3DBB243 -:104A0000072B07D83B685B691A46B9697868FFF7D6 -:104A10004BFF06E03B685B691A46B9697868FFF7A7 -:104A200072FF3B685B681A46B9697868FFF797FEC2 -:104A3000FB690133FB613B681A68FB6922FA03F3E7 -:104A4000002BA7D1002318462037BD4680BD0000AB -:104A500080B400AF044B9B6803F00C031846BD46BE -:104A60005DF8047B704700BF0038024080B400AF9F -:104A7000044B9B6803F0F0031846BD465DF8047BC9 -:104A8000704700BF0038024080B400AF044B9B6801 -:104A900003F4E0531846BD465DF8047B704700BF41 -:104AA0000038024080B400AF044B9B6803F46043BD -:104AB0001846BD465DF8047B704700BF00380240D1 -:104AC00080B400AF044B5B6803F480031846BD4616 -:104AD0005DF8047B704700BF0038024080B400AF2F -:104AE000044B5B689B09C3F308031846BD465DF899 -:104AF000047B70470038024080B400AF044B5B6811 -:104B000003F440331846BD465DF8047B704700BF90 -:104B10000038024080B400AF044B5B6803F0E04310 -:104B20001846BD465DF8047B704700BF0038024060 -:104B300080B400AF044B5B6803F03F031846BD46EA -:104B40005DF8047B704700BF0038024080B582B03A -:104B500000AF786000F020F802467B681A607B683E -:104B60001B68184600F05CF802467B685A607B6858 -:104B70005B68184600F06AF802467B689A607B68BA -:104B80005B68184600F076F802467B68DA6000BF82 -:104B90000837BD4680BD000080B582B000AF00235D -:104BA0007B60FFF755FF03460C2B2DD801A252F86E -:104BB00023F000BFE94B0108094C0108094C01082A -:104BC000094C0108EF4B0108094C0108094C010888 -:104BD000094C0108F54B0108094C0108094C010872 -:104BE000094C0108FF4B01080B4B7B600FE00B4B9E -:104BF0007B600CE0082000F051F8786007E00C20A2 -:104C000000F04CF8786002E0034B7B6000BF7B68EB -:104C100018460837BD4680BD0024F400001BB700CD -:104C200080B582B000AF7860FFF720FF03461B0914 -:104C300003F00F03044AD35C1A467B68D34018463E -:104C40000837BD4680BD00BF84CA030880B582B066 -:104C500000AF7860FFF718FF03469B0A044AD35C55 -:104C60001A467B68D34018460837BD4680BD00BF52 -:104C700094CA030880B582B000AF7860FFF712FFD6 -:104C800003465B0B044AD35C1A467B68D340184644 -:104C90000837BD4680BD00BF94CA030890B587B0F1 -:104CA00000AF786000237B610023FB6000233B6141 -:104CB000FFF706FFF860FB68002B04D0FB68B3F534 -:104CC000800F03D005E01C4B7B6105E01B4B7B6133 -:104CD00002E0194B7B6100BF7B68082B14D1FFF702 -:104CE00027FF02467B69B3FBF2F4FFF7F7FE0346AA -:104CF00003FB04F4FFF700FF03461B0C01335B00CA -:104D0000B4FBF3F33B6111E0FFF712FF02467B694E -:104D1000B3FBF2F4FFF7E2FE034603FB04F4FFF7F4 -:104D2000F9FE03461B0FB4FBF3F33B613B691846E6 -:104D30001C37BD4690BD00BF0024F400001BB70027 -:104D400080B483B000AF78607B681B6803F04003D9 -:104D5000402B01D1012300E0002318460C37BD464B -:104D60005DF8047B704780B483B000AF7860396031 -:104D70003B689BB21A467B681A6100BF0C37BD4680 -:104D80005DF8047B704780B584B000AF786039600F -:104D90000123FB737868FFF7D3FF0346002B39D15B -:104DA0007B681B6823F47F4323F0BF033A681168D4 -:104DB0003A68526811433A68926811433A68D26877 -:104DC00011433A68126911433A68526911433A68CB -:104DD000926911433A68D26911433A68126A0A43E8 -:104DE0001A437B681A607B685B6823F004023B68A7 -:104DF0005B691B0C1A437B685A603B681B6AB3F5FE -:104E0000005F05D13B685B6A19467868FFF7ABFF26 -:104E10000023FB737B68DB6923F400627B68DA6143 -:104E2000FB7B18461037BD4680BD80B483B000AF11 -:104E3000786039607B683A689A6200BF0C37BD467B -:104E40005DF8047B704780B483B000AF7860396050 -:104E50007B683A68DA6200BF0C37BD465DF8047BB8 -:104E6000704780B483B000AF786039607B683A687F -:104E70001A6300BF0C37BD465DF8047B704780B4F1 -:104E800083B000AF78607B685B6943F001027B68A8 -:104E90005A6100BF0C37BD465DF8047B70470000C7 -:104EA00080B584B000AF786039607B681B68FB60B8 -:104EB0007B683D4A934213D07B68B3F1804F0FD09B -:104EC0007B683A4A93420BD07B68394A934207D0B9 -:104ED0007B68384A934203D07B68374A934206D1B5 -:104EE000FB6823F070023B685B681343FB607B68E0 -:104EF0002D4A93422BD07B68B3F1804F27D07B683B -:104F00002A4A934223D07B68294A93421FD07B6868 -:104F1000284A93421BD07B68274A934217D07B686C -:104F2000264A934213D07B68254A93420FD07B6870 -:104F3000244A93420BD07B68234A934207D07B6874 -:104F4000224A934203D07B68214A934206D1FB68F0 -:104F500023F440723B68DB681343FB607B68FA68AC -:104F60001A603B689B6819467868FFF76CFF3B68DE -:104F70001B8819467868FFF758FF7B680A4A9342F6 -:104F800003D07B680C4A934205D13B681B7C1946D1 -:104F90007868FFF766FF7868FFF771FF002318460F -:104FA0001037BD4680BD00BF000001400004004036 -:104FB00000080040000C0040000401400040014097 -:104FC000004401400048014000180040001C00401F -:104FD0000020004080B483B000AF78607B68DB685D -:104FE00003F40053B3F5005F0CBF01230023DBB2D1 -:104FF00018460C37BD465DF8047B704780B483B01B -:1050000000AF786039607B681B6923F440523B68CD -:105010001A437B681A6100BF0C37BD465DF8047BFC -:10502000704780B483B000AF786039607B685B699B -:1050300023F440723B681A437B685A6100BF0C3707 -:10504000BD465DF8047B70472DE9B04FC0B000AF9E -:10505000C7F8FC00C7F8F810C7F8F420C7F8F0301C -:10506000D7F8F430B3F5004F40F00C81D7F8F830A2 -:105070000022C7F8E830C7F8EC20D7E93A452246C5 -:105080002B46911839665B417B66D7E91823214688 -:1050900012EB0108294643EB01094FF000024FF0E3 -:1050A00000034FEAC90343EA58734FEAC802904627 -:1050B0009946234618EB0303C7F8E0302B4649EB2B -:1050C0000303C7F8E430D7F8F03000229A4693463D -:1050D0001AEB0A03BB654BEB0B03FB65D7E9162301 -:1050E000D7E93801FBF7B0FD02460B46644BA3FB42 -:1050F00002235B099BB21B019CB2D7F8F830002257 -:10510000C7F8D830C7F8DC20D7E9368942464B4685 -:10511000911839655B417B65D7E9142341465118E5 -:10512000B96449464B41FB644FF000024FF0000365 -:10513000D7E912AB5946CB00514643EA5173514669 -:10514000CA0010461946034642469B18C7F8D0309D -:105150004B460A4642EB0303C7F8D430D7F8F03089 -:105160000022C7F8C830C7F8CC20D7E932120B4666 -:10517000DB183B64134642EB03037B64D7E910233F -:10518000D7E93401FBF760FD02460B4611463C4B64 -:10519000A3FB01235B09642202FB03F3CB1ADB00B0 -:1051A00003F13202364BA3FB02235B099BB25B0087 -:1051B0009BB203F4F8739BB223449CB2D7F8F83047 -:1051C0000022C7F8C030C7F8C420D7E9308942466A -:1051D0004B469118B9635B41FB63D7E90E23414607 -:1051E0005118396349464B417B634FF000024FF041 -:1051F0000003D7E90CAB5946CB00514643EA517343 -:105200005146CA0010461946034642469B18C7F845 -:10521000B8304B460A4642EB0303C7F8BC30D7F818 -:10522000F0300022C7F8B030C7F8B420D7E92C120C -:105230000B46DB18BB62134642EB0303FB62D7E964 -:105240000A23D7E92E01FBF7FFFC02460B460C4B65 -:10525000A3FB02135B09642101FB03F3D31ADB00F8 -:105260003233074AA2FB03235B099BB203F0070317 -:105270009BB223449BB21A46D7F8FC309A6007E1F0 -:105280001F85EB51D7F8F8300022C7F8A830C7F8CF -:10529000AC20D7E92A8942464B46911839625B41D6 -:1052A0007B62D7E9082341465418494643EB010580 -:1052B0004FF000024FF00003EB0043EA5473E200AA -:1052C00014461D464346E318C7F8A0304B4645EB4D -:1052D0000303C7F8A430D7F8F0300022C7F898309D -:1052E000C7F89C204FF000024FF00003D7E9264595 -:1052F00029468B00214643EA917321468A00D7E96B -:105300002801FBF7A1FC02460B46644BA3FB0223DA -:105310005B099BB21B019CB2D7F8F8300022C7F89A -:105320009030C7F89420D7E9248942464B4691181B -:10533000B9615B41FB61D7E90623414651183961E8 -:1053400049464B417B614FF000024FF00003D7E923 -:1053500004AB5946CB00514643EA51735146CA004B -:1053600010461946034642469B18C7F888304B46FC -:105370000A4642EB0303C7F88C30D7F8F03000221E -:10538000C7F88030C7F884204FF000024FF00003C8 -:10539000D7E9208949468B00414643EA917341464B -:1053A0008A00D7E92201FBF74FFC02460B463B4B34 -:1053B000A3FB02135B09642101FB03F3D31A1B0156 -:1053C0003233364AA2FB03235B099BB203F0F0039E -:1053D0009BB223449CB2D7F8F8300022BB67FA672F -:1053E000D7E91E8942464B469118B9605B41FB6084 -:1053F000D7E9022341465118396049464B417B6049 -:105400004FF000024FF00003D7E900AB5946CB0044 -:10541000514643EA51735146CA00104619460346A5 -:1054200042469B183B674B460A4642EB03037B67A9 -:10543000D7F8F0300022BB66FA664FF000024FF05A -:105440000003D7E91A8949468B00414643EA917324 -:1054500041468A00D7E91C01FBF7F6FB02460B46E2 -:105460000E4BA3FB02135B09642101FB03F3D31A68 -:105470001B013233094AA2FB03235B099BB203F0F1 -:105480000F039BB223449BB21A46D7F8FC309A60B4 -:1054900000BF07F58077BD46BDE8B08F1F85EB5193 -:1054A00080B588B000AF786039600123FB770023B6 -:1054B000BB617868FFF78EFD0346002B5ED17B68E9 -:1054C000DB6823F4164323F00C033A6851683A680A -:1054D000D26811433A68126911433A6892690A43E3 -:1054E0001A437B68DA603B689B6819467868FFF767 -:1054F00085FD3B685B6919467868FFF792FD07F107 -:1055000008031846FFF722FB7B681F4A934202D12B -:105510007B69BB6121E07B681C4A934202D13B69F5 -:10552000BB611AE07B681A4A934202D13B69BB61B6 -:1055300013E07B68174A934202D17B69BB610CE0A0 -:105540007B68154A934202D13B69BB6105E07B68E9 -:10555000124A934201D13B69BB61BB69002B0DD05C -:105560003B681B68002B09D00023FB773B689A69D6 -:105570003B681B68B9697868FFF766FDFB7F1846D2 -:105580002037BD4680BD00BF0010014000440040F0 -:105590000048004000140140004C00400050004012 -:1055A00080B483B000AF7860044A7B68136000BFAA -:1055B0000C37BD465DF8047B704700BF000000203B -:1055C00080B582B000AF184B0022C3F8F020164B14 -:1055D0000022C3F8F420144B4FF0FF32C3F8F82038 -:1055E000F022002110481FF025F900237B600BE01A -:1055F0000D497A6813465B001344DB000B4400221C -:105600001A607B6801337B607B68092BF0DD064BF9 -:105610000022C3F80421002204490A2002F090FD70 -:1056200000BF0837BD4680BDF80F00204557010870 -:1056300080B584B000AFF8607A603B600B46FB72C7 -:10564000FB68002B70D07B68002B08D13B68002BD7 -:1056500005D1BB69002B02D1FB69002B64D0374B0D -:10566000D3F8F030092B5FDC344BD3F8F02013462D -:105670005B001344DB00314A134418220021184612 -:105680001FF0D8F82D4BD3F8F0202C4913465B00BF -:105690001344DB000B44FA681A60284BD3F8F0205F -:1056A000264913465B001344DB000B440433FA7AAB -:1056B0001A70224BD3F8F020204913465B001344A4 -:1056C000DB000B4408337A681A601C4BD3F8F020D7 -:1056D0001A4913465B001344DB000B4410333A684D -:1056E0001A60164BD3F8F020144913465B0013449C -:1056F000DB000B440C33BA691A60104BD3F8F0206E -:105700000E4913465B001344DB000B441433FA6963 -:105710001A600A4BD3F8F0300133084AC2F8F0306F -:10572000064BD3F8F03004E005481FF091FD4FF030 -:10573000FF3318461037BD4680BD00BFF80F00206C -:10574000C07A030880B584B000AF9F4BD3F8F8301F -:10575000B3F1FF3F3CD10023BB6032E0BA6813468F -:105760005B001344DB00984A13447B607B681B6832 -:10577000002B22D07B681B6898470346FB707B6830 -:105780001B79FA789A4219D18F4ABB68C2F8F8306F -:105790008D4B002283F802218B4B0022A3F8FE20C0 -:1057A000894B0022A3F8FC207B681B79DB43022293 -:1057B000194686481FF03EF803E100BFBB6801337D -:1057C000BB60814BD3F8F030BA689A42C6DBF8E090 -:1057D0007D4BD3F8F8207C4BD3F8F0309A4280F21E -:1057E000F080794BD3F8F82013465B001344DB00BC -:1057F000754A13447B607B681B68002B00F0E180D6 -:105800007B681B6898470346FB700123FB736E4B54 -:1058100093F802315A1CD1B26B4A82F802111A462F -:10582000694B1344FA7883F80021674B93F80231EF -:1058300003F00103DAB2644B83F802210023BB605A -:1058400013E0614ABB68134403F580731A78BB68A0 -:1058500001335D490B4493F800319A4202D0002392 -:10586000FB7305E0BB680133BB60BB68002BE8DD60 -:10587000554BB3F8FC30002B1FD17B681B79FA78AD -:105880009A4278D1FB7B012B75D14F4B0122A3F8B3 -:10589000FC207B685B69002B02D07B685B699847C2 -:1058A0007B68DB68002B66D0474B0122C3F8F420ED -:1058B000454B3222A3F8FE205DE0434BD3F8F43091 -:1058C000032B58D07B681B79FA789A4227D13E4B3C -:1058D000B3F8FC30312B08D83B4BB3F8FC30013324 -:1058E0009AB2394BA3F8FC2045E0374BB3F8FC30B3 -:1058F000322B40D17B689B68002B07D0324B322281 -:10590000A3F8FE20304B0222C3F8F4202E4BB3F84C -:10591000FC3001339AB22C4BA3F8FC202BE0FB7B2C -:10592000012B28D17B681B69002B08D0264B322223 -:10593000A3F8FE20244B0322C3F8F4201BE07B686D -:10594000DB68002B07D17B689B68002B03D17B6849 -:105950001B69002B05D01C4BD3F8F430B3F1FF3F8B -:1059600009D1194B0022C3F8F420174B4FF0FF3236 -:10597000C3F8F82025E0144BD3F8F430002B20DDD9 -:10598000114BB3F8FE30002B1BD00F4BB3F8FE3099 -:10599000013B9AB20C4BA3F8FE200B4BB3F8FE3040 -:1059A000002B0ED1084BD3F8F430032B04D1064B57 -:1059B0004FF0FF32C3F8F820034B4FF0FF32C3F82B -:1059C000F4201037BD4680BDF80F0020F8100020ED -:1059D00080B586B000AF0023FB6002F0DFFCB8604A -:1059E00000233B6100237B611CE07A6913465B0066 -:1059F0001344DB00264A13443B603B681B68002BC2 -:105A00000CD03B681B68984703461A463B681B79D5 -:105A10009A4204D03B6901333B6100E000BF7B69DF -:105A200001337B611A4BD3F8F0307A699A42DCDBA0 -:105A3000174BD3F8F0303A699A4219D0FFF782FE3B -:105A4000134BD3F80431002B04D0114BD3F804319D -:105A50000120984702F0A2FC78607A68BB68D31AEC -:105A600041F288329342BBD94FF0FF33FB6000E034 -:105A700000BF074B0022C3F8F420054B4FF0FF3264 -:105A8000C3F8F820FB6818461837BD4680BD00BF34 -:105A9000F80F002080B483B000AF7860044A7B68C0 -:105AA000C2F8043100BF0C37BD465DF8047B704777 -:105AB000F80F002080B400AF064B0022C3F8F4209A -:105AC000044B4FF0FF32C3F8F82000BFBD465DF82D -:105AD000047B7047F80F002080B584B000AF544BB2 -:105AE000D3F80831002B40F09F80514BD3F8083198 -:105AF00001334F4AC2F808314D4BD3F8F430002B34 -:105B000040F38D804A4BD3F8F830002BC0F28780E9 -:105B10000023BB600023FB602EE0FA6813465B00A5 -:105B20001344DB00424A13447B607B681B68002BF4 -:105B30001ED07B681B6898470346FB707B681B7907 -:105B4000FA789A4215D13A4BD3F8F830FA689A426B -:105B500003D1BB680133BB600BE0BB68013BBB609A -:105B6000334BD3F8F830194632481FF0D5FA00E02D -:105B700000BFFB680133FB602D4BD3F8F030FA68AF -:105B80009A42CADB2A4BD3F8F430032B02D0BB680D -:105B9000012B07D0264BD3F8F430032B3AD1BB6846 -:105BA000002B37D1224BD3F8F82013465B00134467 -:105BB000DB001F4A13447B607B68002B2AD01C4B00 -:105BC000D3F8F430012B08D17B68DB68002B21D09F -:105BD0007B68DB689847B8601CE0154BD3F8F4305D -:105BE000022B08D17B689B68002B13D07B689B68D5 -:105BF0009847B8600EE00E4BD3F8F430032B09D170 -:105C00007B681B69002B05D07B681B699847B860CF -:105C1000FFF750FF064B4FF0FF32C3F8F420044B60 -:105C20000022C3F8082100E000BF1037BD4680BD48 -:105C3000F80F0020E07A030880B58EB000AF03466D -:105C4000FB7100233B6200237B620123BB620023C4 -:105C5000FB6000233B6100237B610023BB61FB7978 -:105C6000FB610E233B630123FB6207F10C03194622 -:105C70000848FDF727F9034687F83730FB7997F88E -:105C80003720194604481FF047FA00BF3837BD4691 -:105C900080BD00BF0C0F0020F87A030880B483B0E9 -:105CA00000AF78607B68044A136000BF0C37BD46C4 -:105CB0005DF8047B704700BF0C00002080B582B007 -:105CC00000AF00F047F81D4B1B68002B03D01B4BA7 -:105CD0001B680020984702211948FDF72CFC034659 -:105CE000FB71FB79002B02D016481FF0B1FA04219A -:105CF0001348FDF720FC0346FB71FB79002B02D013 -:105D000011481FF0A5FA01210D48FDF73AFC0346A2 -:105D1000FB71FB79002B02D00C481FF099FA084860 -:105D2000FDF7B0F90346FB71FB79002B02D0084860 -:105D30001FF08EFA00BF0837BD4680BD0C00002062 -:105D40000C0F0020207B03086C7B0308B07B03084A -:105D5000F87B030880B500AF4FF4047200211348AC -:105D60001EF068FD4FF41372002111481EF062FD11 -:105D70000E4B0E4AC3F800220C4B0C4AC3F8042207 -:105D80000A4B0022C3F80822084B0022C3F80C2259 -:105D9000074B074AC3F84022054B054AC3F8442283 -:105DA000034B0022C3F8482200BF80BD50130020DF -:105DB0000411002080B582B000AF204BD3F8083228 -:105DC000002B01DC012335E01C4BD3F804321946CB -:105DD0001A4BD3F8043203F118023B461848FDF77A -:105DE00095F90346FB71FB79002B1DD101F0D4F826 -:105DF000124BD3F80832013B104AC2F808320F4B5D -:105E0000D3F8043220330D4AC2F804320B4BD3F8D6 -:105E100004320C4A934203D9084B084AC3F80422BF -:105E200001F0CEF8002305E0FB79194606481FF083 -:105E300073F9022318460837BD4680BD5013002071 -:105E40000C0F002030150020107C030880B58AB0AC -:105E500000AF3B461C333A4600212048FDF731FA9B -:105E6000034687F8273097F82730002B2AD11C4BA0 -:105E7000D3F848320E2B21DC194BD3F84032394687 -:105E8000242218461EF0C8FC154BD3F848320133C3 -:105E9000134AC2F84832124BD3F840322433104A26 -:105EA000C2F840320E4BD3F840320E4A934203D927 -:105EB0000B4B0B4AC3F8402200230AE00A481FF0AC -:105EC000C7F905E097F82730194608481FF024F96C -:105ED000012318462837BD4680BD00BF0C0F0020A7 -:105EE00004110020201300203C7C0308587C030888 -:105EF00080B584B000AF78607B68002B05D1324854 -:105F00001FF0A6F94FF0FF3359E0304BD3F80832B9 -:105F10000F2B4EDC2D4BD3F8003220227968184627 -:105F20001EF07AFC01F038F8284BD3F80832013320 -:105F3000264AC2F80832254BD3F800322033234AD0 -:105F4000C2F80032214BD3F80032214A934203D9E0 -:105F50001E4B1E4AC3F8002201F032F81B4BD3F847 -:105F60000C32002B1ED1FFF725FFF860FB68002BD9 -:105F700008D1164B0122C3F80C2201211548FDF768 -:105F8000DAFA13E0FB68012B08D1104B0022C3F8AA -:105F90000C2201210F48FDF7F4FA07E00E481FF02C -:105FA00057F903E001210B48FDF7C5FA0023FB6018 -:105FB00004E00A481FF04CF90123FB60FB68184617 -:105FC0001037BD4680BD00BF847C030850130020FD -:105FD000301500200C0F0020A47C0308C87C0308A7 -:105FE00080B584B000AF78607B68002B02D14FF0A1 -:105FF000FF332EE0194BD3F84832002B26DD174B28 -:10600000D3F844322422194678681EF005FC00F0CB -:10601000C3FF124BD3F84832013B104AC2F8483252 -:106020000E4BD3F8443224330C4AC2F844320B4BA3 -:10603000D3F844320A4A934203D9084B074AC3F8BB -:10604000442200F0BDFF0023FB6001E00123FB6060 -:10605000FB6818461037BD4680BD00BF0411002004 -:106060002013002080B582B000AFFFF7A3FE786058 -:106070007B68002B0ED07B68012B08D1074B0022D8 -:10608000C3F80C2201210648FDF77BFA02E005481F -:106090001FF0DEF800BF0837BD4680BD501300205A -:1060A0000C0F0020E07C030880B582B000AF002117 -:1060B0000848FDF718FA786004E0FFF7C7FE7B6830 -:1060C000013B7B607B68002BF7D100BF00BF083726 -:1060D000BD4680BD0C0F002080B582B000AF786057 -:1060E000FFF7C0FF00BF0837BD4680BD80B582B056 -:1060F00000AF7860FFF7B6FF00BF0837BD4680BD30 -:1061000080B582B000AF7860FFF7ACFF00BF083702 -:10611000BD4680BD80B582B000AF7860FFF7C4FF98 -:1061200000BF0837BD4680BD80B582B000AF786043 -:1061300003481FF08DF800BF0837BD4680BD00BF83 -:10614000F47C030880B582B000AF786003481FF08C -:106150007FF800BF0837BD4680BD00BF087D03083B -:1061600080B483B000AF78607B68002B03D0064B0F -:1061700001221A6002E0044B00221A6000BF0C37B3 -:10618000BD465DF8047B70471000002080B582B0EA -:1061900000AF78603960094B1B68012B05D1396865 -:1061A000786801F0CFF8034604E03968786801F0B8 -:1061B00033FA034618460837BD4680BD100000205C -:1061C00080B582B000AF78603960094B1B68012B45 -:1061D00005D13968786801F02BF9034604E0396885 -:1061E000786801F045FA034618460837BD4680BD79 -:1061F0001000002080B584B000AF78607B68DBB20F -:10620000FB7307F10F0301211846FFF7BFFF7B68FF -:1062100018461037BD4680BD80B582B000AFFB1C6C -:1062200001211846FFF7CCFF78607B68012B03D172 -:10623000FB787B607B6800E0002318460837BD468A -:1062400080BD80B586B000AFF860B9607A607968CB -:10625000B868FFF7B5FF78617B6918461837BD4607 -:1062600080BD80B584B000AFF860B9607A607968AD -:10627000B868FFF78BFF7B6818461037BD4680BDB6 -:1062800080B582B000AF78607868FFF7B3FF03464F -:1062900018460837BD4680BD80B400AF034B5B682D -:1062A0001846BD465DF8047B704700BF60150020AE -:1062B00080B584B000AF786000F06EFE0A4BDB6CF6 -:1062C000FB60094B01229A60074B00225A6000F0E4 -:1062D00077FEFB681A46054978681EF09DFAFB6850 -:1062E00018461037BD4680BD60150020701500208F -:1062F00080B400AF034B00229A6000BFBD465DF83A -:10630000047B70476015002080B500AF0A4B002267 -:106310001A600A4B00221A60094B4FF0FF321A60D4 -:10632000084B00221A604FF4FA72002106481EF052 -:1063300081FA00BF80BD00BFD8170020DC17002005 -:1063400014000020E0170020E415002080B588B07C -:1063500000AF78607B68002B00F0B6800023FB6103 -:1063600080E0FB69322202FB03F3594A1344796847 -:106370001846F9F74DFF0346002B70D1554B1B68AB -:10638000FA699A4208DB544B1A68524B1B68F96948 -:10639000CB1AD31A3B6104E04E4B1A68FB69D31A3F -:1063A0003B613B69013B3B610023FB6052E0FA69C2 -:1063B000FB681344BB61BB6901337B61464B1B68BF -:1063C000BA699A4204DB444B1B68BA69D31ABB61B1 -:1063D000414B1B687A699A4204DB3F4B1B687A6920 -:1063E000D31A7B61BB69322202FB03F3384A1344A0 -:1063F0003222002118461EF01DFABB69322202FB30 -:1064000003F3334A1A447B69322101FB03F3304919 -:106410000B44194610461EF043FF3B69013BFA68E6 -:106420009A4214D17B69322202FB03F3284A1344B7 -:106430003222002118461EF0FDF97B69322202FB50 -:1064400003F3234A1344796818461EF029FFFB68BA -:106450000133FB60FA683B699A42A8DB34E0FB69D0 -:106460000133FB611C4B1B68FA699A42FFF679AF56 -:10647000184B1B68092B02DD164B00221A60154BC6 -:106480001B68322202FB03F3114A1344322200211B -:1064900018461EF0CFF90F4B1B68322202FB03F3A4 -:1064A0000B4A1344796818461EF0FAFE094B1B6824 -:1064B0000133084A1360084B1B68092B04DC064BA8 -:1064C0001B680133044A13602037BD4680BD00BFFE -:1064D000E4150020D8170020DC17002080B582B01A -:1064E00000AF364B1B68002B64DD344B1B68013B4F -:1064F000324A1360324B1B68013B314A1360304B08 -:106500001B68002B13DA2F4B1B68013B2C4A1360CE -:106510000DE00820FFF76EFE2020FFF76BFE08203D -:10652000FFF768FE284B9B6C013B274A9364264B80 -:106530009B6C002BEDD1244B9B68002B32D1224B5E -:106540005B68002B2ED100237B6027E01C4B1B686F -:106550001E4A322101FB03F31A447B6813441B7863 -:10656000FB70FB781F2B16D9FB787E2B13D8164BAC -:106570009B6C302B0FDCFB781846FFF73BFE124B71 -:106580009B6C114A1344FA7883F850200E4B9B6C95 -:1065900001330D4A93647B6801337B607B68312B48 -:1065A000D4DD08E0084B00229A64074B002283F8F0 -:1065B000502000E000BF0837BD4680BDE017002036 -:1065C00014000020DC17002060150020E4150020D6 -:1065D00080B582B000AF444B1A68444B1B689A42A6 -:1065E0007EDA414B1B6801333F4A1360404B1B6806 -:1065F00001333F4A13603C4B1A683C4B1B689A427C -:1066000013D10DE00820FFF7F5FD2020FFF7F2FD84 -:106610000820FFF7EFFD374B9B6C013B354A936435 -:10662000344B9B6C002BEDD15BE0314B1A682F4B48 -:106630001B689A4211DB2E4B00221A600DE00820E5 -:10664000FFF7D8FD2020FFF7D5FD0820FFF7D2FD8A -:10665000284B9B6C013B274A9364264B9B6C002B79 -:10666000EDD1244B9B68002B32D1224B5B68002B71 -:106670002ED100237B6027E01D4B1B681E4A322170 -:1066800001FB03F31A447B6813441B78FB70FB780F -:106690001F2B16D9FB787E2B13D8164B9B6C302BF7 -:1066A0000FDCFB781846FFF7A5FD124B9B6C114AD7 -:1066B0001344FA7883F850200E4B9B6C01330D4A3B -:1066C00093647B6801337B607B68312BD4DD08E009 -:1066D000084B00229A64074B002283F8502000E008 -:1066E00000BF0837BD4680BDE0170020DC17002042 -:1066F0001400002060150020E415002080B500AFD4 -:106700000E4B00229A640D4B0022DA640D20FFF735 -:1067100071FD0A20FFF76EFD4320FFF76BFD4D2052 -:10672000FFF768FD4420FFF765FD3A20FFF762FDA3 -:106730003E20FFF75FFD00BF80BD00BF6015002059 -:1067400080B500AF01F0C6FC31234E2238214FF452 -:10675000E13000F097FD00220C490A2001F0F0FC26 -:106760000C201EF0F1FC0A481EF0D6FC0C201EF096 -:10677000EBFC8422002107481EF05CF8064B012246 -:106780001A60FFF7C1FD00BF80BD00BF9D67010813 -:10679000147D0308601500201000002080B582B031 -:1067A00000AFC64B1B68002B40F00283FFF734FD9F -:1067B00078607B68002B03DAC04B00225A64FAE24F -:1067C0007B687F2B00F2718101A252F823F000BF99 -:1067D000AB6A0108AB6A0108AB6A0108D16901081C -:1067E000AB6A0108AB6A0108AB6A0108AB6A010831 -:1067F000E5690108AB6A0108AB6A0108AB6A0108E8 -:10680000AB6A01080B6A0108AB6A0108AB6A0108B0 -:10681000AB6A0108AB6A0108AB6A0108AB6A010800 -:10682000AB6A0108AB6A0108AB6A0108AB6A0108F0 -:10683000AB6A0108AB6A0108AB6A01086B6A010820 -:10684000AB6A0108AB6A0108AB6A0108AB6A0108D0 -:10685000AB6A0108AB6A0108AB6A0108AB6A0108C0 -:10686000AB6A0108AB6A0108AB6A0108AB6A0108B0 -:10687000AB6A0108AB6A0108AB6A0108AB6A0108A0 -:10688000AB6A0108AB6A0108AB6A0108AB6A010890 -:10689000AB6A0108AB6A0108AB6A0108AB6A010880 -:1068A000AB6A0108AB6A0108AB6A0108AB6A010870 -:1068B000AB6A0108AB6A0108AB6A0108AB6A010860 -:1068C000AB6A0108AB6A0108AB6A0108AB6A010850 -:1068D000AB6A0108AB6A0108AB6A0108AB6A010840 -:1068E000AB6A0108AB6A0108AB6A0108AB6A010830 -:1068F000AB6A0108AB6A0108AB6A0108AB6A010820 -:10690000AB6A0108AB6A0108AB6A0108AB6A01080F -:10691000AB6A0108AB6A0108AB6A0108AB6A0108FF -:10692000AB6A0108AB6A0108AB6A0108AB6A0108EF -:10693000AB6A0108AB6A0108AB6A0108AB6A0108DF -:10694000AB6A0108AB6A0108AB6A0108AB6A0108CF -:10695000AB6A0108AB6A0108AB6A0108AB6A0108BF -:10696000AB6A0108AB6A0108AB6A0108AB6A0108AF -:10697000AB6A0108AB6A0108AB6A0108AB6A01089F -:10698000AB6A0108AB6A0108AB6A0108AB6A01088F -:10699000AB6A0108AB6A0108AB6A0108AB6A01087F -:1069A000AB6A0108AB6A0108AB6A0108AB6A01086F -:1069B000AB6A0108AB6A0108AB6A0108AB6A01085F -:1069C000AB6A0108AB6A0108AB6A0108736A010887 -:1069D0003A4B9B68012B6AD1FFF790FE374B01229F -:1069E000DA6064E0354B9B6C002B62D00820FFF727 -:1069F00001FC2020FFF7FEFB0820FFF7FBFB2F4BDD -:106A00009B6C013B2D4A936453E02C4B5B68002B3D -:106A100051D12A4B9B68002B4DD10D20FFF7EAFB8B -:106A20000A20FFF7E7FB254B9B6C244A1344002206 -:106A300083F85020214B9B6C204AD3642049214885 -:106A40001EF02EFC1D4BDB6C002B02D01C48FFF708 -:106A50007DFC1D4B1B681D4A13601D4B1B681D4AA6 -:106A60001360164B01225A6025E0144B01225A6430 -:106A700033E0124B9B6C002B2ED00820FFF7BAFBA3 -:106A80002020FFF7B7FB0820FFF7B4FB0B4B9B6CF4 -:106A9000013B0A4A9364094BDB6C002B1CD0074B6B -:106AA000DB6C013B054AD36416E000BF15E000BF74 -:106AB00013E000BF11E000BF0FE000BF6015002031 -:106AC000B015002070150020D817002014000020F9 -:106AD000DC170020E017002000BF7B681B2B00F0B4 -:106AE0003B81964B5B6C002B00F03681934B5B6CCB -:106AF000012B40F025817B685B2B40F02181FFF763 -:106B00008BFB78607B68313B132B00F2068101A27E -:106B100052F823F0856B0108616C0108D36C010801 -:106B2000E56C0108F76C0108096D01081B6D01088F -:106B30001B6D01081B6D01081B6D01081B6D010811 -:106B40001B6D01081B6D01081B6D01081B6D010801 -:106B50001B6D0108656B01086F6B0108796B0108FB -:106B60007F6B010875237B60FFF7B8FCE4E06423CA -:106B70007B60FFF72DFDDFE072237B60DCE06C23A0 -:106B80007B60D9E0FFF748FB78607B687E2B02D101 -:106B900068237B60C5E07B68312B09D1FFF73CFBA4 -:106BA00078607B687E2B40F0BC8031237B60B8E04E -:106BB0007B68322B09D1FFF72FFB78607B687E2B37 -:106BC00040F0AF8032237B60ABE07B68332B09D190 -:106BD000FFF722FB78607B687E2B40F0A280332396 -:106BE0007B609EE07B68342B09D1FFF715FB786052 -:106BF0007B687E2B40F0958034237B6091E07B683E -:106C0000352B09D1FFF708FB78607B687E2B40F0BD -:106C1000888035237B6084E07B68372B08D1FFF7C1 -:106C2000FBFA78607B687E2B7BD136237B6078E033 -:106C30007B68382B08D1FFF7EFFA78607B687E2BF2 -:106C40006FD137237B606CE07B68392B69D1FFF70C -:106C5000E3FA78607B687E2B63D138237B6060E049 -:106C6000FFF7DAFA78607B687E2B02D169237B60BC -:106C700059E07B68302B08D1FFF7CEFA78607B684B -:106C80007E2B50D139237B604DE07B68312B08D1BE -:106C9000FFF7C2FA78607B687E2B44D161237B606A -:106CA00041E07B68332B08D1FFF7B6FA78607B6848 -:106CB0007E2B38D162237B6035E07B68342B32D168 -:106CC000FFF7AAFA78607B687E2B2CD163237B6068 -:106CD00029E0FFF7A1FA78607B687E2B25D1642339 -:106CE0007B6022E0FFF798FA78607B687E2B1ED1EC -:106CF00065237B601BE0FFF78FFA78607B687E2B53 -:106D000017D175237B6014E0FFF786FA78607B6803 -:106D10007E2B10D164237B600DE0084B00225A6467 -:106D20000AE000BF0FE000BF0DE000BF0BE000BFB6 -:106D300009E000BF07E000BF05E000BF60150020CC -:106D40001E4B00225A641D4B5B6C002B04D00023A9 -:106D50007B601A4B00225A64184B9B68002B1FD192 -:106D6000164B5B68002B1BD17B681F2B22DD7B68D9 -:106D70007E2B1FDC114B9B6C302B1BDC7868FFF7E4 -:106D800039FA0E4B9B6C7A68D1B20C4A13440A460E -:106D900083F85020094B9B6C0133084A936409E047 -:106DA000064B00229A64054B002283F8502002E033 -:106DB00000BF00E000BF0837BD4680BD6015002061 -:106DC00080B483B000AF064BDB687B60044B0022CD -:106DD000DA607B6818460C37BD465DF8047B704767 -:106DE0006015002080B400AFBFF34F8F00BF064B8B -:106DF000DB6803F4E0620449044B1343CB60BFF348 -:106E00004F8F00BF00BFFDE700ED00E00400FA0572 -:106E100090B58FB000AF78605D4B1A685D4BA3FBF7 -:106E20000213D21A520813449B083B627B68002B62 -:106E300000F0A5803A6A1346DB009B1A3B62544B74 -:106E40001968544BA3FB0123CA1A520813449A0829 -:106E50001346DB009B1ACA1A3B6A13443B623B6A27 -:106E60003B6300237B630DE03B6B1B78BB777A6849 -:106E70007B6B1344BA7F1A703B6B01333B637B6BB4 -:106E800001337B637B6B0B2BEEDD7B680C2118469B -:106E900001F0C2FD02467B68DA603BA3D3E9002320 -:106EA000C7E90A237B6807F10C04186859689A68D7 -:106EB000DB680FC400237B6321E007F10C027B6BCE -:106EC00013441B78BB7797F8283003F00F0387F83B -:106ED0002730D7E90A014FF000024FF00003020902 -:106EE00042EA01720B09C7E90A2397F82730BA7FF3 -:106EF000D243D1B27A68D1547B6B01337B637B6B15 -:106F00000F2BDADD002387F8273034E07B681B780D -:106F1000FB7701237B6326E07B6B013B7A68D35CC4 -:106F2000BB77BB7F5B08BB777B6B102B03D1FB7FF1 -:106F300087F8263005E07A687B6B13441B7887F866 -:106F4000263097F82630DB0187F82630BA7F97F88D -:106F500026301343BB777B6B013B7A68B97FD154F2 -:106F60007B6B01337B637B6B102BD5DD97F8273070 -:106F7000013387F8273097F82730002BC6D000BFA1 -:106F80003C37BD4690BD00BFB8369A1F5EC7D240A1 -:106F9000180000202549922480B400AF074B1B68DD -:106FA000002B01D172B600BF044B1B680133034AAA -:106FB000136000BFBD465DF8047B7047E4170020F6 -:106FC00080B400AF094B1B68002B04D0074B1B6833 -:106FD000013B064A1360054B1B68002B01D162B6CA -:106FE00000BF00BFBD465DF8047B7047E41700207A -:106FF00080B500AF03481EF02BF972B600BFFFF753 -:10700000F1FE00BF207D030880B584B000AF78603A -:1070100001F094F9F86001F091F9B860BA68FB6882 -:10702000D31A7A689A4200D3F5E700BF00BF103741 -:10703000BD4680BD80B586B000AF786001F07EF9B6 -:1070400078617B684FF47A7202FB03F33B6101F0D5 -:1070500075F9F860FA687B69D31A3A699A4200D3E5 -:10706000F5E700BF00BF1837BD4680BD80B58AB0C8 -:1070700000AF00237B620823BB613B1D1846FFF76E -:10708000C7FE00233B620023FB6127E0184A3B6AEE -:1070900052F823307B61FB69BA6993FBF2F2B9695C -:1070A00001FB02F29B1AFB61FB695B0028333B4446 -:1070B00033F8242C7B691B889A4209D07B691B8892 -:1070C0004FF6FF72934203D03B6A01337B620AE0C2 -:1070D0003B6A01333B62FB690133FB61054B1B6873 -:1070E0003A6A9A42D2DB7B6A18462837BD4680BD91 -:1070F000EC170020E817002080B483B000AF0346EF -:10710000FB80FB8841F69812934206D8FB881A460A -:10711000920013445B00FB8002E04FF6FF73FB809C -:1071200000BF0C37BD465DF8047B704780B400AFEC -:1071300000BFBD465DF8047B704780B483B000AFEC -:1071400078607B68DB6843F400527B68DA6000BFDC -:107150000C37BD465DF8047B704780B483B000AF48 -:1071600078607B681B6803F02003202B0CBF012391 -:107170000023DBB218460C37BD465DF8047B704730 -:1071800080B483B000AF78607B681B6803F0400375 -:10719000402B0CBF01230023DBB218460C37BD4641 -:1071A0005DF8047B704780B483B000AF78607B6883 -:1071B0001B6803F08003802B0CBF01230023DBB28C -:1071C00018460C37BD465DF8047B704780B483B029 -:1071D00000AF78607B68DB6843F020027B68DA6090 -:1071E00000BF0C37BD465DF8047B704780B483B0A8 -:1071F00000AF78607B68DB6843F080027B68DA6010 -:1072000000BF0C37BD465DF8047B704780B483B087 -:1072100000AF78607B68DB6823F020027B68DA606F -:1072200000BF0C37BD465DF8047B704780B483B067 -:1072300000AF78607B68DB6823F080027B68DA60EF -:1072400000BF0C37BD465DF8047B704780B483B047 -:1072500000AF78607B685B68DBB218460C37BD46D0 -:107260005DF8047B704780B483B000AF78600B4654 -:10727000FB70FA787B685A6000BF0C37BD465DF83A -:10728000047B704780B582B000AF78600846114635 -:107290001A460346FB700B46BB7013467B703822C0 -:1072A000002124481DF0C6FA224B234A1A61214BC3 -:1072B0004FF4C062DA601F4B204A5A621D4B4FF4F4 -:1072C00000721A621B4B1E4A5A601A4A7B6893600E -:1072D000184B1B69174A5361164B5B69154A93613A -:1072E000144B00229A83134B0022DA83114B5B6A02 -:1072F000104A93620F4B9B6A0E4AD3620D4B0022D9 -:107300001A860C4B01225A860A4B45F2AA521A8061 -:10731000084B00225A630A48FFF798FF0848FFF716 -:1073200055FF0748FFF709FF002318460837BD46F9 -:1073300080BD00BF6C2000206C1800206C1E002057 -:107340000010014080B584B000AF786039607B6880 -:10735000002B02D03B68002B02DA4FF0FF3361E0D4 -:10736000324B1B8845F2AA52934202D06FF00103C0 -:1073700058E0FFF711FE2D4B9B8B1A463B681A44D1 -:107380002A4BDB689A4201DD00233B60274B9B6957 -:10739000BB60FFF715FE3B68002B02DA6FF00203BB -:1073A00040E00023FB6016E07A68531C7B60BB68FA -:1073B000591CB96012781A701C4B1A691B4BDB6898 -:1073C000013B1344BA689A4202D9184B1B69BB604F -:1073D000FB680133FB60FA683B689A42E4DB3B6878 -:1073E000002B1ED0FFF7D8FD104ABB6893610F4BEE -:1073F0009A8B3B689BB213449AB20C4B9A830B4B0B -:10740000DB8B012B0BD0094B9B8B002B07D0074B41 -:107410000122DA83054B5B681846FFF7E7FEFFF7AA -:10742000CFFD3B6818461037BD4680BD6C2000205C -:1074300080B586B000AF786039607B68002B02D0E1 -:107440003B68002B02DA4FF0FF334DE0284B1B88DE -:1074500045F2AA52934202D06FF0010344E0FFF7D5 -:107460009BFD234B9B6A3B61214B1B8EFB60FFF70F -:10747000A7FDFB68002B02DA6FF0020334E03A68E4 -:10748000FB689A4201DD00232EE000237B6117E0B8 -:107490007B685A1C7A603A6912781A703B6901332A -:1074A0003B61134B5A6A124B1B6A013B13443A6906 -:1074B0009A4202D90E4B5B6A3B617B6901337B6167 -:1074C0007A693B689A42E3DBFFF766FD084A3B694D -:1074D0009362074B1A8E3B689BB2D31A9AB2044B45 -:1074E0001A86FFF76DFD3B6818461837BD4680BD0C -:1074F0006C20002080B582B000AF464B5B68184618 -:10750000FFF72BFE0346002B39D0424B5B68184631 -:10751000FFF79CFE0346FB713E4B1B8845F2AA52C7 -:10752000934273D13B4B1B8E1A463A4B1B6A9A42CD -:107530001CDA384BDB6AFA791A70364BDB6A013396 -:10754000344AD362334BDA6A324B596A314B1B6A85 -:10755000013B0B449A4203D92E4B5B6A2D4AD362FE -:107560002C4B1B8E01339AB22A4B1A86294B5B6B2C -:10757000002B04D0274B5B6BFA7910469847254BBC -:107580005B681846FFF70FFE0346002B3FD0214BE8 -:107590001B8845F2AA52934205D01E4B5B681846E1 -:1075A000FFF744FE33E01B4B9B8B002B25D0194B80 -:1075B0005A68184B5B691B7819461046FFF753FE53 -:1075C000144B5B690133134A5361124B5A69114BD7 -:1075D0001969104BDB68013B0B449A4203D90D4BF0 -:1075E0001B690C4A53610B4B9B8B013B9AB2094BB5 -:1075F0009A83084B0122DA8309E0064B0022DA83E2 -:10760000044B5B681846FFF711FE00E000BF083727 -:10761000BD4680BD6C20002080B582B000AF786090 -:107620003960124B5B681846FFF700FE16E000BF9A -:107630000E4B5B681846FFF7A3FD0346002BF7D0FF -:107640000A4B5A687B681B7819461046FFF70BFEF9 -:107650007B6801337B603B68013B3B603B68002BF0 -:10766000E5D13B6818460837BD4680BD6C20002038 -:1076700080B584B000AF786039600023FB60144BA4 -:107680005B681846FFF7C2FD1AE000BF104B5B684D -:107690001846FFF775FD0346002BF7D00C4B5B68CF -:1076A0001846FFF7D3FD03461A467B681A707B68BD -:1076B00001337B603B68013B3B60FB680133FB604F -:1076C0003B68002BE1D1FB6818461037BD4680BDF2 -:1076D0006C20002080B582B000AF464B5B68184636 -:1076E000FFF73BFD0346002B39D0424B5B68184641 -:1076F000FFF7ACFD0346FB713E4B1B8845F2AA52D7 -:10770000934273D13B4B1B8E1A463A4B1B6A9A42EB -:107710001CDA384BDB6AFA791A70364BDB6A0133B4 -:10772000344AD362334BDA6A324B596A314B1B6AA3 -:10773000013B0B449A4203D92E4B5B6A2D4AD3621C -:107740002C4B1B8E01339AB22A4B1A86294B5B6B4A -:10775000002B04D0274B5B6BFA7910469847254BDA -:107760005B681846FFF71FFD0346002B3FD0214BF7 -:107770001B8845F2AA52934205D01E4B5B681846FF -:10778000FFF754FD33E01B4B9B8B002B25D0194B8F -:107790005A68184B5B691B7819461046FFF763FD62 -:1077A000144B5B690133134A5361124B5A69114BF5 -:1077B0001969104BDB68013B0B449A4203D90D4B0E -:1077C0001B690C4A53610B4B9B8B013B9AB2094BD3 -:1077D0009A83084B0122DA8309E0064B0022DA8300 -:1077E000044B5B681846FFF721FD00E000BF083737 -:1077F000BD4680BDA420002080B485B000AF786075 -:1078000014E07B681B78FB73FB7B002B12D0FB7BA7 -:10781000602B08D9FB7B7A2B05D8FB7B203BFB73C5 -:107820007B68FA7B1A707B6801337B607B68002B76 -:10783000E7D100E000BF00BF1437BD465DF8047B10 -:107840007047000080B584B000AFF860B9607A601E -:10785000314B1B681F2B53DCF868F8F7E3FC034639 -:107860000B2B18D92C4B1A6813469B0013449B0012 -:107870002A4A13440B22F96818461CF0CDFF264B08 -:107880001A68264913469B0013449B000B440B3394 -:1078900000221A700BE0204B1A6813469B00134419 -:1078A0009B001E4A1344F96818461DF0F9FC1A4B58 -:1078B0001A6813469B0013449B00184A1344184649 -:1078C000FFF79AFF144B1A68144913469B001344A0 -:1078D0009B000B440C33BA681A600F4B1A680F49AF -:1078E00013469B0013449B000B4410337A681A60C4 -:1078F000094B1B680133084A1360074B1B6807E0FC -:10790000054B1B68194606481DF006FC4FF0FF3377 -:1079100018461037BD4680BD5C230020DC200020C7 -:10792000347D030880B5BCB000AFFEF7B5FC03465C -:10793000002B02D14FF0FF33B4E107F19C0318464E -:10794000FEF7B6FCC7F8D0000023C7F8E0300023EC -:10795000C7F8DC300023C7F8D8300023C7F8D4308C -:10796000002387F86830002387F8343000233B7009 -:107970000023C7F8EC30A3E007F19C02D7F8EC3005 -:1079800013441B7887F8CF30D7F8E030002B2DD187 -:10799000D7F8DC30002B04D197F8CF30202B00F043 -:1079A0008580D7F8DC30002B0ED097F8CF30202B15 -:1079B0000AD107F16802D7F8DC30134400221A70AC -:1079C0000123C7F8E03076E0D7F8DC30302B72DCEA -:1079D00007F16802D7F8DC30134497F8CF201A700B -:1079E000D7F8DC300133C7F8DC3064E0D7F8E0309A -:1079F000012B2CD1D7F8D830002B03D197F8CF30FA -:107A0000202B55D0D7F8D830002B0ED097F8CF3098 -:107A1000202B0AD107F13402D7F8D83013440022C2 -:107A20001A700223C7F8E03045E0D7F8D830302B81 -:107A300041DC07F13402D7F8D830134497F8CF204F -:107A40001A70D7F8D8300133C7F8D83033E0D7F8F8 -:107A5000E030022B3CD1D7F8D430002B03D197F87B -:107A6000CF30202B26D0D7F8D430002B0DD097F86C -:107A7000CF30202B09D13A46D7F8D4301344002216 -:107A80001A700323C7F8E03015E0D7F8D430302B54 -:107A900011DC3A46D7F8D430134497F8CF201A7047 -:107AA000D7F8D4300133C7F8D43004E000BF02E087 -:107AB00000BF00E000BFD7F8EC300133C7F8EC306E -:107AC000D7F8EC20D7F8D0309A42FFF655AF00E057 -:107AD00000BF07F16802D7F8DC30134400221A70A7 -:107AE00007F13402D7F8D830134400221A703A460E -:107AF000D7F8D430134400221A7007F168031846EF -:107B0000FFF77AFE07F134031846FFF775FE3B4690 -:107B10001846FFF771FE0023C7F8EC3031E0D7F8C4 -:107B2000EC2013469B0013449B00604A134407F16A -:107B3000680211461846F8F76BFB0346002B1BD171 -:107B40005A49D7F8EC2013469B0013449B000B4482 -:107B500010331B68002B1BD05449D7F8EC20134678 -:107B60009B0013449B000B4410331B68394607F1FC -:107B70003402104698470BE0D7F8EC300133C7F8D1 -:107B8000EC304B4B1B68D7F8EC209A42C7DB00E087 -:107B900000BF474B1B68D7F8EC209A427DDB4FF0C3 -:107BA000FF33C7F8E4300023C7F8EC3050E000237F -:107BB000C7F8E83030E007F16802D7F8E83013443E -:107BC0001B7887F8CF303949D7F8EC2013469B0053 -:107BD00013449B00CA18D7F8E83013441B7887F881 -:107BE000CE3097F8CF30202B1ED097F8CF30002B17 -:107BF0001AD097F8CE30202B16D097F8CE30002B25 -:107C000012D097F8CF2097F8CE309A420BD1D7F800 -:107C1000E8300133C7F8E830D7F8E820D7F8DC308F -:107C20009A42C8DB00E000BFD7F8E820D7F8DC3084 -:107C30009A4208D1D7F8DC30002B04D0D7F8EC30CA -:107C4000C7F8E4300AE0D7F8EC300133C7F8EC307D -:107C5000174B1B68D7F8EC209A42A8DBD7F8E43022 -:107C6000002B1ADB1149D7F8E42013469B0013447C -:107C70009B000B4410331B68002B0ED00B49D7F828 -:107C8000E42013469B0013449B000B4410331B68F5 -:107C9000394607F1340210469847FEF72FFDFEF7EC -:107CA00027FB00231846F037BD4680BDDC200020AE -:107CB0005C23002080B590B000AF7860396007F198 -:107CC0000C03184611F04EFC002387F83C3007F1F6 -:107CD0000C03194608481DF01FFA07F10C0318465B -:107CE00011F0AEFC07F10C03194604481DF014FA1C -:107CF00000BF4037BD4680BD587D0308707D030836 -:107D000080B584B000AF786039600023FB601AE072 -:107D1000FA6813469B0013449B00104A134419460B -:107D20000F481DF0F9F90D49FA6813469B001344FA -:107D30009B000B440C331B6819460A481DF0ECF9F4 -:107D4000FB680133FB60084B1B68FA689A42DFDB73 -:107D500000BF00BF1037BD4680BD00BFDC20002043 -:107D6000787D0308807D03085C23002080B582B005 -:107D700000AF78603960FFF73BF900BF0837BD46B8 -:107D800080BD000080B500AFFEF7DAFC4FF4207232 -:107D900000210B481CF04EFD0A4B00221A600A4AD3 -:107DA0000A490B48FFF74EFD0A4A0B490B48FFF7FB -:107DB00049FD0B4A0B490C48FFF744FD00BF80BD4D -:107DC000DC2000205C230020017D0108AC7D03083D -:107DD000C07D0308B57C0108C87D0308E07D030869 -:107DE0006D7D0108E87D0308F87D030880B483B049 -:107DF00000AF78607B681B6843F040027B681A60C4 -:107E000000BF0C37BD465DF8047B704780B483B07B -:107E100000AF78607B689B6803F00103012B01D100 -:107E2000012300E0002318460C37BD465DF8047BB3 -:107E3000704780B483B000AF78607B689B6803F0C4 -:107E40000203022B01D1012300E0002318460C3766 -:107E5000BD465DF8047B704780B483B000AF7860A6 -:107E60007B68DB68DBB218460C37BD465DF8047BE7 -:107E7000704780B485B000AF78600B46FB707B68BC -:107E80000C33FB60FB68FA781A7000BF1437BD46EC -:107E90005DF8047B7047000080B500AF0348FFF732 -:107EA000A5FF034B01221A7000BF80BD00300140C6 -:107EB0006023002080B582B000AF0346FB7100BF95 -:107EC0000C48FFF7B6FF0346002BF9D0FB791946A3 -:107ED0000848FFF7CEFF00BF0648FFF797FF0346AD -:107EE000002BF9D00348FFF7B7FF034618460837C1 -:107EF000BD4680BD0030014080B582B000AF034672 -:107F0000FB71FB791846FFF7D5FF00BF0837BD4668 -:107F100080BD80B500AFFF20FFF7CCFF03461846B9 -:107F200080BD000080B500AF0348FFF75FFF034B43 -:107F300001221A7000BF80BD00380040612300207C -:107F400080B582B000AF0346FB7100BF0C48FFF75D -:107F500070FF0346002BF9D0FB7919460848FFF75C -:107F600088FF00BF0648FFF751FF0346002BF9D0FA -:107F70000348FFF771FF034618460837BD4680BD2A -:107F80000038004080B582B000AF0346FB71FB793A -:107F90001846FFF7D5FF00BF0837BD4680BD80B546 -:107FA00000AFFF20FFF7CCFF0346184680BD00005E -:107FB00080B500AF0348FFF719FF034B01221A7089 -:107FC00000BF80BD003C00406223002080B582B02D -:107FD00000AF0346FB7100BF0C48FFF72AFF0346C2 -:107FE000002BF9D0FB7919460848FFF742FF00BF84 -:107FF0000648FFF70BFF0346002BF9D00348FFF7B5 -:108000002BFF034618460837BD4680BD003C0040A4 -:1080100080B582B000AF0346FB71FB791846FFF7CD -:10802000D5FF00BF0837BD4680BD80B500AFFF203B -:10803000FFF7CCFF0346184680BD000080B483B034 -:1080400000AF03463960FB7197F90730002B0ADB5C -:108050003B68DAB20C4997F907301201D2B20B44EF -:1080600083F800230AE03B68DAB20849FB7903F0A1 -:108070000F03043B1201D2B20B441A7600BF0C3737 -:10808000BD465DF8047B704700E100E000ED00E0D4 -:1080900080B582B000AF78607B68013BB3F1807F30 -:1080A00001D301230FE00A4A7B68013B53600F2193 -:1080B0004FF0FF30FFF7C2FF054B00229A60044BE0 -:1080C00007221A60002318460837BD4680BD00BF4E -:1080D00010E000E080B500AF124B1B68002B1FD1F1 -:1080E0001148FFF7D5FF00214FF0FF30FFF7A6FF43 -:1080F0000E4B00221A600E4B00221A60A0220021B3 -:108100000C481CF097FB0C4B00221A600B4B002212 -:108110001A60044B01221A604FF47A70FEF7ECFFEC -:1081200000BF80BD1424002020BF02006423002073 -:10813000682300206C2300200C2400201024002041 -:1081400080B586B000AFF860B9607A60FB68002B3C -:1081500001DC0123FB601D4B1B68002B26D01C4B50 -:108160001B68092B22DCFB68002B1FD0184B1B68F7 -:10817000FA6818491B010B441A60154B1B68154A15 -:108180001B0113440433BA681A60114B1B68114A6F -:108190001B0113440C337A681A600D4B1B687B611A -:1081A0000B4B1B6801330A4A13600AE0074B19683E -:1081B000074B1A68FB6808481CF0AEFF4FF0FF330E -:1081C0007B617B6918461837BD4680BD14240020AA -:1081D000682300206C230020007E030880B582B055 -:1081E00000AF214B1B68002B3AD000237B6032E0AC -:1081F0001E4B1B681A461E497B681B010B441B68FB -:10820000B2FBF3F101FB03F3D31A002B20D1184A80 -:108210007B681B01134404331B68002B06D0144AEF -:108220007B681B01134404331B689847104A7B6822 -:108230001B0113440C331B68002B09D00C4A7B68CC -:108240001B011344083301221A600A4B01221A60F1 -:108250007B6801337B60084B1B687A689A42C7DBF6 -:1082600000BF0837BD4680BD1424002064230020D1 -:108270006C230020102400206823002080B582B0E9 -:1082800000AF164B1B68002B24D0154B1B68002B2E -:1082900020D000237B6018E0124A7B681B01134446 -:1082A00008331B68002B0DD00E4A7B681B0113445A -:1082B000083300221A600B4A7B681B0113440C33FD -:1082C0001B6898477B6801337B60074B1B687A68A3 -:1082D0009A42E1DB00BF0837BD4680BD1424002070 -:1082E000102400206C2300206823002080B500AFFC -:1082F0000F4B1B6801330E4A1360FFF76FFF0C4BE7 -:1083000019680C4B83FB01239A10CB17D21A134622 -:108310009B0013445B00CA1A002A06D1064B1B6857 -:108320000133054A1360FEF701FF00BF80BD00BFA7 -:1083300064230020676666660C24002080B485B044 -:1083400000AF134B1B68BB60124B9B68FB60104B6C -:108350001B687B60BA687B689A4204D00D4B9B68AF -:10836000FB607B68BB60BB6801334FF47A7203FB30 -:1083700002F2FB6801339B080749A1FB03139B082A -:10838000D31A18461437BD465DF8047B704700BF0A -:108390006423002010E000E0176CC11680B400AF29 -:1083A000034B1B681846BD465DF8047B704700BF51 -:1083B0006423002080B58AB000AF78607B689B683A -:1083C0009847786219E07B6A0F2B02DC7B6A3B627C -:1083D00001E010233B627B685B6807F10C02396A9D -:1083E00010469847F861FB69002B02DC0023FB6113 -:1083F00006E07A6AFB69D31A7B627B6A002BE2DCB7 -:108400007B6A18462837BD4680BD000080B590B015 -:1084100000AF7860396007F10803BB627B68002B0E -:1084200002D03B68002B02D14FF0FF33A7E1954B00 -:108430001B68B3F5826F33DA7B689B689847786274 -:108440007B6A002B03DC6FF00203FB6328E08D4B9B -:108450001A687B6A134440F2DC5293420BDC7B685F -:108460005B68884A126887490A440432796A104670 -:108470009847F8630EE07B685A68824B1B68814915 -:108480000B44181D7F4B1B68C3F5BB6304331946AF -:108490009047F8637B4B1A68FB6B1344794A13606F -:1084A000784B1B687B627B6A0F2B04DC6FF0020346 -:1084B000FB63FB6B63E10023BB630023FB620023D0 -:1084C0007B6300233B630023FB6380E07B6B002B1B -:1084D00006D1BB6B102B03DD6FF00303FB637AE067 -:1084E000684B1B68BA6B9A4213DA664ABB6B13443B -:1084F00004331B7887F82330BB6B0133BB63BA6A44 -:108500007B6B134497F823201A707B6B032B5BDC87 -:1085100003E06FF00203FB635DE07B6B002B1ED179 -:10852000462297F82330934205D1BB6B013BFB6297 -:1085300001233B6348E0562297F82330934205D14C -:10854000BB6B013BFB6202233B633DE0BB6BFB6209 -:1085500000233B6300237B630023FB6337E03B6B1B -:10856000012B10D1484A7B6B13441B7897F82320CA -:108570009A4229D00023FB6200233B6300237B63E4 -:108580000023FB6323E03B6B022B10D13F4A7B6B44 -:1085900013441B7897F823209A4215D00023FB62DE -:1085A00000233B6300237B630023FB630FE0002376 -:1085B000FB6200233B6300237B636FF00703FB63D5 -:1085C00033481CF045FE06E07B6B01337B637B6B1D -:1085D0000F2B7FF77BAF7B6B0F2B1DDDBB6A04334B -:1085E0000A21184600F0BEF903463B84BB6ADB89CA -:1085F0009BB23A8C9A4207D11022B96A38681CF0B3 -:108600000BF91023FB6307E0BB6BFB6221481CF0F6 -:108610001FFE6FF00103FB63FB6B102B76D13B68F1 -:1086200004221A4918461CF0E7F80346002B6AD1C9 -:108630003B68DB889BB2FB61FB69B3F5806F0CDDA7 -:10864000FB691033FA6A1344FB62F96912481CF0A3 -:1086500063FD6FF00503FB6358E0FB69002B05D158 -:10866000FB6A1033FB621023FB634FE0FB6903F1ED -:108670000F02044B1B689A4210DB6FF00203FB638E -:1086800044E000BF182400209CCA0308A0CA0308C5 -:10869000507E0308787E03089C7E0308BB6B3A4A31 -:1086A00013440433F969184600F05CF903467B83F0 -:1086B000BB6A1B899BB27A8B9A4218D13B6803F143 -:1086C0001000BB6B304A13440433FA6919461CF09E -:1086D000A3F8FB69B3F5806F05DA3A68FB691344C8 -:1086E000103300221A70FB691033FB6305E0274842 -:1086F0001CF0AEFD6FF00103FB63FB691033FA6AF7 -:108700001344FB6202E0FB6A1033FB62FB6A002B3E -:108710001EDD1D4B1B68FA6A9A4219DC1A4B1B6856 -:10872000FA6A9A420BDAFB6A174A1344191D164B70 -:108730001A68FB6AD31A1A4615481CF06DF8124BDA -:108740001A68FB6AD31A104A13600023FB6215E013 -:10875000FB6A002B03DA0F481CF07AFD0EE00A4B8F -:108760001B68FA6A9A4209DD074B00221A60064B21 -:108770001B681A46F96A08481CF0CEFCFB6B1846C9 -:108780004037BD4680BD00BF18240020B87E0308D6 -:108790001C240020DC7E0308EC7E030880B588B032 -:1087A00000AFF860B9607A60BB68002B02D14FF06F -:1087B000FF335AE0BB6804222E4918461CF01CF80F -:1087C0000346002B02D11023BB6114E0BB680422D6 -:1087D000294918461CF010F80346002B05D1BB6848 -:1087E000DB889BB21033BB6105E024481CF030FDF0 -:1087F0004FF0FF3339E00023FB61FB68DB689847EB -:1088000078617B69002B03DC6FF00103FB6116E0EC -:108810007A69BB699A4211DA7B68013B7B607B68AD -:10882000002B02DC0123FB6109E0FB681B69002BC4 -:10883000E3D0FB681B6901209847DEE700BFFB69B6 -:10884000002B11D1FB681B68BA68B96910469847BC -:10885000F861FA69BB699A4206D0F96908481CF0C8 -:108860005BFC6FF0010300E0002318462037BD4693 -:1088700080BD00BF9CCA0308A0CA0308247F030868 -:10888000487F030880B584B000AFF860B960134634 -:10889000FB80FB68002B02D14FF0FF332EE0BB685A -:1088A000002B01D10023FB80FB68164A106818607A -:1088B000FB68FA88DA80FB881946B86800F052F83D -:1088C00003461A46FB681A81FB6804330A211846DE -:1088D00000F048F803461A46FB68DA81FB88002B53 -:1088E0000BD0FB681033BA689A4206D0FB6810338D -:1088F000FA88B96818461BF08FFF00231846103716 -:10890000BD4680BDA0CA030880B582B000AF7860C4 -:108910007B68002B04D05822002178681BF08AFF66 -:1089200000BF0837BD4680BD80B483B000AF0346AA -:108930000A46FB8013467B71FB881B0A9AB2F988B2 -:108940007B794B40DBB2064931F813305340FB8052 -:10895000FB8818460C37BD465DF8047B704700BFA6 -:10896000A4CA030880B584B000AF786039600023E2 -:108970007B810023FB600DE0FB687A6813441A7862 -:108980007B8911461846FFF7CFFF03467B81FB68C2 -:108990000133FB60FA683B689A42EDDB7B8918463D -:1089A0001037BD4680BD80B485B000AF78603960B7 -:1089B0000023BB600023FB600AE0FB687A68134475 -:1089C0001B781A46BB681344BB60FB680133FB602D -:1089D000FA683B689A42F0DBBB6818461437BD461C -:1089E0005DF8047B7047000080B483B000AF78600E -:1089F0000B46FB707B681A0AF9787B684B40DBB248 -:108A0000044951F82330534018460C37BD465DF8F1 -:108A1000047B7047A4CC030880B584B000AF7860B5 -:108A200039604FF0FF33BB600023FB600BE0FB6855 -:108A30007A6813441B781946B868FFF7D5FFB86009 -:108A4000FB680133FB60FA683B689A42EFDBBB6866 -:108A500018461037BD4680BD80B485B000AF786041 -:108A600039600023FB730FE07B681A78FB7B53406F -:108A7000DBB21A46094B9B5CDB43FB737B6801331B -:108A80007B603B68013B3B603B68002BECD1FB7B90 -:108A900018461437BD465DF8047B7047A4D0030820 -:108AA00080B500AF00F066F800BF80BD80B58AB029 -:108AB00000AFF860B9607A603B60BB68012B02D1FF -:108AC00010237B6207E0BB68022B02D108237B6284 -:108AD00001E018237B62FB687B617B6ABB617B687A -:108AE000FB613B683B6207F114034FF48052194667 -:108AF0000648FBF745FA0346002B01D1012300E0AD -:108B0000002318462837BD4680BD00BF840F0020D3 -:108B100080B58AB000AFF860B9607A603B60BB682E -:108B2000012B02D110237B6207E0BB68022B02D12C -:108B300008237B6201E018237B62FB687B617B6A10 -:108B4000BB617B68FB613B683B6207F114034FF438 -:108B5000805219460648FBF713FA0346002B01D151 -:108B6000012300E0002318462837BD4680BD00BF22 -:108B7000B80F002080B582B000AF00230122012190 -:108B80000120FFF793FF4FF4FA70FEF73DFA002340 -:108B9000012201210220FFF789FF00230822012181 -:108BA0000320FFF783FF4FF40C737B607B68012287 -:108BB00001210420FFF77AFF40F2AB211548FBF7B3 -:108BC0000AFA0023012202210120FFF7A1FF4FF43E -:108BD000FA70FEF719FA0023012202210220FFF7A2 -:108BE00097FF0023082202210320FFF791FF4FF493 -:108BF0000C737B607B68012202210420FFF788FF51 -:108C000040F2AB210448FBF7E6F900BF0837BD4648 -:108C100080BD00BF840F0020B80F002080B483B057 -:108C200000AF78600B467B807B687A881A8000BF33 -:108C30000C37BD465DF8047B704780B483B000AF4D -:108C400078607B681B889BB218460C37BD465DF880 -:108C5000047B704780B485B000AFF860B9607A607B -:108C600008E0BB689A1CBA60FA681B8813807B68AE -:108C7000013B7B607B68002BF3D100BF00BF143742 -:108C8000BD465DF8047B704780B500AFFFF790F9F3 -:108C900000BF80BD90B585B000AF03463960FB8052 -:108CA0001346BB80BB88002B28D03B68002B25D007 -:108CB00011F074FE0320FFF7ABF9FB881B0A9BB28F -:108CC000DBB21846FFF7A4F9FB88DBB21846FFF7C2 -:108CD0009FF90023FB6009E03C68631C3B60FFF7E1 -:108CE000A4F903462370FB680133FB60BB88FA6874 -:108CF0009A42F1DB11F05EFEBB8800E000231846CB -:108D00001437BD4690BD80B584B000AF03463960CE -:108D1000FB801346BB80BB88002B2FD03B68002B09 -:108D20002CD011F03BFE0620FFF772F911F042FE45 -:108D300011F034FE0220FFF76BF9FB881B0A9BB28F -:108D4000DBB21846FFF764F9FB88DBB21846FFF781 -:108D50005FF90023FB6009E03B685A1C3A601B780E -:108D60001846FFF755F9FB680133FB60BB88FA68CA -:108D70009A42F1DB11F01EFEBB8800E0002318468A -:108D80001037BD4680BD80B500AF00F016F8FFF784 -:108D900083F800F019F800F0C3F800F002F800BF03 -:108DA00080BD80B500AF00F081F900F067FC00F0F5 -:108DB0008BFC00F039FA00BF80BD80B400AF00BF6B -:108DC000BD465DF8047B704780B500AF0449054897 -:108DD00002F036F80449054802F058F800BF80BD9B -:108DE00059A9020845A90208F97E0108137F010864 -:108DF00080B485B000AFF860B9607A603B60FB6812 -:108E0000DAB2284B9A71FB681B0ADAB2254BDA7189 -:108E1000FB681B0CDAB2234B1A72FB681B0EDAB22A -:108E2000204B5A72BB68DAB21E4B9A72BB681B0A9F -:108E3000DAB21C4BDA72BB681B0CDAB2194B1A732C -:108E4000BB681B0EDAB2174B5A737B68DAB2154B4C -:108E50009A737B681B0ADAB2124BDA737B681B0CBD -:108E6000DAB2104B1A747B681B0EDAB20D4B5A74CF -:108E70003B68DAB20B4B9A743B681B0ADAB2094BB7 -:108E8000DA743B681B0CDAB2064B1A753B681B0E92 -:108E9000DAB2044B5A7500BF1437BD465DF8047B47 -:108EA000704700BF082A002080B588B000AF786006 -:108EB00007F10C031846FDF7ABFF07F10C03102177 -:108EC0001846FFF74FFD0346FB8307F10C03102103 -:108ED0001846FFF768FD03467B777B68002B1AD0A6 -:108EE0007B6852221A707B68013350221A707B68AB -:108EF00002334E221A70FB8B1B0A9AB27B68033333 -:108F0000D2B21A707B680433FA8BD2B21A707B68C3 -:108F100005337A7F1A7000BF2037BD4680BD000040 -:108F200080B500AF184B01221A70174B00225A70FF -:108F3000154B01229A70144B0122DA701348FFF787 -:108F4000B3FF134B134A1A60134B6FF07F421A6042 -:108F5000124B134A1A60134B114A1A600C4B1868D3 -:108F60000D4B19680D4B1A680E4B1B68FFF740FF3D -:108F7000064B01229A750C4B03221A700A4B4FF4D0 -:108F8000FA625A8000BF80BD202A0020082A0020F3 -:108F9000282A0020C0A810FD2C2A0020302A0020FA -:108FA000C0A81001342A0020242A002080B500AF78 -:108FB00030490B2001F096FF2F481CF049F92D4B4A -:108FC0001B78012B03D12D481CF042F90DE0294BF1 -:108FD0001B78002B03D12A481CF03AF905E0254BF9 -:108FE0001B78194627481CF097F8224B5B78012B19 -:108FF00003D125481CF02CF90DE01E4B5B78002BAB -:1090000003D122481CF024F905E01A4B5B7819467D -:109010001F481CF081F8174B9B78012B03D11D488A -:109020001CF016F90DE0134B9B78002B03D11A4866 -:109030001CF00EF905E00F4B9B78194617481CF001 -:109040006BF80C4BDB78012B03D115481CF000F9B1 -:109050000DE0084BDB78002B03D112481CF0F8F828 -:1090600005E0044BDB7819460F481CF055F800BFAB -:1090700080BD00BF202A0020707F0308947F030872 -:10908000AC7F0308C47F0308D47F0308F07F030884 -:109090000C8003081C8003083880030850800308F4 -:1090A000608003087C80030898800308B0B58CB00A -:1090B00004AF544B3C460FCB84E80F000021002046 -:1090C00001F010FF0A20FDF7B5FF0021092001F093 -:1090D00009FF0A20FDF7AEFF4B490A2001F002FF0D -:1090E0000A20FDF7A7FF0021092001F0FBFE0A205E -:1090F000FDF7A0FFFFF75AFF3B461946012001F09C -:10910000F1FE0346FB61FB69B3F1FF3F05D13F4828 -:109110001CF09EF84FF0FF3370E007F11B03194677 -:109120000E2001F0DFFEFB7E194639481BF0F4FFEC -:10913000F0233B8307F118031946042001F0D2FE07 -:1091400007F118031946052001F0CCFE07F11803BA -:109150001946022001F0C6FE4FF6F0733B8307F17B -:1091600018031946032001F0BDFE19233B8307F1C4 -:1091700018031946062001F0B5FE07F11803194639 -:10918000072001F0AFFE3B8B194622481BF0C4FFBD -:1091900007F110031946082001F0A4FE3B7C184695 -:1091A0007B7C1C46BB7C1D46FB7C3A7D797D029115 -:1091B000019200932B462246014617481BF0ACFF54 -:1091C00007F11B0319460F2001F08CFE0346FB61DB -:1091D000FB69B3F1FF3F03D110481CF039F80CE0F4 -:1091E000FB7E012B03D10E481CF032F805E0FB7E1C -:1091F000002B02D10B481CF02BF8FB6918462037D6 -:10920000BD46B0BD48810308202A0020A88003087D -:10921000C4800308D8800308EC8003080C8103088D -:109220002881030838810308B0B586B004AF002355 -:10923000FB71FB1D1946022001F036FF4449002056 -:1092400001F032FF0A20FDF7F5FE4149012001F04F -:109250002BFF3B461946082001F044FE3B461946C9 -:109260003C481BF059FF3A4B1B781846384B5B784B -:109270001C46374B9B781D46354BDB781A46344BE2 -:109280001B791946324B5B790293019100922B4670 -:109290002246014630481BF03FFF2D4B9B79194673 -:1092A0002B4BDB791A462A4B1B7A1846284B5B7AE4 -:1092B0000093034629481BF02FFF254B9B7B194643 -:1092C000234BDB7B1A46224B1B7C1846204B5B7CD6 -:1092D0000093034622481BF01FFF1D4B9B7A194643 -:1092E0001B4BDB7A1A461A4B1B7B1846184B5B7BD1 -:1092F000009303461B481BF00FFF154B9B7C194640 -:10930000134BDB7C1A46124B1B7D1846104B5B7DC2 -:109310000093034614481BF0FFFE0D4B9B7D012B71 -:1093200003D112481BF094FF06E0094B9B7D022BF2 -:1093300002D10F481BF08CFF0E481BF089FF0E492D -:10934000042001F0B1FE00BF0837BD46B0BD00BF2C -:10935000082A002058810308708103088C810308C3 -:10936000A0810308B4810308C8810308DC810308D5 -:10937000F081030804820308242A002080B584B009 -:1093800000AF78600023FB607B68012B00F3A880AE -:109390007B6813F10F0F0ADA7B686FF47A729342DD -:1093A00000F097807B6813F57A7F33D098E07B6874 -:1093B0000F33102B00F2948001A252F823F000BF6B -:1093C000C5940108B7940108A99401089B94010869 -:1093D0008D9401087F940108E1940108E19401084B -:1093E0007194010863940108559401084794010899 -:1093F000399401082B9401081D9401080D9401086B -:10940000059401083B481BF023FF6CE03A481BF031 -:109410001FFF68E039481BF01BFF64E038481BF071 -:1094200017FF4FF0FF33FB605DE036481BF010FF85 -:109430004FF0FF33FB6056E033481BF009FF4FF05D -:10944000FF33FB604FE031481BF002FF4FF0FF336A -:10945000FB6048E02E481BF0FBFE4FF0FF33FB6043 -:1094600041E02C481BF0F4FE4FF0FF33FB603AE084 -:1094700029481BF0EDFE4FF0FF33FB6033E0274837 -:109480001BF0E6FE4FF0FF33FB602CE024481BF09E -:10949000DFFE4FF0FF33FB6025E022481BF0D8FED3 -:1094A0004FF0FF33FB601EE01F481BF0D1FE4FF072 -:1094B000FF33FB6017E01D481BF0CAFE4FF0FF337F -:1094C000FB6010E01A481BF0C3FE4FF0FF33FB6057 -:1094D00009E018481BF0BCFE4FF0FF33FB6002E0D0 -:1094E0007B68FB6000BF00F0C2F8FB6818461037CD -:1094F000BD4680BD6C82030890820308DC820308AD -:109500000C830308248303083C8303088483030833 -:10951000A4830308D0830308E8830308188403089E -:109520002C84030844840308588403086C840308CB -:10953000A4840308DC84030880B586B000AFF8601B -:10954000B9607A6000237B61FB681B68012B03D044 -:10955000FB681B68022B14D1FB685B68022B0DD1E2 -:10956000FB681B7A7A6892B2B968184601F054F821 -:1095700038613869FFF702FF786102E003481BF0A9 -:1095800067FE7B6918461837BD4680BD0485030811 -:1095900080B586B000AFF860B9607A6000237B6167 -:1095A000FB681B68012B03D0FB681B68022B14D1DE -:1095B000FB685B68022B0DD1FB681B7A7A6892B25C -:1095C000B968184601F022F938613869FFF7D6FE0C -:1095D000786102E003481BF03BFE7B6918461837B0 -:1095E000BD4680BD0485030880B582B000AF7860B9 -:1095F0007B685B68022B06D17B681B7A184600F0FB -:10960000B4FC034601E04FF0FF3318460837BD466F -:1096100080BD80B582B000AF78607B685B68022B4C -:1096200006D17B681B7A184600F054FC034601E023 -:109630004FF0FF3318460837BD4680BD80B582B075 -:1096400000AF78607B68002B04DA786800F0DCFA01 -:10965000034608E07B68002B04DC786800F0BEFA63 -:10966000034600E0002318460837BD4680BD80B59C -:1096700000AF00F055F800BF80BD000080B483B09B -:1096800000AF00237B6009E00C4A7B685B01134458 -:10969000043301221A607B6801337B607B68002BF6 -:1096A000F2DD074B00221A60064B00221A6000BF51 -:1096B0000C37BD465DF8047B704700BF1C000020DE -:1096C000382A00203C2A002080B582B000AF012358 -:1096D000FB7000237B6017E00F4A7B685B0113443B -:1096E00008331B78FA1C0721184601F045F90A4A8D -:1096F0007B685B01134408331B78194607481BF04D -:109700000BFD7B6801337B607B68002BE4DD00BFD1 -:1097100000BF0837BD4680BD1C0000201885030827 -:10972000B0B590B004AF0023BB6207F10F03194638 -:109730000F2001F0D7FB0346FB610A237B6207F190 -:109740000E0319460F2001F0CDFB0346BB61FA69F9 -:10975000BB699A4204D0B9699C481BF0DDFC11E05A -:10976000BA7BFB7B9A4207D0BB7B1946FB7B1A4630 -:1097700097481BF0D1FC05E07B6A013B7B627B6A6A -:10978000002BDCDC7B6A002B40F00C82FB69B3F120 -:10979000FF3F06D18F4B00221A608F481BF058FD07 -:1097A00003E2FB7B012B0FD18A4B1B68012B52D0AC -:1097B0000123BB62874B01221A6088481BF048FDD9 -:1097C000874B00221A6046E0FB7B002B3FD1814B88 -:1097D0001B68002B03D07F4B1B68012B16D17D4BE0 -:1097E0001B68002B08D10223BB627A4B03221A604C -:1097F0007C481BF02DFD2EE0794B00221A60754B42 -:1098000002221A6078481BF023FD24E0714B1B688C -:10981000022B14D175481BF01BFD714B1B680133E3 -:109820006F4A13606E4B1B680A2B14DD0223BB6268 -:10983000684B03221A606B481BF00AFD0BE0654B76 -:109840001B68032B07D06A481BF002FD03E0694840 -:109850001BF0FEFCA9E15F4B1B68032B37D1BB6AF1 -:10986000022B34D10023FB622DE0634AFB6A5B01CB -:10987000134404331B68012B22D05F4AFB6A5B014F -:109880001344043301221A605B4AFB6A5B011344F0 -:1098900008331B78194659481BF03EFC564AFB6AB0 -:1098A0005B01134408331B78184600F03FFE524A10 -:1098B000FB6A5B01134408331B78184600F06EFD09 -:1098C000FB6A0133FB62FB6A002BCEDD6DE10023F6 -:1098D000FB6262E1484AFB6A5B01134408331B7870 -:1098E000FB75454AFB6A5B01134410331B88BB823E -:1098F000FB7D9B000133DB0003F54073184600F04D -:109900008FF90346FB730A233B62FB7D9B00013307 -:10991000DB0003F54073184600F082F90346FB7440 -:10992000FB7BFA7C9A4206D0F97DFA7CFB7B3448BB -:109930001BF0F2FB05E03B6A013B3B623B6A002BFC -:10994000E3DC3B6A002B40F02F81FB7B1C2B00F2F9 -:10995000118101A252F823F0CB9A0108759B0108EE -:10996000759B0108759B0108759B0108759B010893 -:10997000759B0108759B0108759B0108759B010883 -:10998000759B0108759B0108759B0108759B010873 -:10999000759B0108759B0108759B0108759B010863 -:1099A000759B0108199B0108879B0108759B01089D -:1099B000759B0108059A0108759B0108759B0108B4 -:1099C000759B0108759B01089B9A01083C8503085B -:1099D00054850308382A00207885030894850308F5 -:1099E0003C2A0020A4850308B8850308CC85030819 -:1099F000E0850308F48503081C000020088603089E -:109A000038860308FB7D9B000133DB0003F5007300 -:109A1000184600F005F903469BB203F01F033B8292 -:109A20003B8A03F00103002B00F0AF80604AFB6A21 -:109A30005B011344043302221A6007F10802FB7D24 -:109A40000421184601F098F8BA1DFB7D052118463F -:109A500001F092F8F97DBB68DBB21C46BB681B0ABB -:109A6000DBB21D46BB681B0CDBB21A46BB681B0E83 -:109A7000DBB2F8880290019300922B4622464D48B3 -:109A80001BF04AFBFB7D9B000133DB0003F50073F9 -:109A90000121184600F010F977E0FB7D184600F030 -:109AA00045FD0346FB61FB7D184600F077FCFB7D1E -:109AB000FA69194640481BF02FFB3D4AFB6A5B01DF -:109AC0001344043301221A6064E0FB7D19463B48CD -:109AD0001BF022FBBA8AF87D0123012100F048FB2C -:109AE0000346FB61FB7DFA699A4205D1FB7D19466D -:109AF00033481BF011FB4AE0FB7DFA6919463148F7 -:109B00001BF00AFBFB6913F1030F40D12E481BF039 -:109B10009FFBFFF746F93AE0FB7D184600F0ACFCEE -:109B20000346FB61FB69012B1DD1214AFB6A5B01E6 -:109B30001344043303221A60F97D244B9B791C469D -:109B4000224BDB791D46214B1B7A1A461F4B5B7A51 -:109B50001846BB8A0293019000922B4622461C486D -:109B60001BF0DAFA16E0FB7DFA69194619481BF07A -:109B7000D3FA0FE0FB7B002B0BD0FB7B194616487A -:109B80001BF0CAFA05E000BF04E000BF02E000BF1E -:109B900000E000BFFB6A0133FB62FB6A002B7FF72A -:109BA00099AE02E000BF00E000BF3037BD46B0BD57 -:109BB0001C0000205C860308A8860308D4860308DE -:109BC0000C8703083487030864870308082A0020E9 -:109BD00078870308C4870308F487030880B483B038 -:109BE00000AF78607B68002B04DC7B685B01054A72 -:109BF000134400E0002318460C37BD465DF8047B93 -:109C0000704700BF1C00002080B483B000AF7860B4 -:109C1000002318460C37BD465DF8047B70470000F2 -:109C200080B584B000AF7860224BDB689847214B49 -:109C30005B6998471F4B5B6A002B03D01D4B9B6AE7 -:109C4000002B14D11B4B1B6A7A68120CD2B210463F -:109C50009847184B1B6A7A68120AD2B21046984786 -:109C6000144B1B6A7A68D2B21046984711E07B68A1 -:109C70001B0CDBB23B737B681B0ADBB27B737B681C -:109C8000DBB2BB730B4B9B6A07F10C02032110463E -:109C90009847084BDB6998470346FB73054B9B6964 -:109CA0009847044B1B699847FB7B18461037BD4605 -:109CB00080BD00BF4000002080B584B000AF786058 -:109CC0000B46FB70224BDB689847214B5B6998473A -:109CD0007B6843F004037B601D4B9B6A002B19D10A -:109CE0001B4B1B6A7A68120CD2B210469847184B6D -:109CF0001B6A7A68120AD2B210469847144B1B6A44 -:109D00007A68D2B210469847114B1B6AFA7810460F -:109D1000984713E07B681B0CDBB23B737B681B0A24 -:109D2000DBB27B737B68DBB2BB73FB78FB73084BE6 -:109D30009B6A07F10C02042110469847044B9B696B -:109D40009847034B1B69984700BF1037BD4680BD3D -:109D50004000002090B587B000AFF860B9601346AE -:109D6000FB802B4BDB689847294B5B699847284B56 -:109D70005B6A002B03D0264B9B6A002B26D1244B19 -:109D80001B6AFA68120CD2B210469847204B1B6A25 -:109D9000FA68120AD2B2104698471D4B1B6AFA683D -:109DA000D2B2104698470023FB820AE0184BDB69C9 -:109DB000FA8AB9688C18984703462370FB8A0133E6 -:109DC000FB82FA8AFB889A42F0D317E0FB681B0CEF -:109DD000DBB23B74FB681B0ADBB27B74FB68DBB253 -:109DE000BB740B4B9B6A07F1100203211046984786 -:109DF000074B5B6AFA881146B8689847044B9B6921 -:109E00009847034B1B69984700BF1C37BD4690BD60 -:109E10004000002080B586B000AFF860B9601346FE -:109E2000FB802B4BDB689847294B5B699847FB68A5 -:109E300043F00403FB60264B9B6A002B26D1244B86 -:109E40001B6AFA68120CD2B210469847204B1B6A64 -:109E5000FA68120AD2B2104698471D4B1B6AFA687C -:109E6000D2B2104698470023FB820AE0184B1B6AC7 -:109E7000FA8AB9680A44127810469847FB8A013377 -:109E8000FB82FA8AFB889A42F0D317E0FB681B0C2E -:109E9000DBB23B74FB681B0ADBB27B74FB68DBB292 -:109EA000BB740B4B9B6A07F11002032110469847C5 -:109EB000074B9B6AFA881146B8689847044B9B6920 -:109EC0009847034B1B69984700BF1837BD4680BDB4 -:109ED0004000002090B585B000AF0346FB71002321 -:109EE000FB810023BB81FB799B000133DB0003F581 -:109EF00000531846FFF794FE0346BB81BB891B0243 -:109F00009CB2FB799B000133DB0003F50453184638 -:109F1000FFF786FE03469BB22344BB81BB89002B1F -:109F20001AD0FB799B000133DB0003F50053184680 -:109F3000FFF776FE0346FB81FB891B029CB2FB798F -:109F40009B000133DB0003F504531846FFF768FE5E -:109F500003469BB22344FB81FA89BB899A42C2D152 -:109F6000FB8918461437BD4690BD90B585B000AF4B -:109F70000346FB710023FB810023BB81FB799B001F -:109F80000133DB0003F518531846FFF749FE03467B -:109F9000BB81BB891B029CB2FB799B000133DB00B8 -:109FA00003F51C531846FFF73BFE03469BB22344C0 -:109FB000BB81BB89002B1AD0FB799B000133DB00EE -:109FC00003F518531846FFF72BFE0346FB81FB8968 -:109FD0001B029CB2FB799B000133DB0003F51C5391 -:109FE0001846FFF71DFE03469BB22344FB81FA8906 -:109FF000BB899A42C2D1FB8918461437BD4690BD31 -:10A0000090B585B000AF03463960FB711346BB8045 -:10A010000023FB810023BB60BB88002B48D0FB7969 -:10A020009B000133DB0003F510531846FFF7F8FDE2 -:10A0300003469BB21B029CB2FB799B000133DB0001 -:10A0400003F514531846FFF7EBFD03469BB2234478 -:10A05000FB81FB891B02FA7992000232D200134481 -:10A06000BB60BB881A463968B868FFF7D3FEFA8927 -:10A07000BB881344FB81FB799B000133DB0003F5B4 -:10A0800010531A46FB891B0A9BB2DBB219461046D5 -:10A09000FFF712FEFB799B000133DB0003F514533D -:10A0A0001A46FB89DBB219461046FFF705FE00E0B1 -:10A0B00000BF1437BD4690BD90B585B000AF0346D4 -:10A0C0003960FB711346BB800023FB810023BB601A -:10A0D000BB88002B48D0FB799B000133DB0003F5E4 -:10A0E00020531846FFF79CFD03469BB21B029CB20F -:10A0F000FB799B000133DB0003F524531846FFF77F -:10A100008FFD03469BB22344FB81FB891B02FA7936 -:10A1100092000332D2001344BB60BB881A463968F0 -:10A12000B868FFF717FEFA89BB881344FB81FB79F7 -:10A130009B000133DB0003F520531A46FB891B0A01 -:10A140009BB2DBB219461046FFF7B6FDFB799B00C8 -:10A150000133DB0003F524531A46FB89DBB21946B1 -:10A160001046FFF7A9FD00E000BF1437BD4690BDC3 -:10A1700090B585B000AF0446084611461A462346FE -:10A18000FB710346BB710B46BB801346FB70FB792A -:10A19000082B02D94FF0FF33F2E0BB79012B05D039 -:10A1A000002B11DD023B022B0ED811E007F10C034E -:10A1B000042219464FF47060FFF7CCFDFB68002BBA -:10A1C00005D16FF00203DBE06FF00403D8E000BFBD -:10A1D000FB7803F00403002B02D06FF00503CFE0FF -:10A1E000FB78002B25D0BB79012B02D0022B08D0A5 -:10A1F00024E0FB7803F02103002B1CD16FF0050352 -:10A20000BEE0FB7803F02003002B06D097F9033063 -:10A21000002B02DB6FF00503B2E0FB7803F01003C4 -:10A22000002B0AD097F90330002B06DB6FF00503F3 -:10A23000A6E000BF02E000BF00E000BFFB791846C7 -:10A2400000F0ACF8FB799B000133DB00184697F96E -:10A25000033023F00F035AB297F9063013435BB271 -:10A26000DBB21946FFF728FDBB88002B10D1464B07 -:10A270001B885A1C91B2444A1180BB80424B1B88F8 -:10A280004FF6F072934203D13F4B4FF440421A8095 -:10A29000FB799B000133DB0003F580631A46BB8822 -:10A2A0001B0A9BB2DBB219461046FFF705FDFB798E -:10A2B0009B000133DB0003F5A0631A46BB88DBB2C9 -:10A2C00019461046FFF7F8FCFB799B000133DB00D1 -:10A2D00003F5807301211846FFF7EEFC00BFFB7900 -:10A2E0009B000133DB0003F580731846FFF798FCF1 -:10A2F0000346002BF3D1FB79012202FA03F31BB2D0 -:10A30000DB431AB2214B1B881BB213401BB29AB21B -:10A310001E4B1A80FB7803F00102FB7902FA03F36B -:10A320001AB21A4B1B881BB213431BB29AB2174BBB -:10A330001A80FB79012202FA03F31BB2DB431AB243 -:10A34000134B1B881BB213401BB29AB2104B1A80DE -:10A35000FB79104A002122F81310FB790E4A0021E4 -:10A36000D15400BFFB799B000133DB0003F5407340 -:10A370001846FFF755FC0346002BF3D097F907303A -:10A3800018461437BD4690BD3C000020402A0020EE -:10A39000422A0020442A0020542A002080B582B09E -:10A3A00000AF0346FB71FB79082B02D94FF0FF3356 -:10A3B00055E0FB799B000133DB0003F5807310212E -:10A3C0001846FFF779FC00BFFB799B000133DB00E7 -:10A3D00003F580731846FFF723FC0346002BF3D1E7 -:10A3E000FB799B000133DB0003F500731F21184646 -:10A3F000FFF762FCFB79012202FA03F31BB2DB4395 -:10A400001AB2194B1B881BB213401BB29AB2164BDF -:10A410001A80FB79012202FA03F31BB2DB431AB262 -:10A42000124B1B881BB213401BB29AB20F4B1A80FF -:10A43000FB790F4A002122F81310FB790D4A002105 -:10A44000D15400BFFB799B000133DB0003F540735F -:10A450001846FFF7E5FB0346002BF3D1012318460E -:10A460000837BD4680BD00BF402A0020422A002098 -:10A47000442A0020542A002080B582B000AF034651 -:10A48000FB71FB79082B02D94FF0FF3349E0FB79D0 -:10A490009B000133DB001846FFF7C2FB034603F0C5 -:10A4A0000F03012B02D06FF004033AE0FB799B000D -:10A4B0000133DB0003F540731846FFF7B1FB034699 -:10A4C000132B02D06FF002032BE0FB799B000133CA -:10A4D000DB0003F5807302211846FFF7EDFB00BF98 -:10A4E000FB799B000133DB0003F580731846FFF70F -:10A4F00097FB0346002BF3D106E0FB791846FFF7E4 -:10A500004DFF6FF003030CE0FB799B000133DB0090 -:10A5100003F540731846FFF783FB0346142BECD179 -:10A52000012318460837BD4680BD000080B582B0C3 -:10A5300000AF0346FB71FB79082B02D94FF0FF33C4 -:10A5400062E0FB799B000133DB001846FFF768FBF4 -:10A55000034603F00F03012B02D06FF0040353E016 -:10A56000FB799B000133DB0003F58073082118465B -:10A57000FFF7A2FB00BFFB799B000133DB0003F573 -:10A5800080731846FFF74CFB0346002BF3D1FB7991 -:10A59000012202FA03F31BB2DB431AB21C4B1B88E5 -:10A5A0001BB213401BB29AB2194B1A80194B1B886D -:10A5B0001A46FB7942FA03F303F00103002B16D08D -:10A5C000002321E0FB799B000133DB0003F50073DE -:10A5D0001846FFF725FB034603F00803002B06D0BF -:10A5E000FB791846FFF7DAFE6FF00C030CE0FB79FD -:10A5F0009B000133DB0003F540731846FFF710FBA7 -:10A600000346002BDED1012318460837BD4680BD26 -:10A61000422A0020402A002080B584B000AF0346C3 -:10A620003960FB711346BB800023FB730023BB81A1 -:10A63000FB79082B02D94FF0FF33DEE0FB799B005A -:10A640000133DB001846FFF7EBFA034603F00F0374 -:10A65000012B02D06FF00403CFE0BB88002B02D1A6 -:10A660006FF00D03C9E0FB799B000133DB0003F5BC -:10A6700040731846FFF7D4FA0346FB73FB7B172B96 -:10A6800005D0FB7B1C2B02D06FF00603B5E05D4BC1 -:10A690001B881A46FB7942FA03F303F00103002BEF -:10A6A00039D0FB799B000133DB0003F500731846BA -:10A6B000FFF7B6FA034603F01F03FB73FB7B03F0BF -:10A6C0001003002B19D0FB799B000133DB0003F54D -:10A6D000007310211846FFF7EFFAFB79012202FA06 -:10A6E00003F31BB2DB431AB2464B1B881BB2134069 -:10A6F0001BB29AB2434B1A800DE0FB7B03F00803B8 -:10A70000002B06D0FB791846FFF748FE6FF00C03CC -:10A7100073E0002371E0FB799B000133DB0003F55C -:10A72000F8531846FFF77CFA03469BB29B02BB81A5 -:10A73000BA88BB899A4201D9BB89BB80FB7918468C -:10A74000FFF7C8FB0346BB81FB799B000133DB00AD -:10A7500003F540731846FFF763FA0346FB73FB7B70 -:10A76000172B09D0FB7B1C2B06D0FB791846FFF773 -:10A7700015FE6FF0060340E0234B1B881A46FB7959 -:10A7800042FA03F303F00103002B05D0BA88BB891A -:10A790009A4201D9002330E0BA88BB899A4200D995 -:10A7A000CCE700BFBA88FB7939681846FFF728FC68 -:10A7B000FB799B000133DB0003F5807320211846F1 -:10A7C000FFF77AFA00BFFB799B000133DB0003F54A -:10A7D00080731846FFF724FA0346002BF3D1FB7968 -:10A7E000012202FA03F31AB2064B1B881BB2134371 -:10A7F0001BB29AB2034B1A80BB8818461037BD466D -:10A8000080BD00BF422A0020402A002090B585B0BC -:10A8100000AF03463960FB711346BB800023FB7316 -:10A820000023BB81FB79082B02D94FF0FF339CE05A -:10A83000FB799B000133DB001846FFF7F1F9034673 -:10A8400003F00F03012B02D06FF004038DE0BB88EF -:10A85000002B02D16FF00D0387E0FB799B000133E1 -:10A86000DB0003F5F0531846FFF7DAF903469BB215 -:10A870009B02BB81BA89BB889A4201D2BB89BB804B -:10A88000FB791846FFF771FB0346BB81FB799B0000 -:10A890000133DB0003F540731846FFF7C1F90346A7 -:10A8A000FB73FB7B172B26D0FB7B1C2B1CD1BB899E -:10A8B000002B33D1FB791846FFF70CFB03461C46EF -:10A8C000FB799B000133DB0003F5F8531846FFF7D3 -:10A8D000A7F903469B029C420DD1FB791846FFF76E -:10A8E0005DFD6FF0060340E0FB791846FFF756FD6B -:10A8F0006FF0060339E01F4B1B881A46FB7942FABA -:10A9000003F303F00103002B04D0BB89002B01D11A -:10A9100000232AE0BB89002B02D1B1E700BF00E091 -:10A9200000BFBA89BB889A4201D2BB89BB80BA8872 -:10A93000FB7939681846FFF7BFFBFB799B000133B1 -:10A94000DB0003F5807340211846FFF7B5F900BF1F -:10A95000FB799B000133DB0003F580731846FFF79A -:10A960005FF90346002BF3D1BB8818461437BD4668 -:10A9700090BD00BF402A002080B582B000AF0346E2 -:10A980003A60FB710B46BB71FB79082B02D94FF083 -:10A99000FF33EDE0BB79013B062B00F2E58001A21D -:10A9A00052F823F0C1A90108DDA90108F9A901089D -:10A9B00037AA01084FAA01088DAA01082FAB010888 -:10A9C000FB799B000133DB0003F5B0531A463B686B -:10A9D0001B7819461046FFF76FF9C8E0FB799B001A -:10A9E0000133DB0003F5A8531A463B681B78194670 -:10A9F0001046FFF761F9BAE0FB799B000133DB00F9 -:10AA000003F590531A463B681B881B0A9BB2DBB2C6 -:10AA100019461046FFF750F9FB799B000133DB0024 -:10AA200003F598531A463B681B88DBB2194610465B -:10AA3000FFF742F99BE0FB799B000133DB0003F554 -:10AA40004063042239681846FFF7E4F98FE0FB7988 -:10AA50009B000133DB0003F580531A463B681B88DB -:10AA60001B0A9BB2DBB219461046FFF725F9FB79AA -:10AA70009B000133DB0003F588531A463B681B88B3 -:10AA8000DBB219461046FFF717F970E0FB799B001F -:10AA90000133DB001846FFF7C3F8034603F00F034A -:10AAA000012B02D06FF0040362E0FB799B000133BD -:10AAB000DB0003F53C531846FFF7B2F80346002BC2 -:10AAC00002D06FF0010353E0FB799B000133DB0000 -:10AAD00003F5807322211846FFF7EEF81AE0FB79A0 -:10AAE0009B000133DB0003F500731846FFF798F86D -:10AAF000034603F00803002B0CD0FB799B000133C5 -:10AB0000DB0003F5007308211846FFF7D5F86FF056 -:10AB10000C032DE0FB799B000133DB0003F5807310 -:10AB20001846FFF77DF80346002BD8D11FE0FB79CC -:10AB30009B000133DB001846FFF772F8034603F071 -:10AB40000F03012B02D06FF0040311E0FB799B008F -:10AB50000133DB0003F53C531A463B681B7819466A -:10AB60001046FFF7A9F802E06FF0090300E00123A7 -:10AB700018460837BD4680BD90B583B000AF034688 -:10AB80003A60FB710B46BB71FB79082B02D94FF081 -:10AB9000FF3301E1BB790C2B00F2FA8001A252F8DD -:10ABA00023F000BFD9AB0108F5AB010811AC0108D7 -:10ABB0002DAC010867AC01087FAC010891AD01081C -:10ABC000B9AC0108F3AC010805AD010817AD0108E7 -:10ABD00033AD01086BAD0108FB799B000133DB004D -:10ABE0001846FFF71DF8034623F00F03DAB23B685F -:10ABF0001A70D0E0FB799B000133DB0003F5B05302 -:10AC00001846FFF70DF803461A463B681A70C2E073 -:10AC1000FB799B000133DB0003F5A8531846FEF7D0 -:10AC2000FFFF03461A463B681A70B4E0FB799B00AD -:10AC30000133DB0003F590531846FEF7F1FF03469E -:10AC40009BB21B029CB2FB799B000133DB0003F536 -:10AC500098531846FEF7E4FF03469BB223449AB28A -:10AC60003B681A8097E0FB799B000133DB0003F51A -:10AC70004063042239681846FFF76CF88BE0FB79D3 -:10AC80009B000133DB0003F580531846FEF7C8FF35 -:10AC900003469BB21B029CB2FB799B000133DB0095 -:10ACA00003F588531846FEF7BBFF03469BB22344C7 -:10ACB0009AB23B681A806EE0FB799B000133DB009F -:10ACC0001846FEF7ADFF034603F00F03012B02D039 -:10ACD0006FF0040360E0FB799B000133DB0003F5B8 -:10ACE0003C531846FEF79CFF03469AB23B681A8015 -:10ACF00051E0FB791846FFF7EDF803461A463B682A -:10AD00001A8048E0FB791846FFF72FF903461A46E8 -:10AD10003B681A803FE0FB799B000133DB0003F5C1 -:10AD200040731846FEF77CFF03461A463B681A70CC -:10AD300031E0FB799B000133DB001846FEF770FF22 -:10AD4000034603F00103002B08D0FB791846FFF7F8 -:10AD50000CF903461A463B681A801CE0FB79104A3E -:10AD600032F813203B681A8015E0FB799B00013311 -:10AD7000DB001846FEF754FF0346012B02D16FF0AB -:10AD8000040309E0FB79074AD25C3B681A7002E0D1 -:10AD90006FF0010300E0012318460C37BD4690BD5B -:10ADA000442A0020542A002080B400AF00BFBD46D2 -:10ADB0005DF8047B704780B400AF00BFBD465DF80E -:10ADC000047B704780B400AF00BFBD465DF8047BD4 -:10ADD000704780B400AF00BFBD465DF8047B70478C -:10ADE00080B483B000AF78607B681B78DBB2184614 -:10ADF0000C37BD465DF8047B704780B483B000AF6C -:10AE000078600B46FB707B68FA781A7000BF0C37CD -:10AE1000BD465DF8047B704780B400AF0023184640 -:10AE2000BD465DF8047B704780B483B000AF034635 -:10AE3000FB7100BF0C37BD465DF8047B7047000016 -:10AE400080B483B000AF786039607B68002B02D09B -:10AE50003B68002B06D10A4B0A4A5A61084B0A4A42 -:10AE60009A6106E0064A7B685361054A3B68936134 -:10AE700000BF00BF0C37BD465DF8047B704700BFC4 -:10AE800040000020C5AD0108D3AD010880B483B0F7 -:10AE900000AF7860396000BF0F4B1B8803F400736C -:10AEA000002BF9D07B68002B02D03B68002B06D129 -:10AEB000094B0A4ADA61084B094A1A6206E0064A57 -:10AEC0007B68D361044A3B68136200BF00BF0C3744 -:10AED000BD465DF8047B70474000002019AE0108B4 -:10AEE00029AE010890B587B000AF03463960FB7109 -:10AEF0000023FB750023FB6000233B61FB790F2BD4 -:10AF000000F2C78001A252F823F000BF4DAF010844 -:10AF100053AF01087FAF010873AF01088DAF01087F -:10AF200099AF0108A7AF0108CDAF0108F3AF010841 -:10AF300037B001083DB0010845B0010899B00108DB -:10AF40004DB001085BB0010877B0010800F0EAF8E5 -:10AF5000A3E03B68002B04D03B68FB60FB68083330 -:10AF60003B61FB683A691146184600F027F9034631 -:10AF700094E03B681B88184600F0ACF98DE000F0C7 -:10AF8000DDF903461A463B681A8086E03B681B8859 -:10AF9000184600F0F8F980E000F010FA03461A466F -:10AFA0003B681A8079E03B681B881B0A9BB2DBB2C6 -:10AFB00019464FF49850FEF77FFE3B681B88DBB2C2 -:10AFC00019464FF4A050FEF777FE66E04FF4985014 -:10AFD000FEF726FE03469BB21B029CB24FF4A05024 -:10AFE000FEF71EFE03469BB223449AB23B681A80CA -:10AFF00053E02C4B9A783B681A703B680133294A1E -:10B00000D2781A703B680233264A12791A703B686C -:10B010000333244A52791A703B680433214A9279E7 -:10B020001A703B6805331F4AD2791A703B680633A1 -:10B0300000221A7031E000F013FA2EE0386800F0B8 -:10B0400036FA2AE0386800F074FA26E03B681B788C -:10B05000184600F0D7FA034620E000F0E8F903466E -:10B06000FB75FB7DFF2B02D14FF0FF3316E03B68F1 -:10B07000FA7D1A7011E000F0C4F90346FB75FB7D00 -:10B08000FF2B02D14FF0FF3308E03B68FA7D1A70C6 -:10B0900003E04FF0FF3301E000BF002318461C37E8 -:10B0A000BD4690BD4000002080B582B000AF034691 -:10B0B0003960FB71FB79052B2CD801A252F823F0E3 -:10B0C000D9B00108E1B00108E9B00108F7B0010802 -:10B0D00005B101080DB10108386800F0DDFA1CE087 -:10B0E000386800F019FB18E03B681B78184600F040 -:10B0F00053FB034612E000F071FB03461A463B681F -:10B100001A700AE0386800F071FB06E0386800F059 -:10B110008EFB02E04FF0FF3300E0002318460837B3 -:10B12000BD4680BD80B586B000AF3B1D06221946E6 -:10B130004FF41060FEF70EFE07F1140304221946C7 -:10B140004FF48070FEF706FE07F110030422194643 -:10B150004FF4A060FEF7FEFD07F10C030422194630 -:10B160004FF47060FEF7F6FD80210020FEF7A4FD8D -:10B170000020FEF755FD3B1D062219464FF41060D6 -:10B18000FEF748FE07F11403042219464FF48070BD -:10B19000FEF740FE07F11003042219464FF4A060A9 -:10B1A000FEF738FE07F10C03042219464FF47060D5 -:10B1B000FEF730FE00BF1837BD4680BD80B584B0B5 -:10B1C00000AF786039600023BB73FFF7ABFF7B688B -:10B1D000002B3BD00023BB730023FB7315E097F9D2 -:10B1E0000F307A6813441A78BB7B1344DBB2BB730D -:10B1F00097F90E30102B02DD4FF0FF3366E097F920 -:10B200000F30DBB20133DBB2FB7397F90F30072B42 -:10B21000E5DD0023FB7315E097F90F309B00013348 -:10B22000DB0003F5F853184697F90F307A6813449A -:10B230001B781946FEF740FD97F90F30DBB201335A -:10B24000DBB2FB7397F90F30072BE5DD3B68002B72 -:10B250003BD00023BB730023FB7315E097F90F303D -:10B260003A6813441A78BB7B1344DBB2BB7397F97B -:10B270000E30102B02DD4FF0FF3327E097F90F302F -:10B28000DBB20133DBB2FB7397F90F30072BE5DD3F -:10B290000023FB7315E097F90F309B000133DB00AF -:10B2A00003F5F053184697F90F303A6813441B78AA -:10B2B0001946FEF701FD97F90F30DBB20133DBB21F -:10B2C000FB7397F90F30072BE5DD00231846103785 -:10B2D000BD4680BD80B584B000AF0346FB80FB88CF -:10B2E000FB73FB881B0A9BB2BB73FB7B23F00F0332 -:10B2F000DBB219464FF4A850FEF7DEFC0023FB73C7 -:10B3000014E0BA7BFB7B42FA03F303F00103002B4A -:10B3100009D0FB7B9B000133DB0003F500731F2189 -:10B320001846FEF7C9FCFB7B0133FB73FB7B072B45 -:10B33000E7D900BF00BF1037BD4680BD80B582B0E1 -:10B3400000AF0023FB710023BB710023BB804FF4CF -:10B35000A850FEF765FC034623F00F03FB714FF482 -:10B36000B850FEF75DFC0346BB71BB79BB80BB8860 -:10B370001B029AB2FB799BB21344BB80BB88184670 -:10B380000837BD4680BD80B584B000AF0346FB8062 -:10B39000FB88FB73FB881B0A9BB2BB73FB7B1946C4 -:10B3A0004FF4B050FEF788FCBB7B19464FF4C050F9 -:10B3B000FEF782FC00BF1037BD4680BD80B582B06D -:10B3C00000AF0023FB710023BB710023BB804FF44F -:10B3D000B050FEF725FC0346FB714FF4C050FEF75A -:10B3E0001FFC0346BB71BB79BB80BB881B029AB2B2 -:10B3F000FB799BB21344BB80BB8818460837BD4617 -:10B4000080BD80B582B000AF0023FB714FF438508F -:10B41000FEF706FC034603F00103002B01D00123D5 -:10B42000FB7197F9073018460837BD4680BD80B5D7 -:10B4300082B000AF0023FB714FF43850FEF7F0FBF1 -:10B44000034603F03803302B02D10123FB7101E0E6 -:10B450000023FB7197F9073018460837BD4680BDB9 -:10B4600080B582B000AF4FF43850FEF7D9FB0346E9 -:10B47000FB71FB7903F07F03FB71FB7919464FF4F5 -:10B480003850FEF719FC4FF43850FEF7C9FB03465D -:10B49000FB71FB7963F07F03FB71FB7919464FF475 -:10B4A0003850FEF709FC00BF0837BD4680BD80B5A7 -:10B4B00084B000AF78600023FB737B681B78012B9E -:10B4C00004D1FB7B43F04003FB7303E0FB7B23F0E1 -:10B4D0004003FB737B685B78012B04D1FB7B43F05B -:10B4E0003803FB7319E07B68DB78012B0DD17B6897 -:10B4F0009B78012B04D1FB7B43F01803FB730CE01A -:10B50000FB7B43F00803FB7307E07B689B78012B10 -:10B5100003D1FB7B43F01003FB73FB7B19464FF415 -:10B520003850FEF7C9FBFFF79BFF00BF1037BD4641 -:10B5300080BD80B584B000AF78600023FB734FF40A -:10B540003850FEF76DFB0346FB73FB7B9B11DBB2B0 -:10B5500003F00103DAB27B681A70FB7B03F0380357 -:10B56000202B01D0382B03D17B6801225A7003E0D5 -:10B570007B6800225A7000BFFB7B03F03803103B4E -:10B58000102B8CBF01220022D2B2002A11D101223D -:10B5900002FA03F303F0013323F08073002B14BF8E -:10B5A00001230023DBB2002B03D07B6801229A70B9 -:10B5B00003E07B6800229A7000BFFB7B03F0380336 -:10B5C000083B182B8CBF01220022D2B2002A11D1D5 -:10B5D000012202FA03F303F0013323F48073002BFA -:10B5E00014BF01230023DBB2002B03D07B680122B0 -:10B5F000DA7003E07B680022DA7000BF00BF10370A -:10B60000BD4680BD80B584B000AF0346FB7100230A -:10B61000FB734FF43850FEF703FB0346FB73FB7BD1 -:10B6200003F04003002B02D14FF0FF3330E0FB7BEF -:10B6300023F03803FB73FB79012B04D1FB7B43F030 -:10B640003003FB7303E0FB7B43F03803FB73FB7BAE -:10B6500019464FF43850FEF72FFBFFF701FF4FF468 -:10B660003850FEF7DDFA0346FB73FB79012B06D158 -:10B67000FB7B03F03003002B08D0002308E0FB7BAA -:10B6800003F03803002B01D0002301E04FF0FF331B -:10B6900018461037BD4680BD80B582B000AF7860D7 -:10B6A0007B68062219464FF41060FEF7B3FB7B68F7 -:10B6B0000E33042219464FF48070FEF7ABFB7B6813 -:10B6C0000A33042219464FF4A060FEF7A3FB7B68FF -:10B6D0000633042219464FF47060FEF79BFB7B682B -:10B6E0009A7C0B4B1A707B68DA7C094B5A707B682A -:10B6F0001A7D074B9A707B685A7D054BDA707B6820 -:10B700009A7D044B1A7000BF0837BD4680BD00BF4C -:10B710005C2A0020602A002080B582B000AF7860EB -:10B720007B68062219464FF41060FEF713FB7B6816 -:10B730000E33042219464FF48070FEF70BFB7B6832 -:10B740000A33042219464FF4A060FEF703FB7B681E -:10B750000633042219464FF47060FEF7FBFA0C4BD7 -:10B760001A787B689A740A4B5A787B68DA74084BAB -:10B770009A787B681A75064BDA787B685A75054BA0 -:10B780001A787B689A7500BF0837BD4680BD00BF38 -:10B790005C2A0020602A002080B584B000AF0346F8 -:10B7A000FB710023FB73FB7923F03A03002B02D0DB -:10B7B0004FF0FF330EE00020FEF732FA0346FB7332 -:10B7C000FA7BFB791343FB73FB7B19460020FEF7E2 -:10B7D00073FA002318461037BD4680BD80B500AF10 -:10B7E0000020FEF71DFA0346184680BD80B582B0E2 -:10B7F00000AF78607B681B7819464FF4D850FEF78D -:10B800005BFA7B685B881B0A9BB2DBB219464FF47C -:10B81000C850FEF751FA7B685B88DBB219464FF4DB -:10B82000D050FEF749FA00BF0837BD4680BD90B53D -:10B8300083B000AF78604FF4D850FEF7F1F90346BB -:10B840001A467B681A704FF4C850FEF7E9F90346B0 -:10B850009BB21B029CB24FF4D050FEF7E1F90346B5 -:10B860009BB223449AB27B685A8000BF0C37BD4616 -:10B8700090BD000080B584B000AFF860B9607A6018 -:10B880003B60142200211C4818F0D4FF1A4AFB68C0 -:10B890005360194ABB689360174A7B68D360164AA5 -:10B8A0003B681361144B5B68002B0BD0124B9B68F9 -:10B8B000002B07D0104BDB68002B03D00E4B1B690D -:10B8C000002B05D10D4819F0C3FC4FF0FF330EE0FB -:10B8D000094B01221A6000F013F80021002000F04B -:10B8E0005BF8642000F088FB00F020F80023184685 -:10B8F0001037BD4680BD00BF642A002018880308A9 -:10B9000080B500AF084B1B68002B0AD0064B5B6864 -:10B910009847054B1B6906209847034B9B6898473F -:10B9200000E000BF80BD00BF642A002080B500AFEA -:10B93000084B1B68002B0AD0064B5B689847054BE9 -:10B940001B6904209847034B9B68984700E000BFA1 -:10B9500080BD00BF642A002080B582B000AF0D4BCF -:10B960001B68002B01D100230FE00A4B5B6898474E -:10B97000084B1B6905209847064BDB689847034630 -:10B98000FB71044B9B689847FB7918460837BD4606 -:10B9900080BD00BF642A002080B582B000AF03469E -:10B9A0000A46FB711346BB710E4B1B68002B14D06B -:10B9B0000C4B5B6898470B4B1B6901209847094B60 -:10B9C0001B69FA7910469847064B1B69BA791046ED -:10B9D0009847044B9B68984700E000BF0837BD4676 -:10B9E00080BD00BF642A002080B582B000AFFFF7A1 -:10B9F000B3FF0346FB71FB7903F00103FB71FB7995 -:10BA000018460837BD4680BD90B587B000AFF860D6 -:10BA1000B9607A60BB68002B06D07B68002B03DD21 -:10BA20001E4B1B68002B02D14FF0FF3332E01B4B43 -:10BA30005B689847194B1B6903209847174B1B6994 -:10BA4000FA68120CD2B210469847144B1B69FA6878 -:10BA500092B2120A92B2D2B2104698470F4B1B69AB -:10BA6000FA68D2B21046984700237B610AE00B4B7C -:10BA7000DB68BC68621CBA609847034623707B6928 -:10BA800001337B617A697B689A42F0DB034B9B68E8 -:10BA90009847002318461C37BD4690BD642A0020F5 -:10BAA00080B584B000AF786039600023BB601F4B65 -:10BAB0001B68002B01D1002333E01C4B5B689847C7 -:10BAC0001A4B1B6903209847184B1B697A68120CA4 -:10BAD000D2B210469847154B1B697A6892B2120A87 -:10BAE00092B2D2B210469847104B1B697A68D2B214 -:10BAF000104698470023FB600BE00C4BDB6898472F -:10BB00000346FF2B02D00123BB6006E0FB68013334 -:10BB1000FB603B68FA689A42EFD3044B9B689847F6 -:10BB2000BB6818461037BD4680BD00BF642A0020A0 -:10BB300080B586B000AFF860B9607A60BB68002B52 -:10BB400006D07B68002B03DD234B1B68002B02D142 -:10BB50004FF0FF333BE0FFF7D3FE642000F06DFAB7 -:10BB60001D4B5B6898471C4B1B69022098471A4B7A -:10BB70001B69FA68120CD2B210469847164B1B6923 -:10BB8000FA6892B2120A92B2D2B210469847124B99 -:10BB90001B69FA68D2B21046984700237B610AE01D -:10BBA0000D4B1A69BB68591CB9601B781846904741 -:10BBB0007B6901337B617A697B689A42F0DB064BD3 -:10BBC0009B6898474FF4967000F037FA0346184682 -:10BBD0001837BD4680BD00BF642A002080B584B000 -:10BBE00000AF786039600123FB601C4B1B68002BA1 -:10BBF00001D1FB682DE0FFF783FE642000F01DFA01 -:10BC0000164B5B689847154B1B6920209847134BD0 -:10BC10001B697A68120CD2B2104698470F4B1B6909 -:10BC20007A6892B2120A92B2D2B2104698470B4B7F -:10BC30001B697A68D2B210469847084B9B689847B0 -:10BC40003B68002B04D04FF4967000F0D5F9F860F3 -:10BC5000FB6818461037BD4680BD00BF642A00202F -:10BC600080B586B000AFF860B9607A60FB68DBB27F -:10BC70007B617B69002B02D14FF480737B617B6910 -:10BC80001A46B968F868FFF753FF38613B69002B23 -:10BC900018D1FA687B691344FB60BA687B69134466 -:10BCA000BB607A687B69D31A7B607B68FF2B03DDFE -:10BCB0004FF480737B61E2E77B68002B04DD7B68D7 -:10BCC0007B61DCE700BF00E000BF3B691846183726 -:10BCD000BD4680BD80B5ADF5815D82B000AF07F196 -:10BCE000280343F81C0C07F1280343F8201C07F134 -:10BCF000280343F8242C07F1280353F81C3C23F4B1 -:10BD00007F6323F00F0307F5805202F118021360DE -:10BD1000002307F5805202F11C02136007F128038B -:10BD200007F12802114653F8243C07F5805202F12E -:10BD30001802126851F81C1CAD4819F0EDF93BE1EE -:10BD4000002307F58152136007F12803183B4FF4D5 -:10BD50008052194607F5805303F118031868FFF75E -:10BD600053FE4FF4805307F5805202F11402136022 -:10BD700007F1280353F81C2C07F5805303F118032F -:10BD80001B68D21A07F1280353F8243C134407F523 -:10BD9000805202F1140212689A4213D907F1280363 -:10BDA00053F81C2C07F5805303F118031B68D21AB3 -:10BDB00007F1280353F8243C134407F5805202F19D -:10BDC0001402136007F1280307F5805202F11802EC -:10BDD000126853F81C3CD31A07F5805202F1140282 -:10BDE0001268134407F5805202F11002136007F144 -:10BDF000280353F81C2C07F5805303F118031B6824 -:10BE0000D31A07F5815202F10402136034E007F1FE -:10BE100028031A4607F5815303F104031B681344F2 -:10BE2000183B1A7807F5815303F104031B6807F1E7 -:10BE3000280151F8201C0B441B781340DAB207F597 -:10BE4000815303F104031B6807F1280151F8201CFA -:10BE50000B441B789A4204D0012307F581521360EA -:10BE600016E007F5815303F104031B68013307F55E -:10BE7000815202F10402136007F5815303F10403B8 -:10BE80001B6807F5805202F1140212689A42BED86C -:10BE900007F581531B68002B38D0012107F580532B -:10BEA00003F118031868FFF799FE07F1280353F808 -:10BEB0001C2C07F5805303F118031B68D21A07F1F5 -:10BEC0002803183B134407F12802114607F5805256 -:10BED00002F11002126851F8201C184618F09CFC60 -:10BEE00007F12803183B4FF48052194607F5805399 -:10BEF00003F118031868FFF7B3FE07F5805303F149 -:10BF00001C0318603B4819F0A3F916E007F58053AD -:10BF100003F110031B6807F12802114607F12802FC -:10BF200010461A4651F8201C50F81C0CFFF798FEDA -:10BF300007F5805303F11C03186007F5805303F1E4 -:10BF40001C031B68002B46D107F1280353F8242C4F -:10BF500007F5805303F110031B68D31A07F1280279 -:10BF600042F8243C07F12803194607F1280353F847 -:10BF7000202C07F5805303F110031B68134441F88C -:10BF8000203C07F12803194607F1280353F81C2C1D -:10BF900007F5805303F110031B68134441F81C3C60 -:10BFA00007F5805303F118031B6803F5805307F569 -:10BFB000805202F11802136007F1280353F81C3C69 -:10BFC000B3F1007F08D207F1280353F8243C002B7B -:10BFD0003FF7B6AE00E000BF07F5805303F11C0346 -:10BFE0001B68184607F581570837BD4680BD00BF5E -:10BFF000548803087888030880B584B000AF78605F -:10C000004FF0FF33BB600023FB600DE0FFF7ECFC5B -:10C010000346002B02D10023BB6009E00120FBF79F -:10C0200009F8FB680133FB60FA687B689A42EDD33C -:10C03000BB6818461037BD4680BD80B584B000AFE0 -:10C0400078604FF0FF33BB600023FB600DE0FFF72B -:10C05000CBFC0346002B02D10023BB6009E00A2081 -:10C06000FAF7D2FFFB680133FB60FA687B689A42FB -:10C07000EDD3BB6818461037BD4680BD80B584B08F -:10C0800000AF786039603B68BB600020FAF768F861 -:10C09000334819F0DDF87B68002B03D1314819F0E3 -:10C0A000D7F81AE07B68012B03D12F4819F0D0F89C -:10C0B00013E07B68022B03D12C4819F0C9F80CE07F -:10C0C0007B68032B03D12A4819F0C2F805E07B688E -:10C0D000042B02D1274819F0BBF8274819F0B8F80B -:10C0E000BB681B681946254819F016F8BB685B68E1 -:10C0F0001946234819F010F8BB689B681946214877 -:10C1000019F00AF8BB68DB6819461F4819F004F8F3 -:10C11000BB681B6919461D4818F0FEFFBB685B69C8 -:10C1200019461B4818F0F8FFBB689B691946194867 -:10C1300018F0F2FFBB68DB691946174818F0ECFFEE -:10C140000023FB6008E03220FAF774FF6420FAF75E -:10C1500071FFFB680133FB60FB68092BF3DD97E798 -:10C160009C890308CC890308E4890308FC89030837 -:10C17000148A03082C8A03083C8A03084C8A0308A3 -:10C180005C8A03086C8A03087C8A03088C8A03088B -:10C190009C8A0308B08A0308C48A030880B48DB05F -:10C1A00000AF786039607B68002B02D03B68002BC1 -:10C1B00002D14FF0FF3300E10023FB62F2E0FB6AA3 -:10C1C0007A681A4407F114031068516803C307F131 -:10C1D0000C0307F1140292E8030083E80300002334 -:10C1E000BB6211E0784ABB6A134408331B78013BF9 -:10C1F00007F10C01BA6A0A44127830333B4403F861 -:10C200001C2CBB6A0133BB62BB6A072BEADD00232F -:10C210003B620023BB621DE00123FB7700237B62AE -:10C2200012E007F11402BB6A13441A78FB7F134033 -:10C23000DBB2002B02D03B6A01333B62FB7F5B0029 -:10C24000FB777B6A01337B627B6A072BE9DDBB6A84 -:10C250000133BB62BB6A072BDEDD3B6A03F00103DF -:10C26000002B3DD00023BB6235E0FB7EFB77002333 -:10C270007B622AE007F114027B6A13441B78BB77C8 -:10C2800007F114027B6A13441B785B08D9B207F1EB -:10C2900014027B6A13440A461A70FB7F03F0010301 -:10C2A000002B0DD007F114027B6A13441B7863F056 -:10C2B0007F03D9B207F114027B6A13440A461A704D -:10C2C000BB7FFB777B6A01337B627B6A072BD1DD07 -:10C2D000BB6A0133BB62BA6A3B6A9A42C5DB3BE088 -:10C2E0000023BB6234E03B7DFB7707237B6229E0C0 -:10C2F00007F114027B6A13441B78BB7707F1140221 -:10C300007B6A13441B785B00D9B207F114027B6A85 -:10C3100013440A461A7097F91F30002B0DDA07F103 -:10C3200014027B6A13441B7843F00103D9B207F16E -:10C3300014027B6A13440A461A70BB7FFB777B6A40 -:10C34000013B7B627B6A002BD2DABB6A0133BB62A2 -:10C35000BA6A3B6A9A42C6DB0023BB6213E007F16C -:10C360001402BB6A13441A781749BB6A0B441B7842 -:10C370005340D9B207F11402BB6A13440A461A703B -:10C38000BB6A0133BB62BB6A072BE8DDFB6A7A68D4 -:10C3900013441A4607F1140303CB10605160FB6A83 -:10C3A0000833FB62FA6A3B689A4205DA3A68FB6A2C -:10C3B000D31A072B3FF703AF002318463437BD4687 -:10C3C0005DF8047B704700BF6C00002080B500AFB3 -:10C3D000104B00221A610F4B00225A610D4B0022B4 -:10C3E0009A610C4B0022DA610B4B00225A600A4B17 -:10C3F00000229A60084B4FF0FF32DA60064B4FF094 -:10C40000FF321A61044B00225A6100F071FA00BF3A -:10C4100080BD00BF6C0000207C2F002080B58AB05A -:10C4200000AFF860B9607A603B60FB68002B09DB05 -:10C43000BB68002B06D07B68802B09D07B68B3F5E6 -:10C44000806F05D0764818F003FF4FF0FF33E2E02D -:10C450003B68002B62D1FB68002B5FD1714B5B689E -:10C46000B3F5806F5AD23B68002B52D1FB68002B8A -:10C470004FD16D4818F0ECFE08226C49B86818F0EE -:10C48000BBF90346002B3ED1BB680833082268493C -:10C49000184618F0B1F90346002B34D1614B012244 -:10C4A0009A60604B4FF0FF32DA605E4B4FF0FF3224 -:10C4B0001A61BB681B695D4A1361BB685B695B4AB3 -:10C4C0005361BB689B69594A9361BB68DB69574AF2 -:10C4D000D3611C23FB61FB6919465448FCF79CFAA5 -:10C4E000B861524BDB69BA699A4206D14F4B1B695E -:10C4F0001A464C4B5A6100238DE04E4818F0A8FEB6 -:10C500006FF0010387E04C4818F0A2FE4FF0FF33B4 -:10C5100081E04A4818F09CFE00237CE0484B7B6198 -:10C520007A693B6813447B61FB68013B7A6802FBD4 -:10C5300003F31A467B6913447B617B683B61394B8B -:10C540005A687B681344374A5360364B9B68002B0C -:10C5500053D0344B5B697A689A4208DA7B683B6255 -:10C56000304B5A697B68D31A2E4A536105E02D4B34 -:10C570005B693B622B4B00225A6100237B620EE019 -:10C58000284B18697B6ABA6813441B781946FCF774 -:10C590002BFA0346234A13617B6A01337B627A6A72 -:10C5A0003B6A9A42ECDB396AB868FFF7F7FD002373 -:10C5B0007B620EE01B4BD8687B6ABA6813441B7819 -:10C5C0001946FCF711FA0346164AD3607B6A013319 -:10C5D0007B627A6A3B6A9A42ECDB3B6A7B6207E0E9 -:10C5E0007B6ABA681344FF221A707B6A01337B624C -:10C5F0007A6A7B689A42F3DB01E07B683B623A69C6 -:10C600007969104818F088FD3B691A46B96878695D -:10C61000FFF726FB3B6A18462837BD4680BD00BFA2 -:10C62000D48A03087C2F0020EC8A03086C000020C9 -:10C6300074000020008B0308188B0308308B03085C -:10C640000000F901448B030880B5ADF5836D00AFA0 -:10C6500007F58363A3F21443186007F58363A3F51A -:10C660008363196007F58363A3F583631B68C7F8C9 -:10C6700008344FF0FF33C7F814344CE0D7F80834CF -:10C68000B3F5806F0ADD4FF48063C7F80C34D7F838 -:10C690000834A3F58063C7F8083406E0D7F80834F7 -:10C6A000C7F80C340023C7F8083407F1080107F570 -:10C6B0008363A3F214434FF480621868FFF7A4F970 -:10C6C0000023C7F8103414E007F58363A3F58262F2 -:10C6D000D7F8103413441B78DBB21946D7F814048A -:10C6E000FCF782F9C7F81404D7F810340133C7F8FF -:10C6F0001034D7F81024D7F80C349A42E4DB07F54D -:10C700008363A3F2144307F58362A2F21442126812 -:10C7100002F580621A6007F58363A3F583631B68E3 -:10C7200003F1FC7303F5803307F58362A2F2144230 -:10C7300012689A42A2D3D7F81434184607F58367D3 -:10C74000BD4680BD80B584B000AF3A4B9B68002BDE -:10C7500004D1394818F07CFD002367E01C23BB603E -:10C76000BB6819463548FCF757F978604FF0FF333E -:10C77000FB607968324818F0CFFC304BDB69194612 -:10C78000304818F0C9FC2D4B5B6919462E4818F04B -:10C79000C3FC284BDB6819462C4818F0BDFC274B1E -:10C7A0009B6919462A4818F0B7FC224B1B691946A9 -:10C7B000284818F0B1FC214B1B691946264818F08F -:10C7C000ABFC1C4B5B691946244818F0A5FC1B4BBD -:10C7D000DB697A689A4225D1184B5A69154BDB6898 -:10C7E0009A421FD1154B9A69124B1B699A4219D173 -:10C7F000124B1B6919461A48FFF726FF78600F4B4A -:10C800005B691A467968174818F086FC0B4B5B6920 -:10C810007A689A4202D10023FB6006E0124818F0C1 -:10C8200017FD02E0114818F013FDFB681846103799 -:10C83000BD4680BD7C2F0020708B03086C0000205B -:10C84000848B0308A48B0308C48B0308E48B0308C0 -:10C85000048C0308248C0308488C0308688C0308A4 -:10C860000000F9018C8C0308B88C0308D88C0308ED -:10C8700080B58AB002AF7860FFF764FF0346002BF3 -:10C8800029D14FF48033FB614FF48033BB61154BEA -:10C890001B697B61134B1B6903F2FF73DB0A3B616E -:10C8A0003B69DB023B610F4B5B69FB60FB680193FB -:10C8B0003B6900937B69BA69F9690B4818F02CFC55 -:10C8C000FB6800933B697A69B969F86900F044F83C -:10C8D000FAF78EFB02E0054818F0BAFC00BF2037DB -:10C8E000BD4680BD6C000020F08C0308448D030819 -:10C8F00080B584B000AF0023BB60154818F0A8FCD9 -:10C900004FF0FC73FB6016E04FF48051F868FFF7BE -:10C91000C7F878607B68002B09D00121F868FFF721 -:10C920005DF92E20F9F7ACFCBB680133BB60FB68F6 -:10C9300003F58053FB60FB68B3F1007FE4D3B96873 -:10C94000044818F0E9FB00BF1037BD4680BD00BFAA -:10C95000708F0308948F030890B5ADF21C4D00AFA3 -:10C9600007F58364A4F20C44206007F58360A0F50A -:10C970008260016007F58361A1F214410A6007F546 -:10C980008362A2F58362136007F114034FF480629F -:10C99000FF21184617F04EFF07F11403354A1C46D5 -:10C9A00013460FCB07C4238002341B0C237007F5FA -:10C9B0008363A3F2044307F58362A2F20C42126878 -:10C9C000C3F8802007F58363A3F2044307F583626D -:10C9D000A2F582621268C3F8842007F58363A3F28C -:10C9E000044307F58362A2F214421268C3F8882058 -:10C9F00007F58363A3F2044307F58362A2F583621C -:10CA00001268C3F88C2007F58363A3F20443D7F8B8 -:10CA10002824C3F8902007F114034FF47F711846BF -:10CA2000FBF7FAFF024607F58363A3F20443C3F85A -:10CA3000FC23114818F00CFC01214FF0FC70FFF7AB -:10CA4000CDF807F11403C7F81434D7F814344FF4B1 -:10CA5000806219464FF0FC70FFF702F9074818F0A2 -:10CA6000F7FB6420FAF7E6FA00BF07F21C47BD4661 -:10CA700090BD00BF108E0308BC8F0308D08F030841 -:10CA800080B483B000AF78607B681B6843F001021C -:10CA90007B681A6000BF0C37BD465DF8047B7047A9 -:10CAA00080B483B000AF78607B681B6823F001021C -:10CAB0007B681A6000BF0C37BD465DF8047B704789 -:10CAC00080B483B000AF786039607B683A68DA621E -:10CAD00000BF0C37BD465DF8047B704780B483B05F -:10CAE00000AF78607B686FF001021A6100BF0C37FD -:10CAF000BD465DF8047B704780B483B000AF7860BA -:10CB00007B681B6903F00103012B01D1012300E0C5 -:10CB1000002318460C37BD465DF8047B704780B48F -:10CB200083B000AF78607B68DB6843F001027B680C -:10CB3000DA6000BF0C37BD465DF8047B704780B4F7 -:10CB400083B000AF78607B68DB6823F001027B680C -:10CB5000DA6000BF0C37BD465DF8047B704700000B -:10CB600080B582B000AF786039607B68012B03D05C -:10CB70003B681B68012B02D11E4B1B6898477B68E2 -:10CB8000022B04D03B6804331B68012B02D11A4BE3 -:10CB90001B6898477B68032B04D03B6808331B68ED -:10CBA000012B02D1154B1B6898477B68042B04D0DE -:10CBB0003B680C331B68012B02D1114B1B68984753 -:10CBC0007B68052B04D03B6810331B68012B02D116 -:10CBD0000C4B1B6898477B68062B04D03B681433CA -:10CBE0001B68012B02D1084B1B68984700BF083710 -:10CBF000BD4680BD6C0400207C0400208C04002015 -:10CC00009C040020AC040020BC04002080B582B04D -:10CC100000AF786039607B68012B03D03B681B68EC -:10CC2000012B02D11E4B1B6898477B68022B04D056 -:10CC30003B6804331B68012B02D11A4B1B689847D1 -:10CC40007B68032B04D03B6808331B68012B02D19F -:10CC5000154B1B6898477B68042B04D03B680C334A -:10CC60001B68012B02D1114B1B6898477B68052B71 -:10CC700004D03B6810331B68012B02D10C4B1B689E -:10CC800098477B68062B04D03B6814331B68012B44 -:10CC900002D1084B1B68984700BF0837BD4680BDCE -:10CCA000700400208004002090040020A0040020D4 -:10CCB000B0040020C004002080B582B000AF7860CE -:10CCC00039607B68012B03D03B681B68012B02D1C4 -:10CCD0001E4B1B6898477B68022B04D03B680433CB -:10CCE0001B68012B02D11A4B1B6898477B68032BEA -:10CCF00004D03B6808331B68012B02D1154B1B681D -:10CD000098477B68042B04D03B680C331B68012BCD -:10CD100002D1114B1B6898477B68052B04D03B68F8 -:10CD200010331B68012B02D10C4B1B6898477B68A2 -:10CD3000062B04D03B6814331B68012B02D1084B2F -:10CD40001B68984700BF0837BD4680BD74040020AB -:10CD50008404002094040020A4040020B4040020D3 -:10CD6000C404002080B582B000AF786039607B6871 -:10CD7000012B03D03B681B68012B02D11E4B1B68A3 -:10CD800098477B68022B04D03B6804331B68012B57 -:10CD900002D11A4B1B6898477B68032B04D03B6871 -:10CDA00008331B68012B02D1154B1B6898477B6821 -:10CDB000042B04D03B680C331B68012B02D1114BB0 -:10CDC0001B6898477B68052B04D03B6810331B68B1 -:10CDD000012B02D10C4B1B6898477B68062B04D0B3 -:10CDE0003B6814331B68012B02D1084B1B68984722 -:10CDF00000BF0837BD4680BD7804002088040020AD -:10CE000098040020A8040020B8040020C8040020D2 -:10CE100080B485B000AFF860B9607A603B60094AC1 -:10CE2000FB681360084ABB681360084A7B6813609C -:10CE3000074A3B68136000BF1437BD465DF8047BAA -:10CE4000704700BF6C0400207004002074040020B0 -:10CE50007804002080B500AF0948FFF73FFE08487E -:10CE6000FFF76DFE0648FFF71BFE802200210548F4 -:10CE700017F0E0FC034B01221A6000BF80BD00BF29 -:10CE800000400140942F002080B500AF5148FFF7CB -:10CE900033FE0346002B00F09A804E48FFF71EFE3B -:10CEA0004D4BDA6A4C4B1B6B9A4203D24A4B9B693F -:10CEB000002B1CDC49490120FFF7A8FE474901204F -:10CEC000FFF750FF4348FFF7EBFD434B9B69002BF7 -:10CED0007CDD414B00229A613F4B0022DA633E4BDE -:10CEE000DB6F002B72D03C4BDB6F98476EE03A4B08 -:10CEF0001B6A3B4A92FBF3F3DA0F13445B109BB2BD -:10CF000019463448FFF7DCFD334B9B6B002B25D1D2 -:10CF1000314B01229A63304BDB6A01332E4AD362D4 -:10CF20002D4B5A692C4BDB6913442B4A53612A4B16 -:10CF30001B68002B0DD1284BDB69012B04D127493D -:10CF40000120FFF70DFE1DE024490120FFF7B4FE8C -:10CF500018E022490120FFF703FE13E01E4B0022D8 -:10CF60009A631D4B1B68002B08D11C490120FFF759 -:10CF70004DFE1A490120FFF7F5FE03E01749012095 -:10CF8000FFF744FE144B9B69012B0DD1124BDA6A5B -:10CF9000114B1B6B5B089A4206D30F4B03229A611D -:10CFA0000D4BDB6A0C4A53630B4B9B69022B0ED172 -:10CFB000094BDA6A084B5B6B9A4208D3064B032293 -:10CFC0009A61054BDB68044A536200E000BF00BF72 -:10CFD00080BD00BF00400140942F0020DC2F0020C6 -:10CFE000C027090080B500AF8A4B9B69002B40F336 -:10CFF0000E81884BDB6B002B00F00981854B1B6F8A -:10D00000002B5CD1834B1B6C002B58D0814B5B6C8D -:10D010000133804A53647F4B5A6C7E4B1B6C9A429F -:10D020004DD37C4B00225A647A4B1B6E002B19D0D7 -:10D03000784B9B69012B07D0764B9B69022B03D061 -:10D04000744B9B69032B0DD1724B1B6E714A926E10 -:10D050007049C96E104698470346002B02D06D4BAD -:10D0600004229A616B4B5B6E002B21D0694B9B694C -:10D07000012B0BD0674B9B69022B07D0654B9B693B -:10D08000032B03D0634B9B69042B11D1614B5B6E67 -:10D09000604A926E5F49C96E104698470346002B5E -:10D0A00006D05C4B1B695B4A53625A4B05229A615E -:10D0B000584B5B6F002B02D0564B5B6F9847554B1C -:10D0C0009B69012B31D1534B9B6A1A46514B5B6ACA -:10D0D00013441A464F4B9A624E4B9B6A42F20F72B0 -:10D0E00093420CDD4B4B1B6A01334A4A1362494B96 -:10D0F0009B6AA3F51C53103B464A9362ECE700BFC2 -:10D10000444B1B6A434A926893420EDB414B022216 -:10D110009A61404B9B681A463E4B1A623D4B1A6B14 -:10D120003C4BDB6AD31A3B4A53633A4B9B69032B54 -:10D1300028D1384B9B6A1A46364B5B6AD31A1A467B -:10D14000344B9A62334B9B6A002B10DA314B1B6ACB -:10D15000002B0CDD2F4B1B6A013B2E4A13622D4B1B -:10D160009B6A03F51C5310332A4A9362EAE7294B62 -:10D170001B6A284A5268934204DC264B5B681A46B5 -:10D18000244B1A62234B9B69042B03D0214B9B69D0 -:10D19000052B3DD11F4B9B6A1A461E4B5B6AD31A67 -:10D1A0001A461C4B9A621B4B9B6A002B10DA194BD8 -:10D1B0001B6A002B0CDD174B1B6A013B154A1362DF -:10D1C000144B9B6A03F51C531033124A9362EAE72F -:10D1D000104B1B6A0F4A5268934219DC0E4901201A -:10D1E000FFF714FD0C490120FFF7BCFD0B48FFF7CA -:10D1F00057FC084B00229A61064B0022DA63054B6C -:10D20000DB6F002B04D0034BDB6F984700E000BFBF -:10D2100080BD00BF942F0020DC2F00200040014083 -:10D2200080B485B000AFF860B9607A603B60094AAD -:10D23000FB681360084ABB681360084A7B68136088 -:10D24000074A3B68136000BF1437BD465DF8047B96 -:10D25000704700BF7C04002080040020840400206C -:10D260008804002080B500AF0948FFF737FC084864 -:10D27000FFF765FC0648FFF713FC802200210548F4 -:10D2800017F0D8FA034B01221A6000BF80BD00BF1F -:10D29000004401401430002080B500AF5148FFF732 -:10D2A0002BFC0346002B00F09A804E48FFF716FC3B -:10D2B0004D4BDA6A4C4B1B6B9A4203D24A4B9B692B -:10D2C000002B1CDC49490220FFF7A0FC4749022043 -:10D2D000FFF748FD4348FFF7E3FB434B9B69002BF7 -:10D2E0007CDD414B00229A613F4B0022DA633E4BCA -:10D2F000DB6F002B72D03C4BDB6F98476EE03A4BF4 -:10D300001B6A3B4A92FBF3F3DA0F13445B109BB2A8 -:10D3100019463448FFF7D4FB334B9B6B002B25D1C8 -:10D32000314B01229A63304BDB6A01332E4AD362C0 -:10D330002D4B5A692C4BDB6913442B4A53612A4B02 -:10D340001B68002B0DD1284BDB69012B04D1274929 -:10D350000220FFF705FC1DE024490220FFF7ACFC8A -:10D3600018E022490220FFF7FBFB13E01E4B0022CE -:10D370009A631D4B1B68002B08D11C490220FFF744 -:10D3800045FC1A490220FFF7EDFC03E01749022093 -:10D39000FFF73CFC144B9B69012B0DD1124BDA6A51 -:10D3A000114B1B6B5B089A4206D30F4B03229A6109 -:10D3B0000D4BDB6A0C4A53630B4B9B69022B0ED15E -:10D3C000094BDA6A084B5B6B9A4208D3064B03227F -:10D3D0009A61054BDB68044A536200E000BF00BF5E -:10D3E00080BD00BF00440140143000205C300020AC -:10D3F000C027090080B500AF8A4B9B69002B40F322 -:10D400000E81884BDB6B002B00F00981854B1B6F75 -:10D41000002B5CD1834B1B6C002B58D0814B5B6C79 -:10D420000133804A53647F4B5A6C7E4B1B6C9A428B -:10D430004DD37C4B00225A647A4B1B6E002B19D0C3 -:10D44000784B9B69012B07D0764B9B69022B03D04D -:10D45000744B9B69032B0DD1724B1B6E714A926EFC -:10D460007049C96E104698470346002B02D06D4B99 -:10D4700004229A616B4B5B6E002B21D0694B9B6938 -:10D48000012B0BD0674B9B69022B07D0654B9B6927 -:10D49000032B03D0634B9B69042B11D1614B5B6E53 -:10D4A000604A926E5F49C96E104698470346002B4A -:10D4B00006D05C4B1B695B4A53625A4B05229A614A -:10D4C000584B5B6F002B02D0564B5B6F9847554B08 -:10D4D0009B69012B31D1534B9B6A1A46514B5B6AB6 -:10D4E00013441A464F4B9A624E4B9B6A42F20F729C -:10D4F00093420CDD4B4B1B6A01334A4A1362494B82 -:10D500009B6AA3F51C53103B464A9362ECE700BFAD -:10D51000444B1B6A434A926893420EDB414B022202 -:10D520009A61404B9B681A463E4B1A623D4B1A6B00 -:10D530003C4BDB6AD31A3B4A53633A4B9B69032B40 -:10D5400028D1384B9B6A1A46364B5B6AD31A1A4667 -:10D55000344B9A62334B9B6A002B10DA314B1B6AB7 -:10D56000002B0CDD2F4B1B6A013B2E4A13622D4B07 -:10D570009B6A03F51C5310332A4A9362EAE7294B4E -:10D580001B6A284A5268934204DC264B5B681A46A1 -:10D59000244B1A62234B9B69042B03D0214B9B69BC -:10D5A000052B3DD11F4B9B6A1A461E4B5B6AD31A53 -:10D5B0001A461C4B9A621B4B9B6A002B10DA194BC4 -:10D5C0001B6A002B0CDD174B1B6A013B154A1362CB -:10D5D000144B9B6A03F51C531033124A9362EAE71B -:10D5E000104B1B6A0F4A5268934219DC0E49022005 -:10D5F000FFF70CFB0C490220FFF7B4FB0B48FFF7C9 -:10D600004FFA084B00229A61064B0022DA63054B61 -:10D61000DB6F002B04D0034BDB6F984700E000BFAB -:10D6200080BD00BF143000205C3000200044014069 -:10D6300080B485B000AFF860B9607A603B60094A99 -:10D64000FB681360084ABB681360084A7B68136074 -:10D65000074A3B68136000BF1437BD465DF8047B82 -:10D66000704700BF8C040020900400209404002028 -:10D670009804002080B500AF0948FFF72FFA08484A -:10D68000FFF75DFA0648FFF70BFA802200210548F4 -:10D6900017F0D0F8034B01221A6000BF80BD00BF15 -:10D6A000004801409430002080B500AF5148FFF79A -:10D6B00023FA0346002B00F09A804E48FFF70EFA3B -:10D6C0004D4BDA6A4C4B1B6B9A4203D24A4B9B6917 -:10D6D000002B1CDC49490320FFF798FA4749032037 -:10D6E000FFF740FB4348FFF7DBF9434B9B69002BF7 -:10D6F0007CDD414B00229A613F4B0022DA633E4BB6 -:10D70000DB6F002B72D03C4BDB6F98476EE03A4BDF -:10D710001B6A3B4A92FBF3F3DA0F13445B109BB294 -:10D7200019463448FFF7CCF9334B9B6B002B25D1BE -:10D73000314B01229A63304BDB6A01332E4AD362AC -:10D740002D4B5A692C4BDB6913442B4A53612A4BEE -:10D750001B68002B0DD1284BDB69012B04D1274915 -:10D760000320FFF7FDF91DE024490320FFF7A4FA89 -:10D7700018E022490320FFF7F3F913E01E4B0022C3 -:10D780009A631D4B1B68002B08D11C490320FFF72F -:10D790003DFA1A490320FFF7E5FA03E01749032091 -:10D7A000FFF734FA144B9B69012B0DD1124BDA6A47 -:10D7B000114B1B6B5B089A4206D30F4B03229A61F5 -:10D7C0000D4BDB6A0C4A53630B4B9B69022B0ED14A -:10D7D000094BDA6A084B5B6B9A4208D3064B03226B -:10D7E0009A61054BDB68044A536200E000BF00BF4A -:10D7F00080BD00BF0048014094300020DC30002094 -:10D80000C027090080B500AF8A4B9B69002B40F30D -:10D810000E81884BDB6B002B00F00981854B1B6F61 -:10D82000002B5CD1834B1B6C002B58D0814B5B6C65 -:10D830000133804A53647F4B5A6C7E4B1B6C9A4277 -:10D840004DD37C4B00225A647A4B1B6E002B19D0AF -:10D85000784B9B69012B07D0764B9B69022B03D039 -:10D86000744B9B69032B0DD1724B1B6E714A926EE8 -:10D870007049C96E104698470346002B02D06D4B85 -:10D8800004229A616B4B5B6E002B21D0694B9B6924 -:10D89000012B0BD0674B9B69022B07D0654B9B6913 -:10D8A000032B03D0634B9B69042B11D1614B5B6E3F -:10D8B000604A926E5F49C96E104698470346002B36 -:10D8C00006D05C4B1B695B4A53625A4B05229A6136 -:10D8D000584B5B6F002B02D0564B5B6F9847554BF4 -:10D8E0009B69012B31D1534B9B6A1A46514B5B6AA2 -:10D8F00013441A464F4B9A624E4B9B6A42F20F7288 -:10D9000093420CDD4B4B1B6A01334A4A1362494B6D -:10D910009B6AA3F51C53103B464A9362ECE700BF99 -:10D92000444B1B6A434A926893420EDB414B0222EE -:10D930009A61404B9B681A463E4B1A623D4B1A6BEC -:10D940003C4BDB6AD31A3B4A53633A4B9B69032B2C -:10D9500028D1384B9B6A1A46364B5B6AD31A1A4653 -:10D96000344B9A62334B9B6A002B10DA314B1B6AA3 -:10D97000002B0CDD2F4B1B6A013B2E4A13622D4BF3 -:10D980009B6A03F51C5310332A4A9362EAE7294B3A -:10D990001B6A284A5268934204DC264B5B681A468D -:10D9A000244B1A62234B9B69042B03D0214B9B69A8 -:10D9B000052B3DD11F4B9B6A1A461E4B5B6AD31A3F -:10D9C0001A461C4B9A621B4B9B6A002B10DA194BB0 -:10D9D0001B6A002B0CDD174B1B6A013B154A1362B7 -:10D9E000144B9B6A03F51C531033124A9362EAE707 -:10D9F000104B1B6A0F4A5268934219DC0E490320F0 -:10DA0000FFF704F90C490320FFF7ACF90B48FFF7C7 -:10DA100047F8084B00229A61064B0022DA63054B57 -:10DA2000DB6F002B04D0034BDB6F984700E000BF97 -:10DA300080BD00BF94300020DC3000200048014051 -:10DA400080B485B000AFF860B9607A603B60094A85 -:10DA5000FB681360084ABB681360084A7B68136060 -:10DA6000074A3B68136000BF1437BD465DF8047B6E -:10DA7000704700BF9C040020A0040020A4040020E4 -:10DA8000A804002080B500AF0948FFF727F8084830 -:10DA9000FFF755F80648FFF703F8802200210548F4 -:10DAA00016F0C8FE034B01221A6000BF80BD00BF04 -:10DAB000001800401431002080B500AF5148FFF736 -:10DAC0001BF80346002B00F09A804E48FFF706F83B -:10DAD0004D4BDA6A4C4B1B6B9A4203D24A4B9B6903 -:10DAE000002B1CDC49490420FFF790F8474904202B -:10DAF000FFF738F94348FEF7D3FF434B9B69002BF0 -:10DB00007CDD414B00229A613F4B0022DA633E4BA1 -:10DB1000DB6F002B72D03C4BDB6F98476EE03A4BCB -:10DB20001B6A3B4A92FBF3F3DA0F13445B109BB280 -:10DB300019463448FEF7C4FF334B9B6B002B25D1AD -:10DB4000314B01229A63304BDB6A01332E4AD36298 -:10DB50002D4B5A692C4BDB6913442B4A53612A4BDA -:10DB60001B68002B0DD1284BDB69012B04D1274901 -:10DB70000420FEF7F5FF1DE024490420FFF79CF880 -:10DB800018E022490420FEF7EBFF13E01E4B0022B1 -:10DB90009A631D4B1B68002B08D11C490420FFF71A -:10DBA00035F81A490420FFF7DDF803E0174904208F -:10DBB000FFF72CF8144B9B69012B0DD1124BDA6A3D -:10DBC000114B1B6B5B089A4206D30F4B03229A61E1 -:10DBD0000D4BDB6A0C4A53630B4B9B69022B0ED136 -:10DBE000094BDA6A084B5B6B9A4208D3064B032257 -:10DBF0009A61054BDB68044A536200E000BF00BF36 -:10DC000080BD00BF00180040143100205C310020AE -:10DC1000C027090080B500AF8A4B9B69002B40F3F9 -:10DC20000E81884BDB6B002B00F00981854B1B6F4D -:10DC3000002B5CD1834B1B6C002B58D0814B5B6C51 -:10DC40000133804A53647F4B5A6C7E4B1B6C9A4263 -:10DC50004DD37C4B00225A647A4B1B6E002B19D09B -:10DC6000784B9B69012B07D0764B9B69022B03D025 -:10DC7000744B9B69032B0DD1724B1B6E714A926ED4 -:10DC80007049C96E104698470346002B02D06D4B71 -:10DC900004229A616B4B5B6E002B21D0694B9B6910 -:10DCA000012B0BD0674B9B69022B07D0654B9B69FF -:10DCB000032B03D0634B9B69042B11D1614B5B6E2B -:10DCC000604A926E5F49C96E104698470346002B22 -:10DCD00006D05C4B1B695B4A53625A4B05229A6122 -:10DCE000584B5B6F002B02D0564B5B6F9847554BE0 -:10DCF0009B69012B31D1534B9B6A1A46514B5B6A8E -:10DD000013441A464F4B9A624E4B9B6A42F20F7273 -:10DD100093420CDD4B4B1B6A01334A4A1362494B59 -:10DD20009B6AA3F51C53103B464A9362ECE700BF85 -:10DD3000444B1B6A434A926893420EDB414B0222DA -:10DD40009A61404B9B681A463E4B1A623D4B1A6BD8 -:10DD50003C4BDB6AD31A3B4A53633A4B9B69032B18 -:10DD600028D1384B9B6A1A46364B5B6AD31A1A463F -:10DD7000344B9A62334B9B6A002B10DA314B1B6A8F -:10DD8000002B0CDD2F4B1B6A013B2E4A13622D4BDF -:10DD90009B6A03F51C5310332A4A9362EAE7294B26 -:10DDA0001B6A284A5268934204DC264B5B681A4679 -:10DDB000244B1A62234B9B69042B03D0214B9B6994 -:10DDC000052B3DD11F4B9B6A1A461E4B5B6AD31A2B -:10DDD0001A461C4B9A621B4B9B6A002B10DA194B9C -:10DDE0001B6A002B0CDD174B1B6A013B154A1362A3 -:10DDF000144B9B6A03F51C531033124A9362EAE7F3 -:10DE0000104B1B6A0F4A5268934219DC0E490420DA -:10DE1000FEF7FCFE0C490420FEF7A4FF0B48FEF7BA -:10DE20003FFE084B00229A61064B0022DA63054B45 -:10DE3000DB6F002B04D0034BDB6F984700E000BF83 -:10DE400080BD00BF143100205C310020001800406C -:10DE500080B485B000AFF860B9607A603B60094A71 -:10DE6000FB681360084ABB681360084A7B6813604C -:10DE7000074A3B68136000BF1437BD465DF8047B5A -:10DE8000704700BFAC040020B0040020B4040020A0 -:10DE9000B804002080B500AF0948FEF71FFE08480F -:10DEA000FEF74DFE0648FEF7FBFD802200210548E7 -:10DEB00016F0C0FC034B01221A6000BF80BD00BFFA -:10DEC000001C00409431002080B500AF5148FEF79F -:10DED00013FE0346002B00F09A804E48FEF7FEFD2D -:10DEE0004D4BDA6A4C4B1B6B9A4203D24A4B9B69EF -:10DEF000002B1CDC49490520FEF788FE4749052018 -:10DF0000FEF730FF4348FEF7CBFD434B9B69002BE8 -:10DF10007CDD414B00229A613F4B0022DA633E4B8D -:10DF2000DB6F002B72D03C4BDB6F98476EE03A4BB7 -:10DF30001B6A3B4A92FBF3F3DA0F13445B109BB26C -:10DF400019463448FEF7BCFD334B9B6B002B25D1A3 -:10DF5000314B01229A63304BDB6A01332E4AD36284 -:10DF60002D4B5A692C4BDB6913442B4A53612A4BC6 -:10DF70001B68002B0DD1284BDB69012B04D12749ED -:10DF80000520FEF7EDFD1DE024490520FEF794FE77 -:10DF900018E022490520FEF7E3FD13E01E4B0022A6 -:10DFA0009A631D4B1B68002B08D11C490520FEF706 -:10DFB0002DFE1A490520FEF7D5FE03E0174905207E -:10DFC000FEF724FE144B9B69012B0DD1124BDA6A2C -:10DFD000114B1B6B5B089A4206D30F4B03229A61CD -:10DFE0000D4BDB6A0C4A53630B4B9B69022B0ED122 -:10DFF000094BDA6A084B5B6B9A4208D3064B032243 -:10E000009A61054BDB68044A536200E000BF00BF21 -:10E0100080BD00BF001C004094310020DC31002096 -:10E02000C027090080B500AF8A4B9B69002B40F3E5 -:10E030000E81884BDB6B002B00F00981854B1B6F39 -:10E04000002B5CD1834B1B6C002B58D0814B5B6C3D -:10E050000133804A53647F4B5A6C7E4B1B6C9A424F -:10E060004DD37C4B00225A647A4B1B6E002B19D087 -:10E07000784B9B69012B07D0764B9B69022B03D011 -:10E08000744B9B69032B0DD1724B1B6E714A926EC0 -:10E090007049C96E104698470346002B02D06D4B5D -:10E0A00004229A616B4B5B6E002B21D0694B9B69FC -:10E0B000012B0BD0674B9B69022B07D0654B9B69EB -:10E0C000032B03D0634B9B69042B11D1614B5B6E17 -:10E0D000604A926E5F49C96E104698470346002B0E -:10E0E00006D05C4B1B695B4A53625A4B05229A610E -:10E0F000584B5B6F002B02D0564B5B6F9847554BCC -:10E100009B69012B31D1534B9B6A1A46514B5B6A79 -:10E1100013441A464F4B9A624E4B9B6A42F20F725F -:10E1200093420CDD4B4B1B6A01334A4A1362494B45 -:10E130009B6AA3F51C53103B464A9362ECE700BF71 -:10E14000444B1B6A434A926893420EDB414B0222C6 -:10E150009A61404B9B681A463E4B1A623D4B1A6BC4 -:10E160003C4BDB6AD31A3B4A53633A4B9B69032B04 -:10E1700028D1384B9B6A1A46364B5B6AD31A1A462B -:10E18000344B9A62334B9B6A002B10DA314B1B6A7B -:10E19000002B0CDD2F4B1B6A013B2E4A13622D4BCB -:10E1A0009B6A03F51C5310332A4A9362EAE7294B12 -:10E1B0001B6A284A5268934204DC264B5B681A4665 -:10E1C000244B1A62234B9B69042B03D0214B9B6980 -:10E1D000052B3DD11F4B9B6A1A461E4B5B6AD31A17 -:10E1E0001A461C4B9A621B4B9B6A002B10DA194B88 -:10E1F0001B6A002B0CDD174B1B6A013B154A13628F -:10E20000144B9B6A03F51C531033124A9362EAE7DE -:10E21000104B1B6A0F4A5268934219DC0E490520C5 -:10E22000FEF7F4FC0C490520FEF79CFD0B48FEF7B9 -:10E2300037FC084B00229A61064B0022DA63054B3B -:10E24000DB6F002B04D0034BDB6F984700E000BF6F -:10E2500080BD00BF94310020DC310020001C004054 -:10E2600080B485B000AFF860B9607A603B60094A5D -:10E27000FB681360084ABB681360084A7B68136038 -:10E28000074A3B68136000BF1437BD465DF8047B46 -:10E29000704700BFBC040020C0040020C40400205C -:10E2A000C804002080B500AF0948FEF717FC0848F5 -:10E2B000FEF745FC0648FEF7F3FB802200210548E7 -:10E2C00016F0B8FA034B01221A6000BF80BD00BFF0 -:10E2D000002000401432002080B500AF5148FEF706 -:10E2E0000BFC0346002B00F09A804E48FEF7F6FB2D -:10E2F0004D4BDA6A4C4B1B6B9A4203D24A4B9B69DB -:10E30000002B1CDC49490620FEF780FC474906200B -:10E31000FEF728FD4348FEF7C3FB434B9B69002BE8 -:10E320007CDD414B00229A613F4B0022DA633E4B79 -:10E33000DB6F002B72D03C4BDB6F98476EE03A4BA3 -:10E340001B6A3B4A92FBF3F3DA0F13445B109BB258 -:10E3500019463448FEF7B4FB334B9B6B002B25D199 -:10E36000314B01229A63304BDB6A01332E4AD36270 -:10E370002D4B5A692C4BDB6913442B4A53612A4BB2 -:10E380001B68002B0DD1284BDB69012B04D12749D9 -:10E390000620FEF7E5FB1DE024490620FEF78CFC75 -:10E3A00018E022490620FEF7DBFB13E01E4B00229B -:10E3B0009A631D4B1B68002B08D11C490620FEF7F1 -:10E3C00025FC1A490620FEF7CDFC03E0174906207C -:10E3D000FEF71CFC144B9B69012B0DD1124BDA6A22 -:10E3E000114B1B6B5B089A4206D30F4B03229A61B9 -:10E3F0000D4BDB6A0C4A53630B4B9B69022B0ED10E -:10E40000094BDA6A084B5B6B9A4208D3064B03222E -:10E410009A61054BDB68044A536200E000BF00BF0D -:10E4200080BD00BF00200040143200205C3200207C -:10E43000C027090080B500AF8A4B9B69002B40F3D1 -:10E440000E81884BDB6B002B00F00981854B1B6F25 -:10E45000002B5CD1834B1B6C002B58D0814B5B6C29 -:10E460000133804A53647F4B5A6C7E4B1B6C9A423B -:10E470004DD37C4B00225A647A4B1B6E002B19D073 -:10E48000784B9B69012B07D0764B9B69022B03D0FD -:10E49000744B9B69032B0DD1724B1B6E714A926EAC -:10E4A0007049C96E104698470346002B02D06D4B49 -:10E4B00004229A616B4B5B6E002B21D0694B9B69E8 -:10E4C000012B0BD0674B9B69022B07D0654B9B69D7 -:10E4D000032B03D0634B9B69042B11D1614B5B6E03 -:10E4E000604A926E5F49C96E104698470346002BFA -:10E4F00006D05C4B1B695B4A53625A4B05229A61FA -:10E50000584B5B6F002B02D0564B5B6F9847554BB7 -:10E510009B69012B31D1534B9B6A1A46514B5B6A65 -:10E5200013441A464F4B9A624E4B9B6A42F20F724B -:10E5300093420CDD4B4B1B6A01334A4A1362494B31 -:10E540009B6AA3F51C53103B464A9362ECE700BF5D -:10E55000444B1B6A434A926893420EDB414B0222B2 -:10E560009A61404B9B681A463E4B1A623D4B1A6BB0 -:10E570003C4BDB6AD31A3B4A53633A4B9B69032BF0 -:10E5800028D1384B9B6A1A46364B5B6AD31A1A4617 -:10E59000344B9A62334B9B6A002B10DA314B1B6A67 -:10E5A000002B0CDD2F4B1B6A013B2E4A13622D4BB7 -:10E5B0009B6A03F51C5310332A4A9362EAE7294BFE -:10E5C0001B6A284A5268934204DC264B5B681A4651 -:10E5D000244B1A62234B9B69042B03D0214B9B696C -:10E5E000052B3DD11F4B9B6A1A461E4B5B6AD31A03 -:10E5F0001A461C4B9A621B4B9B6A002B10DA194B74 -:10E600001B6A002B0CDD174B1B6A013B154A13627A -:10E61000144B9B6A03F51C531033124A9362EAE7CA -:10E62000104B1B6A0F4A5268934219DC0E490620B0 -:10E63000FEF7ECFA0C490620FEF794FB0B48FEF7B8 -:10E640002FFA084B00229A61064B0022DA63054B31 -:10E65000DB6F002B04D0034BDB6F984700E000BF5B -:10E6600080BD00BF143200205C320020002000403A -:10E6700080B500AF0548FEF731FA0448FEF74FFABF -:10E680000248FEF7FDF900BF80BD00BF0004014055 -:10E6900080B500AF0B48FEF72FFA0346002B0ED0D3 -:10E6A0000848FEF71BFAFEF79DFCFEF7A3FEFFF7F6 -:10E6B000A9F8FFF7AFFAFFF7B5FCFFF7BBFE00BF05 -:10E6C00080BD00BF0004014080B500AFFFF7D0FF60 -:10E6D000FEF7C0FBFEF7C6FDFEF7CCFFFFF7D2F951 -:10E6E000FFF7D8FBFFF7DEFD00BF80BD80B582B02D -:10E6F00000AF786040F21F420021786816F09AF867 -:10E7000000BF0837BD4680BD80B588B000AFF86057 -:10E710000B467A60FB72FB68B3F5005F0AD37B6837 -:10E72000D3F819301A46F968294816F0F5FC4FF06D -:10E73000FF3348E0FB68DB087B617B69B3F5806FE2 -:10E740000BD37B68B3F81D309BB21A467969214818 -:10E7500016F0E2FC4FF0FF3335E0FB6803F00703EF -:10E76000BB610123FB7705E0BB69013BBB61FB7F1C -:10E770005B00FB77BB69002BF6D1FB7A002B13D132 -:10E780007A687B6913441F331B785AB297F91F309C -:10E79000DB435BB213405BB2D9B27A687B69134446 -:10E7A0001F330A461A700DE07A687B6913441F33E1 -:10E7B0001A78FB7F1343D9B27A687B6913441F33FD -:10E7C0000A461A70002318462037BD4680BD00BF98 -:10E7D000E48F03081490030880B487B000AF78601A -:10E7E0007B68D3F81930DB08FB607B68D3F81930FD -:10E7F00003F00703BB6000233B610BE07A683B69D1 -:10E8000013441F331B78FF2B01D0002322E03B6908 -:10E8100001333B613A69FB689A42EFD30123FB75F0 -:10E8200000233B6111E07A68FB6813441F331A78B8 -:10E83000FB7D1340DBB2002B01D100230AE0FB7DFE -:10E840005B00FB753B6901333B613A69BB689A42E7 -:10E85000E9D3012318461C37BD465DF8047B704799 -:10E8600080B500AF0CF08AFBF9F734FCF9F78AFAAF -:10E87000FAF70AFAF6F7A4FE0AF0F6FE13F046F8E5 -:10E880000CF082FB10F0CAF813F0ECFE0EF050FF13 -:10E890000A4816F0DDFCFAF703F909F097FC00F0DE -:10E8A0000FF8F9F7EBFCF9F73DF810F02DFBF7F74F -:10E8B00013F909F047FD13F007FFF2E7349103085D -:10E8C00080B582B000AF002228494FF4FA70F9F702 -:10E8D00037FC45F2AA5009F09BFD45F2AA5000F022 -:10E8E000CDFA2348F7F7D6F8F8F7C0FBF9F7C6FCDE -:10E8F000F9F718F810F008FB13F0E6FE09F022FD16 -:10E900000AF0DAFE0346FB80FB881B0A9BB2022B4F -:10E9100007D018233B6038680AF0EEFB154816F064 -:10E9200097FC0AF0E3FE0346FB80FB88002B07D12F -:10E9300009233B6038680AF0DFFB0F4816F088FCBB -:10E94000F7F746F80346002B04D00A233B603868EB -:10E950000AF0D2FBF7F7AEF800F0BAF8074816F065 -:10E9600077FC00BF0837BD4680BD00BF2DA9020857 -:10E970009D8302086C910308849103089C9103080D -:10E9800080B582B002AF782200212D4815F052FFE9 -:10E9900008F05EF82B4808F025FD2B4809F006FC2E -:10E9A0002A4B2B4AC3F87424284B2A4AC3F87824EC -:10E9B000294A00213C20F9F7C3FB00230193274B90 -:10E9C00000930023002200212548F6F731FE254A56 -:10E9D00025492648F8F736FF254A23492548F8F700 -:10E9E00031FF254A25492648F8F72CFF254A2649B4 -:10E9F0002648F8F727FF264A26492748F8F722FF36 -:10EA0000264A27492748F8F71DFF274A274928485B -:10EA1000F8F718FF274A28492848F8F713FF284A2B -:10EA200028492948F8F70EFF084BDB6919462748A3 -:10EA300016F072FB054B00229A6100BFBD4680BDF7 -:10EA40009C370020A4D10308E4D20308303800200A -:10EA500099EB010871EC0108DDEC010865EE010895 -:10EA6000A5AA0208F5610208B0910308C491030841 -:10EA70007D610208CC910308E9630208D091030884 -:10EA8000E09103082D640208E8910308F891030857 -:10EA9000396A0208049203080C9203087D63020895 -:10EAA0001492030824920308A16702083092030815 -:10EAB00040920308616802084C92030854920308CC -:10EAC000896902085C9203086C9203087492030837 -:10EAD00080B500AFC82000F004F800F039FC00BF9A -:10EAE00080BD80B590B000AF786007F10C03342290 -:10EAF0000021184615F09EFE48F239033B820023A0 -:10EB00007B8240F20113BB824FF40073FB8248F218 -:10EB100039033B8300237B8340F20113BB834FF413 -:10EB20000073FB8348F239033B8400237B8440F26B -:10EB30000113BB844FF40073FB8448F239033B8517 -:10EB400000237B8540F20113BB854FF40073FB85E6 -:10EB500048F239033B8600237B8640F20113BB86D3 -:10EB60004FF40073FB8648F201033B8701237B8748 -:10EB700040F20113BB874FF40073FB870123FB6056 -:10EB800007F10C0318460CF013FB7868F8F752FAFB -:10EB900000BF4037BD4680BD80B500AF00F002F831 -:10EBA00000BF80BD98B500AF002012F011FD0346F4 -:10EBB000012B51D1294816F04BFB0021002012F007 -:10EBC000F7FC274B1B6823F48063254A1360254814 -:10EBD00016F03EFB244B5B69DA6A214BD3F83031E7 -:10EBE0009A420FD1204B5B691B8E9CB212F070FDD4 -:10EBF000034623449AB21A4BD3F818311B0C9BB22C -:10EC00009A4224D0164BD3F818319BB2144AC2F85A -:10EC10001831154B5B691B8E9BB21C4612F058FDD8 -:10EC2000034623441A040E4BD3F8183113430C4AFD -:10EC3000C2F818310C4B5B69DB6A094AC2F8303103 -:10EC400009F0DCFB094816F003FB0AF093FB04F023 -:10EC5000D7F801200AF098FA00BF98BD88920308FF -:10EC60003038002098920308D8490020B492030855 -:10EC700080B582B000AF00237B60094B1B6803F4B2 -:10EC80000073002B08D100F00DF878607B68002B32 -:10EC900002D078680AF030FA00BF0837BD4680BD60 -:10ECA0003038002080B582B000AF00237B607B68E5 -:10ECB000002B0ED10BF058FF0346002B02D10BF0B6 -:10ECC000C1F906E00BF042FF0346002B01D10BF027 -:10ECD000CFF97B6818460837BD4680BD80B500AFC8 -:10ECE00001200AF051FA002014F02EFB00BF80BD75 -:10ECF00080B582B000AF0BF037F90BF061F90CF082 -:10ED000026F90BF005F90BF087F90BF0D5F8002385 -:10ED10007B607B6818460837BD4680BD80B582B0F1 -:10ED200000AF00237B600BF01FFF0346002B04D0D5 -:10ED30000BF00CFF0346002B02D00BF083F906E02A -:10ED40000BF004FF0346002B01D10BF091F97B6817 -:10ED500018460837BD4680BD80B582B000AF034677 -:10ED6000FB803E4B1B68D3F84433012B71D13C4BE5 -:10ED700093F85130012B6CD10BF004FF0346002BAC -:10ED80000AD1374B0A2283F84920354BDA6CFB88CD -:10ED9000D31A334AD36418E00BF0F4FE0346002B79 -:10EDA00013D02F4B93F849300A2B0ED12C4B002255 -:10EDB00083F84920294B1B68D3F848331A46284B5F -:10EDC000DA64274B022283F850200BF0DBFE034667 -:10EDD000002B0AD0224B0A2283F84A20204BDA6CFF -:10EDE000FB88D31A1E4AD36418E00BF0CBFE03460F -:10EDF000002B13D11A4B93F84A300A2B0ED1184B23 -:10EE0000002283F84A20154B1B68D3F848331A4672 -:10EE1000134BDA64124B022283F85020104BDB6C48 -:10EE2000002B03DC0E4B002283F850200C4B93F890 -:10EE30005030002B0DD14FF441700AF05DF9084BB2 -:10EE40000122DA65064B022283F850204FF48073CA -:10EE500000E0002318460837BD4680BDE40C0020C2 -:10EE60009C37002080B500AF034816F0F1F906F09A -:10EE7000DFFE0023184680BDD892030880B588B015 -:10EE800000AF78607B6803F4AA43B3F5AA4F49D179 -:10EE90002A4816F0DDF92A4816F03EF907F1080372 -:10EEA00018220021184615F0C5FC264B1B68D3F824 -:10EEB000C830BB60234B1B68D3F8CC30FB60214BC0 -:10EEC0001B68D3F8D0303B611E4B1B68D3F8D83099 -:10EED00042F2107202FB03F31B4A82FB03129213ED -:10EEE000DB17D31A7B61174B1B68D3F8C830BB61A3 -:10EEF000144B1B68D3F8C830FB6107F108031846B0 -:10EF000000F028F80F4B1B68D3F820230F4BD3F8E1 -:10EF1000FC339A4206D00B4B1B68D3F820330B4AC4 -:10EF2000C2F8FC337B6803F0AA03AA2B02D108487D -:10EF300016F08EF900BF2037BD4680BDF49203085D -:10EF400010930308E40C00206B29827430380020F1 -:10EF50001C93030880B584B000AF78607B68002BF9 -:10EF60000FD10D4816F074F9182200210B4815F046 -:10EF700061FC0B4B0022C3F80822094B0022C3F8A6 -:10EF80000C220AF02DFA074816F062F9064816F02E -:10EF90005FF90023FB6017E038930308403A002034 -:10EFA000303800204C93030868930308FB68591C11 -:10EFB000AC4AFB689B0013445B681A46AA4816F0EB -:10EFC000ABF8FB680133FB60FB68052BEEDDA74B5C -:10EFD000D3F80C3245F2AA52934231D1A34BD3F865 -:10EFE000083203F00103002B2AD07B681B681A4605 -:10EFF0009F49A04816F090F89C4BD3F81032194660 -:10F000009D4816F089F87B681A68984BD3F810323F -:10F01000D31ABB60934B5B68BA681344BB60B96892 -:10F02000964816F079F88F4B5B68BA681946944891 -:10F0300016F072F8B96800200CF08EF80AF0D0F9DA -:10F040008A4BD3F80C3245F2AA52934233D1874B04 -:10F05000D3F8083203F00203002B2CD07B68043372 -:10F060001B681A468749834816F056F87F4BD3F839 -:10F0700014321946804816F04FF87B6804331A683A -:10F080007A4BD3F81432D31ABB60764B9B68BA68BC -:10F090001344BB60B968794816F03EF8714B9B6821 -:10F0A000BA681946764816F037F8B96801200CF0AE -:10F0B00053F80AF095F96D4BD3F80C3245F2AA5289 -:10F0C000934233D1694BD3F8083203F00403002B89 -:10F0D0002CD07B6808331B681A466B49654816F0CC -:10F0E0001BF8624BD3F818321946634816F014F82F -:10F0F0007B6808331A685D4BD3F81832D31ABB60AB -:10F10000584BDB68BA681344BB60B9685B4816F0BB -:10F1100003F8544BDB68BA681946594815F0FCFFF0 -:10F12000B96802200CF018F80AF05AF94F4BD3F8DE -:10F130000C3245F2AA52934233D14C4BD3F80832E9 -:10F1400003F00803002B2CD07B680C331B681A4695 -:10F150004E49484815F0E0FF444BD3F81C3219469D -:10F16000454815F0D9FF7B680C331A683F4BD3F83C -:10F170001C32D31ABB603B4B1B69BA681344BB609B -:10F18000B9683E4815F0C8FF364B1B69BA68194686 -:10F190003B4815F0C1FFB96803200BF0DDFF0AF012 -:10F1A0001FF9324BD3F80C3245F2AA52934233D1B5 -:10F1B0002E4BD3F8083203F02003002B2CD07B68B1 -:10F1C00014331B681A4632492A4815F0A5FF274B0D -:10F1D000D3F824321946284815F09EFF7B68143373 -:10F1E0001A68224BD3F82432D31ABB601D4B9B699B -:10F1F000BA681344BB60B968204815F08DFF194BFD -:10F200009B69BA6819461E4815F086FFB968052043 -:10F210000BF0A2FF0AF0E4F8144BD3F80C3245F2DD -:10F22000AA5293424ED1114BD3F8083203F0100387 -:10F23000002B47D07B6810331B681A4615490D48D0 -:10F2400015F06AFF094BD3F8203219460A4815F029 -:10F2500063FF7B6810331A68044BD3F82032D31A4B -:10F26000BB6019E0BC4900208493030830380020BB -:10F270009493030898930308B0930308CC9303086E -:10F28000E0930308FC930308009403080894030820 -:10F2900010940308189403081F4B5B69BA68134461 -:10F2A000BB60B9681D4815F037FF1B4B5B69BA6836 -:10F2B00019461B4815F030FFB96804200BF04CFFCD -:10F2C0000AF08EF87B68002B09D01822796815485F -:10F2D00015F0A2FA144B45F2AA52C3F80C221348B7 -:10F2E00015F0B6FF0023FB600DE0FB68591C0A4ACD -:10F2F000FB689B0013445B681A460D4815F00CFF31 -:10F30000FB680133FB60FB68052BEEDD00BF00BF2F -:10F310001037BD4680BD00BFBC490020CC93030818 -:10F32000E0930308403A002030380020209403087E -:10F330008493030880B500AF18220349034815F0F1 -:10F340006BFA00BF80BD00BFC049002050380020CC -:10F3500080B400AF0E4B1B68D3F828310D4A136000 -:10F360000B4B1B68D3F830310A4A9360084B1B687B -:10F37000D3F82C31074A5360054B1B68D3F834315E -:10F38000044AD36000BFBD465DF8047B704700BFF0 -:10F39000E40C00201438002080B400AF0D4B1B6833 -:10F3A00045F2AA5293420ED10B4BD3F8083203F028 -:10F3B0000103002B07D0074B5A68084B5B689A4241 -:10F3C00001DD002300E001231846BD465DF8047B03 -:10F3D000704700BFBC49002030380020143800209E -:10F3E00080B400AF0D4B1B6845F2AA5293420ED178 -:10F3F0000B4BD3F8083203F00103002B07D0074B67 -:10F400005A68084B1B689A4201DA002300E0012386 -:10F410001846BD465DF8047B704700BFBC4900201C -:10F42000303800201438002080B584B000AF7860F8 -:10F430000023FB6013F06AFF0346012B02D14FF457 -:10F440008073FB60FB6818461037BD4680BD000026 -:10F4500080B59CB000AF7860396000237B6601F016 -:10F460000FFE78667B6E002B04D0786E09F044FEA8 -:10F470007B6E76E007F10C0358220021184615F048 -:10F48000D9F90123BB810023FB8148F239033B8278 -:10F4900000237B820123BB827B68344A02FB03F397 -:10F4A000BB614FF47A73BB63314B1B68D3F8903167 -:10F4B000FB663B68012B05DC2D4B1B68D3F8A431A0 -:10F4C000BB6610E03B68022B05D1294B1B68D3F8C3 -:10F4D000A831BB6607E03B68022B04DD244B1B68A8 -:10F4E000D3F8AC31BB66FA6EBB6E9A4201DDBB6EDF -:10F4F000FB66FB6E642202FB03F3FB63BB6E6422BC -:10F5000002FB03F33B641A4B1B68D3F89C31194A86 -:10F51000B2FBF3F37B64164B1B68D3F8A031154A9A -:10F52000B2FBF3F3BB64144BFB64144B3B65002349 -:10F530007B65134BBB65134B1B6843F04003114ABB -:10F54000136007F10C03184610F062FD78660D4B4E -:10F550001B6823F040030B4A1360786E09F0CCFD62 -:10F560007B6E18467037BD4680BD00BF400D03005E -:10F57000E40C002080FC0A002DF6010843F6010887 -:10F5800029F401083038002080B584B000AF7860DD -:10F5900039607B687B810FF0F3FCF860FB68002B1F -:10F5A00001D0FB681AE0B7F90A30002B07DDFFF73E -:10F5B000F3FE0346002B10D12323FB600DE0B7F9C7 -:10F5C0000A30002B07DAFFF70BFF0346002B04D1AC -:10F5D0002423FB6001E00023FB60FB681846103722 -:10F5E000BD4680BD80B584B000AF786039600FF053 -:10F5F000D3FCF860FB6818461037BD4680BD80B567 -:10F6000084B000AF786039600FF0D2FCF86009F088 -:10F61000FDFEF7F7D5FB0346002B02D04FF48073B5 -:10F62000FB60FB6818461037BD4680BD80B582B0D0 -:10F6300000AF7860FFF7B0FE034618460837BD46B6 -:10F6400080BD80B582B000AF7860FFF7C9FE034689 -:10F6500018460837BD4680BD80B5B6B000AF7860AB -:10F6600039600023A7F8D4307B68002B01D1002338 -:10F67000D2E03B68002B22D1694B1B68D3F8903154 -:10F68000642202FB03F3BB60654B1B68D3F898311F -:10F69000642202FB03F3FB60614B1B68D3F89C31CF -:10F6A000604AB2FBF3F33B615D4B1B68D3F8A031BA -:10F6B0005C4AB2FBF3F37B6107F108033B607B68B4 -:10F6C000002B04DA4FF6FF73A7F8D63009E07B6809 -:10F6D000002B03DD0123A7F8D63002E00023A7F8B2 -:10F6E000D63007F11803B4220021184615F0A2F80D -:10F6F0000123BB610023FB61B7F8D430DB00D833B2 -:10F700003B4448F2390223F8B82CB7F8D430DB0078 -:10F71000D8333B44002223F8B62CBB699BB203F0DC -:10F720000F039AB2B7F8D43042F4807292B2DB0081 -:10F73000D8333B4423F8B42CB7F8D430DB00D833AB -:10F740003B444FF4007223F8B22CB7F8D4300E3398 -:10F750009B00D8333B447A6843F8C02C0023BB6637 -:10F760007B68002BB8BF5B42FB664FF47A733B6744 -:10F770003B681B687B673B681B68BB673B685B68D3 -:10F78000FB673B681B68C7F880303B689B68C7F81D -:10F7900084303B689B68C7F888303B68DB68C7F8F3 -:10F7A0008C300023C7F890301F4BC7F898301F4BA0 -:10F7B000C7F89C300023C7F8A0300023C7F8A43056 -:10F7C0000023C7F8A8300023C7F8AC30BB69C7F8DE -:10F7D000B030174BC7F8C030164BC7F8BC30164BCB -:10F7E000C7F8B830B7F9D6309BB2C7F8C430BB6998 -:10F7F000C7F8C83007F1180318460BF0E1FEC7F848 -:10F80000D000D7F894301946D7F8D00010F02EFD6C -:10F81000C7F8CC00D7F8CC301846D837BD4680BDE5 -:10F82000E40C002080FC0A009D8302083194020849 -:10F8300089F50108E5F50108FFF5010880B582B0FA -:10F8400000AF0023FB710BF0F5F80346002B04D149 -:10F85000FB79002B01D1002300E001231846083773 -:10F86000BD4680BD80B5A0B000AF0123BB670023BB -:10F87000FB67934BD3F8083223F00103904AC2F898 -:10F88000083209F0ADFD07F1140364220021184687 -:10F8900014F0D0FF0123BB820023FB8248F239031E -:10F8A0003B8300237B830123BB83BB6F854A02FB21 -:10F8B00003F33B62BB6F844A02FB03F37B62834B1F -:10F8C0001B68D3F89031642202FB03F37B647F4B07 -:10F8D0001B68D3F89431642202FB03F3BB647B4BB7 -:10F8E0001B68D3F89C317A4AB2FBF3F3FB64774B85 -:10F8F0001B68D3F8A031764AB2FBF3F33B65754B36 -:10F90000BB65754B3B66754B7B660023BB66744BD2 -:10F910003B676B4B1B6843F04003694A136007F178 -:10F920001403184610F000F9F867642008F036FD5B -:10F93000FB6F40F20112934240F08880FFF77EFF98 -:10F940000346002B40F08280604B1B68D3F8903157 -:10F95000642202FB03F37B605C4B1B68D3F8943199 -:10F96000642202FB03F3BB60584B1B68D3F89C3145 -:10F97000574AB2FBF3F3FB60544B1B68D3F8A0313A -:10F98000534AB2FBF3F33B61BB6F4F4A02FB03F3F5 -:10F990003A1D11461846FFF75FFE0123BB82002384 -:10F9A000FB8248F239033B8300237B830123BB8323 -:10F9B000BB6F4FF47A6202FB03F33B62BB6F424AB8 -:10F9C00002FB03F37B6264237B644FF47A73BB64B2 -:10F9D000444BFB644FF4E1533B653E4BBB653E4BF0 -:10F9E0003B663E4B7B660023BB663D4B3B6707F1A6 -:10F9F0001403184610F098F8F867642008F0CEFC5D -:10FA0000FB6F40F20112934213D1FFF717FF034639 -:10FA1000002B0ED12A4BD3F8083243F00103284AB9 -:10FA2000C2F80832304815F013FC40F20113FB67AE -:10FA300018E0234BD3F8083223F00103204AC2F820 -:10FA40000832F96F294815F067FB0BE01C4BD3F81F -:10FA5000083223F001031A4AC2F80832F96F23482A -:10FA600015F05AFB164B1B6823F04003144A136031 -:10FA70001F4B5B68124AD2F8102219461D4815F038 -:10FA80004BFB124B1B68D3F8C8300D4AC2F810323A -:10FA90000B4BD3F81032194600200BF05DFB09F038 -:10FAA0009FFC134B5B681946134815F035FBF86F44 -:10FAB00009F022FBFB6F18468037BD4680BD00BFB2 -:10FAC00030380020400D030030F8FFFFE40C002028 -:10FAD00080FC0A003DF8010899F30108E1F30108F0 -:10FAE00059F601084019010064940308789403084A -:10FAF000BC49002094940308B894030880B400AF74 -:10FB00000D4B1B6845F2AA5293420ED10B4BD3F812 -:10FB1000083203F00203002B07D0074B9A68084B0A -:10FB2000DB689A4201DD002300E001231846BD4650 -:10FB30005DF8047B704700BFBC49002030380020CE -:10FB40001438002080B400AF0D4B1B6845F2AA5258 -:10FB500093420ED10B4BD3F8083203F00203002B73 -:10FB600007D0074B9A68084B9B689A4201DA00233A -:10FB700000E001231846BD465DF8047B704700BFD6 -:10FB8000BC490020303800201438002080B582B0F5 -:10FB900000AF7860FFF7B2FF034618460837BD464E -:10FBA00080BD80B582B000AF7860FFF7CBFF034621 -:10FBB00018460837BD4680BD80B485B000AF786078 -:10FBC0000C4B1B6845F2AA52934209D10A4BD3F859 -:10FBD000083203F00203002B02D00023FB6001E097 -:10FBE0002123FB60FB6818461437BD465DF8047B93 -:10FBF000704700BFBC4900203038002080B584B079 -:10FC000000AF78600023FB6013F080FB0346012BFC -:10FC100002D14FF48073FB60FB6818461037BD4675 -:10FC200080BD000080B59CB000AF786039600023D3 -:10FC30007B6601F025FA78667B6E002B04D0786E27 -:10FC400009F05AFA7B6E76E007F10C035822002186 -:10FC5000184614F0EFFD0123BB810123FB8148F21C -:10FC600039033B8200237B820123BB827B68344AB9 -:10FC700002FB03F3BB614FF47A73BB63314B1B6828 -:10FC8000D3F89031FB663B68012B05DC2D4B1B68DC -:10FC9000D3F8A431BB6610E03B68022B05D1294B99 -:10FCA0001B68D3F8A831BB6607E03B68022B04DD74 -:10FCB000244B1B68D3F8AC31BB66FA6EBB6E9A421C -:10FCC00001DDBB6EFB66FB6E642202FB03F3FB638C -:10FCD000BB6E642202FB03F33B641A4B1B68D3F830 -:10FCE0009C31194AB2FBF3F37B64164B1B68D3F8C3 -:10FCF000A031154AB2FBF3F3BB64144BFB64144B05 -:10FD00003B65144B7B65144BBB65144B1B6843F080 -:10FD10004003124A136007F10C03184610F078F9FB -:10FD200078660E4B1B6823F040030C4A1360786E14 -:10FD300009F0E2F97B6E18467037BD4680BD00BF02 -:10FD4000400D0300E40C002080FC0A008DFB01083C -:10FD5000A3FB0108B9FB0108FDFB010830380020B6 -:10FD600080B584B000AF786039607B687B810FF02C -:10FD700007F9F860FB68002B01D0FB681FE0B7F9BA -:10FD80000A30002B07DDFFF7B9FE0346002B10D128 -:10FD90002523FB600DE0B7F90A30002B07DAFFF7E7 -:10FDA000D1FE0346002B04D12623FB6001E0002393 -:10FDB000FB60FB68002B01D0FB6800E0FB68184685 -:10FDC0001037BD4680BD80B584B000AF7860396023 -:10FDD0000FF0E2F8F860FB6818461037BD4680BDAA -:10FDE00080B584B000AF786039600FF0E1F8F8605A -:10FDF000FEF758FFF860FB68002B01D0FB6800E0BD -:10FE0000FB6818461037BD4680BD000080B5B6B00F -:10FE100000AF786039600123A7F8D4307B68002BED -:10FE200001D10023D2E03B68002B22D1694B1B6833 -:10FE3000D3F89031642202FB03F3BB60654B1B686F -:10FE4000D3F89831642202FB03F3FB60614B1B681B -:10FE5000D3F89C31604AB2FBF3F33B615D4B1B6806 -:10FE6000D3F8A0315C4AB2FBF3F37B6107F10803DE -:10FE70003B607B68002B04DA4FF6FF73A7F8D6309F -:10FE800009E07B68002B03DD0123A7F8D63002E0F0 -:10FE90000023A7F8D63007F11803B4220021184632 -:10FEA00014F0C8FC0123BB610023FB61B7F8D43018 -:10FEB000DB00D8333B4448F2390223F8B82CB7F8BA -:10FEC000D430DB00D8333B44002223F8B62CBB6986 -:10FED0009BB203F00F039AB2B7F8D43042F48072A9 -:10FEE00092B2DB00D8333B4423F8B42CB7F8D430BB -:10FEF000DB00D8333B444FF4007223F8B22CB7F840 -:10FF0000D4300E339B00D8333B447A6843F8C02C7E -:10FF10000023BB667B68002BB8BF5B42FB664FF4D7 -:10FF20007A733B673B681B687B673B681B68BB67F2 -:10FF30003B685B68FB673B681B68C7F880303B68C1 -:10FF40009B68C7F884303B689B68C7F888303B687B -:10FF5000DB68C7F88C300023C7F890301F4BC7F818 -:10FF600098301F4BC7F89C300023C7F8A0300023FF -:10FF7000C7F8A4300023C7F8A8300023C7F8AC3076 -:10FF8000BB69C7F8B030174BC7F8C030164BC7F87D -:10FF9000BC30164BC7F8B830B7F9D6309BB2C7F8AB -:10FFA000C430BB69C7F8C83007F1180318460BF016 -:10FFB00007FBC7F8D000D7F894301946D7F8D0001F -:10FFC00010F054F9C7F8CC00D7F8CC301846D83721 -:10FFD000BD4680BDE40C002080FC0A009D83020821 -:10FFE0003194020861FD0108C7FD0108E1FD010827 -:10FFF00080B582B000AF0023FB710AF029FD0346F3 -:020000040802F0 -:10000000002B04D1FB79002B01D1002300E0012358 -:1000100018460837BD4680BD80B5A0B000AF7860F7 -:100020000023FB67934BD3F8083223F00203914A75 -:10003000C2F8083209F0D4F907F11803642200214C -:10004000184614F0F7FB01233B8301237B8348F21E -:100050003903BB830023FB8301233B847B68864AEF -:1000600002FB03F37B627B68844A02FB03F3BB62FF -:10007000834B1B68D3F89031642202FB03F3BB640B -:100080007F4B1B68D3F89431642202FB03F3FB64BB -:100090007B4B1B68D3F89C317A4AB2FBF3F33B6588 -:1000A000774B1B68D3F8A031764AB2FBF3F37B653C -:1000B000754BFB65754B7B66754BBB660023FB661A -:1000C000744B7B676B4B1B6843F04003694A1360BA -:1000D00007F1180318460FF027FDF867642008F0B1 -:1000E0005DF9FB6F40F20112934240F08980FFF707 -:1000F0007FFF0346002B40F08380614B1B68D3F8E1 -:100100009031642202FB03F3BB605D4B1B68D3F8A4 -:100110009431642202FB03F3FB60594B1B68D3F854 -:100120009C31584AB2FBF3F33B61554B1B68D3F843 -:10013000A031544AB2FBF3F37B617B684F4A02FB68 -:1001400003F307F1080211461846FFF75FFE01238B -:100150003B8301237B8348F23903BB830023FB836A -:1001600001233B847B684FF47A6202FB03F37B62DA -:100170007B68424A02FB03F3BB626423BB644FF417 -:100180007A73FB64444B3B654FF4E1537B653E4B14 -:10019000FB653E4B7B663E4BBB660023FB663D4BDF -:1001A0007B6707F1180318460FF0BEFCF867642060 -:1001B00008F0F4F8FB6F40F20112934213D1FFF7FD -:1001C00017FF0346002B0ED12A4BD3F8083243F019 -:1001D0000203284AC2F80832304815F039F840F2D4 -:1001E0000113FB6718E0234BD3F8083223F0020316 -:1001F000204AC2F80832F96F294814F08DFF0BE04D -:100200001C4BD3F8083223F002031A4AC2F8083212 -:10021000F96F234814F080FF164B1B6823F040034E -:10022000144A13601F4B9B68124AD2F814221946D5 -:100230001D4814F071FF124B1B68D3F8CC300D4AE7 -:10024000C2F814320B4BD3F81432194601200AF0CD -:1002500083FF09F0C5F8134B9B681946134814F047 -:100260005BFFF86F08F048FFFB6F18468037BD460C -:1002700080BD00BF30380020400D030030F8FFFF84 -:10028000E40C002080FC0A00F1FF0108FDFA0108DF -:1002900045FB01080DFE0108401901006C9503089B -:1002A00080950308BC4900209C95030854950308D9 -:1002B00080B586B000AF786039607868F0F762F991 -:1002C00002460B46C7E904237868F0F75BF902465B -:1002D0000B46D7E90401F0F7BFF902460B46C7E920 -:1002E00004233868F0F74EF902460B46C7E90223AB -:1002F0003868F0F747F902460B46D7E90201F0F7F4 -:10030000ABF902460B46C7E90223D7E90223D7E936 -:100310000401EFF7EBFF02460B4643EC172BB0EE60 -:10032000470AF0EE670A17F0E1FA51EC100B4FF0B4 -:100330000002074BEFF7DAFF02460B46104619465C -:10034000F0F762FC034618461837BD4680BD00BF73 -:100350000000E03F80B584B000AF786039607B6812 -:100360007B817B681B0C3B810EF00AFEF860FB680A -:10037000002B01D0FB6839E0B7F90A30002B07DD0C -:10038000FFF70AF80346002B10D12323FB600DE092 -:10039000B7F90A30002B07DAFFF722F80346002BE3 -:1003A00004D12423FB6001E00023FB60FB68002BE9 -:1003B00001D0FB681AE0B7F90830002B07DDFFF722 -:1003C0009DFB0346002B10D12523FB600DE0B7F900 -:1003D0000830002B07DAFFF7B5FB0346002B04D1EA -:1003E0002623FB6001E00023FB60FB681846103702 -:1003F000BD4680BD80B584B000AF786039600EF036 -:10040000CBFDF860FB6818461037BD4680BD80B54F -:1004100084B000AF786039600EF0CAFDF860FEF776 -:1004200041FCF860FB68002B01D0FB6800E0FB6832 -:1004300018461037BD4680BD80B5BAB000AFF86031 -:10044000B9607A600023A7F8E2300123A7F8E03012 -:10045000FB68002B04D1BB68002B01D1002325E1F0 -:100460007B68002B22D1934B1B68D3F89031642218 -:1004700002FB03F37B618F4B1B68D3F89831642236 -:1004800002FB03F3BB618B4B1B68D3F89C318A4A98 -:10049000B2FBF3F3FB61874B1B68D3F8A031864AAC -:1004A000B2FBF3F33B6207F114037B60FB68002BA4 -:1004B00004DA4FF6FF73A7F8E63009E0FB68002B7B -:1004C00003DD0123A7F8E63002E00023A7F8E630B9 -:1004D000BB68002B04DA4FF6FF73A7F8E43009E09D -:1004E000BB68002B03DD0123A7F8E43002E0002302 -:1004F000A7F8E43007F12403B4220021184614F0D1 -:1005000099F901237B620023BB62B7F8E230DB007C -:10051000E8333B4448F2390223F8BC2CB7F8E23008 -:10052000DB00E8333B44002223F8BA2C7B6A9BB201 -:1005300003F00F039AB2B7F8E23042F4807292B23D -:10054000DB00E8333B4423F8B82CB7F8E230DB009B -:10055000E8333B444FF4007223F8B62CB7F8E2308E -:100560000E339B00E8333B44FA6843F8C42CB7F8D9 -:10057000E030DB00E8333B4448F2390223F8BC2C7E -:10058000B7F8E030DB00E8333B44002223F8BA2C14 -:100590007B6A9BB203F00F039AB2B7F8E03042F4E3 -:1005A000807292B2DB00E8333B4423F8B82CB7F8F2 -:1005B000E030DB00E8333B444FF4007223F8B62C04 -:1005C000B7F8E0300E339B00E8333B44BA6843F899 -:1005D000C42C00237B67BB6883EAE372A2EBE3725F -:1005E000FB68002BB8BF5B429342B8BF1346BB67A2 -:1005F0004FF47A73FB677B681B68C7F880307B68B1 -:100600001B68C7F884307B685B68C7F888307B68F4 -:100610001B68C7F88C307B689B68C7F890307B6894 -:100620009B68C7F894307B68DB68C7F89830002374 -:10063000C7F89C30214BC7F8A430214BC7F8A8302D -:100640000023C7F8AC300023C7F8B0300023C7F848 -:10065000B4300023C7F8B8307B6AC7F8BC30194BF8 -:10066000C7F8CC30184BC7F8C830184BC7F8C4309F -:10067000B7F9E4301A04B7F9E6309BB21343C7F870 -:10068000D0307B6AC7F8D43007F1240318460AF04B -:1006900097FFC7F8DC00D7F8A0301946D7F8DC0080 -:1006A0000FF0E4FDC7F8D800D7F8D8301846E8377F -:1006B000BD4680BDE40C002080FC0A009D8302083A -:1006C0003194020855030208F50302080F040208DA -:1006D00080B588B000AFF860B9607A604C4B0022FA -:1006E000C3F804244A4B1B6843F04003484A136094 -:1006F0000023FB61F86908F0FFFC08F071FE454B30 -:100700001B6845F2AA5293426DD1414BD3F808328F -:1007100003F00303032B66D13F4B1B68D3F828314A -:10072000FA689A4214DB3C4B1B68D3F82C31FA6808 -:100730009A420DDC384B1B68D3F83031BA689A42C4 -:1007400006DB354B1B68D3F83431BA689A4207DDB3 -:10075000BA68F968314814F0DFFC2223FB6144E0F9 -:1007600008F03EFE2B4B5B68FA68D31ABB61294B3D -:100770009B68BA68D31A7B61294814F069FD254B40 -:100780005B681946274814F0C7FC224B9B68194642 -:10079000254814F0C1FC1F4BDB681946234814F0B0 -:1007A000BBFC7A687969B869FFF746FEF8612048B2 -:1007B00014F04EFD174B5B6819461A4814F0ACFC58 -:1007C000144B9B681946184814F0A6FC114BDB68C3 -:1007D0001946164814F0A0FC0E4B1B691946154823 -:1007E00014F09AFC01E02123FB61094B0122C3F8BC -:1007F0000424074B1B6823F04003054A1360F86983 -:1008000008F07AFCFB6918462037BD4680BD00BF62 -:1008100030380020BC490020E40C0020C0950308BB -:10082000F0950308009603080C9603081896030831 -:10083000249603083496030880B483B000AF786030 -:10084000084BDA68084B1B68D3F84C319A4201DD3B -:10085000002300E0012318460C37BD465DF8047BF9 -:10086000704700BFBC490020E40C002080B483B076 -:1008700000AF7860084BDA68084B1B68D3F8483142 -:100880009A4201DA002300E0012318460C37BD46E6 -:100890005DF8047B704700BFBC490020E40C0020D9 -:1008A00080B485B000AF78600C4B1B6845F2AA524B -:1008B000934209D10A4BD3F8083203F00403002B0A -:1008C00002D00023FB6001E02123FB60FB68184697 -:1008D0001437BD465DF8047B704700BFBC4900205B -:1008E0003038002080B584B000AF78600023FB6012 -:1008F00012F00CFD0346012B02D14FF48073FB6014 -:10090000FB6818461037BD4680BD000080B59AB020 -:1009100000AF7860396007F10803582200211846BB -:1009200013F088FF01233B8102237B8148F23903C6 -:10093000BB810023FB8100233B827B6847F230525E -:1009400002FB03F37B614FF47A737B63234B1B68D9 -:10095000D3F8E4317B667A6E3B689A4201DD3B68EE -:100960007B667B6E642202FB03F3BB633B686422FD -:1009700002FB03F3FB63194B1B68D3F8F831184AE9 -:10098000B2FBF3F33B64154B1B68D3F8FC31144AFC -:10099000B2FBF3F37B64134BBB64134BFB64134B4D -:1009A0003B65134B7B65134B1B6843F04003114AB7 -:1009B000136007F1080318460FF02AFB38660D4B49 -:1009C0001B6823F040030B4A1360386E08F094FB59 -:1009D0003B6E18466837BD4680BD00BFE40C002062 -:1009E00080FC0A00390802086D080208A108020804 -:1009F000E50802083038002080B584B000AF786088 -:100A000039600EF0BDFAF860FB68002B01D0FB687E -:100A100000E0FB6818461037BD4680BD80B584B045 -:100A200000AF786039600EF0B7FAF860FB681846DE -:100A30001037BD4680BD000080B584B000AF78603F -:100A400039600AF03DF80346002B07D10E4814F038 -:100A5000FFFB4FF48073FB60FB6810E00EF0A8FA18 -:100A6000F860FB68002B01D0FB6808E0FEF71AF97C -:100A7000F860FB68002B01D0FB6800E0FB681846BB -:100A80001037BD4680BD00BF4096030880B584B0D6 -:100A900000AF786039600AF013F80346002B07D1E5 -:100AA000144814F0D5FB4FF48073FB60FB681DE025 -:100AB0000EF07EFAF860FB68002B01D0FB6815E0B1 -:100AC000FEF7F0F8F860FB68002B01D0FB680DE042 -:100AD000094B1B68D3F89831084AA2FB0323DB08B3 -:100AE0009BB21846FEF738F9F860FB6818461037D5 -:100AF000BD4680BD40960308E40C0020CDCCCCCC94 -:100B000080B5B6B000AF786039600223A7F8D63060 -:100B10007B68002B01D10023BEE03B68002B22D173 -:100B20005F4B1B68D3F8E431642202FB03F3BB6024 -:100B30005B4B1B68D3F8EC31642202FB03F3FB60D0 -:100B4000574B1B68D3F8F831564AB2FBF3F33B61BD -:100B5000534B1B68D3F8FC31524AB2FBF3F37B6171 -:100B600007F108033B6007F11803B422002118467F -:100B700013F060FE0123BB610023FB61B7F8D630A0 -:100B8000DB00D8333B4448F2390223F8B82CB7F8DD -:100B9000D630DB00D8333B44002223F8B62CBB69A7 -:100BA0009BB203F00F039AB2B7F8D63042F48072CA -:100BB00092B2DB00D8333B4423F8B42CB7F8D630DC -:100BC000DB00D8333B444FF4007223F8B22CB7F863 -:100BD000D6300E339B00D8333B447A6843F8C02CA0 -:100BE0000023BB667B68002BB8BF5B42FB664FF4FB -:100BF0007A733B673B681B687B673B681B68BB6716 -:100C00003B685B68FB673B681B68C7F880303B68E4 -:100C10009B68C7F884303B689B68C7F888303B689E -:100C2000DB68C7F88C300023C7F890301E4BC7F83C -:100C300098301E4BC7F89C300023C7F8A030002323 -:100C4000C7F8A4300023C7F8A8300023C7F8AC3099 -:100C50000023C7F8B030164BC7F8C030154BC7F8A3 -:100C6000BC30154BC7F8B8300023C7F8C430BB6997 -:100C7000C7F8C83007F1180318460AF0A1FCC7F8F6 -:100C8000D000D7F894301946D7F8D0000FF0EEFA1C -:100C9000C7F8CC00D7F8CC301846D837BD4680BD51 -:100CA000E40C002080FC0A009D83020831940208B5 -:100CB000F90902081D0A0208390A020880B59CB029 -:100CC00000AF78605A4BD3F8083223F00403584A37 -:100CD000C2F8083208F084FB07F1080364220021FF -:100CE000184613F0A7FD01233B8102237B8148F2C4 -:100CF0003903BB810023FB8100233B827B6842F2E6 -:100D0000107202FB03F37B617B684A4A02FB03F328 -:100D1000BB61494B1B68D3F8E431642202FB03F347 -:100D2000BB63454B1B68D3F8E831642202FB03F335 -:100D3000FB63414B1B68D3F8F831404AB2FBF3F335 -:100D40003B643D4B1B68D3F8FC313C4AB2FBF3F3E8 -:100D50007B640023BB643A4BFB6400237B65002368 -:100D6000BB650023FB65374B7B66314B1B6843F04B -:100D700040032F4A136007F1080318460EF0D4FE13 -:100D8000F8662B4B1B6823F04003294A136064204C -:100D900007F004FBFB6E40F20112934213D109F0FD -:100DA00065FE0346002B0ED1214BD3F8083243F0E9 -:100DB00004031F4AC2F80832234814F049FA40F2EB -:100DC0000113FB660DE01A4BD3F8083223F004033D -:100DD000174AC2F80832F96E1C4814F09DF9202316 -:100DE000FB661B4BDB68124AD2F8182219461948D9 -:100DF00014F092F9104B1B68D3F8D0300C4AC2F8AB -:100E000018320B4BD3F81832194602200AF0A4F915 -:100E100008F0E6FA0E4BDB6819460F4814F07CF92F -:100E2000F86E08F069F9FB6E18467037BD4680BD54 -:100E30003038002018FCFFFFE40C002080FC0A0082 -:100E40006DAA0208010B0208589603086C96030865 -:100E5000BC49002088960308BC96030880B584B07E -:100E600000AF786039600023FB60264B1B6843F0BD -:100E70004003244A1360244B1B6845F2AA52934254 -:100E80002ED1204BD3F8083203F00403002B27D0D7 -:100E90001E4B1B68D3F848317A689A4206DB1B4B1D -:100EA0001B68D3F84C317A689A4209DD164BDB682F -:100EB0007A681946164814F02FF92223FB6012E0D5 -:100EC00008F08EFA104BDB687A68D31ABB60BB68F7 -:100ED000002B08D03968B868FFF712FEF86002E00E -:100EE0002123FB6000E000BF064B1B6823F040039A -:100EF000044A1360F86808F0FFF8FB6818461037DA -:100F0000BD4680BD30380020BC490020E40C0020E4 -:100F1000E496030880B584B000AF786039600023A0 -:100F2000FB60284B1B6843F04003264A136008F01F -:100F3000C3FF254B1B6845F2AA5293422ED1214B89 -:100F4000D3F8083203F00403002B27D01F4B1B6893 -:100F5000D3F848317A689A4206DB1C4B1B68D3F8F9 -:100F60004C317A689A4209DD174BDB687A6819467A -:100F7000174814F0D1F82223FB6012E008F030FA91 -:100F8000114BDB687A68D31ABB60BB68002B08D0B2 -:100F90003968B868FFF7B4FDF86002E02123FB6010 -:100FA00000E000BF08F072FF064B1B6823F040030F -:100FB000044A1360F86808F09FF8FB681846103779 -:100FC000BD4680BD30380020BC490020E40C002024 -:100FD000E496030880B584B000AF78600023FB601E -:100FE000244BD3F8003245F2AA5293420CD1224B43 -:100FF0001B6845F2AA52934206D11E4BD3F8083221 -:1010000003F00403002B03D10120FFF757FEF86023 -:10101000FB6840F20112934202D0FB68002B24D1FE -:10102000144BD3F8003245F2AA5293421BD1124B13 -:101030001B6845F2AA52934212D10E4BD3F80832E4 -:1010400003F00403002B0BD00C4B1B68D3F85C227D -:101050007B68134400211846FFF75CFFF86004E04A -:101060005523FB6001E01623FB60FB681846103730 -:10107000BD4680BD30380020BC490020E40C002073 -:1010800080B582B000AF00237B60244BD3F80032E0 -:1010900045F2AA5293420CD1214B1B6845F2AA5249 -:1010A000934206D11D4BD3F8083203F00403002B02 -:1010B00003D10120FFF702FE78607B6840F2011245 -:1010C000934202D07B68002B22D1144BD3F800321C -:1010D00045F2AA52934219D1114B1B6845F2AA520C -:1010E000934210D10D4BD3F8083203F00403002BC8 -:1010F00009D00C4B1B68D3F85C3200211846FFF76F -:10110000ADFE786004E055237B6001E016237B6030 -:101110007B6818460837BD4680BD00BF30380020C8 -:10112000BC490020E40C002080B598B000AF7E4B95 -:10113000D3F8083223F008037B4AC2F808320023B0 -:10114000FB65FFF79DFFF865FB6D002B04D0F86D84 -:1011500007F0D2FFFB6DE3E008F042F93B1D582297 -:101160000021184613F066FB0123BB800323FB809C -:1011700048F239033B8100237B810123BB8142F28A -:1011800010733B61694B1B68D3F8003242F2107256 -:1011900002FB03F3DB08664AA2FB03239B087B6187 -:1011A000624B1B68D3F8043242F2107202FB03F365 -:1011B000DB085F4AA2FB03239B08BB615B4B1B68F8 -:1011C000D3F80C3242F2107202FB03F3DB08584AE8 -:1011D000A2FB03239B08574AB2FBF3F3FB61534B7B -:1011E0001B68D3F8103242F2107202FB03F3DB08E3 -:1011F0004F4AA2FB03239B084E4AB2FBF3F33B6228 -:101200000023BB640023FB6400233B654A4B3B6423 -:101210000023BB65444B1B6843F04003424A136004 -:101220003B1D18460DF070FFF8653F4B1B6823F01F -:1012300040033D4A1360642007F0B0F8FB6DB3F53E -:10124000807F15D13B6C984703461A46BB6D9A4286 -:101250000ED1354BD3F8083243F00803324AC2F8B6 -:101260000832364813F0F4FF40F20113FB650BE03F -:101270002D4BD3F8083223F008032B4AC2F808326A -:10128000F96D2F4813F048FFFB6D40F201129342B5 -:101290003AD1254BD3F8083203F00803002B33D0A2 -:1012A00009F0F2FB0346002B2ED1264B1B691E4A88 -:1012B000D2F81C221946244813F02EFF1B4B1B6842 -:1012C000D3F8D83042F2107202FB03F31F4A82FBBC -:1012D00003129213DB17D31A134AC2F81C32124BB3 -:1012E000D3F81C321946032009F036FF08F078F8CD -:1012F000144B1B691946164813F00EFF002140F6E7 -:10130000C41000F09BF907E0074BD3F8083223F034 -:101310000803054AC2F80832F86D07F0EDFEFB6DD0 -:1013200018466037BD4680BD30380020E40C0020F0 -:10133000176CC11600A24A0489AA0208189703086C -:101340002C970308BC490020489703086B29827436 -:101350007097030880B584B000AF78600023FB600D -:1013600011F0D4FF0346012B02D14FF48073FB60D0 -:10137000FB6818461037BD4680BD000080B59AB0A6 -:1013800000AF786039603B68002B02DC01233B60D2 -:1013900005E03B684B4A934201DD4A4B3B6000232A -:1013A0003B660020FFF716FE38663B6E002B04D02C -:1013B000386E07F0A1FE3B6E80E007F1080358226B -:1013C0000021184613F036FA01233B8103237B8169 -:1013D00048F23903BB810023FB8101233B823A4B56 -:1013E0007B617B697A6802FB03F37B6142F21073D5 -:1013F0007B63364B1B68D3F800327B667A6E3B68A2 -:101400009A4201DD3B687B667B6E42F2107202FB02 -:1014100003F32F4A82FB03121A441212DB17D31A6A -:10142000BB633B6842F2107202FB03F3284A82FB63 -:1014300003121A441212DB17D31AFB63234B1B68E7 -:10144000D3F80C3242F2107202FB03F3DB08214A9C -:10145000A2FB03239B08204AB2FBF3F33B641B4B24 -:101460001B68D3F8103242F2107202FB03F3DB0860 -:10147000184AA2FB03239B08174AB2FBF3F37B64D1 -:101480000023BB640023FB6400233B65134B7B6597 -:10149000134B1B6843F04003114A136007F1080324 -:1014A00018460EF0B5FD38660D4B1B6823F040035F -:1014B0000B4A1360386E07F01FFE3B6E1846683704 -:1014C000BD4680BDA086010000E1F505E40C0020CA -:1014D000B7600BB6176CC11600A24A045513020878 -:1014E0003038002090B5A7B000AF786039607B68D5 -:1014F000002B01D1002396E00023C7F8903007F1BC -:101500001C0374220021184613F094F90123BB83B5 -:101510000023BB667B68002BB8BF5B42FB660023E1 -:101520003B670023FB8303233B6248F23903BB8400 -:101530007B68BB620023C7F8883042F210737B6778 -:101540000123C7F8943010E0D7F8942013465B00CD -:1015500013449B0098333B44783B4FF0FF321A60B2 -:10156000D7F894300133C7F89430D7F89430052B6E -:10157000EADD3B68002B45D12D4B1B68D3F80032C8 -:1015800042F2107202FB03F3DB082A4AA2FB032398 -:101590009B08FB60264B1B68D3F8083242F210729E -:1015A00002FB03F3DB08234AA2FB03239B083B61F6 -:1015B0001F4B1B68D3F80C3242F2107202FB03F38C -:1015C000DB081C4AA2FB03239B081B4AB2FBF3F374 -:1015D0007B61174B1B68D3F8103242F2107202FB8A -:1015E00003F3DB08134AA2FB03239B08124AB2FB56 -:1015F000F3F3BB6107F1780407F10C030FCB84E828 -:101600000F0007E03B6807F17804186859689A688A -:10161000DB680FC407F11C0318460EF0C7F8C7F8C3 -:101620009000D7F8903018469C37BD4690BD00BF5B -:10163000E40C0020176CC11600A24A0480B586B0E5 -:1016400000AF78603960224B0022C3F80424204B9D -:101650001B6843F040031E4A136000237B617869D6 -:1016600007F04AFD1B4B1B6845F2AA5293421BD15F -:10167000174BD3F8083203F00803002B14D007F0FF -:10168000AFFE144B1B693B617A683B69D31AFB6060 -:1016900007F10C0318460EF0C1FDFB680021184647 -:1016A000FFF720FF786101E021237B61084B0122D5 -:1016B000C3F80424064B1B6823F04003044A13605C -:1016C000786907F019FD7B6918461837BD4680BD5B -:1016D00030380020BC49002080B584B000AF78606D -:1016E0000023FB6011F012FE0346012B02D14FF4E0 -:1016F0008073FB60FB6818461037BD4680BD000054 -:1017000080B59CB000AF7860396000237B6607F13C -:101710000C0358220021184613F08CF80123BB81DA -:101720000423FB8148F239033B8200237B8201239F -:10173000BB827B68314A02FB03F3BB614FF47A73CF -:10174000BB632F4B1B68D3F8B431FB663B68012B9E -:1017500005DC2B4B1B68D3F8B831BB6610E03B6847 -:10176000022B05D1264B1B68D3F8BC31BB6607E0C2 -:101770003B68022B04DD224B1B68D3F8C031BB66EB -:10178000FA6EBB6E9A4201DDBB6EFB66FB6E642295 -:1017900002FB03F3FB63BB6E642202FB03F33B64B7 -:1017A000174B1B68D3F8C831164AB2FBF3F37B64BE -:1017B000134B1B68D3F8CC31124AB2FBF3F3BB6472 -:1017C00000237B65104BBB65104B1B6843F0400347 -:1017D0000E4A136007F10C0318460EF019FC7866E8 -:1017E0000A4B1B6823F04003084A1360786E07F029 -:1017F00083FC7B6E18467037BD4680BDE0930400C5 -:10180000E40C002080FC0A00D916020830380020C1 -:1018100080B5B6B000AF786039600423A7F8D43043 -:101820007B68002B01D10023D2E03B68002B22D142 -:10183000694B1B68D3F8B431642202FB03F3BB602D -:10184000654B1B68D3F8D031642202FB03F3FB60C5 -:10185000614B1B68D3F8C831604AB2FBF3F33B61BC -:101860005D4B1B68D3F8CC315C4AB2FBF3F37B6170 -:1018700007F108033B607B68002B04DA4FF6FF7327 -:10188000A7F8D63009E07B68002B03DD0123A7F819 -:10189000D63002E00023A7F8D63007F11803B422AF -:1018A0000021184612F0C6FF0123BB610023FB6133 -:1018B000B7F8D430DB00D8333B4448F2390223F880 -:1018C000B82CB7F8D430DB00D8333B44002223F8DF -:1018D000B62CBB699BB203F00F039AB2B7F8D430B1 -:1018E00042F4807292B2DB00D8333B4423F8B42C2C -:1018F000B7F8D430DB00D8333B444FF4007223F800 -:10190000B22CB7F8D4300E339B00D8333B447A68FE -:1019100043F8C02C0023BB667B68002BB8BF5B423A -:10192000FB664FF47A733B673B681B687B673B68D9 -:101930001B68BB673B685B68FB673B681B68C7F855 -:1019400080303B689B68C7F884303B689B68C7F869 -:1019500088303B68DB68C7F88C300023C7F89030CC -:101960001F4BC7F898301F4BC7F89C300023C7F8AF -:10197000A0300023C7F8A4300023C7F8A830002304 -:10198000C7F8AC30BB69C7F8B030174BC7F8C030E8 -:10199000164BC7F8BC30164BC7F8B830B7F9D6307D -:1019A0009BB2C7F8C430BB69C7F8C83007F1180349 -:1019B000184609F005FEC7F8D000D7F8943019464C -:1019C000D7F8D0000EF052FCC7F8CC00D7F8CC30D6 -:1019D0001846D837BD4680BDE40C002080FC0A00C4 -:1019E0009D8302083194020889F50108E5F5010894 -:1019F000FFF501080000000080B582B000AF7860FC -:101A00007868EEF7BFFD0AA3D3E90023EEF724FEC2 -:101A100002460B4610461946EFF7CEF803467B60A8 -:101A20007B6818460837BD4680BD00BFAFF3008015 -:101A300060E5D022DBF9204080B584B000AF78604B -:101A40000023FB6011F062FC0346012B02D14FF42E -:101A50008073FB60FB6818461037BD4680BD0000F0 -:101A600080B59CB000AF7860396000237B6607F1D9 -:101A70000C0358220021184612F0DCFE0123BB8122 -:101A80000523FB8148F201033B8201237B82012372 -:101A9000BB827B68314A02FB03F3BB614FF47A736C -:101AA000BB632F4B1B68D3F8B431FB663B68012B3B -:101AB00005DC2B4B1B68D3F8B831BB6610E03B68E4 -:101AC000022B05D1264B1B68D3F8BC31BB6607E05F -:101AD0003B68022B04DD224B1B68D3F8C031BB6688 -:101AE000FA6EBB6E9A4201DDBB6EFB66FB6E642232 -:101AF00002FB03F3FB63BB6E642202FB03F33B6454 -:101B0000174B1B68D3F8C831164AB2FBF3F37B645A -:101B1000134B1B68D3F8CC31124AB2FBF3F3BB640E -:101B200000237B65104BBB65104B1B6843F04003E3 -:101B30000E4A136007F10C0318460EF069FA786636 -:101B40000A4B1B6823F04003084A1360786E07F0C5 -:101B5000D3FA7B6E18467037BD4680BDE093040013 -:101B6000E40C002080FC0A00391A020830380020FA -:101B700080B5B6B000AF786039600523A7F8D430DF -:101B80007B68002B01D10023D2E03B68002B22D1DF -:101B9000694B1B68D3F8B431642202FB03F3BB60CA -:101BA000654B1B68D3F8D031642202FB03F3FB6062 -:101BB000614B1B68D3F8C831604AB2FBF3F33B6159 -:101BC0005D4B1B68D3F8CC315C4AB2FBF3F37B610D -:101BD00007F108033B607B68002B04DA4FF6FF73C4 -:101BE000A7F8D63009E07B68002B03DD0123A7F8B6 -:101BF000D63002E00023A7F8D63007F11803B4224C -:101C00000021184612F016FE0123BB610023FB6180 -:101C1000B7F8D430DB00D8333B4448F2010223F854 -:101C2000B82CB7F8D430DB00D8333B44012223F87A -:101C3000B62CBB699BB203F00F039AB2B7F8D4304D -:101C400042F4807292B2DB00D8333B4423F8B42CC8 -:101C5000B7F8D430DB00D8333B444FF4007223F89C -:101C6000B22CB7F8D4300E339B00D8333B447A689B -:101C700043F8C02C0023BB667B68002BB8BF5B42D7 -:101C8000FB664FF47A733B673B681B687B673B6876 -:101C90001B68BB673B685B68FB673B681B68C7F8F2 -:101CA00080303B689B68C7F884303B689B68C7F806 -:101CB00088303B68DB68C7F88C300023C7F8903069 -:101CC0001F4BC7F898301F4BC7F89C300023C7F84C -:101CD000A0300023C7F8A4300023C7F8A8300023A1 -:101CE000C7F8AC30BB69C7F8B030174BC7F8C03085 -:101CF000164BC7F8BC30164BC7F8B830B7F9D6301A -:101D00009BB2C7F8C430BB69C7F8C83007F11803E5 -:101D1000184609F055FCC7F8D000D7F8943019469A -:101D2000D7F8D0000EF0A2FAC7F8CC00D7F8CC3024 -:101D30001846D837BD4680BDE40C002080FC0A0060 -:101D40009D8302083194020889F50108E5F5010830 -:101D5000FFF5010880B584B000AF786039607B681A -:101D6000FB727B681B0ABB727B681B0C7B720DF0DD -:101D700007F9F860FB68002B01D0FB6860E097F979 -:101D80000B30002B0DDDFDF707FB0346002B1CD1AC -:101D90002323FB602C4B5B6819462C4813F0BCF9DD -:101DA00013E097F90B30002B0DDAFDF719FB034612 -:101DB000002B0AD12423FB60234B5B681946234880 -:101DC00013F0AAF901E00023FB60FB68002B01D0AF -:101DD000FB6835E097F90A30002B0DDDFDF78EFE2C -:101DE0000346002B1CD12523FB60174B9B6819462B -:101DF000174813F091F913E097F90A30002B0DDA28 -:101E0000FDF7A0FE0346002B0AD12623FB600E4BF4 -:101E10009B6819460E4813F07FF901E00023FB6030 -:101E2000FB68002B01D0FB680AE097F90930002B12 -:101E300005DC97F90930002B01DB0023FB60FB6810 -:101E400018461037BD4680BDBC4900208C9703085A -:101E50009497030880B584B000AF786039600DF0C6 -:101E60009BF8F860FB6818461037BD4680BD00003F -:101E700080B584B000AF7860396008F021FE034679 -:101E8000002B07D10E4813F0E3F94FF48073FB6089 -:101E9000FB6810E00DF08CF8F860FB68002B01D0B7 -:101EA000FB6808E0FCF7FEFEF860FB68002B01D041 -:101EB000FB6800E0FB6818461037BD4680BD00BFD8 -:101EC0004096030880B5BCB000AFF860B9607A6096 -:101ED0003B600023A7F8E8300123A7F8E63003238E -:101EE000A7F8E4300423A7F8E2300523A7F8E03090 -:101EF000FB68002B0ED1BB68002B0BD17B68002B3D -:101F000008D13B68002B05D1D7F8F830002B01D160 -:101F100000232AE2D7F8FC30002B23D13B4B1B686F -:101F2000D3F89031642202FB03F33B61374B1B680B -:101F3000D3F89831642202FB03F37B61334B1B68B7 -:101F4000D3F89C31324AB2FBF3F3BB612F4B1B68D1 -:101F5000D3F8A0312E4AB2FBF3F3FB6107F1100373 -:101F6000C7F8FC30FB68002B03DAFF2387F8EF305B -:101F700009E0FB68002B03DD012387F8EF3002E066 -:101F8000002387F8EF30BB68002B03DAFF2387F8C4 -:101F9000EE3009E0BB68002B03DD012387F8EE304B -:101FA00002E0002387F8EE307B68002B03DAFF2382 -:101FB00087F8ED3009E07B68002B03DD012387F80B -:101FC000ED3002E0002387F8ED303B68002B03DAA8 -:101FD000FF2387F8EC3009E03B68002B03DD012389 -:101FE00087F8EC3002E0002387F8EC30D7F8F830BF -:101FF000002B03DAFF2387F8EB300EE0D7F8F83038 -:10200000002B07DD012387F8EB3006E0E40C00200D -:1020100080FC0A00002387F8EB30B968F868FEF707 -:1020200047F9C7F8DC007B68002BB8BF5B421A4653 -:10203000D7F8DC30934238BF1346C7F8DC303B6832 -:10204000CC4A82FB03129210DB17D31A002BB8BFC5 -:102050005B421A46D7F8DC30934238BF1346C7F8C4 -:10206000DC3007F12003B4220021184612F0E2FB15 -:1020700001233B6200237B62B7F8E830DB00F033DA -:102080003B4448F2390223F8C82CB7F8E830DB00AB -:10209000F0333B44002223F8C62C3B6A9BB203F08A -:1020A0000F039AB2B7F8E83042F4807292B2DB00C4 -:1020B000F0333B4423F8C42CB7F8E830DB00F033AE -:1020C0003B444FF4007223F8C22CB7F8E8300E33CB -:1020D0009B00F0333B44FA6843F8D02CB7F8E63065 -:1020E000DB00F0333B4448F2390223F8C82CB7F840 -:1020F000E630DB00F0333B44002223F8C62C3B6A79 -:102100009BB203F00F039AB2B7F8E63042F4807244 -:1021100092B2DB00F0333B4423F8C42CB7F8E6302E -:10212000DB00F0333B444FF4007223F8C22CB7F8C5 -:10213000E6300E339B00F0333B44BA6843F8D02CB2 -:10214000B7F8E430DB00F0333B4448F2390223F8BF -:10215000C82CB7F8E430DB00F0333B44002223F80E -:10216000C62C3B6A9BB203F00F039AB2B7F8E43077 -:1021700042F4807292B2DB00F0333B4423F8C42C6B -:10218000B7F8E430DB00F0333B444FF4007223F83F -:10219000C22CB7F8E4300E339B00F0333B447A682E -:1021A00043F8D02CB7F8E230DB00F0333B4448F280 -:1021B000390223F8C82CB7F8E230DB00F0333B4497 -:1021C000002223F8C62C3B6A9BB203F00F039AB29D -:1021D000B7F8E23042F4807292B2DB00F0333B4455 -:1021E00023F8C42CB7F8E230DB00F0333B444FF463 -:1021F000007223F8C22CB7F8E2103B685D4A82FBFC -:1022000003029210DB17D21A01F10E039B00F03388 -:102210003B4443F8D02CB7F8E030DB00F0333B44CC -:1022200048F2010223F8C82CB7F8E030DB00F033A5 -:102230003B44012223F8C62C3B6A9BB203F00F03F8 -:102240009AB2B7F8E03042F4807292B2DB00F03319 -:102250003B4423F8C42CB7F8E030DB00F0333B44B8 -:102260004FF4007223F8C22CB7F8E0300E339B0015 -:10227000F0333B44002243F8D02C00233B67D7F8CF -:10228000DC307B674FF47A73BB67D7F8FC301B6890 -:10229000FB67D7F8FC301B68C7F88030D7F8FC30F4 -:1022A0005B68C7F88430D7F8FC301B68C7F8883003 -:1022B000D7F8FC309B68C7F88C30D7F8FC309B68A7 -:1022C000C7F89030D7F8FC30DB68C7F894300023AB -:1022D000C7F89830284BC7F8A030284BC7F8A4306F -:1022E0000023C7F8A8300023C7F8AC300023C7F894 -:1022F000B0300023C7F8B4303B6AC7F8B830204B81 -:10230000C7F8C8301F4BC7F8C4301F4BC7F8C030E0 -:1023100097F8EB2097F8EC3013435BB2DAB297F9F9 -:10232000ED301B0403F47F031A4397F9EE301B02D0 -:102330009BB21A4397F9EF30DBB21343C7F8CC30A6 -:102340003B6AC7F8D03007F12003184609F038F986 -:10235000C7F8D800D7F89C301946D7F8D8000DF048 -:1023600085FFC7F8D400D7F8D4301846F037BD46FB -:1023700080BD00BF676666669D83020831940208CF -:10238000551D0208551E0208711E020890B5B7B00F -:1023900000AF786039600223A7F8D6300423A7F88D -:1023A000D4303B68002B22D1884B1B68D3F8E43132 -:1023B000642202FB03F3BB60844B1B68D3F8EC314F -:1023C000642202FB03F3FB60804B1B68D3F8F831F7 -:1023D0007F4AB2FBF3F33B617C4B1B68D3F8FC31C3 -:1023E0007B4AB2FBF3F37B6107F108033B6007F123 -:1023F0001803B4220021184612F01CFA0123BB6115 -:102400000023FB61B7F8D630DB00D8333B4448F2F9 -:10241000390223F8B82CB7F8D630DB00D8333B4468 -:10242000002223F8B62CBB699BB203F00F039AB2CB -:10243000B7F8D63042F4807292B2DB00D8333B4416 -:1024400023F8B42CB7F8D630DB00D8333B444FF434 -:10245000007223F8B22CB7F8D6300E339B00D83375 -:102460003B447A6843F8C02C0023FB61B7F8D430B2 -:10247000DB00D8333B4448F2390223F8B82CB7F8D4 -:10248000D430DB00D8333B44002223F8B62CBB69A0 -:102490009BB203F00F039AB2B7F8D43042F48072C3 -:1024A00092B2DB00D8333B4423F8B42CB7F8D430D5 -:1024B000DB00D8333B444FF4007223F8B22C786829 -:1024C000EEF760F84FF03332424BEEF7C5F80246B4 -:1024D0000B46B7F8D44010461946EEF76DFB02469E -:1024E00004F10E039B00D8333B4443F8C02C002377 -:1024F000BB667868EEF746F84FF03332354BEEF7AF -:10250000ABF802460B4610461946EEF755FB03465C -:10251000002BB8BF5B42FB664FF47A733B673B68A6 -:102520001B687B673B681B68BB673B685B68FB6736 -:102530003B681B68C7F880303B689B68C7F88430ED -:102540003B689B68C7F888303B68DB68C7F88C300D -:102550000023C7F89030204BC7F898301F4BC7F8BE -:102560009C300023C7F8A0300023C7F8A430002314 -:10257000C7F8A8300023C7F8AC300023C7F8B03044 -:10258000174BC7F8C030174BC7F8BC30164BC7F80D -:10259000B8300023C7F8C430BB69C7F8C83007F1AA -:1025A0001803184609F00CF8C7F8D000D7F8943093 -:1025B0001946D7F8D0000DF059FEC7F8CC00D7F86F -:1025C000CC301846DC37BD4690BD00BFE40C00207F -:1025D00080FC0A003333F33F9D83020831940208E4 -:1025E000F90902081D0A0208390A020880B5B8B0C4 -:1025F00000AF786039600523A7F8DE300423A7F820 -:10260000DC307B68002B01D100231BE13B68002BF1 -:1026100022D18E4B1B68D3F8B431642202FB03F342 -:10262000BB608A4B1B68D3F8D031642202FB03F3F2 -:10263000FB60864B1B68D3F8C831854AB2FBF3F3C5 -:102640003B61824B1B68D3F8CC31814AB2FBF3F378 -:102650007B6107F108033B607868FFF7CDF903461B -:10266000002BB8BF5B42184601F082FAC7F8D800C9 -:102670007A6813469B0013445B00002BB8BF5B4293 -:102680001A46724B1B68D3F8243302FB03F3714ADA -:10269000A2FB03235B09184601F06AFAC7F8D400CD -:1026A00007F11803B4220021184612F0C3F80123E1 -:1026B000BB610023FB61B7F8DE30DB00E0333B4455 -:1026C00048F2010223F8C02CB7F8DE30DB00E0331B -:1026D0003B44012223F8BE2CBB699BB203F00F03DD -:1026E0009AB2B7F8DE3042F4807292B2DB00E03387 -:1026F0003B4423F8BC2CB7F8DE30DB00E0333B442E -:102700004FF4007223F8BA2CB7F8DE300E339B007A -:10271000E0333B44D7F8D82043F8C82C0023FB61B2 -:10272000B7F8DC30DB00E0333B4448F2390223F8F1 -:10273000C02CB7F8DC30DB00E0333B44002223F848 -:10274000BE2CBB699BB203F00F039AB2B7F8DC3022 -:1027500042F4807292B2DB00E0333B4423F8BC2C9D -:10276000B7F8DC30DB00E0333B444FF4007223F871 -:10277000BA2CB7F8DC300E339B00E0333B44D7F87B -:10278000D42043F8C82CD7F8D820D7F8D4309342B7 -:10279000B8BF1346FB660023BB664FF47A733B67F2 -:1027A0003B681B687B673B681B68BB673B685B6873 -:1027B000FB673B681B68C7F880303B689B68C7F8BD -:1027C00084303B689B68C7F888303B68DB68C7F893 -:1027D0008C300023C7F890301F4BC7F898301F4B40 -:1027E000C7F89C300023C7F8A0300023C7F8A430F6 -:1027F0000023C7F8A8300023C7F8AC300023C7F87F -:10280000B030174BC7F8C030164BC7F8BC30164B6A -:10281000C7F8B8300023C7F8C430BB69C7F8C83060 -:1028200007F11803184608F0CBFEC7F8D000D7F818 -:1028300094301946D7F8D0000DF018FDC7F8CC0039 -:10284000D7F8CC301846E037BD4680BDE40C0020F8 -:1028500080FC0A001F85EB519D8302083194020819 -:10286000F90902081D0A02088D0A0208B0B592B0E3 -:1028700002AFF860B9607A603B60764B0022C3F823 -:102880000424744B1B6843F04003724A1360002316 -:10289000FB63F86B06F030FC6F4B1B68D3F82831F4 -:1028A0003B636D4B1B68D3F83031FB626A4B1B688E -:1028B000D3F82C31BB62684B1B68D3F834317B6290 -:1028C000664B1B6845F2AA52934240F0AD80614BC3 -:1028D000D3F8083203F00303032B40F0A5805D4BCF -:1028E000D3F8083203F00803002B00F09D80FA684B -:1028F0003B6B9A420BDBFA68BB6A9A4207DCBA6808 -:10290000FB6A9A4203DBBA687B6A9A4207DDBA68BF -:10291000F968534812F000FC2223FB6387E006F0BD -:102920005FFD4E4B5B68FA68D31A3B624B4B9B686A -:10293000BA68D31AFB61BB6D012B50D13B6A494A7F -:1029400082FB03129210DB17D21A3B6A454981FBC6 -:1029500003018910DB17CB1A03FB02F2FB69414923 -:1029600081FB03018910DB17C91AFB693D4880FB15 -:1029700003408010DB17C31A01FB03F3134418460E -:10298000EDF700FE02460B4643EC102B14F0AEFFB1 -:1029900055EC104B304B1B68D3F824331846EDF739 -:1029A000E1FD02460B4620462946EDF755FE02465C -:1029B0000B46104619464FF000022B4BEDF776FF01 -:1029C00002460B4610461946EEF7F6F80346BB637F -:1029D000BA6B13469B0013445B00BB6303E0002308 -:1029E000BB6300237B631D4B1B69BB617A68BB69BA -:1029F000D31A7B6107F1140318460DF00FFC3B6AF4 -:102A0000002B05D1FB69002B02D17B69002B0ED076 -:102A10007A697B6D01937B6B0093BB6BF969386AB4 -:102A2000FFF750FAF86302E02123FB6300E000BFE8 -:102A3000084B0122C3F80424064B1B6823F0400313 -:102A4000044A1360F86B06F057FBFB6B18464037DF -:102A5000BD46B0BD30380020E40C0020BC49002049 -:102A6000C0950308676666660000594000000000D4 -:102A7000B0B584B000AF78607868EDF783FD0246AA -:102A80000B46C7E902232BA3D3E90023D7E90201B0 -:102A9000EDF7E2FD02460B461046194625A3D3E9A1 -:102AA0000023EDF703FF02460B461046194623A309 -:102AB000D3E90023EDF7FAFE02460B46104619460D -:102AC0004FF000024FF08043EDF7F0FE02460B4658 -:102AD00014461D464FF000024FF00003D7E90201F3 -:102AE000EEF74AF80346002B03D04FF000000E49E2 -:102AF00002E04FF000000D494FF000020C4BEDF7E3 -:102B0000ABFD02460B4620462946EDF7EFFB024699 -:102B10000B4610461946EEF74FF803461846103795 -:102B2000BD46B0BDAFF300800000F03F0000F0BF35 -:102B30000000E03F000000000088C340182D44540E -:102B4000FB21094090B593B004AFF860B9607A609A -:102B50003B6000237B633F4812F07AFB3E4BD96811 -:102B60003D4BD3F804233C4BD3F808333B4812F0D9 -:102B7000D3FA7B6B002B67D1394B002283F85120AD -:102B800006F02EFC344BD3F80433FB62324BD3F8FF -:102B90000833BB627B68012B03D140F6C4133B634F -:102BA00006E02D4BD3F810331846FFF761FF38636A -:102BB000294BD3F814337B62274BD3F818333B628D -:102BC000274B5B6A012B01D101233B60BB68002BC3 -:102BD00020D1244B1B68D3F89031642202FB03F30D -:102BE0003B61204B1B68D3F89831642202FB03F34E -:102BF0007B611C4B1B68D3F89C311B4AB2FBF3F37F -:102C0000BB61184B1B68D3F8A031174AB2FBF3F332 -:102C1000FB6107E0BB6807F11004186859689A68FF -:102C2000DB680FC43B68029307F1100301933B6A12 -:102C300000937B6A3A6BB96AF86AFFF717FE78630C -:102C4000074B012283F851207B6B18463C37BD4669 -:102C500090BD00BF9C97030830380020B097030850 -:102C60009C370020E40C002080FC0A0080B58CB06A -:102C700004AF786039600023FB61FB69002B46D10B -:102C800006F0AEFB244BD3F80433BB61224BD3F8E0 -:102C900008337B61204BD3F810331846FFF7E8FE6A -:102CA00038611D4BD3F81433FB601B4BD3F818333A -:102CB000BB601A4B002283F851203B68002B12D0D6 -:102CC000174B5B68BA699A420DD1154B9B687A69BC -:102CD0009A4208D1124B1B693A699A4203D1104BB0 -:102CE0005B69FA689A42FB69002B0CD100230293BE -:102CF00000230193BB680093FB683A697969B8695E -:102D0000FFF7B4FDF861054B012283F85120FB6900 -:102D100018462037BD4680BD303800209C37002043 -:102D2000BC49002080B500AF07F0B8F90A4B1B681A -:102D3000002B0BD1094B1B68D3F88C32064A536128 -:102D4000054B5B691946064812F0E6F9024B012271 -:102D50001A6000BF80BD00BF9C370020E40C00203B -:102D6000D897030880B483B000AF00237B607B68F2 -:102D7000002B07D1204B1B6803F00203002B01D16D -:102D800007237B607B68002B08D11B4BD3F80032F4 -:102D900045F2AA52934201D016237B607B68002B38 -:102DA00023D1164B1B6845F2AA5293421BD1124BFA -:102DB000D3F8083203F00103002B14D00E4BD3F8E4 -:102DC000083203F00203002B0DD00B4BD3F808326E -:102DD00003F00403002B06D0074BD3F8083203F0AE -:102DE0000803002B01D121237B607B6818460C3738 -:102DF000BD465DF8047B704730380020BC49002098 -:102E000080B586B000AF3A4B0022C3F80023384BA0 -:102E10000022C3F80423364B0022C3F80823344BA6 -:102E20000022C3F81023324B0022C3F81423304B86 -:102E30000022C3F818230EF04BFB0346012B24D1CC -:102E40002C4B5B699A6C2C4B1B68D3F89832D31AC5 -:102E5000274AC2F80433274B5B69DA6C264B1B68A0 -:102E6000D3F89C32D31A224AC2F80833214B5B694B -:102E70001B6D1F4AC2F810331D4BDB6818460EF05D -:102E800039FB0346012B0DD002E04FF0FF332BE05E -:102E9000174B0022DA60164BDB68154AC2F81C316A -:102EA00005F0ACFA00237B6111E03B461A467969D4 -:102EB00000200DF0C7FC38613B69002B0DD13B466B -:102EC0000121184600F01AF87B6901337B61084B39 -:102ED000DB687A699A42E8D300E000BF044B45F210 -:102EE000AA52C3F80023002318461837BD4680BDF8 -:102EF00030380020D8490020E40C002080B483B092 -:102F000000AF786039607B68002B62D03B68012B92 -:102F100003D03B68B3F1FF3F5BD17B681B78022B8A -:102F20000BD07B681B78212B07D07B681B78052B87 -:102F300003D07B681B78232B4CD1294BD3F8042377 -:102F40007B68B3F902301BB219463B6801FB03F3FF -:102F50001344234AC2F80433214BD3F808237B6877 -:102F6000B3F904301BB219463B6801FB03F3134469 -:102F70001B4AC2F808331A4BD3F810237B68B3F905 -:102F800006301BB219463B6801FB03F31344144A95 -:102F9000C2F81033124BD3F814237B68B3F9023014 -:102FA0001BB219463B6801FB03F313440C4AC2F8F9 -:102FB00014330B4BD3F818237B68B3F904301BB2DE -:102FC00019463B6801FB03F31344054AC2F8183362 -:102FD00000E000BF0C37BD465DF8047B704700BFC2 -:102FE0003038002080B584B002AF00237B607B685E -:102FF000002B06D10EF06CFA0346012B01D04023C2 -:103000007B607B68002B31D1424B5B699A6D414BF1 -:103010005B695B6D9A4227DB3E4B5B691A6E3D4BE9 -:103020005B69DB6D9A421FDB3A4B5B699A6C394BEB -:103030005B695B6D9A4217DB364B5B69DA6C354B2B -:103040005B69DB6D9A420FDB324B5B699A6C314BEB -:103050005B699B6D9A4207DC2E4B5B69DA6C2D4BEA -:103060005B691B6E9A4201DD41237B607B68002B0C -:103070004BD1284B5B695A6D274B1B68D3F818312D -:103080009A421ADB234B5B699A6D234B1B68D3F87A -:103090001C319A4211DC1F4B5B69DA6D1E4B1B68B9 -:1030A000D3F820319A4208DB1A4B5B691A6E1A4B2F -:1030B0001B68D3F824319A4227DD164B5B69596DA2 -:1030C000144B5B699A6D134B5B69186E114B5B690E -:1030D000DB6D00930346114812F01EF80E4B1B687F -:1030E000D3F818110C4B1B68D3F81C210A4B1B6832 -:1030F000D3F82401084B1B68D3F820310093034612 -:10310000074812F009F842237B607B6818460837AD -:10311000BD4680BDD8490020E40C00200498030877 -:103120003898030880B5ADF5806D00AF00200EF033 -:103130004FFA0346012B25D1154B5B6903F1400281 -:1031400007F58063A3F58063403311464FF4707236 -:10315000184611F061FB0F4812F07AF80E4812F091 -:1031600077F80EF0ABF83B4618460EF095FA0021C2 -:1031700000200EF01DFA06F0FDF8084812F068F87D -:103180000EF09CF800BF07F58067BD4680BD00BF0C -:10319000D849002070980308849803089C98030875 -:1031A00080B584B000AF786039600BF0E9FEF8605C -:1031B000FCF7F2F80346002B07D1144B5B68194665 -:1031C000134811F0A9FF2323FB60FCF709F903461C -:1031D000002B07D10D4B5B6819460D4811F09CFF81 -:1031E0002423FB60FCF78AFC0346002B01D1252336 -:1031F000FB60FCF7A7FC0346002B01D12623FB60F4 -:10320000FB6818461037BD4680BD00BFBC49002092 -:103210008C97030880B582B000AF00237B607B6889 -:10322000002B06D1FCF7B8F80346002B01D123236D -:103230007B607B68002B06D1FCF7D2F80346002B9D -:1032400001D124237B607B6818460837BD4680BDCA -:1032500080B584B000AF786039600BF09DFEF860F7 -:10326000FB68002B01D0FB680BE007F029FC03464C -:10327000002B05D1054811F0EBFF4FF48073FB6084 -:10328000FB6818461037BD4680BD00BF4096030856 -:1032900080B584B000AF7860396007F011FC034658 -:1032A000002B05D10D4811F0D3FF4FF48073FB6064 -:1032B0000BF07EFEF860FB68002B01D0FB6808E095 -:1032C000FBF7F0FCF860FB68002B01D0FB6800E026 -:1032D000FB6818461037BD4680BD00BF4096030806 -:1032E00090B5ABB000AF786039607B68FB653B6838 -:1032F000BB65BB6D002B02D0FB6D002B02D14FF0E4 -:10330000FF33C5E3BB6D1B6B002B40F09483BB6D9B -:10331000DB68032B00F08F83BB6D00221A62FB6D0C -:103320001B68052B08D0FB6D1B68272B04D0FB6D99 -:103330001B68282B40F07F83BB6D1B69002B02D1DB -:103340000023FB6735E0BB6DD3F84831BB67BB6D2D -:103350001A69BB6DD3F844319A4202D9BB6F5B4204 -:10336000BB67BB6D586BBB6D1B69BA6F194608F024 -:10337000BBF8F867BB6F002B0ADDBB6DD3F8443197 -:10338000FA6F9A420ED9BB6DD3F84431FB6709E05E -:10339000BB6DD3F84431FA6F9A4203D2BB6DD3F8B8 -:1033A0004431FB67BB6D5B68002B02D1BB6DFA6FCC -:1033B0001A6105F035FF03467B65BB6D34334FF46E -:1033C00086720021184611F035FA0023C7F88C30B8 -:1033D0000023C7F8883005F023FF03461C460EF093 -:1033E000A1F803469C4280F0268305F019FF0346AE -:1033F000194607F140031A4600200DF023FAC7F8DA -:10340000A400D7F8A430002B40F00F8397F8402099 -:10341000FB6D1B68DBB29A4240F00383BB6D1B68F7 -:10342000002B0ED0B7F94630002BB8BF5B429BB2E1 -:103430001A46FB6DDB6A9A4203D90123C7F8A43010 -:10344000F9E2FB6D1B68052B1DD1BB6D1B68002BC2 -:103450000ED0B7F94630002BB8BF5B429BB21A467C -:10346000FB6D1B6B9A4203D90123C7F8A430E2E23B -:10347000B7F946309AB2FB6D1B699BB2D31A9BB267 -:103480001BB2A7F84630B7F94230002B08D1B7F984 -:103490004430002B04D1B7F94630002B00F0938262 -:1034A000FB6D1B68282B0FD10023C7F8A030002329 -:1034B000C7F89C300023C7F898300023C7F8943031 -:1034C0000023C7F8903066E0FB6D1B68272B0FD1F7 -:1034D0000023C7F8A0300023C7F89C300023C7F8AA -:1034E00098300023C7F894300023C7F8903052E09A -:1034F000B7F94230C7F8A030B7F94430C7F89C306C -:10350000B7F94630C7F898300023C7F89430B7F8B9 -:103510004830C44AA2FB0323DB089BB21A46C24BC5 -:103520001B68D3F8243302FB03F3C04AA2FB032336 -:103530005B09C7F89030FBF7F1FBC7F8A400B7F8B8 -:1035400048301846FBF708FCC7F8A400B84B93F8BE -:103550004830012B1FD1B64BB3F93E301A46D7F88D -:10356000A0301344C7F8A030B14BB3F940301A462D -:10357000D7F89C301344C7F89C30AD4B002283F839 -:103580004820AB4BB3F93E20A94B5A87A84BB3F95F -:103590004020A74B9A87FB6D5B68B3F1FF3F0ED1CC -:1035A000D7F8A0305B42C7F8A030D7F89C305B4218 -:1035B000C7F89C30D7F898305B42C7F89830D7F8F6 -:1035C0009830002B05D0D7F89800FFF751FAC7F8CC -:1035D0009800D7F8A030002BB8BF5B429BB2C3F372 -:1035E0000E03A7F88630D7F89C30002BB8BF5B429B -:1035F0009BB2C3F30E03A7F88430D7F89830002BA2 -:10360000B8BF5B429BB2C3F30E03A7F88230D7F872 -:103610009430002BB8BF5B429BB2C3F30E03A7F8F4 -:103620005230D7F89030002BB8BF5B429BB2C3F347 -:103630000E03A7F88030D7F8A030002B07DAB7F8D0 -:1036400086306FEA43436FEA5343A7F88630D7F8D2 -:103650009C30002B07DAB7F884306FEA43436FEAF7 -:103660005343A7F88430D7F89830002B07DAB7F81F -:1036700082306FEA43436FEA5343A7F88230D7F8AA -:103680009430002B07DAB7F852306FEA43436FEA01 -:103690005343A7F85230D7F89030002B07DAB7F829 -:1036A00080306FEA43436FEA5343A7F88030B7F89E -:1036B0004830C7F88C30D7F88C2013469B00134451 -:1036C000C7F88C30D7F89830002BB8BF5B42C3F3F3 -:1036D0000E03D7F88C209A420BDAD7F89830002BDB -:1036E000B8BF5B42C3F30E03C7F88C300123C7F8A1 -:1036F0008830BB6D34334FF486720021184611F0C8 -:1037000099F8BB6DB7F88620A3F88020BB6DB7F899 -:103710008420A3F8A020BB6DB7F88220A3F8E02096 -:10372000FB6D1B68052B1AD107F03AFA0346002BF4 -:103730000CD1B7F880203C4B1B68D3F82433B2FB84 -:10374000F3F39AB2BB6DA3F8002104E0BB6DB7F8A8 -:103750008020A3F80021BB6D0022A3F82021D7F818 -:103760008C20BB6D5A63BB6D0122A3F84420D7F8AF -:103770008C20BB6D9A66BB6D0122A3F84620D7F85A -:103780008C20BB6DDA66BB6D0122A3F84C20D7F804 -:103790008C20BB6D9A67BB6D0122A3F84E20D7F831 -:1037A0008C20BB6DDA67BB6D0122A3F84A20D7F8E5 -:1037B0008C20BB6D5A67BB6D9B69002B40F0FD8070 -:1037C000D7F8A430002B40F0F880BB6D1B69002BAC -:1037D00007D1FB6D9B693B67FB6D5A69BB6D1A6135 -:1037E000DDE000237B6600233B6607F10C03142217 -:1037F0000021184611F01EF8FB6D5969FB6DDB695D -:103800001A46F86F07F0A0FD7867FB6D9B693B6770 -:103810007B6DBB6607F1300310220021184611F0C2 -:1038200009F8B8E0CDCCCCCCE40C00201F85EB51DE -:103830009C370020BB6E0133BB6607F1200407F103 -:1038400030030FCB84E80F0007F130031A46B96E3E -:1038500000200CF0F7FFC7F8A400D7F8A430002B25 -:1038600040F0928097F83020FB6D1B68DBB29A42E3 -:103870006AD13B6E5B00A8333B4433F99C3C1A464B -:103880007B6E9B1A7B66B7F93630002BB8BF5B4264 -:103890009BB21AB23B6E5B00A8333B4423F89C2CCE -:1038A0003B6E5B00A8333B4433F99C3C1A467B6E6D -:1038B00013447B663B6E01333B663B6E092B01DD97 -:1038C00000233B66FB6DDA6A7B6E9A4204D3FB6D84 -:1038D0001A6B7B6E9A4203D2FB6D5B69FB6636E026 -:1038E000B7F92230B7F9322002FB03F3002B07DBD4 -:1038F000B7F92430B7F9342002FB03F3002B20DAA8 -:10390000B7F93630002BB8BF5B429BB21A46FB6D4D -:10391000DB6A9A4203D9FB6D5B69FB6617E0B7F976 -:103920003630002BB8BF5B429BB21A46FB6D1B6B57 -:103930009A4203D9FB6D5B69FB6608E03B6FFB664F -:1039400005E03B6FFB6602E0FB6D5B69FB663A6F6F -:10395000FB6E9A4202D9FB6E3B6720E03B8F1A4612 -:1039600013469B0013441A467B6F934209D93B8F41 -:103970001A4613469B0013441A467B6F9B1A7B67BB -:1039800009E000237B6706E0434811F061FCFB6D12 -:103990005B693B6703E07B6F002B7FF44BAFFB6DF4 -:1039A0005A69BB6DC3F84021BB6D3A6FC3F844211F -:1039B000FB6DDA69BB6DC3F84821BB6D01221A6249 -:1039C000BB6D01221A63FB6D00221A61FB6D5B68FF -:1039D000B3F1FF3F09D105F053FC07F140034FF06D -:1039E000FF311846FFF78AFA13E005F025FC05F0D1 -:1039F00017FC0346194607F140031A4600200CF055 -:103A000021FFC7F8A40007F1400301211846FFF782 -:103A100075FAB7F94230002B0CD1B7F94430002BBE -:103A200008E00123C7F8A43005E0D7F8A4101B482C -:103A300011F072FB00BFBB6D9B69012B03D0BB6D06 -:103A40009B69022B14D1FB6D5A69BB6DC3F84021F1 -:103A5000FB6D5A69BB6DC3F84421FB6DDA69BB6D20 -:103A6000C3F848210E4811F0F3FBBB6D03229A61A5 -:103A7000BB6D9B69032B0AD1BB6D9B68002B06D1E4 -:103A8000BB6D1B6A002B02D0BB6D00221A620023A3 -:103A90001846AC37BD4690BDB4980308CC980308CF -:103AA000E898030880B584B000AFF860B9607A6028 -:103AB000012004F073FCBB68013BBB60BB68002BBA -:103AC00001DA7B6805E0FB6898470346002BEFD1DD -:103AD000002318461037BD4680BD000000000000DE -:103AE00080B584B000AF78607868ECF74BFD024693 -:103AF0000B46C7E90223D7E9020102460B46ECF761 -:103B0000F5FB02460B461046194613A3D3E90023E2 -:103B1000ECF7A2FD02460B461046194610A3D3E966 -:103B20000023ECF799FD02460B46104619460EA3FA -:103B3000D3E90023ECF7BAFE02460B46C7E902239D -:103B4000D7E90201EDF738F803461BB218461037E3 -:103B5000BD4680BDAFF30080182D4454FB210940C1 -:103B6000000000000088C340000000000094E14015 -:103B700080B483B000AF78600A4B1B68D3F8283359 -:103B80007A6803FB02F2074B1B68D3F82C33B2FBB5 -:103B9000F3F37B607B6818460C37BD465DF8047B09 -:103BA000704700BFE40C002090B5ADF5357D00AF47 -:103BB00007F53473A3F533731860002387F8CB320D -:103BC0000023C7F8C4320023C7F8C0320023C7F867 -:103BD000A832FFF7C7F8C7F8CC02FFF7A3FAFBF744 -:103BE000B7FBD7F8CC32002B03D1FFF7FBF9C7F8AE -:103BF000CC02D7F8CC32002B07D0D7F8CC0205F096 -:103C00007BFAD7F8CC3201F0B6BCB34B00229A62F3 -:103C1000B14B002283F83820AF4B002283F84820B4 -:103C2000AD4B022283F85020AC4B1B68D3F84833CD -:103C30001A46A94BDA64A84B012283F85120FBF7FE -:103C400057F8C7F8CC02FFF76DF8D7F8CC32002B45 -:103C500009D1A24B1B68D3F85C3200211846FDF74E -:103C6000FDF8C7F8CC02D7F8CC32002B31D19C4BF1 -:103C7000DB6818460DF03EFC0346012B01D005F031 -:103C800079FB974BDB68002B21D0954BDB6807F164 -:103C90001C02194600200CF0D5FD07F53473A3F57E -:103CA0002D731B78282B09D08D4BDB68013B8C4A88 -:103CB000D3608B4BDB68002B02D0E6E700BF00E04F -:103CC00000BF874BDB681946864811F025FAFFF7DD -:103CD00097F8D7F8CC32002B40F0A88005F0A0FA76 -:103CE0000346194607F14C031A4600200CF0AAFDC2 -:103CF000C7F8A402D7F8A432002B04D040F2031373 -:103D0000C7F8CC3292E00021012006F0CDFD0A2058 -:103D100004F044FB714B1B68D3F85C320021184659 -:103D2000FDF79CF8C7F8CC0205F070FB6C4BD3F89C -:103D300004236D4B5B689A4210DC694BD3F8043363 -:103D40001A46664B1B68D3F85433D31A1A46644B91 -:103D5000C3F80423604B012283F86E20604BD3F834 -:103D60000823614B9B689A4210DC5D4BD3F8083303 -:103D70001A465A4B1B68D3F85833D31A1A46584B75 -:103D8000C3F80823544B012283F86F20D7F8CC32B4 -:103D9000002B08D107F14C00002301220021FEF77F -:103DA000D1FEC7F8CC024C4B93F86E30012B04D0F7 -:103DB000494B93F86F30012B38D1474B93F86E3055 -:103DC000012B10D1464BD3F804331A46434B1B68E2 -:103DD000D3F8543313441A46414BC3F804233E4BE3 -:103DE000002283F86E203C4B93F86F30012B10D1EA -:103DF0003B4BD3F808331A46384B1B68D3F858337B -:103E000013441A46364BC3F80823334B002283F879 -:103E10006F20D7F8CC32002B08D107F14C000023DB -:103E200001220021FEF78EFEC7F8CC0207F15C03E9 -:103E300040220021184610F0FDFC07F13C0310223F -:103E40000021184610F0F6FC254BDB68002B08D04B -:103E5000234BDB68013B07F13C02194600200CF0C4 -:103E6000F1FCD7F8CC32002B2DD107F53473A3F534 -:103E700033731B68032B13D107F53473A3F51D733C -:103E80004FF0FF325A6005F0FBF9C7F8A402D7F8EB -:103E9000A432002B0ADA40F20313C7F8CC3205E053 -:103EA00007F53473A3F51D7301225A6007F53473C7 -:103EB000A3F533731B68022B05D107F53473A3F503 -:103EC0001D7301229A60D7F8CC32002B0ED0D7F8A0 -:103ED000CC3201F050BB00BF9C370020E40C002026 -:103EE0003038002004990308BC490020DF4B1B68D0 -:103EF00043F48253DD4A13600023C7F8A032012344 -:103F0000C7F89C320523C7F898320323C7F89432C8 -:103F10000423C7F8903207F19C034FF4E8720021A4 -:103F2000184610F087FC07F53473A3F50D730122D2 -:103F30001A6007F53473A3F50D7300225A6007F574 -:103F40003473A3F50D72D7F8A032DB00134448F2A6 -:103F500039021A8107F53473A3F50D72D7F8A03230 -:103F6000DB00134400225A8107F53473A3F50D7367 -:103F70001B689BB203F00F039BB243F4807399B2AA -:103F800007F53473A3F50D72D7F8A032DB001344A4 -:103F90000A469A8107F53473A3F50D72D7F8A0325B -:103FA000DB0013444FF40072DA8107F53473A3F594 -:103FB0000D72D7F89C32DB00134448F239021A81A3 -:103FC00007F53473A3F50D72D7F89C32DB00134468 -:103FD00000225A8107F53473A3F50D731B689BB259 -:103FE00003F00F039BB243F4807399B207F5347367 -:103FF000A3F50D72D7F89C32DB0013440A469A8170 -:1040000007F53473A3F50D72D7F89C32DB00134427 -:104010004FF40072DA8107F53473A3F50D72D7F807 -:104020009432DB00134448F239021A8107F53473E5 -:10403000A3F50D72D7F89432DB00134400225A81A5 -:1040400007F53473A3F50D731B689BB203F00F03E0 -:104050009BB243F4807399B207F53473A3F50D72E4 -:10406000D7F89432DB0013440A469A8107F534737B -:10407000A3F50D72D7F89432DB0013444FF40072AD -:10408000DA8107F53473A3F50D72D7F89032DB00AF -:10409000134448F239021A8107F53473A3F50D72FF -:1040A000D7F89032DB00134400225A8107F53473AD -:1040B000A3F50D731B689BB203F00F039BB243F48F -:1040C000807399B207F53473A3F50D72D7F8903267 -:1040D000DB0013440A469A8107F53473A3F50D7289 -:1040E000D7F89032DB0013444FF40072DA8107F501 -:1040F0003473A3F50D72D7F89832DB00134448F2FD -:1041000001021A8107F53473A3F50D72D7F89832BE -:10411000DB00134401225A8107F53473A3F50D73B4 -:104120001B689BB203F00F039BB243F4807399B2F8 -:1041300007F53473A3F50D72D7F89832DB001344FA -:104140000A469A8107F53473A3F50D72D7F89832B1 -:10415000DB0013444FF40072DA8107F53473A3F5E2 -:104160000D73434AC3F8942107F53473A3F50D7317 -:10417000404AC3F8982107F15C0207F53473A3F5B0 -:104180000D73C3F89C2107F53473A3F50D733A4AF8 -:10419000C3F8A02107F53473A3F50D730022C3F80B -:1041A000A42107F53473A3F50D730022C3F8A821E9 -:1041B00007F53473A3F50D730022C3F8AC2107F1A2 -:1041C0005C0207F53473A3F50D73C3F8B02107F54E -:1041D0003473A3F50D730022C3F8B42107F53473CB -:1041E000A3F50D730022C3F8B82107F53473A3F5C6 -:1041F0000D73224AC3F8BC2107F53473A3F50D7380 -:104200001F4AC3F8C02107F53473A3F50D731D4A87 -:10421000C3F8C42107F15C0207F53473A3F50D73ED -:10422000C3F8C82107F53473A3F50D730022C3F852 -:10423000CC210023C7F8CC3204F0F2FF0346194624 -:1042400007F14C031A4600200CF0FCFAC7F8A40250 -:1042500007F53473A3F521731B78282B14D107F5C8 -:104260003473A3F5217305221A700DE03038002055 -:104270009D830208E132020831940208913202085B -:1042800051320208A131020804F0CAFF03461C465D -:104290000DF048F903469C4214D204F0C1FF0346D6 -:1042A000194607F14C031A4600200CF0CBFAC7F868 -:1042B000A402D7F8A432002B08D040F20313C7F8A9 -:1042C000CC3203E04FF48273C7F8CC32D7F8CC324B -:1042D000002B0FD007F53473A3F533731B68032B42 -:1042E00003D104F0A9FFC7F8A4028F4810F0B0FF73 -:1042F00001F0AFB807F53473A3F525731A7807F505 -:104300003473A3F521731B789A4200F0458207F5B8 -:104310003473A3F525731B78052B07D107F5347388 -:10432000A3F521731B78272B00F0368207F5347331 -:10433000A3F521731B78052B07D107F53473A3F57B -:1043400025731B78272B00F0278207F53473A3F51C -:1043500025731B7887F8CB3207F53473A3F52573E3 -:104360001B78052B06D007F53473A3F525731B784E -:10437000272B47D16D4B1B6A012B43D10121012013 -:1043800006F092FA4FF4967004F008F805F094FDE8 -:104390004FF4407241F288316548FFF783FBC7F85C -:1043A000CC0205F0CBFDC82003F0F8FFD7F8CC32E3 -:1043B000002B09D15F4B1B68D3F85C3200211846F3 -:1043C000FCF74CFDC7F8CC02D7F8CC32002B01D15A -:1043D00005F0CAFD554B00221A62D7F8CC32002BEB -:1043E00005D0D7F8CC0204F087FE01F032B84F4B6D -:1043F0000022DA874D4B0022A3F840204B4B0122CC -:1044000083F8602007F53473A3F525731B78282BF8 -:1044100040F09480454BDB69012B40F08F80434B8B -:10442000DB6A012B18D12F2241F288314248FFF775 -:1044300039FBC7F8CC02D7F8CC32002B0CD1C820FE -:1044400003F0ACFF05F0D2FDC82003F0A7FF05F094 -:10445000E3FD642003F0A2FFD7F8CC32002B59D142 -:10446000324BDB6A012B0FD1324B1B68D3F8383348 -:1044700000211846FEF7BAF8C7F8CC022B4B0022F1 -:10448000DA622A4B00221A63D7F8CC32002B41D1D2 -:104490000021012006F008FAC82003F07FFF05F094 -:1044A00037FD05F009FDC82003F078FF05F088FD11 -:1044B0004FF4FA7003F072FF1C4B93F86030012B3D -:1044C0001AD11A4B002283F86020184B5B6E174AF2 -:1044D000916E00221846FCF7FBF8C7F8CC02D7F81B -:1044E000CC32002B05D0D7F8CC0204F005FE00F04A -:1044F000B0BF642003F052FF0C4B1B6B012B09D1A2 -:104500000C4B1B68D3F8603200211846FCF7A6FC60 -:10451000C7F8CC02D7F8CC32002B0FD0D7F8CC029A -:1045200004F0EAFD00F095BF2C9903089C370020A9 -:10453000F9AA0208E40C0020BDAB020807F53473A9 -:10454000A3F521731B78282B40F0BC80CB4B0122B4 -:10455000DA61002140F6C410FDF770F8C7F8CC020C -:10456000D7F8CC32002B09D105F0FEFC2F2241F206 -:104570008831C348FFF796FAC7F8CC02D7F8CC3297 -:10458000002B35D1BF4B1B68D3F85C320021184695 -:10459000FCF764FCC7F8CC02D7F8CC32002B21D151 -:1045A00005F024FD4FF4967003F0F8FE06F006FBCC -:1045B0000346002B01D105F0EDFC4FF42F7003F002 -:1045C000EDFE05F08FFC4FF42F7003F0E7FE40F294 -:1045D000013241F28831AC48FFF764FAC7F8CC02E7 -:1045E00005F01AFD4FF4967003F0D8FE05F04EFC6E -:1045F000D7F8CC32002B10D14FF4407241F2883101 -:10460000A248FFF74FFAC7F8CC020121012006F0BB -:104610004BF94FF4967003F0C1FE984B9B6A012B47 -:1046200028D107F53473A3F521731B891946D7F8F0 -:10463000C032974A82FB03025211DB17D31A994208 -:1046400011DD07F53473A3F521731B891946D7F8DB -:10465000C0328F4A82FB03025211DB179B1A0B44B4 -:10466000C7F8C43202E00023C7F8C432834B0022EB -:104670009A6206E007F53473A3F521731B89C7F826 -:10468000C432D7F8CC32002B12D1824B5B68814AFE -:1046900092681946804810F03FFD784B012283F85C -:1046A00051200021D7F8C402FDF7A0FFC7F8CC02C3 -:1046B000D7F8CC32002B05D0D7F8CC0204F01CFD83 -:1046C00000F0C7BE07F53473A3F521731B78052BE3 -:1046D00062D16C4B1B68D3F848331A46674BDA64D7 -:1046E000664B00225A87654B00229A87D7F8CC3256 -:1046F000002B47D1614B01221A62684BD3F810336B -:104700001846FEF7B5F9034600211846FCF796FF58 -:10471000C7F8CC02D7F8CC32002B07D107F14C03F5 -:1047200000211846FEF7A2FAC7F8CC02D7F8CC321F -:10473000002B16D1534B1B68D3F86032002118466A -:10474000FCF78CFBC7F8CC0205F0F8FBC82003F09F -:1047500025FE05F009FC4FF4967003F01FFE05F0EE -:1047600095FBD7F8CC32002B08D14FF4407241F2C0 -:1047700088314648FFF796F9C7F8CC02012101209D -:1047800006F092F8D7F8CC32002B05D0D7F8CC023F -:1047900004F0B2FC00F05DBE07F53473A3F521739D -:1047A0001B78272B0AD105F0C9FBC82003F0F6FDC2 -:1047B00005F0DAFB4FF4967003F0F0FD07F5347363 -:1047C000A3F5257207F53473A3F5217314460FCBB7 -:1047D00084E80F0004F024FDC7F88C02D7F88C326F -:1047E000C7F8BC320023C7F8B832D7F8B832013363 -:1047F000C7F8B83207F53473A3F51D735B68012B56 -:1048000005D1D7F8BC320133C7F8BC3210E007F548 -:104810003473A3F51D735B68B3F1FF3F08D1D7F87C -:10482000BC32002B04D0D7F8BC32013BC7F8BC32F5 -:104830000CF078FE0246D7F8BC329A421AD9D7F863 -:10484000BC3207F12C02194600200BF0FBFFC7F821 -:10485000A402D7F8A432002B0ED107F53473A3F5C8 -:1048600021731A7807F53473A3F529731B789A42DC -:1048700016D1BAE700BF14E000BF12E09C37002059 -:10488000BDAB0208E40C002015AB0208DDAA02084B -:104890001F85EB51BC4900204499030830380020A3 -:1048A00000BF07F53473A3F50D7300225A6007F5B6 -:1048B0003473A3F521731B781A4607F53473A3F5F7 -:1048C0001D731A6007F53473A3F51D7300225A6334 -:1048D00007F53473A3F51D73D7F8B8229A6307F16F -:1048E0009C0338334FF4A672002118460FF0A2FF44 -:1048F00007F53473A3F521731B78052B07D007F553 -:104900003473A3F521731B78282B40F09880B24BA9 -:104910001B68D3F8D4314FF4FA7203FB02F207F5A7 -:104920003473A3F51D735A61AB4B1B68D3F8D831B0 -:104930004FF4FA7203FB02F207F53473A3F51D730B -:104940009A61A54B1B68D3F8DC31A44AB2FBF3F2A1 -:1049500007F53473A3F51D73DA619F4B1B68D3F819 -:10496000DC319E4AB2FBF3F207F53473A3F51D73F5 -:104970001A6207F53473A3F51D731B6A232B06D83F -:1049800007F53473A3F51D7324221A620DE007F5B1 -:104990003473A3F51D731B6A914A934205D907F539 -:1049A0003473A3F51D738E4A1A6207F53473A3F5A9 -:1049B0001D738B4A5A62884B1B68D3F8E031184646 -:1049C000FFF78EF803461A4607F53473A3F51D73F7 -:1049D000DA62814B1B68D3F864321846FFF780F81F -:1049E00003461A4607F53473A3F51D731A637A4B11 -:1049F0001B68D3F8D4314FF4FA7203FB02F207F5C7 -:104A00003473A3F50D73C3F88821734B1B68D3F877 -:104A1000DC31724AB2FBF3F207F53473A3F50D7380 -:104A2000C3F88C216C4B1B68D3F8A0316B4AB2FBE6 -:104A3000F3F207F53473A3F50D73C3F89021664BB9 -:104A40001B68D3F824321846EBF78CFD4FF00002B8 -:104A5000644BEBF701FE02460B46104619464FF039 -:104A60000002614BEBF7F8FD02460B461046194673 -:104A7000ECF7CAF8024607F53473A3F51D739A6282 -:104A800007F19C03184608F017F9C7F8A40204F0D0 -:104A9000C7FBC7F8BC02D7F8BC22D7F88C329A42C1 -:104AA00007DAD7F88C22D7F8BC32D31AC7F8B83255 -:104AB00006E0D7F8BC22D7F88C32D31AC7F8B83240 -:104AC000D7F8B832C7F8BC3207F53473A3F50D73C5 -:104AD000DB6BD7F8BC229A424DDD07F53473A3F5A2 -:104AE0001D735B68012B1DD1404BDB6807F12C0265 -:104AF000194600200BF0A6FEC7F8880207F12C0328 -:104B00004FF0FF311846FEF7F9F904F0B9FBC7F88A -:104B10008802D7F88832002B28DA40F20313C7F84E -:104B2000CC3223E007F53473A3F51D735B68B3F152 -:104B3000FF3F1BD12D4BDB6807F12C0219460020EB -:104B40000BF080FEC7F8880207F12C0301211846FC -:104B5000FEF7D4F904F070FBC7F88802D7F8883262 -:104B6000002B03DA4FF48273C7F8CC32D7F8BC328B -:104B7000013BC7F8BC32D7F8CC32002B0BD107F57C -:104B80003473A3F50D735B6D1946D7F8A4020BF0CF -:104B90006DFBC7F8CC0207F53473A3F521731B78BE -:104BA000022B40F09583124B002283F8512005F030 -:104BB00083F94FF4407241F288310E48FEF772FFDC -:104BC000C7F8CC02D7F8CC32002B15D0D7F8CC02DE -:104BD00004F092FA00F03DBCE40C002080320200A8 -:104BE00040190100000059400000144030380020F6 -:104BF0009C370020F9AA02080023C7F8B432BC4B46 -:104C00005B68C7F88432BA4B9B68C7F88032D7F824 -:104C1000CC32002B49D104F003FB03461C460CF0B8 -:104C200081FC03469C4242D204F0FAFA034619463C -:104C300007F12C031A4600200BF004FEC7F8A4026B -:104C4000D7F8A432002B34D107F12C03C7F8B432C3 -:104C500007F53473A3F521731A7807F53473A3F5B8 -:104C600029731B789A4226D107F53473A3F5257270 -:104C700007F53473A3F5217314460FCB84E80F00B6 -:104C800007F53473A3F51D735B68012B02D104F0A3 -:104C9000D3FABCE707F53473A3F51D735B68B3F172 -:104CA000FF3FB4D104F0ECFAB1E700BF04E000BF6D -:104CB00002E000BF00E000BFFEF7A2F88D4BD3F882 -:104CC0000433C7F87C328B4BD3F80833C7F87832FB -:104CD00097F8CB32052B04D097F8CB32272B40F036 -:104CE000D48107F53473A3F529731B78282B40F082 -:104CF000CC81814B93F87030012B0ED17D4BD3F8D2 -:104D000004237E4B1B68D3F84C33D31A794AC2F87C -:104D10000433794B002283F87020774B93F871307D -:104D2000012B0ED1734BD3F80823744B1B68D3F8B7 -:104D30005033D31A6F4AC2F808336F4B002283F8FE -:104D40007120D7F87C22D7F88432D01AD7F878228D -:104D5000D7F88032D31A1946FBF7AAFA0346C7F8E8 -:104D6000C032654B01229A62634B0122DA62002352 -:104D700087F8CB32604B01225A6205F087F84FF476 -:104D8000407241F288315E48FEF78CFEC7F8CC02D3 -:104D9000D7F8CC32002B40F06E810121012005F0C4 -:104DA00083FDC82003F0FAFA04F030FB514BD3F82E -:104DB00004234F4B5B689A4204DA4F4BFF2283F87F -:104DC0006C200FE04B4BD3F80423494B5B689A42AD -:104DD00004DD494B012283F86C2003E0464B00229E -:104DE00083F86C20434BD3F80823414B9B689A42CD -:104DF00004DA414BFF2283F86D200FE03D4BD3F8DE -:104E000008233B4B9B689A4204DD3B4B012283F80D -:104E10006D2003E0384B002283F86D20374B1B6870 -:104E2000D3F89031642203FB02F207F53473A3F543 -:104E300031731A60314B1B68D3F8D831642203FBFD -:104E400002F207F53473A3F531735A602B4B1B68DC -:104E5000D3F89C312B4AB2FBF3F207F53473A3F578 -:104E600031739A60254B1B68D3F8A031254AB2FBF9 -:104E7000F3F207F53473A3F53173DA6007F10C012F -:104E800001230022D7F8B402FDF75CFEC7F8CC027C -:104E9000D7F8CC32002B04D0D7F8CC0204F02CF990 -:104EA000D7E2322003F07AFA04F0B0FA124B93F909 -:104EB0006C30012B09D10E4B5A68104B1B68D3F88C -:104EC000683213440C4A536603E0094B5B680A4A94 -:104ED0005366094B93F96D30012B15D1044B9A6839 -:104EE000064B1B68D3F868321344034A93661FE0ED -:104EF000BC490020303800209C370020E40C002002 -:104F0000DDAA020880FC0A00B54B93F96D30B3F1BD -:104F1000FF3F09D1B34B9A68B34B1B68D3F8683293 -:104F2000D31AAF4A936603E0AE4B9B68AC4A9366D4 -:104F3000AB4B00225A6207F53473A3F52173B3F922 -:104F40000230002B03D10023C7F8B03203E04FF04A -:104F5000FF33C7F8B03207F53473A3F52173B3F903 -:104F60000430002B03D10023C7F8AC3203E04FF02C -:104F7000FF33C7F8AC3207F53473A3F52173B3F9E7 -:104F800002301A4607F53473A3F52173B3F90430E0 -:104F900019461046FBF78CF90346C7F8743207F53B -:104FA0003473A3F52173B3F902301A46D7F8B0323F -:104FB00002FB03F307EE903AB8EEE77A8A4B1B68E0 -:104FC000D3F8343307EE903AB8EE676AD7F8743204 -:104FD00007EE903AF8EEE76AC6EE267A67EE277A91 -:104FE000FDEEE77A17EE903AC7F8B03207F5347362 -:104FF000A3F52173B3F904301A46D7F8AC3202FB9B -:1050000003F307EE903AB8EEE77A774B1B68D3F8D4 -:10501000343307EE903AB8EE676AD7F8743207EE89 -:10502000903AF8EEE76AC6EE267A67EE277AFDEE4A -:10503000E77A17EE903AC7F8AC320021012005F06C -:1050400033FCC82003F0AAF90022D7F8AC12D7F835 -:10505000B002FBF7F1F9C7F8CC02D7F8CC32002B3D -:1050600004D0D7F8CC0204F047F8F2E1C82003F0EE -:1050700095F904F021FFD7F8CC32002B00F0238102 -:10508000D7F8CC0204F038F8E3E197F8CB32282BBC -:1050900040F0B08007F53473A3F529731B78282BF3 -:1050A00040F0A880504B1B68D3F85C3200211846B2 -:1050B000FBF7D4FEC7F8CC0204F0A8F94B4BD3F8A9 -:1050C0000423484B5B689A4210DC484BD3F8043306 -:1050D0001A46454B1B68D3F85433D31A1A46434B30 -:1050E000C3F804233E4B012283F86E203F4BD3F8D4 -:1050F00008233C4B9B689A4210DC3C4BD3F80833A6 -:105100001A46394B1B68D3F85833D31A1A46374B13 -:10511000C3F80823324B012283F86F20D7F8CC3232 -:10512000002B08D1002301220021D7F8B402FDF79B -:1051300009FDC7F8CC022A4B93F86E30012B04D03E -:10514000274B93F86F30012B38D1254B93F86E30F5 -:10515000012B10D1254BD3F804331A46224B1B6880 -:10516000D3F8543313441A46204BC3F804231C4B82 -:10517000002283F86E201A4B93F86F30012B10D168 -:105180001A4BD3F808331A46174B1B68D3F8583319 -:1051900013441A46154BC3F80823114B002283F819 -:1051A0006F20D7F8CC32002B08D100230122002138 -:1051B000D7F8B402FDF7C6FCC7F8CC02094B5B6810 -:1051C000084A926819460A480FF0A6FFD7F8CC3271 -:1051D000002B78D0D7F8CC0203F08EFF39E100BF66 -:1051E0009C370020BC490020E40C0020303800200F -:1051F0005C9903080021012005F056FBC82003F04C -:10520000CDF804F003F99F4BD3F804239E4B5B6861 -:105210009A420EDA9B4BD3F804239C4B1B68D3F8BD -:105220004C331344974AC2F80433994B012283F854 -:105230007020944BD3F80823934B9B689A420EDA64 -:10524000904BD3F80823914B1B68D3F85033134489 -:105250008C4AC2F808338E4B012283F87120894BA7 -:10526000D3F810331846FDF703FC03460021184617 -:10527000FCF7E4F9C7F8CC02D7F8CC32002B09D1FF -:10528000824B1B68D3F8603200211846FBF7E6FD1D -:10529000C7F8CC02D7F8CC32002B08D1002300226B -:1052A0000021D7F8B402FDF74DFCC7F8CC02784BCB -:1052B00001221A63D7F8CC32002B04D0D7F8CC02E5 -:1052C00003F01AFFC5E0724B012283F85120A3E0DE -:1052D00007F53473A3F521731B78002B07D007F56E -:1052E0003473A3F521731B78802B40F08980F9F784 -:1052F000FFFCC7F8A402D7F8A432002B57D107F55A -:105300003473A3F533731B68012B50D1604B1B6AB8 -:10531000012B4CD14FF4967003F040F804F0CCFD13 -:105320004FF4407241F288315A48FEF7BBFBC7F890 -:10533000CC02D7F8CC32002B08D10021012005F097 -:10534000B3FA04F011FE642003F028F8D7F8CC3249 -:10535000002B09D14D4B1B68D3F85C320021184655 -:10536000FBF77CFDC7F8CC024FF4407241F2883164 -:105370004948FEF797FBC7F8CC02454B00221A625A -:1053800000F05EFBC7F8A402D7F8A432002B09D1C5 -:105390004FF48273C7F8CC3203F0ECFF3F4B00228E -:1053A0001A802CE0D7F8A432C7F8CC3227E000F0FE -:1053B00047FBC7F8A402D7F8A432002B09D14FF459 -:1053C0008273C7F8CC3203F0D5FF344B00221A8029 -:1053D00003E0D7F8A432C7F8CC32D7F8A432C7F824 -:1053E000CC32D7F8A432002B32D14FF48273C7F8F5 -:1053F000CC3203F0BFFF294B00221A8028E027E0BF -:1054000007F53473A3F5257207F53473A3F52173FB -:1054100014460FCB84E80F00D7F8CC32002B3EF4B3 -:1054200008AFF9F765FC04F031FD194BDB6D012B7A -:1054300006D14FF44173C7F8CC32154B0022DA6520 -:10544000D7F8CC0203F058FE15480FF001FF00E03A -:1054500000BFD7F8CC32002B24D00D4BDB6D012BD5 -:1054600006D14FF44173C7F8CC32094B0022DA65FC -:10547000F9F73EFC04F00AFDD7F8CC0203F03CFE3D -:1054800012E000BF30380020BC490020E40C0020AE -:105490009C370020F9AA0208BDAB0208243800207E -:1054A00078990308F9F724FCD7F8CC32002B10D0F8 -:1054B000D7F8CC3240F2031293420AD0D7F8CC325C -:1054C000B3F5827F05D0D7F8CC3240F20512934273 -:1054D0002CD1F9F70DFC03F0A3FEC7F870020CF015 -:1054E00021F80346C7F86C32D7F8CC32D7F86C22D3 -:1054F000D7F8701222480FF00FFED7F86C32023B3B -:10550000D7F870229A4211DB1E4BDB6901331D4A2A -:10551000D3611C4BDB691B4AC2F8243102F06EFFD9 -:10552000184BDB69194618480FF0F6FDD7F8CC3256 -:1055300040F2031293420AD0D7F8CC32B3F5827FFF -:1055400005D0D7F8CC3240F20512934207D1F9F7D3 -:10555000CFFB03F00FFF00F073FAC7F8CC02094B42 -:105560001B6823F48253074A1360D7F8CC0203F078 -:10557000C3FDD7F8CC32184607F53577BD4690BD48 -:105580008C990308303800207492030880B582B0EB -:1055900000AF00237B60314B00229A612F4B002229 -:1055A000DA612E4B0022DA622C4B00221A622C4B5D -:1055B0001B6843F040032A4A1360002003F09CFD5F -:1055C0000A2002F0EBFE0021012005F06DF904F045 -:1055D000CBFC0123FB70FB78013B032B1DD801A200 -:1055E00052F823F0F5550208FF5502080756020845 -:1055F0000F5602080120FBF761FB78600EE0FBF715 -:1056000093FD78600AE0FAF72DF9786006E04FF034 -:10561000FF30FAF701FD786000E000BF7B6840F2E0 -:105620000112934209D1FB780133FB70642002F030 -:10563000B5FEFB78052B02D0CDE700BF00E000BF30 -:105640002F2241F288310748FEF72CFA78607868FB -:1056500003F052FD00BF0837BD4680BD9C370020D7 -:1056600030380020BDAB020880B582B000AF002307 -:105670007B60244B00229A61224B0022DA60214B8E -:105680009B69204AC2F820311E4BDB681D4AC2F8D4 -:105690001C3102F0B3FE1C4B00229A611A4B00220F -:1056A000DA61194B0022DA62174B00221A62174B9B -:1056B0001B68D3F85C3200211846FBF7CFFB7860FB -:1056C0007B68002B0BD1002140F6C410FBF7B6FF1E -:1056D00078607B68002B02D100F0B2F978607B68BB -:1056E000002B03D0786803F007FD08E07B68002BEF -:1056F00005D14FF485737B60786803F0FDFC0837B3 -:10570000BD4680BD303800209C370020E40C0020CE -:1057100080B483B000AF7860074B1B6803F48253FA -:10572000002B03D0044B0022C3F8302400BF0C37F9 -:10573000BD465DF8047B70473038002080B582B0EC -:1057400000AF00237B60FDF70DFB78607B68002BCA -:105750000BD10BF0BDFE0346012B06D040237B602E -:10576000786803F0C9FC7B6821E003F003FE7B68E6 -:10577000002B12D1104B1B6843F040030E4A1360FC -:10578000002003F0B9FC0A2002F008FE00230022EA -:1057900000210020FDF7D6F97860074B1B6823F045 -:1057A0004003054A1360786803F0A6FC7B6818463E -:1057B0000837BD4680BD00BF3038002080B58AB0B4 -:1057C00004AF00237B61FDF7CDFA78617B69002B84 -:1057D0000BD10BF07DFE0346012B06D040237B61ED -:1057E000786903F089FC7B6958E07B69002B03D161 -:1057F0000020FBF7EFFB78617B69002B44D1294B3C -:105800001B6843F04003274A1360002003F074FC38 -:105810000A2002F0C3FD244B5B691A6C234B1B6802 -:10582000D3F89832D31A3B611F4B5B691B6C194646 -:105830001F480FF071FC1C4B5B695A6C1B4B1B68BB -:10584000D3F89C32D31AFB60174B5B695B6C19462B -:1058500018480FF061FC0023BB6000237B6000232D -:105860003B60F9F745FA78617B69002B0CD1002386 -:105870000293002301933B6800937B68BA68F96840 -:105880003869FCF7F3FF7861064B1B6823F040038F -:10589000044A1360786903F02FFC7B6918461837B7 -:1058A000BD4680BD30380020D8490020E40C0020DF -:1058B000A8990308D499030880B586B000AF0023E7 -:1058C0007B611E4B1B6843F040031C4A13600020A1 -:1058D00003F012FC0A2002F061FD03F081FDFDF7E8 -:1058E00041FA78617B69002B19D103F099FC0346DA -:1058F00019463B461A4600200AF0A4FF38613B696E -:10590000002B05D03B461022002118460EF092FFD6 -:105910003846002300220021FDF714F97861074B77 -:105920001B6823F04003054A1360786903F0E4FB29 -:105930007B6918461837BD4680BD00BF303800204F -:1059400080B58AB004AF00237B610021012004F000 -:10595000ABFF314B1B6843F040032F4A136000201C -:1059600003F0CAFB0A2002F019FD03F039FDFDF730 -:10597000F9F978617B69002B3AD1284B1B68D3F881 -:10598000943203F00103002B05D0244B1B68D3F89D -:1059900098323B6102E0224B5B683B611F4B1B6806 -:1059A000D3F8943203F00203002B05D01B4B1B6885 -:1059B000D3F89C32FB6002E0194B9B68FB60F9F75F -:1059C00097F978610023BB6000237B6000233B6074 -:1059D0007B69002B0CD100230293002301933B68C9 -:1059E00000937B68BA68F9683869FCF73FFF786113 -:1059F000094B1B6823F04003074A13607B69002BA7 -:105A000002D108480FF024FC786903F075FB7B692C -:105A100018461837BD4680BD30380020E40C002001 -:105A2000BC490020009A030880B582B000AF00F0A6 -:105A300007F878607B6818460837BD4680BD0000CF -:105A400080B500AF1E4B1B68D3F89032012B03D1F9 -:105A5000FFF774FE034631E0194B1B68D3F8903210 -:105A6000022B03D1FFF7AAFE034627E0144B1B6865 -:105A7000D3F89032032B20D0114B1B68D3F890320F -:105A8000042B06D10F480FF0E3FBFFF759FF034645 -:105A900014E00B4B1B68D3F89032052B0DD1084B4B -:105AA0001B68D3F8C800064B1B68D3F8CC30002223 -:105AB0001946FAF70DFE034600E00023184680BDA4 -:105AC000E40C0020189A030880B58CB000AF786011 -:105AD0000023FB624E4B0022DA620020FBF77AFAC9 -:105AE000F8624C4B1B6843F040034A4A1360F86A63 -:105AF00003F002FB0A2002F051FC0BF013FD0346F9 -:105B00001A46796844480FF007FB0BF0E1FC0346A6 -:105B1000012B05D041480FF09BFB4023FB6268E05E -:105B20000BF000FD0346002B0BD00BF0FBFC0246F4 -:105B30007B68934207D90BF0F5FC0346013B7B6081 -:105B400001E000237B60334A7B68D3607968344886 -:105B50000FF0E2FA2F4BDB68002B1DD02D4BDB68DA -:105B600007F11802194600200AF06CFE3B7E282B34 -:105B700009D0284BDB68013B264AD360254BDB6804 -:105B8000002B02D0EAE700BF00E000BF214BDB683A -:105B9000194624480FF0C0FA1E4BDB681D4AC2F8B4 -:105BA0001C3102F02BFCFDF72BF9B862BB6A002B0D -:105BB0001FD11D480FF04CFB03F032FB0346194682 -:105BC00007F108031A4600200AF03CFEB862BB6ADF -:105BD000002B03D040F20313FB6207E007F108003B -:105BE000002300220021FCF7ADFFF8620F480FF000 -:105BF0002FFB084B1B6823F04003064A1360F86A2A -:105C000003F07AFAFB6A18463037BD4680BD00BF04 -:105C10009C37002030380020349A0308589A030833 -:105C2000649A030804990308809A0308989A030861 -:105C300080B582B000AF00237B60164B1B6843F435 -:105C40008253144A1360786803F056FA0A2002F06F -:105C5000A5FB104B00229A610F4B00229A610E4B5C -:105C60000022DA610C4B00221A620120FDF79CFF32 -:105C70007860084B1B6823F48253064A13607868E7 -:105C800003F03AFA002003F037FA7B681846083729 -:105C9000BD4680BD303800209C37002080B584B0E0 -:105CA00000AF0346FB80FDF7B5FAF860FB68002BF8 -:105CB00003D0F86803F020FA22E0FB88013B052BB3 -:105CC0001DD801A252F823F0E15C0208E75C02084B -:105CD000FF5C0208F15C0208FF5C0208F95C020844 -:105CE000F9F7C0FD0CE04FF0FF30FAF795F907E047 -:105CF0000120FAF7E3FF03E0FBF716FA00E000BF2C -:105D00001037BD4680BD00BF80B582B000AF0346EE -:105D1000FB800B46BB8013467B800021012004F0F2 -:105D2000C3FDFB88013B152B00F2AE8001A252F8A7 -:105D300023F000BF8D5D0208B35D0208895E020892 -:105D4000D95D0208895E0208FF5D0208895E0208CB -:105D5000895E0208895E0208895E0208895E02087F -:105D6000895E0208895E0208895E0208895E02086F -:105D7000895E0208895E0208895E0208895E02085F -:105D8000255E02084B5E0208715E0208BB88022B8A -:105D900005D17B8819460120F9F75AFB76E0BB88CC -:105DA000012B73D17B8819464FF0FF30F9F750FB78 -:105DB0006CE0BB88022B05D17B8819460120F9F7DE -:105DC00031FF65E0BB88012B62D17B8819464FF01B -:105DD000FF30F9F727FF5BE0BB88012B05D17B88FB -:105DE00019460120FAF792FD54E0BB88022B51D1ED -:105DF0007B8819464FF0FF30FAF788FD4AE0BB88F0 -:105E0000012B05D17B8819460120FBF7B7FA43E047 -:105E1000BB88022B40D17B8819464FF0FF30FBF73F -:105E2000ADFA39E0BB88012B05D17B8819460120EA -:105E3000FBF766FC32E0BB88022B2FD17B8819462A -:105E40004FF0FF30FBF75CFC28E0BB88012B05D14D -:105E50007B8819460120FBF703FE21E0BB88022B5B -:105E60001ED17B8819464FF0FF30FBF7F9FD17E094 -:105E7000BB88012B02D104F0E5F813E0BB88022BAC -:105E800010D104F0F5F80DE000BF0CE000BF0AE00F -:105E900000BF08E000BF06E000BF04E000BF02E072 -:105EA00000BF00E000BF0121012004F0FDFC00BFA5 -:105EB0000837BD4680BD00BF80B584B000AF034643 -:105EC000FB800B46BB8013467B80FDF7A3F9F8608F -:105ED000FB68002B03D0F86803F00EF9D6E000232E -:105EE000FB60FB880D2B3DD00D2BC0F2CC80B3F5B1 -:105EF0008D7F80F2C880B3F5827F40F3C480A3F227 -:105F00000513142B00F2BF8001A252F823F000BF4A -:105F100087600208B75F020887600208ED5F020829 -:105F20008760020809600208775F0208256002089E -:105F300087600208C95F0208895F0208A55F02083E -:105F4000DB5F02086B600208876002088760020856 -:105F5000876002088760020887600208876002087D -:105F600041600208BB88012B02D104F097F88DE054 -:105F700004F0AAF88AE0BB88012B02D104F062F891 -:105F800084E004F075F881E0BB88012B07D103F0B1 -:105F90007DFF642002F002FA04F028F876E004F0B5 -:105FA0003BF873E0BB88012B02D103F09BFF6DE04F -:105FB00003F0AEFF6AE0BB88012B02D104F0C7FFFB -:105FC00064E004F0C4FF61E0BB88012B02D103F060 -:105FD000CBFF5BE003F0B2FF58E0BB88012B02D19E -:105FE00003F054FF52E003F067FF4FE0BB88012B42 -:105FF00007D104F0E3FD0346002B46D103F0CAFFAE -:1060000043E003F0DDFF40E0BB88012B05D1002118 -:1060100042F21070FBF7FCFB38E000211D48FBF753 -:10602000F7FB33E0BB88012B05D1002142F2107051 -:10603000FBF79EFD2AE000211648FBF799FD25E0BD -:10604000BB88012B08D1144B1B68D3F85C320021AC -:106050001846FAF703FF19E00F4B1B68D3F86032BC -:1060600000211846FAF7FAFE10E0BB88012B04D194 -:106070000021C820FBF736FA08E000216FF0C700C6 -:10608000FBF730FA02E000BF00E000BF1037BD466A -:1060900080BD00BFF0D8FFFFE40C002080B582B0C7 -:1060A00000AF03460A46FB801346BB80FB88013BDA -:1060B000042B55D801A252F823F000BFD16002088A -:1060C000F560020819610208616102083D61020879 -:1060D000BB88012B05D14FF44471002005F050F826 -:1060E00040E0BB88022B3DD140F21131002005F089 -:1060F00047F837E0BB88012B05D14FF444710120EC -:1061000005F03EF830E0BB88022B2DD140F2113172 -:10611000012005F035F827E0BB88012B05D14FF4AD -:106120004471012005F02CF820E0BB88022B1DD122 -:1061300040F21131012005F023F817E0BB88012B54 -:1061400005D14FF44471012005F01AF810E0BB8826 -:10615000022B0DD140F21131012005F011F807E0BA -:1061600000BF06E000BF04E000BF02E000BF00E0A7 -:1061700000BF00BF0837BD4680BD00BF80B584B0FA -:1061800000AF786039607B68002B2AD03B68002B19 -:1061900027D03A68796816480EF0BEFF7B681B78F6 -:1061A000002B20D03B681B78002B1CD078680EF0A9 -:1061B000F5FAF86038680EF0F1FAB860FB68002B69 -:1061C00002D1FFF735FD0FE0FB68012B03D1012061 -:1061D000FDF7EAFC08E0FB68022B05D1FFF730FC75 -:1061E00002E000BF00E000BF1037BD4680BD00BF29 -:1061F000AC9A030880B584B000AF786039607B68E2 -:10620000002B00F0B3803B68002B00F0AF803A68B1 -:10621000796859480EF080FF7B681B78002B00F0EE -:10622000A7803B681B78002B00F0A28078680EF0F6 -:10623000B5FAF86038680EF0B1FAB860FB68002B68 -:1062400020D1BB68002B02D1FFF7A0F991E0BB6819 -:10625000012B02D1F9F706FB8BE0BB68022B04D1BE -:106260004FF0FF30F9F7D8FE83E0BB68052B03D170 -:106270000120FAF723FD7CE0BB68062B79D1FAF701 -:1062800053FF76E0FB68652B04D10021B868F9F76D -:10629000E3F96EE0FB68662B04D10021B868F9F7DA -:1062A000B5FD66E0FB68672B04D10021B868FAF7FA -:1062B00027FC5EE0FB68682B04D10021B868FBF77F -:1062C00011F956E0FB68692B04D10021B868FBF78F -:1062D0009FFA4EE0FB686A2B04D10021B868FBF7F7 -:1062E00047FC46E0FB686B2B04D10021B868FCF743 -:1062F0004DF83EE0FB686C2B04D10021B868FCF738 -:1063000075F936E0FB68C92B04D10021B868FAF7AB -:10631000A5FD2EE0FB68CA2B04D10021B868FCF76C -:1063200065F926E0FB68012B0ED1BB68002B05D177 -:10633000012201210120FFF7E7FC1AE001220221DE -:106340000120FFF7E1FC14E0FB68022B11D1BB68D0 -:10635000002B05D1012201210220FFF7D5FC08E026 -:10636000012202210220FFF7CFFC02E000BF00E083 -:1063700000BF1037BD4680BDAC9A030880B586B01B -:1063800000AF786039607B68002B24D03B68002B1D -:1063900021D03A68796813480EF0BEFE7B681B78FE -:1063A000002B1AD03B681B78002B16D078680EF0B3 -:1063B000F5F9786138680EF0F1F93861F8F798FC72 -:1063C000F860FB68002B09D1002239697869FAF777 -:1063D0007FF9F86002E000BF00E000BF1837BD465B -:1063E00080BD00BFAC9A030880B584B000AF786070 -:1063F00039607B68002B10D079680B480EF08CFE5A -:106400007B681B78002B0AD078680EF0C7F9F8601B -:106410000021F868FBF712F902E000BF00E000BFBE -:106420001037BD4680BD00BFC49A030880B582B056 -:1064300000AF7860396015480EF00AFF144B5B68B6 -:10644000194614480EF068FE114B9B681946124815 -:106450000EF062FE0E4B1B69194610480EF05CFEF2 -:106460000B4BDB6819460E480EF056FE084B9B6935 -:1064700019460C480EF050FE054B5B6919460A4858 -:106480000EF04AFE00BF0837BD4680BDD09A030813 -:10649000BC490020E09A0308EC9A0308F89A030824 -:1064A000049B0308109B03081C9B030880B584B061 -:1064B00000AF786039603B68002B00F06D814FF4CD -:1064C0008062002138680EF0B5F90123FB605EE1BF -:1064D000FB68013B0F2B00F2368101A252F823F03A -:1064E00021650208476502086D6502089365020888 -:1064F000A5650208C7650208ED6502081366020873 -:10650000396602085F66020883660208A766020809 -:10651000CB660208EF6602081367020837670208B5 -:1065200004F088FA0346002B03D07B68002B00F0B0 -:106530000C813B6820331A783B68203342F001021B -:10654000D2B21A7001E104F083FA0346002B03D0A3 -:106550007B68002B00F0FB803B6820331A783B6897 -:10656000203342F00202D2B21A70F0E004F07EFA58 -:106570000346002B03D07B68002B00F0EA803B68C9 -:1065800054331A783B68543342F00102D2B21A7085 -:10659000DFE004F079FA0346002B00F0DC807B6832 -:1065A000002BD8E004F07EFA0346002B03D07B6872 -:1065B000002B00F0D2803B681B7843F00103DAB275 -:1065C0003B681A70C9E004F07BFA0346002B03D045 -:1065D0007B68002B00F0C3803B6801331A783B686E -:1065E000013342F00102D2B21A70B8E004F076FA38 -:1065F0000346002B03D07B68002B00F0B2803B6881 -:1066000056331A783B68563342F00102D2B21A7000 -:10661000A7E004F071FA0346002B03D07B68002B3F -:1066200000F0A1803B6856331A783B68563342F03D -:106630000202D2B21A7096E004F06CFA0346002B04 -:1066400003D07B68002B00F090803B6856331A78AB -:106650003B68563342F00402D2B21A7085E004F06F -:1066600067FA0346002B02D07B68002B7FD03B6883 -:1066700056331A783B68563342F00802D2B21A7089 -:1066800075E004F063FA0346002B02D07B68002B10 -:106690006FD03B6856331A783B68563342F010028D -:1066A000D2B21A7065E004F05FFA0346002B02D004 -:1066B0007B68002B5FD03B6856331A783B685633B3 -:1066C00042F02002D2B21A7055E004F05BFA0346A1 -:1066D000002B02D07B68002B4FD03B6856331A78D2 -:1066E0003B68563342F04002D2B21A7045E004F0E3 -:1066F00057FA0346002B02D07B68002B3FD03B6843 -:1067000056331A783B68563362F07F02D2B21A7061 -:1067100035E004F053FA0346002B02D07B68002BCF -:106720002FD03B6857331A783B68573342F0010249 -:10673000D2B21A7025E004F04FFA0346002B22D0A3 -:106740007B68002B1FE000BF1EE000BF1CE000BF05 -:106750001AE000BF18E000BF16E000BF14E000BF61 -:1067600012E000BF10E000BF0EE000BF0CE000BF71 -:106770000AE000BF08E000BF06E000BF04E000BF81 -:1067800002E000BF00E000BFFB680133FB60FB6874 -:10679000102B7FF79DAE00E000BF1037BD4680BDD7 -:1067A000F0B58FB004AF7860396000233B623B6A7C -:1067B0007B627B681B78002B03D078680DF0EEFFBE -:1067C00078623B681B78002B03D038680DF0E6FF39 -:1067D00038627B6A002B01D10AF070FD7B6A0A2BBC -:1067E00033D13B6A002B30DB3B6AFB61F969194806 -:1067F0000EF092FCFB6907F10802194600200AF02E -:1068000021F8B861BB69002B1CD13B7A1C467B7A0E -:106810001D46B7F90A301E46B7F90C301A46B7F9CB -:106820000E3019463B8A184607F108030A330393D2 -:1068300002900191009233462A46214606480EF006 -:106840006BFC02E005480EF003FD00BF2C37BD468F -:10685000F0BD00BF289B03083C9B03087C9B0308FA -:1068600080B584B000AF786039607B68002B6ED053 -:106870003B68002B6BD03A68796839480EF04CFCC5 -:106880007B681B78002B64D03B681B78002B60D0A2 -:1068900078680DF083FFF86038680DF07FFFB8600E -:1068A000FA68BB689A4202D003F05EFB54E0FB68D2 -:1068B000082B50D801A252F823F000BFE16802086B -:1068C000FF680208076902080F69020817690208D1 -:1068D0001F690208276902082F6902084769020830 -:1068E000204B46F2A8121A601F4B4CF250321A602D -:1068F0001E4B1F4A1A601F4B1D4A1A602CE0194A92 -:10690000BB68136028E0184ABB68136024E0174A8C -:10691000BB68136020E0174ABB6813601CE0164A8E -:10692000BB68136018E0154ABB68136014E0FCF7FD -:1069300067FA134BD3F81033114AD268194611483D -:106940000EF0EAFB08E0BB680D4AD36003E000BF2D -:1069500002E000BF00E000BF1037BD4680BD00BFB1 -:10696000AC9A0308CC040020D0040020D4040020FA -:10697000A0860100D8040020DC040020E0040020F0 -:1069800030380020889B030880B584B000AF786061 -:1069900039607B68002B41D03B68002B3ED03A68C1 -:1069A000796821480EF0B8FB7B681B78002B37D044 -:1069B0003B681B78002B33D078680DF0EFFEF86051 -:1069C00038680DF0EBFEB860FB68002B29D1BB687E -:1069D000002B26D1154B3F22C3F80822144B1B680D -:1069E000D3F8C830114AC2F81032114B1B68D3F8E3 -:1069F000CC300E4AC2F814320D4B1B68D3F8D83095 -:106A00000A4AC2F81C320A4B1B68D3F8D030074A36 -:106A1000C2F818320748F8F79DFA02E000BF00E01C -:106A200000BF1037BD4680BDAC9A03083038002047 -:106A3000E40C0020403A002080B582B000AF7860BE -:106A40003960FEF711FE00BF0837BD4680BD00006B -:106A500080B500AF084807F01BFB084807F028FB8B -:106A6000074807F035FB074807F042FB06F0ACFF8C -:106A700007F05CF900BF80BDE4040020E4080020BA -:106A800084D3030884E3030880B500AF054A0649B0 -:106A90000648F0F7D7FE064A06490748F0F7D2FE47 -:106AA00000BF80BDBD6A020804A1030814A1030849 -:106AB000057402081CA103082CA1030880B59EB030 -:106AC00000AF786039607B68002B00F079843B6808 -:106AD000002B00F075843A687968A1480EF01CFB21 -:106AE00000237B6700233B617B681B78002B03D06E -:106AF00078680DF053FE78673B681B78002B03D055 -:106B000038680DF04BFE386100233B670023BB65FE -:106B100003F022F80346A7F86E30B7F86E30DB4377 -:106B2000A7F86E3002F0FCFF0346A7F86C30B7F808 -:106B30006C30DB43A7F86C3003F060FF034687F846 -:106B40006B3097F86B30DB4387F86B3003F064FFF2 -:106B5000034687F86A3097F86A30DB4387F86A3073 -:106B6000012002F0C3FF78667B6EDB437B66022068 -:106B700002F0BCFF38663B6EDB433B6602F0ECFF85 -:106B80000346FB81FA89B7F86E309A4200F096828C -:106B90000123A7F85E3001237B6588E2B7F86E20F9 -:106BA000FB8953409AB2B7F85E3013409BB2002B7A -:106BB00000F06C827B6D013B0F2B00F2698201A219 -:106BC00052F823F0056C0208496C02088F6C020829 -:106BD000D56C02081B6D0208756D0208BB6D0208BA -:106BE000016E0208476E02088D6E0208D36E02081D -:106BF000196F02085F6F0208B56F0208FD6F020887 -:106C000045700208574B3B65574B1B68002B02D061 -:106C1000554B1B683B65FA89B7F85E3013409BB251 -:106C2000002B08D0396F4B1C3B673B6D01224F484E -:106C30000EF072FA2DE2396F4B1C3B673B6D01225F -:106C40004B480EF069FA24E2464BFB64464B1B6846 -:106C5000002B03D0444B1B681433FB64FA89B7F84C -:106C60005E3013409BB2002B08D0396F4B1C3B6742 -:106C7000FB6C02223D480EF04FFA0AE2396F4B1CC2 -:106C80003B67FB6C02223A480EF046FA01E2354BB4 -:106C9000BB64354B1B68002B03D0334B1B68283378 -:106CA000BB64FA89B7F85E3013409BB2002B08D062 -:106CB000396F4B1C3B67BB6C03222C480EF02CFA3F -:106CC000E7E1396F4B1C3B67BB6C032228480EF091 -:106CD00023FADEE1234B7B64234B1B68002B03D09C -:106CE000214B1B683C337B64FA89B7F85E30134054 -:106CF0009BB2002B08D0396F4B1C3B677B6C042286 -:106D00001A480EF009FAC4E1396F4B1C3B677B6CE3 -:106D1000042217480EF000FABBE1124B3B64124B01 -:106D20001B68002B03D0104B1B6850333B64FA895F -:106D3000B7F85E3013409BB2002B08D0396F4B1C64 -:106D40003B673B6C052209480EF0E6F9A1E1396F7B -:106D50004B1C3B673B6C052205480EF0DDF998E1C2 -:106D600034A103084CA103082838002050A10308CF -:106D70006CA103088B4BFB638B4B1B68002B03D070 -:106D8000894B1B686433FB63FA89B7F85E301340A4 -:106D90009BB2002B08D0396F4B1C3B67FB6B062264 -:106DA00082480EF0B9F974E1396F4B1C3B67FB6BFD -:106DB00006227F480EF0B0F96BE17A4BBB637A4B49 -:106DC0001B68002B03D0784B1B687833BB63FA89B0 -:106DD000B7F85E3013409BB2002B08D0396F4B1CC4 -:106DE0003B67BB6B072271480EF096F951E1396F92 -:106DF0004B1C3B67BB6B07226D480EF08DF948E1D9 -:106E0000684B7B63684B1B68002B03D0664B1B6889 -:106E10008C337B63FA89B7F85E3013409BB2002B4A -:106E200008D0396F4B1C3B677B6B08225F480EF024 -:106E300073F92EE1396F4B1C3B677B6B08225C4872 -:106E40000EF06AF925E1574B3B63574B1B68002B4B -:106E500003D0554B1B68A0333B63FA89B7F85E300B -:106E600013409BB2002B08D0396F4B1C3B673B6B28 -:106E700009224E480EF050F90BE1396F4B1C3B676D -:106E80003B6B09224A480EF047F902E1454BFB6291 -:106E9000454B1B68002B03D0434B1B68B433FB628C -:106EA000FA89B7F85E3013409BB2002B08D0396FD7 -:106EB0004B1C3B67FB6A0A223C480EF02DF9E8E0C8 -:106EC000396F4B1C3B67FB6A0A2239480EF024F9E4 -:106ED000DFE0344BBB62344B1B68002B03D0324BDA -:106EE0001B68C833BB62FA89B7F85E3013409BB2A7 -:106EF000002B08D0396F4B1C3B67BB6A0B222B4819 -:106F00000EF00AF9C5E0396F4B1C3B67BB6A0B22D8 -:106F100027480EF001F9BCE0224B7B62224B1B6834 -:106F2000002B03D0204B1B68DC337B62FA89B7F857 -:106F30005E3013409BB2002B08D0396F4B1C3B676F -:106F40007B6A0C2219480EF0E7F8A2E0396F4B1C5F -:106F50003B677B6A0C2216480EF0DEF899E0114B75 -:106F60003B62114B1B68002B03D00F4B1B68F033A7 -:106F70003B62FA89B7F85E3013409BB2002B08D011 -:106F8000396F4B1C3B673B6A0D2208480EF0C4F872 -:106F90007FE0396F4B1C3B673B6A0D2204480EF0C3 -:106FA000BBF876E04CA103082838002050A1030864 -:106FB0006CA10308A54BFB61A54B1B68002B04D0FB -:106FC000A34B1B6803F58273FB61FA89B7F85E3047 -:106FD00013409BB2002B08D0396F4B1C3B67FB69F9 -:106FE0000E229C480EF098F853E0396F4B1C3B671B -:106FF000FB690E2298480EF08FF84AE0934BBB6174 -:10700000934B1B68002B04D0914B1B6803F58C73CA -:10701000BB61FA89B7F85E3013409BB2002B08D0F1 -:10702000396F4B1C3B67BB690F228A480EF074F81E -:107030002FE0396F4B1C3B67BB690F2286480EF06F -:107040006BF826E0814B7B61814B1B68002B04D0E1 -:107050007F4B1B6803F596737B61FA89B7F85E3046 -:1070600013409BB2002B08D0396F4B1C3B677B69E8 -:10707000102278480EF050F80BE0396F4B1C3B673C -:107080007B69102274480EF047F802E000BF00E070 -:1070900000BFB7F85E305B00A7F85E300120EFF765 -:1070A000C9FFBB6D0133BB657B6D01337B657B6DB8 -:1070B000102B7FF773ADFB89A7F86E3002F030FD1F -:1070C0000346FB81FA89B7F86C309A4200F0E08001 -:1070D0000123A7F85E3001237B65D2E0B7F86C206E -:1070E000FB8953409AB2B7F85E3013409BB2002B35 -:1070F00000F0AA807B6D013B052B00F2B38001A25A -:1071000052F823F01D7102084F71020881710208C4 -:10711000B3710208E571020817720208FA89B7F81C -:107120005E3013409BB2002B08D03B6F5A1C3A676D -:107130000122194649480DF0EFFF94E03B6F5A1CBD -:107140003A670122194646480DF0E6FF8BE0FA89BE -:10715000B7F85E3013409BB2002B08D03B6F5A1C2F -:107160003A67022219463D480DF0D6FF7BE03B6F9F -:107170005A1C3A670222194639480DF0CDFF72E0D9 -:10718000FA89B7F85E3013409BB2002B08D03B6FF2 -:107190005A1C3A670322194630480DF0BDFF62E0E1 -:1071A0003B6F5A1C3A67032219462D480DF0B4FF75 -:1071B00059E0FA89B7F85E3013409BB2002B08D033 -:1071C0003B6F5A1C3A670422194624480DF0A4FF6D -:1071D00049E03B6F5A1C3A670422194620480DF0DB -:1071E0009BFF40E0FA89B7F85E3013409BB2002B5A -:1071F00008D03B6F5A1C3A670522194617480DF014 -:107200008BFF30E03B6F5A1C3A6705221946144841 -:107210000DF082FF27E0FA89B7F85E3013409BB289 -:10722000002B08D03B6F5A1C3A67062219460B48C0 -:107230000DF072FF17E03B6F5A1C3A6706221946A1 -:1072400007480DF069FF0EE000BF0CE04CA10308F9 -:107250002838002050A103086CA1030888A1030866 -:10726000A0A1030800BFB7F85E305B00A7F85E304E -:107270000120EFF7DFFEBB6D0133BB657B6D013392 -:107280007B657B6D062B7FF729AFFB89A7F86C30F8 -:1072900003F0B4FB0346FB8197F86B309BB2FA898D -:1072A0009A421AD0FB89002B07D13B6F5A1C3A67D0 -:1072B000194646480DF030FF06E03B6F5A1C3A670E -:1072C000194643480DF028FF0120EFF7B3FEBB6DD0 -:1072D0000133BB65FB8987F86B3003F09DFB0346E8 -:1072E000FB8197F86A309BB2FA899A421AD0FB89DF -:1072F000002B07D13B6F5A1C3A67194635480DF0F1 -:107300000BFF06E03B6F5A1C3A67194632480DF0F6 -:1073100003FF0120EFF78EFEBB6D0133BB65FB89D8 -:1073200087F86A30012002F0E1FBB860BA687B6E32 -:107330009A420FD0BB687B663B6F5A1C3A677A6EE5 -:10734000194626480DF0E8FE0120EFF773FEBB6DED -:107350000133BB65022002F0C9FBB860BA683B6E1E -:107360009A420FD0BB683B663B6F5A1C3A673A6E35 -:1073700019461B480DF0D0FE0120EFF75BFEBB6DF8 -:107380000133BB650A20EFF755FEBB6D0A33BB65C1 -:10739000BB6DB3F5FA7F04DB0023BB65002001F071 -:1073A000ABFEF0F76BFF00200BF0CEFFEFF708FD10 -:1073B0000346002B06D17B6F002B7FF4DFAB02E08E -:1073C00000BF00E000BF7837BD4680BDB8A103080C -:1073D000CCA10308E0A10308F4A1030808A2030854 -:1073E0001CA2030880B483B000AF7860044A7B68B5 -:1073F000136000BF0C37BD465DF8047B704700BFCB -:107400002838002080B598B000AF786039607B687C -:10741000002B00F0B0863B68002B00F0AC863A6889 -:10742000796898480DF078FE0023FB650023BB6562 -:107430007B681B78002B03D078680DF0AFF9F865F6 -:107440003B681B78002B03D038680DF0A7F9B865AE -:10745000FB6D002B40F07D810123BB6001237B6528 -:1074600000233B653B6D002B40F04F8102F024FD73 -:1074700002F04EFD02F078FD02F0A2FD02F0CCFD1C -:1074800002F0F6FD02F020FE02F04AFE7B6D013BA9 -:10749000072B00F2218101A252F823F0BD740208EB -:1074A000FD7402083F75020881750208C375020861 -:1074B000037602084376020899760208724BFB6451 -:1074C000724B1B68002B02D0704B1B68FB64BB68BF -:1074D000002B07D102F0F0FCFA6C01216C480DF092 -:1074E0001BFEFBE0BB68012B40F0F88002F0CEFCF5 -:1074F000FA6C012167480DF00FFEEFE0624BBB64B0 -:10750000624B1B68002B03D0604B1B681433BB64B9 -:10751000BB68002B07D102F0FBFCBA6C02215C486F -:107520000DF0FAFDDCE0BB68012B40F0D98002F0E1 -:10753000D9FCBA6C022157480DF0EEFDD0E0524B59 -:107540007B64524B1B68002B03D0504B1B682833C5 -:107550007B64BB68002B07D102F006FD7A6C032127 -:107560004B480DF0D9FDBDE0BB68012B40F0BA805F -:1075700002F0E4FC7A6C032146480DF0CDFDB1E049 -:10758000414B3B64414B1B68002B03D03F4B1B68B6 -:107590003C333B64BB68002B07D102F011FD3A6C11 -:1075A00004213B480DF0B8FD9EE0BB68012B40F084 -:1075B0009B8002F0EFFC3A6C042136480DF0ACFDE4 -:1075C00092E0314BFB63314B1B68002B03D02F4BF8 -:1075D0001B685033FB63BB68002B07D102F01CFD16 -:1075E000FA6B05212A480DF097FD7FE0BB68012B5F -:1075F0007CD102F0FBFCFA6B052126480DF08CFDD6 -:1076000074E0214BBB63214B1B68002B03D01F4B45 -:107610001B686433BB63BB68002B07D102F028FDF5 -:10762000BA6B06211A480DF077FD61E0BB68012BAB -:107630005ED102F007FDBA6B062116480DF06CFD15 -:1076400056E0114B7B63114B1B68002B03D00F4B93 -:107650001B6878337B63BB68002B07D102F034FDD5 -:107660007A6B07210A480DF057FD43E0BB68012BF8 -:1076700040D102F013FD7A6B072106480DF04CFD56 -:1076800038E000BF34A103084CA103082C380020C7 -:1076900030A2030848A20308A04B3B63A04B1B6821 -:1076A000002B03D09E4B1B688C333B63BB68002BC5 -:1076B00007D102F035FD3A6B08219A480DF02CFDF8 -:1076C0001AE0BB68012B17D102F014FD3A6B0821B8 -:1076D00095480DF021FD0FE000BF0EE000BF0CE06B -:1076E00000BF0AE000BF08E000BF06E000BF04E002 -:1076F00000BF02E000BF00E000BF7B6D01337B658F -:107700007B6D082B01DD01237B65012000F046FE27 -:107710003B6D01333B653B6DB3F57A7F01DD0023A3 -:107720003B65EFF74DFB0346002B3FF49BAE02F0A9 -:10773000C3FB02F0EDFB02F017FC02F041FC02F08B -:107740006BFC02F095FC02F0BFFC02F0E9FC00F0DB -:1077500021BDFB6D002B40F33B81FB6D082B00F33B -:107760003781FB6D013B072B00F2208101A252F80B -:1077700023F000BF95770208D57702081778020832 -:10778000597802089B780208DB7802082D790208F4 -:107790006D790208614BFB62614B1B68002B02D0C4 -:1077A0005F4B1B68FB62BB6D002B07D102F084FBB3 -:1077B000FA6A01215B480DF0AFFCF9E0BB6D012BCB -:1077C00040F0F68002F062FBFA6A012156480DF0A3 -:1077D000A3FCEDE0514BBB62514B1B68002B03D067 -:1077E0004F4B1B681433BB62BB6D002B07D102F0FB -:1077F0008FFBBA6A02214B480DF08EFCDAE0BB6DBC -:10780000012B40F0D78002F06DFBBA6A0221464896 -:107810000DF082FCCEE0414B7B62414B1B68002B9C -:1078200003D03F4B1B6828337B62BB6D002B07D115 -:1078300002F09AFB7A6A03213A480DF06DFCBBE036 -:10784000BB6D012B40F0B88002F078FB7A6A03210F -:1078500035480DF061FCAFE0304B3B62304B1B68AC -:10786000002B03D02E4B1B683C333B62BB6D002BBF -:1078700007D102F0A5FB3A6A04212A480DF04CFC1E -:107880009CE0BB6D012B40F0998002F083FB3A6ACB -:10789000042125480DF040FC90E0204BFB61204B7B -:1078A0001B68002B03D01E4B1B685033FB61BB6D64 -:1078B000002B07D102F0B0FBFA69052119480DF041 -:1078C0002BFC7DE0BB6D012B7AD102F08FFBFA69B6 -:1078D000052115480DF020FC72E0104BBB61104BE8 -:1078E0001B68002B03D00E4B1B686433BB61BB6D60 -:1078F000002B07D102F0BCFBBA69062109480DF044 -:107900000BFC5FE0BB6D012B5CD102F09BFBBA6905 -:10791000062105480DF000FC54E000BF4CA103080F -:107920002C38002030A2030848A20308A64B7B6134 -:10793000A64B1B68002B03D0A44B1B6878337B61DC -:10794000BB6D002B07D102F0BFFB7A690721A0486D -:107950000DF0E2FB38E0BB6D012B35D102F09EFB50 -:107960007A6907219B480DF0D7FB2DE0964B3B61D0 -:10797000964B1B68002B03D0944B1B688C333B61E8 -:10798000BB6D002B07D102F0CBFB3A690821904870 -:107990000DF0C2FB1AE0BB6D012B17D102F0AAFB60 -:1079A0003A6908218B480DF0B7FB0FE000BFF1E307 -:1079B00000BFEFE300BFEDE300BFEBE300BFE9E38F -:1079C00000BFE7E300BFE5E300BFE3E300BFE1E39F -:1079D000FB6D0A2B12D1BB6D002B05D102F027FAEB -:1079E0007D480DF035FCD5E3BB6D012B40F0D28313 -:1079F00002F025FA79480DF02BFCCBE3FB6D142B3C -:107A000012D1BB6D002B05D102F001FA74480DF0C4 -:107A10001FFCBFE3BB6D012B40F0BC8302F0FFF9FC -:107A200070480DF015FCB5E3FB6D152B17D1002345 -:107A3000FB600CE002F0F3F96420EFF7E5FA02F0E6 -:107A4000E6F96420EFF7E0FAFB680133FB60FA68BF -:107A5000BB6D9A42EEDB64480DF0FAFB9AE3FB6DD6 -:107A60001E2B0ED1BB6D002B05D102F0BBFF5F4872 -:107A70000DF0EEFB8EE302F0A9FF5D480DF0E8FB90 -:107A800088E3FB6D282B40F3BB80FB6D2E2B00F3AE -:107A9000B780FB6D283BFB65FB6D013B052B00F2BE -:107AA000878001A252F823F0C17A0208E97A02081D -:107AB000117B0208397B0208617B0208897B02087E -:107AC000BB6D002B06D103F09BF8012149480DF056 -:107AD00023FB6FE0BB6D012B6CD103F088F8012113 -:107AE00045480DF019FB65E0BB6D002B06D103F096 -:107AF000CFF802213F480DF00FFB5DE0BB6D012B7D -:107B00005AD103F0BCF802213B480DF005FB53E0CD -:107B1000BB6D002B06D103F003F9032135480DF0AE -:107B2000FBFA4BE0BB6D012B48D103F0F0F80321C9 -:107B300031480DF0F1FA41E0BB6D002B06D103F0A6 -:107B400037F904212B480DF0E7FA39E0BB6D012B22 -:107B500036D103F024F9042127480DF0DDFA2FE097 -:107B6000BB6D002B06D103F06BF9052121480DF008 -:107B7000D3FA27E0BB6D012B24D103F058F905217E -:107B80001D480DF0C9FA1DE0BB6D002B06D103F0B6 -:107B90009FF9062117480DF0BFFA2FE0BB6D012BAE -:107BA0002CD103F08CF9062113480DF0B5FA25E02D -:107BB00000BFEFE200BFEDE200BFEBE200BFE9E291 -:107BC00000BFE7E200BFE5E24CA103082C3800202B -:107BD00030A2030848A2030860A2030870A20308A9 -:107BE0007CA203088CA2030898A20308A8A2030899 -:107BF000B8A20308C8A20308E0A2030800BFC9E2B4 -:107C0000FB6D322B40F3A280FB6D382B00F39E807E -:107C1000FB6D323BFB65FB6D013B052B00F2888061 -:107C200001A252F823F000BF417C0208697C0208DF -:107C3000917C0208B97C0208E17C0208097D0208F7 -:107C4000BB6D002B06D102F0EDFF0121AC480DF019 -:107C500063FA6FE0BB6D012B6CD102F0DAFF0121FA -:107C6000A8480DF059FA65E0BB6D002B06D103F072 -:107C700021F80221A2480DF04FFA5DE0BB6D012B07 -:107C80005AD103F00EF802219E480DF045FA53E058 -:107C9000BB6D002B06D103F055F8032198480DF079 -:107CA0003BFA4BE0BB6D012B48D103F042F80321B6 -:107CB00094480DF031FA41E0BB6D002B06D103F082 -:107CC00089F804218E480DF027FA39E0BB6D012BAD -:107CD00036D103F076F804218A480DF01DFA2FE022 -:107CE000BB6D002B06D103F0BDF8052184480DF0D3 -:107CF00013FA27E0BB6D012B24D103F0AAF805216C -:107D000080480DF009FA1DE0BB6D002B06D103F091 -:107D1000F1F806217A480DF0FFF915E0BB6D012B53 -:107D200012D103F0DEF8062176480DF0F5F90BE0EC -:107D300000BF2FE200BF2DE200BF2BE200BF29E20F -:107D400000BF27E200BF25E200BF23E2FB6D3C2B12 -:107D500040F3A280FB6D422B00F39E80FB6D3C3B09 -:107D6000FB65FB6D013B052B00F2888001A252F8F8 -:107D700023F000BF8D7D0208B57D0208DD7D02087D -:107D8000057E02082D7E0208557E0208BB6D002B81 -:107D900006D102F059FF01215B480DF0BDF96FE0FB -:107DA000BB6D012B6CD102F046FF012157480DF04D -:107DB000B3F965E0BB6D002B06D102F08DFF022107 -:107DC00051480DF0A9F95DE0BB6D012B5AD102F0CD -:107DD0007AFF02214D480DF09FF953E0BB6D002B57 -:107DE00006D102F0C1FF032147480DF095F94BE0A1 -:107DF000BB6D012B48D102F0AEFF032143480DF0CB -:107E00008BF941E0BB6D002B06D102F0F5FF042198 -:107E10003D480DF081F939E0BB6D012B36D102F000 -:107E2000E2FF042139480DF077F92FE0BB6D002BFC -:107E300006D103F029F8052133480DF06DF927E04C -:107E4000BB6D012B24D103F016F805212F480DF04E -:107E500063F91DE0BB6D002B06D103F05DF8062130 -:107E600029480DF059F915E0BB6D012B12D103F033 -:107E70004AF8062125480DF04FF90BE000BF89E1D3 -:107E800000BF87E100BF85E100BF83E100BF81E162 -:107E900000BF7FE100BF7DE1FB6D462B40F3AE806C -:107EA000FB6D4C2B00F3AA80FB6D463BFB65FB6D25 -:107EB000013B052B00F2948001A252F823F000BF91 -:107EC000D97E0208197F0208417F0208697F0208F3 -:107ED000917F0208B97F0208BB6D002B06D102F02A -:107EE000C5FE01210A480DF017F97BE0BB6D012B9F -:107EF00078D102F0B2FE012106480DF00DF971E0D3 -:107F0000F4A203080CA3030824A303083CA303085A -:107F100054A303086CA30308BB6D002B06D102F029 -:107F2000EDFE02219D480DF0F7F85DE0BB6D012BE1 -:107F30005AD102F0DAFE022199480DF0EDF853E033 -:107F4000BB6D002B06D102F021FF032193480DF0F9 -:107F5000E3F84BE0BB6D012B48D102F00EFF03218B -:107F60008F480DF0D9F841E0BB6D002B06D102F02F -:107F700055FF042189480DF0CFF839E0BB6D012B86 -:107F800036D102F042FF042185480DF0C5F82FE0FC -:107F9000BB6D002B06D102F089FF05217F480DF053 -:107FA000BBF827E0BB6D012B24D102F076FF052141 -:107FB0007B480DF0B1F81DE0BB6D002B06D102F03F -:107FC000BDFF062175480DF0A7F815E0BB6D012B2C -:107FD00012D102F0AAFF062171480DF09DF80BE0C6 -:107FE00000BFD7E000BFD5E000BFD3E000BFD1E0C5 -:107FF00000BFCFE000BFCDE000BFCBE0FB6D502B5A -:1080000040F3C880FB6D562B00F3C480FB6D503BE2 -:10801000FB65FB6D013B052B00F2AF8001A252F81E -:1080200023F000BF3D80020873800208A780020889 -:10803000DB8002080F81020843810208BB6D002B20 -:1080400009D140F21131002003F09AF8012155487E -:108050000DF062F893E0BB6D012B40F090804FF47F -:108060004471002003F08CF801214F480DF054F8C2 -:1080700085E0BB6D002B09D140F21131012003F0E6 -:108080007FF8022147480DF047F87AE0BB6D012BDD -:1080900077D14FF44471012003F072F80221424875 -:1080A0000DF03AF86DE0BB6D002B09D140F21131B3 -:1080B000022003F065F803213A480DF02DF862E044 -:1080C000BB6D012B5FD14FF44471022003F058F8CF -:1080D000032135480DF020F855E0BB6D002B09D188 -:1080E00040F21131032003F04BF804212D480DF02C -:1080F00013F84AE0BB6D012B47D14FF444710320C4 -:1081000003F03EF8042128480DF006F83DE0BB6D71 -:10811000002B09D140F21131042003F031F8052180 -:1081200020480CF0F9FF32E0BB6D012B2FD14FF44A -:108130004471042003F024F805211B480CF0ECFFE7 -:1081400025E0BB6D002B09D140F21131052003F071 -:1081500017F8062113480CF0DFFF1AE0BB6D012B66 -:1081600017D14FF44471052003F00AF806210E4898 -:108170000CF0D2FF0DE000BF0CE000BF0AE000BF32 -:1081800008E000BF06E000BF04E000BF02E000BF5F -:1081900000E000BF6037BD4680BD00BF54A30308A8 -:1081A0006CA3030884A303089CA3030880B483B0D2 -:1081B00000AF7860044A7B68136000BF0C37BD468F -:1081C0005DF8047B704700BF2C38002080B582B07A -:1081D00000AF40F27C42002152480CF02BFB514B87 -:1081E0004FF0FF32C3F840244E4B1B6843F00103AD -:1081F0004C4A13604B4B1B6843F00203494A13601F -:108200004FF4807148480CF087FF0121474805F082 -:1082100059FA444BD3F83431002B03D0414B0022A0 -:10822000A3F8FE213F4BB3F8FE3145F2AA52934228 -:1082300018D04FF4807200213C480CF0FBFA394B07 -:108240000022C3F83421374B45F2AA52A3F8FE218D -:1082500000F0D4F836480CF0FBFF324B0022C3F894 -:10826000082245E0314B7B607B68184602F012FF24 -:1082700001F0B6F82B4B3F22C3F80822294BD3F864 -:108280001C31284AD360274BD3F81831254AD268CD -:10829000194628480CF040FF224BD3F82031214AE0 -:1082A0009361204BD3F824311E4AD3611D4BD3F880 -:1082B00048311C4A13671B4BD3F828311A46194B17 -:1082C0001A65184BD3F82C311A46164B5A65154BC4 -:1082D000D3F83831134A9360124B9B68164A1361E6 -:1082E000104BD3F83C31144AD36014480CF0B0FF63 -:1082F000F6F746FBFEF7C8FB0BF0CCFB38603B689B -:10830000002B03D0074B0122C3F8342400F066F899 -:108310000B4A00214EF66020EFF712FF00BF08372E -:10832000BD4680BD30380020B4A30308303900209A -:10833000CCA30308E8A30308D849002008A4030835 -:10834000C783020880B500AF094BD3F87434002B03 -:1083500003D0074BD3F874349847054BD3F87834DF -:10836000002B03D0024BD3F87834984700BF80BD70 -:108370003038002080B500AF074BD3F87834002B9D -:1083800003D0054BD3F878349847EFF777FF06F022 -:10839000BBFD00BF80BD00BF3038002080B582B07B -:1083A00000AF7860FFF7E6FF7B68002B06D0012066 -:1083B000EEF740FE7B68013B7B60F3E700BF00BF48 -:1083C0000837BD4680BD80B500AF4FF0FF300BF0E1 -:1083D00067FE00F003F800BF80BD000080B400AF6E -:1083E000054B1B6843F00103034A136000BFBD4601 -:1083F0005DF8047B704700BF3038002080B500AFC7 -:108400000121024805F07AF900BF80BD3039002013 -:1084100080B582B000AF78600A4BD3F800227B6849 -:108420001343084AC2F8003207480CF011FF054B0D -:108430001B6843F02003034A136000BF0837BD46A2 -:1084400080BD00BF3038002024A4030880B400AFF2 -:1084500000BFBD465DF8047B704780B485B000AFB7 -:10846000F860B9607A603B60002318461437BD4657 -:108470005DF8047B7047000080B584B000AF786081 -:10848000084611461A460346FB700B46BB7013465E -:108490007B707B68002B02D0BB69002B02D14FF0B0 -:1084A000FF332CE01022002178680CF0C3F97B68C0 -:1084B000002242F00E021A71002262F07F025A710D -:1084C0007B68BA789A727B68FA78DA727B687A7815 -:1084D0001A737B6810338022B96918460CF09CF936 -:1084E00078687B68103380221946F0F7CBF9F86082 -:1084F000FB68002B02D004480CF0AAFEFB6818466B -:108500001037BD4680BD00BFE4A4030880B5ADF5BB -:10851000826D00AF07F58263A3F20C43186007F584 -:108520008263A3F58263196007F58263A3F20C43AB -:108530001B68002B02D14FF0FF33AEE007F58263DA -:10854000A3F20C431022002118680CF073F907F114 -:1085500008034FF48062002118460CF06BF907F510 -:108560008263A3F20C431B68002242F001021A71DD -:10857000002262F07F025A7107F58263A3F58263DD -:108580001B689AB207F58263A3F20C431B685A81F9 -:1085900001F092F80346A7F80E34B7F80E341B0A20 -:1085A0009BB21A46B7F80E34DBB207F108003D491A -:1085B0000CF056FE01F09AF80346A7F80E34B7F80F -:1085C0000E341B0A9BB21946B7F80E34DAB207F123 -:1085D000080303F1100013460A4633490CF040FE2D -:1085E00007F108032033184600F0BCFF07F1080329 -:1085F0005033184601F024F807F108037033184689 -:108600000BF0A2FD07F10803903318460BF0B0FD04 -:108610004FF4806125480CF07FFD07F108031946EF -:1086200023480CF079FD07F1080310331946204860 -:108630000CF072FD07F10803203319461C480CF0BA -:108640006BFD07F108035033194619480CF064FD1F -:1086500007F108037033194615480CF05DFD07F16A -:1086600008039033194612480CF056FD07F5826353 -:10867000A3F20C431B6807F108014FF4806218460F -:10868000F0F700F9C7F80804D7F80834002B02D037 -:1086900008480CF0DDFDD7F80834184607F5826766 -:1086A000BD4680BD14A5030828A503083CA5030802 -:1086B00064A503086CA5030880B584B000AF78609A -:1086C00039607B68002B02D14FF0FF331FE010228E -:1086D000002178680CF0AEF87B68002242F00202BC -:1086E0001A71002262F07F025A713B689AB27B686D -:1086F0005A817B68802208491846F0F7C3F8F86071 -:10870000FB68002B02D005480CF0A2FDFB68184660 -:108710001037BD4680BD00BF3038002098A5030843 -:1087200080B584B000AF786039607B68002B02D1DF -:108730004FF0FF3321E01022002178680CF07AF826 -:108740007B68002242F011021A71002262F07F025F -:108750005A713B689BB21A467B68C3F80A207B6853 -:10876000802208491846F0F78DF8F860FB68002B66 -:1087700002D005480CF06CFDFB6818461037BD466A -:1087800080BD00BF3038002098A5030880B5ADF546 -:10879000826D00AF07F58263A3F20C43186007F502 -:1087A0008263A3F20C431B68002B02D14FF0FF330E -:1087B0003AE007F58263A3F20C4310220021186807 -:1087C0000CF038F807F10C034FF4806200211846D2 -:1087D0000CF030F807F58263A3F20C431B6800220B -:1087E00042F005021A71002262F07F025A7107F10D -:1087F0000C0319460020FDF759FE07F58263A3F22A -:108800000C431B6807F10C014FF480621846F0F727 -:1088100039F8C7F80C04D7F80C34002B02D00548FF -:108820000CF016FDD7F80C34184607F58267BD46E4 -:1088300080BD00BF98A5030880B5ADF5826D00AF7F -:1088400007F58263A3F20C43186007F58263A3F275 -:108850000C431B68002B02D14FF0FF3332E007F5C9 -:108860008263A3F20C431022002118680BF0E2FF90 -:1088700007F58263A3F20C431B68002242F0080252 -:108880001A71002262F07F025A7107F10C03194637 -:108890000120FDF70BFE07F58263A3F20C431B6872 -:1088A00007F10C014FF480621846EFF7EBFFC7F8B1 -:1088B0000C04D7F80C34002B02D005480CF0C8FC8F -:1088C000D7F80C34184607F58267BD4680BD00BF57 -:1088D000C8A5030880B483B000AF3B600346FB71BA -:1088E0000B46BB7113467B7100BF0C37BD465DF86C -:1088F000047B704780B582B000AF78601A4B0022CD -:108900005A60194B0222C3F81824174B0022C3F8EF -:108910001024154B0022C3F82024134B0022C3F867 -:108920002824114BD3F80C340F4A53650E4B5B6D62 -:108930001A460D4BC3F82C210B4BD3F808340A4AC6 -:108940001365094B1B6D1A46074BC3F82821FFF727 -:1089500055FD06480CF07CFC002000F0CDFB00BF6C -:108960000837BD4680BD00BF30380020F8A5030899 -:1089700080B584B000AF786039607B68262B00F248 -:10898000188101A252F823F0258A02082B8A0208D6 -:108990003F8A0208538A0208618A02086F8A020825 -:1089A000C38A0208D18A0208DF8A0208E78A02081D -:1089B000018B02080F8B02081D8B0208B38B020883 -:1089C000B38B02082B8B0208318B0208398B02080B -:1089D0004D8B0208658B0208798B0208B38B020865 -:1089E000B38B0208B38B0208B38B0208B38B020867 -:1089F000B38B0208B38B0208B38B0208B38B020857 -:108A0000B38B0208B38B0208B38B0208B38B020846 -:108A1000B38B0208918B02089F8B0208B38B02086C -:108A2000AD8B020800F084FBC4E064480CF010FC3D -:108A3000634B1B6843F00203614A1360BAE061486C -:108A40000CF006FC5E4B1B6823F002035C4A1360CB -:108A5000B0E05B4B1B6843F00103594A1360A9E087 -:108A6000574B1B6823F00103554A1360A2E03B6893 -:108A7000002B06D1524B0022DA61514B00221A67BB -:108A80000FE03B681BB2FB604D4BDA69FB68134497 -:108A9000FB60FB68002B01DA0023FB60FB68484A9F -:108AA000D361474BDB69464AC2F82431444B1B6F04 -:108AB000434AC2F84831FFF7A1FC002000F01CFB3C -:108AC00078E03F4B1B6823F004033D4A136071E0DC -:108AD0003B4B1B6843F00403394A13606AE03B6870 -:108AE000374A936066E0386808F028FD344B1B680D -:108AF00023F48063324A136033480CF0A9FB59E039 -:108B00002F4B1B6823F480732D4A136052E02C4BCB -:108B10001B6823F400732A4A13604BE0284B1B6840 -:108B200043F40073264A136044E000F023FC41E064 -:108B30003868FFF7DFFE3DE0214B1B6843F400532C -:108B40001F4A136021480CF083FB33E01C4B1B6869 -:108B500023F400531A4A1360ECF7ACFF1C480CF0E6 -:108B600077FB27E0164B1B6843F40043144A13605D -:108B700018480CF06DFB1DE0114B1B6823F40043FB -:108B80000F4A1360ECF796FF13480CF061FB11E0FD -:108B90000B4B1B6843F48023094A13600AE0084B1F -:108BA0001B6823F48003064A136003E008F0EEFC20 -:108BB00000E000BF00BF1037BD4680BD14A603080B -:108BC0003038002028A603083CA6030870A6030836 -:108BD00094A60308B8A60308DCA6030880B586B0EF -:108BE00002AF78607B68DB889BB219467B681B8983 -:108BF0009BB21A467B685B899BB218467B689B894F -:108C00009BB20093034641480CF086FA0023FB60B8 -:108C1000FB68002B04D0F86800F06EFAFB6870E087 -:108C20007B68DB889BB2013B072B68D801A252F816 -:108C300023F000BF558C0208638C02087D8C02086B -:108C4000978C0208AD8C0208FF8C0208C78C0208C2 -:108C5000E58C02087B681B899BB21846FDF71EF85D -:108C60004EE07B681B8998B27B685B8999B27B6810 -:108C70009B899BB21A46FDF747F841E07B681B8948 -:108C800098B27B685B8999B27B689B899BB21A46D4 -:108C9000FDF712F934E07B681B899AB27B685B8927 -:108CA0009BB219461046FDF7F9F929E07B681B894C -:108CB00098B27B685B8999B27B689B899BB21A46A4 -:108CC00000F026F81CE07B681B899BB218467B6885 -:108CD0005B899BB219467B689B899BB21A4600F060 -:108CE00026F80DE07B681B8998B27B685B8999B296 -:108CF0007B689B899BB21A4600F025F800E000BF14 -:108D0000002318461037BD4680BD00BF00A70308EA -:108D100080B483B000AF0346FB800B46BB80134694 -:108D20007B8000BF0C37BD465DF8047B704780B484 -:108D300085B000AFF860B9607A6000BF1437BD46F7 -:108D40005DF8047B704780B483B000AF0346FB80BE -:108D50000B46BB8013467B8000BF0C37BD465DF8D9 -:108D6000047B704780B582B000AF78607B68DB8899 -:108D70009BB2194679480CF0CFF97B68DB889BB22F -:108D8000013B4F2B00F2E38001A252F823F000BF19 -:108D90004F8F02084F8F0208D18E0208D78E02082B -:108DA000DD8E0208E38E0208E98E0208F58E0208C5 -:108DB0004F8F02084F8F0208018F02080D8F0208A3 -:108DC0004F8F02084F8F02084F8F02084F8F020803 -:108DD000138F0208198F02084F8F02084F8F020865 -:108DE0004F8F02084F8F02084F8F02084F8F0208E3 -:108DF0004F8F02084F8F02084F8F02084F8F0208D3 -:108E00004F8F02084F8F02084F8F02081F8F0208F2 -:108E10002B8F02084F8F02084F8F02084F8F0208D6 -:108E20004F8F0208FB8E0208378F0208EF8E020870 -:108E30003D8F02084F8F02084F8F02084F8F0208A4 -:108E40004F8F02084F8F02084F8F02084F8F020882 -:108E50004F8F02084F8F02084F8F02084F8F020872 -:108E60004F8F02084F8F02084F8F02084F8F020862 -:108E70004F8F02084F8F02084F8F02084F8F020852 -:108E80004F8F02084F8F02084F8F02084F8F020842 -:108E90004F8F02084F8F02084F8F02084F8F020832 -:108EA0004F8F02084F8F02084F8F02084F8F020822 -:108EB0004F8F02084F8F02084F8F02084F8F020812 -:108EC0004F8F02084F8F02084F8F0208438F02080E -:108ED000FCF7CAFB3CE0FCF759FB39E0FCF72EFC41 -:108EE00036E0FCF76BFC33E0FCF72AFD30E000F0E5 -:108EF0007BF82DE000F096F82AE000F09BF827E0E0 -:108F00007B689B681846FCF7DFFD21E0FCF7D4FC8A -:108F10001EE0FCF789FD1BE000F07CF818E07B68A0 -:108F20009B68184600F056F812E07B689B681A466A -:108F30000B4B9A600CE000F05EF809E000F063F87B -:108F400006E07B689B68184600F07BF800E000BFF5 -:108F5000002318460837BD4680BD00BF4CA7030854 -:108F60003038002080B582B000AF78607B68002B7D -:108F700002D14FF0FF3325E07B68DB889BB21946B6 -:108F800012480CF0C9F87B68DB889BB2502B11D0DB -:108F9000502B15DC022B02D0202B05D010E00C4BFF -:108FA0000122C3F800240CE07B689B68184600F09F -:108FB00011F806E07B689B68184600F042F800E074 -:108FC00000BF002318460837BD4680BD64A70308CC -:108FD0003038002080B483B000AF786000BF0C3719 -:108FE000BD465DF8047B704780B400AF00BFBD464E -:108FF0005DF8047B704780B400AF00231846BD467F -:109000005DF8047B704780B400AF00BFBD465DF8DB -:10901000047B704780B400AF00231846BD465DF85E -:10902000047B704780B400AF00231846BD465DF84E -:10903000047B704780B400AF00BFBD465DF8047B81 -:10904000704780B483B000AF786000BF0C37BD4676 -:109050005DF8047B704780B483B000AF78603960FE -:10906000002318460C37BD465DF8047B704780B47A -:1090700083B000AF78603960002318460C37BD46D6 -:109080005DF8047B7047000080B584B000AF786065 -:109090007B68D3F80630FB607B68D3F80A30BB608E -:1090A000BA68F96805480CF037F8B968F868FFF74E -:1090B000D2FF00BF1037BD4680BD00BF84A70308A4 -:1090C00080B584B000AF78607B68D3F80630FB6071 -:1090D0007B68D3F80A30BB60BA68F96805480CF0C1 -:1090E0001BF8B968F868FFF7C2FF00BF1037BD462C -:1090F00080BD00BFA4A7030880B582B000AF786030 -:10910000094B5A687B689A4203D0796807480CF08B -:1091100003F87B68044A5360012000F035F800230F -:1091200018460837BD4680BD30380020CCA703085C -:1091300080B500AF0020FFF7DFFF00BF80BD00005B -:1091400080B582B000AFF6F7F5F80AF095FF034658 -:109150000B4AD36680220A490A480BF04DFB78601F -:109160007B68002B07D0064B054A803311468022CE -:1091700018460BF051FB7B6818460837BD4680BD8A -:1091800030380020B038002080B582B000AF786061 -:1091900078680AF067F800BF0837BD4680BD000058 -:1091A00080B582B000AF78607B68002B09D10D4894 -:1091B0000CF04EF80C4B1B6823F010030A4A1360A6 -:1091C00008E00A480CF044F8074B1B6843F0100312 -:1091D000054A13600020FFF7D7FF00BF0837BD46E0 -:1091E00080BD00BFE0A7030830380020F4A70308C3 -:1091F00080B500AF084B1B69084A9360064BDB68DB -:10920000064AC2F83C31054B9B68044AC2F8383123 -:10921000FFF7F4F800BF80BDD849002030380020A7 -:1092200080B400AF034BDB681846BD465DF8047B95 -:10923000704700BF3038002080B582B000AF0F4BC0 -:10924000DB6801337B607B68184608F053F90346FE -:10925000012B0AD17B68094AD360084BDB68074AB7 -:10926000C2F81C31FFF7CAF802E04FF0FF337B6011 -:109270007B6818460837BD4680BD00BF30380020E7 -:1092800080B500AF0B4BDB68002B0ED0094BDB68C1 -:10929000013B084AD360074BDB68064AC2F81C3121 -:1092A000FFF7ACF8034BDB6801E04FF0FF331846E3 -:1092B00080BD00BF3038002080B5ADF5826D00AFB5 -:1092C00007F58263A3F20C43186007F58263A3F2EB -:1092D0000C431B68002B02D14FF0FF3341E007F530 -:1092E0008263A3F20C431B68DB889BB2B3F5806FEB -:1092F00011D007F58263A3F20C431B68DB889BB295 -:109300004FF48062194619480BF006FF6FF0010315 -:10931000C7F80C3414E007F58263A3F20C431B6812 -:1093200003F1100207F58263A3F2044318461146C5 -:109330004FF480631A460BF06FFA0023C7F80C3421 -:10934000D7F80C34002B0AD1D7F80C34002B06D1F7 -:10935000074BDB68064AC2F81C31FFF74FF8D7F815 -:109360000C34184607F58267BD4680BD08A803087F -:109370003038002080B500AF0E4B0022DA600D4B74 -:1093800000229A650B4BDB680A4AC2F81C31FFF7D2 -:1093900035F8084B4FF0FF32C3F84024054B00224C -:1093A000C3F83C24034B0022C3F84424F9F728FDFA -:1093B00000BF80BD3038002080B582B000AF78603B -:1093C0007B68002B06D01822796804480BF024FA39 -:1093D000FFF714F800BF0837BD4680BD30390020C4 -:1093E00080B586B000AF3B46184601F02FFE03461D -:1093F000002B07D13B46184601F078FE3B46184645 -:10940000FFF7DAFF00BF1837BD4680BD80B586B0D4 -:1094100000AF3B46184601F019FE0346002B03D16E -:109420003B46184601F062FE00BF1837BD4680BDBE -:1094300080B582B000AF786039603868FFF7BCFF54 -:1094400000BF0837BD4680BDB0B5A0B004AF78609E -:10945000404B07F124041D460FCD0FC40FCD0FC4A0 -:1094600095E80F0084E80F003B4A07F1180307CA8C -:1094700083E80700394A07F10C0307CA03C31A70CF -:1094800007F1150300221A809A700123BB6600239E -:1094900087F86F3019E097F86F309B0070333B44CA -:1094A00053F84C1C07F11803032218460BF0A4F9DB -:1094B0000346002B04D197F86F300133BB6608E0F8 -:1094C00097F86F30013387F86F3097F86F300B2BB8 -:1094D000E1D907F11803093318460BF05FF9034689 -:1094E000DBB27B6607F11803043318460BF056F91C -:1094F0000346DBB23B6607F10C0318460BF04EF94E -:109500000346DBB2FB6507F10C03033318460BF08F -:1095100045F90346DBB2BB6507F10C030633184679 -:109520000BF03CF90346DBB27B657B68002B0DD06A -:109530007B6D0393BB6D0293FB6D01933B6E0093B8 -:10954000BB6E7A6E064978680BF08AFE00BF7037F2 -:10955000BD46B0BD8CA80308BCA80308C8A8030872 -:1095600070A80308F0B585B000AF78607B68002B69 -:109570005FD07B68314A14469C4604F1300E654644 -:1095800026460FCE28606960AA60EB6010340CF1AB -:10959000100C7445F3D17B682F3300221A707B685E -:1095A0001B78FF2B03D17B6800221A7041E07B6897 -:1095B00024331B78FF2B3CD17B6825331B78FF2B92 -:1095C00037D17B6826331B78FF2B32D17B6827335A -:1095D0001B78FF2B2DD17B6828331B78FF2B28D1DC -:1095E0007B6829331B78FF2B23D17B682A331B78B8 -:1095F000FF2B1ED17B682B331B78FF2B19D17B6887 -:109600002C331B78FF2B14D17B682D331B78FF2B59 -:109610000FD17B682E331B78FF2B0AD17B68243354 -:10962000FB60F868FFF710FF044BBB60BB681933A1 -:10963000BB6000BF1437BD46F0BD00BF84F3030814 -:1096400080B582B000AF7860044B054A0549786860 -:109650000BF006FE00BF0837BD4680BDD4A8030846 -:10966000BCA80308E0A8030880B582B000AF00F0F2 -:1096700023F803467B607B681B12DBB27A68D2B2A8 -:1096800019460B480BF048FD00F030F803463B60EC -:109690003B681B12DBB23A68D2B2194605480BF0A0 -:1096A0003BFD01F085F800BF0837BD4680BD00BF17 -:1096B000F0A8030814A9030880B500AF0A4B1B8863 -:1096C000002B05D0084B1B884FF6FF72934207D141 -:1096D0004FF0C040EFF7B1FA03461A46024B1A802A -:1096E000014B1B88184680BDF83C002080B500AFB8 -:1096F0000A4B1B88002B05D0084B1B884FF6FF72C6 -:10970000934206D10648EFF798FA03461A46034BF0 -:109710001A80024B1B88184680BD00BFFA3C00200F -:109720000200006080B500AF002000F01FFA03487F -:10973000EFF783FA0346184680BD00BF04000060BF -:1097400080B500AF0248EFF778FA0346184680BDAF -:109750000A00006080B500AF0448EFF76EFA0346D8 -:1097600003F003039BB2184680BD00BF08000060F1 -:1097700080B582B000AF002000F0F8F90A48EFF79A -:109780005CFA03467B607B681B047B600748EFF74D -:1097900054FA03461A467B6813447B607B6818467C -:1097A0000837BD4680BD00BF0E0000600C000060A1 -:1097B00080B582B000AF0346FB80FB88012B03D14C -:1097C000FFF7D6FF034600E0002318460837BD46E2 -:1097D00080BD000080B584B000AF0346FB80FB88ED -:1097E000012B10D10B48EFF728FA0346FB60FB680A -:1097F0001B04FB600848EFF720FA03461A46FB6893 -:109800001344FB6001E00023FB60FB68184610373F -:10981000BD4680BD120000601000006080B582B0BF -:1098200000AF002000F0A2F90A48EFF706FA03465D -:109830007B607B681B047B600748EFF7FEF90346FB -:109840001A467B6813447B607B6818460837BD4620 -:1098500080BD00BF160000601400006080B582B0BB -:1098600000AF0346FB80FB88012B03D1FFF7D6FF37 -:10987000034600E0002318460837BD4680BD0000BF -:1098800080B582B000AF002000F070F90A48EFF711 -:10989000D4F903467B607B681B047B600748EFF7C5 -:1098A000CCF903461A467B6813447B607B681846F4 -:1098B0000837BD4680BD00BF220000602000006068 -:1098C00080B582B000AF002000F050F90A48EFF7F1 -:1098D000B4F903467B607B681B047B600748EFF7A5 -:1098E000ACF903461A467B6813447B607B681846D4 -:1098F0000837BD4680BD00BF260000602400006020 -:1099000080B582B000AF002000F030F90A48EFF7D0 -:1099100094F903467B607B681B047B600748EFF784 -:109920008CF903461A467B6813447B607B681846B3 -:109930000837BD4680BD00BF2A00006028000060D7 -:1099400080B582B000AF002000F010F90A48EFF7B0 -:1099500074F903467B607B681B047B600748EFF764 -:109960006CF903461A467B6813447B607B68184693 -:109970000837BD4680BD00BF2E0000602C0000608F -:1099800080B582B000AF002000F0F0F80A48EFF791 -:1099900054F903467B607B681B047B600748EFF744 -:1099A0004CF903461A467B6813447B607B68184673 -:1099B0000837BD4680BD00BF320000603000006047 -:1099C00080B582B000AF002000F0D0F80A48EFF771 -:1099D00034F903467B607B681B047B600748EFF724 -:1099E0002CF903461A467B6813447B607B68184653 -:1099F0000837BD4680BD00BF3600006034000060FF -:109A000080B582B000AF0346FB80FB88013B052B8D -:109A100026D801A252F823F0319A0208399A020896 -:109A2000419A0208499A0208519A0208599A020872 -:109A3000FFF726FF034615E0FFF742FF034611E05C -:109A4000FFF75EFF03460DE0FFF77AFF034609E0EC -:109A5000FFF796FF034605E0FFF7B2FF034601E07C -:109A60004FF0FF3318460837BD4680BD80B582B041 -:109A700000AF002000F07AF80A48EFF7DEF803465E -:109A80007B607B681B047B600748EFF7D6F80346D2 -:109A90001A467B6813447B607B6818460837BD46CE -:109AA00080BD00BF420000604000006080B582B011 -:109AB00000AF002000F05AF80A48EFF7BEF803465E -:109AC0007B607B681B047B600748EFF7B6F80346B2 -:109AD0001A467B6813447B607B6818460837BD468E -:109AE00080BD00BF460000604400006080B582B0C9 -:109AF00000AF0346FB80FB88012B02D0022B04D071 -:109B000007E0FFF7B3FF034605E0FFF7CFFF03468B -:109B100001E04FF0FF3318460837BD4680BD000016 -:109B200080B500AF0448EFF788F8034603F03F0321 -:109B30009BB2184680BD00BF5000006080B500AFEA -:109B40000448EFF77AF8034603F03F039BB2184648 -:109B500080BD00BF5200006080B500AF0248EFF743 -:109B60006CF80346184680BD5400006080B582B092 -:109B700000AF0346FB80FB8819464FF0C040EFF76B -:109B80004DF800BF0837BD4680BD000080B584B0E9 -:109B900000AF78607B68002B02D14FF0FF33E4E028 -:109BA0007B681B88012B23D17B685B88012B06D146 -:109BB0004FF48870FFF7DAFF6E4BFB601BE07B68A9 -:109BC0005B88022B06D140F21110FFF7CFFF6A4BE2 -:109BD000FB6010E07B685B88032B06D14FF4897033 -:109BE000FFF7C4FF654BFB6005E04FF0FF33BCE0BF -:109BF0004FF0FF33B9E07B681B88012B40F0B18048 -:109C00007B685B685E4A934203D97B685C4A5A6012 -:109C100006E07B685B68232B02D87B6824225A60AD -:109C20007B689B68574A934209D97B689B681946B1 -:109C300055480BF071FA7B68524A9A600FE07B68D6 -:109C40009B68002B0BD17B689B6819464F480BF033 -:109C500063FA7B6801229A604FF0FF3385E07B68EE -:109C6000DB68484A934209D97B68DB681946484853 -:109C70000BF052FA7B68434ADA600FE07B68DB68DE -:109C8000002B0BD17B68DB68194642480BF044FA85 -:109C90007B680122DA604FF0FF3366E07B685B6827 -:109CA0009BB21946F868EEF7B9FF7B685B681B0C3E -:109CB0009BB21946F868EEF7B1FF7B689B689BB2D0 -:109CC0001946F868EEF7AAFF7B689B681B0C9BB2ED -:109CD0001946F868EEF7A2FF7B68DB689BB219466D -:109CE000F868EEF79BFF7B68DB681B0C9BB219469C -:109CF000F868EEF793FF7B685B88032B23D07B68C3 -:109D00001B699BB21946F868EEF788FF7B681B69F0 -:109D10001B0C9BB21946F868EEF780FF7B685B6905 -:109D20009BB21946F868EEF779FF7B685B691B0CFC -:109D30009BB21946F868EEF771FF44F64B71F8686C -:109D4000EEF76CFF04E044F64B71F868EEF766FF3F -:109D50007B681B88012B07D140F20110FFF706FF3B -:109D600002E04FF0FF3300E0002318461037BD46F5 -:109D700080BD00BF020000600400006006000060BB -:109D80004019010000093D0038A9030850A9030843 -:109D900068A9030880A9030880B582B000AF034614 -:109DA000FB80FB88012B02D0FB88052B17D14FF4D9 -:109DB0008070FFF7DBFE4FF49070FFF7D7FE40F2A4 -:109DC0002110FFF7D3FE4FF48870FFF7CFFE40F26B -:109DD0001110FFF7CBFE4FF48970FFF7C7FE002389 -:109DE00018460837BD4680BD80B582B000AF034637 -:109DF000FB80FB88012B02D0FB88052B03D14FF49D -:109E00008970FFF7B3FE00BF0837BD4680BD80B53F -:109E100000AF40F20140FFF7A9FE00BF80BD80B552 -:109E200000AF4FF48060FFF7A1FE00BF80BD80B59A -:109E300000AF40F20150FFF799FE00BF80BD80B532 -:109E400000AF4FF4A060FFF791FE00BF80BD80B56A -:109E500082B000AF03460A46FB801346BB80FB88F6 -:109E60001B011BB2DBB21BB243F4C0631AB2B7F9D9 -:109E7000043003F00F031BB213431BB29BB218460E -:109E8000FFF774FE00BF0837BD4680BD80B500AF48 -:109E9000074B1B8843F001039AB2054B1A80044B11 -:109EA0001B8819460348EEF7B9FE00BF80BD00BF0E -:109EB000AC3C00202200006080B500AF074B1B883F -:109EC00023F001039AB2054B1A80044B1B881946F4 -:109ED0000348EEF7A3FE00BF80BD00BFAC3C0020EE -:109EE0002200006080B500AF074B1B8843F00203DF -:109EF0009AB2054B1A80044B1B8819460348EEF7AB -:109F00008DFE00BF80BD00BFAC3C00202200006081 -:109F100080B500AF074B1B8823F002039AB2054BB4 -:109F20001A80044B1B8819460348EEF777FE00BFE2 -:109F300080BD00BFAC3C00202200006080B500AFB7 -:109F4000074B1B8843F004039AB2054B1A80044B5D -:109F50001B8819460348EEF761FE00BF80BD00BFB5 -:109F6000AC3C00202200006080B500AF074B1B888E -:109F700023F004039AB2054B1A80044B1B88194640 -:109F80000348EEF74BFE00BF80BD00BFAC3C002095 -:109F90002200006080B500AF074B1B8843F0080328 -:109FA0009AB2054B1A80044B1B8819460348EEF7FA -:109FB00035FE00BF80BD00BFAC3C00202200006029 -:109FC00080B500AF074B1B8823F008039AB2054BFE -:109FD0001A80044B1B8819460348EEF71FFE00BF8A -:109FE00080BD00BFAC3C00202200006080B500AF07 -:109FF000074B1B8843F010039AB2054B1A80044BA1 -:10A000001B8819460348EEF709FE00BF80BD00BF5C -:10A01000AC3C00202200006080B500AF074B1B88DD -:10A0200023F010039AB2054B1A80044B1B88194683 -:10A030000348EEF7F3FD00BF80BD00BFAC3C00203D -:10A040002200006080B500AF074B1B8843F020035F -:10A050009AB2054B1A80044B1B8819460348EEF749 -:10A06000DDFD00BF80BD00BFAC3C002022000060D1 -:10A0700080B500AF074B1B8823F020039AB2054B35 -:10A080001A80044B1B8819460348EEF7C7FD00BF32 -:10A0900080BD00BFAC3C00202200006080B500AF56 -:10A0A000074B1B8843F040039AB2054B1A80044BC0 -:10A0B0001B8819460348EEF7B1FD00BF80BD00BF05 -:10A0C000AC3C00202200006080B500AF074B1B882D -:10A0D00023F040039AB2054B1A80044B1B881946A3 -:10A0E0000348EEF79BFD00BF80BD00BFAC3C0020E5 -:10A0F0002200006080B500AF074B1B8843F080034F -:10A100009AB2054B1A80044B1B8819460348EEF798 -:10A1100085FD00BF80BD00BFAC3C00202200006078 -:10A1200080B500AF074B1B8823F080039AB2054B24 -:10A130001A80044B1B8819460348EEF76FFD00BFD9 -:10A1400080BD00BFAC3C00202200006080B582B022 -:10A1500000AF03460A46FB801346BB80FB88DB0149 -:10A1600003F1C043BA8811461846EEF757FD00BF09 -:10A170000837BD4680BD000080B586B000AF0346FD -:10A18000B9607A60FB8100237B61FB89002B43D09F -:10A190003FE0BB681B88C3F30E033B617A693B69F0 -:10A1A00013447B613B6907EE903AF8EE677A9FEDC6 -:10A1B0001D7A67EE877A9FED1C7A77EE877AFCEE40 -:10A1C000E77A17EE903A3B613B69B3F5004F06D34F -:10A1D00016480BF03DF87B6903F580137B61BB6883 -:10A1E0001B8823F4FF4323F07F039AB2BB681A80D5 -:10A1F000BB681A883B699BB2C3F30E039BB213433F -:10A200009AB2BB681A807B68013B7B60BB680233F3 -:10A21000BB607B68002BBCD17B6918461837BD46F4 -:10A2200080BD00BF8FC2B53F77BE7F3F98A90308AE -:10A2300080B584B000AF78607B68002B05D1AF4853 -:10A240000BF006F84FF0FF3353E17B685B88012B7E -:10A2500002D0042B08D00FE07B681B8840F201116C -:10A260001846FFF773FF0FE07B681B884FF481717E -:10A270001846FFF76BFF07E07B681B884FF480717F -:10A280001846FFF763FF00BF7B68D88E7B6803F139 -:10A2900016017B689B8A1A46FFF76EFFF8607B68A1 -:10A2A0009B88012B40F08B807B681B884FF4A0615A -:10A2B0001846FFF74BFF7B681B88DB0103F1C043A7 -:10A2C0001433FA6892B211461846EEF7A7FC7B6881 -:10A2D0001B88DB0103F1C0431A33FA68120C92B2F7 -:10A2E00011461846EEF79AFC7B681B88DB0103F1E8 -:10A2F000C04306337A6802F116017A68928A1846DA -:10A30000EEF7A8FC7B681B88DB0103F1C043023336 -:10A310007A68926892B211461846EEF77FFC7B6825 -:10A320001B88DB0103F1C04302337A689268120C88 -:10A3300092B211461846EEF771FC7B681B88DB0170 -:10A3400003F1C04302337A68D26892B211461846CC -:10A35000EEF764FC7B681B88DB0103F1C04302332A -:10A360007A68D268120C92B211461846EEF756FC83 -:10A370007B681B88DB0103F1C04302337A681269F2 -:10A3800092B211461846EEF749FC7B681B88DB0148 -:10A3900003F1C04302337A681269120C92B211467B -:10A3A0001846EEF73BFC7B681B88DB0103F1C043DA -:10A3B000023344F64B711846EEF730FC98E07B68A8 -:10A3C0009B88022B40F08B807B681B8840F20151F8 -:10A3D0001846FFF7BBFE7B681B88DB0103F1C04317 -:10A3E0001633FA6892B211461846EEF717FC7B68EE -:10A3F0001B88DB0103F1C0431C33FA68120C92B2D4 -:10A4000011461846EEF70AFC7B681B88DB0103F156 -:10A41000C04308337A6802F116017A68928A1846B6 -:10A42000EEF718FC7B681B88DB0103F1C0430433A3 -:10A430007A68926892B211461846EEF7EFFB7B6895 -:10A440001B88DB0103F1C04304337A689268120C65 -:10A4500092B211461846EEF7E1FB7B681B88DB01E0 -:10A4600003F1C04304337A68D26892B211461846A9 -:10A47000EEF7D4FB7B681B88DB0103F1C043043398 -:10A480007A68D268120C92B211461846EEF7C6FBF3 -:10A490007B681B88DB0103F1C04304337A681269CF -:10A4A00092B211461846EEF7B9FB7B681B88DB01B8 -:10A4B00003F1C04304337A681269120C92B2114658 -:10A4C0001846EEF7ABFB7B681B88DB0103F1C0434A -:10A4D000043344F64B711846EEF7A0FB08E07B68A6 -:10A4E0009B88194606480AF017FE4FF0FF3300E03C -:10A4F000002318461037BD4680BD00BFACA9030835 -:10A50000D0A9030880B582B000AF03460A46FB809D -:10A510001346BB80BB88012B10D1FB884FF4A06190 -:10A520001846FFF713FEFB88DB0103F1C043063337 -:10A53000002200211846EEF78DFB12E0BB88022BAB -:10A540000FD1FB8840F201511846FFF7FFFDFB8851 -:10A55000DB0103F1C0430833002200211846EEF767 -:10A5600079FB00BF0837BD4680BD80B582B000AF23 -:10A5700003463960FB80FB88DB0103F1C0430A33EB -:10A580003A6892B211461846EEF748FBFB88DB01A9 -:10A5900003F1C0430C333A68120C92B211461846CC -:10A5A000EEF73CFB00BF0837BD4680BD80B582B0EA -:10A5B00000AFFFF7B7F80346FB80B7F90630002B72 -:10A5C00080F2C680FFF7BCF80346FB800120FFF74E -:10A5D000CDFAFB8803F00103002B06D0724B1B68F9 -:10A5E000002B02D0704B1B689847FB8803F00203D6 -:10A5F000002B06D06C4B5B68002B02D06A4B5B686B -:10A600009847FB8803F00403002B06D0664B9B6839 -:10A61000002B02D0644B9B689847FB8803F008032B -:10A62000002B06D0604BDB68002B02D05E4BDB6852 -:10A630009847FB8803F01003002B06D05A4B1B6988 -:10A64000002B02D0584B1B699847FB8803F020036E -:10A65000002B06D0544B5B69002B02D0524B5B6938 -:10A660009847FB8803F04003002B06D04E4B9B69B4 -:10A67000002B02D04C4B9B699847FB8803F080036A -:10A68000002B06D0484BDB69002B02D0464BDB6920 -:10A690009847FB8803F48073002B06D0424B1B6A5B -:10A6A000002B02D0404B1B6A9847FB8803F40073D1 -:10A6B000002B06D03C4B5B6A002B02D03A4B5B6A06 -:10A6C0009847FB8803F48063002B06D0364B9B6AC7 -:10A6D000002B02D0344B9B6A9847FB8803F400633D -:10A6E000002B06D0304BDB6A002B02D02E4BDB6AEE -:10A6F0009847FB8803F48053002B06D02A4B1B6B32 -:10A70000002B02D0284B1B6B9847FB8803F40053A7 -:10A71000002B06D0244B5B6B002B02D0224B5B6BD3 -:10A720009847FB8803F48043002B06D01E4B9B6B9D -:10A73000002B02D01C4B9B6B9847B7F90630002BBF -:10A7400006DA194BDB6B002B02D0174BDB6B9847FB -:10A75000FB8803F48043002B21D0FEF7FBFF034668 -:10A76000FB80FB8803F00103002B09D00320FFF7D7 -:10A77000FDF90E4B1B68002B02D00C4B1B68984751 -:10A78000FB8803F00203002B09D00420FFF7EEF949 -:10A79000064B5B68002B02D0044B5B68984700BFF8 -:10A7A0000837BD4680BD00BFB03C0020F03C002013 -:10A7B00080B500AF1020FFF7D9F900BF80BD0000C1 -:10A7C00080B483B000AF03460A46FB8013467B711A -:10A7D000FB88002B3AD0FB88B3F5807F36D87B7995 -:10A7E000012B18D1FB88013B002B00DA0F331B1122 -:10A7F000194A32F8132011B2FA88013A02F00F0216 -:10A80000012000FA02F212B20A4312B291B2124AC5 -:10A8100022F813101BE0FB88013B002B00DA0F33FA -:10A820001B110D4A32F8132011B2FA88013A02F0D6 -:10A830000F02012000FA02F212B2D24312B20A4011 -:10A8400012B291B2044A22F8131000E000BF0C3794 -:10A85000BD465DF8047B7047E80C002080B582B0EF -:10A8600000AF0023FB8014E0FB881B099BB25B0058 -:10A8700003F1C0436033FA88120992B21146094AC3 -:10A8800032F8112011461846EEF7C8F9FB8810334C -:10A89000FB80FB88FF2BE7D900BF00BF0837BD4610 -:10A8A00080BD00BFE80C002080B582B000AF034639 -:10A8B0000A46FB8013467B717A79FB88114618465D -:10A8C000FFF77EFFFFF7CAFF00BF0837BD4680BD18 -:10A8D00080B483B000AF786039607B683A689A6171 -:10A8E00000BF0C37BD465DF8047B704780B483B071 -:10A8F00000AF786039603B681A047B689A6100BFDA -:10A900000C37BD465DF8047B704780B483B000AF60 -:10A91000786039607B685A693B685A407B685A6145 -:10A9200000BF0C37BD465DF8047B704780B500AFB3 -:10A930004FF400510248FFF7E8FF00BF80BD00BFA1 -:10A940000008024080B500AF10210248FFF7CEFF9B -:10A9500000BF80BD0000024080B500AF102102485A -:10A96000FFF7B6FF00BF80BD0000024080B500AF1A -:10A970004FF480510248FFF7B9FF00BF80BD00BF10 -:10A980000004024080B500AF4FF480510248FFF749 -:10A990009FFF00BF80BD00BF0004024080B500AF34 -:10A9A0004FF400410248FFF7A1FF00BF80BD00BF88 -:10A9B0000000024080B500AF4FF400410248FFF7AD -:10A9C00087FF00BF80BD00BF0000024080B500AF20 -:10A9D0004FF480710248FFF789FF00BF80BD00BFC0 -:10A9E0000008024080B500AF4FF480710248FFF7C5 -:10A9F0006FFF00BF80BD00BF0008024080B500AF00 -:10AA0000FFF79CF8034603F00403002B14BF012357 -:10AA10000023DBB2184680BD80B500AFFFF78EF88B -:10AA2000034603F02003002B14BF01230023DBB2F5 -:10AA3000184680BD80B500AFFFF78EF8034603F0DF -:10AA40000103002B14BF01230023DBB2184680BD95 -:10AA500080B500AFFFF780F8034603F00203002B38 -:10AA600014BF01230023DBB2184680BD80B500AFC0 -:10AA7000FFF772F8034603F00403002B14BF012311 -:10AA80000023DBB2184680BD80B500AFFFF764F845 -:10AA9000034603F00803002B14BF01230023DBB29D -:10AAA000184680BD80B500AFFFF756F8034603F0A7 -:10AAB0001003002B14BF01230023DBB2184680BD16 -:10AAC00080B500AFFFF748F8034603F02003002BE2 -:10AAD00014BF01230023DBB2184680BD80B500AF50 -:10AAE000FFF73AF8034603F04003002B14BF01239D -:10AAF0000023DBB2184680BD80B500AFFFF72CF80D -:10AB0000034603F08003002B14BF01230023DBB2B4 -:10AB1000184680BD80B500AFFFF71EF8034603F46A -:10AB20008073002B14BF01230023DBB2184680BDC5 -:10AB300080B500AFFFF710F8034603F40073002B55 -:10AB400014BF01230023DBB2184680BD80B500AFDF -:10AB5000FFF702F8034603F48063002B14BF0123C0 -:10AB60000023DBB2184680BD80B500AFFEF7F4FFCE -:10AB7000034603F40063002B14BF01230023DBB260 -:10AB8000184680BD80B500AFFEF7E6FF034603F42C -:10AB90008053002B14BF01230023DBB2184680BD75 -:10ABA00080B500AFFEF7D8FF034603F40053002B37 -:10ABB00014BF01230023DBB2184680BD80B500AF6F -:10ABC000FEF7CAFF034603F48043002B14BF0123A2 -:10ABD0000023DBB2184680BD80B500AFFEF7BCFF96 -:10ABE00003461BB29BB2DB0BDBB2184680BD80B5BF -:10ABF00000AF40F211610120FFF7A8FA00BF80BD4D -:10AC000080B500AF4FF4C2610120FFF79FFA00BF8B -:10AC100080BD80B500AF40F201610120FFF796FAD8 -:10AC200000BF80BD80B500AF4FF4C0610120FFF7C9 -:10AC30008DFA00BF80BD80B500AF40F22131012008 -:10AC4000FFF784FA00BF80BD80B500AF4FF44871B4 -:10AC50000120FFF77BFA00BF80BD80B500AF40F256 -:10AC600001310120FFF772FA00BF80BD80B500AF4F -:10AC70004FF440710120FFF769FA00BF80BD80B535 -:10AC800000AF40F211610220FFF760FA00BF80BD03 -:10AC900080B500AF4FF4C2610220FFF757FA00BF42 -:10ACA00080BD80B500AF40F201610220FFF74EFA8F -:10ACB00000BF80BD80B500AF4FF4C0610220FFF738 -:10ACC00045FA00BF80BD80B500AF40F221310220BF -:10ACD000FFF73CFA00BF80BD80B500AF4FF448716C -:10ACE0000220FFF733FA00BF80BD80B500AF40F20D -:10ACF00001310220FFF72AFA00BF80BD80B500AF06 -:10AD00004FF440710220FFF721FA00BF80BD80B5EB -:10AD100000AF40F211610320FFF718FA00BF80BDB9 -:10AD200080B500AF4FF4C2610320FFF70FFA00BFF8 -:10AD300080BD80B500AF40F201610320FFF706FA45 -:10AD400000BF80BD80B500AF4FF4C0610320FFF7A6 -:10AD5000FDF900BF80BD80B500AF40F22131032076 -:10AD6000FFF7F4F900BF80BD80B500AF4FF4487124 -:10AD70000320FFF7EBF900BF80BD80B500AF40F2C4 -:10AD800001310320FFF7E2F900BF80BD80B500AFBD -:10AD90004FF440710320FFF7D9F900BF80BD80B5A3 -:10ADA00000AF40F211610420FFF7D0F900BF80BD71 -:10ADB00080B500AF4FF4C2610420FFF7C7F900BFB0 -:10ADC00080BD80B500AF40F201610420FFF7BEF9FD -:10ADD00000BF80BD80B500AF4FF4C0610420FFF715 -:10ADE000B5F900BF80BD80B500AF40F2213104202D -:10ADF000FFF7ACF900BF80BD80B500AF4FF44871DC -:10AE00000420FFF7A3F900BF80BD80B500AF40F27A -:10AE100001310420FFF79AF900BF80BD80B500AF73 -:10AE20004FF440710420FFF791F900BF80BD80B559 -:10AE300000AF40F211610520FFF788F900BF80BD27 -:10AE400080B500AF4FF4C2610520FFF77FF900BF66 -:10AE500080BD80B500AF40F201610520FFF776F9B3 -:10AE600000BF80BD80B500AF4FF4C0610520FFF783 -:10AE70006DF900BF80BD80B500AF40F221310520E3 -:10AE8000FFF764F900BF80BD80B500AF4FF4487193 -:10AE90000520FFF75BF900BF80BD80B500AF40F231 -:10AEA00001310520FFF752F900BF80BD80B500AF2A -:10AEB0004FF440710520FFF749F900BF80BD80B510 -:10AEC00000AF40F211610620FFF740F900BF80BDDE -:10AED00080B500AF4FF4C2610620FFF737F900BF1D -:10AEE00080BD80B500AF40F201610620FFF72EF96A -:10AEF00000BF80BD80B500AF4FF4C0610620FFF7F2 -:10AF000025F900BF80BD80B500AF40F22131062099 -:10AF1000FFF71CF900BF80BD80B500AF4FF448714A -:10AF20000620FFF713F900BF80BD80B500AF40F2E7 -:10AF300001310620FFF70AF900BF80BD80B500AFE0 -:10AF40004FF440710620FFF701F900BF80BD80B4C7 -:10AF500000AF00231846BD465DF8047B704780B4FF -:10AF600000AF01231846BD465DF8047B704780B4EE -:10AF700000AF00BFBD465DF8047B704780B500AFF1 -:10AF8000FFF724FD00BF80BD80B500AFF3F79CFB49 -:10AF9000154B164A16491748F1F73AFF164B174A50 -:10AFA00017491848F2F73CF9174B184A184919483D -:10AFB000F2F73EFB184B194A19491A48F2F740FDBF -:10AFC000194B1A4A1A491B48F2F742FF1A4B1B4AFF -:10AFD0001B491C48F3F744F91C2200211A4809F0C8 -:10AFE00029FC00BF80BD00BF01AC0208EFAB020826 -:10AFF00025AC020813AC020891AC02087FAC020831 -:10B00000B5AC0208A3AC020821AD02080FAD0208DE -:10B0100045AD020833AD0208B1AD02089FAD02088C -:10B02000D5AD0208C3AD020841AE02082FAE02083A -:10B0300065AE020853AE0208D1AE0208BFAE0208E8 -:10B04000F5AE0208E3AE0208BC49002090B585B019 -:10B0500000AF78607B68002B15D00023FB600FE009 -:10B060000B4AFB6832F81310FB689B007A68D4180F -:10B070000846FEF7C5FC03462360FB680133FB600E -:10B08000FB68052BECDD002318461437BD4690BD48 -:10B09000B4F3030880B584B000AF78600023FB6090 -:10B0A0001AE07B68002B0CD00F4AFB6832F81300C3 -:10B0B000FB689B007A6813441B681946FFF755FA32 -:10B0C00007E0094AFB6832F8133000211846FFF701 -:10B0D0004CFAFB680133FB60FB68052BE1DD00BF28 -:10B0E00000BF1037BD4680BDB4F3030880B485B0FF -:10B0F00000AF78600023FB600CE0FB689B007A687F -:10B1000013441A680A49FB689B000B445A60FB68A9 -:10B110000133FB60FB68052BEFDD054B45F2AA52BE -:10B120001A6000BF1437BD465DF8047B704700BF4E -:10B13000BC49002080B582B000AF7860054A7B68CA -:10B1400032F813301846FEF75BFC03461846083702 -:10B15000BD4680BDB4F3030880B582B000AF78600F -:10B160003960064A7B6832F8133039681846FFF7B1 -:10B17000FCF900BF0837BD4680BD00BFB4F303082B -:10B1800080B582B000AF786039607B68052B09DC40 -:10B19000064A7B6832F813303A6892B21146184674 -:10B1A000FEF7D4FF00BF0837BD4680BDB4F30308E7 -:10B1B00080B584B000AF78607B68002B00F0BC8065 -:10B1C0007B681B68002B00F0B9800520FEF7E4FDCA -:10B1D0000023FB60A8E05B4AFB6832F813307B81F8 -:10B1E0007A68FB68DB0013449B881BB2002B80F25B -:10B1F00098807A68FB68DB0013449B8803F00203A5 -:10B20000002B06D07B8940F221311846FEF79EFFC5 -:10B2100005E07B894FF448711846FEF797FF7A687E -:10B22000FB68DB0013449B8803F00403002B06D06B -:10B230007B8940F201311846FEF788FF05E07B89E3 -:10B240004FF440711846FEF781FF7A68FB68DB0017 -:10B2500013449B8803F00803002B06D07B894FF42E -:10B2600044711846FEF772FF05E07B8940F2113108 -:10B270001846FEF76BFF7A68FB68DB0013449B8877 -:10B2800003F02003002B05D07B8903211846FEF72D -:10B29000DEFD04E07B8902211846FEF7D8FD7A68BE -:10B2A000FB68DB0013449B8803F01003002B05D0E0 -:10B2B0007B8901211846FEF7CAFD04E07B89002145 -:10B2C0001846FEF7C4FD7A68FB68DB0013449B88D0 -:10B2D00003F00103002B1ED07A68FB68DB001344E7 -:10B2E000DA887B8911461846FEF730FF7A68FB68DA -:10B2F000DB0013441A897B8911461846FEF726FFA6 -:10B300007A68FB68DB0013445A897B89114618462A -:10B31000FEF71CFF05E07B894FF480711846FEF7AD -:10B3200015FFFB680133FB60FB68052B7FF753AF0C -:10B330000220FEF71BFC02E000BF00E000BF103758 -:10B34000BD4680BDB4F3030880B586B000AFF86099 -:10B35000B9607A60FA68BB689A420AD2BA68FB6838 -:10B36000D31A1846E5F7FEF802460B46C7E9042350 -:10B3700009E0FA68BB68D31A1846E5F7F3F8024605 -:10B380000B46C7E90423FA68BB6813441846E5F77F -:10B39000E9F802460B46D7E90401E5F75DF90246F4 -:10B3A0000B46C7E904237868E5F7DCF802460B464C -:10B3B000D7E90401E5F750F902460B46C7E9042333 -:10B3C00010A3D3E90023D7E90401E5F76FFA024699 -:10B3D0000B46C7E904234FF00002094BD7E90401EB -:10B3E000E4F784FF02460B4610461946E5F70CFCCD -:10B3F000034618461837BD4680BD00BFAFF3008036 -:10B400000000E03F00000000882AA1410000000089 -:10B4100080B586B000AFF860B9607A60FB68002B39 -:10B4200003D0BA687B689A4201D100234EE0BA6823 -:10B430007B689A420AD27A68BB68D31A1846E5F745 -:10B4400091F802460B46C7E9042309E0BA687B6815 -:10B45000D31A1846E5F786F802460B46C7E90423D7 -:10B46000BA687B6813441846E5F77CF802460B4639 -:10B47000D7E90401E5F7F0F802460B46C7E90423D3 -:10B48000D7E9042315A1D1E90001E5F70FFA024637 -:10B490000B46C7E90423F868E5F764F802460B4653 -:10B4A000D7E90401E5F7D8F802460B46C7E90423BB -:10B4B0004FF00002084BD7E90401E4F717FF0246FA -:10B4C0000B4610461946E5F79FFB0346184618370A -:10B4D000BD4680BDAFF300800000E03F00000000EB -:10B4E000882AA14100000000B0B586B000AFF86026 -:10B4F000B9607A60F868E5F735F82EA3D3E9002340 -:10B50000E5F7AAF802460B4614461D467868E5F7AB -:10B5100039F802460B4620462946E5F7C7F90246A8 -:10B520000B46C7E90423B868E5F71CF804460D4646 -:10B53000B868E5F717F802460B4620462946E5F7B6 -:10B540008BF802460B46D7E90401E4F7CFFE02462A -:10B550000B46C7E904234FF000024FF00003D7E980 -:10B560000401E5F709FB0346002B06D097ED040B19 -:10B570000CF0BCF987ED040B05E04FF000024FF032 -:10B580000003C7E904234FF00002094BD7E9040187 -:10B59000E4F7ACFE02460B4610461946E5F734FBCD -:10B5A000034618461837BD46B0BD00BFAFF3008054 -:10B5B0000000E03F00000000882AA14100000000D8 -:10B5C00080B5ECB004AF07F5D073A3F5CE73186067 -:10B5D0000023C7F8243107F5D073A3F5CE731B6899 -:10B5E000002B0AD18C4809F033FE4FF0FF33C7F827 -:10B5F0009831D7F8983101F05ABB07F5D073A3F50D -:10B60000CE731B681B68012B0AD0844809F020FE0A -:10B610004FF0FF33C7F89831D7F8983101F047BBA6 -:10B620000023C7F89C311CE007F5D073A3F5CE7357 -:10B630001B681B689BB203F00F039BB243F480733B -:10B6400099B207F5D073A3F5CE731A68D7F89C3179 -:10B65000DB0013440A469A81D7F89C310133C7F8BE -:10B660009C31D7F89C31052BDEDD07F5D073A3F5AF -:10B67000CE731B6804331846FFF79AFD07F5D073A5 -:10B68000A3F5CE731B68D3F88030002B10D007F5DC -:10B69000D073A3F5CE731B685B68002B08D007F549 -:10B6A000D073A3F5CE731B68D3F88030642098471D -:10B6B00007F5D073A3F5CE731B68D3F8A830002B21 -:10B6C00032D007F5D073A3F5CE731B68D3F8A8303A -:10B6D00007F5D072A2F5CE721268D2F8AC0007F569 -:10B6E000D072A2F5CE721268D2F8B02011469847F7 -:10B6F0000346A7F83A31B7F83A31002B14D0B7F81F -:10B700003A2107F5D073A3F5CE731B68DA67B7F853 -:10B710003A311946424809F0FFFC0223C7F8983134 -:10B72000D7F8983101F0C3BA07F5D073A3F5CE73FB -:10B730001B68D3F8A430002B32D007F5D073A3F5E3 -:10B74000CE731B68D3F8A43007F5D072A2F5CE7281 -:10B750001268D2F8AC0007F5D072A2F5CE7212686A -:10B76000D2F8B020114698470346A7F83A31B7F807 -:10B770003A31002B14D0B7F83A2107F5D073A3F56E -:10B78000CE731B68DA67B7F83A311946254809F0D5 -:10B79000C3FC0323C7F89831D7F8983101F087BA72 -:10B7A00007F5D073A3F5CE731B68D3F8A030002B38 -:10B7B0003CD007F5D073A3F5CE731B68D3F8A03047 -:10B7C00007F5D072A2F5CE721268D2F8AC0007F578 -:10B7D000D072A2F5CE721268D2F8B0201146984706 -:10B7E0000346A7F83A31B7F83A31002B1ED0B7F824 -:10B7F0003A2107F5D073A3F5CE731B68DA67B7F863 -:10B800003A311946084809F087FC0423C7F89831F3 -:10B81000D7F8983101F04BBAD0AA0308E8AA030878 -:10B8200008AB03083CAB03086CAB030807F5D07307 -:10B83000A3F5CE731B68DB6DC7F8003107F5D07335 -:10B84000A3F5CE731B685B6EC7F8343107F5D07370 -:10B85000A3F5CE731B689B6EC7F8303107F5D07324 -:10B86000A3F5CE731B681B6EC7F8FC3007F5D073C9 -:10B87000A3F5CE731B68DB6EC7F8F83007F5D073FD -:10B88000A3F5CE731B681B6FC7F82C3107F5D07377 -:10B89000A3F5CE731B685B6FC7F8283107F5D0732B -:10B8A000A3F5CE731B685A6F13469B001344C7F869 -:10B8B000F430D7F80031002B1BD0D7F83431002BEF -:10B8C00017D0D7F83031002B13D0D7F8FC30002B2D -:10B8D0000FD0D7F8F830002B0BD0D7F82C31002B35 -:10B8E00007D0D7F82831002B03D0D7F8F430002B3D -:10B8F0001FD1A94809F0ACFCD7F828310393D7F839 -:10B900002C310293D7F8F8300193D7F8FC3000932C -:10B91000D7F83031D7F83421D7F800119F4809F013 -:10B92000FBFB4FF0FF33C7F89831D7F8983101F09F -:10B93000BEB907F5D073A3F5CE731B681B68A7F8D3 -:10B94000F230B7F8F230012B1CD14FF49073A7F806 -:10B95000723140F22113A7F870310423A7F86E3139 -:10B960000823A7F86C310123A7F86A310223A7F84E -:10B9700068314FF48873A7F8663140F21113A7F8C5 -:10B98000643102E0864809F063FC0023C7F8943173 -:10B990000023C7F890310023C7F88C310023C7F883 -:10B9A000883107F5D073A3F5CE731B681B6DC7F8FC -:10B9B0007C3107F5D073A3F5CE731B681B6DC7F8F8 -:10B9C00078310023C7F89C316AE007F5D073A3F5FE -:10B9D000CE731B68D7F89C210E3253F82230002B0F -:10B9E0001CDB07F5D073A3F5CE731B68D7F89C2139 -:10B9F0000E3253F82230194607F5D073A3F5807341 -:10BA0000D7F89C2143F8221007F5D073A3F5A4734F -:10BA1000D7F89C21012143F822101DE007F5D073CF -:10BA2000A3F5CE731B68D7F89C210E3253F8223051 -:10BA30005B42194607F5D073A3F58073D7F89C21B4 -:10BA400043F8221007F5D073A3F5A473D7F89C210F -:10BA50004FF0FF3143F8221007F5D073A3F5807340 -:10BA6000D7F89C2153F82230D7F894219A4209D272 -:10BA700007F5D073A3F58073D7F89C2153F82230D3 -:10BA8000C7F8943107F5D073A3F58C73D7F89C21D0 -:10BA9000002143F82210D7F89C310133C7F89C31BC -:10BAA000D7F89C31052B90DD07F5D073A3F5CE7345 -:10BAB0001B685B6DC7F8943107F5D073A3F5CE739F -:10BAC0001B689B6DC7F8EC30D7F89431002B06D17A -:10BAD000344809F0BDFB4FF0FF3301F0E8B8D7F868 -:10BAE0009431012B0BD80123C7F89031D7F894314A -:10BAF000C7F88C31D7F89431C7F8883132E0D7F8DD -:10BB0000EC305B00D7F894219A420FD20223C7F899 -:10BB10009031D7F894315B08C7F88C31D7F894216D -:10BB2000D7F88C31D31AC7F888311BE0D7F89421A5 -:10BB3000D7F8EC3013445A1ED7F8EC30B2FBF3F3CD -:10BB4000C7F89031D7F8EC30C7F88C31D7F890317E -:10BB5000013BD7F88C2102FB03F3D7F89421D31AC9 -:10BB6000C7F88831D7F89031002B07D0D7F88C313F -:10BB7000002B03D0D7F88831002B17D1D7F88831A4 -:10BB8000D7F88C21D7F89011074809F0C5FA4FF083 -:10BB9000FF3301F08CB800BFA0AB0308BCAB0308B7 -:10BBA00020AC030834AC030850AC0308D7F8F820E5 -:10BBB000D7F83411D7F80001FFF7C6FBC7F820010A -:10BBC000D7F82C21D7F83411D7F8FC00FFF7BCFBCD -:10BBD000C7F81C01D7F82021D7F81C311344D7F837 -:10BBE00094219A421AD3D7F82021D7F81C311A444D -:10BBF000D7F8EC301344D7F894219A4280F0CE80E5 -:10BC0000D7F82031D7F8EC20B3FBF2F2D7F8EC10DC -:10BC100001FB02F29B1A002B00F0C080D7F8200134 -:10BC2000E4F7A0FC02460B46C7E93823D7F82021E9 -:10BC3000D7F81C3113441846E4F794FC02460B462F -:10BC4000D7E93801E4F732FE02460B46C7E938234C -:10BC5000D7F89401E4F786FC02460B46D7E9380191 -:10BC6000E4F7FAFC02460B46C7E93823D7F8EC00A4 -:10BC7000E4F778FC02460B46D7E93801E4F716FEF4 -:10BC800002460B46C7E93823D7E93801E4F7BCFF81 -:10BC90000346C7F82031D7F82031002B08D0D7F859 -:10BCA0002031D7F8EC2002FB03F3C7F8203104E081 -:10BCB000D7F894315B08C7F82031D7F820315B0002 -:10BCC0001846E4F74FFC02460B46C7E93623CBA3E0 -:10BCD000D3E90023D7E93601E4F7BEFC02460B4660 -:10BCE000C7E93623D7F8F800E4F73CFC02460B46D8 -:10BCF000D7E93601E4F7DAFD02460B46C7E93623F9 -:10BD0000D7F80001E4F72EFC02460B46D7E93601CE -:10BD1000E4F7EAFA02460B46C7E93623D7F80001F2 -:10BD2000E4F720FC02460B46C7E93823D7F80001A8 -:10BD3000E4F718FC02460B46D7E93801E4F78CFC1F -:10BD400002460B46C7E93823D7E93823D7E936013D -:10BD5000E4F7CCFA02460B46C7E9362397ED360BDB -:10BD60000BF0C4FD87ED380B4FF00002A24BD7E972 -:10BD70003801E4F7BBFA02460B4610461946E4F7D1 -:10BD800043FF0346C7F83431D7F82C21D7F83411D4 -:10BD9000D7F8FC00FFF7D8FAC7F81C010023C7F852 -:10BDA00060310023C7F858310023C7F85C31002305 -:10BDB000C7F854310023C7F850310023C7F84C317D -:10BDC0000023C7F848310023C7F844310023C7F8DF -:10BDD0004031D7F89031C7F88431D7F89031C7F89F -:10BDE00080310023C7F874310023C7F8183107F5F4 -:10BDF000D073A3F5CE731B680022DA670023C7F85F -:10BE000014310023C7F810310023C7F8983107F523 -:10BE1000D073A3F5CE731B68D3F88C30002B16D0EB -:10BE200007F5D073A3F5CE731B68D3F88C3007F5F4 -:10BE3000D072A2F5CE721268D2F8940007F5D072D3 -:10BE4000A2F5CE721268D2F89820114698470220C7 -:10BE5000FDF78CFE07F1080338220021184608F090 -:10BE6000E9FC00F0BABED7F84031002B40F03C822C -:10BE7000D7F85C3103F00303032B00F03582D7F8C9 -:10BE80008431002B04D1D7F87C31002B00F02C82B8 -:10BE9000D7F88431012B0BD1D7F88831C7F824317A -:10BEA000D7F87C31002B2AD10123C7F8603126E076 -:10BEB000D7F88C31C7F82431D7F87C31002B1ED14C -:10BEC000D7F86031002B1AD1D7F81C21D7F8883168 -:10BED0009A4214D9D7F884315A1ED7F81C11D7F8D2 -:10BEE0008831C91AD7F88C310B44591ED7F88C31D8 -:10BEF000B1FBF3F39A4202D80123C7F86031D7F8B7 -:10BF00007421D7F824311344C7F87431D7F860315D -:10BF1000012B37D1D7F81C21D7F888319A4213D991 -:10BF2000D7F81C21D7F88831D31AD7F82421B3FBCE -:10BF3000F2F2D7F8241101FB02F29B1AD7F8242160 -:10BF4000D31AC7F8183106E0D7F88821D7F81C3182 -:10BF5000D31AC7F81831D7F81821D7F824319A42E4 -:10BF600002D30023C7F81831D7F81C31002B09D0B1 -:10BF7000D7F81821D7F82431D31AD7F81C21134445 -:10BF8000C7F81C310023C7F89C3110E107F5D073C6 -:10BF9000A3F58073D7F89C2153F82230002B00F0D2 -:10BFA000EA80D7F85831002B06D107F5D073A3F5F6 -:10BFB000CC7301229A8005E007F5D073A3F5CC730A -:10BFC00002229A8007F5D073A3F5CC73B7F8F2205C -:10BFD0005A8007F5D073A3F5A473D7F89C2153F8C2 -:10BFE0002230002B0EDB07F5D073A3F5CC730022B3 -:10BFF0001A610EE0AFF300800000E03F0000000097 -:10C00000882A914107F5D073A3F5CC734FF04042D5 -:10C010001A6107F5D073A3F5CC7302229A82CA4A3B -:10C02000D7F89C3132F8132007F5D073A3F5CC7301 -:10C030001A8007F5D073A3F5CC7300229A6007F538 -:10C04000D073A3F5CC73D7F82421DA6007F5D07349 -:10C05000A3F58073D7F89C2153F822301846E4F7F3 -:10C0600081FA02460B46C7E93823D7F87401E4F792 -:10C0700079FA02460B46D7E93801E4F7EDFA0246B1 -:10C080000B46C7E93823D7F89401E4F76BFA024668 -:10C090000B46D7E93801E4F709FC02460B46C7E92D -:10C0A000382307F5D073A3F58C73D7F89C2153F888 -:10C0B00022301846E4F756FA02460B46D7E9380113 -:10C0C000E4F712F902460B46C7E938234FF00002A5 -:10C0D0009E4BD7E93801E4F709F902460B461046B2 -:10C0E0001946E4F791FD0346A7F8D63007F5D0735B -:10C0F000A3F58C73D7F89C2153F82220B7F8D630DB -:10C10000D11807F5D073A3F58C73D7F89C2143F8A9 -:10C11000221007F5D073A3F5CC73B7F8D620DA82D6 -:10C1200007F5D073A3F5CC7300221A8307F5D073FB -:10C13000A3F5CC730022DA8607F108031846FEF750 -:10C1400077F8C7F89801D7F89831002B03DAD7F8B9 -:10C15000983100F0ACBDD7F87421D7F894319A42E9 -:10C1600020D307F5D073A3F58C73D7F89C21002159 -:10C1700043F8221016E0D7F85831002B09D1724A43 -:10C18000D7F89C3132F8133001211846FEF7BAF97E -:10C1900008E06D4AD7F89C3132F813300221184676 -:10C1A000FEF7B0F9D7F89C310133C7F89C31D7F8C6 -:10C1B0009C31052B7FF7EAAED7F87421D7F894317C -:10C1C0009A4202D30023C7F8743107F5D073A3F560 -:10C1D000B073B7F8F2201A80D7F85831002B10D17D -:10C1E000D7F85C3143F00103C7F85C3107F5D07331 -:10C1F000A3F5B07301225A80D7F82431C7F814315F -:10C200000FE0D7F85C3143F00203C7F85C3107F563 -:10C21000D073A3F5B07302225A80D7F82431C7F83F -:10C220001031D7F86031002B1BD107F5D073A3F57F -:10C23000B073D7F800219A6007F5D073A3F5B073F7 -:10C24000D7F83421DA6007F5D073A3F5B073002274 -:10C250005A6107F5D073A3F5B073D7F8F8205A6088 -:10C260001BE007F5D073A3F5B073D7F8FC209A60F4 -:10C2700007F5D073A3F5B073D7F8FC20DA6007F5A3 -:10C28000D073A3F5B073D7F818215A6107F5D073AE -:10C29000A3F5B073D7F82C215A6007F5D073A3F536 -:10C2A000B073D7F824211A6107F140031846FDF74F -:10C2B0006DFCD7F88431013BC7F88431D7F884315D -:10C2C000002B0CD1D7F87C31002B08D0D7F87C316B -:10C2D000013BC7F87C31D7F89031C7F88431D7F8E3 -:10C2E0005831DB43C7F858310023C7F89831002391 -:10C2F000A7F83A31D7F85431002B0FD007F5D07397 -:10C30000A3F5CE731B689B6ED7F830219A4205D0F7 -:10C310000F4808F09DFF0023C7F8543107F5D0738C -:10C32000A3F5CE731B689B6EC7F830316423C7F842 -:10C330000C31FDF7F7F90346A7F83E31FDF7F2F9A6 -:10C340000346A7F83C310EE0B4F303080000E03FD9 -:10C3500088AC0308B7F83C31A7F83E31FDF7E2F9A5 -:10C360000346A7F83C31B7F83E21B7F83C319A4272 -:10C37000F0D1B7F86E21B7F86A3113439AB2B7F823 -:10C380003C3113409AB2B7F86E11B7F86A310B43DB -:10C390009BB29A4211D0B7F86C21B7F868311343B9 -:10C3A0009AB2B7F83C3113409AB2B7F86C11B7F8AB -:10C3B00068310B439BB29A4211D1B7F83C11D7F8C0 -:10C3C0000C31C3F164031A46CE4808F0A5FED7F835 -:10C3D0000C315A1EC7F80C21002BAAD100E000BF77 -:10C3E000D7F80C31002B0CD1C74808F031FFB7F853 -:10C3F000F2301846FDF7D0FC6FF00203C7F8983111 -:10C40000E7E3B7F83C21B7F86E3113409BB2002B3D -:10C4100023D0B7F872311846FDF7A8FBD7F85C3186 -:10C4200003F0FE03C7F85C31D7F88031013BC7F851 -:10C430008031D7F88031002B0CD1D7F87831002B20 -:10C4400008D0D7F87831013BC7F87831D7F8903168 -:10C45000C7F880310023C7F81431B7F83C21B7F88A -:10C460006C3113409BB2002B23D0B7F870311846C3 -:10C47000FDF77CFBD7F85C3103F0FD03C7F85C31B6 -:10C48000D7F88031013BC7F88031D7F88031002BD5 -:10C490000CD1D7F87831002B08D0D7F87831013B90 -:10C4A000C7F87831D7F89031C7F880310023C7F842 -:10C4B0001031B7F83C3103F40053002B1AD0FDF7CC -:10C4C0002FFB0346A7F83A310220FDF74FFBB7F8E0 -:10C4D000F2301846FDF760FCB7F83A31002B05D072 -:10C4E000B7F83A311946894808F016FE0123C7F813 -:10C4F00098316EE3B7F86A21B7F8683113439AB2FE -:10C50000B7F83C3113409BB2002B29D1B7F8F23079 -:10C510001846FDF741FC07F5D073A3F5CE731B68F1 -:10C520009B6F012B0BD1D7F85031012B03D1032383 -:10C53000C7F898314DE30423C7F8983149E3D7F899 -:10C540008031002B07D1D7F87831002B03D100239D -:10C55000C7F898313DE36FF00103C7F8983138E32D -:10C5600007F5D073A3F5CE731B68D3F8A830002B62 -:10C5700034D007F5D073A3F5CE731B68D3F8A83079 -:10C5800007F5D072A2F5CE721268D2F8AC0007F5AA -:10C59000D072A2F5CE721268D2F8B0201146984738 -:10C5A0000346A7F83A31B7F83A31002B16D0B7F85E -:10C5B0003A2107F5D073A3F5CE731B68DA67B7F895 -:10C5C000F2301846FDF7E8FBB7F83A311946504803 -:10C5D00008F0A2FD0223C7F89831FAE2D7F84C31EF -:10C5E000002B0ED1D7F85031012B00F01B8107F53D -:10C5F000D073A3F5CE731B68D3F8A430002B00F0E2 -:10C600001181D7F84C31002B25D107F5D073A3F554 -:10C61000CE731B68D3F8A43007F5D072A2F5CE72A2 -:10C620001268D2F8AC0007F5D072A2F5CE7212688B -:10C63000D2F8B020114698470346A7F83A31B7F828 -:10C640003A31002B07D0B7F83A2107F5D073A3F59C -:10C65000CE731B68DA67B7F83A31002B04D1D7F8EC -:10C660004C31002B00F0DE8007F5D073A3F5CE73BC -:10C670001B689B6F012B40F0AB80B7F8F230184677 -:10C68000FDF796F8C7F8D000D7F82821D7F8FC10A6 -:10C69000D7F8D000FEF758FEC7F8CC00B7F8F23054 -:10C6A0001846FDF7DBF8C7F8C800FDF73BF803466E -:10C6B000A7F83E31FDF736F80346A7F83C3108E00D -:10C6C000B7F83C31A7F83E31FDF72CF80346A7F840 -:10C6D0003C31B7F83E21B7F83C319A42F0D1002303 -:10C6E000C7F80831D7F81421D7F810311A44D7F811 -:10C6F000C830D31AD7F8CC209A420BD90123C7F8F7 -:10C700004C3165E0ACAC0308D0AC0308E8AC0308DE -:10C7100004AD0308B7F83C21B7F86A3113409BB267 -:10C72000002B15D0D7F81421D7F8C830D31AD7F872 -:10C73000CC209A4229D2D7F81421D7F8C830D31A7E -:10C74000C7F80831B7F864311846FDF70FFA1CE056 -:10C75000B7F83C21B7F8683113409BB2002B14D0D6 -:10C76000D7F81021D7F8C830D31AD7F8CC209A427E -:10C770000BD2D7F81021D7F8C830D31AC7F8083130 -:10C78000B7F866311846FDF7F1F9D7F80831002BF4 -:10C7900009D1D7F81421D7F810311A44D7F8C83086 -:10C7A000D31AC7F80831D7F8CC30D7F8242102FBC8 -:10C7B00003F3D7F8FC20D7F8D0101846FEF728FE70 -:10C7C000C7F828010023C7F84C310123C7F84031CE -:10C7D0000123C7F8503107F5D073A3F5B073B7F84C -:10C7E000F2201A8007F5D073A3F5B07303225A80A4 -:10C7F00007F5D073A3F5B073D7F828215A6007F571 -:10C80000D073A3F5B073D7F8FC20DA6007F5D073C6 -:10C81000A3F5B073D7F8FC209A6007F140031846DF -:10C82000FDF7B4F9D7F84431002B04D1D7F84831DB -:10C83000012B00F01681D7F84431002B32D1D7F804 -:10C840004831012B2ED007F5D073A3F5CE731B68AA -:10C85000D3F8A030002B25D007F5D073A3F5CE7305 -:10C860001B68D3F8A03007F5D072A2F5CE7212681B -:10C87000D2F8AC0007F5D072A2F5CE721268D2F8E9 -:10C88000B020114698470346A7F83A31B7F83A3135 -:10C89000002B07D0B7F83A2107F5D073A3F5CE7374 -:10C8A0001B68DA67B7F83A31002B04D1D7F8443166 -:10C8B000002B00F0D68007F5D073A3F5CE731B686C -:10C8C0009B6F012B40F0A380B7F8F2301846FCF7BD -:10C8D0006FFFC7F8C400D7F82C21D7F8FC10D7F8A1 -:10C8E000C400FEF731FDC7F8C000B7F8F2301846B3 -:10C8F000FCF7B4FFC7F8BC00FCF714FF0346A7F829 -:10C900003E31FCF70FFF0346A7F83C3108E0B7F8CB -:10C910003C31A7F83E31FCF705FF0346A7F83C3150 -:10C92000B7F83E21B7F83C319A42F0D10023C7F85E -:10C930000431D7F81421D7F810311A44D7F8BC3095 -:10C94000D31AD7F8C0209A4203D90123C7F844313B -:10C950005DE0B7F83C21B7F86A3113409BB2002B79 -:10C9600015D0D7F81421D7F8BC30D31AD7F8C02087 -:10C970009A4229D2D7F81421D7F8BC30D31AC7F875 -:10C980000431B7F864311846FDF7F0F81CE0B7F849 -:10C990003C21B7F8683113409BB2002B14D0D7F874 -:10C9A0001021D7F8BC30D31AD7F8C0209A420BD246 -:10C9B000D7F81021D7F8BC30D31AC7F80431B7F82C -:10C9C00066311846FDF7D2F8D7F80431002B09D1AB -:10C9D000D7F81421D7F810311A44D7F8BC30D31A3D -:10C9E000C7F80431D7F8C030D7F8242102FB03F38D -:10C9F000D7F8FC20D7F8C4101846FEF709FDC7F891 -:10CA00002C010023C7F844310123C7F8403101232A -:10CA1000C7F8483107F5D073A3F5B073B7F8F22023 -:10CA20001A8007F5D073A3F5B07303225A8007F577 -:10CA3000D073A3F5B073D7F82C215A6007F5D073E3 -:10CA4000A3F5B073D7F8FC20DA6007F5D073A3F52F -:10CA5000B073D7F8FC209A6007F140031846FDF741 -:10CA600095F807F5D073A3F5CE731B68D3F89C3007 -:10CA7000002B58D007F5D073A3F5CE731B68D3F8FD -:10CA80009C3007F5D072A2F5CE721268D2F8AC00D5 -:10CA900007F5D072A2F5CE721268D2F8B020114616 -:10CAA00098470346A7F83E31B7F83E31002B2ED009 -:10CAB000D7F85431002B36D10123C7F8543107F58C -:10CAC000D073A3F5B073B7F8F2201A8007F5D073CE -:10CAD000A3F5B07303225A8007F5D073A3F5B073A2 -:10CAE000D7F8F4205A6007F5D073A3F5B073D7F8E0 -:10CAF0003021DA6007F5D073A3F5B073D7F8302191 -:10CB00009A6007F140031846FDF740F80BE0D7F8AC -:10CB10005431012B07D10023C7F85431B7F8F23054 -:10CB20001846FDF761F9D7F85031012B03D0D7F83B -:10CB30004831012B21D107F5D073A3F5CE731B68C3 -:10CB40009B6F002B19D1B7F8F2301846FCF730FE76 -:10CB50000346C7F8B830D7F8B830D7F8FC209A4267 -:10CB60000BD3D7F85031012B03D10323C7F89831E9 -:10CB70002FE00423C7F898312BE007F17003184623 -:10CB8000FEF764FA0346002B20D107F17003184624 -:10CB9000FEF7ACFA07F5D073A3F5CE731B68D3F894 -:10CBA0008430002B15D007F5D073A3F5CE731B6826 -:10CBB000D3F8843007F5D072A2F5CE721268D2F89D -:10CBC000882007F170011046984702E00523C7F856 -:10CBD0009831D7F89831002B0AD1D7F88031002B43 -:10CBE0007FF441A9D7F87831002B7FF43CA900E00D -:10CBF00000BFB7F8F2301846FDF7CEF807F5D0734E -:10CC0000A3F5CE731B68D3F89030002B16D007F530 -:10CC1000D073A3F5CE731B68D3F8903007F5D072AC -:10CC2000A2F5CE721268D2F8940007F5D072A2F580 -:10CC3000CE721268D2F898201146984707F1700317 -:10CC40001846FEF703FA0346002B20D107F17003C4 -:10CC50001846FEF74BFA07F5D073A3F5CE731B68A1 -:10CC6000D3F88430002B15D007F5D073A3F5CE731D -:10CC70001B68D3F8843007F5D072A2F5CE72126823 -:10CC8000D2F8882007F170011046984702E005238A -:10CC9000C7F89831D7F89831002B06D107F5D07333 -:10CCA000A3F5CE731B680022DA67D7F898311846CF -:10CCB00007F5D077BD4680BD80B5ACB000AF7860D9 -:10CCC0007B68002B0AD1B04808F0C2FA4FF0FF335E -:10CCD000C7F8A430D7F8A43000F0F0BC7B681B681C -:10CCE000012B0AD0A94808F0B3FA4FF0FF33C7F878 -:10CCF000A430D7F8A43000F0E1BC0023C7F8AC3072 -:10CD000014E07B681B689BB203F00F039BB243F4F3 -:10CD1000807399B27A68D7F8AC30DB0013440A46C6 -:10CD20009A81D7F8AC300133C7F8AC30D7F8AC30C3 -:10CD3000052BE6DD7B68D3F8C431002B20D07B685F -:10CD4000D3F8C4317A68D2F8C8017A68D2F8CC2115 -:10CD500011469847C7F88400D7F88430002B0FD0CD -:10CD60007B68D7F884205A65D7F88410884808F083 -:10CD7000D3F90223C7F8A430D7F8A43000F09EBC42 -:10CD80007B68D3F8C031002B20D07B68D3F8C0314A -:10CD90007A68D2F8C8017A68D2F8CC21114698474F -:10CDA000C7F88400D7F88430002B0FD07B68D7F801 -:10CDB00084205A65D7F88410764808F0ADF903232B -:10CDC000C7F8A430D7F8A43000F078BC7B68D3F85B -:10CDD000BC31002B20D07B68D3F8BC317A68D2F804 -:10CDE000C8017A68D2F8CC2111469847C7F8840068 -:10CDF000D7F88430002B0FD07B68D7F884205A6591 -:10CE0000D7F88410644808F087F90423C7F8A430E1 -:10CE1000D7F8A43000F052BC7B6804331846FEF704 -:10CE2000C7F97B68D3F89431002B08D07B685B6826 -:10CE3000002B04D07B68D3F89431642098470023FA -:10CE4000C7F8A0300023C7F89C300023C7F89430FF -:10CE50007B6800221A642423C7F880307B68002294 -:10CE60005A657B681B68A7F87E30B7F87E30012BC7 -:10CE700014D14FF49073A7F8923040F22113A7F821 -:10CE800090300423A7F88E300823A7F88C300123B4 -:10CE9000A7F88A300223A7F8883002E03F4808F05C -:10CEA000D7F97B68D3F8A831002B0AD07B68D3F878 -:10CEB000A8317A68D2F8B0017A68D2F8B421114664 -:10CEC00098470220FCF752FE07F10C03382200219C -:10CED000184607F0AFFC7B68D7F8A0205A647B683F -:10CEE000D3F89831002B0BD07B68D3F898317A684F -:10CEF000D2F89C017A68383211469847C7F8A400E6 -:10CF000007F15C031846FEF7A1F80346002B14D185 -:10CF100007F15C031846FEF7E9F87B68D3F8A03107 -:10CF2000002B0ED07B68D3F8A0317A68D2F8A42108 -:10CF300007F15C011046984703E00523C7F8A430C9 -:10CF400085E3D7F8A03003F00303032B00F0218121 -:10CF50007B689B6E002B00F01C817B681B6D032B94 -:10CF600004D17B681B6C002B40F313817B681B6C26 -:10CF7000002B04DD7B681B6C5A1E7B681A6400233F -:10CF8000C7F8AC30BBE000BF24AD03084CAD0308CC -:10CF90007CAD0308B4AD0308E8AD030820AC03087A -:10CFA0007A68D7F8AC303C335B0013449B88002B85 -:10CFB00000F089807A68D7F8AC303C335B001344CA -:10CFC0009B883B84884AD7F8AC3032F81330BB8159 -:10CFD000B7F87E30FB81D7F89C30002B02D10123BB -:10CFE0003B8201E002233B827A68D7F8AC302033E1 -:10CFF0009B0013449B687B617A68D7F8AC3026337A -:10D000009B0013449B68BB61BA6913461B019A1AC3 -:10D010007B68DB6E9A4207D27B68DB6E0E33734A05 -:10D02000A2FB0323DB08BB614FF0FF33FB6100234E -:10D03000C7F8A83017E07A68D7F8AC301901D7F8EC -:10D04000A8300B4458335B0013441A89D7F8A83032 -:10D0500008335B00B0333B4423F89E2CD7F8A8304C -:10D060000133C7F8A8307A68D7F8AC303C335B009E -:10D0700013449B881A46D7F8A8309342DBDBD7F8D5 -:10D08000A83008335B00B0333B44002223F89E2CC9 -:10D090003B8C01339BB23B847A68D7F8AC30343395 -:10D0A0005B0013441B89A7F8423007F10C031846B4 -:10D0B000FDF7BEF8C7F8A400D7F8A430002B19DAA2 -:10D0C000D7F8A430FAE2D7F89C30002B09D1464AB1 -:10D0D000D7F8AC3032F8133001211846FDF712FAB8 -:10D0E00008E0414AD7F8AC3032F813300221184634 -:10D0F000FDF708FAD7F8AC300133C7F8AC30D7F8F1 -:10D10000AC30052B7FF74CAFB7F87E30A7F8443032 -:10D11000D7F89C30002B09D1D7F8A03043F0010399 -:10D12000C7F8A0300123A7F8463008E0D7F8A030B0 -:10D1300043F00203C7F8A0300223A7F846307B680B -:10D14000D3F87831FB647B68D3F87C313B650023EE -:10D15000BB657B68D3F88031BB647B68DB6E7B6525 -:10D1600007F144031846FCF711FDC7F8A400D7F8EF -:10D17000A430002BC0F25B82D7F89C30DB43C7F8A9 -:10D180009C307B689B6B5A1C7B689A637B6800228F -:10D190009A660023C7F8A4300023C7F88430FCF750 -:10D1A000C1FA0346A7F89830FCF7BCFA0346A7F883 -:10D1B0009A3008E0B7F89A30A7F89830FCF7B2FA3E -:10D1C0000346A7F89A30B7F89820B7F89A309A42F1 -:10D1D000F0D1FCF7A7FA0346A7F89830FCF7A2FABB -:10D1E0000346A7F89A300CE0B4F3030889888888CE -:10D1F000B7F89A30A7F89830FCF794FA0346A7F8E6 -:10D200009A30B7F89820B7F89A309A42F0D1B7F828 -:10D210008E20B7F88C3013439AB2B7F89A30134087 -:10D220009BB2002B00F0AE807B681B6D002B39D0C9 -:10D23000B7F87E301846FCF7BBFAB867D7F89430D9 -:10D240007B677B6F002B2DDD7B68DB6E7A6F02FBCB -:10D2500003F37B67786F7B68D3F878311A46B96F30 -:10D26000FEF7D6F8C7F88000B7F87E30A7F844304C -:10D270000323A7F84630D7F88030BB647B68D3F827 -:10D2800078313B657B68D3F87831FB6407F1440360 -:10D290001846FCF77BFCC7F8A400D7F8A430002B95 -:10D2A000C0F2C781B7F89A20B7F88E3013409BB20E -:10D2B000002B2FD0B7F892301846FCF757FCD7F860 -:10D2C000A03003F0FE03C7F8A0307B68DB6B5A1C6C -:10D2D0007B68DA63B7F87E301846FCF77BFA0246C3 -:10D2E0007B689A647B68D3F884217B68DB6D1A4481 -:10D2F0007B68DB6B1A447B685A667B681B6D032B6B -:10D3000008D1D7F89430002B04D0D7F89430013BE3 -:10D31000C7F89430B7F89A20B7F88C3013409BB216 -:10D32000002B2FD0B7F890301846FCF71FFCD7F829 -:10D33000A03003F0FD03C7F8A0307B68DB6B5A1CFC -:10D340007B68DA63B7F87E301846FCF743FA02468A -:10D350007B689A647B68D3F884217B68DB6D1A4410 -:10D360007B68DB6B1A447B685A667B681B6D032BFA -:10D3700008D1D7F89430002B04D0D7F89430013B73 -:10D38000C7F89430B7F89A3003F40053002B14D048 -:10D39000FCF7C6FB0346C7F884300220FCF7E6FB27 -:10D3A000D7F88430002B04D0D7F88410A34807F0B6 -:10D3B000B3FE0123C7F8A43049E1B7F88A20B7F8D3 -:10D3C000883013439AB2B7F89A3013409BB2002BBF -:10D3D00007D17B689B6D002B03D10023C7F8A430D5 -:10D3E00035E17B68D3F8C431002B1DD07B68D3F8BE -:10D3F000C4317A68D2F8C8017A68D2F8CC211146D3 -:10D400009847C7F88400D7F88430002B0CD07B688D -:10D41000D7F884205A65D7F88410894807F07CFE35 -:10D420000223C7F8A43012E17B681B6D002B7BD16F -:10D430007B68D3F8C031002B76D07B68D3F8C0313D -:10D440007A68D2F8C8017A68D2F8CC211146984798 -:10D45000C7F88400D7F88430002B65D07B68D7F8F4 -:10D4600084205A657B68D3F89031C7F88030B7F8CC -:10D470007E30A7F844300323A7F84630D7F8803031 -:10D48000BB64B7F87E301846FCF792F903463B655B -:10D490007B68D3F87831FB6407F144031846FCF746 -:10D4A00075FBC7F8A400D7F8A430002BC0F2C380E6 -:10D4B0003B6DF96CD7F880201846FDF745FFC7F89B -:10D4C00094007B68DB6E002B10D07B68DA6ED7F897 -:10D4D00094301344013BC7F894307B68DB6ED7F877 -:10D4E0009420B2FBF3F3C7F8943002E0554807F0FC -:10D4F000AFFE7B68DB6B1A46D7F8943013447A682A -:10D50000926B9B1A1A467B681A647B681B6C5A1CC8 -:10D510007B681A647B681B6C002B02DA7B68002234 -:10D520001A647B6802221A657B681B6D002B7FF4EE -:10D53000D2AC7B68D3F8BC31002B3FF4CCAC7B6819 -:10D54000D3F8BC317A68D2F8C8017A68D2F8CC2115 -:10D5500011469847C7F88400D7F88430002B3FF471 -:10D56000BAAC7B68D7F884205A657B68D3F88C31D5 -:10D57000C7F88030B7F87E30A7F844300323A7F807 -:10D580004630D7F88030BB64B7F87E301846FCF7D9 -:10D590000FF903463B657B68D3F87831FB6407F1EC -:10D5A00044031846FCF7F2FAC7F8A400D7F8A430F1 -:10D5B000002B4BDB3B6DF96CD7F880201846FDF74C -:10D5C000C3FEC7F894007B68DB6E002B10D07B682D -:10D5D000DA6ED7F894301344013BC7F894307B6877 -:10D5E000DB6ED7F89420B2FBF3F3C7F8943002E077 -:10D5F000154807F02DFE7B68DB6B1A46D7F8943090 -:10D6000013447A68926B9B1A1A467B681A647B688B -:10D610001B6C5A1C7B681A647B681B6C002B02DA3B -:10D620007B6800221A647B6801221A6553E400BFFC -:10D630000DE000BF0BE000BF09E000BF20AE030813 -:10D640003CAE03085CAE030874AE030800BFB7F835 -:10D650007E301846FCF7A0FB7B68D3F8AC31002B7A -:10D660000AD07B68D3F8AC317A68D2F8B0017A6816 -:10D67000D2F8B4211146984707F15C031846FDF72C -:10D68000E5FC0346002B14D107F15C031846FDF7B7 -:10D690002DFD7B68D3F8A031002B0DD07B68D3F82B -:10D6A000A0317A68D2F8A42107F15C0110469847AE -:10D6B00002E00523C7F8A430D7F8A4301846B037E5 -:10D6C000BD4680BD80B582B000AF786039603B68F0 -:10D6D000012B08D14FF4807279684FF48070EBF71A -:10D6E000D9FA034604E0044807F0B2FD4FF0FF33D7 -:10D6F00018460837BD4680BD8CAE030880B582B0A1 -:10D7000000AF786039603B68012B07D14FF480721D -:10D7100079684FF48070EBF7F6FA03E0034807F0FE -:10D7200097FD00BF0837BD4680BD00BF8CAE030823 -:10D7300080B500AF00F07AF800F086F800F092F8BB -:10D740000F4A10491048EAF77DF8104A104911486D -:10D75000EAF778F8104A11491148EAF773F8114AC4 -:10D7600011491248EAF76EF8114A12491248EAF7CD -:10D7700069F8124A12491348EAF764F800BF80BDFD -:10D78000B1E30208A0AE0308B4AE03089DE40208AA -:10D79000C0AE0308D4AE030889E50208E0AE030872 -:10D7A000F0AE03081DE60208FCAE03080CAF030848 -:10D7B000B1E6020818AF03082CAF03089DE7020882 -:10D7C00034AF030848AF030880B5A2B000AF0346EA -:10D7D0003960FB801346BB80BB88002B09D03B68B7 -:10D7E000002B06D0BA88FB8839681846EBF752FA46 -:10D7F00000E000BF8837BD4680BD80B5A2B000AF55 -:10D8000003463960FB801346BB80BB88002B09D0E0 -:10D810003B68002B06D0BA88FB8839681846EBF7BE -:10D8200072FA00E000BF8837BD4680BD80B500AF0A -:10D830004FF4806203494FF48060FFF7C5FF00BFDB -:10D8400080BD00BFFC3C002080B500AF4FF480627B -:10D8500003494FF40060FFF7B7FF00BF80BD00BF72 -:10D86000FC40002080B500AF4FF4806203494FF4C4 -:10D870004060FFF7A9FF00BF80BD00BFFC4400204F -:10D8800080B500AF4FF4806203494FF48060FFF72A -:10D89000B4FF00BF80BD00BFFC3C002080B500AFDE -:10D8A0004FF4806203494FF40060FFF7A6FF00BF0A -:10D8B00080BD00BFFC40002080B500AF4FF4806207 -:10D8C00003494FF44060FFF798FF00BF80BD00BFE1 -:10D8D000FC44002080B582B000AF124B1B68002BC7 -:10D8E0001CD000237B6010E07B689B0003333B600F -:10D8F0000C4B1A683B689B0013441A680A497B6802 -:10D9000041F823207B6801337B607B68FF2BEBDDD4 -:10D91000FFF7B6FF054807F09BFC00E000BF0837A3 -:10D92000BD4680BD38490020FC3C002050AF0308B4 -:10D9300080B582B000AF124B1B68002B1CD00023B7 -:10D940007B6010E07B689B0003333B600C4B1A68E4 -:10D950003B689B0013441A680A497B6841F82320FE -:10D960007B6801337B607B68FF2BEBDDFFF796FF65 -:10D97000054807F06DFC00E000BF0837BD4680BDDC -:10D980003C490020FC40002064AF030880B500AF94 -:10D990000A4B1B68002B0FD0084B1B68084A104627 -:10D9A00019464FF480631A4606F036FFFFF784FFEE -:10D9B000044807F04DFC00E000BF80BD4049002056 -:10D9C000FC44002078AF030880B584B000AF674BFB -:10D9D0001B68002B00F0C5800023FB60BCE0FB68E7 -:10D9E0009B00BB60FB689B0001337B60FB689B0076 -:10D9F00002333B605D4B1A68BB689B0013441B6895 -:10DA0000002B4DD15A4AFB6852F82320574B196816 -:10DA10007B689B000B441B689A421AD2FB68591C16 -:10DA2000534AFB6852F82300504B1A687B689B00EE -:10DA300013441B6802464F4807F06EFB4B4B1A68B5 -:10DA40007B689B0013441A684949FB6841F823200E -:10DA50007FE0474AFB6852F82320444B19683B6833 -:10DA60009B000B441B689A4273D9FB68591C404ABF -:10DA7000FB6852F823003D4B1A683B689B00134437 -:10DA80001B6802463C4807F047FB384B1A683B6866 -:10DA90009B0013441A683649FB6841F8232058E07C -:10DAA000324B1A68BB689B0013441B68012B50D192 -:10DAB0002F4AFB6852F8233019462C4B1A687B68B2 -:10DAC0009B0013441B6899421BDAFB68591C284AC7 -:10DAD000FB6852F823301846244B1A687B689B0079 -:10DAE00013441B680246234807F016FB1F4B1A68B5 -:10DAF0007B689B0013441A681D49FB6841F823208A -:10DB000027E01B4AFB6852F823301946174B1A6866 -:10DB10003B689B0013441B6899421ADDFB68591C43 -:10DB2000134AFB6852F823301846104B1A683B68BA -:10DB30009B0013441B6802460F4807F0EDFA0B4B9D -:10DB40001A683B689B0013441A680949FB6841F84E -:10DB50002320FB680133FB60FB68FF2B7FF73FAF9F -:10DB600000E000BF1037BD4680BD00BF384900202F -:10DB7000FC3C002090AF0308C8AF030880B586B016 -:10DB800000AF7860654B1B68002B00F0C3807B689A -:10DB9000002B40F3BF807B68B3F5807F00F3BA8031 -:10DBA0007B68013B7B617B699B003B617B699B00E0 -:10DBB0000133FB607B699B000233BB60574B1A68E3 -:10DBC0003B699B0013441B68002B4BD1544A7B6973 -:10DBD00052F82320514B1968FB689B000B441B68CB -:10DBE0009A4219D24E4A7B6952F823104B4B1A685D -:10DBF000FB689B0013441B680A467968494807F094 -:10DC00008BFA464B1A68FB689B0013441A68444918 -:10DC10007B6941F823207EE0414A7B6952F823204A -:10DC20003E4B1968BB689B000B441B689A4272D933 -:10DC30003B4A7B6952F82310384B1A68BB689B003B -:10DC400013441B680A467968374807F065FA334B76 -:10DC50001A68BB689B0013441A6831497B6941F814 -:10DC6000232058E02D4B1A683B699B0013441B6826 -:10DC7000012B50D12A4A7B6952F823301946274B91 -:10DC80001A68FB689B0013441B6899421ADA244AFD -:10DC90007B6952F823301946204B1A68FB689B00B9 -:10DCA00013441B680A4679681E4807F035FA1B4B77 -:10DCB0001A68FB689B0013441A6819497B6941F88C -:10DCC000232028E0164A7B6952F823301946134B6B -:10DCD0001A68BB689B0013441B6899421BDD104AFD -:10DCE0007B6952F8233019460C4B1A68BB689B00BD -:10DCF00013441B680A4679680B4807F00DFA074B76 -:10DD00001A68BB689B0013441A6805497B6941F88F -:10DD1000232000E000BF1837BD4680BD38490020F1 -:10DD2000FC3C002090AF0308C8AF030880B584B066 -:10DD300000AF674B1B68002B00F0C5800023FB6021 -:10DD4000BCE0FB689B00BB60FB689B0001337B6011 -:10DD5000FB689B0002333B605D4B1A68BB689B000D -:10DD600013441B68002B4DD15A4AFB6852F82320FC -:10DD7000574B19687B689B000B441B689A421AD268 -:10DD8000FB68591C534AFB6852F82300504B1A6831 -:10DD90007B689B0013441B6802464F4807F0BCF9A0 -:10DDA0004B4B1A687B689B0013441A684949FB680F -:10DDB00041F823207FE0474AFB6852F82320444B78 -:10DDC00019683B689B000B441B689A4273D9FB6837 -:10DDD000591C404AFB6852F823003D4B1A683B68C7 -:10DDE0009B0013441B6802463C4807F095F9384BEA -:10DDF0001A683B689B0013441A683649FB6841F86F -:10DE0000232058E0324B1A68BB689B0013441B6800 -:10DE1000012B50D12F4AFB6852F8233019462C4B66 -:10DE20001A687B689B0013441B6899421BDAFB68E5 -:10DE3000591C284AFB6852F823301846244B1A68AC -:10DE40007B689B0013441B680246234807F064F973 -:10DE50001F4B1A687B689B0013441A681D49FB68B6 -:10DE600041F8232027E01B4AFB6852F8233019466B -:10DE7000174B1A683B689B0013441B6899421ADDD4 -:10DE8000FB68591C134AFB6852F823301846104BA4 -:10DE90001A683B689B0013441B6802460F4807F052 -:10DEA0003BF90B4B1A683B689B0013441A680949FD -:10DEB000FB6841F82320FB680133FB60FB68FF2B04 -:10DEC0007FF73FAF00E000BF1037BD4680BD00BF09 -:10DED0003C490020FC40002000B0030838B0030893 -:10DEE00080B586B000AF7860654B1B68002B00F0F2 -:10DEF000C3807B68002B40F3BF807B68B3F5807FD5 -:10DF000000F3BA807B68013B7B617B699B003B61CE -:10DF10007B699B000133FB607B699B000233BB6024 -:10DF2000574B1A683B699B0013441B68002B4BD16D -:10DF3000544A7B6952F82320514B1968FB689B00B7 -:10DF40000B441B689A4219D24E4A7B6952F823103F -:10DF50004B4B1A68FB689B0013441B680A467968A0 -:10DF6000494807F0D9F8464B1A68FB689B001344F0 -:10DF70001A6844497B6941F823207EE0414A7B6965 -:10DF800052F823203E4B1968BB689B000B441B686A -:10DF90009A4272D93B4A7B6952F82310384B1A686F -:10DFA000BB689B0013441B680A467968374807F032 -:10DFB000B3F8334B1A68BB689B0013441A683149A5 -:10DFC0007B6941F8232058E02D4B1A683B699B0080 -:10DFD00013441B68012B50D12A4A7B6952F8233025 -:10DFE0001946274B1A68FB689B0013441B6899422B -:10DFF0001ADA244A7B6952F823301946204B1A68F2 -:10E00000FB689B0013441B680A4679681E4807F0AA -:10E0100083F81B4B1A68FB689B0013441A68194964 -:10E020007B6941F8232028E0164A7B6952F82330A7 -:10E030001946134B1A68BB689B0013441B6899422E -:10E040001BDD104A7B6952F8233019460C4B1A68C5 -:10E05000BB689B0013441B680A4679680B4807F0AD -:10E060005BF8074B1A68BB689B0013441A680549A4 -:10E070007B6941F8232000E000BF1837BD4680BD12 -:10E080003C490020FC40002000B0030838B00308E1 -:10E0900080B483B000AF7860044A7B68136000BF2F -:10E0A0000C37BD465DF8047B704700BF4449002033 -:10E0B00080B483B000AF7860044A7B68136000BF0F -:10E0C0000C37BD465DF8047B704700BF484900200F -:10E0D00080B483B000AF7860044A7B68136000BFEF -:10E0E0000C37BD465DF8047B704700BF38490020FF -:10E0F00080B483B000AF7860044A7B68136000BFCF -:10E100000C37BD465DF8047B704700BF3C490020DA -:10E1100080B485B000AF78607B68013BFB60FB6832 -:10E12000002B07DBFB68FF2B04DC064AFB6852F878 -:10E13000233000E0002318461437BD465DF8047B09 -:10E14000704700BFFC3C002080B58AB002AF786009 -:10E1500039600023FB617B68013BBB61BB69002B1D -:10E1600055DBBB69FF2B52DCBB699B002A4A134479 -:10E170007B612A4B1A68BB699B0013441B68FB61D7 -:10E18000274806F0C9FF274B1A68BB691B011344D7 -:10E190001B68012B1DD17B691B68FB607B693A689A -:10E1A0001A60FB69002B0BD07B691B681A46FB6861 -:10E1B00000931346FA6979681B4806F0ADFF23E027 -:10E1C0007B691B681A46FB687968184806F0A4FF4B -:10E1D0001AE07B691B683B617B693A681A60FB69DE -:10E1E000002B0AD07B691A683B6900931346FA69D1 -:10E1F00079680D4806F090FF06E07B691A683B6974 -:10E2000079680A4806F088FF7868FFF7B7FC00BF16 -:10E210002037BD4680BD00BFFC3C002044490020A3 -:10E2200070B003083849002080B003089CB0030890 -:10E2300080B485B000AF78607B68013BFB60FB6811 -:10E24000002B07DBFB68FF2B04DC064AFB6852F857 -:10E25000233000E0002318461437BD465DF8047BE8 -:10E26000704700BFFC40002080B58AB002AF7860E4 -:10E2700039600023FB617B68013BBB61BB69002BFC -:10E2800055DBBB69FF2B52DCBB699B002A4A134458 -:10E290007B612A4B1A68BB699B0013441B68FB61B6 -:10E2A000274806F039FF274B1A68BB691B01134446 -:10E2B0001B68012B1DD17B691B68FB607B693A6879 -:10E2C0001A60FB69002B0BD07B691B681A46FB6840 -:10E2D00000931346FA6979681B4806F01DFF23E096 -:10E2E0007B691B681A46FB687968184806F014FFBA -:10E2F0001AE07B691B683B617B693A681A60FB69BD -:10E30000002B0AD07B691A683B6900931346FA69AF -:10E3100079680D4806F000FF06E07B691A683B69E2 -:10E3200079680A4806F0F8FE7868FFF7D9FD00BF63 -:10E330002037BD4680BD00BFFC400020484900207A -:10E34000B4B003083C49002080B003089CB0030827 -:10E3500080B586B000AF78600B467B807B68013B60 -:10E360007B617B69002B19DB7B69B3F5007F15DAD4 -:10E370007B695B000B4A13443B610B4806F0CCFE03 -:10E380003B691B88FB603B697A881A803B691B8864 -:10E390001A46FB687968054806F0BEFE00BF1837CC -:10E3A000BD4680BDFC440020C4B003089CB00308F7 -:10E3B00080B584B000AF78603960324806F048FF1D -:10E3C0000023FB6055E0304B1A68FB689B00134448 -:10E3D0001B68002B4AD02C4B1A68FB689B00134427 -:10E3E0001B681B78002B41D0284B1A68FB681B0167 -:10E3F00013441B68002B0FD1FB68591C224B1A6871 -:10E40000FB689B0013441A682148FB6850F82330CE -:10E41000204806F081FE26E01C4B1A68FB681B01B1 -:10E4200013441B68012B0FD1FB68591C164B1A684B -:10E43000FB689B0013441A681548FB6850F82330AA -:10E44000144806F069FE0EE0FB68591C0E4B1A6872 -:10E45000FB689B0013441A680D48FB6850F8233092 -:10E460000D4806F059FE0220E8F7E4FDFB68013391 -:10E47000FB60FB68FF2BA6DD00BF00BF1037BD4669 -:10E4800080BD00BFDCB003084449002038490020AB -:10E49000FC3C0020E8B00308F8B0030880B584B065 -:10E4A00000AF78603960324806F0D2FE0023FB608E -:10E4B00055E0304B1A68FB689B0013441B68002B27 -:10E4C0004AD02C4B1A68FB689B0013441B681B78CE -:10E4D000002B41D0284B1A68FB681B0113441B68B2 -:10E4E000002B0FD1FB68591C224B1A68FB689B005C -:10E4F00013441A682148FB6850F82330204806F07E -:10E500000BFE26E01C4B1A68FB681B0113441B68BA -:10E51000012B0FD1FB68591C164B1A68FB689B0036 -:10E5200013441A681548FB6850F82330144806F065 -:10E53000F3FD0EE0FB68591C0E4B1A68FB689B004C -:10E5400013441A680D48FB6850F823300D4806F054 -:10E55000E3FD0220E8F76EFDFB680133FB60FB681A -:10E56000FF2BA6DD00BF00BF1037BD4680BD00BF3A -:10E5700008B10308484900203C490020FC40002025 -:10E58000E8B00308F8B0030880B584B000AF786045 -:10E5900039607B68002B37D03B68002B34D03A6859 -:10E5A00079681C4806F0B8FD7B681B78002B2DD0DD -:10E5B0003B681B78002B29D0786806F0EFF8F860EC -:10E5C000386806F0EBF8B860FB68002B05D1BB6833 -:10E5D000002B02D1FFF77EF919E0FB68B3F5807FCD -:10E5E00008DCFB68002B05DDBB681946F868FFF7FF -:10E5F000ABFD0CE0FB68B3F57A7F08D1064806F066 -:10E6000027FEFFF73DF902E000BF00E000BF103732 -:10E61000BD4680BD14B103082CB1030880B584B099 -:10E6200000AF786039607B68002B37D03B68002BE7 -:10E6300034D03A6879681C4806F06EFD7B681B7818 -:10E64000002B2DD03B681B78002B29D0786806F072 -:10E65000A5F8F860386806F0A1F8B860FB68002BF0 -:10E6600005D1BB68002B02D1FFF762F919E0FB6806 -:10E67000B3F5807F08DCFB68002B05DDBB6819461D -:10E68000F868FFF7F1FD0CE0FB68B3F57A7F08D17D -:10E69000064806F0DDFDFFF701F902E000BF00E0EB -:10E6A00000BF1037BD4680BD14B103083CB103085C -:10E6B00080B58AB000AF7860396001237B627B68E7 -:10E6C000002B03D0786806F069F878627B6A3B61BA -:10E6D00000233B620023FB60FB68BB60396929486B -:10E6E00006F01AFD3B69012B02D03B69022B01D1D8 -:10E6F000254B3B623B69012B02D10023FB6104E007 -:10E700003B69022B01D1FC23FB613B6A002B35D016 -:10E710001E4806F09DFD0023BB612CE0BB69013360 -:10E7200019461B4806F0F8FC00237B611AE0BA6921 -:10E7300013465B0013449B001A467B691344FA6935 -:10E740001344BB60BB685B003A6A13441B88FB60E0 -:10E75000F968104806F0E0FC0120E8F76BFC7B69E3 -:10E7600001337B617B690B2BE1DD0B4806F070FD0B -:10E77000BB690133BB61BB69142BCFDD00BF2837F8 -:10E78000BD4680BD4CB10308FC4400205CB10308C9 -:10E790007CB1030884B1030888B1030880B58AB04E -:10E7A00002AF786039607B68002B00F08F803B6897 -:10E7B000002B00F08B803A687968474806F0ACFC83 -:10E7C0007B681B78002B00F083803B681B78002B54 -:10E7D0007ED0786805F0E2FFB861386805F0DEFFAA -:10E7E0007861BB69002B02D1FFF7D0F871E0BB69FB -:10E7F000B3F57A7F05D1FFF75FF8384806F028FDBA -:10E8000067E0BB69364A82FB03121213DB17D31A87 -:10E810003B61BB69324A82FB03121113DA178A1A71 -:10E8200042F2107101FB02F29B1ABB61BB692D4AD7 -:10E8300082FB03125211DB17D31AFB60BB69294A12 -:10E8400082FB03125111DA178A1A642101FB02F2CA -:10E850009B1ABB60FB68002B08DDBB68002B05DD45 -:10E86000FB68152B02DCBB680C2B03DD1E4806F091 -:10E87000EFFC2EE0FB685A1E13465B0013449B001E -:10E880001A46BB68013B13440133FB61FB69002B53 -:10E8900003DDFB69B3F5807F03DD134806F0D8FC88 -:10E8A00017E07B690093BB68FA6839690F4806F086 -:10E8B00033FC3B69022B02D1FB69FC33FB617B69B2 -:10E8C0009BB21946F869FFF743FD02E000BF00E084 -:10E8D00000BF2037BD4680BD14B103088CB10308CA -:10E8E000AD8BDB681F85EB51A0B10308ACB1030809 -:10E8F00080B582B000AF394B00221A60384B4FF020 -:10E90000FF321A60374B4FF0FF321A60364B4FF030 -:10E91000FF321A6000237B604AE07B68582202FBCA -:10E9200003F3324A13441846E9F7EEFF7B680133DC -:10E930003B603B681B0403F47F0343F0807343F0A8 -:10E9400005032A497A68582000FB02F20A44136042 -:10E950003B681B0403F47F0343F0807343F006031A -:10E9600022497A68582000FB02F20A4404321360FC -:10E970001A4B1B687A689A4217D1194A3B68136090 -:10E980001A4A7B68582101FB03F313441B681A469B -:10E99000144B1A60154A7B68582101FB03F313449A -:10E9A00004331B681A46104B1A607B6801337B6086 -:10E9B0007B68002BB1DD094B1B68002B06DB074B86 -:10E9C0001B6819460A4806F0A7FB02E0094806F052 -:10E9D0003FFC00BF0837BD4680BD00BF080D0020CA -:10E9E0000C0D0020100D0020140D00204C490020BB -:10E9F000D8B10308F0B1030880B48FB000AF03466C -:10EA0000FB7100237B6301233B623B6A3B6200BFD7 -:10EA10003C37BD465DF8047B7047000080B500AF11 -:10EA2000FFF766FF0348E7F739F9E7F747F900BF53 -:10EA300080BD00BFF9E9020880B596B000AF0023A1 -:10EA40003B6507F110031846E7F7CAFAF864FB6C58 -:10EA5000002B40F049817B691B0EDBB203F01F03E2 -:10EA6000BB647B691B0CDBB27B647B691B0ADBB27A -:10EA70003B647B69DBB2FB63FB69022B2FD1BB6C70 -:10EA8000002B02D0BB6C012B23D17B6C002B05D05B -:10EA9000994B1B681A467B6C93421AD1FB6B052B72 -:10EAA00012D1964B1B68002B0ADB944B1B68944ACF -:10EAB000582101FB03F31344083301221A600CE1CF -:10EAC000904806F0C5FB08E1F96B8F4806F024FB7F -:10EAD00003E17B6919468D4806F01EFBFDE0FB69EA -:10EAE000002B40F0F2803B6A082B40F0EE80BB6CBC -:10EAF000012B40F0E0807B6C002B05D07E4B1B6827 -:10EB00001A467B6C934267D1FB6B062B40F0D98091 -:10EB10007A4B1B68002B5BDBBA1D07F12C0303CB80 -:10EB200010605160D7F806301B0C1B04BB63D7F88C -:10EB300006309BB27B63764B1B681A46BB6B9342D5 -:10EB40001CD0BB6B724A1360724B00221A606B4B75 -:10EB50001B686B4A582101FB03F313443433002232 -:10EB60001A60664B1B68582202FB03F33833644A71 -:10EB7000134404220021184605F05CFE7B6B072B32 -:10EB800000F39F805D4B1B68D7F80A205C48162174 -:10EB900003FB01F17B6B0B440E3340F823205E4AEC -:10EBA0007B6B52F823205B4B1B681343594A13605D -:10EBB000584B1B68FF2B40F08480504B1B68504A19 -:10EBC000582101FB03F31344343301221A6078E027 -:10EBD0004C4806F03DFB74E0FB6B052B7CD1002319 -:10EBE0007B6564E0464A7B6D582101FB03F31344C7 -:10EBF0001A687B699A4257D1BA1D07F12C0303CBDF -:10EC000010605160D7F806301B0C1B04BB63D7F8AB -:10EC100006309BB27B63414B1B681A46BB6B934229 -:10EC20001BD07B6D582202FB03F31033344A13448C -:10EC3000043304220021184605F0FCFDBB6B374A63 -:10EC40001360374B00221A602D4A7B6D582101FB5F -:10EC500003F31344103300221A607B6B072B32DC62 -:10EC6000D7F80A2026487B6D162103FB01F17B6B48 -:10EC70000B4404339B0003445A60274A7B6B52F8D1 -:10EC80002320274B1B681343254A1360244B1B6822 -:10EC9000FF2B18D11A4A7B6D582101FB03F3134453 -:10ECA000103301221A600EE07B6D01337B657B6DB2 -:10ECB000002B97DD10E07B6919461A4806F02CFA04 -:10ECC0000AE000BF08E000BF06E0F9697A693B6A24 -:10ECD000154806F021FA00E000BF3B6D01333B65AB -:10ECE0003B6D0A2B02DCACE600BF00E000BF00BFBA -:10ECF0005837BD4680BD00BF0C0D0020080D002018 -:10ED00004C4900200CB203082CB203084CB2030893 -:10ED1000A8490020AC490020C0F30308B4490020F2 -:10ED2000B849002070B2030894B2030880B58EB0D1 -:10ED300000AF00237B63D5E06F4B1B687A6B9A4270 -:10ED40007FD16E4A7B6B582101FB03F313440833D8 -:10ED50001B68002B25D0694A7B6B582101FB03F30C -:10ED600013440C331B68002B09D0644A7B6B582179 -:10ED700001FB03F313440C331B68012098475F4ADF -:10ED80007B6B582101FB03F31344083300221A6004 -:10ED90005A4A7B6B582101FB03F3134410330122C1 -:10EDA0001A60564A7B6B582101FB03F3134410335E -:10EDB0001B68002B00F09380504A7B6B582101FBAD -:10EDC00003F313441B687B610023FB610423BB61D5 -:10EDD00008233B6200233B6320E0494B1A683B6BEE -:10EDE0001343C7F8063045497B6B162203FB02F23A -:10EDF0003B6B134404339B000B445B68C7F80A3039 -:10EE000007F12803BA1D1068516803C307F1100306 -:10EE10001846E7F76DF83B6B01333B633B6B072B01 -:10EE2000DBDD364A7B6B582101FB03F313441033BF -:10EE300000221A60324B1B6803F58033304A13609E -:10EE40004DE02E4A7B6B582101FB03F3134434330E -:10EE50001B68002B43D0294A7B6B582101FB03F32D -:10EE6000134404331B687B610023FB610423BB61F3 -:10EE700008233B6200233B631FE0224B1A683B6B75 -:10EE80001343C7F806301D497B6B162203FB02F2C1 -:10EE90003B6B13440E3351F82330C7F80A3007F1A7 -:10EEA0002803BA1D1068516803C307F11003184600 -:10EEB000E7F71EF83B6B01333B633B6B072BDCDD55 -:10EEC0000E4A7B6B582101FB03F3134434330022B9 -:10EED0001A600C4B1B6803F580330A4A13607B6B86 -:10EEE00001337B637B6B002B7FF726AF00BF00BF36 -:10EEF0003837BD4680BD00BF080D00204C490020BA -:10EF0000B0490020A449002080B500AFFFF794FD70 -:10EF1000FFF70CFF00BF80BD80B483B000AF034695 -:10EF2000FB710B46BB7113467B7100BF0C37BD46AE -:10EF30005DF8047B704780B485B000AFF860B960BD -:10EF40007A60FB7000BF1437BD465DF8047B7047E4 -:10EF500080B586B000AF0346B9607A60FB730023CA -:10EF60007B614FF481620021786805F063FC0348FF -:10EF700006F06EF900BF1837BD4680BDC8B2030861 -:10EF800080B582B000AF00237B60F9F7F3F97B68AE -:10EF900018460837BD4680BD80B483B000AF00235B -:10EFA0007B607B6818460C37BD465DF8047B704774 -:10EFB00080B582B000AF00237B607B68002B0AD154 -:10EFC000FBF7CDFF0346002B05D1054806F040F9BD -:10EFD0004FF480737B607B6818460837BD4680BD60 -:10EFE000E0B2030880B584B000AF78603960FFF705 -:10EFF000C7FFF860FB6818461037BD4680BD0000AB -:10F0000080B584B000AF78603960FFF7C5FFF86065 -:10F01000FB68002B01D0FB685EE07B68BB60BB68CF -:10F02000002B02D14FF4807356E0BB685B6C002B61 -:10F030001BD1BB6800229A64BB68DB6B002B4AD0F3 -:10F04000BB68DB6B984703461A46BB685B6D9A4208 -:10F0500041D1BB6801225A64BB685B88204A9B008F -:10F0600013445A68BB68DA6435E0BB689B6C002BBC -:10F0700021D1BB68DB6B002B2DD0BB68DB6B9847C5 -:10F0800003461A46BB685B6D9A4224D0BB685B8816 -:10F09000134A9B0013445A68BB68DB6CD31A83EA9B -:10F0A000E372A2EBE372BB681B6D9A4213DDBB688F -:10F0B00001229A640FE0BB68DB6B002B0BD0BB68AE -:10F0C000DB6B984703461A46BB685B6D9A4202D1D8 -:10F0D0004FF48073FB60FB6818461037BD4680BD57 -:10F0E000BC49002080B584B000AF78603960FFF77C -:10F0F0005FFFF860FB68002B01D0FB6800E0FB6855 -:10F1000018461037BD4680BD80B582B000AF78602C -:10F110000021786800F006F8034618460837BD4617 -:10F1200080BD000080B5B6B000AF786039607B6804 -:10F13000002B02D14FF0FF33F5E27B685B88A7F824 -:10F14000CA3007F10803B4220021184605F072FB0B -:10F150007B681B88BB607B681B89FB607B68DA6807 -:10F160001346DB0013445B01A84A82FB03121A44D6 -:10F170001212DB17D21A7B681A657B681B89002B79 -:10F1800027D17B681B6A002B23D00023C7F8CC3023 -:10F190001AE07A68D7F8CC3008339B0013445B68D8 -:10F1A000002B0CD07B68DA6813465B001A44D7F852 -:10F1B000CC300E339B00D8333B4443F8D02CD7F8E7 -:10F1C000CC300133C7F8CC30D7F8CC30052BE0DD9C -:10F1D00037E0B7F8CA307A689288DB00D8333B440E -:10F1E00023F8C82CB7F8CA307A68D288DB00D83345 -:10F1F0003B4423F8C62CBB689BB203F00F039AB2C2 -:10F20000B7F8CA3042F4807292B2DB00D8333B4484 -:10F2100023F8C42CB7F8CA30DB00D8333B444FF492 -:10F22000007223F8C22C7B68DA68B7F8CA1013465C -:10F230005B001A4401F10E039B00D8333B4443F8B2 -:10F24000D02C7B68DA6813465B001344002BB8BFF0 -:10F250005B42C7F8C4300023BB65D7F8C430FB65F8 -:10F260007B68DB68002BB8BF5B423B667B681B6931 -:10F270007B667B681B69BB667B685B69FB667B683A -:10F280005B693B677B689B697B677B689B69BB6746 -:10F290007B68DB69FB670023C7F880305C4BC7F8ED -:10F2A00088305C4BC7F88C300023C7F890300023BF -:10F2B000C7F894300023C7F898300023C7F89C3073 -:10F2C0000023C7F8A0300023C7F8A430524BC7F87A -:10F2D000A830524BC7F8AC30514BC7F8B0307B6800 -:10F2E000C7F8B4300023C7F8B83007F10803184650 -:10F2F000FCF766F9C7F8D400D7F8D430032B5BD1FC -:10F300006420F9F74BF87B68DB6B002B54D07B68EB -:10F31000DB6B984703461A467B685B6D9A424BD07D -:10F32000404805F095FF7B681B89002B2AD17B683C -:10F330001B6A002B26D00023C7F8CC301DE07A686A -:10F34000D7F8CC3008339B0013445B68002B0FD0F8 -:10F350007B68DB68344A82FB03129210DB179A1A2F -:10F36000D7F8CC300E339B00D8333B4443F8D02C35 -:10F37000D7F8CC300133C7F8CC30D7F8CC30052BD8 -:10F38000DDDD10E07B68DB68B7F8CA10264A82FB37 -:10F3900003029210DB179A1A01F10E039B00D83377 -:10F3A0003B4443F8D02C0023FB6007F108031846C8 -:10F3B000FCF706F9C7F8D400D7F884301946D7F817 -:10F3C000D40000F053FFC7F8D0003B68002B00F0DA -:10F3D000A881D7F8D030B3F5807F04D0D7F8D030EB -:10F3E000002B40F09E817B68DB6B984703461A46F2 -:10F3F0007B685B6D9A4240F094817B685B6D002B6B -:10F4000014D17B6801225A6513E000BFB7600BB6C8 -:10F410009D83020831940208E5F0020801F0020819 -:10F42000E5EF0208F8B20308676666667B680022AB -:10F430005A657B681B695B087B667B681B695B0898 -:10F44000BB667B685B695B08FB667B685B695B0826 -:10F450003B677B689B697B677B689B69BB677B6855 -:10F46000DB69FB677B681B89002B2AD17B681B6AE1 -:10F47000002B26D00023C7F8CC301DE07A68D7F8DF -:10F48000CC3008339B0013445B68002B0FD07B68A3 -:10F49000DB68A74A82FB03129210DB179A1AD7F88F -:10F4A000CC300E339B00D8333B4443F8D02CD7F8F4 -:10F4B000CC300133C7F8CC30D7F8CC30052BDDDDAC -:10F4C00010E07B68DB68B7F8CA10994A82FB030238 -:10F4D0009210DB179A1A01F10E039B00D8333B44BC -:10F4E00043F8D02C7B6800229A647B68DB68914AE1 -:10F4F00082FB03121A441212DB17D21A7B681A65B8 -:10F500000023FB6007F108031846FCF759F8C7F819 -:10F51000D400D7F884301946D7F8D40000F0A6FEFE -:10F52000C7F8D0003B68022B40F0FB80D7F8D03002 -:10F53000B3F5807F04D0D7F8D030002B40F0F180B5 -:10F540007B68DB6B984703461A467B685B6D9A4283 -:10F5500040F0E780B7F8CA301846FBF7EBFDC7F874 -:10F56000C0007B681B89002B2AD17B681B6A002B9B -:10F5700026D00023C7F8CC301DE07A68D7F8CC300D -:10F5800008339B0013445B68002B0FD07B68DB685B -:10F59000674A82FB03129210DB17D21AD7F8CC30DD -:10F5A0000E339B00D8333B4443F8D02CD7F8CC30F3 -:10F5B0000133C7F8CC30D7F8CC30052BDDDD10E0B7 -:10F5C0007B68DB68B7F8CA10594A82FB03029210C5 -:10F5D000DB17D21A01F10E039B00D8333B4443F8EA -:10F5E000D02C7B6800229A647B68DB68514A82FBDE -:10F5F00003121A441212DB17D21A7B681A6507F13C -:10F6000008031846FBF7DCFFC7F8D400D7F88430AE -:10F610001946D7F8D40000F029FEC7F8D000D7F873 -:10F62000D030B3F5807F03D0D7F8D030002B78D11D -:10F630007B68DB6B984703461A467B685B6D9A4292 -:10F640006FD1B7F8CA301846FBF774FD0246D7F8F9 -:10F65000C030D31A002BB8BF5B42C7F8BC30D7F814 -:10F66000BC30DA0F13445B10C7F8BC30D7F8BC309D -:10F67000002B56D07B681B89002B25D17B681B6A29 -:10F68000002B21D00023C7F8CC3018E07A68D7F8D7 -:10F69000CC3008339B0013445B68002B0AD0D7F8AA -:10F6A000BC305A42D7F8CC300E339B00D8333B44A1 -:10F6B00043F8D02CD7F8CC300133C7F8CC30D7F88A -:10F6C000CC30052BE2DD0AE0B7F8CA30D7F8BC2011 -:10F6D00052420E339B00D8333B4443F8D02C0023D6 -:10F6E000C7F8A8300023C7F8AC300123C7F8803032 -:10F6F0007B685B697B667B685B69BB667B685B6913 -:10F70000FB6607F108031846FBF75AFFC7F8D40059 -:10F71000D7F884301946D7F8D40000F0A7FDC7F811 -:10F72000D000D7F8D0301846D837BD4680BD00BFCE -:10F7300067666666B7600BB680B584B000AF786068 -:10F740003960FFF71DFCF8607B68BB60BB681B6F0E -:10F75000002B02D0BB681B6F9847FB681846103718 -:10F76000BD4680BD80B584B000AF78603960FFF7DA -:10F7700013FCF860FB68002B01D0FB6800E0FB681D -:10F7800018461037BD4680BD80B584B000AF7860A4 -:10F790003960FFF70DFCF860FB68002B01D0FB68B7 -:10F7A00000E0FB6818461037BD4680BD80B5B4B098 -:10F7B00000AF78607B68002B01D11523FBE00023AC -:10F7C000C7F8C83007F10803B4220021184605F035 -:10F7D00031F87B681B88BB607B685B88FB6000231B -:10F7E000C7F8CC3078E07968D7F8CC2013465B00B6 -:10F7F00013449B000B4404331B68C7F8BC30D7F894 -:10F80000BC30002B63DB7968D7F8CC2013465B0053 -:10F8100013449B000B4408331A88D7F8BC30DB0034 -:10F82000D0333B4423F8C02C7968D7F8CC2013465A -:10F830005B0013449B000B440A331A88D7F8BC3092 -:10F84000DB00D0333B4423F8BE2CBB689BB203F0F3 -:10F850000F039BB243F480739AB2D7F8BC30DB003D -:10F86000D0333B4423F8BC2CD7F8BC30DB00D0337A -:10F870003B444FF4007223F8BA2C7968D7F8CC20B7 -:10F8800013465B0013449B000B440C331A68D7F8F3 -:10F89000BC300E339B00D0333B4443F8C82C79680E -:10F8A000D7F8CC2013465B0013449B000B440C3369 -:10F8B0001B68002B0BD07968D7F8CC2013465B006F -:10F8C00013449B000B440C331B68C7F8C830D7F8AF -:10F8D000CC300133C7F8CC30D7F8CC30052B82DDE3 -:10F8E000D7F8C830002B01D1002364E07B68DB6CC3 -:10F8F000BB657B681B6DFB657B689B6D3B667B68AE -:10F90000DB6D7B667B68DB6DBB667B68DB6D3B67B5 -:10F910007B681B6EFB667B685B6E7B677B685B6EE0 -:10F92000BB677B689B6EFB670123C7F88030244B65 -:10F93000C7F88830234BC7F88C300023C7F89030C5 -:10F940000023C7F894300023C7F898300023C7F885 -:10F950009C300023C7F8A0300023C7F8A4307B6890 -:10F96000DB6E002B06D00023C7F8A8300023C7F8B1 -:10F97000AC3005E0144BC7F8A830144BC7F8AC30D6 -:10F98000134BC7F8B0307B68C7F8B4300023C7F812 -:10F99000B83007F108031846FBF712FEC7F8C40099 -:10F9A000D7F884301946D7F8C40000F05FFCC7F8D8 -:10F9B000C000D7F8C0301846D037BD4680BD00BF64 -:10F9C0009D8302083194020889F7020865F702084E -:10F9D00039F7020880B584B000AF786039607B6881 -:10F9E000BB60FFF7CDFAF860FB68002B02D1BB6863 -:10F9F000002B01D1FB6831E0BB685B6D002B03D0AD -:10FA0000BB685B6D9847F860FB68002B01D0FB6812 -:10FA100024E0BB68DB68002B0CDDBB68DB6C002BD3 -:10FA20001BD0BB68DB6C98470346002B15D1102315 -:10FA3000FB6012E0BB68DB68002B0CDABB681B6D57 -:10FA4000002B0AD0BB681B6D98470346002B04D1DE -:10FA50001123FB6001E02023FB60FB681846103790 -:10FA6000BD4680BD80B584B000AF786039607B68EA -:10FA7000FB60FFF79DFAB860BB68002B02D1FB6802 -:10FA8000002B01D1BB6800E0BB6818461037BD46AB -:10FA900080BD80B584B000AF786039607B68BB60A2 -:10FAA000FFF77AFAF860FB68002B02D1BB68002BE5 -:10FAB00001D1FB6813E0FB68002B0FD1BB685B6CC6 -:10FAC000002B0BD0BB685B6C984703461A46BB689B -:10FAD0009B6C9A4202D140F20113FB60FB6818460E -:10FAE0001037BD4680BD80B584B000AF7860396006 -:10FAF0007B68FB600023BB60FB68002B0CD0FB68BD -:10FB00001B6C002B08D0FB681B6C98470346002B2E -:10FB100002D1FB6801221A66FB681B6EBB60BB68E2 -:10FB200018461037BD4680BD80B5B6B000AF7860CE -:10FB30007B68002B02D14FF0FF33C5E17B685B8807 -:10FB4000A7F8CA3007F10803B4220021184604F0D0 -:10FB500071FE7B681B88BB607B681B89FB607B68D0 -:10FB60001B89002B23D17B685B69002B1FD00023EE -:10FB7000C7F8CC3016E07B68D7F8CC20063253F8B3 -:10FB80002230002B09D07B68DA68D7F8CC300E33EE -:10FB90009B00D8333B4443F8D02CD7F8CC3001330A -:10FBA000C7F8CC30D7F8CC30052BE4DD33E0B7F81C -:10FBB000CA307A689288DB00D8333B4423F8C82CDB -:10FBC000B7F8CA307A68D288DB00D8333B4423F8D0 -:10FBD000C62CBB689BB203F00F039AB2B7F8CA30C9 -:10FBE00042F4807292B2DB00D8333B4423F8C42C39 -:10FBF000B7F8CA30DB00D8333B444FF4007223F827 -:10FC0000C22CB7F8CA307A68D2680E339B00D8335A -:10FC10003B4443F8D02C0023BB657B68DB68002B9A -:10FC2000B8BF5B42FB654FF47A733B667B681B6B26 -:10FC30007B667B681B6BBB667B685B6BFB667B686C -:10FC40001B6B3B677B689B6B7B677B689B6B5B0875 -:10FC5000BB677B68DB6BFB670023C7F880309C4B7E -:10FC6000C7F888309B4BC7F88C300023C7F890301A -:10FC70000023C7F894300023C7F898300023C7F852 -:10FC80009C300023C7F8A030934BC7F8A430934BA7 -:10FC9000C7F8A830924BC7F8AC30924BC7F8B030D9 -:10FCA0007B68C7F8B4300023C7F8B8300023C7F822 -:10FCB000D4300023C7F8D0307B685B69002B48D173 -:10FCC000D7F8B430D7F8B82011461846FFF782FEAF -:10FCD000C7F8D4007B68DB68002B03DAD7F8D43090 -:10FCE000112B07D07B68DB68002B07DDD7F8D430F9 -:10FCF000102B03D17B681B69C7F8D030D7F8B4301C -:10FD0000D7F8B82011461846FFF7C3FEC7F8D4004D -:10FD1000D7F8D43040F20112934204D17B681B69BA -:10FD2000C7F8D03015E0D7F8D430002B11D1D7F870 -:10FD3000B430D7F8B82011461846FFF7D4FEC7F8FC -:10FD4000C400D7F8C430002B03D07B681B69C7F808 -:10FD5000D030D7F8D030002B30D07B68DB6D002B53 -:10FD600009D07B68DB6D7A6830321146D7F8D00055 -:10FD70009847C7F8D400D7F8D430002B1ED1D7F855 -:10FD8000B430D7F8B82011461846FFF723FEC7F85D -:10FD9000D400D7F8D430002B10D1D7F8B430D7F82E -:10FDA000B82011461846FFF774FEC7F8D400D7F8FC -:10FDB000D430002B02D17B6800221A66D7F8D430E9 -:10FDC000002B7ED1B7F8CA301846FBF7B3F9C7F855 -:10FDD000C00007F108031846FBF7F2FBC7F8C400A0 -:10FDE000D7F8D030002B61D1D7F8C430032B03D023 -:10FDF000D7F8C430022B59D1D7F8C430032B32D1F5 -:10FE0000D7F8B430D7F8B82011461846FFF741FEAE -:10FE1000C7F8D400D7F8D43040F20112934245D14C -:10FE20007B681B69002B41D0B7F8CA301846FBF736 -:10FE300081F9C7F8BC00D7F8BC20D7F8C030D31A76 -:10FE400083EAE372A2EBE3727B681B69D90F0B4470 -:10FE50005B10002BB8BF5B429A4227DA7B681B69B4 -:10FE6000C7F8D0302CE0D7F8C430022B1ED1D7F819 -:10FE7000B430D7F8B82011461846FFF7ABFDC7F8E5 -:10FE8000D4007B68DB68002B03DAD7F8D430112B61 -:10FE900007D07B68DB68002B08DDD7F8D430102B47 -:10FEA00004D17B681B69C7F8D03009E0D7F88430EB -:10FEB0001946D7F8C40000F0D9F9C7F8D40000E01B -:10FEC00047E700BFD7F8D4301846D837BD4680BDC5 -:10FED0009D83020831940208E7FA020865FA0208D5 -:10FEE00093FA0208D5F9020880B584B000AF7860B3 -:10FEF00039607B68BB60FFF743F8F860FB68002B54 -:10FF000002D1BB68002B01D1FB682AE0BB68DB682B -:10FF1000002B0FDDBB681B6C002B21D0BB681B6C5A -:10FF2000BA68526D104698470346002B18D110232B -:10FF3000FB6015E0BB68DB68002B0FDABB685B6C0D -:10FF4000002B0DD0BB685B6CBA68526D10469847A9 -:10FF50000346002B04D11123FB6001E02023FB604A -:10FF6000FB6818461037BD4680BD80B584B000AF31 -:10FF7000786039607B68BB60FFF71AF8F860FB684F -:10FF8000002B02D1BB68002B01D1FB680EE0FB689F -:10FF9000002B0AD1BB68DB6C002B06D0BB68DB6C86 -:10FFA000BA68526D10469847F860FB6818461037DB -:10FFB000BD4680BD80B584B000AF786039607B6895 -:10FFC000BB600023FB60BB681B6D002B04D0BB68CB -:10FFD0001B6D38689847F860FB6818461037BD46B7 -:10FFE00080BD80B584B000AF786039607B68FB600D -:10FFF000FEF7D2FFB860BB68002B02D1FB68002B74 -:020000040803EF -:1000000001D1BB6800E0BB6818461037BD4680BD13 -:1000100080B5B4B000AF78607B68002B01D10023BD -:10002000EBE07B68DB68002B01D10023E5E07B6817 -:100030009B6C002B0ED07B689B6C7A68526D1046CF -:100040009847C7F8C800D7F8C830002B02D0D7F8B7 -:10005000C830D2E07B685B88A7F8C63007F10C0394 -:10006000B4220021184604F0E5FB7B681B88FB6086 -:100070007B681B893B617B681B89002B24D17B68D3 -:100080001B69002B20D00023C7F8CC3017E07A681A -:10009000D7F8CC3004339B0013445B68002B09D0A5 -:1000A0007B68DA68D7F8CC300E339B00D0333B4402 -:1000B00043F8C42CD7F8CC300133C7F8CC30D7F88C -:1000C000CC30052BE3DD33E0B7F8C6307A68928890 -:1000D000DB00D0333B4423F8BC2CB7F8C6307A6839 -:1000E000D288DB00D0333B4423F8BA2CFB689BB2A8 -:1000F00003F00F039AB2B7F8C63042F4807292B29E -:10010000DB00D0333B4423F8B82CB7F8C630DB0013 -:10011000D0333B444FF4007223F8B62CB7F8C63006 -:100120007A68D2680E339B00D0333B4443F8C42C2A -:100130000023FB657B68DB68002BB8BF5B423B6636 -:100140007B68DB6A7B667B681B6BBB667B681B6BB3 -:10015000FB667B685B6B3B677B681B6B7B677B68C5 -:100160009B6BBB677B689B6B5B08FB677B68DB6B90 -:10017000C7F880300023C7F88430224BC7F88C3092 -:10018000214BC7F890300023C7F894300023C7F8FC -:1001900098300023C7F89C300023C7F8A030002314 -:1001A000C7F8A430194BC7F8A830194BC7F8AC30C2 -:1001B000184BC7F8B030184BC7F8B4307B68C7F895 -:1001C000B8307B68DB68002B02DA4FF0FF3300E0C9 -:1001D0000123C7F8BC3007F10C031846FBF7F0F910 -:1001E000C7F8C000D7F888301946D7F8C00000F02B -:1001F0003DF8C7F8C800D7F8C8301846D037BD4614 -:1002000080BD00BF9D83020831940208B5FF02083B -:100210006BFF0208E3FF0208E9FE020880B483B026 -:1002200000AF786006E07B681B68A3F51C53103BA9 -:100230007A6813607B681B6841F288329342F2DC73 -:1002400006E07B681B6803F51C5310337A68136063 -:100250007B681B68044A9342F3DB00BF00BF0C3786 -:10026000BD465DF8047B704778ECFFFF80B485B035 -:1002700000AF786039607B680433092B2BD801A26A -:1002800052F823F0BF020308B9020308B3020308BF -:10029000AD020308CB020308C5020308CB02030822 -:1002A000CB020308CB020308D10203081523FB602D -:1002B00014E00623FB6011E00B23FB600EE0092332 -:1002C000FB600BE00523FB6008E03B68FB6005E09A -:1002D0000B23FB6002E00023FB6000BFFB681846B5 -:1002E0001437BD465DF8047B704700BF80B5ADF59F -:1002F000805D84B000AF102200214F4804F09AFACC -:1003000007F110030C3B4FF4805219464B48EBF7B2 -:100310007BFB002307F5805202F1070213700023D4 -:1003200007F5805202F10C021360002307F580529A -:1003300002F10802136036E007F110031A4607F5D0 -:10034000805303F10C031B6813440C3B1B7807F527 -:10035000805202F1070212789A4219D207F1100373 -:100360001A4607F5805303F10C031B6813440C3B3A -:100370001B7807F5805202F10702137007F58053CE -:1003800003F10C031B6807F5805202F108021360A9 -:1003900007F5805303F10C031B68013307F5805206 -:1003A00002F10C02136007F5805303F10C031B6884 -:1003B00040F6FE729342BFDD07F5805303F1070359 -:1003C0001B78002B12D11E4804F042FF01211B486C -:1003D000EBF704FCFF2307F5805202F107021370CC -:1003E000002307F5805202F10802136007F58053DD -:1003F00003F107031B785B0807F5805202F107023F -:1004000013700D4A07F5805303F107031B7813702F -:10041000094A07F5805303F108031B685360064B34 -:1004200000229A60044B0022DA6000BF07F5805773 -:100430001037BD4680BD00BF0C52002000F0FF0009 -:1004400008B3030880B483B000AF78600B4B5B68DF -:100450007A6813447B6003E07B68A3F6FF737B60DC -:100460007B6840F6FE729342F6DC7B681B031846FD -:100470000C37BD465DF8047B704700BF0C5200206E -:1004800080B586B000AF786039607B683A6802FB5F -:1004900003F3002B01DA03F6FF731B137B617B6808 -:1004A0003A6802FB03F35A42C3F30B03C2F30B0295 -:1004B00058BF53423B617B691846FFF7C3FF0246B2 -:1004C0003B691344FB60FB6818461837BD4680BD86 -:1004D00080B586B000AF786039607B68002B01DAA8 -:1004E00003F6FF731B137B617B685A42C3F30B0354 -:1004F000C2F30B0258BF53423B617B691846FFF7BA -:10050000A1FF02463B691344FB60FB68184618379D -:10051000BD4680BD80B5ADF5805D86B000AF07F10A -:10052000180343F8140C07F1180353F8143C03F6AE -:10053000FF7307F5805202F10C02136007F5805338 -:1005400003F10C031B68002B01DA03F6FF731B1386 -:1005500007F5805202F10C02136007F1180307F54A -:10056000805202F10C02126853F8141C6F4804F018 -:10057000D3FD6F4B5A686E4B9B6813446C4A5360B3 -:1005800005E06B4B5B68A3F6FF73694A5360684BE9 -:100590005B6840F6FE729342F3DC654B5968644B2E -:1005A0009A68634B1B78634804F0B6FD07F58053E7 -:1005B00003F10C031B68B3F5805F10DB40F6FF729C -:1005C00007F5805303F10C0319685B4804F0A4FDA0 -:1005D00040F6FF7307F5805202F10C02136007F139 -:1005E00018030C3B4FF4805219465448EBF70CFAB1 -:1005F0004F4B00229A60002307F5805202F114024B -:1006000013604B4B5B6807F5805202F110021360D8 -:1006100059E0474B9B680133454A9360444B1A7835 -:1006200007F11803194607F5805303F110031B68FF -:100630000B440C3B1A7007F5805303F110031B6841 -:10064000013307F5805202F11002136007F5805361 -:1006500003F110031B6840F6FE72934228DD00236D -:1006600007F5805202F110021360314B1B78002B0A -:1006700012D101213148EBF7B1FA07F118030C3B15 -:100680004FF48052FF21184604F0D4F8284BFF2283 -:100690001A702B4804F0DCFD254B1B785B08DAB29E -:1006A000234B1A70224B1B781946264804F034FD60 -:1006B00007F5805303F114031B68013307F58052DB -:1006C00002F11402136007F5805303F114031A6852 -:1006D00007F5805303F10C031B689A4299DB144B16 -:1006E0009B6807F5805202F10C0212689A4202D010 -:1006F000154804F0ADFD0E4B59680D4B9A680C4B34 -:100700001B78124804F008FD094B0022DA6007F15B -:1007100018030C3B4FF4805219460848EBF7A0FA37 -:1007200000BF07F580571837BD4680BD20B30308CA -:100730000C52002058B3030890B3030800F0FF00E8 -:10074000A4B30308BCB30308E8B303081CB403084C -:1007500080B586B000AF78607B68002B0AD0354B3F -:100760001B68B3F1FF3F05D1324B00221A60324BB8 -:100770000122DA60304BDB68002B08D12D4B0022C0 -:100780001A602D4BDB6801332B4AD3604CE02A4BB7 -:10079000DB68012B48D1284B9B68002B40D0264BAF -:1007A0009968244B1A687B68244804F0B5FC214BF7 -:1007B0001B687B611EE07869FFF744FE38614FF4E7 -:1007C00080513869EBF76CF9F860FB68002B07D0B3 -:1007D00039691B4804F0A0FC01213869EBF7FEF9E8 -:1007E0007B68002B03D17B6901337B6107E07B6968 -:1007F00001337B61104B9B687A699A42DBDB0D4ABF -:100800007B6913600C4B9A680A4B1B689A420BDC9D -:10081000084B4FF0FF321A60074B0222DA6003E008 -:10082000054B4FF0FF32DA60034BDB681846183790 -:10083000BD4680BD180D00200C52002054B40308A2 -:1008400084B4030880B584B000AF0346B9607A6011 -:10085000FB73F87B01237A68B96800F005F803465A -:1008600018461037BD4680BD80B598B000AFB9605E -:100870007A603B600346FB73984B5B695B6ABA68BE -:100880009A420AD3954B5B695B6A1A46B9689448E9 -:1008900004F042FC4FF0FF33B3E37B68002B02D13E -:1008A0004FF0FF33ADE38D4B5B691B8D9BB2102B7B -:1008B00040F0F080894B5B68002B28D1BB68B3F512 -:1008C000800F07D310220021786803F0B3FF4FF0A8 -:1008D000FF3396E3BB68B3F5001F08D27F4B9B69DB -:1008E000FB64BB681B01FA6C1344FB6409E07B4B9F -:1008F0001B6AFB64BB6803F17E631B01FA6C134443 -:10090000FB641022F96C786803F086FF78E3734B80 -:100910005B68062B07D110220021786803F08AFF5C -:100920004FF0FF336DE36D4B5B68012B17D1BB6854 -:100930006C4A934207D910220021786803F07AFFAD -:100940004FF0FF335DE3BB681B017B617B683B635A -:100950003B6B102219467869EBF756F850E35F4B72 -:100960005B68042B3DD1BB685F4A934207D31022DA -:100970000021786803F05EFF4FF0FF3341E3BB686E -:10098000B3F5800F1CD2BB68B3F5001F08D2534BE0 -:100990009B69BB64BB681B01BA6C1344BB6409E070 -:1009A0004E4B1B6ABB64BB6803F17E631B01BA6CD0 -:1009B0001344BB641022B96C786803F02DFF1FE369 -:1009C000BB68A3F5800310211846FFF759FDB861F5 -:1009D0007B683B633B6B10221946B869EBF714F850 -:1009E0000EE33E4B5B68032B4ED100237B653DE05D -:1009F0003A4B1B6B7A6D53F8223045F2AA52934260 -:100A000031D1BB681B01FB61344B1B6B7A6D3232F9 -:100A100053F82230FA699A4225D3304B1B6B7A6D1A -:100A2000323253F8223003F58063FA699A421AD2BF -:100A30002A4B1B6B7A6D323253F82230FA69D31A83 -:100A4000FB61264B1A6B7B6D9B0203F5C873134445 -:100A50001A46FB691344FB61FB691022194678684A -:100A600003F0DAFE05E07B6D01337B657B6D312B96 -:100A7000BEDD7B6D322B40F0C382B9681B4804F0A9 -:100A80004BFB6FF00103BCE2194804F0E1FB4FF0AF -:100A9000FF33B6E2114B5B691B8D9BB2082B40F014 -:100AA00027810E4B5B68002B34D1BB68B3F5000F78 -:100AB00007D308220021786803F0BCFE4FF0FF3313 -:100AC0009FE2BB68B3F5800F14D2044B9B693B6572 -:100AD000BB68DB003A6D13443B6515E0D849002044 -:100AE000A4B40308FFFE0F0000FF4F00C8B40308C2 -:100AF000E8B40308A04B1B6A3B65BB6803F1FE53D7 -:100B0000DB003A6D13443B650822396D786803F0C9 -:100B100083FEBEE0984B5B68062B07D108220021BC -:100B2000786803F087FE4FF0FF336AE2924B5B6810 -:100B3000012B17D1BB68914A934207D308220021A9 -:100B4000786803F077FE4FF0FF335AE2BB68DB00B2 -:100B50003B627B683B633B6B08221946386AEAF7C5 -:100B600053FF96E0844B5B68042B3DD1BB68844AFD -:100B7000934207D308220021786803F05BFE4FF010 -:100B8000FF333EE2BB68B3F5000F1CD2BB68B3F580 -:100B9000800F08D2784B9B69FB65BB68DB00FA6D60 -:100BA0001344FB6509E0744B1B6AFB65BB6803F1EA -:100BB000FE53DB00FA6D1344FB650822F96D78687B -:100BC00003F02AFE65E0BB68A3F500030821184680 -:100BD000FFF756FC78627B683B633B6B0822194643 -:100BE000786AEAF711FF54E0634B5B68032B4DD141 -:100BF0000023BB653DE0604B1B6BBA6D53F82230A0 -:100C000045F2AA52934231D1BB68DB00BB625A4B1A -:100C10001B6BBA6D323253F82230BA6A9A4225D32E -:100C2000554B1B6BBA6D323253F8223003F580639B -:100C3000BA6A9A421AD2504B1B6BBA6D323253F8D1 -:100C40002230BA6AD31ABB624B4B1A6BBB6D9B0244 -:100C500003F5C87313441A46BB6A1344BB62BB6AEC -:100C600008221946786803F0D7FD05E0BB6D013313 -:100C7000BB65BB6D312BBEDDBB6D322B09D1B968B5 -:100C8000404804F049FA6FF00103BAE14FF0FF3336 -:100C9000B7E13B68002B00F0B3817B68B3F9023009 -:100CA0001BB21A467B68B3F902301BB203FB02F297 -:100CB0007B68B3F904301BB219467B68B3F9043082 -:100CC0001BB201FB03F313441846DFF75BFC02463B -:100CD0000B4643EC102B06F009FE53EC102B10468C -:100CE0001946DFF791FF03469AB27B681A8187E1C4 -:100CF000214B5B691B8D9BB2042B40F07E811E4B08 -:100D00005B68002B2BD1BB68B3F1807F07D3042233 -:100D10000021786803F08EFD4FF0FF3371E107F199 -:100D200010037B64BB68B3F5000F08D2124B9B69BC -:100D30007B64BB689B007A6C13447B6409E00E4BB8 -:100D40001B6A7B64BB6803F17E539B007A6C13447F -:100D50007B647B6C1B681A467B681A60C9E0064B93 -:100D60005B68062B10D104220021786803F062FD35 -:100D70004FF0FF3345E100BFD849002000FE1F00BF -:100D800000FE9F00C8B40308A04B5B68012B18D17C -:100D9000BB689F4A934207D304220021786803F07E -:100DA00049FD4FF0FF332CE1BB689B00FB6207F16C -:100DB00010033B633B6B04221946F86AEAF724FEF2 -:100DC00097E0924B5B68042B41D1BB68914A9342F8 -:100DD00007D304220021786803F02CFD4FF0FF3385 -:100DE0000FE1BB68B3F1807F1FD207F110033B64B2 -:100DF000BB68B3F5000F08D2844B9B693B64BB68AA -:100E00009B003A6C13443B6409E0804B1B6A3B64D3 -:100E1000BB6803F17E539B003A6C13443B643B6C0C -:100E20001B681A467B681A6063E0BB6803F17F4366 -:100E300004211846FFF724FB786307F110033B6396 -:100E40003B6B04221946786BEAF7DEFD51E06F4BED -:100E50005B68032B4AD10023FB633AE06B4B1B6BAF -:100E6000FA6B53F8223045F2AA5293422ED1BB6856 -:100E70009B00BB63654B1B6BFA6B323253F822301D -:100E8000BA6B9A4222D3614B1B6BFA6B323253F826 -:100E9000223003F58063BA6B9A4217D25B4B1B6B0F -:100EA000FA6B323253F82230BA6BD31ABB63574B0A -:100EB0001A6BFB6B9B0203F5C87313441A46BB6B9A -:100EC0001344BB63BB6B1B683B6105E0FB6B0133E9 -:100ED000FB63FB6B312BC1DDFB6B322B09D1B96896 -:100EE0004D4804F019F96FF001038AE04FF0FF3329 -:100EF00087E03A7C7B681A707B6800225A70BB7C62 -:100F00001AB27B685A80BB7C1AB27B689A807B6875 -:100F100000229A710022DA717B7C5BB2002B0FDA1F -:100F20007B68B3F902301BB29BB21A465203D21A45 -:100F30009200D31A5B009BB21AB27B685A800CE015 -:100F40007B68B3F902301BB29BB21A46920013447D -:100F50005B009BB21AB27B685A807B7C03F0400333 -:100F6000002B0FD07B68B3F904301BB29BB21A463A -:100F70005203D21A9200D31A5B009BB21AB27B685A -:100F80009A800CE07B68B3F904301BB29BB21A461E -:100F9000920013445B009BB21AB27B689A803B6854 -:100FA000002B2DD07B68B3F902301BB21A467B6848 -:100FB000B3F902301BB203FB02F27B68B3F90430D1 -:100FC0001BB219467B68B3F904301BB201FB03F373 -:100FD00013441846DFF7D6FA02460B4643EC102BB3 -:100FE00006F084FC53EC102B10461946DFF70CFE7C -:100FF00003469AB27B681A8102E04FF0FF3300E0AB -:10100000002318466037BD4680BD00BFD849002088 -:1010100000FC3F0000FC3F01C8B4030880B58EB05F -:1010200000AFB9607A603B600346FB737B68002BBE -:1010300002D14FF0FF3339E1804B5B68002B28D1A0 -:10104000BA683B681A447D4BDB699A4205D87B4BF2 -:101050009A69BB6813447B6315E0BA683B681A441D -:10106000764BD969754B5B6A0B449A4208D8734B2F -:101070001A6ABB681A44714BDB69D31A7B6302E0BE -:101080004FF0FF3312E13A687968786B03F0C4FBE4 -:101090000BE16A4B5B68062B14D1BA683B681A44B3 -:1010A000664BDB6A9A420AD8644B9A6ABB6813445F -:1010B0007B613A687968786903F0AEFBF5E04FF040 -:1010C000FF33F3E05D4B5B68012B0FD1BA683B68DF -:1010D00013445B4A934202D94FF0FF33E6E03B688A -:1010E0001A467968B868EAF7F5FDDEE0534B5B68AD -:1010F000042B4FD1BA683B681A44504BDB699A42C3 -:101100000AD84E4B9A69BB681344BB613A68796848 -:10111000B86903F081FBC8E0BA683B681A44474BE2 -:10112000D969464B5B6A0B449A420DD8434B1A6A05 -:10113000BB681A44414BDB69D31ABB613A687968D2 -:10114000B86903F069FBB0E0BA683B681A443B4BEE -:10115000D9693A4B5B6A0B4403F57F0303F570438F -:101160009A4214D8354BDA69344B5B6A1344BA6837 -:10117000D31A1A463B6819461046FFF7A9F9F861D9 -:101180003B681A467968F869EAF7A4FD8DE04FF0EC -:10119000FF338BE0294B5B68032B40F086803B6874 -:1011A000B3F5806F05D1254B5B691B6ABA689A421B -:1011B0000AD3224B5B691B6ABA683968214803F07D -:1011C000ABFF4FF0FF3371E0BB689B0ABB62BB6AA9 -:1011D0009B027B627A6ABB689A4207D0BA68796AD6 -:1011E000194803F099FF4FF0FF335FE04FF0FF33F2 -:1011F0003B630023FB622EE0104B1B6BFA6A53F833 -:10120000223045F2AA5293420DD10C4B1B6BFA6A65 -:10121000323253F822307A6A9A4204D1B96A0B48C2 -:1012200003F07AFF1AE0054B1B6BFA6A53F8223081 -:10123000002B0DD1FB6A3B6310E000BFD8490020B2 -:1012400000F0FF0008B5030848B5030868B50308B7 -:10125000FB6A0133FB62FB6A312BCDDD3B6B002B5C -:1012600023DB3B6B312B20DC124B1B6B3A6B45F2C3 -:10127000AA5143F822100F4B1B6B3A6B3232796A3A -:1012800043F822100B4B1A6B3B6B9B0203F5C873A0 -:1012900013443B623A687968386A03F0BDFA3B6BE5 -:1012A000BA68B96A044803F037FF00231846383794 -:1012B000BD4680BDD84900208CB50308F0B587B085 -:1012C00006AF6F4803F0C4FF6E4B1B686D4A52684F -:1012D00019466D4803F020FF6A4B5B68002B03D171 -:1012E0006A4803F0B5FF2AE0664B5B68012B03D127 -:1012F000674803F0ADFF22E0624B5B68022B03D12D -:10130000644803F0A5FF1AE05E4B5B68042B03D131 -:10131000614803F09DFF12E05A4B5B68032B03D139 -:101320005E4803F095FF0AE0564B5B68062B03D13D -:101330005B4803F08DFF02E05A4803F089FF5A48EA -:1013400003F086FF4F4B5B691946584803F0E4FEF3 -:101350004C4B5B69196A4B4B5B695A6A494B5B6939 -:101360001B8D9BB21846474B5B695B8D9BB200930C -:1013700003464F4803F0D0FE424B5B69D96A414BAC -:101380005B691B8E9BB21A464A4803F0C5FE3D4B73 -:101390005B6993F832301946474803F0BDFE394B7C -:1013A0005B695B6B1946454803F0B6FE354B5B69DC -:1013B0001E6C344B5B69D3F844C0324B5B69D3F885 -:1013C00048E0304B5B69DB6C2E4A5269126D2D4947 -:1013D0004969496D2B484069806D2A4C6469E46D08 -:1013E000284D6D692D6E059504940390029101922C -:1013F0000093734662463146314803F08DFE214B1F -:101400005B69D96E1F4B5B69186F1E4B5B695C6F24 -:101410001C4B5B699B6F1B4A5269D26F0192009310 -:1014200023460246274803F077FE164B5B69D3F844 -:101430008410144B5B69D3F88820124B5B69D3F896 -:101440008C30214803F068FE0E4B5B6993F89030B6 -:1014500019460C4B5B6993F891301846094B5B6950 -:10146000D3F89220074B5B69D3F89630009313466C -:101470000246164803F050FE00BF0437BD46F0BDDB -:10148000BCB50308D8490020D0B50308F0B503085F -:1014900008B6030820B603083CB6030860B6030884 -:1014A00078B6030894B60308B0B60308C0B60308BC -:1014B000D0B603080CB703082CB703083CB70308E1 -:1014C0004CB70308A8B70308E8B7030810B8030827 -:1014D00080B400AF064B1B6845F2AA52934201D17B -:1014E000012300E000231846BD465DF8047B7047E9 -:1014F000D849002080B582B000AF7860FFF7E8FFE0 -:101500000346012B07D1064B5B695B6A7A689A42F6 -:1015100001D2012300E0002318460837BD4680BDF4 -:10152000D849002080B400AF034B5B695B6A184662 -:10153000BD465DF8047B7047D849002080B582B075 -:1015400000AF7860054803F083FE054B00221A6067 -:10155000012318460837BD4680BD00BF58B80308B0 -:10156000D849002080B582B000AF7860054803F00C -:101570006FFE054B45F2AA521A6001231846083740 -:10158000BD4680BD68B80308D849002080B500AFCB -:10159000054803F05DFE054B1B6BC8220021184671 -:1015A00003F048F900BF80BD78B80308D84900208F -:1015B00080B483B000AF78603960044A3B689360C0 -:1015C00000BF0C37BD465DF8047B7047D84900204A -:1015D00080B483B000AF7860064B9B68002B01D0CD -:1015E000012300E0002318460C37BD465DF8047B5C -:1015F000704700BFD849002080B584B000AF786044 -:101600007B689A68234B5B699B6CD31AFB607B6891 -:10161000DA68204B5B69DB6CD31ABB601D4B5B69DE -:10162000596D1C4B5B69FA680A445A65194B5B6932 -:10163000996D184B5B69FA680A449A65154B5B69AA -:10164000D96D144B5B69BA680A44DA65114B5B6962 -:10165000196E104B5B69BA680A441A660D4B5B69D8 -:101660007A6812681A640B4B5B697A6852685A642C -:10167000084B5B697A6892689A64064B5B697A6882 -:10168000D268DA6401210020FFF792FF00BF103713 -:10169000BD4680BDD849002080B582B000AF7860DB -:1016A000094803F0D5FD094B5B694FF48062796806 -:1016B000184603F0B1F801210020FFF779FF00BFC1 -:1016C0000837BD4680BD00BF8CB80308D84900204C -:1016D00080B582B000AF0023FB80624B5B69403372 -:1016E00004211846E7F73EF903461A46FB881344DF -:1016F000FB805C4B5B69443304211846E7F732F901 -:1017000003461A46FB881344FB80564B5B694833FB -:1017100004211846E7F726F903461A46FB881344C6 -:10172000FB80504B5B694C3304211846E7F71AF9EC -:1017300003461A46FB881344FB804A4B5B695033CF -:1017400004211846E7F70EF903461A46FB881344AE -:10175000FB80444B5B69543304211846E7F702F9D8 -:1017600003461A46FB881344FB803E4B5B695833A3 -:1017700004211846E7F7F6F803461A46FB88134497 -:10178000FB80384B5B695C3304211846E7F7EAF8C5 -:1017900003461A46FB881344FB80324B5B69603377 -:1017A00004211846E7F7DEF803461A46FB8813447F -:1017B000FB802C4B5B69643304211846E7F7D2F8B1 -:1017C00003461A46FB881344FB80264B5B6968334B -:1017D00004211846E7F7C6F803461A46FB88134467 -:1017E000FB80204B5B696C3304211846E7F7BAF89D -:1017F00003461A46FB881344FB801A4B5B6970331F -:1018000004211846E7F7AEF803461A46FB8813444E -:10181000FB80144B5B69743304211846E7F7A2F888 -:1018200003461A46FB881344FB800E4B5B697833F2 -:1018300004211846E7F796F803461A46FB88134436 -:10184000FB80084B5B697C3304211846E7F78AF874 -:1018500003461A46FB881344FB80FB88184608376A -:10186000BD4680BDD849002080B586B000AFF86085 -:10187000B9607A607B68002B02D14FF0FF3341E002 -:1018800000237B61FB68012B08D1BB68002B2CDA9D -:10189000BB689B0203F140437B6126E0FB68022B9F -:1018A00008D1BB68002B20DABB689B0203F14043E0 -:1018B0007B611AE0FB68032B08D1BB68002B14DAAC -:1018C000BB689B0203F140437B610EE0FB68042B85 -:1018D00008D1BB68002B08DABB689B0203F14043C8 -:1018E0007B6102E06FF002030CE07B69002B07D004 -:1018F0004FF480627968786902F08EFF002301E07E -:101900006FF0010318461837BD4680BD80B500AFA3 -:1019100034220021174802F08DFF164B164A5A61F7 -:10192000144B4FF040429A61124B4FF00072DA6153 -:10193000104B4FF050421A620E4B4FF000725A6239 -:101940000C4B4FF040429A620A4B0022DA62094B7C -:101950009B691A46074B1A63064B00221A60E6F78A -:10196000E1FA064B064A07490748E9F783FF00BF3B -:1019700080BD00BFD84900200C4A0020857F0108A7 -:101980009F7F010885A902086DA9020880B483B071 -:1019900000AF03463960FB713B6893F82830052B94 -:1019A00003D03B6893F82830062B00BF0C37BD46A8 -:1019B0005DF8047B704780B483B000AF7860396015 -:1019C0003B6893F82830052B03D03B6893F8283008 -:1019D000062B00BF0C37BD465DF8047B7047000046 -:1019E00080B582B000AF78607B68002B02D14FF0E9 -:1019F000FF3325E07B68D3F80A30134AD360124BDB -:101A00001B69B3F1FF3F03D10020FFF797FD10E002 -:101A10000D4BDB680C4A1269012101FA02F21340F6 -:101A2000002B06D10020FFF789FD074B4FF0FF3256 -:101A30001A61054BDB681946044803F06DFB00236F -:101A400018460837BD4680BDD849002074BA03083F -:101A500080B586B000AF78607B68002B02D14FF074 -:101A6000FF33A3E37B68DB889BB2B3F5806F0ED0B6 -:101A70007B68DB889BB2B3F5807F08D07B68DB880E -:101A80009BB2B3F5807F02D04FF0FF338EE38648E0 -:101A900003F0DEFB8548ECF729FE7B689B7A002B80 -:101AA0001BD17B681033FB60FEF720FCFB681B6AD0 -:101AB000B3F1806F02D800237B612BE004237B61AC -:101AC000FB681B6AB3F1806F24D9FB681B6A03F1C2 -:101AD0007C431846FEF71EFD1CE07B689B7A022BB8 -:101AE00004D101237B61EAF771FC13E07B689B7AE8 -:101AF000032B02D105237B610CE07B689B7A042BCE -:101B000002D106237B6105E0694803F0A1FB4FF099 -:101B1000FF334BE37B69002B40F0D4807B689B7ADA -:101B2000002B68D1634B00225A60604BDB781A4669 -:101B3000604B1A615D4B00221A705C4B00225A7098 -:101B40007B689A7A594B9A707B68DA7A574BDA70CD -:101B50007B689B899AB2554B9A80544B554AC3F87F -:101B60000620524B00225A8100229A81514B524A40 -:101B70005A614E4BD3F8063058697B6803F1100167 -:101B80007B68DB889BB21A4602F046FE474BD3F8CF -:101B900006305B691B6A454AD2F806205269528DAD -:101BA00092B21344013B414AD2F806205269528D49 -:101BB00092B2B3FBF2F33D4AC2F819303B4BD3F873 -:101BC00019300733DB089AB2384BA3F81D204FF4C5 -:101BD00080620021394802F02DFE344B01225A70F8 -:101BE000324B5A221A700020FFF7A8FC0021002077 -:101BF000FFF7DEFCD9E27B689B7A022B40F0D582AE -:101C00002A4B00221A70294B00225A707B689A7A5C -:101C1000264B9A707B68DA7A244BDA707B689B8952 -:101C20009AB2224B9A80214B0022DA8000221A813C -:101C30001E4B234AC3F80A201C4BD3F80A30181D48 -:101C40007B6803F110017B68DB889BB21A4602F0C7 -:101C5000E3FD164BD3F80A305B6A03F2FF339B0AAD -:101C6000124AC2F81930114BD3F819300733DB0888 -:101C70009AB20E4BA3F81D200C4BB3F81D309BB24B -:101C80001A4600210D4802F0D5FD084B01225A707A -:101C9000064B5A221A700020FFF750FC002100204A -:101CA000FFF786FC81E200BF94BA03081C520020B3 -:101CB000B0BA0308D84900200C4A00203B5200204B -:101CC000782A00207B69062B79D17B689B7A042BCC -:101CD00040F06B82914B06225A60914BDB781A469A -:101CE0008E4B1A618E4B00221A708D4B00225A7057 -:101CF0007B689A7A8A4B9A707B68DA7A884BDA70BA -:101D00007B689B899AB2864B9A80854B834AC3F83D -:101D10000620834B00225A8100229A817F4B814A00 -:101D20005A617F4BD3F8063003F114007B6803F14E -:101D300010017B68DB889BB21A4602F06DFD784B80 -:101D4000D3F806305B691B6A754AD2F806205269DF -:101D5000528D92B21344013B714AD2F80620526967 -:101D6000528D92B2B3FBF2F36D4AC2F819306C4B4C -:101D7000D3F819300733DB089AB2694BA3F81D205A -:101D8000674BD3F81930664AB2F81D2092B2194653 -:101D9000654803F0C1F94FF480620021634802F006 -:101DA00049FD5F4B01225A705D4B5A221A70002088 -:101DB000FFF7C4FB00210020FFF7FAFBF5E17B6988 -:101DC000012B03D07B69042B40F005817B689B7A53 -:101DD000002B40F0AF80514A7B695360504BDB7859 -:101DE0001A464E4B1A614E4B00221A704C4B002281 -:101DF0005A707B689A7A4A4B9A707B68DA7A484BB9 -:101E0000DA707B689B899AB2454B9A80444B434A6F -:101E1000C3F80620424B00225A8100229A813F4B90 -:101E2000434A5A613E4BD3F8063058697B6803F148 -:101E300010017B68DB889BB21A4602F0EDFC384B40 -:101E4000D3F806305B691B6A354AD2F8062052691E -:101E5000528D92B21344013B314AD2F806205269A6 -:101E6000528D92B2B3FBF2F32D4AC2F819302C4BCB -:101E7000D3F819300733DB089AB2294BA3F81D2099 -:101E8000274BB3F81D309BB21A460021274802F0B9 -:101E9000D1FC234BD3F81930214AB2F81D2092B25D -:101EA0001946214803F038F91D4BD3F819303B612E -:101EB00008E03B691A4A01211846ECF725FC3B690A -:101EC00001333B613B6903F00703002BF1D1144B55 -:101ED000B3F81D309BB2B3F5806F11D2104BB3F83D -:101EE0001D309BB218330E4A134407330C4AB2F824 -:101EF0001D2092B2C2F58062FF21184602F09AFCC2 -:101F0000074B01225A70064B5A221A700020FFF725 -:101F100015FB00210020FFF74BFB45E1D8490020CD -:101F20001C5200200C4E0020C4BA03083B52002073 -:101F30000C4A00207B689B7A022B40F035819D4B38 -:101F400000221A709B4B00225A707B689A7A994B38 -:101F50009A707B68DA7A974BDA707B689B899AB2C1 -:101F6000944B9A80934B0022DA8000221A81914B85 -:101F7000914AC3F80A208F4BD3F80A30181D7B68AA -:101F800003F110017B68DB889BB21A4602F044FC27 -:101F9000884BD3F80A305B6A03F2FF339B0A854A09 -:101FA000C2F81930834BD3F819300733DB089AB2E3 -:101FB000804BA3F81D207F4BB3F81D309BB21A460F -:101FC00000217E4802F036FC7A4B01225A70794B90 -:101FD0005A221A70E8E07B69032B40F083807B680B -:101FE0009B7A002B40F0E180754B03225A60714BC5 -:101FF000DB781A46724B1A616E4B00221A706D4BD9 -:1020000004225A707B689A7A6A4B9A707B68DA7AF3 -:10201000684BDA707B689B899AB2664B9A80654BF5 -:10202000674AC3F80620634B00225A8100229A8136 -:10203000634B644A5A615F4BD3F8063058697B683A -:1020400003F110017B68DB889BB21A4602F0E4FBC7 -:10205000584BD3F806305B691B6A564AD2F8062003 -:102060005269528D92B21344013B524AD2F8062073 -:102070005269528D92B2B3FBF2F34E4AC2F8193054 -:102080004C4BD3F819300733DB089AB2494BA3F80D -:102090001D204FF48062FF21484802F0CBFB454BE6 -:1020A000D3F81930434AB2F81D2092B21946464877 -:1020B00003F032F8424B1B6BC8220021184602F095 -:1020C000B9FB3C4B04225A703A4B5A221A7000203A -:1020D000FFF748FA01210020FFF76AFA3B4803F0B6 -:1020E000B7F862E07B69052B5FD17B689B7A032B95 -:1020F0005BD1304B00221A702E4B00225A707B6845 -:102100009A7A2C4B9A707B68DA7A2A4BDA707B6861 -:102110009B899AB2274B9A80264B0022DA800022B4 -:102120001A81244B00225A8100229A81214B284A8D -:10213000C3F815201F4BD3F8153018467B6803F100 -:1021400010017B68DB889BB21A4602F065FB194BD5 -:10215000D3F815301B6A03F2FF339B0A154AC2F805 -:102160001930144BD3F819300733DB089AB2114BEE -:10217000A3F81D200F4BB3F81D309BB21A46002167 -:102180000E4802F057FB0B4B01225A70094B5A22A2 -:102190001A70104803F05CF8064BD3F81530194656 -:1021A0000220FFF7F3FB00E000BF002318461837BA -:1021B000BD4680BD1C520020782A00203B520020E2 -:1021C000D84900200C4A0020C4BA0308E8BA030822 -:1021D000943200200CBB030880B586B000AF786055 -:1021E00000237B617B68002B02D14FF0FF3339E085 -:1021F0007B68DB793B617B689B79FB601022002167 -:10220000786802F017FB7B68002242F006021A7120 -:10221000002262F07F025A71FB68DAB27B689A7220 -:102220003B69DAB27B68DA72FB68002B08D17B6805 -:102230004FF480620D491846E6F724FB78610AE006 -:10224000FB68022B07D17B684FF48072084918465F -:10225000E6F718FB78617B69002B02D0054802F095 -:10226000F7FF7B6918461837BD4680BDEC49002052 -:102270007C2A0020C0BB030880B584B000AF786022 -:102280007B68002B02D14FF0FF3336E01022002193 -:10229000786802F0CFFA1B4B1B785A2B07D0194BEA -:1022A00000225A7700229A77164B00225A707B68D8 -:1022B000002242F007021A71002262F07F025A7176 -:1022C000104B9A887B685A810E4B1A787B681A7378 -:1022D0000C4B5A787B685A737B680A4AB2F81D2007 -:1022E00092B209491846E6F7CDFAF860FB68002B70 -:1022F00002D0064802F0ACFFFB6818461037BD4616 -:1023000080BD00BF1C5200203B520020F0BB0308E0 -:1023100080B500AF0020FEF71BFA0346184680BDCB -:1023200080B584B000AF78607B68002B02D14FF09D -:10233000FF33E9E0764B1B785A2B05D0754802F045 -:1023400087FF6FF00103DFE0714B5B78012B0DD04D -:102350006F4B5B78022B09D06D4B5B78042B05D05B -:102360006D4802F075FF6FF00103CDE0684B5B78BC -:10237000012B02D1664B02225A707B689B899AB26C -:10238000634B9B889A420CD07B689B899BB2194611 -:102390005F4B9B881A46614802F0BEFE6FF0020355 -:1023A000B2E05B4B9B78002B1FD1594BD8787B68F0 -:1023B0005B899BB21A46564BD3F806305B695B8D3E -:1023C0009BB202FB03F319467B6803F110027B68A2 -:1023D000DB889BB2FEF722FE7B685B899BB24C4A8E -:1023E00001211846ECF790F95AE0494B9B78022BF3 -:1023F0001FD17B685B899BB218467B6803F1100193 -:102400007B68DB889BB21A460023EAF707F8F8607E -:10241000FB68002B08DB7B685B899BB23C4A01218F -:102420001846ECF771F93BE0F9683D4802F074FE9C -:1024300036E0374B9B78042B1FD1354BD8787B681F -:102440005B899BB21A46324BD3F806305B695B8DD1 -:102450009BB202FB03F319467B6803F110027B6811 -:10246000DB889BB2FEF7DAFD7B685B899BB2284A6A -:1024700001211846ECF748F912E0254B9B78032B15 -:102480000ED1234BD3F8153019467868FFF793FA2D -:102490007B685B899BB21E4A01211846ECF734F930 -:1024A0001B4B5B78042B2ED01948ECF795F90346AB -:1024B000012B28D1164B9B78002B09D1FEF7FEFE8D -:1024C0000020FFF74FF801210020FFF771F814E01A -:1024D0000F4B9B78022B10D00D4B9B78032B0CD00D -:1024E0000B4B9B78042B08D1FEF7E8FE0020FFF78A -:1024F00039F801210020FFF75BF8054B03225A70E1 -:10250000084802F0A5FE002318461037BD4680BDDE -:102510001C52002020BC030838BC030850BC030830 -:1025200090BC0308B0BC030880B584B000AF7860ED -:102530007B68002B02D14FF0FF3327E07B68DB88FC -:102540009BB2B3F5806F07D17B6810331846FFF755 -:10255000A3F80023FB6018E07B68DB889BB2102B9C -:1025600007D17B6810331846FFF746F80023FB605D -:102570000BE07B68DB889BB24FF48062194605480C -:1025800002F0CAFD6FF00103FB60FB6818461037CC -:10259000BD4680BDC8BC030880B584B000AF78607C -:1025A0000023FB607B68002B02D14FF0FF3315E066 -:1025B0007B68DB889BB2B3F5806F02D06FF00103BC -:1025C0000CE07B689B7A18467B68DB7A19467B684F -:1025D00010331A46FFF748F9F860FB6818461037C1 -:1025E000BD4680BD80B582B000AF78603960064BD3 -:1025F0001B683A6879681846E6F79EFF0346184656 -:102600000837BD4680BD00BF3C56002080B582B073 -:1026100000AF78603960064B1B683A6879681846E5 -:10262000E6F7B6FF034618460837BD4680BD00BF33 -:102630003C56002080B500AF034B1B681846E6F7F8 -:10264000D3FF0346184680BD3C56002080B500AF3E -:10265000034B1B681846E6F7DCFF0346184680BDAF -:102660003C56002080B500AFE6F78DFB0020E6F772 -:10267000E5FF03460C4A13600C4B0D4A1A600B4BE6 -:102680000C4A5A60094B0C4A9A60084B0B4ADA60B4 -:10269000064B0B4A1A610B4A00214FF47A70E5F79A -:1026A0004FFD00BF80BD00BF3C56002040560020BB -:1026B000E52503080D260308352603084D260308E3 -:1026C000357001086F96010890B5ADF6640D02AF44 -:1026D00007F58163C7F84C38D7F84C18D448E5F7AC -:1026E00095FEC7F84808D7F84838002B40F36B85AB -:1026F00007F65803A3F58A639B8840F20152934280 -:1027000000F0498440F20152934200F35E8540F2AA -:102710000242934200F0708340F20242934200F37F -:10272000548540F20142934200F0908340F201420E -:10273000934200F34A8540F20532934200F3458507 -:10274000B3F5407F0DDC40F20522934200F33D8556 -:10275000B3F5007F18DC0D2B72DC002B4EDC00F093 -:1027600034BDA3F20133042B00F22F8501A252F8ED -:1027700023F000BF152D0308392D0308CB310308C2 -:10278000A32D0308612E0308A3F20123042B00F2FA -:102790001C8501A252F823F0D12C0308E72C030872 -:1027A000FD2C0308CB310308092D0308A3F2011304 -:1027B0000F2B00F20A8501A252F823F0CB31030857 -:1027C000BD2A0308E32A0308CB310308F52A0308CE -:1027D0000D2B0308192B03084F2B0308A92E030800 -:1027E000E12E0308F530030823310308C72E030840 -:1027F000472F0308012B03089D310308013B0C2BD5 -:1028000000F2E38401A252F823F000BF532803082A -:10281000B728030809290308CB3103086D290308E9 -:10282000F7290308752A0308B1290308CB310308E7 -:10283000FD2F0308CB310308CB310308093003080F -:10284000B3F5887F00F3C184B3F5807FAEDC00F080 -:10285000BCBC07F65803A3F58A63DB8819467548A4 -:1028600002F05AFC07F65803A3F58A63DB881A4680 -:1028700007F5816311461846F5F748FEC7F8480882 -:10288000D7F84838002B11D10022D7F84C186848E7 -:10289000E5F784FFC7F84808D7F84838002B00F060 -:1028A0009684654802F0D4FC00F091BC634802F0C5 -:1028B000CFFC00F08CBC07F65803A3F58A63DB88D5 -:1028C0001A4607F5816311461846F5F7F5FEC7F875 -:1028D0004808D7F84838002B11D10022D7F84C18F7 -:1028E0005348E5F75BFFC7F84808D7F84838002B8E -:1028F00000F06F84524802F0ABFC00F06ABC514813 -:1029000002F0A6FC00F065BC4F4802F0A1FC07F6FF -:102910005803A3F58A63DB88194607F65803A3F525 -:102920008A631B891A4607F58163184600F0E0FFA9 -:10293000C7F84808D7F84838002B12D142F2107275 -:10294000D7F84C183A48E5F729FFC7F84808D7F8F0 -:102950004838002B00F03F843C4802F079FC00F03E -:102960003ABC3B4802F074FC00F035BC07F58163CB -:102970001846F5F70BFFC7F84808D7F84838002B7A -:1029800011D10022D7F84C182948E5F707FFC7F8FE -:102990004808D7F84838002B00F01F842D4802F073 -:1029A00057FC00F01ABC2C4802F052FC00F015BC99 -:1029B0002A4802F04DFC07F581631846F5F73CFF05 -:1029C000C7F84808D7F84838002B10D10022D7F8AC -:1029D0004C181748E5F7E2FEC7F84808D7F848381A -:1029E000002B00F0FC831E4802F032FCF7E31D4888 -:1029F00002F02EFCF3E307F581631846FFF7ECFBCA -:102A0000C7F84808D7F84838002B2FD14FF47A720E -:102A1000D7F84C180648E5F7C1FEC7F84808D7F8BC -:102A20004838002B00F0DD830F4802F011FCD8E39A -:102A3000405600206CBD03088CBD0308CCBD0308C4 -:102A40000CBE03084CBE030890BE0308A4BE0308D6 -:102A5000E4BE030824BF030864BF0308ACBF030837 -:102A6000C4BF030808C0030850C00308D14802F0DF -:102A7000EFFBB6E3D04802F0EBFB07F581631846A5 -:102A8000FFF7FAFBC7F84808D7F84838002B11D1F0 -:102A90004FF47A72D7F84C18C848E5F77FFEC7F8AC -:102AA0004808D7F84838002B00F09D83C44802F04E -:102AB000CFFB98E3C34802F0CBFB94E3C24802F09B -:102AC000C7FB07F65803A3F58A63DB881A4607F6A7 -:102AD0005803A3F58A631B8919461046F5F748FF8A -:102AE0008AE3BA4802F0B4FB07F58163184600F0A8 -:102AF000F5FD81E307F581631846FFF715FD7BE3DC -:102B000007F581631846FFF747FD75E307F5816315 -:102B10001846F6F7D1FB6FE3AD4802F099FB07F5D5 -:102B200081631033184601F0A9F9C7F81C08F5F7BE -:102B300055FCD7F81C38002B04DB4FF44070F6F737 -:102B4000DBFA59E340F20130F6F7D6FA54E307F620 -:102B50005803A3F58A639B79194607F65803A3F532 -:102B60008A63D3F807301A469A4802F0D5FA9A4B8E -:102B7000D3F83434002B40F0A78007F65803A3F5B0 -:102B80008A63D3F80730C7F85438D7F85438934AD3 -:102B9000934202D9914BC7F85438D7F85438904A29 -:102BA000A2FB03235B09C7F85438D7F85438C7F899 -:102BB0003438D7F834385B42C7F83438D7F834386B -:102BC00013F13B0F09DBD7F834383B2B05DCD7F882 -:102BD0003418844802F0A0FA6BE0D7F8343813F5C3 -:102BE000B46F27DDD7F83438B3F5B46F22DAD7F8ED -:102BF00034387B4A82FB03121A445211DB17D31A72 -:102C0000C7F83038D7F83428754B83FB02131344C8 -:102C10005911D317C91A0B461B015B1A9B00D31A13 -:102C2000C7F82C38D7F82C28D7F830186E4802F09F -:102C300073FA3EE0D7F834386C4A82FB03121A4428 -:102C40009212DB17D31AC7F82838D7F83438674AF6 -:102C500082FB03121A449112DA178A1A4FF4B461F4 -:102C600001FB02F29B1AC7F82438D7F824285C4BE2 -:102C700083FB021313445911D317C91A0B461B01C6 -:102C80005B1A9B00D31AC7F82038D7F82438544A67 -:102C900082FB03121A445211DB17D31AC7F82438E7 -:102CA000D7F82038D7F82428D7F82818504802F049 -:102CB00033FAD7F8340801F0F3F9F5F78FFB464BF8 -:102CC0000122C3F8342497E24A4802F0C1FA93E2A1 -:102CD0000020F6F711FA07F581631846F5F77EFF35 -:102CE00000F092FA88E20020F6F706FA07F5816311 -:102CF0001846F6F737F800F087FA7DE207F58163AA -:102D00001846F6F7C1F977E207F581631846F6F73A -:102D1000D7F971E207F581631846FEF799FEF6F7D9 -:102D200067FA0020FEF754FC0346002B40F05D825A -:102D30000020F6F735FA58E2E5F730FBC7F85008FF -:102D4000FFF7E6FAC7F84408D7F84438022B18D042 -:102D5000D7F84438002B14DBE5F720FBC7F8400810 -:102D6000D7F84028D7F85038D31A40F6B8329342F3 -:102D7000E6D9D7F84038C7F850380120F6F704FAFA -:102D8000DEE707F581631846FFF7CAFA0020FEF771 -:102D90001FFC0346012B40F02A820120F6F700FABF -:102DA00025E207F581631846FEF71AFEF6F720FACA -:102DB00022E200BF90C00308D4C0030840560020A0 -:102DC000F0C0030834C103087CC1030894C10308A0 -:102DD000B0C10308C4C103083038002080A8120124 -:102DE00089888888E8C10308FCC10308B7600BB66E -:102DF00018C203083CC2030807F65803A3F58A6308 -:102E00009B79194607F65803A3F58A631B7A1A467D -:102E100007F65803A3F58A63DB79CA4802F07CF908 -:102E200007F65803A3F58A63987907F65803A3F5C4 -:102E30008A63197A07F65803A3F58A63DB791A4681 -:102E4000FCF76AF80120F5F7A9FAD5E1BE4802F0CF -:102E5000FFF96420F5F7A2FA0120E9F709FDCBE1BB -:102E6000BA4BDB681A4607F5816311461846F5F739 -:102E700057FCC7F84808D7F84838002B10D1002273 -:102E8000D7F84C18B248E5F789FCC7F84808D7F8D6 -:102E90004838002B00F0AD81AE4802F0D9F9A8E126 -:102EA000AD4802F0D5F9A4E1AC4802F0D1F9AC4B41 -:102EB000C7F83838D7F8380800F09CFDFAF70AFD53 -:102EC000FAF736FD98E1A74802F0C2F9A64BC7F819 -:102ED0003C38D7F83C0800F08DFDFAF757FD8BE140 -:102EE00007F65803A3F58A63DB79194607F65803FA -:102EF000A3F58A639B791A469C4802F00DF907F600 -:102F00005803A3F58A63DB791A463B46984918466D -:102F100002F0A6F93B46184600F06CFD07F6580390 -:102F2000A3F58A63DB79194607F65803A3F58A638C -:102F30009B791A460023019300230093FF23052069 -:102F4000FBF7F9FF58E107F65803A3F58A639B796D -:102F50001946884802F0E0F807F65803A3F58A639B -:102F60009B791A463B468449184602F079F93B465C -:102F7000184600F03FFD07F65803A3F58A639B79D6 -:102F80001A460023019300230093FF23002106200B -:102F9000FBF7D1FF30E107F65803A3F58A639B796D -:102FA000194607F65803A3F58A635B7A1A4607F6B3 -:102FB0005803A3F58A63DB79184607F65803A3F58F -:102FC0008A631B7A009303466C4802F0A5F807F663 -:102FD0005803A3F58A63987907F65803A3F58A6323 -:102FE000597A07F65803A3F58A63DA7907F6580386 -:102FF000A3F58A631B7AF5F76DFCFDE0F5F726FA79 -:103000006420F5F7CBF9F7E007F65803A3F58A63D8 -:10301000DB7A194607F65803A3F58A639B7A1A46AA -:1030200007F65803A3F58A631B7B554802F074F832 -:1030300007F65803A3F65803184680231A460021C2 -:1030400001F0F8FB07F65803A3F58A63DB7A18460C -:1030500007F65803A3F58A639B7A194607F65803C7 -:10306000A3F58A631B7B1A463B46F5F7F6F9C7F8CA -:103070001808D7F81838002B33D107F65803A3F5F2 -:103080008A63D97A07F65803A3F58A639A7A07F612 -:103090005803A3F58A631C7B07F581603B460093C8 -:1030A0002346F5F7E9F9C7F81808D7F81838002BC0 -:1030B00013D1344802F0CCF80022D7F84C18244839 -:1030C000E5F76CFBC7F81808D7F81838002B00F0A4 -:1030D00092802D4802F0BCF88DE02C4802F0B8F840 -:1030E00089E0D7F818182A4802F016F8D420F6F725 -:1030F00003F880E007F65803A3F58A63DB7A1946E4 -:1031000007F65803A3F58A639B7A1A46214802F012 -:1031100003F83A4607F5816319460520FBF718FFC7 -:103120006AE007F65803A3F58A639B7A19461A48A2 -:1031300001F0F2FF3A4607F5816319460620FBF7D6 -:1031400007FF59E058C2030894C20308D849002079 -:1031500040560020ACC20308ECC2030830C3030889 -:103160004CC3030864C303088CC30308A4C3030847 -:10317000CCC30308ECC3030810C403082CC4030821 -:1031800070C4030898C40308ACC40308F0C403085F -:1031900038C503085CC5030884C5030807F658034F -:1031A000A3F58A63DB7A194607F65803A3F58A6309 -:1031B0009B7A1A4607F65803A3F58A631B7B1148CE -:1031C00001F0AAFF18E000BF16E000BF14E000BF46 -:1031D00012E000BF10E000BF0EE000BF0CE000BF37 -:1031E0000AE000BF08E000BF06E000BF04E000BF47 -:1031F00002E000BF00E000BF00BF07F65C07BD466D -:1032000090BD00BFA4C5030880B584B000AFE5F74A -:10321000C5F80346FB601048E5F7CCF8B860BB681A -:10322000002B13D0B9680D4801F076FF0120F5F7A7 -:10323000B5F8E5F7B3F803467B607A68FB68D31A04 -:103240000A2BE8DD064802F003F800E000BF00BFEB -:103250001037BD4680BD00BF40560020D0C50308D2 -:10326000E8C5030880B5ADF5846D00AF07F584634C -:10327000A3F21C43186007F10803C7F81C34F5F7E4 -:103280005FFF0346002B06D107F58463A3F21C43BE -:103290001B68002B1CD007F1080300211846F5F726 -:1032A0000BFAC7F81804D7F81834002B08D10022FD -:1032B000D7F81C140948E5F771FAC7F8180402E0BA -:1032C000074801F0C5FF074B5B681846F2F720FA84 -:1032D00000BF07F58467BD4680BD00BF4056002093 -:1032E00008C603083038002080B400AF064B1B68C6 -:1032F0005B68022B01D1012300E000231846BD4684 -:103300005DF8047B704700BF3C56002080B5ADF5EA -:10331000836D00AF3B46C7F81434D7F8141409483E -:10332000E5F774F8C7F81004D7F81034002B01DD66 -:10333000012302E0FFF7D8FF0023184607F5836753 -:10334000BD4680BD4056002080B5ADF5846D00AF10 -:1033500007F58463A3F21C43186007F10803C7F85C -:103360001C34D7F81C14CA48E5F750F8C7F81804FD -:10337000D7F81834002B40F37D8107F58463A3F55B -:1033800083639B88B3F5417F00F05581B3F5417F9E -:1033900000F3668140F20232934200F0368140F23F -:1033A0000232934200F35C8140F20132934200F01A -:1033B000148140F20132934200F3528140F2022222 -:1033C000934200F0A08040F20222934200F3488131 -:1033D000B3F5837F00F03781B3F5837F00F340813D -:1033E00040F20512934200F0EB80B3F5837F80F248 -:1033F0003781072B16DC022BC0F23281023B052BF2 -:1034000000F22E8101A252F823F000BF2D340308F0 -:10341000813403086136030861360308193503084F -:103420006B350308B3F5817F5AD019E1994801F053 -:103430000FFF07F58463A3F58363DB881A4607F162 -:10344000080311461846F5F737F9C7F81804D7F8F6 -:103450001834002B10D10022D7F81C148C48E5F743 -:103460009DF9C7F81804D7F81834002B00F0048130 -:10347000894801F0EDFEFFE0884801F0E9FEFBE03D -:10348000874801F0E5FE07F58463A3F58363DB88D5 -:10349000194607F58463A3F583631B891A4607F170 -:1034A0000803184600F024FAC7F81804D7F81834AF -:1034B000002B11D142F21072D7F81C147448E5F7B2 -:1034C0006DF9C7F81804D7F81834002B00F0D6802F -:1034D000744801F0BDFED1E0734801F0B9FECDE0C3 -:1034E000724801F0B5FE07F58463A3F58363DB88BA -:1034F0001A4607F58463A3F583631B8919461046B2 -:10350000F5F736FAE5E06A4801F0A2FE07F1080394 -:103510001846F5F727FDDCE007F58463A3F21C43AA -:103520001B68012B40F0AC8007F108031846FEF73A -:1035300053FEC7F81804D7F81834002B11D14FF4F4 -:103540007A72D7F81C145248E5F728F9C7F818041E -:10355000D7F81834002B00F09380564801F078FE1D -:103560008EE0554801F074FE8AE007F58463A3F20B -:103570001C431B68012B40F08580504801F068FE19 -:1035800007F108031846FEF777FEC7F81804D7F8C6 -:103590001834002B10D14FF47A72D7F81C143C4821 -:1035A000E5F7FCF8C7F81804D7F81834002B69D0F1 -:1035B000434801F04DFE65E0424801F049FE61E0FC -:1035C00007F58463A3F21C431B68012B5CD107F150 -:1035D00008031846FEF7A8FF56E007F58463A3F238 -:1035E0001C431B68012B51D107F108031846FEF755 -:1035F0002FFAF5F7FDFD0020FDF7EAFF0346002B4B -:1036000044D10020F5F7CCFD40E007F58463A3F238 -:103610001C431B68012B59D107F108031846FEF71C -:103620007FFE0020FDF7D4FF0346012B4ED1012081 -:10363000F5F7B6FD4AE007F108031846FEF7D0F9A2 -:10364000F5F7D6FD45E007F58463A3F21C431B683C -:10365000012B3DD107F108031846F5F72DFE37E0A1 -:1036600007F58463A3F583639B881946164801F028 -:1036700053FD2EE000BF2CE000BF2AE000BF28E091 -:1036800000BF26E000BF24E000BF22E000BF20E032 -:103690004056002038C6030854C603089CC60308D9 -:1036A00090BE0308A4BE0308E4BE0308E8C60308EE -:1036B00000C7030820C7030868C70308B4C7030886 -:1036C000D0C703081CC803086CC8030800BF00E08B -:1036D00000BF00BF07F58467BD4680BDF0B585B06B -:1036E00000AF78600023FB607B68002B02D14FF0B5 -:1036F000FF33EBE07B685B899BB2002B3DD17B689D -:10370000DB889BB2B3F5806F18D17B681033714AA8 -:10371000104619464FF480631A4601F07DF8FAF717 -:1037200053F9FAF7ADF84FF4AA40EBF7A7FB4FF4C3 -:10373000AA40F4F76DFE0023FB60C6E07B68DB88DF -:103740009BB2042B15D17B689B899BB21A467B6880 -:1037500010331B6819461046FAF7F6FCFAF790F892 -:103760004FF4AA40EBF78AFB4FF4AA40F4F750FE5F -:10377000ABE06FF00103FB60A7E07B685B899BB265 -:10378000012B39D17B68DB889BB2B3F5806F16D1F2 -:103790007B681033504A104619464FF480631A462E -:1037A00001F03AF8FAF7C2FAFAF778F8AA20EBF73C -:1037B00065FBAA20F4F72CFE0023FB6085E07B6804 -:1037C000DB889BB2042B13D17B689B899BB21A4682 -:1037D0007B6810331B6819461046FAF745FDFAF767 -:1037E0005DF8AA20EBF74AFBAA20F4F711FE6CE083 -:1037F0006FF00103FB6068E07B685B899BB2062B7E -:103800002ED17B68DB889BB2B3F5806F11D17B68CA -:103810001033324A104619464FF480631A4600F0BE -:10382000FBFFFAF749F80023FB602D4801F010FD7B -:103830004BE07B68DB889BB2022B0DD17B689B89B8 -:103840009BB21A467B6810331B8819461046FAF75C -:103850007FFDFAF731F838E06FF00103FB6034E0E8 -:103860007B685B899BB2092B2CD17B68DB889BB280 -:10387000B3F5806F22D17B6810331A4A104603F1EA -:10388000300402461946D1F800C04E688D68C968F8 -:10389000C2F800C056609560D16010331030A3426A -:1038A000EFD10246186859689B68106051609360B8 -:1038B0000D4801F0CDFC0023FB6006E06FF0010332 -:1038C000FB6002E0094801F0C3FCFB6818461437AE -:1038D000BD46F0BDFC3C0020FC400020FC44002024 -:1038E00088C80308FC4800209CC80308BCC803081B -:1038F00080B588B000AFF860B9607A60FB68002BD3 -:1039000002D14FF0FF3368E010220021F86800F088 -:1039100091FFFB68002242F003021A71002262F05C -:103920007F025A71BB689AB2FB685A817B689AB26F -:10393000FB689A817B68002B27D1BB68002B08D1DC -:10394000FB684FF4806227491846E4F79BFFF86153 -:103950003CE0BB68012B08D1FB684FF48062224930 -:103960001846E4F78FFFF86130E0BB68062B08D1FA -:10397000FB684FF480621D491846E4F783FFF86145 -:1039800024E06FF00103FB6120E0BB68002B0DD148 -:103990007868FAF7BDFB0346BB61FB6807F11801C5 -:1039A00004221846E4F76EFFF8610FE0BB68012BB4 -:1039B0000CD17868FAF73CFC03467B61FB6807F1A1 -:1039C000140104221846E4F75DFFF861FB69002B3F -:1039D00002D0074801F03CFCFB6918462037BD4681 -:1039E00080BD00BFFC3C0020FC400020FC440020C7 -:1039F000C8C8030880B5ADF5846D00AF07F58463D2 -:103A0000A3F21C43186007F10C0310220021184692 -:103A100000F010FF07F58463A3F2144348F210028C -:103A20009A8007F58463A3F21C431868DCF7FAFB5D -:103A300003469AB207F58463A3F21C4307F10C0016 -:103A40001968E4F71FFFC7F81C04D7F81C34002BD3 -:103A500003D00A4801F0FCFB08E007F10C03002248 -:103A600019460748E4F79AFEC7F81C04D7F81C3437 -:103A7000184607F58467BD4680BD00BFF4C803083B -:103A80004056002080B400AF00231846BD465DF8C4 -:103A9000047B704780B5B2B000AF0023C7F8C430D4 -:103AA000904B1B68002B01DB002385E10023C7F846 -:103AB000C03007F124031846E3F7AAF97B6AD7F868 -:103AC000C0201344C7F8C030BB6AD7F8C0201344E5 -:103AD000C7F8C030FB6AD7F8C0201344C7F8C0301D -:103AE0003B6BD7F8C0201344C7F8C03040220021F8 -:103AF0007D4800F09FFE07F1740340221946002024 -:103B0000E5F7C8F807F13403402219464020E5F7ED -:103B1000C1F897F87430CB2B38D1B7F875309BB219 -:103B2000002B33D197F87730032B2FD1BB6FD7F809 -:103B3000C0209A422AD197F83430CB2B1AD1B7F84B -:103B400035309BB2002B15D197F83730032B11D1AC -:103B5000BB6BD7F8C0209A420CD13A6FD7F8B0307F -:103B60009A4203D95F4B01221A600EE05D4B00229E -:103B70001A600AE05B4B00221A6007F174034022CE -:103B800019464020E5F7BFF81CE01BE097F83430F9 -:103B9000CB2B17D1B7F835309BB2002B12D197F849 -:103BA0003730032B0ED1BB6BD7F8C0209A4209D116 -:103BB0004C4B01221A6007F13403402219460020C1 -:103BC000E5F7A1F8474B1B68002B01DA00F008F974 -:103BD000444B1B68002B08D1444801F039FB4022BC -:103BE00041490020E5F756F80FE03E4B1B68012BDA -:103BF00008D13F4801F02CFB40223B494020E5F72B -:103C000049F802E03B4801F023FB374B1B78CB2BF4 -:103C10000FD1354BB3F801309BB2002B09D1324B99 -:103C2000DB78032B05D1304B5B68D7F8C0209A4274 -:103C300005D0314801F00CFB00F0D2F867E04FF0FE -:103C4000FF33C7F8BC30284BDA783B462B4918467F -:103C500000F0DCFBC7F8BC00D7F8BC30002B05DA5D -:103C6000274801F0F5FA00F0BBF850E03B681E4A27 -:103C7000D278934230D17A681B4B5B689A422BD141 -:103C8000BB68C7F8B830D7F8B83041F24F4293421A -:103C900009DDD7F8B83041F2B442934203DC124B4D -:103CA000184A1A6232E0D7F8B830002B2EDAD7F86B -:103CB000B8305B42C7F8B830D7F8B83041F24F425D -:103CC000934223DDD7F8B83041F2B44293421DDC71 -:103CD000054B00221A6219E00B4801F0B9FA00F016 -:103CE0007FF814E01C0D0020545600204CC9030836 -:103CF00058C9030864C9030874C903085C56002046 -:103D000088C90308FF3FFF7FB4C9030800BF2C4BDD -:103D10001B6A2C4A934243DCFFF7B4FEC7F8B40099 -:103D2000274B5B6AD7F8B4209A4236D3244B5B6AA0 -:103D3000D7F8B420D31AC7F8B430D7F8B410224853 -:103D400001F0EAF9D7F8B430204AA2FB03235B095B -:103D5000C7F8B430D7F8B4300133C7F8B430184BD3 -:103D60001B6A1A46D7F8B430D31A1A46144B1A6293 -:103D7000134B1B6A002B02DA114B00221A62104B04 -:103D80001B6A104A934202DD0D4B0E4A1A62D7F8A5 -:103D9000B430013BC7F8C43002E00D4801F058FAD6 -:103DA000FFF770FE0346064A53620A4A0A490B4867 -:103DB000E3F748FDD7F8C4301846C837BD4680BD84 -:103DC000545600200080FE7FE4C903088988888853 -:103DD00004CA03089541030810CA030824CA03084B -:103DE00080B596B000AF00237B653B1D1846E3F716 -:103DF0000FF87B687A6D13447B65BB687A6D13445A -:103E00007B65FB687A6D13447B653B697A6D13446F -:103E10007B6507F1140340220021184600F00AFDDB -:103E2000CB233B7500237B750023BB750323FB75F8 -:103E30007B6DBB6164233B6500237B63FFF722FE40 -:103E40000346BB6307F11403402219460020E4F740 -:103E50005AFF07F11403402219464020E4F753FFAC -:103E6000044B00221A60044801F0F2F900BF5837F1 -:103E7000BD4680BD1C0D002028CA030880B596B041 -:103E800000AF78604FF0FF337B657868E3F7B4FCF0 -:103E9000744B1B68002BC0F2E080734BDA7807F19B -:103EA0002C037968184600F0B1FA78657B6D002B19 -:103EB000C0F2D380FB6A6C4AD278934240F0C9804A -:103EC0003A6B694B5B689A4240F0C380664B1B7A41 -:103ED000002B0CD0644BDA7807F1080363491846CD -:103EE00000F094FA78657B6D002B0DDAB5E07B6C01 -:103EF000002B05DB7B6C052B02DC7B6CBB6103E0DC -:103F00004FF0FF337B65A8E07A6CBB699A4240F0C2 -:103F10009C807B6B3B653B6D002B30DD3B6D41F244 -:103F2000883293422BDC504B1B6A514A934203DC8C -:103F30004D4B1B6A002B08DA3A6D13461B019B1A86 -:103F40009B001A46484B1A626EE0474B196A3A6D5D -:103F500013461B019B1A9B000B44434A1362424BBE -:103F60001B6A002B02DA404B00221A623E4B1B6A8E -:103F70003F4A934258DD3C4B3D4A1A6254E03B6D48 -:103F800041F24F42934208DD3B6D41F2B44293420D -:103F900003DC354B374A1A6249E03B6D002B3FDAB0 -:103FA0003B6D5B423B653B6D002B27DD3B6D41F27A -:103FB0008832934222DC2C4B1B6A2D4A934203DD4C -:103FC000294B00221A6231E0274B196A3A6D1346D9 -:103FD00012019B1A9B000B44234A1362224B1B6A5B -:103FE000002B02DA204B00221A621F4B1B6A204A68 -:103FF00093421BDD1C4B1E4A1A6217E03B6D41F2D7 -:104000004F42934208DD3B6D41F2B442934203DCE0 -:10401000154B00221A620AE04FF0FF337B651CE06B -:104020004FF0FF337B6518E000BF00E000BF1422B3 -:1040300079680E4800F0F0FB0B4B00221A77002045 -:1040400000F02EF800237B6507E04FF0FF337B651F -:1040500003E04FF0FF337B6500BF7B6D1846583798 -:10406000BD4680BD1C0D0020545600205C5600202B -:104070000080FE7FFF3FFF7F80B400AF064B1B68D0 -:10408000002B02DB054B1B6A00E000231846BD46EF -:104090005DF8047B704700BF1C0D002054560020C3 -:1040A00080B582B000AF7860234B1B68002B03DA29 -:1040B000224B00221A6239E0FFF7E4FC03461F4A54 -:1040C00053621E4B1B6A1E4A934205DC1B4B1A6A45 -:1040D0007B681344194A1362184B1B6A002B03DADE -:1040E000164B00221A6207E0144B1B6A144A9342D3 -:1040F00002DD124B134A1A62104BDB6B01330F4A7D -:10410000D3630D4B1B68002B08D140220B49402084 -:10411000E4F7F9FD084B01221A6007E04022074945 -:104120000020E4F7F0FD044B00221A60034B1B6AE9 -:1041300018460837BD4680BD1C0D0020545600208F -:104140000080FE7FFF3FFF7F80B582B000AF7860C8 -:10415000054B5B681A460549786801F081F800BF95 -:104160000837BD4680BD00BF5456002038CA03083A -:1041700080B582B000AF7860044A0549786801F0E4 -:104180006FF800BF0837BD4680BD00BF5C560020F9 -:1041900044CA030880B58CB000AF78603960002352 -:1041A000FB620023BB627B68002B4CD03B68002B7A -:1041B00049D03A687968264800F0AEFF7B681B78E2 -:1041C000002B03D0786800F0E9FAF8623B681B78AE -:1041D000002B03D0386800F0E1FAB862FB6A002BCC -:1041E0001DD107F108031846FFF7AEFF07F10803DA -:1041F0001946184800F090FF07F108031846FFF72A -:10420000B7FF07F108031946124800F085FFFFF7D2 -:1042100033FF03461946104800F07EFF14E0FB6AA6 -:10422000012B03D13868FFF729FE0DE0FB6A022B52 -:1042300003D1B86AFFF734FF06E0FB6A642B03D1B1 -:10424000FFF7CEFD00E000BF3037BD4680BD00BFA8 -:1042500050CA030868CA030870CA030880B485B04E -:1042600000AF786039600123FB723B685A4203F06B -:10427000070302F0070258BF5342BB723B68002B92 -:1042800000DA0733DB101A467B6813447B60002397 -:10429000FB6005E0FB7A5B00FB72FB680133FB60AF -:1042A000BB7AFA689A42F5DB7B681A78FB7A13408E -:1042B000DBB2002B01D0012300E0002318461437A5 -:1042C000BD465DF8047B704780B487B000AFF860EE -:1042D000B9607A600123FB74BB685A4203F007039C -:1042E00002F0070258BF5342BB74BB68002B00DAD0 -:1042F0000733DB101A46FB681344FB6000237B6125 -:1043000005E0FB7C5B00FB747B6901337B61BB7C5C -:104310007A699A42F5DB7B68002B07D0FB681A7834 -:10432000FB7C1343DAB2FB681A700BE0FB681B7866 -:104330005AB297F91330DB435BB213405BB2DAB287 -:10434000FB681A7000BF1C37BD465DF8047B7047E0 -:1043500080B58AB000AFF860B9607A60FB68002B66 -:1043600050D0BB68012B4DDD7B68002B4AD07B68A9 -:10437000002B03DA4FF0FF337B6201E001237B6205 -:104380007B687A6A02FB03F37B607B68BA6893FB05 -:10439000F2F2B96801FB02F29B1A7B6000233B62D8 -:1043A000396AF868FFF75AFFB8617B6A002B0BDAAD -:1043B0003A6A7B68D31AFB61FB69002B10DAFA6951 -:1043C000BB681344FB610BE03A6A7B681344FB61F2 -:1043D000FA69BB689A4203DBFA69BB68D31AFB61CE -:1043E000F969F868FFF73AFF7861BA69F969F8681E -:1043F000FFF76AFFFB693B627B69BB613B6A002B8D -:10440000D3D100E000BF2837BD4680BD80B59AB04B -:1044100000AFF860B9601346FB71FB68002B02D057 -:10442000BB68002B02D14FF0FF338EE12422002124 -:10443000F86800F0FFF9FB79002B02D0FB79032B21 -:1044400002D94FF0FF3380E100237B6618E0FA7950 -:10445000984913469B0013449B00CA187B6E134473 -:104460001B78013BBB64BB6CBA681344197807F135 -:1044700034027B6E13440A461A707B6E01337B66EE -:104480007B6E132BE3DD00233B662AE007F1340249 -:104490003B6E13441B7887F84C300023FB650AE021 -:1044A000854AFB6D13441B7897F84C209A4206D03E -:1044B000FB6D0133FB65FB6D1F2BF1DD00E000BFE1 -:1044C000FB6D1F2B02DD4FF0FF333EE1FB6DD9B2D8 -:1044D00007F110023B6E13440A461A703B6E01331B -:1044E0003B663B6E132BD1DD07F124030D22002127 -:1044F000184600F09FF913233B6648E007F11002CD -:104500003B6E13441B7887F84D3097F84D3003F01D -:104510001F0387F84D300C23FB6524E007F12402CC -:10452000FB6D13441B785B01D9B207F12402FB6DCC -:1045300013440A461A7007F12402FB6D13441A78DB -:10454000FB6D013B68333B4413F8443CDB08DBB2B2 -:104550001343D9B207F12402FB6D13440A461A70C3 -:10456000FB6D013BFB65FB6D002BD7DC97F824301E -:104570005B01DBB287F8243097F8242097F84D30A0 -:104580001343DBB287F824303B6E013B3B663B6E46 -:10459000002BB3DA0023BB6510E007F12402BB6DEA -:1045A00013441B7883F05903D9B207F12402BB6D81 -:1045B00013440A461A70BB6D0133BB65BB6D0C2BEF -:1045C000EBDD97F8303003F00F03DBB287F83030C3 -:1045D00097F8303003F00F03DBB287F8303097F8EC -:1045E000303087F84F30FA7997F84F10314813463A -:1045F0009B0013449B0003440B441B787B651023F2 -:104600003B650DE0FA792B4913469B0013449B0050 -:10461000CA183B6D13441B787B653B6D01333B65CA -:104620003B6D132B0BDC7B6D052BEBD07B6D0A2BCD -:10463000E8D07B6D0F2BE5D07B6D142BE2D03B6D6A -:10464000142B11D07B6D052B0ED07B6D0A2B0BD05C -:104650007B6D0F2B08D07B6D142B05D07B6D002B51 -:1046600002DD7B6D142B02DD4FF0FF336DE097F818 -:104670004F3003F00103002B02D17B6D5B427B6561 -:1046800007F124037A6D60211846FFF761FE07F1F8 -:10469000240301330C211846E4F7DEF9034687F8BA -:1046A0004E3097F8243097F84E209A4206D04FF0BB -:1046B000FF334AE060F4030840F4030897F82F3012 -:1046C0001A46FB681A60D7F82B20FB685A60B7F9C6 -:1046D00029301BB21F4A82FB0312DB17D31A1BB20D -:1046E0001A46FB689A60D7F825301A4A82FB0312F3 -:1046F000DB17D21AFB68DA60FB689A68FB68DB6834 -:104700001A4413465B0013445B001846B7F929307E -:104710001BB21A46D7F82530D1180E4B83FB013255 -:10472000CB17D21A13465B0013445B00CA1A02442B -:10473000FB681A61D7F82520FB689A61B7F9293020 -:104740001BB21A46FB685A61002318466837BD46FB -:1047500080BD00BFABAAAA2A80B483B000AF0123FA -:104760003B603B6883F3108800BF074B074A9A60A1 -:1047700000237B607B6883F3108800BF00BF0C3789 -:10478000BD465DF8047B704700ED00E000000108C5 -:1047900080B500AFEAF764F800BF80BD0A220021AF -:1047A00000F008BE014B1868704700BF200D0020C4 -:1047B00070B50D4D0D4C641BA4100026A64209D106 -:1047C0000B4D0C4C03F070F9641BA4100026A6429C -:1047D00005D170BD55F8043B98470136EEE755F812 -:1047E000043B98470136F2E794F8030894F803086D -:1047F00094F8030898F8030810B501390244904270 -:1048000001D1002005E0037811F8014FA34201D047 -:10481000181B10BD0130F2E70A44914200F1FF334A -:1048200000D1704710B511F8014B03F8014F9142C8 -:10483000F9D110BD02440346934200D1704703F8FA -:10484000011BF9E72DE9FF4755EC104B002D0E46F3 -:1048500019462B46BBBF05F100431D4600232D23FF -:104860000B700D9BDDF830A0914623F02008BCBFF3 -:1048700022461446B8F1460F05D0B8F1450F00D1D5 -:104880000136022100E0032103AB019302AB009348 -:1048900045EC104B5346324600F0E2FEB8F1470FAC -:1048A000074602D119F0010F22D0B8F1460F07EBED -:1048B000060910D13B78302B0AD100220023204674 -:1048C0002946DCF731F918B9C6F10106CAF80060CB -:1048D000DAF8003099440022002320462946DCF70C -:1048E00023F908B1CDF80C903022039B4B4507D338 -:1048F000039B0E9ADB1B3846136004B0BDE8F087BB -:10490000591C03911A70F0E7F7B503460029B8BFA8 -:10491000494203F8022BB4BF2D222B2209294270F1 -:104920002ADD0DF10704A4460A27A6460A4691FB94 -:10493000F7F607FB16153035632A04F1FF340EF83D -:10494000015C3146F1DC3031AEF1020504F8011CA6 -:10495000441C294661450AD30DF10902A2EB0E025F -:10496000654588BF00221344181A03B0F0BD11F842 -:10497000012B04F8012FEDE7302330318370C17033 -:10498000031DF1E72DE9F04F2DED028B8DB00C46A4 -:10499000DDF8608016461F46054601F007FED0F898 -:1049A00000A05046DBF73EFC00230A9323680593E2 -:1049B000D8F8003094F818B0073323F0070303F158 -:1049C0000802C8F80020D3E90023C4E91223D4E97F -:1049D000128929F000430793CDF8188008EE100AD9 -:1049E0009F4BDDE906014FF0FF32DCF7CFF888BBC3 -:1049F000DDE906019A4B4FF0FF32DCF7A9F848BB1E -:104A00000022002340464946DCF798F810B12D23D8 -:104A100084F84330934B9448BBF1470F94BF9846BA -:104A2000804603232361059B23F0040222604FF09C -:104A30000009009733460BAA2146284600F0D8F912 -:104A4000013040F090804FF0FF300DB0BDEC028B94 -:104A5000BDE8F08F42464B4640464946DCF796F8A3 -:104A600040B14B46002BBCBF2D2384F843307F4818 -:104A70007F4BD1E763680BF0DF0206925A1C3FD1EF -:104A800006236360059B616843F4806200230393FF -:104A90000AABCDE901B309AB49EC108B009322605E -:104AA0000DF123032846FFF7CDFE069B0999472BFE -:104AB000804608D1C81C02DB6368994241DDABF136 -:104AC000020B5FFA8BFBBBF1650F20D801395A4608 -:104AD00004F150000991FFF717FF0A9A1318012AF1 -:104AE0008146236102DC2268D20701D501332361AC -:104AF0009DF82330002B9CD02D2384F8433098E779 -:104B0000069A472ABED1002BBCD10123B9E7BBF1DD -:104B1000660F18D1002963680BDD216113B9226883 -:104B2000D00702D501330B442361A1654FF0000982 -:104B3000DEE713B92268D20701D50233F4E7012377 -:104B4000F2E74FF0670B0A9B994205DB236821616E -:104B5000D807EAD54B1CE7E70029D4BFC1F1020210 -:104B600001221344E0E723685A0507D4236942462B -:104B700031462846B84701302CD164E7BBF1650FB8 -:104B800040F2E080D4E9120100220023DBF7CCFFE1 -:104B9000002834D0374A012331462846B84701302F -:104BA0003FF451AFDDE909239A4202DB2368D807BD -:104BB00010D518EE103A524631462846B847013013 -:104BC0003FF441AF4FF0000804F11A090A9B013B82 -:104BD000434509DC23689B0700F10581E0680B9BD6 -:104BE0009842B8BF184630E701234A463146284666 -:104BF000B84701303FF427AF08F10108E6E7099B09 -:104C0000002B39DC1B4A012331462846B8470130C6 -:104C10003FF419AFDDE90923134302D12368D90713 -:104C2000D8D518EE103A524631462846B8470130DA -:104C30003FF409AF4FF0000904F11A0A099B5B42E7 -:104C40004B4501DC0A9B92E7012352463146284638 -:104C5000B84701303FF4F7AE09F10109EEE700BFB4 -:104C6000FFFFEF7FB4F40308B8F40308C0F40308AF -:104C7000BCF40308C4F403080A9AA36D9A42A8BFBF -:104C80001A46002A914637DC4FF0000B29EAE979F1 -:104C900004F11A02A36D0593A3EB09035B4533DC12 -:104CA000DDE909239A423BDB2368DA0738D40A9B03 -:104CB000059A09999A1AA3EB01099145A8BF914653 -:104CC000B9F1000F35DC4FF0000829EAE97904F169 -:104CD0001A0ADDE909239B1AA3EB090343457FF771 -:104CE00079AF0123524631462846B84701303FF498 -:104CF000AAAE08F10108ECE71346314642462846C1 -:104D0000B8470130C0D19EE60123314628460592BE -:104D1000B84701303FF497AE059A0BF1010BB9E7A4 -:104D200018EE103A524631462846B8470130BED1F7 -:104D300089E6059A4B46424431462846B847013039 -:104D4000C1D180E60A9A012A01DCDB0738D50123AC -:104D5000424631462846B84701303FF474AE18EE5B -:104D6000103A524631462846B84701303FF46BAE00 -:104D7000D4E9120100220023DBF7D6FED8B90A9B42 -:104D800008F10102013B31462846B84701300ED1F7 -:104D900059E60123524631462846B84701303FF4D0 -:104DA00052AE08F101080A9B013B4345F1DC4B463A -:104DB00004F15002DCE64FF0000804F11A0AF2E7B1 -:104DC00001234246DFE701234A4631462846B847D9 -:104DD00001303FF438AE08F10108E3680B995B1A23 -:104DE0004345F0DCFAE64FF0000804F11909F4E756 -:104DF0002DE9F047164699468A680B69DDF8208050 -:104E00009342B8BF1346336091F8432007460C46DF -:104E10000AB1013333602368990642BF3368023315 -:104E20003360256815F0060506D104F1190AE36818 -:104E300032689B1AAB4226DC94F84320131E22688A -:104E400018BF012392062BD404F143024946384689 -:104E5000C04701301ED02368E568326803F00603BE -:104E6000042B08BFAD1AA36822690CBF25EAE575BB -:104E700000259342C4BF9B1AED1800261A34B54290 -:104E80001AD1002008E00123524649463846C0475F -:104E9000013003D14FF0FF30BDE8F0870135C6E7A0 -:104EA000E1185A1C302081F84300224494F8451040 -:104EB00082F843100233C7E70123224649463846A9 -:104EC000C0470130E6D00136D9E700002DE9FF47A1 -:104ED0000F7E0C9D782F914680460C469A4601F134 -:104EE000430207D8622F0AD8002F00F0D880582F2D -:104EF00000F0A38004F1420584F842703AE0A7F183 -:104F00006303152BF6D801A151F823F0654F030870 -:104F1000794F0308F54E0308F54E0308F54E0308D4 -:104F2000F54E0308794F0308F54E0308F54E0308C4 -:104F3000F54E0308F54E030885500308A94F0308F2 -:104F400067500308F54E0308F54E0308A750030801 -:104F5000F54E0308A94F0308F54E0308F54E030864 -:104F60006F5003082B681A1D1B682A6004F1420564 -:104F700084F842300123A3E020682968060601F185 -:104F800004030AD50E682B60002E03DA2D23764227 -:104F900084F843305E480A2319E00E682B6010F055 -:104FA000400F18BF36B2EFE72B682068191D296043 -:104FB000010601D51E6802E04606FBD51E8854484E -:104FC0006F2F0CBF08230A23002184F84310656863 -:104FD000A560002DA2BF216821F0040121600EB957 -:104FE000002D4DD01546B6FBF3F103FB1167C75DED -:104FF00005F8017D3746BB420E46F4D9082B0BD18C -:105000002368DE0708D5236961689942DEBF302333 -:1050100005F8013C05F1FF35521B2261CDF800A0D7 -:105020004B4603AA21464046FFF7E2FE01304CD131 -:105030004FF0FF3004B0BDE8F087354881F8457087 -:105040002968236851F8046B29601D0614D5DF0711 -:1050500044BF43F0200323601EB9236823F02003DC -:1050600023601023B0E7236843F0200323607823F4 -:10507000284884F84530E3E7590648BFB6B2E6E76A -:105080001546BBE72B6826686169181D2860350640 -:105090001B6801D5196002E07006FBD5198000235A -:1050A00023611546BAE72B681A1D2A601D686268DD -:1050B00000212846DBF7C4F808B1401B6060636834 -:1050C0002361002384F84330A8E723692A46494630 -:1050D0004046D0470130ABD023689B0713D4E0682B -:1050E000039B9842B8BF1846A4E7012332464946BD -:1050F0004046D04701309BD00135E36803995B1AE5 -:10510000AB42F2DCEBE7002504F11906F5E700BF3E -:10511000C6F40308D7F403080FB40A4B13B51C6890 -:1051200024B1A36913B9204601F0A2F905AB049A92 -:10513000A1680193204602F0ADF802B0BDE810402E -:1051400004B07047200D0020094B13B51C680146C0 -:1051500034B1A36923B90190204601F089F901997E -:10516000A268204602B0BDE8104002F0C3B900BFFB -:10517000200D002070B50E46054618B183690BB9A5 -:1051800001F076F9AB69AC6813B9284601F070F903 -:105190002C4B9C4220D16C68636EDB0705D4A3893D -:1051A000980502D4A06D01F006FAA38919071DD550 -:1051B0002369DBB1013EA36816F8011F013BA36020 -:1051C00039BB002B38DA22460A21284600F0FCF8C9 -:1051D000013011D00A2511E01B4B9C4201D1AC6873 -:1051E000DAE71A4B9C4208BFEC68D5E7214628460F -:1051F00000F03CF90028DDD04FF0FF35636EDA0790 -:1052000005D4A3899B0502D4A06D01F0D5F92846E9 -:1052100070BD002B04DAA2699A4206DC0A2904D088 -:1052200023685A1C22601970C5E72246284600F000 -:10523000CBF80130BFD1DFE723680A255A1C226072 -:105240001D70DBE79CF60308BCF603087CF6030838 -:10525000024B01461868FFF78DBF00BF200D0020EC -:105260000EB400B59CB01DAB029006906FF00041EB -:10527000094807910491094953F8042B05910068E6 -:10528000019302A901F0DCFE029B00221A701CB0FF -:105290005DF804EB03B07047200D00200802FFFF0B -:1052A000034611F8012B03F8012B002AF9D17047AE -:1052B000012B2DE9F04701D0242B06D9FFF772FA14 -:1052C000162303600020BDE8F087DFF8E4C00D4638 -:1052D0002E4615F8014B14F80C7017F00807F7D19B -:1052E0002D2C32D12C780127B51C002B5BD0102B34 -:1052F00009D1302C07D12C7804F0DF04582C4DD183 -:105300006C781023023507F1004808F1FF384FF0A0 -:10531000000CB8FBF3F9664603FB198AA4F1300EC2 -:10532000BEF1090F16D87446A34224DDBCF1000F6C -:105330001EDBB1451CD301D1A24519DB06FB034698 -:105340004FF0010C15F8014BE8E72B2C04BF2C782B -:10535000B51CCAE7A4F1410EBEF1190F01D8373CC4 -:10536000E2E7A4F1610EBEF1190F04D8573CDBE768 -:105370004FF0FF3CE6E7BCF1000F05DA22230360A3 -:10538000464642B930469EE707B17642002AF9D038 -:10539000BCF1000F00D0691E1160F3E73024002B30 -:1053A000B1D10823AFE7302CA5D00A23ABE700BF6B -:1053B000E9F4030813460A46014602480068FFF76D -:1053C00077BF00BF200D0020F8B50E4614460546F5 -:1053D00018B183690BB901F04BF8214B9C422BD1DA -:1053E0006C68A369A360A3891A072FD523696BB3DF -:1053F00023692068C01A6369F6B28342374604DC29 -:105400002146284600F0A0FF30BBA368013BA36003 -:1054100023685A1C22601E7063690130834204D0E5 -:10542000A389DB0706D50A2E04D12146284600F0C1 -:105430008BFF88B93846F8BD0A4B9C4201D1AC6855 -:10544000CFE7094B9C4208BFEC68CAE721462846D3 -:1054500000F00CF80028CBD04FF0FF37EAE700BF90 -:105460009CF60308BCF603087CF60308324B70B5C3 -:105470001D6806460C4625B1AB6913B9284600F0F5 -:10548000F7FF2E4B9C420FD16C68A389B4F90C2016 -:1054900019072CD4DD0611D40923336042F04003F0 -:1054A000A3814FF0FF303EE0254B9C4201D1AC6818 -:1054B000EBE7244B9C4208BFEC68E6E7580712D59F -:1054C000616B41B104F14403994202D0304601F0CE -:1054D0007BFC00236363A38923F02403A3810023BF -:1054E000636023692360A38943F00803A3812369D0 -:1054F0004BB9A38903F42073B3F5007F03D0214691 -:10550000304601F07FF8A089B4F90C2010F00103B7 -:105510000AD00023A36063695B42A361236943B996 -:1055200010F08000BAD170BD810758BF6369A360D5 -:10553000F4E70020F7E700BF200D00209CF60308E9 -:10554000BCF603087CF603082DE9F74F03690C69E4 -:10555000A3420746C0F28180013C01F1140800F12A -:10556000140505EB8403019358F8243055F82420E2 -:1055700001339A424FEA840B08EB8409B2FBF3F63D -:1055800031D34FF0000E4046AC46F24650F8042BA3 -:1055900093B206FB03E34FEA134E9BB2AAEB03035D -:1055A000DCF800A0120C13FA8AF306FB02E2009367 -:1055B000009B4FEA124E92B2C2EB1A4202EB234218 -:1055C000BDF80030814543EA02434CF8043B4FEA02 -:1055D000224ADBD255F80B302BB9019B043B9D428C -:1055E0001A462ED33C61384601F0D6FA002824DB57 -:1055F000013628464FF0000C58F8042BD0F800E094 -:1056000093B2ACEB0303120C13FA8EF3C2EB1E42FF -:1056100002EB23429BB243EA0243C14540F8043BFC -:105620004FEA224CE8D255F8242005EB840322B936 -:10563000043B9D421A460AD33C61304603B0BDE8A4 -:10564000F08F1268043B002ACCD1013CC7E71268F6 -:10565000043B002AF0D1013CEBE70020EEE700001C -:105660002DE9F04F2DED048B57EC106B93B0456A8C -:10567000DDF88080069110EE10AA044609920C9382 -:10568000BB4675B9102000F0FDFF0246606220B9EC -:10569000A74BEA21A74801F0DBFFC0E901550560EF -:1056A000C560636A196851B15A684A600123934022 -:1056B0008B60204601F02EF8636A00221A603B1EC0 -:1056C000AABF002323F0004BC8F800309A4BBCBFA0 -:1056D0000122C8F8002033EA0B031BD10C9A42F2D6 -:1056E0000F731360CBF31303334300F09285219BB8 -:1056F00063B9924B22E0924B01930833219A1360D5 -:10570000019813B0BDEC048BBDE8F08F8B4B019377 -:105710000333F3E70022002350465946DBF704FA2F -:105720004BEC19AB804658B10C9A01231360219BB6 -:10573000002B00F06B8583481860431E0193DFE760 -:105740004BEC10AB10AA11A9204601F0CBFACBF319 -:105750000A5508EE100A002D00F0848019EE903AE8 -:10576000C3F3130343F07F57564647F44017A5F29F -:10577000FF35CDF83880744B002230463946DAF7D1 -:10578000B3FD65A3D3E90023DAF766FF64A3D3E989 -:105790000023DAF7ABFD064628460F46DAF7F2FE9D -:1057A00061A3D3E90023DAF757FF02460B463046E0 -:1057B0003946DAF79BFD06460F46DBF7FDF9002276 -:1057C0000090002330463946DBF7B8F950B1009815 -:1057D000DAF7D8FE32463B46DBF7A6F910B9009B54 -:1057E000013B0093009B162B5AD8009A574B03EBB2 -:1057F000C203D3E9002351EC190BDBF79FF9002812 -:1058000050D0009B013B009300230B93109B5D1B2A -:105810006B1E059345BFC5F10103049300230023CC -:105820004CBF05930493009B002B3DDB059B009A26 -:105830000A921344059300230793069B092B00F259 -:105840008980052BC4BF043B0693069BA3F102038A -:10585000CCBF00250125032B00F28780DFE803F091 -:105860002D3A3859DDE910531D4405F23243202BFF -:10587000C1BFC3F1400305F212400BFA03F326FA4D -:1058800000F0DABFC3F1200306FA03F01843DAF799 -:1058900069FE01230646A1F1F877013D0E936AE700 -:1058A0000123B2E70B90B1E7049B009A9B1A049383 -:1058B0005342079300230A93BFE700230893099BF1 -:1058C000002B55DC0123CDE902331A4609920CE086 -:1058D0000123F3E70023099A0893009B13440293E2 -:1058E0000133012B0393B8BF0123606A0022426099 -:1058F000042202F114069E4241683DD9204600F080 -:10590000C9FE019000283BD1114B02464FF4D571DE -:10591000C0E60123DFE700BF61436F63A787D23F83 -:10592000B3C8608B288AC63FFB799F501344D33F8E -:10593000F6F503080DF603080000F07FF2F5030802 -:10594000E9F50308C5F403080000F83F60F7030811 -:1059500068F6030801250023069308954FF0FF33EE -:10596000CDE9023300221223B0E701230893F5E7C3 -:10597000099BCDE90233B8E7013141605200B8E735 -:10598000636A019A1A60039B0E2B00F29D80002D22 -:1059900000F09A80009B002B32DDB74A03F00F0322 -:1059A00002EBC303D3E90089009BD8054FEA231714 -:1059B00016D5B24B51EC190BD3E90823DAF776FF71 -:1059C00007F00F0782468B460325AC4E57B9424677 -:1059D0004B4650465946DAF769FF82468B4628E027 -:1059E0000225F2E7F90708D540464946D6E90023E3 -:1059F000DAF732FE0135804689467F100836E5E742 -:105A000000F09B80009B9D4F5E429B4B06F00F0277 -:105A100003EBC203D3E9002351EC190BDAF71CFEA8 -:105A2000361182468B4600230225002E7AD1002BA8 -:105A3000D3D10B9B002B00F08280914B002250466B -:105A40005946DBF77BF8002879D0039B002B76D0F2 -:105A5000029B002B36DD009B504659465F1E0022FC -:105A6000884BDAF7F9FD029E82468B4601352846BF -:105A7000DAF788FD52465B46DAF7EEFD824B0022EC -:105A8000DAF734FCD046D9468246A1F1507B002E8D -:105A900058D17E4B002240464946DAF725FC524653 -:105AA0005B4680468946DBF767F8002840F0958220 -:105AB00052460BF1004340464946DBF73FF80028C9 -:105AC00040F089825BEC19AB119B002BC0F248813E -:105AD000009A0E2A00F34481674B03EBC203D3E91B -:105AE0000089099B002B80F2D580039B002B00F3DB -:105AF000D18040F06F82654B002240464946DAF77C -:105B0000ABFD52465B46DBF72DF8039E3746002877 -:105B100040F04582019D312305F8013B009B013394 -:105B2000009340E2F20705D5D7E90023DAF794FDA8 -:105B3000013501237610083777E7022579E7009FC2 -:105B4000039E94E701994C4B31440D91089903EB66 -:105B5000C60353E90223002943D04D490020DAF758 -:105B6000A5FE52465B46DAF7BFFB019D82468B4697 -:105B700049464046DBF720F80646DAF703FD0246C1 -:105B80000B4640464946DAF7AFFB303605F8016B65 -:105B900052465B4680468946DAF7D0FF002863D13B -:105BA00042464B4636490020DAF79EFB52465B469A -:105BB000DAF7C4FF002840F0B5800D9B9D4281D0EC -:105BC000304B002250465946DAF746FD2D4B8246AF -:105BD0008B46404649460022DAF73EFD804689461C -:105BE000C6E750465946DAF737FD0D9B019D0F93E6 -:105BF00082468B4649464046DAF7DEFF0646DAF72C -:105C0000C1FC303602460B4640464946DAF76CFB8B -:105C100005F8016B0D9B9D42804689464FF00002BE -:105C200024D11B4B50465946DAF760FB02460B461F -:105C300040464946DAF7A0FF002873D152465B463A -:105C400013490020DAF750FB02460B46404649460E -:105C5000DAF774FF00283FF435AF0F9D6B1E0F93EA -:105C600015F8013C302BF8D0009749E0054BDAF7E6 -:105C7000F3FC80468946BDE760F7030838F7030860 -:105C80000000F03F0000244000001C4000001440D1 -:105C90000000E03F019D56465F4642464B46304677 -:105CA0003946DAF703FEDAF787FF8246DAF76AFC4D -:105CB00042464B46DAF7D0FC02460B4630463946A0 -:105CC0000AF13006DAF710FB05F8016B019E039F1D -:105CD000AE1BB74202460B4635D1DAF707FB424608 -:105CE0004B4606460F46DAF747FFD0B942464B46C9 -:105CF00030463946DAF718FF10B11AF0010F10D10B -:105D0000204618EE101A00F005FD002300982B70B5 -:105D10000C9B01301860219B002B3FF4F1AC1D60FF -:105D2000EEE4009F2B461D4613F8012D392A06D1BB -:105D3000019A9A42F7D10199302201370A701A78F4 -:105D400001321A7090E7A64B0022DAF785FC002298 -:105D5000002306460F46DAF7E7FE00289DD0CFE77E -:105D6000089A002A00F0D780069A012A00F3BA8028 -:105D70000E9A002A00F0B28003F23343079E049D7E -:105D8000049A1A440492059A01211A442046059265 -:105D900000F078FD0746002D0CDD059B002B09DD8A -:105DA000AB42049AA8BF2B46D21A0492059AED1A68 -:105DB000D31A0593079B1BB3089B002B00F0AF8001 -:105DC000002E13DD39463246204600F01BFE18EE49 -:105DD000102A01460746204600F06AFD18EE101A08 -:105DE0008046204600F096FC08EE108A079B9A1B1E -:105DF00006D018EE101A204600F004FE08EE100A35 -:105E00000121204600F03EFD0A9B002B064640F390 -:105E100088801A460146204600F0F4FD069B012BBF -:105E2000064640F381804FF00008336906EB830398 -:105E3000186900F0D7FCC0F12000059B184410F051 -:105E40001F0000F09280C0F12003042B40F38A80F1 -:105E5000C0F11C00049B03440493059B03440544C8 -:105E60000593049B002B07DD18EE101A1A462046F6 -:105E700000F022FE08EE100A059B002B05DD3146DE -:105E80001A46204600F018FE06460B9B002B6ED0EB -:105E900018EE100A314600F07FFE002867DA009BFA -:105EA000013B18EE101A00930A220023204600F04E -:105EB00053FC089B08EE100A002B00F0B181002370 -:105EC00039460A22204600F047FC029B002B074679 -:105ED00000F38E80069B022B51DC89E0109BC3F1FE -:105EE00036034BE7039B5E1E079BB342BFBF079B76 -:105EF0000796F21A0A9BB6BF9B189E1B0A93039B38 -:105F0000B8BF0026002BB7BFDDE90323DDE9033569 -:105F10009D1A002334E7079E049D089F3BE7079ADC -:105F200067E7069B012B18DCBAF1000F15D1CBF304 -:105F3000130393B92BF000431B0D1B0583B1049B86 -:105F400001330493059B013305934FF001080A9B2D -:105F5000002B7FF46AAF01206FE74FF00008F6E7EF -:105F60009846F4E73FF47DAF18461C3072E7039B78 -:105F7000002B37DC069B022B34DD039B0293029B34 -:105F80006BB931460522204600F0E6FB0146064685 -:105F900018EE100A00F000FE00283FF7BBAD099B89 -:105FA000019DDB4300934FF000083146204600F08E -:105FB000B1FB002F3FF4A4AEB8F1000F05D0B845F7 -:105FC00003D04146204600F0A5FB3946204600F0AC -:105FD000A1FB95E600263746E1E70097374699E5AD -:105FE00000002440089B002B00F0CA80039B029312 -:105FF000002D05DD39462A46204600F05DFD0746A6 -:10600000B8F1000F5BD07968204600F043FB0546ED -:1060100028B9874B024640F2EA21FFF73BBB3A69B9 -:106020000232920007F10C010C30FEF7F5FB012261 -:106030002946204600F040FD019B03F10109DDE9FE -:106040000123134405930AF00103B846049307465D -:10605000314618EE100AFFF777FA4146029000F138 -:10606000300A18EE100A00F097FD3A4603903146C8 -:10607000204600F0ADFDC26809F1FF3B054602BBBA -:10608000014618EE100A00F087FD02462946204618 -:10609000079200F03FFBDDE9063243EA0201049B70 -:1060A0000B434D460FD1BAF1390F2AD0039B002B79 -:1060B00002DD029B03F1310A8BF800A075E7384638 -:1060C000BAE70122E2E7039B002B04DB06990B43AE -:1060D00004990B4322D1002AEEDD18EE101A01229A -:1060E000204600F0E9FC314608EE100A00F054FDAD -:1060F000002803DCE0D11AF0010FDDD0BAF1390F2E -:10610000D7D139238BF800302B461D46013B15F8BB -:10611000012C392A71D001321A7046E7002A07DDB6 -:10612000BAF1390FEDD00AF101038BF800303CE7EA -:10613000059B09F801AC994547D018EE101A0023C9 -:106140000A22204600F008FBB84508EE100A4FF07E -:1061500000034FF00A024146204606D100F0FCFA47 -:106160008046074609F1010972E700F0F5FA394661 -:10617000804600230A22204600F0EEFA0746F1E7A7 -:10618000039B0293019D18EE100A3146FFF7DCF9DC -:1061900000F1300A019B05F801ABEA1A029B934219 -:1061A00009DD18EE101A00230A22204600F0D4FA66 -:1061B00008EE100AE7E7029B002BC8BF1D46019BB3 -:1061C000D8BF01251D444FF0000818EE101A012217 -:1061D000204600F071FC314608EE100A00F0DCFCAD -:1061E000002891DC02D11AF0010F8DD12B461D46FB -:1061F00013F8012D302AFAD0D7E6019A9A4284D1B9 -:10620000009B0133009331231370CEE6094BFFF757 -:1062100095BA219B002B7FF46EAA074BFFF78EBA2D -:10622000029B002BAEDC069B022B3FF7A8AEA9E732 -:1062300068F60308C4F40308E9F503088A892DE920 -:10624000F041054610070C4658D44B68002B05DC7E -:106250000B6C002B02DC0020BDE8F081E66A002E0A -:10626000F9D0002312F480522F682B6032D0606D79 -:10627000A3895A0705D56368C01A636B0BB1236CF9 -:10628000C01A00230246E66A216A2846B047431C2A -:10629000A38906D129681D292CD82A4ACA40D607C5 -:1062A00028D500226260D9042269226004D5421CEC -:1062B00001D12B6803B96065616B2F600029CAD0DA -:1062C00004F14403994202D0284600F07DFD0020ED -:1062D0006063C1E7216A01232846B047411CC7D14A -:1062E0002B68002BC4D01D2B01D0162B01D12F60A1 -:1062F000B1E7A38943F04003A381ADE70F69002F05 -:10630000A9D093070E6808BF4B690F6018BF002320 -:10631000A6EB07088B60B8F1000F9CDD216AA66A26 -:1063200043463A462846B047002806DCA38943F096 -:106330004003A3814FF0FF308EE70744A8EB00082D -:10634000E9E700BF0100402038B50B6905460C465F -:1063500013B90025284638BD18B183690BB900F080 -:1063600087F8144B9C421BD16C68B4F90C30002B9D -:10637000EFD0626ED00704D4990502D4A06D00F06E -:106380001AF928462146FFF759FF636EDA070546DA -:10639000E0D4A3899B05DDD4A06D00F00DF9D9E709 -:1063A000054B9C4201D1AC68DFE7044B9C4208BF1F -:1063B000EC68DAE79CF60308BCF603087CF60308F1 -:1063C000002310B50446C0E90033C0E904338360FC -:1063D00081814366C2818361194608225C30FEF7E1 -:1063E00029FA054B6362054BA362054BE362054B3B -:1063F0002462236310BD00BFA5750308C775030899 -:10640000FF75030823760308014900F0AFB800BF09 -:106410004963030870B568224D1E55430E4605F1C9 -:10642000740100F03DFD044640B10021C0E90016B2 -:106430000C30A06005F16802FEF7FCF9204670BD43 -:10644000014800F0B8B800BF95560020014800F0A0 -:10645000B3B800BF95560020014800F0ACB800BFAB -:1064600096560020014800F0A7B800BF96560020BD -:1064700010B50446FFF7F0FFA3691BB1BDE810405B -:10648000FFF7F0BFC4E912332365134B134A1B68AF -:10649000A262A34204BF0123A361204600F020F8BA -:1064A0006060204600F01CF8A060204600F018F85C -:1064B0000022E06004216068FFF782FFA0680122EB -:1064C0000921FFF77DFFE06802221221FFF778FF24 -:1064D0000123A361D2E700BFB0F4030809640308F5 -:1064E000F8B50746FFF7ACFF1E4B1E68B36913B93A -:1064F0003046FFF7BDFF4836D6E90134013B03D5EE -:1065000033680BB33668F7E7B4F90C50D5B9164BBE -:10651000E36004F15800656600F04CF8FFF796FF61 -:10652000C4E90155C4E904552560A561082229463E -:1065300004F15C00FEF77EF9C4E90D55C4E912557B -:106540002046F8BD6834D9E704213846FFF762FFDA -:10655000044630600028D5D1FFF778FF0C233B605C -:10656000EEE700BFB0F403080100FFFF2DE9F84398 -:106570000646884600F148040027D4E90195B9F1A0 -:10658000010905D52468002CF7D13846BDE8F88309 -:10659000AB89012B07D9B5F90E30013303D0294659 -:1065A0003046C04707436835E9E7000000487047B8 -:1065B000740E002070477047704770B50E46B1F9F1 -:1065C0000E10002996B014461D4608DAB6F90C30B4 -:1065D00000222A601A0610D44FF480630EE06A4647 -:1065E00001F076F80028F1DB019A02F47042A2F57E -:1065F00000535A425A412A60EEE7402300202360AC -:1066000016B070BD8B8973B59D0706460C4607D53D -:1066100004F14703236023610123636102B070BD6D -:1066200001AB6A46FFF7C9FF00990546304600F006 -:1066300037FC48B9B4F90C309A05EFD423F00303C2 -:1066400043F00203A381E3E70D4BB362A38920600B -:1066500043F08003A381009B6361019B20615BB1D8 -:10666000B4F90E10304601F045F828B1A38923F0A3 -:10667000030343F00103A381A0890543A581CDE76E -:1066800009640308024B0146186800F009BC00BF0A -:10669000200D002070B5466A04460D4676B91020DC -:1066A000FFF7F0FF0246606220B9184B18486621D8 -:1066B00000F0CEFFC0E901660660C660666AF36856 -:1066C00083B1636ADB6853F82500B8B9012101FA88 -:1066D00005F6721D9200204600F060FB60B1C0E933 -:1066E00001560EE021220421204600F057FB636A88 -:1066F000F060DB68002BE4D1002070BD026843F835 -:1067000025200023C0E90333F7E700BFF6F50308AF -:10671000DCF6030870B5466A05460C4676B91020CB -:10672000FFF7B0FF0246686220B9094B09488A2189 -:1067300000F08EFFC0E901660660C6603CB16B6A7E -:106740006268DB6853F82210216043F8224070BD74 -:10675000F6F50308DCF603082DE9F0410D6907465C -:106760000C461E4601F1140C0020DCF8003099B2F2 -:1067700002FB01611E0C0B0C02FB063389B20130D7 -:1067800001EB034185424CF8041B4FEA1346ECDC55 -:106790000EB3A368AB4219DC616838460131FFF7DC -:1067A00079FF804628B902460C4B0D48B52100F010 -:1067B0004FFF2269023204F10C0192000C30FEF707 -:1067C0002BF821463846FFF7A5FF444604EB850326 -:1067D00001355E6125612046BDE8F08168F6030859 -:1067E000DCF60308030C1B04D3B90004102310F0DB -:1067F0007F4F04BF0002083310F0704F04BF000148 -:10680000043310F0404F04BF80000233002805DB42 -:1068100010F0804F03F1010308BF20231846704792 -:106820000023E4E7036813F0070201460BD0DA0700 -:1068300023D4980749BF5B089B0801200B605CBF0D -:106840000B600220704798B2A8B91B0C1020DAB276 -:106850000AB908301B0A1A0704BF1B0904309A073B -:1068600004BF9B080230DA0703D45B0800F1010083 -:1068700005D00B6070471046E9E7002070472020E4 -:106880007047000010B50C460121FFF703FF0246D8 -:1068900028B9054B05484FF4A07100F0D9FE01233B -:1068A0004461036110BD00BF68F60308DCF603080D -:1068B0002DE9F04F91460A69D9F810309A42B8BFD5 -:1068C0000B460C46BCBF4C4699462769D9F810A028 -:1068D000A368616807EB0A06B34285B0B8BF01310F -:1068E000FFF7D8FE30B90246444B454840F25D11EF -:1068F00000F0AEFE00F1140505EB86082B460022E1 -:10690000434521D304F1140303EB870709F1140372 -:1069100003EB8A0202923A1B153A22F00302043278 -:1069200004F115018F4238BF04220192029A0393A9 -:106930009A420CD8002E03DD58F8043D002B5AD0A3 -:10694000066105B0BDE8F08F43F8042BD8E7B3F833 -:1069500000A0BAF1000F24D004F1140EA9464FF0A4 -:10696000000C5EF8042BD9F800101FFA82FB89B2E4 -:106970000AFB0B114FEA124BD9F8002061444FEA91 -:10698000124C0AFB0BC202EB114289B241EA0241EE -:10699000774549F8041B4FEA124CE2D8019A45F8B2 -:1069A00002C0039AB2F802900433B9F1000F20D06C -:1069B000296804F1140CAE464FF0000ABCF800B090 -:1069C000BEF8022009FB0B22924489B241EA0A4137 -:1069D0004EF8041B5CF8042BBEF80010120C09FBE7 -:1069E000021101EB1A4167454FEA114AE6D8019AB4 -:1069F000A95004359AE7013E9CE700BF68F60308FA -:106A0000DCF603082DE9F843154612F003020646AA -:106A10000F4607D0254C013A002354F82220FFF7F7 -:106A20009BFE0746AD103DD0746A7CB91020FFF77D -:106A300029FE0246706228B91D4B1E484FF4D771DB -:106A400000F006FEC0E901440460C460D6F824806A -:106A5000D8F808404CB940F271213046FFF712FFD8 -:106A60000023C8F80800044603604FF00009EB0754 -:106A70000AD5394622463046FFF71AFF3946804686 -:106A80003046FFF747FE47466D100BD0206838B9F7 -:106A9000224621463046FFF70BFF2060C0F80090E9 -:106AA0000446E4E73846BDE8F88300BF28F8030849 -:106AB000F6F50308DCF603082DE9F0470C464968B3 -:106AC000236903EB6218A368074691464FEA621AEE -:106AD00008F10106B3420BDB3846FFF7DBFD054644 -:106AE00048B902462A4B2B4840F2D91100F0B0FDBC -:106AF00001315B00EEE7002300F1140100F1100208 -:106B00001846534537DB20692AEAEA7A04F1140370 -:106B100019F01F0901EB8A0103EB80002FD0C9F1A6 -:106B2000200E8A464FF0000C1A6802FA09F242EA77 -:106B30000C024AF8042B53F8042B984222FA0EFC5C -:106B4000F2D8031B153B23F00303043304F11502B1 -:106B5000904238BF042341F803C0BCF1000F01D0BC -:106B600008F10206013E38462E612146FFF7D2FDAC -:106B70002846BDE8F08742F8040F0133C1E7043925 -:106B800053F8042B41F8042F9842F9D8EAE700BFE4 -:106B900068F60308DCF6030830B502690C69121BBD -:106BA0000ED100F11403143103EB840001EB8401D6 -:106BB00050F8045D51F8044DA54203D005D30122DD -:106BC000104630BD8342F3D3FAE74FF0FF32F7E7C8 -:106BD0002DE9F84F0C460646114620469046FFF731 -:106BE000DBFF051E10D129463046FFF753FD30B9B3 -:106BF0003A4B024640F23221394800F029FD012388 -:106C0000C0E90435BDE8F88FA4BF4346A04630462E -:106C1000D8F80410A6BF1C4600250125FFF73AFD51 -:106C200020B92E4B02464FF41071E5E7D8F81070EA -:106C30002669C56004F1140908F1140500F1140E69 -:106C400005EB870C09EB860608F11002F2460021DD -:106C500059F8043B52F804BF1FFA83F811FA8BF17C -:106C60001B0CA1EB0808C3EB1B4303EB28431FFAE3 -:106C700088F819144E4548EA03434AF8043BE7D81C -:106C8000331B153B23F0030304331534A64238BFEE -:106C900004231D4473449E462E4666450ED30CF1D4 -:106CA0000302521B22F00302033DAC4538BF002211 -:106CB0001A4452F8043D7BB10761A3E756F8048BF0 -:106CC00011FA88F2141404EB184492B242EA044216 -:106CD0004EF8042B2114E0E7013FEAE768F60308C9 -:106CE000DCF603082DE9F7438946012157EC106BC8 -:106CF0009046FFF7CFFC044630B90246254B2648A4 -:106D000040F20A3100F0A4FCC7F30A55C7F313039D -:106D100035BB002E019328D068460096FFF782FD10 -:106D2000009900B3019AC0F1200302FA03F30B4368 -:106D3000C24063610192019BA361002B14BF022238 -:106D400001222261D5B1A5F233450544C9F80050AE -:106D5000C0F13500C8F80000204603B0BDE8F0835C -:106D600043F48013D5E76161E5E701A8FFF75AFD19 -:106D7000019B6361012222612030E3E704EB82037F -:106D8000A0F23240C9F800001869FFF72BFDC0EBF4 -:106D90004210DFE768F60308DCF6030837B5A1FB0D -:106DA00002244CB91146019200F07AF8019A054686 -:106DB00030B9284603B030BD0C2202600025F8E748 -:106DC0002146FDF737FDF4E737B5002944D051F8E7 -:106DD000043C0190002BA1F10404B8BFE41800F0BA -:106DE000D7FC1E4A0198136833B96360146003B07E -:106DF000BDE8304000F0D2BCA34208D92568611933 -:106E00008B4201BF19685B6849192160EDE71A469A -:106E10005B680BB1A342FAD911685518A5420BD192 -:106E2000246821445418A3421160E0D11C685B68B7 -:106E3000536021441160DAE702D90C230360D6E7DE -:106E4000256861198B4204BF19685B68636004BFE1 -:106E5000491921605460CAE703B030BD985600203C -:106E600070B50E4E0C463168054611B900F08AFB2C -:106E700030602146284600F085FB431C0AD0C41C24 -:106E800024F00304A04207D0211A284600F07AFB20 -:106E9000013001D14FF0FF34204670BD9C560020D8 -:106EA0002DE9F041CD1C25F0030508350C2D38BF28 -:106EB0000C25002D074601DBA94205D90C233B60B8 -:106EC00000263046BDE8F0812E4E00F061FC3368AC -:106ED0001C4634BB29463846FFF7C2FF431C044614 -:106EE0004DD134682646002E40D1236831463846BD -:106EF00004EB030800F046FB80453AD121680335D6 -:106F00006D1A25F0030508350C2D38BF0C252946D0 -:106F10003846FFF7A5FF01302BD023682B442360B0 -:106F20000EE02268521B1ED40B2A16D96119A34207 -:106F3000256018BF5960636808BF316062514B60BB -:106F4000384604F10B0600F029FC26F00706231D45 -:106F5000F21AB6D09B1BA350B3E76268A3420CBFE2 -:106F600032605A60ECE723466468B2E734467668DC -:106F7000B9E70C233B60384600F010FCA1E7256020 -:106F8000DEE700BF985600202DE9F0478E689E424C -:106F900082460C4690461F4638D88A8912F4906F74 -:106FA00032D025680969A5EB0109656905EB45053E -:106FB00005EBD57501334B446D109D4238BF1D461E -:106FC000530531D52946FFF76BFF064650B90C2310 -:106FD000CAF80030A38943F04003A3814FF0FF308B -:106FE000BDE8F08721694A46FDF716FCA38923F422 -:106FF000906343F08003A381266165614E44A5EB55 -:1070000009052660A5603E46BE4200D93E4620687E -:107010003246414600F0A2FBA3689B1BA360236895 -:10702000334423600020DBE72A4600F0BDFB064620 -:107030000028E1D121695046FFF7C6FEC7E70000EE -:107040002DE9F04F98468B891B069DB007460D46EB -:1070500014460ED50B6963B94021FFF721FF286064 -:10706000286120B90C233B604FF0FF30D1E0402372 -:107070006B610023099320238DF82930CDF80C8013 -:107080003023DFF8A8818DF82A304FF0010923461C -:107090009A4613F8012B0AB1252AF9D1BAEB040B51 -:1070A0000BD05B46224629463846FFF76DFF01307C -:1070B00000F0AA80099A5A4409929AF80030002BED -:1070C00000F0A28000234FF0FF32CDE905230AF142 -:1070D000010A049307938DF853301A9354460522FE -:1070E00014F8011B5148D9F7ABF8049AD8B9D00667 -:1070F00044BF20238DF85330110744BF2B238DF854 -:1071000053309AF800302A2B15D0079A54460020A5 -:107110004FF00A0C214611F8013B303B092B4ED9A8 -:10712000B0B1079214E0A0EB080309FA03F313438C -:107130000493A246D2E7039B191D1B680391002B01 -:10714000BBBF5B4242F0020207930793B8BF0492B1 -:1071500023782E2B0CD163782A2B35D1039B1A1D53 -:107160001B680392002BB8BF4FF0FF330234059326 -:10717000DFF8C8A0217803225046D9F761F840B162 -:107180004023A0EB0A0003FA00F0049B0343013400 -:10719000049314F8011B26488DF828100622D9F70D -:1071A0004FF8002838D0234B1BBB039B073323F039 -:1071B000070308330393099B3344099367E70CFBE8 -:1071C00002320C460120A5E700230134059319463D -:1071D0004FF00A0C204610F8012B303A092A03D947 -:1071E000002BC5D00591C3E70CFB01210446012308 -:1071F000F0E703AB00932A460F4B04A93846FDF78E -:10720000C1FB421C0646D6D1AB895B063FF52CAFCD -:1072100009981DB0BDE8F08F03AB00932A46064BDA -:1072200004A93846FDF752FEEBE700BF34F8030827 -:107230003EF8030885490308896F03083AF80308F4 -:107240009368013B002B10B4936008DA9469A34261 -:1072500001DB0A2903D15DF8044BFEF7B5B81368CA -:10726000581C1060197008465DF8044B7047F8B55B -:1072700006460F461446D518AC4201D1002007E05F -:1072800014F8011B3A463046FFF7DAFF431CF3D1EE -:10729000F8BD00002DE9F04F0D469DB0144698460C -:1072A000064618B183690BB9FFF7E2F8894B9D4296 -:1072B0001BD175686B6ED90705D4AB899A0502D4CA -:1072C000A86DFFF778F9AB891B0701D52B69EBB9DE -:1072D00029463046FEF7CAF8C0B16B6EDC070ED502 -:1072E0004FF0FF301DB0BDE8F08F7B4B9D4201D1C8 -:1072F000B568DFE7794B9D4208BFF568DAE7AB89EF -:107300009805EDD4A86DFFF757F9E9E70023099335 -:1073100020238DF82930CDF80C803023DFF8C08190 -:107320008DF82A304FF0010923469A4613F8012BB5 -:107330000AB1252AF9D1BAEB040B0BD05B462246E1 -:1073400029463046FFF793FF013000F0AA80099AE2 -:107350005A4409929AF80030002B00F0A2800023D2 -:107360004FF0FF32CDE905230AF1010A0493079398 -:107370008DF853301A935446052214F8011B5848CF -:10738000D8F75EFF049AD8B9D10644BF20238DF800 -:107390005330130744BF2B238DF853309AF8003035 -:1073A0002A2B15D0079A544600204FF00A0C21468C -:1073B00011F8013B303B092B4ED9B0B1079214E0D4 -:1073C000A0EB080309FA03F313430493A246D2E7A0 -:1073D000039B191D1B680391002BBBBF5B4242F04E -:1073E000020207930793B8BF049223782E2B0CD187 -:1073F00063782A2B35D1039B1A1D1B680392002B3F -:10740000B8BF4FF0FF3302340593DFF8E4A02178D2 -:1074100003225046D8F714FF40B14023A0EB0A00E6 -:1074200003FA00F0049B03430134049314F8011B96 -:107430002C488DF828100622D8F702FF00283FD0EC -:10744000294B1BBB039B073323F00703083303932C -:10745000099B3B44099367E70CFB02320C46012071 -:10746000A5E700230134059319464FF00A0C204686 -:1074700010F8012B303A092A03D9002BC5D0059109 -:10748000C3E70CFB012104460123F0E703AB0093A3 -:107490002A46164B04A93046FDF774FA0746781CB5 -:1074A000D6D16B6ED90705D4AB899A0502D4A86DE5 -:1074B000FFF782F8AB895B063FF512AF099811E739 -:1074C00003AB00932A46094B04A93046FDF7FEFCA6 -:1074D000E4E700BF9CF60308BCF603087CF603084B -:1074E00034F803083EF80308854903086F7203085F -:1074F0003AF8030870B50D461446064618B183697C -:107500000BB9FEF7B5FF1C4B9C4224D17468636E27 -:10751000D80705D4A389990502D4A06DFFF74BF8CD -:10752000A368013B002BA36005DAA26993421CDB30 -:10753000EBB20A2B19D023685A1C22601D70EDB2E1 -:10754000636EDA0705D4A3899B0502D4A06DFFF70B -:1075500033F8284670BD094B9C4201D1B468D6E788 -:10756000074B9C4208BFF468D1E7294622463046C3 -:10757000FDF72AFF0546E3E79CF60308BCF603087F -:107580007CF6030838B5064D0023044608462B60F8 -:10759000DAF766FE431C02D12B6803B1236038BDC5 -:1075A000A056002010B50C46B1F90E1000F02CF9D1 -:1075B0000028ABBF636DA3891B1823F48053ACBFB5 -:1075C0006365A38110BD2DE9F0411F468B89DB0562 -:1075D00005460C46164605D5B1F90E1002230022C9 -:1075E00000F098F8A389B4F90E1023F48053A38116 -:1075F00032463B462846BDE8F04100F017B810B5CA -:107600000C46B1F90E1000F085F8431CA38915BF94 -:10761000606523F4805343F48053A38118BFA38192 -:1076200010BDB1F90E1000F031B8000038B5074DAB -:1076300004460846114600222A601A46DEF711FE6B -:10764000431C02D12B6803B1236038BDA056002033 -:107650001FB514461A46094B1B680546D8684CB13D -:10766000074B0091CDE9013406492B4600F01EF886 -:1076700000F0E9F8044B1C46F3E700BF200D0020A2 -:1076800045F8030852F8030880F8030838B5064D9A -:107690000023044608462B60DAF7AEFD431C02D1F6 -:1076A0002B6803B1236038BDA05600200EB403B58B -:1076B000014603AB054853F8042B00680193FFF71C -:1076C000E9FD02B05DF804EB03B07047200D002027 -:1076D00038B5074D00230446084611462B60DAF7FB -:1076E00097FD431C02D12B6803B1236038BD00BF56 -:1076F000A056002038B5064D0023044608462B60EE -:10770000DAF796FD431C02D12B6803B1236038BD24 -:10771000A056002038B5074D044608461146002201 -:107720002A601A46DAF78FFD431C02D12B6803B199 -:10773000236038BDA056002082B001B901A942B132 -:107740004BB113780B601278101E18BF012002B0E5 -:1077500070471046FBE76FF00100F8E7884210B56C -:1077600001EB020402D98442234607D8431EA142FA -:1077700008D011F8012B03F8012FF8E70244014665 -:107780008A4200D110BD13F8014D02F8014DF7E710 -:107790000148FEF710BF00BF945600200148FEF7D5 -:1077A0000BBF00BF945600202DE9F04180461446DF -:1077B0000E4621B9BDE8F0411146FFF771BB2AB969 -:1077C000FFF702FB25462846BDE8F08100F042F8AD -:1077D0008442074602D8B4EB500F12D821464046E7 -:1077E000FFF75EFB05460028EDD0BC42224631463D -:1077F00028BF3A46FDF710F831464046FFF7E4FA55 -:10780000E1E73546DFE7000038B5074D0446084696 -:10781000114600222A601A46DEF713FD431C02D1EE -:107820002B6803B1236038BDA056002049B1FF2A60 -:1078300085BF8A2303600A704FF0FF3098BF012094 -:1078400070470846704708B5062000F033F801205D -:10785000DAF7C8FC51F8043C181F002BBCBF0B58CA -:10786000C01870471F2938B504460D4604D91623A1 -:1078700003604FF0FF3038BD426C12B152F8213036 -:107880004BB9204600F030F82A4601462046BDE8B4 -:10789000384000F017B8012B0AD0591C03D1162329 -:1078A00003600120E7E7002442F825402846984776 -:1078B0000020E0E7024B01461868FFF7D3BF00BF86 -:1078C000200D002038B5074D002304460846114618 -:1078D0002B60DAF777FC431C02D12B6803B12360DD -:1078E00038BD00BFA0560020DAF764BC38B52DEDD6 -:1078F000028B55EC104B00F025F822462B46204613 -:107900002946B0EE408AF0EE608AD9F73FF990B987 -:107910000022002320462946D9F710F958B1FCF778 -:1079200041FF212303600022002310461946D8F7A7 -:10793000BDFF41EC180BB0EE480AF0EE680ABDEC52 -:10794000028B38BD2DE9F04155EC104B554EAE433E -:1079500010EE100A10EE103A2A46294610D110EE09 -:10796000102A2B46D8F778FE02460B4620462946B9 -:10797000D8F7BCFC04460D4645EC104BBDE8F08141 -:10798000002D10DC25F000463043F5D05DB110EE3F -:10799000102A2B4610EE100AD8F7A6FC02460B461A -:1079A000D8F784FFE6E7121574D0D407C1F31301AA -:1079B000A2F2FF3741F480115EBFDA0F5B0002EBE9 -:1079C00041010024DA0F02EB41017F105B00162514 -:1079D00020464FF4001286188E42DEBF891BB01875 -:1079E000A4184900013D01EBD3714FEA52024FEA5E -:1079F0004303F0D12A464FF0200E4FF0004681425B -:107A000006EB050C02DC13D19C4511D8BCF1000F2C -:107A10000CEB060543DA002D41DB00F10108091AE1 -:107A20009C4588BF01F1FF31A3EB0C033244404673 -:107A30004FEAD37CBEF1010E0CEB41014FEA430348 -:107A40004FEA5606DBD10B4306D0501C13BF013260 -:107A50000134724622F0010263105208E10703F17B -:107A60007F5303F5001348BF42F0004203EB075574 -:107A7000144681E7D90A15385B050029FAD0CD02F2 -:107A80000AD5C2F1200423FA04F4551E9340214381 -:107A9000421B8AE71046F0E749000132EFE78046D3 -:107AA000BDE700BF0000F07FF8B500BFF8BC08BC20 -:107AB0009E467047F8B500BFF8BC08BC9E467047AC -:107AC00061646420627574746F6E206D6F726520DE -:107AD0007468616E20656E61626C650D0000000067 -:107AE000627574746F6E25642073746174652065AB -:107AF00072726F720D0A000044656661756C7443A2 -:107B0000616E46696C746572206174206669666F87 -:107B100025642C2068616C7374613D25640D0A0036 -:107B200048414C5F43414E5F4163746976617465BF -:107B30004E6F74696669636174696F6E2826484385 -:107B4000414E2C2043414E5F49545F52585F464995 -:107B5000464F305F4D53475F50454E44494E47298D -:107B6000206661696C65640D0000000048414C5F4F -:107B700043414E5F41637469766174654E6F746909 -:107B80006669636174696F6E28264843414E2C20F4 -:107B900043414E5F49545F52585F4649464F305FFC -:107BA00046554C4C29206661696C65640D000000E7 -:107BB00048414C5F43414E5F44656163746976613F -:107BC00074654E6F74696669636174696F6E2826A7 -:107BD0004843414E2C2043414E5F49545F54585F07 -:107BE0004D41494C424F585F454D505459292066EC -:107BF00061696C65640D000048414C5F43414E5F14 -:107C00005374617274206661696C65640D000000D4 -:107C10005472616E7343616E44617461546F427556 -:107C2000733A6F74686572207374612C2068616C9C -:107C30007374613D25640D0A0000000063616E20CD -:107C40007265636569766520627566662069732072 -:107C500066756C6C0D0000005265737643616E446E -:107C600061746146726F6D4275733A6F74686572C4 -:107C7000207374612C2068616C7374613D25640D00 -:107C80000A00000053656E644143414E44617461D3 -:107C90005061636B65743A70617261206572726FD6 -:107CA000720D00006E6F206D61696C20626F78202C -:107CB000696E206170702C207374617274206C6125 -:107CC0007465720D0000000063616E2073656E6460 -:107CD00020627566662069732066756C6C0D000005 -:107CE0006E6F206D61696C20626F7820696E20690B -:107CF0006E740D0063616E207278206669666F3065 -:107D00002066756C6C0D000063616E206572726F89 -:107D1000720D00001B5B313B34303B33326D000091 -:107D20007265737461727420746865206D63752E5A -:107D30002E2E0D004164645368656C6C436D6420A5 -:107D40006661696C65642C20675F636D644E756D58 -:107D50003D25640D0A000000536F667477617265FB -:107D60002056657273696F6E203D2025730D0A00E1 -:107D700025730D0A000000000D0A25730D0A00008E -:107D80000925730D0A00000073686F7720616C6C21 -:107D900020686973746F727920636D643A0D000016 -:107DA0000925642E25730D0A0000000073686F77A3 -:107DB000207468652068656C7020696E666F0000CD -:107DC00048454C500000000073686F772074686568 -:107DD0002076657273696F6E20696E666F000000B1 -:107DE00056455253494F4E007265626F6F7420744E -:107DF0006865206D637500005245424F4F54000086 -:107E000041646454726967676572546F4C69737436 -:107E1000206661696C65642C20675F7472696767AE -:107E20006572496E697465643D25642C20675F74D2 -:107E30007269676765724C6973744E756D203D2079 -:107E400025642C206761703D25640D0A0000000048 -:107E5000312E206572726F72207374617475732095 -:107E6000696E20476574414E6F726D616C5061633D -:107E70006B65740D00000000322E20637263206574 -:107E800072726F7220696E20476574414E6F726D19 -:107E9000616C5061636B65740D0000006461746116 -:107EA0002065786C656E206572726F722C206C652F -:107EB0006E3D25640D0A0000332E206578637263E1 -:107EC000206572726F7220696E20476574414E6F33 -:107ED000726D616C5061636B65740D0062656769FA -:107EE0006E696478203C20300D000000626567698F -:107EF00064783D2564203E20675F67747043747228 -:107F00006C2E6C656E3D25642C2073657420675F54 -:107F10006774704374726C2E6C656E203D20300D5A -:107F20000A00000070617261206572722C206E6F11 -:107F300074206120636F7272656374656420706180 -:107F4000636B65740D0000006572726F722061745E -:107F50002063616C6C2053656E64436F6D6D44618A -:107F600074612C2072736C743D25640D0A0000004E -:107F700061667465722073657420636F6E666967ED -:107F80002C2070687920636F6E6669672069733A88 -:107F90000D000000636F6E66696720627920736F61 -:107FA0006674776172653A0D00000000636F6E665B -:107FB00069672062792068617264776172653A0D41 -:107FC00000000000636F6E66696720627920256497 -:107FD0003A0D0A006D6F6465206973205048595F3F -:107FE0004D4F44455F4155544F4E45474F3A0D0064 -:107FF0006D6F6465206973205048595F4D4F44454B -:108000005F4D414E55414C3A0D0000006D6F646567 -:108010002069732025643A0D0A00000073706565BD -:1080200064206973205048595F53504545445F317F -:1080300030303A0D0000000073706565642069738C -:10804000205048595F53504545445F31303A0D0048 -:1080500073706565642069732025643A0D0A000019 -:108060006475706C6578206973205048595F445579 -:10807000504C45585F46554C4C3A0D006475706C39 -:108080006578206973205048595F4455504C4558D5 -:108090005F48414C463A0D006475706C6578206904 -:1080A000732025643A0D0A0057495A434849502025 -:1080B000496E697469616C697A6564206661696C8E -:1080C0002E0D0000706F7765726D6F6465206973A7 -:1080D0002025643A0D0A0000696E747274696D653A -:1080E0002069732025643A0D0A00000063686970F6 -:1080F0002049442069732025782025782025782080 -:1081000025782025782025780D0A0000556E6B6EA5 -:108110006F776E20504859204C696E6B20737461E4 -:108120007574732E0D000000504859204C696E6B19 -:10813000204F4E2E0D000000504859204C696E6BA8 -:10814000204F46462E0D00000202020202020202E9 -:1081500002020202020202020D0A3D3D3D20257389 -:10816000204E455420434F4E46203D3D3D0D0A00D4 -:108170004D41433A2025583A25583A25583A255832 -:108180003A25583A25580D0A000000005349503A44 -:108190002025642E25642E25642E25640D0A0000FA -:1081A0004741573A2025642E25642E25642E2564E8 -:1081B0000D0A00005355423A2025642E25642E25D1 -:1081C000642E25640D0A0000444E533A2025642E87 -:1081D00025642E25642E25640D0A0000616C6C6FE9 -:1081E00063206970207374617469630D000000007E -:1081F000616C6C6F632069702062792064686370C1 -:108200000D0000003D3D3D3D3D3D3D3D3D3D3D3D85 -:108210003D3D3D3D3D3D3D3D3D3D0D0057616B6567 -:10822000206F6E204C414E0D000000005050504F0A -:1082300045207465726D696E617465640D0000009F -:1082400044657374696E6174696F6E20556E7265F2 -:1082500061636861626C650D000000004950206335 -:108260006F6E666C6963740D000000005265737573 -:108270006C74206973204F4B2061626F757420739A -:108280006F636B65742070726F636573732E0D007E -:10829000536F636B65742069732062757379206F07 -:1082A0006E2070726F63657373696E6720746865A2 -:1082B000206F7065726174696F6E2E2056616C69F3 -:1082C00064206F6E6C79204E6F6E2D626C6F636BE5 -:1082D00020494F204D6F64652E0D00005265737567 -:1082E0006C7420697320666174616C206572726FB2 -:1082F000722061626F757420736F636B6574207098 -:10830000726F636573732E0D00000000496E766115 -:108310006C696420736F636B6574206E756D626544 -:10832000720D0000496E76616C696420736F636B37 -:108330006574206F7074696F6E0D0000536F636B0E -:108340006574206973206E6F7420696E6974696149 -:108350006C697A6564206F722053495052206973AA -:10836000205A65726F20495020616464726573738E -:10837000207768656E20536E5F4D525F5443500DF9 -:1083800000000000536F636B657420756E65787034 -:1083900065637465646C7920636C6F7365642E0D1E -:1083A00000000000496E76616C696420736F636B36 -:1083B0006574206D6F646520666F7220736F636BE8 -:1083C0006574206F7065726174696F6E2E0D0000A8 -:1083D000496E76616C696420736F636B65742066A7 -:1083E0006C61670D00000000496E76616C69642065 -:1083F000736F636B65742073746174757320666F3B -:108400007220736F636B6574206F7065726174693D -:108410006F6E2E0D00000000496E76616C6964205D -:10842000617267756D656E742E0D0000506F727409 -:10843000206E756D626572206973207A65726F0DAA -:1084400000000000496E76616C696420495020612B -:108450006464726573730D0054696D656F75742083 -:108460006F636375727265640D000000446174612E -:10847000206C656E677468206973207A65726F205E -:108480006F722067726561746572207468616E2016 -:10849000627566666572206D61782073697A652EF3 -:1084A0000D000000536F636B65742062756666652E -:1084B00072206973206E6F7420656E6F7567682017 -:1084C000666F72206461746120636F6D6D756E6993 -:1084D000636174696F6E2E0D00000000496E766155 -:1084E0006C6964207061636B6574206C656E677481 -:1084F000682E20466174616C204572726F722E0D79 -:1085000000000000736F636B6574206E6F742063EE -:108510006F6E6E6563740D00656E61626C652073CD -:108520006F636B6574202564206175746F206B65C3 -:10853000657020616C6976650D0A0000312E206E31 -:108540006574206C696E6B2072736C74203D2025FD -:10855000640D0A00312E206E6574206C696E6B20EC -:10856000737461203D20307825782C206F6C643D39 -:10857000307825780D0A0000556E6B6E6F776E208F -:10858000504859204C696E6B207374617574732E5A -:108590000D000000504859204C696E6B2055502E3C -:1085A0000D000000312E20504859204C696E6B2080 -:1085B000444F574E2E0D0000312E20504859204C6C -:1085C000696E6B20574149542E0D0000322E205009 -:1085D0004859204C696E6B20574149542E0D0000BC -:1085E0006F74686572204C696E6B207374612E0D18 -:1085F0000000000077616974652050485920636F5E -:108600006E6E6563742E0D00436C6F73652054436A -:10861000502073657276657220736F636B6574208A -:10862000256420616E6420646973636F6E6E656398 -:10863000742E0D0A00000000312E20736F636B65ED -:1086400074202564207372203D20307825782C20FA -:108650006F6C643D307825780D0A0000544350203B -:1086600073657276657220697320636F6E6E6563E1 -:1086700074656420746F20736F636B657420256468 -:108680002C2064657374696E6174696F6E20697003 -:108690003D25642E25642E25642E25642C20706FC4 -:1086A00072743D25640D0A00544350207365727640 -:1086B000657220736F636B65742025642077616930 -:1086C0007420636C6F73652C2072736C743D256429 -:1086D0000D0A000054435020736572766572207352 -:1086E0006F636B657420256420697320636C6F73FE -:1086F00065642C206372656174652061206E657706 -:1087000020736F636B65740D0A00000054435020A2 -:1087100073657276657220736F636B657420256470 -:108720002063726561746520737563636573730D8F -:108730000A00000043726561746520544350207341 -:10874000657276657220736F636B65742025642093 -:108750006661696C65642C20636F64653D25640DFA -:108760000A000000526520496E6974204E657477D6 -:108770006F726B0D000000005443502073657276D9 -:10878000657220736F636B6574202564204C697378 -:1087900074656E696E672E2E2E2E2E2E0D0A0973AD -:1087A00065727665722069703D2025642E25642EE1 -:1087B00025642E25642C20706F72743D25640D0A8B -:1087C0000000000054435020736572766572207378 -:1087D0006F636B6574202564204C697374656E202B -:1087E0006572726F722C20636F64653D25640D0A9B -:1087F0000000000054435020736572766572206457 -:10880000656661756C742C20676574536E5F535296 -:108810003D307825780D0A00534E466C61736849E7 -:108820006E69742070617261206572726F720D00E2 -:108830004E6F7220666C61736820556E6971756544 -:10884000206964203D200000307825782C2000002D -:108850000D0000006E77652C206661643D30782540 -:10886000782C207361643D30782578206C656E3DEE -:1088700025642C200D0A0000457261736520344B7D -:1088800020616E642077720D000000002D2D2D2DCB -:108890002D2D2D2D2D2D2D2D2D2D6E6F7220666CD5 -:1088A00061736820696E666F2D2D2D2D2D2D2D2D58 -:1088B0002D2D2D2D2D2D0D006D616E75666163744E -:1088C00075726572206964203D20307825780D0A24 -:1088D00000000000646576696365206964203D20BE -:1088E000307825780D0A00006D656D6F72792074FF -:1088F000797065203D20307825780D0A0000000051 -:108900006361706163697479203D20307825780D4A -:108910000A0000002D2D2D2D2D2D2D2D2D2D2D2D31 -:108920002D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D77 -:108930002D2D2D2D2D2D2D2D2D2D2D2D2D2D0D00B4 -:10894000446174466C61736852644461746120616F -:108950006464723D307825782C0D0A000D0A256478 -:108960003A09000025303278200000004461744646 -:108970006C617368577244617461576974684572B9 -:1089800061736520616464723D307825782C0D0A2E -:1089900000000000646F6E65200D00000D0A2D2D93 -:1089A0002D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2DF7 -:1089B0002D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2DE7 -:1089C0002D2D2D2D2D2D2D0D00000000496E204840 -:1089D0006172644661756C745F48616E646C657247 -:1089E0000D000000496E204D656D4D616E6167653B -:1089F0005F48616E646C65720D000000496E204234 -:108A000075734661756C745F48616E646C65720D58 -:108A100000000000496E2055736167654661756C02 -:108A2000745F48616E646C65720D0000496E204E83 -:108A30004D495F48616E646C65720D0052656773E5 -:108A400020496E20737461636B0D00005230203D2D -:108A5000203078256C780D0A000000005231203D4E -:108A6000203078256C780D0A000000005232203D3D -:108A7000203078256C780D0A000000005233203D2C -:108A8000203078256C780D0A000000005231322029 -:108A90003D203078256C780D0A0000005231345B9F -:108AA0004C525D203D203078256C780D0A00000086 -:108AB0005231355B50435D203D203078256C780D78 -:108AC0000A00000078505352203D203078256C7801 -:108AD0000D0A000053617665417070446174612035 -:108AE00070617261206572720D00000070726F63B8 -:108AF0006573732066696C6520686561640D0000AC -:108B000066696C65206865616420637263206572C4 -:108B1000726F720D0000000062696E2066696C65FC -:108B2000206E6F7420737570706F72740D0000008A -:108B300066696C65206E6F7420636F727265637412 -:108B40000D0000007361766520746F206E6F726691 -:108B50006C6173682C20616464723D3078256C7898 -:108B60002C2077746C656E3D25640D0A00000000B2 -:108B7000675F6973726E707566696C65203D3D2034 -:108B8000300D0000636865636B20675F676E70750A -:108B90004865616420637263203D203078256C78DD -:108BA000200D0A00675F676E7075486561642E6806 -:108BB00064646174637263203D203078256C782092 -:108BC0000D0A0000675F676E7075486561642E620C -:108BD000696E637263203D203078256C78200D0A21 -:108BE00000000000675F73617665417070437472C6 -:108BF0006C2E62696E637263203D203078256C783C -:108C0000200D0A00675F676E7075486561642E729B -:108C10006E7075637263203D203078256C78200D6E -:108C20000A000000675F736176654170704374727B -:108C30006C2E726E7075637263203D203078256CE7 -:108C400078200D0A00000000675F676E7075486548 -:108C500061642E646174616C656E203D20307825FE -:108C60006C78200D0A000000675F736176654170C3 -:108C7000704374726C2E727376436F756E74657286 -:108C8000203D203078256C78200D0A0063616C63EC -:108C900020637263203D20307825782C20675F6741 -:108CA0006E7075486561642E62696E637263203D03 -:108CB00020307825780D0A0072652063616C63208E -:108CC00066696C65206461746120637263206572FB -:108CD000726F720D00000000726563656976652031 -:108CE00066696C6520637263206572726F720D0035 -:108CF0005374617274417070557064617465207250 -:108D0000647374617274203D20307825782C20774C -:108D1000727374617274203D20307825782C206C39 -:108D2000656E203D2025642C2077746C656E203D97 -:108D30002025642C20776372633D307825780D0AF6 -:108D40000000000049735361766544617461436FAC -:108D50007272656374206661696C65640D00000061 -:108D60005772697465206461746120746F20616456 -:108D70006472203D203078257820626567696E0D29 -:108D80000A0000000D0A57726974654170704269EB -:108D90006E44617461206572726F722E206164642A -:108DA000723D307825782C2073697A653D25640DF5 -:108DB0000A0000007772697465206461746120663E -:108DC000696E6973680D000057726974654170704F -:108DD00042696E44617461206661696C65640D006E -:108DE00055706461746541707020626567696E0DCD -:108DF00000000000757064617465646174612063D3 -:108E00006865636B637263206572720D0000000019 -:108E10004150505F43414E5F55504441544500001E -:108E2000757064617465646174612075706D6173DF -:108E30006B206572720D0000666C6173682061645E -:108E40006472206572726F720D0000007361766546 -:108E500020646174612063726320636865636B20C2 -:108E60006572726F722C206372633D307825782CA6 -:108E700020617070636865636B3D307825780D0AFA -:108E800000000000736176652066696C652073746C -:108E900061636B746F70203D20307825782C2072D0 -:108EA00065736574616464723D307825780D0A00DD -:108EB000736176652064617461206F6B0D00000042 -:108EC0005570646174654170703A2066726F6D20F0 -:108ED0006164643D3078257820746F207374616418 -:108EE000643D307825782C2073697A653D25642CA3 -:108EF000207773697A653D25640D0A007361766594 -:108F00002064617461206E6F742072696768740DEB -:108F100000000000426567696E2072756E20617006 -:108F2000700D0000737461636B746F70203D2030AE -:108F30007825782C207265736574616464723D30A5 -:108F40007825780D0A0000004A756D7020746F2036 -:108F500061707020616464726573730D00000000BD -:108F600072756E20617070206661696C65640D00B9 -:108F7000494150436C65616E55706461746541721E -:108F800065612C20657261736520626567696E0D8D -:108F900000000000494150436C65616E557064618A -:108FA0007465417265612066696E6973682C20631F -:108FB0006F756E743D25640D0A000000496170579D -:108FC000726974655061726120626567696E0D0037 -:108FD00049617057726974655061726120656E6491 -:108FE0000D0000006572726F7220696E2057726901 -:108FF00074655273764269746D6170206964783D5E -:1090000025642C207061636B65744E756D3D25641D -:109010000D0A00006572726F7220696E20577269C6 -:1090200074655273764269746D6170206261646424 -:10903000723D25642C206C656E426D703D25640D7B -:109040000A0000007374617274207265636569764A -:10905000652066696C650D007265636569766520DB -:109060007374617274206F7665720D0073656E643F -:1090700020746F206E6F6465747970653D3078255B -:10908000780D0A006E6F77206461746143686563D0 -:109090006B73756D3D25642C20726563656976651B -:1090A0003A6461746153697A653D25642C2064617A -:1090B0007461436865636B73756D3D307825780D19 -:1090C0000A0000005472616E734461746150726FE3 -:1090D0006320577269746546696C654170702065DC -:1090E00072726F72207273743D202564200D0A0025 -:1090F0005472616E734461746150726F6320526583 -:1091000063656976652066696C652066696E69735A -:10911000680D00005472616E734461746150726F27 -:109120006320636865636B20637263206572726F8E -:10913000720D00000D0A3D3D3D3D3D3D3D3D3D3D37 -:109140003D3D3D3D3D3D3D3D204170706C6963615D -:1091500074696F6E203D3D3D3D3D3D3D3D3D3D3D96 -:109160003D3D3D3D3D3D3D0D0000000066706761A9 -:10917000206861726420766572206572726F720D6C -:10918000000000006670676120736F66742076656A -:1091900072206572726F720D000000005072654D92 -:1091A00061696E4C6F6F70206F7665720D00000004 -:1091B0007465737420746865206D6F746F206374B8 -:1091C000726C0000544553544D4F000052554E00F0 -:1091D0006D6F7665207220746F20706F73000000D1 -:1091E000524D4F56544F000073686F772074686576 -:1091F00020696E666F0000004D4F544F494E464F38 -:10920000000000007265736574000000524553450C -:10921000540000006D6F766520787920746F20709F -:109220006F73000058594D4F5645544F00000000D1 -:1092300053686F7746696C65496E666F0000000081 -:1092400046494C45494E464F000000006465627532 -:1092500067000000444542554700000053696D75A2 -:109260006C6174696F6E20776F726B0053494D5556 -:10927000000000006F7574436F756E746572203D59 -:10928000202564200D0A00006765742061206E654A -:10929000772066696C650D00526573657420776F81 -:1092A000726B2073746120656E207363616E340D80 -:1092B000000000006E6F74207468652073616D6536 -:1092C0002066696C652C207365742069647820744D -:1092D0006F20300D0000000073746172742062759D -:1092E00074746F6E207461736B2073746172740D8B -:1092F000000000000D0A0920526566726573684F10 -:1093000070746963616C4D6350617261733A0D00F2 -:109310007A65726F20706F730D0A09000D0A0920BB -:10932000526566726573684F70746963616C576BE0 -:1093300050617261733A0D00736574207A65726FC3 -:1093400020746F2076616C69640D00000D0A09734A -:109350006574204F70746963616C207A65726F2048 -:10936000706172610D0000006265666F7265207346 -:1093700065742C206D6F746F7320706F7320697328 -:109380003A0D00000920706F735B25645D3D256414 -:109390000D0A00004D5458000D0A736574202573A2 -:1093A000207A65726F203D202564200D0A000000A0 -:1093B0006265666F7265207365742C207A65726FC2 -:1093C0002069732025640D0A000000007365742075 -:1093D0006E657720706F7320746F2025640D0A000E -:1093E0006F6C6420706F733D25642C206E65772050 -:1093F000706F733D25640D0A000000004D54590044 -:109400004D545531000000004D5452310000000011 -:109410004D545031000000004D5453310000000005 -:109420006166746572207365742C206D6F746F7340 -:1094300020706F732069733A0D0000000D0A74618B -:109440007267657420706F736974696F6E206F75D1 -:1094500074206F662072616E67652C20783D2564EC -:109460000D0A000046696E64585A65726F20737564 -:1094700063636573730D000046696E64585A6572C4 -:109480006F206572726F722C20636F64653D256476 -:109490000D0A00006265666F7265207365742C208A -:1094A0004D545820706F733D25642C2073657420D3 -:1094B000746F2025640D0A006166746572207365FF -:1094C000742C204D545820706F733D25640D0A0094 -:1094D0000D0A74617267657420706F736974696FC7 -:1094E0006E206F7574206F662072616E67652C2028 -:1094F000793D25640D0A00004D545920546F205ABF -:1095000065726F20737563636573730D00000000EF -:109510004D545920546F205A65726F206572726FD6 -:10952000722C20636F64653D307825780D0A000049 -:109530006265666F7265207365742C204D545920E6 -:10954000706F733D25642C2073657420746F202523 -:10955000640D0A006166746572207365742C204D79 -:10956000545920706F733D25640D0A0046696E647E -:10957000595A65726F20737563636573730D0000CC -:1095800046696E64595A65726F206572726F722CEB -:1095900020636F64653D25640D0A00006265666F97 -:1095A0007265207365742C204D5459706F733D257E -:1095B000642C2073657420746F2025640D0A0000EC -:1095C0000D0A74617267657420706F736974696FD6 -:1095D0006E206F7574206F662072616E67652C2037 -:1095E000783D25642C20793D25640D0A000000009B -:1095F0000D0A206265666F7265206D6F76650D00DD -:109600000978706F733D25640D0A00000979706F49 -:10961000733D25640D0A0000097531706F733D2597 -:10962000640D0A000D0A206166746572206D6F7604 -:10963000650D00000972706F733D25640D0A00000E -:109640006765742073746F7020627574746F6E2018 -:10965000646F776E0D00000046696E6455315A657F -:10966000726F20737563636573730D0046696E6472 -:1096700055315A65726F206572726F722C20636F5C -:1096800064653D25640D0A0046696E6455315A656E -:10969000726F2C206265666F7265207365742C2072 -:1096A0004D54553120706F733D25642C20736574C3 -:1096B00020746F2025640D0A0000000046696E6466 -:1096C00055315A65726F2C2061667465722073651E -:1096D000742C204D54553120706F733D25640D0A54 -:1096E000000000000D0A74617267657420706F736A -:1096F0006974696F6E206F7574206F662072616E79 -:1097000067652C2075313D25642C20706F73753191 -:109710003D25640D0A00000046696E6452315A65A9 -:10972000726F20737563636573730D0046696E64B1 -:1097300052315A65726F206572726F722C20636F9E -:1097400064653D25640D0A006265666F726520736D -:1097500065742C204D54523120706F733D25642C5C -:109760002073657420746F2025640D0A00000000CA -:109770006166746572207365742C204D54523120DB -:10978000706F733D25640D0A00000000783D25646C -:109790000D0A0000793D25640D0A00005859525306 -:1097A0003150314D6F7665546F506F730D0000006E -:1097B000696478203D2025642C676F20746F2078C1 -:1097C0003D2025642C20676F20746F2079203D2078 -:1097D00025642C200D0A0000332E2073657420466A -:1097E000616E4D6F746F734F6E2066616E436C6F68 -:1097F0007365436F756E746572203D2025640D0A94 -:109800000000000067726170682072616E67652CED -:10981000206C6566743D25642C2072696768743D10 -:1098200025642C20746F703D25642C20626F747445 -:109830006F6D3D25640D0A0070617261207365745F -:109840002072616E67652C206C6566743D25642C02 -:109850002072696768743D25642C20746F703D2503 -:10986000642C20626F74746F6D3D25640D0A0000D6 -:109870004164644E657746696C654F6666736574CE -:109880000D0000006265666F7265206164642C20C3 -:1098900066696C6520696E666F3A0D006166746575 -:1098A00072206164642C2066696C6520696E666F45 -:1098B0003A0D00006461746120656E642C2075733C -:1098C00065206D696E7070730D000000476574410E -:1098D000446174614974656D2072736C74203D201D -:1098E00025640D0A00000000696E2073746F7020FB -:1098F0007374617475732C207879206D6F76650DA3 -:109900000000000066696E64206E656172206F70F1 -:109910007469206461746120746F2066696C6520CD -:109920006964783D25640D0A0000000065727220AC -:10993000617420676574207374657020646174615C -:109940000D0000007370696E20616374706F733D69 -:109950002825642C2564290D0A0000007370696EA7 -:10996000207374617220616374706F733D28256485 -:109970002C2564290D0A0000657272206F6B206F20 -:10998000722070617573650D0000000069647820B5 -:109990003D2025642C6974656D203D20256420657B -:1099A00072723D25780D0A00675F64617446696CC8 -:1099B000652E7046696C65486561642D3E66696C0C -:1099C00065486561642E616E63686F7258203D253D -:1099D000640D0A00675F64617446696C652E7046A9 -:1099E000696C65486561642D3E66696C65486561B2 -:1099F000642E616E63686F7259203D25640D0A0004 -:109A000073656E642063757470726F7373666C61D6 -:109A100067203D20300D0000676F746F206F666611 -:109A2000736574207768656E2066696E6973680D6A -:109A3000000000006A756D7020746F2066696C65A7 -:109A4000206964783D25642C2073746974636865AB -:109A5000733D25640D0A00006E6F2066696C650D0C -:109A600000000000616374206A756D7020746F20BF -:109A700066696C65206964783D25640D0A00000004 -:109A80006265666F7265206D6F766520746F2077F2 -:109A90006F726B0D000000006166746572206D6F5F -:109AA000766520746F20776F726B0D007061726144 -:109AB000313D25732C2070617261323D25730D0A92 -:109AC0000000000070617261313D25730D0A0000D5 -:109AD0006D6F746F7320696E666F3A0D0000000041 -:109AE0000958706F733D25640D0A00000959706FA5 -:109AF000733D25640D0A00000952706F733D2564A3 -:109B00000D0A00000955706F733D25640D0A0000B1 -:109B10000950706F733D25640D0A00000953706F82 -:109B2000733D25640D0A000047657441446174610A -:109B30004974656D282564293A0000006374726CCD -:109B40003D307825782C20617474723D307825780A -:109B50002C2064783D25642C64793D25642C647246 -:109B60003D25642C6C656E3D25642C616374696FC2 -:109B70006E3D307825780D0A000000006572722075 -:109B80006964780D00000000776F726B706F73204E -:109B90007231203D2025642C2064617461696478F1 -:109BA0003D25640D0A0000000000000058B4ABB869 -:109BB000D0C6F7D7F8B1EA0059B4ABB8D0C6F7D7DA -:109BC000F8B1EA00C9FDBDB5B4ABB8D0C6F7B8DF8F -:109BD000B6C80000D0FDD7AAB4ABB8D0C6F7BDC791 -:109BE000B6C80000BFC9B2BCCFDFC7F8D3F2C9CF37 -:109BF000B1DFBDE728582D2900000000BFC9B2BC65 -:109C0000CFDFC7F8D3F2CFC2B1DFBDE728582B2989 -:109C100000000000BFC9B2BCCFDFC7F8D3F2D7F352 -:109C2000B1DFBDE728592D2900000000BFC9B2BC33 -:109C3000CFDFC7F8D3F2D3D2B1DFBDE728592B2944 -:109C400000000000BFC9D2C6B6AFC7F8D3F2C9CF73 -:109C5000B1DFBDE728582D2900000000BFC9D2C6DA -:109C6000B6AFC7F8D3F2CFC2B1DFBDE728582B2972 -:109C700000000000BFC9D2C6B6AFC7F8D3F2D7F311 -:109C8000B1DFBDE728592D2900000000BFC9D2C6A9 -:109C9000B6AFC7F8D3F2D3D2B1DFBDE728592B292D -:109CA00000000000CFE0B6D4CEBBD6C35800000001 -:109CB000CFE0B6D4CEBBD6C359000000C9FDBDB5B8 -:109CC000D2C6B6AFCFC2CFDE00000000C9FDBDB521 -:109CD000D2C6B6AFC9CFCFDE000000007879C6F497 -:109CE000B6AFCDA3D6B9CBD9B6C800007879B9E95B -:109CF000C1E3D4CBD0D0CBD9B6C800007879BFD5DA -:109D0000D7DFD4CBD0D0CBD9B6C800007879D0D0AB -:109D1000D7DFBCD3CBD9B6C8000000007879C9B270 -:109D2000B3B5BCD3CBD9B6C8000000007879CAD689 -:109D3000B6AFD2C6B6AFCBD9B6C831007879CAD6DD -:109D4000B6AFD2C6B6AFCBD9B6C832007879CAD6CC -:109D5000B6AFD2C6B6AFCBD9B6C833007879D7EE96 -:109D6000B8DFD2C6B6AFCBD9B6C80000CBCDC1CF15 -:109D7000C6F4B6AFCDA3D6B9CBD9B6C800000000A3 -:109D8000CBCDC1CFCAD6B6AFD2C6B6AFCBD9B6C887 -:109D900031000000CBCDC1CFCAD6B6AFD2C6B6AF68 -:109DA000CBD9B6C832000000CBCDC1CFCAD6B6AF32 -:109DB000D2C6B6AFCBD9B6C833000000CBCDC1CF29 -:109DC000D7EEB8DFD2C6B6AFCBD9B6C80000000018 -:109DD000CBCDC1CFD0D0D7DFBCD3CBD9B6C8000054 -:109DE000CBCDC1CFC9B2B3B5BCD3CBD9B6C80000B7 -:109DF000CBCDC1CFBFD5D7DFD4CBD0D0CBD9B6C890 -:109E000000000000D7EED0A1B2BCCFDFCBD9B6C8DE -:109E100000000000D7EEB4F3B2BCCFDFCBD9B6C898 -:109E200000000000B2BCCFDFBCD3CBD9B6C8000065 -:109E3000B2BCCFDFBDB5CBD9D7EED0A1C6ABB2EEA9 -:109E4000BDC7B6C800000000C9FDBDB5C6F0CDA3B2 -:109E5000CBD9B6C800000000C9FDBDB5B9E9C1E362 -:109E6000CBD9B6C800000000C9FDBDB5BFD5D7DF4E -:109E7000CBD9B6C800000000C9FDBDB5BDF8B8F823 -:109E8000CBD9B6C800000000B5B6D1B9B2E2CAD489 -:109E9000CBD9B6C800000000C9FDBDB5BCD3CBD935 -:109EA000B6C80000C9FDBDB5C9B2B3B5BCD3CBD9E6 -:109EB000B6C80000B8FAD7D9D0FDD7AAC6F4CDA34A -:109EC000CBD9B6C800000000B8FAD7D9D0FDD7AAC0 -:109ED000B9E9C1E3CBD9B6C800000000B8FAD7D9B8 -:109EE000D0FDD7AAD4CBD7AACBD9B6C800000000E2 -:109EF000B8FAD7D9D0FDD7AAD4CBB6AFBCD3CBD97B -:109F0000B6C80000B8FAD7D9D0FDD7AAC9B2B3B540 -:109F1000BCD3CBD9B6C80000B9D5BDC7BAF37879E0 -:109F2000B2B9B3A500000000B2BCCFDFD7EED0A11C -:109F3000CBD9B6C800000000BCD3B9A4B2C4C1CF0D -:109F4000BAF1B6C800000000BCD3B9A4CCA7B5B61E -:109F5000B8DFB6C800000000BCD3B9A4C2E4B5B6EF -:109F6000B8DFB6C800000000BCD3B9A4CCA7B5B612 -:109F7000BDC7B6C800000000CDC2CBBFBDE1CAF866 -:109F8000CEBBD6C3C6ABD2C600000000B7E7BBFA53 -:109F9000B9D8B1D5D1D3CAB100000000CDEAB3C958 -:109FA000BAF3CDA3B3B5CEBBD6C3D1A1D4F10000D3 -:109FB000C6ABD2C6B5E3D7F8B1EAD3D0D0A7B1EAE1 -:109FC000D6BE0000C6ABD2C6B5E3D7F8B1EA58009A -:109FD000C6ABD2C6B5E3D7F8B1EA5900CAFDBEDDBB -:109FE000BCE4D1D3CAB10000BFAABBFAD7D4B6AF84 -:109FF000D5D2C1E300000000343400003333000048 -:10A0000032320000CBCDC1CFB3A4B6C8B2B9B3A52C -:10A0100000000000B2FAC1BFD4A4C9E800000000EB -:10A02000CBD9B6C8C6A5C5E4CFB5CAFD00000000AF -:10A03000CDC2CBBFB2B9B3A5BCC6CBE3BBF9CAFD99 -:10A0400000000000CDC2CBBFB2B9B3A5BCC6CBE304 -:10A05000CAB5BCCAB3A4B6C80000000031310000C4 -:10A06000C6ABD2C6C8A5CDC2CBBFCEBBD6C3BAF392 -:10A07000BBD8CDCBBEE0C0EB00000000CDC2CBBF53 -:10A08000C7B0D4A4CDC2CBBFB3A4B6C800000000F3 -:10A09000BCD3D1B9B5E3B3A4B6C80000CEDEC1CFFE -:10A0A000BCECB2E2BFAAB9D800000000CEDEC1CF3E -:10A0B000BCECB2E2C9A8C3E8B4CECAFD00000000FF -:10A0C00058BCE4CFB6B2B9B3A500000059BCE4CF88 -:10A0D000B6B2B9B3A500000058C6F0CABCCEBBD614 -:10A0E000C3C6ABD2C600000059C6F0CABCCEBBD6B0 -:10A0F000C3C6ABD2C6000000D7EEBAF3D2BBB8F6E7 -:10A1000000000000696E7075742064657465637486 -:10A1100000000000494E5055540000006F757470E7 -:10A12000757420636F6E74726F6C00004F555450DD -:10A130005554000070617261313D25732C207061AF -:10A140007261323D25730D0A00000000000000001E -:10A1500025642E20496E7075742564206973206F04 -:10A1600066662028257329200D0A000025642E200C -:10A17000496E7075742564206973206F6E202028E5 -:10A18000257329200D0A000025642E204D2564200A -:10A19000616C61726D206973206F6666200D0A0024 -:10A1A00025642E204D256420616C61726D206973D9 -:10A1B000206F6E200D0A000025642E205A50312099 -:10A1C0006973206F6E200D0A0000000025642E20A8 -:10A1D0005A5031206973206F6666200D0A00000016 -:10A1E00025642E205A5032206973206F6E200D0A8C -:10A1F0000000000025642E205A5032206973206F21 -:10A200006666200D0A00000025642E204563643137 -:10A21000203D202564200D0A0000000025642E202A -:10A2200045636432203D202564200D0A00000000B3 -:10A230004F75747075742564206973206F6666208D -:10A2400028257329200D0A004F75747075742564D4 -:10A25000206973206F6E2028257329200D0A0000C5 -:10A2600053657249644F75744F66660D00000000B7 -:10A2700053657249644F75744F6E0D005365744D8C -:10A28000704F75744F66660D000000005365744D85 -:10A29000704F75744F6E0D006D70207369676E613D -:10A2A0006C20656E640D0000536574456E3438355E -:10A2B0004F75744F66660D00536574456E343835BE -:10A2C0004F75744F6E0D00006D6F746F25642064C0 -:10A2D0006972206973206F6666200D0A0000000015 -:10A2E0006D6F746F256420646972206973206F6ECE -:10A2F000200D0A006D6F746F25642070756C736596 -:10A30000206973206F6666200D0A00006D6F746F00 -:10A3100025642070756C7365206973206F6E200D45 -:10A320000A0000006D6F746F25642073656C312026 -:10A330006973206F6666200D0A0000006D6F746FF0 -:10A3400025642073656C31206973206F6E200D0ABF -:10A35000000000006D6F746F25642073656C3220FF -:10A360006973206F6666200D0A0000006D6F746FC0 -:10A3700025642073656C32206973206F6E200D0A8E -:10A38000000000006D6F746F256420736572766F36 -:10A39000206973206F6666200D0A00006D6F746F70 -:10A3A000256420736572766F206973206F6E200DAF -:10A3B0000A00000073697A656F66285361766564E8 -:10A3C00050617261293D25640D0A0000322E206C17 -:10A3D0006F616420736176652064617461206661D9 -:10A3E000696C65640D0000006C6F61642066696CC7 -:10A3F0006549443D307825782C2064617461496456 -:10A40000783D25640D0A0000322E206C6F616420B7 -:10A41000736176652064617461207375636365732D -:10A42000730D00007365742070617261206F6B2082 -:10A43000666C61670D000000626F61726420766572 -:10A440007273696F6E3A2070726F746F636F6C3DD8 -:10A4500025642C206E6F646569643D25642C206E34 -:10A460006F6465547970653D25640D0A0000000035 -:10A4700076657273696F6E3D25730D0A00000000EA -:10A480006572726F722061742063616C6C20506120 -:10A49000636B657441564C445020696E204372656D -:10A4A000617465426F6172645665720D0000000050 -:10A4B0006572726F722061742063616C6C205061F0 -:10A4C000636B657441564C445020696E204372653D -:10A4D00061746548656164426F6172645061726164 -:10A4E0000D0000006572726F722061742063616CF0 -:10A4F0006C205061636B657441564C445020696E0A -:10A5000020437265617465486561644E765061727E -:10A5100061730D004650474120486172643A20251E -:10A52000782E2578000000004650474120536F6682 -:10A53000743A2025782E257800000000637265614A -:10A5400074652073797374656D20696E666F206C15 -:10A55000656E3D25642C20617320666F6C6C6F778F -:10A560003A0D0A0025730D0A000000006572726F33 -:10A57000722061742063616C6C205061636B657440 -:10A5800041564C445020696E204372656174654D9C -:10A5900063496E666F0D00006572726F72206174A0 -:10A5A0002063616C6C205061636B657441564C4450 -:10A5B0005020696E204372656174654D6353746108 -:10A5C0007475730D000000006572726F7220617403 -:10A5D0002063616C6C205061636B657441564C4420 -:10A5E0005020696E2043726561746553656E736FA8 -:10A5F0007273426D700D000067657420636D642096 -:10A600004D435F434C45414E5F424F4242494E0DE0 -:10A610000000000073657420656E20776F726B20F8 -:10A620007374610D00000000736574206469732009 -:10A63000776F726B207374610D0000006765742082 -:10A64000496E76616C696444617446696C65206327 -:10A650006D642C20526573657420776F726B207364 -:10A66000746120656E207363616E310D000000001F -:10A67000676574204D435F5345545F454E544552C2 -:10A680005F5343414E5F53454E534F5220636D64B9 -:10A690000D000000676574204D435F5345545F45CE -:10A6A0005849545F5343414E5F53454E534F5220D8 -:10A6B000636D640D00000000676574204D435F53B7 -:10A6C00045545F454E5445525F544553545F4F5572 -:10A6D0005450555420636D640D000000676574206C -:10A6E0004D435F5345545F455849545F5445535457 -:10A6F0005F4F555450555420636D640D00000000A9 -:10A7000072656365697665206374726C2062792076 -:10A7100068616E642C20616374636F64653D30789A -:10A7200025782C2070617261313D307825782C209D -:10A7300070617261323D307825782C2070617261D1 -:10A74000333D307825780D0A00000000776F726B7A -:10A7500020636D642C20636F64653D307825780D2F -:10A760000A000000776F726B20636D642077686564 -:10A770006E20776F726B2C20636F64653D30782597 -:10A78000780D0A006D6F766520746F20636D642C00 -:10A7900020706F73783D25642C20706F73793D2590 -:10A7A000640D0A006D6F7665206173206F667374A7 -:10A7B00020636D642C206F667374783D25642C20B3 -:10A7C0006F667374793D25640D0A00004572726FDF -:10A7D000723A20636F64653D307825780D0A000079 -:10A7E000636C65616E2066696C65206F6B20666CBA -:10A7F00061670D007365742066696C65206F6B205E -:10A80000666C61670D00000072656365697665209E -:10A810006C656E206E6F74206571752C2072656397 -:10A82000656976656C656E3D25642C2046696C65AE -:10A830004578656350617261203D20256400000009 -:10A840004A616E00466562004D617200417072009F -:10A850004D6179004A756E004A756C00417567005C -:10A86000536570004F6374004E6F7600446563005B -:10A87000253032642530326425303264253032642C -:10A8800025303264253032640000000040A80308FF -:10A8900044A8030848A803084CA8030850A80308C4 -:10A8A00054A8030858A803085CA8030860A8030874 -:10A8B00064A8030868A803086CA8030853657020FF -:10A8C000203420323032350030393A31383A33349E -:10A8D0000000000030393A31383A333400000000CB -:10A8E0004275696C643A2025732025730D0A0000B7 -:10A8F0000D0A4650474120486172642056657273C4 -:10A90000696F6E203D205665722025782E257820AF -:10A910000D0A00000D0A4650474120536F6674200F -:10A9200056657273696F6E203D20566572202578DA -:10A930002E2578200D0A00007374617274505053F4 -:10A940003D2564203E204D41585F5050530D0A0074 -:10A9500073746172745050533D2564203C204D49FE -:10A960004E5F5050530D0A0072756E5050533D2586 -:10A9700064203E204D41585F5050530D0A000000A6 -:10A9800072756E5050533D2564203C204D494E5FFA -:10A990005050530D0A00000073696E652063616CAE -:10A9A00063206572726F720D000000007061726149 -:10A9B00020697320656D70747920696E2057726903 -:10A9C0007465496E746572446174610D0000000025 -:10A9D00062756653656C203D2025642C206572727B -:10A9E0006F720D0A0000000070617261313D2573C5 -:10A9F0002C2070617261323D25730D0A0000000049 -:10AA000072656164206164647220307825782C203E -:10AA100076616C3D307825780D0A00007772697494 -:10AA200065206164647220307825782C2076616C12 -:10AA30003D307825780D0A006F7020636F756E7455 -:10AA400065723D25640D0A007A7020636F756E741F -:10AA500065723D25640D0A00436C6561724563644F -:10AA600031436F756E7465720D000000436C656153 -:10AA70007245636432436F756E7465720D00000039 -:10AA80005365744F70436F756E7465722025640D45 -:10AA90000A0000005365745A70436F756E746572D6 -:10AAA0002025640D0A00000053657445636431433A -:10AAB0006F756E7465722025640D0A0053657445C8 -:10AAC000636432436F756E7465722025640D0A00ED -:10AAD00070617261206572726F7220696E204D6FB5 -:10AAE000746F7352756E0D007061726120764178DB -:10AAF00069734964206572726F7220696E204D6FB0 -:10AB0000746F7352756E0D00656D657267656E6367 -:10AB1000792073746F70203120696E20496E7465DE -:10AB200072706F6C6174696F6E4D6F74696F6E2CAB -:10AB3000206572723D307825780D0A007175696361 -:10AB40006B2073746F70203120696E20496E7465BC -:10AB500072706F6C6174696F6E4D6F74696F6E2C7B -:10AB6000206572723D307825780D0A006E6F726D27 -:10AB7000616C2073746F70203120696E20496E748F -:10AB80006572706F6C6174696F6E4D6F74696F6E12 -:10AB90002C206572723D307825780D0A0000000087 -:10ABA0006F6E65206F6620737065656420706172DA -:10ABB00061206973207A65726F200D007374617271 -:10ABC00074707073203D2025642C2072756E707037 -:10ABD00073203D2025642C20736C6F777070732078 -:10ABE0003D2025642C2073746F70707073203D209D -:10ABF00025642C2061646470707367203D20256497 -:10AC00002C2064656370707367203D2025642C20C0 -:10AC100062726B70707367203D2025640D0A00001E -:10AC20006E6F7420737570706F72742076617869BE -:10AC3000730D00006D6F766520636F756E74203D37 -:10AC400020302E2072756E206F7665720D00000028 -:10AC500063616C63206572726F722E206369726328 -:10AC60006C656E756D3D25642C20636972636C653F -:10AC700073697A653D25642C206C61737473697AFD -:10AC8000653D25640D0A0000726573657420736C60 -:10AC90006F77737461207768656E20737065656483 -:10ACA000206368616E67650D00000000312E207220 -:10ACB0006420737461206572722C207374613D305E -:10ACC0007825782C20636F756E743D25640D0A001D -:10ACD0007264206670676120646174612074696DBC -:10ACE0006F75740D00000000312E206178697320AB -:10ACF000616C61726D2076616C75653D3078257888 -:10AD00000D0A0000312E20656D657267656E6379EE -:10AD10002073746F7020332C206572723D3078255B -:10AD2000780D0A0070617261206572726F7220691D -:10AD30006E20436F6E74696E756F7573496E7465BE -:10AD400072706F6C6174696F6E0D0000706172617A -:10AD50002076417869734964206572726F72206948 -:10AD60006E20436F6E74696E756F7573496E74658E -:10AD700072706F6C6174696F6E0D0000656D657245 -:10AD800067656E63792073746F70203120696E205F -:10AD9000436F6E74696E756F7573496E746572700A -:10ADA0006F6C6174696F6E2C206572723D3078250E -:10ADB000780D0A00717569636B2073746F702031B0 -:10ADC00020696E20436F6E74696E756F7573496E7E -:10ADD000746572706F6C6174696F6E2C206572722D -:10ADE0003D307825780D0A006E6F726D616C2073AE -:10ADF000746F70203120696E20436F6E74696E75B8 -:10AE00006F7573496E746572706F6C6174696F6E83 -:10AE10002C206572723D307825780D0A0000000004 -:10AE2000322E206178697320616C61726D207661C9 -:10AE30006C75653D307825780D0A0000322E20654E -:10AE40006D657267656E63792073746F7020332C43 -:10AE5000206572723D307825780D0A00312E20452C -:10AE600072723A20696E7465724C6F6E673D3D3048 -:10AE70000D000000322E204572723A20696E746512 -:10AE8000724C6F6E673D3D300D0000006E6F742098 -:10AE9000737570706F7274206C6F630D000000002A -:10AEA00073686F7720746865206D632070617261CC -:10AEB0000000000053484F574D435041524100009D -:10AEC00073686F772074686520776B20706172619A -:10AED0000000000053484F57574B5041524100006B -:10AEE00073657420746865206D6320706172610001 -:10AEF0005345544D43504152410000007365742046 -:10AF000074686520776B20706172610053455457F7 -:10AF10004B5041524100000073686F7720746865A0 -:10AF200020616E67207061726100000053484F57C6 -:10AF3000414E47007365742074686520616E672018 -:10AF40007061726100000000534554414E4700009B -:10AF5000777269746520646566206D632070617224 -:10AF6000610D000077726974652064656620776BF7 -:10AF700020706172610D00007772697465206465EC -:10AF80006620616E676C6520706172610D00000063 -:10AF90006D6320706172612069643D25642C2076A8 -:10AFA000616C3D2564206C657373207468616E204C -:10AFB0006D696E3D25642C2073657420746F206D5F -:10AFC000696E0D0A000000006D63207061726120DF -:10AFD00069643D25642C2076616C3D2564206D6F8D -:10AFE0007265207468616E206D61783D25642C2047 -:10AFF00073657420746F206D61780D0A0000000085 -:10B00000776B20706172612069643D25642C207625 -:10B01000616C3D2564206C657373207468616E20DB -:10B020006D696E3D25642C2073657420746F206DEE -:10B03000696E0D0A00000000776B2070617261205C -:10B0400069643D25642C2076616C3D2564206D6F1C -:10B050007265207468616E206D61783D25642C20D6 -:10B0600073657420746F206D61780D0A0000000014 -:10B07000736574206D6320706172612000000000B0 -:10B0800025642E202573203D2025642C206F6C64C0 -:10B0900076616C75653D25640D0A000025642E20DF -:10B0A0003D2025642C206F6C6476616C75653D25B0 -:10B0B000640D0A0073657420776B207061726120E3 -:10B0C00000000000736574206D6F766520737461F5 -:10B0D000727420616E676C65200000006D632070E3 -:10B0E0006172613A0D00000025642E202573203D19 -:10B0F0002025640D0A00000025642E202573203DC4 -:10B1000020307825780D0A00776B20706172613AE3 -:10B110000D00000070617261313D25732C2070615B -:10B120007261323D25730D0A00000000736176657F -:10B13000206D6320706172610D000000736176659F -:10B1400020776B20706172610D000000616E6720D6 -:10B15000706172612025643A0D0A000009310932DC -:10B1600009330934093509360937093809390931EC -:10B17000300931310931320D0000000025643A09EF -:10B1800000000000256409000D0000007361766571 -:10B1900020616E676C6520706172610D00000000B7 -:10B1A000696478206572720D000000007365742078 -:10B1B000616E67207461626C652025642C20617467 -:10B1C000202825642C202564292C2076616C756547 -:10B1D0003D25640D0A00000063757220626F617284 -:10B1E0006420696478203D2025640D0A0000000079 -:10B1F000696E697420657874656E644374726C4C12 -:10B20000697374206572726F720D00006572726FDF -:10B21000723A20675F637572426F61726449647845 -:10B22000206E6F7420696E69740D00006F7468651C -:10B23000722052656D6F746520636D642C20636DA0 -:10B24000643D307825780D0A000000006F74686551 -:10B25000722052656D6F7465207061636B65742C2C -:10B2600020657869643D307825780D0A000000007B -:10B27000676574206F746865722064617461207002 -:10B2800061636B65742C20657869643D307825783E -:10B290000D0A00006F74686572207061636B6574DD -:10B2A0002C5254523D25642C49443D25782C444C65 -:10B2B000433D25640D0A000063616E206461746182 -:10B2C00020696E7465720D006E6F742073757070F6 -:10B2D0006F72742070726F746F636F6C0D0000007A -:10B2E0006765742073746F7020627574746F6E205C -:10B2F000646F776E0D0000006E6F742061742073B0 -:10B30000656E736F720D00004572617365204E4F5C -:10B31000525F4441545F4D414E4147450D0000008E -:10B320004E6F72416C6C6F63416E645365745573FC -:10B33000696E67466C6167732C20616C6C6F636229 -:10B340007974653D25642C20616C63736563733D7E -:10B3500025640D0A000000006265666F7265206159 -:10B360006C6C6F632C206265677365636964783DFC -:10B3700025642C2071756575656E756D3D25642C91 -:10B38000207772666C61673D307825780D0A000081 -:10B39000616C63736563733D2564203E2025640DF5 -:10B3A0000A00000072652065726173652064617433 -:10B3B000206D616E6167650D000000006E6F722088 -:10B3C000616C6C6F6320717565756520726574754D -:10B3D000726E20746F20302C207772666C61673D2E -:10B3E000307825780D0A00004572726F723A206736 -:10B3F0005F6E6F724D616E616765722E71756575F6 -:10B40000655365634E756D206E6F74206575712090 -:10B41000616C63736563730D0000000061667465A1 -:10B420007220616C6C6F632C206265677365636961 -:10B4300064783D25642C2071756575656E756D3D6C -:10B4400025642C207772666C61673D307825780D15 -:10B450000A00000052656C65617365537061636535 -:10B460002C207365636E756D3D25642C20657261BB -:10B4700073656964783D25642C2073796E633D257E -:10B48000640D0A00446174466C617368346B4572E4 -:10B490006173652065616464723D307825780D0ABA -:10B4A0000000000047657441446174614974656D32 -:10B4B000206572726F722C206964783D2564203E8D -:10B4C0002025640D0A0000006E6F7420666F756E93 -:10B4D00064207468652064617461206F662069640B -:10B4E000783D25640D0A00006572726F72322C205F -:10B4F0006E6F7420737570706F72742073746F72D6 -:10B500006167650D000000002873697A653D256458 -:10B510002920213D204441545F424C4F434B5F530F -:10B52000495A45206F722028626567616464723DE4 -:10B53000256429203E20286461746153697A653D41 -:10B540002564290D0A00000028626C6B6164647236 -:10B550003D25642920213D2028626567616464726D -:10B560003D2564290D0A00007361766520646174CD -:10B5700020746F2073616D6520616464722C206299 -:10B580006C6B6964783D25640D0A00007361766513 -:10B59000206461746120626C646964783D25642074 -:10B5A000626567616464723D3078257820746F202D -:10B5B0006275666964783D25640D0A000D0A646150 -:10B5C00074612066696C6520696E666F3A0D0000D3 -:10B5D00009656E666C61673D307825782C20737440 -:10B5E0006F726167653D307825782C20000000007F -:10B5F000646174612073746F726520617420657872 -:10B600007372616D0D000000646174612073746F6A -:10B610007265206174206E6F72666C6173680D00D4 -:10B62000646174612073746F7265206174206E614F -:10B630006E64666C6173680D000000006461746183 -:10B640002073746F72652061742065787372616D08 -:10B6500020616E64206E6F72666C6173680D00000D -:10B66000646174612073746F7265206174206E650B -:10B6700074776F726B0D0000646174612073746F76 -:10B680007265206174206672616D652065787261F3 -:10B690006D0D00006E6F7420737570706F72742082 -:10B6A00073746F7261676520747970650D000000B6 -:10B6B0000D0A0966696C65686561643A0D000000F1 -:10B6C0000966696C656E616D653D25730D0A000044 -:10B6D0000966696C656C656E3D25642C6974656DE1 -:10B6E0006E756D733D25642C627974657370657237 -:10B6F0006974656D3D25642C62797465737065723B -:10B70000626C6B3D25640D0A0000000009636865EA -:10B71000636B73756D3D307825782C636865636B5A -:10B720004372633D307825780D0A00000962656731 -:10B73000486561643D25640D0A0000000966696C76 -:10B740006549443D307825780D0A000009616E6333 -:10B75000686F72783D25642C616E63686F72793D05 -:10B7600025642C0D0A09626567696E783D25642C95 -:10B77000626567696E793D25642C626567696E72E2 -:10B780003D25640D0A096D696E783D25642C6D6157 -:10B7900078783D25642C6D696E793D25642C6D614A -:10B7A00078793D25640D0A0009616E63686F7278CF -:10B7B000323D25642C616E63686F7279323D256479 -:10B7C0002C0D0A09626567696E78323D25642C622A -:10B7D0006567696E79323D25642C626567696E72B2 -:10B7E000323D25640D0A000009456E466C61673DD7 -:10B7F000307825782C6F6666736574583D25642C07 -:10B800006F6666736574593D25640D0A000000007B -:10B8100009785265706561744E756D733D25642CB1 -:10B82000795265706561744E756D733D25642C7831 -:10B8300052657065617444697374616E63653D251A -:10B84000642C7952657065617444697374616E63C8 -:10B85000653D25640D0A0000496E76616C6964449B -:10B86000617446696C650D004176616C6964446180 -:10B870007446696C650D0000496E76616C696444BC -:10B880006174426C6F636B0D00000000736574207F -:10B890006E65772066696C6520706172613A0D0A89 -:10B8A0000D00000066696C6520696E666F2C206271 -:10B8B0006567783D25642C20626567793D25640DB8 -:10B8C0000A00000066696C6520696E666F2C206155 -:10B8D0006E63686F72583D25642C20616E63686FDB -:10B8E00072593D25640D0A00676574206974656DA1 -:10B8F000206572726F72206174204765744D696EA5 -:10B900004D617846726F6D46696C65446174426141 -:10B9100073652C2072736C74203D2025640D0A0021 -:10B920004765744D696E4D617846726F6D46696CFE -:10B9300065446174426173652C206E756D3D2564AC -:10B94000206D696E783D25642C206D6178783D25E9 -:10B95000642C206D696E793D25642C206D617879A9 -:10B960003D2564200D0A0000312E20776861742780 -:10B9700073207468697320636173653F0D00000074 -:10B9800063656E7465723D25662C25662C723D25B7 -:10B99000660D0A00322E636F756E743D25642C208F -:10B9A000696E6372656D656E743D25660D0A0000F3 -:10B9B000637265617465206E756D626572203D25E8 -:10B9C000642C206973206E6F7420657175616C2022 -:10B9D000746F20737465704E756D6265723D256479 -:10B9E0003A0D0A006265666F726520777269746548 -:10B9F00020626567783D25642C20626567793D2566 -:10BA0000642C20737465704E756D6265723D25649B -:10BA10000D0A0000746573742E64737200000000D8 -:10BA200073697A656F6628537172744974656D29FC -:10BA30003D25642C2073697A656F66285371727492 -:10BA4000496E666F293D25640D0A000073746570A8 -:10BA500073697A65206973206E6F742073757070D6 -:10BA60006F72742C207573652064656661756C74E3 -:10BA70000D000000675F64617446696C652E66693D -:10BA80006C654964784D6170203D202030782578C0 -:10BA9000200D0A0067657420636D64207374617201 -:10BAA0007420726563656976652066696C650D0052 -:10BAB0006E6F7420737570706F72742066696C6538 -:10BAC0000D000000727376207061636B6574206EE8 -:10BAD000756D3D25642C206269746D6170206C6504 -:10BAE0006E3D25640D0A00006765742061206E6557 -:10BAF000772066696C652C207361766564206174BB -:10BB0000206E6574776F726B0D0000007374617244 -:10BB100074206578626F6172642075706461746509 -:10BB20000D00000073656E64207265717565737435 -:10BB300020636D642C2064626964783D25640D0A7D -:10BB400000000000646174626C6F636B4964783D4F -:10BB500025642C206F7574206F662072616E676596 -:10BB60002E206279746573506572426C6B3D25645A -:10BB70002C206461746153697A653D25640D0A0067 -:10BB800072657175657374206661696C65642C20DB -:10BB90007472616E734163746976653D307825789F -:10BBA0002C207472616E73666C61673D25642C2075 -:10BBB000656E666C61673D307825780D0A0000007F -:10BBC0006572726F722061742063616C6C205061C9 -:10BBD000636B657441564C445020696E2043726516 -:10BBE00061746546696C65496E666F0D0000000002 -:10BBF0006572726F722061742063616C6C20506199 -:10BC0000636B657441564C445020696E20437265E5 -:10BC10006174655472616E73526573756C740D0056 -:10BC20005472616E732066696C65206E6F7420615A -:10BC300063746976650D00005472616E73206669E5 -:10BC40006C65206E6F742072656164790D00000070 -:10BC500066696C654944206973206E6F7420657154 -:10BC600075616C20696E2052656365697665466909 -:10BC70006C65446174612C207468697369643D2546 -:10BC8000642C207361766569643D25640D0A0000AB -:10BC9000577269746546696C65417070206572728F -:10BCA0006F72097273743D202564200D0A00000034 -:10BCB000526563656976652066696C652066696EA4 -:10BCC0006973680D00000000726563656976652020 -:10BCD0006C656E206E6F74206571752C20726563C3 -:10BCE000656976656C656E3D25642C2044617461E0 -:10BCF00046696C6550617261203D2025640000003A -:10BD000053656E644F706572436F6D6D446174610D -:10BD100020697320456D7074790D00004765744F7C -:10BD2000706572436F6D6D44617461206973204565 -:10BD30006D7074790D0000004765744F7065725224 -:10BD400073764C656E20697320456D7074790D00B3 -:10BD50004765744F706572547273467265654C65C1 -:10BD60006E20697320456D7074790D0067657420CD -:10BD70006D6320696E666F20636D642C20746F673D -:10BD8000676C653D25640D0A000000006572726FE6 -:10BD9000722061742063616C6C2053656E64415045 -:10BDA00061636B657420696E204F70657261746F9A -:10BDB000725461736B2055434D445F4745545F4D4A -:10BDC000435F494E464F200D000000006572726FC0 -:10BDD000722061742063616C6C20437265617465CC -:10BDE0004D63496E666F20696E204F706572617495 -:10BDF0006F725461736B2055434D445F4745545FE8 -:10BE00004D435F494E464F200D0000006572726F32 -:10BE1000722061742063616C6C2053656E644150C4 -:10BE200061636B657420696E204F70657261746F19 -:10BE3000725461736B2055434D445F4745545F4DC9 -:10BE4000435F535441545553200D00006572726F87 -:10BE5000722061742063616C6C204372656174654B -:10BE60004D6353746174757320696E204F706572F1 -:10BE700061746F725461736B2055434D445F474545 -:10BE8000545F4D435F535441545553200D000000FF -:10BE9000676574206D6320706172617320636D64E7 -:10BEA0000D0000006572726F722061742063616C16 -:10BEB0006C2053656E64415061636B657420696EDC -:10BEC000204F70657261746F725461736B205543BB -:10BED0004D445F4745545F4D435F504152415320AD -:10BEE0000D0000006572726F722061742063616CD6 -:10BEF0006C204372656174654D635061726173209B -:10BF0000696E204F70657261746F725461736B203B -:10BF100055434D445F4745545F4D435F5041524147 -:10BF200053200D006572726F722061742063616C22 -:10BF30006C2053656E64415061636B657420696E5B -:10BF4000204F70657261746F725461736B2055433A -:10BF50004D445F4745545F53454E534F5253200D58 -:10BF6000000000006572726F722061742063616C62 -:10BF70006C2043726561746553656E736F727353A1 -:10BF8000746174757320696E204F70657261746F8F -:10BF9000725461736B2055434D445F4745545F5362 -:10BFA000454E534F5253200D00000000676574202A -:10BFB0006D632073656E736F727320626D702063A2 -:10BFC0006D640D006572726F722061742063616C24 -:10BFD0006C2053656E64415061636B657420696EBB -:10BFE000204F70657261746F725461736B2055439A -:10BFF0004D445F4745545F53454E534F52535F4244 -:10C000004D50200D000000006572726F7220617447 -:10C010002063616C6C2043726561746553656E7357 -:10C020006F7273426D7020696E204F70657261741B -:10C030006F725461736B2055434D445F4745545FA5 -:10C0400053454E534F52535F424D50200D00000058 -:10C050006572726F722061742063616C6C2053652D -:10C060006E64415061636B657420696E204F70652A -:10C070007261746F725461736B2055434D445F4716 -:10C0800045545F46494C455F494E464F200D0000E0 -:10C090006572726F722061742063616C6C204372F0 -:10C0A0006561746546696C65496E666F20696E20CE -:10C0B0004F70657261746F725461736B2055434D9C -:10C0C000445F4745545F46494C455F494E464F20C3 -:10C0D0000D000000312E20676574207472616E734C -:10C0E00020726573756C7420636D640D0000000030 -:10C0F0006572726F722061742063616C6C2053658D -:10C100006E64415061636B657420696E204F706589 -:10C110007261746F725461736B2055434D445F4775 -:10C1200045545F5452414E535F524553554C542031 -:10C130000D0000006572726F722061742063616C83 -:10C140006C204372656174655472616E73526573DD -:10C15000756C7420696E204F70657261746F7254D3 -:10C1600061736B2055434D445F4745545F545241C2 -:10C170004E535F524553554C54200D005365744D3A -:10C1800063537461747573207768656E2073746F80 -:10C19000700D0000726563656976652073657420B3 -:10C1A0006D63207061726120636D640D000000009A -:10C1B00073657420696E7374616C6C6D656E740D5B -:10C1C0000000000073657420656C61707365642CF9 -:10C1D00020747970653D25642C2074696D65203D5F -:10C1E0002025640D0A000000636C6F73652074697C -:10C1F0006D653D2564206D696E0D0A00636C6F737B -:10C20000652074696D653D256420686F7572202511 -:10C2100064206D696E0D0A00636C6F73652074692C -:10C220006D653D25642064617920256420686F7503 -:10C2300072202564206D696E0D0A0000686173200C -:10C2400073657420656C617073656420616C7265E0 -:10C250006164790D0000000075706461746520658B -:10C260007820626F6172642C2070726F746F636FDC -:10C270006C547970653D25642C206E6F646574790B -:10C2800070653D25642C206E6F646549643D2564AE -:10C290000D0A0000726563656976652075706461DA -:10C2A00074206D6320636D640D0000006572726F11 -:10C2B000722061742063616C6C2053656E64415020 -:10C2C00061636B657420696E204F70657261746F75 -:10C2D000725461736B2055434D445F4745545F462C -:10C2E000494C455F4C495354200D00006572726FF4 -:10C2F000722061742063616C6C20437265617465A7 -:10C300004D6353746174757320696E204F7065724C -:10C3100061746F725461736B2055434D445F4745A0 -:10C32000545F46494C455F4C495354200D00000072 -:10C33000726563656976652073657420646566203F -:10C340007061726120636D640D000000736574207C -:10C350006D6320616E6420776B2064656620706178 -:10C36000726100007265636569766520736574208B -:10C370006D6F766520616E676C6520646566207000 -:10C3800061726120636D640D0000000073657420AC -:10C390006D7620616E676C652064656620706172E1 -:10C3A00061000000736574206865616420646566DF -:10C3B00020706172612C206E6F6465747970653DC8 -:10C3C00025642C2069643D25640D0A007365742082 -:10C3D000686561642064656620706172612C206EFE -:10C3E0006F6465747970653D256400007365742021 -:10C3F000636F6C6F722064656620706172612C20BF -:10C40000626F6172646E756D3D25640D0A000000F7 -:10C4100073657420636F6C6F722064656620706151 -:10C4200072612C2069643D2564000000747261769D -:10C430006572736520636D642C2070726F746F6316 -:10C440006F6C547970653D25642C206E6F6465496E -:10C45000643D25642C206E6F6465547970653D25BC -:10C46000642C207472614E756D3D25640D0A0000C8 -:10C47000676574206865616420747970653D256422 -:10C480002069643D2564206E767061726169643D47 -:10C4900025640D0A0000000073656E642068656104 -:10C4A00064206E762070617261730D006572726F28 -:10C4B000722061742063616C6C2053656E6441501E -:10C4C00061636B657420696E204F70657261746F73 -:10C4D000725461736B2055434D445F4745545F4828 -:10C4E0004541445F4E565041524153200D000000DB -:10C4F0006572726F722061742063616C6C2043728C -:10C5000065617465486561644E765061726173203F -:10C51000696E204F70657261746F725461736B2025 -:10C5200055434D445F4745545F484541445F4E562F -:10C530005041524153200D0072656164206865616D -:10C5400064206E76207061726173206572726F7202 -:10C550002C2072736C743D25640D0A007365742081 -:10C560006865616420706172612C206E6F6465740F -:10C570007970653D25642C206E6F646549643D25A6 -:10C58000640D0A0073657420636F6C6F72207061B4 -:10C5900072612C20626F6172646E756D3D25640D51 -:10C5A0000A00000073657420686561642074797006 -:10C5B000653D25642069643D256420706172616970 -:10C5C000643D2564206E76706172610D0A00000082 -:10C5D0005265616442756666456D70747920727348 -:10C5E0006C743D25640D0A00436C65616E4275668E -:10C5F000664166746572416374696F6E2074696D1B -:10C600006F75740D000000006572726F72206174A6 -:10C610002063616C6C204372656174654D63537473 -:10C620006174757320696E2053656E644D63537435 -:10C63000617475730D000000676574206D6320736D -:10C64000746174757320636D64207768656E207201 -:10C65000756E0D006572726F722061742063616C7B -:10C660006C2053656E64415061636B657420696E24 -:10C67000204F70657261746F725461736B57686597 -:10C680006E52756E2055434D445F4745545F4D4390 -:10C690005F535441545553200D0000006572726F72 -:10C6A000722061742063616C6C20437265617465F3 -:10C6B0004D6353746174757320696E204F70657299 -:10C6C00061746F725461736B5768656E52756E203A -:10C6D00055434D445F4745545F4D435F5354415468 -:10C6E0005553200D000000005365744D6353746171 -:10C6F000747573207768656E2072756E0D0000008A -:10C7000067657420636F6E74726F6C20776F726BE5 -:10C7100020636D64207768656E2072756E0D000071 -:10C720006572726F722061742063616C6C20536556 -:10C730006E64415061636B657420696E204F706553 -:10C740007261746F725461736B5768656E52756E67 -:10C750002055434D445F4745545F46494C455F492A -:10C760004E464F200D0000006572726F722061749A -:10C770002063616C6C2043726561746546696C6509 -:10C78000496E666F20696E204F70657261746F72BA -:10C790005461736B5768656E52756E2055434D44F6 -:10C7A0005F4745545F46494C455F494E464F200D13 -:10C7B00000000000332E20676574207472616E7370 -:10C7C00020726573756C7420636D640D0000000049 -:10C7D0006572726F722061742063616C6C205365A6 -:10C7E0006E64415061636B657420696E204F7065A3 -:10C7F0007261746F725461736B5768656E52756EB7 -:10C800002055434D445F4745545F5452414E535F5A -:10C81000524553554C54200D000000006572726F54 -:10C82000722061742063616C6C2043726561746571 -:10C830005472616E73526573756C7420696E204F0B -:10C8400070657261746F725461736B5768656E5274 -:10C85000756E2055434D445F4745545F5452414ED9 -:10C86000535F524553554C54200D000067657420AA -:10C87000636D64203D2030782578207768656E20D0 -:10C8800072756E0D0A000000726563656976652039 -:10C89000616E676C6520706172610D007265636521 -:10C8A0006976652070617463682064617461202812 -:10C8B0006964782920706172610D00006F74686589 -:10C8C0007220706172610D006572726F7220617406 -:10C8D0002063616C6C205061636B657441564C44FD -:10C8E0005020696E204372656174654D63506172BA -:10C8F00061730D006572726F722061742063616CE8 -:10C900006C205061636B657441564C445020696ED5 -:10C910002053656E644465627567496E666F0D00ED -:10C920006572726F722061742063616C6C2050615B -:10C93000636B657441564C445020696E2053656E9C -:10C940006446696C6550617261730D006C6F61645F -:10C9500020656E6320300D006C6F616420656E632E -:10C9600020310D006C6F616420656E63206572720A -:10C970006F720D0072656C6F616420656E63206577 -:10C9800072726F720D0000004465636F64655073CE -:10C990007764537472696E67206572726F722C20AF -:10C9A0007265736574205265736574496E73746142 -:10C9B0006C6C0D00636C69656E744964206F722045 -:10C9C0006370754964206E6F74206571752C2072D8 -:10C9D00065736574205265736574496E7374616C18 -:10C9E0006C0D0000727463207265636F72642C209A -:10C9F000636C6F73652074696D653D257520736583 -:10CA0000630D0A007274632072657365740D000013 -:10CA1000496E7374616C6C2066756E6374696F6EB9 -:10CA200000000000494E53005265736574496E73EF -:10CA300074616C6C0D00000043505549443A202548 -:10CA4000750000004C505357443A202573000000F5 -:10CA500070617261313D25732C2070617261323DCD -:10CA600025730D0A0000000025730D0A0000000068 -:10CA7000576F726B61626C65203D202564206D6983 -:10CA80006E0D0A0000000000000000000102030417 -:10CA9000060708090000000001020304465346444B -:10CAA00056534644000096302C61BA5119C48FF495 -:10CAB00035A5A3953288A4B81EE988D92B4CBD7C36 -:10CAC000072D911D6410F2204871DE417DD4EBE406 -:10CAD00051B5C7855698C0A87AF9ECC94F5CD96C96 -:10CAE000633DF50DC8205E10E4417271D1E447D476 -:10CAF000FD856BB5FAA86C98D6C940F9E36C755CF6 -:10CB0000CF0D593DAC303A0080511661B5F423C4C5 -:10CB100099950FA59EB80888B2D924E9877C114C55 -:10CB2000AB1D3D2D90410671BC202A1089851FB593 -:10CB3000A5E433D4A2C934F98EA81898BB0D2D3DB5 -:10CB4000976C015CF4516261D8304E00ED957BA585 -:10CB5000C1F457C4C6D950E9EAB87C88DF1D492D15 -:10CB6000F37C654C5861CE517400E23041A5D795F5 -:10CB70006DC4FBF46AE9FCD94688D0B8732DE51D75 -:10CB80005F4CC97C3C71AA411010862025B5B38545 -:10CB900009D49FE40EF998C92298B4A8173D810DD5 -:10CBA0003B5CAD6C2083B6B30CE29AD23947AF77C9 -:10CBB00015268316120B843B3E6AA85A0BCF9DFFA5 -:10CBC00027AEB19E4493D2A368F2FEC25D57CB67F5 -:10CBD0007136E706761BE02B5A7ACC4A6FDFF9EF05 -:10CBE00043BED58EE8A37E93C4C252F2F167675765 -:10CBF000DD064B36DA2B4C1BF64A607AC3EF55DF65 -:10CC0000EF8E79BE8CB31A83A0D236E295770347B4 -:10CC1000B9162F26BE3B280B925A046AA7FF31CFC4 -:10CC20008B9E1DAEB0C226F29CA30A93A9063F3686 -:10CC300085671357824A147AAE2B381B9B8E0DBE24 -:10CC4000B7EF21DFD4D242E2F8B36E83CD165B2674 -:10CC5000E1777747E65A706ACA3B5C0BFF9E69AE84 -:10CC6000D3FF45CF78E2EED25483C2B36126F716E4 -:10CC70004D47DB774A6ADC5A660BF03B53AEC59EE4 -:10CC80007FCFE9FF1CF28AC23093A6A30536930634 -:10CC90002957BF672E7AB84A021B942B37BEA18E44 -:10CCA0001BDF8DEF00000000963007772C610EEE41 -:10CCB000BA51099919C46D078FF46A7035A563E9F3 -:10CCC000A395649E3288DB0EA4B8DC791EE9D5E01A -:10CCD00088D9D2972B4CB609BD7CB17E072DB8E719 -:10CCE000911DBF906410B71DF220B06A4871B9F36E -:10CCF000DE41BE847DD4DA1AEBE4DD6D51B5D4F4A7 -:10CD0000C785D38356986C13C0A86B647AF962FD0B -:10CD1000ECC9658A4F5C0114D96C0663633D0FFA58 -:10CD2000F50D088DC8206E3B5E10694CE44160D55E -:10CD3000727167A2D1E4033C47D4044BFD850DD248 -:10CD40006BB50AA5FAA8B5356C98B242D6C9BBDB5B -:10CD500040F9BCACE36CD832755CDF45CF0DD6DC56 -:10CD6000593DD1ABAC30D9263A00DE518051D7C8FD -:10CD70001661D0BFB5F4B42123C4B3569995BACF88 -:10CD80000FA5BDB89EB802280888055FB2D90CC6A9 -:10CD900024E90BB1877C6F2F114C6858AB1D61C122 -:10CDA0003D2D66B69041DC760671DB01BC20D29841 -:10CDB0002A10D5EF8985B1711FB5B606A5E4BF9FCE -:10CDC00033D4B8E8A2C9077834F9000F8EA80996C1 -:10CDD00018980EE1BB0D6A7F2D3D6D08976C64912C -:10CDE000015C63E6F4516B6B62616C1CD830658545 -:10CDF0004E0062F2ED95066C7BA5011BC1F4088222 -:10CE000057C40FF5C6D9B06550E9B712EAB8BE8B62 -:10CE10007C88B9FCDF1DDD62492DDA15F37CD38CEB -:10CE2000654CD4FB5861B24DCE51B53A7400BCA3E9 -:10CE3000E230BBD441A5DF4AD795D83D6DC4D1A41B -:10CE4000FBF4D6D36AE96943FCD96E34468867ADF2 -:10CE5000D0B860DA732D0444E51D03335F4C0AAA91 -:10CE6000C97C0DDD3C710550AA41022710100BBE94 -:10CE700086200CC925B56857B3856F2009D466B9DB -:10CE80009FE461CE0EF9DE5E98C9D9292298D0B010 -:10CE9000B4A8D7C7173DB359810DB42E3B5CBDB7BD -:10CEA000AD6CBAC02083B8EDB6B3BF9A0CE2B6033E -:10CEB0009AD2B1743947D5EAAF77D29D1526DB04F3 -:10CEC0008316DC73120B63E3843B64943E6A6D0D3E -:10CED000A85A6A7A0BCF0EE49DFF099327AE000A89 -:10CEE000B19E077D44930FF0D2A3088768F2011E1C -:10CEF000FEC206695D5762F7CB67658071366C19B3 -:10CF0000E7066B6E761BD4FEE02BD3895A7ADA10D3 -:10CF1000CC4ADD676FDFB9F9F9EFBE8E43BEB717B4 -:10CF2000D58EB060E8A3D6D67E93D1A1C4C2D8383E -:10CF300052F2DF4FF167BBD16757BCA6DD06B53FA4 -:10CF40004B36B248DA2B0DD84C1B0AAFF64A0336E3 -:10CF5000607A0441C3EF60DF55DF67A8EF8E6E3162 -:10CF600079BE69468CB361CB1A8366BCA0D26F25AB -:10CF700036E2685295770CCC03470BBBB9160222F8 -:10CF80002F260555BE3BBAC5280BBDB2925AB42B0D -:10CF9000046AB35CA7FFD7C231CFD0B58B9ED92C22 -:10CFA0001DAEDE5BB0C2649B26F263EC9CA36A7587 -:10CFB0000A936D02A906099C3F360EEB856707723E -:10CFC00013570005824ABF95147AB8E2AE2BB17BA5 -:10CFD000381BB60C9B8ED2920DBED5E5B7EFDC7C2C -:10CFE00021DFDB0BD4D2D38642E2D4F1F8B3DD6883 -:10CFF0006E83DA1FCD16BE815B26B9F6E177B06F7E -:10D000007747B718E65A0888706A0FFFCA3B06666A -:10D010005C0B0111FF9E658F69AE62F8D3FF6B61F7 -:10D0200045CF6C1678E20AA0EED20DD75483044E99 -:10D03000C2B30339612667A7F71660D04D47694927 -:10D04000DB776E3E4A6AD1AEDC5AD6D9660BDF403A -:10D05000F03BD83753AEBCA9C59EBBDE7FCFB247ED -:10D06000E9FFB5301CF2BDBD8AC2BACA3093B353D2 -:10D07000A6A3B4240536D0BA9306D7CD2957DE54DB -:10D08000BF67D9232E7A66B3B84A61C4021B685DB4 -:10D09000942B6F2A37BE0BB4A18E0CC31BDF055A2D -:10D0A0008DEF022D00070E091C1B1215383F36317B -:10D0B00024232A2D70777E796C6B6265484F464138 -:10D0C00054535A5DE0E7EEE9FCFBF2F5D8DFD6D128 -:10D0D000C4C3CACD90979E998C8B8285A8AFA6A118 -:10D0E000B4B3BABDC7C0C9CEDBDCD5D2FFF8F1F608 -:10D0F000E3E4EDEAB7B0B9BEABACA5A28F888186F8 -:10D1000093949D9A2720292E3B3C35321F181116E7 -:10D1100003040D0A5750595E4B4C45426F686166D7 -:10D1200073747D7A898E878095929B9CB1B6BFB8C7 -:10D13000ADAAA3A4F9FEF7F0E5E2EBECC1C6CFC8B7 -:10D14000DDDAD3D4696E676075727B7C51565F58A7 -:10D150004D4A4344191E171005020B0C21262F2897 -:10D160003D3A33344E49404752555C5B7671787F87 -:10D170006A6D64633E39303722252C2B0601080F77 -:10D180001A1D1413AEA9A0A7B2B5BCBB9691989F67 -:10D190008A8D8483DED9D0D7C2C5CCCBE6E1E8EF57 -:10D1A000FAFDF4F358C1E3CEBB000000000000001C -:10D1B000000000000000000059C1E3CEBB000000E9 -:10D1C00000000000000000000000000055C1E3CE98 -:10D1D000BB00000000000000000000000000000094 -:10D1E00052C1E3CEBB0000000000000000000000C0 -:10D1F00000000000C6F4B6AFB0B4C5A50000000042 -:10D200000000000000000000CDA3D6B9B0B4C5A551 -:10D21000000000000000000000000000C9CFBCD0EA -:10D22000C1CFC6F8B8D72DB3F6CEBB0000000000C2 -:10D23000C9CFBCD0C1CFC6F8B8D72DBBD8CEBB00A4 -:10D2400000000000CFC2BCD0C1CFC6F8B8D72DB304 -:10D25000F6CEBB0000000000CFC2BCD0C1CFC6F8E4 -:10D26000B8D72DBBD8CEBB0000000000B9E2CFCBB1 -:10D27000B4A2C1CFB5CDCEBB31000000000000008C -:10D28000B9E2CFCBB4A2C1CFB5CDCEBB3200000046 -:10D2900000000000B9E2CFCBB4A2C1CFB8DFCEBB53 -:10D2A0003100000000000000B9E2CFCBB4A2C1CF32 -:10D2B000B8DFCEBB3200000000000000B9E2CFCBE7 -:10D2C000D1B9C1CFCCA7C6F0B5BDCEBB0000000020 -:10D2D000000000000000000000000000000000004E -:10D2E00000000000C9CFBCD0C1CFC6F8B8D7BFD8A6 -:10D2F000D6C6000000000000CFC2BCD0C1CFC6F827 -:10D30000B8D7BFD8D6C6000000000000D1B9C1CF41 -:10D31000C6F8B8D7BFD8D6C600000000000000008D -:10D32000CBCDC1CFC6F8B8D7BFD8D6C60000000055 -:10D3300000000000BCF4CFDFC6F8B8D7BFD8D6C60F -:10D340000000000000000000CBC9C1CFB5E7BBFA68 -:10D35000D4CB00000000000000000000B7E7BBFADB -:10D36000D5FDD7AA0000000000000000000000006A -:10D3700000000000000000000000000000000000AD -:10D38000000000000000000000000000000000009D -:10D39000000000000000000000000000000000008D -:10D3A000000000000000000000000000000000007D -:10D3B000000000000000000000000000000000006D -:10D3C000000000000000000000000000000000005D -:10D3D000000000000000000000000000000000004D -:10D3E000000000000000000000000000000000003D -:10D3F000000000000000000000000000000000002D -:10D40000000000000000000000000000000000001C -:10D41000000000000000000000000000000000000C -:10D4200000000000000000000000000000000000FC -:10D4300000000000000000000000000000000000EC -:10D4400000000000000000000000000000000000DC -:10D4500000000000000000000000000000000000CC -:10D4600000000000000000000000000000000000BC -:10D4700000000000000000000000000000000000AC -:10D48000000000000000000000000000000000009C -:10D49000000000000000000000000000000000008C -:10D4A000000000000000000000000000000000007C -:10D4B000000000000000000000000000000000006C -:10D4C000000000000000000000000000000000005C -:10D4D000000000000000000000000000000000004C -:10D4E000000000000000000000000000000000003C -:10D4F000000000000000000000000000000000002C -:10D50000000000000000000000000000000000001B -:10D51000000000000000000000000000000000000B -:10D5200000000000000000000000000000000000FB -:10D5300000000000000000000000000000000000EB -:10D5400000000000000000000000000000000000DB -:10D5500000000000000000000000000000000000CB -:10D5600000000000000000000000000000000000BB -:10D5700000000000000000000000000000000000AB -:10D58000000000000000000000000000000000009B -:10D59000000000000000000000000000000000008B -:10D5A000000000000000000000000000000000007B -:10D5B000000000000000000000000000000000006B -:10D5C000000000000000000000000000000000005B -:10D5D000000000000000000000000000000000004B -:10D5E000000000000000000000000000000000003B -:10D5F000000000000000000000000000000000002B -:10D60000000000000000000000000000000000001A -:10D61000000000000000000000000000000000000A -:10D6200000000000000000000000000000000000FA -:10D6300000000000000000000000000000000000EA -:10D6400000000000000000000000000000000000DA -:10D6500000000000000000000000000000000000CA -:10D6600000000000000000000000000000000000BA -:10D6700000000000000000000000000000000000AA -:10D68000000000000000000000000000000000009A -:10D69000000000000000000000000000000000008A -:10D6A000000000000100000000000080FFFFFF7F7D -:10D6B000743A01000100000000000080FFFFFF7FBE -:10D6C00074DCFFFF0100000000000080FFFFFF7F0F -:10D6D000881300000100000000000080FFFFFF7FB2 -:10D6E000000000000100000000000080FFFFFF7F3D -:10D6F000282300000100000000000080FFFFFF7FE2 -:10D700000000000000000000000000000000000019 -:10D710000000000000000000000000000000000009 -:10D7200000000000000000000000000000000000F9 -:10D7300000000000000000000000000000000000E9 -:10D7400000000000000000000000000000000000D9 -:10D7500000000000000000000000000000000000C9 -:10D7600000000000000000000000000000000000B9 -:10D7700000000000000000000000000000000000A9 -:10D780000000000000000000000000000000000099 -:10D790000000000000000000000000000000000089 -:10D7A0000000000000000000000000000000000079 -:10D7B0000000000000000000000000000000000069 -:10D7C0000000000000000000000000000000000059 -:10D7D0000000000000000000000000000000000049 -:10D7E000000000000100000000000080FFFFFF7F3C -:10D7F00030F8FFFF0100000000000080FFFFFF7F06 -:10D80000A00901000100000000000080FFFFFF7F71 -:10D8100030F8FFFF0100000000000080FFFFFF7FE5 -:10D8200098B700000100000000000080FFFFFF7FAC -:10D8300020D1FFFF0100000000000080FFFFFF7FFC -:10D84000743A01000100000000000080FFFFFF7F2C -:10D8500074DCFFFF0100000000000080FFFFFF7F7D -:10D86000B4F5000001000000F0D8FFFF1027000011 -:10D870000000000001000000F0D8FFFF10270000AA -:10D880002CE8FFFF00000000000000000000000086 -:10D890000000000000000000000000000000000088 -:10D8A00000000000010000009CFFFFFF10270000A7 -:10D8B00038FFFFFF010000009CFFFFFF1027000062 -:10D8C0001E140000010000009CFFFFFF1027000055 -:10D8D00038FFFFFF010000009CFFFFFF1027000042 -:10D8E000B8050100010000009CFFFFFF10270000A9 -:10D8F00060EA00000100000000000080FFFFFF7FE1 -:10D90000000000000100000000000080FFFFFF7F1A -:10D910000000000000000000000000000000000007 -:10D9200000000000000000000000000000000000F7 -:10D930000000000001000000F0D8FFFF10270000E9 -:10D940000000000001000000F0D8FFFF10270000D9 -:10D9500000000000000000000000000000000000C7 -:10D9600000000000000000000000000000000000B7 -:10D9700000000000000000000000000000000000A7 -:10D980000000000000000000000000000000000097 -:10D990000000000000000000000000000000000087 -:10D9A0000000000000000000000000000000000077 -:10D9B0000000000000000000000000000000000067 -:10D9C00000000000000000000100000064000000F2 -:10D9D0000A000000000000000100000064000000D8 -:10D9E000640000000000000001000000E8030000E7 -:10D9F0002C010000000000000100000010270000C2 -:10DA0000E8030000000000000100000010270000F3 -:10DA1000102700000000000001000000E8030000E3 -:10DA20000A0000000000000001000000E803000000 -:10DA3000C80000000000000001000000E803000032 -:10DA4000F40100000000000001000000E8030000F5 -:10DA50005802000000000000010000006400000007 -:10DA60000A0000000000000001000000E8030000C0 -:10DA70000A0000000000000001000000E8030000B0 -:10DA8000C80000000000000001000000E8030000E2 -:10DA9000F40100000000000001000000E8030000A5 -:10DAA000580200000000000001000000E803000030 -:10DAB000E803000000000000010000001027000043 -:10DAC000102700000000000001000000E803000033 -:10DAD0002C010000000000000100000064000000B4 -:10DAE0000A0000000000000001000000B004000077 -:10DAF000E80300000000000001000000A00F00008B -:10DB0000F401000000000000010000005046000089 -:10DB1000B80B00000000000001000000F40100004C -:10DB20000A0000000000000001000000F4010000F5 -:10DB3000140000000000000001000000F4010000DB -:10DB4000320000000000000001000000F4010000AD -:10DB50001E0000000000000001000000F4010000B1 -:10DB60000A00000000000000010000001027000073 -:10DB7000F401000000000000010000001027000078 -:10DB8000E80300000000000001000000100E00008B -:10DB9000050000000000000001000000100E000061 -:10DBA000640000000000000001000000100E0000F2 -:10DBB0000500000000000000010000001027000028 -:10DBC000F401000000000000010000001027000028 -:10DBD00088130000000000000000000000000000AA -:10DBE0000000000000000000000000000000000035 -:10DBF0000000000000000000000000000000000025 -:10DC000000000000000000000000000010270000DD -:10DC10000D0000000000000001000000E80300000B -:10DC20000A000000000000000000000000000000EA -:10DC300000000000000000000000000000000000E4 -:10DC400000000000000000000000000000000000D4 -:10DC500000000000000000000000000000000000C4 -:10DC600000000000000000000000000000000000B4 -:10DC700000000000000000000000000000000000A4 -:10DC80000000000000000000000000000000000094 -:10DC90000000000000000000000000000000000084 -:10DCA0000000000000000000000000000000000074 -:10DCB0000000000000000000000000000000000064 -:10DCC0000000000000000000000000000000000054 -:10DCD0000000000000000000000000000000000044 -:10DCE00000000000010000009CFFFFFFFFFFFF7F1E -:10DCF00000000000010000009CFFFFFF1027000053 -:10DD000088130000010000009CFFFFFF10270000A7 -:10DD1000000000000000000000000000504600006D -:10DD2000000000000100000000000000D00700001B -:10DD3000E8030000000000000000000000000000F8 -:10DD400000000000000000000000000000000000D3 -:10DD500000000000000000000000000000000000C3 -:10DD600000000000000000000000000000000000B3 -:10DD700000000000000000000000000000000000A3 -:10DD80000000000000000000000000000000000093 -:10DD90000000000000000000000000000000000083 -:10DDA0000000000000000000000000000000000073 -:10DDB00000000000000000000000000064000000FF -:10DDC00000000000000000000000000064000000EF -:10DDD00000000000000000000000000064000000DF -:10DDE000000000000100000000000080FFFFFF7F36 -:10DDF000000000000100000000000080FFFFFF7F26 -:10DE00000000000000000000000000000000000012 -:10DE10000000000000000000000000000000000002 -:10DE200000000000000000000000000000000000F2 -:10DE300000000000000000000000000000000000E2 -:10DE400000000000000000000000000000000000D2 -:10DE5000000000000000000000000000FFFFFF7F46 -:10DE600000000000000000000000000000000000B2 -:10DE700000000000000000000000000000000000A2 -:10DE80000000000000000000000000000000000092 -:10DE90000000000000000000000000000000000082 -:10DEA0000000000000000000000000000000000072 -:10DEB0000000000000000000000000000000000062 -:10DEC0000000000000000000000000000000000052 -:10DED0000000000000000000000000000000000042 -:10DEE0000000000000000000000000000000000032 -:10DEF0000000000000000000000000000000000022 -:10DF00000000000000000000000000000000000011 -:10DF10000000000000000000000000000000000001 -:10DF200000000000000000000000000000000000F1 -:10DF300000000000000000000000000000000000E1 -:10DF400000000000000000000000000000000000D1 -:10DF500000000000000000000000000000000000C1 -:10DF600000000000000000000000000000000000B1 -:10DF700000000000000000000000000000000000A1 -:10DF80000000000000000000000000000000000091 -:10DF90000000000000000000000000000000000081 -:10DFA0000000000000000000000000000000000071 -:10DFB00000000000000000000000000064000000FD -:10DFC000000000000000000000000000040000004D -:10DFD000000000000000000000000000040000003D -:10DFE000000000000000000000000000040000002D -:10DFF000000000000100000048F4FFFFB80B000023 -:10E00000000000000000000000000000FFFFFFFF14 -:10E01000000000000000000001000000E803000014 -:10E0200001000000000000000A000000881300004A -:10E03000E8030000000000000A0000008813000050 -:10E04000E8030000000000000000000004000000E1 -:10E050000000000000000000000000001027000089 -:10E06000A00F00000000000000000000E803000016 -:10E0700028000000000000000000000088130000DD -:10E08000C80000000000000001000000E8030000DC -:10E09000010000000000000000000000010000007E -:10E0A000010000000000000000000000A086010048 -:10E0B000102700000100000018FCFFFFE80300002B -:10E0C000000000000100000018FCFFFFE803000052 -:10E0D0000000000000000000000000001027000009 -:10E0E000E80300000000000000000000102700000E -:10E0F000E803000000000000000000000000000035 -:10E10000000000000000000000000000000000000F -:10E1100000000000000000000000000000000000FF -:10E1200000000000000000000000000000000000EF -:10E1300000000000000000000000000000000000DF -:10E1400000000000000000000000000000000000CF -:10E1500000000000000000000000000000000000BF -:10E1600000000000000000000000000000000000AF -:10E17000000000000000000000000000000000009F -:10E18000000000000000000000000000000000008F -:10E19000000000000000000000000000000000007F -:10E1A000000000000000000000000000000000006F -:10E1B000000000000000000000000000000000005F -:10E1C000000000000000000000000000000000004F -:10E1D000000000000000000000000000000000003F -:10E1E000000000000000000000000000000000002F -:10E1F000000000000000000000000000000000001F -:10E20000000000000000000000000000000000000E -:10E2100000000000000000000000000000000000FE -:10E2200000000000000000000000000000000000EE -:10E2300000000000000000000000000000000000DE -:10E2400000000000000000000000000000000000CE -:10E2500000000000000000000000000000000000BE -:10E2600000000000000000000000000000000000AE -:10E27000000000000000000000000000000000009E -:10E28000000000000000000000000000000000008E -:10E29000000000000000000000000000000000007E -:10E2A000000000000000000000000000000000006E -:10E2B000000000000000000000000000000000005E -:10E2C000000000000000000000000000000000004E -:10E2D000000000000000000000000000000000003E -:10E2E000000000000000000000000000000000002E -:10E2F000000000000000000000000000000000001E -:10E30000000000000000000000000000000000000D -:10E3100000000000000000000000000000000000FD -:10E3200000000000000000000000000000000000ED -:10E3300000000000000000000000000000000000DD -:10E3400000000000000000000000000000000000CD -:10E3500000000000000000000000000000000000BD -:10E3600000000000000000000000000000000000AD -:10E37000000000000000000000000000000000009D -:10E38000000000000000000000000000000000008D -:10E39000000000000000000000000000000000007D -:10E3A000000000000000000000000000000000006D -:10E3B000000000000000000000000000000000005D -:10E3C000000000000000000000000000000000004D -:10E3D000000000000000000000000000000000003D -:10E3E000000000000000000000000000000000002D -:10E3F000000000000000000000000000000000001D -:10E40000000000000000000000000000000000000C -:10E4100000000000000000000000000000000000FC -:10E4200000000000000000000000000000000000EC -:10E4300000000000000000000000000000000000DC -:10E4400000000000000000000000000000000000CC -:10E4500000000000000000000000000000000000BC -:10E4600000000000000000000000000000000000AC -:10E47000000000000000000000000000000000009C -:10E48000000000000000000000000000000000008C -:10E49000000000000000000000000000000000007C -:10E4A000000000000000000000000000000000006C -:10E4B000000000000000000000000000000000005C -:10E4C000000000000000000000000000000000004C -:10E4D000000000000000000000000000000000003C -:10E4E000000000000000000000000000000000002C -:10E4F000000000000000000000000000000000001C -:10E50000000000000000000000000000000000000B -:10E5100000000000000000000000000000000000FB -:10E5200000000000000000000000000000000000EB -:10E5300000000000000000000000000000000000DB -:10E5400000000000000000000000000000000000CB -:10E5500000000000000000000000000000000000BB -:10E5600000000000000000000000000000000000AB -:10E57000000000000000000000000000000000009B -:10E58000000000000000000000000000000000008B -:10E59000000000000000000000000000000000007B -:10E5A000000000000000000000000000000000006B -:10E5B000000000000000000000000000000000005B -:10E5C000000000000000000000000000000000004B -:10E5D000000000000000000000000000000000003B -:10E5E000000000000000000000000000000000002B -:10E5F000000000000000000000000000000000001B -:10E60000000000000000000000000000000000000A -:10E6100000000000000000000000000000000000FA -:10E6200000000000000000000000000000000000EA -:10E6300000000000000000000000000000000000DA -:10E6400000000000000000000000000000000000CA -:10E6500000000000000000000000000000000000BA -:10E6600000000000000000000000000000000000AA -:10E67000000000000000000000000000000000009A -:10E68000000000000000000000000000000000008A -:10E69000000000000000000000000000000000007A -:10E6A000000000000000000000000000000000006A -:10E6B000000000000000000000000000000000005A -:10E6C000000000000000000000000000000000004A -:10E6D000000000000000000000000000000000003A -:10E6E000000000000000000000000000000000002A -:10E6F000000000000000000000000000000000001A -:10E700000000000000000000000000000000000009 -:10E7100000000000000000000000000000000000F9 -:10E7200000000000000000000000000000000000E9 -:10E7300000000000000000000000000000000000D9 -:10E7400000000000000000000000000000000000C9 -:10E7500000000000000000000000000000000000B9 -:10E7600000000000000000000000000000000000A9 -:10E770000000000000000000000000000000000099 -:10E780000000000000000000000000000000000089 -:10E790000000000000000000000000000000000079 -:10E7A0000000000000000000000000000000000069 -:10E7B0000000000000000000000000000000000059 -:10E7C0000000000000000000000000000000000049 -:10E7D0000000000000000000000000000000000039 -:10E7E0000000000000000000000000000000000029 -:10E7F0000000000000000000000000000000000019 -:10E800000000000000000000000000000000000008 -:10E8100000000000000000000000000000000000F8 -:10E8200000000000000000000000000000000000E8 -:10E8300000000000000000000000000000000000D8 -:10E8400000000000000000000000000000000000C8 -:10E8500000000000000000000000000000000000B8 -:10E8600000000000000000000000000000000000A8 -:10E870000000000000000000000000000000000098 -:10E880000000000000000000000000000000000088 -:10E890000000000000000000000000000000000078 -:10E8A0000000000000000000000000000000000068 -:10E8B0000000000000000000000000000000000058 -:10E8C0000000000000000000000000000000000048 -:10E8D0000000000000000000000000000000000038 -:10E8E0000000000000000000000000000000000028 -:10E8F0000000000000000000000000000000000018 -:10E900000000000000000000000000000000000007 -:10E9100000000000000000000000000000000000F7 -:10E9200000000000000000000000000000000000E7 -:10E9300000000000000000000000000000000000D7 -:10E9400000000000000000000000000000000000C7 -:10E9500000000000000000000000000000000000B7 -:10E9600000000000000000000000000000000000A7 -:10E970000000000000000000000000000000000097 -:10E980000000000000000000000000000000000087 -:10E990000000000000000000000000000000000077 -:10E9A0000000000000000000000000000000000067 -:10E9B0000000000000000000000000000000000057 -:10E9C0000000000000000000000000000000000047 -:10E9D0000000000000000000000000000000000037 -:10E9E0000000000000000000000000000000000027 -:10E9F0000000000000000000000000000000000017 -:10EA00000000000000000000000000000000000006 -:10EA100000000000000000000000000000000000F6 -:10EA200000000000000000000000000000000000E6 -:10EA300000000000000000000000000000000000D6 -:10EA400000000000000000000000000000000000C6 -:10EA500000000000000000000000000000000000B6 -:10EA600000000000000000000000000000000000A6 -:10EA70000000000000000000000000000000000096 -:10EA80000000000000000000000000000000000086 -:10EA90000000000000000000000000000000000076 -:10EAA0000000000000000000000000000000000066 -:10EAB0000000000000000000000000000000000056 -:10EAC0000000000000000000000000000000000046 -:10EAD0000000000000000000000000000000000036 -:10EAE0000000000000000000000000000000000026 -:10EAF0000000000000000000000000000000000016 -:10EB00000000000000000000000000000000000005 -:10EB100000000000000000000000000000000000F5 -:10EB200000000000000000000000000000000000E5 -:10EB300000000000000000000000000000000000D5 -:10EB400000000000000000000000000000000000C5 -:10EB500000000000000000000000000000000000B5 -:10EB600000000000000000000000000000000000A5 -:10EB70000000000000000000000000000000000095 -:10EB80000000000000000000000000000000000085 -:10EB90000000000000000000000000000000000075 -:10EBA0000000000000000000000000000000000065 -:10EBB0000000000000000000000000000000000055 -:10EBC0000000000000000000000000000000000045 -:10EBD0000000000000000000000000000000000035 -:10EBE0000000000000000000000000000000000025 -:10EBF0000000000000000000000000000000000015 -:10EC00000000000000000000000000000000000004 -:10EC100000000000000000000000000000000000F4 -:10EC200000000000000000000000000000000000E4 -:10EC300000000000000000000000000000000000D4 -:10EC400000000000000000000000000000000000C4 -:10EC500000000000000000000000000000000000B4 -:10EC600000000000000000000000000000000000A4 -:10EC70000000000000000000000000000000000094 -:10EC80000000000000000000000000000000000084 -:10EC90000000000000000000000000000000000074 -:10ECA0000000000000000000000000000000000064 -:10ECB0000000000000000000000000000000000054 -:10ECC0000000000000000000000000000000000044 -:10ECD0000000000000000000000000000000000034 -:10ECE0000000000000000000000000000000000024 -:10ECF0000000000000000000000000000000000014 -:10ED00000000000000000000000000000000000003 -:10ED100000000000000000000000000000000000F3 -:10ED200000000000000000000000000000000000E3 -:10ED300000000000000000000000000000000000D3 -:10ED400000000000000000000000000000000000C3 -:10ED500000000000000000000000000000000000B3 -:10ED600000000000000000000000000000000000A3 -:10ED70000000000000000000000000000000000093 -:10ED80000000000000000000000000000000000083 -:10ED90000000000000000000000000000000000073 -:10EDA0000000000000000000000000000000000063 -:10EDB0000000000000000000000000000000000053 -:10EDC0000000000000000000000000000000000043 -:10EDD0000000000000000000000000000000000033 -:10EDE0000000000000000000000000000000000023 -:10EDF0000000000000000000000000000000000013 -:10EE00000000000000000000000000000000000002 -:10EE100000000000000000000000000000000000F2 -:10EE200000000000000000000000000000000000E2 -:10EE300000000000000000000000000000000000D2 -:10EE400000000000000000000000000000000000C2 -:10EE500000000000000000000000000000000000B2 -:10EE600000000000000000000000000000000000A2 -:10EE70000000000000000000000000000000000092 -:10EE80000000000000000000000000000000000082 -:10EE90000000000000000000000000000000000072 -:10EEA0000000000000000000000000000000000062 -:10EEB0000000000000000000000000000000000052 -:10EEC0000000000000000000000000000000000042 -:10EED0000000000000000000000000000000000032 -:10EEE0000000000000000000000000000000000022 -:10EEF0000000000000000000000000000000000012 -:10EF00000000000000000000000000000000000001 -:10EF100000000000000000000000000000000000F1 -:10EF200000000000000000000000000000000000E1 -:10EF300000000000000000000000000000000000D1 -:10EF400000000000000000000000000000000000C1 -:10EF500000000000000000000000000000000000B1 -:10EF600000000000000000000000000000000000A1 -:10EF70000000000000000000000000000000000091 -:10EF80000000000000000000000000000000000081 -:10EF90000000000000000000000000000000000071 -:10EFA0000000000000000000000000000000000061 -:10EFB0000000000000000000000000000000000051 -:10EFC0000000000000000000000000000000000041 -:10EFD0000000000000000000000000000000000031 -:10EFE0000000000000000000000000000000000021 -:10EFF0000000000000000000000000000000000011 -:10F000000000000000000000000000000000000000 -:10F0100000000000000000000000000000000000F0 -:10F0200000000000000000000000000000000000E0 -:10F0300000000000000000000000000000000000D0 -:10F0400000000000000000000000000000000000C0 -:10F0500000000000000000000000000000000000B0 -:10F0600000000000000000000000000000000000A0 -:10F070000000000000000000000000000000000090 -:10F080000000000000000000000000000000000080 -:10F090000000000000000000000000000000000070 -:10F0A0000000000000000000000000000000000060 -:10F0B0000000000000000000000000000000000050 -:10F0C0000000000000000000000000000000000040 -:10F0D0000000000000000000000000000000000030 -:10F0E0000000000000000000000000000000000020 -:10F0F0000000000000000000000000000000000010 -:10F1000000000000000000000000000000000000FF -:10F1100000000000000000000000000000000000EF -:10F1200000000000000000000000000000000000DF -:10F1300000000000000000000000000000000000CF -:10F1400000000000000000000000000000000000BF -:10F1500000000000000000000000000000000000AF -:10F16000000000000000000000000000000000009F -:10F17000000000000000000000000000000000008F -:10F18000000000000000000000000000000000007F -:10F19000000000000000000000000000000000006F -:10F1A000000000000000000000000000000000005F -:10F1B000000000000000000000000000000000004F -:10F1C000000000000000000000000000000000003F -:10F1D000000000000000000000000000000000002F -:10F1E000000000000000000000000000000000001F -:10F1F000000000000000000000000000000000000F -:10F2000000000000000000000000000000000000FE -:10F2100000000000000000000000000000000000EE -:10F2200000000000000000000000000000000000DE -:10F2300000000000000000000000000000000000CE -:10F2400000000000000000000000000000000000BE -:10F2500000000000000000000000000000000000AE -:10F26000000000000000000000000000000000009E -:10F27000000000000000000000000000000000008E -:10F28000000000000000000000000000000000007E -:10F29000000000000000000000000000000000006E -:10F2A000000000000000000000000000000000005E -:10F2B000000000000000000000000000000000004E -:10F2C000000000000000000000000000000000003E -:10F2D000000000000000000000000000000000002E -:10F2E000000000000000000000000000000000001E -:10F2F000000000000000000000000000000000000E -:10F3000000000000000000000000000000000000FD -:10F3100000000000000000000000000000000000ED -:10F3200000000000000000000000000000000000DD -:10F3300000000000000000000000000000000000CD -:10F3400000000000000000000000000000000000BD -:10F3500000000000000000000000000000000000AD -:10F36000000000000000000000000000000000009D -:10F37000000000000000000000000000000000008D -:10F380000000000045302D30312D474F412D4F50AA -:10F39000544943205631302E30312E303120202038 -:10F3A0002020202020202020FFFFFFFFFFFFFFFF65 -:10F3B000FFFFFFFF0100020003000400050006003C -:10F3C000010000000200000004000000080000002E -:10F3D000100000002000000040000000800000003D -:10F3E000000100000002000000040000000800000E -:10F3F000001000000020000000400000008000001D -:10F4000000000100000002000000040000000800ED -:10F4100000001000000020000000400000008000FC -:10F4200000000001000000020000000400000008CD -:10F4300000000010000000200000004000000080DC -:10F44000303132333435363738394142434445461A -:10F4500047484A4B4C4D4E505253545556575859A5 -:10F460000102030405060708090A0B0C0D0E0F1014 -:10F4700011121314040911050A0E10061203140BBD -:10F48000010D130F02070C080D070C040613030AE5 -:10F4900011140B120F050E02080109100A040B08C3 -:10F4A000100C05091113070E14030D010F020612AB -:10F4B000240D0020494E4600696E66004E414E0004 -:10F4C0006E616E00300030313233343536373839C2 -:10F4D00041424344454600303132333435363738C3 -:10F4E00039616263646566000020202020202020AE -:10F4F00020202828282828202020202020202020E4 -:10F5000020202020202020202088101010101010F3 -:10F51000101010101010101010040404040404043F -:10F5200004040410101010101010414141414141D9 -:10F5300001010101010101010101010101010101BB -:10F5400001010101101010101010424242424242CB -:10F55000020202020202020202020202020202028B -:10F560000202020210101010200000000000000033 -:10F57000000000000000000000000000000000008B -:10F58000000000000000000000000000000000007B -:10F59000000000000000000000000000000000006B -:10F5A000000000000000000000000000000000005B -:10F5B000000000000000000000000000000000004B -:10F5C000000000000000000000000000000000003B -:10F5D000000000000000000000000000000000002B -:10F5E000000000000000000000496E66696E69744A -:10F5F00079004E614E005245454E54206D616C6C51 -:10F600006F6320737563636565646564002F62755D -:10F61000696C642F676E752D746F6F6C732D666FD8 -:10F62000722D73746D33325F31302E332D323032A0 -:10F63000312E31302E32303231313130352D3131C1 -:10F6400030302F7372632F6E65776C69622F6E6531 -:10F65000776C69622F6C6962632F7374646C696282 -:10F660002F64746F612E630042616C6C6F63207352 -:10F670007563636565646564000000000000000058 -:10F68000000000000000000000000000000000007A -:10F69000000000000000000000000000000000006A -:10F6A000000000000000000000000000000000005A -:10F6B000000000000000000000000000000000004A -:10F6C000000000000000000000000000000000003A -:10F6D0000000000000000000000000002F627569BB -:10F6E0006C642F676E752D746F6F6C732D666F72FF -:10F6F0002D73746D33325F31302E332D3230323111 -:10F700002E31302E32303231313130352D313130F1 -:10F71000302F7372632F6E65776C69622F6E657719 -:10F720006C69622F6C6962632F7374646C69622FF9 -:10F730006D707265632E63000080E03779C34143CA -:10F74000176E05B5B5B89346F5F93FE9034F384D47 -:10F75000321D30F94877825A3CBF737FDD4F1575F3 -:10F76000000000000000F03F000000000000244006 -:10F7700000000000000059400000000000408F40E1 -:10F78000000000000088C34000000000006AF8404C -:10F790000000000080842E4100000000D012634170 -:10F7A0000000000084D797410000000065CDCD41E6 -:10F7B000000000205FA00242000000E876483742C7 -:10F7C000000000A2941A6D42000040E59C30A24265 -:10F7D0000000901EC4BCD64200003426F56B0C43DA -:10F7E0000080E03779C3414300A0D8855734764381 -:10F7F00000C84E676DC1AB43003D9160E458E143E2 -:10F80000408CB5781DAF154450EFE2D6E41A4B4456 -:10F8100092D54D06CFF08044F64AE1C7022DB5449B -:10F82000B49DD9794378EA4405000000190000002E -:10F830007D000000232D302B2000686C4C00656695 -:10F8400067454647002C2066756E6374696F6E3A93 -:10F850002000617373657274696F6E2022257322B4 -:10F86000206661696C65643A2066696C65202225B2 -:10F8700073222C206C696E65202564257325730A1C -:0CF88000004300504F534958002E000078 -:08F88C00EC13FD7F01000000F8 -:04F89400F501010871 -:04F89800D101010891 -:10F89C000024F4001000000001000000395C010895 -:10F8AC0001000000FFFFFFFF107AFF1F01000000A6 -:10F8BC000000000000000000C0A810FD881300002C -:10F8CC0000000000000000000000000000C000006C -:10F8DC00010257353530300000000000A9AD010899 -:10F8EC00B7AD0108C5AD0108D3AD0108E1AD010804 -:10F8FC00FBAD01080000000000000000474F41452F -:10F90C004D424F5301030502040806070000000096 -:10F91C0000000000000000000000000000000000DB -:10F92C0000000000000000000000000000000000CB -:10F93C0000000000000000000000000000000000BB -:10F94C0000000000000000000000000000000000AB -:10F95C00000000000000000000000000000000009B -:10F96C00000000000000000000000000000000008B -:10F97C00000000000000000000000000000000007B -:10F98C00000000000000000000000000000000006B -:10F99C00000000000000000000000000000000005B -:10F9AC00000000000000000000000000000000004B -:10F9BC00000000000000000000000000000000003B -:10F9CC00000000000000000000000000000000002B -:10F9DC00000000000000000000000000000000001B -:10F9EC00000000000000000000000000000000000B -:10F9FC0000000000000000000000000000000000FB -:10FA0C0000000000000000000000000000000000EA -:10FA1C0000000000000000000000000000000000DA -:10FA2C0000000000000000000000000000000000CA -:10FA3C0000000000000000000000000000000000BA -:10FA4C0000000000000000000000000000000000AA -:10FA5C00000000000000000000000000000000009A -:10FA6C00000000000000000000000000000000008A -:10FA7C00000000000000000000000000000000007A -:10FA8C00000000000000000000000000000000006A -:10FA9C00000000000000000000000000000000005A -:10FAAC00000000000000000000000000000000004A -:10FABC00000000000000000000000000000000003A -:10FACC00000000000000000000000000000000002A -:10FADC00000000000000000000000000000000001A -:10FAEC00000000000000000000000000000000000A -:10FAFC0000000000000000000000000000000000FA -:10FB0C0000000000000000000000000000000000E9 -:10FB1C0000000000000000000000000000000000D9 -:10FB2C0000000000000000000000000000000000C9 -:10FB3C0000000000000000000000000000000000B9 -:10FB4C0000000000000000000000000000000000A9 -:10FB5C000000000000000000000000000000000099 -:10FB6C000000000000000000000000000000000089 -:10FB7C000000000000000000000000000000000079 -:10FB8C000000000000000000000000000000000069 -:10FB9C000000000000000000000000000000000059 -:10FBAC000000000000000000000000000000000049 -:10FBBC000000000000000000000000000000000039 -:10FBCC000000000000000000000000000000000029 -:10FBDC000000000000000000000000000000000019 -:10FBEC000000000000000000000000000000000009 -:10FBFC0000000000000000000000000000000000F9 -:10FC0C0000000000000000000000000000000000E8 -:10FC1C0000000000000000000000000000000000D8 -:10FC2C0000000000000000000000000000000000C8 -:10FC3C0000000000000000000000000000000000B8 -:10FC4C0000000000000000000000000000000000A8 -:10FC5C000000000000000000000000000000000098 -:10FC6C000000000000000000000000000000000088 -:10FC7C000000000000000000000000000000000078 -:10FC8C000000000000000000000000000000000068 -:10FC9C000000000000000000000000000000000058 -:10FCAC000000000000000000000000000000000048 -:10FCBC000000000000000000000000000000000038 -:10FCCC000000000000000000000000000000000028 -:10FCDC000000000000000000000000000000000018 -:10FCEC000000000000000000000000000000000008 -:10FCFC000000000000000000000000006FAF0208D0 -:10FD0C006FAF02086FAF02086FAF02086FAF020847 -:10FD1C006FAF02086FAF02086FAF02086FAF020837 -:10FD2C006FAF02086FAF02086FAF02086FAF020827 -:10FD3C006FAF02086FAF02086FAF02086FAF020817 -:10FD4C006FAF02086FAF02086FAF02086FAF020807 -:10FD5C006FAF02086FAF02086FAF0208A861000016 -:10FD6C0050C30000A0860100A0860100D00700004F -:10FD7C00D0070000A89B0308A89B0308A89B0308B6 -:10FD8C00A89B0308A89B0308A89B0308A89B03082F -:10FD9C00A89B0308A89B0308A89B0308A89B03081F -:10FDAC00A89B0308A89B0308A89B0308A89B03080F -:10FDBC00A89B0308A89B0308A89B0308A89B0308FF -:10FDCC00A89B0308A89B0308A89B0308A89B0308EF -:10FDDC00A89B0308A89B0308A89B0308A89B0308DF -:10FDEC00A89B0308A89B0308A89B0308A89B0308CF -:10FDFC00A89B0308A89B0308A89B0308A89B0308BF -:10FE0C00A89B0308A89B0308A89B0308A89B0308AE -:10FE1C00A89B0308A89B0308A89B0308A89B03089E -:10FE2C00A89B0308A89B0308A89B0308A89B03088E -:10FE3C00A89B0308A89B0308A89B0308AC9B03087A -:10FE4C00B89B0308C49B0308A89B0308D49B030816 -:10FE5C00A89B0308A89B0308A89B0308A89B03085E -:10FE6C00A89B0308A89B0308A89B0308A89B03084E -:10FE7C00A89B0308A89B0308A89B0308A89B03083E -:10FE8C00A89B0308A89B0308A89B0308E49B0308F2 -:10FE9C00FC9B0308149C03082C9C0308449C03083B -:10FEAC005C9C0308749C03088C9C0308A49C0308AA -:10FEBC00B09C0308A89B0308A89B0308BC9C0308E0 -:10FECC00CC9C0308A89B0308A89B0308A89B0308C9 -:10FEDC00A89B0308A89B0308A89B0308A89B0308DE -:10FEEC00A89B0308A89B0308A89B0308A89B0308CE -:10FEFC00A89B0308A89B0308A89B0308A89B0308BE -:10FF0C00A89B0308DC9C0308EC9C0308FC9C0308DE -:10FF1C000C9D03081C9D03082C9D03083C9D0308A5 -:10FF2C004C9D03085C9D03086C9D0308809D030891 -:10FF3C00949D0308A89D0308BC9D0308D09D03084D -:10FF4C00E09D0308F09D0308049E0308149E03081B -:10FF5C00249E0308309E0308489E0308589E0308FD -:10FF6C00689E0308789E0308889E0308989E0308E1 -:10FF7C00A49E0308B49E0308C89E0308DC9E0308D5 -:10FF8C00F09E0308049F0308A89B0308A89B030882 -:10FF9C00A89B0308189F0308289F0308A89B030825 -:10FFAC00A89B0308A89B0308A89B0308A89B03080D -:10FFBC00A89B0308A89B0308A89B0308A89B0308FD -:10FFCC00A89B0308A89B0308A89B0308389F030859 -:10FFDC00489F0308589F0308689F0308789F0308ED -:10FFEC00A89B0308A89B0308A89B0308A89B0308CD -:04FFFC00A89B0308B3 -:020000040804EE -:10000000A89B0308A89B0308A89B03088C9F0308D0 -:100010009C9F0308B09F0308C49F0308D09F030858 -:10002000A89B0308A89B0308A89B0308A89B030898 -:10003000A89B0308DC9F0308A89B0308A89B030850 -:10004000A89B0308A89B0308A89B0308A89B030878 -:10005000A89B0308A89B0308A89B0308A89B030868 -:10006000A89B0308A89B0308A89B0308A89B030858 -:10007000A89B0308A89B0308A89B0308A89B030848 -:10008000A89B0308A89B0308A89B0308E89F0308F4 -:10009000F89F0308FC9F030800A0030804A00308BE -:1000A00014A0030820A0030830A0030844A00308FC -:1000B0005CA0030860A003087CA0030890A00308CC -:1000C000A89B03089CA00308ACA00308C0A00308D9 -:1000D000CCA00308D8A00308E8A00308A89B030845 -:1000E000A89B0308A89B0308A89B0308A89B0308D8 -:1000F000A89B0308A89B0308A89B0308A89B0308C8 -:10010000A89B0308A89B0308A89B0308A89B0308B7 -:10011000A89B0308A89B0308A89B0308A89B0308A7 -:10012000A89B0308A89B0308A89B0308A89B030897 -:10013000A89B0308A89B0308A89B0308A89B030887 -:10014000A89B0308A89B0308A89B0308A89B030877 -:10015000A89B0308A89B0308A89B0308A89B030867 -:10016000A89B0308A89B0308A89B0308A89B030857 -:10017000A89B0308A89B0308A89B0308F8A00308F2 -:10018000A89B0308A89B0308A89B0308A89B030837 -:10019000A89B0308A89B0308A89B0308A89B030827 -:1001A000A89B0308A89B0308A89B0308A89B030817 -:1001B000A89B0308A89B0308A89B0308A89B030807 -:1001C000A89B0308A89B0308A89B0308A89B0308F7 -:1001D000A89B0308A89B0308A89B0308A89B0308E7 -:1001E000A89B0308A89B0308A89B0308A89B0308D7 -:1001F000A89B0308A89B0308A89B0308A89B0308C7 -:10020000A89B0308A89B0308A89B0308A89B0308B6 -:10021000A89B0308A89B0308A89B0308A89B0308A6 -:10022000A89B0308A89B0308A89B0308A89B030896 -:10023000A89B0308A89B0308A89B0308A89B030886 -:10024000A89B0308A89B0308A89B0308A89B030876 -:10025000A89B0308A89B0308A89B0308A89B030866 -:10026000A89B0308A89B0308A89B0308A89B030856 -:10027000A89B0308A89B0308A89B0308A89B030846 -:10028000A89B0308A89B0308A89B0308A89B030836 -:10029000A89B0308A89B0308A89B0308A89B030826 -:1002A000A89B0308A89B0308A89B0308A89B030816 -:1002B000A89B0308A89B0308A89B0308A89B030806 -:1002C000A89B0308A89B0308A89B0308A89B0308F6 -:1002D000A89B0308A89B0308A89B0308A89B0308E6 -:1002E000A89B0308A89B0308A89B0308A89B0308D6 -:1002F000A89B0308A89B0308A89B0308A89B0308C6 -:10030000A89B0308A89B0308A89B0308A89B0308B5 -:10031000A89B0308A89B0308A89B0308A89B0308A5 -:10032000A89B0308A89B0308A89B0308A89B030895 -:10033000A89B0308A89B0308A89B0308A89B030885 -:10034000A89B0308A89B0308A89B0308A89B030875 -:10035000A89B0308A89B0308A89B0308A89B030865 -:10036000A89B0308A89B0308A89B0308A89B030855 -:10037000A89B0308A89B0308A89B0308A89B030845 -:10038000A89B0308A89B0308A89B0308A89B030835 -:10039000A89B0308A89B0308A89B0308A89B030825 -:1003A000A89B0308A89B0308A89B0308A89B030815 -:1003B000A89B0308A89B0308A89B0308A89B030805 -:1003C000A89B0308A89B0308A89B0308A89B0308F5 -:1003D000A89B0308A89B0308A89B0308A89B0308E5 -:1003E000A89B0308A89B0308A89B0308A89B0308D5 -:1003F000A89B0308A89B0308A89B0308A89B0308C5 -:10040000A89B0308A89B0308A89B0308A89B0308B4 -:10041000A89B0308A89B0308A89B0308A89B0308A4 -:10042000A89B0308A89B0308A89B0308A89B030894 -:10043000A89B0308A89B0308A89B0308A89B030884 -:10044000A89B0308A89B0308A89B0308A89B030874 -:10045000A89B0308A89B0308A89B0308A89B030864 -:10046000A89B0308A89B0308A89B0308A89B030854 -:10047000A89B0308A89B0308A89B0308A89B030844 -:10048000A89B0308A89B0308A89B0308A89B030834 -:10049000A89B0308A89B0308A89B0308A89B030824 -:1004A000A89B0308A89B0308A89B0308A89B030814 -:1004B000A89B0308A89B0308A89B0308A89B030804 -:1004C000A89B0308A89B0308A89B0308A89B0308F4 -:1004D000A89B0308A89B0308A89B0308A89B0308E4 -:1004E000A89B0308A89B0308A89B0308A89B0308D4 -:1004F000A89B0308A89B0308A89B0308A89B0308C4 -:10050000A89B0308A89B0308A89B0308A89B0308B3 -:10051000A89B0308A89B0308A89B0308A89B0308A3 -:10052000A89B0308A89B0308A89B0308A89B030893 -:10053000A89B0308A89B0308A89B0308A89B030883 -:10054000A89B0308A89B0308A89B0308A89B030873 -:10055000A89B0308A89B0308A89B0308A89B030863 -:10056000A89B0308A89B0308A89B0308A89B030853 -:10057000A89B0308A89B0308A89B0308F8A00308EE -:10058000FC3C0020FFFF0000000000000000000015 -:10059000000000000000000000000000000000005B -:1005A00000000000FFFFFFFFFFFFFFFFFFFFFFFF57 -:1005B000FFFFFFFFFFFFFFFFFFFFFFFF240D0020F6 -:1005C000000000009CF60308BCF603087CF6030854 -:1005D000000000000000000000000000000000001B -:1005E000000000000000000000000000000000000B -:1005F00000000000000000000000000000000000FB -:1006000000000000000000000000000000000000EA -:1006100000000000000000000000000000000000DA -:100620004300000000000000000000000000000087 -:1006300000000000000000000000000000000000BA -:100640004300000000000000000000000000000067 -:10065000000000000000000000000000000000009A -:100660004300000000000000000000000000000047 -:10067000000000000000000000000000000000007A -:100680004300000000000000000000000000000027 -:10069000000000000000000000000000000000005A -:1006A0004300000000000000000000000000000007 -:1006B000000000000000000000000000000000003A -:1006C00043000000000000000000000000000000E7 -:1006D000000000000000000000000000000000001A -:1006E00043000000000000000000000000000000C7 -:1006F00000000000000000000000000000000000FA -:100700002D7803083977030800000000E8F4030897 -:1007100089F8030880F8030880F8030880F80308C4 -:1007200080F8030880F8030880F8030880F80308BD -:1007300080F8030880F80308FFFFFFFFFFFFFFFFBB -:10074000FFFFFFFFFFFF0000010041534349490045 -:100750000000000000000000000000000000000099 -:100760000000000000000000000041534349490020 -:100770000000000000000000000000000000000079 -:0C0780000000000000000000000000006D -:0400000508012B952E -:00000001FF diff --git a/光纤布线机源码.rar b/光纤布线机源码.rar deleted file mode 100644 index 91e305f..0000000 Binary files a/光纤布线机源码.rar and /dev/null differ